Skip to content
Snippets Groups Projects
Commit 29f13141 authored by Edward Moyse's avatar Edward Moyse
Browse files

Merge branch '2TRT_plots' into 'master'

egamma ART additional plots

See merge request atlas/athena!36565
parents 2544fdbf 4eee0344
No related branches found
No related tags found
No related merge requests found
......@@ -117,6 +117,14 @@ photon_fraction_list = [
{'name': 'truthPhotonConvRecoUnconvEfficiency', 'color': kPink + 2, 'title': 'True Conv #rightarrow Unconv'}
]
photon_conversion_list = [
{'name': 'truthConvRecoConv2Si', 'color': kGreen + 2, 'title': 'True Conv #rightarrow Si-Si Conv'},
{'name': 'truthConvRecoConv1Si', 'color': kBlue + 2, 'title': 'True Conv #rightarrow 1 Si Conv'},
{'name': 'truthConvRecoConv1TRT', 'color': kRed + 2, 'title': 'True Conv #rightarrow 1 TRT Conv'},
{'name': 'truthConvRecoConv2TRT', 'color': kOrange + 2, 'title': 'True Conv #rightarrow TRT-TRT Conv'},
{'name': 'truthConvRecoConv2SiTRT', 'color': kCyan + 2, 'title': 'True Conv #rightarrow Si-TRT Conv'},
]
def get_key_names(file, directory=""):
"""
......@@ -190,7 +198,66 @@ def make_profile_plots(f_base, f_nightly, result_file, particle_type):
h_base_profile.SetTitle("")
make_ratio_plot(h_base_profile, h_nightly_profile, folder['title'], result_file, y_axis_label)
def make_conversion_plot(f_base, f_nightly, result_file):
"""
This function creates conversion plots to study reco vs true
converion radius for the various conversion categoried
"""
for histo in get_key_names(f_nightly, 'truthConvRecoConv2Si'):
variable_name = histo.split("_", 1)[1]
if variable_name != "convRadiusTrueVsReco":
continue
c1 = TCanvas()
leg = TLegend(0.1, 0.75, 0.9, 0.9)
leg.SetNColumns(2)
for i, folder in enumerate(photon_conversion_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)
if baseline.Integral() != 0:
baseline.Scale(1/baseline.Integral())
if nightly.Integral() != 0:
nightly.Scale(1/nightly.Integral())
baseline.SetMinimum(min(baseline.GetMinimum(), baseline.GetMinimum()) * 0.7)
baseline.SetMaximum(max(baseline.GetMaximum(), baseline.GetMaximum()) * 1.3)
baseline.GetXaxis().SetTitle("R^{reco}_{conv. vtx} - R^{true}_{conv. vtx} [mm]")
baseline.GetYaxis().SetTitle("normalized to unity")
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()
result_file.cd()
c1.SaveAs("ConversionRadiusTrueVsReco.png")
c1.Write("ConversionRadiusTrueVsReco")
def make_photon_fraction_plot(f_base, f_nightly, result_file):
......@@ -368,14 +435,15 @@ if __name__ == '__main__':
output_file = TFile("BN_ComparisonPlots_" + particle_type + ".hist.root", "RECREATE")
make_comparison_plots(particle_type, baseline_file, nightly_file, output_file)
if particle_type == 'gamma':
make_profile_plots(baseline_file, nightly_file, output_file, particle_type)
make_photon_fraction_plot(baseline_file, nightly_file,output_file)
make_conversion_plot(baseline_file, nightly_file, output_file)
make_comparison_plots(particle_type, baseline_file, nightly_file, output_file)
if particle_type == 'gamma':
make_profile_plots(baseline_file, nightly_file, output_file, particle_type)
make_photon_fraction_plot(baseline_file, nightly_file,output_file)
......
......@@ -18,6 +18,7 @@ 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["convRadiusTrueVsReco"] = new TH1D(Form("%s_%s",m_name.c_str(),"convRadiusTrueVsReco"), ";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);
......@@ -28,6 +29,7 @@ StatusCode TruthPhotonHistograms::initializePlots() {
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);
ATH_CHECK(m_rootHistSvc->regHist(m_folder+"convRadius", histoMap["convRadius"]));
ATH_CHECK(m_rootHistSvc->regHist(m_folder+"convRadiusTrueVsReco", histoMap["convRadiusTrueVsReco"]));
ATH_CHECK(m_rootHistSvc->regHist(m_folder+"resolution_e", histoMap["resolution_e"]));
ATH_CHECK(m_rootHistSvc->regHist(m_folder+"resolution_pT", histoMap["resolution_pT"]));
......@@ -48,6 +50,7 @@ void TruthPhotonHistograms::fill(const xAOD::IParticle& phrec) {
float res_pT = -999;
float res_eta = -999;
float res_phi = -999;
float recoR = -999;
ParticleHistograms::fill(phrec);
......@@ -75,10 +78,13 @@ void TruthPhotonHistograms::fill(const xAOD::IParticle& phrec) {
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);
}
}
histoMap["convRadiusTrueVsReco"]->Fill(recoR - trueR);
histoMap["resolution_e"]->Fill(res_e);
histoMap["resolution_pT"]->Fill(res_pT);
histoMap["resolution_eta"]->Fill(res_eta);
......
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