Skip to content
Snippets Groups Projects
Commit 7090c251 authored by John Kenneth Anders's avatar John Kenneth Anders
Browse files

Merge branch 'egamma-art-new-features-21.0' into '21.0'

Egamma ART: Adding cluster plots and modifying plotting macro

See merge request atlas/athena!21766
parents e6195986 eab35641
No related merge requests found
#!/usr/bin/env python
#
# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration.
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.
#
import sys
import os
from ROOT import gDirectory, gROOT, gStyle, kTRUE, kFALSE, \
TCanvas, TFile, TH1, \
TH1D, TLegend, TPad, kBlack, kBlue, kRed, kGreen, kOrange, kCyan, kPink
#Import the ROOT libraries
from ROOT import gDirectory, gROOT, gStyle, kTRUE, TCanvas, TFile, TFileIter, TH1, TH1D, TLegend, TPad
# gROOT.SetBatch(kTRUE)
gStyle.SetOptStat(0)
cluster_list = [
{'name': 'clusterAll', 'title': 'Clusters - Inclusive'},
{'name': 'cluster10GeV', 'title': 'Clusters - 10 GeV'},
{'name': 'clusterPromptAll', 'title': 'Clusters from Prompt - Inclusive'},
{'name': 'clusterPrompt10GeV', 'title': 'Clusters from Prompt - 10 GeV'},
]
electron_comparison_list = [
{'name': 'showerShapesAll', 'title': 'Shower Shape - Inclusive'},
{'name': 'showerShapes10GeV', 'title': 'Shower Shape - 10 GeV'},
{'name': 'isolationAll', 'title': 'Isolation'},
{'name': 'recoElectronAll', 'title': 'Reconstructed Electron'},
{'name': 'truthRecoElectronLooseLH', 'title': 'Reconstructed Electron LooseLH'},
{'name': 'truthRecoElectronMediumLH', 'title': 'Reconstructed Electron MediumLH'},
{'name': 'truthRecoElectronTightLH', 'title': 'Reconstructed Electron TightLH'},
{'name': 'truthElectronAll', 'title': 'True Electron'},
{'name': 'truthPromptElectronAll', 'title': 'True Prompt Electron'},
{'name': 'truthElectronRecoElectronAll', 'title': 'True Electron Reconstructed as Electron'},
{'name': 'truthPromptElectronWithTrack', 'title': 'True Prompt Electron with Track'},
{'name': 'truthPromptElectronWithGSFTrack', 'title': 'True Prompt Electron with GSFTrack'},
{'name': 'truthPromptElectronWithReco', 'title': 'True Prompt Electron with Reco Electron'},
{'name': 'recoElectronIsoFixedCutTight', 'title': 'Reconstructed Electron FixedCutTight'},
{'name': 'recoElectronIsoFixedCutTightTrackOnly', 'title': 'Reconstructed Electron FixedCutTightTrackOnly'},
{'name': 'recoElectronIsoFixedCutLoose', 'title': 'Reconstructed Electron FixedCutLoose'},
{'name': 'trackingEfficiency', 'title': 'Tracking Efficiency'},
{'name': 'GSFEfficiency', 'title': 'GSF Efficiency'},
{'name': 'matchingEfficiency', 'title': 'Matching Efficiency'},
{'name': 'reconstructionEfficiency', 'title': 'Reconstruction Efficiency'},
{'name': 'recoElectronLooseLHEfficiency', 'title': 'Reconstructed Electron LooseLH Efficiency'},
{'name': 'recoElectronMediumLHEfficiency', 'title': 'Reconstructed Electron MediumLH Efficiency'},
{'name': 'recoElectronTightLHEfficiency', 'title': 'Reconstructed Electron TightLH Efficiency'},
{'name': 'recoElectronIsoFixedCutTightEfficiency', 'title': 'Reconstructed Electron FixedCutTight Efficiency'},
{'name': 'recoElectronIsoFixedCutTightTrackOnlyEfficiency', 'title': 'Reconstructed Electron FixedCutTighTrackOnly Efficiency'},
{'name': 'recoElectronIsoFixedCutLooseEfficiency', 'title': 'Reconstructed Electron FixedCutLoose Efficiency'},
]
photon_comparison_list = [
{'name': 'recoPhotonAll', 'title': 'Reconstructed Photon'},
{'name': 'truthPhotonRecoPhoton', 'title': 'True photon reconstructed as photon'},
{'name': 'truthConvPhoton', 'title': 'True converted photon'},
{'name': 'truthConvRecoConv', 'title': 'True conversion reconstructed as converted photon'},
{'name': 'truthConvRecoConv1Si', 'title': 'True conversion reconstructed as 1 Si conv'},
{'name': 'truthConvRecoConv1TRT', 'title': 'True conversion reconstructed as 1 TRT conv'},
{'name': 'truthConvRecoConv2Si', 'title': 'True conversion reconstructed as Si-Si conv'},
{'name': 'truthConvRecoConv2TRT', 'title': 'True conversion reconstructed as TRT-TRT conv'},
{'name': 'truthConvRecoConv2SiTRT', 'title': 'True conversion reconstructed as Si-TRT conv'},
{'name': 'truthConvRecoUnconv', 'title': 'True conversion reconstructed as unconverted photon'},
{'name': 'truthUnconvPhoton', 'title': 'True unconverted photon'},
{'name': 'truthUnconvRecoConv', 'title': 'True unconverted reconstructed as conv photon'},
{'name': 'truthUnconvRecoUnconv', 'title': 'True unconverted reconstructed as unconverted photon'},
{'name': 'showerShapesAll', 'title': 'Shower Shape - Inclusive'},
{'name': 'showerShapes10GeV', 'title': 'Shower Shape - 10 GeV'},
{'name': 'isolationAll', 'title': 'Isolation'},
{'name': 'recoPhotonUnconvIsoFixedCutTight', 'title': 'FixedCutTight Unconverted Photon'},
{'name': 'recoPhotonUnconvIsoFixedCutTightCaloOnly', 'title': 'FixedCutTightCaloOnly Unconverted Photon'},
{'name': 'recoPhotonUnconvIsoFixedCutLoose', 'title': 'FixedCutLoose Unconverted Photon'},
{'name': 'recoPhotonConvIsoFixedCutTight', 'title': 'FixedCutTight Converted Photon'},
{'name': 'recoPhotonConvIsoFixedCutTightCaloOnly', 'title': 'FixedCutTightCaloOnly Converted Photon'},
{'name': 'recoPhotonConvIsoFixedCutLoose', 'title': 'FixedCutLoose Converted Photon'},
{'name': 'truthPhotonUnconvRecoUnconvEfficiency', 'title': 'True Conv #rightarrow Conv'},
{'name': 'truthPhotonRecoConvEfficiency', 'title': 'True Conv #rightarrow Conv'},
{'name': 'recoPhotonUnconvIsoFixedCutTightEfficiency', 'title': 'True Conv #rightarrow Conv'},
{'name': 'recoPhotonUnconvIsoFixedCutTightCaloOnlyEfficiency', 'title': 'True Conv #rightarrow Conv'},
{'name': 'recoPhotonUnconvIsoFixedCutLooseEfficiency', 'title': 'True Conv #rightarrow Conv'},
{'name': 'recoPhotonConvIsoFixedCutTightEfficiency', 'title': 'True Conv #rightarrow Conv'},
{'name': 'recoPhotonConvIsoFixedCutTightCaloOnlyEfficiency', 'title': 'True Conv #rightarrow Conv'},
{'name': 'recoPhotonConvIsoFixedCutLooseEfficiency', 'title': 'True Conv #rightarrow Conv'},
]
def GetKeyNames(f0, dir = ""):
f0.cd(dir)
photon_fraction_list = [
{'name': 'truthPhotonConvRecoConvEfficiency', 'color': kBlack, 'title': 'True Conv #rightarrow Conv'},
{'name': 'truthPhotonConvRecoConv1SiEfficiency', 'color': kBlue + 2, 'title': 'True Conv #rightarrow 1 Si Conv'},
{'name': 'truthPhotonConvRecoConv1TRTEfficiency', 'color': kRed + 2, 'title': 'True Conv #rightarrow 1 TRT Conv'},
{'name': 'truthPhotonConvRecoConv2SiEfficiency', 'color': kGreen + 2, 'title': 'True Conv #rightarrow Si-Si Conv'},
{'name': 'truthPhotonConvRecoConv2TRTEfficiency', 'color': kOrange + 2,
'title': 'True Conv #rightarrow TRT-TRT Conv'},
{'name': 'truthPhotonConvRecoConv2SiTRTEfficiency', 'color': kCyan + 2,
'title': 'True Conv #rightarrow Si-TRT Conv'},
{'name': 'truthPhotonConvRecoUnconvEfficiency', 'color': kPink + 2, 'title': 'True Conv #rightarrow Unconv'}
]
def get_key_names(file, directory=""):
"""
Function to get the key elements name from a given directory
:param file: TFile
:param directory: Directory
:return:
"""
file.cd(directory)
return [key.GetName() for key in gDirectory.GetListOfKeys()]
f_baseline = TFile(sys.argv[1])
f_nightly = TFile(sys.argv[2])
particleType = sys.argv[3]
def make_comparison_plots(type, f_base, f_nightly, result_file):
"""
fO = TFile("BN_ComparisonPlots_"+particleType+".hist.root", "RECREATE")
:param type: electron or gamma
:param f_base: TFile with the baseline plots
:param f_nightly: TFile with the nightly plots
:param result_file: TFile with the resulting comparison
"""
comparison_list = photon_comparison_list if type == 'gamma' else electron_comparison_list
for folder in comparison_list:
for histo in get_key_names(f_nightly, folder['name']):
h_base = f_base.Get(folder['name'] + '/' + histo)
h_nightly = f_nightly.Get(folder['name'] + '/' + histo)
make_ratio_plot(h_base, h_nightly, folder['title'], result_file)
gROOT.SetBatch(kTRUE)
gStyle.SetOptStat(0)
for folder in GetKeyNames(f_nightly):
for histo in GetKeyNames(f_nightly,folder):
c1 = TCanvas()
mainPad = TPad("mainPad", "top", 0.00, 0.254758, 1.00, 1.00)
mainPad.SetLeftMargin(0.12)
mainPad.SetRightMargin(0.04)
mainPad.SetTopMargin(0.02)
mainPad.SetBottomMargin(0.02)
mainPad.SetTicky(0)
mainPad.SetTickx(0)
mainPad.Draw()
def make_profile_plots(f_base, f_nightly, result_file):
c1.Update()
ratioPad = TPad("ratioPad","bottom", 0.00, 0.00, 1.00, 0.25)
ratioPad.SetLeftMargin(0.12)
ratioPad.SetRightMargin(0.04)
ratioPad.SetTopMargin(0.03)
ratioPad.SetTickx(0)
ratioPad.SetBottomMargin(0.36)
ratioPad.Draw()
c1.Update()
for i, folder in enumerate(cluster_list):
for histo in get_key_names(f_nightly, folder['name']):
print(histo)
if '2D' not in histo:
continue
h_base = f_base.Get(folder['name'] + '/' + histo)
h_base_profile = h_base.ProfileX(histo+"_ProfileB")
h_nightly = f_nightly.Get(folder['name'] + '/' + histo)
h_nightly_profile = h_nightly.ProfileX(histo+"_Profile")
h_base_profile.SetDirectory(0)
h_nightly_profile.SetDirectory(0)
h_Base = f_baseline.Get(folder+'/'+histo)
h_Base.SetLineColor(4)
h_Base.SetLineWidth(2)
h_Base.GetXaxis().SetLabelOffset(1.20)
h_Base.GetYaxis().SetTitleSize(0.045)
h_Base.GetYaxis().SetTitleOffset(0.95)
h_Night = f_nightly.Get(folder+'/'+histo)
h_Night.SetMarkerStyle(8)
h_Night.SetMarkerSize(0.5)
mainPad.cd()
if not "2D" in histo: h_Base.Draw()
h_Night.Draw("same p" if not "2D" in histo else "colz")
make_ratio_plot(h_base_profile, h_nightly_profile, folder['title'], result_file, "Mean E_{raw}/E_{truth}")
c1.Update()
var_name = histo.split("_", 1)[1]
leg = TLegend(0.330986, 0.884087, 0.879499, 0.97053)
leg.SetHeader(folder+''+var_name, "C")
def make_photon_fraction_plot(f_base, f_nightly, result_file):
"""
This functions created a photon validation plot with efficiencies
and fractions
:param f_base TFile with the baseline histograms:
:param f_nightly TFile with the nightly histograms:
"""
for histo in get_key_names(f_nightly, 'truthPhotonConvRecoConvEfficiency'):
variable_name = histo.split("_", 1)[1]
c1 = TCanvas()
leg = TLegend(0.1, 0.75, 0.9, 0.9)
leg.SetNColumns(2)
leg.SetFillStyle(0)
leg.SetBorderSize(0)
if not "2D" in histo: leg.AddEntry(h_Base , "Baseline", "l")
leg.AddEntry(h_Night, "Nightly" , "p")
for i, folder in enumerate(photon_fraction_list):
baseline = f_base.Get(folder['name'] + '/' + folder['name'] + "_" + variable_name)
baseline.SetDirectory(0)
nightly = f_nightly.Get(folder['name'] + '/' + folder['name'] + "_" + variable_name)
nightly.SetDirectory(0)
baseline.GetYaxis().SetTitle("Efficiency and fraction")
baseline.SetLineColor(folder['color'])
nightly.SetLineColor(folder['color'])
baseline.SetMarkerColor(folder['color'])
nightly.SetMarkerColor(folder['color'])
baseline.SetMarkerStyle(1)
nightly.SetMarkerStyle(20)
leg.AddEntry(nightly, folder['title'], "p")
if i == 0:
baseline.Draw("hist ")
else:
baseline.Draw("same hist")
nightly.Draw("p same")
leg.Draw()
c1.Update()
ratioPad.cd()
if not "2D" in histo:
h1clone = h_Night.Clone()
h1clone.Sumw2()
h1clone.SetStats(0)
h1clone.Divide(h_Base)
h1clone.SetMarkerColor(1)
h1clone.SetMarkerStyle(20)
if "Efficiency" in folder:
h1clone.GetYaxis().SetRangeUser(h1clone.GetMinimum()*0.7,h1clone.GetMaximum()*1.3)
gStyle.SetOptStat(0)
h1clone.GetXaxis().SetLabelSize(0.10)
h1clone.GetXaxis().SetTitleSize(0.17)
h1clone.GetYaxis().SetLabelSize(0.10)
h1clone.GetYaxis().SetRangeUser(0.75, 1.25)
h1clone.GetYaxis().SetTitle("Ratio")
h1clone.GetYaxis().CenterTitle(1)
h1clone.GetYaxis().SetTitleSize(0.15)
h1clone.GetYaxis().SetTitleOffset(0.3)
h1clone.GetYaxis().SetNdivisions(505)
h1clone.Draw("p")
c1.Update()
c1.SaveAs(folder+'_'+var_name+".png" )
fO.cd()
c1.Write(folder+'_'+var_name)
fO.Write()
fO.Close()
result_file.cd()
c1.SaveAs("ConvertionEff_" + variable_name + ".png")
c1.Write("ConvertionEff_" + variable_name)
def make_ratio_plot(h_base, h_nightly, name, result_file, y_axis_label=None):
"""
:param h_base: Baseline histogram
:param h_nightly: Nightly histogram
:param name: Human-readable name of the histogram
:param result_file: TFile where the output is saved
:param y_axis_label: Y axis label is case is needed (fraction vs efficiency)
"""
histogram_name = h_nightly.GetName()
type_name = histogram_name.split("_", 1)[0]
variable_name = histogram_name.split("_", 1)[1]
c1 = TCanvas()
main_pad = TPad("main_pad", "top", 0.00, 0.25, 1.00, 1.00)
main_pad.SetLeftMargin(0.12)
main_pad.SetRightMargin(0.04)
main_pad.SetTopMargin(0.02)
main_pad.SetBottomMargin(0.02)
main_pad.SetTicky(0)
main_pad.SetTickx(0)
main_pad.Draw()
ratio_pad = TPad("ratio_pad", "bottom", 0.00, 0.00, 1.00, 0.25)
ratio_pad.SetLeftMargin(0.12)
ratio_pad.SetRightMargin(0.04)
ratio_pad.SetTopMargin(0.03)
ratio_pad.SetTickx(0)
ratio_pad.SetBottomMargin(0.36)
ratio_pad.Draw()
h_base.SetLineColor(4)
h_base.SetLineWidth(2)
h_nightly.SetMarkerStyle(8)
h_nightly.SetMarkerSize(0.5)
main_pad.cd()
if y_axis_label != None:
h_base.GetYaxis().SetTitle(y_axis_label)
h_base.GetYaxis().SetTitle(y_axis_label)
if not '2D' in variable_name or 'Profile' in variable_name:
h_base.Draw()
h_nightly.Draw("same p" if not '2D' in variable_name or 'Profile' in variable_name else 'colz')
c1.Update()
h_base.GetXaxis().SetLabelSize(0)
h_base.GetXaxis().SetLabelOffset(999)
h_base.SetMinimum(min(h_base.GetMinimum(), h_nightly.GetMinimum()) * 0.7)
h_base.SetMaximum(max(h_base.GetMaximum(), h_nightly.GetMaximum()) * 1.3)
leg = TLegend(0.4, 0.88, 0.9, 0.95)
leg.SetHeader(name, "C")
leg.SetNColumns(2)
leg.SetFillStyle(0)
leg.SetBorderSize(0)
leg.AddEntry(h_base, "Baseline", "l")
leg.AddEntry(h_nightly, "Nightly", "p")
leg.Draw()
c1.Update()
ratio_pad.cd()
h1clone = h_nightly.Clone()
h1clone.Sumw2()
h1clone.SetStats(0)
h1clone.Divide(h_base)
h1clone.SetMarkerColor(1)
h1clone.SetMarkerStyle(20)
if "Efficiency" in histogram_name:
h1clone.GetYaxis().SetRangeUser(h1clone.GetMinimum() * 0.7, h1clone.GetMaximum() * 1.3)
gStyle.SetOptStat(0)
h1clone.GetXaxis().SetLabelSize(0.10)
h1clone.GetXaxis().SetTitleSize(0.17)
h1clone.GetYaxis().SetLabelSize(0.10)
h1clone.GetYaxis().SetRangeUser(0.75, 1.25)
h1clone.GetYaxis().SetTitle("Ratio")
h1clone.GetYaxis().CenterTitle(1)
h1clone.GetYaxis().SetTitleSize(0.15)
h1clone.GetYaxis().SetTitleOffset(0.3)
h1clone.GetYaxis().SetNdivisions(505)
h1clone.Draw("hist")
c1.Update()
result_file.cd()
c1.SaveAs(type_name + '_' + variable_name + ".png")
c1.Write(type_name + '_' + variable_name)
if __name__ == '__main__':
gROOT.SetBatch(kTRUE)
gStyle.SetOptStat(0)
baseline_file = TFile(sys.argv[1])
nightly_file = TFile(sys.argv[2])
particle_type = sys.argv[3] # it can be 'electron' or 'gamma'
output_file = TFile("BN_ComparisonPlots_" + particle_type + ".hist.root", "RECREATE")
make_comparison_plots(particle_type, baseline_file, nightly_file, output_file)
make_profile_plots(baseline_file, nightly_file, output_file)
if particle_type == 'gamma':
make_photon_fraction_plot(baseline_file, nightly_file,output_file)
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "ClusterHistograms.h"
#include "AthenaBaseComps/AthCheckMacros.h"
#include "xAODEgamma/ElectronxAODHelpers.h"
using namespace egammaMonitoring;
StatusCode ClusterHistograms::initializePlots() {
histo2DMap["Eraw_Etruth_vs_Etruth_2D"] = (new TH2D(Form("%s_%s",m_name.c_str(),"Eraw_Etruth_vs_Etruth_2D"), ";E^{truth};E^{raw}/E^{truth}", 100,0.,200.,50, 0.5, 1.5));
histo2DMap["Eraw_Etruth_vs_eta_2D"] = (new TH2D(Form("%s_%s",m_name.c_str(),"Eraw_Etruth_vs_eta_2D"), ";truth #eta;E^{raw}/E^{truth}", 40, -3, 3, 50, 0.5, 1.5));
ATH_CHECK(m_rootHistSvc->regHist(m_folder+"Eraw_Etruth_vs_Etruth_2D", histo2DMap["Eraw_Etruth_vs_Etruth_2D"]));
ATH_CHECK(m_rootHistSvc->regHist(m_folder+"Eraw_Etruth_vs_eta_2D", histo2DMap["Eraw_Etruth_vs_eta_2D"]));
return StatusCode::SUCCESS;
} // initializePlots
void ClusterHistograms::fill(const xAOD::Egamma& egamma) {
const xAOD::CaloCluster *cluster = egamma.caloCluster();
const xAOD::TruthParticle *truth_egamma = xAOD::TruthHelpers::getTruthParticle(egamma);
if (truth_egamma) {
histo2DMap["Eraw_Etruth_vs_Etruth_2D"]->Fill(truth_egamma->e()/1000,cluster->rawE()/truth_egamma->e());
histo2DMap["Eraw_Etruth_vs_eta_2D"]->Fill(truth_egamma->eta(),cluster->rawE()/truth_egamma->e());
}
}
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef EGAMMAVALIDATION_CLUSTERSHISTOGRAMS_H
#define EGAMMAVALIDATION_CLUSTERSHISTOGRAMS_H
#include "GaudiKernel/ITHistSvc.h"
#include "xAODEgamma/Egamma.h"
#include "xAODEgamma/EgammaxAODHelpers.h"
#include "xAODTruth/TruthParticle.h"
#include "xAODTruth/xAODTruthHelpers.h"
#include "EgammaAnalysisInterfaces/IAsgElectronLikelihoodTool.h"
#include "TH1.h"
#include "TH2.h"
namespace egammaMonitoring{
class ClusterHistograms{
public:
// Histos
ClusterHistograms(std::string name,
std::string title,
std::string folder,
ITHistSvc * &rootHistSvc
) :
m_name(name),
m_title(title),
m_folder(folder),
m_rootHistSvc(rootHistSvc) {}
std::map<std::string, TH1D* > histoMap;
std::map<std::string, TH2D* > histo2DMap;
StatusCode initializePlots();
void fill(const xAOD::Egamma& egamma);
protected:
std::string m_name;
std::string m_title;
std::string m_folder;
ITHistSvc* m_rootHistSvc = nullptr;
};
}
#endif
......@@ -6,6 +6,7 @@
#include "EgammaMonitoring.h"
#include "MCTruthClassifier/IMCTruthClassifier.h"
#include "GaudiKernel/SystemOfUnits.h"
#include "IHistograms.h"
......@@ -34,11 +35,27 @@ StatusCode EgammaMonitoring::initialize() {
showerShapes10GeV = std::unique_ptr<egammaMonitoring::ShowerShapesHistograms>(new egammaMonitoring::ShowerShapesHistograms(
"showerShapes10GeV","Shower Shapes - 10 GeV", "/MONITORING/showerShapes10GeV/", rootHistSvc));
clusterAll = std::unique_ptr<egammaMonitoring::ClusterHistograms>(new egammaMonitoring::ClusterHistograms(
"clustersAll","Clusters", "/MONITORING/clusterAll/", rootHistSvc));
cluster10GeV= std::unique_ptr<egammaMonitoring::ClusterHistograms>(new egammaMonitoring::ClusterHistograms(
"clusters10GeV","Clusters - 10 GeV", "/MONITORING/cluster10GeV/", rootHistSvc));
clusterPromptAll = std::unique_ptr<egammaMonitoring::ClusterHistograms>(new egammaMonitoring::ClusterHistograms(
"clustersPromptAll","Clusters from Prompt", "/MONITORING/clusterPromptAll/", rootHistSvc));
clusterPrompt10GeV = std::unique_ptr<egammaMonitoring::ClusterHistograms>(new egammaMonitoring::ClusterHistograms(
"clustersPrompt10GeV","Clusters from Prompt - 10 GeV", "/MONITORING/clusterPrompt10GeV/", rootHistSvc));
isolationAll = std::unique_ptr<egammaMonitoring::IsolationHistograms>(new egammaMonitoring::IsolationHistograms(
"isolationAll","Isolation ", "/MONITORING/isolationAll/", rootHistSvc));
ATH_CHECK(showerShapesAll->initializePlots());
ATH_CHECK(showerShapes10GeV->initializePlots());
ATH_CHECK(clusterAll->initializePlots());
ATH_CHECK(cluster10GeV->initializePlots());
ATH_CHECK(clusterPromptAll->initializePlots());
ATH_CHECK(clusterPrompt10GeV->initializePlots());
ATH_CHECK(isolationAll->initializePlots());
if ("electron" == m_sampleType) {
......@@ -268,6 +285,25 @@ StatusCode EgammaMonitoring::execute() {
}
ATH_MSG_DEBUG( "------------ Truth Egamma Container ---------------" );
for (auto egtruth : *egTruthParticles) {
if (!egtruth) continue;
const xAOD::Electron *electron = xAOD::EgammaHelpers::getRecoElectron(egtruth);
if (!electron) continue;
clusterPromptAll->fill(*electron);
if (egtruth->pt() > 10*Gaudi::Units::GeV) {
clusterPrompt10GeV->fill(*electron);
}
}
ATH_MSG_DEBUG( "------------ Truth Particles Container ---------------" );
unsigned int promtpElectronTruthIndex = - 9;
for (auto truth : *truthParticles) {
......@@ -435,11 +471,16 @@ StatusCode EgammaMonitoring::execute() {
for (auto elrec : *RecoEl) {
if (!elrec) continue;
clusterAll->fill(*elrec);
if (elrec->pt() > 10*Gaudi::Units::GeV) {
cluster10GeV->fill(*elrec);
}
recoElectronAll->fill(*elrec);
showerShapesAll->fill(*elrec);
isolationAll->fill(*elrec);
if ((elrec->pt()) / 1000. > 10.) showerShapes10GeV->fill(*elrec);
if (elrec->pt() > 10*Gaudi::Units::GeV) {
showerShapes10GeV->fill(*elrec);
}
const xAOD::TruthParticle *truth = xAOD::TruthHelpers::getTruthParticle(*elrec);
if (!truth ) continue;
......@@ -506,9 +547,14 @@ StatusCode EgammaMonitoring::execute() {
recoPhotonAll->fill(*phrec);
isolationAll->fill(*phrec);
showerShapesAll->fill(*phrec);
if (phrec->pt()) showerShapes10GeV->fill(*phrec);
clusterAll->fill(*phrec);
if (phrec->pt() > 10*Gaudi::Units::GeV) {
cluster10GeV->fill(*phrec);
}
if (phrec->pt() > 10*Gaudi::Units::GeV){
showerShapes10GeV->fill(*phrec);
}
} // RecoPh Loop
......@@ -523,6 +569,10 @@ StatusCode EgammaMonitoring::execute() {
if (!photon) continue;
truthPhotonRecoPhoton->fill(*egtruth);
clusterPromptAll->fill(*photon);
if (egtruth->pt() > 10*Gaudi::Units::GeV) {
clusterPrompt10GeV->fill(*photon);
}
bool isRecoConv = xAOD::EgammaHelpers::isConvertedPhoton(photon);
xAOD::EgammaParameters::ConversionType convType = xAOD::EgammaHelpers::conversionType(photon);
......
......@@ -41,6 +41,7 @@
#include "RecoPhotonHistograms.h"
#include "IHistograms.h"
#include "ShowerShapesHistograms.h"
#include "ClusterHistograms.h"
#include "EfficiencyPlot.h"
#include "IsolationHistograms.h"
......@@ -65,6 +66,14 @@ class EgammaMonitoring : public AthAlgorithm
std::unique_ptr<egammaMonitoring::ClusterHistograms> clusterAll;
std::unique_ptr<egammaMonitoring::ClusterHistograms> cluster10GeV;
std::unique_ptr<egammaMonitoring::ClusterHistograms> clusterPromptAll;
std::unique_ptr<egammaMonitoring::ClusterHistograms> clusterPrompt10GeV;
std::unique_ptr<egammaMonitoring::ShowerShapesHistograms> showerShapesAll;
std::unique_ptr<egammaMonitoring::ShowerShapesHistograms> showerShapes10GeV;
std::unique_ptr<egammaMonitoring::IsolationHistograms> isolationAll;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment