104 mytree_ =
new TTree(
"energyScale",
"");
105 TString treeVariables =
"mc_npar/I:parID:mc_sep/F:mc_e:mc_et:mc_phi:mc_eta:mc_theta:";
106 treeVariables +=
"em_dR/F:";
107 treeVariables +=
"em_isInCrack/I:em_scType:em_e/F:em_et:em_phi:em_eta:em_theta:em_nCell/I:em_nBC:";
108 treeVariables +=
"em_pet/F:em_pe:em_peta:em_ptheta:" ;
110 treeVariables +=
"emCorr_e/F:emCorr_et:emCorr_eta:emCorr_phi:emCorr_theta:";
111 treeVariables +=
"emCorr_pet/F:emCorr_peta:emCorr_ptheta:" ;
113 treeVariables +=
"em_pw/F:em_ew:em_br" ;
138 LogInfo(
"EnergyScaleAnalyzer") <<
"Could not get MC Product!";
144 std::vector< Handle< HepMCProduct > > evtHandles ;
147 for (
unsigned int i=0;
i<evtHandles.size(); ++
i) {
148 if ( evtHandles[
i].isValid() ) {
153 HepMC::GenEvent::vertex_const_iterator
vtx = evt->vertices_begin() ;
156 xVtx_ = 0.1*(*vtx)->position().x();
157 yVtx_ = 0.1*(*vtx)->position().y();
158 zVtx_ = 0.1*(*vtx)->position().z();
169 edm::LogError(
"EnergyScaleAnalyzer") <<
"Can't get collection with producer hybridSuperClusters.";
176 edm::LogError(
"EnergyScaleAnalyzer") <<
"Can't get collection with producer dynamicHybridSuperClusters.";
183 edm::LogError(
"EnergyScaleAnalyzer") <<
"Can't get collection with producer fixedMatrixSuperClustersWithPreshower.";
191 edm::LogError(
"EnergyScaleAnalyzer") <<
"Can't get collection with producer correctedHybridSuperClusters.";
198 edm::LogError(
"EnergyScaleAnalyzer") <<
"Can't get collection with producer correctedDynamicHybridSuperClusters.";
205 edm::LogError(
"EnergyScaleAnalyzer") <<
"Can't get collection with producer correctedFixedMatrixSuperClustersWithPreshower.";
251 HepMC::GenEvent::particle_const_iterator
p = genEvent->particles_begin();
257 std::vector<HepMC::GenParticle* > mcParticles;
259 for ( HepMC::GenEvent::particle_const_iterator p = genEvent->particles_begin();
260 p != genEvent->particles_end();
265 if ( (*p)->pdg_id() != 22 &&
abs((*p)->pdg_id()) != 11 )
continue;
268 bool satisfySelectionCriteria =
269 (*p)->momentum().perp() > min_eT &&
270 fabs((*p)->momentum().eta()) < max_eta;
272 if ( ! satisfySelectionCriteria )
continue;
275 mcParticles.push_back(*p);
279 if ( mcParticles.size() == 2 ) {
283 mc2->momentum().eta(), mc2->momentum().phi());
290 for(std::vector<HepMC::GenParticle* >::const_iterator p = mcParticles.begin();
291 p != mcParticles.end(); ++
p) {
298 tree_.
mc_et = mc->momentum().e()*
sin(mc->momentum().theta());
328 reco::SuperClusterCollection::const_iterator em = scColl->end();
329 float energyMax = -100.0;
330 for(reco::SuperClusterCollection::const_iterator aClus = scColl->begin();
331 aClus != scColl->end(); ++aClus) {
334 aClus->position().eta(), aClus->position().phi());
336 float energy = aClus->energy();
337 if ( energy < energyMax )
continue;
343 if (em == scColl->end() ) {
353 double emAbsEta = fabs(em->position().eta());
355 if ( emAbsEta < 0.018 ||
356 (emAbsEta > 0.423 && emAbsEta < 0.461) ||
357 (emAbsEta > 0.770 && emAbsEta < 0.806) ||
358 (emAbsEta > 1.127 && emAbsEta < 1.163) ||
359 (emAbsEta > 1.460 && emAbsEta < 1.558) )
363 em->position().eta(), em->position().phi());
364 tree_.
em_e = em->energy();
365 tree_.
em_et = em->energy() *
sin(em->position().theta());
366 tree_.
em_phi = em->position().phi();
367 tree_.
em_eta = em->position().eta();
368 tree_.
em_theta = em->position().theta();
370 tree_.
em_nBC = em->clustersSize();
384 etaMax_ = em->position().eta();
385 phiMax_ = em->position().phi();
404 em = corrSCColl->end();
406 for(reco::SuperClusterCollection::const_iterator aClus = corrSCColl->begin();
407 aClus != corrSCColl->end(); ++aClus) {
410 aClus->position().eta(), aClus->position().phi());
412 float energy = aClus->energy();
413 if ( energy < energyMax )
continue;
419 if (em == corrSCColl->end() ) {
428 tree_.
emCorr_et = em->energy() *
sin(em->position().theta());
440 tree_.
em_pw = em->phiWidth();
441 tree_.
em_ew = em->etaWidth();
void getManyByType(std::vector< Handle< PROD > > &results) const
edm::EDGetTokenT< reco::SuperClusterCollection > dynamicHybridSuperClusters_token
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::SuperClusterCollection > fixedMatrixSuperClustersWithPreshower_token
virtual void analyze(const edm::Event &, const edm::EventSetup &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
Sin< T >::type sin(const T &t)
edm::EDGetTokenT< edm::HepMCProduct > hepMCLabel_
edm::EDGetTokenT< reco::SuperClusterCollection > correctedFixedMatrixSuperClustersWithPreshower_token
edm::EDGetTokenT< reco::SuperClusterCollection > hybridSuperClusters_token
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
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
double delta_R(double eta1, double phi1, double eta2, double phi2)
edm::EDGetTokenT< reco::SuperClusterCollection > correctedDynamicHybridSuperClusters_token
dynamicHybridSuperClusters
edm::EDGetTokenT< reco::SuperClusterCollection > correctedHybridSuperClusters_token
const HepMC::GenEvent * GetEvent() const
EnergyScaleAnalyzer(const edm::ParameterSet &)
T const * product() const
void labelsForToken(EDGetToken iToken, Labels &oLabels) const