77 "dynamicHybridSuperClusters",
edm::InputTag(
"dynamicHybridSuperClusters")));
79 "correctedHybridSuperClusters",
edm::InputTag(
"correctedHybridSuperClusters")));
82 "correctedDynamicHybridSuperClusters",
edm::InputTag(
"correctedDynamicHybridSuperClusters")));
85 edm::InputTag(
"correctedFixedMatrixSuperClustersWithPreshower")));
88 "fixedMatrixSuperClustersWithPreshower",
edm::InputTag(
"fixedMatrixSuperClustersWithPreshower")));
108 mytree_ =
new TTree(
"energyScale",
"");
109 TString treeVariables =
110 "mc_npar/I:parID:mc_sep/" 111 "F:mc_e:mc_et:mc_phi:mc_eta:mc_theta:";
112 treeVariables +=
"em_dR/F:";
114 "em_isInCrack/I:em_scType:em_e/F:em_et:em_phi:em_eta:em_theta:em_nCell/" 116 treeVariables +=
"em_pet/F:em_pe:em_peta:em_ptheta:";
119 treeVariables +=
"emCorr_e/F:emCorr_et:emCorr_eta:emCorr_phi:emCorr_theta:";
122 treeVariables +=
"emCorr_pet/F:emCorr_peta:emCorr_ptheta:";
124 treeVariables +=
"em_pw/F:em_ew:em_br";
148 if (!(
hepMC.isValid())) {
149 LogInfo(
"EnergyScaleAnalyzer") <<
"Could not get MC Product!";
154 std::vector<Handle<HepMCProduct>> evtHandles;
157 throw cms::Exception(
"UnsupportedFunction") <<
"EnergyScaleAnalyzer::analyze: " 158 <<
"getManyByType has not been supported by the Framework since 2015. " 159 <<
"This module has been broken since then. Maybe it should be deleted. " 160 <<
"Another possibility is to upgrade to use GetterOfProducts instead.";
162 for (
unsigned int i = 0;
i < evtHandles.size(); ++
i) {
168 HepMC::GenEvent::vertex_const_iterator
vtx = evt->vertices_begin();
171 xVtx_ = 0.1 * (*vtx)->position().x();
172 yVtx_ = 0.1 * (*vtx)->position().y();
173 zVtx_ = 0.1 * (*vtx)->position().z();
184 edm::LogError(
"EnergyScaleAnalyzer") <<
"Can't get collection with producer hybridSuperClusters.";
191 edm::LogError(
"EnergyScaleAnalyzer") <<
"Can't get collection with producer dynamicHybridSuperClusters.";
198 edm::LogError(
"EnergyScaleAnalyzer") <<
"Can't get collection with producer " 199 "fixedMatrixSuperClustersWithPreshower.";
207 edm::LogError(
"EnergyScaleAnalyzer") <<
"Can't get collection with producer correctedHybridSuperClusters.";
214 edm::LogError(
"EnergyScaleAnalyzer") <<
"Can't get collection with producer " 215 "correctedDynamicHybridSuperClusters.";
222 edm::LogError(
"EnergyScaleAnalyzer") <<
"Can't get collection with producer " 223 "correctedFixedMatrixSuperClustersWithPreshower.";
273 HepMC::GenEvent::particle_const_iterator
p =
genEvent->particles_begin();
279 std::vector<HepMC::GenParticle *> mcParticles;
281 for (HepMC::GenEvent::particle_const_iterator
p =
genEvent->particles_begin();
p !=
genEvent->particles_end(); ++
p) {
285 if ((*p)->pdg_id() != 22 &&
abs((*p)->pdg_id()) != 11)
289 bool satisfySelectionCriteria = (*p)->momentum().perp() > min_eT && fabs((*p)->momentum().eta()) <
max_eta;
291 if (!satisfySelectionCriteria)
295 mcParticles.push_back(*
p);
299 if (mcParticles.size() == 2) {
303 kinem::delta_R(mc1->momentum().eta(), mc1->momentum().phi(), mc2->momentum().eta(), mc2->momentum().phi());
309 for (std::vector<HepMC::GenParticle *>::const_iterator
p = mcParticles.begin();
p != mcParticles.end(); ++
p) {
352 reco::SuperClusterCollection::const_iterator em = scColl->end();
353 float energyMax = -100.0;
354 for (reco::SuperClusterCollection::const_iterator aClus = scColl->begin(); aClus != scColl->end(); ++aClus) {
357 kinem::delta_R(
mc->momentum().eta(),
mc->momentum().phi(), aClus->position().eta(), aClus->position().phi());
359 float energy = aClus->energy();
367 if (em == scColl->end()) {
378 double emAbsEta = fabs(em->position().eta());
381 if (emAbsEta < 0.018 || (emAbsEta > 0.423 && emAbsEta < 0.461) || (emAbsEta > 0.770 && emAbsEta < 0.806) ||
382 (emAbsEta > 1.127 && emAbsEta < 1.163) || (emAbsEta > 1.460 && emAbsEta < 1.558))
406 etaMax_ = em->position().eta();
407 phiMax_ = em->position().phi();
427 em = corrSCColl->end();
429 for (reco::SuperClusterCollection::const_iterator aClus = corrSCColl->begin(); aClus != corrSCColl->end(); ++aClus) {
432 kinem::delta_R(
mc->momentum().eta(),
mc->momentum().phi(), aClus->position().eta(), aClus->position().phi());
434 float energy = aClus->energy();
442 if (em == corrSCColl->end()) {
edm::EDGetTokenT< reco::SuperClusterCollection > dynamicHybridSuperClusters_token
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::SuperClusterCollection > fixedMatrixSuperClustersWithPreshower_token
~EnergyScaleAnalyzer() override
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
void analyze(const edm::Event &, const edm::EventSetup &) override
Sin< T >::type sin(const T &t)
T const * product() const
edm::EDGetTokenT< edm::HepMCProduct > hepMCLabel_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< reco::SuperClusterCollection > correctedFixedMatrixSuperClustersWithPreshower_token
Log< level::Error, false > LogError
edm::EDGetTokenT< reco::SuperClusterCollection > hybridSuperClusters_token
T getUntrackedParameter(std::string const &, T const &) const
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)
#define DEFINE_FWK_MODULE(type)
double delta_R(double eta1, double phi1, double eta2, double phi2)
edm::EDGetTokenT< reco::SuperClusterCollection > correctedDynamicHybridSuperClusters_token
dynamicHybridSuperClusters
edm::EDGetTokenT< reco::SuperClusterCollection > correctedHybridSuperClusters_token
Log< level::Info, false > LogInfo
EnergyScaleAnalyzer(const edm::ParameterSet &)
void labelsForToken(EDGetToken iToken, Labels &oLabels) const