14 " raw data conversion by event "
20 if (options.path.find(
'eos')<0
and options.server.find(
'root://')<0
and not options.online)
or os.path.isdir(options.path): local =
True
23 server = options.server
24 from XRootD
import client
26 if options.runNumber>0:
27 runNr = str(options.runNumber).zfill(6)
28 path = options.path+
'run_'+ runNr+
'/'
29 if options.partition < 0:
33 part = str(options.partition).zfill(4)
34 inFile =
'data_'+part+
'.root'
35 self.
outFile =
"sndsw_raw_"+runNr+
'-'+part+
'.root'
37 server = options.server
38 runNr = str( abs(options.runNumber) ).zfill(6)
39 path = options.path+
'run_'+ runNr+
'/'
40 inFile =
'data_'+part+
'.root'
41 self.
outFile = ROOT.TMemFile(
'monitorRawData',
'recreate')
46 if options.path.find(
'2022')!=-1: fpath =
"/eos/experiment/sndlhc/convertedData/physics/2022/"
47 elif options.path.find(
'2023')!=-1: fpath =
"/eos/experiment/sndlhc/convertedData/physics/2023/"
48 elif options.path.find(
'2024')!=-1: fpath =
"/eos/experiment/sndlhc/convertedData/physics/2024/"
49 else: fpath =
"/eos/experiment/sndlhc/convertedData/commissioning/TI18/"
50 fg = ROOT.TFile.Open(options.server+fpath+
"/FSdict.root")
52 FSdict = pkl.load(
'FSdict')
54 if options.runNumber
in FSdict:
55 if 'B1' in FSdict[options.runNumber]: self.
fsdict = FSdict[options.runNumber]
57 print(
'continue without knowing filling scheme',options.server+options.path)
65 if self.
fsdict[
'phaseShift2'] == 0
or self.
fsdict[
'phaseShift2'] == 1718:
68 for bunchNumber
in range (0, Nbunches):
69 nb1 = (Nbunches + bunchNumber - self.
fsdict[
'phaseShift1'])%Nbunches
70 nb2 = (Nbunches + bunchNumber - self.
fsdict[
'phaseShift1']- self.
fsdict[
'phaseShift2'])%Nbunches
71 b1 = nb1
in self.
fsdict[
'B1']
72 b2 = nb2
in self.
fsdict[
'B2']
76 IP1 = self.
fsdict[
'B1'][nb1][
'IP1']
78 IP2 = self.
fsdict[
'B2'][nb2][
'IP2']
79 self.
FSmap.Add(ROOT.TObjString(str(bunchNumber)), ROOT.TObjString(str(int(IP2))+str(int(IP1))+str(int(b2))+str(int(b1))))
80 else: self.
FSmap.Add(ROOT.TObjString(
"0"), ROOT.TObjString(
"-1"))
82 self.
run = ROOT.FairRunAna()
83 self.
ioman = ROOT.FairRootManager.Instance()
87 mpath = options.path+options.monitorTag+
'run_'+ runNr+
'/'
88 self.
fiN=ROOT.TFile.Open(server+mpath+inFile)
90 self.
fiN=ROOT.TFile.Open(server+path+inFile)
96 if options.nEvents<0: self.
nEvents = self.
fiN.data.GetEntries()
97 else: self.
nEvents = min(options.nEvents,self.
fiN.data.GetEntries())
99 if options.nEvents<0: self.
nEvents = self.
fiN.event.GetEntries()
100 else: self.
nEvents = min(options.nEvents,self.
fiN.event.GetEntries())
101 print(
'converting ',self.
nEvents,
' events ',
' of run',options.runNumber)
103 ioman.RegisterInputObject(
'runN', ROOT.TObjString(str(options.runNumber)))
104 ioman.RegisterInputObject(
'pathCalib', ROOT.TObjString(server+path))
105 ioman.RegisterInputObject(
'pathJSON', ROOT.TObjString(server+path))
106 ioman.RegisterInputObject(
'nEvents', ROOT.TObjString(str(self.
nEvents)))
107 ioman.RegisterInputObject(
'nStart', ROOT.TObjString(str(options.nStart)))
108 ioman.RegisterInputObject(
'debug', ROOT.TObjString(str(options.debug)))
109 ioman.RegisterInputObject(
'stop', ROOT.TObjString(str(options.stop)))
110 ioman.RegisterInputObject(
'heartBeat', ROOT.TObjString(str(options.heartBeat)))
111 ioman.RegisterInputObject(
'makeCalibration', ROOT.TObjString(str(int(options.makeCalibration))))
112 ioman.RegisterInputObject(
'chi2Max', ROOT.TObjString(str(options.chi2Max)))
113 ioman.RegisterInputObject(
'saturationLimit', ROOT.TObjString(str(options.saturationLimit)))
114 ioman.RegisterInputObject(
'local', ROOT.TObjString(str(int(local))))
115 ioman.RegisterInputObject(
'newFormat', ROOT.TObjString(str(int(self.
newFormat))))
116 ioman.RegisterInputObject(
'FSmap', self.
FSmap)
120 logger = ROOT.FairLogger.GetLogger()
121 logger.SetColoredLog(
True)
122 logger.SetLogVerbosityLevel(
'low')
123 logger.SetLogScreenLevel(
'error')
124 logger.SetLogToScreen(
True)
126 logger.SetLogToFile(
True)
127 logger.SetLogFileName(
'run_'+str(options.runNumber)+
'-'+part+
'_CPP.log')
128 logger.SetLogFileLevel(
'info')
129 logger.SetLogScreenLevel(
'info')
132 ioman.RegisterInputObject(
"rawData", self.
fiN)
136 elif options.FairTask_convRaw: self.
outfile = ROOT.FairRootFileSink(self.
outFile.replace(
'.root',
'_CPP.root'))
141 self.
run.SetEventHeaderPersistence(
False)
142 self.
xrdb = ROOT.FairRuntimeDb.instance()
143 self.
xrdb.getContainer(
"FairBaseParSet").setStatic()
144 self.
xrdb.getContainer(
"FairGeoParSet").setStatic()
146 if options.FairTask_convRaw:
147 self.
run.AddTask(ROOT.ConvRawData())
155 if options.makeCalibration:
157 fqdc_cal = open(path+
'/qdc_cal.csv')
158 Lqdc = fqdc_cal.readlines()
159 ftdc_cal = open(path+
'/tdc_cal.csv')
160 Ltdc = ftdc_cal.readlines()
162 with client.File()
as f:
163 f.open(server+path+
"/qdc_cal.csv")
165 Lqdc = L.decode().split(
'\n')
167 f.open(server+path+
"/tdc_cal.csv")
169 Ltdc = L.decode().split(
'\n')
175 for l
in range(1,len(L)):
176 tmp = L[l].replace(
'\n',
'').split(
',')
177 if len(tmp)<10:
continue
178 board_id = int(tmp[0])
179 if not board_id
in qdc_cal: qdc_cal[board_id]={}
181 if not fe_id
in qdc_cal[board_id]: qdc_cal[board_id][fe_id]={}
182 channel = int(tmp[2])
183 if not channel
in qdc_cal[board_id][fe_id]: qdc_cal[board_id][fe_id][channel]={}
185 if not tac
in qdc_cal[board_id][fe_id][channel]: qdc_cal[board_id][fe_id][channel][tac]={}
186 X = qdc_cal[board_id][fe_id][channel][tac]
191 X[
'e']=float(tmp[10])
192 if float(tmp[9]) < 2: X[
'chi2Ndof'] = 999999.
193 else: X[
'chi2Ndof']=float(tmp[7])/float(tmp[9])
196 for l
in range(1,len(L)):
197 tmp = L[l].replace(
'\n',
'').split(
',')
198 if len(tmp)<9:
continue
199 board_id = int(tmp[0])
200 if not board_id
in qdc_cal: qdc_cal[board_id]={}
202 if not fe_id
in qdc_cal[board_id]: qdc_cal[board_id][fe_id]={}
203 channel = int(tmp[2])
204 if not channel
in qdc_cal[board_id][fe_id]: qdc_cal[board_id][fe_id][channel]={}
206 if not tac
in qdc_cal[board_id][fe_id][channel]: qdc_cal[board_id][fe_id][channel][tac]={}
208 if not tdc
in qdc_cal[board_id][fe_id][channel][tac]: qdc_cal[board_id][fe_id][channel][tac][tdc]={}
209 X = qdc_cal[board_id][fe_id][channel][tac][tdc]
214 if float(tmp[10]) < 2: X[
'chi2Ndof'] = 999999.
215 else: X[
'chi2Ndof']=float(tmp[8])/float(tmp[10])
220 key = {
'DS':2,
'US':1,
'Veto':0}
221 sndswPath = os.environ[
'SNDSW_ROOT']
223 infile = sndswPath+
"/geometry/"+system+
"_SiPM_mapping.csv"
225 if os.path.isdir(sndswPath+
"/geometry"):
226 with open(infile,
"r")
as f:
227 reader = csv.DictReader(f, delimiter=
',')
228 for i, row
in enumerate(reader):
229 SiPMmap[system][int(row[
'SiPM'])] = [int(row[
'CN']), int(row[
'pin']), int(row[
'TOFPET']), int(row[
'CHANNEL'])]
231 for channel
in SiPMmap[system]:
232 row = SiPMmap[system][channel]
233 self.
TofpetMap[key[system]][row[2]*1000+row[3]] = channel
235 with open(path+
'board_mapping.json')
as f:
238 with client.File()
as f:
239 f.open(server+path+
"/board_mapping.json")
240 status, jsonStr = f.read()
244 self.
slots = {0:
'A',1:
'A',2:
'B',3:
'B',4:
'C',5:
'C',6:
'D',7:
'D'}
248 board_id = int(b.split(
'_')[1])
251 for slot
in self.
slots:
253 tmp = self.
boardMaps[
'MuFilter'][b][x].split(
'_')[0]
255 elif tmp==
'DS': s = 2
261 for o
in [
'Left',
'Right']:
262 self.
offMap[
'Veto_'+str(s)+o] =[10000 + (s-1)*1000+ 0,8,2]
263 self.
offMap[
'Veto_3Vert'] = [10000 + 2*1000+ 6,-8,1]
265 for o
in [
'Left',
'Right']:
266 self.
offMap[
'US_'+str(s)+o] =[20000 + (s-1)*1000+ 9,-8,2]
269 self.
offMap[
'DS_'+str(s)+o] =[30000 + (s-1)*1000+ 119, -1,1]
271 for o
in [
'Left',
'Right']:
272 self.
offMap[
'DS_'+str(s)+o] =[30000 + (s-1)*1000+ 59,-1,2]
275 for b
in self.
fiN.GetListOfKeys():
277 if name.find(
'board')!=0:
continue
281 self.
sTree = ROOT.TTree(
'rawConv',
'raw data converted')
282 ROOT.gDirectory.pwd()
293 B.SetName(
'BranchList')
294 B.Add(ROOT.TObjString(
'sndScifiHit'))
295 B.Add(ROOT.TObjString(
'MuFilterHit'))
296 B.Add(ROOT.TObjString(
'SNDLHCEventHeader'))
297 self.
fSink.WriteObject(B,
"BranchList", ROOT.TObject.kSingleKey)
298 self.
fSink.SetRunId(options.runNumber)
305 def channel(self,tofpet_id,tofpet_channel,position):
306 return (64 * tofpet_id + 63 - tofpet_channel + 512*position)
310 def qdc_chi2(self,board_id,tofpet_id,channel,tac,TDC=0):
312 par = qdc_cal[board_id][tofpet_id][channel][tac]
313 parT = qdc_cal[board_id][tofpet_id][channel][tac][TDC]
314 return max(par[
'chi2Ndof'],parT[
'chi2Ndof'])
316 def qdc_sat(self,board_id,tofpet_id,channel,tac,v_fine):
318 par = qdc_cal[board_id][tofpet_id][channel][tac]
319 return v_fine/par[
'd']
321 def comb_calibration(self,board_id,tofpet_id,channel,tac,v_coarse,v_fine,t_coarse,t_fine,GQDC = 1.0, TDC=0):
323 par = qdc_cal[board_id][tofpet_id][channel][tac]
326 ftdc = (-parT[
'b']-ROOT.TMath.Sqrt(parT[
'b']**2-4*parT[
'a']*(parT[
'c']-x)))/(2*parT[
'a'])
327 timestamp = t_coarse + ftdc
328 tf = timestamp - t_coarse
330 fqdc = -par[
'c']*ROOT.TMath.Log(1+ROOT.TMath.Exp( par[
'a']*(x-par[
'e'])**2-par[
'b']*(x-par[
'e']) )) + par[
'd']
331 value = (v_fine-fqdc)/GQDC
332 return timestamp,value,max(par[
'chi2Ndof'],parT[
'chi2Ndof']),v_fine/par[
'd']
340 for c
in qdc_cal[b][t]:
341 for tac
in qdc_cal[b][t][c]:
342 par = qdc_cal[b][t][c][tac]
343 if 'chi2Ndof' in par: chi2 = par[
'chi2Ndof']
345 parT = qdc_cal[b][t][c][tac][TDC]
346 if 'chi2Ndof' in parT: chi2T = parT[
'chi2Ndof']
348 key = tac +10*c + t*10*100 + b*10*100*100
349 if not key
in report: report[key]=[chi2,chi2T]
353 key = (tofpet_id%2)*1000 + tofpet_channel
354 tmp = boardMaps[
'MuFilter'][board][self.
slots[tofpet_id]]
355 sipmChannel = TofpetMap[system][key]-1
356 nSiPMs = abs(offMap[tmp][1])
357 nSides = abs(offMap[tmp][2])
358 direction = int(offMap[tmp][1]/nSiPMs)
359 detID = offMap[tmp][0] + direction*(sipmChannel//(nSiPMs))
360 sipm_number = sipmChannel%(nSiPMs)
361 print(sipmChannel,nSiPMs,nSides,detID,sipm_number)
364 runNr = str( abs(self.
options.runNumber) ).zfill(6)
365 path = self.
options.path+
'run_'+ runNr+
'/'
366 from XRootD
import client
367 with client.File()
as f:
368 f.open(self.
options.server+path+
"/channels.csv")
375 filename =
"currently_processed_file.txt"
377 from XRootD
import client
378 with client.File()
as f:
379 f.open(self.
options.server+path+filename)
383 for l
in self.
Lcrun: print(l)
386 runNr = str( abs(self.
options.runNumber) ).zfill(6)
387 path = self.
options.path+
'run_'+ runNr+
'/'
388 jname =
"run_timestamps.json"
389 from XRootD
import client
390 with client.File()
as f:
391 f.open(self.
options.server+path+jname)
392 status, jsonStr = f.read()
394 date = json.loads(jsonStr)
395 time_str = date[
'start_time'].replace(
'Z',
'')
396 time_obj = time.strptime(time_str,
'%Y-%m-%dT%H:%M:%S')
397 startTimeOfRun = calendar.timegm(time_obj)
398 return startTimeOfRun
410 if self.
options.FairTask_convRaw:
421 if self.
options.FairTask_convRaw:
424 self.
run.GetTask(
"ConvRawData").UpdateInput(eventNumber)
426 Fout = self.
outfile.GetRootFile()
427 self.
sTree = Fout.Get(
'cbmsim')
430 print(
'run ',self.
options.runNumber,
' event',eventNumber,
" ",time.ctime())
432 event = self.
fiN.data
433 event.GetEvent(eventNumber)
434 self.
header.SetEventTime(event.evt_timestamp)
435 self.
header.SetUTCtimestamp(int(event.evt_timestamp*6.23768*1e-9 + self.
run_startUTC))
436 self.
header.SetEventNumber(event.evt_number)
437 self.
header.SetFlags(event.evt_flags)
439 if self.
FSmap.GetEntries()>1:
440 if self.
header.GetAccMode()== 12:
441 self.
header.SetBunchType(int(str(self.
FSmap.GetValue(str(int((event.evt_timestamp%(4*3564))/8))))))
443 self.
header.SetBunchType(int(str(self.
FSmap.GetValue(str(int((event.evt_timestamp%(4*3564))/4))))))
445 self.
header.SetBunchType(int(str(self.
FSmap.GetValue(
"0"))))
452 digiMuFilterStore = {}
454 for n
in range(event.n_hits):
455 board_id = event.boardId[n]
456 board =
'board_'+str(board_id)
459 station,mat = self.
boardMaps[
'Scifi'][board]
460 elif board
in self.
boardMaps[
'MuFilter']:
463 print(board+
' not known. Serious error, stop')
466 tofpet_id = event.tofpetId[n]
467 tofpet_channel = event.tofpetChannel[n]
468 if self.
options.makeCalibration:
471 print(scifi,board_id,tofpet_id,tofpet_channel,tac,event.tCoarse[n],event.tFine[n],event.vCoarse[n],event.vFine[n])
472 TDC,QDC,Chi2ndof,satur = self.
comb_calibration(board_id,tofpet_id,tofpet_channel,tac,event.vCoarse[n],event.vFine[n],event.tCoarse[n],event.tFine[n])
474 TDC = event.timestamp[n]
476 QDCchi2N = event.valueCalChi2[n]/event.valueCalDof[n]
477 TDCchi2N = event.timestampCalChi2[n]/event.timestampCalDof[n]
478 Chi2ndof = max( QDCchi2N,TDCchi2N )
479 satur = event.value_saturation[n]
480 if Chi2ndof > self.
options.chi2Max:
481 if QDC>1E20: QDC = 997.
482 if QDC != QDC: QDC = 998.
485 elif satur > self.
options.saturationLimit
or QDC>1E20
or QDC != QDC:
486 if QDC>1E20: QDC = 987.
488 print(
'inf',board_id,tofpet_id,tofpet_channel,event.tac[n],event.vCoarse[n],event.vFine[n],TDC-event.tCoarse[n],eventNumber,Chi2ndof)
489 if QDC != QDC: QDC = 988.
491 print(
'nan',board_id,tofpet_id,tofpet_channel,event.tac[n],event.vCoarse[n],event.vFine[n],TDC-event.tCoarse[n],eventNumber,Chi2ndof)
492 A = int(min( QDC,1000))
493 B = min(satur,999)/1000.
496 elif Chi2ndof > self.
options.chi2Max:
500 print(
'calibrated: tdc = ',TDC,
' qdc = ',QDC)
505 key = (tofpet_id%2)*1000 + tofpet_channel
507 if self.
options.debug
or not tmp.find(
'not')<0: print(
'debug',tmp,system,key,board,tofpet_id,tofpet_id%2,tofpet_channel)
510 print(
'key does not exist',key)
511 print(system, key,board,tofpet_id, self.
TofpetMap[system])
513 sipmChannel = self.
TofpetMap[system][key]-1
516 direction = int(self.
offMap[tmp][1]/nSiPMs)
517 detID = self.
offMap[tmp][0] + direction*(sipmChannel//(nSiPMs))
518 sipm_number = sipmChannel%(nSiPMs)
519 if tmp.find(
'Right')>0:
520 sipm_number += nSiPMs
521 if not detID
in digiMuFilterStore:
522 digiMuFilterStore[detID] = ROOT.MuFilterHit(detID,nSiPMs,nSides)
523 test = digiMuFilterStore[detID].GetSignal(sipm_number)
524 digiMuFilterStore[detID].SetDigi(QDC,TDC,sipm_number)
525 digiMuFilterStore[detID].SetDaqID(sipm_number,n,board_id, tofpet_id, tofpet_channel)
526 if mask: digiMuFilterStore[detID].SetMasked(sipm_number)
529 print(
'create mu hit: ',detID,tmp,system,tofpet_id,self.
offMap[tmp],sipmChannel,nSiPMs,nSides,test)
530 print(
' ',detID,sipm_number,QDC,TDC)
531 if test>0
or detID%1000>200
or sipm_number>15:
532 print(
'what goes wrong?',detID,sipm_number,system,key,board,tofpet_id,tofpet_channel,test)
538 if station[2]==
"Y": orientation = 0
539 sipmLocal = (chan - mat*512)
540 sipmID = 1000000*int(station[1]) + 100000*orientation + 10000*mat + 1000*(sipmLocal//128) + chan%128
541 if not sipmID
in digiSciFiStore:
542 digiSciFiStore[sipmID] = ROOT.sndScifiHit(sipmID)
543 digiSciFiStore[sipmID].SetDigi(QDC,TDC)
544 digiSciFiStore[sipmID].SetDaqID(0,n, board_id, tofpet_id, tofpet_channel)
545 if mask: digiSciFiStore[sipmID].setInvalid()
547 print(
'create scifi hit: tdc = ',board,sipmID,QDC,TDC)
548 print(
'tofpet:', tofpet_id,tofpet_channel,mat,chan)
549 print(station[1],station[2],mat,chan,int(chan/128)%4,chan%128)
552 for sipmID
in digiSciFiStore:
554 self.
digiSciFi[indexSciFi]=digiSciFiStore[sipmID]
556 for detID
in digiMuFilterStore:
558 self.
digiMuFilter[indexMuFilter]=digiMuFilterStore[detID]
561 if self.
options.FairTask_convRaw:
564 self.
run.GetTask(
"ConvRawData").UpdateInput(eventNumber)
566 Fout = self.
outfile.GetRootFile()
567 self.
sTree = Fout.Get(
'cbmsim')
570 print(
'run ',self.
options.runNumber,
' event',eventNumber,
" ",time.ctime())
571 event = self.
fiN.event
572 rc = event.GetEvent(eventNumber)
573 self.
header.SetEventTime(event.timestamp)
582 digiMuFilterStore = {}
585 board_id = int(board.split(
'_')[1])
588 station,mat = self.
boardMaps[
'Scifi'][board]
589 elif board
in self.
boardMaps[
'MuFilter']:
592 print(board+
' not known. Serious error, stop')
595 rc = bt.GetEvent(eventNumber)
596 for n
in range(bt.n_hits):
598 tofpet_id = bt.tofpet_id[n]
599 tofpet_channel = bt.tofpet_channel[n]
600 if self.
options.makeCalibration:
602 print(scifi,board_id,bt.tofpet_id[n],bt.tofpet_channel[n],bt.tac[n],bt.t_coarse[n],bt.t_fine[n],bt.v_coarse[n],bt.v_fine[n])
604 TDC,QDC,Chi2ndof,satur = self.
comb_calibration(board_id,tofpet_id,tofpet_channel,tac,bt.v_coarse[n],bt.v_fine[n],bt.t_coarse[n],bt.t_fine[n])
606 TDC = bt.timestamp[n]
610 if Chi2ndof > self.
options.chi2Max:
611 if QDC>1E20: QDC = 997.
612 if QDC != QDC: QDC = 998.
615 elif satur > self.
options.saturationLimit
or QDC>1E20
or QDC != QDC:
616 if QDC>1E20: QDC = 987.
618 print(
'inf',board_id,bt.tofpet_id[n],bt.tofpet_channel[n],bt.tac[n],bt.v_coarse[n],bt.v_fine[n],TDC-bt.t_coarse[n],eventNumber,Chi2ndof)
619 if QDC != QDC: QDC = 988.
621 print(
'nan',board_id,bt.tofpet_id[n],bt.tofpet_channel[n],bt.tac[n],bt.v_coarse[n],bt.v_fine[n],\
622 TDC-bt.t_coarse[n],TDC,bt.t_coarse[n],eventNumber,Chi2ndof)
623 A = int(min( QDC,1000))
624 B = min(satur,999)/1000.
627 elif Chi2ndof > self.
options.chi2Max:
631 print(
'calibrated: tdc = ',TDC,
' qdc = ',QDC)
636 key = (tofpet_id%2)*1000 + tofpet_channel
638 if self.
options.debug
or not tmp.find(
'not')<0: print(
'debug',tmp,system,key,board,tofpet_id,tofpet_id%2,tofpet_channel)
641 print(
'key does not exist',key)
642 print(system, key,board,tofpet_id, self.
TofpetMap[system])
644 sipmChannel = self.
TofpetMap[system][key]-1
645 nSiPMs = abs(self.
offMap[tmp][1])
646 nSides = abs(self.
offMap[tmp][2])
647 direction = int(self.
offMap[tmp][1]/nSiPMs)
648 detID = self.
offMap[tmp][0] + direction*(sipmChannel//(nSiPMs))
649 sipm_number = sipmChannel%(nSiPMs)
650 if tmp.find(
'Right')>0:
651 sipm_number += nSiPMs
652 if not detID
in digiMuFilterStore:
653 digiMuFilterStore[detID] = ROOT.MuFilterHit(detID,nSiPMs,nSides)
654 test = digiMuFilterStore[detID].GetSignal(sipm_number)
655 digiMuFilterStore[detID].SetDigi(QDC,TDC,sipm_number)
656 digiMuFilterStore[detID].SetDaqID(sipm_number, board_id, tofpet_id, tofpet_channel)
657 if mask: digiMuFilterStore[detID].SetMasked(sipm_number)
660 print(
'create mu hit: ',detID,tmp,system,tofpet_id,self.
offMap[tmp],sipmChannel,nSiPMs,nSides,test)
661 print(
' ',detID,sipm_number,QDC,TDC)
662 if test>0
or detID%1000>200
or sipm_number>15:
663 print(
'what goes wrong?',detID,sipm_number,system,key,board,tofpet_id,tofpet_channel,test)
669 if station[2]==
"Y": orientation = 0
670 sipmLocal = (chan - mat*512)
671 sipmID = 1000000*int(station[1]) + 100000*orientation + 10000*mat + 1000*(sipmLocal//128) + chan%128
672 if not sipmID
in digiSciFiStore:
673 digiSciFiStore[sipmID] = ROOT.sndScifiHit(sipmID)
674 digiSciFiStore[sipmID].SetDigi(QDC,TDC)
675 digiSciFiStore[sipmID].SetDaqID(0, board_id, tofpet_id, tofpet_channel)
676 if mask: digiSciFiStore[sipmID].setInvalid()
678 print(
'create scifi hit: tdc = ',board,sipmID,QDC,TDC)
679 print(
'tofpet:', tofpet_id,tofpet_channel,mat,chan)
680 print(station[1],station[2],mat,chan,int(chan/128)%4,chan%128)
683 for sipmID
in digiSciFiStore:
685 self.
digiSciFi[indexSciFi]=digiSciFiStore[sipmID]
687 for detID
in digiMuFilterStore:
689 self.
digiMuFilter[indexMuFilter]=digiMuFilterStore[detID]
694 if self.
options.FairTask_convRaw:
704 print(
'number of events processed',self.
sTree.GetEntries(),self.
fiN.event.GetEntries())
708 print(
"File closed ",self.
fiN.GetName())