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  * $Date: 2012/04/27 13:46:14 $
5  * $Revision: 1.86 $
6  * \author G. Della Ricca
7  * \author E. Di Marco
8  *
9 */
10 
11 #include <iostream>
12 #include <fstream>
13 #include <vector>
14 #include <math.h>
15 
18 
20 
22 
36 
38 
40 
41 #include "TLorentzVector.h"
42 
44 
45  init_ = false;
46 
48 
49  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
50 
51  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
52 
53  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
54 
55  // parameters...
56  EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");
57  BasicClusterCollection_ = ps.getParameter<edm::InputTag>("BasicClusterCollection");
58  SuperClusterCollection_ = ps.getParameter<edm::InputTag>("SuperClusterCollection");
59  EcalRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalRecHitCollection");
60 
61  // histograms...
62  meBCEne_ = 0;
63  meBCNum_ = 0;
64  meBCSiz_ = 0;
65 
66  meBCEneFwdMap_ = 0;
67  meBCNumFwdMap_ = 0;
68  meBCETFwdMap_ = 0;
69  meBCSizFwdMap_ = 0;
70 
79 
80  meBCEneBwdMap_ = 0;
81  meBCNumBwdMap_ = 0;
82  meBCETBwdMap_ = 0;
83  meBCSizBwdMap_ = 0;
84 
93 
94  meSCEne_ = 0;
95  meSCNum_ = 0;
96  meSCSiz_ = 0;
97 
98  meSCCrystalSiz_ = 0;
99  meSCSeedEne_ = 0;
100  meSCEne2_ = 0;
101  meSCEneVsEMax_ = 0;
102  meSCEneLowScale_ = 0;
103  meSCSeedMapOcc_[0] = 0;
104  meSCSeedMapOcc_[1] = 0;
105  meSCMapSingleCrystal_[0] = 0;
106  meSCMapSingleCrystal_[1] = 0;
107 
108  mes1s9_ = 0;
109  mes1s9thr_ = 0;
110  mes9s25_ = 0;
111 
112  meInvMassPi0_ = 0;
113  meInvMassJPsi_ = 0;
114  meInvMassZ0_ = 0;
115  meInvMassHigh_ = 0;
116 
117  meInvMassPi0Sel_ = 0;
118  meInvMassJPsiSel_ = 0;
119  meInvMassZ0Sel_ = 0;
120  meInvMassHighSel_ = 0;
121 
122  thrS4S9_ = 0.85;
123  thrClusEt_ = 0.250;
124  thrCandEt_ = 0.800;
125 
126 }
127 
129 
130 }
131 
133 
134  ievt_ = 0;
135 
136  if ( dqmStore_ ) {
137  dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTask");
138  dqmStore_->rmdir(prefixME_ + "/EEClusterTask");
139  }
140 
141 }
142 
144 
145  Numbers::initGeometry(c, false);
146 
147  if ( ! mergeRuns_ ) this->reset();
148 
149 }
150 
152 
153 }
154 
156 
157  if ( meBCEne_ ) meBCEne_->Reset();
158 
159  if ( meBCNum_ ) meBCNum_->Reset();
160 
161  if ( meBCSiz_ ) meBCSiz_->Reset();
162 
164 
166 
168 
170 
172 
174 
176 
178 
180 
182 
184 
186 
188 
190 
192 
194 
196 
198 
200 
202 
204 
206 
208 
210 
211  if ( meSCEne_ ) meSCEne_->Reset();
212 
213  if ( meSCNum_ ) meSCNum_->Reset();
214 
215  if ( meSCSiz_ ) meSCSiz_->Reset();
216 
218 
219  if ( meSCSeedEne_ ) meSCSeedEne_->Reset();
220 
221  if ( meSCEne2_ ) meSCEne2_->Reset();
222 
224 
226 
227  if ( meSCSeedMapOcc_[0] ) meSCSeedMapOcc_[0]->Reset();
228 
229  if ( meSCSeedMapOcc_[1] ) meSCSeedMapOcc_[1]->Reset();
230 
232 
234 
235  if ( mes1s9_ ) mes1s9_->Reset();
236 
237  if ( mes1s9thr_ ) mes1s9thr_->Reset();
238 
239  if ( mes9s25_ ) mes9s25_->Reset();
240 
242 
244 
245  if ( meInvMassZ0_ ) meInvMassZ0_->Reset();
246 
248 
250 
252 
254 
256 
257 }
258 
260 
261  init_ = true;
262 
263  std::string name;
264 
265  if ( dqmStore_ ) {
266  dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTask");
267 
268  name = "EECLT BC energy";
269  meBCEne_ = dqmStore_->book1D(name, name, 100, 0., 150.);
270  meBCEne_->setAxisTitle("energy (GeV)", 1);
271 
272  name = "EECLT BC number";
273  meBCNum_ = dqmStore_->book1D(name, name, 100, 0., 150.);
274  meBCNum_->setAxisTitle("number of clusters", 1);
275 
276  name = "EECLT BC size";
277  meBCSiz_ = dqmStore_->book1D(name, name, 100, 0., 150.);
278  meBCSiz_->setAxisTitle("cluster size", 1);
279 
280  name = "EECLT BC energy map EE +";
281  meBCEneFwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 500., "s");
282  meBCEneFwdMap_->setAxisTitle("x", 1);
283  meBCEneFwdMap_->setAxisTitle("y", 2);
284 
285  name = "EECLT BC number map EE +";
286  meBCNumFwdMap_ = dqmStore_->book2D(name, name, 20, -150., 150., 20, -150., 150.);
287  meBCNumFwdMap_->setAxisTitle("x", 1);
288  meBCNumFwdMap_->setAxisTitle("y", 2);
289 
290  name = "EECLT BC ET map EE +";
291  meBCETFwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 500., "s");
292  meBCETFwdMap_->setAxisTitle("x", 1);
293  meBCETFwdMap_->setAxisTitle("y", 2);
294 
295  name = "EECLT BC size map EE +";
296  meBCSizFwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 100., "s");
297  meBCSizFwdMap_->setAxisTitle("x", 1);
298  meBCSizFwdMap_->setAxisTitle("y", 2);
299 
300  name = "EECLT BC energy projection eta EE +";
301  meBCEneFwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, 1.479, 3.0, 100, 0., 500., "s");
303  meBCEneFwdMapProjEta_->setAxisTitle("energy (GeV)", 2);
304 
305  name = "EECLT BC energy projection phi EE +";
306  meBCEneFwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 500., "s");
308  meBCEneFwdMapProjPhi_->setAxisTitle("energy (GeV)", 2);
309 
310  name = "EECLT BC number projection eta EE +";
311  meBCNumFwdMapProjEta_ = dqmStore_->book1D(name, name, 20, 1.479, 3.0);
313  meBCNumFwdMapProjEta_->setAxisTitle("number of clusters", 2);
314 
315  name = "EECLT BC number projection phi EE +";
316  meBCNumFwdMapProjPhi_ = dqmStore_->book1D(name, name, 50, -M_PI, M_PI);
318  meBCNumFwdMapProjPhi_->setAxisTitle("number of clusters", 2);
319 
320  name = "EECLT BC ET projection eta EE +";
321  meBCETFwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, 1.479, 3.0, 100, 0., 500., "s");
323  meBCETFwdMapProjEta_->setAxisTitle("transverse energy (GeV)", 2);
324 
325  name = "EECLT BC ET projection phi EE +";
326  meBCETFwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 500., "s");
328  meBCETFwdMapProjPhi_->setAxisTitle("transverse energy (GeV)", 2);
329 
330  name = "EECLT BC size projection eta EE +";
331  meBCSizFwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, 1.479, 3.0, 100, 0., 100., "s");
333  meBCSizFwdMapProjEta_->setAxisTitle("cluster size", 2);
334 
335  name = "EECLT BC size projection phi EE +";
336  meBCSizFwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 100., "s");
338  meBCSizFwdMapProjPhi_->setAxisTitle("cluster size", 2);
339 
340  name = "EECLT BC energy map EE -";
341  meBCEneBwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 500., "s");
342  meBCEneBwdMap_->setAxisTitle("x", 1);
343  meBCEneBwdMap_->setAxisTitle("y", 2);
344 
345  name = "EECLT BC number map EE -";
346  meBCNumBwdMap_ = dqmStore_->book2D(name, name, 20, -150., 150., 20, -150., 150.);
347  meBCNumBwdMap_->setAxisTitle("x", 1);
348  meBCNumBwdMap_->setAxisTitle("y", 2);
349 
350  name = "EECLT BC ET map EE -";
351  meBCETBwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 500., "s");
352  meBCETBwdMap_->setAxisTitle("x", 1);
353  meBCETBwdMap_->setAxisTitle("y", 2);
354 
355  name = "EECLT BC size map EE -";
356  meBCSizBwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 100., "s");
357  meBCSizBwdMap_->setAxisTitle("x", 1);
358  meBCSizBwdMap_->setAxisTitle("y", 2);
359 
360  name = "EECLT BC energy projection eta EE -";
361  meBCEneBwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, -3.0, -1.479, 100, 0., 500., "s");
363  meBCEneBwdMapProjEta_->setAxisTitle("energy (GeV)", 2);
364 
365  name = "EECLT BC energy projection phi EE -";
366  meBCEneBwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 500., "s");
368  meBCEneBwdMapProjPhi_->setAxisTitle("energy (GeV)", 2);
369 
370  name = "EECLT BC number projection eta EE -";
371  meBCNumBwdMapProjEta_ = dqmStore_->book1D(name, name, 20, -3.0, -1.479);
373  meBCNumBwdMapProjEta_->setAxisTitle("number of clusters", 2);
374 
375  name = "EECLT BC number projection phi EE -";
376  meBCNumBwdMapProjPhi_ = dqmStore_->book1D(name, name, 50, -M_PI, M_PI);
378  meBCNumBwdMapProjPhi_->setAxisTitle("number of clusters", 2);
379 
380  name = "EECLT BC ET projection eta EE -";
381  meBCETBwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, -3.0, -1.479, 100, 0., 500., "s");
383  meBCETBwdMapProjEta_->setAxisTitle("transverse energy (GeV)", 2);
384 
385  name = "EECLT BC ET projection phi EE -";
386  meBCETBwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 500., "s");
388  meBCETBwdMapProjPhi_->setAxisTitle("transverse energy (GeV)", 2);
389 
390  name = "EECLT BC size projection eta EE -";
391  meBCSizBwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, -3.0, -1.479, 100, 0., 100., "s");
393  meBCSizBwdMapProjEta_->setAxisTitle("cluster size", 2);
394 
395  name = "EECLT BC size projection phi EE -";
396  meBCSizBwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 100., "s");
398  meBCSizBwdMapProjPhi_->setAxisTitle("cluster size", 2);
399 
400  name = "EECLT SC energy";
401  meSCEne_ = dqmStore_->book1D(name, name, 100, 0., 150.);
402  meSCEne_->setAxisTitle("energy (GeV)", 1);
403 
404  name = "EECLT SC number";
405  meSCNum_ = dqmStore_->book1D(name, name, 50, 0., 50.);
406  meSCNum_->setAxisTitle("number of clusters", 1);
407 
408  name = "EECLT SC size";
409  meSCSiz_ = dqmStore_->book1D(name, name, 50, 0., 50.);
410  meSCSiz_->setAxisTitle("cluster size", 1);
411 
412  name = "EECLT SC size (crystal)";
413  meSCCrystalSiz_ = dqmStore_->book1D(name, name, 150, 0, 150);
414  meSCCrystalSiz_->setAxisTitle("cluster size in crystals", 1);
415 
416  name = "EECLT SC seed crystal energy";
417  meSCSeedEne_ = dqmStore_->book1D(name, name, 100, 0., 10.);
418  meSCSeedEne_->setAxisTitle("seed crystal energy (GeV)", 1);
419 
420  name = "EECLT SC e2";
421  meSCEne2_ = dqmStore_->book1D(name, name, 100, 0., 10.);
422  meSCEne2_->setAxisTitle("seed + highest neighbor crystal energy (GeV)", 1);
423 
424  name = "EECLT SC energy vs seed crystal energy";
425  meSCEneVsEMax_ = dqmStore_->book2D(name, name, 50, 0., 10., 50, 0., 10.);
426  meSCEneVsEMax_->setAxisTitle("seed crystal energy (GeV)", 1);
427  meSCEneVsEMax_->setAxisTitle("cluster energy (GeV)", 2);
428 
429  name = "EECLT SC energy (low scale)";
430  meSCEneLowScale_ = dqmStore_->book1D(name, name, 100, 0., 10.);
431  meSCEneLowScale_->setAxisTitle("cluster energy (GeV)", 1);
432 
433  name = "EECLT SC seed occupancy map EE -";
434  meSCSeedMapOcc_[0] = dqmStore_->book2D(name, name, 20, 0., 100., 20, 0., 100.);
435  meSCSeedMapOcc_[0]->setAxisTitle("jx'", 1);
436  meSCSeedMapOcc_[0]->setAxisTitle("jy'", 2);
437 
438  name = "EECLT SC seed occupancy map EE +";
439  meSCSeedMapOcc_[1] = dqmStore_->book2D(name, name, 20, 0., 100., 20, 0., 100.);
440  meSCSeedMapOcc_[1]->setAxisTitle("jx'", 1);
441  meSCSeedMapOcc_[1]->setAxisTitle("jy'", 2);
442 
443  name = "EECLT SC single crystal cluster seed occupancy map EE -";
444  meSCMapSingleCrystal_[0] = dqmStore_->book2D(name, name, 20, 0., 100., 20, 0., 100.);
445  meSCMapSingleCrystal_[0]->setAxisTitle("jx'", 1);
446  meSCMapSingleCrystal_[0]->setAxisTitle("jy'", 2);
447 
448  name = "EECLT SC single crystal cluster seed occupancy map EE +";
449  meSCMapSingleCrystal_[1] = dqmStore_->book2D(name, name, 20, 0., 100., 20, 0., 100.);
450  meSCMapSingleCrystal_[1]->setAxisTitle("jx'", 1);
451  meSCMapSingleCrystal_[1]->setAxisTitle("jy'", 2);
452 
453  name = "EECLT s1s9";
454  mes1s9_ = dqmStore_->book1D(name, name, 50, 0., 1.5);
455  mes1s9_->setAxisTitle("s1/s9", 1);
456 
457  name = "EECLT s1s9 thr";
458  mes1s9thr_ = dqmStore_->book1D(name, name, 50, 0., 1.5);
459  mes1s9thr_->setAxisTitle("s1/s9", 1);
460 
461  name = "EECLT s9s25";
462  mes9s25_ = dqmStore_->book1D(name, name, 75, 0., 1.5);
463  mes9s25_->setAxisTitle("s9/s25", 1);
464 
465  name = "EECLT dicluster invariant mass Pi0";
466  meInvMassPi0_ = dqmStore_->book1D(name, name, 50, 0.0, 0.500);
467  meInvMassPi0_->setAxisTitle("mass (GeV)", 1);
468 
469  name = "EECLT dicluster invariant mass JPsi";
470  meInvMassJPsi_ = dqmStore_->book1D(name, name, 50, 2.9, 3.3);
471  meInvMassJPsi_->setAxisTitle("mass (GeV)", 1);
472 
473  name = "EECLT dicluster invariant mass Z0";
474  meInvMassZ0_ = dqmStore_->book1D(name, name, 50, 40, 110);
475  meInvMassZ0_->setAxisTitle("mass (GeV)", 1);
476 
477  name = "EECLT dicluster invariant mass high";
478  meInvMassHigh_ = dqmStore_->book1D(name, name, 500, 110, 3000);
479  meInvMassHigh_->setAxisTitle("mass (GeV)", 1);
480 
481  name = "EECLT dicluster invariant mass Pi0 sel";
482  meInvMassPi0Sel_ = dqmStore_->book1D(name, name, 50, 0.00, 0.500);
483  meInvMassPi0Sel_->setAxisTitle("mass (GeV)", 1);
484 
485  name = "EECLT dicluster invariant mass JPsi sel";
486  meInvMassJPsiSel_ = dqmStore_->book1D(name, name, 50, 2.9, 3.3);
487  meInvMassJPsiSel_->setAxisTitle("mass (GeV)", 1);
488 
489  name = "EECLT dicluster invariant mass Z0 sel";
490  meInvMassZ0Sel_ = dqmStore_->book1D(name, name, 50, 40, 110);
491  meInvMassZ0Sel_->setAxisTitle("mass (GeV)", 1);
492 
493  name = "EECLT dicluster invariant mass high sel";
494  meInvMassHighSel_ = dqmStore_->book1D(name, name, 500, 110, 3000);
495  meInvMassHighSel_->setAxisTitle("mass (GeV)", 1);
496 
497  }
498 
499 }
500 
502 
503  if ( ! init_ ) return;
504 
505  if ( dqmStore_ ) {
506  dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTask");
507 
509  meBCEne_ = 0;
510 
512  meBCNum_ = 0;
513 
515  meBCSiz_ = 0;
516 
518  meBCEneFwdMap_ = 0;
519 
521  meBCNumFwdMap_ = 0;
522 
524  meBCETFwdMap_ = 0;
525 
527  meBCSizFwdMap_ = 0;
528 
531 
534 
537 
540 
543 
546 
549 
552 
554  meBCEneBwdMap_ = 0;
555 
557  meBCNumBwdMap_ = 0;
558 
560  meBCETBwdMap_ = 0;
561 
563  meBCSizBwdMap_ = 0;
564 
567 
570 
573 
576 
579 
582 
585 
588 
590  meSCEne_ = 0;
591 
593  meSCNum_ = 0;
594 
596  meSCSiz_ = 0;
597 
599  meSCCrystalSiz_ = 0;
600 
602  meSCSeedEne_ = 0;
603 
605  meSCEne2_ = 0;
606 
608  meSCEneVsEMax_ = 0;
609 
611  meSCEneLowScale_ = 0;
612 
614  meSCSeedMapOcc_[0] = 0;
615 
617  meSCSeedMapOcc_[1] = 0;
618 
620  meSCMapSingleCrystal_[0] = 0;
621 
623  meSCMapSingleCrystal_[1] = 0;
624 
626  mes1s9_ = 0;
627 
629  mes1s9thr_ = 0;
630 
632  mes9s25_ = 0;
633 
635  meInvMassPi0_ = 0;
636 
638  meInvMassJPsi_ = 0;
639 
641  meInvMassZ0_ = 0;
642 
644  meInvMassHigh_ = 0;
645 
647  meInvMassPi0Sel_ = 0;
648 
650  meInvMassJPsiSel_ = 0;
651 
653  meInvMassZ0Sel_ = 0;
654 
656  meInvMassHighSel_ = 0;
657 
658  }
659 
660  init_ = false;
661 
662 }
663 
665 
666  edm::LogInfo("EEClusterTask") << "analyzed " << ievt_ << " events";
667 
668  if ( enableCleanup_ ) this->cleanup();
669 
670 }
671 
673 
674  bool enable = false;
675 
677 
678  if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
679 
680  for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
681 
682  if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
683 
684  if ( dcchItr->getRunType() == EcalDCCHeaderBlock::BEAMH4 ||
685  dcchItr->getRunType() == EcalDCCHeaderBlock::BEAMH2 ) enable = true;
686 
687  if ( dcchItr->getRunType() == EcalDCCHeaderBlock::COSMIC ||
688  dcchItr->getRunType() == EcalDCCHeaderBlock::MTCC ||
689  dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
690  dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
691  dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_LOCAL ||
692  dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_LOCAL ) enable = true;
693 
694  break;
695 
696  }
697 
698  } else {
699 
700  enable = true;
701  edm::LogWarning("EEClusterTask") << EcalRawDataCollection_ << " not available";
702 
703  }
704 
705  if ( ! enable ) return;
706 
707  if ( ! init_ ) this->setup();
708 
709  ievt_++;
710 
711  // ECAL topology
712  edm::ESHandle<CaloTopology> pTopology;
713  c.get<CaloTopologyRecord>().get(pTopology);
714  if ( !pTopology.isValid() ) {
715  edm::LogWarning("EEClusterTask") << "Topology not valid";
716  return;
717  }
718  const CaloTopology* topology = pTopology.product();
719 
720  // recHits
722  e.getByLabel( EcalRecHitCollection_, pEERecHits );
723  if ( !pEERecHits.isValid() ) {
724  edm::LogWarning("EEClusterTask") << "RecHit collection " << EcalRecHitCollection_ << " not available.";
725  return;
726  }
727  const EcalRecHitCollection* eeRecHits = pEERecHits.product();
728 
730 
731  // --- Endcap Basic Clusters ---
733  if ( e.getByLabel(BasicClusterCollection_, pBasicClusters) ) {
734 
735  int nbcc = pBasicClusters->size();
736  if (nbcc>0) meBCNum_->Fill(float(nbcc));
737 
738  for ( reco::BasicClusterCollection::const_iterator bCluster = pBasicClusters->begin(); bCluster != pBasicClusters->end(); ++bCluster ) {
739 
740  meBCEne_->Fill(bCluster->energy());
741  meBCSiz_->Fill(float(bCluster->size()));
742 
743  if ( bCluster->eta() > 0 ) {
744  meBCEneFwdMap_->Fill(bCluster->x(), bCluster->y(), bCluster->energy());
745  meBCEneFwdMapProjEta_->Fill( bCluster->eta(), bCluster->energy() );
746  meBCEneFwdMapProjPhi_->Fill( bCluster->phi(), bCluster->energy() );
747 
748  meBCNumFwdMap_->Fill(bCluster->x(), bCluster->y());
749  meBCNumFwdMapProjEta_->Fill( bCluster->eta() );
750  meBCNumFwdMapProjPhi_->Fill( bCluster->phi() );
751 
752  meBCETFwdMap_->Fill(bCluster->x(), bCluster->y(), bCluster->energy() * sin(bCluster->position().theta()) );
753  meBCETFwdMapProjEta_->Fill( bCluster->eta(), bCluster->energy() * sin(bCluster->position().theta()) );
754  meBCETFwdMapProjPhi_->Fill( bCluster->phi(), bCluster->energy() * sin(bCluster->position().theta()) );
755 
756  meBCSizFwdMap_->Fill(bCluster->x(), bCluster->y(), float(bCluster->size()) );
757  meBCSizFwdMapProjEta_->Fill( bCluster->eta(), float(bCluster->size()) );
758  meBCSizFwdMapProjPhi_->Fill( bCluster->phi(), float(bCluster->size()) );
759  } else {
760  meBCEneBwdMap_->Fill(bCluster->x(), bCluster->y(), bCluster->energy());
761  meBCEneBwdMapProjEta_->Fill( bCluster->eta(), bCluster->energy() );
762  meBCEneBwdMapProjPhi_->Fill( bCluster->phi(), bCluster->energy() );
763 
764  meBCNumBwdMap_->Fill(bCluster->x(), bCluster->y());
765  meBCNumBwdMapProjEta_->Fill( bCluster->eta() );
766  meBCNumBwdMapProjPhi_->Fill( bCluster->phi() );
767 
768  meBCETBwdMap_->Fill(bCluster->x(), bCluster->y(), bCluster->energy() * sin(bCluster->position().theta()) );
769  meBCETBwdMapProjEta_->Fill( bCluster->eta(), bCluster->energy() * sin(bCluster->position().theta()) );
770  meBCETBwdMapProjPhi_->Fill( bCluster->phi(), bCluster->energy() * sin(bCluster->position().theta()) );
771 
772  meBCSizBwdMap_->Fill(bCluster->x(), bCluster->y(), float(bCluster->size()) );
773  meBCSizBwdMapProjEta_->Fill( bCluster->eta(), float(bCluster->size()) );
774  meBCSizBwdMapProjPhi_->Fill( bCluster->phi(), float(bCluster->size()) );
775 
776  float e2x2 = EcalClusterTools::e2x2( *bCluster, eeRecHits, topology );
777  float e3x3 = EcalClusterTools::e3x3( *bCluster, eeRecHits, topology );
778 
779  // fill the selected cluster collection
780  float pt = std::abs( bCluster->energy()*sin(bCluster->position().theta()) );
781  if ( pt > thrClusEt_ && e2x2/e3x3 > thrS4S9_ ) bcSel.push_back(*bCluster);
782  }
783 
784  }
785 
786  } else {
787 
788  edm::LogWarning("EEClusterTask") << BasicClusterCollection_ << " not available";
789 
790  }
791 
792  for ( reco::BasicClusterCollection::const_iterator bc1 = bcSel.begin(); bc1 != bcSel.end(); ++bc1 ) {
793  TLorentzVector bc1P;
794  bc1P.SetPtEtaPhiE(std::abs(bc1->energy()*sin(bc1->position().theta())),
795  bc1->eta(), bc1->phi(), bc1->energy());
796  for ( reco::BasicClusterCollection::const_iterator bc2 = bc1+1; bc2 != bcSel.end(); ++bc2 ) {
797  TLorentzVector bc2P;
798  bc2P.SetPtEtaPhiE(std::abs(bc2->energy()*sin(bc2->position().theta())),
799  bc2->eta(), bc2->phi(), bc2->energy());
800 
801  TLorentzVector candP = bc1P + bc2P;
802 
803  if ( candP.Pt() > thrCandEt_ ) {
804  float mass = candP.M();
805  if ( mass < 0.500 ) {
806  meInvMassPi0Sel_->Fill( mass );
807  } else if ( mass > 2.9 && mass < 3.3 ) {
808  meInvMassJPsiSel_->Fill( mass );
809  } else if ( mass > 40 && mass < 110 ) {
810  meInvMassZ0Sel_->Fill( mass );
811  } else if ( mass > 110 ) {
812  meInvMassHighSel_->Fill( mass );
813  }
814 
815  }
816 
817  }
818  }
819 
820  // --- Endcap Super Clusters ----
822  if ( e.getByLabel(SuperClusterCollection_, pSuperClusters) ) {
823 
824  int nscc = pSuperClusters->size();
825  if ( nscc > 0 ) meSCNum_->Fill(float(nscc));
826 
827  TLorentzVector sc1_p(0,0,0,0);
828  TLorentzVector sc2_p(0,0,0,0);
829 
831 
832  for ( reco::SuperClusterCollection::const_iterator sCluster = pSuperClusters->begin(); sCluster != pSuperClusters->end(); sCluster++ ) {
833 
834  // energy, size
835  meSCEne_->Fill(sCluster->energy());
836  meSCSiz_->Fill(float(sCluster->clustersSize()));
837 
838  reco::CaloClusterPtr theSeed = sCluster->seed();
839 
840  // Find the seed rec hit
841  std::vector< std::pair<DetId,float> > sIds = sCluster->hitsAndFractions();
842 
843  float eMax, e2nd;
844  EcalRecHitCollection::const_iterator seedItr = eeRecHits->begin();
845  EcalRecHitCollection::const_iterator secondItr = eeRecHits->begin();
846 
847  for(std::vector< std::pair<DetId,float> >::const_iterator idItr = sIds.begin(); idItr != sIds.end(); ++idItr) {
848  DetId id = idItr->first;
849  if(id.det() != DetId::Ecal) { continue; }
850  EcalRecHitCollection::const_iterator hitItr = eeRecHits->find(id);
851  if(hitItr == eeRecHits->end()) { continue; }
852  if(hitItr->energy() > secondItr->energy()) { secondItr = hitItr; }
853  if(hitItr->energy() > seedItr->energy()) { std::swap(seedItr,secondItr); }
854  }
855 
856  eMax = seedItr->energy();
857  e2nd = secondItr->energy();
858  EEDetId seedId = (EEDetId) seedItr->id();
859 
860  float e3x3 = EcalClusterTools::e3x3( *theSeed, eeRecHits, topology );
861  float e5x5 = EcalClusterTools::e5x5( *theSeed, eeRecHits, topology );
862 
863  meSCCrystalSiz_->Fill(sIds.size());
864  meSCSeedEne_->Fill(eMax);
865  meSCEne2_->Fill(eMax+e2nd);
866  meSCEneVsEMax_->Fill(eMax,sCluster->energy());
867  meSCEneLowScale_->Fill(sCluster->energy());
868 
869  // Prepare to fill maps
870  int ism = Numbers::iSM(seedId);
871  int eeSide;
872  if( ism >= 1 && ism <= 9)
873  eeSide = 0;
874  else
875  eeSide = 1;
876  int eex = seedId.ix();
877  int eey = seedId.iy();
878  float xeex = eex - 0.5;
879  float xeey = eey - 0.5;
880 
881  meSCSeedMapOcc_[eeSide]->Fill(xeex, xeey);
882 
883  if(sIds.size() == 1) meSCMapSingleCrystal_[eeSide]->Fill(xeex, xeey);
884 
885  mes1s9_->Fill( eMax/e3x3 );
886  if ( eMax > 3.0 ) mes1s9thr_->Fill( eMax/e3x3 );
887  mes9s25_->Fill( e3x3/e5x5 );
888 
889  // look for the two most energetic super clusters
890  if ( sCluster->energy() > sc1_p.Energy() ) {
891  sc2_p=sc1_p;
892  sc1_p.SetPtEtaPhiE(sCluster->energy()*sin(sCluster->position().theta()),
893  sCluster->eta(), sCluster->phi(), sCluster->energy());
894  } else if ( sCluster->energy() > sc2_p.Energy() ) {
895  sc2_p.SetPtEtaPhiE(sCluster->energy()*sin(sCluster->position().theta()),
896  sCluster->eta(), sCluster->phi(), sCluster->energy());
897  }
898 
899  }
900  // Get the invariant mass of the two most energetic super clusters
901  if ( nscc >= 2) {
902  TLorentzVector sum = sc1_p+sc2_p;
903  float mass = sum.M();
904  if ( mass < 0.500 ) {
905  meInvMassPi0_->Fill( mass );
906  } else if ( mass > 2.9 && mass < 3.3 ) {
907  meInvMassJPsi_->Fill( mass );
908  } else if ( mass > 40 && mass < 110 ) {
909  meInvMassZ0_->Fill( mass );
910  } else if ( mass > 110 ) {
911  meInvMassHigh_->Fill( mass );
912  }
913  }
914 
915  } else {
916 
917  edm::LogWarning("EEClusterTask") << SuperClusterCollection_ << " not available";
918 
919  }
920 
921 }
MonitorElement * meBCETFwdMap_
Definition: EEClusterTask.h:77
MonitorElement * mes9s25_
Definition: EEClusterTask.h:99
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:82
void reset(void)
Reset.
void endJob(void)
EndJob.
int ix() const
Definition: EEDetId.h:71
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:717
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
MonitorElement * meBCNum_
Definition: EEClusterTask.h:74
Some &quot;id&quot; conversions.
MonitorElement * meBCNumFwdMap_
Definition: EEClusterTask.h:77
MonitorElement * meInvMassPi0_
MonitorElement * meInvMassHigh_
void beginJob(void)
BeginJob.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< T >::const_iterator const_iterator
#define abs(x)
Definition: mlp_lapack.h:159
MonitorElement * meBCEneBwdMap_
Definition: EEClusterTask.h:81
MonitorElement * meBCSizFwdMapProjEta_
Definition: EEClusterTask.h:78
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:86
void Fill(long long x)
MonitorElement * meBCNumBwdMapProjPhi_
Definition: EEClusterTask.h:83
MonitorElement * meBCETBwdMapProjPhi_
Definition: EEClusterTask.h:83
MonitorElement * meBCEneFwdMapProjPhi_
Definition: EEClusterTask.h:79
MonitorElement * meBCEneFwdMapProjEta_
Definition: EEClusterTask.h:78
edm::InputTag SuperClusterCollection_
Definition: EEClusterTask.h:70
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
MonitorElement * meBCNumFwdMapProjPhi_
Definition: EEClusterTask.h:79
MonitorElement * meBCNumBwdMapProjEta_
Definition: EEClusterTask.h:82
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:82
void removeElement(const std::string &name)
Definition: DQMStore.cc:2572
MonitorElement * meBCSizBwdMap_
Definition: EEClusterTask.h:81
static float e3x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
MonitorElement * meBCEneBwdMapProjPhi_
Definition: EEClusterTask.h:83
MonitorElement * meInvMassJPsiSel_
MonitorElement * meBCSizFwdMapProjPhi_
Definition: EEClusterTask.h:79
MonitorElement * meBCETFwdMapProjPhi_
Definition: EEClusterTask.h:79
MonitorElement * meBCSiz_
Definition: EEClusterTask.h:75
int iy() const
Definition: EEDetId.h:77
MonitorElement * meBCNumFwdMapProjEta_
Definition: EEClusterTask.h:78
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
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
MonitorElement * meSCEneVsEMax_
Definition: EEClusterTask.h:92
bool isValid() const
Definition: HandleBase.h:76
MonitorElement * meSCSiz_
Definition: EEClusterTask.h:87
MonitorElement * meBCSizFwdMap_
Definition: EEClusterTask.h:77
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
MonitorElement * meSCEne_
Definition: EEClusterTask.h:85
MonitorElement * meSCMapSingleCrystal_[2]
Definition: EEClusterTask.h:95
MonitorElement * meSCSeedEne_
Definition: EEClusterTask.h:90
MonitorElement * meInvMassJPsi_
MonitorElement * meBCETFwdMapProjEta_
Definition: EEClusterTask.h:78
MonitorElement * meSCEneLowScale_
Definition: EEClusterTask.h:93
void setup(void)
Setup.
const_iterator end() const
edm::InputTag EcalRecHitCollection_
Definition: EEClusterTask.h:71
Definition: DetId.h:20
MonitorElement * meSCCrystalSiz_
Definition: EEClusterTask.h:89
#define M_PI
Definition: BFit3D.cc:3
MonitorElement * meBCNumBwdMap_
Definition: EEClusterTask.h:81
MonitorElement * meBCSizBwdMapProjPhi_
Definition: EEClusterTask.h:83
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:50
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:77
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
T const * product() const
Definition: Handle.h:74
MonitorElement * meSCSeedMapOcc_[2]
Definition: EEClusterTask.h:94
iterator find(key_type k)
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:246
tuple mass
Definition: scaleCards.py:27
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
edm::InputTag BasicClusterCollection_
Definition: EEClusterTask.h:69
MonitorElement * meBCEne_
Definition: EEClusterTask.h:73
static EcalSubdetector subDet(const EBDetId &id)
Definition: Numbers.cc:145
MonitorElement * meBCETBwdMap_
Definition: EEClusterTask.h:81
MonitorElement * meSCEne2_
Definition: EEClusterTask.h:91
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:845
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)
edm::InputTag EcalRawDataCollection_
Definition: EEClusterTask.h:68
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
const_iterator begin() const
std::string prefixME_
Definition: EEClusterTask.h:62
Definition: Run.h:33
DQMStore * dqmStore_
Definition: EEClusterTask.h:60
virtual ~EEClusterTask()
Destructor.
MonitorElement * mes1s9_
Definition: EEClusterTask.h:97
MonitorElement * mes1s9thr_
Definition: EEClusterTask.h:98
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:1175
static float e2x2(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
MonitorElement * meBCSizBwdMapProjEta_
Definition: EEClusterTask.h:82