00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <vector>
00012
00013 #include "FWCore/ServiceRegistry/interface/Service.h"
00014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00015
00016 #include "DataFormats/Common/interface/TriggerResults.h"
00017 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00018 #include "DQMServices/Core/interface/MonitorElement.h"
00019 #include "DQMServices/Core/interface/DQMStore.h"
00020
00021 #include "DQM/EcalCommon/interface/Numbers.h"
00022
00023 #include "DQM/EcalEndcapMonitorTasks/interface/EETriggerTowerTask.h"
00024 #include "FWCore/Common/interface/TriggerNames.h"
00025
00026 #include <iostream>
00027
00028 const int EETriggerTowerTask::nTTEta = 20;
00029 const int EETriggerTowerTask::nTTPhi = 20;
00030 const int EETriggerTowerTask::nSM = 18;
00031
00032 EETriggerTowerTask::EETriggerTowerTask(const edm::ParameterSet& ps) {
00033
00034 init_ = false;
00035
00036 dqmStore_ = edm::Service<DQMStore>().operator->();
00037
00038 prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00039
00040 mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
00041
00042 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00043
00044 meEtSpectrumReal_[0] = 0;
00045 meEtSpectrumReal_[1] = 0;
00046 meEtSpectrumEmul_[0] = 0;
00047 meEtSpectrumEmul_[1] = 0;
00048 meEtSpectrumEmulMax_[0] = 0;
00049 meEtSpectrumEmulMax_[1] = 0;
00050 meEtBxReal_[0] = 0;
00051 meEtBxReal_[1] = 0;
00052 meOccupancyBxReal_[0] = 0;
00053 meOccupancyBxReal_[1] = 0;
00054 meTCCTimingCalo_[0] = 0;
00055 meTCCTimingCalo_[1] = 0;
00056 meTCCTimingMuon_[0] = 0;
00057 meTCCTimingMuon_[1] = 0;
00058 meEmulMatchIndex1D_[0] = 0;
00059 meEmulMatchIndex1D_[1] = 0;
00060 meEmulMatchMaxIndex1D_[0] = 0;
00061 meEmulMatchMaxIndex1D_[1] = 0;
00062
00063 reserveArray(meEtMapReal_);
00064 reserveArray(meVetoReal_);
00065 reserveArray(meEtMapEmul_);
00066 reserveArray(meVetoEmul_);
00067 reserveArray(meEmulError_);
00068 reserveArray(meEmulMatch_);
00069 reserveArray(meVetoEmulError_);
00070
00071 realCollection_ = ps.getParameter<edm::InputTag>("EcalTrigPrimDigiCollectionReal");
00072 emulCollection_ = ps.getParameter<edm::InputTag>("EcalTrigPrimDigiCollectionEmul");
00073 EEDigiCollection_ = ps.getParameter<edm::InputTag>("EEDigiCollection");
00074 HLTResultsCollection_ = ps.getParameter<edm::InputTag>("HLTResultsCollection");
00075
00076 HLTCaloHLTBit_ = ps.getUntrackedParameter<std::string>("HLTCaloHLTBit", "");
00077 HLTMuonHLTBit_ = ps.getUntrackedParameter<std::string>("HLTMuonHLTBit", "");
00078
00079 outputFile_ = ps.getUntrackedParameter<std::string>("OutputRootFile", "");
00080
00081 LogDebug("EETriggerTowerTask") << "REAL digis: " << realCollection_;
00082 LogDebug("EETriggerTowerTask") << "EMULATED digis: " << emulCollection_;
00083
00084 }
00085
00086 EETriggerTowerTask::~EETriggerTowerTask(){
00087
00088 }
00089
00090 void EETriggerTowerTask::reserveArray( array1& array ) {
00091
00092 array.reserve( nSM );
00093 array.resize( nSM, static_cast<MonitorElement*>(0) );
00094
00095 }
00096
00097 void EETriggerTowerTask::beginJob(void){
00098
00099 ievt_ = 0;
00100
00101 if ( dqmStore_ ) {
00102 dqmStore_->setCurrentFolder(prefixME_ + "/EETriggerTowerTask");
00103 dqmStore_->rmdir(prefixME_ + "/EETriggerTowerTask");
00104 }
00105
00106 }
00107
00108 void EETriggerTowerTask::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 EETriggerTowerTask::endRun(const edm::Run& r, const edm::EventSetup& c) {
00117
00118 }
00119
00120 void EETriggerTowerTask::reset(void) {
00121
00122 for (int iside = 0; iside < 2; iside++) {
00123 if ( meEtSpectrumReal_[iside] ) meEtSpectrumReal_[iside]->Reset();
00124 if ( meEtSpectrumEmul_[iside] ) meEtSpectrumEmul_[iside]->Reset();
00125 if ( meEtSpectrumEmulMax_[iside] ) meEtSpectrumEmulMax_[iside]->Reset();
00126 if ( meEtBxReal_[iside] ) meEtBxReal_[iside]->Reset();
00127 if ( meOccupancyBxReal_[iside] ) meOccupancyBxReal_[iside]->Reset();
00128 if ( meTCCTimingCalo_[iside] ) meTCCTimingCalo_[iside]->Reset();
00129 if ( meTCCTimingMuon_[iside] ) meTCCTimingMuon_[iside]->Reset();
00130 if ( meEmulMatchIndex1D_[iside] ) meEmulMatchIndex1D_[iside]->Reset();
00131 if ( meEmulMatchMaxIndex1D_[iside] ) meEmulMatchMaxIndex1D_[iside]->Reset();
00132 }
00133
00134 for (int i = 0; i < 18; i++) {
00135
00136 if ( meEtMapReal_[i] ) meEtMapReal_[i]->Reset();
00137 if ( meVetoReal_[i] ) meVetoReal_[i]->Reset();
00138 if ( meEtMapEmul_[i] ) meEtMapEmul_[i]->Reset();
00139 if ( meVetoEmul_[i] ) meVetoEmul_[i]->Reset();
00140 if ( meEmulError_[i] ) meEmulError_[i]->Reset();
00141 if ( meEmulMatch_[i] ) meEmulMatch_[i]->Reset();
00142 if ( meVetoEmulError_[i] ) meVetoEmulError_[i]->Reset();
00143
00144 }
00145
00146 }
00147
00148 void EETriggerTowerTask::setup(void){
00149
00150 init_ = true;
00151
00152 if ( dqmStore_ ) {
00153 setup( "Real Digis",
00154 (prefixME_ + "/EETriggerTowerTask").c_str(), false );
00155
00156 setup( "Emulated Digis",
00157 (prefixME_ + "/EETriggerTowerTask/Emulated").c_str(), true);
00158 }
00159 else {
00160 edm::LogError("EETriggerTowerTask") << "Bad DQMStore, cannot book MonitorElements.";
00161 }
00162 }
00163
00164 void EETriggerTowerTask::setup( const char* nameext,
00165 const char* folder,
00166 bool emulated ) {
00167
00168 array1* meEtMap = &meEtMapReal_;
00169 array1* meVeto = &meVetoReal_;
00170
00171 if ( emulated ) {
00172 meEtMap = &meEtMapEmul_;
00173 meVeto = &meVetoEmul_;
00174 }
00175
00176 dqmStore_->setCurrentFolder(folder);
00177
00178 char histo[200];
00179
00180 if (!emulated) {
00181 sprintf(histo, "EETTT Et spectrum %s EE -", nameext);
00182 meEtSpectrumReal_[0] = dqmStore_->book1D(histo, histo, 256, 0., 256.);
00183 meEtSpectrumReal_[0]->setAxisTitle("energy (ADC)", 1);
00184
00185 sprintf(histo, "EETTT Et spectrum %s EE +", nameext);
00186 meEtSpectrumReal_[1] = dqmStore_->book1D(histo, histo, 256, 0., 256.);
00187 meEtSpectrumReal_[1]->setAxisTitle("energy (ADC)", 1);
00188
00189 sprintf(histo, "EETTT TP matching index EE -");
00190 meEmulMatchIndex1D_[0] = dqmStore_->book1D(histo, histo, 7, -1., 6.);
00191 meEmulMatchIndex1D_[0]->setAxisTitle("TP data matching emulator", 1);
00192
00193 sprintf(histo, "EETTT TP matching index EE +");
00194 meEmulMatchIndex1D_[1] = dqmStore_->book1D(histo, histo, 7, -1., 6.);
00195 meEmulMatchIndex1D_[1]->setAxisTitle("TP data matching emulator", 1);
00196
00197 sprintf(histo, "EETTT max TP matching index EE -");
00198 meEmulMatchMaxIndex1D_[0] = dqmStore_->book1D(histo, histo, 7, -1., 6.);
00199 meEmulMatchMaxIndex1D_[0]->setAxisTitle("Max TP data matching emulator", 1);
00200
00201 sprintf(histo, "EETTT max TP matching index EE +");
00202 meEmulMatchMaxIndex1D_[1] = dqmStore_->book1D(histo, histo, 7, -1., 6.);
00203 meEmulMatchMaxIndex1D_[1]->setAxisTitle("Max TP data matching emulator", 1);
00204
00205 double xbins[51];
00206 for ( int i=0; i<=11; i++ ) xbins[i] = i-1;
00207
00208
00209
00210 for ( int i=12; i<=22; i++) xbins[i] = 3371+i-12;
00211
00212 for ( int i=23; i<=51; i++) xbins[i] = 3382+(i-23)*6;
00213
00214 sprintf(histo, "EETTT Et vs bx %s EE -", nameext);
00215 meEtBxReal_[0] = dqmStore_->bookProfile(histo, histo, 50, xbins, 256, 0, 256);
00216 meEtBxReal_[0]->setAxisTitle("bunch crossing", 1);
00217 meEtBxReal_[0]->setAxisTitle("energy (ADC)", 2);
00218
00219 sprintf(histo, "EETTT Et vs bx %s EE +", nameext);
00220 meEtBxReal_[1] = dqmStore_->bookProfile(histo, histo, 50, xbins, 256, 0, 256);
00221 meEtBxReal_[1]->setAxisTitle("bunch crossing", 1);
00222 meEtBxReal_[1]->setAxisTitle("energy (ADC)", 2);
00223
00224 sprintf(histo, "EETTT TP occupancy vs bx %s EE -", nameext);
00225 meOccupancyBxReal_[0] = dqmStore_->bookProfile(histo, histo, 50, xbins, 2448, 0, 2448);
00226 meOccupancyBxReal_[0]->setAxisTitle("bunch crossing", 1);
00227 meOccupancyBxReal_[0]->setAxisTitle("TP number", 2);
00228
00229 sprintf(histo, "EETTT TP occupancy vs bx %s EE +", nameext);
00230 meOccupancyBxReal_[1] = dqmStore_->bookProfile(histo, histo, 50, xbins, 2448, 0, 2448);
00231 meOccupancyBxReal_[1]->setAxisTitle("bunch crossing", 1);
00232 meOccupancyBxReal_[1]->setAxisTitle("TP number", 2);
00233
00234 if ( HLTCaloHLTBit_ != "" ) {
00235 sprintf(histo, "EETTT TCC timing calo triggers %s EE -", nameext);
00236 meTCCTimingCalo_[0] = dqmStore_->book2D(histo, histo, 36, 1, 37, 7, -1., 6.);
00237 meTCCTimingCalo_[0]->setAxisTitle("nTCC", 1);
00238 meTCCTimingCalo_[0]->setAxisTitle("TP data matching emulator", 2);
00239
00240 sprintf(histo, "EETTT TCC timing calo triggers %s EE +", nameext);
00241 meTCCTimingCalo_[1] = dqmStore_->book2D(histo, histo, 36, 73, 109, 7, -1., 6.);
00242 meTCCTimingCalo_[1]->setAxisTitle("nTCC", 1);
00243 meTCCTimingCalo_[1]->setAxisTitle("TP data matching emulator", 2);
00244 }
00245
00246 if ( HLTMuonHLTBit_ != "" ) {
00247 sprintf(histo, "EETTT TCC timing muon triggers %s EE -", nameext);
00248 meTCCTimingMuon_[0] = dqmStore_->book2D(histo, histo, 36, 1, 37, 7, -1., 6.);
00249 meTCCTimingMuon_[0]->setAxisTitle("nTCC", 1);
00250 meTCCTimingMuon_[0]->setAxisTitle("TP data matching emulator", 2);
00251
00252 sprintf(histo, "EETTT TCC timing muon triggers %s EE +", nameext);
00253 meTCCTimingMuon_[1] = dqmStore_->book2D(histo, histo, 36, 73, 109, 7, -1., 6.);
00254 meTCCTimingMuon_[1]->setAxisTitle("nTCC", 1);
00255 meTCCTimingMuon_[1]->setAxisTitle("TP data matching emulator", 2);
00256 }
00257
00258 } else {
00259 sprintf(histo, "EETTT Et spectrum %s EE -", nameext);
00260 meEtSpectrumEmul_[0] = dqmStore_->book1D(histo, histo, 256, 0., 256.);
00261 meEtSpectrumEmul_[0]->setAxisTitle("energy (ADC)", 1);
00262
00263 sprintf(histo, "EETTT Et spectrum %s EE +", nameext);
00264 meEtSpectrumEmul_[1] = dqmStore_->book1D(histo, histo, 256, 0., 256.);
00265 meEtSpectrumEmul_[1]->setAxisTitle("energy (ADC)", 1);
00266
00267 sprintf(histo, "EETTT Et spectrum %s max EE -", nameext);
00268 meEtSpectrumEmulMax_[0] = dqmStore_->book1D(histo, histo, 256, 0., 256.);
00269 meEtSpectrumEmulMax_[0]->setAxisTitle("energy (ADC)", 1);
00270
00271 sprintf(histo, "EETTT Et spectrum %s max EE +", nameext);
00272 meEtSpectrumEmulMax_[1] = dqmStore_->book1D(histo, histo, 256, 0., 256.);
00273 meEtSpectrumEmulMax_[1]->setAxisTitle("energy (ADC)", 1);
00274 }
00275
00276 for (int i = 0; i < 18; i++) {
00277
00278 sprintf(histo, "EETTT Et map %s %s", nameext, Numbers::sEE(i+1).c_str());
00279 (*meEtMap)[i] = dqmStore_->bookProfile2D(histo, histo,
00280 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50.,
00281 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.,
00282 256, 0, 256.);
00283 (*meEtMap)[i]->setAxisTitle("ix", 1);
00284 if ( i+1 >= 1 && i+1 <= 9 ) (*meEtMap)[i]->setAxisTitle("101-ix", 1);
00285 (*meEtMap)[i]->setAxisTitle("iy", 2);
00286 dqmStore_->tag((*meEtMap)[i], i+1);
00287
00288 if (!emulated) {
00289
00290 sprintf(histo, "EETTT EmulError %s", Numbers::sEE(i+1).c_str());
00291 meEmulError_[i] = dqmStore_->book2D(histo, histo,
00292 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50.,
00293 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50. );
00294 meEmulError_[i]->setAxisTitle("ix", 1);
00295 if ( i+1 >= 1 && i+1 <= 9 ) meEmulError_[i]->setAxisTitle("101-ix", 1);
00296 meEmulError_[i]->setAxisTitle("iy", 2);
00297 dqmStore_->tag(meEmulError_[i], i+1);
00298
00299 sprintf(histo, "EETTT EmulMatch %s", Numbers::sEE(i+1).c_str());
00300 meEmulMatch_[i] = dqmStore_->book3D(histo, histo,
00301 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50.,
00302 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.,
00303 6, 0., 6.);
00304 meEmulMatch_[i]->setAxisTitle("ix", 1);
00305 if ( i+1 >= 1 && i+1 <= 9 ) meEmulMatch_[i]->setAxisTitle("101-ix", 1);
00306 meEmulMatch_[i]->setAxisTitle("iy", 2);
00307 dqmStore_->tag(meEmulMatch_[i], i+1);
00308
00309 sprintf(histo, "EETTT EmulFineGrainVetoError %s", Numbers::sEE(i+1).c_str());
00310 meVetoEmulError_[i] = dqmStore_->book2D(histo, histo,
00311 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50.,
00312 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.);
00313 meVetoEmulError_[i]->setAxisTitle("ix", 1);
00314 if ( i+1 >= 1 && i+1 <= 9 ) meVetoEmulError_[i]->setAxisTitle("101-ix", 1);
00315 meVetoEmulError_[i]->setAxisTitle("iy", 2);
00316 dqmStore_->tag(meVetoEmulError_[i], i+1);
00317
00318 }
00319 }
00320
00321 }
00322
00323 void EETriggerTowerTask::cleanup(void) {
00324
00325 if ( ! init_ ) return;
00326
00327 if ( dqmStore_ ) {
00328
00329 if ( !outputFile_.empty() ) dqmStore_->save( outputFile_.c_str() );
00330
00331 dqmStore_->rmdir( prefixME_ + "/EETriggerTowerTask" );
00332
00333 }
00334
00335 init_ = false;
00336
00337 }
00338
00339 void EETriggerTowerTask::endJob(void){
00340
00341 edm::LogInfo("EETriggerTowerTask") << "analyzed " << ievt_ << " events";
00342
00343 if ( enableCleanup_ ) this->cleanup();
00344
00345 }
00346
00347 void EETriggerTowerTask::analyze(const edm::Event& e, const edm::EventSetup& c){
00348
00349 if ( ! init_ ) this->setup();
00350
00351 ievt_++;
00352
00353 edm::Handle<EcalTrigPrimDigiCollection> realDigis;
00354
00355 if ( e.getByLabel(realCollection_, realDigis) ) {
00356
00357 int neetpd = realDigis->size();
00358 LogDebug("EETriggerTowerTask") << "event " << ievt_ << " trigger primitive digi collection size: " << neetpd;
00359
00360 processDigis( e,
00361 realDigis,
00362 meEtMapReal_,
00363 meVetoReal_);
00364
00365 } else {
00366 edm::LogWarning("EETriggerTowerTask") << realCollection_ << " not available";
00367 }
00368
00369 edm::Handle<EcalTrigPrimDigiCollection> emulDigis;
00370
00371 if ( e.getByLabel(emulCollection_, emulDigis) ) {
00372
00373 edm::Handle<edm::TriggerResults> hltResults;
00374
00375 if ( !e.getByLabel(HLTResultsCollection_, hltResults) ) {
00376 HLTResultsCollection_ = edm::InputTag(HLTResultsCollection_.label(), HLTResultsCollection_.instance(), "HLT");
00377 }
00378
00379 if ( !e.getByLabel(HLTResultsCollection_, hltResults) ) {
00380 HLTResultsCollection_ = edm::InputTag(HLTResultsCollection_.label(), HLTResultsCollection_.instance(), "FU");
00381 }
00382
00383 if ( e.getByLabel(HLTResultsCollection_, hltResults) ) {
00384
00385 processDigis( e,
00386 emulDigis,
00387 meEtMapEmul_,
00388 meVetoEmul_,
00389 realDigis,
00390 hltResults);
00391
00392 } else {
00393 edm::LogWarning("EETriggerTowerTask") << HLTResultsCollection_ << " not available";
00394 }
00395
00396 } else {
00397 edm::LogInfo("EETriggerTowerTask") << emulCollection_ << " not available";
00398 }
00399
00400 }
00401
00402 void
00403 EETriggerTowerTask::processDigis( const edm::Event& e, const edm::Handle<EcalTrigPrimDigiCollection>& digis,
00404 array1& meEtMap,
00405 array1& meVeto,
00406 const edm::Handle<EcalTrigPrimDigiCollection>& compDigis,
00407 const edm::Handle<edm::TriggerResults> & hltResults ) {
00408
00409 int bx = e.bunchCrossing();
00410 int nTP[2];
00411 nTP[0] = nTP[1] = 0;
00412
00413
00414 int readoutCrystalsInTower[108][41];
00415 for (int itcc = 0; itcc < 108; itcc++) {
00416 for (int itt = 0; itt < 41; itt++) readoutCrystalsInTower[itcc][itt] = 0;
00417 }
00418
00419 if ( compDigis.isValid() ) {
00420
00421 edm::Handle<EEDigiCollection> crystalDigis;
00422
00423 if ( e.getByLabel(EEDigiCollection_, crystalDigis) ) {
00424
00425 for ( EEDigiCollection::const_iterator cDigiItr = crystalDigis->begin(); cDigiItr != crystalDigis->end(); ++cDigiItr ) {
00426
00427 EEDetId id = cDigiItr->id();
00428
00429 int ix = id.ix();
00430 int iy = id.iy();
00431 int ism = Numbers::iSM( id );
00432 int itcc = Numbers::iTCC( ism, EcalEndcap, ix, iy );
00433 int itt = Numbers::iTT( ism, EcalEndcap, ix, iy );
00434
00435 readoutCrystalsInTower[itcc-1][itt-1]++;
00436
00437 }
00438
00439 } else {
00440 edm::LogWarning("EETriggerTowerTask") << EEDigiCollection_ << " not available";
00441 }
00442
00443 }
00444
00445 bool caloTrg = false;
00446 bool muonTrg = false;
00447
00448 if ( hltResults.isValid() ) {
00449
00450 int ntrigs = hltResults->size();
00451 if ( ntrigs!=0 ) {
00452
00453 const edm::TriggerNames & triggerNames = e.triggerNames(*hltResults);
00454
00455 for ( int itrig = 0; itrig != ntrigs; ++itrig ) {
00456 std::string trigName = triggerNames.triggerName(itrig);
00457 bool accept = hltResults->accept(itrig);
00458
00459 if ( trigName == HLTCaloHLTBit_ ) caloTrg = accept;
00460
00461 if ( trigName == HLTMuonHLTBit_ ) muonTrg = accept;
00462
00463 }
00464
00465 } else {
00466 edm::LogWarning("EBTriggerTowerTask") << " zero size trigger names in input TriggerResults";
00467 }
00468
00469 }
00470
00471 for ( EcalTrigPrimDigiCollection::const_iterator tpdigiItr = digis->begin(); tpdigiItr != digis->end(); ++tpdigiItr ) {
00472
00473 if ( Numbers::subDet( tpdigiItr->id() ) != EcalEndcap ) continue;
00474
00475 int ismt = Numbers::iSM( tpdigiItr->id() );
00476 int itt = Numbers::iTT( tpdigiItr->id() );
00477 int itcc = Numbers::iTCC( tpdigiItr->id() );
00478
00479 std::vector<DetId>* crystals = Numbers::crystals( tpdigiItr->id() );
00480
00481 float xvalEt = tpdigiItr->compressedEt();
00482 float xvalVeto = 0.5 + tpdigiItr->fineGrain();
00483
00484 bool good = true;
00485 bool goodVeto = true;
00486
00487 int compDigiInterest = -1;
00488
00489 bool matchSample[6];
00490 for (int j=0; j<6; j++) matchSample[j]=false;
00491
00492 if ( compDigis.isValid() ) {
00493
00494 if ( ismt >= 1 && ismt <= 9 ) {
00495 if ( meEtSpectrumEmul_[0] ) meEtSpectrumEmul_[0]->Fill( xvalEt );
00496 } else {
00497 if ( meEtSpectrumEmul_[1] ) meEtSpectrumEmul_[1]->Fill( xvalEt );
00498 }
00499
00500 float maxEt = 0;
00501 int maxTPIndex = -1;
00502 for (int j=0; j<5; j++) {
00503 float EtTP = (*tpdigiItr)[j].compressedEt();
00504 if ( EtTP > maxEt ) {
00505 maxEt = EtTP;
00506 maxTPIndex = j+1;
00507 }
00508 }
00509
00510 if ( ismt >= 1 && ismt <= 9 ) {
00511 if ( meEtSpectrumEmulMax_[0] ) meEtSpectrumEmulMax_[0]->Fill( maxEt );
00512 if ( meEmulMatchMaxIndex1D_[0] && maxEt > 0 ) meEmulMatchMaxIndex1D_[0]->Fill( maxTPIndex );
00513 } else {
00514 if ( meEtSpectrumEmulMax_[1] ) meEtSpectrumEmulMax_[1]->Fill( maxEt );
00515 if ( meEmulMatchMaxIndex1D_[1] && maxEt > 0 ) meEmulMatchMaxIndex1D_[1]->Fill( maxTPIndex );
00516 }
00517
00518 EcalTrigPrimDigiCollection::const_iterator compDigiItr = compDigis->find( tpdigiItr->id().rawId() );
00519 if ( compDigiItr != compDigis->end() ) {
00520 int compDigiEt = compDigiItr->compressedEt();
00521 compDigiInterest = (compDigiItr->ttFlag() & 0x3);
00522
00523 if ( ismt >= 1 && ismt <= 9 ) {
00524 if ( compDigiEt > 0 ) nTP[0]++;
00525 if ( meEtSpectrumReal_[0] ) meEtSpectrumReal_[0]->Fill( compDigiEt );
00526 if ( meEtBxReal_[0] && compDigiEt > 0 ) meEtBxReal_[0]->Fill( bx, compDigiEt );
00527 } else {
00528 if ( compDigiEt > 0 ) nTP[1]++;
00529 if ( meEtSpectrumReal_[1] ) meEtSpectrumReal_[1]->Fill( compDigiEt );
00530 if ( meEtBxReal_[1] && compDigiEt > 0 ) meEtBxReal_[1]->Fill( bx, compDigiEt );
00531 }
00532
00533
00534
00535 matchSample[0]=false;
00536 bool matchedAny=false;
00537
00538 for (int j=0; j<5; j++) {
00539 if ((*tpdigiItr)[j].compressedEt() == compDigiEt ) {
00540 matchSample[j+1]=true;
00541 matchedAny=true;
00542 } else {
00543 matchSample[j+1]=false;
00544 }
00545 }
00546
00547 if (!matchedAny) matchSample[0]=true;
00548
00549
00550 if (readoutCrystalsInTower[itcc-1][itt-1] == int(crystals->size()) &&
00551 (compDigiInterest == 1 || compDigiInterest == 3) && compDigiEt > 0) {
00552
00553 if ( tpdigiItr->compressedEt() != compDigiEt ) {
00554 good = false;
00555 }
00556 if ( tpdigiItr->fineGrain() != compDigiItr->fineGrain() ) {
00557 goodVeto = false;
00558 }
00559
00560 for (int j=0; j<6; j++) {
00561 if (matchSample[j]) {
00562
00563 int index = ( j==0 ) ? -1 : j;
00564
00565 if ( ismt >= 1 && ismt <= 9 ) {
00566 meEmulMatchIndex1D_[0]->Fill(index+0.5);
00567 } else {
00568 meEmulMatchIndex1D_[1]->Fill(index+0.5);
00569 }
00570
00571 for ( unsigned int i=0; i<crystals->size(); i++ ) {
00572
00573 EEDetId id = (*crystals)[i];
00574
00575 int ix = id.ix();
00576 int iy = id.iy();
00577
00578 if ( ismt >= 1 && ismt <= 9 ) ix = 101 - ix;
00579
00580 float xix = ix-0.5;
00581 float xiy = iy-0.5;
00582
00583 meEmulMatch_[ismt-1]->Fill(xix, xiy, j+0.5);
00584 if ( ismt >= 1 && ismt <= 9 ) {
00585 if ( meTCCTimingCalo_[0] && caloTrg ) meTCCTimingCalo_[0]->Fill( itcc, index+0.5 );
00586 if ( meTCCTimingMuon_[0] && muonTrg ) meTCCTimingMuon_[0]->Fill( itcc, index+0.5 );
00587 } else {
00588 if ( meTCCTimingCalo_[1] && caloTrg ) meTCCTimingCalo_[1]->Fill( itcc, index+0.5 );
00589 if ( meTCCTimingMuon_[1] && muonTrg ) meTCCTimingMuon_[1]->Fill( itcc, index+0.5 );
00590 }
00591
00592 }
00593
00594 }
00595 }
00596
00597 }
00598
00599 } else {
00600 good = false;
00601 goodVeto = false;
00602 }
00603
00604 for ( unsigned int i=0; i<crystals->size(); i++ ) {
00605
00606 EEDetId id = (*crystals)[i];
00607
00608 int ix = id.ix();
00609 int iy = id.iy();
00610
00611 if ( ismt >= 1 && ismt <= 9 ) ix = 101 - ix;
00612
00613 float xix = ix-0.5;
00614 float xiy = iy-0.5;
00615
00616 if (!good ) {
00617 if ( meEmulError_[ismt-1] ) meEmulError_[ismt-1]->Fill(xix, xiy);
00618 }
00619 if (!goodVeto) {
00620 if ( meVetoEmulError_[ismt-1] ) meVetoEmulError_[ismt-1]->Fill(xix, xiy);
00621 }
00622
00623 }
00624
00625 }
00626
00627 for ( unsigned int i=0; i<crystals->size(); i++ ) {
00628
00629 EEDetId id = (*crystals)[i];
00630
00631 int ix = id.ix();
00632 int iy = id.iy();
00633
00634 if ( ismt >= 1 && ismt <= 9 ) ix = 101 - ix;
00635
00636 float xix = ix-0.5;
00637 float xiy = iy-0.5;
00638
00639 if ( meEtMap[ismt-1] ) meEtMap[ismt-1]->Fill(xix, xiy, xvalEt);
00640 if ( meVeto[ismt-1] ) meVeto[ismt-1]->Fill(xix, xiy, xvalVeto);
00641
00642 }
00643
00644 }
00645
00646 if ( meOccupancyBxReal_[0] ) meOccupancyBxReal_[0]->Fill( bx, nTP[0] );
00647 if ( meOccupancyBxReal_[1] ) meOccupancyBxReal_[1]->Fill( bx, nTP[1] );
00648
00649 }
00650