test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaSuperClusters.cc
Go to the documentation of this file.
2 
6 
8 
13 
15 
17 
19  MCTruthCollectionToken_(consumes<edm::HepMCProduct>(ps.getParameter<edm::InputTag>("MCTruthCollection"))),
20  barrelRawSuperClusterCollectionToken_(consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("barrelRawSuperClusterCollection"))),
21  barrelCorSuperClusterCollectionToken_(consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("barrelCorSuperClusterCollection"))),
22  endcapRawSuperClusterCollectionToken_(consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("endcapRawSuperClusterCollection"))),
23  endcapPreSuperClusterCollectionToken_(consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("endcapPreSuperClusterCollection"))),
24  endcapCorSuperClusterCollectionToken_(consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("endcapCorSuperClusterCollection"))),
25  barrelRecHitCollectionToken_(consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("barrelRecHitCollection"))),
26  endcapRecHitCollectionToken_(consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("endcapRecHitCollection"))),
27  hsSize_(ps, "Size"),
28  hsNumBC_(ps, "NumBC"),
29  hsET_(ps, "ET"),
30  hsEta_(ps, "Eta"),
31  hsPhi_(ps, "Phi"),
32  hsS1toS9_(ps, "S1toS9"),
33  hsS25toE_(ps, "S25toE"),
34  hsEoverTruth_(ps, "EoverTruth"),
35  hsdeltaR_(ps, "deltaR"),
36  hsphiWidth_(ps, "phiWidth"),
37  hsetaWidth_(ps, "etaWidth"),
38  hspreshowerE_(ps, "preshowerE"),
39  hsR_(ps, "R"),
40  hist_EB_RawSC_Size_(0),
41  hist_EE_RawSC_Size_(0),
42  hist_EB_CorSC_Size_(0),
43  hist_EE_CorSC_Size_(0),
44  hist_EE_PreSC_Size_(0),
45  hist_EB_RawSC_NumBC_(0),
46  hist_EE_RawSC_NumBC_(0),
47  hist_EB_CorSC_NumBC_(0),
48  hist_EE_CorSC_NumBC_(0),
49  hist_EE_PreSC_NumBC_(0),
50  hist_EB_RawSC_ET_(0),
51  hist_EE_RawSC_ET_(0),
52  hist_EB_CorSC_ET_(0),
53  hist_EE_CorSC_ET_(0),
54  hist_EE_PreSC_ET_(0),
55  hist_EB_RawSC_Eta_(0),
56  hist_EE_RawSC_Eta_(0),
57  hist_EB_CorSC_Eta_(0),
58  hist_EE_CorSC_Eta_(0),
59  hist_EE_PreSC_Eta_(0),
60  hist_EB_RawSC_Phi_(0),
61  hist_EE_RawSC_Phi_(0),
62  hist_EB_CorSC_Phi_(0),
63  hist_EE_CorSC_Phi_(0),
64  hist_EE_PreSC_Phi_(0),
65  hist_EB_RawSC_S1toS9_(0),
66  hist_EE_RawSC_S1toS9_(0),
67  hist_EB_CorSC_S1toS9_(0),
68  hist_EE_CorSC_S1toS9_(0),
69  hist_EE_PreSC_S1toS9_(0),
70  hist_EB_RawSC_S25toE_(0),
71  hist_EE_RawSC_S25toE_(0),
72  hist_EB_CorSC_S25toE_(0),
73  hist_EE_CorSC_S25toE_(0),
74  hist_EE_PreSC_S25toE_(0),
75  hist_EB_RawSC_EoverTruth_(0),
76  hist_EE_RawSC_EoverTruth_(0),
77  hist_EB_CorSC_EoverTruth_(0),
78  hist_EE_CorSC_EoverTruth_(0),
79  hist_EE_PreSC_EoverTruth_(0),
80  hist_EB_RawSC_deltaR_(0),
81  hist_EE_RawSC_deltaR_(0),
82  hist_EB_CorSC_deltaR_(0),
83  hist_EE_CorSC_deltaR_(0),
84  hist_EE_PreSC_deltaR_(0),
85  hist_EE_PreSC_preshowerE_(0),
86  hist_EE_CorSC_preshowerE_(0),
87  hist_EE_CorSC_phiWidth_(0),
88  hist_EB_CorSC_phiWidth_(0),
89  hist_EE_CorSC_etaWidth_(0),
90  hist_EB_CorSC_etaWidth_(0),
91  hist_EB_CorSC_ET_vs_Eta_(0),
92  hist_EB_CorSC_ET_vs_Phi_(0),
93  hist_EE_CorSC_ET_vs_Eta_(0),
94  hist_EE_CorSC_ET_vs_Phi_(0),
95  hist_EE_CorSC_ET_vs_R_(0)
96 {
97 }
98 
100 {
101 }
102 
103 void
105 {
106  _ibooker.setCurrentFolder("EcalClusterV/EcalSuperClusters/");
107 
108  // Number of SuperClusters
109  //
111  = _ibooker.book1D("hist_EB_RawSC_Size_","# Raw SuperClusters in Barrel",
114  = _ibooker.book1D("hist_EE_RawSC_Size_","# Raw SuperClusters in Endcap",
117  = _ibooker.book1D("hist_EB_CorSC_Size_","# Corrected SuperClusters in Barrel",
120  = _ibooker.book1D("hist_EE_CorSC_Size_","# Corrected SuperClusters in Endcap",
123  = _ibooker.book1D("hist_EE_PreSC_Size_","# SuperClusters with Preshower in Endcap",
125 
126  // Number of BasicClusters in SuperCluster
127  //
129  = _ibooker.book1D("hist_EB_RawSC_NumBC_","# of Basic Clusters in Raw Super Clusters in Barrel",
132  = _ibooker.book1D("hist_EE_RawSC_NumBC_","# of Basic Clusters in Raw Super Clusters in Endcap",
135  = _ibooker.book1D("hist_EB_CorSC_NumBC_","# of Basic Clusters in Corrected SuperClusters in Barrel",
138  = _ibooker.book1D("hist_EE_CorSC_NumBC_","# of Basic Clusters in Corrected SuperClusters in Endcap",
141  = _ibooker.book1D("hist_EE_PreSC_NumBC_","# of Basic Clusters in SuperClusters with Preshower in Endcap",
143 
144  // ET distribution of SuperClusters
145  //
147  = _ibooker.book1D("hist_EB_RawSC_ET_","ET of Raw SuperClusters in Barrel",
150  = _ibooker.book1D("hist_EE_RawSC_ET_","ET of Raw SuperClusters in Endcap",
153  = _ibooker.book1D("hist_EB_CorSC_ET_","ET of Corrected SuperClusters in Barrel",
156  = _ibooker.book1D("hist_EE_CorSC_ET_","ET of Corrected SuperClusters in Endcap",
159  = _ibooker.book1D("hist_EE_PreSC_ET_","ET of SuperClusters with Preshower in Endcap",
161 
162  // Eta distribution of SuperClusters
163  //
165  = _ibooker.book1D("hist_EB_RawSC_Eta_","Eta of Raw SuperClusters in Barrel",
168  = _ibooker.book1D("hist_EE_RawSC_Eta_","Eta of Raw SuperClusters in Endcap",
171  = _ibooker.book1D("hist_EB_CorSC_Eta_","Eta of Corrected SuperClusters in Barrel",
174  = _ibooker.book1D("hist_EE_CorSC_Eta_","Eta of Corrected SuperClusters in Endcap",
177  = _ibooker.book1D("hist_EE_PreSC_Eta_","Eta of SuperClusters with Preshower in Endcap",
179 
180  // Phi distribution of SuperClusters
181  //
183  = _ibooker.book1D("hist_EB_RawSC_Phi_","Phi of Raw SuperClusters in Barrel",
186  = _ibooker.book1D("hist_EE_RawSC_Phi_","Phi of Raw SuperClusters in Endcap",
189  = _ibooker.book1D("hist_EB_CorSC_Phi_","Phi of Corrected SuperClusters in Barrel",
192  = _ibooker.book1D("hist_EE_CorSC_Phi_","Phi of Corrected SuperClusters in Endcap",
195  = _ibooker.book1D("hist_EE_PreSC_Phi_","Phi of SuperClusters with Preshower in Endcap",
197 
198  // S1/S9 distribution of SuperClusters
199  //
201  = _ibooker.book1D("hist_EB_RawSC_S1toS9_","S1/S9 of Raw Super Clusters in Barrel",
204  = _ibooker.book1D("hist_EE_RawSC_S1toS9_","S1/S9 of Raw Super Clusters in Endcap",
207  = _ibooker.book1D("hist_EB_CorSC_S1toS9_","S1/S9 of Corrected SuperClusters in Barrel",
210  = _ibooker.book1D("hist_EE_CorSC_S1toS9_","S1/S9 of Corrected SuperClusters in Endcap",
213  = _ibooker.book1D("hist_EE_PreSC_S1toS9_","S1/S9 of SuperClusters with Preshower in Endcap",
215 
216  // S25/E distribution of SuperClusters
217  //
219  = _ibooker.book1D("hist_EB_RawSC_S25toE_","S25/E of Raw Super Clusters in Barrel",
222  = _ibooker.book1D("hist_EE_RawSC_S25toE_","S25/E of Raw Super Clusters in Endcap",
225  = _ibooker.book1D("hist_EB_CorSC_S25toE_","S25/E of Corrected SuperClusters in Barrel",
228  = _ibooker.book1D("hist_EE_CorSC_S25toE_","S25/E of Corrected SuperClusters in Endcap",
231  = _ibooker.book1D("hist_EE_PreSC_S25toE_","S25/E of SuperClusters with Preshower in Endcap",
233 
234  // E/E(true) distribution of SuperClusters
235  //
237  = _ibooker.book1D("hist_EB_RawSC_EoverTruth_","E/True E of Raw SuperClusters in Barrel",
240  = _ibooker.book1D("hist_EE_RawSC_EoverTruth_","E/True E of Raw SuperClusters in Endcap",
243  = _ibooker.book1D("hist_EB_CorSC_EoverTruth_","E/True E of Corrected SuperClusters in Barrel",
246  = _ibooker.book1D("hist_EE_CorSC_EoverTruth_","E/True E of Corrected SuperClusters in Endcap",
249  = _ibooker.book1D("hist_EE_PreSC_EoverTruth_","E/True E of SuperClusters with Preshower in Endcap",
251 
252  // dR distribution of SuperClusters from truth
253  //
255  = _ibooker.book1D("hist_EB_RawSC_deltaR_","dR to MC truth of Raw Super Clusters in Barrel",
258  = _ibooker.book1D("hist_EE_RawSC_deltaR_","dR to MC truth of Raw Super Clusters in Endcap",
261  = _ibooker.book1D("hist_EB_CorSC_deltaR_","dR to MC truth of Corrected SuperClusters in Barrel",
264  = _ibooker.book1D("hist_EE_CorSC_deltaR_","dR to MC truth of Corrected SuperClusters in Endcap",
267  = _ibooker.book1D("hist_EE_PreSC_deltaR_","dR to MC truth of SuperClusters with Preshower in Endcap",
269 
270  // phi width stored in corrected SuperClusters
272  = _ibooker.book1D("hist_EB_CorSC_phiWidth_","phiWidth of Corrected Super Clusters in Barrel",
275  = _ibooker.book1D("hist_EE_CorSC_phiWidth_","phiWidth of Corrected Super Clusters in Endcap",
277 
278  // eta width stored in corrected SuperClusters
280  = _ibooker.book1D("hist_EB_CorSC_etaWidth_","etaWidth of Corrected Super Clusters in Barrel",
283  = _ibooker.book1D("hist_EE_CorSC_etaWidth_","etaWidth of Corrected Super Clusters in Endcap",
285 
286 
287  // preshower energy
289  = _ibooker.book1D("hist_EE_PreSC_preshowerE_","preshower energy in Super Clusters with Preshower in Endcap",
292  = _ibooker.book1D("hist_EE_CorSC_preshowerE_","preshower energy in Corrected Super Clusters with Preshower in Endcap",
294 
295 
296  //
298  = _ibooker.book2D( "hist_EB_CorSC_ET_vs_Eta_", "Corr Super Cluster ET versus Eta in Barrel",
301 
303  = _ibooker.book2D( "hist_EB_CorSC_ET_vs_Phi_", "Corr Super Cluster ET versus Phi in Barrel",
306 
308  = _ibooker.book2D( "hist_EE_CorSC_ET_vs_Eta_", "Corr Super Cluster ET versus Eta in Endcap",
311 
313  = _ibooker.book2D( "hist_EE_CorSC_ET_vs_Phi_", "Corr Super Cluster ET versus Phi in Endcap",
316 
318  = _ibooker.book2D( "hist_EE_CorSC_ET_vs_R_", "Corr Super Cluster ET versus Radius in Endcap",
320  hsR_.bins, hsR_.min, hsR_.max);
321 
322 }
323 
324 void
326 {
327 
328  bool skipMC = false;
329  bool skipBarrel = false;
330  bool skipEndcap = false;
331 
332  //
333  // Get MCTRUTH
334  //
336  evt.getByToken(MCTruthCollectionToken_, pMCTruth);
337  if (!pMCTruth.isValid()) {
338  edm::LogError("EgammaSuperClusters") << "Error! can't get MC collection ";
339  skipMC = true;
340  }
341  const HepMC::GenEvent* genEvent = pMCTruth->GetEvent();
342 
343  if( skipMC ) return;
344 
345  //
346  // Get the BARREL products
347  //
348  edm::Handle<reco::SuperClusterCollection> pBarrelRawSuperClusters;
349  evt.getByToken(barrelRawSuperClusterCollectionToken_, pBarrelRawSuperClusters);
350  if (!pBarrelRawSuperClusters.isValid()) {
351  edm::LogError("EgammaSuperClusters") << "Error! can't get collection Raw SC";
352  skipBarrel = true;
353  }
354 
355  edm::Handle<reco::SuperClusterCollection> pBarrelCorSuperClusters;
356  evt.getByToken(barrelCorSuperClusterCollectionToken_, pBarrelCorSuperClusters);
357  if (!pBarrelCorSuperClusters.isValid()) {
358  edm::LogError("EgammaSuperClusters") << "Error! can't get collection Cor SC";
359  skipBarrel = true;
360  }
361 
362  edm::Handle< EBRecHitCollection > pBarrelRecHitCollection;
363  evt.getByToken( barrelRecHitCollectionToken_, pBarrelRecHitCollection );
364  if ( ! pBarrelRecHitCollection.isValid() ) {
365  skipBarrel = true;
366  }
367  edm::Handle< EERecHitCollection > pEndcapRecHitCollection;
368  evt.getByToken( endcapRecHitCollectionToken_, pEndcapRecHitCollection );
369  if ( ! pEndcapRecHitCollection.isValid() ) {
370  skipEndcap = true;
371  }
372 
373  if( skipBarrel || skipEndcap ) return;
374 
376 
377  // Get the BARREL collections
378  const reco::SuperClusterCollection* barrelRawSuperClusters = pBarrelRawSuperClusters.product();
379  const reco::SuperClusterCollection* barrelCorSuperClusters = pBarrelCorSuperClusters.product();
380 
381  // Number of entries in collections
382  hist_EB_RawSC_Size_->Fill(barrelRawSuperClusters->size());
383  hist_EB_CorSC_Size_->Fill(barrelCorSuperClusters->size());
384 
385  // Do RAW BARREL SuperClusters
386  for(reco::SuperClusterCollection::const_iterator aClus = barrelRawSuperClusters->begin();
387  aClus != barrelRawSuperClusters->end(); aClus++)
388  {
389  // kinematics
390  hist_EB_RawSC_NumBC_->Fill(aClus->clustersSize());
391  hist_EB_RawSC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
392  hist_EB_RawSC_Eta_->Fill(aClus->position().eta());
393  hist_EB_RawSC_Phi_->Fill(aClus->position().phi());
394 
395  // cluster shape
396  const reco::CaloClusterPtr seed = aClus->seed();
397  hist_EB_RawSC_S1toS9_->Fill( lazyTool.eMax( *seed ) / lazyTool.e3x3( *seed ) );
398  hist_EB_RawSC_S25toE_->Fill( lazyTool.e5x5( *seed ) / aClus->energy() );
399 
400  // truth
401  double dRClosest = 999.9;
402  double energyClosest = 0;
403  closestMCParticle(genEvent, *aClus, dRClosest, energyClosest);
404 
405  if (dRClosest < 0.1)
406  {
407  hist_EB_RawSC_EoverTruth_->Fill(aClus->energy()/energyClosest);
408  hist_EB_RawSC_deltaR_->Fill(dRClosest);
409 
410  }
411 
412  }
413 
414  // Do CORRECTED BARREL SuperClusters
415  for(reco::SuperClusterCollection::const_iterator aClus = barrelCorSuperClusters->begin();
416  aClus != barrelCorSuperClusters->end(); aClus++)
417  {
418  // kinematics
419  hist_EB_CorSC_NumBC_->Fill(aClus->clustersSize());
420  hist_EB_CorSC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
421  hist_EB_CorSC_Eta_->Fill(aClus->position().eta());
422  hist_EB_CorSC_Phi_->Fill(aClus->position().phi());
423 
424  hist_EB_CorSC_ET_vs_Eta_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->eta() );
425  hist_EB_CorSC_ET_vs_Phi_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->phi() );
426 
427 
428  // cluster shape
429  const reco::CaloClusterPtr seed = aClus->seed();
430  hist_EB_CorSC_S1toS9_->Fill( lazyTool.eMax( *seed ) / lazyTool.e3x3( *seed ) );
431  hist_EB_CorSC_S25toE_->Fill( lazyTool.e5x5( *seed ) / aClus->energy() );
432 
433  // correction variables
434  hist_EB_CorSC_phiWidth_->Fill(aClus->phiWidth());
435  hist_EB_CorSC_etaWidth_->Fill(aClus->etaWidth());
436 
437  // truth
438  double dRClosest = 999.9;
439  double energyClosest = 0;
440  closestMCParticle(genEvent, *aClus, dRClosest, energyClosest);
441 
442  if (dRClosest < 0.1)
443  {
444  hist_EB_CorSC_EoverTruth_->Fill(aClus->energy()/energyClosest);
445  hist_EB_CorSC_deltaR_->Fill(dRClosest);
446 
447  }
448 
449  }
450 
451  //
452  // Get the ENDCAP products
453  //
454  edm::Handle<reco::SuperClusterCollection> pEndcapRawSuperClusters;
455  evt.getByToken(endcapRawSuperClusterCollectionToken_, pEndcapRawSuperClusters);
456  if (!pEndcapRawSuperClusters.isValid()) {
457  edm::LogError("EgammaSuperClusters") << "Error! can't get collection Raw EE SC";
458  }
459 
460  edm::Handle<reco::SuperClusterCollection> pEndcapPreSuperClusters;
461  evt.getByToken(endcapPreSuperClusterCollectionToken_, pEndcapPreSuperClusters);
462  if (!pEndcapPreSuperClusters.isValid()) {
463  edm::LogError("EgammaSuperClusters") << "Error! can't get collection Pre EE SC";
464  }
465 
466  edm::Handle<reco::SuperClusterCollection> pEndcapCorSuperClusters;
467  evt.getByToken(endcapCorSuperClusterCollectionToken_, pEndcapCorSuperClusters);
468  if (!pEndcapCorSuperClusters.isValid()) {
469  edm::LogError("EgammaSuperClusters") << "Error! can't get collection Cor EE SC";
470  }
471 
472  // Get the ENDCAP collections
473  const reco::SuperClusterCollection* endcapRawSuperClusters = pEndcapRawSuperClusters.product();
474  const reco::SuperClusterCollection* endcapPreSuperClusters = pEndcapPreSuperClusters.product();
475  const reco::SuperClusterCollection* endcapCorSuperClusters = pEndcapCorSuperClusters.product();
476 
477  // Number of entries in collections
478  hist_EE_RawSC_Size_->Fill(endcapRawSuperClusters->size());
479  hist_EE_PreSC_Size_->Fill(endcapPreSuperClusters->size());
480  hist_EE_CorSC_Size_->Fill(endcapCorSuperClusters->size());
481 
482  // Do RAW ENDCAP SuperClusters
483  for(reco::SuperClusterCollection::const_iterator aClus = endcapRawSuperClusters->begin();
484  aClus != endcapRawSuperClusters->end(); aClus++)
485  {
486  hist_EE_RawSC_NumBC_->Fill(aClus->clustersSize());
487  hist_EE_RawSC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
488  hist_EE_RawSC_Eta_->Fill(aClus->position().eta());
489  hist_EE_RawSC_Phi_->Fill(aClus->position().phi());
490 
491  const reco::CaloClusterPtr seed = aClus->seed();
492  hist_EE_RawSC_S1toS9_->Fill( lazyTool.eMax( *seed ) / lazyTool.e3x3( *seed ) );
493  hist_EE_RawSC_S25toE_->Fill( lazyTool.e5x5( *seed ) / aClus->energy() );
494 
495  // truth
496  double dRClosest = 999.9;
497  double energyClosest = 0;
498  closestMCParticle(genEvent, *aClus, dRClosest, energyClosest);
499 
500  if (dRClosest < 0.1)
501  {
502  hist_EE_RawSC_EoverTruth_->Fill(aClus->energy()/energyClosest);
503  hist_EE_RawSC_deltaR_->Fill(dRClosest);
504  }
505 
506  }
507 
508  // Do ENDCAP SuperClusters with PRESHOWER
509  for(reco::SuperClusterCollection::const_iterator aClus = endcapPreSuperClusters->begin();
510  aClus != endcapPreSuperClusters->end(); aClus++)
511  {
512  hist_EE_PreSC_NumBC_->Fill(aClus->clustersSize());
513  hist_EE_PreSC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
514  hist_EE_PreSC_Eta_->Fill(aClus->position().eta());
515  hist_EE_PreSC_Phi_->Fill(aClus->position().phi());
516  hist_EE_PreSC_preshowerE_->Fill(aClus->preshowerEnergy());
517 
518  const reco::CaloClusterPtr seed = aClus->seed();
519  hist_EE_PreSC_S1toS9_->Fill( lazyTool.eMax( *seed ) / lazyTool.e3x3( *seed ) );
520  hist_EE_PreSC_S25toE_->Fill( lazyTool.e5x5( *seed ) / aClus->energy() );
521 
522  // truth
523  double dRClosest = 999.9;
524  double energyClosest = 0;
525  closestMCParticle(genEvent, *aClus, dRClosest, energyClosest);
526 
527  if (dRClosest < 0.1)
528  {
529  hist_EE_PreSC_EoverTruth_->Fill(aClus->energy()/energyClosest);
530  hist_EE_PreSC_deltaR_->Fill(dRClosest);
531  }
532 
533  }
534 
535  // Do CORRECTED ENDCAP SuperClusters
536  for(reco::SuperClusterCollection::const_iterator aClus = endcapCorSuperClusters->begin();
537  aClus != endcapCorSuperClusters->end(); aClus++)
538  {
539  hist_EE_CorSC_NumBC_->Fill(aClus->clustersSize());
540  hist_EE_CorSC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
541  hist_EE_CorSC_Eta_->Fill(aClus->position().eta());
542  hist_EE_CorSC_Phi_->Fill(aClus->position().phi());
543  hist_EE_CorSC_preshowerE_->Fill(aClus->preshowerEnergy());
544 
545  hist_EE_CorSC_ET_vs_Eta_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->eta() );
546  hist_EE_CorSC_ET_vs_Phi_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->phi() );
547  hist_EE_CorSC_ET_vs_R_->Fill( aClus->energy()/std::cosh(aClus->position().eta()),
548  std::sqrt( std::pow(aClus->x(),2) + std::pow(aClus->y(),2) ) );
549 
550 
551  // correction variables
552  hist_EE_CorSC_phiWidth_->Fill(aClus->phiWidth());
553  hist_EE_CorSC_etaWidth_->Fill(aClus->etaWidth());
554 
555  const reco::CaloClusterPtr seed = aClus->seed();
556  hist_EE_CorSC_S1toS9_->Fill( lazyTool.eMax( *seed ) / lazyTool.e3x3( *seed ) );
557  hist_EE_CorSC_S25toE_->Fill( lazyTool.e5x5( *seed ) / aClus->energy() );
558 
559  // truth
560  double dRClosest = 999.9;
561  double energyClosest = 0;
562  closestMCParticle(genEvent, *aClus, dRClosest, energyClosest);
563 
564  if (dRClosest < 0.1)
565  {
566  hist_EE_CorSC_EoverTruth_->Fill(aClus->energy()/energyClosest);
567  hist_EE_CorSC_deltaR_->Fill(dRClosest);
568  }
569 
570  }
571 
572 }
573 
574 //
575 // Closest MC Particle
576 //
577 void
579  double &dRClosest, double &energyClosest) const
580 {
581 
582  // SuperCluster eta, phi
583  double scEta = sc.eta();
584  double scPhi = sc.phi();
585 
586  // initialize dRClosest to a large number
587  dRClosest = 999.9;
588 
589  // loop over the MC truth particles to find the
590  // closest to the superCluster in dR space
591  for(HepMC::GenEvent::particle_const_iterator currentParticle = genEvent->particles_begin();
592  currentParticle != genEvent->particles_end(); currentParticle++ )
593  {
594  if((*currentParticle)->status() == 1)
595  {
596  // need GenParticle in ECAL co-ordinates
597  HepMC::FourVector vtx = (*currentParticle)->production_vertex()->position();
598  double phiTrue = (*currentParticle)->momentum().phi();
599  double etaTrue = ecalEta((*currentParticle)->momentum().eta(), vtx.z()/10., vtx.perp()/10.);
600 
601  double dPhi = reco::deltaPhi(phiTrue, scPhi);
602  double dEta = scEta - etaTrue;
603  double deltaR = std::sqrt(dPhi*dPhi + dEta*dEta);
604 
605  if(deltaR < dRClosest)
606  {
607  dRClosest = deltaR;
608  energyClosest = (*currentParticle)->momentum().e();
609  }
610 
611  } // end if stable particle
612 
613  } // end loop on get particles
614 
615 }
616 
617 
618 //
619 // Compute Eta in the ECAL co-ordinate system
620 //
621 float
622 EgammaSuperClusters::ecalEta(float EtaParticle , float Zvertex, float plane_Radius) const
623 {
624  const float R_ECAL = 136.5;
625  const float Z_Endcap = 328.0;
626  const float etaBarrelEndcap = 1.479;
627 
628  if(EtaParticle != 0.)
629  {
630  float Theta = 0.0 ;
631  float ZEcal = (R_ECAL-plane_Radius)*sinh(EtaParticle)+Zvertex;
632 
633  if(ZEcal != 0.0) Theta = atan(R_ECAL/ZEcal);
634  if(Theta<0.0) Theta = Theta+Geom::pi() ;
635 
636  float ETA = - log(tan(0.5*Theta));
637 
638  if( fabs(ETA) > etaBarrelEndcap )
639  {
640  float Zend = Z_Endcap ;
641  if(EtaParticle<0.0 ) Zend = -Zend ;
642  float Zlen = Zend - Zvertex ;
643  float RR = Zlen/sinh(EtaParticle);
644  Theta = atan((RR+plane_Radius)/Zend);
645  if(Theta<0.0) Theta = Theta+Geom::pi() ;
646  ETA = - log(tan(0.5*Theta));
647  }
648 
649  return ETA;
650  }
651  else
652  {
653  edm::LogWarning("") << "[EgammaSuperClusters::ecalEta] Warning: Eta equals to zero, not correcting" ;
654  return EtaParticle;
655  }
656 }
657 
MonitorElement * hist_EE_CorSC_ET_vs_Phi_
MonitorElement * hist_EE_CorSC_ET_vs_R_
MonitorElement * hist_EE_PreSC_ET_
edm::EDGetTokenT< reco::SuperClusterCollection > endcapRawSuperClusterCollectionToken_
MonitorElement * hist_EB_CorSC_ET_
MonitorElement * hist_EB_CorSC_NumBC_
MonitorElement * hist_EE_CorSC_etaWidth_
MonitorElement * hist_EE_PreSC_EoverTruth_
MonitorElement * hist_EE_CorSC_Eta_
MonitorElement * hist_EB_RawSC_Size_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
MonitorElement * hist_EE_RawSC_NumBC_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
int bins
Definition: HistSpec.h:9
MonitorElement * hist_EB_RawSC_S1toS9_
MonitorElement * hist_EB_RawSC_ET_
double max
Definition: HistSpec.h:8
MonitorElement * hist_EE_CorSC_EoverTruth_
MonitorElement * hist_EE_CorSC_deltaR_
MonitorElement * hist_EB_RawSC_Phi_
MonitorElement * hist_EE_RawSC_ET_
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:163
float ecalEta(float, float, float) const
void Fill(long long x)
MonitorElement * hist_EB_CorSC_phiWidth_
MonitorElement * hist_EE_PreSC_S1toS9_
edm::EDGetTokenT< reco::SuperClusterCollection > endcapPreSuperClusterCollectionToken_
double min
Definition: HistSpec.h:7
MonitorElement * hist_EB_RawSC_Eta_
#define ETA
MonitorElement * hist_EB_CorSC_deltaR_
MonitorElement * hist_EE_RawSC_S1toS9_
MonitorElement * hist_EB_CorSC_S25toE_
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
MonitorElement * hist_EE_CorSC_S1toS9_
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollectionToken_
MonitorElement * hist_EE_RawSC_deltaR_
edm::EDGetTokenT< edm::HepMCProduct > MCTruthCollectionToken_
T sqrt(T t)
Definition: SSEVec.h:18
MonitorElement * hist_EE_PreSC_Phi_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
MonitorElement * hist_EB_CorSC_ET_vs_Eta_
edm::EDGetTokenT< reco::SuperClusterCollection > barrelRawSuperClusterCollectionToken_
MonitorElement * hist_EB_CorSC_EoverTruth_
tuple genEvent
Definition: MCTruth.py:33
MonitorElement * hist_EB_CorSC_etaWidth_
MonitorElement * hist_EE_CorSC_ET_
bool isValid() const
Definition: HandleBase.h:75
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< reco::SuperClusterCollection > endcapCorSuperClusterCollectionToken_
MonitorElement * hist_EE_PreSC_deltaR_
MonitorElement * hist_EE_CorSC_Size_
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
MonitorElement * hist_EE_PreSC_preshowerE_
MonitorElement * hist_EB_CorSC_Phi_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
T const * product() const
Definition: Handle.h:81
MonitorElement * hist_EB_CorSC_S1toS9_
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MonitorElement * hist_EB_CorSC_Size_
MonitorElement * hist_EE_CorSC_Phi_
edm::EDGetTokenT< reco::SuperClusterCollection > barrelCorSuperClusterCollectionToken_
MonitorElement * hist_EB_RawSC_EoverTruth_
static const float etaBarrelEndcap
MonitorElement * hist_EE_RawSC_EoverTruth_
EgammaSuperClusters(const edm::ParameterSet &)
static const float Z_Endcap
MonitorElement * hist_EB_RawSC_S25toE_
MonitorElement * hist_EE_PreSC_Eta_
MonitorElement * hist_EB_CorSC_Eta_
MonitorElement * hist_EB_RawSC_NumBC_
MonitorElement * hist_EE_CorSC_preshowerE_
double pi()
Definition: Pi.h:31
static const float R_ECAL
MonitorElement * hist_EE_RawSC_Size_
MonitorElement * hist_EE_CorSC_NumBC_
MonitorElement * hist_EE_CorSC_S25toE_
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:166
MonitorElement * hist_EE_RawSC_S25toE_
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollectionToken_
MonitorElement * hist_EE_CorSC_ET_vs_Eta_
void closestMCParticle(HepMC::GenEvent const *, reco::SuperCluster const &, double &, double &) const
MonitorElement * hist_EE_PreSC_NumBC_
MonitorElement * hist_EE_PreSC_S25toE_
MonitorElement * hist_EE_RawSC_Eta_
MonitorElement * hist_EE_PreSC_Size_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
MonitorElement * hist_EB_RawSC_deltaR_
MonitorElement * hist_EE_RawSC_Phi_
Definition: Run.h:43
MonitorElement * hist_EB_CorSC_ET_vs_Phi_
MonitorElement * hist_EE_CorSC_phiWidth_