SND@LHC Software
Loading...
Searching...
No Matches
vetoTimeCalibration.vetoTimeWalk Class Reference
Inheritance diagram for vetoTimeCalibration.vetoTimeWalk:
Collaboration diagram for vetoTimeCalibration.vetoTimeWalk:

Public Member Functions

 Init (self, options, monitor)
 
 ExecuteEvent (self, event)
 
 Plot (self)
 
 Finalize (self)
 

Public Attributes

 M
 
 zPos
 
 options
 
 tdcScifiStationCalib
 
 V
 
 C
 
 Vveto
 

Detailed Description

Definition at line 338 of file vetoTimeCalibration.py.

Member Function Documentation

◆ ExecuteEvent()

vetoTimeCalibration.vetoTimeWalk.ExecuteEvent (   self,
  event 
)

Definition at line 360 of file vetoTimeCalibration.py.

360 def ExecuteEvent(self,event):
361 h = self.M.h
362 s = 1
363 vetoHits = {10:[],11:[]}
364 for aHit in event.Digi_MuFilterHits:
365 if not aHit.isValid(): continue
366 detID = aHit.GetDetectorID()//1000
367 if not detID<20: continue
368 vetoHits[detID].append(aHit)
369 if not(len(vetoHits[10])==1) and not(len(vetoHits[11])==1): return
370
371 DetID2Key={}
372 for nHit in range(event.Digi_ScifiHits.GetEntries()):
373 DetID2Key[event.Digi_ScifiHits[nHit].GetDetectorID()] = nHit
374
375 Z0 = self.zPos['Scifi'][10]
376 times = []
377 for aTrack in event.Reco_MuonTracks:
378 if not aTrack.GetUniqueID()==1: continue
379 tdc = {10:{},11:{}}
380 S = aTrack.getFitStatus()
381 if not S.isFitConverged(): continue
382 mom = aTrack.getFittedState().getMom()
383 pos = aTrack.getFittedState().getPos()
384 slopeX = mom.X()/mom.Z()
385 slopeY = mom.Y()/mom.Z()
386# get time of track by averaging all times of the clusters correcting for track length
387 for nM in range(aTrack.getNumPointsWithMeasurement()):
388 state = aTrack.getFittedState(nM)
389 Meas = aTrack.getPointWithMeasurement(nM)
390 W = Meas.getRawMeasurement()
391 clkey = W.getHitId()
392 aCl = event.Cluster_Scifi[clkey]
393 aHit = event.Digi_ScifiHits[DetID2Key[aCl.GetFirst()]]
394 s = aCl.GetFirst()//1000000
395 aCl.GetPosition(A,B)
396 mat = (aCl.GetFirst()//10000)%10
397 if aHit.isVertical():
398 proj = 'V'
399 L = B[1]-state.getPos()[1]
400 else:
401 proj = 'H'
402 L = A[0]-state.getPos()[0]
403 time = aCl.GetTime() # Get time in ns, use fastest TDC of cluster
404 time-= self.tdcScifiStationCalib[s][1][proj][mat] # correct as function of station / projection / mat
405 time-= self.tdcScifiStationCalib[s][0] # internal station calibration
406 time-= abs(L)/self.V # signal along fibre
407#
408 dZ = (A[2]+B[2])/2. - Z0
409 dL = dZ * ROOT.TMath.Sqrt( slopeX**2+slopeY**2+1 )
410 if slopeY>0.1: dL = -dL # cosmics from the back
411 time-= dL/self.C # track length with respect to sation0
412#
413 times.append(time)
414
415 sTime = statistics.mean(times)
416 rms = statistics.stdev(times)
417 rc = h['trms'].Fill(rms)
418 s = 1
419 for l in range(2):
420 zEx = self.M.zPos['MuFilter'][1*10+l]
421 lam = (zEx-pos.z())/mom.z()
422 yEx = pos.y()+lam*mom.y()
423 xEx = pos.x()+lam*mom.x() # needed for correction of signal propagation
424 for aHit in vetoHits[10+l]:
425 detID = aHit.GetDetectorID()
426 self.M.MuFilter.GetPosition(detID,A,B)
427 D = (A[1]+B[1])/2. - yEx
428 if abs(D)<5:
429 bar = (detID%1000)
430 tdc[10+l][bar] = {'L':{},'R':{}}
431 for k in range(16):
432 qdc = aHit.GetSignal(k)
433 if qdc <0: continue
434 kx = k
435 side = 'L'
436 L = A[0]-xEx
437 if not k < 8 :
438 kx = k - 8
439 side = 'R'
440 L = B[0]-xEx
441 T = aHit.GetTime(k) * self.M.TDC2ns
442 T-= abs(L)/self.Vveto # signal along bar
443
444 dZ = (A[2]+B[2])/2. - Z0
445 dL = dZ * ROOT.TMath.Sqrt( slopeX**2+slopeY**2+1 )
446 if slopeY>0.1: dL = -dL # cosmics from the back
447 T-= dL/self.C # track length with respect to sation0
448 key = self.M.sdict[s]+str(s*10+l)+'_'+str(bar)+side+str(kx)
449 # print(key,T,sTime)
450 h['tvsQDC_'+key].Fill(qdc,T-sTime)
451
void GetPosition(Int_t id, TVector3 &vLeft, TVector3 &vRight)
Definition MuFilter.cxx:639

◆ Finalize()

vetoTimeCalibration.vetoTimeWalk.Finalize (   self)

Definition at line 465 of file vetoTimeCalibration.py.

465 def Finalize(self):
466 h = self.M.h
467 s = 1
468 ut.writeHists(h,'timeWalk_'+self.M.sdict[s]+'.root')
469

◆ Init()

vetoTimeCalibration.vetoTimeWalk.Init (   self,
  options,
  monitor 
)

Definition at line 340 of file vetoTimeCalibration.py.

340 def Init(self,options,monitor):
341 self.M = monitor
342 self.zPos = monitor.zPos
343 self.options = options
344 h = monitor.h
345 s = 1
346 for l in range(self.M.systemAndPlanes[s]):
347 for bar in range(self.M.systemAndBars[s]):
348 for side in ['L','R']:
349 for k in range(8):
350 key = self.M.sdict[s]+str(s*10+l)+'_'+str(bar)+side+str(k)
351 ut.bookHist(h,'tvsQDC_'+key,'t '+key+";QDC [a.u.];t [ns]",60,0.,60.,120,-7.,5.)
352 ut.bookHist(h,'trms', "rms of scifi times;t [ns]",100,0.,1.)
353 with open('ScifiTimeAlignment_v2', 'rb') as fh:
354 self.tdcScifiStationCalib = pickle.load(fh)
355 self.V = 15 * u.cm/u.ns
356 self.C = 299792458 * u.m/u.s
357 self.Vveto = 13.5 * u.cm/u.ns
358
359

◆ Plot()

vetoTimeCalibration.vetoTimeWalk.Plot (   self)

Definition at line 452 of file vetoTimeCalibration.py.

452 def Plot(self):
453 h = self.M.h
454 M=self.M
455 s = 1
456 for l in range(M.systemAndPlanes[s]):
457 for side in ['L','R']:
458 ut.bookCanvas(h,'plane'+str(l)+side,'',2400,1800,8,7)
459 for kx in range(8):
460 for bar in range(M.systemAndBars[s]):
461 tc = h['plane'+str(l)+side].cd(kx+bar*8+1)
462 key = M.sdict[s]+str(s*10+l)+'_'+str(bar)+side+str(kx)
463 h['tvsQDC_'+key].Draw('colz')
464

Member Data Documentation

◆ C

vetoTimeCalibration.vetoTimeWalk.C

Definition at line 356 of file vetoTimeCalibration.py.

◆ M

vetoTimeCalibration.vetoTimeWalk.M

Definition at line 341 of file vetoTimeCalibration.py.

◆ options

vetoTimeCalibration.vetoTimeWalk.options

Definition at line 343 of file vetoTimeCalibration.py.

◆ tdcScifiStationCalib

vetoTimeCalibration.vetoTimeWalk.tdcScifiStationCalib

Definition at line 354 of file vetoTimeCalibration.py.

◆ V

vetoTimeCalibration.vetoTimeWalk.V

Definition at line 355 of file vetoTimeCalibration.py.

◆ Vveto

vetoTimeCalibration.vetoTimeWalk.Vveto

Definition at line 357 of file vetoTimeCalibration.py.

◆ zPos

vetoTimeCalibration.vetoTimeWalk.zPos

Definition at line 342 of file vetoTimeCalibration.py.


The documentation for this class was generated from the following file: