29 #include "CLHEP/Units/GlobalPhysicalConstants.h" 158 edm::LogInfo(
"PhotonAnalyzer") <<
"Analyzing event number: " << evt.
id() <<
"\n";
181 if (!pfCandidateHandle.
isValid()) {
188 if ( ! pfCandToPhotonMapHandle.
isValid()) {
189 edm::LogInfo(
"SimplePhotonAnalyzer") <<
"Error! Can't get the product: valueMapPhotons " << std::endl;
191 pfCandToPhotonMap = *(pfCandToPhotonMapHandle.
product());
193 std::cout <<
" SimplePhotonAnalyzer valueMap size" << pfCandToPhotonMap.
size() << std::endl;
194 unsigned nObj = pfCandidateHandle->size();
195 for(
unsigned int lCand=0; lCand < nObj; lCand++) {
199 if ( myPho.
isNonnull() )
std::cout <<
" PF SC " << pfCandRef->superClusterRef()->energy() <<
" Photon SC " << myPho->superCluster()->energy() << std::endl;
204 for ( HepMC::GenEvent::particle_const_iterator
p = myGenEvent->particles_begin();
p != myGenEvent->particles_end(); ++
p ) {
205 if ( !( (*p)->pdg_id() == 22 && (*p)->status()==1 ) )
continue;
209 if ( (*p)->production_vertex() ) {
210 if ( (*p)->production_vertex()->particles_begin(
HepMC::parents) !=
212 mother = *((*p)->production_vertex()->particles_begin(
HepMC::parents));
214 if ( ((mother ==
nullptr) || ((mother !=
nullptr) && (mother->pdg_id() == 25))
215 || ((mother !=
nullptr) && (mother->pdg_id() == 22)))) {
217 float minDelta=10000.;
218 std::vector<reco::Photon> localPhotons;
222 float phiPho=(*p)->momentum().phi();
223 float etaPho=(*p)->momentum().eta();
224 etaPho =
etaTransformation(etaPho, (*p)->production_vertex()->position().z()/10. );
228 for( reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end(); iPho++) {
230 localPhotons.push_back(localPho);
233 float phiClu=localPho.
phi();
234 float etaClu=localPho.
eta();
238 if ( deltaPhi >
pi ) deltaPhi -= twopi;
239 if ( deltaPhi < -
pi) deltaPhi += twopi;
243 if ( delta<0.1 && delta < minDelta ) {
252 if ( iMatch>-1 ) matched =
true;
259 bool phoIsInBarrel=
false;
260 if ( fabs(matchingPho.
superCluster()->position().eta() ) < 1.479 ) {
267 float trueEta= (*p)->momentum().eta() ;
268 trueEta =
etaTransformation(trueEta, (*p)->production_vertex()->position().z()/10. );
271 float photonE = matchingPho.
energy();
272 float photonEt= matchingPho.
et() ;
273 float photonEta= matchingPho.
eta() ;
274 float photonPhi= matchingPho.
phi() ;
276 float r9 = matchingPho.
r9();
292 if ( phoIsInBarrel ) {
330 const float PI = 3.1415927;
334 const float R_ECAL = 136.5;
341 float ZEcal = R_ECAL*sinh(EtaParticle)+Zvertex;
343 if(ZEcal != 0.0) Theta = atan(R_ECAL/ZEcal);
344 if(Theta<0.0) Theta = Theta+
PI ;
347 if( fabs(ETA) > etaBarrelEndcap )
350 if(EtaParticle<0.0 ) Zend = -Zend ;
351 float Zlen = Zend - Zvertex ;
352 float RR = Zlen/sinh(EtaParticle);
353 Theta = atan(RR/Zend);
354 if(Theta<0.0) Theta = Theta+
PI ;
355 ETA = -
log(
tan(0.5*Theta));
T getParameter(std::string const &) const
float hcalTowerSumEtConeDR04() const
Hcal isolation sum.
edm::InputTag barrelEcalHits_
bool isNonnull() const
Checks for non-null.
float etaTransformation(float a, float b)
double eta() const final
momentum pseudorapidity
MonitorElement * h1_scEta_
MonitorElement * h1_deltaPhi_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
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_
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
edm::InputTag endcapEcalHits_
MonitorElement * h1_recEoverTrueEEndcap_
static const double deltaEta
MonitorElement * h1_recEoverTrueEBarrel_
edm::ESHandle< CaloTopology > theCaloTopo_
void analyze(const edm::Event &, const edm::EventSetup &) override
double et() const final
transverse energy
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * h1_pho_trkIsoBarrel_
float sigmaIetaIeta() const
double energy() const final
energy
Tan< T >::type tan(const T &t)
MonitorElement * h1_pho_E_
MonitorElement * h1_deltaEta_
MonitorElement * h1_pho_trkIsoEndcap_
float hadronicOverEm() const
the total hadronic over electromagnetic fraction
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
SimplePhotonAnalyzer(const edm::ParameterSet &)
MonitorElement * h1_pho_hcalIsoBarrel_
MonitorElement * h1_pho_Phi_
const HepMC::GenEvent * GetEvent() const
MonitorElement * h1_pho_sigmaIetaIetaBarrel_
T const * product() const
std::vector< Photon > PhotonCollection
collectin of Photon objects
MonitorElement * h1_pho_hOverEEndcap_
static const float etaBarrelEndcap
static const float Z_Endcap
MonitorElement * h1_pho_R9Endcap_
static const float R_ECAL
MonitorElement * h1_pho_ecalIsoBarrel_
MonitorElement * h1_pho_ecalIsoEndcap_
~SimplePhotonAnalyzer() override
MonitorElement * h1_pho_sigmaIetaIetaEndcap_
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_
MonitorElement * h1_pho_hOverEBarrel_