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