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

Public Member Functions

 Init (self, options, monitor)
 
 ExecuteEvent (self, event)
 
 checkOtherTriggers (self, event, debug=False)
 
 Plot (self, beamOnly=False)
 

Public Attributes

 debug
 
 deadTime
 
 M
 
 eventBefore
 
 trackTask
 
 OT
 
 noiseCuts
 
 zEx
 

Detailed Description

Definition at line 922 of file Mufi_monitoring.py.

Member Function Documentation

◆ checkOtherTriggers()

Mufi_monitoring.Veto_Efficiency.checkOtherTriggers (   self,
  event,
  debug = False 
)

Definition at line 1182 of file Mufi_monitoring.py.

1182 def checkOtherTriggers(self,event,debug=False):
1183 T0 = event.EventHeader.GetEventTime()
1184 N = event.EventHeader.GetEventNumber()
1185 otherFastTrigger = False
1186 otherAdvTrigger = False
1187 tightNoiseFilter = False
1188 Nprev = 1
1189 if N<Nprev: return otherFastTrigger, otherAdvTrigger, tightNoiseFilter, -1, 0
1190 rc = event.GetEvent(N-Nprev)
1191 dt = T0 - event.EventHeader.GetEventTime()
1192 while dt < self.deadTime and N>Nprev:
1193 otherFastTrigger = False
1194 for x in event.EventHeader.GetFastNoiseFilters():
1195 if debug: print('fast:', x.first, x.second )
1196 if x.second and not x.first == 'Veto_Total': otherFastTrigger = True
1197 otherAdvTrigger = False
1198 for x in event.EventHeader.GetAdvNoiseFilters():
1199 if debug: print('adv:', x.first, x.second )
1200 if x.second and not x.first == 'VETO_Planes': otherAdvTrigger = True
1201 if debug: print('pre event ',Nprev,dt,otherFastTrigger,otherAdvTrigger)
1202 if otherFastTrigger and otherAdvTrigger:
1203 rc = event.GetEvent(N)
1204 return otherFastTrigger, otherAdvTrigger, tightNoiseFilter, Nprev, dt
1205 Nprev+=1
1206 rc = event.GetEvent(N-Nprev)
1207 dt = T0 - event.EventHeader.GetEventTime()
1208 Nprev = 1
1209 rc = event.GetEvent(N-Nprev)
1210 dt = T0 - event.EventHeader.GetEventTime()
1211 while dt < self.deadTime and Nprev>N:
1212 hits = {2:0,1:0,0:0}
1213 for aHit in event.Digi_MuFilterHits:
1214 Minfo = self.M.MuFilter_PlaneBars(aHit.GetDetectorID())
1215 s,l,bar = Minfo['station'],Minfo['plane'],Minfo['bar']
1216 if s>1: continue
1217 allChannels = aHit.GetAllSignals(False,False)
1218 hits[l]+=len(allChannels)
1219 noiseFilter0 = sum(hits)>4.5
1220 noiseFilter1 = all(p > 0 for p in hits)
1221 if debug: print('veto hits:',hits)
1222 if noiseFilter0 and noiseFilter1:
1223 tightNoiseFilter = True
1224 rc = event.GetEvent(N)
1225 return otherFastTrigger, otherAdvTrigger, tightNoiseFilter, Nprev-1, dt
1226 Nprev+=1
1227 rc = event.GetEvent(N-Nprev)
1228 dt = T0 - event.EventHeader.GetEventTime()
1229 if Nprev>1:
1230 rc = event.GetEvent(N-Nprev+1)
1231 dt = T0 - event.EventHeader.GetEventTime()
1232 rc = event.GetEvent(N)
1233 return otherFastTrigger, otherAdvTrigger, tightNoiseFilter, Nprev-1, dt
1234

◆ ExecuteEvent()

Mufi_monitoring.Veto_Efficiency.ExecuteEvent (   self,
  event 
)

Definition at line 971 of file Mufi_monitoring.py.

971 def ExecuteEvent(self,event):
972 scifiCorTest = False
973 systemAndPlanes = self.M.systemAndPlanes
974 sdict = self.M.sdict
975 s = 1
976 h = self.M.h
977 W = self.M.Weight
978 nSiPMs = self.M.MuFilter.GetConfParI("MuFilter/VetonSiPMs")
979 hits = {2:0,1:0,0:0,'0L':0,'0R':0,'1L':0,'1R':0}
980 vetoHitsFromPrev = 0
981 if event.EventHeader.GetRunId() < 6204 and event.EventHeader.GetRunId() > 5480: vetoHitsFromPrev = 5
982 # special treatment for first 10fb-1 in 2023, wrong time alignment, again!
983 N1 = event.GetReadEntry()
984 Tcurrent = event.EventHeader.GetEventTime()
985 dT = abs(Tcurrent-self.eventBefore['T'])
986 prevAdded = False
987 for j in [0,-1]:
988 if j<0 and N1>0:
989 if dT > vetoHitsFromPrev: continue
990 rc = event.GetEvent(N1-1) # add veto hits from prev event
991 prevAdded = True
992 for aHit in event.Digi_MuFilterHits:
993 if not aHit.isValid(): continue
994 Minfo = self.M.MuFilter_PlaneBars(aHit.GetDetectorID())
995 s,l,bar = Minfo['station'],Minfo['plane'],Minfo['bar']
996 if s>1: continue
997 allChannels = self.M.map2Dict(aHit,'GetAllSignals')
998 hits[l]+=len(allChannels)
999 if l != 2:
1000 for c in allChannels:
1001 if nSiPMs > c: # left side
1002 hits[str(l)+'L']+=1
1003 else:
1004 hits[str(l)+'R']+=1
1005 allChannels.clear()
1006 if prevAdded and N1>1:
1007 rc = event.GetEvent(N1-2)
1008 Tprevprev = event.EventHeader.GetEventTime()
1009 dT = abs(Tcurrent-Tprevprev)
1010 if prevAdded: event.GetEvent(N1)
1011 prevEvent = False
1012 tightNoiseFilter = None
1013 otherAdvTrigger = None
1014 otherFastTrigger = None
1015 if dT < self.deadTime and dT > vetoHitsFromPrev:
1016 prevEvent = True
1017 # check type of prev event, if it would pass tight noise filter, run 6568 ++
1018 if event.EventHeader.GetRunId() > 6567 and N1>0:
1019 tightNoiseFilter, otherFastTrigger, otherAdvTrigger,Nprev,dt = self.checkOtherTriggers(event)
1020
1021 tmpT = self.eventBefore['T']
1022 tmpN = self.eventBefore['N']
1023 self.eventBefore['T'] = Tcurrent
1024 if (self.M.EventNumber - self.eventBefore['N'] > 1) and self.M.options.postScale < 2:
1025 print('what is going on?', self.M.EventNumber, self.eventBefore['N'])
1026 self.eventBefore['N'] = self.M.EventNumber
1027
1028 rc = h['scaler'].Fill(11)
1029 if self.M.Reco_MuonTracks.GetEntries()<2: return # require Scifi and DS track
1030# check that track has scifi cluster in station 1, afterthought: require measurements in all planes
1031 planes = {}
1032 for scifiTrack in self.M.Reco_MuonTracks:
1033 if not scifiTrack.GetUniqueID()==1: continue
1034 fitStatus = scifiTrack.getFitStatus()
1035 if not fitStatus.isFitConverged(): continue
1036 if fitStatus.getNdf() < 5 or fitStatus.getNdf()>12 : continue
1037 if fitStatus.getChi2()/fitStatus.getNdf() > 80: continue
1038 for nM in range(scifiTrack.getNumPointsWithMeasurement()):
1039 M = scifiTrack.getPointWithMeasurement(nM)
1040 W = M.getRawMeasurement()
1041 detID = W.getDetId()
1042 planes[detID//100000] = 1
1043 rc = h['scaler'].Fill(10)
1044 scifiOneEff = 10 in planes or 11 in planes or not scifiCorTest
1045 if not scifiOneEff and len(planes) < 8: return
1046 if scifiOneEff and len(planes) < 10: return
1047 rc = h['scaler'].Fill(0)
1048 if not prevEvent: rc = h['scaler'].Fill(1)
1049
1050 for l in range(systemAndPlanes[1]-1):
1051 rc = h['hitVeto_'+str(l)].Fill(hits[str(l)+'L'],hits[str(l)+'R'])
1052 rc = h['hitVeto_01'].Fill(hits[0],hits[1])
1053 if systemAndPlanes[1] > 2 :
1054 rc = h['hitVeto_02'].Fill(hits[0],hits[2])
1055 rc = h['hitVeto_12'].Fill(hits[1],hits[2])
1056
1057 for muTrack in self.M.Reco_MuonTracks:
1058 if not muTrack.GetUniqueID()==3: continue
1059 fstate = muTrack.getFittedState()
1060 posT,momT = fstate.getPos(),fstate.getMom()
1061 lam = (self.zEx-posT.z())/momT.z()
1062 yExTag = posT.y()+lam*momT.y()
1063 xExTag = posT.x()+lam*momT.x()
1064 sstate = scifiTrack.getFittedState()
1065 pos = sstate.getPos()
1066 delX = xExTag - pos.x()
1067 delY = yExTag - pos.y()
1068 rc = h['X/Y'].Fill(delX,delY)
1069 if abs(delX)>10 or abs(delY)>10: return
1070
1071 for aTrack in self.M.Reco_MuonTracks:
1072 if not aTrack.GetUniqueID()==1: continue
1073 fitStatus = aTrack.getFitStatus()
1074 if not fitStatus.isFitConverged(): continue
1075 fstate = aTrack.getFittedState()
1076 pos,mom = [fstate.getPos(),fstate.getMom()]
1077 beam = False
1078 if abs(mom.x()/mom.z())<0.1 and abs(mom.y()/mom.z())<0.1: beam = True
1079# extrapolate to veto
1080# check timing, remove backward tracks
1081# 1: get early DS time in horizontal plane 2:
1082 dsHitTimes = []
1083 for aHit in event.Digi_MuFilterHits:
1084 if not aHit.isValid(): continue
1085 detID = aHit.GetDetectorID()
1086 Minfo = self.M.MuFilter_PlaneBars(detID)
1087 s,l,bar = Minfo['station'],Minfo['plane'],Minfo['bar']
1088 if s==3 and l==2:
1089 self.M.MuFilter.GetPosition(detID,A,B)
1090 timeLeft = aHit.GetTime(0)
1091 timeRight = aHit.GetTime(1)
1092 if timeLeft>0 and timeRight>0:
1093 dL = abs(A[0]-B[0])
1094 avTime = self.M.MuFilter.GetCorrectedTime(detID, 0, timeLeft*self.M.TDC2ns,0) + \
1095 self.M.MuFilter.GetCorrectedTime(detID, 1, timeRight*self.M.TDC2ns,0)
1096 dsHitTimes.append( (avTime-abs(A[0]-B[0])/15)/2) # L/2 / 15cm/ns
1097 dsHitTimes.sort()
1098 scifiHitTimes = {1:[],2:[],3:[],4:[],5:[]}
1099 deltaT = -100
1100 if len(dsHitTimes)>0:
1101 for scifiHit in event.Digi_ScifiHits:
1102 detID = scifiHit.GetDetectorID()
1103 s = int(scifiHit.GetDetectorID()/1000000)
1104 if s>1.5: continue
1105 scifiHitTimes[s].append(self.M.Scifi.GetCorrectedTime(detID,scifiHit.GetTime()*self.M.TDC2ns,0))
1106 for s in scifiHitTimes:
1107 if len(scifiHitTimes[s])<1: continue
1108 scifiHitTimes[s].sort()
1109 deltaT = dsHitTimes[0] - scifiHitTimes[s][0] - (self.M.zPos['MuFilter'][34]-self.M.zPos['Scifi'][s*10])/u.speedOfLight
1110 rc = h['deltaT'].Fill(deltaT)
1111 if deltaT < -10: continue
1112 #look for previous event time
1113 T1 = event.EventHeader.GetEventTime()
1114 N1 = event.EventHeader.GetEventNumber()
1115 if prevAdded: rc = event.GetEvent(N1-2)
1116 else: rc = event.GetEvent(N1-1)
1117 T0 = event.EventHeader.GetEventTime()
1118 rc = event.GetEvent(N1+1)
1119 T2 = event.EventHeader.GetEventTime()
1120 rc = event.GetEvent(N1)
1121 if (T1-T0) < 100 and self.M.options.postScale < 2:
1122 if not prevEvent: print('what is going on?',N1,T1,T0,N1-1,tmpN,tmpT)
1123 prevEvent = True
1124 s = 1
1125 xEx = {}
1126 yEx = {}
1127 for l in range(systemAndPlanes[1]):
1128 zEx = self.M.zPos['MuFilter'][s*10+l]
1129 lam = (zEx-pos.z())/mom.z()
1130 xEx[l] = pos.x()+lam*mom.x()
1131 yEx[l] = pos.y()+lam*mom.y()
1132 for l in range(systemAndPlanes[1]):
1133 for noiseCut in self.noiseCuts:
1134 c=''
1135 if not prevEvent: c='NoPrev'
1136 nc = 'T'+c+str(noiseCut)
1137 ncL = 'T'+'TiNoFi'+str(noiseCut)
1138 if hits[l] > noiseCut or (l==2 and hits[l] > int(noiseCut/2+0.5)):
1139 rc = h[nc+'PosVeto_'+str(l)].Fill(xEx[l],yEx[l])
1140 if tightNoiseFilter: rc = h[ncL+'PosVeto_'+str(l)].Fill(xEx[l],yEx[l])
1141 if beam: rc = h[nc+'beamPosVeto_'+str(l)].Fill(xEx[l],yEx[l])
1142 else:
1143 rc = h[nc+'XPosVeto_'+str(l)].Fill(xEx[l],yEx[l])
1144 rc = h[nc+'XPosVetoXL_'+str(l)].Fill(xEx[l],yEx[l])
1145 if tightNoiseFilter: h[ncL+'XPosVeto_'+str(l)].Fill(xEx[l],yEx[l])
1146 if beam: rc = h[nc+'beamXPosVeto_'+str(l)].Fill(xEx[l],yEx[l])
1147 if l==0:
1148 if -45<xEx[l] and xEx[l]<-10 and 27<yEx[l] and yEx[l]<54:
1149 rc = h['timeDiffPrev_'+str(noiseCut)].Fill(T1-T0)
1150 rc = h['timeDiffNext_'+str(noiseCut)].Fill(T2-T1)
1151 if ( systemAndPlanes[1]==2 and hits[0] > noiseCut and hits[1] > noiseCut) or \
1152 ( systemAndPlanes[1]==3 and hits[0] > noiseCut and hits[1] > noiseCut \
1153 and hits[2] > int(noiseCut/2+0.5) ):
1154 for l1 in range(systemAndPlanes[1]):
1155 rc = h[nc+'PosVeto_111'+str(l1)].Fill(xEx[l1],yEx[l1])
1156 if tightNoiseFilter:
1157 rc = h[ncL+'PosVeto_111'+str(l1)].Fill(xEx[l1],yEx[l1])
1158 if beam: rc = h[nc+'beamPosVeto_1110'].Fill(xEx[l],yEx[l])
1159 if ( systemAndPlanes[1]==2 and (hits[0] > noiseCut or hits[1] > noiseCut)) or \
1160 ( systemAndPlanes[1]==3 and (hits[0] > noiseCut or hits[1] > noiseCut \
1161 or hits[2] > int(noiseCut/2+0.5)) ):
1162 rc = h[nc+'PosVeto_000'].Fill(xEx[l],yEx[l])
1163 if tightNoiseFilter: h[ncL+'PosVeto_000'].Fill(xEx[l],yEx[l])
1164 if beam: rc = h[nc+'beamPosVeto_000'].Fill(xEx[l],yEx[l])
1165 else:
1166 if -45<xEx[l] and xEx[l]<-10 and 27<yEx[l] and yEx[l]<54:
1167 rc = h['XtimeDiffPrev_'+str(noiseCut)].Fill(T1-T0)
1168 rc = h['XtimeDiffNext_'+str(noiseCut)].Fill(T2-T1)
1169 if not prevEvent or (prevEvent and not tightNoiseFilter):
1170 if self.debug: print('no hits',noiseCut,prevEvent,beam,N1,tightNoiseFilter,otherFastTrigger,otherAdvTrigger)
1171 for l1 in range(systemAndPlanes[1]):
1172 rc = h[nc+'XPosVeto_111'+str(l1)].Fill(xEx[l1],yEx[l1])
1173 if tightNoiseFilter:
1174 rc = h[ncL+'XPosVeto_111'+str(l1)].Fill(xEx[l1],yEx[l1])
1175 if beam: rc = h[nc+'beamXPosVeto_1110'].Fill(xEx[l],yEx[l])
1176 # also for the 2 planea
1177 if hits[0] > noiseCut and hits[1] > noiseCut:
1178 rc = h[nc+'PosVeto_11'].Fill(xEx[l],yEx[l])
1179 if not (hits[0] > noiseCut or hits[1] > noiseCut):
1180 rc = h[nc+'XPosVeto_11'].Fill(xEx[l],yEx[l])
1181
void GetPosition(Int_t id, TVector3 &vLeft, TVector3 &vRight)
Definition MuFilter.cxx:639
Float_t GetCorrectedTime(Int_t id, Int_t c, Double_t t, Double_t L)
Definition MuFilter.cxx:579
Int_t GetConfParI(TString name)
Definition MuFilter.h:47
Double_t GetCorrectedTime(Int_t fDetectorID, Double_t rawTime, Double_t L)
Definition Scifi.cxx:517

◆ Init()

Mufi_monitoring.Veto_Efficiency.Init (   self,
  options,
  monitor 
)

Definition at line 924 of file Mufi_monitoring.py.

924 def Init(self,options,monitor):
925 self.debug = True
926 self.deadTime = 100
927 self.M = monitor
928 sdict = self.M.sdict
929 self.eventBefore={'T':-1,'N':-1,'hits':{2:0,1:0,0:0,'0L':0,'0R':0,'1L':0,'1R':0}}
930 h = self.M.h
931 run = ROOT.FairRunAna.Instance()
932 self.trackTask = run.GetTask('simpleTracking')
933 if not self.trackTask: self.trackTask = run.GetTask('houghTransform')
934 ioman = ROOT.FairRootManager.Instance()
935 self.OT = ioman.GetSink().GetOutTree()
936 s = 1
937 self.noiseCuts = [1,5,10,12]
938 self.zEx = self.M.zPos['Scifi'][10]
939 for noiseCut in self.noiseCuts:
940 ut.bookHist(h,'timeDiffPrev_'+str(noiseCut),'time diff; [clock cycles] ',100,-0.5,999.5)
941 ut.bookHist(h,'XtimeDiffPrev_'+str(noiseCut),'time diff no hits; [clock cycles] ',100,-0.5,999.5)
942 ut.bookHist(h,'timeDiffNext_'+str(noiseCut),'time diff next; [clock cycles] ',100,-0.5,999.5)
943 ut.bookHist(h,'XtimeDiffNext_'+str(noiseCut),'time diff next no hits; [clock cycles] ',100,-0.5,999.5)
944 for c in ['','NoPrev','TiNoFi']:
945 for b in ['','beam']:
946 nc = 'T'+c+str(noiseCut)+b
947 for l in range(monitor.systemAndPlanes[s]):
948 ut.bookHist(h,nc+'PosVeto_'+str(l),'track pos at veto'+str(l)+' with hit '+';X [cm]; Y [cm]',110,-55.,0.,110,10.,65.)
949 ut.bookHist(h,nc+'XPosVeto_'+str(l),'track pos at veto'+str(l)+' no hit'+str(l)+';X [cm]; Y [cm]',110,-55.,0.,110,10.,65.)
950 ut.bookHist(h,nc+'XPosVetoXL_'+str(l),'track pos at veto'+str(l)+' no hit'+str(l)+';X [cm]; Y [cm]',1100,-55.,0.,1100,10.,65.)
951 ut.bookHist(h,nc+'PosVeto_111'+str(l),'track pos at veto AND hit'+';X [cm]; Y [cm]',110,-55.,0.,110,10.,65.)
952 ut.bookHist(h,nc+'XPosVeto_111'+str(l),'track pos at veto no hit'+';X [cm]; Y [cm]',110,-55.,0.,110,10.,65.)
953 if l == 0:
954 ut.bookHist(h,nc+'PosVeto_11','track pos at veto AND hit'+';X [cm]; Y [cm]',110,-55.,0.,110,10.,65.)
955 ut.bookHist(h,nc+'XPosVeto_11','track pos at veto no hit'+';X [cm]; Y [cm]',110,-55.,0.,110,10.,65.)
956 ut.bookHist(h,nc+'PosVeto_000','track pos at veto OR hit'+';X [cm]; Y [cm]',110,-55.,0.,110,10.,65.)
957 for x in h:
958 if isinstance(h[x], ROOT.TH2) and x.find("PosVeto")>0:
959 h[x].SetStats(0)
960
961 ut.bookHist(h,'hitVeto_0','nr hits L vs R;n sipm; n sipm',25,-0.5,24.5,25,-0.5,24.5)
962 ut.bookHist(h,'hitVeto_1','nr hits L vs R;n sipm; n sipm',25,-0.5,24.5,25,-0.5,24.5)
963 ut.bookHist(h,'hitVeto_2','nr hits T ;n sipm', 25,-0.5,24.5)
964 ut.bookHist(h,'hitVeto_01','nr hits 0 vs 1;n sipm; n sipm',25,-0.5,24.5,25,-0.5,24.5)
965 ut.bookHist(h,'hitVeto_02','nr hits 0 vs 2;n sipm; n sipm',25,-0.5,24.5,25,-0.5,24.5)
966 ut.bookHist(h,'hitVeto_12','nr hits 1 vs 2;n sipm; n sipm',25,-0.5,24.5,25,-0.5,24.5)
967 ut.bookHist(h,'scaler','all no prevEvent',25,-0.5,24.5)
968 ut.bookHist(h,'deltaT','delta T DS 2 and Scifi 1',100,-20.0,20.)
969 ut.bookHist(h,'X/Y','xy matching of scifi DS',100,-20.0,20.,100,-20.0,20.)
970

◆ Plot()

Mufi_monitoring.Veto_Efficiency.Plot (   self,
  beamOnly = False 
)

Definition at line 1235 of file Mufi_monitoring.py.

1235 def Plot(self,beamOnly=False):
1236 h = self.M.h
1237 nVetoPlanes =self.M.systemAndPlanes[1]
1238 if nVetoPlanes > 2 : hist_idx = ['0','1','2','000','1110']
1239 else: hist_idx = ['0','1','000','1110']
1240 if beamOnly: b='beam'
1241 else: b=''
1242 for c in ['','NoPrev']:
1243 allTracks = h['T'+c+'1PosVeto_0'].Clone('tmp')
1244 allTracks.Add(h['T'+c+'1XPosVeto_0'])
1245 for noiseCut in self.noiseCuts:
1246 nc = 'T'+c+str(noiseCut)+b
1247 h[nc+'XPosVeto_000']=allTracks.Clone(nc+'XPosVeto_000')
1248 h[nc+'XPosVeto_000'].Add(h[nc+'PosVeto_000'],-1)
1249 for l in hist_idx:
1250 h[nc+'Veto_ineff'+l] = h[nc+'PosVeto_'+l].Clone(nc+'Veto_ineff'+l)
1251 if l != '2': h[nc+'Veto_ineff'+l].SetTitle('Veto inefficiency '+l+' noise cut='+str(noiseCut))
1252 else: h[nc+'Veto_ineff'+l].SetTitle('Veto inefficiency '+l+' noise cut='+str(int(noiseCut/2+0.5)))
1253 h[nc+'Veto_ineff'+l].SetMinimum(0)
1254 h[nc+'Veto_ineff'+l].SetMaximum(1)
1255 for ix in range(allTracks.GetNbinsX()):
1256 for iy in range(allTracks.GetNbinsY()):
1257 for l in hist_idx:
1258 bc = allTracks.GetBinContent(ix,iy)
1259 if bc < 100:
1260 h[nc+'Veto_ineff'+l].SetBinContent(ix,iy,-1)
1261 h[nc+'Veto_ineff'+l].SetBinError(ix,iy,0)
1262 else:
1263 h[nc+'Veto_ineff'+l].SetBinContent(ix,iy,max(h[nc+'XPosVeto_'+l].GetBinContent(ix+1,iy+1)/bc, 2.7/bc))
1264 h[nc+'Veto_ineff'+l].SetBinError(ix,iy,h[nc+'XPosVeto_'+l].GetBinError(ix+1,iy+1)/bc)
1265 ut.bookCanvas(h,nc+'VetoEff','',1400,1800, nVetoPlanes, 2*nVetoPlanes)
1266 for p in range(2*nVetoPlanes**2):
1267 tc = h[nc+'VetoEff'].cd(p+1)
1268 if p < nVetoPlanes:
1269 h[nc+'PosVeto_'+str(p%nVetoPlanes)].Draw('colz')
1270 if p in range(nVetoPlanes, 2*nVetoPlanes):
1271 h[nc+'PosVeto_111'+str(p%nVetoPlanes)].Draw('colz')
1272 if p in range(2*nVetoPlanes, 3*nVetoPlanes):
1273 h[nc+'XPosVeto_'+str(p%nVetoPlanes)].Draw('colz')
1274 if p in range(3*nVetoPlanes, 4*nVetoPlanes):
1275 h[nc+'XPosVeto_111'+str(p%nVetoPlanes)].Draw('colz')
1276 tc = h[nc+'VetoEff'].cd(4*nVetoPlanes+1)
1277 h[nc+'PosVeto_000'].Draw('colz')
1278
1279 ut.bookCanvas(h,nc+'VetoInEff','',1800,1400,nVetoPlanes,2)
1280 for p in range(nVetoPlanes):
1281 tc = h[nc+'VetoInEff'].cd(p+1)
1282 tc.SetLogz(1)
1283 h[nc+'Veto_ineff'+str(p)].Draw('colz')
1284 tc = h[nc+'VetoInEff'].cd(nVetoPlanes+1)
1285 tc.SetLogz(1)
1286 h[nc+'Veto_ineff1110'].Draw('colz')
1287 tc = h[nc+'VetoInEff'].cd(nVetoPlanes+2)
1288 tc.SetLogz(1)
1289 h[nc+'Veto_ineff000'].Draw('colz')
1290# make some printout
1291 Ntot = h[nc+'PosVeto_0'].Clone('Ntot')
1292 Ntot.Add(h[nc+'XPosVeto_0'])
1293 ineff0 = h[nc+'XPosVeto_0'].GetEntries()/(Ntot.GetEntries()+1E-20)
1294 ineff1 = h[nc+'XPosVeto_1'].GetEntries()/(Ntot.GetEntries()+1E-20)
1295 ineff2, ineffAND_old, ineffOR_old = 0, 0, 0
1296 if nVetoPlanes > 2:
1297 ineff2 = h[nc+'XPosVeto_2'].GetEntries()/(Ntot.GetEntries()+1E-20)
1298 ineffOR_old = h[nc+'XPosVeto_11'].GetEntries()/(Ntot.GetEntries()+1E-20)
1299 ineffAND_old = 1.-h[nc+'PosVeto_11'].GetEntries()/(Ntot.GetEntries()+1E-20)
1300 ineffOR = h[nc+'XPosVeto_1110'].GetEntries()/(Ntot.GetEntries()+1E-20)
1301 ineffAND = 1.-h[nc+'PosVeto_1110'].GetEntries()/(Ntot.GetEntries()+1E-20)
1302 region = [21,91,34,89]
1303 xax = h[nc+'PosVeto_0'].GetXaxis()
1304 yax = h[nc+'PosVeto_0'].GetYaxis()
1305 Ntot_r = Ntot.Integral(region[0],region[1],region[2],region[3])+1E-20
1306 ineff0_r = h[nc+'XPosVeto_0'].Integral(region[0],region[1],region[2],region[3])/Ntot_r
1307 ineff1_r = h[nc+'XPosVeto_1'].Integral(region[0],region[1],region[2],region[3])/Ntot_r
1308 ineff2_r, ineffAND_old_r, ineffOR_old_r = 0, 0, 0
1309 if nVetoPlanes > 2:
1310 ineff2_r = h[nc+'XPosVeto_2'].Integral(region[0],region[1],region[2],region[3])/Ntot_r
1311 ineffOR_r_old = h[nc+'XPosVeto_11'].Integral(region[0],region[1],region[2],region[3])/Ntot_r
1312 ineffAND_r_old = 1.-h[nc+'PosVeto_11'].Integral(region[0],region[1],region[2],region[3])/Ntot_r
1313 ineffOR_r = h[nc+'XPosVeto_1110'].Integral(region[0],region[1],region[2],region[3])/Ntot_r
1314 ineffAND_r = 1.-h[nc+'PosVeto_1110'].Integral(region[0],region[1],region[2],region[3])/Ntot_r
1315 print('noise cut = ',noiseCut, 'previous event:',c)
1316 print('global inefficiency veto0: %5.2F%% veto1: %5.2F%% veto2: %5.2F%%'
1317 %(ineff0*100,ineff1*100,ineff2*100),
1318 'vetoAND: %5.2F%% vetoOR: %5.2F%% veto0AND1: %5.2F%% veto0OR1: %5.2F%%'
1319 %(ineffAND*100,ineffOR*100,ineffAND_old*100,ineffOR_old*100))
1320 print('region %5.2F < X < %5.2F and %5.2F < Y < %5.2F '%(xax.GetBinCenter(region[0]),
1321 xax.GetBinCenter(region[1]),yax.GetBinCenter(region[0]),yax.GetBinCenter(region[1])))
1322 print('veto0: %5.2F%% veto1: %5.2F%% veto2: %5.2F%%'
1323 %(ineff0_r*100,ineff1_r*100,ineff2_r*100),
1324 'vetoAND: %5.2F%% vetoOR: %5.2F%% veto0AND1: %5.2F%% veto0OR1: %5.2F%%'
1325 %(ineffAND_r*100,ineffOR_r*100,ineffAND_old*100,ineffOR_old*100))
1326#
1327 for p in range(1,nVetoPlanes):
1328 if p == 1:
1329 h['hitVeto_X'] = h['hitVeto_0'+str(p)].ProjectionX('hitVeto_X')
1330 h['hitVeto_X'].SetStats(0)
1331 h['hitVeto_X'].SetLineColor(ROOT.kOrange)
1332 h['hitVeto_X'].SetLineWidth(3)
1333 h['hitVeto_Y'+str(p)] = h['hitVeto_0'+str(p)].ProjectionY('hitVeto_Y'+str(p))
1334 h['hitVeto_Y'+str(p)].SetLineColor(ROOT.kBlue-2*p)
1335 h['hitVeto_Y'+str(p)].SetStats(0)
1336 ut.bookCanvas(h,'ThitVeto','',900,600,1,1)
1337 tc = h['ThitVeto'].cd()
1338 tc.SetLogy(1)
1339 h['hitVeto_X'].Draw('hist')
1340 for p in range(1,nVetoPlanes): h['hitVeto_Y'+str(p)].Draw('histsame')
1341
1342 #save the Veto inefficiency plots to file
1343 if self.M.options.postScale<2:
1344 self.M.presenterFile.mkdir('mufilter/VetoIneff')
1345 for item in h:
1346 if isinstance(h[item], ROOT.TCanvas) and \
1347 (item.find('Eff')>0 or item.find('ThitVeto')>0):
1348 self.M.myPrint(h[item],item,subdir='mufilter/expert/VetoIneff')

Member Data Documentation

◆ deadTime

Mufi_monitoring.Veto_Efficiency.deadTime

Definition at line 926 of file Mufi_monitoring.py.

◆ debug

Mufi_monitoring.Veto_Efficiency.debug

Definition at line 925 of file Mufi_monitoring.py.

◆ eventBefore

Mufi_monitoring.Veto_Efficiency.eventBefore

Definition at line 929 of file Mufi_monitoring.py.

◆ M

Mufi_monitoring.Veto_Efficiency.M

Definition at line 927 of file Mufi_monitoring.py.

◆ noiseCuts

Mufi_monitoring.Veto_Efficiency.noiseCuts

Definition at line 937 of file Mufi_monitoring.py.

◆ OT

Mufi_monitoring.Veto_Efficiency.OT

Definition at line 935 of file Mufi_monitoring.py.

◆ trackTask

Mufi_monitoring.Veto_Efficiency.trackTask

Definition at line 932 of file Mufi_monitoring.py.

◆ zEx

Mufi_monitoring.Veto_Efficiency.zEx

Definition at line 938 of file Mufi_monitoring.py.


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