From 6f36e8b85d9f8a78807646b7f81c22f5f21945c8 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste De Vivie De Regie <devivie@lpsc.in2p3.fr> Date: Wed, 29 May 2024 10:49:27 +0200 Subject: [PATCH] cleaning egamma ART cleaning egamma ART --- .../python/egammaMonitoringConfig.py | 12 +- .../scripts/runegammaMonitoring.py | 7 +- .../src/ClusterHistograms.cxx | 76 ++++++---- .../src/DiObjectHistograms.cxx | 8 +- .../egammaValidation/src/EfficiencyPlot.cxx | 1 - .../egammaValidation/src/EgammaMonitoring.cxx | 135 ++++++++++-------- .../egammaValidation/src/EgammaMonitoring.h | 33 +++-- .../src/IsolationHistograms.cxx | 16 ++- .../src/ParticleHistograms.cxx | 22 +-- .../src/RecoClusterHistograms.cxx | 8 +- .../src/RecoElectronHistograms.cxx | 18 +-- .../src/RecoPhotonHistograms.cxx | 12 +- .../src/ShowerShapesHistograms.cxx | 60 ++++---- .../egammaValidation/src/TrackHistograms.cxx | 30 ++-- .../src/TruthElectronHistograms.cxx | 39 +++-- .../src/TruthPhotonHistograms.cxx | 73 +++++----- .../test/test_electron_fwd_Run4.sh | 2 +- 17 files changed, 310 insertions(+), 242 deletions(-) diff --git a/Reconstruction/egamma/egammaValidation/python/egammaMonitoringConfig.py b/Reconstruction/egamma/egammaValidation/python/egammaMonitoringConfig.py index d3d20cb3f34e..4491fd5054d1 100644 --- a/Reconstruction/egamma/egammaValidation/python/egammaMonitoringConfig.py +++ b/Reconstruction/egamma/egammaValidation/python/egammaMonitoringConfig.py @@ -28,10 +28,20 @@ def egammaMonitoringCfg(flags, particleType = 'electron', AsgElectronLikelihoodToolCfg) for k,w in eidWP.items(): t = AsgElectronLikelihoodToolCfg(flags, k+'LHSelector', w) - kwarg[k+'LH'] = t.popPrivateTools() + kwarg[k+'_Ele'] = t.popPrivateTools() acc.merge(t) if addFwd: kwarg['FwdElectronsKey'] = 'ForwardElectrons' + from ElectronPhotonSelectorTools.AsgForwardElectronLikelihoodToolConfig import ( + AsgForwardElectronLikelihoodToolCfg) + for k in eidWP.keys(): + # do not use the WP name as mapping points to a corrupted ID (in main, 24/05/24) + # anyway, not appropriate for ITk but least corrupted within rel21.2/Run2 + configFile = f'dev/ElectronPhotonSelectorTools/offline/mc16_20190729/FwdLH{k}Conf.conf' + t = AsgForwardElectronLikelihoodToolCfg(flags,k+'FwdSelector', + ConfigFile = configFile) + kwarg[k+'_FwdEle'] = t.popPrivateTools() + acc.merge(t) if particleType == 'gamma': from ElectronPhotonSelectorTools.AsgPhotonIsEMSelectorsConfig import ( diff --git a/Reconstruction/egamma/egammaValidation/scripts/runegammaMonitoring.py b/Reconstruction/egamma/egammaValidation/scripts/runegammaMonitoring.py index 7ac62b4f0411..3e5eba6c0ab8 100755 --- a/Reconstruction/egamma/egammaValidation/scripts/runegammaMonitoring.py +++ b/Reconstruction/egamma/egammaValidation/scripts/runegammaMonitoring.py @@ -5,6 +5,7 @@ # Cut-and-paste from RunHitAnalysis.py import sys +import os from argparse import ArgumentParser @@ -33,7 +34,11 @@ from AthenaConfiguration.AllConfigFlags import initConfigFlags from AthenaConfiguration.Enums import ProductionStep flags = initConfigFlags() flags.Common.ProductionStep = ProductionStep.Simulation -flags.Input.Files = [ f for f in args.inputFiles.split(',') ] +isDir = os.path.isdir(args.inputFiles) +if isDir: + flags.Input.Files = [ args.inputFiles + '/' + f for f in os.listdir(args.inputFiles) ] +else: + flags.Input.Files = [ f for f in args.inputFiles.split(',') ] from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags setupDetectorFlags(flags, ['LAr','Tile'], use_metadata=True, toggle_geometry=True) # to be checked. Without this, I got diff --git a/Reconstruction/egamma/egammaValidation/src/ClusterHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/ClusterHistograms.cxx index 6b59562c44bb..90c828f9ae47 100644 --- a/Reconstruction/egamma/egammaValidation/src/ClusterHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/ClusterHistograms.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "ClusterHistograms.h" @@ -18,39 +18,46 @@ using namespace egammaMonitoring; StatusCode ClusterHistograms::initializePlots() { + + const char* fN = m_name.c_str(); - profileMap["Eraw_Etruth_vs_Etruth_profile"] = new TProfile(Form("%s_%s",m_name.c_str(),"Eraw_Etruth_vs_Etruth_profile"), ";E^{truth};E^{raw}/E^{truth}", 100,0.,200., 0.5,1.5); - profileMap["Eraw_Etruth_vs_eta_profile"] = new TProfile(Form("%s_%s",m_name.c_str(),"Eraw_Etruth_vs_eta_profile"), ";truth #eta;E^{raw}/E^{truth}", 60,-4.5,4.5, 0.5,1.5); - profileMap["number_cells_vs_et_in_layer_0_profile"] = new TProfile(Form("%s_%s",m_name.c_str(),"number_cells_vs_et_in_layer_0_profile"), "Number of cells;E_{T}", 60,0,300, 0,100.); - profileMap["number_cells_vs_et_in_layer_1_profile"] = new TProfile(Form("%s_%s",m_name.c_str(),"number_cells_vs_et_in_layer_1_profile"), "Number of cells;E_{T}", 60,0,300, 0,100.); - profileMap["number_cells_vs_et_in_layer_2_profile"] = new TProfile(Form("%s_%s",m_name.c_str(),"number_cells_vs_et_in_layer_2_profile"), "Number of cells;E_{T}", 60,0,300, 0,100.); - profileMap["number_cells_vs_et_in_layer_3_profile"] = new TProfile(Form("%s_%s",m_name.c_str(),"number_cells_vs_et_in_layer_3_profile"), "Number of cells;E_{T}", 60,0,300, 0,100.); + for (int is = 0; is < 4; is++) { + TString pNm = Form("number_cells_vs_eta_in_layer_%i_profile",is); + TString pN = Form("%s_number_cells_vs_eta_in_layer_%i_profile",fN,is); + profileMap[pNm.Data()] = new TProfile(pN.Data(), "Number of cells;truth #eta", 90,-4.5,4.5, 0, 100); + pN = Form("%s%s",m_folder.c_str(),pNm.Data()); + ATH_CHECK(m_rootHistSvc->regHist(pN.Data(), profileMap[pNm.Data()])); + + pNm = Form("number_cells_vs_e_in_layer_%i_profile",is); + pN = Form("%s_number_cells_vs_e_in_layer_%i_profile",fN,is); + profileMap[pNm.Data()] = new TProfile(pN.Data(), "Number of cells;truth E [GeV]", 60, 0, 300, 0, 100); + pN = Form("%s%s",m_folder.c_str(),pNm.Data()); + ATH_CHECK(m_rootHistSvc->regHist(pN.Data(), profileMap[pNm.Data()])); + } - profileMap["number_cells_vs_eta_in_layer_0_profile"] = new TProfile(Form("%s_%s",m_name.c_str(),"number_cells_vs_eta_in_layer_0_profile"), "Number of cells;truth #eta", 60,-4.5,4.5, 0,100); - profileMap["number_cells_vs_eta_in_layer_1_profile"] = new TProfile(Form("%s_%s",m_name.c_str(),"number_cells_vs_eta_in_layer_1_profile"), "Number of cells;truth #eta", 60,-4.5,4.5, 0,100); - profileMap["number_cells_vs_eta_in_layer_2_profile"] = new TProfile(Form("%s_%s",m_name.c_str(),"number_cells_vs_eta_in_layer_2_profile"), "Number of cells;truth #eta", 60,-4.5,4.5, 0,100); - profileMap["number_cells_vs_eta_in_layer_3_profile"] = new TProfile(Form("%s_%s",m_name.c_str(),"number_cells_vs_eta_in_layer_3_profile"), "Number of cells;truth #eta", 60,-4.5,4.5, 0,100); + // tempo, for checks + for (int is = 0; is < 24; is++) { + TString pNm = Form("number_cells_vs_eta_in_sampling_%i_profile",is); + TString pN = Form("%s_number_cells_vs_eta_in_sampling_%i_profile",fN,is); + profileMap[pNm.Data()] = new TProfile(pN.Data(), "Number of cells;truth #eta", 90,-4.5,4.5, 0,100); + pN = Form("%s%s",m_folder.c_str(),pNm.Data()); + ATH_CHECK(m_rootHistSvc->regHist(pN.Data(), profileMap[pNm.Data()])); + } - profileMap["number_topocluster_vs_et_profile"] = new TProfile(Form("%s_%s",m_name.c_str(),"number_topocluster_vs_et_profile"), "Number of topocluster;E_{T}", 60,0,300, -0.5,14.5); - profileMap["number_topocluster_vs_eta_profile"] = new TProfile(Form("%s_%s",m_name.c_str(),"number_topocluster_vs_eta_profile"), "Number of topocluster;truth #eta", 60,-4.5,4.5, -0.5,14.5); + profileMap["Eraw_Etruth_vs_Etruth_profile"] = new TProfile(Form("%s_Eraw_Etruth_vs_Etruth_profile",fN), ";E^{truth};E^{raw}/E^{truth}", 100, 0., 200., 0.5, 1.5); + profileMap["Eraw_Etruth_vs_eta_profile"] = new TProfile(Form("%s_Eraw_Etruth_vs_eta_profile",fN), ";truth #eta;E^{raw}/E^{truth}", 90, -4.5, 4.5, 0.5, 1.5); - profileMap["number_cell_in_layer"] = new TProfile(Form("%s_%s",m_name.c_str(),"number_cell_in_layer"), ";Number of cells;Layer",100,0,200, 0,4); - histo2DMap["mu_energy_resolution_2D"] = new TH2D(Form("%s_%s",m_name.c_str(),"mu_energy_resolution_2D"), ";<#mu>; Energy Resolution", 5,0,80, 20,-1,1); + profileMap["number_topocluster_vs_e_profile"] = new TProfile(Form("%s_number_topocluster_vs_e_profile",fN), "Number of topocluster;truth E [GeV]", 60, 0, 300, -0.5, 14.5); + profileMap["number_topocluster_vs_eta_profile"] = new TProfile(Form("%s_number_topocluster_vs_eta_profile",fN), "Number of topocluster;truth #eta", 90,-4.5,4.5, -0.5, 14.5); + + // do not undertstand this histo... + profileMap["number_cell_in_layer"] = new TProfile(Form("%s_number_cell_in_layer",fN), ";Number of cells;Layer", 100, 0, 200,0, 4); + histo2DMap["mu_energy_resolution_2D"] = new TH2D(Form("%s_mu_energy_resolution_2D",fN), ";<#mu>; Energy Resolution", 5, 0, 80, 20, -1, 1); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"Eraw_Etruth_vs_Etruth_profile", profileMap["Eraw_Etruth_vs_Etruth_profile"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"Eraw_Etruth_vs_eta_profile", profileMap["Eraw_Etruth_vs_eta_profile"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"number_cells_vs_et_in_layer_0_profile", profileMap["number_cells_vs_et_in_layer_0_profile"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"number_cells_vs_et_in_layer_1_profile", profileMap["number_cells_vs_et_in_layer_1_profile"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"number_cells_vs_et_in_layer_2_profile", profileMap["number_cells_vs_et_in_layer_2_profile"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"number_cells_vs_et_in_layer_3_profile", profileMap["number_cells_vs_et_in_layer_3_profile"])); - - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"number_cells_vs_eta_in_layer_0_profile", profileMap["number_cells_vs_eta_in_layer_0_profile"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"number_cells_vs_eta_in_layer_1_profile", profileMap["number_cells_vs_eta_in_layer_1_profile"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"number_cells_vs_eta_in_layer_2_profile", profileMap["number_cells_vs_eta_in_layer_2_profile"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"number_cells_vs_eta_in_layer_3_profile", profileMap["number_cells_vs_eta_in_layer_3_profile"])); - - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"number_topocluster_vs_et_profile", profileMap["number_topocluster_vs_et_profile"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"number_topocluster_vs_e_profile", profileMap["number_topocluster_vs_e_profile"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"number_topocluster_vs_eta_profile", profileMap["number_topocluster_vs_eta_profile"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"number_cell_in_layer", profileMap["number_cell_in_layer"])); @@ -76,7 +83,7 @@ void ClusterHistograms::fill(const xAOD::Egamma& egamma, float mu = 0) { const auto Etruth = truth_egamma->e(); const auto Eres = (Ereco - Etruth)/Etruth; - profileMap["Eraw_Etruth_vs_Etruth_profile"]->Fill(truth_egamma->e()/1000,Ereco/Etruth); + profileMap["Eraw_Etruth_vs_Etruth_profile"]->Fill(Etruth/1000,Ereco/Etruth); profileMap["Eraw_Etruth_vs_eta_profile"]->Fill(truth_egamma->eta(),Ereco/Etruth); histo2DMap["mu_energy_resolution_2D"]->Fill(mu,Eres); @@ -85,22 +92,33 @@ void ClusterHistograms::fill(const xAOD::Egamma& egamma, float mu = 0) { if ( !cellLinks ) return; std::map<int, int > cells_per_layer; + std::map<int, int > cells_per_sam; for (const CaloCell* cell : *cellLinks) { if (cell) { int layer = cell->caloDDE()->getLayer(); cells_per_layer[layer]++; + int sam = cell->caloDDE()->getSampling(); + /* + std::cout << m_name << " sam = " << sam << " layer = " << layer + << " eta cell raw = " << cell->caloDDE()->eta_raw() //<< " eta part = " << truth_egamma->eta() + << " IW " << cell->caloDDE()->is_lar_em_endcap_inner() << " OW " << cell->caloDDE()->is_lar_em_endcap_outer() << std::endl; + */ + cells_per_sam[sam]++; } } auto associatedTopoCluster = xAOD::EgammaHelpers::getAssociatedTopoClusters(cluster); - profileMap["number_topocluster_vs_et_profile"]->Fill(truth_egamma->e()/1000, associatedTopoCluster.size()); + profileMap["number_topocluster_vs_e_profile"]->Fill(Etruth/1000, associatedTopoCluster.size()); profileMap["number_topocluster_vs_eta_profile"]->Fill(truth_egamma->eta(), associatedTopoCluster.size()); for (auto const& x : cells_per_layer) { profileMap["number_cell_in_layer"]->Fill(x.second,x.first); - profileMap["number_cells_vs_et_in_layer_"+std::to_string(x.first)+"_profile"]->Fill(truth_egamma->e()/1000, x.second); + profileMap["number_cells_vs_e_in_layer_"+std::to_string(x.first)+"_profile"]->Fill(Etruth/1000, x.second); profileMap["number_cells_vs_eta_in_layer_"+std::to_string(x.first)+"_profile"]->Fill(truth_egamma->eta(), x.second); } + for (auto const& x : cells_per_sam) { + profileMap[Form("number_cells_vs_eta_in_sampling_%i_profile",x.first)]->Fill(truth_egamma->eta(), x.second); + } } diff --git a/Reconstruction/egamma/egammaValidation/src/DiObjectHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/DiObjectHistograms.cxx index 803689fbb9f7..870842aef819 100644 --- a/Reconstruction/egamma/egammaValidation/src/DiObjectHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/DiObjectHistograms.cxx @@ -12,13 +12,15 @@ namespace egammaMonitoring { StatusCode DiObjectHistograms::initializePlots() { - histoMap["mass"] = new TH1D(Form("%s_%s",m_name.c_str(),"mass"),"",300,50,200); + const char* fN = m_name.c_str(); + + histoMap["mass"] = new TH1D(Form("%s_mass",fN),";m [GeV]; Events",300,50,200); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"mass", histoMap["mass"])); - histoMap["massvsmu"] = new TH2D(Form("%s_%s",m_name.c_str(),"massvsmu"),"",100,0,100,150,50,200); + histoMap["massvsmu"] = new TH2D(Form("%s_massvsmu",fN),";#mu;m [GeV]",100,0,100,150,50,200); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"massvsmu", histoMap["massvsmu"])); - histoMap["massvspT"] = new TH2D(Form("%s_%s",m_name.c_str(),"massvspT"),"",20,0,100,150,50,200); + histoMap["massvspT"] = new TH2D(Form("%s_massvspT",fN),";p_{T} [GeV];m [GeV]",20,0,100,150,50,200); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"massvspT", histoMap["massvspT"])); return StatusCode::SUCCESS; } diff --git a/Reconstruction/egamma/egammaValidation/src/EfficiencyPlot.cxx b/Reconstruction/egamma/egammaValidation/src/EfficiencyPlot.cxx index 4942e70fb24e..dfd4a27cd7b5 100644 --- a/Reconstruction/egamma/egammaValidation/src/EfficiencyPlot.cxx +++ b/Reconstruction/egamma/egammaValidation/src/EfficiencyPlot.cxx @@ -31,5 +31,4 @@ namespace egammaMonitoring { } // - } // namespace diff --git a/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.cxx b/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.cxx index c62ef9402239..80ce7c58a076 100644 --- a/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.cxx +++ b/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "EgammaMonitoring.h" @@ -102,13 +102,13 @@ StatusCode EgammaMonitoring::initialize() { truthPromptElectronWithRecoTrack = std::make_unique<egammaMonitoring::TruthElectronHistograms>( "truthPromptElectronWithRecoTrack","Truth Prompt Electrons With GSFTrack", "/MONITORING/truthPromptElectronWithRecoTrack/", rootHistSvc); - truthRecoElectronLooseLH = std::make_unique<egammaMonitoring::TruthElectronHistograms>( + truthRecoElectronLoose = std::make_unique<egammaMonitoring::TruthElectronHistograms>( "truthRecoElectronLooseLH","LLH Electrons Reco Electron", "/MONITORING/truthRecoElectronLooseLH/", rootHistSvc); - truthRecoElectronMediumLH = std::make_unique<egammaMonitoring::TruthElectronHistograms>( + truthRecoElectronMedium = std::make_unique<egammaMonitoring::TruthElectronHistograms>( "truthRecoElectronMediumLH","MLH Electrons Reco Electron", "/MONITORING/truthRecoElectronMediumLH/", rootHistSvc); - truthRecoElectronTightLH = std::make_unique<egammaMonitoring::TruthElectronHistograms>( + truthRecoElectronTight = std::make_unique<egammaMonitoring::TruthElectronHistograms>( "truthRecoElectronTightLH","TLH Electrons Reco Electron", "/MONITORING/truthRecoElectronTightLH/", rootHistSvc); if (!m_FwdElectronsKey.empty()) { @@ -120,15 +120,15 @@ StatusCode EgammaMonitoring::initialize() { truthPromptElectronWithGSFTrack->hasFwd(); truthPromptElectronWithReco->hasFwd(); truthPromptElectronWithRecoTrack->hasFwd(); - truthRecoElectronLooseLH->hasFwd(); - truthRecoElectronMediumLH->hasFwd(); - truthRecoElectronTightLH->hasFwd(); + truthRecoElectronLoose->hasFwd(); + truthRecoElectronMedium->hasFwd(); + truthRecoElectronTight->hasFwd(); } ATH_CHECK(recoElectronAll->initializePlots()); - ATH_CHECK(truthRecoElectronLooseLH->initializePlots()); - ATH_CHECK(truthRecoElectronMediumLH->initializePlots()); - ATH_CHECK(truthRecoElectronTightLH->initializePlots()); + ATH_CHECK(truthRecoElectronLoose->initializePlots()); + ATH_CHECK(truthRecoElectronMedium->initializePlots()); + ATH_CHECK(truthRecoElectronTight->initializePlots()); ATH_CHECK(truthElectronAll->initializePlots(true)); ATH_CHECK(truthPromptElectronAll->initializePlots(true)); ATH_CHECK(truthElectronRecoElectronAll->initializePlots()); @@ -173,6 +173,9 @@ StatusCode EgammaMonitoring::initialize() { truthPhotonAllConv = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( "truthPhotonAllConv","truthPhotonAllConv", "/MONITORING/truthPhotonAllConv/", rootHistSvc); + truthPhotonAllLateConv = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( + "truthPhotonAllLateConv","truthPhotonAllLateConv", "/MONITORING/truthPhotonAllLateConv/", rootHistSvc); + truthPhotonRecoPhoton = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( "truthPhotonRecoPhoton","truthPhotonRecoPhoton", "/MONITORING/truthPhotonRecoPhoton/", rootHistSvc); @@ -227,17 +230,17 @@ StatusCode EgammaMonitoring::initialize() { truthPhotonUnconvRecoUnconv = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( "truthUnconvRecoUnconv","truthUnconvRecoUnconv", "/MONITORING/truthUnconvRecoUnconv/", rootHistSvc); - recoPhotonUnconvLooseLH = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( - "recoPhotonUnconvLooseLH","LLH Photons Reco Photon", "/MONITORING/recoPhotonUnconvLooseLH/", rootHistSvc); + recoPhotonUnconvLoose = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( + "recoPhotonUnconvLoose","Loose Photons Reco Photon", "/MONITORING/recoPhotonUnconvLoose/", rootHistSvc); - recoPhotonUnconvTightLH = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( - "recoPhotonUnconvTightLH","TLH Photons Reco Photon", "/MONITORING/recoPhotonUnconvTightLH/", rootHistSvc); + recoPhotonUnconvTight = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( + "recoPhotonUnconvTight","Tight Photons Reco Photon", "/MONITORING/recoPhotonUnconvTight/", rootHistSvc); - recoPhotonConvLooseLH = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( - "recoPhotonConvLooseLH","LLH Photons Reco Photon", "/MONITORING/recoPhotonConvLooseLH/", rootHistSvc); + recoPhotonConvLoose = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( + "recoPhotonConvLoose","Loose Photons Reco Photon", "/MONITORING/recoPhotonConvLoose/", rootHistSvc); - recoPhotonConvTightLH = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( - "recoPhotonConvTightLH","LLH Photons Reco Photon", "/MONITORING/recoPhotonConvTightLH/", rootHistSvc); + recoPhotonConvTight = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( + "recoPhotonConvTight","Tight Photons Reco Photon", "/MONITORING/recoPhotonConvTight/", rootHistSvc); recoPhotonUnconvIsoFixedCutTight = std::make_unique<egammaMonitoring::TruthPhotonHistograms>( "recoPhotonUnconvIsoFixedCutTight","Isolation Fixed Cut Tight Photons Reco Photon", "/MONITORING/recoPhotonUnconvIsoFixedCutTight/", rootHistSvc); @@ -290,6 +293,7 @@ StatusCode EgammaMonitoring::initialize() { ATH_CHECK(truthPhotonAll->initializePlots()); ATH_CHECK(truthPhotonAllUnconv->initializePlots()); ATH_CHECK(truthPhotonAllConv->initializePlots()); + ATH_CHECK(truthPhotonAllLateConv->initializePlots()); ATH_CHECK(truthPhotonRecoPhoton->initializePlots()); ATH_CHECK(truthPhotonRecoPhotonOrElectron->initializePlots()); ATH_CHECK(truthPhotonConvPhoton->initializePlots()); @@ -308,10 +312,10 @@ StatusCode EgammaMonitoring::initialize() { ATH_CHECK(truthPhotonUnconvRecoConv2TRT->initializePlots()); ATH_CHECK(truthPhotonUnconvRecoConv2SiTRT->initializePlots()); ATH_CHECK(truthPhotonUnconvRecoUnconv->initializePlots()); - ATH_CHECK(recoPhotonUnconvLooseLH->initializePlots()); - ATH_CHECK(recoPhotonUnconvTightLH->initializePlots()); - ATH_CHECK(recoPhotonConvLooseLH->initializePlots()); - ATH_CHECK(recoPhotonConvTightLH->initializePlots()); + ATH_CHECK(recoPhotonUnconvLoose->initializePlots()); + ATH_CHECK(recoPhotonUnconvTight->initializePlots()); + ATH_CHECK(recoPhotonConvLoose->initializePlots()); + ATH_CHECK(recoPhotonConvTight->initializePlots()); ATH_CHECK(recoPhotonUnconvIsoFixedCutTight->initializePlots()); ATH_CHECK(recoPhotonUnconvIsoFixedCutTightCaloOnly->initializePlots()); ATH_CHECK(recoPhotonUnconvIsoFixedCutLoose->initializePlots()); @@ -336,16 +340,22 @@ StatusCode EgammaMonitoring::initialize() { if ("electron" == m_sampleType) { //*****************ID selectors (3 levels)******************** - ATH_CHECK(m_LooseLH.retrieve()); - ATH_CHECK(m_MediumLH.retrieve()); - ATH_CHECK(m_TightLH.retrieve()); + ATH_CHECK(m_Loose_Ele.retrieve()); + ATH_CHECK(m_Medium_Ele.retrieve()); + ATH_CHECK(m_Tight_Ele.retrieve()); ATH_CHECK(m_FwdElectronsKey.initialize(!m_FwdElectronsKey.empty())); - m_dR1 = new TH1D("dR1",";#Delta R;Events",1000,0,0.1); - ATH_CHECK(rootHistSvc->regHist("/MONITORING/Check/dR1",m_dR1)); - m_dR2 = new TH1D("dR2",";#Delta R;Events",1000,0,0.1); - ATH_CHECK(rootHistSvc->regHist("/MONITORING/Check/dR2",m_dR2)); + if (!m_FwdElectronsKey.empty()) { + m_dR1 = new TH1D("dR1",";#Delta R;Events",1000,0,0.1); + ATH_CHECK(rootHistSvc->regHist("/MONITORING/Check/dR1",m_dR1)); + m_dR2 = new TH1D("dR2",";#Delta R;Events",1000,0,0.1); + ATH_CHECK(rootHistSvc->regHist("/MONITORING/Check/dR2",m_dR2)); + + ATH_CHECK(m_Loose_FwdEle.retrieve()); + ATH_CHECK(m_Medium_FwdEle.retrieve()); + ATH_CHECK(m_Tight_FwdEle.retrieve()); + } } if ("gamma" == m_sampleType) { @@ -411,6 +421,10 @@ StatusCode EgammaMonitoring::execute() { if (!electron) continue; + //JB test + //if (xAOD::EgammaHelpers::isElectron(electron)) + //continue; + clusterPromptAll->fill(*electron,mu); if (egtruth->pt() > 10*Gaudi::Units::GeV) { clusterPrompt10GeV->fill(*electron,mu); @@ -574,6 +588,9 @@ StatusCode EgammaMonitoring::execute() { for (const auto *elrec : *RecoEl) { + //JB test + //continue; + if (!elrec) continue; bool toFill = false; @@ -617,12 +634,12 @@ StatusCode EgammaMonitoring::execute() { foundPromptElectron = true; truthPromptElectronWithReco->fill(elTruth,elrec); truthPromptElectronWithRecoTrack->fill(elTruth,elrec); // yes the same. This is different for fwd - if (m_LooseLH->accept(elrec)) - truthRecoElectronLooseLH->fill(elTruth,elrec); - if (m_MediumLH->accept(elrec)) - truthRecoElectronMediumLH->fill(elTruth,elrec); - if (m_TightLH->accept(elrec)) - truthRecoElectronTightLH->fill(elTruth,elrec); + if (m_Loose_Ele->accept(elrec)) + truthRecoElectronLoose->fill(elTruth,elrec); + if (m_Medium_Ele->accept(elrec)) + truthRecoElectronMedium->fill(elTruth,elrec); + if (m_Tight_Ele->accept(elrec)) + truthRecoElectronTight->fill(elTruth,elrec); } } // RecoEl Loop @@ -691,6 +708,12 @@ StatusCode EgammaMonitoring::execute() { truthPromptElectronWithReco->fill(elTruth,el); if (el->nTrackParticles() > 0) truthPromptElectronWithRecoTrack->fill(elTruth,el); + if (m_Loose_FwdEle->accept(el)) + truthRecoElectronLoose->fill(elTruth,el); + if (m_Medium_FwdEle->accept(el)) + truthRecoElectronMedium->fill(elTruth,el); + if (m_Tight_FwdEle->accept(el)) + truthRecoElectronTight->fill(elTruth,el); } } } // loop on fwdEl @@ -713,8 +736,6 @@ StatusCode EgammaMonitoring::execute() { clusterAll->fill(*phrec,mu); if (phrec->pt() > 10*Gaudi::Units::GeV) { cluster10GeV->fill(*phrec,mu); - } - if (phrec->pt() > 10*Gaudi::Units::GeV){ showerShapes10GeV->fill(*phrec); } @@ -732,6 +753,7 @@ StatusCode EgammaMonitoring::execute() { const xAOD::Electron *electron = xAOD::EgammaHelpers::getRecoElectron(egtruth); if(isTrueConv) truthPhotonAllConv->fill(*egtruth, mu); + if(isTrueLateConv) truthPhotonAllLateConv->fill(*egtruth, mu); if(!isTrueConv && !isTrueLateConv) truthPhotonAllUnconv->fill(*egtruth, mu); if(photon || electron) @@ -778,8 +800,8 @@ StatusCode EgammaMonitoring::execute() { if (m_IsoFixedCutTight->accept(*photon)) recoPhotonConvIsoFixedCutTight->fill(*egtruth, mu); if (m_IsoFixedCutTightCaloOnly->accept(*photon)) recoPhotonConvIsoFixedCutTightCaloOnly->fill(*egtruth, mu); if (m_IsoFixedCutLoose->accept(*photon)) recoPhotonConvIsoFixedCutLoose->fill(*egtruth, mu); - if (m_Loose_Photon->accept(photon)) recoPhotonConvLooseLH->fill(*egtruth, mu); - if (m_Tight_Photon->accept(photon)) recoPhotonConvTightLH->fill(*egtruth, mu); + if (m_Loose_Photon->accept(photon)) recoPhotonConvLoose->fill(*egtruth, mu); + if (m_Tight_Photon->accept(photon)) recoPhotonConvTight->fill(*egtruth, mu); } // isRecoConv else { truthPhotonConvRecoUnconv->fill(*egtruth, mu); @@ -787,7 +809,8 @@ StatusCode EgammaMonitoring::execute() { } } //isTrueConv - else if (!isTrueLateConv) { + //else if (!isTrueLateConv) { + else { truthPhotonUnconvPhoton->fill(*egtruth, mu); @@ -816,8 +839,8 @@ StatusCode EgammaMonitoring::execute() { if (m_IsoFixedCutTight->accept(*photon)) recoPhotonUnconvIsoFixedCutTight->fill(*egtruth, mu); if (m_IsoFixedCutTightCaloOnly->accept(*photon)) recoPhotonUnconvIsoFixedCutTightCaloOnly->fill(*egtruth, mu); if (m_IsoFixedCutLoose->accept(*photon)) recoPhotonUnconvIsoFixedCutLoose->fill(*egtruth, mu); - if (m_Loose_Photon->accept(photon)) recoPhotonUnconvLooseLH->fill(*egtruth, mu); - if (m_Tight_Photon->accept(photon)) recoPhotonUnconvTightLH->fill(*egtruth, mu); + if (m_Loose_Photon->accept(photon)) recoPhotonUnconvLoose->fill(*egtruth, mu); + if (m_Tight_Photon->accept(photon)) recoPhotonUnconvTight->fill(*egtruth, mu); } // !isTrueLateConv } //egtruth Loop @@ -893,12 +916,12 @@ StatusCode EgammaMonitoring::finalize() { ATH_CHECK(matchingEfficiency.divide(truthPromptElectronWithRecoTrack.get(), truthPromptElectronWithGSFTrack.get())); egammaMonitoring::EfficiencyPlot reconstructionEfficiency("reconstructionEfficiency", "/MONITORING/reconstructionEfficiency/", rootHistSvc ); ATH_CHECK(reconstructionEfficiency.divide(truthPromptElectronWithReco.get(), truthPromptElectronAll.get())); - egammaMonitoring::EfficiencyPlot recoElectronLooseLHEfficiency("recoElectronLooseLHEfficiency", "/MONITORING/recoElectronLooseLHEfficiency/", rootHistSvc ); - ATH_CHECK(recoElectronLooseLHEfficiency.divide(truthRecoElectronLooseLH.get(), truthPromptElectronAll.get())); - egammaMonitoring::EfficiencyPlot recoElectronMediumLHEfficiency("recoElectronMediumLHEfficiency", "/MONITORING/recoElectronMediumLHEfficiency/", rootHistSvc ); - ATH_CHECK(recoElectronMediumLHEfficiency.divide(truthRecoElectronMediumLH.get(), truthPromptElectronAll.get())); - egammaMonitoring::EfficiencyPlot recoElectronTightLHEfficiency("recoElectronTightLHEfficiency", "/MONITORING/recoElectronTightLHEfficiency/", rootHistSvc ); - ATH_CHECK(recoElectronTightLHEfficiency.divide(truthRecoElectronTightLH.get(), truthPromptElectronAll.get())); + egammaMonitoring::EfficiencyPlot recoElectronLooseEfficiency("recoElectronLooseLHEfficiency", "/MONITORING/recoElectronLooseLHEfficiency/", rootHistSvc ); + ATH_CHECK(recoElectronLooseEfficiency.divide(truthRecoElectronLoose.get(), truthPromptElectronAll.get())); + egammaMonitoring::EfficiencyPlot recoElectronMediumEfficiency("recoElectronMediumLHEfficiency", "/MONITORING/recoElectronMediumLHEfficiency/", rootHistSvc ); + ATH_CHECK(recoElectronMediumEfficiency.divide(truthRecoElectronMedium.get(), truthPromptElectronAll.get())); + egammaMonitoring::EfficiencyPlot recoElectronTightEfficiency("recoElectronTightLHEfficiency", "/MONITORING/recoElectronTightLHEfficiency/", rootHistSvc ); + ATH_CHECK(recoElectronTightEfficiency.divide(truthRecoElectronTight.get(), truthPromptElectronAll.get())); } @@ -957,14 +980,14 @@ StatusCode EgammaMonitoring::finalize() { egammaMonitoring::EfficiencyPlot recoPhotonConvIsoFixedCutLooseEfficiency("recoPhotonConvIsoFixedCutLooseEfficiency", "/MONITORING/recoPhotonConvIsoFixedCutLooseEfficiency/", rootHistSvc ); ATH_CHECK(recoPhotonConvIsoFixedCutLooseEfficiency.divide( recoPhotonConvIsoFixedCutLoose.get(), truthPhotonConvRecoConv.get())); - egammaMonitoring::EfficiencyPlot recoPhotonConvLooseLHEfficiency("recoPhotonConvLooseLHEfficiency", "/MONITORING/recoPhotonConvLooseLHEfficiency/", rootHistSvc ); - ATH_CHECK(recoPhotonConvLooseLHEfficiency.divide( recoPhotonConvLooseLH.get(), truthPhotonConvRecoConv.get())); - egammaMonitoring::EfficiencyPlot recoPhotonConvTightLHEfficiency("recoPhotonConvTightLHEfficiency", "/MONITORING/recoPhotonConvTightLHEfficiency/", rootHistSvc ); - ATH_CHECK(recoPhotonConvTightLHEfficiency.divide( recoPhotonConvTightLH.get(), truthPhotonConvRecoConv.get())); - egammaMonitoring::EfficiencyPlot recoPhotonUnconvLooseLHEfficiency("recoPhotonUnconvLooseLHEfficiency", "/MONITORING/recoPhotonUnconvLooseLHEfficiency/", rootHistSvc ); - ATH_CHECK(recoPhotonUnconvLooseLHEfficiency.divide( recoPhotonUnconvLooseLH.get(), truthPhotonUnconvRecoUnconv.get())); - egammaMonitoring::EfficiencyPlot recoPhotonUnconvTightLHEfficiency("recoPhotonUnconvTightLHEfficiency", "/MONITORING/recoPhotonUnconvTightLHEfficiency/", rootHistSvc ); - ATH_CHECK(recoPhotonUnconvTightLHEfficiency.divide( recoPhotonUnconvTightLH.get(), truthPhotonUnconvRecoUnconv.get())); + egammaMonitoring::EfficiencyPlot recoPhotonConvLooseEfficiency("recoPhotonConvLooseEfficiency", "/MONITORING/recoPhotonConvLooseEfficiency/", rootHistSvc ); + ATH_CHECK(recoPhotonConvLooseEfficiency.divide( recoPhotonConvLoose.get(), truthPhotonConvRecoConv.get())); + egammaMonitoring::EfficiencyPlot recoPhotonConvTightEfficiency("recoPhotonConvTightEfficiency", "/MONITORING/recoPhotonConvTightEfficiency/", rootHistSvc ); + ATH_CHECK(recoPhotonConvTightEfficiency.divide( recoPhotonConvTight.get(), truthPhotonConvRecoConv.get())); + egammaMonitoring::EfficiencyPlot recoPhotonUnconvLooseEfficiency("recoPhotonUnconvLooseEfficiency", "/MONITORING/recoPhotonUnconvLooseEfficiency/", rootHistSvc ); + ATH_CHECK(recoPhotonUnconvLooseEfficiency.divide( recoPhotonUnconvLoose.get(), truthPhotonUnconvRecoUnconv.get())); + egammaMonitoring::EfficiencyPlot recoPhotonUnconvTightEfficiency("recoPhotonUnconvTightEfficiency", "/MONITORING/recoPhotonUnconvTightEfficiency/", rootHistSvc ); + ATH_CHECK(recoPhotonUnconvTightEfficiency.divide( recoPhotonUnconvTight.get(), truthPhotonUnconvRecoUnconv.get())); egammaMonitoring::WidthPlot truthPhotonRecoPhotonWidth("truthPhotonRecoPhotonWidth", "/MONITORING/truthPhotonRecoPhotonWidth/", rootHistSvc); ATH_CHECK(truthPhotonRecoPhotonWidth.fill(truthPhotonRecoPhoton.get())); diff --git a/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.h b/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.h index d7b6b8b9ee47..a9e36543b5ec 100644 --- a/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.h +++ b/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.h @@ -82,11 +82,11 @@ public: std::unique_ptr<egammaMonitoring::TruthElectronHistograms> truthPromptElectronWithRecoTrack; std::unique_ptr<egammaMonitoring::TruthElectronHistograms> - truthRecoElectronLooseLH; + truthRecoElectronLoose; std::unique_ptr<egammaMonitoring::TruthElectronHistograms> - truthRecoElectronMediumLH; + truthRecoElectronMedium; std::unique_ptr<egammaMonitoring::TruthElectronHistograms> - truthRecoElectronTightLH; + truthRecoElectronTight; // photons std::unique_ptr<egammaMonitoring::ClusterHistograms> clusterConvPhoton; @@ -101,6 +101,7 @@ public: std::unique_ptr<egammaMonitoring::IHistograms> truthPhotonAll; std::unique_ptr<egammaMonitoring::IHistograms> truthPhotonAllUnconv; std::unique_ptr<egammaMonitoring::IHistograms> truthPhotonAllConv; + std::unique_ptr<egammaMonitoring::IHistograms> truthPhotonAllLateConv; std::unique_ptr<egammaMonitoring::IHistograms> truthPhotonRecoPhoton; std::unique_ptr<egammaMonitoring::IHistograms> truthPhotonRecoPhotonOrElectron; @@ -121,10 +122,10 @@ public: std::unique_ptr<egammaMonitoring::IHistograms> truthPhotonUnconvRecoConv2SiTRT; std::unique_ptr<egammaMonitoring::IHistograms> truthPhotonUnconvRecoUnconv; - std::unique_ptr<egammaMonitoring::IHistograms> recoPhotonUnconvLooseLH; - std::unique_ptr<egammaMonitoring::IHistograms> recoPhotonUnconvTightLH; - std::unique_ptr<egammaMonitoring::IHistograms> recoPhotonConvLooseLH; - std::unique_ptr<egammaMonitoring::IHistograms> recoPhotonConvTightLH; + std::unique_ptr<egammaMonitoring::IHistograms> recoPhotonUnconvLoose; + std::unique_ptr<egammaMonitoring::IHistograms> recoPhotonUnconvTight; + std::unique_ptr<egammaMonitoring::IHistograms> recoPhotonConvLoose; + std::unique_ptr<egammaMonitoring::IHistograms> recoPhotonConvTight; std::unique_ptr<egammaMonitoring::IHistograms> recoPhotonUnconvIsoFixedCutTight; std::unique_ptr<egammaMonitoring::IHistograms> @@ -155,12 +156,18 @@ private: /// Selector tools // electron ID - ToolHandle<IAsgElectronLikelihoodTool> m_LooseLH - { this, "LooseLH", "", "" }; - ToolHandle<IAsgElectronLikelihoodTool> m_MediumLH - { this, "MediumLH", "", "" }; - ToolHandle<IAsgElectronLikelihoodTool> m_TightLH - { this, "TightLH", "", "" }; + ToolHandle<IAsgElectronLikelihoodTool> m_Loose_Ele + { this, "Loose_Ele", "", "" }; + ToolHandle<IAsgElectronLikelihoodTool> m_Medium_Ele + { this, "Medium_Ele", "", "" }; + ToolHandle<IAsgElectronLikelihoodTool> m_Tight_Ele + { this, "Tight_Ele", "", "" }; + ToolHandle<IAsgElectronLikelihoodTool> m_Loose_FwdEle + { this, "Loose_FwdEle", "", "" }; + ToolHandle<IAsgElectronLikelihoodTool> m_Medium_FwdEle + { this, "Medium_FwdEle", "", "" }; + ToolHandle<IAsgElectronLikelihoodTool> m_Tight_FwdEle + { this, "Tight_FwdEle", "", "" }; // photon ID ToolHandle<IAsgPhotonIsEMSelector> m_Loose_Photon diff --git a/Reconstruction/egamma/egammaValidation/src/IsolationHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/IsolationHistograms.cxx index 52e808b2d79d..1f260386717f 100644 --- a/Reconstruction/egamma/egammaValidation/src/IsolationHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/IsolationHistograms.cxx @@ -15,16 +15,18 @@ using namespace egammaMonitoring; StatusCode IsolationHistograms::initializePlots(bool do_var_histos) { - histoMap["ptCone20"] = new TH1D(Form("%s_%s",m_name.c_str(),"ptCone20" ), ";p_{T}^{cone20}; Events / 0.25 GeV", 60, 0., 15.); - histoMap["ptCone30"] = new TH1D(Form("%s_%s",m_name.c_str(),"ptCone30" ), ";p_{T}^{cone30}; Events / 0.25 GeV", 60, 0., 15.); + const char* fN = m_name.c_str(); + + histoMap["ptCone20"] = new TH1D(Form("%s_ptCone20",fN), ";p_{T}^{cone20} [GeV]; Events / 0.25 GeV", 60, 0., 15.); + histoMap["ptCone30"] = new TH1D(Form("%s_ptCone30",fN), ";p_{T}^{cone30} [GeV]; Events / 0.25 GeV", 60, 0., 15.); if (do_var_histos) { - histoMap["ptVarCone20"] = new TH1D(Form("%s_%s",m_name.c_str(),"ptVarCone20" ), ";p_{T}^{varCone20}; Events / 0.25 GeV", 60, 0., 15.); - histoMap["ptVarCone30"] = new TH1D(Form("%s_%s",m_name.c_str(),"ptVarCone30" ), ";p_{T}^{varCone30}; Events / 0.25 GeV", 60, 0., 15.); + histoMap["ptVarCone20"] = new TH1D(Form("%s_ptVarCone20",fN), ";p_{T}^{varCone20} [GeV]; Events / 0.25 GeV", 60, 0., 15.); + histoMap["ptVarCone30"] = new TH1D(Form("%s_ptVarCone30",fN), ";p_{T}^{varCone30} [GeV]; Events / 0.25 GeV", 60, 0., 15.); } - histoMap["topoEtCone20"] = new TH1D(Form("%s_%s",m_name.c_str(),"topoEtCone20" ), ";E_{T}^{topoCone20}; Events / 0.8 GeV", 60, -20., 30.); - histoMap["topoEtCone30"] = new TH1D(Form("%s_%s",m_name.c_str(),"topoEtCone30" ), ";E_{T}^{topoCone30}; Events / 0.8 GeV", 60, -20., 30.); - histoMap["topoEtCone40"] = new TH1D(Form("%s_%s",m_name.c_str(),"topoEtCone40" ), ";E_{T}^{topoCone40}; Events / 0.8 GeV", 60, -20., 30.); + histoMap["topoEtCone20"] = new TH1D(Form("%s_topoEtCone20",fN), ";E_{T}^{topoCone20} [GeV]; Events / 0.8 GeV", 60, -20., 30.); + histoMap["topoEtCone30"] = new TH1D(Form("%s_topoEtCone30",fN), ";E_{T}^{topoCone30} [GeV]; Events / 0.8 GeV", 60, -20., 30.); + histoMap["topoEtCone40"] = new TH1D(Form("%s_topoEtCone40",fN), ";E_{T}^{topoCone40} [GeV]; Events / 0.8 GeV", 60, -20., 30.); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"ptCone20", histoMap["ptCone20"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"ptCone30", histoMap["ptCone30"])); diff --git a/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.cxx index 530f06bdfd04..f18188a52ee9 100644 --- a/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/ParticleHistograms.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "ParticleHistograms.h" @@ -12,15 +12,16 @@ namespace egammaMonitoring { StatusCode ParticleHistograms::initializePlots() { - 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()); + const char* fN = m_name.c_str(); - 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"] = new TH1D(Form("%s_pT",fN) , ";p_{T} [GeV];Events", 40, 0, 200); + histoMap["eta"] = new TH1D(Form("%s_eta",fN), ";#eta;Events" , 90, -4.5, 4.5); + histoMap["phi"] = new TH1D(Form("%s_phi",fN), ";#phi;Events" , 20, -TMath::Pi(), TMath::Pi()); + histoMap["eta_15GeV"] = new TH1D(Form("%s_eta_15GeV",fN), ";#eta;Events", 90, -4.5, 4.5); + histoMap["phi_15GeV"] = new TH1D(Form("%s_phi_15GeV",fN), ";#phi;Events", 20, -TMath::Pi(), TMath::Pi()); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"pT", histoMap["pT"])); + 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"])); @@ -28,9 +29,9 @@ namespace egammaMonitoring { 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"])); + histoMap["pT_eta4"] = new TH1D(Form("%s_pT_eta4",fN) , ";p_{T} [GeV];Events",40, 0, 200); + histoMap["phi_eta4"] = new TH1D(Form("%s_phi_eta4",fN), ";#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"])); } @@ -41,7 +42,6 @@ namespace egammaMonitoring { ParticleHistograms::fill(egamma,0.); } - void ParticleHistograms::fill(const xAOD::IParticle& egamma, float /*mu*/) { double pT = egamma.pt()*1e-3; diff --git a/Reconstruction/egamma/egammaValidation/src/RecoClusterHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/RecoClusterHistograms.cxx index 6a88652f4760..386c5e87fcee 100644 --- a/Reconstruction/egamma/egammaValidation/src/RecoClusterHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/RecoClusterHistograms.cxx @@ -17,16 +17,18 @@ using namespace egammaMonitoring; StatusCode RecoClusterHistograms::initializePlots() { + const char* fN = m_name.c_str(); + for (int il = 0; il < 4; il++) { TString hN = Form("hNcellsvseteta_Lr%i",il); - m_histo3DMap[hN.Data()] = new TH3D(Form("%s_%s",m_name.c_str(),hN.Data()),"",20,0,200,25,0,2.5,60,0,60); + m_histo3DMap[hN.Data()] = new TH3D(Form("%s_%s",fN,hN.Data()),"",20,0,200,25,0,2.5,60,0,60); ATH_CHECK(m_rootHistSvc->regHist(m_folder+hN.Data(), m_histo3DMap[hN.Data()])); hN = Form("hEvseteta_Lr%i",il); - m_histo3DMap[hN.Data()] = new TH3D(Form("%s_%s",m_name.c_str(),hN.Data()),"",20,0,200,25,0,2.5,50,0,200); + m_histo3DMap[hN.Data()] = new TH3D(Form("%s_%s",fN,hN.Data()),"",20,0,200,25,0,2.5,50,0,200); ATH_CHECK(m_rootHistSvc->regHist(m_folder+hN.Data(), m_histo3DMap[hN.Data()])); } TString hN = "hNToposvseteta"; - m_histo3DMap[hN.Data()] = new TH3D(Form("%s_%s",m_name.c_str(),hN.Data()),"",20,0,200,25,0,2.5,10,0,10); + m_histo3DMap[hN.Data()] = new TH3D(Form("%s_%s",fN,hN.Data()),"",20,0,200,25,0,2.5,10,0,10); ATH_CHECK(m_rootHistSvc->regHist(m_folder+hN.Data(), m_histo3DMap[hN.Data()])); return StatusCode::SUCCESS; diff --git a/Reconstruction/egamma/egammaValidation/src/RecoElectronHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/RecoElectronHistograms.cxx index efbc701e6add..4c41846ea426 100644 --- a/Reconstruction/egamma/egammaValidation/src/RecoElectronHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/RecoElectronHistograms.cxx @@ -15,21 +15,21 @@ StatusCode RecoElectronHistograms::initializePlots() { ATH_CHECK(ParticleHistograms::initializePlots()); + const char* fN = m_name.c_str(); + if (!m_isData) { - histoMap["truthType"] = new TH1D(Form("%s_%s",m_name.c_str(),"truthType"),";truth type; Events",41,-1,40); - histoMap["truthOrigin"] = new TH1D(Form("%s_%s",m_name.c_str(),"truthOrigin"),";truth origin; Events",51,-1,50); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"truthType", histoMap["truthType"])); + histoMap["truthType"] = new TH1D(Form("%s_truthType",fN), ";truth type; Events", 41,-1,40); + histoMap["truthOrigin"] = new TH1D(Form("%s_truthOrigin",fN), ";truth origin; Events",51,-1,50); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"truthType", histoMap["truthType"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"truthOrigin", histoMap["truthOrigin"])); } - histo2DMap["eta_nTracks"] = - new TH2D(Form("%s_%s",m_name.c_str(),"eta_nTracks"), - ";#eta;n_{trk}; Events", 60, -4.5, 4.5, 10, 0,10); + histo2DMap["eta_nTracks"] = new TH2D(Form("%s_eta_nTracks",fN), + ";#eta;n_{trk}; Events", 90, -4.5, 4.5, 10, 0,10); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eta_nTracks", histo2DMap["eta_nTracks"])); - histo3DMap["eteta_eop"] = - new TH3D(Form("%s_%s",m_name.c_str(),"eteta_eop"), - ";E_{T};#eta;E/p; Events", 20, 0, 200, 25, 0, 2.5, 250, 0.5,3.); + histo3DMap["eteta_eop"] = new TH3D(Form("%s_eteta_eop",fN), + ";E_{T} [GeV];#eta;E/p; Events", 20, 0, 200, 25, 0, 2.5, 250, 0.5,3.); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eteta_eop", histo3DMap["eteta_eop"])); return StatusCode::SUCCESS; diff --git a/Reconstruction/egamma/egammaValidation/src/RecoPhotonHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/RecoPhotonHistograms.cxx index d7c78d2769fb..b503218c8e03 100644 --- a/Reconstruction/egamma/egammaValidation/src/RecoPhotonHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/RecoPhotonHistograms.cxx @@ -18,12 +18,14 @@ StatusCode RecoPhotonHistograms::initializePlots() { ATH_CHECK(ParticleHistograms::initializePlots()); - histoMap["convRadius"] = new TH1D(Form("%s_%s",m_name.c_str(),"convRadius"), ";Conversion Radius [mm]; Events", 14, m_cR_bins); - histoMap["truthType"] = new TH1D(Form("%s_%s",m_name.c_str(),"truthType"),";truth type; Events",41,-1,40); - histoMap["truthOrigin"] = new TH1D(Form("%s_%s",m_name.c_str(),"truthOrigin"),";truth origin; Events",51,-1,50); + const char* fN = m_name.c_str(); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"convRadius", histoMap["convRadius"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"truthType", histoMap["truthType"])); + histoMap["convRadius"] = new TH1D(Form("%s_convRadius",fN), ";Conversion Radius [mm]; Events", 14, m_cR_bins); + histoMap["truthType"] = new TH1D(Form("%s_truthType",fN), ";truth type; Events", 41,-1,40); + histoMap["truthOrigin"] = new TH1D(Form("%s_truthOrigin",fN), ";truth origin; Events",51,-1,50); + + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"convRadius", histoMap["convRadius"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"truthType", histoMap["truthType"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"truthOrigin", histoMap["truthOrigin"])); return StatusCode::SUCCESS; diff --git a/Reconstruction/egamma/egammaValidation/src/ShowerShapesHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/ShowerShapesHistograms.cxx index 418e7ad0c75d..98b86cf14b20 100644 --- a/Reconstruction/egamma/egammaValidation/src/ShowerShapesHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/ShowerShapesHistograms.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "ShowerShapesHistograms.h" @@ -15,23 +15,25 @@ using namespace egammaMonitoring; StatusCode ShowerShapesHistograms::initializePlots() { + + const char* fN = m_name.c_str(); - histoMap["hadleak"] = new TH1D(Form("%s_%s",m_name.c_str(),"hadleak"), ";E_{hadleak} ; Hadronic leakage Events" , 100, -0.07, 0.13 ); - histoMap["rhad"] = new TH1D(Form("%s_%s",m_name.c_str(),"rhad" ), ";R_{had}; Events" , 100, -0.07, 0.13 ); - histoMap["reta"] = new TH1D(Form("%s_%s",m_name.c_str(),"reta" ), ";R_{#eta}; R_{#eta} Events" , 355, 0. , 1.1005); - histoMap["rphi"] = new TH1D(Form("%s_%s",m_name.c_str(),"rphi" ), ";R_{#phi}; R_{#phi} Events" , 355, 0. , 1.1005); - histoMap["weta2"] = new TH1D(Form("%s_%s",m_name.c_str(),"weta2" ), ";W_{#etas2}; W_{#etas2} Events" , 100, 0. , 0.03 ); - histoMap["eratio"] = new TH1D(Form("%s_%s",m_name.c_str(),"eratio" ), ";E_{ratio}; E_{ratio} Events" , 100, 0. , 1.01 ); - histoMap["deltae"] = new TH1D(Form("%s_%s",m_name.c_str(),"deltae" ), ";#DeltaE [MeV]; #DeltaE Events" , 100, 0. , 500. ); - histoMap["f1"] = new TH1D(Form("%s_%s",m_name.c_str(),"f1" ), ";f_{1}; f_{1} Events" , 100, 0. , 1.0 ); - histoMap["fside"] = new TH1D(Form("%s_%s",m_name.c_str(),"fside" ), ";f_{side}; f_{side} Events" , 100, 0. , 2.0 ); - histoMap["wtots1"] = new TH1D(Form("%s_%s",m_name.c_str(),"wtots1" ), ";w_{s, tot}; w_{s, tot} Events" , 100, 0. , 10. ); - histoMap["ws3"] = new TH1D(Form("%s_%s",m_name.c_str(),"ws3" ), ";w_{s, 3}; w_{s, 3} Events" , 100, 0. , 1. ); - - histoMap["lateral"] = new TH1D(Form("%s_%s",m_name.c_str(),"lateral"), ";Lateral of seed; Events" , 50, 0. , 1. ); - histoMap["second_R"] = new TH1D(Form("%s_%s",m_name.c_str(),"second_R"), ";Second R; Events" , 150, 0. , 15000. ); - histoMap["EMFrac"] = new TH1D(Form("%s_%s",m_name.c_str(),"EMFrac" ), ";EMFrac; Events" , 51, 0. , 1.02 ); - histo2DMap["lateral_second_R_2D"] = new TH2D(Form("%s_%s",m_name.c_str(),"lateral_second_R_2D"), ";Lateral of seed; Second R", 50, 0, 1, 150,0.,15000.); + histoMap["hadleak"] = new TH1D(Form("%s_hadleak",fN), ";E_{hadleak}; Events" , 100, -0.07, 0.13 ); + histoMap["rhad"] = new TH1D(Form("%s_rhad",fN) , ";R_{had}; Events" , 100, -0.07, 0.13 ); + histoMap["reta"] = new TH1D(Form("%s_reta",fN) , ";R_{#eta}; Events" , 355, 0. , 1.1005); + histoMap["rphi"] = new TH1D(Form("%s_rphi",fN) , ";R_{#phi}; Events" , 355, 0. , 1.1005); + histoMap["weta2"] = new TH1D(Form("%s_weta2",fN) , ";W_{#etas2}; Events" , 100, 0. , 0.03 ); + histoMap["eratio"] = new TH1D(Form("%s_eratio",fN) , ";E_{ratio}; Events" , 101, 0. , 1.01 ); + histoMap["deltae"] = new TH1D(Form("%s_deltae",fN) , ";#DeltaE [MeV]; Events" , 100, 0. , 500. ); + histoMap["f1"] = new TH1D(Form("%s_f1",fN) , ";f_{1}; Events" , 100, 0. , 1.0 ); + histoMap["fside"] = new TH1D(Form("%s_fside",fN) , ";f_{side}; Events" , 100, 0. , 2.0 ); + histoMap["wtots1"] = new TH1D(Form("%s_wtots1",fN) , ";w_{s, tot}; Events" , 100, 0. , 10. ); + histoMap["ws3"] = new TH1D(Form("%s_ws3",fN) , ";w_{s, 3}; Events" , 100, 0. , 1. ); + + histoMap["lateral"] = new TH1D(Form("%s_lateral",fN), ";Lateral of seed; Events" , 50, 0. , 1. ); + histoMap["second_R"] = new TH1D(Form("%s_second_R",fN), ";Second R; Events" , 150, 0. , 15000. ); + histoMap["EMFrac"] = new TH1D(Form("%s_EMFrac",fN), ";EMFrac; Events" , 51, 0. , 1.02 ); + histo2DMap["lateral_second_R_2D"] = new TH2D(Form("%s_lateral_second_R_2D",fN), ";Lateral of seed; Second R", 50, 0, 1, 150,0.,15000.); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"lateral", histoMap["lateral"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"second_R", histoMap["second_R"])); @@ -115,18 +117,20 @@ void ShowerShapesHistograms::fill(const xAOD::Egamma& egamma) { histoMap["rphi"]->Fill(Rphi); if (egamma.showerShapeValue(shweta2, xAOD::EgammaParameters::weta2)) histoMap["weta2"]->Fill(shweta2); - if (egamma.showerShapeValue(Eratio, xAOD::EgammaParameters::Eratio)) - histoMap["eratio"]->Fill(Eratio); - if (egamma.showerShapeValue(DeltaE, xAOD::EgammaParameters::DeltaE)) - histoMap["deltae"]->Fill(DeltaE); if (egamma.showerShapeValue(frac_f1, xAOD::EgammaParameters::f1)) histoMap["f1"]->Fill(frac_f1); - if (egamma.showerShapeValue(shfside, xAOD::EgammaParameters::fracs1)) - histoMap["fside"]->Fill(shfside); - if (egamma.showerShapeValue(shwtots1, xAOD::EgammaParameters::wtots1)) - histoMap["wtots1"]->Fill(shwtots1); - if (egamma.showerShapeValue(shws3, xAOD::EgammaParameters::weta1)) - histoMap["ws3"]->Fill(shws3); - + // Only fill S1 variables if there some energy in S1 (to avoid under/overflows + if (frac_f1 != 0) { + if (egamma.showerShapeValue(Eratio, xAOD::EgammaParameters::Eratio)) + histoMap["eratio"]->Fill(Eratio); + if (egamma.showerShapeValue(DeltaE, xAOD::EgammaParameters::DeltaE)) + histoMap["deltae"]->Fill(DeltaE); + if (egamma.showerShapeValue(shfside, xAOD::EgammaParameters::fracs1)) + histoMap["fside"]->Fill(shfside); + if (egamma.showerShapeValue(shwtots1, xAOD::EgammaParameters::wtots1)) + histoMap["wtots1"]->Fill(shwtots1); + if (egamma.showerShapeValue(shws3, xAOD::EgammaParameters::weta1)) + histoMap["ws3"]->Fill(shws3); + } } } diff --git a/Reconstruction/egamma/egammaValidation/src/TrackHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/TrackHistograms.cxx index 7ae75bd0ce2b..c6361f4cd157 100644 --- a/Reconstruction/egamma/egammaValidation/src/TrackHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/TrackHistograms.cxx @@ -17,32 +17,34 @@ using xAOD::EgammaHelpers::summaryValueFloat; using xAOD::EgammaHelpers::summaryValueInt; StatusCode TrackHistograms::initializePlots() { + + const char* fN = m_name.c_str(); - histoMap["pT"] = new TH1D(Form("%s_%s",m_name.c_str(),"pT"), "Tracks ;p_{T} [GeV]", 100, 0., 100.); + histoMap["pT"] = new TH1D(Form("%s_pT",fN), ";p_{T} [GeV];Tracks", 100, 0., 100.); - histoMap["PrecisionHitFraction"] = new TH1D(Form("%s_%s",m_name.c_str(),"PrecisionHitFraction"), "Tracks ;Precision hit fraction", 20, 0., 1.); - histoMap["PrecisionHitFraction_lowmu"] = new TH1D(Form("%s_%s",m_name.c_str(),"PrecisionHitFraction_lowmu"), "Tracks ;Precision hit fraction", 20, 0., 1.); - histoMap["PrecisionHitFraction_highmu"] = new TH1D(Form("%s_%s",m_name.c_str(),"PrecisionHitFraction_highmu"), "Tracks ;Precision hit fraction", 20, 0., 1.); + histoMap["PrecisionHitFraction"] = new TH1D(Form("%s_PrecisionHitFraction",fN), ";Precision hit fraction;Tracks", 20, 0., 1.); + histoMap["PrecisionHitFraction_lowmu"] = new TH1D(Form("%s_PrecisionHitFraction_lowmu",fN), ";Precision hit fraction;Tracks", 20, 0., 1.); + histoMap["PrecisionHitFraction_highmu"] = new TH1D(Form("%s_PrecisionHitFraction_highmu",fN), ";Precision hit fraction;Tracks", 20, 0., 1.); - histoMap["eProbabilityHT"] = new TH1D(Form("%s_%s",m_name.c_str(),"eProbabilityHT"), "Tracks ;eProbabilityHT", 20, 0., 1.); - histoMap["eProbabilityHT_lowmu"] = new TH1D(Form("%s_%s",m_name.c_str(),"eProbabilityHT_lowmu"), "Tracks ;eProbabilityHT", 20, 0., 1.); - histoMap["eProbabilityHT_highmu"] = new TH1D(Form("%s_%s",m_name.c_str(),"eProbabilityHT_highmu"), "Tracks ;eProbabilityHT", 20, 0., 1.); + histoMap["eProbabilityHT"] = new TH1D(Form("%s_eProbabilityHT",fN), ";eProbabilityHT;Tracks", 20, 0., 1.); + histoMap["eProbabilityHT_lowmu"] = new TH1D(Form("%s_eProbabilityHT_lowmu",fN), ";eProbabilityHT;Tracks", 20, 0., 1.); + histoMap["eProbabilityHT_highmu"] = new TH1D(Form("%s_eProbabilityHT_highmu",fN), ";eProbabilityHT;Tracks", 20, 0., 1.); - profileMap["PrecisionHitFractionvsmu"] = new TProfile(Form("%s_%s",m_name.c_str(),"PrecisionHitFractionvsmu"), "Precision hit fraction;mu", 35, 0., 70., 0., 1.); - profileMap["eProbabilityHTvsmu"] = new TProfile(Form("%s_%s",m_name.c_str(),"eProbabilityHTvsmu"), "eProbabilityHT;mu", 35, 0., 70., 0., 1.); + profileMap["PrecisionHitFractionvsmu"] = new TProfile(Form("%s_PrecisionHitFractionvsmu",fN), ";mu;Precision hit fraction", 35, 0., 70., 0., 1.); + profileMap["eProbabilityHTvsmu"] = new TProfile(Form("%s_eProbabilityHTvsmu",fN), ";mu;eProbabilityHT", 35, 0., 70., 0., 1.); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"pT", histoMap["pT"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"PrecisionHitFraction", histoMap["PrecisionHitFraction"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"PrecisionHitFraction_lowmu", histoMap["PrecisionHitFraction_lowmu"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"PrecisionHitFraction", histoMap["PrecisionHitFraction"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"PrecisionHitFraction_lowmu", histoMap["PrecisionHitFraction_lowmu"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"PrecisionHitFraction_highmu", histoMap["PrecisionHitFraction_highmu"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eProbabilityHT", histoMap["eProbabilityHT"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eProbabilityHT_lowmu", histoMap["eProbabilityHT_lowmu"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eProbabilityHT", histoMap["eProbabilityHT"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eProbabilityHT_lowmu", histoMap["eProbabilityHT_lowmu"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eProbabilityHT_highmu", histoMap["eProbabilityHT_highmu"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"PrecisionHitFractionvsmu", profileMap["PrecisionHitFractionvsmu"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eProbabilityHTvsmu", profileMap["eProbabilityHTvsmu"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"eProbabilityHTvsmu", profileMap["eProbabilityHTvsmu"])); return StatusCode::SUCCESS; diff --git a/Reconstruction/egamma/egammaValidation/src/TruthElectronHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/TruthElectronHistograms.cxx index 276840f5ade3..775c2616fd2d 100644 --- a/Reconstruction/egamma/egammaValidation/src/TruthElectronHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/TruthElectronHistograms.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "TruthElectronHistograms.h" @@ -20,13 +20,15 @@ StatusCode TruthElectronHistograms::initializePlots() { StatusCode TruthElectronHistograms::initializePlots(bool reducedHistSet) { + const char* fN = m_name.c_str(); + if (!reducedHistSet) { - histoMap["deltaPhi2"] = new TH1D(Form("%s_%s",m_name.c_str(),"deltaPhi2"), ";deltaPhi2; Events", 40, -0.06, 0.06); - histoMap["deltaEta2"] = new TH1D(Form("%s_%s",m_name.c_str(),"deltaEta2"), ";deltaEta2; Events", 40, -0.04, 0.04); - histoMap["deltaPhiRescaled2"] = new TH1D(Form("%s_%s",m_name.c_str(),"deltaPhiRescaled2"), ";deltaPhiRescaled2; Events", 40, -0.04, 0.04); + histoMap["deltaPhi2"] = new TH1D(Form("%s_deltaPhi2",fN), ";deltaPhi2; Events", 40, -0.06, 0.06); + histoMap["deltaEta2"] = new TH1D(Form("%s_deltaEta2",fN), ";deltaEta2; Events", 40, -0.04, 0.04); + histoMap["deltaPhiRescaled2"] = new TH1D(Form("%s_deltaPhiRescaled2",fN), ";deltaPhiRescaled2; Events", 40, -0.04, 0.04); - histoMap["d0Oversigmad0"] = new TH1D(Form("%s_%s",m_name.c_str(),"d0Oversigmad0"), "; d0Oversigmad0; Events", 40, -10, 10); - histoMap["qOverp_resolution"] = new TH1D(Form("%s_%s",m_name.c_str(),"qOverp_resolution"), ";(q/P reco - q/P truth)/ q/p truth; Events", 60, -1, 1.5); + histoMap["d0Oversigmad0"] = new TH1D(Form("%s_d0Oversigmad0",fN), "; d0Oversigmad0; Events", 40, -10, 10); + histoMap["qOverp_resolution"] = new TH1D(Form("%s_qOverp_resolution",fN), ";(q/P reco - q/P truth)/ q/p truth; Events", 60, -1, 1.5); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"deltaPhi2", histoMap["deltaPhi2"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"deltaEta2", histoMap["deltaEta2"])); @@ -36,21 +38,16 @@ StatusCode TruthElectronHistograms::initializePlots(bool reducedHistSet) { // 2D only for truthPromptElectronWithRecoTrack (temporary) if (m_name == "truthPromptElectronWithRecoTrack") { - histoMap2D["eta_deltaPhi2"] = - new TH2D(Form("%s_%s",m_name.c_str(),"eta_deltaPhi2"), - ";#eta;#Delta#phi_{2}; Events", 60, -4.5, 4.5, 40, -0.06, 0.06); - histoMap2D["eta_deltaEta2"] = - new TH2D(Form("%s_%s",m_name.c_str(),"eta_deltaEta2"), - ";#eta;#Delta#eta_{2}; Events", 60, -4.5, 4.5, 40, -0.06, 0.06); - histoMap2D["eta_deltaPhiRescaled2"] = - new TH2D(Form("%s_%s",m_name.c_str(),"eta_deltaPhiRescaled2"), - ";#eta;#Delta#phi_{2}^{Rescaled}; Events", 60, -4.5, 4.5, 40, -0.06, 0.06); - histoMap2D["eta_d0Oversigmad0"] = - new TH2D(Form("%s_%s",m_name.c_str(),"eta_d0Oversigmad0"), - ";#eta;d_{0}/#sigma_{d_{0}}; Events", 60, -4.5, 4.5, 40, -10, 10); - histoMap2D["eta_qOverp_resolution"] = - new TH2D(Form("%s_%s",m_name.c_str(),"eta_qOverp_resolution"), - ";#eta;(q/P_{reco})/(q/P_{truth}) -1; Events", 60, -4.5, 4.5, 60, -1, 1.5); + histoMap2D["eta_deltaPhi2"] = new TH2D(Form("%s_eta_deltaPhi2",fN), + ";#eta;#Delta#phi_{2}; Events", 90, -4.5, 4.5, 40, -0.06, 0.06); + histoMap2D["eta_deltaEta2"] = new TH2D(Form("%s_eta_deltaEta2",fN), + ";#eta;#Delta#eta_{2}; Events", 90, -4.5, 4.5, 40, -0.06, 0.06); + histoMap2D["eta_deltaPhiRescaled2"] = new TH2D(Form("%s_eta_deltaPhiRescaled2",fN), + ";#eta;#Delta#phi_{2}^{Rescaled}; Events", 90, -4.5, 4.5, 40, -0.06, 0.06); + histoMap2D["eta_d0Oversigmad0"] = new TH2D(Form("%s_eta_d0Oversigmad0",fN), + ";#eta;d_{0}/#sigma_{d_{0}}; Events", 90, -4.5, 4.5, 40, -10, 10); + histoMap2D["eta_qOverp_resolution"] = new TH2D(Form("%s_eta_qOverp_resolution",fN), + ";#eta;(q/P_{reco})/(q/P_{truth}) -1; Events", 90, -4.5, 4.5, 60, -1, 1.5); for (const auto& e : histoMap2D) { ATH_CHECK(m_rootHistSvc->regHist(m_folder+e.first, e.second)); diff --git a/Reconstruction/egamma/egammaValidation/src/TruthPhotonHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/TruthPhotonHistograms.cxx index 820daeb25b71..4c0d932d0c33 100644 --- a/Reconstruction/egamma/egammaValidation/src/TruthPhotonHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/TruthPhotonHistograms.cxx @@ -22,23 +22,26 @@ StatusCode TruthPhotonHistograms::initializePlots() { ATH_CHECK(ParticleHistograms::initializePlots()); - histoMap["convRadius"] = new TH1D(Form("%s_%s",m_name.c_str(),"convRadius"), ";Conversion Radius [mm]; Conversion Radius Events", 14, m_cR_bins); - histoMap["convRadius_15GeV"] = new TH1D(Form("%s_%s",m_name.c_str(),"convRadius_15GeV"), ";Conversion Radius [mm]; Conversion Radius Events", 14, m_cR_bins); - histoMap["convRadiusTrueVsReco"] = new TH1D(Form("%s_%s",m_name.c_str(),"convRadiusTrueVsReco"), ";R^{reco}_{conv. vtx} - R^{true}_{conv. vtx} [mm]; Events", 100, -200, 200); + const char* fN = m_name.c_str(); - histoMap["pileup"] = new TH1D(Form("%s_%s",m_name.c_str(),"pileup"), ";mu; mu Events", 35, 0., 70.); - histoMap["pileup_15GeV"] = new TH1D(Form("%s_%s",m_name.c_str(),"pileup_15GeV"), ";mu; mu Events", 35, 0., 70.); - histoMap["onebin"] = new TH1D(Form("%s_%s",m_name.c_str(),"onebin"), "; ; Events", 1, 0., 1.); - histoMap["onebin_15GeV"] = new TH1D(Form("%s_%s",m_name.c_str(),"onebin_15GeV"), "; ; Events", 1, 0., 1.); + histoMap["convRadius_all"] = new TH1D(Form("%s_convRadius_all",fN), ";Conversion Radius [mm]; Conversion Radius Events", 200, 0, 2000); + histoMap["convRadius"] = new TH1D(Form("%s_convRadius",fN), ";Conversion Radius [mm]; Conversion Radius Events", 14, m_cR_bins); + histoMap["convRadius_15GeV"] = new TH1D(Form("%s_convRadius_15GeV",fN), ";Conversion Radius [mm]; Conversion Radius Events", 14, m_cR_bins); + histoMap["convRadiusTrueVsReco"] = new TH1D(Form("%s_convRadiusTrueVsReco",fN), ";R^{reco}_{conv. vtx} - R^{true}_{conv. vtx} [mm]; Events", 100, -200, 200); - histoMap["resolution_e"] = new TH1D(Form("%s_%s", m_name.c_str(), "resolution_e"), "; E_{reco} - E_{true} / E_{truth}; Events", 40, -0.2, 0.2); - histoMap["resolution_pT"] = new TH1D(Form("%s_%s", m_name.c_str(), "resolution_pT"), "; p_{T}_{reco} - p_{T}_{true} / p_{T}_{truth}; Events", 40, -0.2, 0.2); - histoMap["resolution_eta"] = new TH1D(Form("%s_%s", m_name.c_str(), "resolution_eta"), "; #eta_{reco} - #eta_{true}; Events", 20, -0.05, 0.05); - histoMap["resolution_phi"] = new TH1D(Form("%s_%s", m_name.c_str(), "resolution_phi"), "; #phi_{reco} - #phi_{true}; Events", 20, -0.05, 0.05); + histoMap["pileup"] = new TH1D(Form("%s_pileup",fN), ";mu; mu Events", 35, 0., 70.); + histoMap["pileup_15GeV"] = new TH1D(Form("%s_pileup_15GeV",fN), ";mu; mu Events", 35, 0., 70.); + histoMap["onebin"] = new TH1D(Form("%s_onebin",fN), "; ; Events", 1, 0., 1.); + histoMap["onebin_15GeV"] = new TH1D(Form("%s_onebin_15GeV",fN), "; ; Events", 1, 0., 1.); - histo2DMap["resolution_e_vs_pT"] = new TH2D(Form("%s_%s",m_name.c_str(),"resolution_e_vs_pT"), ";p_{T};E_{reco} - E_{true} / E_{truth}", 40, 0, 200, 160, -0.2, 0.2); - histo2DMap["resolution_e_vs_eta"] = new TH2D(Form("%s_%s",m_name.c_str(),"resolution_e_vs_eta"), ";#eta;E_{reco} - E_{true} / E_{truth}", 20, 0, 3, 160, -0.2, 0.2); + histoMap["resolution_e"] = new TH1D(Form("%s_resolution_e",fN), "; E_{reco} / E_{true} - 1; Events", 40, -0.2, 0.2); + histoMap["resolution_eta"] = new TH1D(Form("%s_resolution_eta",fN), "; #eta_{reco} - #eta_{true}; Events", 20, -0.05, 0.05); + histoMap["resolution_phi"] = new TH1D(Form("%s_resolution_phi",fN), "; #phi_{reco} - #phi_{true}; Events", 20, -0.05, 0.05); + histo2DMap["resolution_e_vs_pT"] = new TH2D(Form("%s_resolution_e_vs_pT",fN), ";p_{T} [GeV];E_{reco} / E_{true} - 1", 40, 0, 200, 160, -0.2, 0.2); + histo2DMap["resolution_e_vs_eta"] = new TH2D(Form("%s_resolution_e_vs_eta",fN), ";|#eta|;E_{reco} / E_{true} - 1", 25, 0, 2.5, 160, -0.2, 0.2); + + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"convRadius_all", histoMap["convRadius_all"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"convRadius", histoMap["convRadius"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"convRadius_15GeV", histoMap["convRadius_15GeV"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"convRadiusTrueVsReco", histoMap["convRadiusTrueVsReco"])); @@ -49,7 +52,6 @@ StatusCode TruthPhotonHistograms::initializePlots() { ATH_CHECK(m_rootHistSvc->regHist(m_folder+"onebin_15GeV", histoMap["onebin_15GeV"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"resolution_e", histoMap["resolution_e"])); - ATH_CHECK(m_rootHistSvc->regHist(m_folder+"resolution_pT", histoMap["resolution_pT"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"resolution_eta", histoMap["resolution_eta"])); ATH_CHECK(m_rootHistSvc->regHist(m_folder+"resolution_phi", histoMap["resolution_phi"])); @@ -66,27 +68,20 @@ void TruthPhotonHistograms::fill(const xAOD::IParticle& phrec) { void TruthPhotonHistograms::fill(const xAOD::IParticle& phrec, float mu) { - float trueR = -999; - float res_e = -999; - float res_pT = -999; - float res_eta = -999; - float res_phi = -999; - float recoR = -999; - ParticleHistograms::fill(phrec); const xAOD::TruthParticle *truth = xAOD::TruthHelpers::getTruthParticle(phrec); + float trueR = -999; if (truth) { if (truth->pdgId() == 22 && truth->hasDecayVtx()) { - float x = truth->decayVtx()->x(); - float y = truth->decayVtx()->y(); - trueR = std::sqrt( x*x + y*y ); + trueR = truth->decayVtx()->perp(); } } + histoMap["convRadius_all"]->Fill(trueR); histoMap["convRadius"]->Fill(trueR); histoMap["pileup"]->Fill(mu); histoMap["onebin"]->Fill(0.5); @@ -97,31 +92,31 @@ void TruthPhotonHistograms::fill(const xAOD::IParticle& phrec, float mu) { histoMap["onebin_15GeV"]->Fill(0.5); } - // access reco photon from the xAOD::TruthParticle (can't use the IParticle* here) const auto *truthParticle = dynamic_cast<const xAOD::TruthParticle*>(&phrec); if (truthParticle) { const xAOD::Photon *photon = xAOD::EgammaHelpers::getRecoPhoton(truthParticle); if (photon) { - res_e = (photon->e() - truth->e())/truth->e(); - res_pT = (photon->pt() - truth->pt())/truth->pt(); - res_eta = photon->eta() - truth->eta(); - res_phi = photon->phi() - truth->phi(); - recoR = xAOD::EgammaHelpers::conversionRadius(photon); + float res_e = photon->e()/truth->e() - 1.; + float res_eta = photon->eta() - truth->eta(); + float res_phi = photon->phi() - truth->phi(); + float recoR = xAOD::EgammaHelpers::conversionRadius(photon); - } - } + // Resolution histograms only make sense if there was a reco particle ! + // And for resolution on R, only if true conv, reco conv + if (recoR < 1000 && trueR > 0) + histoMap["convRadiusTrueVsReco"]->Fill(recoR - trueR); - histoMap["convRadiusTrueVsReco"]->Fill(recoR - trueR); + histoMap["resolution_e"]->Fill(res_e); + histoMap["resolution_eta"]->Fill(res_eta); + histoMap["resolution_phi"]->Fill(res_phi); - histoMap["resolution_e"]->Fill(res_e); - histoMap["resolution_pT"]->Fill(res_pT); - histoMap["resolution_eta"]->Fill(res_eta); - histoMap["resolution_phi"]->Fill(res_phi); + histo2DMap["resolution_e_vs_pT"]->Fill(phrec.pt()/1000., res_e); + histo2DMap["resolution_e_vs_eta"]->Fill(std::abs(phrec.eta()), res_e); - histo2DMap["resolution_e_vs_pT"]->Fill(phrec.pt()/1000., res_e); - histo2DMap["resolution_e_vs_eta"]->Fill(std::abs(phrec.eta()), res_e); + } + } } // fill diff --git a/Reconstruction/egamma/egammaValidation/test/test_electron_fwd_Run4.sh b/Reconstruction/egamma/egammaValidation/test/test_electron_fwd_Run4.sh index 7305505b1043..e4e5b0383d77 100755 --- a/Reconstruction/egamma/egammaValidation/test/test_electron_fwd_Run4.sh +++ b/Reconstruction/egamma/egammaValidation/test/test_electron_fwd_Run4.sh @@ -49,7 +49,7 @@ case $ArtProcess in echo "art-result: $? final_comparison" ## dcube not so relevant for the time being : the refs are not target or best achieved, there are from main, nightly 28/07/23 - $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py -p -x dcube -c /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/egammaValidation/DCube_Config/electron.xml -r /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/egammaValidation/Nightly_Files/ref_main/Nightly-monitoring_electron_fwd_Run4.hist.root Nightly-monitoring.hist.root + $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py -p -x dcube -c /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/egammaValidation/DCube_Config/fwd_electron.xml -r /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/egammaValidation/Nightly_Files/ref_main/Nightly-monitoring_electron_fwd_Run4.hist.root Nightly-monitoring.hist.root #echo "art-result: $? plot" ;; -- GitLab