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( std::string const &nameext,
00165 std::string const &folder,
00166 bool emulated ) {
00167
00168 array1* meEtMap = &meEtMapReal_;
00169
00170 if ( emulated ) {
00171 meEtMap = &meEtMapEmul_;
00172 }
00173
00174 dqmStore_->setCurrentFolder(folder);
00175
00176 std::string name;
00177
00178 if (!emulated) {
00179 name = "EETTT Et spectrum " + nameext + " EE -";
00180 meEtSpectrumReal_[0] = dqmStore_->book1D(name, name, 256, 0., 256.);
00181 meEtSpectrumReal_[0]->setAxisTitle("energy (ADC)", 1);
00182
00183 name = "EETTT Et spectrum " + nameext + " EE +";
00184 meEtSpectrumReal_[1] = dqmStore_->book1D(name, name, 256, 0., 256.);
00185 meEtSpectrumReal_[1]->setAxisTitle("energy (ADC)", 1);
00186
00187 name = "EETTT TP matching index EE -";
00188 meEmulMatchIndex1D_[0] = dqmStore_->book1D(name, name, 7, -1., 6.);
00189 meEmulMatchIndex1D_[0]->setAxisTitle("TP data matching emulator", 1);
00190
00191 name = "EETTT TP matching index EE +";
00192 meEmulMatchIndex1D_[1] = dqmStore_->book1D(name, name, 7, -1., 6.);
00193 meEmulMatchIndex1D_[1]->setAxisTitle("TP data matching emulator", 1);
00194
00195 name = "EETTT max TP matching index EE -";
00196 meEmulMatchMaxIndex1D_[0] = dqmStore_->book1D(name, name, 7, -1., 6.);
00197 meEmulMatchMaxIndex1D_[0]->setAxisTitle("Max TP data matching emulator", 1);
00198
00199 name = "EETTT max TP matching index EE +";
00200 meEmulMatchMaxIndex1D_[1] = dqmStore_->book1D(name, name, 7, -1., 6.);
00201 meEmulMatchMaxIndex1D_[1]->setAxisTitle("Max TP data matching emulator", 1);
00202
00203 double xbins[51];
00204 for ( int i=0; i<=11; i++ ) xbins[i] = i-1;
00205
00206
00207
00208 for ( int i=12; i<=22; i++) xbins[i] = 3371+i-12;
00209
00210 for ( int i=23; i<=50; i++) xbins[i] = 3382+(i-23)*6;
00211
00212 name = "EETTT Et vs bx " + nameext + " EE -";
00213 meEtBxReal_[0] = dqmStore_->bookProfile(name, name, 50, xbins, 256, 0, 256);
00214 meEtBxReal_[0]->setAxisTitle("bunch crossing", 1);
00215 meEtBxReal_[0]->setAxisTitle("energy (ADC)", 2);
00216
00217 name = "EETTT Et vs bx " + nameext + " EE +";
00218 meEtBxReal_[1] = dqmStore_->bookProfile(name, name, 50, xbins, 256, 0, 256);
00219 meEtBxReal_[1]->setAxisTitle("bunch crossing", 1);
00220 meEtBxReal_[1]->setAxisTitle("energy (ADC)", 2);
00221
00222 name = "EETTT TP occupancy vs bx " + nameext + " EE -";
00223 meOccupancyBxReal_[0] = dqmStore_->bookProfile(name, name, 50, xbins, 2448, 0, 2448);
00224 meOccupancyBxReal_[0]->setAxisTitle("bunch crossing", 1);
00225 meOccupancyBxReal_[0]->setAxisTitle("TP number", 2);
00226
00227 name = "EETTT TP occupancy vs bx " + nameext + " EE +";
00228 meOccupancyBxReal_[1] = dqmStore_->bookProfile(name, name, 50, xbins, 2448, 0, 2448);
00229 meOccupancyBxReal_[1]->setAxisTitle("bunch crossing", 1);
00230 meOccupancyBxReal_[1]->setAxisTitle("TP number", 2);
00231
00232 if ( HLTCaloHLTBit_ != "" ) {
00233 name = "EETTT TCC timing calo triggers " + nameext + " EE -";
00234 meTCCTimingCalo_[0] = dqmStore_->book2D(name, name, 36, 1, 37, 7, -1., 6.);
00235 meTCCTimingCalo_[0]->setAxisTitle("nTCC", 1);
00236 meTCCTimingCalo_[0]->setAxisTitle("TP data matching emulator", 2);
00237
00238 name = "EETTT TCC timing calo triggers " + nameext + " EE +";
00239 meTCCTimingCalo_[1] = dqmStore_->book2D(name, name, 36, 73, 109, 7, -1., 6.);
00240 meTCCTimingCalo_[1]->setAxisTitle("nTCC", 1);
00241 meTCCTimingCalo_[1]->setAxisTitle("TP data matching emulator", 2);
00242 }
00243
00244 if ( HLTMuonHLTBit_ != "" ) {
00245 name = "EETTT TCC timing muon triggers " + nameext + " EE -";
00246 meTCCTimingMuon_[0] = dqmStore_->book2D(name, name, 36, 1, 37, 7, -1., 6.);
00247 meTCCTimingMuon_[0]->setAxisTitle("nTCC", 1);
00248 meTCCTimingMuon_[0]->setAxisTitle("TP data matching emulator", 2);
00249
00250 name = "EETTT TCC timing muon triggers " + nameext + " EE +";
00251 meTCCTimingMuon_[1] = dqmStore_->book2D(name, name, 36, 73, 109, 7, -1., 6.);
00252 meTCCTimingMuon_[1]->setAxisTitle("nTCC", 1);
00253 meTCCTimingMuon_[1]->setAxisTitle("TP data matching emulator", 2);
00254 }
00255
00256 } else {
00257 name = "EETTT Et spectrum " + nameext + " EE -";
00258 meEtSpectrumEmul_[0] = dqmStore_->book1D(name, name, 256, 0., 256.);
00259 meEtSpectrumEmul_[0]->setAxisTitle("energy (ADC)", 1);
00260
00261 name = "EETTT Et spectrum " + nameext + " EE +";
00262 meEtSpectrumEmul_[1] = dqmStore_->book1D(name, name, 256, 0., 256.);
00263 meEtSpectrumEmul_[1]->setAxisTitle("energy (ADC)", 1);
00264
00265 name = "EETTT Et spectrum " + nameext + " max EE -";
00266 meEtSpectrumEmulMax_[0] = dqmStore_->book1D(name, name, 256, 0., 256.);
00267 meEtSpectrumEmulMax_[0]->setAxisTitle("energy (ADC)", 1);
00268
00269 name = "EETTT Et spectrum " + nameext + " max EE +";
00270 meEtSpectrumEmulMax_[1] = dqmStore_->book1D(name, name, 256, 0., 256.);
00271 meEtSpectrumEmulMax_[1]->setAxisTitle("energy (ADC)", 1);
00272 }
00273
00274 for (int i = 0; i < 18; i++) {
00275
00276 name = "EETTT Et map " + nameext + " " + Numbers::sEE(i+1);
00277 (*meEtMap)[i] = dqmStore_->bookProfile2D(name, name,
00278 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50.,
00279 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.,
00280 256, 0, 256.);
00281 (*meEtMap)[i]->setAxisTitle("ix", 1);
00282 if ( i+1 >= 1 && i+1 <= 9 ) (*meEtMap)[i]->setAxisTitle("101-ix", 1);
00283 (*meEtMap)[i]->setAxisTitle("iy", 2);
00284 dqmStore_->tag((*meEtMap)[i], i+1);
00285
00286 if (!emulated) {
00287
00288 name = "EETTT EmulError " + Numbers::sEE(i+1);
00289 meEmulError_[i] = dqmStore_->book2D(name, name,
00290 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50.,
00291 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50. );
00292 meEmulError_[i]->setAxisTitle("ix", 1);
00293 if ( i+1 >= 1 && i+1 <= 9 ) meEmulError_[i]->setAxisTitle("101-ix", 1);
00294 meEmulError_[i]->setAxisTitle("iy", 2);
00295 dqmStore_->tag(meEmulError_[i], i+1);
00296
00297 name = "EETTT EmulMatch " + Numbers::sEE(i+1);
00298 meEmulMatch_[i] = dqmStore_->book3D(name, name,
00299 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50.,
00300 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.,
00301 6, 0., 6.);
00302 meEmulMatch_[i]->setAxisTitle("ix", 1);
00303 if ( i+1 >= 1 && i+1 <= 9 ) meEmulMatch_[i]->setAxisTitle("101-ix", 1);
00304 meEmulMatch_[i]->setAxisTitle("iy", 2);
00305 dqmStore_->tag(meEmulMatch_[i], i+1);
00306
00307 name = "EETTT EmulFineGrainVetoError " + Numbers::sEE(i+1);
00308 meVetoEmulError_[i] = dqmStore_->book2D(name, name,
00309 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50.,
00310 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.);
00311 meVetoEmulError_[i]->setAxisTitle("ix", 1);
00312 if ( i+1 >= 1 && i+1 <= 9 ) meVetoEmulError_[i]->setAxisTitle("101-ix", 1);
00313 meVetoEmulError_[i]->setAxisTitle("iy", 2);
00314 dqmStore_->tag(meVetoEmulError_[i], i+1);
00315
00316 }
00317 }
00318
00319 }
00320
00321 void EETriggerTowerTask::cleanup(void) {
00322
00323 if ( ! init_ ) return;
00324
00325 if ( dqmStore_ ) {
00326
00327 if ( !outputFile_.empty() ) dqmStore_->save( outputFile_.c_str() );
00328
00329 dqmStore_->rmdir( prefixME_ + "/EETriggerTowerTask" );
00330
00331 }
00332
00333 init_ = false;
00334
00335 }
00336
00337 void EETriggerTowerTask::endJob(void){
00338
00339 edm::LogInfo("EETriggerTowerTask") << "analyzed " << ievt_ << " events";
00340
00341 if ( enableCleanup_ ) this->cleanup();
00342
00343 }
00344
00345 void EETriggerTowerTask::analyze(const edm::Event& e, const edm::EventSetup& c){
00346
00347 if ( ! init_ ) this->setup();
00348
00349 ievt_++;
00350
00351 edm::Handle<EcalTrigPrimDigiCollection> realDigis;
00352
00353 if ( e.getByLabel(realCollection_, realDigis) ) {
00354
00355 int neetpd = realDigis->size();
00356 LogDebug("EETriggerTowerTask") << "event " << ievt_ << " trigger primitive digi collection size: " << neetpd;
00357
00358 processDigis( e,
00359 realDigis,
00360 meEtMapReal_,
00361 meVetoReal_);
00362
00363 } else {
00364 edm::LogWarning("EETriggerTowerTask") << realCollection_ << " not available";
00365 }
00366
00367 edm::Handle<EcalTrigPrimDigiCollection> emulDigis;
00368
00369 if ( e.getByLabel(emulCollection_, emulDigis) ) {
00370
00371 edm::Handle<edm::TriggerResults> hltResults;
00372
00373 if ( !e.getByLabel(HLTResultsCollection_, hltResults) ) {
00374 HLTResultsCollection_ = edm::InputTag(HLTResultsCollection_.label(), HLTResultsCollection_.instance(), "HLT");
00375 }
00376
00377 if ( !e.getByLabel(HLTResultsCollection_, hltResults) ) {
00378 HLTResultsCollection_ = edm::InputTag(HLTResultsCollection_.label(), HLTResultsCollection_.instance(), "FU");
00379 }
00380
00381 if ( e.getByLabel(HLTResultsCollection_, hltResults) ) {
00382
00383 processDigis( e,
00384 emulDigis,
00385 meEtMapEmul_,
00386 meVetoEmul_,
00387 realDigis,
00388 hltResults);
00389
00390 } else {
00391 edm::LogWarning("EETriggerTowerTask") << HLTResultsCollection_ << " not available";
00392 }
00393
00394 } else {
00395 edm::LogInfo("EETriggerTowerTask") << emulCollection_ << " not available";
00396 }
00397
00398 }
00399
00400 void
00401 EETriggerTowerTask::processDigis( const edm::Event& e, const edm::Handle<EcalTrigPrimDigiCollection>& digis,
00402 array1& meEtMap,
00403 array1& meVeto,
00404 const edm::Handle<EcalTrigPrimDigiCollection>& compDigis,
00405 const edm::Handle<edm::TriggerResults> & hltResults ) {
00406
00407 int bx = e.bunchCrossing();
00408 int nTP[2];
00409 nTP[0] = nTP[1] = 0;
00410
00411
00412 int readoutCrystalsInTower[108][41];
00413 for (int itcc = 0; itcc < 108; itcc++) {
00414 for (int itt = 0; itt < 41; itt++) readoutCrystalsInTower[itcc][itt] = 0;
00415 }
00416
00417 if ( compDigis.isValid() ) {
00418
00419 edm::Handle<EEDigiCollection> crystalDigis;
00420
00421 if ( e.getByLabel(EEDigiCollection_, crystalDigis) ) {
00422
00423 for ( EEDigiCollection::const_iterator cDigiItr = crystalDigis->begin(); cDigiItr != crystalDigis->end(); ++cDigiItr ) {
00424
00425 EEDetId id = cDigiItr->id();
00426
00427 int ix = id.ix();
00428 int iy = id.iy();
00429 int ism = Numbers::iSM( id );
00430 int itcc = Numbers::iTCC( ism, EcalEndcap, ix, iy );
00431 int itt = Numbers::iTT( ism, EcalEndcap, ix, iy );
00432
00433 readoutCrystalsInTower[itcc-1][itt-1]++;
00434
00435 }
00436
00437 } else {
00438 edm::LogWarning("EETriggerTowerTask") << EEDigiCollection_ << " not available";
00439 }
00440
00441 }
00442
00443 bool caloTrg = false;
00444 bool muonTrg = false;
00445
00446 if ( hltResults.isValid() ) {
00447
00448 int ntrigs = hltResults->size();
00449 if ( ntrigs!=0 ) {
00450
00451 const edm::TriggerNames & triggerNames = e.triggerNames(*hltResults);
00452
00453 for ( int itrig = 0; itrig != ntrigs; ++itrig ) {
00454 std::string trigName = triggerNames.triggerName(itrig);
00455 bool accept = hltResults->accept(itrig);
00456
00457 if ( trigName == HLTCaloHLTBit_ ) caloTrg = accept;
00458
00459 if ( trigName == HLTMuonHLTBit_ ) muonTrg = accept;
00460
00461 }
00462
00463 } else {
00464 edm::LogWarning("EBTriggerTowerTask") << " zero size trigger names in input TriggerResults";
00465 }
00466
00467 }
00468
00469 for ( EcalTrigPrimDigiCollection::const_iterator tpdigiItr = digis->begin(); tpdigiItr != digis->end(); ++tpdigiItr ) {
00470
00471 if ( Numbers::subDet( tpdigiItr->id() ) != EcalEndcap ) continue;
00472
00473 int ismt = Numbers::iSM( tpdigiItr->id() );
00474 int itt = Numbers::iTT( tpdigiItr->id() );
00475 int itcc = Numbers::iTCC( tpdigiItr->id() );
00476
00477 std::vector<DetId>* crystals = Numbers::crystals( tpdigiItr->id() );
00478
00479 float xvalEt = tpdigiItr->compressedEt();
00480 float xvalVeto = 0.5 + tpdigiItr->fineGrain();
00481
00482 bool good = true;
00483 bool goodVeto = true;
00484
00485 int compDigiInterest = -1;
00486
00487 bool matchSample[6];
00488 for (int j=0; j<6; j++) matchSample[j]=false;
00489
00490 if ( compDigis.isValid() ) {
00491
00492 if ( ismt >= 1 && ismt <= 9 ) {
00493 if ( meEtSpectrumEmul_[0] ) meEtSpectrumEmul_[0]->Fill( xvalEt );
00494 } else {
00495 if ( meEtSpectrumEmul_[1] ) meEtSpectrumEmul_[1]->Fill( xvalEt );
00496 }
00497
00498 float maxEt = 0;
00499 int maxTPIndex = -1;
00500 for (int j=0; j<5; j++) {
00501 float EtTP = (*tpdigiItr)[j].compressedEt();
00502 if ( EtTP > maxEt ) {
00503 maxEt = EtTP;
00504 maxTPIndex = j+1;
00505 }
00506 }
00507
00508 if ( ismt >= 1 && ismt <= 9 ) {
00509 if ( meEtSpectrumEmulMax_[0] ) meEtSpectrumEmulMax_[0]->Fill( maxEt );
00510 if ( meEmulMatchMaxIndex1D_[0] && maxEt > 0 ) meEmulMatchMaxIndex1D_[0]->Fill( maxTPIndex );
00511 } else {
00512 if ( meEtSpectrumEmulMax_[1] ) meEtSpectrumEmulMax_[1]->Fill( maxEt );
00513 if ( meEmulMatchMaxIndex1D_[1] && maxEt > 0 ) meEmulMatchMaxIndex1D_[1]->Fill( maxTPIndex );
00514 }
00515
00516 EcalTrigPrimDigiCollection::const_iterator compDigiItr = compDigis->find( tpdigiItr->id().rawId() );
00517 if ( compDigiItr != compDigis->end() ) {
00518 int compDigiEt = compDigiItr->compressedEt();
00519 compDigiInterest = (compDigiItr->ttFlag() & 0x3);
00520
00521 if ( ismt >= 1 && ismt <= 9 ) {
00522 if ( compDigiEt > 0 ) nTP[0]++;
00523 if ( meEtSpectrumReal_[0] ) meEtSpectrumReal_[0]->Fill( compDigiEt );
00524 if ( meEtBxReal_[0] && compDigiEt > 0 ) meEtBxReal_[0]->Fill( bx, compDigiEt );
00525 } else {
00526 if ( compDigiEt > 0 ) nTP[1]++;
00527 if ( meEtSpectrumReal_[1] ) meEtSpectrumReal_[1]->Fill( compDigiEt );
00528 if ( meEtBxReal_[1] && compDigiEt > 0 ) meEtBxReal_[1]->Fill( bx, compDigiEt );
00529 }
00530
00531
00532
00533 matchSample[0]=false;
00534 bool matchedAny=false;
00535
00536 for (int j=0; j<5; j++) {
00537 if ((*tpdigiItr)[j].compressedEt() == compDigiEt ) {
00538 matchSample[j+1]=true;
00539 matchedAny=true;
00540 } else {
00541 matchSample[j+1]=false;
00542 }
00543 }
00544
00545 if (!matchedAny) matchSample[0]=true;
00546
00547
00548 if (readoutCrystalsInTower[itcc-1][itt-1] == int(crystals->size()) &&
00549 (compDigiInterest == 1 || compDigiInterest == 3) && compDigiEt > 0) {
00550
00551 if ( tpdigiItr->compressedEt() != compDigiEt ) {
00552 good = false;
00553 }
00554 if ( tpdigiItr->fineGrain() != compDigiItr->fineGrain() ) {
00555 goodVeto = false;
00556 }
00557
00558 for (int j=0; j<6; j++) {
00559 if (matchSample[j]) {
00560
00561 int index = ( j==0 ) ? -1 : j;
00562
00563 if ( ismt >= 1 && ismt <= 9 ) {
00564 meEmulMatchIndex1D_[0]->Fill(index+0.5);
00565 } else {
00566 meEmulMatchIndex1D_[1]->Fill(index+0.5);
00567 }
00568
00569 for ( unsigned int i=0; i<crystals->size(); i++ ) {
00570
00571 EEDetId id = (*crystals)[i];
00572
00573 int ix = id.ix();
00574 int iy = id.iy();
00575
00576 if ( ismt >= 1 && ismt <= 9 ) ix = 101 - ix;
00577
00578 float xix = ix-0.5;
00579 float xiy = iy-0.5;
00580
00581 meEmulMatch_[ismt-1]->Fill(xix, xiy, j+0.5);
00582 if ( ismt >= 1 && ismt <= 9 ) {
00583 if ( meTCCTimingCalo_[0] && caloTrg ) meTCCTimingCalo_[0]->Fill( itcc, index+0.5 );
00584 if ( meTCCTimingMuon_[0] && muonTrg ) meTCCTimingMuon_[0]->Fill( itcc, index+0.5 );
00585 } else {
00586 if ( meTCCTimingCalo_[1] && caloTrg ) meTCCTimingCalo_[1]->Fill( itcc, index+0.5 );
00587 if ( meTCCTimingMuon_[1] && muonTrg ) meTCCTimingMuon_[1]->Fill( itcc, index+0.5 );
00588 }
00589
00590 }
00591
00592 }
00593 }
00594
00595 }
00596
00597 } else {
00598 good = false;
00599 goodVeto = false;
00600 }
00601
00602 for ( unsigned int i=0; i<crystals->size(); i++ ) {
00603
00604 EEDetId id = (*crystals)[i];
00605
00606 int ix = id.ix();
00607 int iy = id.iy();
00608
00609 if ( ismt >= 1 && ismt <= 9 ) ix = 101 - ix;
00610
00611 float xix = ix-0.5;
00612 float xiy = iy-0.5;
00613
00614 if (!good ) {
00615 if ( meEmulError_[ismt-1] ) meEmulError_[ismt-1]->Fill(xix, xiy);
00616 }
00617 if (!goodVeto) {
00618 if ( meVetoEmulError_[ismt-1] ) meVetoEmulError_[ismt-1]->Fill(xix, xiy);
00619 }
00620
00621 }
00622
00623 }
00624
00625 for ( unsigned int i=0; i<crystals->size(); i++ ) {
00626
00627 EEDetId id = (*crystals)[i];
00628
00629 int ix = id.ix();
00630 int iy = id.iy();
00631
00632 if ( ismt >= 1 && ismt <= 9 ) ix = 101 - ix;
00633
00634 float xix = ix-0.5;
00635 float xiy = iy-0.5;
00636
00637 if ( meEtMap[ismt-1] ) meEtMap[ismt-1]->Fill(xix, xiy, xvalEt);
00638 if ( meVeto[ismt-1] ) meVeto[ismt-1]->Fill(xix, xiy, xvalVeto);
00639
00640 }
00641
00642 }
00643
00644 if ( meOccupancyBxReal_[0] ) meOccupancyBxReal_[0]->Fill( bx, nTP[0] );
00645 if ( meOccupancyBxReal_[1] ) meOccupancyBxReal_[1]->Fill( bx, nTP[1] );
00646
00647 }
00648