CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
EnergyScaleAnalyzer Class Reference

#include <Validation/EcalClusters/src/EnergyScaleAnalyzer.cc>

Inheritance diagram for EnergyScaleAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Classes

struct  tree_structure_
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 
 EnergyScaleAnalyzer (const edm::ParameterSet &)
 
 ~EnergyScaleAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void fillTree (const reco::SuperClusterCollection *scColl, const reco::SuperClusterCollection *corrSCColl, HepMC::GenParticle *mc, tree_structure_ &tree_, float xV, float yV, float zV, int scType)
 

Private Attributes

float energyMax_
 
float etaMax_
 
float etaMaxVtx_
 
float eTMax_
 
float eTMaxVtx_
 
int evtN
 
std::string hepMCLabel_
 
TTree * mytree_
 
std::string outputFile_
 
float phiMax_
 
float phiMaxVtx_
 
float rClust_vtx_
 
TFile * rootFile_
 
float thetaMax_
 
float thetaMaxVtx_
 
tree_structure_ tree_
 
float xClust_vtx_
 
float xClust_zero_
 
float xVtx_
 
float yClust_vtx_
 
float yClust_zero_
 
float yVtx_
 
float zClust_vtx_
 
float zClust_zero_
 
float zVtx_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 48 of file EnergyScaleAnalyzer.h.

Constructor & Destructor Documentation

EnergyScaleAnalyzer::EnergyScaleAnalyzer ( const edm::ParameterSet ps)
explicit

Definition at line 73 of file EnergyScaleAnalyzer.cc.

References evtN, edm::ParameterSet::getParameter(), hepMCLabel_, outputFile_, rootFile_, and AlCaHLTBitMon_QueryRunRegistry::string.

75 {
76 
77  hepMCLabel_ = ps.getParameter<std::string>("hepMCLabel");
78 
79  outputFile_ = ps.getParameter<std::string>("outputFile");
80  rootFile_ = TFile::Open(outputFile_.c_str(),"RECREATE"); // open output file to store histograms
81 
82  evtN = 0;
83 }
T getParameter(std::string const &) const
EnergyScaleAnalyzer::~EnergyScaleAnalyzer ( )

Definition at line 87 of file EnergyScaleAnalyzer.cc.

References rootFile_.

89 {
90  delete rootFile_;
91 }

Member Function Documentation

void EnergyScaleAnalyzer::analyze ( const edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 115 of file EnergyScaleAnalyzer.cc.

References funct::abs(), kinem::delta_R(), dynamicHybridSuperClusters_cfi::dynamicHybridSuperClusters, fillTree(), MCTruth::genEvent, configurableAnalysis::GenParticle, edm::Event::getByLabel(), edm::Event::getManyByType(), hepMCLabel_, unifiedSCCollection_cfi::hybridSuperClusters, i, EnergyScaleAnalyzer::tree_structure_::mc_e, EnergyScaleAnalyzer::tree_structure_::mc_et, EnergyScaleAnalyzer::tree_structure_::mc_eta, EnergyScaleAnalyzer::tree_structure_::mc_npar, EnergyScaleAnalyzer::tree_structure_::mc_phi, EnergyScaleAnalyzer::tree_structure_::mc_sep, EnergyScaleAnalyzer::tree_structure_::mc_theta, AlCaHLTBitMon_ParallelJobs::p, EnergyScaleAnalyzer::tree_structure_::parID, funct::sin(), tree_, xVtx_, yVtx_, and zVtx_.

115  {
116  using namespace edm; // needed for all fwk related classes
117  using namespace std;
118 
119  // std::cout << "Proceccing event # " << ++evtN << std::endl;
120 
121  //Get containers for MC truth, SC etc. ===================================================
122  // =======================================================================================
123  // =======================================================================================
124  Handle<HepMCProduct> hepMC;
125  evt.getByLabel( hepMCLabel_, hepMC ) ;
126 
127  const HepMC::GenEvent* genEvent = hepMC->GetEvent();
128  if ( !(hepMC.isValid())) {
129  LogInfo("EnergyScaleAnalyzer") << "Could not get MC Product!";
130  return;
131  }
132 
133 
134  //=======================For Vertex correction
135  std::vector< Handle< HepMCProduct > > evtHandles ;
136  evt.getManyByType( evtHandles ) ;
137 
138  for ( unsigned int i=0; i<evtHandles.size(); ++i) {
139  if ( evtHandles[i].isValid() ) {
140  const HepMC::GenEvent* evt = evtHandles[i]->GetEvent() ;
141 
142  // take only 1st vertex for now - it's been tested only of PGuns...
143  //
144  HepMC::GenEvent::vertex_const_iterator vtx = evt->vertices_begin() ;
145  if ( evtHandles[i].provenance()->moduleLabel() == hepMCLabel_ ) {
146  //Corrdinates of Vertex w.r.o. the point (0,0,0)
147  xVtx_ = 0.1*(*vtx)->position().x();
148  yVtx_ = 0.1*(*vtx)->position().y();
149  zVtx_ = 0.1*(*vtx)->position().z();
150  }
151  }
152  }
153  //==============================================================================
154  //Get handle to SC collections
155 
157  try {
158  evt.getByLabel("hybridSuperClusters","",hybridSuperClusters);
159  }catch (cms::Exception& ex) {
160  edm::LogError("EnergyScaleAnalyzer") << "Can't get collection with producer hybridSuperClusters.";
161  }
162 
164  try {
165  evt.getByLabel("dynamicHybridSuperClusters","",dynamicHybridSuperClusters);
166  }catch (cms::Exception& ex) {
167  edm::LogError("EnergyScaleAnalyzer") << "Can't get collection with producer dynamicHybridSuperClusters.";
168  }
169 
170  Handle<reco::SuperClusterCollection> fixedMatrixSuperClustersWithPS;
171  try {
172  evt.getByLabel("fixedMatrixSuperClustersWithPreshower","",fixedMatrixSuperClustersWithPS);
173  }catch (cms::Exception& ex) {
174  edm::LogError("EnergyScaleAnalyzer") << "Can't get collection with producer fixedMatrixSuperClustersWithPreshower.";
175  }
176 
177  //Corrected collections
178  Handle<reco::SuperClusterCollection> correctedHybridSC;
179  try {
180  evt.getByLabel("correctedHybridSuperClusters","",correctedHybridSC);
181  }catch (cms::Exception& ex) {
182  edm::LogError("EnergyScaleAnalyzer") << "Can't get collection with producer correctedHybridSuperClusters.";
183  }
184 
185  Handle<reco::SuperClusterCollection> correctedDynamicHybridSC;
186  try{
187  evt.getByLabel("correctedDynamicHybridSuperClusters","",correctedDynamicHybridSC);
188  }catch (cms::Exception& ex) {
189  edm::LogError("EnergyScaleAnalyzer") << "Can't get collection with producer correctedDynamicHybridSuperClusters.";
190  }
191 
192  Handle<reco::SuperClusterCollection> correctedFixedMatrixSCWithPS;
193  try {
194  evt.getByLabel("correctedFixedMatrixSuperClustersWithPreshower","",correctedFixedMatrixSCWithPS);
195  }catch (cms::Exception& ex ) {
196  edm::LogError("EnergyScaleAnalyzer") << "Can't get collection with producer correctedFixedMatrixSuperClustersWithPreshower.";
197  }
198 
200  const reco::SuperClusterCollection* hSC = hybridSuperClusters.product();
201  const reco::SuperClusterCollection* fmSC = fixedMatrixSuperClustersWithPS.product();
202  const reco::SuperClusterCollection* chSC = correctedHybridSC.product();
203  const reco::SuperClusterCollection* cdSC = correctedDynamicHybridSC.product();
204  const reco::SuperClusterCollection* cfmSC = correctedFixedMatrixSCWithPS.product();
205 
206  // ----------------------- Print outs for debugging
207  /*
208  std::cout << "MC truth" << std::endl;
209  int counterI = 0;
210  for( HepMC::GenEvent::particle_const_iterator p = genEvent->particles_begin();
211  p != genEvent->particles_end(); ++p ) {
212  if ( fabs((*p)->momentum().eta()) < 1.5 ) {
213  std::cout << ++counterI << " " << (*p)->momentum().e() << " "
214  << (*p)->momentum().phi() << " " << (*p)->momentum().eta() << std::endl;
215  }
216  }
217 
218  std::cout << "Standard clusters" << std::endl;
219  counterI = 0;
220  for(reco::SuperClusterCollection::const_iterator em = hSC->begin();
221  em != hSC->end(); ++em )
222  std::cout << ++counterI << " " << em->energy() << " " << em->position().phi() << " " << em->position().eta() << std::endl;
223 
224  std::cout << "Dynamic clusters" << std::endl;
225  counterI = 0;
226  for(reco::SuperClusterCollection::const_iterator em = dSC->begin();
227  em != dSC->end(); ++em )
228  std::cout << ++counterI << " " << em->energy() << " " << em->position().phi() << " " << em->position().eta() << std::endl;
229 
230  std::cout << "FixedMatrix clusters with PS" << std::endl;
231  counterI = 0;
232  for(reco::SuperClusterCollection::const_iterator em = fmSC->begin();
233  em != fmSC->end(); ++em )
234  std::cout << ++counterI << " " << em->energy() << " " << em->position().phi() << " " << em->position().eta() << std::endl;
235  */
236  // -----------------------------
237  //=====================================================================
238  // All containers are loaded, perform the analysis
239  //====================================================================
240 
241  // --------------------------- Store MC particles
242  HepMC::GenEvent::particle_const_iterator p = genEvent->particles_begin();
243 
244  // Search for MC electrons or photons that satisfy the criteria
245  float min_eT = 5;
246  float max_eta = 2.5;
247 
248  std::vector<HepMC::GenParticle* > mcParticles;
249  //int counter = 0;
250  for ( HepMC::GenEvent::particle_const_iterator p = genEvent->particles_begin();
251  p != genEvent->particles_end();
252  ++p ) {
253  //LogInfo("EnergyScaleAnalyzer") << "Particle " << ++counter
254  //<< " PDG ID = " << (*p)->pdg_id() << " pT = " << (*p)->momentum().perp();
255  // require photon or electron
256  if ( (*p)->pdg_id() != 22 && abs((*p)->pdg_id()) != 11 ) continue;
257 
258  // require selection criteria
259  bool satisfySelectionCriteria =
260  (*p)->momentum().perp() > min_eT &&
261  fabs((*p)->momentum().eta()) < max_eta;
262 
263  if ( ! satisfySelectionCriteria ) continue;
264 
265  // EM MC particle is found, save it in the vector
266  mcParticles.push_back(*p);
267  }
268  // separation in dR between 2 first MC particles
269  // should not be used for MC samples with > 2 em objects generated!
270  if ( mcParticles.size() == 2 ) {
271  HepMC::GenParticle* mc1 = mcParticles[0];
272  HepMC::GenParticle* mc2 = mcParticles[1];
273  tree_.mc_sep = kinem::delta_R(mc1->momentum().eta(), mc1->momentum().phi(),
274  mc2->momentum().eta(), mc2->momentum().phi());
275  } else
276  tree_.mc_sep = -100;
277 
278 
279  // now loop over MC particles, find the match with SC and do everything we need
280  // then save info in the tree for every MC particle
281  for(std::vector<HepMC::GenParticle* >::const_iterator p = mcParticles.begin();
282  p != mcParticles.end(); ++p) {
283  HepMC::GenParticle* mc = *p;
284 
285  // Fill MC information
286  tree_.mc_npar = mcParticles.size();
287  tree_.parID = mc->pdg_id();
288  tree_.mc_e = mc->momentum().e();
289  tree_.mc_et = mc->momentum().e()*sin(mc->momentum().theta());
290  tree_.mc_phi = mc->momentum().phi();
291  tree_.mc_eta = mc->momentum().eta();
292  tree_.mc_theta = mc->momentum().theta();
293 
294 
295  //Call function to fill tree
296  // scType coprreponds:
297  // HybridSuperCluster -- 1
298  // DynamicHybridSuperCluster -- 2
299  // FixedMatrixSuperClustersWithPreshower -- 3
300 
301  fillTree( hSC, chSC, mc, tree_, xVtx_, yVtx_, zVtx_, 1);
302  // std::cout << " TYPE " << 1 << " : " << tree_.em_e << " : " << tree_.em_phi << " : " << tree_.em_eta << std::endl;
303 
304  fillTree( dSC, cdSC, mc, tree_, xVtx_, yVtx_, zVtx_, 2);
305  // std::cout << " TYPE " << 2 << " : " << tree_.em_e << " : " << tree_.em_phi << " : " << tree_.em_eta << std::endl;
306 
307  fillTree( fmSC, cfmSC, mc, tree_, xVtx_, yVtx_, zVtx_, 3);
308  // std::cout << " TYPE " << 3 << " : " << tree_.em_e << " : " << tree_.em_phi << " : " << tree_.em_eta << std::endl;
309 
310  // mytree_->Fill();
311  } // loop over particles
312 }
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:424
int i
Definition: DBlmapReader.cc:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void fillTree(const reco::SuperClusterCollection *scColl, const reco::SuperClusterCollection *corrSCColl, HepMC::GenParticle *mc, tree_structure_ &tree_, float xV, float yV, float zV, int scType)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple genEvent
Definition: MCTruth.py:33
double delta_R(double eta1, double phi1, double eta2, double phi2)
Definition: AnglesUtil.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
void EnergyScaleAnalyzer::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 95 of file EnergyScaleAnalyzer.cc.

References EnergyScaleAnalyzer::tree_structure_::mc_npar, mytree_, and tree_.

95  {
96 //========================================================================
97 
98  mytree_ = new TTree("energyScale","");
99  TString treeVariables = "mc_npar/I:parID:mc_sep/F:mc_e:mc_et:mc_phi:mc_eta:mc_theta:"; // MC information
100  treeVariables += "em_dR/F:"; // MC <-> EM matching information
101  treeVariables += "em_isInCrack/I:em_scType:em_e/F:em_et:em_phi:em_eta:em_theta:em_nCell/I:em_nBC:"; // EM SC info
102  treeVariables += "em_pet/F:em_pe:em_peta:em_ptheta:" ; // EM SC physics (eta corrected information)
103 
104  treeVariables += "emCorr_e/F:emCorr_et:emCorr_eta:emCorr_phi:emCorr_theta:";// CMSSW standard corrections
105  treeVariables += "emCorr_pet/F:emCorr_peta:emCorr_ptheta:" ;// CMSSW standard physics
106 
107  treeVariables += "em_pw/F:em_ew:em_br" ; // EM widths pw -- phiWidth, ew -- etaWidth, ratios of pw/ew
108 
109  mytree_->Branch("energyScale",&(tree_.mc_npar),treeVariables);
110 
111 }
void EnergyScaleAnalyzer::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 441 of file EnergyScaleAnalyzer.cc.

References rootFile_.

441  {
442  //========================================================================
443  //Fill ROOT tree
444  rootFile_->Write();
445 }
void EnergyScaleAnalyzer::fillTree ( const reco::SuperClusterCollection scColl,
const reco::SuperClusterCollection corrSCColl,
HepMC::GenParticle *  mc,
tree_structure_ tree_,
float  xV,
float  yV,
float  zV,
int  scType 
)
private

fill tree with kinematic variables of corrected Super Cluster

Definition at line 315 of file EnergyScaleAnalyzer.cc.

References kinem::delta_R(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, EnergyScaleAnalyzer::tree_structure_::em_br, EnergyScaleAnalyzer::tree_structure_::em_dR, EnergyScaleAnalyzer::tree_structure_::em_e, EnergyScaleAnalyzer::tree_structure_::em_et, EnergyScaleAnalyzer::tree_structure_::em_eta, EnergyScaleAnalyzer::tree_structure_::em_ew, EnergyScaleAnalyzer::tree_structure_::em_isInCrack, EnergyScaleAnalyzer::tree_structure_::em_nBC, EnergyScaleAnalyzer::tree_structure_::em_nCell, EnergyScaleAnalyzer::tree_structure_::em_pe, EnergyScaleAnalyzer::tree_structure_::em_pet, EnergyScaleAnalyzer::tree_structure_::em_peta, EnergyScaleAnalyzer::tree_structure_::em_phi, EnergyScaleAnalyzer::tree_structure_::em_ptheta, EnergyScaleAnalyzer::tree_structure_::em_pw, EnergyScaleAnalyzer::tree_structure_::em_scType, EnergyScaleAnalyzer::tree_structure_::em_theta, EnergyScaleAnalyzer::tree_structure_::emCorr_e, EnergyScaleAnalyzer::tree_structure_::emCorr_et, EnergyScaleAnalyzer::tree_structure_::emCorr_eta, EnergyScaleAnalyzer::tree_structure_::emCorr_pet, EnergyScaleAnalyzer::tree_structure_::emCorr_peta, EnergyScaleAnalyzer::tree_structure_::emCorr_phi, EnergyScaleAnalyzer::tree_structure_::emCorr_ptheta, EnergyScaleAnalyzer::tree_structure_::emCorr_theta, relval_parameters_module::energy, energyMax_, eta(), etaMax_, etaMaxVtx_, eTMax_, eTMaxVtx_, create_public_lumi_plots::log, mytree_, phi, phiMax_, phiMaxVtx_, rClust_vtx_, funct::sin(), mathSSE::sqrt(), funct::tan(), thetaMax_, thetaMaxVtx_, xClust_vtx_, xClust_zero_, yClust_vtx_, yClust_zero_, zClust_vtx_, and zClust_zero_.

Referenced by analyze().

316  {
317 
318  // ----------------------------- SuperClusters before energy correction
319  reco::SuperClusterCollection::const_iterator em = scColl->end();
320  float energyMax = -100.0; // dummy energy of the matched SC
321  for(reco::SuperClusterCollection::const_iterator aClus = scColl->begin();
322  aClus != scColl->end(); ++aClus) {
323  // check the matching
324  float dR = kinem::delta_R(mc ->momentum().eta(), mc ->momentum().phi(),
325  aClus->position().eta(), aClus->position().phi());
326  if (dR < 0.4) { // a rather loose matching cut
327  float energy = aClus->energy();
328  if ( energy < energyMax ) continue;
329  energyMax = energy;
330  em = aClus;
331  }
332  }
333 
334  if (em == scColl->end() ) {
335  // std::cout << "No matching SC with type " << scType << " was found for MC particle! " << std::endl;
336  // std::cout << "Going to next type of SC. " << std::endl;
337  return;
338  }
339  // ------------
340 
341  tree_.em_scType = scType;
342 
343  tree_.em_isInCrack = 0;
344  double emAbsEta = fabs(em->position().eta());
345  // copied from RecoEgama/EgammaElectronAlgos/src/EgammaElectronClassification.cc
346  if ( emAbsEta < 0.018 ||
347  (emAbsEta > 0.423 && emAbsEta < 0.461) ||
348  (emAbsEta > 0.770 && emAbsEta < 0.806) ||
349  (emAbsEta > 1.127 && emAbsEta < 1.163) ||
350  (emAbsEta > 1.460 && emAbsEta < 1.558) )
351  tree_.em_isInCrack = 1;
352 
353  tree_.em_dR = kinem::delta_R(mc->momentum().eta(), mc->momentum().phi(),
354  em->position().eta(), em->position().phi());
355  tree_.em_e = em->energy();
356  tree_.em_et = em->energy() * sin(em->position().theta());
357  tree_.em_phi = em->position().phi();
358  tree_.em_eta = em->position().eta();
359  tree_.em_theta = em->position().theta();
360  tree_.em_nCell = em->size();
361  tree_.em_nBC = em->clustersSize();
362 
363  //Get physics e, et etc:
364  //Coordinates of EM object with respect of the point (0,0,0)
365  xClust_zero_ = em->position().x();
366  yClust_zero_ = em->position().y();
367  zClust_zero_ = em->position().z();
368  //Coordinates of EM object w.r.o. the Vertex position
369  xClust_vtx_ = xClust_zero_ - xV;
370  yClust_vtx_ = yClust_zero_ - yV;
371  zClust_vtx_ = zClust_zero_ - zV;
372 
373  energyMax_ = em->energy();
374  thetaMax_ = em->position().theta();
375  etaMax_ = em->position().eta();
376  phiMax_ = em->position().phi();
378  if ( phiMax_ < 0) phiMax_ += 2*3.14159;
379 
382  etaMaxVtx_ = - log(tan(thetaMaxVtx_/2));
385  if ( phiMaxVtx_ < 0) phiMaxVtx_ += 2*3.14159;
386  //=============================
387  //parametres of EM object after vertex correction
392 
393 
394  //------------------------------- Get SC after energy correction
395  em = corrSCColl->end();
396  energyMax = -100.0; // dummy energy of the matched SC
397  for(reco::SuperClusterCollection::const_iterator aClus = corrSCColl->begin();
398  aClus != corrSCColl->end(); ++aClus) {
399  // check the matching
400  float dR = kinem::delta_R(mc ->momentum().eta(), mc ->momentum().phi(),
401  aClus->position().eta(), aClus->position().phi());
402  if (dR < 0.4) {
403  float energy = aClus->energy();
404  if ( energy < energyMax ) continue;
405  energyMax = energy;
406  em = aClus;
407  }
408  }
409 
410  if (em == corrSCColl->end() ) {
411  // std::cout << "No matching corrected SC with type " << scType << " was found for MC particle! " << std::endl;
412  // std::cout << "Going to next type of SC. " << std::endl;
413  return;
414  }
415  // ------------
416 
418  tree_.emCorr_e = em->energy();
419  tree_.emCorr_et = em->energy() * sin(em->position().theta());
420  tree_.emCorr_phi = em->position().phi();
421  tree_.emCorr_eta = em->position().eta();
422  tree_.emCorr_theta = em->position().theta();
423 
424  // =========== Eta and Theta wrt Vertex does not change after energy corrections are applied
425  // =========== So, no need to calculate them again
426 
430 
431  tree_.em_pw = em->phiWidth();
432  tree_.em_ew = em->etaWidth();
434 
435  mytree_->Fill();
436 
437 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T eta() const
T sqrt(T t)
Definition: SSEVec.h:48
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double delta_R(double eta1, double phi1, double eta2, double phi2)
Definition: AnglesUtil.h:116
Definition: DDAxes.h:10

Member Data Documentation

float EnergyScaleAnalyzer::energyMax_
private

Definition at line 134 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::etaMax_
private

Definition at line 137 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::etaMaxVtx_
private

Definition at line 138 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::eTMax_
private

Definition at line 135 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::eTMaxVtx_
private

Definition at line 136 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

int EnergyScaleAnalyzer::evtN
private

Definition at line 145 of file EnergyScaleAnalyzer.h.

Referenced by EnergyScaleAnalyzer().

std::string EnergyScaleAnalyzer::hepMCLabel_
private

Definition at line 63 of file EnergyScaleAnalyzer.h.

Referenced by analyze(), and EnergyScaleAnalyzer().

TTree* EnergyScaleAnalyzer::mytree_
private

Definition at line 69 of file EnergyScaleAnalyzer.h.

Referenced by beginJob(), and fillTree().

std::string EnergyScaleAnalyzer::outputFile_
private

Definition at line 61 of file EnergyScaleAnalyzer.h.

Referenced by EnergyScaleAnalyzer().

float EnergyScaleAnalyzer::phiMax_
private

Definition at line 139 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::phiMaxVtx_
private

Definition at line 140 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::rClust_vtx_
private

Definition at line 132 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

TFile* EnergyScaleAnalyzer::rootFile_
private

Definition at line 66 of file EnergyScaleAnalyzer.h.

Referenced by endJob(), EnergyScaleAnalyzer(), and ~EnergyScaleAnalyzer().

float EnergyScaleAnalyzer::thetaMax_
private

Definition at line 141 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::thetaMaxVtx_
private

Definition at line 142 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

tree_structure_ EnergyScaleAnalyzer::tree_
private

Definition at line 117 of file EnergyScaleAnalyzer.h.

Referenced by analyze(), and beginJob().

float EnergyScaleAnalyzer::xClust_vtx_
private

Definition at line 128 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::xClust_zero_
private

Definition at line 124 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::xVtx_
private

Definition at line 120 of file EnergyScaleAnalyzer.h.

Referenced by analyze().

float EnergyScaleAnalyzer::yClust_vtx_
private

Definition at line 129 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::yClust_zero_
private

Definition at line 125 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::yVtx_
private

Definition at line 121 of file EnergyScaleAnalyzer.h.

Referenced by analyze().

float EnergyScaleAnalyzer::zClust_vtx_
private

Definition at line 130 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::zClust_zero_
private

Definition at line 126 of file EnergyScaleAnalyzer.h.

Referenced by fillTree().

float EnergyScaleAnalyzer::zVtx_
private

Definition at line 122 of file EnergyScaleAnalyzer.h.

Referenced by analyze().