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

Public Member Functions

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

Public Attributes

 M
 
 OT
 
 xing
 
 mat_label
 
 nScifi
 
 nMats
 
 nMatsAll
 

Detailed Description

Definition at line 12 of file Scifi_monitoring.py.

Member Function Documentation

◆ ExecuteEvent()

Scifi_monitoring.Scifi_hitMaps.ExecuteEvent (   self,
  event 
)

Definition at line 40 of file Scifi_monitoring.py.

40 def ExecuteEvent(self,event):
41 h = self.M.h
42 W = self.M.Weight
43 mult = [0]*10
44 for aHit in event.Digi_ScifiHits:
45 if not aHit.isValid(): continue
46 X = self.M.Scifi_xPos(aHit.GetDetectorID())
47 self.M.fillHist1(detector+'mat_'+str(X[0]*3+X[1]),X[2])
48 self.M.fillHist1(detector+'sig_'+str(X[0]*3+X[1]),aHit.GetSignal(0))
49 self.M.fillHist1(detector+'tdc_'+str(X[0]*3+X[1]),aHit.GetTime(0))
50 self.M.Scifi.GetSiPMPosition(aHit.GetDetectorID(),A,B)
51 if aHit.isVertical(): self.M.fillHist1(detector+'posX_'+str(X[0]),A[0])
52 else: self.M.fillHist1(detector+'posY_'+str(X[0]),A[1])
53 mult[X[0]]+=1
54 for s in range(10):
55 self.M.fillHist1(detector+'mult_'+str(s),mult[s])
void GetSiPMPosition(Int_t SiPMChan, TVector3 &A, TVector3 &B)
Definition Scifi.cxx:625

◆ Init()

Scifi_monitoring.Scifi_hitMaps.Init (   self,
  options,
  monitor 
)

Definition at line 14 of file Scifi_monitoring.py.

14 def Init(self,options,monitor):
15 self.M = monitor
16 h = self.M.h
17 ioman = ROOT.FairRootManager.Instance()
18 self.OT = ioman.GetSink().GetOutTree()
19 if self.M.fsdict or self.M.hasBunchInfo : self.xing = {'':True,'B1only':False,'B2noB1':False,'noBeam':False}
20 else: self.xing = {'':True}
21 self.mat_label = {}
22 self.nScifi = self.M.Scifi.GetConfParI("Scifi/nscifi")
23 self.nMats = self.M.Scifi.GetConfParI("Scifi/nmats")
24 self.nMatsAll = self.nScifi*self.nMats*2
25 for xi in self.xing:
26 for s in range(2*self.nScifi):
27 ut.bookHist(h,detector+'posX_'+str(s)+xi,'x; x [cm]',2000,-100.,100.)
28 ut.bookHist(h,detector+'posY_'+str(s)+xi,'y; y[cm]',2000,-100.,100.)
29 if s%2==1: ut.bookHist(h,detector+'mult_'+str(s)+xi,'mult vertical station '+str(s//2+1)+'; #hits',100,-0.5,99.5)
30 else: ut.bookHist(h,detector+'mult_'+str(s)+xi,'mult horizontal station '+str(s//2+1)+'; #hits',100,-0.5,99.5)
31 for mat in range(self.nMatsAll):
32 s = mat//6
33 p = 'H'
34 if mat%6>2: p='V'
35 m = mat%3
36 ut.bookHist(h,detector+'mat_'+str(mat)+xi,'hit map station '+str(s)+p+' mat '+str(m)+'; #channel',512,-0.5,511.5)
37 ut.bookHist(h,detector+'sig_'+str(mat)+xi,'signal '+str(s)+p+' mat '+str(m)+'; QDC [a.u.]',200,-50.0,150.)
38 ut.bookHist(h,detector+'tdc_'+str(mat)+xi,'tdc '+str(s)+p+' mat '+str(m)+'; timestamp [LHC clock cycles]',200,-1.,4.)
39 if xi=='': self.mat_label[mat] = str(s)+p+' mat '+str(m)
Int_t GetConfParI(TString name)
Definition Scifi.h:50

◆ Plot()

Scifi_monitoring.Scifi_hitMaps.Plot (   self)

Definition at line 56 of file Scifi_monitoring.py.

56 def Plot(self):
57 h = self.M.h
58 # parameters for the signal median
59 q05=np.array([0.5])
60 med=np.array([0.])
61 signal_attributes={}
62 for xi in self.xing:
63 if not self.M.fsdict and not self.M.hasBunchInfo and xi!='': continue
64 ut.bookCanvas(h,detector+'hitmaps'+xi,' ',1024,768,6,5)
65 ut.bookCanvas(h,detector+'signal'+xi,' ',1024,768,6,5)
66 ut.bookCanvas(h,detector+'tdc'+xi,' ',1024,768,6,5)
67 for mat in range(self.nMatsAll):
68 tc = self.M.h[detector+'hitmaps'+xi].cd(mat+1)
69 tc.SetLogy(1)
70 self.M.h[detector+'mat_'+str(mat)+xi].Draw()
71 ROOT.gStyle.SetOptStat(10)
72 tc = self.M.h[detector+'signal'+xi].cd(mat+1)
73 rc = self.M.h[detector+'sig_'+str(mat)+xi]
74 rc.Draw()
75 rc.GetQuantiles(1,med,q05)
76 signal_attributes[mat]={"median":med[0],
77 "std":rc.GetStdDev(),
78 "max":rc.FindLastBinAbove(0),
79 "percent_overflow":rc.GetBinContent(rc.GetNbinsX()+1)/rc.Integral()*100. if rc.Integral()>0 else 0.}
80 tc = self.M.h[detector+'tdc'+xi].cd(mat+1)
81 self.M.h[detector+'tdc_'+str(mat)+xi].Draw()
82
83# summary canvases of the median, maximum and overflow of signals
84 # overflow is always 0, so skip it
85 ut.bookCanvas(h,detector+'signalsSummary'+xi,' ',1024,768,1,1)
86 signal_medians, signal_maxima = ROOT.TGraphErrors(), ROOT.TGraphErrors()
87 signal_medians.SetTitle("Median of signal per mat")
88 signal_medians.GetYaxis().SetTitle("median QDC [a.u.]")
89 signal_maxima.SetTitle("Maximal signal per mat")
90 signal_maxima.GetYaxis().SetTitle("maximum QDC [a.u.]")
91 Area = {}
92 for mat in range(self.nMatsAll):
93 signal_medians.SetPoint(mat, mat,signal_attributes[mat]["median"])
94 signal_medians.SetPointError(mat,0,signal_attributes[mat]["std"])
95 signal_maxima.SetPoint(mat, mat,signal_attributes[mat]["max"])
96 signal_maxima.SetPointError(mat,0,0)
97 graph_list = [signal_medians]
98 for counter, graph in enumerate(graph_list):
99 h[detector+'signalsSummary'+xi].cd(counter+1)
100 ROOT.gPad.SetBottomMargin(0.2)
101 ROOT.gPad.SetGrid(0)
102 graph.Draw('AP')
103 xAxis = graph.GetXaxis()
104 # get rid of the original ticks
105 xAxis.SetTickLength(0)
106 ymin = graph.GetHistogram().GetMinimum()
107 ymax = graph.GetHistogram().GetMaximum()
108 for mat in range(self.nMatsAll):
109 bin_index = xAxis.FindBin(mat)
110 xAxis.SetBinLabel(bin_index,self.mat_label[mat])
111 # Draw custom grid lines for the X axis
112 grid = ROOT.TLine(graph.GetPointX(mat), ymin, graph.GetPointX(mat), ymax)
113 grid.SetLineStyle(3)
114 grid.DrawClone()
115 # Draw ticks
116 tick = ROOT.TLine(graph.GetPointX(mat), ymin, graph.GetPointX(mat), ymin + 0.03*(ymax-ymin))
117 tick.DrawClone()
118 # redraw the graph
119 graph.Draw('P,same')
120 # draw a bkg
121 Area[counter] = ROOT.TBox(ROOT.TMath.MinElement(graph.GetN(), graph.GetX()),
122 graph.GetHistogram().GetMinimum(),
123 ROOT.TMath.MaxElement(graph.GetN(), graph.GetX()),
124 graph.GetHistogram().GetMaximum())
125 Area[counter].SetLineWidth(0)
126 Area[counter].SetFillStyle(3003)
127 Area[counter].SetFillColor(ROOT.kBlue)
128 Area[counter].Draw("same")
129 graph.SetMarkerStyle(20)
130 graph.SetMarkerColor(ROOT.kBlue)
131 graph.SetLineColor(ROOT.kBlue)
132# end of the summary QDC shifter canvases
133
134 ut.bookCanvas(h,detector+'positions'+xi,' ',2048,768,5,2)
135 ut.bookCanvas(h,detector+'mult'+xi,' ',2048,768,5,2)
136 for s in range(5):
137 tc = self.M.h[detector+'positions'+xi].cd(s+1)
138 self.M.h[detector+'posY_'+str(2*s)+xi].Draw()
139 tc = self.M.h[detector+'positions'+xi].cd(s+6)
140 self.M.h[detector+'posX_'+str(2*s+1)+xi].Draw()
141
142 tc = self.M.h[detector+'mult'+xi].cd(s+1)
143 tc.SetLogy(1)
144 self.M.h[detector+'mult_'+str(2*s)+xi].Draw()
145 tc = self.M.h[detector+'mult'+xi].cd(s+6)
146 tc.SetLogy(1)
147 self.M.h[detector+'mult_'+str(2*s+1)+xi].Draw()
148
149 for item in h:
150 if isinstance(h[item], ROOT.TH2):
151 h[item].SetStats(0)
152
153 canvas = detector+'signalsSummary'+xi
154 self.M.h[canvas].Update()
155 if xi!='': self.M.myPrint(self.M.h[canvas],"Scifi-"+canvas,subdir='scifi/shifter/'+xi)
156 else: self.M.myPrint(self.M.h[canvas],"Scifi-"+canvas,subdir='scifi/shifter')
157
158 for canvas in [detector+'hitmaps'+xi,detector+'signal'+xi,detector+'mult'+xi]:
159 self.M.h[canvas].Update()
160 if canvas.find('hitmaps')>0: role='shifter'
161 else : role='expert'
162 if xi!='': self.M.myPrint(self.M.h[canvas],"Scifi-"+canvas,subdir='scifi/'+role+'/'+xi)
163 else: self.M.myPrint(self.M.h[canvas],"Scifi-"+canvas,subdir='scifi/'+role)
164

Member Data Documentation

◆ M

Scifi_monitoring.Scifi_hitMaps.M

Definition at line 15 of file Scifi_monitoring.py.

◆ mat_label

Scifi_monitoring.Scifi_hitMaps.mat_label

Definition at line 21 of file Scifi_monitoring.py.

◆ nMats

Scifi_monitoring.Scifi_hitMaps.nMats

Definition at line 23 of file Scifi_monitoring.py.

◆ nMatsAll

Scifi_monitoring.Scifi_hitMaps.nMatsAll

Definition at line 24 of file Scifi_monitoring.py.

◆ nScifi

Scifi_monitoring.Scifi_hitMaps.nScifi

Definition at line 22 of file Scifi_monitoring.py.

◆ OT

Scifi_monitoring.Scifi_hitMaps.OT

Definition at line 18 of file Scifi_monitoring.py.

◆ xing

Scifi_monitoring.Scifi_hitMaps.xing

Definition at line 19 of file Scifi_monitoring.py.


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