SND@LHC Software
Loading...
Searching...
No Matches
Monitor.Monitoring Class Reference
Collaboration diagram for Monitor.Monitoring:

Public Member Functions

 __init__ (self, options, FairTasks)
 
 GetEntries (self)
 
 updateSource (self, fname)
 
 GetEvent (self, n)
 
 publishRootFile (self)
 
 purgeMonitorHistos (self)
 
 updateHtml (self)
 
 cleanUpHtml (self, destination="online")
 
 checkAlarm (self, minEntries=1000)
 
 sendAlarm (self)
 
 systemAndOrientation (self, s, plane)
 
 getAverageZpositions (self)
 
 smallSiPMchannel (self, i)
 
 Scifi_xPos (self, detID)
 
 MuFilter_PlaneBars (self, detID)
 
 map2Dict (self, aHit, T='GetAllSignals', mask=True)
 
 fit_langau (self, hist, o, bmin, bmax, opt='')
 
 twoLangaufun (self, x, par)
 
 langaufun (self, x, par)
 
 myPrint (self, tc, name, subdir='', withRootFile=True)
 
 fillHist1 (self, hname, parx)
 
 fillHist2 (self, hname, parx, pary)
 

Public Attributes

 options
 
 EventNumber
 
 TStart
 
 TEnd
 
 MonteCarlo
 
 Weight
 
 myclient
 
 snd_geo
 
 MuFilter
 
 Scifi
 
 systemAndPlanes
 
 systemAndBars
 
 systemAndChannels
 
 sdict
 
 freq
 
 TDC2ns
 
 zPos
 
 h
 
 runNr
 
 FairTasks
 
 converter
 
 fsdict
 
 hasBunchInfo
 
 eventTree
 
 trackTask
 
 Reco_MuonTracks
 
 clusMufi
 
 clusScifi
 
 run
 
 Nbunches
 
 div
 
 sink
 
 xing
 
 alarms
 

Static Public Attributes

bool notOK = True
 
int nIter = 0
 
 fiN
 
 Nkeys = self.converter.fiN.ReadKeys()
 
list listOfKeys = []
 
int first = -1
 
 nentries = eval("self.converter.fiN."+name+".GetEntries()")
 
 first
 
str wwwPath = "/eos/experiment/sndlhc/www/online"
 
 rc = os.system("xrdcp -f "+self.presenterFile.GetName()+" "+os.environ['EOSSHIP']+wwwPath)
 
 presenterFile
 
float invsq2pi = 0.3989422804014
 
float mpshift = -0.22278298
 
float np = 100.0
 
float sc = 5.0
 
float summe = 0.0
 
float mpc = par[1] - mpshift * par[0]
 
 xlow = max(0,x[0] - sc * par[3])
 
float xupp = x[0] + sc * par[3]
 
tuple step = (xupp-xlow) / np
 
float i = 1.0
 
tuple xx = xlow + (i-.5) * step
 
 fland = ROOT.TMath.Landau(xx,mpc,par[0]) / par[0]
 
float xx = xupp - (i-.5) * step
 

Detailed Description

Definition at line 66 of file Monitor.py.

Constructor & Destructor Documentation

◆ __init__()

Monitor.Monitoring.__init__ (   self,
  options,
  FairTasks 
)

Definition at line 68 of file Monitor.py.

68 def __init__(self,options,FairTasks):
69 self.options = options
70 self.EventNumber = -1
71 self.TStart = -1
72 self.TEnd = -1
73 self.MonteCarlo = False
74 self.Weight = 1
75
76 path = options.path
77 self.myclient = None
78 if path.find('eos')>0:
79 path = options.server+options.path
80 if options.online:
81 path = path.replace("raw_data","convertedData").replace("data/","")
82 self.myclient = client.FileSystem(options.server)
83# setup geometry
84 if (options.geoFile).find('../')<0: self.snd_geo = SndlhcGeo.GeoInterface(path+options.geoFile)
85 else: self.snd_geo = SndlhcGeo.GeoInterface(options.geoFile[3:])
86 self.MuFilter = self.snd_geo.modules['MuFilter']
87 self.Scifi = self.snd_geo.modules['Scifi']
88
89# MuFilter mapping of planes and bars
90 self.systemAndPlanes = {1:self.MuFilter.GetConfParI("MuFilter/NVetoPlanes"),
91 2:self.MuFilter.GetConfParI("MuFilter/NUpstreamPlanes"),
92 3:2*self.MuFilter.GetConfParI("MuFilter/NDownstreamPlanes")-1} # to arrive at 7 DS planes
93 self.systemAndBars = {1:self.MuFilter.GetConfParI("MuFilter/NVetoBars"),
94 2:self.MuFilter.GetConfParI("MuFilter/NUpstreamBars"),
95 3:self.MuFilter.GetConfParI("MuFilter/NDownstreamBars")}
96 self.systemAndChannels = {1:[self.MuFilter.GetConfParI("MuFilter/VetonSiPMs"),0],
97 2:[self.MuFilter.GetConfParI("MuFilter/UpstreamnSiPMs")-2,2],
98 3:[self.MuFilter.GetConfParI("MuFilter/DownstreamnSiPMs"),0]}
99 self.sdict = {0:'Scifi',1:'Veto',2:'US',3:'DS'}
100
101 self.freq = 160.316E6
102 self.TDC2ns = 1E9/self.freq
103
104 self.zPos = self.getAverageZpositions()
105
106 self.h = {} # histogram storage
107
108 self.runNr = str(options.runNumber).zfill(6)
109# presenter file
110 if hasattr(self, "saveTo") and options.saveTo!="":
111 name = options.saveTo+'run'+self.runNr+'_'+str(options.nStart//1000000)+'.root'
112 else:
113 name = 'run'+self.runNr+'.root'
114 if options.interactive: name = 'I-'+name
115 self.presenterFile = ROOT.TFile(name,'recreate')
116 for role in ['','shifter', 'expert']:
117 self.presenterFile.mkdir('scifi/'+role)
118 self.presenterFile.mkdir('mufilter/'+role)
119 self.presenterFile.mkdir('daq/'+role)
120 if options.interactive: self.presenterFile.mkdir('eventdisplay/'+role)
121 self.FairTasks = {}
122 for x in FairTasks: # keeps extended methods if from python class
123 self.FairTasks[x.GetName()] = x
124
125# setup input
126 if options.online:
127 import ConvRawData
128 options.chi2Max = 2000.
129 options.saturationLimit = 0.95
130 options.stop = False
131 options.withGeoFile = True
132 self.converter = ConvRawData.ConvRawDataPY()
133 self.converter.Init(options)
134 self.options.online = self.converter
135 self.fsdict = False
136 self.hasBunchInfo = False
137 self.eventTree = options.online.fSink.GetOutTree()
138 self.Nkeys = 38 # need to find a way to get this number automatically
139 if self.converter.newFormat: self.Nkeys = 1
140 for t in self.FairTasks:
141 T = self.FairTasks[t]
142 self.converter.run.AddTask(T)
143 if t=='simpleTracking':
144 T.Init(self.converter)
145 self.trackTask = self.FairTasks[t]
146 self.Reco_MuonTracks = T.fittedTracks
147 self.clusMufi = T.clusMufi
148 self.clusScifi = T.clusScifi
149 else: T.Init()
150 self.run = self.converter.run
151 if self.eventTree.EventHeader.GetAccMode()==12: # ion runs
152 self.Nbunches = 1782
153 self.div = 8
154 else: # proton runs
155 self.Nbunches = 3564
156 self.div = 4
157 return
158 else:
159 if options.fname:
160 f=ROOT.TFile.Open(options.fname)
161 eventChain = f.Get('rawConv')
162 if not eventChain:
163 eventChain = f.cbmsim
164 if eventChain.GetBranch('MCTrack'): self.MonteCarlo = True
165 partitions = []
166 else:
167 partitions = 0
168 if options.partition < 0:
169 partitions = []
170 if path.find('eos')>0:
171# check for partitions
172 dirlist = str( subprocess.check_output("xrdfs "+options.server+" ls "+options.path+"run_"+self.runNr,shell=True) )
173 for x in dirlist.split('\\n'):
174 ix = x.find('sndsw_raw-')
175 if ix<0: continue
176 partitions.append(x[ix:])
177 else:
178# check for partitions
179 dirlist = os.listdir(options.path+"run_"+self.runNr)
180 for x in dirlist:
181 if not x.find('sndsw_raw-')<0:
182 partitions.append(x)
183 else:
184 partitions = ["sndsw_raw-"+ str(options.partition).zfill(4)+".root"]
185 if options.runNumber>0:
186 eventChain = ROOT.TChain('rawConv')
187 for p in partitions:
188 eventChain.Add(path+'run_'+self.runNr+'/'+p)
189
190 rc = eventChain.GetEvent(0)
191 self.TStart = eventChain.EventHeader.GetEventTime()
192 if options.nEvents <0:
193 rc = eventChain.GetEvent(eventChain.GetEntries()-1)
194 else:
195 rc = eventChain.GetEvent(options.nEvents-1)
196 self.TEnd = eventChain.EventHeader.GetEventTime()
197 rc = eventChain.GetEvent(0)
198# start FairRunAna
199 self.run = ROOT.FairRunAna()
200 ioman = ROOT.FairRootManager.Instance()
201 ioman.SetTreeName(eventChain.GetName())
202 outFile = ROOT.TMemFile('dummy','CREATE')
203 source = ROOT.FairFileSource(eventChain.GetCurrentFile())
204 for i in range(1,len(partitions)):
205 p = partitions[i]
206 source.AddFile(path+'run_'+self.runNr+'/'+p)
207 self.run.SetSource(source)
208 self.sink = ROOT.FairRootFileSink(outFile)
209 self.run.SetSink(self.sink)
210
211 for t in FairTasks:
212 self.run.AddTask(t)
213
214#avoiding some error messages
215 xrdb = ROOT.FairRuntimeDb.instance()
216 xrdb.getContainer("FairBaseParSet").setStatic()
217 xrdb.getContainer("FairGeoParSet").setStatic()
218
219 self.run.Init()
220 if len(partitions)>0: self.eventTree = ioman.GetInChain()
221 else: self.eventTree = ioman.GetInTree()
222#fitted tracks
223 if "simpleTracking" in self.FairTasks:
224 self.trackTask = self.FairTasks["simpleTracking"]
225 self.Reco_MuonTracks = self.trackTask.fittedTracks
226 self.clusMufi = self.trackTask.clusMufi
227 self.clusScifi = self.trackTask.clusScifi
228 self.trackTask.DSnPlanes = 3
229
230# initialize detector class for access to eventheader
231 rc = eventChain.GetEvent(0)
232 if not self.MonteCarlo:
233 self.snd_geo.modules['Scifi'].InitEvent(eventChain.EventHeader)
234 self.snd_geo.modules['MuFilter'].InitEvent(eventChain.EventHeader)
235
236 # define the number of bunches in the LHC
237 if eventChain.EventHeader.GetAccMode()==12: # ion runs
238 self.Nbunches = 1782
239 self.div = 8
240 else: # proton runs
241 self.Nbunches = 3564
242 self.div = 4
243
244 # get filling scheme, only necessary if not encoded in EventHeader, before 2022 reprocessing
245 self.hasBunchInfo = False
246 self.fsdict = False
247 if hasattr(eventChain.EventHeader,"GetBunchType"):
248 if not eventChain.EventHeader.GetBunchType()<0:
249 self.hasBunchInfo = True
250 print('take bunch info from event header')
251 if not self.hasBunchInfo:
252 try:
253 fg = ROOT.TFile.Open(options.server+options.path+'FSdict.root')
254 pkl = Unpickler(fg)
255 FSdict = pkl.load('FSdict')
256 fg.Close()
257 if options.runNumber in FSdict: self.fsdict = FSdict[options.runNumber]
258 except:
259 print('continue without knowing filling scheme',options.server+options.path)
260 if self.fsdict:
261 print('extract bunch info from filling scheme')
262 if self.fsdict or self.hasBunchInfo:
263 for x in ['B1only','B2noB1','noBeam']:
264 for role in ['shifter', 'expert']:
265 self.presenterFile.mkdir('mufilter/'+role+'/'+x)
266 self.presenterFile.mkdir('scifi/'+role+'/'+x)
267

Member Function Documentation

◆ checkAlarm()

Monitor.Monitoring.checkAlarm (   self,
  minEntries = 1000 
)

Definition at line 470 of file Monitor.py.

470 def checkAlarm(self,minEntries=1000):
471 self.alarms = {'scifi':[]}
472 # check for empty histograms in scifi signal
473 entries = {}
474 for mat in range(30):
475 entries[mat] = self.h['scifi-mat_'+str(mat)].GetEntries()
476 res = sorted(entries.items(), key=operator.itemgetter(1),reverse=True)
477 if res[0][1]>minEntries: # choose limit which makes it sensitive to check for empty mats
478 for mat in range(30):
479 if entries[mat] < 1:
480 s = mat//6 + 1
481 if mat%6 < 3 : p='H'
482 else : p='V'
483 e = str(s)+p+str(mat%3)
484 self.alarms['scifi'].append(e)
485 if len(self.alarms['scifi']) > 0: self.sendAlarm()
486
487 self.alarms['Veto']=[]
488 # check for empty histograms in veto signal
489 entries = {}
490 s = 1
491 for p in range(2):
492 for side in ['L','R']:
493 entries[str(10*s+p)+side] = self.h['mufi-sig'+p+str(10*s+p)].GetEntries()
494 res = sorted(entries.items(), key=operator.itemgetter(1),reverse=True)
495 if res[0][1]>minEntries: # choose limit which makes it sensitive to check for empty boards
496 for p in range(2):
497 for side in ['L','R']:
498 if entries[str(10*s+p)+side] < 1:
499 self.alarms['Veto'].append(str(10*s+p)+side())
500 # check for empty histograms in US signal
501 entries = {}
502 s = 2
503 for p in range(5):
504 for side in ['L','R']:
505 entries[str(s*10+p)+side] = self.h['mufi-sig2'+p+str(s*10+p)].GetEntries()
506 res = sorted(entries.items(), key=operator.itemgetter(1),reverse=True)
507 if res[0][1]>1000: # choose limit which makes it sensitive to check for empty boards
508 for p in range(5):
509 for side in ['L','R']:
510 if entries[str(s*10+p)+side] < 1:
511 self.alarms['Veto'].append(str(s*10+p)+side())
512
513

◆ cleanUpHtml()

Monitor.Monitoring.cleanUpHtml (   self,
  destination = "online" 
)

Definition at line 448 of file Monitor.py.

448 def cleanUpHtml(self,destination="online"):
449 rc = os.system("xrdcp -f "+os.environ['EOSSHIP']+"/eos/experiment/sndlhc/www/"+destination+".html . ")
450 old = open(destination+".html")
451 oldL = old.readlines()
452 old.close()
453 tmp = open("tmp.html",'w')
454 dirlist = str( subprocess.check_output("xrdfs "+os.environ['EOSSHIP']+" ls /eos/experiment/sndlhc/www/"+destination+"/",shell=True) )
455 for L in oldL:
456 OK = True
457 if L.find("https://snd-lhc-monitoring.web.cern.ch/"+destination)>0:
458 k = L.find("file=")+5
459 m = L.find(".root")+5
460 R = L[k:m]
461 if not R in dirlist: OK = False
462 if OK: tmp.write(L)
463 tmp.close()
464 os.system('cp tmp.html '+destination+'.html')
465 try:
466 rc = os.system("xrdcp -f "+destination+".html "+os.environ['EOSSHIP']+"/eos/experiment/sndlhc/www/")
467 except:
468 print("copy of html failed. Token expired?")
469

◆ fillHist1()

Monitor.Monitoring.fillHist1 (   self,
  hname,
  parx 
)

Definition at line 676 of file Monitor.py.

676 def fillHist1(self,hname,parx):
677 for x in ['','B1only','B2noB1','noBeam']:
678 if x=='':
679 rc = self.h[hname].Fill(parx,self.Weight)
680 elif self.xing[x]:
681 rc = self.h[hname+x].Fill(parx,self.Weight)

◆ fillHist2()

Monitor.Monitoring.fillHist2 (   self,
  hname,
  parx,
  pary 
)

Definition at line 682 of file Monitor.py.

682 def fillHist2(self,hname,parx,pary):
683 for x in ['','B1only','B2noB1','noBeam']:
684 if x=='':
685 rc = self.h[hname].Fill(parx,pary,self.Weight)
686 elif self.xing[x]:
687 rc = self.h[hname+x].Fill(parx,pary,self.Weight)
688

◆ fit_langau()

Monitor.Monitoring.fit_langau (   self,
  hist,
  o,
  bmin,
  bmax,
  opt = '' 
)

Definition at line 587 of file Monitor.py.

587 def fit_langau(self,hist,o,bmin,bmax,opt=''):
588 if opt == 2:
589 params = {0:'Width(scale)',1:'mostProbable',2:'norm',3:'sigma',4:'N2'}
590 F = ROOT.TF1('langau',langaufun,0,200,len(params))
591 else:
592 params = {0:'Width(scale)',1:'mostProbable',2:'norm',3:'sigma'}
593 F = ROOT.TF1('langau',twoLangaufun,0,200,len(params))
594 for p in params: F.SetParName(p,params[p])
595 rc = hist.Fit('landau','S'+o,'',bmin,bmax)
596 res = rc.Get()
597 if not res: return res
598 F.SetParameter(2,res.Parameter(0))
599 F.SetParameter(1,res.Parameter(1))
600 F.SetParameter(0,res.Parameter(2))
601 F.SetParameter(3,res.Parameter(2))
602 F.SetParameter(4,0)
603 F.SetParLimits(0,0,100)
604 F.SetParLimits(1,0,100)
605 F.SetParLimits(3,0,10)
606 rc = hist.Fit(F,'S'+o,'',bmin,bmax)
607 res = rc.Get()
608 return res
609

◆ getAverageZpositions()

Monitor.Monitoring.getAverageZpositions (   self)

Definition at line 522 of file Monitor.py.

522 def getAverageZpositions(self):
523 zPos={'MuFilter':{},'Scifi':{}}
524 for s in self.systemAndPlanes:
525 for plane in range(self.systemAndPlanes[s]):
526 bar = 4
527 p = plane
528 if s==3 and (plane%2==0 or plane==7):
529 bar = 90
530 p = plane//2
531 elif s==3 and plane%2==1:
532 bar = 30
533 p = plane//2
534 self.MuFilter.GetPosition(s*10000+p*1000+bar,A,B)
535 zPos['MuFilter'][s*10+plane] = (A.Z()+B.Z())/2.
536 for s in range(1,6):
537 mat = 1
538 sipm = 1
539 channel = 64
540 for o in range(2):
541 self.Scifi.GetPosition(channel+1000*sipm+10000*mat+100000*o+1000000*s,A,B)
542 zPos['Scifi'][s*10+o] = (A.Z()+B.Z())/2.
543 return zPos
544

◆ GetEntries()

Monitor.Monitoring.GetEntries (   self)

Definition at line 268 of file Monitor.py.

268 def GetEntries(self):
269 if self.options.online:
270 if self.converter.newFormat: return self.converter.fiN.Get('data').GetEntries()
271 else: return self.converter.fiN.event.GetEntries()
272 else:
273 return self.eventTree.GetEntries()
274

◆ GetEvent()

Monitor.Monitoring.GetEvent (   self,
  n 
)

Definition at line 317 of file Monitor.py.

317 def GetEvent(self,n):
318 if not self.options.online: # offline, FairRoot in charge
319
320 if self.eventTree.GetBranchStatus('Reco_MuonTracks'):
321 for aTrack in self.eventTree.Reco_MuonTracks:
322 if aTrack: aTrack.Delete()
323 self.eventTree.Reco_MuonTracks.Delete()
324 if "simpleTracking" in self.FairTasks:
325 self.Reco_MuonTracks.Delete()
326
327 if self.options.online:
328 online = self.options.online
329 online.executeEvent(n)
330 self.Reco_MuonTracks.Delete()
331 if self.options.FairTask_convRaw:
332 self.options.online.sTree.GetEvent(self.options.online.sTree.GetEntries()-1)
333 for t in self.FairTasks: self.FairTasks[t].ExecuteTask()
334 self.eventTree = self.options.online.sTree
335 else:
336 self.eventTree.GetEvent(n)
337 if not self.MonteCarlo:
338 # initialize detector class for access to eventheader
339 self.snd_geo.modules['Scifi'].InitEvent(self.eventTree.EventHeader)
340 self.snd_geo.modules['MuFilter'].InitEvent(self.eventTree.EventHeader)
341 if self.MonteCarlo: self.Weight = self.eventTree.MCTrack[0].GetWeight()
342 for t in self.FairTasks: self.FairTasks[t].ExecuteTask()
343 self.EventNumber = n
344
345# check for bunch xing type
346 self.xing = {'all':True,'B1only':False,'B2noB1':False,'noBeam':False}
347 if self.hasBunchInfo:
348 binfo = self.eventTree.EventHeader
349 self.xing['IP1'] = binfo.isIP1()
350 self.xing['IP2'] = binfo.isIP2()
351 self.xing['B1'] = binfo.isB1()
352 self.xing['B2'] = binfo.isB2()
353 self.xing['B1only'] = binfo.isB1Only()
354 self.xing['B2noB1'] = binfo.isB2noB1()
355 self.xing['noBeam'] = binfo.isNoBeam()
356 elif self.fsdict:
357 T = self.eventTree.EventHeader.GetEventTime()
358 bunchNumber = int((T%(self.div*self.Nbunches))/self.div+0.5)
359 nb1 = (self.Nbunches + bunchNumber - self.fsdict['phaseShift1'])%self.Nbunches
360 nb2 = (self.Nbunches + bunchNumber - self.fsdict['phaseShift1']- self.fsdict['phaseShift2'])%self.Nbunches
361 b1 = nb1 in self.fsdict['B1']
362 b2 = nb2 in self.fsdict['B2']
363 IP1 = False
364 IP2 = False
365 if b1:
366 IP1 = self.fsdict['B1'][nb1]['IP1']
367 if b2:
368 IP2 = self.fsdict['B2'][nb2]['IP2']
369 self.xing['IP1'] = IP1
370 self.xing['IP2'] = IP2
371 self.xing['B1'] = b1
372 self.xing['B2'] = b2
373 self.xing['B1only'] = b1 and not IP1 and not b2
374 self.xing['B2noB1'] = b2 and not b1
375 self.xing['noBeam'] = not b1 and not b2
376 if self.xing['B1only'] and self.xing['B2noB1'] or self.xing['B1only'] and self.xing['noBeam'] : print('error with b1only assignment',self.xing)
377 if self.xing['B2noB1'] and self.xing['noBeam'] : print('error with b2nob1 assignment',self.xing)
378
379 return self.eventTree
380

◆ langaufun()

Monitor.Monitoring.langaufun (   self,
  x,
  par 
)

Definition at line 616 of file Monitor.py.

616 def langaufun(self,x,par):

◆ map2Dict()

Monitor.Monitoring.map2Dict (   self,
  aHit,
  T = 'GetAllSignals',
  mask = True 
)

Definition at line 569 of file Monitor.py.

569 def map2Dict(self,aHit,T='GetAllSignals',mask=True):
570 if T=="SumOfSignals":
571 key = Tkey
572 elif T=="GetAllSignals" or T=="GetAllTimes":
573 key = Ikey
574 else:
575 print('use case not known',T)
576 1/0
577 key.clear()
578 Value.clear()
579 if T=="GetAllTimes": ROOT.fixRootT(aHit,key,Value,mask)
580 else: ROOT.fixRoot(aHit,key,Value,mask)
581 theDict = {}
582 for k in range(key.size()):
583 if T=="SumOfSignals": theDict[key[k].Data()] = Value[k]
584 else: theDict[key[k]] = Value[k]
585 return theDict
586

◆ MuFilter_PlaneBars()

Monitor.Monitoring.MuFilter_PlaneBars (   self,
  detID 
)

Definition at line 558 of file Monitor.py.

558 def MuFilter_PlaneBars(self,detID):
559 s = detID//10000
560 l = (detID%10000)//1000 # plane number
561 bar = (detID%1000)
562 if s>2:
563 l=2*l
564 if bar>59:
565 bar=bar-60
566 if l<6: l+=1
567 return {'station':s,'plane':l,'bar':bar}
568

◆ myPrint()

Monitor.Monitoring.myPrint (   self,
  tc,
  name,
  subdir = '',
  withRootFile = True 
)

Definition at line 663 of file Monitor.py.

663 def myPrint(self,tc,name,subdir='',withRootFile=True):
664 srun = 'run'+str(self.options.runNumber)
665 if isinstance(tc, ROOT.TCanvas) :
666 tc.Update()
667 if withRootFile:
668 self.presenterFile.cd(subdir)
669 tc.Write()
670 else:
671 if not os.path.isdir(srun): os.system('mkdir '+srun)
672 pname = srun+'/'+name+'-'+srun
673 tc.Print(pname+'.png')
674 tc.Print(pname+'.pdf')
675

◆ publishRootFile()

Monitor.Monitoring.publishRootFile (   self)

Definition at line 381 of file Monitor.py.

381 def publishRootFile(self):

◆ purgeMonitorHistos()

Monitor.Monitoring.purgeMonitorHistos (   self)

Definition at line 397 of file Monitor.py.

397 def purgeMonitorHistos(self):
398 wwwPath = "/eos/experiment/sndlhc/www/online/"
399 for r in self.options.runNumbers.split(','):
400 if r!= '': runList.append(int(r))
401 for r in runList:
402 runNr = str(r).zfill(6)+'.root'
403 f = ROOT.TFile.Open(options.server+wwwPath+ runNr)
404 g = ROOT.TFile('tmp.root','recreate')
405 for d in f.GetListOfKeys():
406 D = f.Get(d.GetName())
407 D.Purge()
408 for d in f.GetListOfKeys():
409 name = d.GetName()
410 s = f.Get(name)
411 g.mkdir(name)
412 g.cd(name)
413 for x in s.GetListOfKeys():
414 s.Get(x.GetName()).Write()
415 g.Close()
416 f.Close()
417 os.system('xrdcp -f tmp.root '+self.options.server+options.path+rName)
418

◆ Scifi_xPos()

Monitor.Monitoring.Scifi_xPos (   self,
  detID 
)

Definition at line 550 of file Monitor.py.

550 def Scifi_xPos(self,detID):
551 orientation = (detID//100000)%10
552 nStation = 2*(detID//1000000-1)+orientation
553 mat = (detID%100000)//10000
554 X = detID%1000+(detID%10000)//1000*128
555 return [nStation,mat,X] # even numbers are Y (horizontal plane), odd numbers X (vertical plane)
556
557# decode MuFilter detID

◆ sendAlarm()

Monitor.Monitoring.sendAlarm (   self)

Definition at line 514 of file Monitor.py.

514 def sendAlarm(self):
515 print('ALARM',self.alarms)
516

◆ smallSiPMchannel()

Monitor.Monitoring.smallSiPMchannel (   self,
  i 
)

Definition at line 545 of file Monitor.py.

545 def smallSiPMchannel(self,i):
546 if i==2 or i==5 or i==10 or i==13: return True
547 else: return False
548
549# Scifi specific code

◆ systemAndOrientation()

Monitor.Monitoring.systemAndOrientation (   self,
  s,
  plane 
)

Definition at line 517 of file Monitor.py.

517 def systemAndOrientation(self,s,plane):
518 if s==1 or s==2: return "horizontal"
519 if plane%2==1 or plane == 6: return "vertical"
520 return "horizontal"
521

◆ twoLangaufun()

Monitor.Monitoring.twoLangaufun (   self,
  x,
  par 
)

Definition at line 610 of file Monitor.py.

610 def twoLangaufun(self,x,par):
611 N1 = self.langaufun(x,par)
612 par2 = [par[0],par[1]*2,par[4],par[3]]
613 N2 = self.langaufun(x,par2)
614 return N1+abs(N2)
615

◆ updateHtml()

Monitor.Monitoring.updateHtml (   self)

Definition at line 419 of file Monitor.py.

419 def updateHtml(self):
420 if self.options.online: destination="online"
421 elif self.options.path.find('2022')>0: destination="reprocessing"
422 else: destination="offline"
423 rc = os.system("xrdcp -f "+os.environ['EOSSHIP']+"/eos/experiment/sndlhc/www/"+destination+".html . ")
424 old = open(destination+".html")
425 oldL = old.readlines()
426 old.close()
427 tmp = open("tmp.html",'w')
428 found = False
429 for L in oldL:
430 if not L.find(self.runNr)<0: return
431 if L.find("https://snd-lhc-monitoring.web.cern.ch/"+destination+"/run.html?file=run")>0 and not found:
432 r = str(self.options.runNumber)
433 Lnew = ' <li> <a href="https://snd-lhc-monitoring.web.cern.ch/'+destination+'/run.html?file=run'
434 Lnew+= self.runNr+'.root&lastcycle">run '+r+' </a>'+self.options.startTime
435 if self.options.postScale>1: Lnew+=" post scaled:"+str(self.options.postScale)
436 Lnew+='\n'
437 tmp.write(Lnew)
438 found = True
439 tmp.write(L)
440 tmp.close()
441 os.system('cp '+destination+'.html '+destination+time.ctime().replace(' ','')+'.html ') # make backup
442 os.system('cp tmp.html '+destination+'.html')
443 try:
444 rc = os.system("xrdcp -f "+destination+".html "+os.environ['EOSSHIP']+"/eos/experiment/sndlhc/www/")
445 except:
446 print("copy of html failed. Token expired?")
447

◆ updateSource()

Monitor.Monitoring.updateSource (   self,
  fname 
)

Definition at line 275 of file Monitor.py.

275 def updateSource(self,fname):

Member Data Documentation

◆ alarms

Monitor.Monitoring.alarms

Definition at line 471 of file Monitor.py.

◆ clusMufi

Monitor.Monitoring.clusMufi

Definition at line 147 of file Monitor.py.

◆ clusScifi

Monitor.Monitoring.clusScifi

Definition at line 148 of file Monitor.py.

◆ converter

Monitor.Monitoring.converter

Definition at line 132 of file Monitor.py.

◆ div

Monitor.Monitoring.div

Definition at line 153 of file Monitor.py.

◆ EventNumber

Monitor.Monitoring.EventNumber

Definition at line 70 of file Monitor.py.

◆ eventTree

Monitor.Monitoring.eventTree

Definition at line 137 of file Monitor.py.

◆ FairTasks

Monitor.Monitoring.FairTasks

Definition at line 121 of file Monitor.py.

◆ fiN

Monitor.Monitoring.fiN
static

Definition at line 286 of file Monitor.py.

◆ first [1/2]

int Monitor.Monitoring.first = -1
static

Definition at line 301 of file Monitor.py.

◆ first [2/2]

Monitor.Monitoring.first
static

Definition at line 304 of file Monitor.py.

◆ fland

Monitor.Monitoring.fland = ROOT.TMath.Landau(xx,mpc,par[0]) / par[0]
static

Definition at line 654 of file Monitor.py.

◆ freq

Monitor.Monitoring.freq

Definition at line 101 of file Monitor.py.

◆ fsdict

Monitor.Monitoring.fsdict

Definition at line 135 of file Monitor.py.

◆ h

Monitor.Monitoring.h

Definition at line 106 of file Monitor.py.

◆ hasBunchInfo

Monitor.Monitoring.hasBunchInfo

Definition at line 136 of file Monitor.py.

◆ i

float Monitor.Monitoring.i = 1.0
static

Definition at line 649 of file Monitor.py.

◆ invsq2pi

float Monitor.Monitoring.invsq2pi = 0.3989422804014
static

Definition at line 629 of file Monitor.py.

◆ listOfKeys

list Monitor.Monitoring.listOfKeys = []
static

Definition at line 296 of file Monitor.py.

◆ MonteCarlo

Monitor.Monitoring.MonteCarlo

Definition at line 73 of file Monitor.py.

◆ mpc

float Monitor.Monitoring.mpc = par[1] - mpshift * par[0]
static

Definition at line 640 of file Monitor.py.

◆ mpshift

float Monitor.Monitoring.mpshift = -0.22278298
static

Definition at line 630 of file Monitor.py.

◆ MuFilter

Monitor.Monitoring.MuFilter

Definition at line 86 of file Monitor.py.

◆ myclient

Monitor.Monitoring.myclient

Definition at line 77 of file Monitor.py.

◆ Nbunches

Monitor.Monitoring.Nbunches

Definition at line 152 of file Monitor.py.

◆ nentries

Monitor.Monitoring.nentries = eval("self.converter.fiN."+name+".GetEntries()")
static

Definition at line 303 of file Monitor.py.

◆ nIter

int Monitor.Monitoring.nIter = 0
static

Definition at line 278 of file Monitor.py.

◆ Nkeys

Monitor.Monitoring.Nkeys = self.converter.fiN.ReadKeys()
static

Definition at line 289 of file Monitor.py.

◆ notOK

bool Monitor.Monitoring.notOK = True
static

Definition at line 277 of file Monitor.py.

◆ np

float Monitor.Monitoring.np = 100.0
static

Definition at line 633 of file Monitor.py.

◆ options

Monitor.Monitoring.options

Definition at line 69 of file Monitor.py.

◆ presenterFile

Monitor.Monitoring.presenterFile
static

Definition at line 395 of file Monitor.py.

◆ rc

Monitor.Monitoring.rc = os.system("xrdcp -f "+self.presenterFile.GetName()+" "+os.environ['EOSSHIP']+wwwPath)
static

Definition at line 392 of file Monitor.py.

◆ Reco_MuonTracks

Monitor.Monitoring.Reco_MuonTracks

Definition at line 146 of file Monitor.py.

◆ run

Monitor.Monitoring.run

Definition at line 150 of file Monitor.py.

◆ runNr

Monitor.Monitoring.runNr

Definition at line 108 of file Monitor.py.

◆ sc

float Monitor.Monitoring.sc = 5.0
static

Definition at line 634 of file Monitor.py.

◆ Scifi

Monitor.Monitoring.Scifi

Definition at line 87 of file Monitor.py.

◆ sdict

Monitor.Monitoring.sdict

Definition at line 99 of file Monitor.py.

◆ sink

Monitor.Monitoring.sink

Definition at line 208 of file Monitor.py.

◆ snd_geo

Monitor.Monitoring.snd_geo

Definition at line 84 of file Monitor.py.

◆ step

tuple Monitor.Monitoring.step = (xupp-xlow) / np
static

Definition at line 646 of file Monitor.py.

◆ summe

float Monitor.Monitoring.summe = 0.0
static

Definition at line 637 of file Monitor.py.

◆ systemAndBars

Monitor.Monitoring.systemAndBars

Definition at line 93 of file Monitor.py.

◆ systemAndChannels

Monitor.Monitoring.systemAndChannels

Definition at line 96 of file Monitor.py.

◆ systemAndPlanes

Monitor.Monitoring.systemAndPlanes

Definition at line 90 of file Monitor.py.

◆ TDC2ns

Monitor.Monitoring.TDC2ns

Definition at line 102 of file Monitor.py.

◆ TEnd

Monitor.Monitoring.TEnd

Definition at line 72 of file Monitor.py.

◆ trackTask

Monitor.Monitoring.trackTask

Definition at line 145 of file Monitor.py.

◆ TStart

Monitor.Monitoring.TStart

Definition at line 71 of file Monitor.py.

◆ Weight

Monitor.Monitoring.Weight

Definition at line 74 of file Monitor.py.

◆ wwwPath

str Monitor.Monitoring.wwwPath = "/eos/experiment/sndlhc/www/online"
static

Definition at line 385 of file Monitor.py.

◆ xing

Monitor.Monitoring.xing

Definition at line 346 of file Monitor.py.

◆ xlow

Monitor.Monitoring.xlow = max(0,x[0] - sc * par[3])
static

Definition at line 643 of file Monitor.py.

◆ xupp

float Monitor.Monitoring.xupp = x[0] + sc * par[3]
static

Definition at line 644 of file Monitor.py.

◆ xx [1/2]

tuple Monitor.Monitoring.xx = xlow + (i-.5) * step
static

Definition at line 653 of file Monitor.py.

◆ xx [2/2]

float Monitor.Monitoring.xx = xupp - (i-.5) * step
static

Definition at line 657 of file Monitor.py.

◆ zPos

Monitor.Monitoring.zPos

Definition at line 104 of file Monitor.py.


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