Skip to content

Commit

Permalink
Split the dR plot for neutral hadrons in two eta ranges in the EB (ma…
Browse files Browse the repository at this point in the history
…inly intended for Phase2)
  • Loading branch information
nancymarinelli committed Jun 15, 2023
1 parent 83835cb commit 2799bf4
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 35 deletions.
117 changes: 84 additions & 33 deletions Validation/RecoEgamma/plugins/PhotonValidator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ PhotonValidator::PhotonValidator(const edm::ParameterSet& pset)
nRecConvAss_ = 0;
nRecConvAssWithEcal_ = 0;
nInvalidPCA_ = 0;


}

PhotonValidator::~PhotonValidator() {}
Expand Down Expand Up @@ -1190,11 +1192,11 @@ void PhotonValidator::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&
//
histname = "ecalRecHitSumEtConeDR04";
h_ecalRecHitSumEtConeDR04_[0][0] =
iBooker.book1D(histname + "All", "ecalRecHitSumEtDR04: All Ecal", etBin, etMin, 20.);
iBooker.book1D(histname + "All", "ecalRecHitSumEtDR04: All Ecal", etBin, etMin, 50.);
h_ecalRecHitSumEtConeDR04_[0][1] =
iBooker.book1D(histname + "Barrel", "ecalRecHitSumEtDR04: Barrel ", etBin, etMin, 20.);
iBooker.book1D(histname + "Barrel", "ecalRecHitSumEtDR04: Barrel ", etBin, etMin, 50.);
h_ecalRecHitSumEtConeDR04_[0][2] =
iBooker.book1D(histname + "Endcap", "ecalRecHitSumEtDR04: Endcap ", etBin, etMin, 20.);
iBooker.book1D(histname + "Endcap", "ecalRecHitSumEtDR04: Endcap ", etBin, etMin, 50.);
//

if (!isRunCentrally_) {
Expand Down Expand Up @@ -1295,20 +1297,20 @@ void PhotonValidator::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&
//
histname = "hcalTowerSumEtConeDR04";
h_hcalTowerSumEtConeDR04_[0][0] =
iBooker.book1D(histname + "All", "hcalTowerSumEtConeDR04: All Ecal", etBin, etMin, 20.);
iBooker.book1D(histname + "All", "hcalTowerSumEtConeDR04: All Ecal", etBin, etMin, 50.);
h_hcalTowerSumEtConeDR04_[0][1] =
iBooker.book1D(histname + "Barrel", "hcalTowerSumEtConeDR04: Barrel ", etBin, etMin, 20.);
iBooker.book1D(histname + "Barrel", "hcalTowerSumEtConeDR04: Barrel ", etBin, etMin, 50.);
h_hcalTowerSumEtConeDR04_[0][2] =
iBooker.book1D(histname + "Endcap", "hcalTowerSumEtConeDR04: Endcap ", etBin, etMin, 20.);
iBooker.book1D(histname + "Endcap", "hcalTowerSumEtConeDR04: Endcap ", etBin, etMin, 50.);
//
histname = "hcalTowerBcSumEtConeDR04";
if (!isRunCentrally_)
h_hcalTowerBcSumEtConeDR04_[0][0] =
iBooker.book1D(histname + "All", "hcalTowerBcSumEtConeDR04: All Ecal", etBin, etMin, 20.);
iBooker.book1D(histname + "All", "hcalTowerBcSumEtConeDR04: All Ecal", etBin, etMin, 50.);
h_hcalTowerBcSumEtConeDR04_[0][1] =
iBooker.book1D(histname + "Barrel", "hcalTowerBcSumEtConeDR04: Barrel ", etBin, etMin, 20.);
iBooker.book1D(histname + "Barrel", "hcalTowerBcSumEtConeDR04: Barrel ", etBin, etMin, 50.);
h_hcalTowerBcSumEtConeDR04_[0][2] =
iBooker.book1D(histname + "Endcap", "hcalTowerBcSumEtConeDR04: Endcap ", etBin, etMin, 20.);
iBooker.book1D(histname + "Endcap", "hcalTowerBcSumEtConeDR04: Endcap ", etBin, etMin, 50.);

//
if (!isRunCentrally_) {
Expand Down Expand Up @@ -2032,11 +2034,15 @@ void PhotonValidator::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&
iBooker.book1D(histname + "Barrel", "dR(pho,cand) Neutral Hadrons : Barrel", etBin, etMin, 0.7);
h_dRPhoPFcand_NeuHad_Cleaned_[2] =
iBooker.book1D(histname + "Endcap", "dR(pho,cand) Neutral Hadrons : Endcap", etBin, etMin, 0.7);
h_dRPhoPFcand_NeuHad_Cleaned_[3] =
iBooker.book1D(histname + "Barrel_1", "dR(pho,cand) Neutral Hadrons : Barrel |eta| <=1", etBin, etMin, 0.7);
h_dRPhoPFcand_NeuHad_Cleaned_[4] =
iBooker.book1D(histname + "Barrel_2", "dR(pho,cand) Neutral Hadrons : Barrel |eta | > 1", etBin, etMin, 0.7);
histname = "dRPhoPFcand_Pho_Cleaned";
h_dRPhoPFcand_Pho_Cleaned_[0] =
iBooker.book1D(histname + "All", "dR(pho,cand) Photons : All Ecal", etBin, etMin, 0.7);
iBooker.book1D(histname + "All", "dR(pho,cand) Photons : All Ecal", etBin, etMin, 0.7);
h_dRPhoPFcand_Pho_Cleaned_[1] =
iBooker.book1D(histname + "Barrel", "dR(pho,cand) Photons : Barrel", etBin, etMin, 0.7);
iBooker.book1D(histname + "Barrel", "dR(pho,cand) Photons : Barrel", etBin, etMin, 0.7);
h_dRPhoPFcand_Pho_Cleaned_[2] =
iBooker.book1D(histname + "Endcap", "dR(pho,cand) Photons : Endcap", etBin, etMin, 0.7);

Expand Down Expand Up @@ -2069,13 +2075,20 @@ void PhotonValidator::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&
iBooker.book1D(histname + "Barrel", "dR(pho,cand) Charged Hadrons : Barrel", etBin, etMin, 0.7);
h_dRPhoPFcand_ChHad_unCleaned_[2] =
iBooker.book1D(histname + "Endcap", "dR(pho,cand) Charged Hadrons : Endcap", etBin, etMin, 0.7);

histname = "dRPhoPFcand_NeuHad_unCleaned";
h_dRPhoPFcand_NeuHad_unCleaned_[0] =
iBooker.book1D(histname + "All", "dR(pho,cand) Neutral Hadrons : All Ecal", etBin, etMin, 0.7);
h_dRPhoPFcand_NeuHad_unCleaned_[1] =
iBooker.book1D(histname + "Barrel", "dR(pho,cand) Neutral Hadrons : Barrel", etBin, etMin, 0.7);
h_dRPhoPFcand_NeuHad_unCleaned_[2] =
iBooker.book1D(histname + "Endcap", "dR(pho,cand) Neutral Hadrons : Endcap", etBin, etMin, 0.7);
h_dRPhoPFcand_NeuHad_unCleaned_[3] =
iBooker.book1D(histname + "Barrel_1", "dR(pho,cand) Neutral Hadrons : Barrel |eta| <=1 ", etBin, etMin, 0.7);
h_dRPhoPFcand_NeuHad_unCleaned_[4] =
iBooker.book1D(histname + "Barrel_2", "dR(pho,cand) Neutral Hadrons : Barrel |eta| > 1", etBin, etMin, 0.7);


histname = "dRPhoPFcand_Pho_unCleaned";
h_dRPhoPFcand_Pho_unCleaned_[0] =
iBooker.book1D(histname + "All", "dR(pho,cand) Photons: All Ecal", etBin, etMin, 0.7);
Expand Down Expand Up @@ -2257,26 +2270,26 @@ void PhotonValidator::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const&
//
histname = "ecalRecHitSumEtConeDR04";
h_ecalRecHitSumEtConeDR04_miniAOD_[0][0] =
iBooker.book1D(histname + "All_miniAOD", "ecalRecHitSumEtDR04: All Ecal", etBin, etMin, 20.);
iBooker.book1D(histname + "All_miniAOD", "ecalRecHitSumEtDR04: All Ecal", etBin, etMin, 50.);
h_ecalRecHitSumEtConeDR04_miniAOD_[0][1] =
iBooker.book1D(histname + "Barrel_miniAOD", "ecalRecHitSumEtDR04: Barrel ", etBin, etMin, 20.);
iBooker.book1D(histname + "Barrel_miniAOD", "ecalRecHitSumEtDR04: Barrel ", etBin, etMin, 50.);
h_ecalRecHitSumEtConeDR04_miniAOD_[0][2] =
iBooker.book1D(histname + "Endcap_miniAOD", "ecalRecHitSumEtDR04: Endcap ", etBin, etMin, 20.);
iBooker.book1D(histname + "Endcap_miniAOD", "ecalRecHitSumEtDR04: Endcap ", etBin, etMin, 50.);
histname = "hcalTowerSumEtConeDR04";
h_hcalTowerSumEtConeDR04_miniAOD_[0][0] =
iBooker.book1D(histname + "All_miniAOD", "hcalTowerSumEtConeDR04: All Ecal", etBin, etMin, 20.);
iBooker.book1D(histname + "All_miniAOD", "hcalTowerSumEtConeDR04: All Ecal", etBin, etMin, 50.);
h_hcalTowerSumEtConeDR04_miniAOD_[0][1] =
iBooker.book1D(histname + "Barrel_miniAOD", "hcalTowerSumEtConeDR04: Barrel ", etBin, etMin, 20.);
iBooker.book1D(histname + "Barrel_miniAOD", "hcalTowerSumEtConeDR04: Barrel ", etBin, etMin, 50.);
h_hcalTowerSumEtConeDR04_miniAOD_[0][2] =
iBooker.book1D(histname + "Endcap_miniAOD", "hcalTowerSumEtConeDR04: Endcap ", etBin, etMin, 20.);
iBooker.book1D(histname + "Endcap_miniAOD", "hcalTowerSumEtConeDR04: Endcap ", etBin, etMin, 50.);
//
histname = "hcalTowerBcSumEtConeDR04";
h_hcalTowerBcSumEtConeDR04_miniAOD_[0][0] =
iBooker.book1D(histname + "All_miniAOD", "hcalTowerBcSumEtConeDR04: All Ecal", etBin, etMin, 20.);
iBooker.book1D(histname + "All_miniAOD", "hcalTowerBcSumEtConeDR04: All Ecal", etBin, etMin, 50.);
h_hcalTowerBcSumEtConeDR04_miniAOD_[0][1] =
iBooker.book1D(histname + "Barrel_miniAOD", "hcalTowerBcSumEtConeDR04: Barrel ", etBin, etMin, 20.);
iBooker.book1D(histname + "Barrel_miniAOD", "hcalTowerBcSumEtConeDR04: Barrel ", etBin, etMin, 50.);
h_hcalTowerBcSumEtConeDR04_miniAOD_[0][2] =
iBooker.book1D(histname + "Endcap_miniAOD", "hcalTowerBcSumEtConeDR04: Endcap ", etBin, etMin, 20.);
iBooker.book1D(histname + "Endcap_miniAOD", "hcalTowerBcSumEtConeDR04: Endcap ", etBin, etMin, 50.);
histname = "isoTrkSolidConeDR04";
h_isoTrkSolidConeDR04_miniAOD_[0][0] =
iBooker.book1D(histname + "All_miniAOD", "isoTrkSolidConeDR04: All Ecal", etBin, etMin, etMax * 0.1);
Expand Down Expand Up @@ -3162,9 +3175,14 @@ void PhotonValidator::dqmBeginRun(edm::Run const& r, edm::EventSetup const& theE
theMF_ = theEventSetup.getHandle(magneticFieldToken_);

thePhotonMCTruthFinder_ = std::make_unique<PhotonMCTruthFinder>();



}

void PhotonValidator::dqmEndRun(edm::Run const& r, edm::EventSetup const&) { thePhotonMCTruthFinder_.reset(); }
void PhotonValidator::dqmEndRun(edm::Run const& r, edm::EventSetup const&) {

thePhotonMCTruthFinder_.reset(); }

void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup) {
thePhotonMCTruthFinder_->clear();
Expand Down Expand Up @@ -3570,6 +3588,8 @@ void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup)
}
// }



for (std::vector<PhotonMCTruth>::const_iterator mcPho = mcPhotons.begin(); mcPho != mcPhotons.end(); mcPho++) {
if ((*mcPho).fourMomentum().et() < minPhoEtCut_)
continue;
Expand All @@ -3591,6 +3611,8 @@ void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup)
mcPhi_ = phiNormalization(mcPhi);
mcEta_ = (*mcPho).fourMomentum().pseudoRapidity();
mcEta_ = etaTransformation(mcEta_, (*mcPho).primaryVertex().z());


mcConvR_ = (*mcPho).vertex().perp();
mcConvX_ = (*mcPho).vertex().x();
mcConvY_ = (*mcPho).vertex().y();
Expand Down Expand Up @@ -3724,7 +3746,9 @@ void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup)
if (!matched)
continue;

bool phoIsInBarrel = false;
bool phoIsInBarrel = false; // full barrel
bool phoIsInBarrel1 = false; // |eta| <=1
bool phoIsInBarrel2 = false; // |eta| >1
bool phoIsInEndcap = false;
bool phoIsInEndcapP = false;
bool phoIsInEndcapM = false;
Expand All @@ -3740,6 +3764,14 @@ void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup)
if (matchingPho->superCluster()->position().eta() < 0)
phoIsInEndcapM = true;
}
if ( fabs(matchingPho->superCluster()->position().eta()) <= 1) {
phoIsInBarrel1 = true;
} else if ( fabs(matchingPho->superCluster()->position().eta()) > 1 ) {
phoIsInBarrel2 = true;
}




edm::Handle<EcalRecHitCollection> ecalRecHitHandle;
if (phoIsInBarrel) {
Expand Down Expand Up @@ -4174,20 +4206,29 @@ void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup)
if (type == reco::PFCandidate::h0) {
SumPtIsoValNh += pfCandRef->pt();
h_dRPhoPFcand_NeuHad_unCleaned_[0]->Fill(dR);
if (phoIsInBarrel)
if (phoIsInBarrel) {
h_dRPhoPFcand_NeuHad_unCleaned_[1]->Fill(dR);
else
h_dRPhoPFcand_NeuHad_unCleaned_[2]->Fill(dR);
}
if (type == reco::PFCandidate::gamma) {
if (phoIsInBarrel1) {
h_dRPhoPFcand_NeuHad_unCleaned_[3]->Fill(dR);
}
if (phoIsInBarrel2) {
h_dRPhoPFcand_NeuHad_unCleaned_[4]->Fill(dR);
}
} else {
h_dRPhoPFcand_NeuHad_Cleaned_[2]->Fill(dR);
}
}

if (type == reco::PFCandidate::gamma) {
SumPtIsoValPh += pfCandRef->pt();
h_dRPhoPFcand_Pho_unCleaned_[0]->Fill(dR);
if (phoIsInBarrel)
h_dRPhoPFcand_Pho_unCleaned_[1]->Fill(dR);
else
h_dRPhoPFcand_Pho_unCleaned_[2]->Fill(dR);
}
////////// acces the value map to access the PFCandidates in overlap with the photon which need to be excluded from the isolation

////////// acces the value map to access the PFCandidates in overlap with the photon which need to be excluded from the isolation
bool skip = false;
for (std::vector<reco::PFCandidateRef>::const_iterator i = phoToParticleBasedIsoMap[matchingPho].begin();
i != phoToParticleBasedIsoMap[matchingPho].end();
Expand All @@ -4197,6 +4238,7 @@ void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup)
}
} // loop over the PFCandidates flagged as overlapping with the photon


if (skip)
continue;
if (type == reco::PFCandidate::h) {
Expand All @@ -4210,11 +4252,18 @@ void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup)
if (type == reco::PFCandidate::h0) {
SumPtIsoValCleanNh += pfCandRef->pt();
h_dRPhoPFcand_NeuHad_Cleaned_[0]->Fill(dR);
if (phoIsInBarrel)
if (phoIsInBarrel) {
h_dRPhoPFcand_NeuHad_Cleaned_[1]->Fill(dR);
else
h_dRPhoPFcand_NeuHad_Cleaned_[2]->Fill(dR);
}
if (phoIsInBarrel1) {
h_dRPhoPFcand_NeuHad_Cleaned_[3]->Fill(dR);
}
if (phoIsInBarrel2) {
h_dRPhoPFcand_NeuHad_Cleaned_[4]->Fill(dR);
}
} else {
h_dRPhoPFcand_NeuHad_Cleaned_[2]->Fill(dR);
}
}
if (type == reco::PFCandidate::gamma) {
SumPtIsoValCleanPh += pfCandRef->pt();
h_dRPhoPFcand_Pho_Cleaned_[0]->Fill(dR);
Expand Down Expand Up @@ -4822,6 +4871,8 @@ void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup)
} // End loop over generated particles
} // End loop over simulated Photons



if (!isRunCentrally_) {
h_nSimPho_[0]->Fill(float(nSimPho_[0]));
h_nSimPho_[1]->Fill(float(nSimPho_[1]));
Expand Down Expand Up @@ -5509,4 +5560,4 @@ float PhotonValidator::etaTransformation(float EtaParticle, float Zvertex) {
//---Return the result
return ETA;
//---end
}
}
5 changes: 3 additions & 2 deletions Validation/RecoEgamma/plugins/PhotonValidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class PhotonValidator : public DQMOneEDAnalyzer<> {
std::string fName_;
edm::ESHandle<MagneticField> theMF_;


int verbosity_;
int nEvt_;
int nEntry_;
Expand Down Expand Up @@ -343,10 +344,10 @@ class PhotonValidator : public DQMOneEDAnalyzer<> {
MonitorElement* h_pfMva_[3];
//// particle based isolation from ValueMap
MonitorElement* h_dRPhoPFcand_ChHad_Cleaned_[3];
MonitorElement* h_dRPhoPFcand_NeuHad_Cleaned_[3];
MonitorElement* h_dRPhoPFcand_NeuHad_Cleaned_[5];
MonitorElement* h_dRPhoPFcand_Pho_Cleaned_[3];
MonitorElement* h_dRPhoPFcand_ChHad_unCleaned_[3];
MonitorElement* h_dRPhoPFcand_NeuHad_unCleaned_[3];
MonitorElement* h_dRPhoPFcand_NeuHad_unCleaned_[5];
MonitorElement* h_dRPhoPFcand_Pho_unCleaned_[3];
MonitorElement* h_SumPtOverPhoPt_ChHad_Cleaned_[3];
MonitorElement* h_SumPtOverPhoPt_NeuHad_Cleaned_[3];
Expand Down

0 comments on commit 2799bf4

Please sign in to comment.