25 throw(std::runtime_error(
"\n\nEgammaObjects: Only 11 = Photon and 22 = Electron are acceptable parictleIDs! Exiting...\n\n"));
148 TH1::SetDefaultSumw2(
true);
157 =
new TH1D(
"hist_Et_",(
"Et Distribution of "+
particleString).c_str(),
160 =
new TH1D(
"hist_EtOverTruth_",(
"Reco Et over True Et of "+
particleString).c_str(),
170 =
new TH1D(
"hist_E_",(
"E Distribution of "+
particleString).c_str(),
173 =
new TH1D(
"hist_EOverTruth_",(
"Reco E over True E of "+
particleString).c_str(),
183 =
new TH1D(
"hist_Eta_",(
"Eta Distribution of "+
particleString).c_str(),
186 =
new TH1D(
"hist_EtaOverTruth_",(
"Reco Eta over True Eta of "+
particleString).c_str(),
196 =
new TH1D(
"hist_Phi_",(
"Phi Distribution of "+
particleString).c_str(),
199 =
new TH1D(
"hist_PhiOverTruth_",(
"Reco Phi over True Phi of "+
particleString).c_str(),
208 std::string recoParticleName;
210 if(
particleID == 22 ) recoParticleName =
"Higgs";
211 else if(
particleID == 11 ) recoParticleName =
"Z";
214 =
new TH1D(
"hist_All_recoMass_",(recoParticleName+
" Mass from "+
particleString+
" in All Regions").c_str(),
217 =
new TH1D(
"hist_BarrelOnly_recoMass_",(recoParticleName+
" Mass from "+
particleString+
" in Barrel").c_str(),
220 =
new TH1D(
"hist_EndcapOnly_recoMass_",(recoParticleName+
" Mass from "+
particleString+
" in EndCap").c_str(),
223 =
new TH1D(
"hist_Mixed_recoMass_",(recoParticleName+
" Mass from "+
particleString+
" in Split Detectors").c_str(),
227 =
new TH1D(
"hist_recoMass_withBackgroud_NoEtCut_",(recoParticleName+
" Mass from "+
particleString+
" with Background, No Et Cut").c_str(),
230 =
new TH1D(
"hist_recoMass_withBackgroud_5EtCut_",(recoParticleName+
" Mass from "+
particleString+
" with Background, 5 Et Cut").c_str(),
233 =
new TH1D(
"hist_recoMass_withBackgroud_10EtCut_",(recoParticleName+
" Mass from "+
particleString+
" with Background, 10 Et Cut").c_str(),
236 =
new TH1D(
"hist_recoMass_withBackgroud_20EtCut_",(recoParticleName+
" Mass from "+
particleString+
" with Background, 20 Et Cut").c_str(),
243 =
new TH2D(
"_TEMP_scatterPlot_EtOverTruthVsEt_",
"_TEMP_scatterPlot_EtOverTruthVsEt_",
246 =
new TH2D(
"_TEMP_scatterPlot_EtOverTruthVsE_",
"_TEMP_scatterPlot_EtOverTruthVsE_",
249 =
new TH2D(
"_TEMP_scatterPlot_EtOverTruthVsEta_",
"_TEMP_scatterPlot_EtOverTruthVsEta_",
252 =
new TH2D(
"_TEMP_scatterPlot_EtOverTruthVsPhi_",
"_TEMP_scatterPlot_EtOverTruthVsPhi_",
256 =
new TH2D(
"_TEMP_scatterPlot_EOverTruthVsEt_",
"_TEMP_scatterPlot_EOverTruthVsEt_",
259 =
new TH2D(
"_TEMP_scatterPlot_EOverTruthVsE_",
"_TEMP_scatterPlot_EOverTruthVsE_",
262 =
new TH2D(
"_TEMP_scatterPlot_EOverTruthVsEta_",
"_TEMP_scatterPlot_EOverTruthVsEta_",
265 =
new TH2D(
"_TEMP_scatterPlot_EOverTruthVsPhi_",
"_TEMP_scatterPlot_EOverTruthVsPhi_",
269 =
new TH2D(
"_TEMP_scatterPlot_deltaEtaVsEt_",
"_TEMP_scatterPlot_deltaEtaVsEt_",
272 =
new TH2D(
"_TEMP_scatterPlot_deltaEtaVsE_",
"_TEMP_scatterPlot_deltaEtaVsE_",
275 =
new TH2D(
"_TEMP_scatterPlot_deltaEtaVsEta_",
"_TEMP_scatterPlot_deltaEtaVsEta_",
278 =
new TH2D(
"_TEMP_scatterPlot_deltaEtaVsPhi_",
"_TEMP_scatterPlot_deltaEtaVsPhi_",
282 =
new TH2D(
"_TEMP_scatterPlot_deltaPhiVsEt_",
"_TEMP_scatterPlot_deltaPhiVsEt_",
285 =
new TH2D(
"_TEMP_scatterPlot_deltaPhiVsE_",
"_TEMP_scatterPlot_deltaPhiVsE_",
288 =
new TH2D(
"_TEMP_scatterPlot_deltaPhiVsEta_",
"_TEMP_scatterPlot_deltaPhiVsEta_",
291 =
new TH2D(
"_TEMP_scatterPlot_deltaPhiVsPhi_",
"_TEMP_scatterPlot_deltaPhiVsPhi_",
310 std::vector<reco::Photon> photonsMCMatched;
312 for(reco::PhotonCollection::const_iterator aClus = photons->begin(); aClus != photons->end(); aClus++)
314 if(aClus->et() >=
EtCut)
317 hist_E_->Fill(aClus->energy());
323 for(
int firstPhoton = 0, numPhotons = photons->size(); firstPhoton < numPhotons - 1; firstPhoton++)
324 for(
int secondPhoton = firstPhoton + 1; secondPhoton < numPhotons; secondPhoton++)
333 if(pOne.
et() >= 5 && pTwo.
et() >= 5)
336 if(pOne.
et() >= 10 && pTwo.
et() >= 10)
339 if(pOne.
et() >= 20 && pTwo.
et() >= 20)
349 const HepMC::GenEvent*
genEvent = pMCTruth->GetEvent();
351 for(HepMC::GenEvent::particle_const_iterator currentParticle = genEvent->particles_begin();
352 currentParticle != genEvent->particles_end(); currentParticle++ )
354 if(
abs((*currentParticle)->pdg_id())==22 && (*currentParticle)->status()==1
355 && (*currentParticle)->momentum().e()/cosh(
ecalEta((*currentParticle)->momentum().eta(), (*currentParticle)->production_vertex()->position().z()/10.,
356 (*currentParticle)->production_vertex()->position().perp()/10.)) >=
EtCut)
358 HepMC::FourVector vtx = (*currentParticle)->production_vertex()->position();
359 double phiTrue = (*currentParticle)->momentum().phi();
360 double etaTrue =
ecalEta((*currentParticle)->momentum().eta(), vtx.z()/10., vtx.perp()/10.);
361 double eTrue = (*currentParticle)->momentum().e();
362 double etTrue = (*currentParticle)->momentum().e()/cosh(etaTrue);
364 double etaCurrent, etaFound = -999;
365 double phiCurrent, phiFound = -999;
366 double etCurrent, etFound = -999;
367 double eCurrent, eFound = -999;
371 double closestParticleDistance = 999;
373 for(reco::PhotonCollection::const_iterator aClus = photons->begin(); aClus != photons->end(); aClus++)
375 if(aClus->et() >
EtCut)
377 etaCurrent = aClus->
eta();
378 phiCurrent = aClus->phi();
379 etCurrent = aClus->et();
380 eCurrent = aClus->energy();
382 double deltaPhi = phiCurrent-phiTrue;
387 if(deltaR < closestParticleDistance)
391 etaFound = etaCurrent;
392 phiFound = phiCurrent;
393 closestParticleDistance =
deltaR;
394 bestMatchPhoton = *aClus;
399 if(closestParticleDistance < 0.05 && etFound/etTrue > .5 && etFound/etTrue < 1.5)
435 photonsMCMatched.push_back(bestMatchPhoton);
445 if(photonsMCMatched.size() == 2)
472 std::vector<reco::GsfElectron> electronsMCMatched;
474 for(reco::GsfElectronCollection::const_iterator aClus = electrons->begin(); aClus != electrons->end(); aClus++)
476 if(aClus->et() >=
EtCut)
479 hist_E_->Fill(aClus->energy());
485 for(
int firstElectron = 0, numElectrons = electrons->size(); firstElectron < numElectrons - 1; firstElectron++)
486 for(
int secondElectron = firstElectron + 1; secondElectron < numElectrons; secondElectron++)
495 if(eOne.
et() >= 5 && eTwo.
et() >= 5)
498 if(eOne.
et() >= 10 && eTwo.
et() >= 10)
501 if(eOne.
et() >= 20 && eTwo.
et() >= 20)
511 const HepMC::GenEvent*
genEvent = pMCTruth->GetEvent();
512 for(HepMC::GenEvent::particle_const_iterator currentParticle = genEvent->particles_begin();
513 currentParticle != genEvent->particles_end(); currentParticle++ )
515 if(
abs((*currentParticle)->pdg_id())==11 && (*currentParticle)->status()==1
516 && (*currentParticle)->momentum().e()/cosh((*currentParticle)->momentum().eta()) >=
EtCut)
518 double phiTrue = (*currentParticle)->momentum().phi();
519 double etaTrue = (*currentParticle)->momentum().eta();
520 double eTrue = (*currentParticle)->momentum().e();
521 double etTrue = (*currentParticle)->momentum().e()/cosh(etaTrue);
523 double etaCurrent, etaFound = -999;
524 double phiCurrent, phiFound = -999;
525 double etCurrent, etFound = -999;
526 double eCurrent, eFound = -999;
530 double closestParticleDistance = 999;
532 for(reco::GsfElectronCollection::const_iterator aClus = electrons->begin(); aClus != electrons->end(); aClus++)
534 if(aClus->et() >
EtCut)
536 etaCurrent = aClus->
eta();
537 phiCurrent = aClus->phi();
538 etCurrent = aClus->et();
539 eCurrent = aClus->energy();
541 double deltaPhi = phiCurrent-phiTrue;
546 if(deltaR < closestParticleDistance)
550 etaFound = etaCurrent;
551 phiFound = phiCurrent;
552 closestParticleDistance =
deltaR;
553 bestMatchElectron = *aClus;
558 if(closestParticleDistance < 0.05 && etFound/etTrue > .5 && etFound/etTrue < 1.5)
594 electronsMCMatched.push_back(bestMatchElectron);
604 if(electronsMCMatched.size() == 2)
646 const float R_ECAL = 136.5;
650 if(EtaParticle != 0.)
653 float ZEcal = (R_ECAL-plane_Radius)*sinh(EtaParticle)+Zvertex;
655 if(ZEcal != 0.0) Theta = atan(R_ECAL/ZEcal);
656 if(Theta<0.0) Theta = Theta+
Geom::pi() ;
660 if(
std::abs(ETA) > etaBarrelEndcap )
663 if(EtaParticle<0.0 ) Zend = -Zend ;
664 float Zlen = Zend - Zvertex ;
665 float RR = Zlen/sinh(EtaParticle);
666 Theta = atan((RR+plane_Radius)/Zend);
667 if(Theta<0.0) Theta = Theta+
Geom::pi() ;
668 ETA = -
log(
tan(0.5*Theta));
675 edm::LogWarning(
"") <<
"[EgammaObjects::ecalEta] Warning: Eta equals to zero, not correcting" ;
859 hist_Et_->GetXaxis()->SetTitle(
"Et (GeV)");
860 hist_Et_->GetYaxis()->SetTitle(
"# per Et Bin");
884 hist_E_->GetXaxis()->SetTitle(
"E (GeV)");
885 hist_E_->GetYaxis()->SetTitle(
"# per E Bin");
889 hist_EEfficiency_->GetYaxis()->SetTitle(
"# True Reconstructed/# True per E Bin");
909 hist_Eta_->GetXaxis()->SetTitle(
"#eta (Radians)");
910 hist_Eta_->GetYaxis()->SetTitle(
"# per Eta Bin");
934 hist_Phi_->GetXaxis()->SetTitle(
"#phi (Radians)");
935 hist_Phi_->GetYaxis()->SetTitle(
"# per Phi Bin");
959 std::string recoParticleName;
961 if(
particleID == 22 ) recoParticleName =
"Reco Higgs";
962 else if(
particleID == 11 ) recoParticleName =
"Reco Z";
1116 std::string recoParticleName;
1118 if(
particleID == 22 ) recoParticleName =
"HiggsRecoMass";
1119 else if(
particleID == 11 ) recoParticleName =
"ZRecoMass";
TH1D * hist_resolutionEVsPhi_
TH2D * _TEMP_scatterPlot_EtOverTruthVsPhi_
double hist_min_deltaEta_
T getParameter(std::string const &) const
double hist_min_EtaOverTruth_
TH2D * _TEMP_scatterPlot_deltaEtaVsEta_
TH1D * hist_resolutionEVsE_
TH2D * _TEMP_scatterPlot_deltaPhiVsPhi_
TH1D * hist_PhiEfficiency_
TH1D * hist_deltaEtaVsEta_
float ecalEta(float EtaParticle, float Zvertex, float plane_Radius)
void analyzePhotons(const edm::Event &, const edm::EventSetup &)
TH1D * hist_EtOverTruthVsEt_
TH1D * hist_resolutionEVsEta_
virtual double et() const
transverse energy
TH1D * hist_deltaEtaVsPhi_
TH1D * hist_EOverTruthVsEt_
TH1D * hist_recoMass_withBackgroud_20EtCut_
TH2D * _TEMP_scatterPlot_EtOverTruthVsE_
TH2D * _TEMP_scatterPlot_deltaPhiVsE_
void getEfficiencyHistosViaDividing()
TH1D * hist_Mixed_recoMass_
double hist_min_PhiOverTruth_
TH1D * hist_resolutionPhiVsPhi_
TH1D * hist_resolutionEtVsEta_
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
edm::InputTag MCTruthCollection_
TH2D * _TEMP_scatterPlot_EOverTruthVsEta_
TH2D * _TEMP_scatterPlot_deltaPhiVsEt_
TH1D * hist_ENumRecoOverNumTrue_
TH1D * hist_deltaPhiVsPhi_
double hist_max_EtaOverTruth_
void loadHistoParameters(const edm::ParameterSet &ps)
TH1D * hist_EOverTruthVsE_
TH1D * hist_EtNumRecoOverNumTrue_
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
TH1D * hist_resolutionEVsEt_
void createTempHistoObjects()
TH1D * hist_resolutionEtVsPhi_
std::string particleString
virtual double eta() const
momentum pseudorapidity
int hist_bins_EOverTruth_
TH1D * hist_EOverTruthVsPhi_
TH2D * _TEMP_scatterPlot_EtOverTruthVsEta_
TH1D * hist_EtOverTruthVsEta_
double hist_min_EtOverTruth_
double findRecoMass(reco::Photon pOne, reco::Photon pTwo)
TH1D * hist_EOverTruthVsEta_
void getDeltaResHistosViaSlicing()
TH1D * hist_resolutionEtVsE_
TH2D * _TEMP_scatterPlot_deltaEtaVsE_
double hist_max_recoMass_
TH1D * hist_PhiNumRecoOverNumTrue_
TH1D * hist_PhiOverTruth_
double hist_min_deltaPhi_
TH1D * hist_recoMass_withBackgroud_5EtCut_
TH2D * _TEMP_scatterPlot_deltaEtaVsPhi_
TH1D * hist_resolutionEtVsEt_
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
TH2D * _TEMP_scatterPlot_EOverTruthVsEt_
double hist_max_deltaEta_
Cos< T >::type cos(const T &t)
TH1D * hist_EtOverTruthVsE_
TH1D * hist_resolutionEtaVsE_
Tan< T >::type tan(const T &t)
TH1D * hist_BarrelOnly_recoMass_
TH1D * hist_EndcapOnly_recoMass_
TH1D * hist_deltaPhiVsEt_
TH1D * hist_EtaOverTruth_
TH1D * hist_deltaPhiVsEta_
TH1D * hist_deltaEtaVsEt_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double hist_max_deltaPhi_
int hist_bins_EtOverTruth_
TH1D * hist_recoMass_withBackgroud_10EtCut_
double deltaR(double eta1, double eta2, double phi1, double phi2)
edm::InputTag RecoCollection_
TH1D * hist_resolutionPhiVsEt_
double hist_max_PhiOverTruth_
void analyzeElectrons(const edm::Event &, const edm::EventSetup &)
TH2D * _TEMP_scatterPlot_deltaPhiVsEta_
TH2D * _TEMP_scatterPlot_EOverTruthVsE_
double hist_max_EtOverTruth_
EgammaObjects(const edm::ParameterSet &)
TH1D * hist_All_recoMass_
TH2D * _TEMP_scatterPlot_deltaEtaVsEt_
math::XYZPoint caloPosition() const
TH2D * _TEMP_scatterPlot_EOverTruthVsPhi_
std::vector< Photon > PhotonCollection
collectin of Photon objects
TH1D * hist_resolutionEtaVsPhi_
static const float etaBarrelEndcap
T const * product() const
TH1D * hist_EtOverTruthVsPhi_
static const float Z_Endcap
double hist_min_recoMass_
TH1D * hist_EtaEfficiency_
TH1D * hist_resolutionPhiVsE_
double hist_min_EOverTruth_
void loadCMSSWObjects(const edm::ParameterSet &ps)
TH1D * hist_recoMass_withBackgroud_NoEtCut_
TH2D * _TEMP_scatterPlot_EtOverTruthVsEt_
int hist_bins_PhiOverTruth_
static const float R_ECAL
double hist_max_EOverTruth_
int hist_bins_EtaOverTruth_
void createBookedHistoObjects()
TH1D * hist_resolutionEtaVsEta_
TH1D * hist_resolutionPhiVsEta_
TH1D * hist_EtEfficiency_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
TH1D * hist_EtaNumRecoOverNumTrue_
Power< A, B >::type pow(const A &a, const B &b)
TH1D * hist_resolutionEtaVsEt_