diff --git a/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.cxx b/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.cxx index e557a39c780f8308b2b938f6a9baf50f0811a616..96fe30f1fa47ff6ebbcca046937c5d76fad03242 100644 --- a/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.cxx +++ b/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.cxx @@ -16,6 +16,7 @@ #include "xAODEgamma/Electron.h" #include "xAODEgamma/Photon.h" #include "xAODTruth/TruthParticle.h" +#include "xAODTruth/TruthVertex.h" #include "xAODTruth/xAODTruthHelpers.h" #include "xAODEgamma/EgammaxAODHelpers.h" @@ -109,6 +110,20 @@ StatusCode EgammaMonitoring::initialize() { truthRecoElectronTightLH = std::make_unique<egammaMonitoring::TruthElectronHistograms>( "truthRecoElectronTightLH","TLH Electrons Reco Electron", "/MONITORING/truthRecoElectronTightLH/", rootHistSvc); + if (!m_FwdElectronsKey.empty()) { + recoElectronAll->hasFwd(); + truthElectronAll->hasFwd(); + truthPromptElectronAll->hasFwd(); + truthElectronRecoElectronAll->hasFwd(); + truthPromptElectronWithTrack->hasFwd(); + truthPromptElectronWithGSFTrack->hasFwd(); + truthPromptElectronWithReco->hasFwd(); + truthPromptElectronWithRecoTrack->hasFwd(); + truthRecoElectronLooseLH->hasFwd(); + truthRecoElectronMediumLH->hasFwd(); + truthRecoElectronTightLH->hasFwd(); + } + ATH_CHECK(recoElectronAll->initializePlots()); ATH_CHECK(truthRecoElectronLooseLH->initializePlots()); ATH_CHECK(truthRecoElectronMediumLH->initializePlots()); @@ -407,25 +422,41 @@ StatusCode EgammaMonitoring::execute() { MCTruthPartClassifier::ParticleOrigin TO = res.second; MCTruthPartClassifier::ParticleType TT = res.first; - ATH_MSG_DEBUG( " ******** Truth particle associated to Electron Found: " - << " STATUS " << truth->status() - << " type " << truth->type() - << " barcode " << truth->barcode() - << " PDG id " << truth->pdgId() - << " index " << truth->index() - << " TO " << TO - << " TT " << TT - << " eventNumber " << eventInfo->eventNumber() ); + if (msgLvl(MSG::DEBUG)) { + + bool haspVtx = truth->hasProdVtx(); + double rProd = -1; + if (haspVtx) { + const xAOD::TruthVertex* pvtx = truth->prodVtx(); + rProd = pvtx->perp(); + } + bool hasdVtx = truth->hasDecayVtx(); + double rDec = -1; + if (hasdVtx) { + const xAOD::TruthVertex* dvtx = truth->decayVtx(); + rDec = dvtx->perp(); + } + + ATH_MSG_DEBUG( " ******** Truth electron found: " + << " STATUS " << truth->status() + << " barcode " << truth->barcode() + << " charge " << truth->charge() + << " index " << truth->index() + << " TO " << TO + << " TT " << TT + << " Rprod = " << rProd + << " Rdec = " << rDec + << " eventNumber " << eventInfo->eventNumber() ); + } // Check if it is the prompt electron if (TO == MCTruthPartClassifier::SingleElec && TT == MCTruthPartClassifier::IsoElectron && truth->barcode() == 10001) { truthPromptElectronAll->fill(truth); promptElectronTruthIndex = truth->index(); - } - // Check that it is not from geant4 + // Check that it is not from geant4 (but electron from photon conversion are kept) if (TT != MCTruthPartClassifier::NonPrimary) truthElectronAll->fill(truth); } diff --git a/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.cxx index db11d9c179b988ae944fec20512840475fbd9892..530f06bdfd044441ec12997a4887117dcd0618ac 100644 --- a/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.cxx @@ -12,21 +12,28 @@ namespace egammaMonitoring { StatusCode ParticleHistograms::initializePlots() { - histoMap["pT"] = new TH1D(Form("%s_%s",m_name.c_str(),"pT") , ";p_{T} [GeV]; Track p_{T} Events", 40, 0, 200); - histoMap["eta"] = new TH1D(Form("%s_%s",m_name.c_str(),"eta") , ";#eta; Track #eta Events" , 60, -4.5, 4.5); - histoMap["phi"] = new TH1D(Form("%s_%s",m_name.c_str(),"phi") , ";#phi; Track #phi Events" , 20, -TMath::Pi(), TMath::Pi()); + histoMap["pT"] = new TH1D(Form("%s_%s",m_name.c_str(),"pT") , ";p_{T} [GeV];Events", 40, 0, 200); + histoMap["eta"] = new TH1D(Form("%s_%s",m_name.c_str(),"eta") , ";#eta;Events" , 60, -4.5, 4.5); + histoMap["phi"] = new TH1D(Form("%s_%s",m_name.c_str(),"phi") , ";#phi;Events" , 20, -TMath::Pi(), TMath::Pi()); + + histoMap["eta_15GeV"] = new TH1D(Form("%s_%s",m_name.c_str(),"eta_15GeV") , ";#eta;Events" , 60, -4.5, 4.5); + histoMap["phi_15GeV"] = new TH1D(Form("%s_%s",m_name.c_str(),"phi_15GeV") , ";#phi;Events" , 20, -TMath::Pi(), TMath::Pi()); - histoMap["pT_15GeV"] = new TH1D(Form("%s_%s",m_name.c_str(),"pT_15GeV") , ";p_{T} [GeV]; Track p_{T} Events", 40, 0, 200); - histoMap["eta_15GeV"] = new TH1D(Form("%s_%s",m_name.c_str(),"eta_15GeV") , ";#eta; Track #eta Events" , 60, -4.5, 4.5); - histoMap["phi_15GeV"] = new TH1D(Form("%s_%s",m_name.c_str(),"phi_15GeV") , ";#phi; Track #phi Events" , 20, -TMath::Pi(), TMath::Pi()); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"pT", histoMap["pT"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eta", histoMap["eta"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"phi", histoMap["phi"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"pT_15GeV", histoMap["pT_15GeV"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eta_15GeV", histoMap["eta_15GeV"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"phi_15GeV", histoMap["phi_15GeV"])); + + if (m_hasFwd) { + histoMap["pT_eta4"] = new TH1D(Form("%s_%s",m_name.c_str(),"pT_eta4") ,";p_{T} [GeV];Events", 40, 0, 200); + histoMap["phi_eta4"] = new TH1D(Form("%s_%s",m_name.c_str(),"phi_eta4") , ";#phi;Events" , 20, -TMath::Pi(), TMath::Pi()); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"pT_eta4", histoMap["pT_eta4"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"phi_eta4", histoMap["phi_eta4"])); + } + return StatusCode::SUCCESS; } @@ -37,16 +44,22 @@ namespace egammaMonitoring { void ParticleHistograms::fill(const xAOD::IParticle& egamma, float /*mu*/) { - if((egamma.pt())/1000. > 0) histoMap["pT"]->Fill((egamma.pt())/1000.); + double pT = egamma.pt()*1e-3; + if (pT > 0) + histoMap["pT"]->Fill(pT); histoMap["eta"]->Fill(egamma.eta()); histoMap["phi"]->Fill(egamma.phi()); - if((egamma.pt())/1000. > 15) { - histoMap["pT_15GeV"]->Fill((egamma.pt())/1000.); + if (pT > 15) { histoMap["eta_15GeV"]->Fill(egamma.eta()); histoMap["phi_15GeV"]->Fill(egamma.phi()); } + if (m_hasFwd && std::abs(egamma.eta()) < 4.) { + histoMap["pT_eta4"]->Fill(pT); + histoMap["phi_eta4"]->Fill(egamma.phi()); + } + } } diff --git a/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.h b/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.h index 78282b8a233e710663956221c2c4143c970687a7..4cff77f9b18d0ffb61b2fc4a640c126e6df75382 100644 --- a/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.h +++ b/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.h @@ -23,6 +23,11 @@ namespace egammaMonitoring { void fill(const xAOD::IParticle& egamma); void fill(const xAOD::IParticle& egamma, float mu); + void hasFwd(bool a = true) { m_hasFwd = a; } + + private: + bool m_hasFwd = false; + }; } diff --git a/Reconstruction/egamma/egammaValidation/src/RecoElectronHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/RecoElectronHistograms.cxx index d3a9ac6f7cff0088bc7e810d5231c147918784ed..efbc701e6addd3f964555f6dfdeb0aacf177fd3a 100644 --- a/Reconstruction/egamma/egammaValidation/src/RecoElectronHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/RecoElectronHistograms.cxx @@ -54,7 +54,8 @@ void RecoElectronHistograms::fill(const xAOD::Electron& elrec) { } histo2DMap["eta_nTracks"]->Fill(elrec.eta(),elrec.nTrackParticles()); - histo3DMap["eteta_eop"]->Fill(elrec.pt()*1e-3,std::abs(elrec.eta()),elrec.pt()/elrec.trackParticle()->pt()); + if (elrec.nTrackParticles()) + histo3DMap["eteta_eop"]->Fill(elrec.pt()*1e-3,std::abs(elrec.eta()),elrec.pt()/elrec.trackParticle()->pt()); } diff --git a/Reconstruction/egamma/egammaValidation/test/test_electron_Run4.sh b/Reconstruction/egamma/egammaValidation/test/test_electron_Run4.sh index 553675f1a4efaca97417f6f354eb5541f977718d..92f2fafe5bf443b627ade98c1fdb83f180599573 100755 --- a/Reconstruction/egamma/egammaValidation/test/test_electron_Run4.sh +++ b/Reconstruction/egamma/egammaValidation/test/test_electron_Run4.sh @@ -39,7 +39,7 @@ case $ArtProcess in echo "art-result: $? checks_files" - runegammaMonitoring.py -p 'electron' -fwd 'True' + runegammaMonitoring.py -p 'electron' echo "art-result: $? athena_job"