From b5c367584b20818268b7dbb8210b87165fa723ba Mon Sep 17 00:00:00 2001 From: siilieva Date: Fri, 1 Nov 2024 15:45:37 +0100 Subject: [PATCH] Restructure the monitoring to make the Scifi track plots in the DAQ moni module. Excluding the slow Scifi_residuals module from the monitoring, one also excludes the Scifi track moni plots. To fix that, these are moved to the DAQ moni module, where we have other plots related to tracks e.g. tracks vs bunch number. --- shipLHC/scripts/DAQ_monitoring.py | 77 ++++++++++++++++++++++++++--- shipLHC/scripts/Scifi_monitoring.py | 8 ++- shipLHC/scripts/run_Monitoring.py | 2 +- 3 files changed, 77 insertions(+), 10 deletions(-) diff --git a/shipLHC/scripts/DAQ_monitoring.py b/shipLHC/scripts/DAQ_monitoring.py index 58e2d587b7..3e63160763 100644 --- a/shipLHC/scripts/DAQ_monitoring.py +++ b/shipLHC/scripts/DAQ_monitoring.py @@ -90,8 +90,20 @@ def Init(self,options,monitor): self.xing = {'all':True,'B1only':False,'B2noB1':False,'noBeam':False} for x in self.xing: ut.bookHist(h,'bnr'+x,'bunch number; ',3564,-0.5,3564-0.5) + # The SciFi track monitoring plots are made in this module. + # These histograms are present in the SciFi_residuals module as well. Since running the latter is + # time-consuming, it is excluded from the baseline monitoring, while the relevant SciFi track + # plots are moved here. The DS track plots are defined in the MuFilter monitoring module. ut.bookHist(h,'trackDir'+x,'track direction;',300,-0.5,0.25) ut.bookHist(h,'trackDirSig'+x,'track direction significance;',100,-20,10) + if not self.M.fsdict and not self.M.hasBunchInfo and x!='all': continue + ut.bookHist(h,'trackSlopes'+x,'track slope; x/z [mrad]; y/z [mrad]',1000,-100,100,1000,-100,100) + ut.bookHist(h,'trackSlopesXL'+x,'track slope; x/z [rad]; y/z [rad]',2200,-1.1,1.1,2200,-1.1,1.1) + ut.bookHist(h,'trackPos'+x,'track pos; x [cm]; y [cm]',100,-90,10.,80,0.,80.) + ut.bookHist(h,'trackPosBeam'+x,'beam track pos slopes<0.1rad; x [cm]; y [cm]',100,-90,10.,80,0.,80.) + for item in h: + if isinstance(h[item], ROOT.TH2) and (item.find('trackPos')>0 or item.find('trackSlopes')>0): + h[item].SetTitleOffset(1.1, 'Y') ut.bookHist(h,'Tboard','Hit time per board, wrt SciFi 4Y board 40; board id; t_{hit} - t_{board 40 mean} [clock cycles]',62,0.5,62.5,100,-5.,5.) ut.bookHist(h,'Cckboard','160 MHz bunch number; board id; SND clock align phase wrt LHC [clock cycles]',62,0.5,62.5,100,0.,16.) @@ -120,6 +132,19 @@ def ExecuteEvent(self,event): if theTrack.GetUniqueID()!=1: DStrack = True continue + # get the slopes and track positions + state = theTrack.getFittedState() + pos = state.getPos() + mom = state.getMom() + slopeX = mom.X()/mom.Z() + slopeY = mom.Y()/mom.Z() + for x in self.xing: + if self.M.xing[x]: + self.M.fillHist2('trackSlopes'+x,slopeX*1000-pos.X()/48.2,slopeY*1000-pos.Y()/48.2) + self.M.fillHist2('trackSlopesXL'+x,slopeX-pos.X()/48200,slopeY-pos.Y()/48200) + self.M.fillHist2('trackPos'+x,pos.X(),pos.Y()) + if abs(slopeX)<0.1 and abs(slopeY)<0.1: self.M.fillHist2('trackPosBeam'+x,pos.X(),pos.Y()) + # get the track direction SL = trackTask.trackDir(theTrack) if not SL: continue SFtrack = True @@ -451,22 +476,60 @@ def Plot(self): h['Txing'].Update() self.M.myPrint(h['Txing'],"RatesXing",subdir='daq/expert') + for xi in self.xing: + if not self.M.fsdict and not self.M.hasBunchInfo and xi!='all': continue + # to make the titles better use 'x' + x = xi + if xi =='all': x='' + tname = 'scifi-trackSlopes'+x + ut.bookCanvas(h,tname,"track directions",1600,1800,3,2) + h[tname].cd(1) + rc = h['trackSlopes'+xi].Draw('colz') + h[tname].cd(2) + rc = h['trackSlopes'+xi].ProjectionX("slopeX"+xi) + rc.Draw() + rc.SetTitle('track X slope') + h[tname].cd(3) + rc = h['trackSlopes'+xi].ProjectionY("slopeY"+xi) + rc.Draw() + rc.SetTitle('track Y slope') + h[tname].cd(4) + rc = h['trackSlopesXL'+xi].Draw('colz') + h[tname].cd(5) + rc = h['trackSlopesXL'+xi].ProjectionX("slopeXL"+xi) + rc.Draw() + rc.SetTitle('track X slope') + h[tname].cd(6) + rc = h['trackSlopesXL'+xi].ProjectionY("slopeYL"+xi) + rc.Draw() + rc.SetTitle('track Y slope') + if xi=='all': self.M.myPrint(self.M.h[tname],tname,subdir='scifi/shifter') + else: self.M.myPrint(self.M.h[tname],tname,subdir='scifi/shifter/'+xi) + tname = 'scifi-trackPos'+x + ut.bookCanvas(h,tname,"track position first state",600,1200,1,2) + h[tname].cd(1) + rc = h['trackPosBeam'+xi].Draw('colz') + h[tname].cd(2) + rc = h['trackPos'+xi].Draw('colz') + if xi=='all': self.M.myPrint(self.M.h[tname],'trackPos'+xi,subdir='scifi/shifter') + else: self.M.myPrint(self.M.h[tname],'trackPos'+xi,subdir='scifi/shifter/'+xi) + if self.fsdict or self.M.hasBunchInfo: - ut.bookCanvas(h,'trackDirection',' ',1024,768,4,2) + ut.bookCanvas(h,'scifi-trackDirection',' ',1024,768,4,2) j=1 for x in self.xing: - h['trackDirection'].cd(j) + h['scifi-trackDirection'].cd(j) h['trackDir'+x].Draw() - h['trackDirection'].cd(4+j) + h['scifi-trackDirection'].cd(4+j) h['trackDir'+x].Draw() j+=1 else: - ut.bookCanvas(h,'trackDirection',' ',1024,768,2,1) - h['trackDirection'].cd(1) + ut.bookCanvas(h,'scifi-trackDirection',' ',1024,768,2,1) + h['scifi-trackDirection'].cd(1) h['trackDirall'].Draw() - h['trackDirection'].cd(2) + h['scifi-trackDirection'].cd(2) h['trackDirSigall'].Draw() - self.M.myPrint(h['trackDirection'],'trackdirections',subdir='scifi/expert') + self.M.myPrint(h['scifi-trackDirection'],'trackdirections',subdir='scifi/expert') ut.bookCanvas(h,'bunchNumber','bunch nr',2048,1600,1,3) tc = h['bunchNumber'].cd(1) diff --git a/shipLHC/scripts/Scifi_monitoring.py b/shipLHC/scripts/Scifi_monitoring.py index e4a0c72576..6f3b02701b 100644 --- a/shipLHC/scripts/Scifi_monitoring.py +++ b/shipLHC/scripts/Scifi_monitoring.py @@ -197,6 +197,7 @@ def Init(self,options,monitor): ut.bookHist(h,detector+'trackChi2/ndof','track chi2/ndof vs ndof; #chi^{2}/Ndof; Ndof',100,0,100,20,0,20) # type of crossing, check for b1only,b2nob1,nobeam self.xing = {'':True,'B1only':False,'B2noB1':False,'noBeam':False} + ''' for xi in self.xing: if not self.M.fsdict and not self.M.hasBunchInfo and xi!='': continue ut.bookHist(h,detector+'trackSlopes'+xi,'track slope; x/z [mrad]; y/z [mrad]',1000,-100,100,1000,-100,100) @@ -206,7 +207,7 @@ def Init(self,options,monitor): for item in h: if isinstance(h[item], ROOT.TH2) and (item.find('trackPos')>0 or item.find('trackSlopes')>0): h[item].SetTitleOffset(1.1, 'Y') - + ''' if alignPar: for x in alignPar: self.M.Scifi.SetConfPar(x,alignPar[x]) @@ -285,11 +286,12 @@ def ExecuteEvent(self,event): slopeX = mom.X()/mom.Z() slopeY = mom.Y()/mom.Z() rc = h[detector+'trackChi2/ndof'].Fill(fitStatus.getChi2()/(fitStatus.getNdf()+1E-10),fitStatus.getNdf()) + ''' self.M.fillHist2(detector+'trackSlopes',slopeX*1000-pos.X()/48.2,slopeY*1000-pos.Y()/48.2) self.M.fillHist2(detector+'trackSlopesXL',slopeX-pos.X()/48200,slopeY-pos.Y()/48200) self.M.fillHist2(detector+'trackPos',pos.X(),pos.Y()) if abs(slopeX)<0.1 and abs(slopeY)<0.1: self.M.fillHist2(detector+'trackPosBeam',pos.X(),pos.Y()) - + ''' if not theTrack: return @@ -464,6 +466,7 @@ def Plot(self): for proj in P: T.append('scifiRes'+proj) for canvas in T: self.M.myPrint(self.M.h[canvas],"Scifi-"+canvas,subdir='scifi/expert') + ''' for xi in self.xing: if not self.M.fsdict and not self.M.hasBunchInfo and xi!='': continue tname = detector+'trackDir'+xi @@ -498,6 +501,7 @@ def Plot(self): rc = h[detector+'trackPos'+xi].Draw('colz') if x=='': self.M.myPrint(self.M.h[tname],detector+'trackPos'+xi,subdir='scifi/shifter') else: self.M.myPrint(self.M.h[tname],detector+'trackPos'+xi,subdir='scifi/shifter/'+xi) + ''' class Scifi_trackEfficiency(ROOT.FairTask): " track efficiency tag with DS track" diff --git a/shipLHC/scripts/run_Monitoring.py b/shipLHC/scripts/run_Monitoring.py index bb0e403b12..b944f8a94a 100644 --- a/shipLHC/scripts/run_Monitoring.py +++ b/shipLHC/scripts/run_Monitoring.py @@ -191,7 +191,7 @@ def currentRun(): monitorTasks['Mufi_hitMaps'] = Mufi_monitoring.Mufi_hitMaps() monitorTasks['Mufi_QDCcorellations'] = Mufi_monitoring.Mufi_largeVSsmall() if options.postScale<2: monitorTasks['Veto_Efficiency'] = Mufi_monitoring.Veto_Efficiency() -monitorTasks['Scifi_residuals'] = Scifi_monitoring.Scifi_residuals() # time consuming +#monitorTasks['Scifi_residuals'] = Scifi_monitoring.Scifi_residuals() # time consuming if options.interactive: monitorTasks['EventDisplay'] = EventDisplay_Task.twod() for m in monitorTasks: