CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EEClusterTask.cc
Go to the documentation of this file.
1 /*
2  * \file EEClusterTask.cc
3  *
4  * \author G. Della Ricca
5  * \author E. Di Marco
6  *
7 */
8 
9 #include <iostream>
10 #include <fstream>
11 #include <vector>
12 #include <math.h>
13 
16 
18 
20 
31 
33 
35 
36 #include "TLorentzVector.h"
37 
39 
40  init_ = false;
41 
43 
44  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
45 
46  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
47 
48  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
49 
50  // parameters...
51  EcalRawDataCollection_ = consumes<EcalRawDataCollection>(ps.getParameter<edm::InputTag>("EcalRawDataCollection"));
52  BasicClusterCollection_ = consumes<edm::View<reco::CaloCluster> >(ps.getParameter<edm::InputTag>("BasicClusterCollection"));
53  SuperClusterCollection_ = consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("SuperClusterCollection"));
54  EcalRecHitCollection_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("EcalRecHitCollection"));
55 
56  // histograms...
57  meBCEne_ = 0;
58  meBCNum_ = 0;
59  meBCSiz_ = 0;
60 
61  meBCEneFwdMap_ = 0;
62  meBCNumFwdMap_ = 0;
63  meBCETFwdMap_ = 0;
64  meBCSizFwdMap_ = 0;
65 
74 
75  meBCEneBwdMap_ = 0;
76  meBCNumBwdMap_ = 0;
77  meBCETBwdMap_ = 0;
78  meBCSizBwdMap_ = 0;
79 
88 
89  meSCEne_ = 0;
90  meSCNum_ = 0;
91  meSCSiz_ = 0;
92 
93  meSCCrystalSiz_ = 0;
94  meSCSeedEne_ = 0;
95  meSCEne2_ = 0;
96  meSCEneVsEMax_ = 0;
97  meSCEneLowScale_ = 0;
98  meSCSeedMapOcc_[0] = 0;
99  meSCSeedMapOcc_[1] = 0;
100  meSCMapSingleCrystal_[0] = 0;
101  meSCMapSingleCrystal_[1] = 0;
102 
103  mes1s9_ = 0;
104  mes1s9thr_ = 0;
105  mes9s25_ = 0;
106 
107  meInvMassPi0_ = 0;
108  meInvMassJPsi_ = 0;
109  meInvMassZ0_ = 0;
110  meInvMassHigh_ = 0;
111 
112  meInvMassPi0Sel_ = 0;
113  meInvMassJPsiSel_ = 0;
114  meInvMassZ0Sel_ = 0;
115  meInvMassHighSel_ = 0;
116 
117  thrS4S9_ = 0.85;
118  thrClusEt_ = 0.250;
119  thrCandEt_ = 0.800;
120 
121 }
122 
124 
125 }
126 
128 
129  ievt_ = 0;
130 
131  if ( dqmStore_ ) {
132  dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTask");
133  dqmStore_->rmdir(prefixME_ + "/EEClusterTask");
134  }
135 
136 }
137 
139 
140  Numbers::initGeometry(c, false);
141 
142  if ( ! mergeRuns_ ) this->reset();
143 
144 }
145 
147 
148 }
149 
151 
152  if ( meBCEne_ ) meBCEne_->Reset();
153 
154  if ( meBCNum_ ) meBCNum_->Reset();
155 
156  if ( meBCSiz_ ) meBCSiz_->Reset();
157 
159 
161 
163 
165 
167 
169 
171 
173 
175 
177 
179 
181 
183 
185 
187 
189 
191 
193 
195 
197 
199 
201 
203 
205 
206  if ( meSCEne_ ) meSCEne_->Reset();
207 
208  if ( meSCNum_ ) meSCNum_->Reset();
209 
210  if ( meSCSiz_ ) meSCSiz_->Reset();
211 
213 
214  if ( meSCSeedEne_ ) meSCSeedEne_->Reset();
215 
216  if ( meSCEne2_ ) meSCEne2_->Reset();
217 
219 
221 
222  if ( meSCSeedMapOcc_[0] ) meSCSeedMapOcc_[0]->Reset();
223 
224  if ( meSCSeedMapOcc_[1] ) meSCSeedMapOcc_[1]->Reset();
225 
227 
229 
230  if ( mes1s9_ ) mes1s9_->Reset();
231 
232  if ( mes1s9thr_ ) mes1s9thr_->Reset();
233 
234  if ( mes9s25_ ) mes9s25_->Reset();
235 
237 
239 
240  if ( meInvMassZ0_ ) meInvMassZ0_->Reset();
241 
243 
245 
247 
249 
251 
252 }
253 
255 
256  init_ = true;
257 
259 
260  if ( dqmStore_ ) {
261  dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTask");
262 
263  name = "EECLT BC energy";
264  meBCEne_ = dqmStore_->book1D(name, name, 100, 0., 150.);
265  meBCEne_->setAxisTitle("energy (GeV)", 1);
266 
267  name = "EECLT BC number";
268  meBCNum_ = dqmStore_->book1D(name, name, 100, 0., 150.);
269  meBCNum_->setAxisTitle("number of clusters", 1);
270 
271  name = "EECLT BC size";
272  meBCSiz_ = dqmStore_->book1D(name, name, 100, 0., 150.);
273  meBCSiz_->setAxisTitle("cluster size", 1);
274 
275  name = "EECLT BC energy map EE +";
276  meBCEneFwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 500., "s");
277  meBCEneFwdMap_->setAxisTitle("x", 1);
278  meBCEneFwdMap_->setAxisTitle("y", 2);
279 
280  name = "EECLT BC number map EE +";
281  meBCNumFwdMap_ = dqmStore_->book2D(name, name, 20, -150., 150., 20, -150., 150.);
282  meBCNumFwdMap_->setAxisTitle("x", 1);
283  meBCNumFwdMap_->setAxisTitle("y", 2);
284 
285  name = "EECLT BC ET map EE +";
286  meBCETFwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 500., "s");
287  meBCETFwdMap_->setAxisTitle("x", 1);
288  meBCETFwdMap_->setAxisTitle("y", 2);
289 
290  name = "EECLT BC size map EE +";
291  meBCSizFwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 100., "s");
292  meBCSizFwdMap_->setAxisTitle("x", 1);
293  meBCSizFwdMap_->setAxisTitle("y", 2);
294 
295  name = "EECLT BC energy projection eta EE +";
296  meBCEneFwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, 1.479, 3.0, 100, 0., 500., "s");
298  meBCEneFwdMapProjEta_->setAxisTitle("energy (GeV)", 2);
299 
300  name = "EECLT BC energy projection phi EE +";
301  meBCEneFwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 500., "s");
303  meBCEneFwdMapProjPhi_->setAxisTitle("energy (GeV)", 2);
304 
305  name = "EECLT BC number projection eta EE +";
306  meBCNumFwdMapProjEta_ = dqmStore_->book1D(name, name, 20, 1.479, 3.0);
308  meBCNumFwdMapProjEta_->setAxisTitle("number of clusters", 2);
309 
310  name = "EECLT BC number projection phi EE +";
311  meBCNumFwdMapProjPhi_ = dqmStore_->book1D(name, name, 50, -M_PI, M_PI);
313  meBCNumFwdMapProjPhi_->setAxisTitle("number of clusters", 2);
314 
315  name = "EECLT BC ET projection eta EE +";
316  meBCETFwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, 1.479, 3.0, 100, 0., 500., "s");
318  meBCETFwdMapProjEta_->setAxisTitle("transverse energy (GeV)", 2);
319 
320  name = "EECLT BC ET projection phi EE +";
321  meBCETFwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 500., "s");
323  meBCETFwdMapProjPhi_->setAxisTitle("transverse energy (GeV)", 2);
324 
325  name = "EECLT BC size projection eta EE +";
326  meBCSizFwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, 1.479, 3.0, 100, 0., 100., "s");
328  meBCSizFwdMapProjEta_->setAxisTitle("cluster size", 2);
329 
330  name = "EECLT BC size projection phi EE +";
331  meBCSizFwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 100., "s");
333  meBCSizFwdMapProjPhi_->setAxisTitle("cluster size", 2);
334 
335  name = "EECLT BC energy map EE -";
336  meBCEneBwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 500., "s");
337  meBCEneBwdMap_->setAxisTitle("x", 1);
338  meBCEneBwdMap_->setAxisTitle("y", 2);
339 
340  name = "EECLT BC number map EE -";
341  meBCNumBwdMap_ = dqmStore_->book2D(name, name, 20, -150., 150., 20, -150., 150.);
342  meBCNumBwdMap_->setAxisTitle("x", 1);
343  meBCNumBwdMap_->setAxisTitle("y", 2);
344 
345  name = "EECLT BC ET map EE -";
346  meBCETBwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 500., "s");
347  meBCETBwdMap_->setAxisTitle("x", 1);
348  meBCETBwdMap_->setAxisTitle("y", 2);
349 
350  name = "EECLT BC size map EE -";
351  meBCSizBwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 100., "s");
352  meBCSizBwdMap_->setAxisTitle("x", 1);
353  meBCSizBwdMap_->setAxisTitle("y", 2);
354 
355  name = "EECLT BC energy projection eta EE -";
356  meBCEneBwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, -3.0, -1.479, 100, 0., 500., "s");
358  meBCEneBwdMapProjEta_->setAxisTitle("energy (GeV)", 2);
359 
360  name = "EECLT BC energy projection phi EE -";
361  meBCEneBwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 500., "s");
363  meBCEneBwdMapProjPhi_->setAxisTitle("energy (GeV)", 2);
364 
365  name = "EECLT BC number projection eta EE -";
366  meBCNumBwdMapProjEta_ = dqmStore_->book1D(name, name, 20, -3.0, -1.479);
368  meBCNumBwdMapProjEta_->setAxisTitle("number of clusters", 2);
369 
370  name = "EECLT BC number projection phi EE -";
371  meBCNumBwdMapProjPhi_ = dqmStore_->book1D(name, name, 50, -M_PI, M_PI);
373  meBCNumBwdMapProjPhi_->setAxisTitle("number of clusters", 2);
374 
375  name = "EECLT BC ET projection eta EE -";
376  meBCETBwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, -3.0, -1.479, 100, 0., 500., "s");
378  meBCETBwdMapProjEta_->setAxisTitle("transverse energy (GeV)", 2);
379 
380  name = "EECLT BC ET projection phi EE -";
381  meBCETBwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 500., "s");
383  meBCETBwdMapProjPhi_->setAxisTitle("transverse energy (GeV)", 2);
384 
385  name = "EECLT BC size projection eta EE -";
386  meBCSizBwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, -3.0, -1.479, 100, 0., 100., "s");
388  meBCSizBwdMapProjEta_->setAxisTitle("cluster size", 2);
389 
390  name = "EECLT BC size projection phi EE -";
391  meBCSizBwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 100., "s");
393  meBCSizBwdMapProjPhi_->setAxisTitle("cluster size", 2);
394 
395  name = "EECLT SC energy";
396  meSCEne_ = dqmStore_->book1D(name, name, 100, 0., 150.);
397  meSCEne_->setAxisTitle("energy (GeV)", 1);
398 
399  name = "EECLT SC number";
400  meSCNum_ = dqmStore_->book1D(name, name, 50, 0., 50.);
401  meSCNum_->setAxisTitle("number of clusters", 1);
402 
403  name = "EECLT SC size";
404  meSCSiz_ = dqmStore_->book1D(name, name, 50, 0., 50.);
405  meSCSiz_->setAxisTitle("cluster size", 1);
406 
407  name = "EECLT SC size (crystal)";
408  meSCCrystalSiz_ = dqmStore_->book1D(name, name, 150, 0, 150);
409  meSCCrystalSiz_->setAxisTitle("cluster size in crystals", 1);
410 
411  name = "EECLT SC seed crystal energy";
412  meSCSeedEne_ = dqmStore_->book1D(name, name, 100, 0., 10.);
413  meSCSeedEne_->setAxisTitle("seed crystal energy (GeV)", 1);
414 
415  name = "EECLT SC e2";
416  meSCEne2_ = dqmStore_->book1D(name, name, 100, 0., 10.);
417  meSCEne2_->setAxisTitle("seed + highest neighbor crystal energy (GeV)", 1);
418 
419  name = "EECLT SC energy vs seed crystal energy";
420  meSCEneVsEMax_ = dqmStore_->book2D(name, name, 50, 0., 10., 50, 0., 10.);
421  meSCEneVsEMax_->setAxisTitle("seed crystal energy (GeV)", 1);
422  meSCEneVsEMax_->setAxisTitle("cluster energy (GeV)", 2);
423 
424  name = "EECLT SC energy (low scale)";
425  meSCEneLowScale_ = dqmStore_->book1D(name, name, 100, 0., 10.);
426  meSCEneLowScale_->setAxisTitle("cluster energy (GeV)", 1);
427 
428  name = "EECLT SC seed occupancy map EE -";
429  meSCSeedMapOcc_[0] = dqmStore_->book2D(name, name, 20, 0., 100., 20, 0., 100.);
430  meSCSeedMapOcc_[0]->setAxisTitle("jx'", 1);
431  meSCSeedMapOcc_[0]->setAxisTitle("jy'", 2);
432 
433  name = "EECLT SC seed occupancy map EE +";
434  meSCSeedMapOcc_[1] = dqmStore_->book2D(name, name, 20, 0., 100., 20, 0., 100.);
435  meSCSeedMapOcc_[1]->setAxisTitle("jx'", 1);
436  meSCSeedMapOcc_[1]->setAxisTitle("jy'", 2);
437 
438  name = "EECLT SC single crystal cluster seed occupancy map EE -";
439  meSCMapSingleCrystal_[0] = dqmStore_->book2D(name, name, 20, 0., 100., 20, 0., 100.);
440  meSCMapSingleCrystal_[0]->setAxisTitle("jx'", 1);
441  meSCMapSingleCrystal_[0]->setAxisTitle("jy'", 2);
442 
443  name = "EECLT SC single crystal cluster seed occupancy map EE +";
444  meSCMapSingleCrystal_[1] = dqmStore_->book2D(name, name, 20, 0., 100., 20, 0., 100.);
445  meSCMapSingleCrystal_[1]->setAxisTitle("jx'", 1);
446  meSCMapSingleCrystal_[1]->setAxisTitle("jy'", 2);
447 
448  name = "EECLT s1s9";
449  mes1s9_ = dqmStore_->book1D(name, name, 50, 0., 1.5);
450  mes1s9_->setAxisTitle("s1/s9", 1);
451 
452  name = "EECLT s1s9 thr";
453  mes1s9thr_ = dqmStore_->book1D(name, name, 50, 0., 1.5);
454  mes1s9thr_->setAxisTitle("s1/s9", 1);
455 
456  name = "EECLT s9s25";
457  mes9s25_ = dqmStore_->book1D(name, name, 75, 0., 1.5);
458  mes9s25_->setAxisTitle("s9/s25", 1);
459 
460  name = "EECLT dicluster invariant mass Pi0";
461  meInvMassPi0_ = dqmStore_->book1D(name, name, 50, 0.0, 0.500);
462  meInvMassPi0_->setAxisTitle("mass (GeV)", 1);
463 
464  name = "EECLT dicluster invariant mass JPsi";
465  meInvMassJPsi_ = dqmStore_->book1D(name, name, 50, 2.9, 3.3);
466  meInvMassJPsi_->setAxisTitle("mass (GeV)", 1);
467 
468  name = "EECLT dicluster invariant mass Z0";
469  meInvMassZ0_ = dqmStore_->book1D(name, name, 50, 40, 110);
470  meInvMassZ0_->setAxisTitle("mass (GeV)", 1);
471 
472  name = "EECLT dicluster invariant mass high";
473  meInvMassHigh_ = dqmStore_->book1D(name, name, 500, 110, 3000);
474  meInvMassHigh_->setAxisTitle("mass (GeV)", 1);
475 
476  name = "EECLT dicluster invariant mass Pi0 sel";
477  meInvMassPi0Sel_ = dqmStore_->book1D(name, name, 50, 0.00, 0.500);
478  meInvMassPi0Sel_->setAxisTitle("mass (GeV)", 1);
479 
480  name = "EECLT dicluster invariant mass JPsi sel";
481  meInvMassJPsiSel_ = dqmStore_->book1D(name, name, 50, 2.9, 3.3);
482  meInvMassJPsiSel_->setAxisTitle("mass (GeV)", 1);
483 
484  name = "EECLT dicluster invariant mass Z0 sel";
485  meInvMassZ0Sel_ = dqmStore_->book1D(name, name, 50, 40, 110);
486  meInvMassZ0Sel_->setAxisTitle("mass (GeV)", 1);
487 
488  name = "EECLT dicluster invariant mass high sel";
489  meInvMassHighSel_ = dqmStore_->book1D(name, name, 500, 110, 3000);
490  meInvMassHighSel_->setAxisTitle("mass (GeV)", 1);
491 
492  }
493 
494 }
495 
497 
498  if ( ! init_ ) return;
499 
500  if ( dqmStore_ ) {
501  dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTask");
502 
504  meBCEne_ = 0;
505 
507  meBCNum_ = 0;
508 
510  meBCSiz_ = 0;
511 
513  meBCEneFwdMap_ = 0;
514 
516  meBCNumFwdMap_ = 0;
517 
519  meBCETFwdMap_ = 0;
520 
522  meBCSizFwdMap_ = 0;
523 
526 
529 
532 
535 
538 
541 
544 
547 
549  meBCEneBwdMap_ = 0;
550 
552  meBCNumBwdMap_ = 0;
553 
555  meBCETBwdMap_ = 0;
556 
558  meBCSizBwdMap_ = 0;
559 
562 
565 
568 
571 
574 
577 
580 
583 
585  meSCEne_ = 0;
586 
588  meSCNum_ = 0;
589 
591  meSCSiz_ = 0;
592 
594  meSCCrystalSiz_ = 0;
595 
597  meSCSeedEne_ = 0;
598 
600  meSCEne2_ = 0;
601 
603  meSCEneVsEMax_ = 0;
604 
606  meSCEneLowScale_ = 0;
607 
608  if ( meSCSeedMapOcc_[0] ) dqmStore_->removeElement( meSCSeedMapOcc_[0]->getName() );
609  meSCSeedMapOcc_[0] = 0;
610 
611  if ( meSCSeedMapOcc_[1] ) dqmStore_->removeElement( meSCSeedMapOcc_[1]->getName() );
612  meSCSeedMapOcc_[1] = 0;
613 
615  meSCMapSingleCrystal_[0] = 0;
616 
618  meSCMapSingleCrystal_[1] = 0;
619 
621  mes1s9_ = 0;
622 
624  mes1s9thr_ = 0;
625 
627  mes9s25_ = 0;
628 
630  meInvMassPi0_ = 0;
631 
633  meInvMassJPsi_ = 0;
634 
636  meInvMassZ0_ = 0;
637 
639  meInvMassHigh_ = 0;
640 
642  meInvMassPi0Sel_ = 0;
643 
645  meInvMassJPsiSel_ = 0;
646 
648  meInvMassZ0Sel_ = 0;
649 
651  meInvMassHighSel_ = 0;
652 
653  }
654 
655  init_ = false;
656 
657 }
658 
660 
661  edm::LogInfo("EEClusterTask") << "analyzed " << ievt_ << " events";
662 
663  if ( enableCleanup_ ) this->cleanup();
664 
665 }
666 
668 
669  bool enable = false;
670 
672 
673  if ( e.getByToken(EcalRawDataCollection_, dcchs) ) {
674 
675  for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
676 
677  if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
678 
679  if ( dcchItr->getRunType() == EcalDCCHeaderBlock::BEAMH4 ||
680  dcchItr->getRunType() == EcalDCCHeaderBlock::BEAMH2 ) enable = true;
681 
682  if ( dcchItr->getRunType() == EcalDCCHeaderBlock::COSMIC ||
683  dcchItr->getRunType() == EcalDCCHeaderBlock::MTCC ||
684  dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
685  dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
686  dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_LOCAL ||
687  dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_LOCAL ) enable = true;
688 
689  break;
690 
691  }
692 
693  } else {
694 
695  enable = true;
696  edm::LogWarning("EEClusterTask") << "EcalRawDataCollection not available";
697 
698  }
699 
700  if ( ! enable ) return;
701 
702  if ( ! init_ ) this->setup();
703 
704  ievt_++;
705 
706  // ECAL topology
707  edm::ESHandle<CaloTopology> pTopology;
708  c.get<CaloTopologyRecord>().get(pTopology);
709  if ( !pTopology.isValid() ) {
710  edm::LogWarning("EEClusterTask") << "Topology not valid";
711  return;
712  }
713  const CaloTopology* topology = pTopology.product();
714 
715  // recHits
717  e.getByToken( EcalRecHitCollection_, pEERecHits );
718  if ( !pEERecHits.isValid() ) {
719  edm::LogWarning("EEClusterTask") << "RecHit collection not available.";
720  return;
721  }
722  const EcalRecHitCollection* eeRecHits = pEERecHits.product();
723 
724  std::vector<reco::CaloCluster const*> bcSel;
725 
726  // --- Endcap Basic Clusters ---
728  if ( e.getByToken(BasicClusterCollection_, pBasicClusters) ) {
729 
730  int nbcc = pBasicClusters->size();
731  if (nbcc>0) meBCNum_->Fill(float(nbcc));
732 
733  for ( edm::View<reco::CaloCluster>::const_iterator bCluster = pBasicClusters->begin(); bCluster != pBasicClusters->end(); ++bCluster ) {
734 
735  meBCEne_->Fill(bCluster->energy());
736  meBCSiz_->Fill(float(bCluster->size()));
737 
738  if ( bCluster->eta() > 0 ) {
739  meBCEneFwdMap_->Fill(bCluster->x(), bCluster->y(), bCluster->energy());
740  meBCEneFwdMapProjEta_->Fill( bCluster->eta(), bCluster->energy() );
741  meBCEneFwdMapProjPhi_->Fill( bCluster->phi(), bCluster->energy() );
742 
743  meBCNumFwdMap_->Fill(bCluster->x(), bCluster->y());
744  meBCNumFwdMapProjEta_->Fill( bCluster->eta() );
745  meBCNumFwdMapProjPhi_->Fill( bCluster->phi() );
746 
747  meBCETFwdMap_->Fill(bCluster->x(), bCluster->y(), bCluster->energy() * sin(bCluster->position().theta()) );
748  meBCETFwdMapProjEta_->Fill( bCluster->eta(), bCluster->energy() * sin(bCluster->position().theta()) );
749  meBCETFwdMapProjPhi_->Fill( bCluster->phi(), bCluster->energy() * sin(bCluster->position().theta()) );
750 
751  meBCSizFwdMap_->Fill(bCluster->x(), bCluster->y(), float(bCluster->size()) );
752  meBCSizFwdMapProjEta_->Fill( bCluster->eta(), float(bCluster->size()) );
753  meBCSizFwdMapProjPhi_->Fill( bCluster->phi(), float(bCluster->size()) );
754  } else {
755  meBCEneBwdMap_->Fill(bCluster->x(), bCluster->y(), bCluster->energy());
756  meBCEneBwdMapProjEta_->Fill( bCluster->eta(), bCluster->energy() );
757  meBCEneBwdMapProjPhi_->Fill( bCluster->phi(), bCluster->energy() );
758 
759  meBCNumBwdMap_->Fill(bCluster->x(), bCluster->y());
760  meBCNumBwdMapProjEta_->Fill( bCluster->eta() );
761  meBCNumBwdMapProjPhi_->Fill( bCluster->phi() );
762 
763  meBCETBwdMap_->Fill(bCluster->x(), bCluster->y(), bCluster->energy() * sin(bCluster->position().theta()) );
764  meBCETBwdMapProjEta_->Fill( bCluster->eta(), bCluster->energy() * sin(bCluster->position().theta()) );
765  meBCETBwdMapProjPhi_->Fill( bCluster->phi(), bCluster->energy() * sin(bCluster->position().theta()) );
766 
767  meBCSizBwdMap_->Fill(bCluster->x(), bCluster->y(), float(bCluster->size()) );
768  meBCSizBwdMapProjEta_->Fill( bCluster->eta(), float(bCluster->size()) );
769  meBCSizBwdMapProjPhi_->Fill( bCluster->phi(), float(bCluster->size()) );
770 
771  float e2x2 = EcalClusterTools::e2x2( *bCluster, eeRecHits, topology );
772  float e3x3 = EcalClusterTools::e3x3( *bCluster, eeRecHits, topology );
773 
774  // fill the selected cluster collection
775  float pt = std::abs( bCluster->energy()*sin(bCluster->position().theta()) );
776  if ( pt > thrClusEt_ && e2x2/e3x3 > thrS4S9_ ) bcSel.push_back(&*bCluster);
777  }
778 
779  }
780 
781  } else {
782 
783  // edm::LogWarning("EEClusterTask") << "BasicClusterCollection not available";
784 
785  }
786 
787  for ( std::vector<reco::CaloCluster const*>::const_iterator bc1 = bcSel.begin(); bc1 != bcSel.end(); ++bc1 ) {
788  TLorentzVector bc1P;
789  bc1P.SetPtEtaPhiE(std::abs((*bc1)->energy()*sin((*bc1)->position().theta())),
790  (*bc1)->eta(), (*bc1)->phi(), (*bc1)->energy());
791  for ( std::vector<reco::CaloCluster const*>::const_iterator bc2 = bc1+1; bc2 != bcSel.end(); ++bc2 ) {
792  TLorentzVector bc2P;
793  bc2P.SetPtEtaPhiE(std::abs((*bc2)->energy()*sin((*bc2)->position().theta())),
794  (*bc2)->eta(), (*bc2)->phi(), (*bc2)->energy());
795 
796  TLorentzVector candP = bc1P + bc2P;
797 
798  if ( candP.Pt() > thrCandEt_ ) {
799  float mass = candP.M();
800  if ( mass < 0.500 ) {
801  meInvMassPi0Sel_->Fill( mass );
802  } else if ( mass > 2.9 && mass < 3.3 ) {
803  meInvMassJPsiSel_->Fill( mass );
804  } else if ( mass > 40 && mass < 110 ) {
805  meInvMassZ0Sel_->Fill( mass );
806  } else if ( mass > 110 ) {
807  meInvMassHighSel_->Fill( mass );
808  }
809 
810  }
811 
812  }
813  }
814 
815  // --- Endcap Super Clusters ----
817  if ( e.getByToken(SuperClusterCollection_, pSuperClusters) ) {
818 
819  int nscc = pSuperClusters->size();
820  if ( nscc > 0 ) meSCNum_->Fill(float(nscc));
821 
822  TLorentzVector sc1_p(0,0,0,0);
823  TLorentzVector sc2_p(0,0,0,0);
824 
826 
827  for ( reco::SuperClusterCollection::const_iterator sCluster = pSuperClusters->begin(); sCluster != pSuperClusters->end(); sCluster++ ) {
828 
829  // energy, size
830  meSCEne_->Fill(sCluster->energy());
831  meSCSiz_->Fill(float(sCluster->clustersSize()));
832 
833  reco::CaloClusterPtr theSeed = sCluster->seed();
834 
835  // Find the seed rec hit
836  std::vector< std::pair<DetId,float> > sIds = sCluster->hitsAndFractions();
837 
838  float eMax, e2nd;
839  EcalRecHitCollection::const_iterator seedItr = eeRecHits->begin();
840  EcalRecHitCollection::const_iterator secondItr = eeRecHits->begin();
841 
842  for(std::vector< std::pair<DetId,float> >::const_iterator idItr = sIds.begin(); idItr != sIds.end(); ++idItr) {
843  DetId id = idItr->first;
844  if(id.det() != DetId::Ecal) { continue; }
845  EcalRecHitCollection::const_iterator hitItr = eeRecHits->find(id);
846  if(hitItr == eeRecHits->end()) { continue; }
847  if(hitItr->energy() > secondItr->energy()) { secondItr = hitItr; }
848  if(hitItr->energy() > seedItr->energy()) { std::swap(seedItr,secondItr); }
849  }
850 
851  eMax = seedItr->energy();
852  e2nd = secondItr->energy();
853  EEDetId seedId = (EEDetId) seedItr->id();
854 
855  float e3x3 = EcalClusterTools::e3x3( *theSeed, eeRecHits, topology );
856  float e5x5 = EcalClusterTools::e5x5( *theSeed, eeRecHits, topology );
857 
858  meSCCrystalSiz_->Fill(sIds.size());
859  meSCSeedEne_->Fill(eMax);
860  meSCEne2_->Fill(eMax+e2nd);
861  meSCEneVsEMax_->Fill(eMax,sCluster->energy());
862  meSCEneLowScale_->Fill(sCluster->energy());
863 
864  // Prepare to fill maps
865  int ism = Numbers::iSM(seedId);
866  int eeSide;
867  if( ism >= 1 && ism <= 9)
868  eeSide = 0;
869  else
870  eeSide = 1;
871  int eex = seedId.ix();
872  int eey = seedId.iy();
873  float xeex = eex - 0.5;
874  float xeey = eey - 0.5;
875 
876  meSCSeedMapOcc_[eeSide]->Fill(xeex, xeey);
877 
878  if(sIds.size() == 1) meSCMapSingleCrystal_[eeSide]->Fill(xeex, xeey);
879 
880  mes1s9_->Fill( eMax/e3x3 );
881  if ( eMax > 3.0 ) mes1s9thr_->Fill( eMax/e3x3 );
882  mes9s25_->Fill( e3x3/e5x5 );
883 
884  // look for the two most energetic super clusters
885  if ( sCluster->energy() > sc1_p.Energy() ) {
886  sc2_p=sc1_p;
887  sc1_p.SetPtEtaPhiE(sCluster->energy()*sin(sCluster->position().theta()),
888  sCluster->eta(), sCluster->phi(), sCluster->energy());
889  } else if ( sCluster->energy() > sc2_p.Energy() ) {
890  sc2_p.SetPtEtaPhiE(sCluster->energy()*sin(sCluster->position().theta()),
891  sCluster->eta(), sCluster->phi(), sCluster->energy());
892  }
893 
894  }
895  // Get the invariant mass of the two most energetic super clusters
896  if ( nscc >= 2) {
897  TLorentzVector sum = sc1_p+sc2_p;
898  float mass = sum.M();
899  if ( mass < 0.500 ) {
900  meInvMassPi0_->Fill( mass );
901  } else if ( mass > 2.9 && mass < 3.3 ) {
902  meInvMassJPsi_->Fill( mass );
903  } else if ( mass > 40 && mass < 110 ) {
904  meInvMassZ0_->Fill( mass );
905  } else if ( mass > 110 ) {
906  meInvMassHigh_->Fill( mass );
907  }
908  }
909 
910  } else {
911 
912  // edm::LogWarning("EEClusterTask") << "SuperClusterCollection not available";
913 
914  }
915 
916 }
MonitorElement * meBCETFwdMap_
Definition: EEClusterTask.h:82
edm::EDGetTokenT< EcalRawDataCollection > EcalRawDataCollection_
Definition: EEClusterTask.h:73
MonitorElement * mes9s25_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
MonitorElement * meBCETBwdMapProjEta_
Definition: EEClusterTask.h:87
void reset(void)
Reset.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
void endJob(void)
EndJob.
int ix() const
Definition: EEDetId.h:76
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2730
MonitorElement * meBCNum_
Definition: EEClusterTask.h:79
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
Some &quot;id&quot; conversions.
MonitorElement * meBCNumFwdMap_
Definition: EEClusterTask.h:82
MonitorElement * meInvMassPi0_
MonitorElement * meInvMassHigh_
void beginJob(void)
BeginJob.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
MonitorElement * meBCEneBwdMap_
Definition: EEClusterTask.h:86
MonitorElement * meBCSizFwdMapProjEta_
Definition: EEClusterTask.h:83
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
void cleanup(void)
Cleanup.
EEClusterTask(const edm::ParameterSet &ps)
Constructor.
MonitorElement * meSCNum_
Definition: EEClusterTask.h:91
void Fill(long long x)
MonitorElement * meBCNumBwdMapProjPhi_
Definition: EEClusterTask.h:88
MonitorElement * meBCETBwdMapProjPhi_
Definition: EEClusterTask.h:88
MonitorElement * meBCEneFwdMapProjPhi_
Definition: EEClusterTask.h:84
MonitorElement * meBCEneFwdMapProjEta_
Definition: EEClusterTask.h:83
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
MonitorElement * meBCNumFwdMapProjPhi_
Definition: EEClusterTask.h:84
MonitorElement * meBCNumBwdMapProjEta_
Definition: EEClusterTask.h:87
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
MonitorElement * meInvMassZ0Sel_
MonitorElement * meBCEneBwdMapProjEta_
Definition: EEClusterTask.h:87
void removeElement(const std::string &name)
Definition: DQMStore.cc:2772
MonitorElement * meBCSizBwdMap_
Definition: EEClusterTask.h:86
static float e3x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
MonitorElement * meBCEneBwdMapProjPhi_
Definition: EEClusterTask.h:88
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * meInvMassJPsiSel_
MonitorElement * meBCSizFwdMapProjPhi_
Definition: EEClusterTask.h:84
MonitorElement * meBCETFwdMapProjPhi_
Definition: EEClusterTask.h:84
MonitorElement * meBCSiz_
Definition: EEClusterTask.h:80
int iy() const
Definition: EEDetId.h:82
MonitorElement * meBCNumFwdMapProjEta_
Definition: EEClusterTask.h:83
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:1186
edm::EDGetTokenT< EcalRecHitCollection > EcalRecHitCollection_
Definition: EEClusterTask.h:76
MonitorElement * meSCEneVsEMax_
Definition: EEClusterTask.h:97
bool isValid() const
Definition: HandleBase.h:76
MonitorElement * meSCSiz_
Definition: EEClusterTask.h:92
MonitorElement * meBCSizFwdMap_
Definition: EEClusterTask.h:82
MonitorElement * meSCEne_
Definition: EEClusterTask.h:90
MonitorElement * meSCMapSingleCrystal_[2]
MonitorElement * meSCSeedEne_
Definition: EEClusterTask.h:95
MonitorElement * meInvMassJPsi_
MonitorElement * meBCETFwdMapProjEta_
Definition: EEClusterTask.h:83
MonitorElement * meSCEneLowScale_
Definition: EEClusterTask.h:98
void setup(void)
Setup.
const_iterator end() const
Definition: DetId.h:18
MonitorElement * meSCCrystalSiz_
Definition: EEClusterTask.h:94
#define M_PI
Definition: BFit3D.cc:3
MonitorElement * meBCNumBwdMap_
Definition: EEClusterTask.h:86
MonitorElement * meBCSizBwdMapProjPhi_
Definition: EEClusterTask.h:88
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:47
MonitorElement * meInvMassPi0Sel_
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
MonitorElement * meBCEneFwdMap_
Definition: EEClusterTask.h:82
T const * product() const
Definition: Handle.h:81
MonitorElement * meSCSeedMapOcc_[2]
Definition: EEClusterTask.h:99
iterator find(key_type k)
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:243
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
edm::EDGetTokenT< reco::SuperClusterCollection > SuperClusterCollection_
Definition: EEClusterTask.h:75
MonitorElement * meBCEne_
Definition: EEClusterTask.h:78
static EcalSubdetector subDet(const EBDetId &id)
Definition: Numbers.cc:142
MonitorElement * meBCETBwdMap_
Definition: EEClusterTask.h:86
MonitorElement * meSCEne2_
Definition: EEClusterTask.h:96
MonitorElement * meInvMassHighSel_
bool isValid() const
Definition: ESHandle.h:37
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:1000
edm::EDGetTokenT< edm::View< reco::CaloCluster > > BasicClusterCollection_
Definition: EEClusterTask.h:74
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)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
const_iterator begin() const
std::string prefixME_
Definition: EEClusterTask.h:67
Definition: Run.h:41
DQMStore * dqmStore_
Definition: EEClusterTask.h:65
virtual ~EEClusterTask()
Destructor.
MonitorElement * mes1s9_
MonitorElement * mes1s9thr_
MonitorElement * meInvMassZ0_
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:1330
static float e2x2(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
MonitorElement * meBCSizBwdMapProjEta_
Definition: EEClusterTask.h:87