31 #include "CLHEP/Units/GlobalPhysicalConstants.h"
183 "recEoverTrueEBarrel",
" Reco photon Energy over Generated photon Energy: Barrel ", 100, loRes, hiRes);
185 "recEoverTrueEEndcap",
" Reco photon Energy over Generated photon Energy: Endcap ", 100, loRes, hiRes);
208 edm::LogInfo(
"PhotonAnalyzer") <<
"Analyzing event number: " << evt.
id() <<
"\n";
227 if (!pfCandidateHandle.isValid()) {
234 if (!pfCandToPhotonMapHandle.isValid()) {
235 edm::LogInfo(
"SimplePhotonAnalyzer") <<
"Error! Can't get the product: valueMapPhotons " << std::endl;
237 pfCandToPhotonMap = *(pfCandToPhotonMapHandle.product());
239 std::cout <<
" SimplePhotonAnalyzer valueMap size" << pfCandToPhotonMap.size() << std::endl;
240 unsigned nObj = pfCandidateHandle->size();
241 for (
unsigned int lCand = 0; lCand < nObj; lCand++) {
247 std::cout <<
" PF SC " << pfCandRef->superClusterRef()->energy() <<
" Photon SC "
248 << myPho->superCluster()->energy() << std::endl;
251 for (HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end();
253 if (!((*p)->pdg_id() == 22 && (*p)->status() == 1))
258 if ((*p)->production_vertex()) {
261 mother = *((*p)->production_vertex()->particles_begin(
HepMC::parents));
263 if (((mother ==
nullptr) || ((mother !=
nullptr) && (mother->pdg_id() == 25)) ||
264 ((mother !=
nullptr) && (mother->pdg_id() == 22)))) {
265 float minDelta = 10000.;
266 std::vector<reco::Photon> localPhotons;
270 float phiPho = (*p)->momentum().phi();
271 float etaPho = (*p)->momentum().eta();
272 etaPho =
etaTransformation(etaPho, (*p)->production_vertex()->position().z() / 10.);
274 bool matched =
false;
276 for (reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end();
279 localPhotons.push_back(localPho);
282 float phiClu = localPho.
phi();
283 float etaClu = localPho.
eta();
294 if (delta < 0.1 && delta < minDelta) {
308 bool phoIsInBarrel =
false;
309 if (fabs(matchingPho.
superCluster()->position().eta()) < 1.479) {
310 phoIsInBarrel =
true;
315 float trueEta = (*p)->momentum().eta();
316 trueEta =
etaTransformation(trueEta, (*p)->production_vertex()->position().z() / 10.);
319 float photonE = matchingPho.
energy();
320 float photonEt = matchingPho.
et();
321 float photonEta = matchingPho.
eta();
322 float photonPhi = matchingPho.
phi();
324 float r9 = matchingPho.
r9();
366 const float PI = 3.1415927;
370 const float R_ECAL = 136.5;
377 float ZEcal = R_ECAL * sinh(EtaParticle) + Zvertex;
380 Theta = atan(R_ECAL / ZEcal);
385 if (fabs(ETA) > etaBarrelEndcap) {
387 if (EtaParticle < 0.0)
389 float Zlen = Zend - Zvertex;
390 float RR = Zlen / sinh(EtaParticle);
391 Theta = atan(RR / Zend);
394 ETA = -
log(
tan(0.5 * Theta));
edm::InputTag barrelEcalHits_
static std::vector< std::string > checklist log
bool isNonnull() const
Checks for non-null.
float etaTransformation(float a, float b)
MonitorElement * h1_scEta_
MonitorElement * h1_deltaPhi_
#define DEFINE_FWK_MODULE(type)
float hcalTowerSumEtConeDR04(int depth=0) const
float trkSumPtSolidConeDR04() const
std::string vertexProducer_
edm::InputTag pfEgammaCandidates_
float ecalRecHitSumEtConeDR04() const
MonitorElement * h1_pho_R9Barrel_
std::string photonCollection_
MonitorElement * h1_pho_Eta_
MonitorElement * h1_pho_hcalIsoEndcap_
Log< level::Error, false > LogError
static constexpr float R_ECAL
edm::InputTag endcapEcalHits_
std::string mcCollection_
MonitorElement * h1_recEoverTrueEEndcap_
static const double deltaEta
MonitorElement * h1_recEoverTrueEBarrel_
edm::ESHandle< CaloTopology > theCaloTopo_
void analyze(const edm::Event &, const edm::EventSetup &) override
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
MonitorElement * h1_pho_trkIsoBarrel_
float sigmaIetaIeta() const
Tan< T >::type tan(const T &t)
MonitorElement * h1_pho_E_
static constexpr float etaBarrelEndcap
MonitorElement * h1_deltaEta_
MonitorElement * h1_pho_trkIsoEndcap_
float hadronicOverEm(int depth=0) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
SimplePhotonAnalyzer(const edm::ParameterSet &)
MonitorElement * h1_pho_hcalIsoBarrel_
Log< level::Info, false > LogInfo
MonitorElement * h1_pho_Phi_
MonitorElement * h1_pho_sigmaIetaIetaBarrel_
dqm::legacy::MonitorElement MonitorElement
std::vector< Photon > PhotonCollection
collectin of Photon objects
T getParameter(std::string const &) const
MonitorElement * h1_pho_hOverEEndcap_
dqm::legacy::DQMStore DQMStore
MonitorElement * h1_pho_R9Endcap_
double et() const final
transverse energy
static constexpr float ZEcal
MonitorElement * h1_pho_ecalIsoBarrel_
MonitorElement * h1_pho_ecalIsoEndcap_
~SimplePhotonAnalyzer() override
MonitorElement * h1_pho_sigmaIetaIetaEndcap_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * h1_deltaEtaSC_
MonitorElement * h1_pho_Et_
double phi() const final
momentum azimuthal angle
Power< A, B >::type pow(const A &a, const B &b)
std::string photonCollectionProducer_
std::string valueMapPFCandPhoton_
static constexpr float Z_Endcap
MonitorElement * h1_pho_hOverEBarrel_
double energy() const final
energy
double eta() const final
momentum pseudorapidity