ATLAS Offline Software
Loading...
Searching...
No Matches
plotIsoValidation Namespace Reference

Functions

 DrawTLatex (x, y, text, size=18, font=43, align=11)
 saveHisto (plot_options, histo)

Variables

 parser
 help
 default
 action
 options = parser.parse_args()
 inFile = ROOT.TFile.Open(options.inFile, "READ")
 anaTree = inFile.Get("IsoCorrTest")
 Elec_Track_Iso = ROOT.TH1D("elec_track_iso", "track isolation", 55, -5, 50)
 Prepare the histograms to be filled in the simple analysis.
 Elec_Calo_Iso = ROOT.TH1D("elec_calo_iso", "calorimeter isolation", 55, -5, 50)
 Muon_Track_Iso = ROOT.TH1D("muon_track_iso", "track isolation", 55, -5, 50)
 Muon_Calo_Iso = ROOT.TH1D("muon_calo_iso", "calorimeter isolation", 55, -5, 50)
 Elec_RelTrack_Iso = ROOT.TH1D("elec_rel_track_iso", "track isolation", 52, -0.04, 1)
 Isolation / pt of the particles.
 Elec_RelCalo_Iso = ROOT.TH1D("elec_rel_calo_iso", "track isolation", 52, -0.04, 1)
 Muon_RelTrack_Iso = ROOT.TH1D("muon_rel_track_iso", "track isolation", 52, -0.04, 1)
 Muon_RelCalo_Iso = ROOT.TH1D("muon_rel_calo_iso", "track isolation", 52, -0.04, 1)
 Elec_Track_polution_dR = ROOT.TH2D("elec_track_polution_dR", "track_isolaiton against dR",50, 0, 0.5, 100, -1.5, 1.5 )
 Isolation / track of the closest particle — deltaR.
 Elec_Topo_polution_dR = ROOT.TH2D("elec_calo_polution_dR", "calorimeter isolation against dR",50, 0, 0.5, 100, -1.5, 1.5)
 Muon_Track_polution_dR = ROOT.TH2D("muon_track_polution_dR", "track_isolaiton against dR", 50, 0, 0.5, 100, -1.5, 1.5)
 Muon_Topo_polution_dR = ROOT.TH2D("muon_calo_polution_dR", "calorimeter isolation against dR", 50, 0, 0.5, 100, -1.5, 1.5)
 N_Isolated_Muon = ROOT.TH1D("N_muons", "Isolated #mu", 6, 0, 6);
 N_Isolated_Elec = ROOT.TH1D("N_elec", "Elec #mu", 6, 0, 6);
list AllHistos
 treeReader = ROOT.TTreeReader("IsoCorrTest", inFile)
list branch_names = [ B.GetName() for B in anaTree.GetListOfBranches() ]
list mu_trk_cone_names = [b [ b.find("Corr" if options.useCorrectedCones else "Orig") + 5 :] for b in branch_names if b.find("Muons_%s_pt"%("Corr" if options.useCorrectedCones else "Orig")) != -1]
 Find the isolation variables in the list of branches.
list mu_calo_cone_names
list el_trk_cone_names = [ b [ b.find("Corr" if options.useCorrectedCones else "Orig") + 5 :] for b in branch_names if b.find("Electrons_%s_pt"%("Corr" if options.useCorrectedCones else "Orig")) != -1]
list el_calo_cone_names
 mu_pt = ROOT.TTreeReaderArray(float)(treeReader, "Muons_pt")
 mu_eta = ROOT.TTreeReaderArray(float)(treeReader, "Muons_eta")
 mu_phi = ROOT.TTreeReaderArray(float)(treeReader, "Muons_phi")
 mu_trk = ROOT.TTreeReaderArray(float)(treeReader, "Muons_trackPt")
 mu_clu = ROOT.TTreeReaderArray(float)(treeReader, "Muons_clusterEt")
 mu_clu_eta = ROOT.TTreeReaderArray(float)(treeReader, "Muons_clusterEta")
 mu_clu_phi = ROOT.TTreeReaderArray(float)(treeReader, "Muons_clusterPhi")
int mu_trk_iso = ROOT.TTreeReaderArray(float)(treeReader, "Muons_%s_%s"%("Corr" if options.useCorrectedCones else "Orig", mu_trk_cone_names[0])) if len(mu_trk_cone_names) > 0 else None
int mu_calo_iso = ROOT.TTreeReaderArray(float)(treeReader, "Muons_%s_%s"%("Corr" if options.useCorrectedCones else "Orig",mu_calo_cone_names[0])) if len (mu_calo_cone_names) > 0 else None
 el_pt = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_pt")
 el_eta = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_eta")
 el_phi = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_phi")
 el_trk = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_trackPt")
 el_clu = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_clusterEt")
 el_clu_eta = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_clusterEta")
 el_clu_phi = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_clusterPhi")
int el_trk_iso = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_%s_%s"%("Corr" if options.useCorrectedCones else "Orig", el_trk_cone_names[0])) if len(el_trk_cone_names) > 0 else None
int el_calo_iso = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_%s_%s"%("Corr" if options.useCorrectedCones else "Orig",el_calo_cone_names[0])) if len(el_calo_cone_names) > 0 else None
 el_pass_iso = ROOT.TTreeReaderArray(bool)(treeReader, "Muons_%sPassIso"%("Corr" if options.useCorrectedCones else "Orig"))
 mu_pass_iso = ROOT.TTreeReaderArray(bool)(treeReader, "Electrons_%sPassIso"%("Corr" if options.useCorrectedCones else "Orig"))
list muon_t_vec = []
list elec_t_vec = []
list elec_t_calo_vec = []
list muon_t_calo_vec = []
 mu = ROOT.TLorentzVector()
 calo_mu = ROOT.TLorentzVector()
 el = ROOT.TLorentzVector()
 calo_el = ROOT.TLorentzVector()
 dummy_canvas = ROOT.TCanvas("dummy", "dummy", 800, 600)
bool saved_once = False

Function Documentation

◆ DrawTLatex()

plotIsoValidation.DrawTLatex ( x,
y,
text,
size = 18,
font = 43,
align = 11 )

Definition at line 7 of file plotIsoValidation.py.

7def DrawTLatex(x, y, text, size=18, font=43, align=11):
8 tex = ROOT.TLatex()
9 tex.SetTextAlign(align)
10 tex.SetTextSize(size)
11 tex.SetTextFont(font)
12 tex.SetNDC()
13 tex.DrawLatex(x, y, text)
14
15
16

◆ saveHisto()

plotIsoValidation.saveHisto ( plot_options,
histo )

Definition at line 17 of file plotIsoValidation.py.

17def saveHisto(plot_options, histo):
18 if not histo.GetEntries(): return False
19
20 Canvas_Name = "Isolation_%s_%s"%("Corr" if options.useCorrectedCones else "Orig" ,
21 histo.GetName())
22 c1 = ROOT.TCanvas(Canvas_Name, "canvas", 800 , 600)
23
24 c1.cd()
25 c1.SetTopMargin(0.13)
26 if histo.GetDimension() == 2:
27 c1.SetRightMargin(0.15)
28 c1.SetLeftMargin(0.12)
29 if histo.GetDimension() == 1:
30 histo.SetLineColor(ROOT.kRed)
31 histo.SetLineWidth(2)
32
33 histo.Draw()
34 else: histo.Draw("colz")
35 DrawTLatex(c1.GetLeftMargin(), 0.92,"%s (%s)" %(histo.GetTitle(), "corrected" if plot_options.useCorrectedCones else "vanilla") )
36
37 c1.SaveAs("%s/%s.pdf"%(options.outDir, Canvas_Name))
38 c1.SaveAs("%s/AllIsolationPlots_%s.pdf"%(options.outDir, "Corr" if options.useCorrectedCones else "Orig" ))
39
40 return True

Variable Documentation

◆ action

plotIsoValidation.action

Definition at line 49 of file plotIsoValidation.py.

◆ AllHistos

list plotIsoValidation.AllHistos
Initial value:
1= [Elec_Track_Iso,
2 Elec_Calo_Iso ,
3 Muon_Track_Iso,
4 Muon_Calo_Iso,
5 Elec_RelTrack_Iso,
6 Muon_RelTrack_Iso,
7 Elec_RelCalo_Iso,
8 Muon_RelCalo_Iso,
9 Elec_Track_polution_dR,
10 Elec_Topo_polution_dR,
11 Muon_Track_polution_dR,
12 Muon_Topo_polution_dR ,
13 N_Isolated_Muon,
14 N_Isolated_Elec,
15 ]

Definition at line 112 of file plotIsoValidation.py.

◆ anaTree

plotIsoValidation.anaTree = inFile.Get("IsoCorrTest")

Definition at line 61 of file plotIsoValidation.py.

◆ branch_names

list plotIsoValidation.branch_names = [ B.GetName() for B in anaTree.GetListOfBranches() ]

Definition at line 128 of file plotIsoValidation.py.

◆ calo_el

plotIsoValidation.calo_el = ROOT.TLorentzVector()

Definition at line 200 of file plotIsoValidation.py.

◆ calo_mu

plotIsoValidation.calo_mu = ROOT.TLorentzVector()

Definition at line 192 of file plotIsoValidation.py.

◆ default

plotIsoValidation.default

Definition at line 47 of file plotIsoValidation.py.

◆ dummy_canvas

plotIsoValidation.dummy_canvas = ROOT.TCanvas("dummy", "dummy", 800, 600)

Definition at line 243 of file plotIsoValidation.py.

◆ el

plotIsoValidation.el = ROOT.TLorentzVector()

Definition at line 197 of file plotIsoValidation.py.

◆ el_calo_cone_names

list plotIsoValidation.el_calo_cone_names
Initial value:
1= [ b [ b.find("Corr" if options.useCorrectedCones else "Orig") + 5 :] for b in branch_names if b.find("Electrons_%s_topo"%("Corr" if options.useCorrectedCones else "Orig")) != -1 or
2 b.find("Electrons_%s_neflow"%("Corr" if options.useCorrectedCones else "Orig")) != -1
3 ]

Definition at line 136 of file plotIsoValidation.py.

◆ el_calo_iso

int plotIsoValidation.el_calo_iso = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_%s_%s"%("Corr" if options.useCorrectedCones else "Orig",el_calo_cone_names[0])) if len(el_calo_cone_names) > 0 else None

Definition at line 172 of file plotIsoValidation.py.

◆ el_clu

plotIsoValidation.el_clu = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_clusterEt")

Definition at line 167 of file plotIsoValidation.py.

◆ el_clu_eta

plotIsoValidation.el_clu_eta = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_clusterEta")

Definition at line 168 of file plotIsoValidation.py.

◆ el_clu_phi

plotIsoValidation.el_clu_phi = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_clusterPhi")

Definition at line 169 of file plotIsoValidation.py.

◆ el_eta

plotIsoValidation.el_eta = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_eta")

Definition at line 164 of file plotIsoValidation.py.

◆ el_pass_iso

plotIsoValidation.el_pass_iso = ROOT.TTreeReaderArray(bool)(treeReader, "Muons_%sPassIso"%("Corr" if options.useCorrectedCones else "Orig"))

Definition at line 174 of file plotIsoValidation.py.

◆ el_phi

plotIsoValidation.el_phi = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_phi")

Definition at line 165 of file plotIsoValidation.py.

◆ el_pt

plotIsoValidation.el_pt = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_pt")

Definition at line 163 of file plotIsoValidation.py.

◆ el_trk

plotIsoValidation.el_trk = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_trackPt")

Definition at line 166 of file plotIsoValidation.py.

◆ el_trk_cone_names

list plotIsoValidation.el_trk_cone_names = [ b [ b.find("Corr" if options.useCorrectedCones else "Orig") + 5 :] for b in branch_names if b.find("Electrons_%s_pt"%("Corr" if options.useCorrectedCones else "Orig")) != -1]

Definition at line 135 of file plotIsoValidation.py.

◆ el_trk_iso

int plotIsoValidation.el_trk_iso = ROOT.TTreeReaderArray(float)(treeReader, "Electrons_%s_%s"%("Corr" if options.useCorrectedCones else "Orig", el_trk_cone_names[0])) if len(el_trk_cone_names) > 0 else None

Definition at line 171 of file plotIsoValidation.py.

◆ Elec_Calo_Iso

plotIsoValidation.Elec_Calo_Iso = ROOT.TH1D("elec_calo_iso", "calorimeter isolation", 55, -5, 50)

Definition at line 70 of file plotIsoValidation.py.

◆ Elec_RelCalo_Iso

plotIsoValidation.Elec_RelCalo_Iso = ROOT.TH1D("elec_rel_calo_iso", "track isolation", 52, -0.04, 1)

Definition at line 81 of file plotIsoValidation.py.

◆ Elec_RelTrack_Iso

plotIsoValidation.Elec_RelTrack_Iso = ROOT.TH1D("elec_rel_track_iso", "track isolation", 52, -0.04, 1)

Isolation / pt of the particles.

Definition at line 79 of file plotIsoValidation.py.

◆ elec_t_calo_vec

list plotIsoValidation.elec_t_calo_vec = []

Definition at line 182 of file plotIsoValidation.py.

◆ elec_t_vec

list plotIsoValidation.elec_t_vec = []

Definition at line 180 of file plotIsoValidation.py.

◆ Elec_Topo_polution_dR

plotIsoValidation.Elec_Topo_polution_dR = ROOT.TH2D("elec_calo_polution_dR", "calorimeter isolation against dR",50, 0, 0.5, 100, -1.5, 1.5)

Definition at line 94 of file plotIsoValidation.py.

◆ Elec_Track_Iso

plotIsoValidation.Elec_Track_Iso = ROOT.TH1D("elec_track_iso", "track isolation", 55, -5, 50)

Prepare the histograms to be filled in the simple analysis.

Definition at line 68 of file plotIsoValidation.py.

◆ Elec_Track_polution_dR

plotIsoValidation.Elec_Track_polution_dR = ROOT.TH2D("elec_track_polution_dR", "track_isolaiton against dR",50, 0, 0.5, 100, -1.5, 1.5 )

Isolation / track of the closest particle — deltaR.

Definition at line 90 of file plotIsoValidation.py.

◆ help

plotIsoValidation.help

Definition at line 46 of file plotIsoValidation.py.

◆ inFile

plotIsoValidation.inFile = ROOT.TFile.Open(options.inFile, "READ")

Definition at line 56 of file plotIsoValidation.py.

◆ mu

plotIsoValidation.mu = ROOT.TLorentzVector()

Definition at line 189 of file plotIsoValidation.py.

◆ mu_calo_cone_names

list plotIsoValidation.mu_calo_cone_names
Initial value:
1= [ b [ b.find("Corr" if options.useCorrectedCones else "Orig") + 5 :] for b in branch_names if b.find("Muons_%s_topo"%("Corr" if options.useCorrectedCones else "Orig")) != -1 or
2 b.find("Muons_%s_neflow"%("Corr" if options.useCorrectedCones else "Orig")) != -1
3 ]

Definition at line 131 of file plotIsoValidation.py.

◆ mu_calo_iso

int plotIsoValidation.mu_calo_iso = ROOT.TTreeReaderArray(float)(treeReader, "Muons_%s_%s"%("Corr" if options.useCorrectedCones else "Orig",mu_calo_cone_names[0])) if len (mu_calo_cone_names) > 0 else None

Definition at line 161 of file plotIsoValidation.py.

◆ mu_clu

plotIsoValidation.mu_clu = ROOT.TTreeReaderArray(float)(treeReader, "Muons_clusterEt")

Definition at line 155 of file plotIsoValidation.py.

◆ mu_clu_eta

plotIsoValidation.mu_clu_eta = ROOT.TTreeReaderArray(float)(treeReader, "Muons_clusterEta")

Definition at line 156 of file plotIsoValidation.py.

◆ mu_clu_phi

plotIsoValidation.mu_clu_phi = ROOT.TTreeReaderArray(float)(treeReader, "Muons_clusterPhi")

Definition at line 157 of file plotIsoValidation.py.

◆ mu_eta

plotIsoValidation.mu_eta = ROOT.TTreeReaderArray(float)(treeReader, "Muons_eta")

Definition at line 151 of file plotIsoValidation.py.

◆ mu_pass_iso

plotIsoValidation.mu_pass_iso = ROOT.TTreeReaderArray(bool)(treeReader, "Electrons_%sPassIso"%("Corr" if options.useCorrectedCones else "Orig"))

Definition at line 175 of file plotIsoValidation.py.

◆ mu_phi

plotIsoValidation.mu_phi = ROOT.TTreeReaderArray(float)(treeReader, "Muons_phi")

Definition at line 152 of file plotIsoValidation.py.

◆ mu_pt

plotIsoValidation.mu_pt = ROOT.TTreeReaderArray(float)(treeReader, "Muons_pt")

Definition at line 150 of file plotIsoValidation.py.

◆ mu_trk

plotIsoValidation.mu_trk = ROOT.TTreeReaderArray(float)(treeReader, "Muons_trackPt")

Definition at line 153 of file plotIsoValidation.py.

◆ mu_trk_cone_names

list plotIsoValidation.mu_trk_cone_names = [b [ b.find("Corr" if options.useCorrectedCones else "Orig") + 5 :] for b in branch_names if b.find("Muons_%s_pt"%("Corr" if options.useCorrectedCones else "Orig")) != -1]

Find the isolation variables in the list of branches.

Definition at line 130 of file plotIsoValidation.py.

◆ mu_trk_iso

int plotIsoValidation.mu_trk_iso = ROOT.TTreeReaderArray(float)(treeReader, "Muons_%s_%s"%("Corr" if options.useCorrectedCones else "Orig", mu_trk_cone_names[0])) if len(mu_trk_cone_names) > 0 else None

Definition at line 160 of file plotIsoValidation.py.

◆ Muon_Calo_Iso

plotIsoValidation.Muon_Calo_Iso = ROOT.TH1D("muon_calo_iso", "calorimeter isolation", 55, -5, 50)

Definition at line 75 of file plotIsoValidation.py.

◆ Muon_RelCalo_Iso

plotIsoValidation.Muon_RelCalo_Iso = ROOT.TH1D("muon_rel_calo_iso", "track isolation", 52, -0.04, 1)

Definition at line 86 of file plotIsoValidation.py.

◆ Muon_RelTrack_Iso

plotIsoValidation.Muon_RelTrack_Iso = ROOT.TH1D("muon_rel_track_iso", "track isolation", 52, -0.04, 1)

Definition at line 84 of file plotIsoValidation.py.

◆ muon_t_calo_vec

list plotIsoValidation.muon_t_calo_vec = []

Definition at line 183 of file plotIsoValidation.py.

◆ muon_t_vec

list plotIsoValidation.muon_t_vec = []

Definition at line 179 of file plotIsoValidation.py.

◆ Muon_Topo_polution_dR

plotIsoValidation.Muon_Topo_polution_dR = ROOT.TH2D("muon_calo_polution_dR", "calorimeter isolation against dR", 50, 0, 0.5, 100, -1.5, 1.5)

Definition at line 102 of file plotIsoValidation.py.

◆ Muon_Track_Iso

plotIsoValidation.Muon_Track_Iso = ROOT.TH1D("muon_track_iso", "track isolation", 55, -5, 50)

Definition at line 73 of file plotIsoValidation.py.

◆ Muon_Track_polution_dR

plotIsoValidation.Muon_Track_polution_dR = ROOT.TH2D("muon_track_polution_dR", "track_isolaiton against dR", 50, 0, 0.5, 100, -1.5, 1.5)

Definition at line 98 of file plotIsoValidation.py.

◆ N_Isolated_Elec

plotIsoValidation.N_Isolated_Elec = ROOT.TH1D("N_elec", "Elec #mu", 6, 0, 6);

Definition at line 109 of file plotIsoValidation.py.

◆ N_Isolated_Muon

plotIsoValidation.N_Isolated_Muon = ROOT.TH1D("N_muons", "Isolated #mu", 6, 0, 6);

Definition at line 106 of file plotIsoValidation.py.

◆ options

plotIsoValidation.options = parser.parse_args()

Definition at line 50 of file plotIsoValidation.py.

◆ parser

plotIsoValidation.parser
Initial value:
1= argparse.ArgumentParser(description='This script generates validation plots of the isolation correction tool. For more help type \"python plotIsoValidation.py -h\"',
2 prog='plotIsoValidation',
3 formatter_class=argparse.ArgumentDefaultsHelpFormatter)

Definition at line 42 of file plotIsoValidation.py.

◆ saved_once

plotIsoValidation.saved_once = False

Definition at line 247 of file plotIsoValidation.py.

◆ treeReader

plotIsoValidation.treeReader = ROOT.TTreeReader("IsoCorrTest", inFile)

Definition at line 127 of file plotIsoValidation.py.