]>
Commit | Line | Data |
---|---|---|
48265b32 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | $Log$ | |
ca7b8371 | 18 | Revision 1.2 2007/09/18 09:44:45 cvetan |
19 | Sorting out some issues concerning the compilation with and without DATE support | |
20 | ||
1954d2d0 | 21 | Revision 1.1 2007/09/17 10:23:31 cvetan |
22 | New TPC monitoring package from Stefan Kniege. The monitoring package can be started by running TPCMonitor.C macro located in macros folder. | |
23 | ||
48265b32 | 24 | */ |
25 | ||
ca7b8371 | 26 | //////////////////////////////////////////////////////////////////////// |
27 | // | |
28 | // AliTPCMonitor class | |
29 | // | |
30 | // Main class for TPC Monitor | |
31 | // Monitor can handle rootified data, files and online streams in DATE format. | |
32 | // The monitor GUI is started by the macro TPCMonitor.C | |
33 | // | |
34 | // In the The data are read in in two read cycles. | |
35 | // If no sector is specified (sectorid==-1) all sectors are read and only the max value | |
36 | // for each channel is stored in a global histogram for Side A and C. | |
37 | // In this way the whole TPC can be read in at once. | |
38 | // | |
39 | // If the sector is specified only one sector is read in and additional quantities | |
40 | // e.g baseline and baseline rms are calculated and stored. | |
41 | // | |
42 | // Author: Stefan Kniege, IKF, Frankfurt | |
43 | // | |
44 | // | |
45 | ///////////////////////////////////////////////////////////////////////// | |
46 | ||
47 | ||
48 | ||
49 | #include "AliLog.h" | |
50 | #include "AliTPCMonitor.h" | |
51 | #include "AliTPCMonitorMappingHandler.h" | |
52 | #include "AliTPCMonitorDateFile.h" | |
53 | #include "AliTPCMonitorDateFormat.h" | |
54 | #include "AliTPCMonitorAltro.h" | |
55 | #include "AliTPCMonitorFFT.h" | |
56 | #include "AliRawReaderRoot.h" | |
57 | #include "AliRawReader.h" | |
58 | #include "TH2F.h" | |
59 | #include "TF1.h" | |
60 | #include "TMath.h" | |
61 | #include "TCanvas.h" | |
62 | #include "TH3S.h" | |
63 | #include "TLegend.h" | |
64 | #include "TROOT.h" | |
65 | #include "TDirectory.h" | |
66 | #include "TSystem.h" | |
67 | #include "TPaveText.h" | |
68 | #include "TFile.h" | |
69 | #include <Riostream.h> | |
1954d2d0 | 70 | #include "AliTPCMonitorDateMonitor.h" |
ca7b8371 | 71 | |
48265b32 | 72 | ClassImp(AliTPCMonitor) |
73 | ||
74 | //____________________________________________________________________________ | |
ca7b8371 | 75 | AliTPCMonitor::AliTPCMonitor(char* name, char* title) : |
76 | AliTPCMonitorConfig(name,title), | |
77 | fPad(new Int_t*[GetMaxHwAddr()]), | |
78 | fPadMapHw(new Float_t[GetMaxHwAddr()]), | |
79 | fPadMapRCU(new Int_t*[GetMaxHwAddr()]), | |
80 | fHistIROC(0), | |
81 | fHistOROC(0), | |
82 | fHistIROCIndex(0), | |
83 | fHistOROCIndex(0), | |
84 | fHistIROCTime(0), | |
85 | fHistOROCTime(0), | |
86 | fHistIROCClone(0), | |
87 | fHistOROCClone(0), | |
88 | fHistIROCRMS(0), | |
89 | fHistOROCRMS(0), | |
90 | fHistIROCBASE(0), | |
91 | fHistOROCBASE(0), | |
92 | fHistIROCSUM(0), | |
93 | fHistOROCSUM(0), | |
94 | fHistChannelTime(0), | |
95 | fHistAddrMapIndex(0), | |
96 | fHistAddrMaxAdc(0), | |
97 | fHistAddrBaseMean(0), | |
98 | fHistAddrMaxAdcX(0), | |
99 | fHistAddrAdcSum(0), | |
100 | fHistAddrBaseRms(0), | |
101 | fHistDistrSumIROC(0), | |
102 | fHistDistrMaxIROC(0), | |
103 | fHistDistrSumOROC(0), | |
104 | fHistDistrMaxOROC(0), | |
105 | fHistDistrBase2dIROC(0), | |
106 | fHistDistrBase2dOROC(0), | |
107 | fHistDistrBaseRmsIROC(0), | |
108 | fHistDistrBaseMeanIROC(0), | |
109 | fHistDistrBaseRmsOROC(0), | |
110 | fHistDistrBaseMeanOROC(0), | |
111 | fHistGlobalMaxA(0), | |
112 | fHistGlobalMaxC(0), | |
113 | fHistList(new TObjArray()), | |
114 | ||
115 | fkNRowsIroc(63), | |
116 | fkNRowsOroc(96), | |
117 | ||
118 | fkNPadsIroc(110), | |
119 | fkNPadsOroc(140), | |
120 | fkNPadMinIroc(-55), | |
121 | fkNPadMinOroc(-70), | |
122 | fkNPadMaxIroc(55), | |
123 | fkNPadMaxOroc(70), | |
124 | fVerb(0), | |
125 | fLastEv(0), | |
126 | fEventNumber(0), | |
127 | fEventNumberOld(0), | |
128 | fDisableFit(0), | |
129 | fExecGlob(0), | |
130 | fExecPlaneMax(0), | |
131 | fExecPadIrocRms(0), | |
132 | fExecPadOrocRms(0), | |
133 | fRunId(0), | |
134 | fEqId(0), | |
135 | fPadUsedRoc(-1), | |
136 | fPadUsedHwAddr(-1), | |
137 | fGdcId(0), | |
138 | fLdcId(0), | |
139 | fLdcIdOld(1), | |
140 | fMapEqidsSec(new Int_t*[36]), | |
141 | fMapEqidsRcu(new Int_t[1000]), | |
142 | fMirror(1), | |
143 | fChannelIter(0), | |
144 | fMapHand(0), | |
145 | fReaderROOT(0), | |
146 | fReaderDATE(0), | |
147 | fReaderDATEMon(0) | |
48265b32 | 148 | { |
ca7b8371 | 149 | // Constructor |
48265b32 | 150 | |
48265b32 | 151 | for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[GetTimeBins()];} |
48265b32 | 152 | for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];} |
48265b32 | 153 | for(Int_t i = 0; i<36; i++) { fMapEqidsSec[i] = new Int_t[6];} |
ca7b8371 | 154 | |
48265b32 | 155 | if (gDirectory) |
156 | { | |
157 | if (!gDirectory->GetList()) | |
158 | { | |
159 | Warning("Build","Current directory is not a valid directory"); | |
ca7b8371 | 160 | return; |
48265b32 | 161 | } |
162 | AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(GetName()); | |
163 | if(hold) | |
164 | { | |
165 | Warning("Build","Replacing existing histogram: %s (Potential memory leak).",GetName()); | |
166 | gDirectory->GetList()->Remove(hold); | |
167 | } | |
168 | gDirectory->Append(this); | |
ca7b8371 | 169 | } |
170 | CreateHistos(); | |
171 | SetEqIds(); | |
48265b32 | 172 | |
ca7b8371 | 173 | } |
48265b32 | 174 | |
ca7b8371 | 175 | //____________________________________________________________________________ |
176 | AliTPCMonitor::AliTPCMonitor(const AliTPCMonitor &monitor): | |
177 | AliTPCMonitorConfig(monitor.GetName(),monitor.GetTitle()), | |
178 | fPad(new Int_t*[GetMaxHwAddr()]), | |
179 | fPadMapHw(new Float_t[GetMaxHwAddr()]), | |
180 | fPadMapRCU(new Int_t*[GetMaxHwAddr()]), | |
181 | fHistIROC(0), | |
182 | fHistOROC(0), | |
183 | fHistIROCIndex(0), | |
184 | fHistOROCIndex(0), | |
185 | fHistIROCTime(0), | |
186 | fHistOROCTime(0), | |
187 | fHistIROCClone(0), | |
188 | fHistOROCClone(0), | |
189 | fHistIROCRMS(0), | |
190 | fHistOROCRMS(0), | |
191 | fHistIROCBASE(0), | |
192 | fHistOROCBASE(0), | |
193 | fHistIROCSUM(0), | |
194 | fHistOROCSUM(0), | |
195 | fHistChannelTime(0), | |
196 | fHistAddrMapIndex(0), | |
197 | fHistAddrMaxAdc(0), | |
198 | fHistAddrBaseMean(0), | |
199 | fHistAddrMaxAdcX(0), | |
200 | fHistAddrAdcSum(0), | |
201 | fHistAddrBaseRms(0), | |
202 | fHistDistrSumIROC(0), | |
203 | fHistDistrMaxIROC(0), | |
204 | fHistDistrSumOROC(0), | |
205 | fHistDistrMaxOROC(0), | |
206 | fHistDistrBase2dIROC(0), | |
207 | fHistDistrBase2dOROC(0), | |
208 | fHistDistrBaseRmsIROC(0), | |
209 | fHistDistrBaseMeanIROC(0), | |
210 | fHistDistrBaseRmsOROC(0), | |
211 | fHistDistrBaseMeanOROC(0), | |
212 | fHistGlobalMaxA(0), | |
213 | fHistGlobalMaxC(0), | |
214 | fHistList(new TObjArray()), | |
215 | fkNRowsIroc(monitor.fkNRowsIroc), | |
216 | fkNRowsOroc(monitor.fkNRowsOroc), | |
217 | fkNPadsIroc(monitor.fkNPadsIroc), | |
218 | fkNPadsOroc(monitor.fkNPadsOroc), | |
219 | fkNPadMinIroc(monitor.fkNPadMinIroc), | |
220 | fkNPadMinOroc(monitor.fkNPadMinOroc), | |
221 | fkNPadMaxIroc(monitor.fkNPadMaxIroc), | |
222 | fkNPadMaxOroc(monitor.fkNPadMaxOroc), | |
223 | fVerb(monitor.fVerb), | |
224 | fLastEv(monitor.fLastEv), | |
225 | fEventNumber(monitor.fEventNumber), | |
226 | fEventNumberOld(monitor.fEventNumberOld), | |
227 | fDisableFit(monitor.fDisableFit), | |
228 | fExecGlob(monitor.fExecGlob), | |
229 | fExecPlaneMax(monitor.fExecPlaneMax), | |
230 | fExecPadIrocRms(monitor.fExecPadIrocRms), | |
231 | fExecPadOrocRms(monitor.fExecPadOrocRms), | |
232 | fRunId(monitor.fRunId), | |
233 | fEqId(monitor.fEqId), | |
234 | fPadUsedRoc(monitor.fPadUsedRoc), | |
235 | fPadUsedHwAddr(monitor.fPadUsedHwAddr), | |
236 | fGdcId(monitor.fGdcId), | |
237 | fLdcId(monitor.fLdcId), | |
238 | fLdcIdOld(monitor.fLdcIdOld), | |
239 | fMapEqidsSec(new Int_t*[36]), | |
240 | fMapEqidsRcu(new Int_t[1000]), | |
241 | fMirror(monitor.fMirror), | |
242 | fChannelIter(monitor.fChannelIter), | |
243 | fMapHand(monitor.fMapHand), | |
244 | fReaderROOT(monitor.fReaderROOT), | |
245 | fReaderDATE(monitor.fReaderDATE), | |
246 | fReaderDATEMon(monitor.fReaderDATEMon) | |
247 | { | |
248 | // copy constructor | |
249 | ||
250 | fHistIROC=(TH2F*)monitor.fHistIROC->Clone(); fHistList->Add(fHistIROC); | |
251 | fHistOROC=(TH2F*)monitor.fHistOROC->Clone(); fHistList->Add(fHistOROC); | |
252 | fHistIROCIndex=(TH2S*)monitor.fHistIROCIndex->Clone(); fHistList->Add(fHistIROCIndex); | |
253 | fHistOROCIndex=(TH2S*)monitor.fHistOROCIndex->Clone(); fHistList->Add(fHistOROCIndex); | |
254 | fHistIROCTime=(TH2F*)monitor.fHistIROCTime->Clone(); fHistList->Add(fHistIROCTime); | |
255 | fHistOROCTime=(TH2F*)monitor.fHistOROCTime->Clone(); fHistList->Add(fHistOROCTime); | |
256 | fHistIROCClone=(TH2F*)monitor.fHistIROCClone->Clone(); fHistList->Add(fHistIROCClone); | |
257 | fHistOROCClone=(TH2F*)monitor.fHistOROCClone->Clone(); fHistList->Add(fHistOROCClone); | |
258 | fHistIROCRMS=(TH2F*)monitor.fHistIROCRMS->Clone(); fHistList->Add(fHistIROCRMS); | |
259 | fHistOROCRMS=(TH2F*)monitor.fHistOROCRMS->Clone(); fHistList->Add(fHistOROCRMS); | |
260 | fHistIROCBASE=(TH2F*)monitor.fHistIROCBASE->Clone(); fHistList->Add(fHistIROCBASE); | |
261 | fHistOROCBASE=(TH2F*)monitor.fHistOROCBASE->Clone(); fHistList->Add(fHistOROCBASE); | |
262 | fHistIROCSUM=(TH2F*)monitor.fHistIROCSUM->Clone(); fHistList->Add(fHistIROCSUM); | |
263 | fHistOROCSUM=(TH2F*)monitor.fHistOROCSUM->Clone(); fHistList->Add(fHistOROCSUM); | |
264 | ||
265 | fHistChannelTime=(TH2F*)monitor.fHistChannelTime->Clone(); fHistList->Add(fHistChannelTime); | |
266 | ||
267 | fHistAddrMapIndex=(TH1F*)monitor.fHistAddrMapIndex->Clone(); fHistList->Add(fHistAddrMapIndex); | |
268 | fHistAddrMaxAdc=(TH1F*)monitor.fHistAddrMaxAdc->Clone(); fHistList->Add(fHistAddrMaxAdc); | |
269 | fHistAddrBaseMean=(TH1F*)monitor.fHistAddrBaseMean->Clone(); fHistList->Add(fHistAddrBaseMean); | |
270 | fHistAddrMaxAdcX=(TH1F*)monitor.fHistAddrMaxAdcX->Clone(); fHistList->Add(fHistAddrMaxAdcX); | |
271 | fHistAddrAdcSum=(TH1F*)monitor.fHistAddrAdcSum->Clone(); fHistList->Add(fHistAddrAdcSum); | |
272 | fHistAddrBaseRms=(TH1F*)monitor.fHistAddrBaseRms->Clone(); fHistList->Add(fHistAddrBaseRms); | |
273 | ||
274 | ||
275 | fHistDistrSumIROC=(TH1F*)monitor.fHistDistrSumIROC->Clone(); fHistList->Add(fHistDistrSumIROC); | |
276 | fHistDistrMaxIROC=(TH1F*)monitor.fHistDistrMaxIROC->Clone(); fHistList->Add(fHistDistrMaxIROC); | |
277 | fHistDistrSumOROC=(TH1F*)monitor.fHistDistrSumOROC->Clone(); fHistList->Add(fHistDistrSumOROC); | |
278 | fHistDistrMaxOROC=(TH1F*)monitor.fHistDistrMaxOROC->Clone(); fHistList->Add(fHistDistrMaxOROC); | |
279 | ||
280 | fHistDistrBase2dIROC=(TH2F*)monitor.fHistDistrBase2dIROC->Clone(); fHistList->Add(fHistDistrBase2dIROC); | |
281 | fHistDistrBase2dOROC=(TH2F*)monitor.fHistDistrBase2dOROC->Clone(); fHistList->Add(fHistDistrBase2dOROC); | |
282 | fHistDistrBaseRmsIROC=(TH1D*)monitor.fHistDistrBaseRmsIROC->Clone(); fHistList->Add(fHistDistrBaseRmsIROC); | |
283 | fHistDistrBaseMeanIROC=(TH1D*)monitor.fHistDistrBaseMeanIROC->Clone(); fHistList->Add(fHistDistrBaseMeanIROC); | |
284 | fHistDistrBaseRmsOROC=(TH1D*)monitor.fHistDistrBaseRmsOROC->Clone(); fHistList->Add(fHistDistrBaseRmsOROC); | |
285 | fHistDistrBaseMeanOROC=(TH1D*)monitor.fHistDistrBaseMeanOROC->Clone(); fHistList->Add(fHistDistrBaseMeanOROC); | |
286 | ||
287 | fHistGlobalMaxA=(TH2S*)monitor.fHistGlobalMaxA->Clone(); fHistList->Add(fHistGlobalMaxA); | |
288 | fHistGlobalMaxC=(TH2S*)monitor.fHistGlobalMaxC->Clone(); fHistList->Add(fHistGlobalMaxC); | |
289 | ||
290 | // fPad = new Int_t*[monitor.GetMaxHwAddr()]; | |
291 | for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[monitor.GetTimeBins()];} | |
292 | ||
293 | //fPadMapRCU = new Int_t*[monitor.GetMaxHwAddr()]; | |
294 | for(Int_t i = 0; i<monitor.GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];} | |
295 | ||
296 | //fPadMapHw = new Float_t[monitor.GetMaxHwAddr()]; | |
297 | ||
298 | //fMapEqidsRcu = new Int_t[1000]; | |
299 | //fMapEqidsSec = new Int_t*[36]; | |
300 | for(Int_t i = 0; i<36; i++) { fMapEqidsSec[i] = new Int_t[6];} | |
48265b32 | 301 | SetEqIds(); |
ca7b8371 | 302 | |
303 | if (gDirectory) | |
304 | { | |
305 | if (!gDirectory->GetList()) | |
306 | { | |
307 | Warning("Build","Current directory is not a valid directory"); | |
308 | ||
309 | } | |
310 | else | |
311 | { | |
312 | AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(monitor.GetName()); | |
313 | if(hold) | |
314 | { | |
315 | Warning("Build","Replacing existing histogram: %s (Potential memory leak).",monitor.GetName()); | |
316 | gDirectory->GetList()->Remove(hold); | |
317 | } | |
318 | gDirectory->Append(this); | |
319 | } | |
320 | } | |
321 | } | |
322 | ||
323 | ||
324 | //____________________________________________________________________________ | |
48265b32 | 325 | |
ca7b8371 | 326 | AliTPCMonitor &AliTPCMonitor:: operator= (const AliTPCMonitor& monitor) |
327 | { | |
328 | // assigment operator | |
329 | if(this!=&monitor) | |
330 | { | |
331 | ((AliTPCMonitorConfig *)this)->operator=(monitor); | |
332 | fkNRowsIroc=monitor.fkNRowsIroc; | |
333 | fkNRowsOroc=monitor.fkNRowsOroc; | |
334 | fkNPadsIroc=monitor.fkNPadsIroc; | |
335 | fkNPadsOroc=monitor.fkNPadsOroc; | |
336 | fkNPadMinIroc=monitor.fkNPadMinIroc; | |
337 | fkNPadMinOroc=monitor.fkNPadMinOroc; | |
338 | fkNPadMaxIroc=monitor.fkNPadMaxIroc; | |
339 | fkNPadMaxOroc=monitor.fkNPadMaxOroc; | |
340 | fVerb=monitor.fVerb; | |
341 | fLastEv=monitor.fLastEv; | |
342 | fEventNumber=monitor.fEventNumber; | |
343 | fEventNumberOld=monitor.fEventNumberOld; | |
344 | fDisableFit=monitor.fDisableFit; | |
345 | fExecGlob=monitor.fExecGlob; | |
346 | fExecPlaneMax=monitor.fExecPlaneMax; | |
347 | fExecPadIrocRms=monitor.fExecPadIrocRms; | |
348 | fExecPadOrocRms=monitor.fExecPadOrocRms; | |
349 | fRunId=monitor.fRunId; | |
350 | fEqId=monitor.fEqId; | |
351 | fPadUsedRoc=monitor.fPadUsedRoc; | |
352 | fPadUsedHwAddr=monitor.fPadUsedHwAddr; | |
353 | fGdcId=monitor.fGdcId; | |
354 | fLdcId=monitor.fLdcId; | |
355 | fLdcIdOld=monitor.fLdcIdOld; | |
356 | fMapHand=monitor.fMapHand; | |
357 | fReaderROOT=monitor.fReaderROOT; | |
358 | fReaderDATE=monitor.fReaderDATE; | |
359 | ||
360 | ||
361 | fHistList = new TObjArray(); | |
362 | fHistIROC=(TH2F*)monitor.fHistIROC->Clone(); fHistList->Add(fHistIROC); | |
363 | fHistOROC=(TH2F*)monitor.fHistOROC->Clone(); fHistList->Add(fHistOROC); | |
364 | fHistIROCIndex=(TH2S*)monitor.fHistIROCIndex->Clone(); fHistList->Add(fHistIROCIndex); | |
365 | fHistOROCIndex=(TH2S*)monitor.fHistOROCIndex->Clone(); fHistList->Add(fHistOROCIndex); | |
366 | fHistIROCTime=(TH2F*)monitor.fHistIROCTime->Clone(); fHistList->Add(fHistIROCTime); | |
367 | fHistOROCTime=(TH2F*)monitor.fHistOROCTime->Clone(); fHistList->Add(fHistOROCTime); | |
368 | fHistIROCClone=(TH2F*)monitor.fHistIROCClone->Clone(); fHistList->Add(fHistIROCClone); | |
369 | fHistOROCClone=(TH2F*)monitor.fHistOROCClone->Clone(); fHistList->Add(fHistOROCClone); | |
370 | fHistIROCRMS=(TH2F*)monitor.fHistIROCRMS->Clone(); fHistList->Add(fHistIROCRMS); | |
371 | fHistOROCRMS=(TH2F*)monitor.fHistOROCRMS->Clone(); fHistList->Add(fHistOROCRMS); | |
372 | fHistIROCBASE=(TH2F*)monitor.fHistIROCBASE->Clone(); fHistList->Add(fHistIROCBASE); | |
373 | fHistOROCBASE=(TH2F*)monitor.fHistOROCBASE->Clone(); fHistList->Add(fHistOROCBASE); | |
374 | fHistIROCSUM=(TH2F*)monitor.fHistIROCSUM->Clone(); fHistList->Add(fHistIROCSUM); | |
375 | fHistOROCSUM=(TH2F*)monitor.fHistOROCSUM->Clone(); fHistList->Add(fHistOROCSUM); | |
376 | ||
377 | fHistChannelTime=(TH2F*)monitor.fHistChannelTime->Clone(); fHistList->Add(fHistChannelTime); | |
378 | ||
379 | fHistAddrMapIndex=(TH1F*)monitor.fHistAddrMapIndex->Clone(); fHistList->Add(fHistAddrMapIndex); | |
380 | fHistAddrMaxAdc=(TH1F*)monitor.fHistAddrMaxAdc->Clone(); fHistList->Add(fHistAddrMaxAdc); | |
381 | fHistAddrBaseMean=(TH1F*)monitor.fHistAddrBaseMean->Clone(); fHistList->Add(fHistAddrBaseMean); | |
382 | fHistAddrMaxAdcX=(TH1F*)monitor.fHistAddrMaxAdcX->Clone(); fHistList->Add(fHistAddrMaxAdcX); | |
383 | fHistAddrAdcSum=(TH1F*)monitor.fHistAddrAdcSum->Clone(); fHistList->Add(fHistAddrAdcSum); | |
384 | fHistAddrBaseRms=(TH1F*)monitor.fHistAddrBaseRms->Clone(); fHistList->Add(fHistAddrBaseRms); | |
385 | ||
386 | ||
387 | fHistDistrSumIROC=(TH1F*)monitor.fHistDistrSumIROC->Clone(); fHistList->Add(fHistDistrSumIROC); | |
388 | fHistDistrMaxIROC=(TH1F*)monitor.fHistDistrMaxIROC->Clone(); fHistList->Add(fHistDistrMaxIROC); | |
389 | fHistDistrSumOROC=(TH1F*)monitor.fHistDistrSumOROC->Clone(); fHistList->Add(fHistDistrSumOROC); | |
390 | fHistDistrMaxOROC=(TH1F*)monitor.fHistDistrMaxOROC->Clone(); fHistList->Add(fHistDistrMaxOROC); | |
391 | ||
392 | fHistDistrBase2dIROC=(TH2F*)monitor.fHistDistrBase2dIROC->Clone(); fHistList->Add(fHistDistrBase2dIROC); | |
393 | fHistDistrBase2dOROC=(TH2F*)monitor.fHistDistrBase2dOROC->Clone(); fHistList->Add(fHistDistrBase2dOROC); | |
394 | fHistDistrBaseRmsIROC=(TH1D*)monitor.fHistDistrBaseRmsIROC->Clone(); fHistList->Add(fHistDistrBaseRmsIROC); | |
395 | fHistDistrBaseMeanIROC=(TH1D*)monitor.fHistDistrBaseMeanIROC->Clone(); fHistList->Add(fHistDistrBaseMeanIROC); | |
396 | fHistDistrBaseRmsOROC=(TH1D*)monitor.fHistDistrBaseRmsOROC->Clone(); fHistList->Add(fHistDistrBaseRmsOROC); | |
397 | fHistDistrBaseMeanOROC=(TH1D*)monitor.fHistDistrBaseMeanOROC->Clone(); fHistList->Add(fHistDistrBaseMeanOROC); | |
398 | ||
399 | fHistGlobalMaxA=(TH2S*)monitor.fHistGlobalMaxA->Clone(); fHistList->Add(fHistGlobalMaxA); | |
400 | fHistGlobalMaxC=(TH2S*)monitor.fHistGlobalMaxC->Clone(); fHistList->Add(fHistGlobalMaxC); | |
401 | ||
402 | fPad = new Int_t*[monitor.GetMaxHwAddr()]; | |
403 | for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[monitor.GetTimeBins()];} | |
404 | ||
405 | fPadMapRCU = new Int_t*[monitor.GetMaxHwAddr()]; | |
406 | for(Int_t i = 0; i<monitor.GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];} | |
407 | ||
408 | fPadMapHw = new Float_t[monitor.GetMaxHwAddr()]; | |
409 | ||
410 | fMapEqidsRcu = new Int_t[1000]; | |
411 | fMapEqidsSec = new Int_t*[36]; | |
412 | for(Int_t i = 0; i<36; i++) { fMapEqidsSec[i] = new Int_t[6];} | |
413 | SetEqIds(); | |
414 | ||
415 | if (gDirectory) | |
416 | { | |
417 | if (!gDirectory->GetList()) | |
418 | { | |
419 | Warning("Build","Current directory is not a valid directory"); | |
420 | return *this; | |
421 | } | |
422 | AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(monitor.GetName()); | |
423 | if(hold) | |
424 | { | |
425 | Warning("Build","Replacing existing histogram: %s (Potential memory leak).",monitor.GetName()); | |
426 | gDirectory->GetList()->Remove(hold); | |
427 | } | |
428 | gDirectory->Append(this); | |
429 | } | |
430 | fReaderDATEMon=monitor.fReaderDATEMon; | |
431 | } | |
432 | return *this; | |
48265b32 | 433 | } |
ca7b8371 | 434 | |
435 | ||
48265b32 | 436 | //____________________________________________________________________________ |
437 | AliTPCMonitor::~AliTPCMonitor() | |
438 | { | |
439 | // Destructor | |
440 | ||
441 | for(Int_t i = 0; i<GetMaxHwAddr(); i++) { delete[] fPad[i] ;} | |
442 | for(Int_t i = 0; i<GetMaxHwAddr(); i++) { delete[] fPadMapRCU[i];} | |
443 | delete[] fPadMapHw ; | |
444 | DeleteHistos(); | |
445 | } | |
446 | ||
447 | //____________________________________________________________________________ | |
448 | void AliTPCMonitor::CreateHistos() | |
449 | { | |
450 | // Create histograms to be displayed | |
451 | ||
452 | if(fVerb) cout << " create new ones " << endl; | |
ca7b8371 | 453 | fHistIROC = new TH2F("fHistIROC" ,"fHistIROC" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROC); |
454 | fHistOROC = new TH2F("fHistOROC" ,"fHistOROC" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROC); | |
48265b32 | 455 | |
ca7b8371 | 456 | fHistIROCIndex = new TH2S("fHistIROCIndex" ,"fHistIROCIndex" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCIndex); |
457 | fHistOROCIndex = new TH2S("fHistOROCIndex" ,"fHistOROCIndex" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCIndex); | |
48265b32 | 458 | |
ca7b8371 | 459 | fHistIROCTime = new TH2F("fHistIROCTime" ,"fHistIROCTime" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCTime); |
460 | fHistOROCTime = new TH2F("fHistOROCTime" ,"fHistOROCTime" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCTime); | |
48265b32 | 461 | |
ca7b8371 | 462 | fHistIROCRMS = new TH2F("fHistIROCRMS" ,"fHistIROCRMS" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCRMS); |
463 | fHistOROCRMS = new TH2F("fHistOROCRMS" ,"fHistOROCRMS" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCRMS); | |
48265b32 | 464 | |
ca7b8371 | 465 | fHistIROCSUM = new TH2F("fHistIROCSUM" ,"fHistIROCSUM" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCSUM); |
466 | fHistOROCSUM = new TH2F("fHistOROCSUM" ,"fHistOROCSUM" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCSUM); | |
48265b32 | 467 | |
ca7b8371 | 468 | fHistIROCBASE = new TH2F("fHistIROCBASE" ,"fHistIROCBASE" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCBASE); |
469 | fHistOROCBASE = new TH2F("fHistOROCBASE" ,"fHistOROCBASE" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCBASE); | |
48265b32 | 470 | |
471 | ||
472 | fHistChannelTime = new TH2F("fHistChannelTime" ,"fHistChannelTime" ,GetNumOfChannels(),0,GetNumOfChannels(),GetTimeBins(),0,GetTimeBins());fHistList->Add(fHistChannelTime); | |
473 | fHistAddrMapIndex = new TH1F("fHistAddrMapIndex" ,"fHistAddrMapIndex" ,GetMaxHwAddr() ,0,GetMaxHwAddr()); fHistList->Add(fHistAddrMapIndex); | |
474 | fHistAddrMaxAdc = new TH1F("fHistAddrMaxAdc" ,"fHistAddrMaxAdc" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrMaxAdc); | |
475 | fHistAddrMaxAdcX = new TH1F("fHistAddrMaxAdcX" ,"fHistAddrMaxAdcX" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrMaxAdcX); | |
476 | fHistAddrBaseMean = new TH1F("fHistAddrBaseMean" ,"fHistAddrBaseMean" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrBaseMean); | |
477 | fHistAddrAdcSum = new TH1F("fHistAddrAdcSum" ,"fHistAddrAdcSum" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrAdcSum); | |
478 | fHistAddrBaseRms = new TH1F("fHistAddrBaseRms" ,"fHistAddrBaseRms" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrBaseRms); | |
479 | fHistDistrSumIROC = new TH1F("fHistDistrSumIROC" ,"fHistDistrSumIROC" ,400,0.0,4000.0); fHistList->Add(fHistDistrSumIROC); | |
480 | fHistDistrMaxIROC = new TH1F("fHistDistrMaxIROC" ,"fHistDistrMaxIROC" ,500,0.0,1000.0); fHistList->Add(fHistDistrMaxIROC); | |
481 | fHistDistrSumOROC = new TH1F("fHistDistrSumOROC" ,"fHistDistrSumOROC" ,400,0.0,4000.0); fHistList->Add(fHistDistrSumOROC); | |
482 | fHistDistrMaxOROC = new TH1F("fHistDistrMaxOROC" ,"fHistDistrMaxOROC" ,500,0.0,1000.0); fHistList->Add(fHistDistrMaxOROC); | |
483 | ||
484 | fHistDistrBase2dIROC = new TH2F("fHistDistrBase2dIROC" ,"fHistDistrBase2dIROC",100,0.0,100.0,100,0.0,10.0); fHistList->Add(fHistDistrBase2dIROC); | |
485 | fHistDistrBase2dOROC = new TH2F("fHistDistrBase2dOROC" ,"fHistDistrBase2dOROC",100,0.0,100.0,100,0.0,10.0); fHistList->Add(fHistDistrBase2dOROC); | |
486 | ||
487 | fHistGlobalMaxA = new TH2S("SIDE A" ,"SIDE A" ,500,-3000,3000,500,-3000,3000); fHistList->Add(fHistGlobalMaxA); | |
488 | fHistGlobalMaxC = new TH2S("SIDE C" ,"SIDE C" ,500,-3000,3000,500,-3000,3000); fHistList->Add(fHistGlobalMaxC); | |
489 | ||
490 | ResetArrays(); | |
491 | } | |
492 | //____________________________________________________________________________ | |
493 | Int_t AliTPCMonitor::ProcessEvent() | |
494 | { | |
495 | // Process Event | |
496 | // Depending on the value of the sector id all sectors (sectorid == -1) are processed. | |
497 | // | |
498 | // In this case only the maximum values are calculated per pad and filled to the global histograms | |
499 | // In a second loop the last processed(displayed) sector will be processed (sectorid!=-1) | |
500 | // again and the baseline rms and further quantities are calculated | |
501 | // | |
502 | // If only one sector should be processed SetProcOneSector(1) should be set. | |
503 | // In this case only the specified (last/last displayed) sector will be processed. | |
504 | // | |
505 | // If GetProcNextEvent()==0 the same event will be processed again | |
506 | ||
507 | ||
508 | Int_t sectorid = 0; | |
509 | Int_t retflag = 0; // id of last sector + 1000, or error flag | |
510 | if(GetProcNextEvent()==1 && fLastEv) { AliInfo("Last event already processed"); } | |
511 | if(GetProcNextEvent()==1) ResetSectorArray(); | |
512 | ||
513 | ||
514 | if(GetProcNextEvent()==0 || GetProcOneSector()==1 ) sectorid = GetLastSector(); | |
515 | else sectorid = -1; | |
516 | ||
517 | // first iteration | |
518 | retflag = ReadData(sectorid); | |
519 | ||
520 | SetLastProcFile(GetFile()); | |
521 | ||
522 | if(retflag>=10 && retflag<1000){ AliError("Could not read event properly: Check file name and format or try next event"); return 0 ;} | |
523 | ||
524 | DrawHists(3); | |
525 | ||
526 | // second iteration | |
527 | if(sectorid==-1 && retflag >1000) | |
528 | { | |
529 | AliInfo("Second read cycle"); | |
530 | SetProcNextEvent(0); | |
531 | if(GetLastSectorDisplayed()==-1) {sectorid = GetLastSector() ; } | |
532 | else {sectorid = GetLastSectorDisplayed(); SetLastSector(sectorid) ; } | |
533 | retflag = ReadData(sectorid); | |
534 | } | |
535 | ||
536 | SetLastSectorDisplayed(sectorid) ; | |
537 | fMapHand->ReadfecHwMap(GetLastSector()); | |
538 | FillHistsPadPlane(); | |
539 | DrawHists(1); | |
540 | SetEventProcessed(1); | |
541 | return retflag; | |
542 | } | |
543 | ||
544 | //__________________________________________________________________ | |
545 | Int_t AliTPCMonitor::ReadData(Int_t secid) | |
546 | { | |
ca7b8371 | 547 | // Read Data File/Stream for specified Format. |
48265b32 | 548 | // Payload will be extracted from either ROOT or DATE format |
549 | // and passed to FillHistsDecode for decoding of the adc information | |
550 | ||
551 | Int_t format = GetFormat(); | |
552 | ||
553 | ||
554 | //if(format==2 && !gSystem->Getenv("DATE_ROOT")) { AliError("DATE not initialized on this system"); return 11;} | |
555 | ||
556 | if( format==0) {return ReadDataROOT(secid);} | |
557 | else if(format==1) {return ReadDataDATEFile(secid);} | |
558 | else if(format==2) | |
559 | { | |
48265b32 | 560 | return ReadDataDATEStream(secid); |
48265b32 | 561 | } |
562 | ||
563 | AliWarning("Function should already be left"); | |
564 | return 11; | |
565 | } | |
566 | //__________________________________________________________________ | |
567 | Int_t AliTPCMonitor::ReadDataDATEFile(Int_t secid) | |
568 | { | |
569 | // Read Data in Date format. | |
570 | // Date file and monitor will be handled in this function. | |
571 | ||
572 | if(fReaderROOT) { delete fReaderROOT ; fReaderROOT=0;} | |
573 | ||
1954d2d0 | 574 | #ifdef ALI_DATE |
48265b32 | 575 | if(fReaderDATEMon) { delete fReaderDATEMon ; fReaderDATEMon=0;} |
576 | #endif | |
577 | ||
578 | Char_t* eventPtr = 0; | |
ca7b8371 | 579 | AliTPCMonitorDateFormat* dateform = 0; |
48265b32 | 580 | |
581 | // Create objects // | |
582 | if( fReaderDATE==0 || ( fReaderDATE!=0 && (strcmp(GetLastProcFile(),GetFile())!=0) ) ) | |
583 | { | |
584 | cout << " Create new DATE file "<< endl; | |
585 | if(fReaderDATE) { delete fReaderDATE ; fReaderDATE=0; } | |
586 | fReaderDATE = new AliTPCMonitorDateFile() ; | |
587 | fReaderDATE->SetName("fReaderDATE") ; | |
588 | fReaderDATE->OpenDateFile(GetFile()) ; | |
589 | fEventNumber =0; | |
590 | } | |
591 | ||
592 | // Get Event pointer /// | |
593 | if(fReaderDATE->IsDateFileOpen() ==false ) { AliError("Could not open Date File"); return 11 ; } | |
594 | // Rewind event if new event number is smaller than old one | |
ca7b8371 | 595 | if(fEventNumberOld>fEventNumber ) { fReaderDATE->ResetFilePos(); } |
48265b32 | 596 | while(GetProcNextEvent() || fEventNumber==0) |
597 | { | |
598 | fReaderDATE->ReadEvent(); | |
599 | eventPtr = fReaderDATE->GetMemoryPointer(); | |
ca7b8371 | 600 | dateform = new AliTPCMonitorDateFormat(eventPtr); |
601 | Int_t currentev = dateform->GetEventID(); | |
602 | if(fEventNumber <= currentev ){ break; } | |
48265b32 | 603 | } |
ca7b8371 | 604 | |
48265b32 | 605 | eventPtr = fReaderDATE->GetMemoryPointer(); |
606 | ||
ca7b8371 | 607 | if(dateform==0) dateform = new AliTPCMonitorDateFormat(eventPtr); |
608 | fEventNumber = dateform->GetEventID(); | |
609 | fEventNumberOld = dateform->GetEventID(); | |
48265b32 | 610 | |
611 | if(fReaderDATE->IsLastEvent()) fLastEv =1; | |
ca7b8371 | 612 | if(dateform->IsEventEndOfRun()) { AliInfo("Event is end of run: eventType END_OF_RUN "); } |
48265b32 | 613 | |
614 | if(fReaderDATE->IsEventValid() == false ) {AliInfo("Skipping Event because invalid"); return 10; } | |
ca7b8371 | 615 | if(dateform->IsEventPhysicsEvent() == false ) {AliInfo("Skipping Header/event because not Physics event"); return 12; } |
48265b32 | 616 | |
617 | ResetHistos() ; | |
618 | ||
ca7b8371 | 619 | Int_t lastrcu = ReadDataDATESubEventLoop(dateform,secid); |
48265b32 | 620 | |
ca7b8371 | 621 | delete dateform; |
48265b32 | 622 | if(fVerb) cout << " last rcu " << lastrcu << endl; |
623 | return lastrcu; | |
624 | } | |
625 | ||
626 | ||
1954d2d0 | 627 | #ifdef ALI_DATE |
48265b32 | 628 | //__________________________________________________________________ |
629 | Int_t AliTPCMonitor::ReadDataDATEStream(Int_t secid) | |
630 | { | |
631 | // Read Data from DATE stream. | |
632 | // Can also be used for DATE file. | |
633 | ||
634 | ||
635 | if(fReaderROOT) { delete fReaderROOT ; fReaderROOT=0;} | |
636 | if(fReaderDATE) { delete fReaderDATE ; fReaderDATE =0; } | |
637 | ||
638 | Char_t* eventPtr = 0; | |
639 | ||
ca7b8371 | 640 | AliTPCMonitorDateFormat* dateform =0 ; |
48265b32 | 641 | |
642 | // Create objects /// | |
643 | if((fReaderDATEMon==0 || ( fReaderDATEMon!=0 && (strcmp(GetLastProcFile(),GetFile())!=0) ))) | |
644 | { | |
645 | if(fReaderDATEMon!=0) | |
646 | { | |
647 | fReaderDATEMon->Logout(); | |
648 | delete fReaderDATEMon; | |
649 | } | |
650 | fReaderDATEMon = new AliTPCMonitorDateMonitor(); | |
651 | fReaderDATEMon->SetName("DMon"); | |
652 | Int_t status = fReaderDATEMon->OpenMonitoring(GetFile()); | |
653 | if(status) { AliError(Form("Could not read event online: Error: %s",fReaderDATEMon->DecodeError(status))); return 11; } | |
654 | } | |
655 | ||
656 | if(GetProcNextEvent()) | |
657 | { | |
658 | fReaderDATEMon->Free(); | |
659 | Int_t status = fReaderDATEMon->GetEvent(); | |
660 | if(status) { AliError(Form("Could not read event online: Error: %s",fReaderDATEMon->DecodeError(status))); return 11 ;} | |
661 | //fReaderDATEMon->Logout(); | |
662 | } | |
663 | ||
664 | eventPtr = fReaderDATEMon->GetEventPointerasChar(); | |
665 | ||
ca7b8371 | 666 | if(dateform==0) dateform = new AliTPCMonitorDateFormat(eventPtr); |
667 | fEventNumber = dateform->GetEventID(); | |
668 | fEventNumberOld = dateform->GetEventID(); | |
48265b32 | 669 | |
ca7b8371 | 670 | if(dateform->IsEventEndOfRun()) { AliInfo("Event is end of run: eventType END_OF_RUN "); } |
671 | if(dateform->IsEventPhysicsEvent() == false ) {AliInfo("Skipping Header/event because not Physics event"); return 12; } | |
48265b32 | 672 | |
673 | ResetHistos() ; | |
674 | ||
ca7b8371 | 675 | Int_t lastrcu = ReadDataDATESubEventLoop(dateform,secid); |
48265b32 | 676 | |
ca7b8371 | 677 | delete dateform; |
48265b32 | 678 | if(fVerb) cout << " last rcu " << lastrcu << endl; |
679 | return lastrcu; | |
680 | } | |
1954d2d0 | 681 | #else |
682 | //__________________________________________________________________ | |
683 | Int_t AliTPCMonitor::ReadDataDATEStream(Int_t /*secid*/) | |
684 | { | |
685 | // Read Data from DATE stream. | |
686 | // Can also be used for DATE file. | |
687 | // In case DATE is not install | |
688 | // this method is dummy | |
689 | ||
690 | AliError("DATE not initialized on this system"); | |
691 | return 11; | |
692 | } | |
48265b32 | 693 | #endif |
694 | ||
ca7b8371 | 695 | Int_t AliTPCMonitor::ReadDataDATESubEventLoop(AliTPCMonitorDateFormat* dateform, Int_t secid) |
48265b32 | 696 | { |
697 | // Loop over DATE Subevents | |
698 | ||
699 | Bool_t exitSubEventLoop = false; | |
ca7b8371 | 700 | Int_t lastrcuid = 0; |
701 | Int_t lasteq = 0; | |
48265b32 | 702 | Int_t start = 1; |
ca7b8371 | 703 | Int_t rcupatch = 0; |
48265b32 | 704 | Char_t* eventPtr = 0; |
705 | UInt_t* eventPtrUI = 0; | |
706 | ||
707 | fChannelIter =0; | |
708 | ||
709 | while(exitSubEventLoop == false) | |
710 | { | |
ca7b8371 | 711 | if(start==1) { dateform->GotoSubEventHeader() ; start=0;} |
712 | else { dateform->GotoNextSubEventHeader(); } | |
713 | if(dateform->IsLastSubEventHeader()) exitSubEventLoop = true; | |
48265b32 | 714 | |
ca7b8371 | 715 | if(fVerb) cout << " next subevent LDC " << (Int_t)dateform->GetSubEventLDC() << endl; |
48265b32 | 716 | |
ca7b8371 | 717 | lasteq = 0 ; |
48265b32 | 718 | Int_t neq = 0 ; |
719 | ||
ca7b8371 | 720 | while(lasteq==0) |
48265b32 | 721 | { |
ca7b8371 | 722 | if(neq ==0){ dateform->GotoFirstEquipment();} |
723 | else { dateform->GotoNextEquipment();} | |
48265b32 | 724 | |
ca7b8371 | 725 | fGdcId = dateform->GetSubEventGDC() ; |
726 | fLdcId = dateform->GetSubEventLDC(); | |
727 | fRunId = dateform->GetEventRunID(); | |
728 | fEqId = dateform->GetEquipmentID(); | |
729 | rcupatch = GetRCUPatch(fRunId, fEqId); | |
730 | lastrcuid = (rcupatch+1000); | |
48265b32 | 731 | neq++; |
732 | ||
733 | if(fLdcIdOld!=fLdcId && fChannelIter!=0) { | |
734 | if(secid==-1) | |
735 | { | |
736 | FillGlobal(GetLastSector()); | |
737 | ResetArrays(); | |
738 | fChannelIter =0; | |
739 | } | |
740 | else | |
741 | { | |
ca7b8371 | 742 | return lastrcuid; |
48265b32 | 743 | } |
744 | } | |
745 | fLdcIdOld = fLdcId ; | |
746 | ||
747 | ||
ca7b8371 | 748 | if(dateform->IsLastEquipment() != false ) lasteq = 1; |
48265b32 | 749 | |
ca7b8371 | 750 | eventPtr = dateform->GetFirstDataPointer(); |
48265b32 | 751 | eventPtrUI = (UInt_t *) eventPtr; |
ca7b8371 | 752 | Int_t payload = dateform->GetPayloadSize(); |
48265b32 | 753 | |
ca7b8371 | 754 | if(fVerb)DumpHeader(dateform); |
48265b32 | 755 | if(fVerb) cout << "Check sector and fEqId " << endl; |
756 | ||
757 | if(fVerb && secid >0 ) | |
758 | { | |
759 | cout << "secid : "<< secid << " fEqId "<< fEqId << " equipment 0 form map " << endl; | |
760 | cout << fMapEqidsSec[secid][0] << endl; | |
761 | cout << " showed map_eqids " << endl; | |
762 | } | |
763 | ||
764 | if(CheckEqId(secid,fEqId)) | |
765 | { | |
766 | if(fVerb) cout << " init altro " << endl; | |
767 | AliTPCMonitorAltro* altro = new AliTPCMonitorAltro((UInt_t *)eventPtrUI,(payload/4),1); | |
768 | altro->SetWrite10Bit(GetWrite10Bit()); | |
769 | altro->SetActFilename(GetFile()); | |
770 | if(fVerb) cout << " allocated 10bit " << endl; | |
771 | altro->Allocate10BitArray(); | |
772 | altro->Decodeto10Bit(fEqId); | |
ca7b8371 | 773 | AliInfo(Form("Process eqid %i , patch %i ",fEqId,rcupatch%6)); |
774 | FillHistsDecode(altro,(rcupatch%6),secid); | |
775 | if(fChannelIter!=0 && secid==-1 ) SetSectorFilled(rcupatch/6); | |
48265b32 | 776 | delete altro; |
777 | }// if(CheckID) | |
778 | }// while last eq | |
ca7b8371 | 779 | SetLastSector(rcupatch/6); |
48265b32 | 780 | } |
781 | if(fChannelIter!=0 && secid==-1){ FillGlobal(GetLastSector()); } | |
ca7b8371 | 782 | return lastrcuid; |
48265b32 | 783 | |
784 | } | |
785 | //__________________________________________________________________ | |
786 | Int_t AliTPCMonitor::ReadDataROOT(Int_t secid) | |
787 | { | |
788 | // Read in data in ROOT format | |
789 | if(fReaderDATE){ delete fReaderDATE ; fReaderDATE=0;} | |
790 | fChannelIter =0; | |
ca7b8371 | 791 | Int_t lastrcuid = 0; |
792 | Int_t rcupatch = 0; | |
48265b32 | 793 | Int_t equipmentSize = 0; |
794 | UChar_t* eventPtr = 0 ; | |
795 | UInt_t* eventPtrUI = 0 ; | |
796 | Int_t evtype = 0; | |
797 | ||
798 | if(fReaderROOT==0 || ( fReaderROOT!=0 && (strcmp(GetLastProcFile(),GetFile())!=0) ) ) | |
ca7b8371 | 799 | { |
48265b32 | 800 | if(fVerb) cout << "AliTPCMonitor::ReadDataROOT create new reader " << endl; |
801 | if(fReaderROOT) { delete fReaderROOT ; fReaderROOT=0; } | |
ca7b8371 | 802 | fReaderROOT = new AliRawReaderRoot(GetFile()); |
48265b32 | 803 | if(!fReaderROOT) { AliError("Could not initiate AliRawReaderRoo "); return 10;} |
804 | fEventNumber=0; | |
805 | } | |
806 | ||
807 | // reset to beginning of the event | |
808 | fReaderROOT->Reset(); | |
809 | ||
810 | // Rewind event if new event number is smaller than old one | |
811 | if(fEventNumberOld>fEventNumber) fReaderROOT->RewindEvents(); | |
812 | ||
813 | while(GetProcNextEvent() || fEventNumber==0) | |
814 | { | |
815 | if(fVerb) cout << "AliTPCMonitor::ReadDataROOT get event " << endl; | |
816 | if(!fReaderROOT->NextEvent()) { AliError("Could not get next Event"); return 11 ;} | |
ca7b8371 | 817 | Int_t currentev = *(fReaderROOT->GetEventId()); |
48265b32 | 818 | |
ca7b8371 | 819 | if(fEventNumber <= currentev ){ break; } |
48265b32 | 820 | } |
821 | ||
822 | fEventNumber = *(fReaderROOT->GetEventId()); | |
823 | fEventNumberOld = *(fReaderROOT->GetEventId()); | |
824 | ||
825 | ResetHistos() ; | |
826 | ||
827 | while(fReaderROOT->ReadHeader()) | |
828 | { | |
829 | if(fVerb) cout << "AliTPCMonitor::ReadDataROOT read header " << endl; | |
830 | fGdcId = fReaderROOT->GetGDCId() ; | |
831 | fLdcId = fReaderROOT->GetLDCId() ; | |
832 | fRunId = fReaderROOT->GetRunNumber() ; | |
833 | equipmentSize = fReaderROOT->GetEquipmentSize(); | |
834 | fEqId = fReaderROOT->GetEquipmentId(); | |
835 | evtype = fReaderROOT->GetType(); | |
ca7b8371 | 836 | rcupatch = GetRCUPatch(fRunId, fEqId); |
837 | lastrcuid = (rcupatch+1000); | |
48265b32 | 838 | |
839 | if(evtype==1) { AliWarning(Form("EventType==1 in event %i ",fEventNumber)); return 10; } | |
840 | if(equipmentSize==0) { AliWarning(Form("Equipmentsize ==0 in event %i ",fEventNumber)); return 10; } | |
841 | ||
842 | if(fVerb) DumpHeader(fReaderROOT); | |
843 | ||
844 | if(fLdcIdOld!=fLdcId && fChannelIter!=0) { | |
845 | if(secid==-1) | |
846 | { | |
847 | FillGlobal(GetLastSector()); | |
848 | ResetArrays(); | |
849 | fChannelIter =0; | |
850 | } | |
851 | else | |
852 | { | |
ca7b8371 | 853 | return lastrcuid; |
48265b32 | 854 | } |
855 | } | |
856 | fLdcIdOld = fLdcId ; | |
857 | ||
858 | if(CheckEqId(secid,fEqId)) | |
859 | { | |
860 | fReaderROOT->ReadNextData(eventPtr); | |
861 | eventPtrUI = (UInt_t *) eventPtr; | |
862 | Int_t offset = 16; | |
863 | Int_t fsize = (Int_t)((equipmentSize/4) -offset) +1; | |
864 | AliTPCMonitorAltro* altro = new AliTPCMonitorAltro((UInt_t *)eventPtrUI,fsize,2); | |
865 | altro->SetWrite10Bit(GetWrite10Bit()); | |
866 | if(fVerb) cout << "AliTPCMonitor::ReadDataROOT Set Write10bit to " << GetWrite10Bit() << endl; | |
867 | altro->SetActFilename(GetFile()); | |
868 | altro->Allocate10BitArray(); | |
869 | altro->Decodeto10Bit(fEqId); | |
ca7b8371 | 870 | AliInfo(Form("Process sector %i eqid %i , patch %i ",rcupatch/6,fEqId,rcupatch%6)); |
871 | FillHistsDecode(altro,(rcupatch%6),secid); | |
872 | if(fChannelIter!=0 && secid==-1 ) SetSectorFilled(rcupatch/6); | |
48265b32 | 873 | delete altro; |
874 | } | |
ca7b8371 | 875 | SetLastSector(rcupatch/6); |
48265b32 | 876 | } |
877 | if(fChannelIter!=0 && secid==-1) { FillGlobal(GetLastSector()); } | |
ca7b8371 | 878 | return lastrcuid; |
48265b32 | 879 | } |
880 | ||
881 | ||
882 | //____________________________________________________________________________ | |
ca7b8371 | 883 | void AliTPCMonitor::FillHistsDecode(AliTPCMonitorAltro* altro ,Int_t rcupatch, Int_t secid) |
48265b32 | 884 | { |
885 | // Decode Channels, calculate base mean and rms depending on the | |
886 | // value of secid (see ProcessEvent) and fill histograms | |
887 | ||
888 | ||
ca7b8371 | 889 | if(fVerb) cout << "FillHistsDecode : rcupatch " << rcupatch << " id " << secid << endl; |
890 | Int_t timestamp = 0; | |
891 | Int_t sampleiter = 0; | |
892 | Int_t samplelength = 0; | |
893 | Int_t samplebins = 0; | |
48265b32 | 894 | Float_t max = 0; |
ca7b8371 | 895 | Float_t maxx = 0; |
48265b32 | 896 | Float_t sum = 0.0; |
897 | Int_t sumn = 0; | |
ca7b8371 | 898 | Int_t blockpos = 0; |
48265b32 | 899 | Int_t hw = 0; |
900 | Int_t nwords = 0; | |
901 | Int_t nextHwAddress = 0; | |
902 | Int_t ntime = 0; | |
903 | Int_t adc = 0; | |
904 | Int_t nextpos = 0; | |
905 | Int_t lastpos = altro->Get10BitArraySize()-1; | |
906 | Short_t* entries = altro->Get10BitArray(); | |
ca7b8371 | 907 | Double_t hrms = 0.0; |
908 | Double_t hmean = 0.0; | |
48265b32 | 909 | Int_t supnextpos = 0; |
910 | TH1D* hbase = new TH1D("hbase","hbase",GetTimeBins(),0.5,(GetTimeBins()+0.5)); | |
911 | ||
912 | while(lastpos>0) | |
913 | { | |
914 | nextpos = altro->DecodeTrailer(lastpos); | |
915 | supnextpos = altro->GetNextTrailerPos(); | |
916 | if(nextpos==-1) { break; } | |
917 | ||
918 | lastpos = nextpos; | |
ca7b8371 | 919 | blockpos = altro->GetTrailerBlockPos(); |
48265b32 | 920 | hw = altro->GetTrailerHwAddress(); |
921 | nwords = altro->GetTrailerNWords(); | |
ca7b8371 | 922 | nextHwAddress = ( hw + (rcupatch<<12) ); |
48265b32 | 923 | fPad[fChannelIter][0] = nextHwAddress ; |
924 | ||
925 | if(fPadMapHw[nextHwAddress]!=-1 ) | |
926 | { | |
927 | //Int_t hw_before1 = fPad[fChannelIter-2][0]; | |
928 | //Int_t hw_before2 = fPad[fChannelIter-3][0]; | |
929 | ||
930 | if(fVerb){ cout <<"\n //// Ambiguous hwaddress " << nextHwAddress << " write 10bit files and check file for eqid : " << fEqId << " /////// " << endl;} | |
931 | ||
932 | if( TMath::Abs(fPadMapRCU[nextHwAddress][4] - fChannelIter)==1) | |
933 | { | |
934 | if(fVerb) cout << "//// Difference to previous channel==1 : reset branch bit of hw from last channel to 1 " << endl; | |
935 | Int_t hwreset = (nextHwAddress + (1<<11)); | |
936 | fPad[fChannelIter-1][0] = hwreset; | |
937 | ||
938 | fPadMapHw[hwreset] = fChannelIter-1 ; | |
ca7b8371 | 939 | fPadMapRCU[hwreset][0]= rcupatch ; |
48265b32 | 940 | fPadMapRCU[hwreset][1]= ((hwreset & AliTPCMonitorAltro::GetHwMaskBranch()) >> 11); |
941 | fPadMapRCU[hwreset][2]= ((hwreset & AliTPCMonitorAltro::GetHwMaskFEC()) >>7 ); | |
942 | fPadMapRCU[hwreset][3]= ( hwreset & AliTPCMonitorAltro::GetHwMaskFECChannel() ); | |
943 | fPadMapRCU[hwreset][4]= fChannelIter-1; | |
944 | fPadMapRCU[hwreset][5]= altro->GetTrailerPos(); | |
945 | } | |
946 | } | |
947 | ||
948 | fPadMapHw[nextHwAddress] = fChannelIter ; | |
ca7b8371 | 949 | fPadMapRCU[nextHwAddress][0]= rcupatch ; |
48265b32 | 950 | fPadMapRCU[nextHwAddress][1]= ((nextHwAddress & AliTPCMonitorAltro::GetHwMaskBranch())>> 11) ; |
951 | fPadMapRCU[nextHwAddress][2]= ((nextHwAddress & AliTPCMonitorAltro::GetHwMaskFEC()) >>7); | |
952 | fPadMapRCU[nextHwAddress][3]= (nextHwAddress & AliTPCMonitorAltro::GetHwMaskFECChannel()); | |
953 | fPadMapRCU[nextHwAddress][4]= fChannelIter; | |
954 | fPadMapRCU[nextHwAddress][5]= altro->GetTrailerPos(); | |
955 | ||
ca7b8371 | 956 | timestamp = 0; |
957 | sampleiter = 0; | |
958 | samplelength = 0; | |
959 | samplebins = 0; | |
48265b32 | 960 | |
961 | max = 0.0; | |
ca7b8371 | 962 | maxx = 0.0; |
48265b32 | 963 | sum = 0.0; |
964 | sumn = 0; | |
965 | ||
966 | hbase->Reset(); | |
967 | ||
ca7b8371 | 968 | for(Int_t iterwords = 0 ; iterwords< nwords ; iterwords++) |
48265b32 | 969 | { |
ca7b8371 | 970 | if(entries[blockpos-iterwords]==682) { continue; } |
971 | if(entries[blockpos-iterwords]!=682 && sampleiter==0) | |
48265b32 | 972 | { |
ca7b8371 | 973 | samplelength = entries[blockpos-iterwords]; |
974 | sampleiter = samplelength; | |
975 | samplebins = 0; | |
976 | timestamp = entries[blockpos-iterwords-1]; | |
977 | iterwords++; | |
48265b32 | 978 | } |
979 | else | |
980 | { | |
ca7b8371 | 981 | ntime = timestamp-samplebins; |
982 | adc = entries[blockpos-iterwords]; | |
48265b32 | 983 | fPad[fChannelIter][ntime] = adc; |
984 | if( (adc!=0) && (ntime>=GetRangeBaseMin() ) && (ntime<GetRangeBaseMax() )) {hbase->Fill(adc) ;} | |
ca7b8371 | 985 | if( (adc>max) && (ntime>=GetRangeMaxAdcMin()) && (ntime<GetRangeMaxAdcMax() )) {max = adc;maxx = ntime ;} |
48265b32 | 986 | if( (ntime>=GetRangeSumMin()) && (ntime<GetRangeSumMax() )) {sum+=adc; sumn++;} |
ca7b8371 | 987 | samplebins++; |
48265b32 | 988 | } |
989 | } | |
990 | ||
ca7b8371 | 991 | hmean = hbase->GetMean(); |
992 | hbase->GetXaxis()->SetRangeUser(hmean- hmean/3 , hmean + hmean/3); | |
993 | hmean = hbase->GetMean(); | |
994 | hrms = hbase->GetRMS(); | |
48265b32 | 995 | |
ca7b8371 | 996 | if( GetPedestals()==1) fHistAddrMaxAdc->SetBinContent( nextHwAddress,max- hmean); |
48265b32 | 997 | else fHistAddrMaxAdc->SetBinContent( nextHwAddress,max ); |
998 | ||
999 | if(secid!=-1) | |
1000 | { | |
ca7b8371 | 1001 | if(rcupatch<2) |
48265b32 | 1002 | { |
ca7b8371 | 1003 | fHistDistrBase2dIROC->Fill(hmean,hrms); |
48265b32 | 1004 | fHistDistrSumIROC->Fill(sum); |
ca7b8371 | 1005 | if( GetPedestals()==1 ) { fHistDistrMaxIROC->Fill(max-hmean); fHistDistrSumIROC->Fill(sum -sumn*hmean);} |
48265b32 | 1006 | else { fHistDistrMaxIROC->Fill(max); fHistDistrSumIROC->Fill(sum );} |
1007 | } | |
1008 | else | |
1009 | { | |
ca7b8371 | 1010 | fHistDistrBase2dOROC->Fill(hmean,hrms); |
48265b32 | 1011 | fHistDistrSumOROC->Fill(sum); |
ca7b8371 | 1012 | if( GetPedestals()==1 ){ fHistDistrMaxOROC->Fill(max-hmean); fHistDistrSumOROC->Fill(sum -sumn*hmean);} |
48265b32 | 1013 | else { fHistDistrMaxOROC->Fill(max); fHistDistrSumOROC->Fill(sum) ;} |
1014 | } | |
1015 | ||
1016 | fHistAddrAdcSum->SetBinContent( nextHwAddress,sum); | |
1017 | fHistAddrMapIndex->SetBinContent(nextHwAddress,fChannelIter); | |
ca7b8371 | 1018 | fHistAddrBaseMean->SetBinContent(nextHwAddress,hmean); |
1019 | fHistAddrMaxAdcX->SetBinContent( nextHwAddress,maxx); | |
1020 | fHistAddrBaseRms->SetBinContent( nextHwAddress,hrms); | |
48265b32 | 1021 | } |
1022 | fChannelIter++; | |
1023 | if(nextpos<0) { AliError("Error : next pos < 0 "); break ;} | |
1024 | } | |
1025 | delete hbase; | |
1026 | return ; | |
1027 | } | |
1028 | ||
1029 | ||
1030 | //____________________________________________________________________________ | |
1031 | void AliTPCMonitor::FillHistsPadPlane() | |
1032 | { | |
1033 | // Fill 2Dim histograms for IROC and OROC (max , rms and sum) | |
1034 | ||
1035 | if(fVerb)cout << "AliTPCMonitor::FillHistsPadPlane() Start " << endl; | |
1036 | if(fVerb)PrintConfig(); | |
1037 | ||
1038 | Int_t pad = 0; | |
1039 | Int_t row = 0; | |
1040 | Int_t padmax = 0; | |
1041 | Int_t hwadd = 0; | |
1042 | ||
1043 | for(Int_t ch = 0; ch<fChannelIter; ch++) | |
1044 | { | |
1045 | hwadd= fPad[ch][0]; | |
1046 | fHistChannelTime->SetCellContent(ch,0,hwadd); | |
1047 | ||
1048 | for(Int_t bin = 1; bin <GetTimeBins(); bin++) | |
1049 | { | |
1050 | if( fHistChannelTime->GetCellContent(ch,bin)!=0) cout << " cellcontent already set " << endl; | |
1051 | if( GetPedestals()==1 ) fHistChannelTime->SetCellContent(ch,bin,(fPad[ch][bin]- fHistAddrBaseMean->GetBinContent(hwadd))); | |
1052 | else fHistChannelTime->SetCellContent(ch,bin,(fPad[ch][bin])); | |
1053 | } | |
1054 | ||
1055 | pad = fMapHand->GetPad( hwadd); | |
1056 | row = fMapHand->GetPadRow(hwadd); | |
1057 | padmax = fMapHand->GetNumofPads(row); | |
1058 | ||
1059 | if(row<63) | |
1060 | { | |
1061 | fHistIROC->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrMaxAdc->GetBinContent( hwadd)); | |
1062 | fHistIROCIndex->SetCellContent(row +1 ,pad +55 -padmax/2 +1,ch); | |
1063 | fHistIROCRMS->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrBaseRms->GetBinContent( hwadd)); | |
1064 | fHistIROCBASE->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrBaseMean->GetBinContent(hwadd)); | |
1065 | fHistIROCSUM->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrAdcSum->GetBinContent( hwadd)); | |
1066 | } | |
1067 | else | |
1068 | { | |
1069 | fHistOROC->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrMaxAdc->GetBinContent( hwadd)); | |
1070 | fHistOROCIndex->SetCellContent(row-63 +1 ,pad +70 -padmax/2 +1,ch); | |
1071 | fHistOROCRMS->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrBaseRms->GetBinContent( hwadd)); | |
1072 | fHistOROCBASE->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrBaseMean->GetBinContent(hwadd)); | |
1073 | fHistOROCSUM->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrAdcSum->GetBinContent( hwadd)); | |
1074 | } | |
1075 | } | |
1076 | ||
1077 | fHistChannelTime->GetXaxis()->SetRange(0,fChannelIter); | |
1078 | fHistChannelTime->GetYaxis()->SetRange(0,GetTimeBins()); | |
1079 | } | |
1080 | ||
1081 | ||
1082 | ||
1083 | //____________________________________________________________________________ | |
1084 | void AliTPCMonitor::ResetArrays() | |
1085 | { | |
1086 | // Reset data arrays | |
ca7b8371 | 1087 | for(Int_t row = 0 ; row < fkNRowsIroc; row++) |
48265b32 | 1088 | { |
ca7b8371 | 1089 | for(Int_t pad = 0 ; pad < fkNPadsIroc ; pad++) |
48265b32 | 1090 | { |
1091 | fHistIROCIndex->SetCellContent(row+1,pad+1,-1); | |
1092 | } | |
1093 | } | |
ca7b8371 | 1094 | for(Int_t row = 0 ; row < fkNRowsOroc; row++) |
48265b32 | 1095 | { |
ca7b8371 | 1096 | for(Int_t pad = 0 ; pad < fkNPadsOroc ; pad++) |
48265b32 | 1097 | { |
1098 | fHistOROCIndex->SetCellContent(row+1,pad+1,-1); | |
1099 | } | |
1100 | } | |
1101 | ||
1102 | for(Int_t ch= 0; ch<GetMaxHwAddr(); ch++) | |
1103 | { | |
1104 | fHistAddrMaxAdcX->SetBinContent(ch,-1); | |
1105 | fHistAddrMapIndex->SetBinContent(ch,-1); | |
1106 | fHistAddrMaxAdc->SetBinContent( ch, 0); | |
1107 | fHistAddrBaseMean->SetBinContent( ch, 0); | |
1108 | fHistAddrAdcSum->SetBinContent( ch, 0); | |
1109 | fHistAddrBaseRms->SetBinContent(ch, 0); | |
1110 | } | |
1111 | ||
1112 | for(Int_t ch = 0; ch< GetNumOfChannels(); ch++) | |
1113 | { | |
1114 | for(Int_t bin = 0; bin< GetTimeBins(); bin++) | |
1115 | { | |
1116 | fPad[ch][bin] = 0; | |
1117 | } | |
1118 | } | |
1119 | for(Int_t ch = 0; ch< GetMaxHwAddr(); ch++) | |
1120 | { | |
1121 | fPadMapHw[ch]=-1; | |
1122 | fPadMapRCU[ch][0]=-1; | |
1123 | fPadMapRCU[ch][1]=-1; | |
1124 | fPadMapRCU[ch][2]=-1; | |
1125 | fPadMapRCU[ch][3]=-1; | |
1126 | fPadMapRCU[ch][4]=-1; | |
1127 | fPadMapRCU[ch][5]=-1; | |
1128 | } | |
1129 | fPadUsedHwAddr=-1; | |
1130 | } | |
1131 | ||
1132 | ||
1133 | //____________________________________________________________________________ | |
1134 | void AliTPCMonitor::ResetHistos() | |
1135 | { | |
1136 | // Reset all but | |
1137 | for(Int_t i =0; i<fHistList->GetEntries(); i++) | |
1138 | { | |
1139 | if(GetProcNextEvent()==0 && strcmp(((TH1*)fHistList->At(i))->GetName(),"SIDE A")==0) continue; | |
1140 | if(GetProcNextEvent()==0 && strcmp(((TH1*)fHistList->At(i))->GetName(),"SIDE C")==0) continue; | |
1141 | ((TH1*)fHistList->At(i))->Reset(); | |
1142 | } | |
1143 | ResetArrays(); | |
1144 | } | |
1145 | ||
1146 | //____________________________________________________________________________ | |
1147 | void AliTPCMonitor::DeleteHistos() | |
1148 | { | |
1149 | // Delete histograms | |
1150 | for(Int_t i =0; i<fHistList->GetEntries(); i++) | |
1151 | { | |
1152 | delete (TH1*)fHistList->At(i); | |
1153 | } | |
1154 | } | |
1155 | ||
1156 | ||
1157 | //__________________________________________________________________ | |
1158 | Int_t AliTPCMonitor::CheckEqId(Int_t secid,Int_t eqid) | |
1159 | { | |
1160 | // Check if equipment id corresponds to any rcu patch in sector | |
1161 | // Equipment ids changed during commisioning in 2006 (starting from run 704) | |
1162 | // However Runids started from 0 again in 2007 | |
1163 | // Now only runids from commissioning in 2006 after runid 704 and all new ones are supported. | |
1164 | // Comment in equipment check for runids < 704 if old runs should be processed | |
1165 | ||
1166 | if(fVerb) cout << "AliTPCMonitor::CheckEqId : SectorId " << secid << " EquipmentId " << eqid << " runid " << fRunId << endl; | |
1167 | Int_t passed =1; | |
1168 | if(fRunId<704 && 0) // commented out --> runs with runid < 704 in 2006 are not recognized anymore | |
1169 | { | |
1170 | if( (secid>-1) && (secid<36) ) // if ( secid is in range) { take only specific eqids} else { take all } | |
1171 | { | |
1172 | if( (secid==13) && ( eqid!=408 && eqid!=409 && eqid!=509 && eqid!=512 && eqid!=513 && eqid!=517 )) {passed=0;} | |
1173 | else if( (secid==4) && ( eqid!=404 && eqid!=504 && eqid!=407 && eqid!=503 && eqid!=508 && eqid!=506 )) {passed=0;} | |
1174 | } | |
1175 | else {if(fVerb) cout << "passed check "<< endl; } | |
1176 | } | |
1177 | else | |
1178 | { | |
1179 | if( (secid>-1) && (secid<36) ) // if ( secid is in range) { take only specific eqids} else { take all } | |
1180 | { | |
1181 | if(eqid!=fMapEqidsSec[secid][0] && eqid!= fMapEqidsSec[secid][1] && eqid!=fMapEqidsSec[secid][2] && | |
1182 | eqid!=fMapEqidsSec[secid][3] && eqid!= fMapEqidsSec[secid][4] && eqid!=fMapEqidsSec[secid][5] ) {passed=0;} | |
1183 | } | |
1184 | else {if(fVerb) cout << "passed check "<< endl;} | |
1185 | } | |
1186 | return passed; | |
1187 | } | |
1188 | ||
1189 | //__________________________________________________________________ | |
1190 | void AliTPCMonitor::SetEqIds() | |
1191 | { | |
1192 | // Set mapping for equipment ids | |
1193 | for(Int_t i = 0; i<36 ; i++) | |
1194 | { | |
1195 | for(Int_t j = 0; j<6; j++) | |
1196 | { | |
1197 | if(j<2) fMapEqidsSec[i][j]= 768+i*2+j; | |
1198 | else fMapEqidsSec[i][j]= 840+i*4+j-2; | |
1199 | } | |
1200 | } | |
1201 | ||
1202 | for(Int_t i = 0; i<36 ; i++) | |
1203 | { | |
1204 | for(Int_t j = 0; j<6; j++) | |
1205 | { | |
1206 | if(j<2) fMapEqidsRcu[768+i*2+j] = i*6 +j; | |
1207 | else fMapEqidsRcu[840+i*4+j-2] = i*6 +j; | |
1208 | } | |
1209 | } | |
1210 | } | |
1211 | ||
1212 | //__________________________________________________________________ | |
1213 | void AliTPCMonitor::FillGlobal(Int_t sector) | |
1214 | { | |
1215 | ||
1216 | // Fill global histograms with max adc for each channel | |
1217 | ||
1218 | TH2S* hglob =0; | |
1219 | if((sector/18) ==0) hglob = fHistGlobalMaxA; | |
1220 | else hglob = fHistGlobalMaxC; | |
1221 | ||
1222 | Float_t rotsec = (2*TMath::Pi()/18.0); | |
1223 | Float_t rot = (-rotsec*(sector%18) +4*rotsec); | |
1224 | ||
1225 | Float_t m11 = TMath::Cos(rot); | |
1226 | Float_t m12 = TMath::Sin(rot); | |
1227 | Float_t m21 = -1*TMath::Sin(rot); | |
1228 | Float_t m22 = TMath::Cos(rot); | |
1229 | ||
1230 | Int_t max = 0; // use integer for global view | |
1231 | ||
1232 | Double_t xval = 0.0; | |
1233 | Double_t yval = 0.0; | |
1234 | ||
1235 | Int_t pad = 0; | |
1236 | Int_t row = 0; | |
1237 | Int_t padmax = 0; | |
1238 | ||
1239 | Float_t xdr = 0; | |
1240 | Float_t ydr = 0; | |
1241 | ||
1242 | for(Int_t hw = 0; hw<fHistAddrMaxAdc->GetNbinsX(); hw++) | |
1243 | { | |
1244 | max = (Int_t)fHistAddrMaxAdc->GetBinContent(hw); | |
1245 | if(max!=-1) | |
1246 | { | |
1247 | pad = fMapHand->GetPad( hw); | |
1248 | row = fMapHand->GetPadRow(hw); | |
1249 | padmax = fMapHand->GetNumofPads(row); | |
1250 | GetXY(xval ,yval , padmax,row ,pad); | |
1251 | xdr = xval*m11 +yval*m12; | |
1252 | ydr = xval*m21 +yval*m22; | |
1253 | if(hglob->GetBinContent(hglob->GetXaxis()->FindBin(xdr),hglob->GetYaxis()->FindBin(ydr))==0) hglob->Fill(xdr,ydr,(Int_t)max); | |
1254 | } | |
1255 | } | |
1256 | } | |
1257 | ||
1258 | ||
1259 | //__________________________________________________________________ | |
ca7b8371 | 1260 | void AliTPCMonitor::GetXY( Double_t& xval , Double_t& yval , Int_t padmax, Int_t row , Int_t pad) const |
48265b32 | 1261 | { |
1262 | // Get x and y position of pad | |
1263 | ||
1264 | if(row<63) | |
1265 | { | |
1266 | xval = fMirror*( 2*padmax -4*pad -2); | |
1267 | yval = 852.25 +7.5*row; | |
1268 | } | |
1269 | else | |
1270 | { | |
1271 | xval = fMirror*( 3*padmax -6*pad -3); | |
1272 | if((row-63)<63) { yval = 10*(row-63) +1351; } | |
1273 | else { yval = 15*(row-63-64)+1993.5; } | |
1274 | } | |
1275 | ||
1276 | } | |
1277 | ||
1278 | //__________________________________________________________________ | |
ca7b8371 | 1279 | Int_t AliTPCMonitor::GetPadAtX(Float_t xval, Int_t row, Int_t padmax) const |
48265b32 | 1280 | { |
1281 | // Get pad number at given position in x | |
1282 | Int_t pad = 0; | |
1283 | ||
1284 | if(row<63) {pad = (Int_t)( ( (xval/fMirror) +2 -2*padmax)/-4);} | |
1285 | else {pad = (Int_t)( ( (xval/fMirror) +3 -3*padmax)/-6);} | |
1286 | ||
1287 | if(pad>=padmax) return -1; | |
1288 | else return pad ; | |
1289 | ||
1290 | } | |
1291 | ||
1292 | //__________________________________________________________________ | |
ca7b8371 | 1293 | Int_t AliTPCMonitor::GetPadAtX(Float_t xval, Int_t row) const |
48265b32 | 1294 | { |
1295 | ||
1296 | // Get pad number at given position in x | |
1297 | ||
1298 | Int_t padmax = fMapHand->GetNumofPads(row); | |
1299 | Int_t pad = 0; | |
1300 | ||
1301 | if(row<63) {pad = (Int_t)( ( (xval/fMirror) +2 -2*padmax)/-4);} | |
1302 | else {pad = (Int_t)( ( (xval/fMirror) +3 -3*padmax)/-6);} | |
1303 | ||
1304 | if(pad>=padmax) return -1; | |
1305 | else return pad ; | |
1306 | ||
1307 | } | |
1308 | ||
1309 | //__________________________________________________________________ | |
1310 | void AliTPCMonitor::DrawHists(Int_t histos) | |
1311 | { | |
1312 | ||
1313 | // Draw sets of histograms | |
1314 | // histos==1 : 2Dim histos for MAX adc and add executables | |
1315 | // histos==2 : distributions max/rms/sum | |
1316 | // histos==3 : global max adc for specified SideA/C | |
1317 | ||
1318 | ||
1319 | if(fVerb) cout << " Draw histos " << endl; | |
1320 | Char_t cside[10]; | |
1321 | if(GetLastSector()/18==0 ) sprintf(cside,"A"); | |
1322 | else sprintf(cside,"C"); | |
1323 | ||
1324 | Char_t titleSEC[256]; sprintf(titleSEC ,"Sector %i Side %s Run : %05i EventID %i " ,GetLastSector()%18,cside,fRunId, fEventNumber); | |
1325 | Char_t titleEvent[256]; sprintf(titleEvent ,"Time <-> Channles %s" ,titleSEC); | |
1326 | Char_t titleIROC[256]; sprintf(titleIROC ,"IROC %s" ,titleSEC); | |
1327 | Char_t titleOROC[256]; sprintf(titleOROC ,"OROC %s" ,titleSEC); | |
1328 | ||
1329 | Char_t titleMAX[256]; sprintf(titleMAX ,"Max (timebin: %i,%i) %s" ,GetRangeMaxAdcMin(),GetRangeMaxAdcMax(),titleSEC); | |
1330 | Char_t titleSUM[256]; sprintf(titleSUM ,"Sum (timebin: %i,%i) %s" ,GetRangeSumMin() ,GetRangeSumMax() ,titleSEC); | |
1331 | Char_t titleBASE[256]; sprintf(titleBASE ,"Baseline RMS<->Mean (timebin: %i-%i) %s" ,GetRangeBaseMin() ,GetRangeBaseMax() ,titleSEC); | |
1332 | Char_t titleMEAN[256]; sprintf(titleMEAN ,"Baseline Mean (timebin: %i-%i) %s" ,GetRangeBaseMin() ,GetRangeBaseMax() ,titleSEC); | |
1333 | Char_t titleRMS[256] ; sprintf(titleRMS ,"Baseline RMS (timebin: %i-%i) %s" ,GetRangeBaseMin() ,GetRangeBaseMax() ,titleSEC); | |
1334 | ||
1335 | if(histos==1) | |
1336 | { | |
1337 | // IROC _______________________________________________________________ | |
1338 | TCanvas* ciroc = 0; | |
1339 | ciroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("ciroc"); | |
1340 | if(!ciroc) | |
1341 | { | |
1342 | ciroc = CreateCanvas("ciroc"); | |
1343 | fExecPlaneMax=0; | |
1344 | } | |
1345 | ciroc->cd(); | |
1346 | ||
1347 | fHistIROC->SetXTitle("row"); | |
1348 | fHistIROC->SetYTitle("pad"); | |
1349 | if(GetPedestals()) fHistIROC->SetZTitle("max ADC (baseline sub)"); | |
1350 | else fHistIROC->SetZTitle("max ADC "); | |
1351 | fHistIROC->SetTitle(titleIROC); | |
1352 | fHistIROC->SetMinimum(0.01); | |
1353 | fHistIROC->Draw("COLZ"); | |
1354 | ciroc->UseCurrentStyle(); | |
1355 | ||
1356 | ||
1357 | fHistIROCTime->SetXTitle("row"); fHistIROCTime->SetZTitle("peak time (fit)"); fHistIROCTime->SetYTitle("pad"); fHistIROCTime->SetTitle(titleIROC); | |
1358 | fHistIROCRMS->SetXTitle("row"); fHistIROCRMS->SetZTitle( "baseline rms (ADC)"); fHistIROCRMS->SetYTitle("pad"); fHistIROCRMS->SetTitle(titleIROC); | |
1359 | ||
1360 | // OROC | |
1361 | TCanvas* coroc = 0; | |
1362 | coroc =(TCanvas*)gROOT->GetListOfCanvases()->FindObject("coroc"); | |
1363 | if(!coroc) { | |
1364 | coroc = CreateCanvas("coroc"); | |
1365 | fExecPlaneMax=0; | |
1366 | } | |
1367 | coroc->cd(); | |
1368 | ||
1369 | fHistOROC->SetXTitle("row"); | |
1370 | fHistOROC->SetYTitle("pad"); | |
1371 | if(GetPedestals()) fHistOROC->SetZTitle("max ADC (baseline sub)"); | |
1372 | else fHistOROC->SetZTitle("max ADC "); | |
1373 | fHistOROC->SetTitle(titleOROC); | |
1374 | fHistOROC->SetMinimum(0.01); | |
1375 | fHistOROC->Draw("COLZ"); | |
1376 | coroc->UseCurrentStyle(); | |
1377 | ||
1378 | ||
1379 | fHistOROCTime->SetXTitle("row"); fHistOROCTime->SetZTitle("peak time (fit) (timebins)"); fHistOROCTime->SetYTitle("pad"); fHistOROCTime->SetTitle(titleOROC); | |
1380 | fHistOROCRMS->SetXTitle("row"); fHistOROCRMS->SetZTitle("baseline rms (ADC)"); fHistOROCRMS->SetYTitle("pad"); fHistOROCRMS->SetTitle(titleOROC); | |
1381 | ||
1382 | // SUM | |
ca7b8371 | 1383 | Char_t namesum[256] ; sprintf(namesum,"ADC sum (bins: %i, %i)",GetRangeSumMin() ,GetRangeSumMax() ); |
1384 | fHistIROCSUM->SetXTitle("row"); fHistIROCSUM->SetZTitle(namesum); fHistIROCSUM->SetYTitle("pad"); fHistIROCSUM->SetTitle(titleIROC); | |
1385 | fHistOROCSUM->SetXTitle("row"); fHistOROCSUM->SetZTitle(namesum); fHistOROCSUM->SetYTitle("pad"); fHistOROCSUM->SetTitle(titleOROC); | |
48265b32 | 1386 | |
1387 | // BASE | |
ca7b8371 | 1388 | Char_t namebase[256] ; sprintf(namebase ,"base mean (timbebin: %i, %i )",GetRangeBaseMin(),GetRangeBaseMax()); |
1389 | fHistIROCBASE->SetXTitle("row"); fHistIROCBASE->SetZTitle(namebase); fHistIROCBASE->SetYTitle("pad"); fHistIROCBASE->SetTitle(titleIROC); | |
1390 | fHistOROCBASE->SetXTitle("row"); fHistOROCBASE->SetZTitle(namebase); fHistOROCBASE->SetYTitle("pad"); fHistOROCBASE->SetTitle(titleOROC); | |
48265b32 | 1391 | |
1392 | if(fHistIROCClone) fHistIROCClone->Delete(); | |
1393 | if(fHistOROCClone) fHistOROCClone->Delete(); | |
1394 | fHistIROCClone = (TH2F*)fHistIROC->Clone("fHistIROCClone"); | |
1395 | fHistOROCClone = (TH2F*)fHistOROC->Clone("fHistOROCClone"); | |
1396 | ||
1397 | // Executables | |
1398 | if(fExecPlaneMax==0) | |
1399 | { | |
1400 | Char_t carry1[100]; | |
1401 | sprintf(carry1,".x %s/TPC/AliTPCMonitorExec.C(1)",gSystem->Getenv("ALICE_ROOT")); | |
1402 | ciroc->AddExec("pad",carry1); | |
1403 | coroc->AddExec("pad",carry1); | |
1404 | ||
1405 | Char_t carry2[100]; | |
1406 | sprintf(carry2,".x %s/TPC/AliTPCMonitorExec.C(2)",gSystem->Getenv("ALICE_ROOT")); | |
1407 | ciroc->AddExec("row",carry2); | |
1408 | coroc->AddExec("row",carry2); | |
1409 | fExecPlaneMax=1; | |
1410 | } | |
1411 | coroc->Update(); | |
1412 | ciroc->Update(); | |
1413 | } | |
1414 | else if(histos==2) | |
1415 | { | |
1416 | // MAX ADC distribution ____________________________________________ | |
1417 | TCanvas* cmax = 0; | |
1418 | cmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cmax"); | |
1419 | if(!cmax) cmax = CreateCanvas("cmax"); | |
1420 | ||
1421 | cmax->cd(); | |
1422 | fHistDistrMaxIROC->GetXaxis()->SetRangeUser(0.0,1000.0); | |
1423 | fHistDistrMaxIROC->SetXTitle("max ADC (ADC)"); | |
1424 | fHistDistrMaxIROC->SetYTitle("counts"); | |
1425 | fHistDistrMaxIROC->SetTitle(titleMAX); | |
1426 | fHistDistrMaxIROC->Draw(""); | |
1427 | fHistDistrMaxOROC->SetLineColor(2); | |
1428 | fHistDistrMaxOROC->Draw("same"); | |
1429 | ||
1430 | if(fHistDistrMaxOROC->GetMaximum()> fHistDistrMaxIROC->GetMaximum()) fHistDistrMaxIROC->SetMaximum(fHistDistrMaxOROC->GetMaximum()*1.1); | |
1431 | ||
1432 | TLegend* legio = new TLegend(0.6,0.6,0.8,0.8); | |
1433 | legio->SetFillColor(0); | |
1434 | legio->AddEntry(fHistDistrMaxIROC,"IROC","l"); | |
1435 | legio->AddEntry(fHistDistrMaxOROC,"OROC","l"); | |
1436 | legio->Draw("same"); | |
1437 | ||
1438 | // ADC sum distribution | |
1439 | TCanvas* csum = 0; | |
1440 | csum = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("csum"); | |
1441 | if(!csum) csum = CreateCanvas("csum") ; | |
1442 | csum->cd(); | |
1443 | ||
1444 | fHistDistrSumIROC->SetXTitle("sum ADC (ADC)"); | |
1445 | fHistDistrSumIROC->SetYTitle("counts"); | |
1446 | fHistDistrSumIROC->SetTitle(titleSUM); | |
1447 | fHistDistrSumIROC->Draw(""); | |
1448 | fHistDistrSumOROC->SetLineColor(2); | |
1449 | fHistDistrSumOROC->Draw("same"); | |
1450 | if(fHistDistrSumOROC->GetMaximum()> fHistDistrSumIROC->GetMaximum()) fHistDistrSumIROC->SetMaximum(fHistDistrSumOROC->GetMaximum()*1.1); | |
1451 | legio->Draw("same"); | |
1452 | ||
1453 | // BASELINE MEAN distribution | |
1454 | TCanvas* cbasemean = 0; | |
1455 | cbasemean = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cbasemean"); | |
1456 | if(!cbasemean) cbasemean = CreateCanvas("cbasemean"); | |
1457 | cbasemean->cd(); | |
1458 | ||
1459 | fHistDistrBaseMeanIROC = fHistDistrBase2dIROC->ProjectionX("fHistDistrBaseMeanIROC"); | |
1460 | fHistDistrBaseMeanIROC->SetXTitle("base mean (ADC)"); | |
1461 | fHistDistrBaseMeanIROC->SetYTitle("counts"); | |
1462 | fHistDistrBaseMeanIROC->SetTitle(titleMEAN); | |
1463 | fHistDistrBaseMeanIROC->Draw(""); | |
1464 | ||
1465 | fHistDistrBaseMeanOROC = fHistDistrBase2dOROC->ProjectionX("fHistDistrBaseMeanOROC"); | |
1466 | fHistDistrBaseMeanOROC->SetLineColor(2); | |
1467 | fHistDistrBaseMeanOROC->Draw("same"); | |
1468 | if(fHistDistrBaseMeanOROC->GetMaximum()>fHistDistrBaseMeanIROC->GetMaximum()) fHistDistrBaseMeanIROC->SetMaximum(fHistDistrBaseMeanOROC->GetMaximum()*1.1); | |
1469 | legio->Draw("same"); | |
1470 | ||
1471 | TCanvas* cbaserms = 0; | |
1472 | cbaserms = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cbaserms"); | |
1473 | if(!cbaserms) cbaserms = CreateCanvas("cbaserms") ; | |
1474 | cbaserms->cd(); | |
1475 | ||
1476 | // BASELINE RMS distribution | |
1477 | fHistDistrBaseRmsIROC = fHistDistrBase2dIROC->ProjectionY("fHistDistrBaseRmsIROC"); | |
1478 | fHistDistrBaseRmsIROC->SetXTitle("base rms (ADC)"); | |
1479 | fHistDistrBaseRmsIROC->SetYTitle("counts"); | |
1480 | fHistDistrBaseRmsIROC->SetTitle(titleRMS); | |
1481 | fHistDistrBaseRmsIROC->Draw(""); | |
1482 | ||
1483 | fHistDistrBaseRmsOROC = fHistDistrBase2dOROC->ProjectionY("fHistDistrBaseRmsOROC"); | |
1484 | fHistDistrBaseRmsOROC->SetLineColor(2); | |
1485 | fHistDistrBaseRmsOROC->Draw("same"); | |
1486 | if(fHistDistrBaseRmsOROC->GetMaximum()>fHistDistrBaseRmsIROC->GetMaximum()) fHistDistrBaseRmsIROC->SetMaximum(fHistDistrBaseRmsOROC->GetMaximum()*1.1); | |
1487 | legio->Draw("same"); | |
1488 | ||
1489 | cmax->Update(); | |
1490 | csum->Update(); | |
1491 | cbasemean->Update(); | |
1492 | cbaserms->Update(); | |
1493 | } | |
1494 | else if(histos==3) | |
1495 | { | |
1496 | // GLOBAL MAX ADC _________________________________ | |
1497 | if(GetProcNextEvent()==1) | |
1498 | { | |
1499 | TCanvas* cglobA =0; | |
1500 | TCanvas* cglobC =0; | |
1501 | ||
1502 | if(!(cglobC=(TCanvas*)gROOT->GetListOfCanvases()->FindObject("SIDE C all"))) cglobC = CreateCanvas("SIDE C all"); | |
1503 | if(!(cglobA=(TCanvas*)gROOT->GetListOfCanvases()->FindObject("SIDE A all"))) cglobA = CreateCanvas("SIDE A all"); | |
1504 | ||
ca7b8371 | 1505 | Char_t globtitle1[256]; sprintf(globtitle1,"SIDE A Run %05i (EventID %i)",fRunId,fEventNumber); |
1506 | Char_t globtitle2[256]; sprintf(globtitle2,"SIDE C Run %05i (EventID %i)",fRunId,fEventNumber); | |
48265b32 | 1507 | |
ca7b8371 | 1508 | fHistGlobalMaxA->SetTitle(globtitle1); |
1509 | fHistGlobalMaxC->SetTitle(globtitle2); | |
48265b32 | 1510 | fHistGlobalMaxA->SetXTitle("x/mm"); |
1511 | fHistGlobalMaxA->SetYTitle("y/mm"); | |
1512 | fHistGlobalMaxC->SetXTitle("x/mm"); | |
1513 | fHistGlobalMaxC->SetYTitle("y/mm"); | |
1514 | ||
1515 | if(GetPedestals()==0) { fHistGlobalMaxA->SetZTitle("max adc (not baseline sub)"); fHistGlobalMaxC->SetZTitle("max adc (not baseline sub)"); } | |
1516 | else { fHistGlobalMaxA->SetZTitle("max adc "); fHistGlobalMaxC->SetZTitle("max adc "); } | |
1517 | ||
1518 | fHistGlobalMaxA->SetMinimum(0.01); | |
1519 | fHistGlobalMaxC->SetMinimum(0.01); | |
1520 | ||
1521 | cglobC->cd() ; fHistGlobalMaxC->Draw("COLZ"); | |
1522 | cglobA->cd() ; fHistGlobalMaxA->Draw("COLZ"); | |
1523 | ||
ca7b8371 | 1524 | Char_t nameom[256]; |
1525 | sprintf(nameom,".x %s/TPC/AliTPCMonitorExec.C(3)",gSystem->Getenv("ALICE_ROOT")); | |
48265b32 | 1526 | |
1527 | if(fExecGlob==0) | |
1528 | { | |
ca7b8371 | 1529 | if(fVerb)cout << " set exec " << nameom << endl; |
1530 | cglobC->AddExec("glob",nameom); | |
1531 | cglobA->AddExec("glob",nameom); | |
48265b32 | 1532 | fExecGlob = 1; |
1533 | } | |
1534 | else | |
1535 | { | |
1536 | cglobC->DeleteExec("glob"); | |
1537 | cglobA->DeleteExec("glob"); | |
1538 | ||
ca7b8371 | 1539 | if(fVerb) cout << " set exec " << nameom << endl; |
1540 | cglobC->AddExec("glob",nameom); | |
1541 | cglobA->AddExec("glob",nameom); | |
48265b32 | 1542 | |
1543 | } | |
1544 | cglobC->Update(); | |
1545 | cglobA->Update(); | |
1546 | } | |
1547 | ||
1548 | } | |
1549 | } | |
1550 | ||
1551 | ||
1552 | ||
1553 | //__________________________________________________________________ | |
1554 | void AliTPCMonitor::DrawRMSMap() | |
1555 | { | |
1556 | // Draw 2Dim rms histos for IROC and OROC | |
1557 | // and set executables for canvases | |
1558 | ||
1559 | TCanvas* crmsoroc =0; | |
1560 | TCanvas* crmsiroc =0; | |
1561 | if(!(crmsoroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crmsoroc"))) crmsoroc = CreateCanvas("crmsoroc"); | |
1562 | if(!(crmsiroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crmsiroc"))) crmsiroc = CreateCanvas("crmsiroc"); | |
1563 | ||
1564 | crmsiroc->cd(); fHistIROCRMS->Draw("COLZ"); | |
1565 | crmsoroc->cd(); fHistOROCRMS->Draw("COLZ"); | |
1566 | ||
1567 | Char_t carry1[100]; sprintf(carry1,".x %s/TPC/AliTPCMonitorExec.C(1)",gSystem->Getenv("ALICE_ROOT")); | |
1568 | Char_t carry2[100]; sprintf(carry2,".x %s/TPC/AliTPCMonitorExec.C(2)",gSystem->Getenv("ALICE_ROOT")); | |
1569 | ||
1570 | if(fExecPadIrocRms==0) | |
1571 | { | |
1572 | crmsiroc->AddExec("pad",carry1); | |
1573 | crmsiroc->AddExec("row",carry2); | |
1574 | fExecPadIrocRms=1; | |
1575 | } | |
1576 | ||
1577 | if(fExecPadOrocRms==0) | |
1578 | { | |
1579 | crmsoroc->AddExec("pad",carry1); | |
1580 | crmsoroc->AddExec("row",carry2); | |
1581 | fExecPadOrocRms=1; | |
1582 | } | |
1583 | ||
1584 | crmsiroc->Update(); | |
1585 | crmsoroc->Update(); | |
1586 | ||
1587 | DrawHists(2); | |
1588 | ||
1589 | } | |
1590 | ||
1591 | //__________________________________________________________________ | |
1592 | void AliTPCMonitor::ExecPad() | |
1593 | { | |
1594 | ||
1595 | // Executable for Pad | |
1596 | // Show time profile for channel the mouse is pointing at | |
1597 | ||
1598 | Int_t event = gPad->GetEvent(); | |
1599 | if (event != 51) return; | |
1600 | ||
1601 | TObject *select = gPad->GetSelected(); | |
1602 | if(!select) return; | |
1603 | if(!select->InheritsFrom("TH2")) { return; } | |
1604 | gPad->GetCanvas()->FeedbackMode(kTRUE); | |
1605 | ||
1606 | // get position | |
1607 | Int_t px = gPad->GetEventX(); | |
1608 | Int_t py = gPad->GetEventY(); | |
1609 | Float_t upy = gPad->AbsPixeltoY(py); | |
1610 | Float_t upx = gPad->AbsPixeltoX(px); | |
1611 | Float_t y = gPad->PadtoY(upy); | |
1612 | Float_t x = gPad->PadtoX(upx); | |
1613 | ||
1614 | Int_t setrange = 0; | |
1615 | ||
1616 | TCanvas* cpad = 0; | |
1617 | // Char_t namehist[50]; | |
1618 | Char_t projhist[60]; | |
1619 | Char_t namesel[256]; | |
1620 | Char_t namecanv[256]; | |
1621 | ||
ca7b8371 | 1622 | Int_t xbinmin = 0; |
1623 | Int_t xbinmax = 0; | |
1624 | Float_t ybinmin = 0; | |
1625 | Float_t ybinmax = 0; | |
1626 | Int_t rocid = 0; | |
48265b32 | 1627 | |
1628 | // Check wich Canvas executed the event | |
1629 | TH2S* fHistIndex=0; | |
1630 | sprintf(namesel,select->GetName()); | |
1631 | if(strcmp(namesel,"fHistOROC")==0 || strcmp(namesel,"fHistOROCRMS")==0 || strcmp(namesel,"fHistOROCTime")==0 ) | |
1632 | { | |
ca7b8371 | 1633 | rocid = 1; |
48265b32 | 1634 | fPadUsedRoc =1; |
1635 | sprintf(projhist,"ProjectionOROC"); | |
1636 | sprintf(namecanv,"coroc_ch"); | |
1637 | fHistIndex = fHistOROCIndex; | |
1638 | } | |
1639 | if(strcmp(namesel,"fHistIROC")==0 || strcmp(namesel,"fHistIROCRMS")==0 || strcmp(namesel,"fHistIROCTime")==0 ) | |
1640 | { | |
ca7b8371 | 1641 | rocid = 0; |
48265b32 | 1642 | fPadUsedRoc=0; |
1643 | sprintf(projhist,"ProjectionIROC"); | |
1644 | sprintf(namecanv,"ciroc_ch"); | |
ca7b8371 | 1645 | fHistIndex = fHistIROCIndex; |
48265b32 | 1646 | } |
1647 | ||
1648 | // Check if Canvas already existed and get Ranges from former Prjection histogram | |
ca7b8371 | 1649 | if((cpad=(TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv))) |
48265b32 | 1650 | { |
1651 | cpad->cd(); | |
1652 | if(gROOT->Get(projhist)) | |
1653 | { | |
1654 | setrange = 1; | |
ca7b8371 | 1655 | xbinmin = ((TH1D*)gROOT->Get(projhist))->GetXaxis()->GetFirst(); |
1656 | xbinmax = ((TH1D*)gROOT->Get(projhist))->GetXaxis()->GetLast(); | |
1657 | ybinmin = ((TH1D*)gROOT->Get(projhist))->GetMinimum(); | |
1658 | ybinmax = ((TH1D*)gROOT->Get(projhist))->GetMaximum(); | |
48265b32 | 1659 | delete gROOT->Get("legfit"); |
1660 | delete gROOT->Get("fg"); | |
1661 | } | |
1662 | } | |
1663 | else | |
1664 | { | |
1665 | cpad = CreateCanvas(namecanv); cpad->cd(); | |
1666 | } | |
1667 | ||
1668 | // Get Bin | |
1669 | Int_t testy = fHistIndex->GetYaxis()->FindBin(y); | |
1670 | Int_t testx = fHistIndex->GetXaxis()->FindBin(x); | |
1671 | Int_t binchannel = (Int_t)fHistIndex->GetCellContent(testx,testy); | |
1672 | if(binchannel>30000 || binchannel<0) return; | |
1673 | ||
1674 | if(gROOT->Get(projhist)) delete gROOT->Get(projhist); | |
1675 | // Get Projection | |
1676 | TH1D *hp = (TH1D*)(((TH1D*)fHistChannelTime->ProjectionY("hp",binchannel,binchannel))->Clone(projhist)); | |
1677 | ||
1678 | // Make title and Pave for channel Info | |
1679 | Char_t title[256]; | |
1680 | Int_t npadRow , npad , nhw , nmax , hwadd; | |
1681 | ||
1682 | hwadd = (Int_t)fHistChannelTime->GetCellContent(binchannel,0); | |
1683 | fPadUsedHwAddr = hwadd; | |
1684 | ||
ca7b8371 | 1685 | if(rocid==0)npadRow = fMapHand->GetPadRow(hwadd); |
1686 | else npadRow = fMapHand->GetPadRow(hwadd)-63; | |
1687 | npad = fMapHand->GetPad(hwadd); | |
1688 | nhw = hwadd; | |
1689 | nmax = (Int_t)hp->GetMaximum(); | |
48265b32 | 1690 | |
1691 | ||
1692 | TPaveText* legstat = new TPaveText(0.18,0.65,0.3,0.8,"NDC"); | |
1693 | ||
1694 | Int_t connector = fMapHand->GetFECconnector(hwadd); | |
ca7b8371 | 1695 | Int_t fecnr = fMapHand->GetFECfromHw(hwadd); |
1696 | Int_t fecch = fMapHand->GetFECchannel(hwadd); | |
1697 | Int_t altrochip = fMapHand->GetAltro(hwadd); | |
1698 | Int_t altrochannel= (fMapHand->GetAltroChannel(hwadd))%16; | |
1699 | Int_t fecloc = fMapHand->U2fGetFECinRCU(fecnr) ; | |
1700 | Int_t feclocbran = fMapHand->U2fGetFECinBranch(fecnr); | |
1701 | Int_t branch = fMapHand->U2fGetBranch(fecnr); | |
48265b32 | 1702 | |
1703 | ||
1704 | Short_t fecget = (hwadd & AliTPCMonitorAltro::GetHwMaskFEC()) >> 7; | |
1705 | Short_t branchget = (hwadd & AliTPCMonitorAltro::GetHwMaskBranch())>> 11; | |
1706 | ||
1707 | ||
1708 | Char_t nstat1[100]; Char_t nstat2[100]; Char_t nstat3[100]; Char_t nstat4[100]; | |
1709 | Char_t nstat5[100]; Char_t nstat6[100]; Char_t nstat7[100]; Char_t nstat8[100]; | |
1710 | ||
1711 | sprintf(nstat1,"Branch (map) \t %i (%i) \n",branchget,branch); | |
ca7b8371 | 1712 | sprintf(nstat2,"Fec in patch \t %i \n",fecloc); |
1713 | sprintf(nstat8,"Fec in branch (map)\t %i (%i)\n",fecget,feclocbran); | |
48265b32 | 1714 | sprintf(nstat7,"Connector \t %i \n",connector); |
ca7b8371 | 1715 | sprintf(nstat3,"Fec No. \t %i \n",fecnr); |
1716 | sprintf(nstat4,"Fec chan \t %i \n",fecch); | |
1717 | sprintf(nstat5,"Altro chip\t %i \n",altrochip); | |
1718 | sprintf(nstat6,"Altro chan\t %i \n",altrochannel); | |
48265b32 | 1719 | |
1720 | legstat->AddText(nstat1); legstat->AddText(nstat2); legstat->AddText(nstat8); legstat->AddText(nstat7); | |
1721 | legstat->AddText(nstat3); legstat->AddText(nstat4); legstat->AddText(nstat5); legstat->AddText(nstat6); | |
1722 | ||
1723 | sprintf(title,"Row=%d Pad=%d Hw =%d maxADC =%d count =%d",npadRow,npad,nhw,nmax,binchannel); | |
1724 | ||
1725 | hp->SetName(projhist); | |
1726 | hp->SetTitleSize(0.04); | |
1727 | hp->SetTitle(title); | |
1728 | hp->SetYTitle("ADC"); | |
1729 | hp->SetXTitle("Timebin"); | |
1730 | hp->GetXaxis()->SetTitleColor(1); | |
1731 | ||
1732 | if(setrange) | |
1733 | { | |
ca7b8371 | 1734 | hp->GetXaxis()->SetRange(xbinmin,xbinmax); |
1735 | hp->SetMinimum(ybinmin); | |
1736 | hp->SetMaximum(ybinmax); | |
48265b32 | 1737 | } |
1738 | else | |
1739 | { | |
1740 | hp->SetMinimum(0.0); | |
1741 | hp->SetMaximum(1000.0); | |
1742 | } | |
1743 | ||
1744 | cpad->cd(); | |
1745 | hp->Draw(); | |
1746 | ||
1747 | // Make Fit to peak | |
1748 | if(GetPedestals() && fDisableFit==0) | |
1749 | { | |
ca7b8371 | 1750 | Int_t maxx = (Int_t)fHistAddrMaxAdcX->GetBinContent(hwadd); |
48265b32 | 1751 | Float_t max = (Float_t)fHistAddrMaxAdc->GetBinContent(hwadd); |
1752 | Float_t base = (Float_t)fHistAddrBaseMean->GetBinContent(hwadd); | |
1753 | if(base!=0) | |
1754 | { | |
1755 | if( ((max+base)/base)>1.2) | |
1756 | { | |
ca7b8371 | 1757 | TF1* fg = new TF1("fg",AliTPCMonitor::Gamma4,maxx-5,maxx+5,4); |
48265b32 | 1758 | fg->SetParName(0,"Normalisation"); |
1759 | fg->SetParName(1,"Minimum"); | |
1760 | fg->SetParName(2,"Width"); | |
1761 | fg->SetParName(3,"Base"); | |
1762 | fg->SetParameter(0,max); | |
ca7b8371 | 1763 | fg->SetParameter(1,maxx-2); |
48265b32 | 1764 | fg->SetParameter(2,1.5); |
1765 | fg->FixParameter(3,0); | |
1766 | fg->SetLineColor(4); | |
1767 | fg->SetLineWidth(1); | |
1768 | hp->Fit("fg","RQ"); | |
1769 | ||
1770 | TLegend* legfit = new TLegend(0.6,0.7,0.7,0.8); | |
1771 | legfit->AddEntry("fg","#Gamma 4 fit","l"); | |
1772 | legfit->SetFillColor(0); | |
1773 | legfit->SetName("legfit"); | |
1774 | legfit->Draw("same"); | |
1775 | } | |
1776 | } | |
1777 | } | |
1778 | legstat->SetFillColor(0); | |
1779 | legstat->Draw("same"); | |
1780 | cpad->Update(); | |
1781 | return; | |
1782 | } | |
1783 | ||
1784 | //__________________________________________________________________ | |
1785 | void AliTPCMonitor::ExecRow() | |
1786 | { | |
1787 | ||
1788 | // Executable for Pad | |
1789 | // Show profile of max adc over given pad row | |
1790 | // and 2dim histo adc(pad-in-row,time bin) | |
1791 | ||
1792 | Int_t event = gPad->GetEvent(); | |
1793 | if (event != 61) return; | |
1794 | gPad->cd(); | |
1795 | TObject *select = gPad->GetSelected(); | |
1796 | if(!select) return; | |
1797 | if(!select->InheritsFrom("TH2")) { return; } | |
1798 | ||
ca7b8371 | 1799 | Int_t rocid = 0; |
48265b32 | 1800 | // Char_t namehist[50]; |
1801 | Char_t rowhist[60]; | |
ca7b8371 | 1802 | Char_t rowhistsum[60]; |
1803 | Char_t rowhistmax[60]; | |
1804 | Char_t rowhistxmax[60]; | |
48265b32 | 1805 | |
ca7b8371 | 1806 | sprintf(rowhist, "hrowtime"); |
1807 | sprintf(rowhistxmax ,"hxmax"); | |
1808 | sprintf(rowhistmax , "hrowmax"); | |
48265b32 | 1809 | |
1810 | // get position | |
1811 | Int_t px = gPad->GetEventX(); | |
1812 | Int_t py = gPad->GetEventY(); | |
1813 | Float_t upy = gPad->AbsPixeltoY(py); | |
1814 | Float_t upx = gPad->AbsPixeltoX(px); | |
1815 | Float_t y = gPad->PadtoY(upy); | |
1816 | Float_t x = gPad->PadtoX(upx); | |
1817 | ||
ca7b8371 | 1818 | TCanvas*crowtime = 0; |
1819 | TCanvas*crowmax = 0; | |
1820 | TCanvas*cxmax = 0; | |
48265b32 | 1821 | |
1822 | TH2S* fHistIndex = 0; | |
1823 | ||
1824 | // ranges from already existing histos | |
ca7b8371 | 1825 | Int_t rowtimexmin = 0; |
1826 | Int_t rowtimexmax = 0; | |
1827 | Int_t rowtimeymin = 0; | |
1828 | Int_t rowtimeymax = 0; | |
1829 | Float_t rowtimezmin = 0; | |
1830 | Float_t rowtimezmax = 0; | |
48265b32 | 1831 | |
ca7b8371 | 1832 | Int_t prof_rowxmin = 0; |
1833 | Int_t prof_rowxmax = 0; | |
1834 | Double_t prof_rowymin = 0; | |
1835 | Double_t prof_rowymax = 0; | |
48265b32 | 1836 | |
ca7b8371 | 1837 | Int_t profxxmin = 0; |
1838 | Int_t profxxmax = 0; | |
1839 | Double_t profxymin = 0; | |
1840 | Double_t profxymax = 0; | |
48265b32 | 1841 | |
1842 | ||
1843 | Int_t setrange = 0; | |
1844 | ||
1845 | ||
ca7b8371 | 1846 | if( strcmp(select->GetName(),"fHistIROC")==0 || strcmp(select->GetName(),"fHistIROCRMS")==0 ) { fHistIndex = fHistIROCIndex; rocid =1; } |
1847 | else if(strcmp(select->GetName(),"fHistOROC")==0 || strcmp(select->GetName(),"fHistOROCRMS")==0 ) { fHistIndex = fHistOROCIndex; rocid =2; } | |
48265b32 | 1848 | else { cout << " not implemented for this histo " << endl; return; } |
1849 | ||
1850 | gPad->GetCanvas()->FeedbackMode(kTRUE); | |
1851 | ||
1852 | ||
1853 | ||
1854 | // check if canvases exist // | |
ca7b8371 | 1855 | crowtime = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crowtime"); |
1856 | crowmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crowmax"); | |
1857 | cxmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cxmax"); | |
48265b32 | 1858 | |
ca7b8371 | 1859 | if(!crowtime) crowtime = CreateCanvas("crowtime") ; |
1860 | if(!crowmax) crowmax = CreateCanvas("crowmax") ; | |
1861 | if(!cxmax ) cxmax = CreateCanvas("cxmax") ; | |
48265b32 | 1862 | |
1863 | // check ranges of already existing histos | |
1864 | if(gROOT->Get(rowhist)) | |
1865 | { | |
ca7b8371 | 1866 | rowtimexmin = ((TH2F*)gROOT->Get(rowhist))->GetXaxis()->GetFirst(); |
1867 | rowtimexmax = ((TH2F*)gROOT->Get(rowhist))->GetXaxis()->GetLast(); | |
1868 | rowtimeymin = ((TH2F*)gROOT->Get(rowhist))->GetYaxis()->GetFirst(); | |
1869 | rowtimeymax = ((TH2F*)gROOT->Get(rowhist))->GetYaxis()->GetLast(); | |
1870 | rowtimezmin = ((TH2F*)gROOT->Get(rowhist))->GetMinimum(); | |
1871 | rowtimezmax = ((TH2F*)gROOT->Get(rowhist))->GetMaximum(); | |
48265b32 | 1872 | |
ca7b8371 | 1873 | prof_rowxmin = ((TH1F*)gROOT->Get(rowhistmax))->GetXaxis()->GetFirst(); |
1874 | prof_rowxmax = ((TH1F*)gROOT->Get(rowhistmax))->GetXaxis()->GetLast(); | |
1875 | prof_rowymin = ((TH1F*)gROOT->Get(rowhistmax))->GetMinimum(); | |
1876 | prof_rowymax = ((TH1F*)gROOT->Get(rowhistmax))->GetMaximum(); | |
48265b32 | 1877 | |
ca7b8371 | 1878 | profxxmin = ((TH1F*)gROOT->Get(rowhistxmax))->GetXaxis()->GetFirst(); |
1879 | profxxmax = ((TH1F*)gROOT->Get(rowhistxmax))->GetXaxis()->GetLast(); | |
1880 | profxymin = ((TH1F*)gROOT->Get(rowhistxmax))->GetMinimum(); | |
1881 | profxymax = ((TH1F*)gROOT->Get(rowhistxmax))->GetMaximum(); | |
48265b32 | 1882 | |
1883 | setrange =1; | |
1884 | ||
1885 | delete gROOT->Get(rowhist); | |
ca7b8371 | 1886 | delete gROOT->Get(rowhistmax); |
1887 | delete gROOT->Get(rowhistsum); | |
1888 | delete gROOT->Get("hxmax"); | |
48265b32 | 1889 | delete gROOT->Get("legrow"); |
1890 | } | |
1891 | ||
1892 | // get channel for xy bin -> getRow -> getNrows -> getHw for each Pad in Row -> get channel for each hw -> make proj | |
1893 | Int_t testy = fHistIndex->GetYaxis()->FindBin(y); | |
1894 | Int_t testx = fHistIndex->GetXaxis()->FindBin(x); | |
1895 | Int_t binchannel = (Int_t)fHistIndex->GetCellContent(testx,testy); | |
1896 | ||
1897 | if(binchannel>30000) return; | |
ca7b8371 | 1898 | if(binchannel<=0 ) { crowtime->Update() ; crowmax->Update() ; return ; } |
48265b32 | 1899 | |
1900 | // get hwaddress | |
1901 | Int_t hwadd = (Int_t)fHistChannelTime->GetCellContent(binchannel,0); | |
1902 | Int_t row = fMapHand->GetPadRow(hwadd); | |
1903 | Int_t pad = fMapHand->GetPad(hwadd) ; | |
1904 | Int_t numofpads = fMapHand->GetNumofPads(row); | |
1905 | ||
1906 | // create histos | |
ca7b8371 | 1907 | TH2F *hrowtime = new TH2F(rowhist , "" ,numofpads,0,numofpads,GetTimeBins(),0.0,GetTimeBins()); |
1908 | TH1F *hrowmax = new TH1F(rowhistmax , "" ,numofpads,0,numofpads); | |
1909 | TH1F *hxmax = new TH1F(rowhistxmax, "" ,159,0,159 ); | |
48265b32 | 1910 | |
1911 | // Row profile /////////// | |
1912 | if(fVerb) cout << " Number of pads " << numofpads << endl; | |
1913 | for(Int_t padnr = 0; padnr<numofpads;padnr++) | |
1914 | { | |
1915 | Int_t addrinrow = fMapHand->GetPadAddInRow(row,padnr ); | |
1916 | Int_t channel = (Int_t)fHistAddrMapIndex->GetBinContent(addrinrow); | |
1917 | if(channel==-1) continue; | |
1918 | ||
ca7b8371 | 1919 | hrowmax->SetBinContent(padnr+1,fHistAddrMaxAdc->GetBinContent(addrinrow)); |
48265b32 | 1920 | TH1D *hp = fHistChannelTime->ProjectionY("hp",channel,channel); |
1921 | for(Int_t time = 0;time<GetTimeBins();time++) { | |
1922 | ||
1923 | Float_t val = hp->GetBinContent(time); | |
ca7b8371 | 1924 | hrowtime->SetCellContent(padnr+1,time+1,val); |
48265b32 | 1925 | } |
1926 | } | |
1927 | ||
1928 | // X profile ///////////// | |
1929 | Double_t xval = 0.0; | |
1930 | Double_t yval = 0.0; | |
1931 | GetXY(xval,yval,numofpads,row,pad); | |
1932 | ||
1933 | Int_t padnr = 0; | |
1934 | Int_t hw = 0; | |
1935 | for(Int_t nrow = 0; nrow<159; nrow++) | |
1936 | { | |
1937 | padnr = GetPadAtX(xval,nrow); | |
1938 | if(padnr>=0) | |
1939 | { | |
1940 | hw = fMapHand->GetPadAddInRow(nrow,padnr); | |
1941 | if(fPadMapHw[hw]==-1){ continue ; } | |
ca7b8371 | 1942 | else { hxmax->SetBinContent(nrow+1,fHistAddrMaxAdc->GetBinContent(hw)) ; } |
48265b32 | 1943 | } |
1944 | } | |
1945 | ||
ca7b8371 | 1946 | cxmax->cd(); |
1947 | Char_t hxtitle[50] ; sprintf(hxtitle,"max adc in pads at x=%5.1f mm",xval); | |
1948 | hxmax->SetTitle(hxtitle); | |
1949 | hxmax->SetXTitle("row"); | |
1950 | if(!GetPedestals()) hxmax->SetYTitle("max adc (baseline sub.)"); | |
1951 | else hxmax->SetYTitle("max adc "); | |
1952 | hxmax->SetMinimum(0.01); | |
1953 | hxmax->Draw("l"); | |
48265b32 | 1954 | |
1955 | if(setrange) | |
1956 | { | |
ca7b8371 | 1957 | hxmax->GetXaxis()->SetRange(profxxmin,profxxmax); |
1958 | hxmax->SetMinimum(profxymin); | |
1959 | hxmax->SetMaximum(profxymax); | |
48265b32 | 1960 | } |
1961 | ||
ca7b8371 | 1962 | cxmax->Update(); |
48265b32 | 1963 | |
ca7b8371 | 1964 | crowtime->cd(); |
48265b32 | 1965 | Char_t title[256]; |
ca7b8371 | 1966 | Char_t titlemax[256]; |
1967 | if(rocid==1) {sprintf(title,"%s Row=%d",((TH2*)select)->GetTitle(),row) ; sprintf(titlemax,"IROC max/sum Row=%d",row );} | |
1968 | else {sprintf(title,"%s Row=%d",((TH2*)select)->GetTitle(),row-63); sprintf(titlemax,"OROC max/sum Row=%d",row-63);} | |
48265b32 | 1969 | if(fVerb) cout << " set name " << endl; |
1970 | ||
1971 | ||
1972 | // row vs time | |
ca7b8371 | 1973 | crowtime->cd(); |
1974 | hrowtime->SetTitleSize(0.04); | |
1975 | hrowtime->SetTitle(title); | |
1976 | hrowtime->SetYTitle("timbin"); | |
1977 | hrowtime->SetXTitle("pad in row"); | |
1978 | hrowtime->SetZTitle("signal (ADC)"); | |
48265b32 | 1979 | |
ca7b8371 | 1980 | hrowtime->GetXaxis()->SetTitleColor(1); |
1981 | hrowtime->SetMaximum(1000.0); | |
1982 | hrowtime->SetMinimum(0.0); | |
48265b32 | 1983 | |
1984 | if(setrange) | |
1985 | { | |
ca7b8371 | 1986 | hrowtime->GetXaxis()->SetRange(rowtimexmin,rowtimexmax); |
1987 | hrowtime->GetYaxis()->SetRange(rowtimeymin,rowtimeymax); | |
1988 | hrowtime->SetMinimum(rowtimezmin); | |
1989 | hrowtime->SetMaximum(rowtimezmax); | |
48265b32 | 1990 | } |
1991 | ||
ca7b8371 | 1992 | hrowtime->Draw("COLZ"); |
1993 | crowtime->UseCurrentStyle(); | |
1994 | crowtime->Update(); | |
48265b32 | 1995 | |
1996 | // max and sum ///////////////////////// | |
ca7b8371 | 1997 | crowmax->cd(); |
48265b32 | 1998 | if(setrange) { |
ca7b8371 | 1999 | hrowmax->GetXaxis()->SetRange(prof_rowxmin,prof_rowxmax); |
2000 | hrowmax->SetMinimum(prof_rowymin); | |
2001 | hrowmax->SetMaximum(prof_rowymax); | |
48265b32 | 2002 | } |
ca7b8371 | 2003 | hrowmax->SetTitleSize(0.04); |
2004 | hrowmax->SetTitle(title); | |
2005 | hrowmax->SetYTitle("max adc"); | |
2006 | hrowmax->SetXTitle("pad in row"); | |
2007 | hrowmax->GetXaxis()->SetTitleColor(1); | |
48265b32 | 2008 | |
ca7b8371 | 2009 | hrowmax->SetLineColor(2); |
2010 | hrowmax->Draw("l"); | |
2011 | crowmax->Update(); | |
48265b32 | 2012 | |
2013 | return; | |
2014 | } | |
2015 | ||
2016 | //__________________________________________________________________ | |
2017 | void AliTPCMonitor::Write10bitChannel() | |
2018 | { | |
2019 | ||
2020 | // Write 10 bit words form histogram for active(last pointed) channel | |
2021 | ||
2022 | if(fPadUsedHwAddr==-1){ AliWarning(" No active pad "); return ;} | |
2023 | ||
2024 | Int_t pad = (Int_t)fMapHand->GetPad( fPadUsedHwAddr); | |
2025 | Int_t row = (Int_t)fMapHand->GetPadRow(fPadUsedHwAddr); | |
2026 | Int_t channel = (Int_t)fPadMapHw[fPadUsedHwAddr]; | |
2027 | ||
ca7b8371 | 2028 | Char_t filenameroot[256]; |
2029 | Char_t filenamedat[256]; | |
48265b32 | 2030 | Char_t projhist[256]; |
2031 | ||
2032 | if(fPadUsedRoc==1) { sprintf(projhist,"ProjectionOROC"); } | |
2033 | if(fPadUsedRoc==0) { sprintf(projhist,"ProjectionIROC"); } | |
2034 | ||
ca7b8371 | 2035 | sprintf(filenamedat, "Channel_Run%05i_EventID_%i_Pad_%i_Row_%i.dat" ,fRunId,fEventNumber,pad,row); |
2036 | sprintf(filenameroot,"Channel_Run%05i_EventID_%i_Pad_%i_Row_%i.root" ,fRunId,fEventNumber,pad,row); | |
48265b32 | 2037 | |
2038 | TH1D* hpr = 0; | |
ca7b8371 | 2039 | if((hpr=(TH1D*)gROOT->Get(projhist))) |
48265b32 | 2040 | { |
2041 | // root histo | |
ca7b8371 | 2042 | TFile f(filenameroot,"recreate"); |
48265b32 | 2043 | hpr->Write(); |
2044 | f.Close(); | |
2045 | ||
2046 | // raw singal | |
ca7b8371 | 2047 | ofstream datout(filenamedat,ios::out); |
48265b32 | 2048 | datout <<"Timebin \t ADC value " << endl; |
2049 | for(Int_t i = 1; i <GetTimeBins(); i++) | |
2050 | { | |
2051 | datout << i << " \t \t " << fPad[channel][i] << endl; | |
2052 | } | |
2053 | datout.close(); | |
2054 | } | |
2055 | else | |
2056 | { | |
2057 | AliWarning("No projection histo found "); | |
2058 | } | |
2059 | } | |
2060 | ||
2061 | //__________________________________________________________________ | |
2062 | void AliTPCMonitor::ExecTransform() | |
2063 | { | |
2064 | ||
2065 | // Make Fast Fourier Transformation for active pad | |
2066 | // fft is only performed for a data sample of size 2^n | |
2067 | // reduce window according to largest power of 2 which is smaller than the viewing range | |
2068 | ||
2069 | Char_t namecanv[256]; | |
2070 | Char_t projhist[256]; | |
ca7b8371 | 2071 | Char_t namehtrimag[256]; |
2072 | Char_t namehtrreal[256]; | |
48265b32 | 2073 | |
2074 | if(fPadUsedRoc==1) { sprintf(namecanv,"coroc_ch_trans") ; sprintf(projhist,"ProjectionOROC"); } | |
2075 | if(fPadUsedRoc==0) { sprintf(namecanv,"ciroc_ch_trans") ; sprintf(projhist,"ProjectionIROC"); } | |
2076 | ||
2077 | TH1D* hproj = 0; | |
2078 | ||
2079 | if((TH1D*)gROOT->Get(projhist)==0){AliWarning("Proj histo does not exist \n Move mouse over 2d histo choose channel \n and drag mouse form histo again!"); return ;} | |
2080 | else hproj = (TH1D*)gROOT->Get(projhist) ; | |
2081 | ||
2082 | ||
ca7b8371 | 2083 | if(fPadUsedRoc==1) { sprintf(namehtrimag,"htransimagfreq_oroc"); sprintf(namehtrreal,"htransrealfreq_oroc"); } |
2084 | else { sprintf(namehtrimag,"htransimagfreq_iroc"); sprintf(namehtrreal,"htransrealfreq_iroc"); } | |
48265b32 | 2085 | |
ca7b8371 | 2086 | if( gROOT->Get(namehtrimag)) delete gROOT->Get(namehtrimag); |
2087 | if( gROOT->Get(namehtrreal)) delete gROOT->Get(namehtrreal); | |
48265b32 | 2088 | |
2089 | TCanvas *ctrans = 0; | |
2090 | if(!(ctrans = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv))) | |
2091 | { | |
2092 | ctrans = CreateCanvas(namecanv); | |
2093 | ctrans->Divide(1,2); | |
2094 | } | |
2095 | ||
ca7b8371 | 2096 | Int_t binfirst = hproj->GetXaxis()->GetFirst(); |
2097 | Int_t binlast = hproj->GetXaxis()->GetLast(); | |
2098 | Int_t bins = binlast -binfirst +1; | |
48265b32 | 2099 | |
2100 | Int_t power = 0; | |
2101 | for(Int_t pot = 0; pot<=10 ; pot++) | |
2102 | { | |
2103 | Int_t comp = (Int_t)TMath::Power(2,pot); | |
2104 | if(bins>=comp)power = pot; | |
2105 | } | |
2106 | ||
2107 | bins = (Int_t)TMath::Power(2,power); | |
2108 | ||
2109 | // sampling frequency ; | |
ca7b8371 | 2110 | Double_t deltat = 1.0/(Float_t)GetSamplingFrequency(); |
48265b32 | 2111 | |
2112 | // output histo | |
ca7b8371 | 2113 | TH1D* htransrealfreq = new TH1D(namehtrreal,namehtrreal,10000,-1/(2*deltat),1/(2*deltat)); |
2114 | TH1D* htransimagfreq = new TH1D(namehtrimag,namehtrimag,10000,-1/(2*deltat),1/(2*deltat)); | |
48265b32 | 2115 | |
2116 | ||
ca7b8371 | 2117 | Char_t titlereal[256]; |
2118 | Char_t titleimag[256]; | |
2119 | if(fPadUsedRoc==1) { sprintf(titlereal,"OROC DFT real part"); sprintf(titleimag,"OROC DFT imag part"); } | |
2120 | else { sprintf(titlereal,"IROC DFT real part"); sprintf(titleimag,"IROC DFT imag part"); } | |
48265b32 | 2121 | |
ca7b8371 | 2122 | htransrealfreq->SetTitle(titlereal); htransrealfreq->SetXTitle("f/hz"); htransrealfreq->SetYTitle("z_{real}(f)"); |
2123 | htransimagfreq->SetTitle(titleimag); htransimagfreq->SetXTitle("f/hz"); htransimagfreq->SetYTitle("z_{imag}(f)"); | |
48265b32 | 2124 | |
2125 | ||
2126 | // create complex packed data array | |
ca7b8371 | 2127 | const Int_t kdatasiz = 2*bins; |
2128 | Double_t* data = new Double_t[kdatasiz]; | |
48265b32 | 2129 | for(Int_t i=0;i<2*bins;i++) { data[i] = 0.0;} |
ca7b8371 | 2130 | for(Int_t i=0;i<bins;i++) { data[2*i] = (Double_t)hproj->GetBinContent(binfirst+i); } |
48265b32 | 2131 | |
2132 | // make fourier transformation | |
2133 | AliTPCMonitorFFT* four = new AliTPCMonitorFFT(); | |
2134 | four->ComplexRadix2ForwardWrap(data,1,bins); | |
2135 | ||
2136 | // write output and fill histos forward | |
2137 | Double_t freq = 0.0; | |
2138 | for(Int_t i=0;i<2*bins;i++) | |
2139 | { | |
2140 | if(i<bins) | |
2141 | { | |
ca7b8371 | 2142 | if(i<(bins/2)) { freq = i/(bins*deltat) ; } |
2143 | else { freq = -1*((bins-i)/(bins*deltat)); } | |
2144 | htransrealfreq->Fill( freq,data[2*i] ); | |
2145 | htransimagfreq->Fill( freq,data[2*i+1]); | |
48265b32 | 2146 | |
2147 | ||
2148 | } | |
2149 | } | |
2150 | ||
2151 | ctrans->cd(1); | |
ca7b8371 | 2152 | htransrealfreq->Draw(); |
48265b32 | 2153 | ctrans->cd(2); |
ca7b8371 | 2154 | htransimagfreq->Draw(); |
48265b32 | 2155 | ctrans->Update(); |
2156 | delete four; | |
2157 | delete data; | |
2158 | } | |
2159 | ||
2160 | //__________________________________________________________________ | |
ca7b8371 | 2161 | void AliTPCMonitor::ShowSel(Int_t* compval) |
48265b32 | 2162 | { |
2163 | ||
2164 | // Show only selected components | |
2165 | // First restore original histogram from clone | |
2166 | // Than remove all not matching pads form histos | |
2167 | ||
2168 | Int_t connector = 0; | |
ca7b8371 | 2169 | Int_t fecnr = 0; |
2170 | Int_t altrochip = 0; | |
2171 | Int_t feclocbran = 0; | |
48265b32 | 2172 | Int_t branch = 0; |
2173 | Short_t rcuget = 0; | |
2174 | Int_t emptyI = 1; | |
2175 | Int_t index = -1; | |
2176 | Int_t hwadd = 0; | |
2177 | ||
2178 | Float_t maxiroc = fHistIROCClone->GetMaximum(); | |
2179 | Float_t maxoroc = fHistOROCClone->GetMaximum(); | |
2180 | ||
2181 | ||
2182 | // restore original histos | |
ca7b8371 | 2183 | for(Int_t row = 0; row<fkNRowsIroc; row++) |
48265b32 | 2184 | { |
ca7b8371 | 2185 | for(Int_t pad = 0; pad<fkNPadsIroc; pad++) |
48265b32 | 2186 | { |
2187 | index = (Int_t)fHistIROCIndex->GetCellContent(row+1,pad+1); | |
2188 | if(index==-1)continue; | |
2189 | else fHistIROC->SetCellContent(row+1,pad+1,fHistIROCClone->GetCellContent(row+1,pad+1)); | |
2190 | } | |
2191 | } | |
ca7b8371 | 2192 | for(Int_t row = 0; row<fkNRowsOroc; row++) |
48265b32 | 2193 | { |
ca7b8371 | 2194 | for(Int_t pad = 0; pad<fkNPadsOroc; pad++) |
48265b32 | 2195 | { |
2196 | index = (Int_t)fHistOROCIndex->GetCellContent(row+1,pad+1); | |
2197 | if(index==-1)continue; | |
2198 | else fHistOROC->SetCellContent(row+1,pad+1,fHistOROCClone->GetCellContent(row+1,pad+1)); | |
2199 | } | |
2200 | } | |
2201 | ||
2202 | ||
2203 | // remove not matching entries from fHistIROC/fHistOROC | |
2204 | ||
2205 | TH2F* fHist =0; | |
2206 | TH2S* fHistIndex =0; | |
2207 | Int_t npads =0; | |
2208 | Int_t subrows =0; | |
2209 | ||
ca7b8371 | 2210 | for(Int_t row = 0; row< (fkNRowsIroc + fkNRowsOroc); row++) |
48265b32 | 2211 | { |
ca7b8371 | 2212 | if(row<fkNRowsIroc) { fHist=fHistIROC ; fHistIndex = fHistIROCIndex; npads = fkNPadsIroc; subrows =0 ;} |
2213 | else { fHist=fHistOROC ; fHistIndex = fHistOROCIndex; npads = fkNPadsOroc; subrows =fkNRowsIroc;} | |
48265b32 | 2214 | |
2215 | for(Int_t pad = 0; pad<npads; pad++) | |
2216 | { | |
2217 | index = (Int_t)fHistIndex->GetCellContent(row -subrows +1,pad+1); | |
2218 | if(index==-1) continue ; | |
2219 | hwadd = (Int_t)fHistChannelTime->GetCellContent(index,0); | |
2220 | ||
2221 | // global fecnr | |
ca7b8371 | 2222 | fecnr = fMapHand->GetFECfromHw(hwadd); |
2223 | if(compval[0]!=-1 && fecnr!=compval[0]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; } | |
48265b32 | 2224 | |
2225 | // rcu | |
2226 | rcuget = (hwadd & AliTPCMonitorAltro::GetHwMaskRCU())>> 12; | |
ca7b8371 | 2227 | if(compval[1]!=-1 && rcuget!=compval[1]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; } |
48265b32 | 2228 | |
2229 | // branch | |
ca7b8371 | 2230 | branch = fMapHand->U2fGetBranch(fecnr) ; |
2231 | if(compval[2]!=-1 && branch!=compval[2]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; } | |
48265b32 | 2232 | |
2233 | // local fec | |
ca7b8371 | 2234 | feclocbran= fMapHand->U2fGetFECinBranch(fecnr) ; |
2235 | if(compval[3]!=-1 && feclocbran!=compval[3]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; } | |
48265b32 | 2236 | |
2237 | // connector | |
2238 | connector = fMapHand->GetFECconnector(hwadd); | |
ca7b8371 | 2239 | if(compval[4]!=-1 && connector!=compval[4]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; } |
48265b32 | 2240 | |
2241 | // Altro chip | |
ca7b8371 | 2242 | altrochip = fMapHand->GetAltro(hwadd); |
2243 | if(compval[5]!=-1 && altrochip!=compval[5]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; } | |
48265b32 | 2244 | emptyI =0; |
2245 | } | |
2246 | } | |
2247 | ||
2248 | TCanvas* c1 =0; | |
2249 | TCanvas* c2 =0; | |
2250 | if(gROOT->GetListOfCanvases()->FindObject("ciroc")) | |
2251 | { | |
2252 | c1 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("ciroc"); | |
2253 | c1->cd() ; | |
2254 | fHistIROC->Draw("COLZ"); | |
2255 | fHistIROC->SetMaximum(maxiroc); | |
2256 | fHistIROC->SetMinimum(0.0); | |
2257 | c1->Update(); | |
2258 | } | |
2259 | if(gROOT->GetListOfCanvases()->FindObject("coroc")) | |
2260 | { | |
2261 | c2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("coroc"); | |
2262 | c2->cd() ; | |
2263 | fHistOROC->Draw("COLZ"); | |
2264 | fHistOROC->SetMaximum(maxoroc); | |
2265 | fHistOROC->SetMinimum(0.0); | |
2266 | c2->Update(); | |
2267 | } | |
2268 | return ; | |
2269 | } | |
2270 | ||
2271 | //__________________________________________________________________ | |
2272 | void AliTPCMonitor::ResizeCanv() | |
2273 | { | |
2274 | // Resize canvases and delete some of them | |
2275 | ||
2276 | Char_t carry1[100]; | |
2277 | sprintf(carry1,".x %s/TPC/AliTPCMonitorExec.C(1)",gSystem->Getenv("ALICE_ROOT")); | |
2278 | Char_t carry3[100]; | |
2279 | sprintf(carry3,".x %s/TPC/AliTPCMonitorExec.C(2)",gSystem->Getenv("ALICE_ROOT")); | |
2280 | if(fVerb) cout << " canv 1 " << endl; | |
2281 | ||
2282 | if(gROOT->GetListOfCanvases()->FindObject( "coroc_ch")) { delete gROOT->GetListOfCanvases()->FindObject("coroc_ch") ; } | |
2283 | if(gROOT->GetListOfCanvases()->FindObject( "ciroc_ch")) { delete gROOT->GetListOfCanvases()->FindObject("ciroc_ch") ; } | |
2284 | ||
2285 | // for 2dim plots delete create and draw again | |
2286 | if(gROOT->GetListOfCanvases()->FindObject("ciroc")) | |
2287 | { | |
2288 | delete gROOT->GetListOfCanvases()->FindObject("ciroc"); | |
2289 | TCanvas* ciroc = CreateCanvas("ciroc"); | |
2290 | ciroc->cd(); | |
2291 | fHistIROC->Draw("COLZ"); | |
2292 | ciroc->AddExec("pad",carry1); | |
2293 | ciroc->AddExec("row",carry3); | |
2294 | fExecPlaneMax=1; | |
2295 | ciroc->Update(); | |
2296 | } | |
2297 | // for 2dim plots delete create and draw again | |
2298 | if(gROOT->GetListOfCanvases()->FindObject("coroc")) | |
2299 | { | |
2300 | delete gROOT->GetListOfCanvases()->FindObject("coroc"); | |
2301 | TCanvas* coroc = CreateCanvas("coroc"); | |
2302 | coroc->cd(); | |
2303 | fHistOROC->Draw("COLZ"); | |
2304 | ||
2305 | coroc->AddExec("pad",carry1); | |
2306 | coroc->AddExec("row",carry3); | |
2307 | coroc->Update(); | |
2308 | fExecPlaneMax=1; | |
2309 | } | |
2310 | ||
2311 | if(gROOT->GetListOfCanvases()->FindObject( "cbasemean")) { delete gROOT->GetListOfCanvases()->FindObject("cbasemean"); } | |
2312 | if(gROOT->GetListOfCanvases()->FindObject( "cbase")) { delete gROOT->GetListOfCanvases()->FindObject("cbase");} | |
2313 | if(gROOT->GetListOfCanvases()->FindObject( "cbaserms")) { delete gROOT->GetListOfCanvases()->FindObject("cbaserms"); } | |
2314 | if(gROOT->GetListOfCanvases()->FindObject( "cmax")) { delete gROOT->GetListOfCanvases()->FindObject("cmax"); } | |
2315 | if(gROOT->GetListOfCanvases()->FindObject( "csum")) { delete gROOT->GetListOfCanvases()->FindObject("csum"); } | |
2316 | if(gROOT->GetListOfCanvases()->FindObject( "ciroc_ch_trans")) { delete gROOT->GetListOfCanvases()->FindObject("ciroc_ch_trans");} | |
2317 | if(gROOT->GetListOfCanvases()->FindObject( "coroc_ch_trans")) { delete gROOT->GetListOfCanvases()->FindObject("coroc_ch_trans");} | |
ca7b8371 | 2318 | if(gROOT->GetListOfCanvases()->FindObject( "crowtime")) { delete gROOT->GetListOfCanvases()->FindObject("crowtime"); } |
2319 | if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); } | |
2320 | if(gROOT->GetListOfCanvases()->FindObject( "cxmax")) { delete gROOT->GetListOfCanvases()->FindObject("cxmax"); } | |
48265b32 | 2321 | if(gROOT->GetListOfCanvases()->FindObject( "crmsoroc")) { delete gROOT->GetListOfCanvases()->FindObject("crmsoroc"); fExecPadOrocRms = 0; } |
2322 | if(gROOT->GetListOfCanvases()->FindObject( "crmsiroc")) { delete gROOT->GetListOfCanvases()->FindObject("crmsiroc"); fExecPadIrocRms = 0; } | |
ca7b8371 | 2323 | if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); } |
2324 | if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); } | |
48265b32 | 2325 | |
2326 | } | |
2327 | ||
2328 | ||
2329 | ||
2330 | ||
2331 | //__________________________________________________________________ | |
2332 | Int_t AliTPCMonitor::ExecProcess() | |
2333 | { | |
2334 | // Executable for global Histogram | |
2335 | // Will be called from /TPC/AliTPCMonitorExec.C(3) | |
2336 | // Call ProcessEvent for same event and sector pointed at | |
2337 | ||
2338 | Int_t side = 0; | |
2339 | Int_t sector = 0; | |
2340 | ||
2341 | Int_t event = gPad->GetEvent(); | |
2342 | if(event != 61) return -1; | |
2343 | ||
2344 | TObject *select = gPad->GetSelected(); | |
2345 | if(!select) return -1; | |
2346 | if(!select->InheritsFrom("TH2")) {gPad->SetUniqueID(0); return -1; } | |
2347 | if( strcmp(select->GetName(),"hglobal" )==0 || ( strcmp(select->GetName(),"SIDE A" )==0) ) side = 0; | |
2348 | else if( strcmp(select->GetName(),"hglobal2")==0 || ( strcmp(select->GetName(),"SIDE C" )==0) ) side = 1; | |
2349 | ||
2350 | // get position | |
2351 | Int_t px = gPad->GetEventX(); | |
2352 | Int_t py = gPad->GetEventY(); | |
2353 | Float_t upy = gPad->AbsPixeltoY(py); | |
2354 | Float_t upx = gPad->AbsPixeltoX(px); | |
2355 | Float_t y = gPad->PadtoY(upy); | |
2356 | Float_t x = gPad->PadtoX(upx); | |
2357 | ||
2358 | Int_t testy = ((TH2*)select)->GetYaxis()->FindBin(y); | |
2359 | Int_t testx = ((TH2*)select)->GetXaxis()->FindBin(x); | |
2360 | if(((TH2*)select)->GetCellContent(testx,testy)==0) return -1 ; | |
2361 | ||
2362 | Float_t alpha = 0.0; | |
2363 | if(x>0.0 && y > 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(x/y))); | |
2364 | if(x>0.0 && y < 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(y/x))); | |
2365 | if(x<0.0 && y < 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(x/y))); | |
2366 | if(x<0.0 && y > 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(y/x))); | |
2367 | ||
2368 | if(x>0.0 && y < 0.0) alpha += ( TMath::Pi()/2); | |
2369 | if(x<0.0 && y < 0.0) alpha += ( TMath::Pi()); | |
2370 | if(x<0.0 && y > 0.0) alpha += (1.5*TMath::Pi()); | |
2371 | ||
2372 | sector = (Int_t)(alpha/(2*TMath::Pi()/18.0)); | |
2373 | if(alpha> (sector+0.5)*(2*TMath::Pi()/18.0)) sector+=1; | |
2374 | ||
2375 | if(sector==18 && side ==0 ) { | |
2376 | AliWarning("There was a wromg assignment of sector 0 with sector 18. Check sectors"); | |
2377 | sector =0; | |
2378 | } | |
2379 | ||
2380 | sector = (18-sector +4)%18; | |
2381 | SetLastSector(sector+ side*18); | |
2382 | SetProcNextEvent(0); | |
2383 | ||
2384 | if(fVerb) cout << "AliTPCMonitor::ExecProcess() next side " << side << " next sector " << sector << endl; | |
2385 | ||
2386 | return (Int_t)ProcessEvent(); | |
2387 | ||
2388 | } | |
2389 | ||
2390 | //__________________________________________________________________ | |
2391 | Int_t AliTPCMonitor::GetRCUPatch(Int_t runid, Int_t eqid) | |
2392 | { | |
2393 | ||
2394 | // Return RCU patch index for given equipment id eqid | |
2395 | Int_t patch = 0; | |
2396 | //if(runid>=704) | |
2397 | if(runid>=0) | |
2398 | { | |
2399 | if(eqid>=1000) return 0; | |
2400 | patch = fMapEqidsRcu[eqid] ; | |
2401 | } | |
2402 | else | |
2403 | { | |
2404 | if(eqid==408) {patch = 13*6+4 +0; } | |
2405 | if(eqid==409) {patch = 13*6+5 +0; } | |
2406 | if(eqid==509) {patch = 13*6+0 +0; } | |
2407 | if(eqid==512) {patch = 13*6+3 +0; } | |
2408 | if(eqid==513) {patch = 13*6+1 +0; } | |
2409 | if(eqid==517) {patch = 13*6+2 +0; } | |
2410 | ||
2411 | if(eqid==404) {patch = 4*6+5 +0; } | |
2412 | if(eqid==504) {patch = 4*6+4 +0; } | |
2413 | if(eqid==407) {patch = 4*6+3 +0; } | |
2414 | if(eqid==503) {patch = 4*6+2 +0; } | |
2415 | if(eqid==508) {patch = 4*6+1 +0; } | |
2416 | if(eqid==506) {patch = 4*6+0 +0; } | |
2417 | } | |
2418 | return patch; | |
2419 | } | |
2420 | ||
2421 | //__________________________________________________________________ | |
ca7b8371 | 2422 | void AliTPCMonitor::DumpHeader(AliRawReaderRoot * fReaderROOT) const |
48265b32 | 2423 | { |
2424 | // Dump Event header for ROOT format | |
2425 | ||
2426 | cout << "EventHeader : fReaderROOT->GetEquipmentSize() :" << fReaderROOT->GetEquipmentSize() << endl; | |
2427 | cout << "EventHeader : fReaderROOT->GetType() :" << fReaderROOT->GetType() << endl; | |
2428 | cout << "EventHeader : fReaderROOT->GetRunNumber() :" << fReaderROOT->GetRunNumber() << endl; | |
2429 | cout << "EventHeader : fReaderROOT->GetEventId() :" << *(fReaderROOT->GetEventId()) << endl; | |
2430 | cout << "EventHeader : fReaderROOT->GetLDCId() :" << fReaderROOT->GetLDCId() << endl; | |
2431 | cout << "EventHeader : fReaderROOT->GetGDCId() :" << fReaderROOT->GetGDCId() << endl; | |
2432 | } | |
2433 | ||
2434 | //__________________________________________________________________ | |
ca7b8371 | 2435 | void AliTPCMonitor::DumpHeader(AliTPCMonitorDateFormat* dateform) const |
48265b32 | 2436 | { |
2437 | // Dump Event header for DATE format | |
2438 | ||
ca7b8371 | 2439 | cout << "EquipmentHeader : dateform->GetEquipmentSize() :" << dateform->GetEquipmentSize() << endl; |
2440 | cout << "EquipmentHeader : dateform->GetEquipmentType() :" << dateform->GetEquipmentType() << endl; | |
2441 | cout << "EquipmentHeader : dateform->GetEquipmentID() :" << dateform->GetEquipmentID() << endl; | |
2442 | cout << "EquipmentHeader : dateform->GetEquipmentTypeAttribute() :" << dateform->GetEquipmentTypeAttribute() << endl; | |
2443 | cout << "EquipmentHeader : dateform->GetEquipmentBasicSize() :" << dateform->GetEquipmentBasicSize() << endl; | |
2444 | cout << "EquipmentHeader : dateform->GetEquipmentHeaderSize() :" << dateform->GetEquipmentHeaderSize() << endl; | |
2445 | cout << "EquipmentHeader : dateform->IsLastSubEventHeader() :" << dateform->IsLastSubEventHeader() << endl; | |
48265b32 | 2446 | } |
2447 | ||
2448 | //__________________________________________________________________ | |
2449 | Double_t AliTPCMonitor::Gamma4(Double_t* x, Double_t* par) { | |
2450 | ||
2451 | // Gamma4 function used to fit signals | |
2452 | // Defined in sections: diverging branch set to 0 | |
2453 | ||
2454 | Double_t val = 0.0; | |
2455 | if(x[0] > par[1]) | |
2456 | val = par[0]*exp(4.0)* pow((x[0]-par[1])/par[2],4)*exp(-4.0*(x[0]-par[1])/par[2])+ par[3]; | |
2457 | else | |
2458 | val = 0; | |
2459 | return val; | |
2460 | } | |
2461 | ||
2462 | //__________________________________________________________________ | |
2463 | TCanvas* AliTPCMonitor::CreateCanvas(Char_t* name) | |
2464 | { | |
2465 | // Create Canvases | |
2466 | ||
2467 | TCanvas* canv =0; | |
2468 | ||
2469 | Int_t xoffset = GetCanvasXOffset(); | |
2470 | Int_t xsize = GetCanvasXSize(); | |
2471 | Int_t ysize = GetCanvasYSize(); | |
2472 | Int_t xspace = GetCanvasXSpace(); | |
2473 | Int_t yspace = GetCanvasYSpace(); | |
2474 | ||
2475 | // ROC 2dim max distribution | |
2476 | if( strcmp(name,"coroc" )==0) { canv = new TCanvas("coroc" ,"coroc" , -1+xoffset,(Int_t)(yspace+0.5*ysize) ,(Int_t)(1.5*xsize),(Int_t)(1.5*ysize)); return canv; } | |
2477 | else if(strcmp(name,"ciroc" )==0) { canv = new TCanvas("ciroc" ,"ciroc" , -1+xoffset, 0 ,(Int_t)(1.5*xsize),(Int_t)(1.5*ysize)); return canv; } | |
2478 | // ROC 2dim rms distribution | |
2479 | else if(strcmp(name,"crmsoroc" )==0) { canv = new TCanvas("crmsoroc" ,"crmsoroc" , -1+xoffset,(Int_t)(yspace+0.5*ysize) ,(Int_t)(1.5*xsize),(Int_t)(1.5*ysize)); return canv; } | |
2480 | else if(strcmp(name,"crmsiroc" )==0) { canv = new TCanvas("crmsiroc" ,"crmsiroc" , -1+xoffset, 0 ,(Int_t)(1.5*xsize),(Int_t)(1.5*ysize)); return canv; } | |
2481 | // Global ADC max Histos | |
2482 | else if(strcmp(name,"SIDE C all" )==0) { canv = new TCanvas("SIDE C all" ,"SIDE C all" , (Int_t)(3*xspace+ xoffset),(Int_t)(yspace+0.5*ysize) ,(Int_t)(1.5*xsize),(Int_t)(1.5*ysize)); return canv; } | |
2483 | else if(strcmp(name,"SIDE A all" )==0) { canv = new TCanvas("SIDE A all" ,"SIDE A all" , (Int_t)(3*xspace+ xoffset), 0 ,(Int_t)(1.5*xsize),(Int_t)(1.5*ysize)); return canv; } | |
2484 | // 1 dim max sum basekine distribution | |
2485 | else if(strcmp(name,"cmax" )==0) { canv = new TCanvas("cmax" ,"cmax" , -1+xoffset, 3*yspace ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; } | |
2486 | else if(strcmp(name,"csum" )==0) { canv = new TCanvas("csum" ,"csum" , xspace+xoffset, 3*yspace ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; } | |
2487 | else if(strcmp(name,"cbasemean" )==0) { canv = new TCanvas("cbasemean" ,"cbasemean" , 2*xspace+xoffset, 3*yspace ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; } | |
2488 | else if(strcmp(name,"cbaserms" )==0) { canv = new TCanvas("cbaserms" ,"cbaserms" , 3*xspace+xoffset, 3*yspace ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; } | |
2489 | // Projections of single channel | |
2490 | else if(strcmp(name,"coroc_ch" )==0) { canv = new TCanvas("coroc_ch" ,"coroc_ch" , (Int_t)(1.5*xspace+xoffset),(Int_t)(yspace+0.5*ysize),(Int_t)(1.5*xsize),(Int_t)(1.5*ysize)); return canv; } | |
2491 | else if(strcmp(name,"ciroc_ch" )==0) { canv = new TCanvas("ciroc_ch" ,"ciroc_ch" , (Int_t)(1.5*xspace+xoffset), 0 ,(Int_t)(1.5*xsize),(Int_t)(1.5*ysize)); return canv; } | |
2492 | // FFT for single channel | |
2493 | else if(strcmp(name,"coroc_ch_trans")==0) { canv = new TCanvas("coroc_ch_trans","coroc_ch_trans",(Int_t)(3.0*xspace+xoffset),(Int_t)(yspace+0.5*ysize),(Int_t)(1.5*xsize),(Int_t)(1.5*ysize)); return canv; } | |
2494 | else if(strcmp(name,"ciroc_ch_trans")==0) { canv = new TCanvas("ciroc_ch_trans","ciroc_ch_trans",(Int_t)(3.0*xspace+xoffset), 0 ,(Int_t)(1.5*xsize),(Int_t)(1.5*ysize)); return canv; } | |
2495 | // row profile histograms | |
ca7b8371 | 2496 | else if(strcmp(name,"crowtime" )==0) { canv = new TCanvas("crowtime" ,"crowtime" , 1*xspace+xoffset, 2*yspace +ysize ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; } |
2497 | else if(strcmp(name,"crowmax" )==0) { canv = new TCanvas("crowmax" ,"crowmax" , 2*xspace+xoffset, 2*yspace +ysize ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; } | |
2498 | else if(strcmp(name,"cxmax" )==0) { canv = new TCanvas("cxmax" ,"cxmax" , 3*xspace+xoffset, 2*yspace +ysize ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; } | |
48265b32 | 2499 | else { cout << " Warning Canvas name unknown " << endl; return 0 ; } |
2500 | } | |
2501 | ||
2502 | //__________________________________________________________________ | |
2503 | void AliTPCMonitor::WriteHistos() | |
2504 | { | |
2505 | // Writes all available histograms to a file in current directory | |
2506 | // File name will be specified by : sector, side, runid and eventnumber | |
2507 | ||
2508 | if(GetEventProcessed()) | |
2509 | { | |
2510 | AliInfo("Write histos to file"); | |
2511 | Char_t name[256]; | |
2512 | sprintf(name,"SIDE_%i_SECTOR_%02i_RUN_%05i_EventID_%06i.root",(GetLastSector()/18),(GetLastSector()%18),fRunId,fEventNumber); | |
2513 | TFile* f = new TFile(name,"recreate"); | |
2514 | for(Int_t i =0; i<fHistList->GetEntries(); i++) | |
2515 | { | |
2516 | if(((TH1*)fHistList->At(i))!=0) | |
2517 | { | |
2518 | ((TH1*)fHistList->At(i))->Write(); | |
2519 | } | |
2520 | } | |
2521 | f->ls(); | |
2522 | f->Close(); | |
2523 | } | |
2524 | else | |
2525 | { | |
2526 | AliError("No Event Processed : Chose Format , File and push 'Next Event' "); | |
2527 | } | |
2528 | } | |
2529 | ||
2530 | ||
2531 | //__________________________________________________________________ | |
2532 | TH1* AliTPCMonitor::GetHisto(char* histname) | |
2533 | { | |
2534 | ||
2535 | // Returns histogram specified by histname | |
2536 | // check available names for histos in CreateHistos() | |
2537 | ||
2538 | TH1* hist = 0; | |
2539 | if((TH1*)fHistList->FindObject(histname)) | |
2540 | { | |
2541 | hist = (TH1*)fHistList->FindObject(histname); | |
2542 | } | |
ca7b8371 | 2543 | else |
48265b32 | 2544 | { |
2545 | cout << " AliTPCMonitor::GetHisto :: Can not find histo with name " << histname << endl; | |
2546 | } | |
2547 | return hist ; | |
2548 | } |