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