1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.3 2007/10/12 13:36:27 cvetan
19 Coding convention fixes from Stefan
21 Revision 1.2 2007/09/18 09:44:45 cvetan
22 Sorting out some issues concerning the compilation with and without DATE support
24 Revision 1.1 2007/09/17 10:23:31 cvetan
25 New TPC monitoring package from Stefan Kniege. The monitoring package can be started by running TPCMonitor.C macro located in macros folder.
29 ////////////////////////////////////////////////////////////////////////
31 //// AliTPCMonitor class
33 //// Main class for TPC Monitor
34 //// Monitor can handle rootified data, files and online streams in DATE format.
35 //// The monitor GUI is started by the macro TPCMonitor.C
37 //// In the The data are read in in two read cycles.
38 //// If no sector is specified (sectorid==-1) all sectors are read and only the max value
39 //// for each channel is stored in a global histogram for Side A and C.
40 //// In this way the whole TPC can be read in at once.
42 //// If the sector is specified only one sector is read in and additional quantities
43 //// e.g baseline and baseline rms are calculated and stored.
45 //// Author: Stefan Kniege, IKF, Frankfurt
48 /////////////////////////////////////////////////////////////////////////
53 #include "AliTPCMonitor.h"
54 #include "AliTPCMonitorMappingHandler.h"
55 #include "AliTPCMonitorDateFile.h"
56 #include "AliTPCMonitorDateFormat.h"
57 #include "AliTPCMonitorAltro.h"
58 #include "AliTPCMonitorFFT.h"
59 #include "AliRawReaderRoot.h"
60 #include "AliRawReader.h"
68 #include "TDirectory.h"
70 #include "TPaveText.h"
72 #include <Riostream.h>
73 #include "AliTPCMonitorDateMonitor.h"
75 ClassImp(AliTPCMonitor)
77 //____________________________________________________________________________
78 AliTPCMonitor::AliTPCMonitor(char* name, char* title) :
79 AliTPCMonitorConfig(name,title),
80 fPad(new Int_t*[GetMaxHwAddr()]),
81 fPadMapHw(new Float_t[GetMaxHwAddr()]),
82 fPadMapRCU(new Int_t*[GetMaxHwAddr()]),
100 fHistAddrBaseMean(0),
104 fHistDistrSumIROC(0),
105 fHistDistrMaxIROC(0),
106 fHistDistrSumOROC(0),
107 fHistDistrMaxOROC(0),
108 fHistDistrBase2dIROC(0),
109 fHistDistrBase2dOROC(0),
110 fHistDistrBaseRmsIROC(0),
111 fHistDistrBaseMeanIROC(0),
112 fHistDistrBaseRmsOROC(0),
113 fHistDistrBaseMeanOROC(0),
116 fHistList(new TObjArray()),
143 fMapEqidsSec(new Int_t*[36]),
144 fMapEqidsRcu(new Int_t[1000]),
154 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[GetTimeBins()];}
155 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];}
156 for(Int_t i = 0; i<36; i++) { fMapEqidsSec[i] = new Int_t[6];}
160 if (!gDirectory->GetList())
162 Warning("Build","Current directory is not a valid directory");
165 AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(GetName());
168 Warning("Build","Replacing existing histogram: %s (Potential memory leak).",GetName());
169 gDirectory->GetList()->Remove(hold);
171 gDirectory->Append(this);
178 //____________________________________________________________________________
179 AliTPCMonitor::AliTPCMonitor(const AliTPCMonitor &monitor):
180 AliTPCMonitorConfig(monitor.GetName(),monitor.GetTitle()),
181 fPad(new Int_t*[GetMaxHwAddr()]),
182 fPadMapHw(new Float_t[GetMaxHwAddr()]),
183 fPadMapRCU(new Int_t*[GetMaxHwAddr()]),
199 fHistAddrMapIndex(0),
201 fHistAddrBaseMean(0),
205 fHistDistrSumIROC(0),
206 fHistDistrMaxIROC(0),
207 fHistDistrSumOROC(0),
208 fHistDistrMaxOROC(0),
209 fHistDistrBase2dIROC(0),
210 fHistDistrBase2dOROC(0),
211 fHistDistrBaseRmsIROC(0),
212 fHistDistrBaseMeanIROC(0),
213 fHistDistrBaseRmsOROC(0),
214 fHistDistrBaseMeanOROC(0),
217 fHistList(new TObjArray()),
218 fkNRowsIroc(monitor.fkNRowsIroc),
219 fkNRowsOroc(monitor.fkNRowsOroc),
220 fkNPadsIroc(monitor.fkNPadsIroc),
221 fkNPadsOroc(monitor.fkNPadsOroc),
222 fkNPadMinIroc(monitor.fkNPadMinIroc),
223 fkNPadMinOroc(monitor.fkNPadMinOroc),
224 fkNPadMaxIroc(monitor.fkNPadMaxIroc),
225 fkNPadMaxOroc(monitor.fkNPadMaxOroc),
226 fVerb(monitor.fVerb),
227 fLastEv(monitor.fLastEv),
228 fEventNumber(monitor.fEventNumber),
229 fEventNumberOld(monitor.fEventNumberOld),
230 fDisableFit(monitor.fDisableFit),
231 fExecGlob(monitor.fExecGlob),
232 fExecPlaneMax(monitor.fExecPlaneMax),
233 fExecPadIrocRms(monitor.fExecPadIrocRms),
234 fExecPadOrocRms(monitor.fExecPadOrocRms),
235 fRunId(monitor.fRunId),
236 fEqId(monitor.fEqId),
237 fPadUsedRoc(monitor.fPadUsedRoc),
238 fPadUsedHwAddr(monitor.fPadUsedHwAddr),
239 fGdcId(monitor.fGdcId),
240 fLdcId(monitor.fLdcId),
241 fLdcIdOld(monitor.fLdcIdOld),
242 fMapEqidsSec(new Int_t*[36]),
243 fMapEqidsRcu(new Int_t[1000]),
244 fMirror(monitor.fMirror),
245 fChannelIter(monitor.fChannelIter),
246 fMapHand(monitor.fMapHand),
247 fReaderROOT(monitor.fReaderROOT),
248 fReaderDATE(monitor.fReaderDATE),
249 fReaderDATEMon(monitor.fReaderDATEMon)
253 fHistIROC=(TH2F*)monitor.fHistIROC->Clone(); fHistList->Add(fHistIROC);
254 fHistOROC=(TH2F*)monitor.fHistOROC->Clone(); fHistList->Add(fHistOROC);
255 fHistIROCIndex=(TH2S*)monitor.fHistIROCIndex->Clone(); fHistList->Add(fHistIROCIndex);
256 fHistOROCIndex=(TH2S*)monitor.fHistOROCIndex->Clone(); fHistList->Add(fHistOROCIndex);
257 fHistIROCTime=(TH2F*)monitor.fHistIROCTime->Clone(); fHistList->Add(fHistIROCTime);
258 fHistOROCTime=(TH2F*)monitor.fHistOROCTime->Clone(); fHistList->Add(fHistOROCTime);
259 fHistIROCClone=(TH2F*)monitor.fHistIROCClone->Clone(); fHistList->Add(fHistIROCClone);
260 fHistOROCClone=(TH2F*)monitor.fHistOROCClone->Clone(); fHistList->Add(fHistOROCClone);
261 fHistIROCRMS=(TH2F*)monitor.fHistIROCRMS->Clone(); fHistList->Add(fHistIROCRMS);
262 fHistOROCRMS=(TH2F*)monitor.fHistOROCRMS->Clone(); fHistList->Add(fHistOROCRMS);
263 fHistIROCBASE=(TH2F*)monitor.fHistIROCBASE->Clone(); fHistList->Add(fHistIROCBASE);
264 fHistOROCBASE=(TH2F*)monitor.fHistOROCBASE->Clone(); fHistList->Add(fHistOROCBASE);
265 fHistIROCSUM=(TH2F*)monitor.fHistIROCSUM->Clone(); fHistList->Add(fHistIROCSUM);
266 fHistOROCSUM=(TH2F*)monitor.fHistOROCSUM->Clone(); fHistList->Add(fHistOROCSUM);
268 fHistChannelTime=(TH2F*)monitor.fHistChannelTime->Clone(); fHistList->Add(fHistChannelTime);
270 fHistAddrMapIndex=(TH1F*)monitor.fHistAddrMapIndex->Clone(); fHistList->Add(fHistAddrMapIndex);
271 fHistAddrMaxAdc=(TH1F*)monitor.fHistAddrMaxAdc->Clone(); fHistList->Add(fHistAddrMaxAdc);
272 fHistAddrBaseMean=(TH1F*)monitor.fHistAddrBaseMean->Clone(); fHistList->Add(fHistAddrBaseMean);
273 fHistAddrMaxAdcX=(TH1F*)monitor.fHistAddrMaxAdcX->Clone(); fHistList->Add(fHistAddrMaxAdcX);
274 fHistAddrAdcSum=(TH1F*)monitor.fHistAddrAdcSum->Clone(); fHistList->Add(fHistAddrAdcSum);
275 fHistAddrBaseRms=(TH1F*)monitor.fHistAddrBaseRms->Clone(); fHistList->Add(fHistAddrBaseRms);
278 fHistDistrSumIROC=(TH1F*)monitor.fHistDistrSumIROC->Clone(); fHistList->Add(fHistDistrSumIROC);
279 fHistDistrMaxIROC=(TH1F*)monitor.fHistDistrMaxIROC->Clone(); fHistList->Add(fHistDistrMaxIROC);
280 fHistDistrSumOROC=(TH1F*)monitor.fHistDistrSumOROC->Clone(); fHistList->Add(fHistDistrSumOROC);
281 fHistDistrMaxOROC=(TH1F*)monitor.fHistDistrMaxOROC->Clone(); fHistList->Add(fHistDistrMaxOROC);
283 fHistDistrBase2dIROC=(TH2F*)monitor.fHistDistrBase2dIROC->Clone(); fHistList->Add(fHistDistrBase2dIROC);
284 fHistDistrBase2dOROC=(TH2F*)monitor.fHistDistrBase2dOROC->Clone(); fHistList->Add(fHistDistrBase2dOROC);
285 fHistDistrBaseRmsIROC=(TH1D*)monitor.fHistDistrBaseRmsIROC->Clone(); fHistList->Add(fHistDistrBaseRmsIROC);
286 fHistDistrBaseMeanIROC=(TH1D*)monitor.fHistDistrBaseMeanIROC->Clone(); fHistList->Add(fHistDistrBaseMeanIROC);
287 fHistDistrBaseRmsOROC=(TH1D*)monitor.fHistDistrBaseRmsOROC->Clone(); fHistList->Add(fHistDistrBaseRmsOROC);
288 fHistDistrBaseMeanOROC=(TH1D*)monitor.fHistDistrBaseMeanOROC->Clone(); fHistList->Add(fHistDistrBaseMeanOROC);
290 fHistGlobalMaxA=(TH2S*)monitor.fHistGlobalMaxA->Clone(); fHistList->Add(fHistGlobalMaxA);
291 fHistGlobalMaxC=(TH2S*)monitor.fHistGlobalMaxC->Clone(); fHistList->Add(fHistGlobalMaxC);
293 // fPad = new Int_t*[monitor.GetMaxHwAddr()];
294 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[monitor.GetTimeBins()];}
296 //fPadMapRCU = new Int_t*[monitor.GetMaxHwAddr()];
297 for(Int_t i = 0; i<monitor.GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];}
299 //fPadMapHw = new Float_t[monitor.GetMaxHwAddr()];
301 //fMapEqidsRcu = new Int_t[1000];
302 //fMapEqidsSec = new Int_t*[36];
303 for(Int_t i = 0; i<36; i++) { fMapEqidsSec[i] = new Int_t[6];}
308 if (!gDirectory->GetList())
310 Warning("Build","Current directory is not a valid directory");
315 AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(monitor.GetName());
318 Warning("Build","Replacing existing histogram: %s (Potential memory leak).",monitor.GetName());
319 gDirectory->GetList()->Remove(hold);
321 gDirectory->Append(this);
327 //____________________________________________________________________________
329 AliTPCMonitor &AliTPCMonitor:: operator= (const AliTPCMonitor& monitor)
331 // assigment operator
334 ((AliTPCMonitorConfig *)this)->operator=(monitor);
335 fkNRowsIroc=monitor.fkNRowsIroc;
336 fkNRowsOroc=monitor.fkNRowsOroc;
337 fkNPadsIroc=monitor.fkNPadsIroc;
338 fkNPadsOroc=monitor.fkNPadsOroc;
339 fkNPadMinIroc=monitor.fkNPadMinIroc;
340 fkNPadMinOroc=monitor.fkNPadMinOroc;
341 fkNPadMaxIroc=monitor.fkNPadMaxIroc;
342 fkNPadMaxOroc=monitor.fkNPadMaxOroc;
344 fLastEv=monitor.fLastEv;
345 fEventNumber=monitor.fEventNumber;
346 fEventNumberOld=monitor.fEventNumberOld;
347 fDisableFit=monitor.fDisableFit;
348 fExecGlob=monitor.fExecGlob;
349 fExecPlaneMax=monitor.fExecPlaneMax;
350 fExecPadIrocRms=monitor.fExecPadIrocRms;
351 fExecPadOrocRms=monitor.fExecPadOrocRms;
352 fRunId=monitor.fRunId;
354 fPadUsedRoc=monitor.fPadUsedRoc;
355 fPadUsedHwAddr=monitor.fPadUsedHwAddr;
356 fGdcId=monitor.fGdcId;
357 fLdcId=monitor.fLdcId;
358 fLdcIdOld=monitor.fLdcIdOld;
359 fMapHand=monitor.fMapHand;
360 fReaderROOT=monitor.fReaderROOT;
361 fReaderDATE=monitor.fReaderDATE;
364 fHistList = new TObjArray();
365 fHistIROC=(TH2F*)monitor.fHistIROC->Clone(); fHistList->Add(fHistIROC);
366 fHistOROC=(TH2F*)monitor.fHistOROC->Clone(); fHistList->Add(fHistOROC);
367 fHistIROCIndex=(TH2S*)monitor.fHistIROCIndex->Clone(); fHistList->Add(fHistIROCIndex);
368 fHistOROCIndex=(TH2S*)monitor.fHistOROCIndex->Clone(); fHistList->Add(fHistOROCIndex);
369 fHistIROCTime=(TH2F*)monitor.fHistIROCTime->Clone(); fHistList->Add(fHistIROCTime);
370 fHistOROCTime=(TH2F*)monitor.fHistOROCTime->Clone(); fHistList->Add(fHistOROCTime);
371 fHistIROCClone=(TH2F*)monitor.fHistIROCClone->Clone(); fHistList->Add(fHistIROCClone);
372 fHistOROCClone=(TH2F*)monitor.fHistOROCClone->Clone(); fHistList->Add(fHistOROCClone);
373 fHistIROCRMS=(TH2F*)monitor.fHistIROCRMS->Clone(); fHistList->Add(fHistIROCRMS);
374 fHistOROCRMS=(TH2F*)monitor.fHistOROCRMS->Clone(); fHistList->Add(fHistOROCRMS);
375 fHistIROCBASE=(TH2F*)monitor.fHistIROCBASE->Clone(); fHistList->Add(fHistIROCBASE);
376 fHistOROCBASE=(TH2F*)monitor.fHistOROCBASE->Clone(); fHistList->Add(fHistOROCBASE);
377 fHistIROCSUM=(TH2F*)monitor.fHistIROCSUM->Clone(); fHistList->Add(fHistIROCSUM);
378 fHistOROCSUM=(TH2F*)monitor.fHistOROCSUM->Clone(); fHistList->Add(fHistOROCSUM);
380 fHistChannelTime=(TH2F*)monitor.fHistChannelTime->Clone(); fHistList->Add(fHistChannelTime);
382 fHistAddrMapIndex=(TH1F*)monitor.fHistAddrMapIndex->Clone(); fHistList->Add(fHistAddrMapIndex);
383 fHistAddrMaxAdc=(TH1F*)monitor.fHistAddrMaxAdc->Clone(); fHistList->Add(fHistAddrMaxAdc);
384 fHistAddrBaseMean=(TH1F*)monitor.fHistAddrBaseMean->Clone(); fHistList->Add(fHistAddrBaseMean);
385 fHistAddrMaxAdcX=(TH1F*)monitor.fHistAddrMaxAdcX->Clone(); fHistList->Add(fHistAddrMaxAdcX);
386 fHistAddrAdcSum=(TH1F*)monitor.fHistAddrAdcSum->Clone(); fHistList->Add(fHistAddrAdcSum);
387 fHistAddrBaseRms=(TH1F*)monitor.fHistAddrBaseRms->Clone(); fHistList->Add(fHistAddrBaseRms);
390 fHistDistrSumIROC=(TH1F*)monitor.fHistDistrSumIROC->Clone(); fHistList->Add(fHistDistrSumIROC);
391 fHistDistrMaxIROC=(TH1F*)monitor.fHistDistrMaxIROC->Clone(); fHistList->Add(fHistDistrMaxIROC);
392 fHistDistrSumOROC=(TH1F*)monitor.fHistDistrSumOROC->Clone(); fHistList->Add(fHistDistrSumOROC);
393 fHistDistrMaxOROC=(TH1F*)monitor.fHistDistrMaxOROC->Clone(); fHistList->Add(fHistDistrMaxOROC);
395 fHistDistrBase2dIROC=(TH2F*)monitor.fHistDistrBase2dIROC->Clone(); fHistList->Add(fHistDistrBase2dIROC);
396 fHistDistrBase2dOROC=(TH2F*)monitor.fHistDistrBase2dOROC->Clone(); fHistList->Add(fHistDistrBase2dOROC);
397 fHistDistrBaseRmsIROC=(TH1D*)monitor.fHistDistrBaseRmsIROC->Clone(); fHistList->Add(fHistDistrBaseRmsIROC);
398 fHistDistrBaseMeanIROC=(TH1D*)monitor.fHistDistrBaseMeanIROC->Clone(); fHistList->Add(fHistDistrBaseMeanIROC);
399 fHistDistrBaseRmsOROC=(TH1D*)monitor.fHistDistrBaseRmsOROC->Clone(); fHistList->Add(fHistDistrBaseRmsOROC);
400 fHistDistrBaseMeanOROC=(TH1D*)monitor.fHistDistrBaseMeanOROC->Clone(); fHistList->Add(fHistDistrBaseMeanOROC);
402 fHistGlobalMaxA=(TH2S*)monitor.fHistGlobalMaxA->Clone(); fHistList->Add(fHistGlobalMaxA);
403 fHistGlobalMaxC=(TH2S*)monitor.fHistGlobalMaxC->Clone(); fHistList->Add(fHistGlobalMaxC);
405 fPad = new Int_t*[monitor.GetMaxHwAddr()];
406 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[monitor.GetTimeBins()];}
408 fPadMapRCU = new Int_t*[monitor.GetMaxHwAddr()];
409 for(Int_t i = 0; i<monitor.GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];}
411 fPadMapHw = new Float_t[monitor.GetMaxHwAddr()];
413 fMapEqidsRcu = new Int_t[1000];
414 fMapEqidsSec = new Int_t*[36];
415 for(Int_t i = 0; i<36; i++) { fMapEqidsSec[i] = new Int_t[6];}
420 if (!gDirectory->GetList())
422 Warning("Build","Current directory is not a valid directory");
425 AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(monitor.GetName());
428 Warning("Build","Replacing existing histogram: %s (Potential memory leak).",monitor.GetName());
429 gDirectory->GetList()->Remove(hold);
431 gDirectory->Append(this);
433 fReaderDATEMon=monitor.fReaderDATEMon;
439 //____________________________________________________________________________
440 AliTPCMonitor::~AliTPCMonitor()
444 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { delete[] fPad[i] ;}
445 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { delete[] fPadMapRCU[i];}
450 //____________________________________________________________________________
451 void AliTPCMonitor::CreateHistos()
453 // Create histograms to be displayed
455 if(fVerb) cout << " create new ones " << endl;
456 fHistIROC = new TH2F("fHistIROC" ,"fHistIROC" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROC);
457 fHistOROC = new TH2F("fHistOROC" ,"fHistOROC" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROC);
459 fHistIROCIndex = new TH2S("fHistIROCIndex" ,"fHistIROCIndex" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCIndex);
460 fHistOROCIndex = new TH2S("fHistOROCIndex" ,"fHistOROCIndex" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCIndex);
462 fHistIROCTime = new TH2F("fHistIROCTime" ,"fHistIROCTime" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCTime);
463 fHistOROCTime = new TH2F("fHistOROCTime" ,"fHistOROCTime" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCTime);
465 fHistIROCRMS = new TH2F("fHistIROCRMS" ,"fHistIROCRMS" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCRMS);
466 fHistOROCRMS = new TH2F("fHistOROCRMS" ,"fHistOROCRMS" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCRMS);
468 fHistIROCSUM = new TH2F("fHistIROCSUM" ,"fHistIROCSUM" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCSUM);
469 fHistOROCSUM = new TH2F("fHistOROCSUM" ,"fHistOROCSUM" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCSUM);
471 fHistIROCBASE = new TH2F("fHistIROCBASE" ,"fHistIROCBASE" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCBASE);
472 fHistOROCBASE = new TH2F("fHistOROCBASE" ,"fHistOROCBASE" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCBASE);
475 fHistChannelTime = new TH2F("fHistChannelTime" ,"fHistChannelTime" ,GetNumOfChannels(),0,GetNumOfChannels(),GetTimeBins(),0,GetTimeBins());fHistList->Add(fHistChannelTime);
476 fHistAddrMapIndex = new TH1F("fHistAddrMapIndex" ,"fHistAddrMapIndex" ,GetMaxHwAddr() ,0,GetMaxHwAddr()); fHistList->Add(fHistAddrMapIndex);
477 fHistAddrMaxAdc = new TH1F("fHistAddrMaxAdc" ,"fHistAddrMaxAdc" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrMaxAdc);
478 fHistAddrMaxAdcX = new TH1F("fHistAddrMaxAdcX" ,"fHistAddrMaxAdcX" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrMaxAdcX);
479 fHistAddrBaseMean = new TH1F("fHistAddrBaseMean" ,"fHistAddrBaseMean" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrBaseMean);
480 fHistAddrAdcSum = new TH1F("fHistAddrAdcSum" ,"fHistAddrAdcSum" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrAdcSum);
481 fHistAddrBaseRms = new TH1F("fHistAddrBaseRms" ,"fHistAddrBaseRms" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrBaseRms);
482 fHistDistrSumIROC = new TH1F("fHistDistrSumIROC" ,"fHistDistrSumIROC" ,400,0.0,4000.0); fHistList->Add(fHistDistrSumIROC);
483 fHistDistrMaxIROC = new TH1F("fHistDistrMaxIROC" ,"fHistDistrMaxIROC" ,500,0.0,1000.0); fHistList->Add(fHistDistrMaxIROC);
484 fHistDistrSumOROC = new TH1F("fHistDistrSumOROC" ,"fHistDistrSumOROC" ,400,0.0,4000.0); fHistList->Add(fHistDistrSumOROC);
485 fHistDistrMaxOROC = new TH1F("fHistDistrMaxOROC" ,"fHistDistrMaxOROC" ,500,0.0,1000.0); fHistList->Add(fHistDistrMaxOROC);
487 fHistDistrBase2dIROC = new TH2F("fHistDistrBase2dIROC" ,"fHistDistrBase2dIROC",100,0.0,100.0,100,0.0,10.0); fHistList->Add(fHistDistrBase2dIROC);
488 fHistDistrBase2dOROC = new TH2F("fHistDistrBase2dOROC" ,"fHistDistrBase2dOROC",100,0.0,100.0,100,0.0,10.0); fHistList->Add(fHistDistrBase2dOROC);
490 fHistGlobalMaxA = new TH2S("SIDE A" ,"SIDE A" ,500,-3000,3000,500,-3000,3000); fHistList->Add(fHistGlobalMaxA);
491 fHistGlobalMaxC = new TH2S("SIDE C" ,"SIDE C" ,500,-3000,3000,500,-3000,3000); fHistList->Add(fHistGlobalMaxC);
495 //____________________________________________________________________________
496 Int_t AliTPCMonitor::ProcessEvent()
499 // Depending on the value of the sector id all sectors (sectorid == -1) are processed.
501 // In this case only the maximum values are calculated per pad and filled to the global histograms
502 // In a second loop the last processed(displayed) sector will be processed (sectorid!=-1)
503 // again and the baseline rms and further quantities are calculated
505 // If only one sector should be processed SetProcOneSector(1) should be set.
506 // In this case only the specified (last/last displayed) sector will be processed.
508 // If GetProcNextEvent()==0 the same event will be processed again
512 Int_t retflag = 0; // id of last sector + 1000, or error flag
513 if(GetProcNextEvent()==1 && fLastEv) { AliInfo("Last event already processed"); }
514 if(GetProcNextEvent()==1) ResetSectorArray();
517 if(GetProcNextEvent()==0 || GetProcOneSector()==1 ) sectorid = GetLastSector();
521 retflag = ReadData(sectorid);
523 SetLastProcFile(GetFile());
525 if(retflag>=10 && retflag<1000){ AliError("Could not read event properly: Check file name and format or try next event"); return 0 ;}
530 if(sectorid==-1 && retflag >1000)
532 AliInfo("Second read cycle");
534 if(GetLastSectorDisplayed()==-1) {sectorid = GetLastSector() ; }
535 else {sectorid = GetLastSectorDisplayed(); SetLastSector(sectorid) ; }
536 retflag = ReadData(sectorid);
539 SetLastSectorDisplayed(sectorid) ;
540 fMapHand->ReadfecHwMap(GetLastSector());
543 SetEventProcessed(1);
547 //__________________________________________________________________
548 Int_t AliTPCMonitor::ReadData(Int_t secid)
550 // Read Data File/Stream for specified Format.
551 // Payload will be extracted from either ROOT or DATE format
552 // and passed to FillHistsDecode for decoding of the adc information
554 Int_t format = GetFormat();
557 //if(format==2 && !gSystem->Getenv("DATE_ROOT")) { AliError("DATE not initialized on this system"); return 11;}
559 if( format==0) {return ReadDataROOT(secid);}
560 else if(format==1) {return ReadDataDATEFile(secid);}
563 return ReadDataDATEStream(secid);
566 AliWarning("Function should already be left");
569 //__________________________________________________________________
570 Int_t AliTPCMonitor::ReadDataDATEFile(Int_t secid)
572 // Read Data in Date format.
573 // Date file and monitor will be handled in this function.
575 if(fReaderROOT) { delete fReaderROOT ; fReaderROOT=0;}
578 if(fReaderDATEMon) { delete fReaderDATEMon ; fReaderDATEMon=0;}
581 Char_t* eventPtr = 0;
582 AliTPCMonitorDateFormat* dateform = 0;
585 if( fReaderDATE==0 || ( fReaderDATE!=0 && (strcmp(GetLastProcFile(),GetFile())!=0) ) )
587 cout << " Create new DATE file "<< endl;
588 if(fReaderDATE) { delete fReaderDATE ; fReaderDATE=0; }
589 fReaderDATE = new AliTPCMonitorDateFile() ;
590 fReaderDATE->SetName("fReaderDATE") ;
591 fReaderDATE->OpenDateFile(GetFile()) ;
595 // Get Event pointer ///
596 if(fReaderDATE->IsDateFileOpen() ==false ) { AliError("Could not open Date File"); return 11 ; }
597 // Rewind event if new event number is smaller than old one
598 if(fEventNumberOld>fEventNumber ) { fReaderDATE->ResetFilePos(); }
599 while(GetProcNextEvent() || fEventNumber==0)
601 fReaderDATE->ReadEvent();
602 eventPtr = fReaderDATE->GetMemoryPointer();
603 dateform = new AliTPCMonitorDateFormat(eventPtr);
604 Int_t currentev = dateform->GetEventID();
605 if(fEventNumber <= currentev ){ break; }
608 eventPtr = fReaderDATE->GetMemoryPointer();
610 if(dateform==0) dateform = new AliTPCMonitorDateFormat(eventPtr);
611 fEventNumber = dateform->GetEventID();
612 fEventNumberOld = dateform->GetEventID();
614 if(fReaderDATE->IsLastEvent()) fLastEv =1;
615 if(dateform->IsEventEndOfRun()) { AliInfo("Event is end of run: eventType END_OF_RUN "); }
617 if(fReaderDATE->IsEventValid() == false ) {AliInfo("Skipping Event because invalid"); return 10; }
618 if(dateform->IsEventPhysicsEvent() == false ) {AliInfo("Skipping Header/event because not Physics event"); return 12; }
622 Int_t lastrcu = ReadDataDATESubEventLoop(dateform,secid);
625 if(fVerb) cout << " last rcu " << lastrcu << endl;
631 //__________________________________________________________________
632 Int_t AliTPCMonitor::ReadDataDATEStream(Int_t secid)
634 // Read Data from DATE stream.
635 // Can also be used for DATE file.
638 if(fReaderROOT) { delete fReaderROOT ; fReaderROOT=0;}
639 if(fReaderDATE) { delete fReaderDATE ; fReaderDATE =0; }
641 Char_t* eventPtr = 0;
643 AliTPCMonitorDateFormat* dateform =0 ;
645 // Create objects ///
646 if((fReaderDATEMon==0 || ( fReaderDATEMon!=0 && (strcmp(GetLastProcFile(),GetFile())!=0) )))
648 if(fReaderDATEMon!=0)
650 fReaderDATEMon->Logout();
651 delete fReaderDATEMon;
653 fReaderDATEMon = new AliTPCMonitorDateMonitor();
654 fReaderDATEMon->SetName("DMon");
655 Int_t status = fReaderDATEMon->OpenMonitoring(GetFile());
656 if(status) { AliError(Form("Could not read event online: Error: %s",fReaderDATEMon->DecodeError(status))); return 11; }
659 if(GetProcNextEvent())
661 fReaderDATEMon->Free();
662 Int_t status = fReaderDATEMon->GetEvent();
663 if(status) { AliError(Form("Could not read event online: Error: %s",fReaderDATEMon->DecodeError(status))); return 11 ;}
664 //fReaderDATEMon->Logout();
667 eventPtr = fReaderDATEMon->GetEventPointerasChar();
669 if(dateform==0) dateform = new AliTPCMonitorDateFormat(eventPtr);
670 fEventNumber = dateform->GetEventID();
671 fEventNumberOld = dateform->GetEventID();
673 if(dateform->IsEventEndOfRun()) { AliInfo("Event is end of run: eventType END_OF_RUN "); }
674 if(dateform->IsEventPhysicsEvent() == false ) {AliInfo("Skipping Header/event because not Physics event"); return 12; }
678 Int_t lastrcu = ReadDataDATESubEventLoop(dateform,secid);
681 if(fVerb) cout << " last rcu " << lastrcu << endl;
685 //__________________________________________________________________
686 Int_t AliTPCMonitor::ReadDataDATEStream(Int_t /*secid*/)
688 // Read Data from DATE stream.
689 // Can also be used for DATE file.
690 // In case DATE is not install
691 // this method is dummy
693 AliError("DATE not initialized on this system");
698 Int_t AliTPCMonitor::ReadDataDATESubEventLoop(AliTPCMonitorDateFormat* dateform, Int_t secid)
700 // Loop over DATE Subevents
702 Bool_t exitSubEventLoop = false;
707 Char_t* eventPtr = 0;
708 UInt_t* eventPtrUI = 0;
712 while(exitSubEventLoop == false)
714 if(start==1) { dateform->GotoSubEventHeader() ; start=0;}
715 else { dateform->GotoNextSubEventHeader(); }
716 if(dateform->IsLastSubEventHeader()) exitSubEventLoop = true;
718 if(fVerb) cout << " next subevent LDC " << (Int_t)dateform->GetSubEventLDC() << endl;
725 if(neq ==0){ dateform->GotoFirstEquipment();}
726 else { dateform->GotoNextEquipment();}
728 fGdcId = dateform->GetSubEventGDC() ;
729 fLdcId = dateform->GetSubEventLDC();
730 fRunId = dateform->GetEventRunID();
731 fEqId = dateform->GetEquipmentID();
732 rcupatch = GetRCUPatch(fRunId, fEqId);
733 lastrcuid = (rcupatch+1000);
736 if(fLdcIdOld!=fLdcId && fChannelIter!=0) {
739 FillGlobal(GetLastSector());
751 if(dateform->IsLastEquipment() != false ) lasteq = 1;
753 eventPtr = dateform->GetFirstDataPointer();
754 eventPtrUI = (UInt_t *) eventPtr;
755 Int_t payload = dateform->GetPayloadSize();
757 if(fVerb)DumpHeader(dateform);
758 if(fVerb) cout << "Check sector and fEqId " << endl;
760 if(fVerb && secid >0 )
762 cout << "secid : "<< secid << " fEqId "<< fEqId << " equipment 0 form map " << endl;
763 cout << fMapEqidsSec[secid][0] << endl;
764 cout << " showed map_eqids " << endl;
767 if(CheckEqId(secid,fEqId))
769 if(fVerb) cout << " init altro " << endl;
770 AliTPCMonitorAltro* altro = new AliTPCMonitorAltro((UInt_t *)eventPtrUI,(payload/4),1);
771 altro->SetWrite10Bit(GetWrite10Bit());
772 altro->SetActFilename(GetFile());
773 if(fVerb) cout << " allocated 10bit " << endl;
774 altro->Allocate10BitArray();
775 altro->Decodeto10Bit(fEqId);
776 AliInfo(Form("Process eqid %i , patch %i ",fEqId,rcupatch%6));
777 FillHistsDecode(altro,(rcupatch%6),secid);
778 if(fChannelIter!=0 && secid==-1 ) SetSectorFilled(rcupatch/6);
782 SetLastSector(rcupatch/6);
784 if(fChannelIter!=0 && secid==-1){ FillGlobal(GetLastSector()); }
788 //__________________________________________________________________
789 Int_t AliTPCMonitor::ReadDataROOT(Int_t secid)
791 // Read in data in ROOT format
792 if(fReaderDATE){ delete fReaderDATE ; fReaderDATE=0;}
796 Int_t equipmentSize = 0;
797 UChar_t* eventPtr = 0 ;
798 UInt_t* eventPtrUI = 0 ;
801 if(fReaderROOT==0 || ( fReaderROOT!=0 && (strcmp(GetLastProcFile(),GetFile())!=0) ) )
803 if(fVerb) cout << "AliTPCMonitor::ReadDataROOT create new reader " << endl;
804 if(fReaderROOT) { delete fReaderROOT ; fReaderROOT=0; }
805 fReaderROOT = new AliRawReaderRoot(GetFile());
806 if(!fReaderROOT) { AliError("Could not initiate AliRawReaderRoo "); return 10;}
810 // reset to beginning of the event
811 fReaderROOT->Reset();
813 // Rewind event if new event number is smaller than old one
814 if(fEventNumberOld>fEventNumber) fReaderROOT->RewindEvents();
816 while(GetProcNextEvent() || fEventNumber==0)
818 if(fVerb) cout << "AliTPCMonitor::ReadDataROOT get event " << endl;
819 if(!fReaderROOT->NextEvent()) { AliError("Could not get next Event"); return 11 ;}
820 Int_t currentev = *(fReaderROOT->GetEventId());
822 if(fEventNumber <= currentev ){ break; }
825 fEventNumber = *(fReaderROOT->GetEventId());
826 fEventNumberOld = *(fReaderROOT->GetEventId());
830 while(fReaderROOT->ReadHeader())
832 if(fVerb) cout << "AliTPCMonitor::ReadDataROOT read header " << endl;
833 fGdcId = fReaderROOT->GetGDCId() ;
834 fLdcId = fReaderROOT->GetLDCId() ;
835 fRunId = fReaderROOT->GetRunNumber() ;
836 equipmentSize = fReaderROOT->GetEquipmentSize();
837 fEqId = fReaderROOT->GetEquipmentId();
838 evtype = fReaderROOT->GetType();
839 rcupatch = GetRCUPatch(fRunId, fEqId);
840 lastrcuid = (rcupatch+1000);
842 if(evtype==1) { AliWarning(Form("EventType==1 in event %i ",fEventNumber)); return 10; }
843 if(equipmentSize==0) { AliWarning(Form("Equipmentsize ==0 in event %i ",fEventNumber)); return 10; }
845 if(fVerb) DumpHeader(fReaderROOT);
847 if(fLdcIdOld!=fLdcId && fChannelIter!=0) {
850 FillGlobal(GetLastSector());
861 if(CheckEqId(secid,fEqId))
863 fReaderROOT->ReadNextData(eventPtr);
864 eventPtrUI = (UInt_t *) eventPtr;
866 Int_t fsize = (Int_t)((equipmentSize/4) -offset) +1;
867 AliTPCMonitorAltro* altro = new AliTPCMonitorAltro((UInt_t *)eventPtrUI,fsize,2);
868 altro->SetWrite10Bit(GetWrite10Bit());
869 if(fVerb) cout << "AliTPCMonitor::ReadDataROOT Set Write10bit to " << GetWrite10Bit() << endl;
870 altro->SetActFilename(GetFile());
871 altro->Allocate10BitArray();
872 altro->Decodeto10Bit(fEqId);
873 AliInfo(Form("Process sector %i eqid %i , patch %i ",rcupatch/6,fEqId,rcupatch%6));
874 FillHistsDecode(altro,(rcupatch%6),secid);
875 if(fChannelIter!=0 && secid==-1 ) SetSectorFilled(rcupatch/6);
878 SetLastSector(rcupatch/6);
880 if(fChannelIter!=0 && secid==-1) { FillGlobal(GetLastSector()); }
885 //____________________________________________________________________________
886 void AliTPCMonitor::FillHistsDecode(AliTPCMonitorAltro* altro ,Int_t rcupatch, Int_t secid)
888 // Decode Channels, calculate base mean and rms depending on the
889 // value of secid (see ProcessEvent) and fill histograms
892 if(fVerb) cout << "FillHistsDecode : rcupatch " << rcupatch << " id " << secid << endl;
894 Int_t sampleiter = 0;
895 Int_t samplelength = 0;
896 Int_t samplebins = 0;
904 Int_t nextHwAddress = 0;
908 Int_t lastpos = altro->Get10BitArraySize()-1;
909 Short_t* entries = altro->Get10BitArray();
911 Double_t hmean = 0.0;
912 Int_t supnextpos = 0;
913 TH1D* hbase = new TH1D("hbase","hbase",GetTimeBins(),0.5,(GetTimeBins()+0.5));
917 nextpos = altro->DecodeTrailer(lastpos);
918 supnextpos = altro->GetNextTrailerPos();
919 if(nextpos==-1) { break; }
922 blockpos = altro->GetTrailerBlockPos();
923 hw = altro->GetTrailerHwAddress();
924 nwords = altro->GetTrailerNWords();
925 nextHwAddress = ( hw + (rcupatch<<12) );
926 fPad[fChannelIter][0] = nextHwAddress ;
928 if(fPadMapHw[nextHwAddress]!=-1 )
930 //Int_t hw_before1 = fPad[fChannelIter-2][0];
931 //Int_t hw_before2 = fPad[fChannelIter-3][0];
933 if(fVerb){ cout <<"\n //// Ambiguous hwaddress " << nextHwAddress << " write 10bit files and check file for eqid : " << fEqId << " /////// " << endl;}
935 if( TMath::Abs(fPadMapRCU[nextHwAddress][4] - fChannelIter)==1)
937 if(fVerb) cout << "//// Difference to previous channel==1 : reset branch bit of hw from last channel to 1 " << endl;
938 Int_t hwreset = (nextHwAddress + (1<<11));
939 fPad[fChannelIter-1][0] = hwreset;
941 fPadMapHw[hwreset] = fChannelIter-1 ;
942 fPadMapRCU[hwreset][0]= rcupatch ;
943 fPadMapRCU[hwreset][1]= ((hwreset & AliTPCMonitorAltro::GetHwMaskBranch()) >> 11);
944 fPadMapRCU[hwreset][2]= ((hwreset & AliTPCMonitorAltro::GetHwMaskFEC()) >>7 );
945 fPadMapRCU[hwreset][3]= ( hwreset & AliTPCMonitorAltro::GetHwMaskFECChannel() );
946 fPadMapRCU[hwreset][4]= fChannelIter-1;
947 fPadMapRCU[hwreset][5]= altro->GetTrailerPos();
951 fPadMapHw[nextHwAddress] = fChannelIter ;
952 fPadMapRCU[nextHwAddress][0]= rcupatch ;
953 fPadMapRCU[nextHwAddress][1]= ((nextHwAddress & AliTPCMonitorAltro::GetHwMaskBranch())>> 11) ;
954 fPadMapRCU[nextHwAddress][2]= ((nextHwAddress & AliTPCMonitorAltro::GetHwMaskFEC()) >>7);
955 fPadMapRCU[nextHwAddress][3]= (nextHwAddress & AliTPCMonitorAltro::GetHwMaskFECChannel());
956 fPadMapRCU[nextHwAddress][4]= fChannelIter;
957 fPadMapRCU[nextHwAddress][5]= altro->GetTrailerPos();
971 for(Int_t iterwords = 0 ; iterwords< nwords ; iterwords++)
973 if(entries[blockpos-iterwords]==682) { continue; }
974 if(entries[blockpos-iterwords]!=682 && sampleiter==0)
976 samplelength = entries[blockpos-iterwords];
977 sampleiter = samplelength;
979 timestamp = entries[blockpos-iterwords-1];
984 ntime = timestamp-samplebins;
985 adc = entries[blockpos-iterwords];
986 fPad[fChannelIter][ntime] = adc;
987 if( (adc!=0) && (ntime>=GetRangeBaseMin() ) && (ntime<GetRangeBaseMax() )) {hbase->Fill(adc) ;}
988 if( (adc>max) && (ntime>=GetRangeMaxAdcMin()) && (ntime<GetRangeMaxAdcMax() )) {max = adc;maxx = ntime ;}
989 if( (ntime>=GetRangeSumMin()) && (ntime<GetRangeSumMax() )) {sum+=adc; sumn++;}
994 hmean = hbase->GetMean();
995 hbase->GetXaxis()->SetRangeUser(hmean- hmean/3 , hmean + hmean/3);
996 hmean = hbase->GetMean();
997 hrms = hbase->GetRMS();
999 if( GetPedestals()==1) fHistAddrMaxAdc->SetBinContent( nextHwAddress,max- hmean);
1000 else fHistAddrMaxAdc->SetBinContent( nextHwAddress,max );
1006 fHistDistrBase2dIROC->Fill(hmean,hrms);
1007 fHistDistrSumIROC->Fill(sum);
1008 if( GetPedestals()==1 ) { fHistDistrMaxIROC->Fill(max-hmean); fHistDistrSumIROC->Fill(sum -sumn*hmean);}
1009 else { fHistDistrMaxIROC->Fill(max); fHistDistrSumIROC->Fill(sum );}
1013 fHistDistrBase2dOROC->Fill(hmean,hrms);
1014 fHistDistrSumOROC->Fill(sum);
1015 if( GetPedestals()==1 ){ fHistDistrMaxOROC->Fill(max-hmean); fHistDistrSumOROC->Fill(sum -sumn*hmean);}
1016 else { fHistDistrMaxOROC->Fill(max); fHistDistrSumOROC->Fill(sum) ;}
1019 fHistAddrAdcSum->SetBinContent( nextHwAddress,sum);
1020 fHistAddrMapIndex->SetBinContent(nextHwAddress,fChannelIter);
1021 fHistAddrBaseMean->SetBinContent(nextHwAddress,hmean);
1022 fHistAddrMaxAdcX->SetBinContent( nextHwAddress,maxx);
1023 fHistAddrBaseRms->SetBinContent( nextHwAddress,hrms);
1026 if(nextpos<0) { AliError("Error : next pos < 0 "); break ;}
1033 //____________________________________________________________________________
1034 void AliTPCMonitor::FillHistsPadPlane()
1036 // Fill 2Dim histograms for IROC and OROC (max , rms and sum)
1038 if(fVerb)cout << "AliTPCMonitor::FillHistsPadPlane() Start " << endl;
1039 if(fVerb)PrintConfig();
1046 for(Int_t ch = 0; ch<fChannelIter; ch++)
1049 fHistChannelTime->SetCellContent(ch,0,hwadd);
1051 for(Int_t bin = 1; bin <GetTimeBins(); bin++)
1053 if( fHistChannelTime->GetCellContent(ch,bin)!=0) cout << " cellcontent already set " << endl;
1054 if( GetPedestals()==1 ) fHistChannelTime->SetCellContent(ch,bin,(fPad[ch][bin]- fHistAddrBaseMean->GetBinContent(hwadd)));
1055 else fHistChannelTime->SetCellContent(ch,bin,(fPad[ch][bin]));
1058 pad = fMapHand->GetPad( hwadd);
1059 row = fMapHand->GetPadRow(hwadd);
1060 padmax = fMapHand->GetNumofPads(row);
1064 fHistIROC->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrMaxAdc->GetBinContent( hwadd));
1065 fHistIROCIndex->SetCellContent(row +1 ,pad +55 -padmax/2 +1,ch);
1066 fHistIROCRMS->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrBaseRms->GetBinContent( hwadd));
1067 fHistIROCBASE->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrBaseMean->GetBinContent(hwadd));
1068 fHistIROCSUM->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrAdcSum->GetBinContent( hwadd));
1072 fHistOROC->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrMaxAdc->GetBinContent( hwadd));
1073 fHistOROCIndex->SetCellContent(row-63 +1 ,pad +70 -padmax/2 +1,ch);
1074 fHistOROCRMS->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrBaseRms->GetBinContent( hwadd));
1075 fHistOROCBASE->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrBaseMean->GetBinContent(hwadd));
1076 fHistOROCSUM->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrAdcSum->GetBinContent( hwadd));
1080 fHistChannelTime->GetXaxis()->SetRange(0,fChannelIter);
1081 fHistChannelTime->GetYaxis()->SetRange(0,GetTimeBins());
1086 //____________________________________________________________________________
1087 void AliTPCMonitor::ResetArrays()
1089 // Reset data arrays
1090 for(Int_t row = 0 ; row < fkNRowsIroc; row++)
1092 for(Int_t pad = 0 ; pad < fkNPadsIroc ; pad++)
1094 fHistIROCIndex->SetCellContent(row+1,pad+1,-1);
1097 for(Int_t row = 0 ; row < fkNRowsOroc; row++)
1099 for(Int_t pad = 0 ; pad < fkNPadsOroc ; pad++)
1101 fHistOROCIndex->SetCellContent(row+1,pad+1,-1);
1105 for(Int_t ch= 0; ch<GetMaxHwAddr(); ch++)
1107 fHistAddrMaxAdcX->SetBinContent(ch,-1);
1108 fHistAddrMapIndex->SetBinContent(ch,-1);
1109 fHistAddrMaxAdc->SetBinContent( ch, 0);
1110 fHistAddrBaseMean->SetBinContent( ch, 0);
1111 fHistAddrAdcSum->SetBinContent( ch, 0);
1112 fHistAddrBaseRms->SetBinContent(ch, 0);
1115 for(Int_t ch = 0; ch< GetNumOfChannels(); ch++)
1117 for(Int_t bin = 0; bin< GetTimeBins(); bin++)
1122 for(Int_t ch = 0; ch< GetMaxHwAddr(); ch++)
1125 fPadMapRCU[ch][0]=-1;
1126 fPadMapRCU[ch][1]=-1;
1127 fPadMapRCU[ch][2]=-1;
1128 fPadMapRCU[ch][3]=-1;
1129 fPadMapRCU[ch][4]=-1;
1130 fPadMapRCU[ch][5]=-1;
1136 //____________________________________________________________________________
1137 void AliTPCMonitor::ResetHistos()
1140 for(Int_t i =0; i<fHistList->GetEntries(); i++)
1142 if(GetProcNextEvent()==0 && strcmp(((TH1*)fHistList->At(i))->GetName(),"SIDE A")==0) continue;
1143 if(GetProcNextEvent()==0 && strcmp(((TH1*)fHistList->At(i))->GetName(),"SIDE C")==0) continue;
1144 ((TH1*)fHistList->At(i))->Reset();
1149 //____________________________________________________________________________
1150 void AliTPCMonitor::DeleteHistos()
1152 // Delete histograms
1153 for(Int_t i =0; i<fHistList->GetEntries(); i++)
1155 delete (TH1*)fHistList->At(i);
1160 //__________________________________________________________________
1161 Int_t AliTPCMonitor::CheckEqId(Int_t secid,Int_t eqid)
1163 // Check if equipment id corresponds to any rcu patch in sector
1164 // Equipment ids changed during commisioning in 2006 (starting from run 704)
1165 // However Runids started from 0 again in 2007
1166 // Now only runids from commissioning in 2006 after runid 704 and all new ones are supported.
1167 // Comment in equipment check for runids < 704 if old runs should be processed
1169 if(fVerb) cout << "AliTPCMonitor::CheckEqId : SectorId " << secid << " EquipmentId " << eqid << " runid " << fRunId << endl;
1171 if(fRunId<704 && 0) // commented out --> runs with runid < 704 in 2006 are not recognized anymore
1173 if( (secid>-1) && (secid<36) ) // if ( secid is in range) { take only specific eqids} else { take all }
1175 if( (secid==13) && ( eqid!=408 && eqid!=409 && eqid!=509 && eqid!=512 && eqid!=513 && eqid!=517 )) {passed=0;}
1176 else if( (secid==4) && ( eqid!=404 && eqid!=504 && eqid!=407 && eqid!=503 && eqid!=508 && eqid!=506 )) {passed=0;}
1178 else {if(fVerb) cout << "passed check "<< endl; }
1182 if( (secid>-1) && (secid<36) ) // if ( secid is in range) { take only specific eqids} else { take all }
1184 if(eqid!=fMapEqidsSec[secid][0] && eqid!= fMapEqidsSec[secid][1] && eqid!=fMapEqidsSec[secid][2] &&
1185 eqid!=fMapEqidsSec[secid][3] && eqid!= fMapEqidsSec[secid][4] && eqid!=fMapEqidsSec[secid][5] ) {passed=0;}
1187 else {if(fVerb) cout << "passed check "<< endl;}
1192 //__________________________________________________________________
1193 void AliTPCMonitor::SetEqIds()
1195 // Set mapping for equipment ids
1196 for(Int_t i = 0; i<36 ; i++)
1198 for(Int_t j = 0; j<6; j++)
1200 if(j<2) fMapEqidsSec[i][j]= 768+i*2+j;
1201 else fMapEqidsSec[i][j]= 840+i*4+j-2;
1205 for(Int_t i = 0; i<36 ; i++)
1207 for(Int_t j = 0; j<6; j++)
1209 if(j<2) fMapEqidsRcu[768+i*2+j] = i*6 +j;
1210 else fMapEqidsRcu[840+i*4+j-2] = i*6 +j;
1215 //__________________________________________________________________
1216 void AliTPCMonitor::FillGlobal(Int_t sector)
1219 // Fill global histograms with max adc for each channel
1222 if((sector/18) ==0) hglob = fHistGlobalMaxA;
1223 else hglob = fHistGlobalMaxC;
1225 Float_t rotsec = (2*TMath::Pi()/18.0);
1226 Float_t rot = (-rotsec*(sector%18) +4*rotsec);
1228 Float_t m11 = TMath::Cos(rot);
1229 Float_t m12 = TMath::Sin(rot);
1230 Float_t m21 = -1*TMath::Sin(rot);
1231 Float_t m22 = TMath::Cos(rot);
1233 Int_t max = 0; // use integer for global view
1235 Double_t xval = 0.0;
1236 Double_t yval = 0.0;
1245 for(Int_t hw = 0; hw<fHistAddrMaxAdc->GetNbinsX(); hw++)
1247 max = (Int_t)fHistAddrMaxAdc->GetBinContent(hw);
1250 pad = fMapHand->GetPad( hw);
1251 row = fMapHand->GetPadRow(hw);
1252 padmax = fMapHand->GetNumofPads(row);
1253 GetXY(xval ,yval , padmax,row ,pad);
1254 xdr = xval*m11 +yval*m12;
1255 ydr = xval*m21 +yval*m22;
1256 if(hglob->GetBinContent(hglob->GetXaxis()->FindBin(xdr),hglob->GetYaxis()->FindBin(ydr))==0) hglob->Fill(xdr,ydr,(Int_t)max);
1262 //__________________________________________________________________
1263 void AliTPCMonitor::GetXY( Double_t& xval , Double_t& yval , Int_t padmax, Int_t row , Int_t pad) const
1265 // Get x and y position of pad
1269 xval = fMirror*( 2*padmax -4*pad -2);
1270 yval = 852.25 +7.5*row;
1274 xval = fMirror*( 3*padmax -6*pad -3);
1275 if((row-63)<63) { yval = 10*(row-63) +1351; }
1276 else { yval = 15*(row-63-64)+1993.5; }
1281 //__________________________________________________________________
1282 Int_t AliTPCMonitor::GetPadAtX(Float_t xval, Int_t row, Int_t padmax) const
1284 // Get pad number at given position in x
1287 if(row<63) {pad = (Int_t)( ( (xval/fMirror) +2 -2*padmax)/-4);}
1288 else {pad = (Int_t)( ( (xval/fMirror) +3 -3*padmax)/-6);}
1290 if(pad>=padmax) return -1;
1295 //__________________________________________________________________
1296 Int_t AliTPCMonitor::GetPadAtX(Float_t xval, Int_t row) const
1299 // Get pad number at given position in x
1301 Int_t padmax = fMapHand->GetNumofPads(row);
1304 if(row<63) {pad = (Int_t)( ( (xval/fMirror) +2 -2*padmax)/-4);}
1305 else {pad = (Int_t)( ( (xval/fMirror) +3 -3*padmax)/-6);}
1307 if(pad>=padmax) return -1;
1312 //__________________________________________________________________
1313 void AliTPCMonitor::DrawHists(Int_t histos)
1316 // Draw sets of histograms
1317 // histos==1 : 2Dim histos for MAX adc and add executables
1318 // histos==2 : distributions max/rms/sum
1319 // histos==3 : global max adc for specified SideA/C
1322 if(fVerb) cout << " Draw histos " << endl;
1324 if(GetLastSector()/18==0 ) sprintf(cside,"A");
1325 else sprintf(cside,"C");
1327 Char_t titleSEC[256]; sprintf(titleSEC ,"Sector %i Side %s Run : %05i EventID %i " ,GetLastSector()%18,cside,fRunId, fEventNumber);
1328 Char_t titleEvent[256]; sprintf(titleEvent ,"Time <-> Channles %s" ,titleSEC);
1329 Char_t titleIROC[256]; sprintf(titleIROC ,"IROC %s" ,titleSEC);
1330 Char_t titleOROC[256]; sprintf(titleOROC ,"OROC %s" ,titleSEC);
1332 Char_t titleMAX[256]; sprintf(titleMAX ,"Max (timebin: %i,%i) %s" ,GetRangeMaxAdcMin(),GetRangeMaxAdcMax(),titleSEC);
1333 Char_t titleSUM[256]; sprintf(titleSUM ,"Sum (timebin: %i,%i) %s" ,GetRangeSumMin() ,GetRangeSumMax() ,titleSEC);
1334 Char_t titleBASE[256]; sprintf(titleBASE ,"Baseline RMS<->Mean (timebin: %i-%i) %s" ,GetRangeBaseMin() ,GetRangeBaseMax() ,titleSEC);
1335 Char_t titleMEAN[256]; sprintf(titleMEAN ,"Baseline Mean (timebin: %i-%i) %s" ,GetRangeBaseMin() ,GetRangeBaseMax() ,titleSEC);
1336 Char_t titleRMS[256] ; sprintf(titleRMS ,"Baseline RMS (timebin: %i-%i) %s" ,GetRangeBaseMin() ,GetRangeBaseMax() ,titleSEC);
1340 // IROC _______________________________________________________________
1342 ciroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("ciroc");
1345 ciroc = CreateCanvas("ciroc");
1350 fHistIROC->SetXTitle("row");
1351 fHistIROC->SetYTitle("pad");
1352 if(GetPedestals()) fHistIROC->SetZTitle("max ADC (baseline sub)");
1353 else fHistIROC->SetZTitle("max ADC ");
1354 fHistIROC->SetTitle(titleIROC);
1355 fHistIROC->SetMinimum(0.01);
1356 fHistIROC->Draw("COLZ");
1357 ciroc->UseCurrentStyle();
1360 fHistIROCTime->SetXTitle("row"); fHistIROCTime->SetZTitle("peak time (fit)"); fHistIROCTime->SetYTitle("pad"); fHistIROCTime->SetTitle(titleIROC);
1361 fHistIROCRMS->SetXTitle("row"); fHistIROCRMS->SetZTitle( "baseline rms (ADC)"); fHistIROCRMS->SetYTitle("pad"); fHistIROCRMS->SetTitle(titleIROC);
1365 coroc =(TCanvas*)gROOT->GetListOfCanvases()->FindObject("coroc");
1367 coroc = CreateCanvas("coroc");
1372 fHistOROC->SetXTitle("row");
1373 fHistOROC->SetYTitle("pad");
1374 if(GetPedestals()) fHistOROC->SetZTitle("max ADC (baseline sub)");
1375 else fHistOROC->SetZTitle("max ADC ");
1376 fHistOROC->SetTitle(titleOROC);
1377 fHistOROC->SetMinimum(0.01);
1378 fHistOROC->Draw("COLZ");
1379 coroc->UseCurrentStyle();
1382 fHistOROCTime->SetXTitle("row"); fHistOROCTime->SetZTitle("peak time (fit) (timebins)"); fHistOROCTime->SetYTitle("pad"); fHistOROCTime->SetTitle(titleOROC);
1383 fHistOROCRMS->SetXTitle("row"); fHistOROCRMS->SetZTitle("baseline rms (ADC)"); fHistOROCRMS->SetYTitle("pad"); fHistOROCRMS->SetTitle(titleOROC);
1386 Char_t namesum[256] ; sprintf(namesum,"ADC sum (bins: %i, %i)",GetRangeSumMin() ,GetRangeSumMax() );
1387 fHistIROCSUM->SetXTitle("row"); fHistIROCSUM->SetZTitle(namesum); fHistIROCSUM->SetYTitle("pad"); fHistIROCSUM->SetTitle(titleIROC);
1388 fHistOROCSUM->SetXTitle("row"); fHistOROCSUM->SetZTitle(namesum); fHistOROCSUM->SetYTitle("pad"); fHistOROCSUM->SetTitle(titleOROC);
1391 Char_t namebase[256] ; sprintf(namebase ,"base mean (timbebin: %i, %i )",GetRangeBaseMin(),GetRangeBaseMax());
1392 fHistIROCBASE->SetXTitle("row"); fHistIROCBASE->SetZTitle(namebase); fHistIROCBASE->SetYTitle("pad"); fHistIROCBASE->SetTitle(titleIROC);
1393 fHistOROCBASE->SetXTitle("row"); fHistOROCBASE->SetZTitle(namebase); fHistOROCBASE->SetYTitle("pad"); fHistOROCBASE->SetTitle(titleOROC);
1395 if(fHistIROCClone) fHistIROCClone->Delete();
1396 if(fHistOROCClone) fHistOROCClone->Delete();
1397 fHistIROCClone = (TH2F*)fHistIROC->Clone("fHistIROCClone");
1398 fHistOROCClone = (TH2F*)fHistOROC->Clone("fHistOROCClone");
1401 if(fExecPlaneMax==0)
1404 sprintf(carry1,".x %s/TPC/AliTPCMonitorExec.C(1)",gSystem->Getenv("ALICE_ROOT"));
1405 ciroc->AddExec("pad",carry1);
1406 coroc->AddExec("pad",carry1);
1409 sprintf(carry2,".x %s/TPC/AliTPCMonitorExec.C(2)",gSystem->Getenv("ALICE_ROOT"));
1410 ciroc->AddExec("row",carry2);
1411 coroc->AddExec("row",carry2);
1419 // MAX ADC distribution ____________________________________________
1421 cmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cmax");
1422 if(!cmax) cmax = CreateCanvas("cmax");
1425 fHistDistrMaxIROC->GetXaxis()->SetRangeUser(0.0,1000.0);
1426 fHistDistrMaxIROC->SetXTitle("max ADC (ADC)");
1427 fHistDistrMaxIROC->SetYTitle("counts");
1428 fHistDistrMaxIROC->SetTitle(titleMAX);
1429 fHistDistrMaxIROC->Draw("");
1430 fHistDistrMaxOROC->SetLineColor(2);
1431 fHistDistrMaxOROC->Draw("same");
1433 if(fHistDistrMaxOROC->GetMaximum()> fHistDistrMaxIROC->GetMaximum()) fHistDistrMaxIROC->SetMaximum(fHistDistrMaxOROC->GetMaximum()*1.1);
1435 TLegend* legio = new TLegend(0.6,0.6,0.8,0.8);
1436 legio->SetFillColor(0);
1437 legio->AddEntry(fHistDistrMaxIROC,"IROC","l");
1438 legio->AddEntry(fHistDistrMaxOROC,"OROC","l");
1439 legio->Draw("same");
1441 // ADC sum distribution
1443 csum = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("csum");
1444 if(!csum) csum = CreateCanvas("csum") ;
1447 fHistDistrSumIROC->SetXTitle("sum ADC (ADC)");
1448 fHistDistrSumIROC->SetYTitle("counts");
1449 fHistDistrSumIROC->SetTitle(titleSUM);
1450 fHistDistrSumIROC->Draw("");
1451 fHistDistrSumOROC->SetLineColor(2);
1452 fHistDistrSumOROC->Draw("same");
1453 if(fHistDistrSumOROC->GetMaximum()> fHistDistrSumIROC->GetMaximum()) fHistDistrSumIROC->SetMaximum(fHistDistrSumOROC->GetMaximum()*1.1);
1454 legio->Draw("same");
1456 // BASELINE MEAN distribution
1457 TCanvas* cbasemean = 0;
1458 cbasemean = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cbasemean");
1459 if(!cbasemean) cbasemean = CreateCanvas("cbasemean");
1462 fHistDistrBaseMeanIROC = fHistDistrBase2dIROC->ProjectionX("fHistDistrBaseMeanIROC");
1463 fHistDistrBaseMeanIROC->SetXTitle("base mean (ADC)");
1464 fHistDistrBaseMeanIROC->SetYTitle("counts");
1465 fHistDistrBaseMeanIROC->SetTitle(titleMEAN);
1466 fHistDistrBaseMeanIROC->Draw("");
1468 fHistDistrBaseMeanOROC = fHistDistrBase2dOROC->ProjectionX("fHistDistrBaseMeanOROC");
1469 fHistDistrBaseMeanOROC->SetLineColor(2);
1470 fHistDistrBaseMeanOROC->Draw("same");
1471 if(fHistDistrBaseMeanOROC->GetMaximum()>fHistDistrBaseMeanIROC->GetMaximum()) fHistDistrBaseMeanIROC->SetMaximum(fHistDistrBaseMeanOROC->GetMaximum()*1.1);
1472 legio->Draw("same");
1474 TCanvas* cbaserms = 0;
1475 cbaserms = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cbaserms");
1476 if(!cbaserms) cbaserms = CreateCanvas("cbaserms") ;
1479 // BASELINE RMS distribution
1480 fHistDistrBaseRmsIROC = fHistDistrBase2dIROC->ProjectionY("fHistDistrBaseRmsIROC");
1481 fHistDistrBaseRmsIROC->SetXTitle("base rms (ADC)");
1482 fHistDistrBaseRmsIROC->SetYTitle("counts");
1483 fHistDistrBaseRmsIROC->SetTitle(titleRMS);
1484 fHistDistrBaseRmsIROC->Draw("");
1486 fHistDistrBaseRmsOROC = fHistDistrBase2dOROC->ProjectionY("fHistDistrBaseRmsOROC");
1487 fHistDistrBaseRmsOROC->SetLineColor(2);
1488 fHistDistrBaseRmsOROC->Draw("same");
1489 if(fHistDistrBaseRmsOROC->GetMaximum()>fHistDistrBaseRmsIROC->GetMaximum()) fHistDistrBaseRmsIROC->SetMaximum(fHistDistrBaseRmsOROC->GetMaximum()*1.1);
1490 legio->Draw("same");
1494 cbasemean->Update();
1499 // GLOBAL MAX ADC _________________________________
1500 if(GetProcNextEvent()==1)
1505 if(!(cglobC=(TCanvas*)gROOT->GetListOfCanvases()->FindObject("SIDE C all"))) cglobC = CreateCanvas("SIDE C all");
1506 if(!(cglobA=(TCanvas*)gROOT->GetListOfCanvases()->FindObject("SIDE A all"))) cglobA = CreateCanvas("SIDE A all");
1508 Char_t globtitle1[256]; sprintf(globtitle1,"SIDE A Run %05i (EventID %i)",fRunId,fEventNumber);
1509 Char_t globtitle2[256]; sprintf(globtitle2,"SIDE C Run %05i (EventID %i)",fRunId,fEventNumber);
1511 fHistGlobalMaxA->SetTitle(globtitle1);
1512 fHistGlobalMaxC->SetTitle(globtitle2);
1513 fHistGlobalMaxA->SetXTitle("x/mm");
1514 fHistGlobalMaxA->SetYTitle("y/mm");
1515 fHistGlobalMaxC->SetXTitle("x/mm");
1516 fHistGlobalMaxC->SetYTitle("y/mm");
1518 if(GetPedestals()==0) { fHistGlobalMaxA->SetZTitle("max adc (not baseline sub)"); fHistGlobalMaxC->SetZTitle("max adc (not baseline sub)"); }
1519 else { fHistGlobalMaxA->SetZTitle("max adc "); fHistGlobalMaxC->SetZTitle("max adc "); }
1521 fHistGlobalMaxA->SetMinimum(0.01);
1522 fHistGlobalMaxC->SetMinimum(0.01);
1524 cglobC->cd() ; fHistGlobalMaxC->Draw("COLZ");
1525 cglobA->cd() ; fHistGlobalMaxA->Draw("COLZ");
1528 sprintf(nameom,".x %s/TPC/AliTPCMonitorExec.C(3)",gSystem->Getenv("ALICE_ROOT"));
1532 if(fVerb)cout << " set exec " << nameom << endl;
1533 cglobC->AddExec("glob",nameom);
1534 cglobA->AddExec("glob",nameom);
1539 cglobC->DeleteExec("glob");
1540 cglobA->DeleteExec("glob");
1542 if(fVerb) cout << " set exec " << nameom << endl;
1543 cglobC->AddExec("glob",nameom);
1544 cglobA->AddExec("glob",nameom);
1556 //__________________________________________________________________
1557 void AliTPCMonitor::DrawRMSMap()
1559 // Draw 2Dim rms histos for IROC and OROC
1560 // and set executables for canvases
1562 TCanvas* crmsoroc =0;
1563 TCanvas* crmsiroc =0;
1564 if(!(crmsoroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crmsoroc"))) crmsoroc = CreateCanvas("crmsoroc");
1565 if(!(crmsiroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crmsiroc"))) crmsiroc = CreateCanvas("crmsiroc");
1567 crmsiroc->cd(); fHistIROCRMS->Draw("COLZ");
1568 crmsoroc->cd(); fHistOROCRMS->Draw("COLZ");
1570 Char_t carry1[100]; sprintf(carry1,".x %s/TPC/AliTPCMonitorExec.C(1)",gSystem->Getenv("ALICE_ROOT"));
1571 Char_t carry2[100]; sprintf(carry2,".x %s/TPC/AliTPCMonitorExec.C(2)",gSystem->Getenv("ALICE_ROOT"));
1573 if(fExecPadIrocRms==0)
1575 crmsiroc->AddExec("pad",carry1);
1576 crmsiroc->AddExec("row",carry2);
1580 if(fExecPadOrocRms==0)
1582 crmsoroc->AddExec("pad",carry1);
1583 crmsoroc->AddExec("row",carry2);
1594 //__________________________________________________________________
1595 void AliTPCMonitor::ExecPad()
1598 // Executable for Pad
1599 // Show time profile for channel the mouse is pointing at
1601 Int_t event = gPad->GetEvent();
1602 if (event != 51) return;
1604 TObject *select = gPad->GetSelected();
1606 if(!select->InheritsFrom("TH2")) { return; }
1607 gPad->GetCanvas()->FeedbackMode(kTRUE);
1610 Int_t px = gPad->GetEventX();
1611 Int_t py = gPad->GetEventY();
1612 Float_t upy = gPad->AbsPixeltoY(py);
1613 Float_t upx = gPad->AbsPixeltoX(px);
1614 Float_t y = gPad->PadtoY(upy);
1615 Float_t x = gPad->PadtoX(upx);
1620 // Char_t namehist[50];
1621 Char_t projhist[60];
1622 Char_t namesel[256];
1623 Char_t namecanv[256];
1627 Float_t ybinmin = 0;
1628 Float_t ybinmax = 0;
1631 // Check wich Canvas executed the event
1633 sprintf(namesel,select->GetName());
1634 if(strcmp(namesel,"fHistOROC")==0 || strcmp(namesel,"fHistOROCRMS")==0 || strcmp(namesel,"fHistOROCTime")==0 )
1638 sprintf(projhist,"ProjectionOROC");
1639 sprintf(namecanv,"coroc_ch");
1640 fHistIndex = fHistOROCIndex;
1642 if(strcmp(namesel,"fHistIROC")==0 || strcmp(namesel,"fHistIROCRMS")==0 || strcmp(namesel,"fHistIROCTime")==0 )
1646 sprintf(projhist,"ProjectionIROC");
1647 sprintf(namecanv,"ciroc_ch");
1648 fHistIndex = fHistIROCIndex;
1651 // Check if Canvas already existed and get Ranges from former Prjection histogram
1652 if((cpad=(TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv)))
1655 if(gROOT->Get(projhist))
1658 xbinmin = ((TH1D*)gROOT->Get(projhist))->GetXaxis()->GetFirst();
1659 xbinmax = ((TH1D*)gROOT->Get(projhist))->GetXaxis()->GetLast();
1660 ybinmin = ((TH1D*)gROOT->Get(projhist))->GetMinimum();
1661 ybinmax = ((TH1D*)gROOT->Get(projhist))->GetMaximum();
1662 delete gROOT->Get("legfit");
1663 delete gROOT->Get("fg");
1668 cpad = CreateCanvas(namecanv); cpad->cd();
1672 Int_t testy = fHistIndex->GetYaxis()->FindBin(y);
1673 Int_t testx = fHistIndex->GetXaxis()->FindBin(x);
1674 Int_t binchannel = (Int_t)fHistIndex->GetCellContent(testx,testy);
1675 if(binchannel>30000 || binchannel<0) return;
1677 if(gROOT->Get(projhist)) delete gROOT->Get(projhist);
1679 TH1D *hp = (TH1D*)(((TH1D*)fHistChannelTime->ProjectionY("hp",binchannel,binchannel))->Clone(projhist));
1681 // Make title and Pave for channel Info
1683 Int_t npadRow , npad , nhw , nmax , hwadd;
1685 hwadd = (Int_t)fHistChannelTime->GetCellContent(binchannel,0);
1686 fPadUsedHwAddr = hwadd;
1688 if(rocid==0)npadRow = fMapHand->GetPadRow(hwadd);
1689 else npadRow = fMapHand->GetPadRow(hwadd)-63;
1690 npad = fMapHand->GetPad(hwadd);
1692 nmax = (Int_t)hp->GetMaximum();
1695 TPaveText* legstat = new TPaveText(0.18,0.65,0.3,0.8,"NDC");
1697 Int_t connector = fMapHand->GetFECconnector(hwadd);
1698 Int_t fecnr = fMapHand->GetFECfromHw(hwadd);
1699 Int_t fecch = fMapHand->GetFECchannel(hwadd);
1700 Int_t altrochip = fMapHand->GetAltro(hwadd);
1701 Int_t altrochannel= (fMapHand->GetAltroChannel(hwadd))%16;
1702 Int_t fecloc = fMapHand->U2fGetFECinRCU(fecnr) ;
1703 Int_t feclocbran = fMapHand->U2fGetFECinBranch(fecnr);
1704 Int_t branch = fMapHand->U2fGetBranch(fecnr);
1707 Short_t fecget = (hwadd & AliTPCMonitorAltro::GetHwMaskFEC()) >> 7;
1708 Short_t branchget = (hwadd & AliTPCMonitorAltro::GetHwMaskBranch())>> 11;
1711 Char_t nstat1[100]; Char_t nstat2[100]; Char_t nstat3[100]; Char_t nstat4[100];
1712 Char_t nstat5[100]; Char_t nstat6[100]; Char_t nstat7[100]; Char_t nstat8[100];
1714 sprintf(nstat1,"Branch (map) \t %i (%i) \n",branchget,branch);
1715 sprintf(nstat2,"Fec in patch \t %i \n",fecloc);
1716 sprintf(nstat8,"Fec in branch (map)\t %i (%i)\n",fecget,feclocbran);
1717 sprintf(nstat7,"Connector \t %i \n",connector);
1718 sprintf(nstat3,"Fec No. \t %i \n",fecnr);
1719 sprintf(nstat4,"Fec chan \t %i \n",fecch);
1720 sprintf(nstat5,"Altro chip\t %i \n",altrochip);
1721 sprintf(nstat6,"Altro chan\t %i \n",altrochannel);
1723 legstat->AddText(nstat1); legstat->AddText(nstat2); legstat->AddText(nstat8); legstat->AddText(nstat7);
1724 legstat->AddText(nstat3); legstat->AddText(nstat4); legstat->AddText(nstat5); legstat->AddText(nstat6);
1726 sprintf(title,"Row=%d Pad=%d Hw =%d maxADC =%d count =%d",npadRow,npad,nhw,nmax,binchannel);
1728 hp->SetName(projhist);
1729 hp->SetTitleSize(0.04);
1730 hp->SetTitle(title);
1731 hp->SetYTitle("ADC");
1732 hp->SetXTitle("Timebin");
1733 hp->GetXaxis()->SetTitleColor(1);
1737 hp->GetXaxis()->SetRange(xbinmin,xbinmax);
1738 hp->SetMinimum(ybinmin);
1739 hp->SetMaximum(ybinmax);
1743 hp->SetMinimum(0.0);
1744 hp->SetMaximum(1000.0);
1751 if(GetPedestals() && fDisableFit==0)
1753 Int_t maxx = (Int_t)fHistAddrMaxAdcX->GetBinContent(hwadd);
1754 Float_t max = (Float_t)fHistAddrMaxAdc->GetBinContent(hwadd);
1755 Float_t base = (Float_t)fHistAddrBaseMean->GetBinContent(hwadd);
1758 if( ((max+base)/base)>1.2)
1760 TF1* fg = new TF1("fg",AliTPCMonitor::Gamma4,maxx-5,maxx+5,4);
1761 fg->SetParName(0,"Normalisation");
1762 fg->SetParName(1,"Minimum");
1763 fg->SetParName(2,"Width");
1764 fg->SetParName(3,"Base");
1765 fg->SetParameter(0,max);
1766 fg->SetParameter(1,maxx-2);
1767 fg->SetParameter(2,1.5);
1768 fg->FixParameter(3,0);
1769 fg->SetLineColor(4);
1770 fg->SetLineWidth(1);
1773 TLegend* legfit = new TLegend(0.6,0.7,0.7,0.8);
1774 legfit->AddEntry("fg","#Gamma 4 fit","l");
1775 legfit->SetFillColor(0);
1776 legfit->SetName("legfit");
1777 legfit->Draw("same");
1781 legstat->SetFillColor(0);
1782 legstat->Draw("same");
1787 //__________________________________________________________________
1788 void AliTPCMonitor::ExecRow()
1791 // Executable for Pad
1792 // Show profile of max adc over given pad row
1793 // and 2dim histo adc(pad-in-row,time bin)
1795 Int_t event = gPad->GetEvent();
1796 if (event != 61) return;
1798 TObject *select = gPad->GetSelected();
1800 if(!select->InheritsFrom("TH2")) { return; }
1803 // Char_t namehist[50];
1805 Char_t rowhistsum[60];
1806 Char_t rowhistmax[60];
1807 Char_t rowhistxmax[60];
1809 sprintf(rowhist, "hrowtime");
1810 sprintf(rowhistxmax ,"hxmax");
1811 sprintf(rowhistmax , "hrowmax");
1814 Int_t px = gPad->GetEventX();
1815 Int_t py = gPad->GetEventY();
1816 Float_t upy = gPad->AbsPixeltoY(py);
1817 Float_t upx = gPad->AbsPixeltoX(px);
1818 Float_t y = gPad->PadtoY(upy);
1819 Float_t x = gPad->PadtoX(upx);
1821 TCanvas*crowtime = 0;
1822 TCanvas*crowmax = 0;
1825 TH2S* fHistIndex = 0;
1827 // ranges from already existing histos
1828 Int_t rowtimexmin = 0;
1829 Int_t rowtimexmax = 0;
1830 Int_t rowtimeymin = 0;
1831 Int_t rowtimeymax = 0;
1832 Float_t rowtimezmin = 0;
1833 Float_t rowtimezmax = 0;
1835 Int_t profrowxmin = 0;
1836 Int_t profrowxmax = 0;
1837 Double_t profrowymin = 0;
1838 Double_t profrowymax = 0;
1840 Int_t profxxmin = 0;
1841 Int_t profxxmax = 0;
1842 Double_t profxymin = 0;
1843 Double_t profxymax = 0;
1849 if( strcmp(select->GetName(),"fHistIROC")==0 || strcmp(select->GetName(),"fHistIROCRMS")==0 ) { fHistIndex = fHistIROCIndex; rocid =1; }
1850 else if(strcmp(select->GetName(),"fHistOROC")==0 || strcmp(select->GetName(),"fHistOROCRMS")==0 ) { fHistIndex = fHistOROCIndex; rocid =2; }
1851 else { cout << " not implemented for this histo " << endl; return; }
1853 gPad->GetCanvas()->FeedbackMode(kTRUE);
1857 // check if canvases exist //
1858 crowtime = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crowtime");
1859 crowmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crowmax");
1860 cxmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cxmax");
1862 if(!crowtime) crowtime = CreateCanvas("crowtime") ;
1863 if(!crowmax) crowmax = CreateCanvas("crowmax") ;
1864 if(!cxmax ) cxmax = CreateCanvas("cxmax") ;
1866 // check ranges of already existing histos
1867 if(gROOT->Get(rowhist))
1869 rowtimexmin = ((TH2F*)gROOT->Get(rowhist))->GetXaxis()->GetFirst();
1870 rowtimexmax = ((TH2F*)gROOT->Get(rowhist))->GetXaxis()->GetLast();
1871 rowtimeymin = ((TH2F*)gROOT->Get(rowhist))->GetYaxis()->GetFirst();
1872 rowtimeymax = ((TH2F*)gROOT->Get(rowhist))->GetYaxis()->GetLast();
1873 rowtimezmin = ((TH2F*)gROOT->Get(rowhist))->GetMinimum();
1874 rowtimezmax = ((TH2F*)gROOT->Get(rowhist))->GetMaximum();
1876 profrowxmin = ((TH1F*)gROOT->Get(rowhistmax))->GetXaxis()->GetFirst();
1877 profrowxmax = ((TH1F*)gROOT->Get(rowhistmax))->GetXaxis()->GetLast();
1878 profrowymin = ((TH1F*)gROOT->Get(rowhistmax))->GetMinimum();
1879 profrowymax = ((TH1F*)gROOT->Get(rowhistmax))->GetMaximum();
1881 profxxmin = ((TH1F*)gROOT->Get(rowhistxmax))->GetXaxis()->GetFirst();
1882 profxxmax = ((TH1F*)gROOT->Get(rowhistxmax))->GetXaxis()->GetLast();
1883 profxymin = ((TH1F*)gROOT->Get(rowhistxmax))->GetMinimum();
1884 profxymax = ((TH1F*)gROOT->Get(rowhistxmax))->GetMaximum();
1888 delete gROOT->Get(rowhist);
1889 delete gROOT->Get(rowhistmax);
1890 delete gROOT->Get(rowhistsum);
1891 delete gROOT->Get("hxmax");
1892 delete gROOT->Get("legrow");
1895 // get channel for xy bin -> getRow -> getNrows -> getHw for each Pad in Row -> get channel for each hw -> make proj
1896 Int_t testy = fHistIndex->GetYaxis()->FindBin(y);
1897 Int_t testx = fHistIndex->GetXaxis()->FindBin(x);
1898 Int_t binchannel = (Int_t)fHistIndex->GetCellContent(testx,testy);
1900 if(binchannel>30000) return;
1901 if(binchannel<=0 ) { crowtime->Update() ; crowmax->Update() ; return ; }
1904 Int_t hwadd = (Int_t)fHistChannelTime->GetCellContent(binchannel,0);
1905 Int_t row = fMapHand->GetPadRow(hwadd);
1906 Int_t pad = fMapHand->GetPad(hwadd) ;
1907 Int_t numofpads = fMapHand->GetNumofPads(row);
1910 TH2F *hrowtime = new TH2F(rowhist , "" ,numofpads,0,numofpads,GetTimeBins(),0.0,GetTimeBins());
1911 TH1F *hrowmax = new TH1F(rowhistmax , "" ,numofpads,0,numofpads);
1912 TH1F *hxmax = new TH1F(rowhistxmax, "" ,159,0,159 );
1914 // Row profile ///////////
1915 if(fVerb) cout << " Number of pads " << numofpads << endl;
1916 for(Int_t padnr = 0; padnr<numofpads;padnr++)
1918 Int_t addrinrow = fMapHand->GetPadAddInRow(row,padnr );
1919 Int_t channel = (Int_t)fHistAddrMapIndex->GetBinContent(addrinrow);
1920 if(channel==-1) continue;
1922 hrowmax->SetBinContent(padnr+1,fHistAddrMaxAdc->GetBinContent(addrinrow));
1923 TH1D *hp = fHistChannelTime->ProjectionY("hp",channel,channel);
1924 for(Int_t time = 0;time<GetTimeBins();time++) {
1926 Float_t val = hp->GetBinContent(time);
1927 hrowtime->SetCellContent(padnr+1,time+1,val);
1931 // X profile /////////////
1932 Double_t xval = 0.0;
1933 Double_t yval = 0.0;
1934 GetXY(xval,yval,numofpads,row,pad);
1938 for(Int_t nrow = 0; nrow<159; nrow++)
1940 padnr = GetPadAtX(xval,nrow);
1943 hw = fMapHand->GetPadAddInRow(nrow,padnr);
1944 if(fPadMapHw[hw]==-1){ continue ; }
1945 else { hxmax->SetBinContent(nrow+1,fHistAddrMaxAdc->GetBinContent(hw)) ; }
1950 Char_t hxtitle[50] ; sprintf(hxtitle,"max adc in pads at x=%5.1f mm",xval);
1951 hxmax->SetTitle(hxtitle);
1952 hxmax->SetXTitle("row");
1953 if(!GetPedestals()) hxmax->SetYTitle("max adc (baseline sub.)");
1954 else hxmax->SetYTitle("max adc ");
1955 hxmax->SetMinimum(0.01);
1960 hxmax->GetXaxis()->SetRange(profxxmin,profxxmax);
1961 hxmax->SetMinimum(profxymin);
1962 hxmax->SetMaximum(profxymax);
1969 Char_t titlemax[256];
1970 if(rocid==1) {sprintf(title,"%s Row=%d",((TH2*)select)->GetTitle(),row) ; sprintf(titlemax,"IROC max/sum Row=%d",row );}
1971 else {sprintf(title,"%s Row=%d",((TH2*)select)->GetTitle(),row-63); sprintf(titlemax,"OROC max/sum Row=%d",row-63);}
1972 if(fVerb) cout << " set name " << endl;
1977 hrowtime->SetTitleSize(0.04);
1978 hrowtime->SetTitle(title);
1979 hrowtime->SetYTitle("timbin");
1980 hrowtime->SetXTitle("pad in row");
1981 hrowtime->SetZTitle("signal (ADC)");
1983 hrowtime->GetXaxis()->SetTitleColor(1);
1984 hrowtime->SetMaximum(1000.0);
1985 hrowtime->SetMinimum(0.0);
1989 hrowtime->GetXaxis()->SetRange(rowtimexmin,rowtimexmax);
1990 hrowtime->GetYaxis()->SetRange(rowtimeymin,rowtimeymax);
1991 hrowtime->SetMinimum(rowtimezmin);
1992 hrowtime->SetMaximum(rowtimezmax);
1995 hrowtime->Draw("COLZ");
1996 crowtime->UseCurrentStyle();
1999 // max and sum /////////////////////////
2002 hrowmax->GetXaxis()->SetRange(profrowxmin,profrowxmax);
2003 hrowmax->SetMinimum(profrowymin);
2004 hrowmax->SetMaximum(profrowymax);
2006 hrowmax->SetTitleSize(0.04);
2007 hrowmax->SetTitle(title);
2008 hrowmax->SetYTitle("max adc");
2009 hrowmax->SetXTitle("pad in row");
2010 hrowmax->GetXaxis()->SetTitleColor(1);
2012 hrowmax->SetLineColor(2);
2019 //__________________________________________________________________
2020 void AliTPCMonitor::Write10bitChannel()
2023 // Write 10 bit words form histogram for active(last pointed) channel
2025 if(fPadUsedHwAddr==-1){ AliWarning(" No active pad "); return ;}
2027 Int_t pad = (Int_t)fMapHand->GetPad( fPadUsedHwAddr);
2028 Int_t row = (Int_t)fMapHand->GetPadRow(fPadUsedHwAddr);
2029 Int_t channel = (Int_t)fPadMapHw[fPadUsedHwAddr];
2031 Char_t filenameroot[256];
2032 Char_t filenamedat[256];
2033 Char_t projhist[256];
2035 if(fPadUsedRoc==1) { sprintf(projhist,"ProjectionOROC"); }
2036 if(fPadUsedRoc==0) { sprintf(projhist,"ProjectionIROC"); }
2038 sprintf(filenamedat, "Channel_Run%05i_EventID_%i_Pad_%i_Row_%i.dat" ,fRunId,fEventNumber,pad,row);
2039 sprintf(filenameroot,"Channel_Run%05i_EventID_%i_Pad_%i_Row_%i.root" ,fRunId,fEventNumber,pad,row);
2042 if((hpr=(TH1D*)gROOT->Get(projhist)))
2045 TFile f(filenameroot,"recreate");
2050 ofstream datout(filenamedat,ios::out);
2051 datout <<"Timebin \t ADC value " << endl;
2052 for(Int_t i = 1; i <GetTimeBins(); i++)
2054 datout << i << " \t \t " << fPad[channel][i] << endl;
2060 AliWarning("No projection histo found ");
2064 //__________________________________________________________________
2065 void AliTPCMonitor::ExecTransform()
2068 // Make Fast Fourier Transformation for active pad
2069 // fft is only performed for a data sample of size 2^n
2070 // reduce window according to largest power of 2 which is smaller than the viewing range
2072 Char_t namecanv[256];
2073 Char_t projhist[256];
2074 Char_t namehtrimag[256];
2075 Char_t namehtrreal[256];
2077 if(fPadUsedRoc==1) { sprintf(namecanv,"coroc_ch_trans") ; sprintf(projhist,"ProjectionOROC"); }
2078 if(fPadUsedRoc==0) { sprintf(namecanv,"ciroc_ch_trans") ; sprintf(projhist,"ProjectionIROC"); }
2082 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 ;}
2083 else hproj = (TH1D*)gROOT->Get(projhist) ;
2086 if(fPadUsedRoc==1) { sprintf(namehtrimag,"htransimagfreq_oroc"); sprintf(namehtrreal,"htransrealfreq_oroc"); }
2087 else { sprintf(namehtrimag,"htransimagfreq_iroc"); sprintf(namehtrreal,"htransrealfreq_iroc"); }
2089 if( gROOT->Get(namehtrimag)) delete gROOT->Get(namehtrimag);
2090 if( gROOT->Get(namehtrreal)) delete gROOT->Get(namehtrreal);
2092 TCanvas *ctrans = 0;
2093 if(!(ctrans = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv)))
2095 ctrans = CreateCanvas(namecanv);
2096 ctrans->Divide(1,2);
2099 Int_t binfirst = hproj->GetXaxis()->GetFirst();
2100 Int_t binlast = hproj->GetXaxis()->GetLast();
2101 Int_t bins = binlast -binfirst +1;
2104 for(Int_t pot = 0; pot<=10 ; pot++)
2106 Int_t comp = (Int_t)TMath::Power(2,pot);
2107 if(bins>=comp)power = pot;
2110 bins = (Int_t)TMath::Power(2,power);
2112 // sampling frequency ;
2113 Double_t deltat = 1.0/(Float_t)GetSamplingFrequency();
2116 TH1D* htransrealfreq = new TH1D(namehtrreal,namehtrreal,10000,-1/(2*deltat),1/(2*deltat));
2117 TH1D* htransimagfreq = new TH1D(namehtrimag,namehtrimag,10000,-1/(2*deltat),1/(2*deltat));
2120 Char_t titlereal[256];
2121 Char_t titleimag[256];
2122 if(fPadUsedRoc==1) { sprintf(titlereal,"OROC DFT real part"); sprintf(titleimag,"OROC DFT imag part"); }
2123 else { sprintf(titlereal,"IROC DFT real part"); sprintf(titleimag,"IROC DFT imag part"); }
2125 htransrealfreq->SetTitle(titlereal); htransrealfreq->SetXTitle("f/hz"); htransrealfreq->SetYTitle("z_{real}(f)");
2126 htransimagfreq->SetTitle(titleimag); htransimagfreq->SetXTitle("f/hz"); htransimagfreq->SetYTitle("z_{imag}(f)");
2129 // create complex packed data array
2130 const Int_t kdatasiz = 2*bins;
2131 Double_t* data = new Double_t[kdatasiz];
2132 for(Int_t i=0;i<2*bins;i++) { data[i] = 0.0;}
2133 for(Int_t i=0;i<bins;i++) { data[2*i] = (Double_t)hproj->GetBinContent(binfirst+i); }
2135 // make fourier transformation
2136 AliTPCMonitorFFT* four = new AliTPCMonitorFFT();
2137 four->ComplexRadix2ForwardWrap(data,1,bins);
2139 // write output and fill histos forward
2140 Double_t freq = 0.0;
2141 for(Int_t i=0;i<2*bins;i++)
2145 if(i<(bins/2)) { freq = i/(bins*deltat) ; }
2146 else { freq = -1*((bins-i)/(bins*deltat)); }
2147 htransrealfreq->Fill( freq,data[2*i] );
2148 htransimagfreq->Fill( freq,data[2*i+1]);
2155 htransrealfreq->Draw();
2157 htransimagfreq->Draw();
2163 //__________________________________________________________________
2164 void AliTPCMonitor::ShowSel(Int_t* compval)
2167 // Show only selected components
2168 // First restore original histogram from clone
2169 // Than remove all not matching pads form histos
2171 Int_t connector = 0;
2173 Int_t altrochip = 0;
2174 Int_t feclocbran = 0;
2181 Float_t maxiroc = fHistIROCClone->GetMaximum();
2182 Float_t maxoroc = fHistOROCClone->GetMaximum();
2185 // restore original histos
2186 for(Int_t row = 0; row<fkNRowsIroc; row++)
2188 for(Int_t pad = 0; pad<fkNPadsIroc; pad++)
2190 index = (Int_t)fHistIROCIndex->GetCellContent(row+1,pad+1);
2191 if(index==-1)continue;
2192 else fHistIROC->SetCellContent(row+1,pad+1,fHistIROCClone->GetCellContent(row+1,pad+1));
2195 for(Int_t row = 0; row<fkNRowsOroc; row++)
2197 for(Int_t pad = 0; pad<fkNPadsOroc; pad++)
2199 index = (Int_t)fHistOROCIndex->GetCellContent(row+1,pad+1);
2200 if(index==-1)continue;
2201 else fHistOROC->SetCellContent(row+1,pad+1,fHistOROCClone->GetCellContent(row+1,pad+1));
2206 // remove not matching entries from fHistIROC/fHistOROC
2209 TH2S* fHistIndex =0;
2213 for(Int_t row = 0; row< (fkNRowsIroc + fkNRowsOroc); row++)
2215 if(row<fkNRowsIroc) { fHist=fHistIROC ; fHistIndex = fHistIROCIndex; npads = fkNPadsIroc; subrows =0 ;}
2216 else { fHist=fHistOROC ; fHistIndex = fHistOROCIndex; npads = fkNPadsOroc; subrows =fkNRowsIroc;}
2218 for(Int_t pad = 0; pad<npads; pad++)
2220 index = (Int_t)fHistIndex->GetCellContent(row -subrows +1,pad+1);
2221 if(index==-1) continue ;
2222 hwadd = (Int_t)fHistChannelTime->GetCellContent(index,0);
2225 fecnr = fMapHand->GetFECfromHw(hwadd);
2226 if(compval[0]!=-1 && fecnr!=compval[0]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
2229 rcuget = (hwadd & AliTPCMonitorAltro::GetHwMaskRCU())>> 12;
2230 if(compval[1]!=-1 && rcuget!=compval[1]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
2233 branch = fMapHand->U2fGetBranch(fecnr) ;
2234 if(compval[2]!=-1 && branch!=compval[2]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
2237 feclocbran= fMapHand->U2fGetFECinBranch(fecnr) ;
2238 if(compval[3]!=-1 && feclocbran!=compval[3]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
2241 connector = fMapHand->GetFECconnector(hwadd);
2242 if(compval[4]!=-1 && connector!=compval[4]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
2245 altrochip = fMapHand->GetAltro(hwadd);
2246 if(compval[5]!=-1 && altrochip!=compval[5]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
2253 if(gROOT->GetListOfCanvases()->FindObject("ciroc"))
2255 c1 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("ciroc");
2257 fHistIROC->Draw("COLZ");
2258 fHistIROC->SetMaximum(maxiroc);
2259 fHistIROC->SetMinimum(0.0);
2262 if(gROOT->GetListOfCanvases()->FindObject("coroc"))
2264 c2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("coroc");
2266 fHistOROC->Draw("COLZ");
2267 fHistOROC->SetMaximum(maxoroc);
2268 fHistOROC->SetMinimum(0.0);
2274 //__________________________________________________________________
2275 void AliTPCMonitor::ResizeCanv()
2277 // Resize canvases and delete some of them
2280 sprintf(carry1,".x %s/TPC/AliTPCMonitorExec.C(1)",gSystem->Getenv("ALICE_ROOT"));
2282 sprintf(carry3,".x %s/TPC/AliTPCMonitorExec.C(2)",gSystem->Getenv("ALICE_ROOT"));
2283 if(fVerb) cout << " canv 1 " << endl;
2285 if(gROOT->GetListOfCanvases()->FindObject( "coroc_ch")) { delete gROOT->GetListOfCanvases()->FindObject("coroc_ch") ; }
2286 if(gROOT->GetListOfCanvases()->FindObject( "ciroc_ch")) { delete gROOT->GetListOfCanvases()->FindObject("ciroc_ch") ; }
2288 // for 2dim plots delete create and draw again
2289 if(gROOT->GetListOfCanvases()->FindObject("ciroc"))
2291 delete gROOT->GetListOfCanvases()->FindObject("ciroc");
2292 TCanvas* ciroc = CreateCanvas("ciroc");
2294 fHistIROC->Draw("COLZ");
2295 ciroc->AddExec("pad",carry1);
2296 ciroc->AddExec("row",carry3);
2300 // for 2dim plots delete create and draw again
2301 if(gROOT->GetListOfCanvases()->FindObject("coroc"))
2303 delete gROOT->GetListOfCanvases()->FindObject("coroc");
2304 TCanvas* coroc = CreateCanvas("coroc");
2306 fHistOROC->Draw("COLZ");
2308 coroc->AddExec("pad",carry1);
2309 coroc->AddExec("row",carry3);
2314 if(gROOT->GetListOfCanvases()->FindObject( "cbasemean")) { delete gROOT->GetListOfCanvases()->FindObject("cbasemean"); }
2315 if(gROOT->GetListOfCanvases()->FindObject( "cbase")) { delete gROOT->GetListOfCanvases()->FindObject("cbase");}
2316 if(gROOT->GetListOfCanvases()->FindObject( "cbaserms")) { delete gROOT->GetListOfCanvases()->FindObject("cbaserms"); }
2317 if(gROOT->GetListOfCanvases()->FindObject( "cmax")) { delete gROOT->GetListOfCanvases()->FindObject("cmax"); }
2318 if(gROOT->GetListOfCanvases()->FindObject( "csum")) { delete gROOT->GetListOfCanvases()->FindObject("csum"); }
2319 if(gROOT->GetListOfCanvases()->FindObject( "ciroc_ch_trans")) { delete gROOT->GetListOfCanvases()->FindObject("ciroc_ch_trans");}
2320 if(gROOT->GetListOfCanvases()->FindObject( "coroc_ch_trans")) { delete gROOT->GetListOfCanvases()->FindObject("coroc_ch_trans");}
2321 if(gROOT->GetListOfCanvases()->FindObject( "crowtime")) { delete gROOT->GetListOfCanvases()->FindObject("crowtime"); }
2322 if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); }
2323 if(gROOT->GetListOfCanvases()->FindObject( "cxmax")) { delete gROOT->GetListOfCanvases()->FindObject("cxmax"); }
2324 if(gROOT->GetListOfCanvases()->FindObject( "crmsoroc")) { delete gROOT->GetListOfCanvases()->FindObject("crmsoroc"); fExecPadOrocRms = 0; }
2325 if(gROOT->GetListOfCanvases()->FindObject( "crmsiroc")) { delete gROOT->GetListOfCanvases()->FindObject("crmsiroc"); fExecPadIrocRms = 0; }
2326 if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); }
2327 if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); }
2334 //__________________________________________________________________
2335 Int_t AliTPCMonitor::ExecProcess()
2337 // Executable for global Histogram
2338 // Will be called from /TPC/AliTPCMonitorExec.C(3)
2339 // Call ProcessEvent for same event and sector pointed at
2344 Int_t event = gPad->GetEvent();
2345 if(event != 61) return -1;
2347 TObject *select = gPad->GetSelected();
2348 if(!select) return -1;
2349 if(!select->InheritsFrom("TH2")) {gPad->SetUniqueID(0); return -1; }
2350 if( strcmp(select->GetName(),"hglobal" )==0 || ( strcmp(select->GetName(),"SIDE A" )==0) ) side = 0;
2351 else if( strcmp(select->GetName(),"hglobal2")==0 || ( strcmp(select->GetName(),"SIDE C" )==0) ) side = 1;
2354 Int_t px = gPad->GetEventX();
2355 Int_t py = gPad->GetEventY();
2356 Float_t upy = gPad->AbsPixeltoY(py);
2357 Float_t upx = gPad->AbsPixeltoX(px);
2358 Float_t y = gPad->PadtoY(upy);
2359 Float_t x = gPad->PadtoX(upx);
2361 Int_t testy = ((TH2*)select)->GetYaxis()->FindBin(y);
2362 Int_t testx = ((TH2*)select)->GetXaxis()->FindBin(x);
2363 if(((TH2*)select)->GetCellContent(testx,testy)==0) return -1 ;
2365 Float_t alpha = 0.0;
2366 if(x>0.0 && y > 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(x/y)));
2367 if(x>0.0 && y < 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(y/x)));
2368 if(x<0.0 && y < 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(x/y)));
2369 if(x<0.0 && y > 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(y/x)));
2371 if(x>0.0 && y < 0.0) alpha += ( TMath::Pi()/2);
2372 if(x<0.0 && y < 0.0) alpha += ( TMath::Pi());
2373 if(x<0.0 && y > 0.0) alpha += (1.5*TMath::Pi());
2375 sector = (Int_t)(alpha/(2*TMath::Pi()/18.0));
2376 if(alpha> (sector+0.5)*(2*TMath::Pi()/18.0)) sector+=1;
2378 if(sector==18 && side ==0 ) {
2379 AliWarning("There was a wromg assignment of sector 0 with sector 18. Check sectors");
2383 sector = (18-sector +4)%18;
2384 SetLastSector(sector+ side*18);
2385 SetProcNextEvent(0);
2387 if(fVerb) cout << "AliTPCMonitor::ExecProcess() next side " << side << " next sector " << sector << endl;
2389 return (Int_t)ProcessEvent();
2393 //__________________________________________________________________
2394 Int_t AliTPCMonitor::GetRCUPatch(Int_t runid, Int_t eqid) const
2397 // Return RCU patch index for given equipment id eqid
2402 if(eqid>=1000) return 0;
2403 patch = fMapEqidsRcu[eqid] ;
2407 if(eqid==408) {patch = 13*6+4 +0; }
2408 if(eqid==409) {patch = 13*6+5 +0; }
2409 if(eqid==509) {patch = 13*6+0 +0; }
2410 if(eqid==512) {patch = 13*6+3 +0; }
2411 if(eqid==513) {patch = 13*6+1 +0; }
2412 if(eqid==517) {patch = 13*6+2 +0; }
2414 if(eqid==404) {patch = 4*6+5 +0; }
2415 if(eqid==504) {patch = 4*6+4 +0; }
2416 if(eqid==407) {patch = 4*6+3 +0; }
2417 if(eqid==503) {patch = 4*6+2 +0; }
2418 if(eqid==508) {patch = 4*6+1 +0; }
2419 if(eqid==506) {patch = 4*6+0 +0; }
2424 //__________________________________________________________________
2425 void AliTPCMonitor::DumpHeader(AliRawReaderRoot * fReaderROOT) const
2427 // Dump Event header for ROOT format
2429 cout << "EventHeader : fReaderROOT->GetEquipmentSize() :" << fReaderROOT->GetEquipmentSize() << endl;
2430 cout << "EventHeader : fReaderROOT->GetType() :" << fReaderROOT->GetType() << endl;
2431 cout << "EventHeader : fReaderROOT->GetRunNumber() :" << fReaderROOT->GetRunNumber() << endl;
2432 cout << "EventHeader : fReaderROOT->GetEventId() :" << *(fReaderROOT->GetEventId()) << endl;
2433 cout << "EventHeader : fReaderROOT->GetLDCId() :" << fReaderROOT->GetLDCId() << endl;
2434 cout << "EventHeader : fReaderROOT->GetGDCId() :" << fReaderROOT->GetGDCId() << endl;
2437 //__________________________________________________________________
2438 void AliTPCMonitor::DumpHeader(AliTPCMonitorDateFormat* dateform) const
2440 // Dump Event header for DATE format
2442 cout << "EquipmentHeader : dateform->GetEquipmentSize() :" << dateform->GetEquipmentSize() << endl;
2443 cout << "EquipmentHeader : dateform->GetEquipmentType() :" << dateform->GetEquipmentType() << endl;
2444 cout << "EquipmentHeader : dateform->GetEquipmentID() :" << dateform->GetEquipmentID() << endl;
2445 cout << "EquipmentHeader : dateform->GetEquipmentTypeAttribute() :" << dateform->GetEquipmentTypeAttribute() << endl;
2446 cout << "EquipmentHeader : dateform->GetEquipmentBasicSize() :" << dateform->GetEquipmentBasicSize() << endl;
2447 cout << "EquipmentHeader : dateform->GetEquipmentHeaderSize() :" << dateform->GetEquipmentHeaderSize() << endl;
2448 cout << "EquipmentHeader : dateform->IsLastSubEventHeader() :" << dateform->IsLastSubEventHeader() << endl;
2451 //__________________________________________________________________
2452 Double_t AliTPCMonitor::Gamma4(Double_t* x, Double_t* par) {
2454 // Gamma4 function used to fit signals
2455 // Defined in sections: diverging branch set to 0
2459 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];
2465 //__________________________________________________________________
2466 TCanvas* AliTPCMonitor::CreateCanvas(Char_t* name)
2472 Int_t xoffset = GetCanvasXOffset();
2473 Int_t xsize = GetCanvasXSize();
2474 Int_t ysize = GetCanvasYSize();
2475 Int_t xspace = GetCanvasXSpace();
2476 Int_t yspace = GetCanvasYSpace();
2478 // ROC 2dim max distribution
2479 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; }
2480 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; }
2481 // ROC 2dim rms distribution
2482 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; }
2483 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; }
2484 // Global ADC max Histos
2485 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; }
2486 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; }
2487 // 1 dim max sum basekine distribution
2488 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; }
2489 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; }
2490 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; }
2491 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; }
2492 // Projections of single channel
2493 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; }
2494 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; }
2495 // FFT for single channel
2496 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; }
2497 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; }
2498 // row profile histograms
2499 else if(strcmp(name,"crowtime" )==0) { canv = new TCanvas("crowtime" ,"crowtime" , 1*xspace+xoffset, 2*yspace +ysize ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; }
2500 else if(strcmp(name,"crowmax" )==0) { canv = new TCanvas("crowmax" ,"crowmax" , 2*xspace+xoffset, 2*yspace +ysize ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; }
2501 else if(strcmp(name,"cxmax" )==0) { canv = new TCanvas("cxmax" ,"cxmax" , 3*xspace+xoffset, 2*yspace +ysize ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; }
2502 else { cout << " Warning Canvas name unknown " << endl; return 0 ; }
2505 //__________________________________________________________________
2506 void AliTPCMonitor::WriteHistos()
2508 // Writes all available histograms to a file in current directory
2509 // File name will be specified by : sector, side, runid and eventnumber
2511 if(GetEventProcessed())
2513 AliInfo("Write histos to file");
2515 sprintf(name,"SIDE_%i_SECTOR_%02i_RUN_%05i_EventID_%06i.root",(GetLastSector()/18),(GetLastSector()%18),fRunId,fEventNumber);
2516 TFile* f = new TFile(name,"recreate");
2517 for(Int_t i =0; i<fHistList->GetEntries(); i++)
2519 if(((TH1*)fHistList->At(i))!=0)
2521 ((TH1*)fHistList->At(i))->Write();
2529 AliError("No Event Processed : Chose Format , File and push 'Next Event' ");
2534 //__________________________________________________________________
2535 TH1* AliTPCMonitor::GetHisto(char* histname)
2538 // Returns histogram specified by histname
2539 // check available names for histos in CreateHistos()
2542 if((TH1*)fHistList->FindObject(histname))
2544 hist = (TH1*)fHistList->FindObject(histname);
2548 cout << " AliTPCMonitor::GetHisto :: Can not find histo with name " << histname << endl;