19 import ROOT,math,os,array
21 gROOT.ProcessLine(
"#include \"GraphToolKit.h\"")
22 gROOT.ProcessLine(
"#include \"HistToolKit.h\"")
24 Energies = [20000, 50000, 100000, 180000]
25 Particles = [
'pi',
'pr']
26 PhysicsLists = [
'FTFP_BERT',
'FTFP_BERT_ATL',
'QGSP_BERT',
"QGSP_BIC"]
32 ResultDir = Dir+
"/results/"
33 if ROOT.gSystem.AccessPathName(ResultDir):
34 print ResultDir,
"doesn't exist! Making"
35 gSystem.Exec(
"mkdir {}".
format(ResultDir))
38 PlotDir = Dir+
"/plots/"
39 if ROOT.gSystem.AccessPathName(PlotDir):
40 print PlotDir,
"doesn't exist! Making"
41 gSystem.Exec(
"mkdir {}".
format(PlotDir))
46 for Particle
in Particles:
48 InPath = ResultDir+
"/{}/".
format(Particle)
52 outputFile = ROOT.TFile.Open(
'{}/Properities_{}.root'.
format(InPath,Particle),
'RECREATE')
53 for PhysicsList
in PhysicsLists:
56 Response = array.array(
'f')
57 ResponseError = array.array(
'f')
58 Resolution = array.array(
'f')
59 ResolutionError = array.array(
'f')
60 LateralSpread = array.array(
'f')
61 LateralSpreadError = array.array(
'f')
63 EsError = array.array(
'f')
64 LongitudinalProfileList = []
65 NormalizedLongitudinalProfileList = []
67 for Energy
in Energies:
68 Es.append(Energy/1000.)
72 inputFile = ROOT.TFile(
'{}/tiletb90-E{}-{}_{}.root'.
format(InPath,Energy,Particle,PhysicsList),
"read")
75 print "InFile: ",inputFile.GetName()
78 h_E = inputFile.Get(
"RecoE")
79 h_EM0 = inputFile.Get(
"RecoEModule0")
80 h_EB = inputFile.Get(
"RecoECentralModule")
81 h_LP = inputFile.Get(
"LongitudinalProfile")
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()
89 canvas = ROOT.TCanvas(
"canvas",
"",800,600)
91 canvas.Print(ResultDir+
'/{}/totalE_{}_{}_{}.pdf'.
format(Particle,Particle,Energy,PhysicsList))
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)
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)
106 h_LP.Scale(1./(func.GetParameter(1)*1000/Energy))
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
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}")
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]")
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]")
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)
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) ;
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))
164 FullParticleName =
"Pion"
166 FullParticleName =
"Proton"
169 for i, Energy
in enumerate(Energies):
170 LongitudinalProfileList[i].Write()
171 NormalizedLongitudinalProfileList[i].Write()
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)+
"}")
176 LongitudinalProfileList[0].GetYaxis().SetRangeUser(1E-3, 100.)
177 NormalizedLongitudinalProfileList[0].GetYaxis().SetRangeUser(1E-5, 1.)
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)
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)
194 gr_resolution.Write()
195 gr_lateralspread.Write()
205 PiResponse = array.array(
'f', [0.808, 0.844, 0.856, 0.867])
206 PiResponseError = array.array(
'f', [0., 0., 0., 0.])
208 PrResponse = array.array(
'f', [0.811, 0.83, 0.845])
209 PrResponseError = array.array(
'f', [0., 0., 0.])
211 PiResolution = array.array(
'f', [11.94, 8.92, 6.78, 6.02])
212 PiResolutionError = array.array(
'f', [0., 0., 0., 0.])
214 PrResolution = array.array(
'f', [8.63, 5.97, 5.16])
215 PrResolutionError = array.array(
'f', [0., 0., 0.])
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.])
222 PiEs = array.array(
'f', [20., 50., 100., 180.])
223 PiEsError = array.array(
'f', [0., 0., 0., 0.])
225 PrEs = array.array(
'f', [50., 100., 180.])
226 PrEsError = array.array(
'f', [0., 0., 0.])
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])
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])
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))
256 outputFile = ROOT.TFile.Open(
'{}/data.root'.
format(OutPathResult),
'RECREATE')
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}")
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])
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)
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])
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]")
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)
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")
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")
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()
424 for Particle
in Particles:
425 inputFile = ROOT.TFile.Open(
'{}/{}/Properities_{}.root'.
format(ResultDir,Particle,Particle))
426 inputFile2 = ROOT.TFile.Open(
'{}/data/data.root'.
format(ResultDir))
429 outputFile = ROOT.TFile.Open(
'{}/{}/{}_Ratio.root'.
format(ResultDir, Particle, Particle),
'RECREATE')
433 LateralSpreadList = []
434 ResponseRatioList = []
435 ResolutionRatioList = []
436 LateralSpreadRatioList = []
439 ger_dataresponse = inputFile2.Get(
"{}_Response".
format(Particle))
440 ger_dataresolution = inputFile2.Get(
"{}_Resolution".
format(Particle))
441 ger_datalateralspread = inputFile2.Get(
"{}_LateralSpread".
format(Particle))
443 datalongitudinalprofilelist = []
444 datanormalizedlongitudinalprofilelist = []
447 mclongitudinalprofilelists = []
448 mcnormalizedlongitudinalprofilelists = []
450 longitudinalprofileratiolists = []
451 normalizedlongitudinalprofileratiolists = []
454 for Energy
in Energies:
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)))
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)
470 ResponseList.append(ger_mcresponse)
471 ResolutionList.append(ger_mcresolution)
472 LateralSpreadList.append(ger_mclateralspread)
474 N = ger_dataresponse.GetN()
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()
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))
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()
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))
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))
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)
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)
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")
551 ger_response_ratio.Write()
552 ger_resolution_ratio.Write()
553 ger_lateralspread_ratio.Write()
555 ResponseRatioList.append(ger_response_ratio)
556 ResolutionRatioList.append(ger_resolution_ratio)
557 LateralSpreadRatioList.append(ger_lateralspread_ratio)
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)
566 mclongitudinalprofilelist=[]
567 mcnormalizedlongitudinalprofilelist=[]
568 mclongitudinalprofileratiolist=[]
569 mcnormalizedlongitudinalprofileratiolist=[]
570 for Energy
in Energies:
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
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)
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)
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)
601 mclongitudinalprofilelists.append(mclongitudinalprofilelist)
602 mcnormalizedlongitudinalprofilelists.append(mcnormalizedlongitudinalprofilelist)
603 longitudinalprofileratiolists.append(mclongitudinalprofileratiolist)
604 normalizedlongitudinalprofileratiolists.append(mcnormalizedlongitudinalprofileratiolist)
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)
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)
618 FullParticleName =
"Pion"
619 ger_dataresponse.SetTitle(
"Data")
620 ger_dataresolution.SetTitle(
"Data")
621 ger_datalateralspread.SetTitle(
"Data")
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)
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)
651 for i
in range(len(Energies)):
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])
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))
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))
716 for Particle
in Particles:
718 inputFile = ROOT.TFile.Open(
'{}/{}/Properities_{}.root'.
format(ResultDir, Particle, Particle))
720 inputFile2 = ROOT.TFile.Open(
'{}/data/data.root'.
format(ResultDir))
722 print "File: ",inputFile.GetName(),
" doesn't exist!!"
727 LateralSpreadList = []
729 ResponseListWithData = []
730 ResolutionListWithData = []
731 LateralSpreadListWithData = []
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)
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
761 FullParticleName =
"Pion"
763 FullParticleName =
"Proton"
765 if len(ResponseList)==3:
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)
777 if __name__ ==
'__main__':