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 
10 
12 
15 
17 {
18  outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
19  //CMSSW_Version_ = ps.getUntrackedParameter<std::string>("CMSSW_Version", "");
20 
21  verboseDBE_ = ps.getUntrackedParameter<bool>("verboseDBE", false);
22 
23  hist_min_Size_ = ps.getParameter<double>("hist_min_Size");
24  hist_max_Size_ = ps.getParameter<double>("hist_max_Size");
25  hist_bins_Size_ = ps.getParameter<int> ("hist_bins_Size");
26 
27  hist_min_NumBC_ = ps.getParameter<double>("hist_min_NumBC");
28  hist_max_NumBC_ = ps.getParameter<double>("hist_max_NumBC");
29  hist_bins_NumBC_ = ps.getParameter<int> ("hist_bins_NumBC");
30 
31  hist_min_ET_ = ps.getParameter<double>("hist_min_ET");
32  hist_max_ET_ = ps.getParameter<double>("hist_max_ET");
33  hist_bins_ET_ = ps.getParameter<int> ("hist_bins_ET");
34 
35  hist_min_Eta_ = ps.getParameter<double>("hist_min_Eta");
36  hist_max_Eta_ = ps.getParameter<double>("hist_max_Eta");
37  hist_bins_Eta_ = ps.getParameter<int> ("hist_bins_Eta");
38 
39  hist_min_Phi_ = ps.getParameter<double>("hist_min_Phi");
40  hist_max_Phi_ = ps.getParameter<double>("hist_max_Phi");
41  hist_bins_Phi_ = ps.getParameter<int> ("hist_bins_Phi");
42 
43  hist_min_S1toS9_ = ps.getParameter<double>("hist_min_S1toS9");
44  hist_max_S1toS9_ = ps.getParameter<double>("hist_max_S1toS9");
45  hist_bins_S1toS9_ = ps.getParameter<int> ("hist_bins_S1toS9");
46 
47  hist_min_S25toE_ = ps.getParameter<double>("hist_min_S25toE");
48  hist_max_S25toE_ = ps.getParameter<double>("hist_max_S25toE");
49  hist_bins_S25toE_ = ps.getParameter<int> ("hist_bins_S25toE");
50 
51  hist_min_EoverTruth_ = ps.getParameter<double>("hist_min_EoverTruth");
52  hist_max_EoverTruth_ = ps.getParameter<double>("hist_max_EoverTruth");
53  hist_bins_EoverTruth_ = ps.getParameter<int> ("hist_bins_EoverTruth");
54 
55  hist_min_deltaR_ = ps.getParameter<double>("hist_min_deltaR");
56  hist_max_deltaR_ = ps.getParameter<double>("hist_max_deltaR");
57  hist_bins_deltaR_ = ps.getParameter<int> ("hist_bins_deltaR");
58 
59  hist_min_phiWidth_ = ps.getParameter<double>("hist_min_phiWidth");
60  hist_max_phiWidth_ = ps.getParameter<double>("hist_max_phiWidth");
61  hist_bins_phiWidth_ = ps.getParameter<int>("hist_bins_phiWidth");
62 
63  hist_min_etaWidth_ = ps.getParameter<double>("hist_min_etaWidth");
64  hist_max_etaWidth_ = ps.getParameter<double>("hist_max_etaWidth");
65  hist_bins_etaWidth_ = ps.getParameter<int>("hist_bins_etaWidth");
66 
67  hist_bins_preshowerE_ = ps.getParameter<int>("hist_bins_preshowerE");
68  hist_min_preshowerE_ = ps.getParameter<double>("hist_min_preshowerE");
69  hist_max_preshowerE_ = ps.getParameter<double>("hist_max_preshowerE");
70 
71  hist_min_R_ = ps.getParameter<double>("hist_min_R");
72  hist_max_R_ = ps.getParameter<double>("hist_max_R");
73  hist_bins_R_ = ps.getParameter<int> ("hist_bins_R");
74 
75  MCTruthCollectionToken_ = consumes<edm::HepMCProduct>(ps.getParameter<edm::InputTag>("MCTruthCollection"));
76 
77  barrelRawSuperClusterCollectionToken_ = consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("barrelRawSuperClusterCollection"));
78  barrelCorSuperClusterCollectionToken_ = consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("barrelCorSuperClusterCollection"));
79  endcapRawSuperClusterCollectionToken_ = consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("endcapRawSuperClusterCollection"));
80 
81  endcapPreSuperClusterCollectionToken_ = consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("endcapPreSuperClusterCollection"));
82  endcapCorSuperClusterCollectionToken_ = consumes<reco::SuperClusterCollection>(ps.getParameter<edm::InputTag>("endcapCorSuperClusterCollection"));
83 
84  barrelRecHitCollectionToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("barrelRecHitCollection"));
85  endcapRecHitCollectionToken_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("endcapRecHitCollection"));
86 }
87 
89 
91 {
93 
94  if ( verboseDBE_ )
95  {
96  dbe_->setVerbose(1);
98  }
99  else
100  dbe_->setVerbose(0);
101 
102  //dbe_->setCurrentFolder("Ecal/CMSSW_"+CMSSW_Version_+"/EcalClusters/SuperClusters/");
103  dbe_->setCurrentFolder("EcalClusterV/EcalSuperClusters/");
104 
105  // Number of SuperClusters
106  //
108  = dbe_->book1D("hist_EB_RawSC_Size_","# Raw SuperClusters in Barrel",
111  = dbe_->book1D("hist_EE_RawSC_Size_","# Raw SuperClusters in Endcap",
114  = dbe_->book1D("hist_EB_CorSC_Size_","# Corrected SuperClusters in Barrel",
117  = dbe_->book1D("hist_EE_CorSC_Size_","# Corrected SuperClusters in Endcap",
120  = dbe_->book1D("hist_EE_PreSC_Size_","# SuperClusters with Preshower in Endcap",
122 
123  // Number of BasicClusters in SuperCluster
124  //
126  = dbe_->book1D("hist_EB_RawSC_NumBC_","# of Basic Clusters in Raw Super Clusters in Barrel",
129  = dbe_->book1D("hist_EE_RawSC_NumBC_","# of Basic Clusters in Raw Super Clusters in Endcap",
132  = dbe_->book1D("hist_EB_CorSC_NumBC_","# of Basic Clusters in Corrected SuperClusters in Barrel",
135  = dbe_->book1D("hist_EE_CorSC_NumBC_","# of Basic Clusters in Corrected SuperClusters in Endcap",
138  = dbe_->book1D("hist_EE_PreSC_NumBC_","# of Basic Clusters in SuperClusters with Preshower in Endcap",
140 
141  // ET distribution of SuperClusters
142  //
144  = dbe_->book1D("hist_EB_RawSC_ET_","ET of Raw SuperClusters in Barrel",
147  = dbe_->book1D("hist_EE_RawSC_ET_","ET of Raw SuperClusters in Endcap",
150  = dbe_->book1D("hist_EB_CorSC_ET_","ET of Corrected SuperClusters in Barrel",
153  = dbe_->book1D("hist_EE_CorSC_ET_","ET of Corrected SuperClusters in Endcap",
156  = dbe_->book1D("hist_EE_PreSC_ET_","ET of SuperClusters with Preshower in Endcap",
158 
159  // Eta distribution of SuperClusters
160  //
162  = dbe_->book1D("hist_EB_RawSC_Eta_","Eta of Raw SuperClusters in Barrel",
165  = dbe_->book1D("hist_EE_RawSC_Eta_","Eta of Raw SuperClusters in Endcap",
168  = dbe_->book1D("hist_EB_CorSC_Eta_","Eta of Corrected SuperClusters in Barrel",
171  = dbe_->book1D("hist_EE_CorSC_Eta_","Eta of Corrected SuperClusters in Endcap",
174  = dbe_->book1D("hist_EE_PreSC_Eta_","Eta of SuperClusters with Preshower in Endcap",
176 
177  // Phi distribution of SuperClusters
178  //
180  = dbe_->book1D("hist_EB_RawSC_Phi_","Phi of Raw SuperClusters in Barrel",
183  = dbe_->book1D("hist_EE_RawSC_Phi_","Phi of Raw SuperClusters in Endcap",
186  = dbe_->book1D("hist_EB_CorSC_Phi_","Phi of Corrected SuperClusters in Barrel",
189  = dbe_->book1D("hist_EE_CorSC_Phi_","Phi of Corrected SuperClusters in Endcap",
192  = dbe_->book1D("hist_EE_PreSC_Phi_","Phi of SuperClusters with Preshower in Endcap",
194 
195  // S1/S9 distribution of SuperClusters
196  //
198  = dbe_->book1D("hist_EB_RawSC_S1toS9_","S1/S9 of Raw Super Clusters in Barrel",
201  = dbe_->book1D("hist_EE_RawSC_S1toS9_","S1/S9 of Raw Super Clusters in Endcap",
204  = dbe_->book1D("hist_EB_CorSC_S1toS9_","S1/S9 of Corrected SuperClusters in Barrel",
207  = dbe_->book1D("hist_EE_CorSC_S1toS9_","S1/S9 of Corrected SuperClusters in Endcap",
210  = dbe_->book1D("hist_EE_PreSC_S1toS9_","S1/S9 of SuperClusters with Preshower in Endcap",
212 
213  // S25/E distribution of SuperClusters
214  //
216  = dbe_->book1D("hist_EB_RawSC_S25toE_","S25/E of Raw Super Clusters in Barrel",
219  = dbe_->book1D("hist_EE_RawSC_S25toE_","S25/E of Raw Super Clusters in Endcap",
222  = dbe_->book1D("hist_EB_CorSC_S25toE_","S25/E of Corrected SuperClusters in Barrel",
225  = dbe_->book1D("hist_EE_CorSC_S25toE_","S25/E of Corrected SuperClusters in Endcap",
228  = dbe_->book1D("hist_EE_PreSC_S25toE_","S25/E of SuperClusters with Preshower in Endcap",
230 
231  // E/E(true) distribution of SuperClusters
232  //
234  = dbe_->book1D("hist_EB_RawSC_EoverTruth_","E/True E of Raw SuperClusters in Barrel",
237  = dbe_->book1D("hist_EE_RawSC_EoverTruth_","E/True E of Raw SuperClusters in Endcap",
240  = dbe_->book1D("hist_EB_CorSC_EoverTruth_","E/True E of Corrected SuperClusters in Barrel",
243  = dbe_->book1D("hist_EE_CorSC_EoverTruth_","E/True E of Corrected SuperClusters in Endcap",
246  = dbe_->book1D("hist_EE_PreSC_EoverTruth_","E/True E of SuperClusters with Preshower in Endcap",
248 
249  // dR distribution of SuperClusters from truth
250  //
252  = dbe_->book1D("hist_EB_RawSC_deltaR_","dR to MC truth of Raw Super Clusters in Barrel",
255  = dbe_->book1D("hist_EE_RawSC_deltaR_","dR to MC truth of Raw Super Clusters in Endcap",
258  = dbe_->book1D("hist_EB_CorSC_deltaR_","dR to MC truth of Corrected SuperClusters in Barrel",
261  = dbe_->book1D("hist_EE_CorSC_deltaR_","dR to MC truth of Corrected SuperClusters in Endcap",
264  = dbe_->book1D("hist_EE_PreSC_deltaR_","dR to MC truth of SuperClusters with Preshower in Endcap",
266 
267  // phi width stored in corrected SuperClusters
269  = dbe_->book1D("hist_EB_CorSC_phiWidth_","phiWidth of Corrected Super Clusters in Barrel",
272  = dbe_->book1D("hist_EE_CorSC_phiWidth_","phiWidth of Corrected Super Clusters in Endcap",
274 
275  // eta width stored in corrected SuperClusters
277  = dbe_->book1D("hist_EB_CorSC_etaWidth_","etaWidth of Corrected Super Clusters in Barrel",
280  = dbe_->book1D("hist_EE_CorSC_etaWidth_","etaWidth of Corrected Super Clusters in Endcap",
282 
283 
284  // preshower energy
286  = dbe_->book1D("hist_EE_PreSC_preshowerE_","preshower energy in Super Clusters with Preshower in Endcap",
289  = dbe_->book1D("hist_EE_CorSC_preshowerE_","preshower energy in Corrected Super Clusters with Preshower in Endcap",
291 
292 
293  //
294  hist_EB_CorSC_ET_vs_Eta_ = dbe_->book2D( "hist_EB_CorSC_ET_vs_Eta_", "Corr Super Cluster ET versus Eta in Barrel",
297 
298  hist_EB_CorSC_ET_vs_Phi_ = dbe_->book2D( "hist_EB_CorSC_ET_vs_Phi_", "Corr Super Cluster ET versus Phi in Barrel",
301 
302  hist_EE_CorSC_ET_vs_Eta_ = dbe_->book2D( "hist_EE_CorSC_ET_vs_Eta_", "Corr Super Cluster ET versus Eta in Endcap",
305 
306  hist_EE_CorSC_ET_vs_Phi_ = dbe_->book2D( "hist_EE_CorSC_ET_vs_Phi_", "Corr Super Cluster ET versus Phi in Endcap",
309 
310  hist_EE_CorSC_ET_vs_R_ = dbe_->book2D( "hist_EE_CorSC_ET_vs_R_", "Corr Super Cluster ET versus Radius in Endcap",
313 
314 
315 }
316 
318 {
319 
320  bool skipMC = false;
321  bool skipBarrel = false;
322  bool skipEndcap = false;
323 
324  //
325  // Get MCTRUTH
326  //
328  evt.getByToken(MCTruthCollectionToken_, pMCTruth);
329  if (!pMCTruth.isValid()) {
330  edm::LogError("EgammaSuperClusters") << "Error! can't get MC collection ";
331  skipMC = true;
332  }
333  const HepMC::GenEvent* genEvent = pMCTruth->GetEvent();
334 
335  if( skipMC ) return;
336 
337  //
338  // Get the BARREL products
339  //
340  edm::Handle<reco::SuperClusterCollection> pBarrelRawSuperClusters;
341  evt.getByToken(barrelRawSuperClusterCollectionToken_, pBarrelRawSuperClusters);
342  if (!pBarrelRawSuperClusters.isValid()) {
343  edm::LogError("EgammaSuperClusters") << "Error! can't get collection Raw SC";
344  skipBarrel = true;
345  }
346 
347  edm::Handle<reco::SuperClusterCollection> pBarrelCorSuperClusters;
348  evt.getByToken(barrelCorSuperClusterCollectionToken_, pBarrelCorSuperClusters);
349  if (!pBarrelCorSuperClusters.isValid()) {
350  edm::LogError("EgammaSuperClusters") << "Error! can't get collection Cor SC";
351  skipBarrel = true;
352  }
353 
354  edm::Handle< EBRecHitCollection > pBarrelRecHitCollection;
355  evt.getByToken( barrelRecHitCollectionToken_, pBarrelRecHitCollection );
356  if ( ! pBarrelRecHitCollection.isValid() ) {
357  skipBarrel = true;
358  }
359  edm::Handle< EERecHitCollection > pEndcapRecHitCollection;
360  evt.getByToken( endcapRecHitCollectionToken_, pEndcapRecHitCollection );
361  if ( ! pEndcapRecHitCollection.isValid() ) {
362  skipEndcap = true;
363  }
364 
365  if( skipBarrel || skipEndcap ) return;
366 
368 
369  // Get the BARREL collections
370  const reco::SuperClusterCollection* barrelRawSuperClusters = pBarrelRawSuperClusters.product();
371  const reco::SuperClusterCollection* barrelCorSuperClusters = pBarrelCorSuperClusters.product();
372 
373  // Number of entries in collections
374  hist_EB_RawSC_Size_->Fill(barrelRawSuperClusters->size());
375  hist_EB_CorSC_Size_->Fill(barrelCorSuperClusters->size());
376 
377  // Do RAW BARREL SuperClusters
378  for(reco::SuperClusterCollection::const_iterator aClus = barrelRawSuperClusters->begin();
379  aClus != barrelRawSuperClusters->end(); aClus++)
380  {
381  // kinematics
382  hist_EB_RawSC_NumBC_->Fill(aClus->clustersSize());
383  hist_EB_RawSC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
384  hist_EB_RawSC_Eta_->Fill(aClus->position().eta());
385  hist_EB_RawSC_Phi_->Fill(aClus->position().phi());
386 
387  // cluster shape
388  const reco::CaloClusterPtr seed = aClus->seed();
389  hist_EB_RawSC_S1toS9_->Fill( lazyTool.eMax( *seed ) / lazyTool.e3x3( *seed ) );
390  hist_EB_RawSC_S25toE_->Fill( lazyTool.e5x5( *seed ) / aClus->energy() );
391 
392  // truth
393  double dRClosest = 999.9;
394  double energyClosest = 0;
395  closestMCParticle(genEvent, *aClus, dRClosest, energyClosest);
396 
397  if (dRClosest < 0.1)
398  {
399  hist_EB_RawSC_EoverTruth_->Fill(aClus->energy()/energyClosest);
400  hist_EB_RawSC_deltaR_->Fill(dRClosest);
401 
402  }
403 
404  }
405 
406  // Do CORRECTED BARREL SuperClusters
407  for(reco::SuperClusterCollection::const_iterator aClus = barrelCorSuperClusters->begin();
408  aClus != barrelCorSuperClusters->end(); aClus++)
409  {
410  // kinematics
411  hist_EB_CorSC_NumBC_->Fill(aClus->clustersSize());
412  hist_EB_CorSC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
413  hist_EB_CorSC_Eta_->Fill(aClus->position().eta());
414  hist_EB_CorSC_Phi_->Fill(aClus->position().phi());
415 
416  hist_EB_CorSC_ET_vs_Eta_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->eta() );
417  hist_EB_CorSC_ET_vs_Phi_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->phi() );
418 
419 
420  // cluster shape
421  const reco::CaloClusterPtr seed = aClus->seed();
422  hist_EB_CorSC_S1toS9_->Fill( lazyTool.eMax( *seed ) / lazyTool.e3x3( *seed ) );
423  hist_EB_CorSC_S25toE_->Fill( lazyTool.e5x5( *seed ) / aClus->energy() );
424 
425  // correction variables
426  hist_EB_CorSC_phiWidth_->Fill(aClus->phiWidth());
427  hist_EB_CorSC_etaWidth_->Fill(aClus->etaWidth());
428 
429  // truth
430  double dRClosest = 999.9;
431  double energyClosest = 0;
432  closestMCParticle(genEvent, *aClus, dRClosest, energyClosest);
433 
434  if (dRClosest < 0.1)
435  {
436  hist_EB_CorSC_EoverTruth_->Fill(aClus->energy()/energyClosest);
437  hist_EB_CorSC_deltaR_->Fill(dRClosest);
438 
439  }
440 
441  }
442 
443  //
444  // Get the ENDCAP products
445  //
446  edm::Handle<reco::SuperClusterCollection> pEndcapRawSuperClusters;
447  evt.getByToken(endcapRawSuperClusterCollectionToken_, pEndcapRawSuperClusters);
448  if (!pEndcapRawSuperClusters.isValid()) {
449  edm::LogError("EgammaSuperClusters") << "Error! can't get collection Raw EE SC";
450  }
451 
452  edm::Handle<reco::SuperClusterCollection> pEndcapPreSuperClusters;
453  evt.getByToken(endcapPreSuperClusterCollectionToken_, pEndcapPreSuperClusters);
454  if (!pEndcapPreSuperClusters.isValid()) {
455  edm::LogError("EgammaSuperClusters") << "Error! can't get collection Pre EE SC";
456  }
457 
458  edm::Handle<reco::SuperClusterCollection> pEndcapCorSuperClusters;
459  evt.getByToken(endcapCorSuperClusterCollectionToken_, pEndcapCorSuperClusters);
460  if (!pEndcapCorSuperClusters.isValid()) {
461  edm::LogError("EgammaSuperClusters") << "Error! can't get collection Cor EE SC";
462  }
463 
464  // Get the ENDCAP collections
465  const reco::SuperClusterCollection* endcapRawSuperClusters = pEndcapRawSuperClusters.product();
466  const reco::SuperClusterCollection* endcapPreSuperClusters = pEndcapPreSuperClusters.product();
467  const reco::SuperClusterCollection* endcapCorSuperClusters = pEndcapCorSuperClusters.product();
468 
469  // Number of entries in collections
470  hist_EE_RawSC_Size_->Fill(endcapRawSuperClusters->size());
471  hist_EE_PreSC_Size_->Fill(endcapPreSuperClusters->size());
472  hist_EE_CorSC_Size_->Fill(endcapCorSuperClusters->size());
473 
474  // Do RAW ENDCAP SuperClusters
475  for(reco::SuperClusterCollection::const_iterator aClus = endcapRawSuperClusters->begin();
476  aClus != endcapRawSuperClusters->end(); aClus++)
477  {
478  hist_EE_RawSC_NumBC_->Fill(aClus->clustersSize());
479  hist_EE_RawSC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
480  hist_EE_RawSC_Eta_->Fill(aClus->position().eta());
481  hist_EE_RawSC_Phi_->Fill(aClus->position().phi());
482 
483  const reco::CaloClusterPtr seed = aClus->seed();
484  hist_EE_RawSC_S1toS9_->Fill( lazyTool.eMax( *seed ) / lazyTool.e3x3( *seed ) );
485  hist_EE_RawSC_S25toE_->Fill( lazyTool.e5x5( *seed ) / aClus->energy() );
486 
487  // truth
488  double dRClosest = 999.9;
489  double energyClosest = 0;
490  closestMCParticle(genEvent, *aClus, dRClosest, energyClosest);
491 
492  if (dRClosest < 0.1)
493  {
494  hist_EE_RawSC_EoverTruth_->Fill(aClus->energy()/energyClosest);
495  hist_EE_RawSC_deltaR_->Fill(dRClosest);
496  }
497 
498  }
499 
500  // Do ENDCAP SuperClusters with PRESHOWER
501  for(reco::SuperClusterCollection::const_iterator aClus = endcapPreSuperClusters->begin();
502  aClus != endcapPreSuperClusters->end(); aClus++)
503  {
504  hist_EE_PreSC_NumBC_->Fill(aClus->clustersSize());
505  hist_EE_PreSC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
506  hist_EE_PreSC_Eta_->Fill(aClus->position().eta());
507  hist_EE_PreSC_Phi_->Fill(aClus->position().phi());
508  hist_EE_PreSC_preshowerE_->Fill(aClus->preshowerEnergy());
509 
510  const reco::CaloClusterPtr seed = aClus->seed();
511  hist_EE_PreSC_S1toS9_->Fill( lazyTool.eMax( *seed ) / lazyTool.e3x3( *seed ) );
512  hist_EE_PreSC_S25toE_->Fill( lazyTool.e5x5( *seed ) / aClus->energy() );
513 
514  // truth
515  double dRClosest = 999.9;
516  double energyClosest = 0;
517  closestMCParticle(genEvent, *aClus, dRClosest, energyClosest);
518 
519  if (dRClosest < 0.1)
520  {
521  hist_EE_PreSC_EoverTruth_->Fill(aClus->energy()/energyClosest);
522  hist_EE_PreSC_deltaR_->Fill(dRClosest);
523  }
524 
525  }
526 
527  // Do CORRECTED ENDCAP SuperClusters
528  for(reco::SuperClusterCollection::const_iterator aClus = endcapCorSuperClusters->begin();
529  aClus != endcapCorSuperClusters->end(); aClus++)
530  {
531  hist_EE_CorSC_NumBC_->Fill(aClus->clustersSize());
532  hist_EE_CorSC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
533  hist_EE_CorSC_Eta_->Fill(aClus->position().eta());
534  hist_EE_CorSC_Phi_->Fill(aClus->position().phi());
535  hist_EE_CorSC_preshowerE_->Fill(aClus->preshowerEnergy());
536 
537  hist_EE_CorSC_ET_vs_Eta_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->eta() );
538  hist_EE_CorSC_ET_vs_Phi_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->phi() );
539  hist_EE_CorSC_ET_vs_R_->Fill( aClus->energy()/std::cosh(aClus->position().eta()),
540  std::sqrt( std::pow(aClus->x(),2) + std::pow(aClus->y(),2) ) );
541 
542 
543  // correction variables
544  hist_EE_CorSC_phiWidth_->Fill(aClus->phiWidth());
545  hist_EE_CorSC_etaWidth_->Fill(aClus->etaWidth());
546 
547  const reco::CaloClusterPtr seed = aClus->seed();
548  hist_EE_CorSC_S1toS9_->Fill( lazyTool.eMax( *seed ) / lazyTool.e3x3( *seed ) );
549  hist_EE_CorSC_S25toE_->Fill( lazyTool.e5x5( *seed ) / aClus->energy() );
550 
551  // truth
552  double dRClosest = 999.9;
553  double energyClosest = 0;
554  closestMCParticle(genEvent, *aClus, dRClosest, energyClosest);
555 
556  if (dRClosest < 0.1)
557  {
558  hist_EE_CorSC_EoverTruth_->Fill(aClus->energy()/energyClosest);
559  hist_EE_CorSC_deltaR_->Fill(dRClosest);
560  }
561 
562  }
563 
564 }
565 
567 {
568  if (outputFile_.size() != 0 && dbe_) dbe_->save(outputFile_);
569 }
570 
571 //
572 // Closest MC Particle
573 //
575  double &dRClosest, double &energyClosest)
576 {
577 
578  // SuperCluster eta, phi
579  double scEta = sc.eta();
580  double scPhi = sc.phi();
581 
582  // initialize dRClosest to a large number
583  dRClosest = 999.9;
584 
585  // loop over the MC truth particles to find the
586  // closest to the superCluster in dR space
587  for(HepMC::GenEvent::particle_const_iterator currentParticle = genEvent->particles_begin();
588  currentParticle != genEvent->particles_end(); currentParticle++ )
589  {
590  if((*currentParticle)->status() == 1)
591  {
592  // need GenParticle in ECAL co-ordinates
593  HepMC::FourVector vtx = (*currentParticle)->production_vertex()->position();
594  double phiTrue = (*currentParticle)->momentum().phi();
595  double etaTrue = ecalEta((*currentParticle)->momentum().eta(), vtx.z()/10., vtx.perp()/10.);
596 
597  double dPhi = reco::deltaPhi(phiTrue, scPhi);
598  double dEta = scEta - etaTrue;
599  double deltaR = std::sqrt(dPhi*dPhi + dEta*dEta);
600 
601  if(deltaR < dRClosest)
602  {
603  dRClosest = deltaR;
604  energyClosest = (*currentParticle)->momentum().e();
605  }
606 
607  } // end if stable particle
608 
609  } // end loop on get particles
610 
611 }
612 
613 
614 //
615 // Compute Eta in the ECAL co-ordinate system
616 //
617 float EgammaSuperClusters::ecalEta(float EtaParticle , float Zvertex, float plane_Radius)
618 {
619  const float R_ECAL = 136.5;
620  const float Z_Endcap = 328.0;
621  const float etaBarrelEndcap = 1.479;
622 
623  if(EtaParticle != 0.)
624  {
625  float Theta = 0.0 ;
626  float ZEcal = (R_ECAL-plane_Radius)*sinh(EtaParticle)+Zvertex;
627 
628  if(ZEcal != 0.0) Theta = atan(R_ECAL/ZEcal);
629  if(Theta<0.0) Theta = Theta+Geom::pi() ;
630 
631  float ETA = - log(tan(0.5*Theta));
632 
633  if( fabs(ETA) > etaBarrelEndcap )
634  {
635  float Zend = Z_Endcap ;
636  if(EtaParticle<0.0 ) Zend = -Zend ;
637  float Zlen = Zend - Zvertex ;
638  float RR = Zlen/sinh(EtaParticle);
639  Theta = atan((RR+plane_Radius)/Zend);
640  if(Theta<0.0) Theta = Theta+Geom::pi() ;
641  ETA = - log(tan(0.5*Theta));
642  }
643 
644  return ETA;
645  }
646  else
647  {
648  edm::LogWarning("") << "[EgammaSuperClusters::ecalEta] Warning: Eta equals to zero, not correcting" ;
649  return EtaParticle;
650  }
651 }
652 
653 
T getParameter(std::string const &) const
MonitorElement * hist_EE_CorSC_ET_vs_Phi_
T getUntrackedParameter(std::string const &, T const &) const
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_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
MonitorElement * hist_EE_PreSC_EoverTruth_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:1006
MonitorElement * hist_EE_CorSC_Eta_
MonitorElement * hist_EB_RawSC_Size_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
MonitorElement * hist_EE_RawSC_NumBC_
MonitorElement * hist_EB_RawSC_S1toS9_
MonitorElement * hist_EB_RawSC_ET_
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
void Fill(long long x)
MonitorElement * hist_EB_CorSC_phiWidth_
MonitorElement * hist_EE_PreSC_S1toS9_
edm::EDGetTokenT< reco::SuperClusterCollection > endcapPreSuperClusterCollectionToken_
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:48
MonitorElement * hist_EE_PreSC_Phi_
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_
void setVerbose(unsigned level)
Definition: DQMStore.cc:683
MonitorElement * hist_EE_CorSC_ET_
bool isValid() const
Definition: HandleBase.h:75
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:12
MonitorElement * hist_EE_PreSC_preshowerE_
MonitorElement * hist_EB_CorSC_Phi_
float ecalEta(float EtaParticle, float Zvertex, float plane_Radius)
T const * product() const
Definition: Handle.h:81
MonitorElement * hist_EB_CorSC_S1toS9_
MonitorElement * hist_EB_CorSC_Size_
MonitorElement * hist_EE_CorSC_Phi_
edm::EDGetTokenT< reco::SuperClusterCollection > barrelCorSuperClusterCollectionToken_
void closestMCParticle(const HepMC::GenEvent *genEvent, const reco::SuperCluster &sc, double &dRClosest, double &energyClosest)
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
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2608
static const float R_ECAL
MonitorElement * hist_EE_RawSC_Size_
MonitorElement * hist_EE_CorSC_NumBC_
MonitorElement * hist_EE_CorSC_S25toE_
void showDirStructure(void) const
Definition: DQMStore.cc:3401
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:166
MonitorElement * hist_EE_RawSC_S25toE_
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollectionToken_
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:1134
MonitorElement * hist_EE_CorSC_ET_vs_Eta_
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
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:719
MonitorElement * hist_EB_RawSC_deltaR_
MonitorElement * hist_EE_RawSC_Phi_
MonitorElement * hist_EB_CorSC_ET_vs_Phi_
MonitorElement * hist_EE_CorSC_phiWidth_
tuple log
Definition: cmsBatch.py:347