CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EETriggerTowerTask.cc
Go to the documentation of this file.
1 /*
2  * \file EETriggerTowerTask.cc
3  *
4  * $Date: 2012/04/27 13:46:16 $
5  * $Revision: 1.82 $
6  * \author G. Della Ricca
7  * \author E. Di Marco
8  *
9 */
10 
11 #include <vector>
12 
15 
20 
22 
25 
26 #include <iostream>
27 
28 const int EETriggerTowerTask::nTTEta = 20;
29 const int EETriggerTowerTask::nTTPhi = 20;
30 const int EETriggerTowerTask::nSM = 18;
31 
33 
34  init_ = false;
35 
37 
38  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
39 
40  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
41 
42  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
43 
44  meEtSpectrumReal_[0] = 0;
45  meEtSpectrumReal_[1] = 0;
46  meEtSpectrumEmul_[0] = 0;
47  meEtSpectrumEmul_[1] = 0;
48  meEtSpectrumEmulMax_[0] = 0;
49  meEtSpectrumEmulMax_[1] = 0;
50  meEtBxReal_[0] = 0;
51  meEtBxReal_[1] = 0;
52  meOccupancyBxReal_[0] = 0;
53  meOccupancyBxReal_[1] = 0;
54  meTCCTimingCalo_[0] = 0;
55  meTCCTimingCalo_[1] = 0;
56  meTCCTimingMuon_[0] = 0;
57  meTCCTimingMuon_[1] = 0;
58  meEmulMatchIndex1D_[0] = 0;
59  meEmulMatchIndex1D_[1] = 0;
62 
70 
71  realCollection_ = ps.getParameter<edm::InputTag>("EcalTrigPrimDigiCollectionReal");
72  emulCollection_ = ps.getParameter<edm::InputTag>("EcalTrigPrimDigiCollectionEmul");
73  EEDigiCollection_ = ps.getParameter<edm::InputTag>("EEDigiCollection");
74  HLTResultsCollection_ = ps.getParameter<edm::InputTag>("HLTResultsCollection");
75 
76  HLTCaloHLTBit_ = ps.getUntrackedParameter<std::string>("HLTCaloHLTBit", "");
77  HLTMuonHLTBit_ = ps.getUntrackedParameter<std::string>("HLTMuonHLTBit", "");
78 
79  outputFile_ = ps.getUntrackedParameter<std::string>("OutputRootFile", "");
80 
81  LogDebug("EETriggerTowerTask") << "REAL digis: " << realCollection_;
82  LogDebug("EETriggerTowerTask") << "EMULATED digis: " << emulCollection_;
83 
84 }
85 
87 
88 }
89 
91 
92  array.reserve( nSM );
93  array.resize( nSM, static_cast<MonitorElement*>(0) );
94 
95 }
96 
98 
99  ievt_ = 0;
100 
101  if ( dqmStore_ ) {
102  dqmStore_->setCurrentFolder(prefixME_ + "/EETriggerTowerTask");
103  dqmStore_->rmdir(prefixME_ + "/EETriggerTowerTask");
104  }
105 
106 }
107 
109 
110  Numbers::initGeometry(c, false);
111 
112  if ( ! mergeRuns_ ) this->reset();
113 
114 }
115 
117 
118 }
119 
121 
122  for (int iside = 0; iside < 2; iside++) {
123  if ( meEtSpectrumReal_[iside] ) meEtSpectrumReal_[iside]->Reset();
124  if ( meEtSpectrumEmul_[iside] ) meEtSpectrumEmul_[iside]->Reset();
125  if ( meEtSpectrumEmulMax_[iside] ) meEtSpectrumEmulMax_[iside]->Reset();
126  if ( meEtBxReal_[iside] ) meEtBxReal_[iside]->Reset();
127  if ( meOccupancyBxReal_[iside] ) meOccupancyBxReal_[iside]->Reset();
128  if ( meTCCTimingCalo_[iside] ) meTCCTimingCalo_[iside]->Reset();
129  if ( meTCCTimingMuon_[iside] ) meTCCTimingMuon_[iside]->Reset();
130  if ( meEmulMatchIndex1D_[iside] ) meEmulMatchIndex1D_[iside]->Reset();
131  if ( meEmulMatchMaxIndex1D_[iside] ) meEmulMatchMaxIndex1D_[iside]->Reset();
132  }
133 
134  for (int i = 0; i < 18; i++) {
135 
136  if ( meEtMapReal_[i] ) meEtMapReal_[i]->Reset();
137  if ( meVetoReal_[i] ) meVetoReal_[i]->Reset();
138  if ( meEtMapEmul_[i] ) meEtMapEmul_[i]->Reset();
139  if ( meVetoEmul_[i] ) meVetoEmul_[i]->Reset();
140  if ( meEmulError_[i] ) meEmulError_[i]->Reset();
141  if ( meEmulMatch_[i] ) meEmulMatch_[i]->Reset();
142  if ( meVetoEmulError_[i] ) meVetoEmulError_[i]->Reset();
143 
144  }
145 
146 }
147 
149 
150  init_ = true;
151 
152  if ( dqmStore_ ) {
153  setup( "Real Digis",
154  (prefixME_ + "/EETriggerTowerTask").c_str(), false );
155 
156  setup( "Emulated Digis",
157  (prefixME_ + "/EETriggerTowerTask/Emulated").c_str(), true);
158  }
159  else {
160  edm::LogError("EETriggerTowerTask") << "Bad DQMStore, cannot book MonitorElements.";
161  }
162 }
163 
164 void EETriggerTowerTask::setup( std::string const &nameext,
165  std::string const &folder,
166  bool emulated ) {
167 
168  array1* meEtMap = &meEtMapReal_;
169 
170  if ( emulated ) {
171  meEtMap = &meEtMapEmul_;
172  }
173 
174  dqmStore_->setCurrentFolder(folder);
175 
176  std::string name;
177 
178  if (!emulated) {
179  name = "EETTT Et spectrum " + nameext + " EE -";
180  meEtSpectrumReal_[0] = dqmStore_->book1D(name, name, 256, 0., 256.);
181  meEtSpectrumReal_[0]->setAxisTitle("energy (ADC)", 1);
182 
183  name = "EETTT Et spectrum " + nameext + " EE +";
184  meEtSpectrumReal_[1] = dqmStore_->book1D(name, name, 256, 0., 256.);
185  meEtSpectrumReal_[1]->setAxisTitle("energy (ADC)", 1);
186 
187  name = "EETTT TP matching index EE -";
188  meEmulMatchIndex1D_[0] = dqmStore_->book1D(name, name, 7, -1., 6.);
189  meEmulMatchIndex1D_[0]->setAxisTitle("TP data matching emulator", 1);
190 
191  name = "EETTT TP matching index EE +";
192  meEmulMatchIndex1D_[1] = dqmStore_->book1D(name, name, 7, -1., 6.);
193  meEmulMatchIndex1D_[1]->setAxisTitle("TP data matching emulator", 1);
194 
195  name = "EETTT max TP matching index EE -";
196  meEmulMatchMaxIndex1D_[0] = dqmStore_->book1D(name, name, 7, -1., 6.);
197  meEmulMatchMaxIndex1D_[0]->setAxisTitle("Max TP data matching emulator", 1);
198 
199  name = "EETTT max TP matching index EE +";
200  meEmulMatchMaxIndex1D_[1] = dqmStore_->book1D(name, name, 7, -1., 6.);
201  meEmulMatchMaxIndex1D_[1]->setAxisTitle("Max TP data matching emulator", 1);
202 
203  double xbins[51];
204  for ( int i=0; i<=11; i++ ) xbins[i] = i-1; // begin of orbit
205  // abort gap in presence of calibration: [3381-3500]
206  // abort gap in absence of calibration: [3444-3500]
207  // using the wider abort gap always, start finer binning at bx=3371
208  for ( int i=12; i<=22; i++) xbins[i] = 3371+i-12;
209  // use 29 bins for the abort gap
210  for ( int i=23; i<=50; i++) xbins[i] = 3382+(i-23)*6;
211 
212  name = "EETTT Et vs bx " + nameext + " EE -";
213  meEtBxReal_[0] = dqmStore_->bookProfile(name, name, 50, xbins, 256, 0, 256);
214  meEtBxReal_[0]->setAxisTitle("bunch crossing", 1);
215  meEtBxReal_[0]->setAxisTitle("energy (ADC)", 2);
216 
217  name = "EETTT Et vs bx " + nameext + " EE +";
218  meEtBxReal_[1] = dqmStore_->bookProfile(name, name, 50, xbins, 256, 0, 256);
219  meEtBxReal_[1]->setAxisTitle("bunch crossing", 1);
220  meEtBxReal_[1]->setAxisTitle("energy (ADC)", 2);
221 
222  name = "EETTT TP occupancy vs bx " + nameext + " EE -";
223  meOccupancyBxReal_[0] = dqmStore_->bookProfile(name, name, 50, xbins, 2448, 0, 2448);
224  meOccupancyBxReal_[0]->setAxisTitle("bunch crossing", 1);
225  meOccupancyBxReal_[0]->setAxisTitle("TP number", 2);
226 
227  name = "EETTT TP occupancy vs bx " + nameext + " EE +";
228  meOccupancyBxReal_[1] = dqmStore_->bookProfile(name, name, 50, xbins, 2448, 0, 2448);
229  meOccupancyBxReal_[1]->setAxisTitle("bunch crossing", 1);
230  meOccupancyBxReal_[1]->setAxisTitle("TP number", 2);
231 
232  if ( HLTCaloHLTBit_ != "" ) {
233  name = "EETTT TCC timing calo triggers " + nameext + " EE -";
234  meTCCTimingCalo_[0] = dqmStore_->book2D(name, name, 36, 1, 37, 7, -1., 6.);
235  meTCCTimingCalo_[0]->setAxisTitle("nTCC", 1);
236  meTCCTimingCalo_[0]->setAxisTitle("TP data matching emulator", 2);
237 
238  name = "EETTT TCC timing calo triggers " + nameext + " EE +";
239  meTCCTimingCalo_[1] = dqmStore_->book2D(name, name, 36, 73, 109, 7, -1., 6.);
240  meTCCTimingCalo_[1]->setAxisTitle("nTCC", 1);
241  meTCCTimingCalo_[1]->setAxisTitle("TP data matching emulator", 2);
242  }
243 
244  if ( HLTMuonHLTBit_ != "" ) {
245  name = "EETTT TCC timing muon triggers " + nameext + " EE -";
246  meTCCTimingMuon_[0] = dqmStore_->book2D(name, name, 36, 1, 37, 7, -1., 6.);
247  meTCCTimingMuon_[0]->setAxisTitle("nTCC", 1);
248  meTCCTimingMuon_[0]->setAxisTitle("TP data matching emulator", 2);
249 
250  name = "EETTT TCC timing muon triggers " + nameext + " EE +";
251  meTCCTimingMuon_[1] = dqmStore_->book2D(name, name, 36, 73, 109, 7, -1., 6.);
252  meTCCTimingMuon_[1]->setAxisTitle("nTCC", 1);
253  meTCCTimingMuon_[1]->setAxisTitle("TP data matching emulator", 2);
254  }
255 
256  } else {
257  name = "EETTT Et spectrum " + nameext + " EE -";
258  meEtSpectrumEmul_[0] = dqmStore_->book1D(name, name, 256, 0., 256.);
259  meEtSpectrumEmul_[0]->setAxisTitle("energy (ADC)", 1);
260 
261  name = "EETTT Et spectrum " + nameext + " EE +";
262  meEtSpectrumEmul_[1] = dqmStore_->book1D(name, name, 256, 0., 256.);
263  meEtSpectrumEmul_[1]->setAxisTitle("energy (ADC)", 1);
264 
265  name = "EETTT Et spectrum " + nameext + " max EE -";
266  meEtSpectrumEmulMax_[0] = dqmStore_->book1D(name, name, 256, 0., 256.);
267  meEtSpectrumEmulMax_[0]->setAxisTitle("energy (ADC)", 1);
268 
269  name = "EETTT Et spectrum " + nameext + " max EE +";
270  meEtSpectrumEmulMax_[1] = dqmStore_->book1D(name, name, 256, 0., 256.);
271  meEtSpectrumEmulMax_[1]->setAxisTitle("energy (ADC)", 1);
272  }
273 
274  for (int i = 0; i < 18; i++) {
275 
276  name = "EETTT Et map " + nameext + " " + Numbers::sEE(i+1);
277  (*meEtMap)[i] = dqmStore_->bookProfile2D(name, name,
278  50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50.,
279  50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.,
280  256, 0, 256.);
281  (*meEtMap)[i]->setAxisTitle("ix", 1);
282  if ( i+1 >= 1 && i+1 <= 9 ) (*meEtMap)[i]->setAxisTitle("101-ix", 1);
283  (*meEtMap)[i]->setAxisTitle("iy", 2);
284  dqmStore_->tag((*meEtMap)[i], i+1);
285 
286  if (!emulated) {
287 
288  name = "EETTT EmulError " + Numbers::sEE(i+1);
289  meEmulError_[i] = dqmStore_->book2D(name, name,
290  50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50.,
291  50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50. );
292  meEmulError_[i]->setAxisTitle("ix", 1);
293  if ( i+1 >= 1 && i+1 <= 9 ) meEmulError_[i]->setAxisTitle("101-ix", 1);
294  meEmulError_[i]->setAxisTitle("iy", 2);
295  dqmStore_->tag(meEmulError_[i], i+1);
296 
297  name = "EETTT EmulMatch " + Numbers::sEE(i+1);
298  meEmulMatch_[i] = dqmStore_->book3D(name, name,
299  50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50.,
300  50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.,
301  6, 0., 6.);
302  meEmulMatch_[i]->setAxisTitle("ix", 1);
303  if ( i+1 >= 1 && i+1 <= 9 ) meEmulMatch_[i]->setAxisTitle("101-ix", 1);
304  meEmulMatch_[i]->setAxisTitle("iy", 2);
305  dqmStore_->tag(meEmulMatch_[i], i+1);
306 
307  name = "EETTT EmulFineGrainVetoError " + Numbers::sEE(i+1);
308  meVetoEmulError_[i] = dqmStore_->book2D(name, name,
309  50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50.,
310  50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.);
311  meVetoEmulError_[i]->setAxisTitle("ix", 1);
312  if ( i+1 >= 1 && i+1 <= 9 ) meVetoEmulError_[i]->setAxisTitle("101-ix", 1);
313  meVetoEmulError_[i]->setAxisTitle("iy", 2);
314  dqmStore_->tag(meVetoEmulError_[i], i+1);
315 
316  }
317  }
318 
319 }
320 
322 
323  if ( ! init_ ) return;
324 
325  if ( dqmStore_ ) {
326 
327  if ( !outputFile_.empty() ) dqmStore_->save( outputFile_.c_str() );
328 
329  dqmStore_->rmdir( prefixME_ + "/EETriggerTowerTask" );
330 
331  }
332 
333  init_ = false;
334 
335 }
336 
338 
339  edm::LogInfo("EETriggerTowerTask") << "analyzed " << ievt_ << " events";
340 
341  if ( enableCleanup_ ) this->cleanup();
342 
343 }
344 
346 
347  if ( ! init_ ) this->setup();
348 
349  ievt_++;
350 
352 
353  if ( e.getByLabel(realCollection_, realDigis) ) {
354 
355  int neetpd = realDigis->size();
356  LogDebug("EETriggerTowerTask") << "event " << ievt_ << " trigger primitive digi collection size: " << neetpd;
357 
358  processDigis( e,
359  realDigis,
360  meEtMapReal_,
361  meVetoReal_);
362 
363  } else {
364  edm::LogWarning("EETriggerTowerTask") << realCollection_ << " not available";
365  }
366 
368 
369  if ( e.getByLabel(emulCollection_, emulDigis) ) {
370 
372 
373  if ( !e.getByLabel(HLTResultsCollection_, hltResults) ) {
375  }
376 
377  if ( !e.getByLabel(HLTResultsCollection_, hltResults) ) {
379  }
380 
381  if ( e.getByLabel(HLTResultsCollection_, hltResults) ) {
382 
383  processDigis( e,
384  emulDigis,
385  meEtMapEmul_,
386  meVetoEmul_,
387  realDigis,
388  hltResults);
389 
390  } else {
391  edm::LogWarning("EETriggerTowerTask") << HLTResultsCollection_ << " not available";
392  }
393 
394  } else {
395  edm::LogInfo("EETriggerTowerTask") << emulCollection_ << " not available";
396  }
397 
398 }
399 
400 void
402  array1& meEtMap,
403  array1& meVeto,
406 
407  int bx = e.bunchCrossing();
408  int nTP[2];
409  nTP[0] = nTP[1] = 0;
410 
411  // indexes are: readoutCrystalsInTower[TCCId][iTT]
412  int readoutCrystalsInTower[108][41];
413  for (int itcc = 0; itcc < 108; itcc++) {
414  for (int itt = 0; itt < 41; itt++) readoutCrystalsInTower[itcc][itt] = 0;
415  }
416 
417  if ( compDigis.isValid() ) {
418 
419  edm::Handle<EEDigiCollection> crystalDigis;
420 
421  if ( e.getByLabel(EEDigiCollection_, crystalDigis) ) {
422 
423  for ( EEDigiCollection::const_iterator cDigiItr = crystalDigis->begin(); cDigiItr != crystalDigis->end(); ++cDigiItr ) {
424 
425  EEDetId id = cDigiItr->id();
426 
427  int ix = id.ix();
428  int iy = id.iy();
429  int ism = Numbers::iSM( id );
430  int itcc = Numbers::iTCC( ism, EcalEndcap, ix, iy );
431  int itt = Numbers::iTT( ism, EcalEndcap, ix, iy );
432 
433  readoutCrystalsInTower[itcc-1][itt-1]++;
434 
435  }
436 
437  } else {
438  edm::LogWarning("EETriggerTowerTask") << EEDigiCollection_ << " not available";
439  }
440 
441  }
442 
443  bool caloTrg = false;
444  bool muonTrg = false;
445 
446  if ( hltResults.isValid() ) {
447 
448  int ntrigs = hltResults->size();
449  if ( ntrigs!=0 ) {
450 
451  const edm::TriggerNames & triggerNames = e.triggerNames(*hltResults);
452 
453  for ( int itrig = 0; itrig != ntrigs; ++itrig ) {
454  std::string trigName = triggerNames.triggerName(itrig);
455  bool accept = hltResults->accept(itrig);
456 
457  if ( trigName == HLTCaloHLTBit_ ) caloTrg = accept;
458 
459  if ( trigName == HLTMuonHLTBit_ ) muonTrg = accept;
460 
461  }
462 
463  } else {
464  edm::LogWarning("EBTriggerTowerTask") << " zero size trigger names in input TriggerResults";
465  }
466 
467  }
468 
469  for ( EcalTrigPrimDigiCollection::const_iterator tpdigiItr = digis->begin(); tpdigiItr != digis->end(); ++tpdigiItr ) {
470 
471  if ( Numbers::subDet( tpdigiItr->id() ) != EcalEndcap ) continue;
472 
473  int ismt = Numbers::iSM( tpdigiItr->id() );
474  int itt = Numbers::iTT( tpdigiItr->id() );
475  int itcc = Numbers::iTCC( tpdigiItr->id() );
476 
477  std::vector<DetId>* crystals = Numbers::crystals( tpdigiItr->id() );
478 
479  float xvalEt = tpdigiItr->compressedEt();
480  float xvalVeto = 0.5 + tpdigiItr->fineGrain();
481 
482  bool good = true;
483  bool goodVeto = true;
484 
485  int compDigiInterest = -1;
486 
487  bool matchSample[6];
488  for (int j=0; j<6; j++) matchSample[j]=false;
489 
490  if ( compDigis.isValid() ) {
491 
492  if ( ismt >= 1 && ismt <= 9 ) {
493  if ( meEtSpectrumEmul_[0] ) meEtSpectrumEmul_[0]->Fill( xvalEt );
494  } else {
495  if ( meEtSpectrumEmul_[1] ) meEtSpectrumEmul_[1]->Fill( xvalEt );
496  }
497 
498  float maxEt = 0;
499  int maxTPIndex = -1;
500  for (int j=0; j<5; j++) {
501  float EtTP = (*tpdigiItr)[j].compressedEt();
502  if ( EtTP > maxEt ) {
503  maxEt = EtTP;
504  maxTPIndex = j+1;
505  }
506  }
507 
508  if ( ismt >= 1 && ismt <= 9 ) {
509  if ( meEtSpectrumEmulMax_[0] ) meEtSpectrumEmulMax_[0]->Fill( maxEt );
510  if ( meEmulMatchMaxIndex1D_[0] && maxEt > 0 ) meEmulMatchMaxIndex1D_[0]->Fill( maxTPIndex );
511  } else {
512  if ( meEtSpectrumEmulMax_[1] ) meEtSpectrumEmulMax_[1]->Fill( maxEt );
513  if ( meEmulMatchMaxIndex1D_[1] && maxEt > 0 ) meEmulMatchMaxIndex1D_[1]->Fill( maxTPIndex );
514  }
515 
516  EcalTrigPrimDigiCollection::const_iterator compDigiItr = compDigis->find( tpdigiItr->id().rawId() );
517  if ( compDigiItr != compDigis->end() ) {
518  int compDigiEt = compDigiItr->compressedEt();
519  compDigiInterest = (compDigiItr->ttFlag() & 0x3);
520 
521  if ( ismt >= 1 && ismt <= 9 ) {
522  if ( compDigiEt > 0 ) nTP[0]++;
523  if ( meEtSpectrumReal_[0] ) meEtSpectrumReal_[0]->Fill( compDigiEt );
524  if ( meEtBxReal_[0] && compDigiEt > 0 ) meEtBxReal_[0]->Fill( bx, compDigiEt );
525  } else {
526  if ( compDigiEt > 0 ) nTP[1]++;
527  if ( meEtSpectrumReal_[1] ) meEtSpectrumReal_[1]->Fill( compDigiEt );
528  if ( meEtBxReal_[1] && compDigiEt > 0 ) meEtBxReal_[1]->Fill( bx, compDigiEt );
529  }
530 
531  // compare the 5 TPs with different time-windows
532  // sample 0 means no match, 1-5: sample of the TP that matches
533  matchSample[0]=false;
534  bool matchedAny=false;
535 
536  for (int j=0; j<5; j++) {
537  if ((*tpdigiItr)[j].compressedEt() == compDigiEt ) {
538  matchSample[j+1]=true;
539  matchedAny=true;
540  } else {
541  matchSample[j+1]=false;
542  }
543  }
544 
545  if (!matchedAny) matchSample[0]=true;
546 
547  // check if the tower has been readout completely and if it is medium or high interest
548  if (readoutCrystalsInTower[itcc-1][itt-1] == int(crystals->size()) &&
549  (compDigiInterest == 1 || compDigiInterest == 3) && compDigiEt > 0) {
550 
551  if ( tpdigiItr->compressedEt() != compDigiEt ) {
552  good = false;
553  }
554  if ( tpdigiItr->fineGrain() != compDigiItr->fineGrain() ) {
555  goodVeto = false;
556  }
557 
558  for (int j=0; j<6; j++) {
559  if (matchSample[j]) {
560 
561  int index = ( j==0 ) ? -1 : j;
562 
563  if ( ismt >= 1 && ismt <= 9 ) {
564  meEmulMatchIndex1D_[0]->Fill(index+0.5);
565  } else {
566  meEmulMatchIndex1D_[1]->Fill(index+0.5);
567  }
568 
569  for ( unsigned int i=0; i<crystals->size(); i++ ) {
570 
571  EEDetId id = (*crystals)[i];
572 
573  int ix = id.ix();
574  int iy = id.iy();
575 
576  if ( ismt >= 1 && ismt <= 9 ) ix = 101 - ix;
577 
578  float xix = ix-0.5;
579  float xiy = iy-0.5;
580 
581  meEmulMatch_[ismt-1]->Fill(xix, xiy, j+0.5);
582  if ( ismt >= 1 && ismt <= 9 ) {
583  if ( meTCCTimingCalo_[0] && caloTrg ) meTCCTimingCalo_[0]->Fill( itcc, index+0.5 );
584  if ( meTCCTimingMuon_[0] && muonTrg ) meTCCTimingMuon_[0]->Fill( itcc, index+0.5 );
585  } else {
586  if ( meTCCTimingCalo_[1] && caloTrg ) meTCCTimingCalo_[1]->Fill( itcc, index+0.5 );
587  if ( meTCCTimingMuon_[1] && muonTrg ) meTCCTimingMuon_[1]->Fill( itcc, index+0.5 );
588  }
589 
590  } // loop on crystals
591 
592  }
593  }
594 
595  } // check readout
596 
597  } else {
598  good = false;
599  goodVeto = false;
600  }
601 
602  for ( unsigned int i=0; i<crystals->size(); i++ ) {
603 
604  EEDetId id = (*crystals)[i];
605 
606  int ix = id.ix();
607  int iy = id.iy();
608 
609  if ( ismt >= 1 && ismt <= 9 ) ix = 101 - ix;
610 
611  float xix = ix-0.5;
612  float xiy = iy-0.5;
613 
614  if (!good ) {
615  if ( meEmulError_[ismt-1] ) meEmulError_[ismt-1]->Fill(xix, xiy);
616  }
617  if (!goodVeto) {
618  if ( meVetoEmulError_[ismt-1] ) meVetoEmulError_[ismt-1]->Fill(xix, xiy);
619  }
620 
621  } // loop on crystals
622 
623  } // compDigis.isValid
624 
625  for ( unsigned int i=0; i<crystals->size(); i++ ) {
626 
627  EEDetId id = (*crystals)[i];
628 
629  int ix = id.ix();
630  int iy = id.iy();
631 
632  if ( ismt >= 1 && ismt <= 9 ) ix = 101 - ix;
633 
634  float xix = ix-0.5;
635  float xiy = iy-0.5;
636 
637  if ( meEtMap[ismt-1] ) meEtMap[ismt-1]->Fill(xix, xiy, xvalEt);
638  if ( meVeto[ismt-1] ) meVeto[ismt-1]->Fill(xix, xiy, xvalVeto);
639 
640  } // loop on crystals
641 
642  } // loop on TP
643 
644  if ( meOccupancyBxReal_[0] ) meOccupancyBxReal_[0]->Fill( bx, nTP[0] );
645  if ( meOccupancyBxReal_[1] ) meOccupancyBxReal_[1]->Fill( bx, nTP[1] );
646 
647 }
648 
#define LogDebug(id)
bool enableCleanup_
remove MEs
T getParameter(std::string const &) const
void endJob(void)
EndJob.
T getUntrackedParameter(std::string const &, T const &) const
static std::string sEE(const unsigned ism)
Definition: Numbers.cc:226
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:199
virtual ~EETriggerTowerTask()
Destructor.
int ix() const
Definition: EEDetId.h:71
array1 meVetoEmul_
Emulated fine grain veto vs ix vs iy, for each SM.
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
const double xbins[]
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
MonitorElement * meEtBxReal_[2]
number and ET average of TP vs bx for the whole EE+/-
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
MonitorElement * book3D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ)
Book 3D histogram.
Definition: DQMStore.cc:979
Some &quot;id&quot; conversions.
std::string outputFile_
debug output root file. if empty, no output file created.
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
static const int nSM
number of supermodules
void setup(void)
Setup.
static const int nTTPhi
number of trigger towers in phi
MonitorElement * meOccupancyBxReal_[2]
std::vector< T >::const_iterator const_iterator
int bunchCrossing() const
Definition: EventBase.h:62
void reserveArray(array1 &array)
reserve an array to hold one histogram per supermodule
MonitorElement * meEtSpectrumEmul_[2]
edm::InputTag emulCollection_
to find the input collection of emulated digis
static int ix0EE(const unsigned ism)
Definition: Numbers.cc:773
void beginJob(void)
BeginJob.
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:22
static int iy0EE(const unsigned ism)
Definition: Numbers.cc:812
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
void Fill(long long x)
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1354
static std::vector< DetId > * crystals(const EcalTrigTowerDetId &id)
Definition: Numbers.cc:585
edm::InputTag HLTResultsCollection_
to find the input collection of HLT bits
std::vector< MonitorElement * > array1
1D array
void processDigis(const edm::Event &e, const edm::Handle< EcalTrigPrimDigiCollection > &digis, array1 &meEtMap, array1 &meVeto, const edm::Handle< EcalTrigPrimDigiCollection > &compDigis=edm::Handle< EcalTrigPrimDigiCollection >(), const edm::Handle< edm::TriggerResults > &hltResults=edm::Handle< edm::TriggerResults >())
process a collection of digis, either real or emulated
static const int nTTEta
number of trigger towers in eta
static unsigned iTCC(const unsigned ism, const EcalSubdetector subdet, const unsigned i1, const unsigned i2)
Definition: Numbers.cc:534
DQMStore * dqmStore_
DQM back-end interface.
MonitorElement * meEmulMatchMaxIndex1D_[2]
array1 meEtMapEmul_
Emulated Et vs ix vs iy, for each SM.
array1 meVetoReal_
fine grain veto vs ix vs iy, for each SM
int j
Definition: DBlmapReader.cc:9
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1031
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
array1 meEtMapReal_
Et vs ix vs iy, for each SM.
std::string prefixME_
path to MEs
EETriggerTowerTask(const edm::ParameterSet &ps)
Constructor.
MonitorElement * meEtSpectrumEmulMax_[2]
bool mergeRuns_
merge MEs across runs
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:50
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
std::string const & label() const
Definition: InputTag.h:25
void reset(void)
Reset.
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:246
MonitorElement * meEtSpectrumReal_[2]
ET spectrums for the whole EE+/-.
edm::InputTag realCollection_
to find the input collection of real digis
static EcalSubdetector subDet(const EBDetId &id)
Definition: Numbers.cc:145
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
MonitorElement * meTCCTimingCalo_[2]
TCC timing.
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
std::string const & instance() const
Definition: InputTag.h:26
MonitorElement * meEmulMatchIndex1D_[2]
1D emulator match 1D
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
void cleanup(void)
Cleanup.
edm::InputTag EEDigiCollection_
to find the input collection of crystal digis
static unsigned iTT(const unsigned ism, const EcalSubdetector subdet, const unsigned i1, const unsigned i2)
Definition: Numbers.cc:485
Definition: Run.h:33
MonitorElement * meTCCTimingMuon_[2]
int ievt_
local event counter
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:1175