28 throw(std::runtime_error(
29 "\n\nEgammaObjects: Only 11 = Photon and 22 = Electron are acceptable parictleIDs! Exiting...\n\n"));
145 TH1::SetDefaultSumw2(
true);
167 "hist_EtNumRecoOverNumTrue_",
188 "hist_ENumRecoOverNumTrue_",
209 "hist_EtaNumRecoOverNumTrue_",
230 "hist_PhiNumRecoOverNumTrue_",
239 recoParticleName =
"Higgs";
241 recoParticleName =
"Z";
244 (recoParticleName +
" Mass from " +
particleString +
" in All Regions").c_str(),
249 (recoParticleName +
" Mass from " +
particleString +
" in Barrel").c_str(),
254 (recoParticleName +
" Mass from " +
particleString +
" in EndCap").c_str(),
259 (recoParticleName +
" Mass from " +
particleString +
" in Split Detectors").c_str(),
265 new TH1D(
"hist_recoMass_withBackgroud_NoEtCut_",
266 (recoParticleName +
" Mass from " +
particleString +
" with Background, No Et Cut").c_str(),
271 new TH1D(
"hist_recoMass_withBackgroud_5EtCut_",
272 (recoParticleName +
" Mass from " +
particleString +
" with Background, 5 Et Cut").c_str(),
277 new TH1D(
"hist_recoMass_withBackgroud_10EtCut_",
278 (recoParticleName +
" Mass from " +
particleString +
" with Background, 10 Et Cut").c_str(),
283 new TH1D(
"hist_recoMass_withBackgroud_20EtCut_",
284 (recoParticleName +
" Mass from " +
particleString +
" with Background, 20 Et Cut").c_str(),
292 "_TEMP_scatterPlot_EtOverTruthVsEt_",
300 "_TEMP_scatterPlot_EtOverTruthVsE_",
308 "_TEMP_scatterPlot_EtOverTruthVsEta_",
316 "_TEMP_scatterPlot_EtOverTruthVsPhi_",
325 "_TEMP_scatterPlot_EOverTruthVsEt_",
333 "_TEMP_scatterPlot_EOverTruthVsE_",
341 "_TEMP_scatterPlot_EOverTruthVsEta_",
349 "_TEMP_scatterPlot_EOverTruthVsPhi_",
358 "_TEMP_scatterPlot_deltaEtaVsEt_",
366 "_TEMP_scatterPlot_deltaEtaVsE_",
374 "_TEMP_scatterPlot_deltaEtaVsEta_",
382 "_TEMP_scatterPlot_deltaEtaVsPhi_",
391 "_TEMP_scatterPlot_deltaPhiVsEt_",
399 "_TEMP_scatterPlot_deltaPhiVsE_",
407 "_TEMP_scatterPlot_deltaPhiVsEta_",
415 "_TEMP_scatterPlot_deltaPhiVsPhi_",
437 edm::LogError(
"EgammaObjects") <<
"Error! can't get collection with label " <<
l.module;
441 std::vector<reco::Photon> photonsMCMatched;
443 for (reco::PhotonCollection::const_iterator aClus =
photons->begin(); aClus !=
photons->end(); aClus++) {
444 if (aClus->et() >=
EtCut) {
446 hist_E_->Fill(aClus->energy());
452 for (
int firstPhoton = 0, numPhotons =
photons->size(); firstPhoton < numPhotons - 1; firstPhoton++)
453 for (
int secondPhoton = firstPhoton + 1; secondPhoton < numPhotons; secondPhoton++) {
461 if (pOne.
et() >= 5 && pTwo.
et() >= 5)
464 if (pOne.
et() >= 10 && pTwo.
et() >= 10)
467 if (pOne.
et() >= 20 && pTwo.
et() >= 20)
476 edm::LogError(
"EgammaObjects") <<
"Error! can't get collection with label " <<
l.module;
481 for (HepMC::GenEvent::particle_const_iterator currentParticle =
genEvent->particles_begin();
482 currentParticle !=
genEvent->particles_end();
484 if (
abs((*currentParticle)->pdg_id()) == 22 && (*currentParticle)->status() == 1 &&
485 (*currentParticle)->momentum().e() /
486 cosh(
ecalEta((*currentParticle)->momentum().eta(),
487 (*currentParticle)->production_vertex()->position().z() / 10.,
488 (*currentParticle)->production_vertex()->position().perp() / 10.)) >=
490 HepMC::FourVector
vtx = (*currentParticle)->production_vertex()->position();
491 double phiTrue = (*currentParticle)->momentum().phi();
492 double etaTrue =
ecalEta((*currentParticle)->momentum().eta(),
vtx.z() / 10.,
vtx.perp() / 10.);
493 double eTrue = (*currentParticle)->momentum().e();
494 double etTrue = (*currentParticle)->momentum().e() / cosh(etaTrue);
496 double etaCurrent, etaFound = -999;
497 double phiCurrent, phiFound = -999;
498 double etCurrent, etFound = -999;
499 double eCurrent, eFound = -999;
503 double closestParticleDistance = 999;
505 for (reco::PhotonCollection::const_iterator aClus =
photons->begin(); aClus !=
photons->end(); aClus++) {
506 if (aClus->et() >
EtCut) {
507 etaCurrent = aClus->
eta();
508 phiCurrent = aClus->phi();
509 etCurrent = aClus->et();
510 eCurrent = aClus->energy();
512 double deltaPhi = phiCurrent - phiTrue;
519 if (
deltaR < closestParticleDistance) {
522 etaFound = etaCurrent;
523 phiFound = phiCurrent;
524 closestParticleDistance =
deltaR;
525 bestMatchPhoton = *aClus;
530 if (closestParticleDistance < 0.05 && etFound / etTrue > .5 && etFound / etTrue < 1.5) {
541 double deltaPhi = phiFound - phiTrue;
567 photonsMCMatched.push_back(bestMatchPhoton);
577 if (photonsMCMatched.size() == 2) {
600 edm::LogError(
"DOEPlotsProducerElectrons") <<
"Error! can't get collection with label " <<
l.module;
604 std::vector<reco::GsfElectron> electronsMCMatched;
606 for (reco::GsfElectronCollection::const_iterator aClus =
electrons->begin(); aClus !=
electrons->end(); aClus++) {
607 if (aClus->et() >=
EtCut) {
609 hist_E_->Fill(aClus->energy());
615 for (
int firstElectron = 0, numElectrons =
electrons->size(); firstElectron < numElectrons - 1; firstElectron++)
616 for (
int secondElectron = firstElectron + 1; secondElectron < numElectrons; secondElectron++) {
624 if (eOne.
et() >= 5 && eTwo.
et() >= 5)
627 if (eOne.
et() >= 10 && eTwo.
et() >= 10)
630 if (eOne.
et() >= 20 && eTwo.
et() >= 20)
639 edm::LogError(
"DOEPlotsProducerElectrons") <<
"Error! can't get collection with label " <<
l.module;
643 for (HepMC::GenEvent::particle_const_iterator currentParticle =
genEvent->particles_begin();
644 currentParticle !=
genEvent->particles_end();
646 if (
abs((*currentParticle)->pdg_id()) == 11 && (*currentParticle)->status() == 1 &&
647 (*currentParticle)->momentum().e() / cosh((*currentParticle)->momentum().eta()) >=
EtCut) {
648 double phiTrue = (*currentParticle)->momentum().phi();
649 double etaTrue = (*currentParticle)->momentum().eta();
650 double eTrue = (*currentParticle)->momentum().e();
651 double etTrue = (*currentParticle)->momentum().e() / cosh(etaTrue);
653 double etaCurrent, etaFound = -999;
654 double phiCurrent, phiFound = -999;
655 double etCurrent, etFound = -999;
656 double eCurrent, eFound = -999;
660 double closestParticleDistance = 999;
662 for (reco::GsfElectronCollection::const_iterator aClus =
electrons->begin(); aClus !=
electrons->end(); aClus++) {
663 if (aClus->et() >
EtCut) {
664 etaCurrent = aClus->
eta();
665 phiCurrent = aClus->phi();
666 etCurrent = aClus->et();
667 eCurrent = aClus->energy();
669 double deltaPhi = phiCurrent - phiTrue;
676 if (
deltaR < closestParticleDistance) {
679 etaFound = etaCurrent;
680 phiFound = phiCurrent;
681 closestParticleDistance =
deltaR;
682 bestMatchElectron = *aClus;
687 if (closestParticleDistance < 0.05 && etFound / etTrue > .5 && etFound / etTrue < 1.5) {
698 double deltaPhi = phiFound - phiTrue;
724 electronsMCMatched.push_back(bestMatchElectron);
734 if (electronsMCMatched.size() == 2) {
772 const float R_ECAL = 136.5;
776 if (EtaParticle != 0.) {
778 float ZEcal = (
R_ECAL - plane_Radius) * sinh(EtaParticle) + Zvertex;
789 if (EtaParticle < 0.0)
791 float Zlen = Zend - Zvertex;
792 float RR = Zlen / sinh(EtaParticle);
793 Theta = atan((RR + plane_Radius) / Zend);
801 edm::LogWarning(
"") <<
"[EgammaObjects::ecalEta] Warning: Eta equals to zero, not correcting";
908 (
"#sigma of Reco Et over True Et VS Et of " +
particleString).c_str());
910 (
"#sigma of Reco Et over True Et VS E of " +
particleString).c_str());
912 (
"#sigma of Reco Et over True Et VS Eta of " +
particleString).c_str());
914 (
"#sigma of Reco Et over True Et VS Phi of " +
particleString).c_str());
917 (
"#sigma of Reco E over True E VS Et of " +
particleString).c_str());
919 (
"#sigma of Reco E over True E VS E of " +
particleString).c_str());
921 (
"#sigma of Reco E over True E VS Eta of " +
particleString).c_str());
923 (
"#sigma of Reco E over True E VS Phi of " +
particleString).c_str());
958 TF1 gaus(
"mygaus",
"gaus");
1003 hist_Et_->GetXaxis()->SetTitle(
"Et (GeV)");
1004 hist_Et_->GetYaxis()->SetTitle(
"# per Et Bin");
1028 hist_E_->GetXaxis()->SetTitle(
"E (GeV)");
1029 hist_E_->GetYaxis()->SetTitle(
"# per E Bin");
1033 hist_EEfficiency_->GetYaxis()->SetTitle(
"# True Reconstructed/# True per E Bin");
1053 hist_Eta_->GetXaxis()->SetTitle(
"#eta (Radians)");
1054 hist_Eta_->GetYaxis()->SetTitle(
"# per Eta Bin");
1078 hist_Phi_->GetXaxis()->SetTitle(
"#phi (Radians)");
1079 hist_Phi_->GetYaxis()->SetTitle(
"# per Phi Bin");
1106 recoParticleName =
"Reco Higgs";
1108 recoParticleName =
"Reco Z";
1110 hist_All_recoMass_->GetXaxis()->SetTitle((recoParticleName +
" Mass (GeV)").c_str());
1263 recoParticleName =
"HiggsRecoMass";
1265 recoParticleName =
"ZRecoMass";