1 import ROOT,os,sys,getopt
10 histo.GetXaxis().SetTitleSize(.06)
11 histo.GetYaxis().SetTitleSize(.06)
12 histo.GetXaxis().SetTitleOffset(1.3)
13 histo.GetYaxis().SetTitleOffset(1.3)
14 histo.GetXaxis().SetNdivisions(5)
15 histo.GetYaxis().SetNdivisions(5)
24 colour = {
"fit":2,
"sim":1}
25 for fall
in [
"fit",
"sim"] :
26 ut.bookHist(h,
'magZ' +fall,
'Field.Mag() vs Z at (0,0)'+fall+
';z [cm];|B| [T]', 3000, 1000, 4000,200,0,2)
27 h[
'magZ'+fall].SetLineColor(colour[fall])
28 h[
'magZ'+fall].SetMarkerColor(colour[fall])
29 ut.bookHist(h,
'magXY1'+fall,
'Field.Mag() vs (X,Y) at Z=2500 cm, '+fall+
';x [cm];y [cm]', 60, -300.,300.,60,-300,300)
30 ut.bookHist(h,
'magXY2'+fall,
'Field.Mag() vs (X,Y) at Z=2800 cm, '+fall+
';x [cm];y [cm]', 60, -300.,300.,60,-300,300)
31 ut.bookHist(h,
'magXY3'+fall,
'Field.Mag() vs (X,Y) at Z=3000 cm, '+fall+
';x [cm];y [cm]', 60, -300.,300.,60,-300,300)
34 h[histo].SetLineColor(1)
35 h[histo].SetMarkerStyle(20)
39 ROOT.gStyle.SetStatY(0.9)
40 ROOT.gStyle.SetStatX(0.9)
41 ROOT.gStyle.SetStatW(0.3)
42 ROOT.gStyle.SetStatH(0.2)
43 ROOT.gStyle.SetPadBottomMargin(0.2)
44 ROOT.gStyle.SetPadLeftMargin(0.2)
45 ROOT.gStyle.SetPadRightMargin(0.2)
47 ROOT.gStyle.SetOptStat(0)
48 ut.bookCanvas(h,
"mfield1",
"mfield1",nx=600,ny=600,cx=1,cy=1)
49 cv = h[
'mfield1'].cd(1)
51 h[
'magZfit'].Draw(
"sames")
52 h[
'mfield1'].Print(
'mfield1.gif')
54 ut.bookCanvas(h,
"mfield2",
"mfield2",nx=1200,ny=800,cx=3,cy=2)
56 for fall
in [
"fit",
"sim"] :
57 for ci
in range (1,4):
59 cv = h[
'mfield2'].cd(pad)
60 h[
'magXY'+str(ci)+fall].Draw(
"colz")
61 h[
'mfield2'].Print(
'mfield2.gif')
68 ax0 =
';#chi^{2}/ndf;(P_{MCthuth}-P_{RECO})/P_{MCtruth}'
69 ax =
';P_{MCthuth} [GeV];(P_{MCthuth}-P_{RECO})/P_{MCtruth}'
70 ut.bookHist(h,
'delPOverP0'+prefix,
'dP/P vs #chi^{2}/ndf'+prefix+ax0, 500,0.,50.,100,-0.5,0.5)
71 ut.bookHist(h,
'delPOverP1'+prefix,
'dP/P'+prefix+ax,100,0.,50.,100,-0.5,0.5)
72 ut.bookHist(h,
'delPOverP2'+prefix,
'dP/P ndf>'+str(RecoSettings.trackMinNofHits)+prefix+ax,100,0.,50.,100,-0.5,0.5)
73 ut.bookHist(h,
'delPOverP3'+prefix,
'dP/P cleaned #chi^{2}/ndf<'+str(RecoSettings.chi2CutOff)+prefix+ax,100,0.,50.,100,-0.5,0.5)
74 ut.bookHist(h,
'MomRes'+prefix,
'MomRes'+prefix+
';P_{MCthuth} [GeV];#sigma_{Gauss}(#DeltaP/P)',5,0.,50.)
76 hhname=
'delPOverP3_'+str(i)+prefix
77 cond =
'P_{MCtruth} < '+str(i*10)+
" GeV"
78 ut.bookHist(h, hhname, cond+
';(P_{MCthuth}-P_{RECO})/P_{MCtruth}', 200, -.2, .2)
79 h[hhname].StatOverflows(
True)
83 h[histo].SetLineColor(1)
84 h[histo].SetMarkerStyle(20)
88 ROOT.gStyle.SetStatY(0.9)
89 ROOT.gStyle.SetStatX(0.9)
90 ROOT.gStyle.SetStatW(0.3)
91 ROOT.gStyle.SetStatH(0.2)
92 ROOT.gStyle.SetPadBottomMargin(0.2)
93 ROOT.gStyle.SetPadLeftMargin(0.2)
95 ROOT.gStyle.SetOptStat(10)
96 ut.bookCanvas(h,key=
'momentum1'+prefix,title=
'momentum1'+prefix,nx=1000,ny=800,cx=2,cy=2)
97 for cid
in range (1,5):
98 cv = h[
'momentum1'+prefix].cd(cid)
99 hname =
'delPOverP'+str(cid-1)+prefix
104 h[hname].GetXaxis().SetRangeUser(.01,50)
105 h[
'momentum1'+prefix].Print(
'momentum1'+prefix+
'.gif')
107 ROOT.gStyle.SetStatY(0.93)
108 ROOT.gStyle.SetStatX(0.99)
109 ROOT.gStyle.SetStatW(0.4)
110 ROOT.gStyle.SetStatH(0.35)
112 key=
'momentum2'+prefix
113 ut.bookCanvas(h,key,title=key,nx=1200,ny=1200,cx=3,cy=2)
114 rname =
'MomRes'+prefix
115 for cvn
in range (1,6):
116 hname=
'delPOverP3_'+str(cvn)+prefix
120 ROOT.gStyle.SetOptFit(11111)
121 f[hname] = ROOT.TF1(hname,
'gaus',-.05, .05)
122 f[hname].SetParameter(1,0.)
123 f[hname].SetNpx(1000)
124 h[hname].Fit(f[hname],
"R")
125 print "fit", f[hname].GetParameter(2), f[hname].GetParError(2)
126 h[rname].SetBinContent(cvn, f[hname].GetParameter(2))
127 h[rname].SetBinError (cvn, f[hname].GetParError(2))
128 h[key].Print(key+
'.gif')
130 ROOT.gStyle.SetOptStat(0)
131 ROOT.gStyle.SetOptTitle(0)
132 ut.bookCanvas(h,
'momentum3'+prefix,title=
'momentum3'+prefix,nx=600,ny=600,cx=1,cy=1)
135 h[hname].GetYaxis().SetTitleOffset(1.5)
136 h[
'momentum3'+prefix].Print(
'momentum3'+prefix+
'.gif')
150 ut.bookHist(h,
'dNFoldFNnew',
'Number of fitted tracks;N(old);N(new)',
151 10, -1, 9, 10, -1, 9)
152 h[
'dNFoldFNnew'].SetMarkerSize(1.8)
153 ut.bookHist(h,
'FitCorrespondence',
'CorrespondenceBins: 0,5-ok',
155 ut.bookHist(h,
'NDFold',
'NDF old Fit;NDF', 140, 0, 70)
156 ut.bookHist(h,
'NDFnew',
'NDF new Fit;NDF', 140, 0, 70)
157 ut.bookHist(h,
'Chi2NDFold',
'#chi^{2}/NDF old Fit;#chi^{2}/NDF', 200, 0, 20)
158 ut.bookHist(h,
'Chi2NDFnew',
'#chi^{2}.NDF old Fit;#chi^{2}/NDF', 200, 0, 20)
159 style={
'old':0,
'new':1}
160 for name
in (
'NDF',
'Chi2NDF'):
162 h[name+st].SetLineColor(1+style[st])
163 h[name+st].SetMarkerColor(1+style[st])
164 h[name+st].SetMarkerStyle(22+style[st])
167 h[histo].SetLineWidth(2)
172 ROOT.gStyle.SetStatY(0.9)
173 ROOT.gStyle.SetStatX(0.9)
174 ROOT.gStyle.SetStatW(0.3)
175 ROOT.gStyle.SetStatH(0.2)
176 ROOT.gStyle.SetOptStat(11)
177 ut.bookCanvas(h,key=
'FitCompare',title=
'FitCompare',nx=800,ny=800,cx=2,cy=2)
178 cv = h[
'FitCompare'].cd(1)
180 h[
'dNFoldFNnew'].Draw(
'coltext')
181 cv = h[
'FitCompare'].cd(2)
183 h[
'FitCorrespondence'].Draw()
184 cv = h[
'FitCompare'].cd(3)
187 h[
'NDFnew'].Draw(
"sames")
188 cv = h[
'FitCompare'].cd(4)
191 h[
'Chi2NDFold'].Draw()
192 h[
'Chi2NDFnew'].Draw(
"sames")
193 h[
'FitCompare'].Print(
'FitCompare.gif')
207 ut.bookHist(h,
'dxdyALLTrHm',
'dxdy(MCtr,firstHit)@firstHitZ - all-;dx [cm];dy [cm]',
208 2000, -100, 100, 2000, -100, 100)
209 ut.bookHist(h,
'dxdyALLTrHp',
'dxdy(MCtr,firstHit)@firstHitZ - all+;dx [cm];dy [cm]',
210 2000, -100, 100, 2000, -100, 100)
212 ut.bookHist(h,
'dxdyHNLTrHm',
'dxdy(MCtr,firstHit)@firstHitZ - HNL-;dx [cm];dy [cm]',
213 2000, -100, 100, 2000, -100, 100)
214 ut.bookHist(h,
'dxdyHNLTrHp',
'dxdy(MCtr,firstHit)@firstHitZ - HNL+;dx [cm];dy [cm]',
215 2000, -100, 100, 2000, -100, 100)
217 ut.bookHist(h,
'dRvsPz',
'dR(MCtr,firstHit)@firstHitZ vs Pz;Pz_{MC} [GeV];dR [cm]',
218 1000, 0, 50, 1000, 0, 100)
219 ut.bookHist(h,
'dRvsZhit',
'dR(MCtr,firstHit)@firstHitZ vs firstHitZ;Z_{Hit0} [cm];dR [cm]',
220 2400, 2500, 3700, 1000, 0, 100)
222 ut.bookHist(h,
'YMC2dZMCVer',
'abs(YMCprop)/dZMCVer - HNL', 2000, 0,10)
226 h[histo].SetLineColor(1)
230 ROOT.gStyle.SetStatY(0.9)
231 ROOT.gStyle.SetStatX(0.9)
232 ROOT.gStyle.SetStatW(0.3)
233 ROOT.gStyle.SetStatH(0.2)
234 ROOT.gStyle.SetOptStat(11)
236 ut.bookCanvas(h,key=
'dRCanvas',title=
'dRCanvas',nx=1200,ny=600,cx=2,cy=1)
237 ROOT.gStyle.SetOptStat(1)
238 cv = h[
'dRCanvas'].cd(1)
239 h[
'dRvsPz'].Draw(
'colzbox')
240 cv = h[
'dRCanvas'].cd(2)
241 h[
'dRvsZhit'].Draw(
'colzbox')
242 h[
'dRCanvas'].Print(
'dRCanvas.gif')
244 ROOT.gStyle.SetOptStat(11)
245 ut.bookCanvas(h,key=
'ratioYZ',title=
'ratioYZ',nx=600,ny=600,cx=1,cy=1)
246 ROOT.gStyle.SetOptStat(1)
247 cv = h[
'ratioYZ'].cd(1)
248 h[
'YMC2dZMCVer'].Draw()
249 h[
'ratioYZ'].Print(
'ratioYZ.gif')
251 for x
in [
'ALL',
'HNL']:
252 ut.bookCanvas(h,key=
'MCTrackHit'+x,title=
'MCTrackHit'+x,nx=800,ny=800,cx=2,cy=2)
253 ROOT.gStyle.SetOptStat(1)
254 cv = h[
'MCTrackHit'+x].cd(1)
255 h[
'dxdy'+x+
'TrHp'].Draw(
'colz')
256 cv = h[
'MCTrackHit'+x].cd(2)
257 h[
'dxdy'+x+
'TrHm'].Draw(
'colz')
258 cv = h[
'MCTrackHit'+x].cd(3)
260 hh=h[
'dxdy'+x+
'TrHp'].DrawCopy(
'colz')
261 for ax
in [hh.GetXaxis(), hh.GetYaxis()]:
262 ax.SetRangeUser(-5,5)
263 cv = h[
'MCTrackHit'+x].cd(4)
265 hh=h[
'dxdy'+x+
'TrHm'].DrawCopy(
'colz')
266 for ax
in [hh.GetXaxis(), hh.GetYaxis()]:
267 ax.SetRangeUser(-5,5)
268 h[
'MCTrackHit'+x].Print(
'MCTrackHit'+x+
'.gif')
282 ut.bookHist(h,
'docaRel'+prefix,
'docaRel'+prefix+
";step;doca/doca0", 5, 0, 5, 2000, 0., 2.)
283 ut.bookHist(h,
'doca' +prefix,
'doca' +prefix+
";doca [cm]", 500, 0., 100.)
284 h[
'doca'+prefix].SetLineColor(2)
285 ut.bookHist(h,
'doca0' +prefix,
'doca0' +prefix+
";doca0 [cm]", 500, 0., 100.)
286 ut.bookHist(h,
'vdx2'+prefix,
'vdx2'+prefix, 500, 0, 5000, 400, -20., 20.)
287 ut.bookHist(h,
'vdy2'+prefix,
'vdy2'+prefix, 500, 0, 5000, 400, -20., 20.)
288 ut.bookHist(h,
'vdz2'+prefix,
'vdz2'+prefix, 500, 0, 5000, 4000, -400., 400.)
289 ut.bookHist(h,
'vdx2ndf'+prefix,
'vdx2ndf'+prefix, 500, 0, 5000, 400, -20., 20.)
290 ut.bookHist(h,
'vdy2ndf'+prefix,
'vdy2ndf'+prefix, 500, 0, 5000, 400, -20., 20.)
291 ut.bookHist(h,
'vdz2ndf'+prefix,
'vdz2ndf'+prefix, 500, 0, 5000, 4000, -400., 400.)
292 if ( (prefix==
"mUP")
or (prefix==
"mDN") ) :
return
293 for i
in range (1,11):
294 hhname=
'vdx2_'+str(i)+prefix
295 ut.bookHist(h, hhname, hhname, 100, -20., 20.)
296 h[hhname].StatOverflows(
True)
297 hhname=
'vdy2_'+str(i)+prefix
298 ut.bookHist(h, hhname, hhname, 100, -20., 20.)
299 h[hhname].StatOverflows(
True)
300 hhname=
'vdz2_'+str(i)+prefix
301 ut.bookHist(h, hhname, hhname, 200, -400., 400.)
302 h[hhname].StatOverflows(
True)
303 for coord
in (
'x',
'y',
'z') :
304 hname =
"vres"+coord+prefix
305 ut.bookHist(h, hname, hname+
"z_{0}-z_{truth} [cm];", 10, 0., 5000.)
308 h[histo].SetLineColor(1)
313 ROOT.gStyle.SetStatY(0.9)
314 ROOT.gStyle.SetStatX(0.9)
315 ROOT.gStyle.SetStatW(0.3)
316 ROOT.gStyle.SetStatH(0.1)
317 ROOT.gStyle.SetOptStat(1)
319 coordTitle = {1:
'x',2:
'y',3:
'z'}
321 ut.bookCanvas(h,key=
'vertex2'+prefix,title=
'vertex2'+prefix,nx=600,ny=1200,cx=2,cy=3)
323 for cid
in coordTitle.keys():
324 cv = h[
'vertex2'+prefix].cd(cid*2-1+fall)
325 cv.SetBottomMargin(0.2)
326 cv.SetLeftMargin(0.2)
327 hname =
'vd'+coordTitle[cid]+
'2'+cut[fall]+prefix
329 h[hname].GetXaxis().SetTitle(
"z_{0}-z_{truth} [cm]")
330 ytitle = coordTitle[cid]+
"_{truth}-v"+coordTitle[cid]+
"_{reco} [cm]"
331 h[hname].GetXaxis().SetTitleSize(.06)
332 h[hname].GetYaxis().SetTitleSize(.06)
333 h[hname].GetYaxis().SetTitleOffset(1.3)
334 h[hname].GetYaxis().SetNdivisions(5)
335 h[
'vertex2'+prefix].Print(
'vertex2'+prefix+
'.gif')
336 if ( (prefix==
"mUP")
or (prefix==
"mDN") ) :
return
339 for ct
in coordTitle.values():
341 ut.bookCanvas(h,key,title=key,nx=1600,ny=1200,cx=5,cy=2)
343 for cvn
in range (1,11):
344 hname=
'vd'+ct+
'2_'+str(cvn)+prefix
346 cv.SetBottomMargin(0.2)
348 xtitle =
"v"+ct+
"_{truth}-v"+ct+
"_{reco} [cm]"
349 h[hname].GetXaxis().SetTitle(xtitle)
350 h[hname].GetXaxis().SetTitleSize(.06)
351 ROOT.gStyle.SetOptFit(11111)
352 f[key][hname] = ROOT.TF1(hname,
'gaus')
353 f[key][hname].SetNpx(1000)
354 f[key][hname].SetParameter(1,0.)
355 f[key][hname].SetParameter(2,0.2*cvn)
356 h[hname].Fit(f[key][hname])
360 h[rmsht].SetBinContent(cvn, f[key][hname].GetParameter(2))
361 h[rmsht].SetBinError (cvn, f[key][hname].GetParError(2))
362 h[key].Print(ct+prefix+
'.gif')
365 ut.bookCanvas(h,key,title=
'vRes'+prefix,nx=800,ny=800,cx=2,cy=2)
366 for cti
in coordTitle :
368 rmsht =
"vres"+coordTitle[cti]+prefix
369 h[rmsht].SetTitle(
"vertex "+coordTitle[cti]+
" resolution;z_{0}-z_{truth} [cm];#sigma_{Gauss}(#Delta"+coordTitle[cti]+
") [cm]")
371 h[key].Print(key+
'.gif')
373 if ( prefix==
'NEW' ) :
374 key=
'docaPlots'+prefix
375 ut.bookCanvas(h,key,key,nx=1200,ny=600,cx=2,cy=1)
377 h[
'doca'+prefix].Draw()
378 h[
'doca0'+prefix].Draw(
"sames")
380 h[
'docaRel'+prefix].Draw()
381 h[key].Print(key+
'.gif')
def plotMCTrackHitCorrelation