ATLAS Offline Software
Loading...
Searching...
No Matches
makePlot.py
Go to the documentation of this file.
1# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2
3#-----------------------------------------------------
4# Author: Dengfeng Zhang
5# dengfeng.zhang@cern.ch
6#-----------------------------------------------------
7# This script has for functions:
8# GetPlotSingleProperty(): Get energy response, energy resolution,
9# lateral spread and longitudinal profile of MC.
10# GetDataPlotSingleProperty(): Get energy response, energy resolution,
11# lateral spread and longitudinal profile of data.
12# ComDataMC(): Compare MC results with data results, get the ratio of MC to data.
13# Draw all MC, data and their ratios on one plot.
14# (energy response and resolution, lateral spread and longitudinal spread) ;
15# ComparePhysicsList(): Draw Draw all MC results, data results on one plot, not ratios.
16# (energy response and resolution, lateral spread)
17#-----------------------------------------------------
18
19import ROOT,math,os,array
20from ROOT import *
21gROOT.ProcessLine("#include \"GraphToolKit.h\"")
22gROOT.ProcessLine("#include \"HistToolKit.h\"")
23
24Energies = [20000, 50000, 100000, 180000] # beam energy lists
25Particles = ['pi', 'pr'] # particle types
26PhysicsLists = ['FTFP_BERT', 'FTFP_BERT_ATL', 'QGSP_BERT', "QGSP_BIC"] # physics lists
27
28# Get the current working dir
29Dir = os.getcwd()
30# Check main output dir holding output root files does exist in current working dir,
31# otherwise create it.
32ResultDir = Dir+"/results/"
33if ROOT.gSystem.AccessPathName(ResultDir):
34 print ResultDir, "doesn't exist! Making"
35 gSystem.Exec("mkdir {}".format(ResultDir))
36# Check main output dir holding plots does exist in current working dir,
37# otherwise create it.
38PlotDir = Dir+"/plots/"
39if ROOT.gSystem.AccessPathName(PlotDir):
40 print PlotDir, "doesn't exist! Making"
41 gSystem.Exec("mkdir {}".format(PlotDir))
42
43# Get the energy response and resolution, lateral spread
44# and longitudinal of each type of particles, each beam energy and each physics list.
46 for Particle in Particles: # loop over particle types
47 # input path containing root files generated in GetEnergy.cxx
48 InPath = ResultDir+"/{}/".format(Particle)
49 # create output root file
50 # grapherrors of renponse, resolution and lateral spread
51 # and histograms of longitudinal profile will be wrote in it.
52 outputFile = ROOT.TFile.Open('{}/Properities_{}.root'.format(InPath,Particle),'RECREATE')
53 for PhysicsList in PhysicsLists: # loop over physics lists
54 # define array or list of responses, resolutions,
55 # lateral spreads and longitudinal profiles of all beam energies
56 Response = array.array('f') # array of energy responses of all beam energies for each type of particles and for each physics lists
57 ResponseError = array.array('f') #array of energy response errors (only statistical)
58 Resolution = array.array('f') #array of energy resolutions of all beam energies
59 ResolutionError = array.array('f') #array of energy resolution errors
60 LateralSpread = array.array('f') #array of lateral spreads of all beam energies
61 LateralSpreadError = array.array('f') #array of lateral spread errors of all beam energies
62 Es = array.array('f') # array of beam energies
63 EsError = array.array('f') # # array of beam energy errors, always 0
64 LongitudinalProfileList = [] # list of longitudinal profiles of all beam energies
65 NormalizedLongitudinalProfileList = [] # list of normalized longitudinal profiles of all beam energies
66
67 for Energy in Energies: # loop over all beam energies
68 Es.append(Energy/1000.)
69 EsError.append(0.)
70 # get input file generated in GetEnergy.cxx
71 # attaced to each beam energy, particle and physics list
72 inputFile = ROOT.TFile('{}/tiletb90-E{}-{}_{}.root'.format(InPath,Energy,Particle,PhysicsList),"read")
73 if not inputFile:
74 continue
75 print "InFile: ",inputFile.GetName()
76
77 # get histograms in input file
78 h_E = inputFile.Get("RecoE") # total energy distribution
79 h_EM0 = inputFile.Get("RecoEModule0") # distribution of energy in barrel module 0
80 h_EB = inputFile.Get("RecoECentralModule") # distribution of energy in central barrel module
81 h_LP = inputFile.Get("LongitudinalProfile") # get the longitudinal profile
82 h_LP.SetDirectory(0)
83
84 # define a gaus fun to fit total energy distribution
85 func = ROOT.TF1("func","gaus",h_E.GetMean()-2*h_E.GetRMS(),h_E.GetMean()+2*h_E.GetRMS())
86 print h_E.GetMean()-2*h_E.GetRMS()," ", h_E.GetMean()+2*h_E.GetRMS()
87 h_E.Fit("func","R") # fit the total energy distribution by a Gaussian
88 gStyle.SetOptFit(1)
89 canvas = ROOT.TCanvas("canvas","",800,600)
90 h_E.Draw()
91 canvas.Print(ResultDir+'/{}/totalE_{}_{}_{}.pdf'.format(Particle,Particle,Energy,PhysicsList))
92 # energy response is the mean of the gaussian fitting/beam energy,
93 # energy resolution is sigma/mean of the gaussian fitting
94 Response.append(func.GetParameter(1)*1000/Energy)
95 ResponseError.append(func.GetParError(1)*1000/Energy)
96 Resolution.append(func.GetParameter(2)/func.GetParameter(1)*100)
97 ResolutionError.append(func.GetParError(2)/func.GetParameter(1)*100)
98
99 # Get lateral spread(mean energy in module 0/ mean energy in central barrel)
100 LS = h_EM0.GetMean()/h_EB.GetMean()
101 LSError = LS*math.sqrt(pow(h_EM0.GetMeanError()/h_EM0.GetMean(), 2)+pow(h_EB.GetMeanError()/h_EB.GetMean(), 2))
102 LateralSpread.append(LS)
103 LateralSpreadError.append(LSError)
104
105 # get the longitudinal profiles scaling by the energy response
106 h_LP.Scale(1./(func.GetParameter(1)*1000/Energy)) #FIXME
107 #h_LP.Scale(Energy/1000/h_LP.Integral("width")) #FIXME
108 # get the normalized longitudinal profiles normalize it to 1
109 h_NormalizedLP=h_LP.Clone()
110 h_NormalizedLP.SetDirectory(0)
111 h_NormalizedLP.Scale(1./h_LP.Integral("width"))
112 h_LP.SetName("{}_{}GeV_{}_LongitudinalProfile".format(Particle,Energy/1000, PhysicsList))
113 h_LP.SetTitle("{} GeV".format(Energy/1000))
114 h_NormalizedLP.SetName("{}_{}GeV_{}_NormalizedLongitudinalProfile".format(Particle, Energy/1000, PhysicsList))
115 h_NormalizedLP.SetTitle("{} GeV".format(Energy/1000))
116 h_NormalizedLP.GetYaxis().SetTitle("1/E_{tot}#timesdE/dx[1/#lambda]")
117 LongitudinalProfileList.append(h_LP)
118 NormalizedLongitudinalProfileList.append(h_NormalizedLP)
119 print LongitudinalProfileList, NormalizedLongitudinalProfileList
120 outputFile.cd()
121 # create the grapherrors of energy responses
122 gr_response = ROOT.TGraphErrors(len(Es),Es,Response,EsError,ResponseError)
123 gr_response.SetName("{}_{}_Response".format(Particle,PhysicsList))
124 gr_response.SetTitle("{} {} Response".format(Particle,PhysicsList))
125 gr_response.GetXaxis().SetTitle("E_{beam}[GeV]")
126 gr_response.GetYaxis().SetTitle("E_{total}/E_{beam}")
127 # create the grapherrors of energy resolutions
128 gr_resolution = ROOT.TGraphErrors(len(Es),Es,Resolution,EsError,ResolutionError)
129 gr_resolution.SetName("{}_{}_Resolution".format(Particle,PhysicsList))
130 gr_resolution.SetTitle("{} {} Resolution".format(Particle,PhysicsList))
131 gr_resolution.GetYaxis().SetTitle("resolution[%]")
132 gr_resolution.GetXaxis().SetTitle("E_{beam}[GeV]")
133 # create the grapherrors of lateral spread
134 gr_lateralspread = ROOT.TGraphErrors(len(Es),Es,LateralSpread,EsError,LateralSpreadError)
135 gr_lateralspread.SetName("{}_{}_LateralSpread".format(Particle,PhysicsList))
136 gr_lateralspread.SetTitle("{} {} LateralSpread".format(Particle,PhysicsList))
137 gr_lateralspread.GetYaxis().SetTitle("E_{Module0}/E_{Barrel}")
138 gr_lateralspread.GetXaxis().SetTitle("E_{beam}[GeV]")
139 # set the x range of grapherrors of response and resolution
140 gr_response.GetXaxis().SetRangeUser(10, 210)
141 gr_response.GetYaxis().SetNdivisions(510)
142 gr_resolution.GetXaxis().SetRangeUser(10, 210)
143 gr_resolution.GetYaxis().SetNdivisions(510)
144 gr_lateralspread.GetXaxis().SetRangeUser(10, 210)
145 gr_lateralspread.GetYaxis().SetNdivisions(510)
146
147 # set the x range of grapherrors of lateral spread
148 if(Particle=="pi"):
149 gr_lateralspread.GetYaxis().SetRangeUser(0.025, 0.055)
150 gr_lateralspread.GetYaxis().SetNdivisions(503) ;
151 elif(Particle=="pr"):
152 gr_lateralspread.GetYaxis().SetRangeUser(0.025, 0.065)
153 gr_lateralspread.GetYaxis().SetNdivisions(504) ;
154
155 # define output for each particle type,
156 # if this dir doesn't exist, create it.
157 OutPath = PlotDir+"/{}/".format(Particle)
158 if ROOT.gSystem.AccessPathName(OutPath):
159 print OutPath, "doesn't exist! Making"
160 ROOT.gSystem.Exec("mkdir {}".format(OutPath))
161
162 FullParticleName=""
163 if Particle=='pi':
164 FullParticleName = "Pion"
165 elif Particle=='pr':
166 FullParticleName = "Proton"
167
168 # loop over beam energies to draw single longitudinal profile
169 for i, Energy in enumerate(Energies):
170 LongitudinalProfileList[i].Write()
171 NormalizedLongitudinalProfileList[i].Write()
172 # draw the single plot of normalized longitudinal profile and longitudinal profile # of each type of particle and each physics list and each beam energy
173 DrawSingleHistOnCanvas(OutPath+LongitudinalProfileList[i].GetName(), LongitudinalProfileList[i], "PE", False, True, False, "#splitline{"+"{}GeV {}".format(Energy/1000, FullParticleName)+"}{"+"{}".format(PhysicsList)+"}")
174 DrawSingleHistOnCanvas(OutPath+NormalizedLongitudinalProfileList[i].GetName(), NormalizedLongitudinalProfileList[i], "PE",False, True, False, "#splitline{"+"{}GeV {}".format(Energy/1000, FullParticleName)+"}{"+"{}".format(PhysicsList)+"}")
175
176 LongitudinalProfileList[0].GetYaxis().SetRangeUser(1E-3, 100.)
177 NormalizedLongitudinalProfileList[0].GetYaxis().SetRangeUser(1E-5, 1.)
178 # Draw four longitudinal profiles of 4 beam energies of each type of particle and
179 # each physics list on same canvas
180 DrawFourHistsOnCanvas("{}/{}_{}_LongitudinalProfile_LogY".format(OutPath,Particle,PhysicsList), LongitudinalProfileList[0], LongitudinalProfileList[1], LongitudinalProfileList[2], LongitudinalProfileList[3],"pe", "pesame", "pesame", "pesame", False, True, False, FullParticleName, PhysicsList)
181 DrawFourHistsOnCanvas("{}/{}_{}_NormalizedLongitudinalProfile_LogY".format(OutPath,Particle,PhysicsList), NormalizedLongitudinalProfileList[0], NormalizedLongitudinalProfileList[1], NormalizedLongitudinalProfileList[2], NormalizedLongitudinalProfileList[3],"pe", "pesame", "pesame", "pesame", False, True, False, FullParticleName, PhysicsList)
182 # don't use logy on y axis
183 LongitudinalProfileList[0].GetYaxis().SetRangeUser(0., 40.)
184 NormalizedLongitudinalProfileList[0].GetYaxis().SetRangeUser(0., 0.25)
185 DrawFourHistsOnCanvas("{}/{}_{}_LongitudinalProfile".format(OutPath,Particle,PhysicsList), LongitudinalProfileList[0], LongitudinalProfileList[1], LongitudinalProfileList[2], LongitudinalProfileList[3],"pe", "pesame", "pesame", "pesame", False, False, False, FullParticleName, PhysicsList)
186 DrawFourHistsOnCanvas("{}/{}_{}_NormalizedLongitudinalProfile".format(OutPath,Particle,PhysicsList), NormalizedLongitudinalProfileList[0], NormalizedLongitudinalProfileList[1], NormalizedLongitudinalProfileList[2], NormalizedLongitudinalProfileList[3],"pe", "pesame", "pesame", "pesame", False, False, False, FullParticleName, PhysicsList)
187
188 # draw single grapherrors of responses , resolutions and lateral spread
189 DrawSingleGraphErrorsOnCanvas("{}/{}_{}_Response".format(OutPath,Particle,PhysicsList),gr_response,"AP", False, False, False, FullParticleName+" "+PhysicsList)
190 DrawSingleGraphErrorsOnCanvas("{}/{}_{}_Resolution".format(OutPath,Particle,PhysicsList),gr_resolution,"AP", False, False, False, FullParticleName+" "+PhysicsList)
191 DrawSingleGraphErrorsOnCanvas("{}/{}_{}_LateralSpread".format(OutPath,Particle,PhysicsList), gr_lateralspread,"AP", False, False, False, FullParticleName+" "+PhysicsList)
192
193 gr_response.Write()
194 gr_resolution.Write()
195 gr_lateralspread.Write()
196 print Response
197 print Resolution
198 print LateralSpread
199 outputFile.Write()
200
201# get the energy responses and resolutions, lateral spreads and longitudianl of data
202# data results are extracted from http://indico.cern.ch/event/135703/contributions/134036/attachments/108421/154300/main.pdf
204 # pion responses of data
205 PiResponse = array.array('f', [0.808, 0.844, 0.856, 0.867])
206 PiResponseError = array.array('f', [0., 0., 0., 0.])
207 # proton responses of data, proton only has 3 beam energies
208 PrResponse = array.array('f', [0.811, 0.83, 0.845])
209 PrResponseError = array.array('f', [0., 0., 0.])
210 # pion resolutions of data
211 PiResolution = array.array('f', [11.94, 8.92, 6.78, 6.02])
212 PiResolutionError = array.array('f', [0., 0., 0., 0.])
213 # proton resolutions of data, proton only has 3 beam energies
214 PrResolution = array.array('f', [8.63, 5.97, 5.16])
215 PrResolutionError = array.array('f', [0., 0., 0.])
216 # pion latreal spreads of data
217 PiLateralSpread = array.array('f', [0.044, 0.0379, 0.0342, 0.034])
218 PiLateralSpreadError = array.array('f', [0., 0., 0., 0.])
219 PrLateralSpread = array.array('f', [0.045, 0.0403, 0.0396])
220 PrLateralSpreadError = array.array('f', [0., 0., 0.])
221 # pion has four beam energies
222 PiEs = array.array('f', [20., 50., 100., 180.])
223 PiEsError = array.array('f', [0., 0., 0., 0.])
224 # Be careful that proton only has three beam energies
225 PrEs = array.array('f', [50., 100., 180.])
226 PrEsError = array.array('f', [0., 0., 0.])
227
228 # pion longitudinal profiles of data
229 PiLongitudinalProfile20GeV = array.array('f',[4.88076, 4.29345, 1.90255, 0.760799, 0.336904, 0.116429, 0.0472258, 0.0212191, 0.010869])
230 PiLongitudinalProfileError20GeV = array.array('f',[0, 0, 0, 0, 0, 0, 0, 0, 0])
231 PiLongitudinalProfile50GeV = array.array('f',[10.1243, 10.3069, 5.44077, 2.55502, 1.18216, 0.486682, 0.197446, 0.0913368, 0.0474821, 0.0181673, 0.00878025])
232 PiLongitudinalProfileError50GeV = array.array('f',[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
233 PiLongitudinalProfile100GeV = array.array('f',[16.6323,21.0755,12.1435,6.13442,3.14342,1.37201,0.625483,0.31123,0.143954,0.0619092,0.022023,0.0199365])
234 PiLongitudinalProfileError100GeV = array.array('f',[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
235 PiLongitudinalProfile180GeV = array.array('f',[28.1277,37.7873,21.7727,11.4903,6.33449,2.88857,1.31695,0.655294,0.303115,0.140209,0.0739654,0.0318035,0.0145007])
236 PiLongitudinalProfileError180GeV = array.array('f',[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0])
237 # proton longitudinal profiles of data
238 PrLongitudinalProfile50GeV = array.array('f',[10.2289,10.3627,5.51951,2.54066,1.16948,0.472035,0.174547,0.0747019,0.0310458,0.0099195,0.0043075])
239 PrLongitudinalProfileError50GeV = array.array('f',[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
240 PrLongitudinalProfile100GeV = array.array('f',[18.3511,21.2032,11.4597,5.51097,2.61195,1.039,0.431832,0.193063,0.0814251,0.0364116,0.00962173,0.00783076])
241 PrLongitudinalProfileError100GeV = array.array('f',[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
242 PrLongitudinalProfile180GeV = array.array('f',[30.1568,39.1626,21.7967,10.7928,5.42299,2.2868,0.978724,0.437566,0.198557,0.0813227,0.0256083,0.0114493,0.00382185])
243 PrLongitudinalProfileError180GeV = array.array('f',[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
244
245 # define output dir of root files and plots,
246 # if they doesn't exist, create them.
247 OutPathResult = ResultDir+"/data/"
248 OutPathPlot = PlotDir+"/data/"
249 if ROOT.gSystem.AccessPathName(OutPathResult):
250 print OutPathResult, "doesn't exist! Making"
251 ROOT.gSystem.Exec("mkdir {}".format(OutPathResult))
252 if ROOT.gSystem.AccessPathName(OutPathPlot):
253 print OutPathPlot, "doesn't exist! Making"
254 ROOT.gSystem.Exec("mkdir {}".format(OutPathPlot))
255 # create out file
256 outputFile = ROOT.TFile.Open('{}/data.root'.format(OutPathResult),'RECREATE')
257 # create out grapherrors of response, resolution and lateral spreads
258 gr_piresponse = ROOT.TGraphErrors(len(PiEs),PiEs,PiResponse,PiEsError,PiResponseError)
259 gr_piresponse.SetName("pi_Response")
260 gr_piresponse.SetTitle("Pion")
261 gr_piresponse.GetXaxis().SetTitle("E_{beam}[GeV]")
262 gr_piresponse.GetYaxis().SetTitle("E_{total}/E_{beam}")
263 gr_prresponse = ROOT.TGraphErrors(len(PrEs),PrEs,PrResponse,PrEsError,PrResponseError)
264 gr_prresponse.SetName("pr_Response")
265 gr_prresponse.SetTitle("Proton")
266 gr_prresponse.GetXaxis().SetTitle("E_{beam}[GeV]")
267 gr_prresponse.GetYaxis().SetTitle("E_{total}/E_{beam}")
268 gr_piresolution = ROOT.TGraphErrors(len(PiEs),PiEs,PiResolution,PiEsError,PiResolutionError)
269 gr_piresolution.SetName("pi_Resolution")
270 gr_piresolution.SetTitle("Pion")
271 gr_piresolution.GetXaxis().SetTitle("E_{beam}[GeV]")
272 gr_piresolution.GetYaxis().SetTitle("resolution[%]")
273 gr_prresolution = ROOT.TGraphErrors(len(PrEs),PrEs,PrResolution,PrEsError,PrResolutionError)
274 gr_prresolution.SetName("pr_Resolution")
275 gr_prresolution.SetTitle("Proton")
276 gr_prresolution.GetXaxis().SetTitle("E_{beam}[GeV]")
277 gr_prresolution.GetYaxis().SetTitle("resolution[%]")
278 gr_pilateralspread = ROOT.TGraphErrors(len(PiEs),PiEs,PiLateralSpread,PiEsError,PiLateralSpreadError)
279 gr_pilateralspread.SetName("pi_LateralSpread")
280 gr_pilateralspread.SetTitle("Pion")
281 gr_pilateralspread.GetXaxis().SetTitle("E_{beam}[GeV]")
282 gr_pilateralspread.GetYaxis().SetTitle("E_{Module0}/E_{Barrel}")
283 gr_prlateralspread = ROOT.TGraphErrors(len(PrEs),PrEs,PrLateralSpread,PrEsError,PrLateralSpreadError)
284 gr_prlateralspread.SetName("pr_LateralSpread")
285 gr_prlateralspread.SetTitle("Proton")
286 gr_prlateralspread.GetXaxis().SetTitle("E_{beam}[GeV]")
287 gr_prlateralspread.GetYaxis().SetTitle("E_{Module0}/E_{Barrel}")
288
289 NBCells=13 # only use 13 of 18 B cells
290 # bin edges of longitudinal profiles histograms
291 xBLow = array.array('f',[0.119333,1.67226,3.44703,5.0887,6.686,8.15019,9.61438,10.9898,12.3582,13.7407,15.1233,16.4916,17.8671,19.3313])
292 # create longitudinal profiles histograms for all particles and beam energies
293 pi_LongitudinalProfile20GeV = bookTH1F("pi_LongitudinalProfile_20GeV", "20 GeV", "x[#lambda]", "dE/dx[GeV/#lambda]", NBCells, xBLow)
294 pi_LongitudinalProfile50GeV = bookTH1F("pi_LongitudinalProfile_50GeV", "50 GeV", "x[#lambda]", "dE/dx[GeV/#lambda]", NBCells, xBLow)
295 pi_LongitudinalProfile100GeV = bookTH1F("pi_LongitudinalProfile_100GeV", "100 GeV", "x[#lambda]", "dE/dx[GeV/#lambda]", NBCells, xBLow)
296 pi_LongitudinalProfile180GeV = bookTH1F("pi_LongitudinalProfile_180GeV", "180 GeV", "x[#lambda]", "dE/dx[GeV/#lambda]", NBCells, xBLow)
297 pr_LongitudinalProfile50GeV = bookTH1F("pr_LongitudinalProfile_50GeV", "50 GeV", "x[#lambda]", "dE/dx[GeV/#lambda]", NBCells, xBLow)
298 pr_LongitudinalProfile100GeV = bookTH1F("pr_LongitudinalProfile_100GeV", "100 GeV", "x[#lambda]", "dE/dx[GeV/#lambda]", NBCells, xBLow)
299 pr_LongitudinalProfile180GeV = bookTH1F("pr_LongitudinalProfile_180GeV", "180 GeV", "x[#lambda]", "dE/dx[GeV/#lambda]", NBCells, xBLow)
300 # fill longitudinal profile histograms
301 for i in range(len(PiLongitudinalProfile20GeV)):
302 pi_LongitudinalProfile20GeV.SetBinContent(i+1,PiLongitudinalProfile20GeV[i])
303 pi_LongitudinalProfile20GeV.SetBinError(i+1,PiLongitudinalProfileError20GeV[i])
304 for i in range(len(PiLongitudinalProfile50GeV)):
305 pi_LongitudinalProfile50GeV.SetBinContent(i+1,PiLongitudinalProfile50GeV[i])
306 pi_LongitudinalProfile50GeV.SetBinError(i+1,PiLongitudinalProfileError50GeV[i])
307 for i in range(len(PiLongitudinalProfile100GeV)):
308 pi_LongitudinalProfile100GeV.SetBinContent(i+1,PiLongitudinalProfile100GeV[i])
309 pi_LongitudinalProfile100GeV.SetBinError(i+1,PiLongitudinalProfileError100GeV[i])
310 for i in range(len(PrLongitudinalProfile180GeV)):
311 pi_LongitudinalProfile180GeV.SetBinContent(i+1,PiLongitudinalProfile180GeV[i])
312 pi_LongitudinalProfile180GeV.SetBinError(i+1,PiLongitudinalProfileError180GeV[i])
313 for i in range(len(PrLongitudinalProfile50GeV)):
314 pr_LongitudinalProfile50GeV.SetBinContent(i+1,PrLongitudinalProfile50GeV[i])
315 pr_LongitudinalProfile50GeV.SetBinError(i+1,PrLongitudinalProfileError50GeV[i])
316 for i in range(len(PrLongitudinalProfile100GeV)):
317 pr_LongitudinalProfile100GeV.SetBinContent(i+1,PrLongitudinalProfile100GeV[i])
318 pr_LongitudinalProfile100GeV.SetBinError(i+1,PrLongitudinalProfileError100GeV[i])
319 for i in range(len(PrLongitudinalProfile180GeV)):
320 pr_LongitudinalProfile180GeV.SetBinContent(i+1,PrLongitudinalProfile180GeV[i])
321 pr_LongitudinalProfile180GeV.SetBinError(i+1,PrLongitudinalProfileError180GeV[i])
322
323 # get the normalized longitudinal profiles
324 pi_NormalizedLongitudinalProfile20GeV=pi_LongitudinalProfile20GeV.Clone()
325 pi_NormalizedLongitudinalProfile20GeV.Scale(1./pi_LongitudinalProfile20GeV.Integral("width"))
326 pi_NormalizedLongitudinalProfile20GeV.SetName("pi_NormalizedLongitudinalProfile20GeV")
327 pi_NormalizedLongitudinalProfile20GeV.GetYaxis().SetTitle("1/E_{tot}#timesdE/dx[1/#lambda]")
328 pi_NormalizedLongitudinalProfile50GeV=pi_LongitudinalProfile50GeV.Clone()
329 pi_NormalizedLongitudinalProfile50GeV.Scale(1./pi_LongitudinalProfile50GeV.Integral("width"))
330 pi_NormalizedLongitudinalProfile50GeV.SetName("pi_NormalizedLongitudinalProfile50GeV")
331 pi_NormalizedLongitudinalProfile50GeV.GetYaxis().SetTitle("1/E_{tot}#timesdE/dx[1/#lambda]")
332 pi_NormalizedLongitudinalProfile100GeV=pi_LongitudinalProfile100GeV.Clone()
333 pi_NormalizedLongitudinalProfile100GeV.Scale(1./pi_LongitudinalProfile100GeV.Integral("width"))
334 pi_NormalizedLongitudinalProfile100GeV.SetName("pi_NormalizedLongitudinalProfile100GeV")
335 pi_NormalizedLongitudinalProfile100GeV.GetYaxis().SetTitle("1/E_{tot}#timesdE/dx[1/#lambda]")
336 pi_NormalizedLongitudinalProfile180GeV=pi_LongitudinalProfile180GeV.Clone()
337 pi_NormalizedLongitudinalProfile180GeV.Scale(1./pi_LongitudinalProfile180GeV.Integral("width"))
338 pi_NormalizedLongitudinalProfile180GeV.SetName("pi_NormalizedLongitudinalProfile180GeV")
339 pi_NormalizedLongitudinalProfile180GeV.GetYaxis().SetTitle("1/E_{tot}#timesdE/dx[1/#lambda]")
340 pr_NormalizedLongitudinalProfile50GeV=pr_LongitudinalProfile50GeV.Clone()
341 pr_NormalizedLongitudinalProfile50GeV.Scale(1./pr_LongitudinalProfile50GeV.Integral("width"))
342 pr_NormalizedLongitudinalProfile50GeV.SetName("pr_NormalizedLongitudinalProfile50GeV")
343 pr_NormalizedLongitudinalProfile50GeV.GetYaxis().SetTitle("1/E_{tot}#timesdE/dx[1/#lambda]")
344 pr_NormalizedLongitudinalProfile100GeV=pr_LongitudinalProfile100GeV.Clone()
345 pr_NormalizedLongitudinalProfile100GeV.Scale(1./pr_LongitudinalProfile100GeV.Integral("width"))
346 pr_NormalizedLongitudinalProfile100GeV.SetName("pr_NormalizedLongitudinalProfile100GeV")
347 pr_NormalizedLongitudinalProfile100GeV.GetYaxis().SetTitle("1/E_{tot}#timesdE/dx[1/#lambda]")
348 pr_NormalizedLongitudinalProfile180GeV=pr_LongitudinalProfile180GeV.Clone()
349 pr_NormalizedLongitudinalProfile180GeV.Scale(1./pr_LongitudinalProfile180GeV.Integral("width"))
350 pr_NormalizedLongitudinalProfile180GeV.SetName("pr_NormalizedLongitudinalProfile180GeV")
351 pr_NormalizedLongitudinalProfile180GeV.GetYaxis().SetTitle("1/E_{tot}#timesdE/dx[1/#lambda]")
352
353 # draw plots of response resolution and longitudinal profile
354 DrawSingleGraphErrorsOnCanvas("{}/pi_LateralSpread".format(OutPathPlot), gr_pilateralspread,"AP", False, False, False)
355 DrawSingleGraphErrorsOnCanvas("{}/pi_Response".format(OutPathPlot), gr_piresponse,"AP",False, False, False)
356 DrawSingleGraphErrorsOnCanvas("{}/pi_Resolution".format(OutPathPlot), gr_piresolution,"AP", False, False, False)
357 DrawSingleGraphErrorsOnCanvas("{}/pr_LateralSpread".format(OutPathPlot), gr_pilateralspread,"AP", False, False, False)
358 DrawSingleGraphErrorsOnCanvas("{}/pr_Resolution".format(OutPathPlot), gr_prresolution,"AP")
359
360 # draw of response resolution and longitudinal profile of pion and proton on same canvas
361 DrawTwoGraphErrorsOnCanvas("{}/pipr_Resolution".format(OutPathPlot), gr_piresolution, gr_prresolution,"AP", "AP", False, False, False)
362 DrawTwoGraphErrorsOnCanvas("{}/pipr_Response".format(OutPathPlot), gr_piresponse, gr_prresponse,"AP", "AP", False, False, False)
363 DrawTwoGraphErrorsOnCanvas("{}/pipr_LateralSpread".format(OutPathPlot), gr_pilateralspread, gr_prlateralspread,"AP", "AP", False, False, False)
364
365 # draw single longitudinal profile of each beam energy
366 DrawSingleHistOnCanvas("{}/pi_LongitudinalProfile20GeV".format(OutPathPlot),pi_LongitudinalProfile20GeV, "PE", False, True, False)
367 DrawSingleHistOnCanvas("{}/pi_LongitudinalProfile50GeV".format(OutPathPlot),pi_LongitudinalProfile50GeV, "PE", False, True, False)
368 DrawSingleHistOnCanvas("{}/pi_LongitudinalProfile100GeV".format(OutPathPlot),pi_LongitudinalProfile100GeV, "PE", False, True, False)
369 DrawSingleHistOnCanvas("{}/pi_LongitudinalProfile180GeV".format(OutPathPlot),pi_LongitudinalProfile180GeV, "PE", False, True, False)
370 DrawSingleHistOnCanvas("{}/pi_NormalizedLongitudinalProfile20GeV".format(OutPathPlot),pi_LongitudinalProfile20GeV, "PE", False, True, False)
371 DrawSingleHistOnCanvas("{}/pi_NormalizedLongitudinalProfile50GeV".format(OutPathPlot),pi_LongitudinalProfile50GeV, "PE", False, True, False)
372 DrawSingleHistOnCanvas("{}/pi_NormalizedLongitudinalProfile100GeV".format(OutPathPlot),pi_LongitudinalProfile100GeV, "PE", False, True, False)
373 DrawSingleHistOnCanvas("{}/pi_NormalizedLongitudinalProfile180GeV".format(OutPathPlot),pi_LongitudinalProfile180GeV, "PE", False, True, False)
374
375 # draw 4 longitudinal profiles of pions of 4 beam energies on same canvas
376 pi_LongitudinalProfile20GeV.GetYaxis().SetRangeUser(1E-3, 100.)
377 pi_NormalizedLongitudinalProfile20GeV.GetYaxis().SetRangeUser(1E-5, 1.)
378 DrawFourHistsOnCanvas("{}/pi_LongitudinalProfile_LogY".format(OutPathPlot),pi_LongitudinalProfile20GeV,pi_LongitudinalProfile50GeV,pi_LongitudinalProfile100GeV,pi_LongitudinalProfile180GeV,"pe", "pesame", "pesame", "pesame", False, True, False, "Pion")
379 DrawFourHistsOnCanvas("{}/pi_NormalizedLongitudinalProfile_LogY".format(OutPathPlot),pi_NormalizedLongitudinalProfile20GeV,pi_NormalizedLongitudinalProfile50GeV,pi_NormalizedLongitudinalProfile100GeV,pi_NormalizedLongitudinalProfile180GeV,"pe", "pesame", "pesame", "pesame", False, True, False, "Pion")
380 pi_LongitudinalProfile20GeV.GetYaxis().SetRangeUser(0., 40.)
381 pi_NormalizedLongitudinalProfile20GeV.GetYaxis().SetRangeUser(0., 0.25)
382 DrawFourHistsOnCanvas("{}/pi_LongitudinalProfile".format(OutPathPlot),pi_LongitudinalProfile20GeV,pi_LongitudinalProfile50GeV,pi_LongitudinalProfile100GeV,pi_LongitudinalProfile180GeV,"pe", "pesame", "pesame", "pesame", False, False, False, "Pion")
383 DrawFourHistsOnCanvas("{}/pi_NormalizedLongitudinalProfile".format(OutPathPlot),pi_NormalizedLongitudinalProfile20GeV,pi_NormalizedLongitudinalProfile50GeV,pi_NormalizedLongitudinalProfile100GeV,pi_NormalizedLongitudinalProfile180GeV,"pe", "pesame", "pesame", "pesame", False, False, False, "Pion")
384
385 # draw 3 longitudinal profiles of pions of 3 beam energies of pion on same canvas
386 DrawSingleHistOnCanvas("{}/pr_LongitudinalProfile50GeV".format(OutPathPlot),pr_LongitudinalProfile50GeV,"PE", False, True, False)
387 DrawSingleHistOnCanvas("{}/pr_LongitudinalProfile100GeV".format(OutPathPlot),pr_LongitudinalProfile100GeV, "PE", False, True, False)
388 DrawSingleHistOnCanvas("{}/pr_LongitudinalProfile180GeV".format(OutPathPlot),pr_LongitudinalProfile180GeV, "PE", False, True, False)
389
390 # draw 3 longitudinal profiles of proton of 3 beam energies on same canvas
391 pr_LongitudinalProfile50GeV.GetYaxis().SetRangeUser(1E-3, 100.)
392 pr_NormalizedLongitudinalProfile50GeV.GetYaxis().SetRangeUser(1E-5, 1.)
393 DrawThreeHistsOnCanvas("{}/pr_LongitudinalProfile_LogY".format(OutPathPlot),pr_LongitudinalProfile50GeV, pr_LongitudinalProfile100GeV, pr_LongitudinalProfile180GeV, "pe", "pesame", "pesame", False, True, False, "Proton")
394 DrawThreeHistsOnCanvas("{}/pr_NormalizedLongitudinalProfile_LogY".format(OutPathPlot),pr_NormalizedLongitudinalProfile50GeV, pr_NormalizedLongitudinalProfile100GeV, pr_NormalizedLongitudinalProfile180GeV, "pe", "pesame", "pesame", False, True, False, "Proton")
395 pr_LongitudinalProfile50GeV.GetYaxis().SetRangeUser(0., 40.)
396 pr_NormalizedLongitudinalProfile50GeV.GetYaxis().SetRangeUser(0., 0.25)
397 DrawThreeHistsOnCanvas("{}/pr_LongitudinalProfile".format(OutPathPlot),pr_LongitudinalProfile50GeV, pr_LongitudinalProfile100GeV, pr_LongitudinalProfile180GeV, "pe", "pesame", "pesame", False, False, False, "Proton")
398 DrawThreeHistsOnCanvas("{}/pr_NormalizedLongitudinalProfile".format(OutPathPlot),pr_NormalizedLongitudinalProfile50GeV, pr_NormalizedLongitudinalProfile100GeV, pr_NormalizedLongitudinalProfile180GeV, "pe", "pesame", "pesame", False, False, False, "Proton")
399 # save
400 gr_piresponse.Write()
401 gr_piresolution.Write()
402 gr_pilateralspread.Write()
403 gr_prresponse.Write()
404 gr_prresolution.Write()
405 gr_prlateralspread.Write()
406 pi_LongitudinalProfile20GeV.Write()
407 pi_LongitudinalProfile50GeV.Write()
408 pi_LongitudinalProfile100GeV.Write()
409 pi_LongitudinalProfile180GeV.Write()
410 pi_NormalizedLongitudinalProfile20GeV.Write()
411 pi_NormalizedLongitudinalProfile50GeV.Write()
412 pi_NormalizedLongitudinalProfile100GeV.Write()
413 pi_NormalizedLongitudinalProfile180GeV.Write()
414 pr_LongitudinalProfile50GeV.Write()
415 pr_LongitudinalProfile100GeV.Write()
416 pr_LongitudinalProfile180GeV.Write()
417 pr_NormalizedLongitudinalProfile50GeV.Write()
418 pr_NormalizedLongitudinalProfile100GeV.Write()
419 pr_NormalizedLongitudinalProfile180GeV.Write()
420 outputFile.Write()
421
422# compare the mc results with data
424 for Particle in Particles: # loop over particles
425 inputFile = ROOT.TFile.Open('{}/{}/Properities_{}.root'.format(ResultDir,Particle,Particle)) # input file generated in GetPlotSingleProperty(), contain all MC results
426 inputFile2 = ROOT.TFile.Open('{}/data/data.root'.format(ResultDir)) # input file generated in GetDataPlotSingleProperty(), contain all Data results
427 if not inputFile:
428 continue
429 outputFile = ROOT.TFile.Open('{}/{}/{}_Ratio.root'.format(ResultDir, Particle, Particle),'RECREATE') # out file to store rations of MC to data
430
431 ResponseList = [] # list of responses of all physics lists
432 ResolutionList = [] # list of reslotionss of all physics lists
433 LateralSpreadList = [] # list of latreal spreadd of all physics lists
434 ResponseRatioList = [] #list of ratios of responses MCs with all physics lists to data
435 ResolutionRatioList = [] # list of ratios of resolutions MCs to data
436 LateralSpreadRatioList = [] # list of ratios of lateral spreads MCs to data
437
438 # get grapherrors from data file
439 ger_dataresponse = inputFile2.Get("{}_Response".format(Particle))
440 ger_dataresolution = inputFile2.Get("{}_Resolution".format(Particle))
441 ger_datalateralspread = inputFile2.Get("{}_LateralSpread".format(Particle))
442 # list of profiles of all beam energies
443 datalongitudinalprofilelist = []
444 datanormalizedlongitudinalprofilelist = []
445
446 # list of profiles of MC
447 mclongitudinalprofilelists = []
448 mcnormalizedlongitudinalprofilelists = []
449 # list of ratios of profiles of MCs to data
450 longitudinalprofileratiolists = []
451 normalizedlongitudinalprofileratiolists = []
452
453 # loop over the beam energies to get all profiles of this particle of data
454 for Energy in Energies:
455 # proton doesn't has beam energy 20 GeV
456 if Particle=='pr' and Energy==20000: continue
457 datalongitudinalprofilelist.append(inputFile2.Get("{}_LongitudinalProfile_{}GeV".format(Particle, Energy/1000)))
458 datanormalizedlongitudinalprofilelist.append(inputFile2.Get("{}_NormalizedLongitudinalProfile{}GeV".format(Particle, Energy/1000)))
459
460 # loop over physics lists,
461 # to get all responses, resolutions and lateral spreads of each physics lists.
462 for PhysicsList in PhysicsLists:
463 ger_mcresponse = inputFile.Get("{}_{}_Response".format(Particle, PhysicsList))
464 ger_mcresponse.SetTitle(PhysicsList)
465 ger_mcresolution = inputFile.Get("{}_{}_Resolution".format(Particle, PhysicsList))
466 ger_mcresolution.SetTitle(PhysicsList)
467 ger_mclateralspread = inputFile.Get("{}_{}_LateralSpread".format(Particle, PhysicsList))
468 ger_mclateralspread.SetTitle(PhysicsList)
469
470 ResponseList.append(ger_mcresponse)
471 ResolutionList.append(ger_mcresolution)
472 LateralSpreadList.append(ger_mclateralspread)
473
474 N = ger_dataresponse.GetN()
475 # create histograms of responses, resolutions and lateral spreands of data,
476 # divide by the corresponding histogram of MC.
477 # number of bins = number of points in corresponding grapherrors.
478 h_data_response = ROOT.TH1F("h_data_response","data",N, 0, N) ;
479 h_data_resolution = ROOT.TH1F("h_data_resolution","data",N, 0, N) ;
480 h_data_lateralspread = ROOT.TH1F("h_data_lateralspread","data",N, 0, N) ;
481 Xs = ger_dataresponse.GetX()
482 Xerrors = ger_dataresponse.GetEX()
483 dataresponses = ger_dataresponse.GetY()
484 dataresolutions = ger_dataresolution.GetY()
485 datalateralspreads = ger_datalateralspread.GetY()
486 # fill the point values to histograms
487 for i in range(N):
488 h_data_response.SetBinContent(i+1, dataresponses[i])
489 h_data_response.SetBinError(i+1, ger_dataresponse.GetErrorY(i))
490 h_data_resolution.SetBinContent(i+1, dataresolutions[i])
491 h_data_resolution.SetBinError(i+1, ger_dataresolution.GetErrorY(i))
492 h_data_lateralspread.SetBinContent(i+1, datalateralspreads[i])
493 h_data_lateralspread.SetBinError(i+1, ger_datalateralspread.GetErrorY(i))
494 # create histograms of responses, resolutions and lateral spreands of MC.
495 h_mc_response = ROOT.TH1F("h_mc_response","",N, 0, N) ;
496 h_mc_resolution = ROOT.TH1F("h_mc_resolution","",N, 0, N) ;
497 h_mc_lateralspread = ROOT.TH1F("h_mc_lateralspread","",N, 0, N) ;
498 mcresponses = ger_mcresponse.GetY()
499 mcresolutions = ger_mcresolution.GetY()
500 mclateralspreads = ger_mclateralspread.GetY()
501 for i in range(N):
502 if Particle=="pr":
503 # ptoton doesn't have 20 GeV, so skip the first point in grapherrors
504 h_mc_response.SetBinContent(i+1, mcresponses[i+1])
505 h_mc_response.SetBinError(i+1, ger_mcresponse.GetErrorY(i+1))
506 h_mc_resolution.SetBinContent(i+1, mcresolutions[i+1])
507 h_mc_resolution.SetBinError(i+1, ger_mcresolution.GetErrorY(i+1))
508 h_mc_lateralspread.SetBinContent(i+1, mclateralspreads[i])
509 h_mc_lateralspread.SetBinError(i+1, ger_mclateralspread.GetErrorY(i+1))
510 elif Particle=="pi":
511 h_mc_response.SetBinContent(i+1, mcresponses[i])
512 h_mc_response.SetBinError(i+1, ger_mcresponse.GetErrorY(i))
513 h_mc_resolution.SetBinContent(i+1, mcresolutions[i])
514 h_mc_resolution.SetBinError(i+1, ger_mcresolution.GetErrorY(i))
515 h_mc_lateralspread.SetBinContent(i+1, mclateralspreads[i])
516 h_mc_lateralspread.SetBinError(i+1, ger_mclateralspread.GetErrorY(i))
517 # divide two hists to get the ratios
518 h_response_ratio = h_mc_response.Clone()
519 h_response_ratio.Divide(h_data_response)
520 h_resolution_ratio = h_mc_resolution.Clone()
521 h_resolution_ratio.Divide(h_data_resolution)
522 h_lateralspread_ratio = h_mc_lateralspread.Clone()
523 h_lateralspread_ratio.Divide(h_data_lateralspread)
524 # create grapherrors of ratios
525 ger_response_ratio = ROOT.TGraphErrors()
526 ger_response_ratio.SetName("{}_{}_Response_Ratio".format(Particle, PhysicsList))
527 ger_response_ratio.SetTitle(PhysicsList)
528 ger_resolution_ratio = ROOT.TGraphErrors()
529 ger_resolution_ratio.SetName("{}_{}_Resolution_Ratio".format(Particle, PhysicsList))
530 ger_resolution_ratio.SetTitle(PhysicsList)
531 ger_lateralspread_ratio = ROOT.TGraphErrors()
532 ger_lateralspread_ratio.SetName(PhysicsList)
533 ger_lateralspread_ratio.SetTitle(PhysicsList)
534 # set point values of grapherrors of ratios
535 for i in range(N):
536 ger_response_ratio.SetPoint(i, Xs[i], h_response_ratio.GetBinContent(i+1))
537 ger_response_ratio.SetPointError(i, Xerrors[i], h_response_ratio.GetBinError(i+1))
538 ger_resolution_ratio.SetPoint(i, Xs[i], h_resolution_ratio.GetBinContent(i+1))
539 ger_resolution_ratio.SetPointError(i, Xerrors[i], h_resolution_ratio.GetBinError(i+1))
540 ger_lateralspread_ratio.SetPoint(i, Xs[i], h_lateralspread_ratio.GetBinContent(i+1))
541 ger_lateralspread_ratio.SetPointError(i, Xerrors[i], h_lateralspread_ratio.GetBinError(i+1))
542 ger_response_ratio.GetXaxis().SetTitle("E_{beam}[GeV]")
543 ger_response_ratio.GetYaxis().SetTitle("MC/Data")
544 ger_resolution_ratio.GetXaxis().SetTitle("E_{beam}[GeV]")
545 ger_resolution_ratio.GetYaxis().SetTitle("MC/Data")
546 ger_lateralspread_ratio.GetXaxis().SetTitle("E_{beam}[GeV]")
547 ger_lateralspread_ratio.GetYaxis().SetTitle("MC/Data")
548
549 outputFile.cd()
550 # save
551 ger_response_ratio.Write()
552 ger_resolution_ratio.Write()
553 ger_lateralspread_ratio.Write()
554 # append to list
555 ResponseRatioList.append(ger_response_ratio)
556 ResolutionRatioList.append(ger_resolution_ratio)
557 LateralSpreadRatioList.append(ger_lateralspread_ratio)
558 # draw the single ratio
559 DrawSingleGraphErrorsOnCanvas("{}/{}/{}_{}_Response_Ratio".format(PlotDir, Particle, Particle, PhysicsList), ger_response_ratio,"AP", False, False, False, PhysicsList)
560 DrawSingleGraphErrorsOnCanvas("{}/{}/{}_{}_LateralSpread_Ratio".format(PlotDir, Particle, Particle, PhysicsList), ger_lateralspread_ratio,"AP", False, False, False, PhysicsList)
561 DrawSingleGraphErrorsOnCanvas("{}/{}/{}_{}_Resolution_Ratio".format(PlotDir, Particle, Particle, PhysicsList), ger_resolution_ratio,"AP", False, False, False, PhysicsList)
562
563 #------------------Longitudinal Profile----------------------------
564 # list of longitudinal profile of all types of particles and all beam energies and all physics lists
565 # N = N of types of particles * N of beam energies * N of physics lists
566 mclongitudinalprofilelist=[]
567 mcnormalizedlongitudinalprofilelist=[]
568 mclongitudinalprofileratiolist=[]
569 mcnormalizedlongitudinalprofileratiolist=[]
570 for Energy in Energies:
571 # skip 20 GeV for proton
572 if Particle=='pr' and Energy==20000: continue
573 mclongitudinalprofilelist.append(inputFile.Get("{}_{}GeV_{}_LongitudinalProfile".format(Particle, Energy/1000,PhysicsList)))
574 mcnormalizedlongitudinalprofilelist.append(inputFile.Get("{}_{}GeV_{}_NormalizedLongitudinalProfile".format(Particle, Energy/1000, PhysicsList)))
575 print mclongitudinalprofilelist, mcnormalizedlongitudinalprofilelist
576
577 # get the ratios of longitudinal profiles
578 for i in range(len(mclongitudinalprofilelist)):
579 longitudinalprofilelistratio = mclongitudinalprofilelist[i].Clone()
580 longitudinalprofilelistratio.Divide(datalongitudinalprofilelist[i])
581 longitudinalprofilelistratio.SetName(longitudinalprofilelistratio.GetName()+"_Ratio")
582 longitudinalprofilelistratio.GetYaxis().SetTitle("MC/Data")
583 longitudinalprofilelistratio.GetYaxis().SetRangeUser(0.65, 1.45)
584 longitudinalprofilelistratio.Write()
585 mclongitudinalprofileratiolist.append(longitudinalprofilelistratio)
586 normalizedlongitudinalprofilelistratio = mcnormalizedlongitudinalprofilelist[i].Clone()
587 normalizedlongitudinalprofilelistratio.Divide(datanormalizedlongitudinalprofilelist[i])
588 normalizedlongitudinalprofilelistratio.SetName(normalizedlongitudinalprofilelistratio.GetName()+"_Ratio")
589 normalizedlongitudinalprofilelistratio.GetYaxis().SetTitle("MC/Data")
590 normalizedlongitudinalprofilelistratio.GetYaxis().SetRangeUser(0.65, 1.45)
591 normalizedlongitudinalprofilelistratio.Write()
592 mcnormalizedlongitudinalprofileratiolist.append(normalizedlongitudinalprofilelistratio)
593 # draw single ratio of longitudinal profiles
594 if Particle=="pr":
595 DrawSingleHistOnCanvas("{}/{}/{}_{}_{}_LongitudinalProfile_Ratio".format(PlotDir, Particle, Particle, Energies[i+1]/1000, PhysicsList),longitudinalprofilelistratio, "PE", False, False)
596 DrawSingleHistOnCanvas("{}/{}/{}_{}_{}_NormalizedLongitudinalProfile_Ratio".format(PlotDir, Particle, Particle, Energies[i+1]/1000, PhysicsList),normalizedlongitudinalprofilelistratio, "PE", False, False)
597 elif Particle=="pi":
598 DrawSingleHistOnCanvas("{}/{}/{}_{}_{}_LongitudinalProfile_Ratio".format(PlotDir, Particle, Particle, Energies[i]/1000, PhysicsList),longitudinalprofilelistratio, "PE", False, False)
599 DrawSingleHistOnCanvas("{}/{}/{}_{}_{}_NormalizedLongitudinalProfile_Ratio".format(PlotDir, Particle, Particle, Energies[i]/1000, PhysicsList),normalizedlongitudinalprofilelistratio, "PE", False, False)
600 # append the ratio to list
601 mclongitudinalprofilelists.append(mclongitudinalprofilelist)
602 mcnormalizedlongitudinalprofilelists.append(mcnormalizedlongitudinalprofilelist)
603 longitudinalprofileratiolists.append(mclongitudinalprofileratiolist)
604 normalizedlongitudinalprofileratiolists.append(mcnormalizedlongitudinalprofileratiolist)
605 FullParticleName=""
606 # draw rations of longitudinal profiles of all beam energies on same canvas
607 if Particle=='pi':
608 FullParticleName = "Pion"
609 DrawFourHistsOnCanvas("{}/{}/{}_{}_LongitudinalProfile_Ratio".format(PlotDir, Particle, Particle, PhysicsList),mclongitudinalprofileratiolist[0],mclongitudinalprofileratiolist[1],mclongitudinalprofileratiolist[2],mclongitudinalprofileratiolist[3], "PE","pesame","pesame","pesame", False, False, False, FullParticleName, PhysicsList)
610 DrawFourHistsOnCanvas("{}/{}/{}_{}_NormalizedLongitudinalProfile_Ratio".format(PlotDir, Particle, Particle, PhysicsList),mcnormalizedlongitudinalprofileratiolist[0],mcnormalizedlongitudinalprofileratiolist[1],mcnormalizedlongitudinalprofileratiolist[2],mcnormalizedlongitudinalprofileratiolist[3], "PE","pesame","pesame","pesame", False, False, False, FullParticleName,PhysicsList)
611 else:
612 FullParticleName = "Proton"
613 DrawThreeHistsOnCanvas("{}/{}/{}_{}_LongitudinalProfile_Ratio".format(PlotDir, Particle, Particle, PhysicsList),mclongitudinalprofileratiolist[0],mclongitudinalprofileratiolist[1],mclongitudinalprofileratiolist[2], "PE","pesame","pesame", False, False, False, FullParticleName, PhysicsList)
614 DrawThreeHistsOnCanvas("{}/{}/{}_{}_NormalizedLongitudinalProfile_Ratio".format(PlotDir, Particle, Particle, PhysicsList),mcnormalizedlongitudinalprofileratiolist[0],mcnormalizedlongitudinalprofileratiolist[1],mcnormalizedlongitudinalprofileratiolist[2], "PE","pesame","pesame", False, False, False, FullParticleName, PhysicsList)
615
616 FullParticleName=""
617 if Particle=='pi':
618 FullParticleName = "Pion"
619 ger_dataresponse.SetTitle("Data")
620 ger_dataresolution.SetTitle("Data")
621 ger_datalateralspread.SetTitle("Data")
622 elif Particle=='pr':
623 FullParticleName = "Proton"
624 ger_dataresponse.GetXaxis().SetRangeUser(40, 190)
625 ger_dataresolution.GetXaxis().SetRangeUser(40, 190)
626 ger_datalateralspread.GetXaxis().SetRangeUser(40, 190)
627 ger_dataresponse.SetTitle("Data")
628 ger_dataresolution.SetTitle("Data")
629 ger_datalateralspread.SetTitle("Data")
630 for npr in range(len(ResponseList)):
631 ResponseList[npr].GetXaxis().SetRangeUser(40, 190)
632 ResolutionList[npr].GetXaxis().SetRangeUser(40, 190)
633 LateralSpreadList[npr].GetXaxis().SetRangeUser(40, 190)
634 ResponseRatioList[npr].GetXaxis().SetRangeUser(40, 190)
635 ResolutionRatioList[npr].GetXaxis().SetRangeUser(40, 190)
636 LateralSpreadRatioList[npr].GetXaxis().SetRangeUser(40, 190)
637 ResponseList[npr].RemovePoint(0)
638 ResolutionList[npr].RemovePoint(0)
639 LateralSpreadList[npr].RemovePoint(0)
640
641 # draw responses, resolutions and lateral spread of all physcis lists on same canvas.
642 # draw responses, resolutions and lateral spread of all physcis lists and data on top,
643 # and ratios of MC to data on bottom
644 DrawFourGraphErrorsOnCanvas("{}/{}/{}_Response_Ratio".format(PlotDir, Particle, Particle),ResponseRatioList[0], ResponseRatioList[1], ResponseRatioList[2],ResponseRatioList[3], "AP","AP","AP","AP", False, False, False, FullParticleName)
645 DrawTopFiveGraphErrorsAndBottomFourGraphErrorsOnCanvas("{}/{}/{}_TopResponseBottomRatio".format(PlotDir, Particle, Particle),ger_dataresponse, ResponseList[0], ResponseList[1], ResponseList[2],ResponseList[3], ResponseRatioList[0], ResponseRatioList[1], ResponseRatioList[2],ResponseRatioList[3], "AP","AP","AP","AP", "AP","AP","AP","AP", "AP", False, False, False, False, FullParticleName)
646 DrawFourGraphErrorsOnCanvas("{}/{}/{}_Resolution_Ratio".format(PlotDir, Particle, Particle),ResolutionRatioList[0], ResolutionRatioList[1], ResolutionRatioList[2],ResolutionRatioList[3],"AP","AP","AP","AP", False, False, False,FullParticleName)
647 DrawTopFiveGraphErrorsAndBottomFourGraphErrorsOnCanvas("{}/{}/{}_TopResolutionBottomRatio".format(PlotDir, Particle, Particle),ger_dataresolution, ResolutionList[0], ResolutionList[1], ResolutionList[2],ResolutionList[3], ResolutionRatioList[0], ResolutionRatioList[1], ResolutionRatioList[2],ResolutionRatioList[3], "AP","AP","AP","AP", "AP","AP","AP","AP", "AP", False, False, False, False, FullParticleName)
648 DrawFourGraphErrorsOnCanvas("{}/{}/{}_LateralSpread_Ratio".format(PlotDir, Particle, Particle),LateralSpreadRatioList[0], LateralSpreadRatioList[1], LateralSpreadRatioList[2],LateralSpreadRatioList[3],"AP","AP","AP","AP", False, False, False,FullParticleName)
649 DrawTopFiveGraphErrorsAndBottomFourGraphErrorsOnCanvas("{}/{}/{}_TopLateralSpreadBottomRatio".format(PlotDir, Particle, Particle),ger_datalateralspread, LateralSpreadList[0], LateralSpreadList[1], LateralSpreadList[2],LateralSpreadList[3], LateralSpreadRatioList[0], LateralSpreadRatioList[1], LateralSpreadRatioList[2],LateralSpreadRatioList[3], "AP","AP","AP","AP", "AP","AP","AP","AP", "AP", False, False, False, False, FullParticleName)
650
651 for i in range(len(Energies)):
652 if Particle=="pi":
653 datalongitudinalprofilelist[i].GetYaxis().SetRangeUser(5E-3, 100.)
654 if(Energies[i]==20000):
655 datalongitudinalprofilelist[i].GetYaxis().SetRangeUser(5E-3, 10.)
656 datalongitudinalprofilelist[i].SetTitle("Data")
657 mclongitudinalprofilelists[0][i].SetTitle(PhysicsLists[0])
658 mclongitudinalprofilelists[1][i].SetTitle(PhysicsLists[1])
659 mclongitudinalprofilelists[2][i].SetTitle(PhysicsLists[2])
660 mclongitudinalprofilelists[3][i].SetTitle(PhysicsLists[3])
661 longitudinalprofileratiolists[0][i].SetTitle(PhysicsLists[0])
662 longitudinalprofileratiolists[1][i].SetTitle(PhysicsLists[1])
663 longitudinalprofileratiolists[2][i].SetTitle(PhysicsLists[2])
664 longitudinalprofileratiolists[3][i].SetTitle(PhysicsLists[3])
665 datanormalizedlongitudinalprofilelist[i].GetYaxis().SetRangeUser(5E-5, 1.)
666 datanormalizedlongitudinalprofilelist[i].SetTitle("Data")
667 mcnormalizedlongitudinalprofilelists[0][i].SetTitle(PhysicsLists[0])
668 mcnormalizedlongitudinalprofilelists[1][i].SetTitle(PhysicsLists[1])
669 mcnormalizedlongitudinalprofilelists[2][i].SetTitle(PhysicsLists[2])
670 mcnormalizedlongitudinalprofilelists[3][i].SetTitle(PhysicsLists[3])
671 normalizedlongitudinalprofileratiolists[0][i].SetTitle(PhysicsLists[0])
672 normalizedlongitudinalprofileratiolists[1][i].SetTitle(PhysicsLists[1])
673 normalizedlongitudinalprofileratiolists[2][i].SetTitle(PhysicsLists[2])
674 normalizedlongitudinalprofileratiolists[3][i].SetTitle(PhysicsLists[3])
675 # draw profiles of all physcis lists of each beam energy on same canvas
676 # draw profiles of all physcis lists of each beam energy and data on top, ratios of MC to data on bottom
677 DrawFiveHistsOnCanvas("{}/{}/{}_LongitudinalProfileWithData_{}GeV".format(PlotDir, Particle, Particle, Energies[i]/1000),datalongitudinalprofilelist[i],mclongitudinalprofilelists[0][i], mclongitudinalprofilelists[1][i],mclongitudinalprofilelists[2][i],mclongitudinalprofilelists[3][i], "PE", "PESame", "PESame", "PESame", "PESame", False, True, False, "Pion", "E_{beam}="+"{}GeV".format(Energies[i]/1000))
678 DrawFiveHistsOnCanvas("{}/{}/{}_NormalizedLongitudinalProfileWithData_{}GeV".format(PlotDir, Particle, Particle, Energies[i]/1000),datanormalizedlongitudinalprofilelist[i],mcnormalizedlongitudinalprofilelists[0][i], mcnormalizedlongitudinalprofilelists[1][i],mcnormalizedlongitudinalprofilelists[2][i],mcnormalizedlongitudinalprofilelists[3][i], "PE", "PESame", "PESame", "PESame", "PESame", False, True, False, "Pion", "E_{beam}="+"{}GeV".format(Energies[i]/1000))
679 DrawFourHistsOnCanvas("{}/{}/{}_LongitudinalProfile_Ratio_{}GeV".format(PlotDir, Particle, Particle, Energies[i]/1000),longitudinalprofileratiolists[0][i], longitudinalprofileratiolists[1][i],longitudinalprofileratiolists[2][i],longitudinalprofileratiolists[3][i], "PE", "PESame", "PESame", "PESame", False, False, False, "Pion", "E_{beam}="+"{}GeV".format(Energies[i]/1000))
680 DrawFourHistsOnCanvas("{}/{}/{}_NormalizedLongitudinalProfile_Ratio_{}GeV".format(PlotDir, Particle, Particle, Energies[i]/1000),normalizedlongitudinalprofileratiolists[0][i], normalizedlongitudinalprofileratiolists[1][i],normalizedlongitudinalprofileratiolists[2][i],normalizedlongitudinalprofileratiolists[3][i], "PE", "PESame", "PESame", "PESame", False, False, False, "Pion", "E_{beam}="+"{}GeV".format(Energies[i]/1000))
681 DrawTopFiveHistsAndBottomFourHistsOnCanvas("{}/{}/{}_TopLongitudinalProfileBottomRatio_{}GeV".format(PlotDir, Particle, Particle, Energies[i]/1000),datalongitudinalprofilelist[i], mclongitudinalprofilelists[0][i], mclongitudinalprofilelists[1][i],mclongitudinalprofilelists[2][i],mclongitudinalprofilelists[3][i], longitudinalprofileratiolists[0][i], longitudinalprofileratiolists[1][i],longitudinalprofileratiolists[2][i],longitudinalprofileratiolists[3][i], "PE", "PESame", "PESame", "PESame", "PESame", "PE", "PESame", "PESame", "PESame", False, True, False, False, "Pion", "E_{beam}="+"{}GeV".format(Energies[i]/1000))
682 DrawTopFiveHistsAndBottomFourHistsOnCanvas("{}/{}/{}_TopNormalizedLongitudinalProfileBottomRatio_{}GeV".format(PlotDir, Particle, Particle, Energies[i]/1000),datanormalizedlongitudinalprofilelist[i], mcnormalizedlongitudinalprofilelists[0][i], mcnormalizedlongitudinalprofilelists[1][i],mcnormalizedlongitudinalprofilelists[2][i],mcnormalizedlongitudinalprofilelists[3][i], normalizedlongitudinalprofileratiolists[0][i], normalizedlongitudinalprofileratiolists[1][i],normalizedlongitudinalprofileratiolists[2][i],normalizedlongitudinalprofileratiolists[3][i], "PE", "PESame", "PESame", "PESame", "PESame", "PE", "PESame", "PESame", "PESame", False, True, False, False, "Pion", "E_{beam}="+"{}GeV".format(Energies[i]/1000))
683 elif Particle=="pr":
684 # proton doesn't have beam energy og 20 GeV in data.
685 if Energies[i]==20000: continue
686 datalongitudinalprofilelist[i-1].GetYaxis().SetRangeUser(5E-3, 100.)
687 datalongitudinalprofilelist[i-1].SetTitle("Data")
688 mclongitudinalprofilelists[0][i-1].SetTitle(PhysicsLists[0])
689 mclongitudinalprofilelists[1][i-1].SetTitle(PhysicsLists[1])
690 mclongitudinalprofilelists[2][i-1].SetTitle(PhysicsLists[2])
691 mclongitudinalprofilelists[3][i-1].SetTitle(PhysicsLists[3])
692 longitudinalprofileratiolists[0][i-1].SetTitle(PhysicsLists[0])
693 longitudinalprofileratiolists[1][i-1].SetTitle(PhysicsLists[1])
694 longitudinalprofileratiolists[2][i-1].SetTitle(PhysicsLists[2])
695 longitudinalprofileratiolists[3][i-1].SetTitle(PhysicsLists[3])
696 datanormalizedlongitudinalprofilelist[i-1].GetYaxis().SetRangeUser(5E-5, 1.)
697 datanormalizedlongitudinalprofilelist[i-1].SetTitle("Data")
698 mcnormalizedlongitudinalprofilelists[0][i-1].SetTitle(PhysicsLists[0])
699 mcnormalizedlongitudinalprofilelists[1][i-1].SetTitle(PhysicsLists[1])
700 mcnormalizedlongitudinalprofilelists[2][i-1].SetTitle(PhysicsLists[2])
701 mcnormalizedlongitudinalprofilelists[3][i-1].SetTitle(PhysicsLists[3])
702 normalizedlongitudinalprofileratiolists[0][i-1].SetTitle(PhysicsLists[0])
703 normalizedlongitudinalprofileratiolists[1][i-1].SetTitle(PhysicsLists[1])
704 normalizedlongitudinalprofileratiolists[2][i-1].SetTitle(PhysicsLists[2])
705 normalizedlongitudinalprofileratiolists[3][i-1].SetTitle(PhysicsLists[3])
706 DrawFiveHistsOnCanvas("{}/{}/{}_LongitudinalProfileWithData_{}GeV".format(PlotDir, Particle, Particle, Energies[i]/1000),datalongitudinalprofilelist[i-1],mclongitudinalprofilelists[0][i-1], mclongitudinalprofilelists[1][i-1],mclongitudinalprofilelists[2][i-1], mclongitudinalprofilelists[3][i-1], "PE", "PESame", "PESame", "PESame", "PESame", False, True, False, "Proton", "E_{beam}="+"{}GeV".format(Energies[i]/1000))
707 DrawFiveHistsOnCanvas("{}/{}/{}_NormalizedLongitudinalProfileWithData_{}GeV".format(PlotDir, Particle, Particle, Energies[i]/1000),datanormalizedlongitudinalprofilelist[i-1],mcnormalizedlongitudinalprofilelists[0][i-1], mcnormalizedlongitudinalprofilelists[1][i-1],mcnormalizedlongitudinalprofilelists[2][i-1], mcnormalizedlongitudinalprofilelists[3][i-1], "PE", "PESame", "PESame", "PESame", "PESame", False, True, False, "Proton", "E_{beam}="+"{}GeV".format(Energies[i]/1000))
708 DrawFourHistsOnCanvas("{}/{}/{}_LongitudinalProfile_Ratio_{}GeV".format(PlotDir, Particle, Particle, Energies[i]/1000),longitudinalprofileratiolists[0][i-1], longitudinalprofileratiolists[1][i-1],longitudinalprofileratiolists[2][i-1], longitudinalprofileratiolists[3][i-1], "PE", "PESame", "PESame", "PESame", False, False, False, "Proton","E_{beam}="+"{}GeV".format(Energies[i]/1000))
709 DrawFourHistsOnCanvas("{}/{}/{}_NormalizedLongitudinalProfile_Ratio_{}GeV".format(PlotDir, Particle, Particle, Energies[i]/1000),normalizedlongitudinalprofileratiolists[0][i-1], normalizedlongitudinalprofileratiolists[1][i-1],normalizedlongitudinalprofileratiolists[2][i-1], normalizedlongitudinalprofileratiolists[3][i-1],"PE", "PESame", "PESame", "PESame", False, False, False, "Proton", "E_{beam}="+"{}GeV".format(Energies[i]/1000))
710 DrawTopFiveHistsAndBottomFourHistsOnCanvas("{}/{}/{}_TopLongitudinalProfileBottomRatio_{}GeV".format(PlotDir, Particle, Particle, Energies[i]/1000),datalongitudinalprofilelist[i-1], mclongitudinalprofilelists[0][i-1], mclongitudinalprofilelists[1][i-1],mclongitudinalprofilelists[2][i-1],mclongitudinalprofilelists[3][i-1], longitudinalprofileratiolists[0][i-1], longitudinalprofileratiolists[1][i-1],longitudinalprofileratiolists[2][i-1],longitudinalprofileratiolists[3][i-1], "PE", "PESame", "PESame", "PESame", "PESame", "PE", "PESame", "PESame", "PESame", False, True, False, False, "Proton", "E_{beam}="+"{}GeV".format(Energies[i]/1000))
711 DrawTopFiveHistsAndBottomFourHistsOnCanvas("{}/{}/{}_TopNormalizedLongitudinalProfileBottomRatio_{}GeV".format(PlotDir, Particle, Particle, Energies[i]/1000),datanormalizedlongitudinalprofilelist[i-1], mcnormalizedlongitudinalprofilelists[0][i-1], mcnormalizedlongitudinalprofilelists[1][i-1],mcnormalizedlongitudinalprofilelists[2][i-1],mcnormalizedlongitudinalprofilelists[3][i-1], normalizedlongitudinalprofileratiolists[0][i-1], normalizedlongitudinalprofileratiolists[1][i-1],normalizedlongitudinalprofileratiolists[2][i-1],normalizedlongitudinalprofileratiolists[3][i-1], "PE", "PESame", "PESame", "PESame", "PESame", "PE", "PESame", "PESame", "PESame", False, True, False, False, "Proton", "E_{beam}="+"{}GeV".format(Energies[i]/1000))
712
713
714# draw data and MC on same camvas, no ratios
716 for Particle in Particles: # loop over particles
717 # mc input files containing grapherrorses of responses, resolutions and lateral spreads and histograms of longitudinal profiles
718 inputFile = ROOT.TFile.Open('{}/{}/Properities_{}.root'.format(ResultDir, Particle, Particle))
719 # data input files containing grapherrorses of responses, resolutions and lateral spreads and histograms of longitudinal profiles
720 inputFile2 = ROOT.TFile.Open('{}/data/data.root'.format(ResultDir))
721 if not inputFile:
722 print "File: ",inputFile.GetName()," doesn't exist!!"
723 continue
724 # list of grapherrors and responses, resolutions and lateral spreads of MC
725 ResponseList = []
726 ResolutionList = []
727 LateralSpreadList = []
728 # list of grapherrors and responses, resolutions and lateral spreads of data and MC
729 ResponseListWithData = []
730 ResolutionListWithData = []
731 LateralSpreadListWithData = []
732 # get data results
733 ger_dataresponse = inputFile2.Get("{}_Response".format(Particle))
734 ger_dataresponse.SetTitle("Data")
735 ger_dataresolution = inputFile2.Get("{}_Resolution".format(Particle))
736 ger_dataresolution.SetTitle("Data")
737 ger_datalateralspread = inputFile2.Get("{}_LateralSpread".format(Particle))
738 ger_datalateralspread.SetTitle("Data")
739 ResponseListWithData.append(ger_dataresponse)
740 ResolutionListWithData.append(ger_dataresolution)
741 LateralSpreadListWithData.append(ger_datalateralspread)
742 # loop over physics to get grapherrors and responses,
743 # resolutions and lateral spreads of MC
744 for PhysicsList in PhysicsLists:
745 ger_response = inputFile.Get("{}_{}_Response".format(Particle, PhysicsList))
746 ger_response.SetTitle(PhysicsList)
747 ger_resolution = inputFile.Get("{}_{}_Resolution".format(Particle, PhysicsList))
748 ger_resolution.SetTitle(PhysicsList)
749 ger_lateralspread = inputFile.Get("{}_{}_LateralSpread".format(Particle, PhysicsList))
750 ger_lateralspread.SetTitle(PhysicsList)
751 ResponseList.append(ger_response)
752 ResolutionList.append(ger_resolution)
753 LateralSpreadList.append(ger_lateralspread)
754 ResponseListWithData.append(ger_response)
755 ResolutionListWithData.append(ger_resolution)
756 LateralSpreadListWithData.append(ger_lateralspread)
757 print ResponseList,ResolutionList,LateralSpreadList
758
759 FullParticleName=""
760 if Particle=='pi':
761 FullParticleName = "Pion"
762 else:
763 FullParticleName = "Proton"
764 # draw results of proton of MC and data on same canvas
765 if len(ResponseList)==3:
766 DrawThreeGraphErrorsOnCanvas("{}/{}/{}_Response".format(PlotDir,Particle,Particle),ResponseList[0], ResponseList[1], ResponseList[2],"AP","AP","AP")
767 DrawThreeGraphErrorsOnCanvas("{}/{}/{}_Resolution".format(PlotDir,Particle,Particle),ResolutionList[0], ResolutionList[1], ResolutionList[2],"AP","AP","AP")
768 # draw results of pion of MC and data on same canvas
769 elif len(ResponseList)==4:
770 DrawFourGraphErrorsOnCanvas("{}/{}/{}_Response".format(PlotDir,Particle,Particle),ResponseList[0], ResponseList[1], ResponseList[2],ResponseList[3], "AP","AP","AP","AP", False, False, False,FullParticleName)
771 DrawFourGraphErrorsOnCanvas("{}/{}/{}_Resolution".format(PlotDir,Particle,Particle),ResolutionList[0], ResolutionList[1], ResolutionList[2],ResolutionList[3],"AP","AP","AP","AP", False, False, False, FullParticleName)
772 DrawFourGraphErrorsOnCanvas("{}/{}/{}_LateralSpread".format(PlotDir,Particle,Particle),LateralSpreadList[0], LateralSpreadList[1], LateralSpreadList[2],LateralSpreadList[3],"AP","AP","AP","AP", False, False, False, FullParticleName)
773 DrawFiveGraphErrorsOnCanvas("{}/{}/{}_ResponseWithData".format(PlotDir,Particle,Particle),ResponseListWithData[0], ResponseListWithData[1], ResponseListWithData[2],ResponseListWithData[3], ResponseListWithData[4], "AP","AP","AP","AP", "AP", False, False, False,FullParticleName)
774 DrawFiveGraphErrorsOnCanvas("{}/{}/{}_ResolutionWithData".format(PlotDir,Particle,Particle),ResolutionListWithData[0], ResolutionListWithData[1], ResolutionListWithData[2],ResolutionListWithData[3],ResolutionListWithData[4], "AP","AP","AP","AP", "Ap", False, False, False,FullParticleName)
775 DrawFiveGraphErrorsOnCanvas("{}/{}/{}_LateralSpreadWithData".format(PlotDir,Particle,Particle),LateralSpreadListWithData[0], LateralSpreadListWithData[1], LateralSpreadListWithData[2],LateralSpreadListWithData[3],LateralSpreadListWithData[4],"AP","AP","AP","AP","AP", False, False, False,FullParticleName)
776
777if __name__ == '__main__':
780 ComDataMC()
int DrawFiveGraphErrorsOnCanvas(string canvasname, TGraphErrors *gre1, TGraphErrors *gre2, TGraphErrors *gre3, TGraphErrors *gre4, TGraphErrors *gre5, string drawopt1="APL", string drawopt2="PL", string drawopt3="PL", string drawopt4="PL", string drawopt5="PL", bool logx=false, bool logy=false, bool isrectangle=false, string header="", string label="")
int DrawSingleGraphErrorsOnCanvas(string canvasname, TGraphErrors *gre, string drawoption="AP", bool logx=false, bool logy=false, bool isrectangle=true, string label="")
int DrawThreeGraphErrorsOnCanvas(string canvasname, TGraphErrors *gre1, TGraphErrors *gre2, TGraphErrors *gre3, string drawopt1="APL", string drawopt2="PL", string drawopt3="PL", bool logx=false, bool logy=false, bool isrectangle=true, string header="", string label="")
int DrawTwoGraphErrorsOnCanvas(string canvasname, TGraphErrors *gre1, TGraphErrors *gre2, string drawoption1="APL", string drawoption2="PL", bool logx=false, bool logy=false, bool isrectangle=true)
int DrawFourGraphErrorsOnCanvas(string canvasname, TGraphErrors *gre1, TGraphErrors *gre2, TGraphErrors *gre3, TGraphErrors *gre4, string drawopt1="APL", string drawopt2="PL", string drawopt3="PL", string drawopt4="PL", bool logx=false, bool logy=false, bool isrectangle=false, string header="", string label="")
int DrawTopFiveGraphErrorsAndBottomFourGraphErrorsOnCanvas(string canvasname, TGraphErrors *topgre1, TGraphErrors *topgre2, TGraphErrors *topgre3, TGraphErrors *topgre4, TGraphErrors *topgre5, TGraphErrors *bottomgre1, TGraphErrors *bottomgre2, TGraphErrors *bottomgre3, TGraphErrors *bottomgre4, string topdrawopt1="APL", string topdrawopt2="PL", string topdrawopt3="PL", string topdrawopt4="PL", string topdrawopt5="PL", string bottomdrawopt1="APL", string bottomdrawopt2="PL", string bottomdrawopt3="PL", string bottomdrawopt4="PL", bool logx=false, bool toplogy=false, bool bottomlogy=false, bool isrectangle=false, string header="")
int DrawSingleHistOnCanvas(string canvasname, TH1F *hist, string drawoption="PE", bool logx=false, bool logy=true, bool isrectangle=false, string label="")
TH1F * bookTH1F(const std::string &name, const std::string &title, const std::string &xlabel, const std::string &ylabel, int xbins, double xlow, double xhigh, bool sumw2=true, bool overflow=true)
Definition HistToolKit.h:27
int DrawThreeHistsOnCanvas(string canvasname, TH1F *hist1, TH1F *hist2, TH1F *hist3, string drawopt1="PE", string drawopt2="PESame", string drawopt3="PESame", bool logx=false, bool logy=true, bool isrectangle=true, string header="", string label="")
int DrawTopFiveHistsAndBottomFourHistsOnCanvas(string canvasname, TH1F *top1, TH1F *top2, TH1F *top3, TH1F *top4, TH1F *top5, TH1F *bottom1, TH1F *bottom2, TH1F *bottom3, TH1F *bottom4, string topdrawopt1="PE", string topdrawopt2="PESAME", string topdrawopt3="PE", string topdrawopt4="PESAME", string topdrawopt5="PESAME", string bottomdrawopt1="PE", string bottomdrawopt2="PESame", string bottomdrawopt3="PESame", string bottomdrawopt4="PESame", bool logx=false, bool toplogy=true, bool bottomlogy=false, bool isrectangle=false, string header="", string label="")
int DrawFiveHistsOnCanvas(string canvasname, TH1F *hist1, TH1F *hist2, TH1F *hist3, TH1F *hist4, TH1F *hist5, string drawopt1="PE", string drawopt2="PESame", string drawopt3="PESame", string drawopt4="PESame", string drawopt5="PESame", bool logx=false, bool logy=true, bool isrectangle=true, string header="", string label="")
int DrawFourHistsOnCanvas(string canvasname, TH1F *hist1, TH1F *hist2, TH1F *hist3, TH1F *hist4, string drawopt1="PE", string drawopt2="PESame", string drawopt3="PESame", string drawopt4="PESame", bool logx=false, bool logy=true, bool isrectangle=false, string header="", string label="")
if(febId1==febId2)
constexpr int pow(int base, int exp) noexcept
ComDataMC()
Definition makePlot.py:423
GetDataPlotSingleProperty()
Definition makePlot.py:203
ComparePhysicsList()
Definition makePlot.py:715
GetPlotSingleProperty()
Definition makePlot.py:45