00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <iostream>
00012 #include <fstream>
00013
00014 #include "FWCore/ServiceRegistry/interface/Service.h"
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016 #include "FWCore/Framework/interface/ESHandle.h"
00017
00018 #include "DQMServices/Core/interface/MonitorElement.h"
00019
00020 #include "DQMServices/Core/interface/DQMStore.h"
00021
00022 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
00023 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00024 #include "DataFormats/EcalDigi/interface/EBDataFrame.h"
00025 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00026 #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h"
00027 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
00028 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00029
00030 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
00031 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
00032 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
00033
00034 #include "DQM/EcalCommon/interface/Numbers.h"
00035
00036 #include "DQM/EcalBarrelMonitorTasks/interface/EBOccupancyTask.h"
00037
00038 EBOccupancyTask::EBOccupancyTask(const edm::ParameterSet& ps){
00039
00040 init_ = false;
00041
00042 dqmStore_ = edm::Service<DQMStore>().operator->();
00043
00044 prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00045
00046 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00047
00048 mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
00049
00050 EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");
00051 EBDigiCollection_ = ps.getParameter<edm::InputTag>("EBDigiCollection");
00052 EcalPnDiodeDigiCollection_ = ps.getParameter<edm::InputTag>("EcalPnDiodeDigiCollection");
00053 EcalRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalRecHitCollection");
00054 EcalTrigPrimDigiCollection_ = ps.getParameter<edm::InputTag>("EcalTrigPrimDigiCollection");
00055
00056 for (int i = 0; i < 36; i++) {
00057 meOccupancy_[i] = 0;
00058 meOccupancyMem_[i] = 0;
00059 meEBRecHitEnergy_[i] = 0;
00060 meSpectrum_[i] = 0;
00061 }
00062
00063 meEBRecHitSpectrum_ = 0;
00064
00065 meEBDigiOccupancy_ = 0;
00066 meEBDigiOccupancyProjEta_ = 0;
00067 meEBDigiOccupancyProjPhi_ = 0;
00068
00069 meEBRecHitOccupancy_ = 0;
00070 meEBRecHitOccupancyProjEta_ = 0;
00071 meEBRecHitOccupancyProjPhi_ = 0;
00072
00073 meEBRecHitOccupancyThr_ = 0;
00074 meEBRecHitOccupancyProjEtaThr_ = 0;
00075 meEBRecHitOccupancyProjPhiThr_ = 0;
00076
00077 meEBTrigPrimDigiOccupancy_ = 0;
00078 meEBTrigPrimDigiOccupancyProjEta_ = 0;
00079 meEBTrigPrimDigiOccupancyProjPhi_ = 0;
00080
00081 meEBTrigPrimDigiOccupancyThr_ = 0;
00082 meEBTrigPrimDigiOccupancyProjEtaThr_ = 0;
00083 meEBTrigPrimDigiOccupancyProjPhiThr_ = 0;
00084
00085 meEBTestPulseDigiOccupancy_ = 0;
00086 meEBLaserDigiOccupancy_ = 0;
00087 meEBPedestalDigiOccupancy_ = 0;
00088
00089 recHitEnergyMin_ = 0.300;
00090 trigPrimEtMin_ = 4.;
00091
00092 }
00093
00094 EBOccupancyTask::~EBOccupancyTask(){
00095
00096 }
00097
00098 void EBOccupancyTask::beginJob(void){
00099
00100 ievt_ = 0;
00101
00102 if ( dqmStore_ ) {
00103 dqmStore_->setCurrentFolder(prefixME_ + "/EBOccupancyTask");
00104 dqmStore_->rmdir(prefixME_ + "/EBOccupancyTask");
00105 }
00106
00107 }
00108
00109 void EBOccupancyTask::beginRun(const edm::Run& r, const edm::EventSetup& c) {
00110
00111 Numbers::initGeometry(c, false);
00112
00113 if ( ! mergeRuns_ ) this->reset();
00114
00115 }
00116
00117 void EBOccupancyTask::endRun(const edm::Run& r, const edm::EventSetup& c) {
00118
00119 }
00120
00121 void EBOccupancyTask::reset(void) {
00122
00123 for (int i = 0; i < 36; i++) {
00124 if ( meOccupancy_[i] ) meOccupancy_[i]->Reset();
00125 if ( meOccupancyMem_[i] ) meOccupancyMem_[i]->Reset();
00126 if ( meEBRecHitEnergy_[i] ) meEBRecHitEnergy_[i]->Reset();
00127 if ( meSpectrum_[i] ) meSpectrum_[i]->Reset();
00128 }
00129
00130 if ( meEBRecHitSpectrum_ ) meEBRecHitSpectrum_->Reset();
00131
00132 if ( meEBDigiOccupancy_ ) meEBDigiOccupancy_->Reset();
00133 if ( meEBDigiOccupancyProjEta_ ) meEBDigiOccupancyProjEta_->Reset();
00134 if ( meEBDigiOccupancyProjPhi_ ) meEBDigiOccupancyProjPhi_->Reset();
00135
00136 if ( meEBRecHitOccupancy_ ) meEBRecHitOccupancy_->Reset();
00137 if ( meEBRecHitOccupancyProjEta_ ) meEBRecHitOccupancyProjEta_->Reset();
00138 if ( meEBRecHitOccupancyProjPhi_ ) meEBRecHitOccupancyProjPhi_->Reset();
00139
00140 if ( meEBRecHitOccupancyThr_ ) meEBRecHitOccupancyThr_->Reset();
00141 if ( meEBRecHitOccupancyProjEtaThr_ ) meEBRecHitOccupancyProjEtaThr_->Reset();
00142 if ( meEBRecHitOccupancyProjPhiThr_ ) meEBRecHitOccupancyProjPhiThr_->Reset();
00143
00144 if ( meEBTrigPrimDigiOccupancy_ ) meEBTrigPrimDigiOccupancy_->Reset();
00145 if ( meEBTrigPrimDigiOccupancyProjEta_ ) meEBTrigPrimDigiOccupancyProjEta_->Reset();
00146 if ( meEBTrigPrimDigiOccupancyProjPhi_ ) meEBTrigPrimDigiOccupancyProjPhi_->Reset();
00147
00148 if ( meEBTrigPrimDigiOccupancyThr_ ) meEBTrigPrimDigiOccupancyThr_->Reset();
00149 if ( meEBTrigPrimDigiOccupancyProjEtaThr_ ) meEBTrigPrimDigiOccupancyProjEtaThr_->Reset();
00150 if ( meEBTrigPrimDigiOccupancyProjPhiThr_ ) meEBTrigPrimDigiOccupancyProjPhiThr_->Reset();
00151
00152 if ( meEBTestPulseDigiOccupancy_ ) meEBTestPulseDigiOccupancy_->Reset();
00153 if ( meEBLaserDigiOccupancy_ ) meEBLaserDigiOccupancy_->Reset();
00154 if ( meEBPedestalDigiOccupancy_ ) meEBPedestalDigiOccupancy_->Reset();
00155
00156 }
00157
00158 void EBOccupancyTask::setup(void){
00159
00160 init_ = true;
00161
00162 char histo[200];
00163
00164 if ( dqmStore_ ) {
00165 dqmStore_->setCurrentFolder(prefixME_ + "/EBOccupancyTask");
00166
00167 for (int i = 0; i < 36; i++) {
00168 sprintf(histo, "EBOT digi occupancy %s", Numbers::sEB(i+1).c_str());
00169 meOccupancy_[i] = dqmStore_->book2D(histo, histo, 85, 0., 85., 20, 0., 20.);
00170 meOccupancy_[i]->setAxisTitle("ieta", 1);
00171 meOccupancy_[i]->setAxisTitle("iphi", 2);
00172 dqmStore_->tag(meOccupancy_[i], i+1);
00173
00174 sprintf(histo, "EBOT MEM digi occupancy %s", Numbers::sEB(i+1).c_str());
00175 meOccupancyMem_[i] = dqmStore_->book2D(histo, histo, 10, 0., 10., 5, 0., 5.);
00176 meOccupancyMem_[i]->setAxisTitle("pseudo-strip", 1);
00177 meOccupancyMem_[i]->setAxisTitle("channel", 2);
00178 dqmStore_->tag(meOccupancyMem_[i], i+1);
00179
00180 sprintf(histo, "EBOT rec hit energy %s", Numbers::sEB(i+1).c_str());
00181 meEBRecHitEnergy_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 100, 0., 100., "s");
00182 meEBRecHitEnergy_[i]->setAxisTitle("ieta", 1);
00183 meEBRecHitEnergy_[i]->setAxisTitle("iphi", 2);
00184 meEBRecHitEnergy_[i]->setAxisTitle("energy (GeV)", 3);
00185 dqmStore_->tag(meEBRecHitEnergy_[i], i+1);
00186
00187 sprintf(histo, "EBOT energy spectrum %s", Numbers::sEB(i+1).c_str());
00188 meSpectrum_[i] = dqmStore_->book1D(histo, histo, 100, 0., 1.5);
00189 meSpectrum_[i]->setAxisTitle("energy (GeV)", 1);
00190 dqmStore_->tag(meSpectrum_[i], i+1);
00191 }
00192
00193 sprintf(histo, "EBOT rec hit spectrum");
00194 meEBRecHitSpectrum_ = dqmStore_->book1D(histo, histo, 100, 0., 10.);
00195 meEBRecHitSpectrum_->setAxisTitle("energy (GeV)", 1);
00196
00197 sprintf(histo, "EBOT digi occupancy");
00198 meEBDigiOccupancy_ = dqmStore_->book2D(histo, histo, 72, 0., 360., 34, -85., 85.);
00199 meEBDigiOccupancy_->setAxisTitle("jphi", 1);
00200 meEBDigiOccupancy_->setAxisTitle("jeta", 2);
00201 sprintf(histo, "EBOT digi occupancy projection eta");
00202 meEBDigiOccupancyProjEta_ = dqmStore_->book1DD(histo, histo, 34, -85., 85.);
00203 meEBDigiOccupancyProjEta_->setAxisTitle("jeta", 1);
00204 meEBDigiOccupancyProjEta_->setAxisTitle("number of digis", 2);
00205 sprintf(histo, "EBOT digi occupancy projection phi");
00206 meEBDigiOccupancyProjPhi_ = dqmStore_->book1DD(histo, histo, 72, 0., 360.);
00207 meEBDigiOccupancyProjPhi_->setAxisTitle("jphi", 1);
00208 meEBDigiOccupancyProjPhi_->setAxisTitle("number of digis", 2);
00209
00210 sprintf(histo, "EBOT rec hit occupancy");
00211 meEBRecHitOccupancy_ = dqmStore_->book2D(histo, histo, 72, 0., 360., 34, -85., 85.);
00212 meEBRecHitOccupancy_->setAxisTitle("jphi", 1);
00213 meEBRecHitOccupancy_->setAxisTitle("jeta", 2);
00214 sprintf(histo, "EBOT rec hit occupancy projection eta");
00215 meEBRecHitOccupancyProjEta_ = dqmStore_->book1DD(histo, histo, 34, -85., 85.);
00216 meEBRecHitOccupancyProjEta_->setAxisTitle("jeta", 1);
00217 meEBRecHitOccupancyProjEta_->setAxisTitle("number of hits", 2);
00218 sprintf(histo, "EBOT rec hit occupancy projection phi");
00219 meEBRecHitOccupancyProjPhi_ = dqmStore_->book1DD(histo, histo, 72, 0., 360.);
00220 meEBRecHitOccupancyProjPhi_->setAxisTitle("jphi", 1);
00221 meEBRecHitOccupancyProjPhi_->setAxisTitle("number of hits", 2);
00222
00223 sprintf(histo, "EBOT rec hit thr occupancy");
00224 meEBRecHitOccupancyThr_ = dqmStore_->book2D(histo, histo, 72, 0., 360., 34, -85., 85.);
00225 meEBRecHitOccupancyThr_->setAxisTitle("jphi", 1);
00226 meEBRecHitOccupancyThr_->setAxisTitle("jeta", 2);
00227 sprintf(histo, "EBOT rec hit thr occupancy projection eta");
00228 meEBRecHitOccupancyProjEtaThr_ = dqmStore_->book1DD(histo, histo, 34, -85., 85.);
00229 meEBRecHitOccupancyProjEtaThr_->setAxisTitle("jeta", 1);
00230 meEBRecHitOccupancyProjEtaThr_->setAxisTitle("number of hits", 2);
00231 sprintf(histo, "EBOT rec hit thr occupancy projection phi");
00232 meEBRecHitOccupancyProjPhiThr_ = dqmStore_->book1DD(histo, histo, 72, 0., 360.);
00233 meEBRecHitOccupancyProjPhiThr_->setAxisTitle("jphi", 1);
00234 meEBRecHitOccupancyProjPhiThr_->setAxisTitle("number of hits", 2);
00235
00236 sprintf(histo, "EBOT TP digi occupancy");
00237 meEBTrigPrimDigiOccupancy_ = dqmStore_->book2D(histo, histo, 72, 0., 72., 34, -17., 17.);
00238 meEBTrigPrimDigiOccupancy_->setAxisTitle("jphi'", 1);
00239 meEBTrigPrimDigiOccupancy_->setAxisTitle("jeta'", 2);
00240 sprintf(histo, "EBOT TP digi occupancy projection eta");
00241 meEBTrigPrimDigiOccupancyProjEta_ = dqmStore_->book1DD(histo, histo, 34, -17., 17.);
00242 meEBTrigPrimDigiOccupancyProjEta_->setAxisTitle("jeta'", 1);
00243 meEBTrigPrimDigiOccupancyProjEta_->setAxisTitle("number of TP digis", 2);
00244 sprintf(histo, "EBOT TP digi occupancy projection phi");
00245 meEBTrigPrimDigiOccupancyProjPhi_ = dqmStore_->book1DD(histo, histo, 72, 0., 72.);
00246 meEBTrigPrimDigiOccupancyProjPhi_->setAxisTitle("jphi'", 1);
00247 meEBTrigPrimDigiOccupancyProjPhi_->setAxisTitle("number of TP digis", 2);
00248
00249 sprintf(histo, "EBOT TP digi thr occupancy");
00250 meEBTrigPrimDigiOccupancyThr_ = dqmStore_->book2D(histo, histo, 72, 0., 72., 34, -17., 17.);
00251 meEBTrigPrimDigiOccupancyThr_->setAxisTitle("jphi'", 1);
00252 meEBTrigPrimDigiOccupancyThr_->setAxisTitle("jeta'", 2);
00253 sprintf(histo, "EBOT TP digi thr occupancy projection eta");
00254 meEBTrigPrimDigiOccupancyProjEtaThr_ = dqmStore_->book1DD(histo, histo, 34, -17., 17.);
00255 meEBTrigPrimDigiOccupancyProjEtaThr_->setAxisTitle("jeta'", 1);
00256 meEBTrigPrimDigiOccupancyProjEtaThr_->setAxisTitle("number of TP digis", 2);
00257 sprintf(histo, "EBOT TP digi thr occupancy projection phi");
00258 meEBTrigPrimDigiOccupancyProjPhiThr_ = dqmStore_->book1DD(histo, histo, 72, 0., 72.);
00259 meEBTrigPrimDigiOccupancyProjPhiThr_->setAxisTitle("jphi'", 1);
00260 meEBTrigPrimDigiOccupancyProjPhiThr_->setAxisTitle("number of TP digis", 2);
00261
00262 sprintf(histo, "EBOT test pulse digi occupancy");
00263 meEBTestPulseDigiOccupancy_ = dqmStore_->book2D(histo, histo, 72, 0., 360., 34, -85., 85.);
00264 meEBTestPulseDigiOccupancy_->setAxisTitle("jphi'", 1);
00265 meEBTestPulseDigiOccupancy_->setAxisTitle("jeta'", 2);
00266
00267 sprintf(histo, "EBOT laser digi occupancy");
00268 meEBLaserDigiOccupancy_ = dqmStore_->book2D(histo, histo, 72, 0., 360., 34, -85., 85.);
00269 meEBLaserDigiOccupancy_->setAxisTitle("jphi'", 1);
00270 meEBLaserDigiOccupancy_->setAxisTitle("jeta'", 2);
00271
00272 sprintf(histo, "EBOT pedestal digi occupancy");
00273 meEBPedestalDigiOccupancy_ = dqmStore_->book2D(histo, histo, 72, 0., 360., 34, -85., 85.);
00274 meEBPedestalDigiOccupancy_->setAxisTitle("jphi'", 1);
00275 meEBPedestalDigiOccupancy_->setAxisTitle("jeta'", 2);
00276
00277 }
00278
00279 }
00280
00281 void EBOccupancyTask::cleanup(void){
00282
00283 if ( ! init_ ) return;
00284
00285 if ( dqmStore_ ) {
00286 dqmStore_->setCurrentFolder(prefixME_ + "/EBOccupancyTask");
00287
00288 for (int i = 0; i < 36; i++) {
00289 if ( meOccupancy_[i] ) dqmStore_->removeElement( meOccupancy_[i]->getName() );
00290 meOccupancy_[i] = 0;
00291 if ( meOccupancyMem_[i] ) dqmStore_->removeElement( meOccupancyMem_[i]->getName() );
00292 meOccupancyMem_[i] = 0;
00293 if ( meEBRecHitEnergy_[i] ) dqmStore_->removeElement( meEBRecHitEnergy_[i]->getName() );
00294 meEBRecHitEnergy_[i] = 0;
00295 if ( meSpectrum_[i] ) dqmStore_->removeElement( meSpectrum_[i]->getName() );
00296 meSpectrum_[i] = 0;
00297 }
00298
00299 if ( meEBRecHitSpectrum_ ) dqmStore_->removeElement( meEBRecHitSpectrum_->getName() );
00300 meEBRecHitSpectrum_ = 0;
00301
00302 if ( meEBDigiOccupancy_ ) dqmStore_->removeElement( meEBDigiOccupancy_->getName() );
00303 meEBDigiOccupancy_ = 0;
00304 if ( meEBDigiOccupancyProjEta_ ) dqmStore_->removeElement( meEBDigiOccupancyProjEta_->getName() );
00305 meEBDigiOccupancyProjEta_ = 0;
00306 if ( meEBDigiOccupancyProjPhi_ ) dqmStore_->removeElement( meEBDigiOccupancyProjPhi_->getName() );
00307 meEBDigiOccupancyProjPhi_ = 0;
00308
00309 if ( meEBRecHitOccupancy_ ) dqmStore_->removeElement( meEBRecHitOccupancy_->getName() );
00310 meEBRecHitOccupancy_ = 0;
00311 if ( meEBRecHitOccupancyProjEta_ ) dqmStore_->removeElement( meEBRecHitOccupancyProjEta_->getName() );
00312 meEBRecHitOccupancyProjEta_ = 0;
00313 if ( meEBRecHitOccupancyProjPhi_ ) dqmStore_->removeElement( meEBRecHitOccupancyProjPhi_->getName() );
00314 meEBRecHitOccupancyProjPhi_ = 0;
00315
00316 if ( meEBRecHitOccupancyThr_ ) dqmStore_->removeElement( meEBRecHitOccupancyThr_->getName() );
00317 meEBRecHitOccupancyThr_ = 0;
00318 if ( meEBRecHitOccupancyProjEtaThr_ ) dqmStore_->removeElement( meEBRecHitOccupancyProjEtaThr_->getName() );
00319 meEBRecHitOccupancyProjEtaThr_ = 0;
00320 if ( meEBRecHitOccupancyProjPhiThr_ ) dqmStore_->removeElement( meEBRecHitOccupancyProjPhiThr_->getName() );
00321 meEBRecHitOccupancyProjPhiThr_ = 0;
00322
00323 if ( meEBTrigPrimDigiOccupancy_ ) dqmStore_->removeElement( meEBTrigPrimDigiOccupancy_->getName() );
00324 meEBTrigPrimDigiOccupancy_ = 0;
00325 if ( meEBTrigPrimDigiOccupancyProjEta_ ) dqmStore_->removeElement( meEBTrigPrimDigiOccupancyProjEta_->getName() );
00326 meEBTrigPrimDigiOccupancyProjEta_ = 0;
00327 if ( meEBTrigPrimDigiOccupancyProjPhi_ ) dqmStore_->removeElement( meEBTrigPrimDigiOccupancyProjPhi_->getName() );
00328 meEBTrigPrimDigiOccupancyProjPhi_ = 0;
00329
00330 if ( meEBTrigPrimDigiOccupancyThr_ ) dqmStore_->removeElement( meEBTrigPrimDigiOccupancyThr_->getName() );
00331 meEBTrigPrimDigiOccupancyThr_ = 0;
00332 if ( meEBTrigPrimDigiOccupancyProjEtaThr_ ) dqmStore_->removeElement( meEBTrigPrimDigiOccupancyProjEtaThr_->getName() );
00333 meEBTrigPrimDigiOccupancyProjEtaThr_ = 0;
00334 if ( meEBTrigPrimDigiOccupancyProjPhiThr_ ) dqmStore_->removeElement( meEBTrigPrimDigiOccupancyProjPhiThr_->getName() );
00335 meEBTrigPrimDigiOccupancyProjPhiThr_ = 0;
00336
00337 if ( meEBTestPulseDigiOccupancy_ ) dqmStore_->removeElement( meEBTestPulseDigiOccupancy_->getName() );
00338 meEBTestPulseDigiOccupancy_ = 0;
00339
00340 if ( meEBLaserDigiOccupancy_ ) dqmStore_->removeElement( meEBLaserDigiOccupancy_->getName() );
00341 meEBLaserDigiOccupancy_ = 0;
00342
00343 if ( meEBPedestalDigiOccupancy_ ) dqmStore_->removeElement( meEBPedestalDigiOccupancy_->getName() );
00344 meEBPedestalDigiOccupancy_ = 0;
00345
00346 }
00347
00348 init_ = false;
00349
00350 }
00351
00352 void EBOccupancyTask::endJob(void) {
00353
00354 edm::LogInfo("EBOccupancyTask") << "analyzed " << ievt_ << " events";
00355
00356 if ( enableCleanup_ ) this->cleanup();
00357
00358 }
00359
00360 void EBOccupancyTask::analyze(const edm::Event& e, const edm::EventSetup& c){
00361
00362 if ( ! init_ ) this->setup();
00363
00364 ievt_++;
00365
00366 int runType[36] = { notdata };
00367
00368 edm::Handle<EcalRawDataCollection> dcchs;
00369
00370 if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
00371
00372 for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
00373
00374 if ( Numbers::subDet( *dcchItr ) != EcalBarrel ) continue;
00375
00376 int ism = Numbers::iSM( *dcchItr, EcalBarrel );
00377
00378 int runtype = dcchItr->getRunType();
00379
00380 if ( runtype == EcalDCCHeaderBlock::COSMIC ||
00381 runtype == EcalDCCHeaderBlock::MTCC ||
00382 runtype == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
00383 runtype == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
00384 runtype == EcalDCCHeaderBlock::COSMICS_LOCAL ||
00385 runtype == EcalDCCHeaderBlock::PHYSICS_LOCAL ) runType[ism-1] = physics;
00386 if ( runtype == EcalDCCHeaderBlock::TESTPULSE_MGPA ||
00387 runtype == EcalDCCHeaderBlock::TESTPULSE_GAP ) runType[ism-1] = testpulse;
00388 if ( runtype == EcalDCCHeaderBlock::LASER_STD ||
00389 runtype == EcalDCCHeaderBlock::LASER_GAP ) runType[ism-1] = laser;
00390 if ( runtype == EcalDCCHeaderBlock::PEDESTAL_STD ||
00391 runtype == EcalDCCHeaderBlock::PEDESTAL_GAP ) runType[ism-1] = pedestal;
00392
00393 }
00394
00395 } else {
00396 edm::LogWarning("EBOccupancyTask") << EcalRawDataCollection_ << " not available";
00397 }
00398
00399 edm::Handle<EBDigiCollection> digis;
00400
00401 if ( e.getByLabel(EBDigiCollection_, digis) ) {
00402
00403 int nebd = digis->size();
00404 LogDebug("EBOccupancyTask") << "event " << ievt_ << " digi collection size " << nebd;
00405
00406 for ( EBDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
00407
00408 EBDetId id = digiItr->id();
00409
00410 int ic = id.ic();
00411 int ie = (ic-1)/20 + 1;
00412 int ip = (ic-1)%20 + 1;
00413
00414 int ism = Numbers::iSM( id );
00415
00416 float xie = ie - 0.5;
00417 float xip = ip - 0.5;
00418
00419 if ( xie <= 0. || xie >= 85. || xip <= 0. || xip >= 20. ) {
00420 edm::LogWarning("EBOccupancyTask") << " det id = " << id;
00421 edm::LogWarning("EBOccupancyTask") << " sm, ieta, iphi " << ism << " " << ie << " " << ip;
00422 edm::LogWarning("EBOccupancyTask") << " xie, xip " << xie << " " << xip;
00423 }
00424
00425 if ( meOccupancy_[ism-1] ) meOccupancy_[ism-1]->Fill(xie, xip);
00426
00427 int ebeta = id.ieta();
00428 int ebphi = id.iphi();
00429
00430 float xebeta = ebeta - 0.5*id.zside();
00431 float xebphi = ebphi - 0.5;
00432
00433 if ( runType[ism-1] == physics || runType[ism-1] == notdata ) {
00434
00435 if ( meEBDigiOccupancy_ ) meEBDigiOccupancy_->Fill( xebphi, xebeta );
00436 if ( meEBDigiOccupancyProjEta_ ) meEBDigiOccupancyProjEta_->Fill( xebeta );
00437 if ( meEBDigiOccupancyProjPhi_ ) meEBDigiOccupancyProjPhi_->Fill( xebphi );
00438
00439 }
00440
00441 if ( runType[ism-1] == testpulse ) {
00442
00443 if ( meEBTestPulseDigiOccupancy_ ) meEBTestPulseDigiOccupancy_->Fill( xebphi, xebeta );
00444
00445 }
00446
00447 if ( runType[ism-1] == laser ) {
00448
00449 if ( meEBLaserDigiOccupancy_ ) meEBLaserDigiOccupancy_->Fill( xebphi, xebeta );
00450
00451 }
00452
00453 if ( runType[ism-1] == pedestal ) {
00454
00455 if ( meEBPedestalDigiOccupancy_ ) meEBPedestalDigiOccupancy_->Fill( xebphi, xebeta );
00456
00457 }
00458
00459 }
00460
00461 } else {
00462
00463 edm::LogWarning("EBOccupancyTask") << EBDigiCollection_ << " not available";
00464
00465 }
00466
00467 edm::Handle<EcalPnDiodeDigiCollection> PNs;
00468
00469 if ( e.getByLabel(EcalPnDiodeDigiCollection_, PNs) ) {
00470
00471
00472
00473
00474 for ( EcalPnDiodeDigiCollection::const_iterator pnItr = PNs->begin(); pnItr != PNs->end(); ++pnItr ) {
00475
00476 if ( Numbers::subDet( pnItr->id() ) != EcalBarrel ) continue;
00477
00478 int ism = Numbers::iSM( pnItr->id() );
00479
00480 float PnId = pnItr->id().iPnId();
00481
00482 PnId = PnId - 0.5;
00483 float st = 0.0;
00484
00485 for (int chInStrip = 1; chInStrip <= 5; chInStrip++){
00486 if ( meOccupancyMem_[ism-1] ) {
00487 st = chInStrip - 0.5;
00488 meOccupancyMem_[ism-1]->Fill(PnId, st);
00489 }
00490 }
00491
00492 }
00493
00494 } else {
00495
00496 edm::LogWarning("EBOccupancyTask") << EcalPnDiodeDigiCollection_ << " not available";
00497
00498 }
00499
00500
00501 edm::ESHandle<EcalChannelStatus> pChannelStatus;
00502 c.get<EcalChannelStatusRcd>().get(pChannelStatus);
00503 const EcalChannelStatus* chStatus = pChannelStatus.product();
00504
00505 edm::Handle<EcalRecHitCollection> rechits;
00506
00507 if ( e.getByLabel(EcalRecHitCollection_, rechits) ) {
00508
00509 int nebrh = rechits->size();
00510 LogDebug("EBOccupancyTask") << "event " << ievt_ << " rec hits collection size " << nebrh;
00511
00512 for ( EcalRecHitCollection::const_iterator rechitItr = rechits->begin(); rechitItr != rechits->end(); ++rechitItr ) {
00513
00514 EBDetId id = rechitItr->id();
00515
00516
00517 int ebeta = id.ieta();
00518 int ebphi = id.iphi();
00519
00520 float xebeta = ebeta - 0.5*id.zside();
00521 float xebphi = ebphi - 0.5;
00522
00523 int ism = Numbers::iSM( id );
00524
00525
00526 int ic = id.ic();
00527 int ie = (ic-1)/20 + 1;
00528 int ip = (ic-1)%20 + 1;
00529
00530 float xie = ie - 0.5;
00531 float xip = ip - 0.5;
00532
00533 if ( runType[ism-1] == physics || runType[ism-1] == notdata ) {
00534
00535 if ( meEBRecHitOccupancy_ ) meEBRecHitOccupancy_->Fill( xebphi, xebeta );
00536 if ( meEBRecHitOccupancyProjEta_ ) meEBRecHitOccupancyProjEta_->Fill( xebeta );
00537 if ( meEBRecHitOccupancyProjPhi_ ) meEBRecHitOccupancyProjPhi_->Fill( xebphi );
00538
00539 uint32_t flag = rechitItr->recoFlag();
00540 uint32_t sev = EcalSeverityLevelAlgo::severityLevel( id, *rechits, *chStatus );
00541
00542 if ( rechitItr->energy() > recHitEnergyMin_ && flag == EcalRecHit::kGood && sev == EcalSeverityLevelAlgo::kGood ) {
00543
00544 if ( meEBRecHitOccupancyThr_ ) meEBRecHitOccupancyThr_->Fill( xebphi, xebeta );
00545 if ( meEBRecHitOccupancyProjEtaThr_ ) meEBRecHitOccupancyProjEtaThr_->Fill( xebeta );
00546 if ( meEBRecHitOccupancyProjPhiThr_ ) meEBRecHitOccupancyProjPhiThr_->Fill( xebphi );
00547
00548 }
00549
00550 if ( flag == EcalRecHit::kGood && sev == EcalSeverityLevelAlgo::kGood ) {
00551 if ( meEBRecHitEnergy_[ism-1] ) meEBRecHitEnergy_[ism-1]->Fill( xie, xip, rechitItr->energy() );
00552 if ( meSpectrum_[ism-1] ) meSpectrum_[ism-1]->Fill( rechitItr->energy() );
00553 if ( meEBRecHitSpectrum_ ) meEBRecHitSpectrum_->Fill( rechitItr->energy() );
00554 }
00555
00556 }
00557 }
00558
00559 } else {
00560
00561 edm::LogWarning("EBOccupancyTask") << EcalRecHitCollection_ << " not available";
00562
00563 }
00564
00565 edm::Handle<EcalTrigPrimDigiCollection> trigPrimDigis;
00566
00567 if ( e.getByLabel(EcalTrigPrimDigiCollection_, trigPrimDigis) ) {
00568
00569 int nebtpg = trigPrimDigis->size();
00570 LogDebug("EBOccupancyTask") << "event " << ievt_ << " trigger primitives digis collection size " << nebtpg;
00571
00572 for ( EcalTrigPrimDigiCollection::const_iterator tpdigiItr = trigPrimDigis->begin(); tpdigiItr != trigPrimDigis->end(); ++tpdigiItr ) {
00573
00574 if ( Numbers::subDet( tpdigiItr->id() ) != EcalBarrel ) continue;
00575
00576 int ebeta = tpdigiItr->id().ieta();
00577 int ebphi = tpdigiItr->id().iphi();
00578
00579
00580
00581 ebphi = ebphi + 2;
00582 if ( ebphi > 72 ) ebphi = ebphi - 72;
00583
00584 float xebeta = ebeta-0.5*tpdigiItr->id().zside();
00585 float xebphi = ebphi-0.5;
00586
00587 int ism = Numbers::iSM( tpdigiItr->id() );
00588
00589 if ( runType[ism-1] == physics || runType[ism-1] == notdata ) {
00590
00591 if ( meEBTrigPrimDigiOccupancy_ ) meEBTrigPrimDigiOccupancy_->Fill( xebphi, xebeta );
00592 if ( meEBTrigPrimDigiOccupancyProjEta_ ) meEBTrigPrimDigiOccupancyProjEta_->Fill( xebeta );
00593 if ( meEBTrigPrimDigiOccupancyProjPhi_ ) meEBTrigPrimDigiOccupancyProjPhi_->Fill( xebphi );
00594
00595 if ( tpdigiItr->compressedEt() > trigPrimEtMin_ ) {
00596
00597 if ( meEBTrigPrimDigiOccupancyThr_ ) meEBTrigPrimDigiOccupancyThr_->Fill( xebphi, xebeta );
00598 if ( meEBTrigPrimDigiOccupancyProjEtaThr_ ) meEBTrigPrimDigiOccupancyProjEtaThr_->Fill( xebeta );
00599 if ( meEBTrigPrimDigiOccupancyProjPhiThr_ ) meEBTrigPrimDigiOccupancyProjPhiThr_->Fill( xebphi );
00600
00601 }
00602 }
00603 }
00604
00605 } else {
00606
00607 edm::LogWarning("EBOccupancyTask") << EcalTrigPrimDigiCollection_ << " not available";
00608
00609 }
00610
00611 }
00612