18 " produce hitmaps for MuFilter, Veto/US/DS"
20 veto system 2 layers with 7 bars and 8 sipm channels on both ends
21 1 layer with 7 bars and 8 sipms on the top
22 US system 5 layers with 10 bars and 8 sipm channels on both ends
23 DS system horizontal(3) planes, 60 bars, readout on both sides, single channel
24 vertical(4) planes, 60 bar, readout on top, single channel
26 def Init(self,options,monitor):
30 run = ROOT.FairRunAna.Instance()
33 ioman = ROOT.FairRootManager.Instance()
34 self.
OT = ioman.GetSink().GetOutTree()
42 if self.
M.fsdict
or self.
M.hasBunchInfo: self.
xing = {
'':
True,
'B1only':
False,
'B2noB1':
False,
'noBeam':
False}
43 else: self.
xing = {
'':
True}
45 ut.bookHist(h,detector+
'Noise'+xi,
'events with hits in single plane; s*10+l;',40,0.5,39.5)
46 for s
in monitor.systemAndPlanes:
47 ut.bookHist(h,sdict[s]+
'Mult'+xi,
'QDCs vs nr hits; #hits; QDC [a.u.]',200,0.,800.,200,0.,300.)
48 for l
in range(monitor.systemAndPlanes[s]):
49 ut.bookHist(h,detector+
'hitmult_'+str(s*10+l)+xi,
'hit mult / plane '+sdict[s]+str(l)+
'; #hits',61,-0.5,60.5)
50 ut.bookHist(h,detector+
'hit_'+str(s*10+l)+xi,
'channel map / plane '+sdict[s]+str(l)+
'; #channel',160,-0.5,159.5)
51 ut.bookHist(h,detector+
'Xhit_'+str(s*10+l)+xi,
'Xchannel map / plane '+sdict[s]+str(l)+
'; #channel',160,-0.5,159.5)
60 ut.bookHist(h,detector+
'chanActiveRight_'+str(s*10+l),
61 sdict[s]+
' '+str(l)+
'R channel hit multiplicity; #channel; bar',
62 channelsPerSystem[s],-0.5,channelsPerSystem[s]-0.5,
63 monitor.systemAndBars[s],-0.5,monitor.systemAndBars[s]-0.5)
64 ut.bookHist(h,detector+
'chanNfiredRight_'+str(s*10+l),
65 sdict[s]+
' '+str(l)+
'R number of fired channels '+note+
'; N fired channels; bar',
66 channelsPerSystem[s]+1-NSmallSiPMs,-0.5,channelsPerSystem[s]+0.5-NSmallSiPMs,
67 monitor.systemAndBars[s],-0.5,monitor.systemAndBars[s]-0.5)
69 if (s==1
and l==2)
or (s==3
and (l%2==1
or l==6)):
71 ut.bookHist(h,detector+
'chanActiveLeft_'+str(s*10+l),
72 sdict[s]+
' '+str(l)+side+
' channel hit multiplicity; #channel; bar',
73 channelsPerSystem[s],-0.5,channelsPerSystem[s]-0.5,
74 monitor.systemAndBars[s],-0.5,monitor.systemAndBars[s]-0.5)
75 ut.bookHist(h,detector+
'chanNfiredLeft_'+str(s*10+l),
76 sdict[s]+
' '+str(l)+side+
' number of fired channels '+note+
'; N fired channels; bar',
77 channelsPerSystem[s]+1-NSmallSiPMs,-0.5,channelsPerSystem[s]+0.5-NSmallSiPMs,
78 monitor.systemAndBars[s],-0.5,monitor.systemAndBars[s]-0.5)
81 ut.bookHist(h,detector+
'bar_'+str(s*10+l)+xi,
'bar map / plane '+sdict[s]+str(l)+
'; bar',60,-0.5,59.5)
82 ut.bookHist(h,detector+
'dT_'+str(s*10+l)+xi,
'dT with respect to first scifi '+sdict[s]+str(l)+
'; dt [ns] ;# bar + channel', 100,-25.,5.,120,-0.5,2*60-0.5)
83 ut.bookHist(h,detector+
'dTcor_'+str(s*10+l)+xi,
'dTcor with respect to first scifi '+sdict[s]+str(l)+
'; dt [ns] ;# bar + channel',100,-25.,5.,120,-0.5,2*60-0.5)
86 ut.bookHist(h,
'deltaTScifiMufiHit_'+str(ss)+xi,
'deltaT scifi earliest hit versus DS hit 2H',200,-25.,25.)
88 ut.bookHist(h,detector+
'bar_'+str(s*10+l)+xi,
'bar map / plane '+sdict[s]+str(l)+
'; bar',10,-0.5,9.5)
90 ut.bookHist(h,detector+
'dT_'+str(s*10+l)+xi,
'dT with respect to first scifi '+sdict[s]+str(l)+
'; dt [ns] ;# bar + channel', 100,-25.,5.,120,-0.5,2*8*7-0.5)
91 ut.bookHist(h,detector+
'dTcor_'+str(s*10+l)+xi,
'dTcor with respect to first scifi '+sdict[s]+str(l)+
'; dt [ns] ;# bar + channel',100,-25.,5.,120,-0.5,2*8*7-0.5)
92 ut.bookHist(h,detector+
'sig_'+str(s*10+l)+xi,
'signal / plane '+sdict[s]+str(l)+
'; QDC [a.u.]',200,0.0,200.)
94 ut.bookHist(h,detector+
'sigS_'+str(s*10+l)+xi,
'signal / plane '+sdict[s]+str(l)+
'; QDC [a.u.]',200,0.0,200.)
95 ut.bookHist(h,detector+
'TsigS_'+str(s*10+l)+xi,
'signal / plane '+sdict[s]+str(l)+
'; QDC [a.u.]',200,0.0,200.)
96 tagL = US_gel_dict[s*10+l][0]+
": "
97 tagR = US_gel_dict[s*10+l][1]+
": "
101 histo_title_helper =
'signal / plane '+sdict[s]+str(l)
102 ut.bookHist(h,detector+
'sigL_'+str(s*10+l)+xi,tagL+histo_title_helper+
'; QDC [a.u.]',200,0.0,200.)
103 ut.bookHist(h,detector+
'sigR_'+str(s*10+l)+xi,tagR+histo_title_helper+
'; QDC [a.u.]',200,0.0,200.)
104 ut.bookHist(h,detector+
'Tsig_'+str(s*10+l)+xi,histo_title_helper+
'; QDC [a.u.]',200,0.0,200.)
105 ut.bookHist(h,detector+
'TsigL_'+str(s*10+l)+xi,tagL+histo_title_helper+
'; QDC [a.u.]',200,0.0,200.)
106 ut.bookHist(h,detector+
'TsigR_'+str(s*10+l)+xi,tagR+histo_title_helper+
'; QDC [a.u.]',200,0.0,200.)
108 ut.bookHist(h,detector+
'occ_'+str(s*10+l)+xi,
'channel occupancy '+sdict[s]+str(l),100,0.0,200.)
109 ut.bookHist(h,detector+
'occTag_'+str(s*10+l)+xi,
'channel occupancy '+sdict[s]+str(l),100,0.0,200.)
111 ut.bookHist(h,detector+
'leftvsright_1'+xi,
'Veto hits in left / right; Left: # hits; Right: # hits',10,-0.5,9.5,10,-0.5,9.5)
112 ut.bookHist(h,detector+
'leftvsright_2'+xi,
'US hits in left / right; L: # hits; R: # hits',10,-0.5,9.5,10,-0.5,9.5)
113 ut.bookHist(h,detector+
'leftvsright_3'+xi,
'DS hits in left / right; L: # hits; R: # hits',2,-0.5,1.5,2,-0.5,1.5)
114 ut.bookHist(h,detector+
'leftvsright_signal_1'+xi,
'Veto signal in left / right; Left: QDC [a.u.]; Right: QDC [a.u.]',100,-0.5,200.,100,-0.5,200.)
115 ut.bookHist(h,detector+
'leftvsright_signal_2'+xi,
'US signal in left / right; L: QDC [a.u.]; R: QDC [a.u.]',100,-0.5,200.,100,-0.5,200.)
116 ut.bookHist(h,detector+
'leftvsright_signal_3'+xi,
'DS signal in left / right; L: QDC [a.u.]; R: QDC [a.u.]',100,-0.5,200.,100,-0.5,200.)
118 ut.bookHist(h,detector+
'dtime'+xi,
'delta event time; dt [ns]',100,0.0,1000.)
119 ut.bookHist(h,detector+
'dtimeu'+xi,
'delta event time; dt [us]',100,0.0,1000.)
120 ut.bookHist(h,detector+
'dtimem'+xi,
'delta event time; dt [ms]',100,0.0,1000.)
122 ut.bookHist(h,detector+
'bs'+xi,
'beam spot; x[cm]; y[cm]',100,-100.,10.,100,0.,80.)
123 ut.bookHist(h,detector+
'bsDS'+xi,
'beam spot,#bar X, #bar Y',60,-0.5,59.5,60,-0.5,59.5)
124 ut.bookHist(h,detector+
'slopes'+xi,
'muon DS track slopes; slope X [rad]; slope Y [rad]',150,-1.5,1.5,150,-1.5,1.5)
125 ut.bookHist(h,detector+
'trackPos'+xi,
'muon DS track pos; x [cm]; y [cm]',100,-90,10.,80,0.,80.)
126 ut.bookHist(h,detector+
'trackPosBeam'+xi,
'beam track pos slopes<0.1rad; x [cm]; y [cm]',100,-90,10.,80,0.,80.)
128 for bar
in range(monitor.systemAndBars[s]):
129 ut.bookHist(h,detector+
'chanmult_'+str(s*1000+100*l+bar)+xi,
'channels firing per bar '+sdict[s]+str(l)+
" bar "+str(bar)+
'; fired channels',20,-0.5,19.5)
131 xmin = options.Mufixmin
133 ut.bookHist(h,detector+
'resX_'+sdict[s]+str(s*10+l)+xi,
'residual X'+str(s*10+l)+
'; [#cm]',
134 100,xmin,xmax,60,-60.,0.)
135 ut.bookHist(h,detector+
'resY_'+sdict[s]+str(s*10+l)+xi,
'residual Y'+str(s*10+l)+
'; [#cm]',
136 100,xmin,xmax,70,2.,68.)
139 if isinstance(h[x], ROOT.TH2):
144 systemAndPlanes =self.
M.systemAndPlanes
150 for s
in systemAndPlanes:
151 for l
in range(systemAndPlanes[s]): mult[s*10+l]=0
155 for aTrack
in self.
M.Reco_MuonTracks:
156 if aTrack.GetUniqueID()==3: withDSTrack =
True
158 for aHit
in event.Digi_MuFilterHits:
159 Minfo = self.
M.MuFilter_PlaneBars(aHit.GetDetectorID())
160 s,l,bar = Minfo[
'station'],Minfo[
'plane'],Minfo[
'bar']
161 nSiPMs = aHit.GetnSiPMs()
162 nSides = aHit.GetnSides()
163 for c
in aHit.GetAllSignals(
False,
False):
164 if aHit.isMasked(c.first):
165 channel = bar*nSiPMs*nSides + c.first
166 self.
M.fillHist1(detector+
'Xhit_'+str(s)+str(l),channel)
168 if not aHit.isValid():
continue
171 if not key
in planes: planes[key] = {}
172 sumSignal = self.
M.map2Dict(aHit,
'SumOfSignals')
173 planes[key][bar] = [sumSignal[
'SumL'],sumSignal[
'SumR']]
175 allChannels = self.
M.map2Dict(aHit,
'GetAllSignals')
176 for c
in allChannels:
178 Nleft,Nright,Sleft,Sright = 0,0,0,0
180 NSmallLeft, NSmallRight = 0,0
181 for c
in allChannels:
184 if s==2
and (c==2
or c==5): NSmallLeft+=1
185 Sleft+=allChannels[c]
186 h[detector+
'chanActiveLeft_'+str(s*10+l)].Fill(c, bar)
189 if s==2
and (c==10
or c==13): NSmallRight+=1
190 Sright+=allChannels[c]
191 h[detector+
'chanActiveRight_'+str(s*10+l)].Fill(c-nSiPMs, bar)
192 self.
M.fillHist1(detector+
'chanmult_'+str(s*1000+100*l+bar),Nleft)
193 self.
M.fillHist1(detector+
'chanmult_'+str(s*1000+100*l+bar),10+Nright)
194 h[detector+
'chanNfiredLeft_'+str(s*10+l)].Fill(Nleft-NSmallLeft, bar)
195 h[detector+
'chanNfiredRight_'+str(s*10+l)].Fill(Nright-NSmallRight, bar)
196 if not aHit.isVertical():
197 self.
M.fillHist2(detector+
'leftvsright_'+str(s),Nleft,Nright)
198 self.
M.fillHist2(detector+
'leftvsright_signal_'+str(s),Sleft,Sright)
200 for c
in allChannels:
201 channel = bar*nSiPMs*nSides + c
202 self.
M.fillHist1(detector+
'hit_'+str(s)+str(l),int(channel))
203 self.
M.fillHist1(detector+
'bar_'+str(s)+str(l),bar)
204 if s==2
and self.
M.smallSiPMchannel(c) :
205 self.
M.fillHist1(detector+
'sigS_'+str(s)+str(l),allChannels[c])
206 if withDSTrack: self.
M.fillHist1(detector+
'TsigS_'+str(s)+str(l),allChannels[c])
208 self.
M.fillHist1(detector+
'sigL_'+str(s)+str(l),allChannels[c])
209 if withDSTrack: self.
M.fillHist1(detector+
'TsigL_'+str(s)+str(l),allChannels[c])
211 self.
M.fillHist1(detector+
'sigR_'+str(s)+str(l),allChannels[c])
212 if withDSTrack: self.
M.fillHist1(detector+
'sigR_'+str(s)+str(l),allChannels[c])
213 self.
M.fillHist1(detector+
'sig_'+str(s)+str(l),allChannels[c])
214 if withDSTrack: self.
M.fillHist1(detector+
'sig_'+str(s)+str(l),allChannels[c])
220 if mult[x]>3: onePlane.append(x)
222 self.
M.fillHist1(detector+
'Noise',onePlane[0])
228 for i
in range(nhits):
229 self.
M.fillHist2(sdict[s]+
'Mult',nhits, self.
listOfHits[s][i])
230 for s
in systemAndPlanes:
231 for l
in range(systemAndPlanes[s]):
232 self.
M.fillHist1(detector+
'hitmult_'+str(s*10+l),mult[s*10+l])
234 for aTrack
in self.
M.Reco_MuonTracks:
235 if not aTrack.GetUniqueID()==1:
continue
236 fitStatus = aTrack.getFitStatus()
237 if not fitStatus.isFitConverged():
continue
239 fstate = aTrack.getFittedState()
240 posMom[
'first'] = [fstate.getPos(),fstate.getMom()]
242 posMom[
'last'] = [fstate.getPos(),fstate.getMom()]
245 pos,mom = posMom[
'first']
246 lam = (self.
trackTask.firstScifi_z-pos.z())/mom.z()
248 pos1 = ROOT.TVector3(pos.x()+lam*mom.x(),pos.y()+lam*mom.y(),self.
trackTask.firstScifi_z)
250 for aHit
in event.Digi_MuFilterHits:
251 if not aHit.isValid():
continue
252 detID = aHit.GetDetectorID()
253 Minfo = self.
M.MuFilter_PlaneBars(detID)
254 s,l,bar = Minfo[
'station'],Minfo[
'plane'],Minfo[
'bar']
257 if s==1: pos,mom = posMom[
'first']
258 else: pos,mom = posMom[
'last']
259 zEx = self.
M.zPos[
'MuFilter'][s*10+l]
260 lam = (zEx-pos.z())/mom.z()
261 xEx,yEx = pos.x()+lam*mom.x(),pos.y()+lam*mom.y()
263 uCrossv= (B-A).Cross(mom)
264 doca = pq.Dot(uCrossv)/uCrossv.Mag()
265 self.
M.fillHist2(detector+
'resX_'+sdict[s]+str(s*10+l),doca/u.cm,xEx)
266 self.
M.fillHist2(detector+
'resY_'+sdict[s]+str(s*10+l),doca/u.cm,yEx)
268 if (s==3
and abs(doca)<2.5*u.cm)
or (s==1
and abs(doca)<6*u.cm):
270 if aHit.isVertical(): nmax = 1
276 for i
in range(nmax):
277 if aHit.GetTime(i) < 0:
continue
278 posM = ROOT.TVector3(xEx,yEx,zEx)
280 trajLength = (posM-pos1).Mag()
289 tM = aHit.GetTime(i)*self.
M.TDC2ns - L - trajLength/u.speedOfLight
290 self.
M.fillHist2(detector+
'dT_'+str(s*10+l),tM-scifi_time0,bar*barMult+i)
294 tM = corTime - trajLength/u.speedOfLight
295 self.
M.fillHist2(detector+
'dTcor_'+str(s*10+l),tM-scifi_time0,bar*barMult+i)
297 timeLeft = aHit.GetTime(0)
298 timeRight = aHit.GetTime(1)
299 if timeLeft>0
and timeRight>0:
303 dsHitTimes.append( (avTime-abs(A[0]-B[0])/15)/2)
305 if len(dsHitTimes)>0:
307 scifiHitTimes = {1:[],2:[],3:[],4:[],5:[]}
308 for scifiHit
in event.Digi_ScifiHits:
309 detID = scifiHit.GetDetectorID()
310 s = int(scifiHit.GetDetectorID()/1000000)
312 for s
in scifiHitTimes:
313 if len(scifiHitTimes[s])<1:
continue
314 scifiHitTimes[s].sort()
315 deltaT = dsHitTimes[0] - scifiHitTimes[s][0] - (self.
M.zPos[
'MuFilter'][34]-self.
M.zPos[
'Scifi'][s*10])/u.speedOfLight
316 self.
M.fillHist1(
'deltaTScifiMufiHit_'+str(s),deltaT)
323 for aTrack
in self.
M.Reco_MuonTracks:
324 if not aTrack.GetUniqueID()==3:
continue
325 state = aTrack.getFittedState()
327 rc = h[detector+
'bs'].Fill(pos.x(),pos.y(),W)
329 slopeX= mom.X()/mom.Z()
330 slopeY= mom.Y()/mom.Z()
333 self.
M.fillHist2(detector+
'slopes',slopeX,slopeY)
334 self.
M.fillHist2(detector+
'trackPos',pos.X(),pos.Y())
335 if abs(slopeX)<0.1
and abs(slopeY)<0.1: self.
M.fillHist2(detector+
'trackPosBeam',pos.X(),pos.Y())
336 if not Ybar<0
and not Xbar<0
and abs(slopeY)<0.01: self.
M.fillHist2(detector+
'bsDS',Xbar,Ybar)
341 systemAndPlanes =self.
M.systemAndPlanes
342 S = {1:[1800,800,systemAndPlanes[1],1],2:[1800,1500,2,3],3:[1800,1800,2,4]}
344 if not self.
M.fsdict
and not self.
M.hasBunchInfo
and xi!=
'':
continue
347 ut.bookCanvas(h,detector+
'hitmaps' +sdict[s]+xi,
'hitmaps' +sdict[s],S[s][0],S[s][1],S[s][2],S[s][3])
348 ut.bookCanvas(h,detector+
'Xhitmaps' +sdict[s]+xi,
'Xhitmaps' +sdict[s],S[s][0],S[s][1],S[s][2],S[s][3])
349 ut.bookCanvas(h,detector+
'barmaps'+sdict[s]+xi,
'barmaps'+sdict[s],S[s][0],S[s][1],S[s][2],S[s][3])
351 ut.bookCanvas(h,detector+
'dTScifi'+sdict[s]+xi,
'dt rel to scifi'+sdict[s],S[s][0],S[s][1],S[s][2],S[s][3])
352 ut.bookCanvas(h,detector+
'dTcorScifi'+sdict[s]+xi,
'dtcor rel to scifi'+sdict[s],S[s][0],S[s][1],S[s][2],S[s][3])
354 for l
in range(systemAndPlanes[s]):
356 if s==3
and n==7: n=8
357 tc = h[detector+
'hitmaps'+sdict[s]+xi].cd(n)
358 tag = str(s)+str(l)+xi
359 h[detector+
'hit_'+tag].Draw()
360 tc = h[detector+
'Xhitmaps'+sdict[s]+xi].cd(n)
361 h[detector+
'Xhit_'+tag].Draw()
363 tc = h[detector+
'barmaps'+sdict[s]+xi].cd(n)
364 h[detector+
'bar_'+tag].Draw()
366 tc = h[detector+
'dTScifi'+sdict[s]+xi].cd(n)
367 h[detector+
'dT_'+tag].Draw(
'colz')
368 tc = h[detector+
'dTcorScifi'+sdict[s]+xi].cd(n)
369 h[detector+
'dTcor_'+tag].Draw(
'colz')
371 ut.bookCanvas(h,detector+
'hitmult'+xi,
'hit multiplicities per plane',2000,1600,4,3)
373 for s
in systemAndPlanes:
374 for l
in range(systemAndPlanes[s]):
375 tc = h[detector+
'hitmult'+xi].cd(k)
378 rc = h[detector+
'hitmult_'+str(s*10+l)+xi].Draw()
379 ut.bookCanvas(h,
'noise'+xi,
' ',1200,1800,1,1)
380 tc = h[
'noise'+xi].cd()
381 h[detector+
'Noise'+xi].Draw()
383 ut.bookCanvas(h,
'VETO'+xi,
' ',1200,1800,1,2)
385 tc = h[
'VETO'+xi].cd(l+1)
386 hname = detector+
'hit_'+str(1)+str(l)+xi
391 y = h[detector+
'hit_'+str(1)+str(l)+xi].GetMaximum()
392 lname =
'L'+str(n)+hname
393 h[lname] = ROOT.TLine(x,0,x,y)
394 h[lname].SetLineColor(ROOT.kRed)
395 h[lname].SetLineStyle(9)
396 h[lname].Draw(
'same')
398 ut.bookCanvas(h,
'USBars'+xi,
' ',1200,900,1,1)
399 colours = {0:ROOT.kOrange,1:ROOT.kRed,2:ROOT.kGreen,3:ROOT.kBlue,4:ROOT.kMagenta,5:ROOT.kCyan,
400 6:ROOT.kAzure,7:ROOT.kPink,8:ROOT.kSpring}
402 h[detector+
'bar_2'+str(i)+xi].SetLineColor(colours[i])
403 h[detector+
'bar_2'+str(i)+xi].SetLineWidth(2)
404 h[detector+
'bar_2'+str(i)+xi].SetStats(0)
405 h[detector+
'bar_20'+xi].Draw()
406 h[detector+
'bar_21'+xi].Draw(
'same')
407 h[detector+
'bar_22'+xi].Draw(
'same')
408 h[detector+
'bar_23'+xi].Draw(
'same')
409 h[detector+
'bar_24'+xi].Draw(
'same')
410 h[detector+
'lbar2'+xi]=ROOT.TLegend(0.6,0.6,0.99,0.99)
412 h[detector+
'lbar2'+xi].AddEntry(h[detector+
'bar_2'+str(i)+xi],
'plane '+str(i+1),
"f")
413 h[detector+
'lbar2'+xi].Draw()
415 h[detector+
'hit_3'+str(i)+xi].SetLineColor(colours[i])
416 h[detector+
'hit_3'+str(i)+xi].SetLineWidth(2)
417 h[detector+
'hit_3'+str(i)+xi].SetStats(0)
418 h[detector+
'hit_30'+xi].Draw()
420 h[detector+
'hit_3'+str(i)+xi].Draw(
'same')
421 h[detector+
'lbar3'+xi]=ROOT.TLegend(0.6,0.6,0.99,0.99)
423 h[detector+
'lbar3'+xi].AddEntry(h[detector+
'hit_3'+str(i)+xi],
'plane '+str(i+1),
"f")
424 h[detector+
'lbar3'+xi].Draw()
426 ut.bookCanvas(h,detector+
'LR'+xi,
' ',1800,900,3,2)
428 h[detector+
'LR'+xi].cd(i)
429 h[detector+
'leftvsright_'+str(i)+xi].Draw(
'textBox')
430 h[detector+
'LR'+xi].cd(i+3)
431 h[detector+
'leftvsright_signal_'+str(i)+xi].SetMaximum(h[detector+
'leftvsright_signal_'+str(i)+xi].GetBinContent(10,10))
432 h[detector+
'leftvsright_signal_'+str(i)+xi].Draw(
'colz')
434 ut.bookCanvas(h,detector+
'LRinEff'+xi,
' ',1800,450,3,1)
436 h[detector+
'lLRinEff'+str(s)+xi]=ROOT.TLegend(0.6,0.54,0.99,0.93)
437 name = detector+
'leftvsright_signal_'+str(s)+xi
438 h[name+
'0Y'] = h[name].ProjectionY(name+
'0Y',1,1)
439 h[name+
'0X'] = h[name].ProjectionX(name+
'0X',1,1)
440 h[name+
'1X'] = h[name].ProjectionY(name+
'1Y')
441 h[name+
'1Y'] = h[name].ProjectionX(name+
'1X')
442 tc = h[detector+
'LRinEff'+xi].cd(s)
444 h[name+
'0X'].SetStats(0)
445 h[name+
'0Y'].SetStats(0)
446 h[name+
'1X'].SetStats(0)
447 h[name+
'1Y'].SetStats(0)
448 h[name+
'0X'].SetLineColor(ROOT.kRed)
449 h[name+
'0Y'].SetLineColor(ROOT.kGreen)
450 h[name+
'1X'].SetLineColor(ROOT.kMagenta)
451 h[name+
'1Y'].SetLineColor(ROOT.kCyan)
452 h[name+
'0X'].SetMaximum(max(h[name+
'1X'].GetMaximum(),h[name+
'1Y'].GetMaximum()))
454 h[name+
'0Y'].Draw(
'same')
455 h[name+
'1X'].Draw(
'same')
456 h[name+
'1Y'].Draw(
'same')
458 h[detector+
'lLRinEff'+str(s)+xi].AddEntry(h[name+
'0X'],
'left with no signal right',
"f")
459 h[detector+
'lLRinEff'+str(s)+xi].AddEntry(h[name+
'0Y'],
'right with no signal left',
"f")
460 h[detector+
'lLRinEff'+str(s)+xi].AddEntry(h[name+
'1X'],
'left all',
"f")
461 h[detector+
'lLRinEff'+str(s)+xi].AddEntry(h[name+
'1Y'],
'right all',
"f")
462 h[detector+
'lLRinEff'+str(s)+xi].Draw()
464 listSipmTypes = [
'L',
'R',
'S']
471 ut.bookCanvas(h,tag+
'signalUSVeto'+xi,
' ',1200,1600,3,self.
M.systemAndPlanes[1]+self.
M.systemAndPlanes[2])
475 for plane
in range(self.
M.systemAndPlanes[1]):
476 for side
in listSipmTypes:
477 tc = h[tag+
'signalUSVeto'+xi].cd(l)
479 if side==
'S' or (plane==2
and side ==
'R'):
continue
480 rc = h[detector+tag+
'sig'+side+
'_'+str( s*10+plane)+xi]
482 if side==
'S' or tag==
'T':
continue
483 if plane==2: plane_label[Xaxis_bin] =
"Veto "+str(plane)+
" T"
484 else: plane_label[Xaxis_bin] =
"Veto "+str(plane)+
" "+side
486 rc.GetQuantiles(1,med,q05)
487 signal_attributes[Xaxis_bin]={
489 "std":rc.GetStdDev(),
490 "max":rc.FindLastBinAbove(0),
491 "percent_overflow":rc.GetBinContent(rc.GetNbinsX()+1)/rc.Integral()*100.
if rc.Integral()>0
else 0.}
494 for plane
in range(self.
M.systemAndPlanes[2]):
495 for side
in listSipmTypes:
496 tc = h[tag+
'signalUSVeto'+xi].cd(l)
498 rc = h[detector+tag+
'sig'+side+
'_'+str( s*10+plane)+xi]
500 if side==
'S' or tag==
'T':
continue
501 plane_label[Xaxis_bin] =
"US "+str(plane)+
" "+side
503 rc.GetQuantiles(1,med,q05)
504 signal_attributes[Xaxis_bin]={
506 "std":rc.GetStdDev(),
507 "max":rc.FindLastBinAbove(0),
508 "percent_overflow":rc.GetBinContent(rc.GetNbinsX()+1)/rc.Integral()*100.
if rc.Integral()>0
else 0.}
510 ut.bookCanvas(h,tag+
'signalDS'+xi,
' ',900,1600,2,self.
M.systemAndPlanes[3])
513 for plane
in range(self.
M.systemAndPlanes[3]):
514 for side
in listSipmTypes:
515 if side ==
'S':
continue
516 tc = h[tag+
'signalDS'+xi].cd(l)
518 if (plane%2==1
or plane==6)
and side==
'R':
continue
519 rc = h[detector+tag+
'sig'+side+
'_'+str( s*10+plane)+xi]
521 if ()
or tag==
'T':
continue
522 if plane%2==1
or plane==6: plane_label[Xaxis_bin] =
"DS "+str(plane//2+1)+
" T"
523 else:plane_label[Xaxis_bin] =
"DS "+str(plane//2+1)+
" "+side
525 rc.GetQuantiles(1,med,q05)
526 signal_attributes[Xaxis_bin]={
528 "std":rc.GetStdDev(),
529 "max":rc.FindLastBinAbove(0),
530 "percent_overflow":rc.GetBinContent(rc.GetNbinsX()+1)/rc.Integral()*100.
if rc.Integral()>0
else 0.}
534 ut.bookCanvas(h,detector+
'signalsSummary'+xi,
' ',1024,768,1,3)
535 signal_medians = [ROOT.TGraphErrors(), ROOT.TGraphErrors(), ROOT.TGraphErrors()]
536 signal_maxima = [ROOT.TGraphErrors(), ROOT.TGraphErrors(), ROOT.TGraphErrors()]
537 signal_overflow = [ROOT.TGraphErrors(), ROOT.TGraphErrors(), ROOT.TGraphErrors()]
540 for s
in self.
M.systemAndPlanes:
543 signal_medians[s-1].SetTitle(
"Median of signal per plane and per side")
544 signal_medians[s-1].GetYaxis().SetTitle(
"median QDC [a.u.]")
545 signal_maxima[s-1].SetTitle(
"Maximal signal per plane and per side")
546 signal_maxima[s-1].GetYaxis().SetTitle(
"maximum QDC [a.u.]")
547 signal_overflow[s-1].SetTitle(
"Overflow/All QDC per plane and per side")
548 signal_overflow[s-1].GetYaxis().SetTitle(
"overflow QDC [%]")
549 for item
in signal_attributes.keys():
550 if s==2
and plane_label[item].find(
'US')<0 :
continue
551 if s==3
and plane_label[item].find(
'DS')<0 :
continue
552 point_count[s-1] += 1
553 signal_medians[s-1].SetPoint(point_count[s-1],item,signal_attributes[item][
"median"])
554 signal_medians[s-1].SetPointError(point_count[s-1],0,signal_attributes[item][
"std"])
555 signal_maxima[s-1].SetPoint(point_count[s-1],item,signal_attributes[item][
"max"])
556 signal_maxima[s-1].SetPointError(point_count[s-1],0,0)
557 signal_overflow[s-1].SetPoint(point_count[s-1],item,signal_attributes[item][
"percent_overflow"])
558 signal_overflow[s-1].SetPointError(point_count[s-1],0,0)
559 graph_list = [signal_medians, signal_maxima, signal_overflow]
560 for counter, graph
in enumerate([item[0]
for item
in graph_list]):
561 h[detector+
'signalsSummary'+xi].cd(counter+1)
562 ROOT.gPad.SetBottomMargin(0.2)
565 xAxis = graph.GetXaxis()
567 xAxis.SetTickLength(0)
568 ymin = graph.GetHistogram().GetMinimum()
569 ymax = graph.GetHistogram().GetMaximum()
570 for index, item
in enumerate(signal_attributes.keys()):
571 bin_index = xAxis.FindBin(item)
572 xAxis.SetBinLabel(bin_index,plane_label[item])
574 grid = ROOT.TLine(graph.GetPointX(index), ymin, graph.GetPointX(index), ymax)
578 tick = ROOT.TLine(graph.GetPointX(index), ymin, graph.GetPointX(index), ymin + 0.03*(ymax-ymin))
582 graph_list[counter][1].Draw(
'P,same')
583 graph_list[counter][2].Draw(
'P,same')
584 for s
in self.
M.systemAndPlanes:
585 if s==1: Area[counter]={}
586 Area[counter][s-1] = ROOT.TBox(ROOT.TMath.MinElement(graph_list[counter][s-1].GetN(), graph_list[counter][s-1].GetX())-0.5,
587 graph.GetHistogram().GetMinimum(),
588 ROOT.TMath.MaxElement(graph_list[counter][s-1].GetN(), graph_list[counter][s-1].GetX())+0.5,
589 graph.GetHistogram().GetMaximum())
590 Area[counter][s-1].SetLineWidth(0)
591 Area[counter][s-1].SetFillStyle(3003)
592 Area[counter][s-1].SetFillColor(s+1)
593 Area[counter][s-1].Draw(
"same")
594 graph_list[counter][s-1].SetMarkerStyle(21)
595 graph_list[counter][s-1].SetMarkerColor(s+1)
596 graph_list[counter][s-1].SetLineColor(s+1)
599 ut.bookCanvas(h,detector+
"chanbar"+xi,
' ',1800,700,3,1)
600 for s
in self.
M.systemAndPlanes:
603 ut.bookCanvas(h,sdict[s]+
"chanbar"+xi,
' ',1800,1800,12,15)
605 y = self.
M.systemAndPlanes[s]
606 ut.bookCanvas(h,sdict[s]+
"chanbar"+xi,
' ',1800,700,y,self.
M.systemAndBars[s])
607 h[sdict[s]+
"chanbar"+xi].cd(1)
608 for l
in range(self.
M.systemAndPlanes[s]):
609 if s==3
and (l==1
or l==3
or l==5
or l==6):
continue
611 for bar
in range(self.
M.systemAndBars[s]):
612 hname = detector+
'chanmult_'+str(s*1000+100*l+bar)+xi
613 nmax = h[hname].GetBinContent(h[hname].GetMaximumBin())
614 if nmax > maxN : maxN = nmax
615 for bar
in range(self.
M.systemAndBars[s]):
616 hname = detector+
'chanmult_'+str(s*1000+100*l+bar)+xi
619 h[detector+
"chanbar"+xi].cd(s)
620 h[hname].DrawClone(opt)
622 i = l+1 + (self.
M.systemAndBars[s]-bar-1)*self.
M.systemAndPlanes[s]
624 ix = bar//15 + 1 + (l//2)*4
627 h[sdict[s]+
"chanbar"+xi].cd(i)
628 h[hname].SetMaximum(h[hname].GetBinContent(h[hname].GetMaximumBin())*1.2)
632 for item
in [
"Active",
"Nfired"]:
633 ut.bookCanvas(h,detector+item+
'ChannelsPerBarVeto',
' ',1024,768,2,3)
636 for l
in range(self.
M.systemAndPlanes[s]):
638 h[detector+item+
'ChannelsPerBarVeto'].cd(counter)
640 if l==2
and i==1:
continue
642 h[detector+
'chan'+item+
'Left_'+str(s*10+l)].Draw(
"colz")
643 h[detector+
'chan'+item+
'Left_'+str(s*10+l)].SetMinimum(0)
645 h[detector+
'chan'+item+
'Right_'+str(s*10+l)].Draw(
"colz")
646 h[detector+
'chan'+item+
'Right_'+str(s*10+l)].SetMinimum(0)
647 self.
M.myPrint(h[detector+item+
'ChannelsPerBarVeto'],detector+item+
'ChannelsPerBarUSVeto',subdir=
'mufilter/shifter')
649 ut.bookCanvas(h,detector+item+
'ChannelsPerBarUS',
' ',1024,768,2,5)
652 for l
in range(self.
M.systemAndPlanes[s]):
654 h[detector+item+
'ChannelsPerBarUS'].cd(counter)
656 h[detector+
'chan'+item+
'Left_'+str(s*10+l)].Draw(
"colz")
657 h[detector+
'chan'+item+
'Left_'+str(s*10+l)].SetMinimum(0)
659 h[detector+
'chan'+item+
'Right_'+str(s*10+l)].Draw(
"colz")
660 h[detector+
'chan'+item+
'Right_'+str(s*10+l)].SetMinimum(0)
662 self.
M.myPrint(h[detector+item+
'ChannelsPerBarUS'],detector+item+
'ChannelsPerBarUSVeto',subdir=
'mufilter/shifter')
667 ut.bookHist(h,detector+
'chanActiveDSSummaryHisto',
'DS channel hit multiplicity; ;bar',
669 self.
M.systemAndBars[s],-0.5,self.
M.systemAndBars[s]-0.5)
670 h[detector+
'chanActiveDSSummaryHisto'].SetStats(0)
671 xAxis = h[detector+
'chanActiveDSSummaryHisto'].GetXaxis()
672 ut.bookCanvas(h,detector+
'chanActiveDSSummary',
' ',1024,768,1,1)
674 for l
in range(self.
M.systemAndPlanes[s]):
676 if (l%2==1
or l==6)
and i==1:
continue
678 xAxis.SetBinLabel(counter,plane_label[15+counter])
680 for barIndex
in range(1,self.
M.systemAndBars[s]+1):
682 h[detector+
'chanActiveDSSummaryHisto'].SetBinContent(counter, barIndex,
683 h[detector+
'chan'+item+
'Left_'+str(s*10+l)].GetBinContent(1, barIndex))
685 h[detector+
'chanActiveDSSummaryHisto'].SetBinContent(counter, barIndex,
686 h[detector+
'chan'+item+
'Right_'+str(s*10+l)].GetBinContent(1, barIndex))
687 h[detector+
'chanActiveDSSummaryHisto'].SetMinimum(0)
688 h[detector+
'chanActiveDSSummaryHisto'].Draw(
'colz')
689 h[detector+
'chanActiveDSSummaryHisto'].SetStats(0)
690 self.
M.myPrint(h[detector+
'chanActiveDSSummary'],detector+
'chanActiveDSSummary',subdir=
'mufilter/shifter')
693 ut.bookCanvas(h,detector+item+
'ChannelsPerBarDS',
' ',1024,768,3,4)
695 for l
in range(self.
M.systemAndPlanes[s]):
697 h[detector+item+
'ChannelsPerBarDS'].cd(counter)
698 if (l%2==1
or l==6)
and i==1:
continue
700 h[detector+
'chan'+item+
'Left_'+str(s*10+l)].Draw(
"colz")
701 h[detector+
'chan'+item+
'Left_'+str(s*10+l)].SetMinimum(0)
703 h[detector+
'chan'+item+
'Right_'+str(s*10+l)].Draw(
"colz")
704 h[detector+
'chan'+item+
'Right_'+str(s*10+l)].SetMinimum(0)
706 if l==5
and i==0: counter += 2
707 self.
M.myPrint(h[detector+item+
'ChannelsPerBarDS'],detector+item+
'ChannelsPerBarDS',subdir=
'mufilter/shifter')
709 canvas = detector+
'signalsSummary'+xi
710 self.
M.h[canvas].Update()
711 if xi!=
'': self.
M.myPrint(self.
M.h[canvas],canvas,subdir=
'mufilter/shifter/'+xi)
712 else: self.
M.myPrint(self.
M.h[canvas],canvas,subdir=
'mufilter/shifter')
713 for canvas
in [
'signalUSVeto'+xi,
'signalDS'+xi,detector+
'LR'+xi,
'USBars'+xi,
714 "Vetochanbar"+xi,
"USchanbar"+xi,
"DSchanbar"+xi,
'noise'+xi]:
716 if x!=
'': self.
M.myPrint(h[canvas],canvas,subdir=
'mufilter/expert/'+xi)
717 else: self.
M.myPrint(h[canvas],canvas,subdir=
'mufilter/expert')
718 for canvas
in [detector+
'hitmaps',detector+
'Xhitmaps',detector+
'barmaps',detector+
'dTScifi',detector+
'dTcorScifi']:
720 if s<3
and canvas.find(
'dT')>0:
continue
721 h[canvas+sdict[s]+xi].Update()
722 if x!=
'': self.
M.myPrint(h[canvas+sdict[s]+xi],canvas+sdict[s],subdir=
'mufilter/expert/'+xi)
723 else: self.
M.myPrint(h[canvas+sdict[s]+xi],canvas+sdict[s],subdir=
'mufilter/expert')
726 ut.bookCanvas(h,
"muonDSTracks"+xi,
' ',1200,400,3,1)
727 tc = h[
"muonDSTracks"+xi].cd(1)
728 h[detector+
'slopes'+xi].Draw(
'colz')
729 tc = h[
"muonDSTracks"+xi].cd(2)
730 rc = h[detector+
'slopes'+xi].ProjectionX(
"slopeX"+xi)
732 rc.SetTitle(
'track Y slope')
733 tc = h[
"muonDSTracks"+xi].cd(3)
734 rc = h[detector+
'slopes'+xi].ProjectionY(
"slopeY"+xi)
736 rc.SetTitle(
'track Y slope')
738 ut.bookCanvas(h,detector+
'TtrackPos'+xi,
"track position first state",600,1200,1,2)
739 h[detector+
'TtrackPos'+xi].cd(1)
740 rc = h[detector+
'trackPosBeam'+xi].Draw(
'colz')
741 h[detector+
'TtrackPos'+xi].cd(2)
742 rc = h[detector+
'trackPos'+xi].Draw(
'colz')
744 self.
M.myPrint(h[
"muonDSTracks"+xi],
"muonDSTrackdirection"+xi,subdir=
'mufilter/shifter/'+xi)
745 self.
M.myPrint(self.
M.h[detector+
'TtrackPos'+xi],detector+
'trackPos'+xi,subdir=
'mufilter/shifter/'+xi)
747 self.
M.myPrint(h[
"muonDSTracks"+xi],
"muonDSTrackdirection"+xi,subdir=
'mufilter/shifter')
748 self.
M.myPrint(self.
M.h[detector+
'TtrackPos'+xi],detector+
'trackPos'+xi,subdir=
'mufilter/shifter')
752 nh, nv = self.
M.systemAndPlanes[1],15//self.
M.systemAndPlanes[1]
753 ut.bookCanvas(h,detector+
"residualsVsX"+xi,
'residualsVsX ',1200,1200, nh, nv)
754 ut.bookCanvas(h,detector+
"residualsVsY"+xi,
'residualsVsY ',1200,1200, nh, nv)
755 ut.bookCanvas(h,detector+
"residuals"+xi,
'residuals',1200,1200, nh, nv)
757 for p
in [
'resX_',
'resY_']:
758 t = detector+
"residualsVs"+p.replace(
'res',
'').replace(
'_',
'')+xi
762 if s==1
and l>self.
M.systemAndPlanes[1]-1:
continue
763 if s==2
and l>self.
M.systemAndPlanes[2]-1:
continue
765 hname = detector+p+sdict[s]+str(s*10+l)+xi
766 h[hname].Draw(
'colz')
768 tc = h[detector+
"residuals"+xi].cd(i)
769 h[hname+
'proj']=h[hname].ProjectionX(hname+
'proj')
770 rc = h[hname+
'proj'].Fit(
'gaus',
'SQ')
774 stats = h[hname+
'proj'].FindObject(
'stats')
775 stats.SetOptFit(1111111)
780 h[hname+
'proj'].Draw()
783 self.
M.myPrint(self.
M.h[detector+
'residualsVsX'+xi],detector+
'residualsVsX',subdir=
'mufilter/expert/'+xi)
784 self.
M.myPrint(self.
M.h[detector+
'residualsVsY'+xi],detector+
'residualsVsY',subdir=
'mufilter/expert/'+xi)
785 self.
M.myPrint(self.
M.h[detector+
'residuals'+xi],detector+
'residuals',subdir=
'mufilter/expert/'+xi)
787 self.
M.myPrint(self.
M.h[detector+
'residualsVsX'+xi],detector+
'residualsVsX',subdir=
'mufilter/expert')
788 self.
M.myPrint(self.
M.h[detector+
'residualsVsY'+xi],detector+
'residualsVsY',subdir=
'mufilter/expert')
789 self.
M.myPrint(self.
M.h[detector+
'residuals'+xi],detector+
'residuals',subdir=
'mufilter/expert')
791 ut.bookCanvas(self.
M.h,
'dt'+xi,
'',1200,1200,1,2)
793 self.
M.h[
'deltaTScifiMufiHit_'+str(1)].Draw(
'hist')
795 self.
M.h[
'deltaTScifiMufiHit_'+str(s)].SetStats(0)
796 self.
M.h[
'deltaTScifiMufiHit_'+str(s)].SetLineColor(s+1)
797 self.
M.h[
'deltaTScifiMufiHit_'+str(s)].Draw(
'samehist')
799 if 'B2noB1' in self.
xing:
800 self.
M.h[
'deltaTScifiMufiHit_'+str(1)+
'B2noB1'].Draw(
'hist')
802 self.
M.h[
'deltaTScifiMufiHit_'+str(s)+
'B2noB1'].SetStats(0)
803 self.
M.h[
'deltaTScifiMufiHit_'+str(s)+
'B2noB1'].SetLineColor(s+1)
804 self.
M.h[
'deltaTScifiMufiHit_'+str(s)+
'B2noB1'].Draw(
'samehist')
805 self.
M.myPrint(self.
M.h[
'dt'+xi],
'scifi DS hit difference',subdir=
'mufilter/expert')