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 "AliTPCMonitorFFT.h"
56 #include "AliRawReader.h"
57 #include "AliRawReaderRoot.h"
58 #include "AliRawEventHeaderBase.h"
59 #include "AliAltroRawStreamV3.h"
67 #include "TDirectory.h"
70 #include "TPaveText.h"
72 #include <Riostream.h>
74 ClassImp(AliTPCMonitor)
76 const Int_t AliTPCMonitor::fgkHwMaskFEC = 0x0780;
77 const Int_t AliTPCMonitor::fgkHwMaskBranch = 0x0800;
78 const Int_t AliTPCMonitor::fgkHwMaskFECChannel = 0x007f;
79 const Int_t AliTPCMonitor::fgkHwMaskAltroChannel = 0x000f;
80 const Int_t AliTPCMonitor::fgkHwMaskAltroChip = 0x0070;
81 const Int_t AliTPCMonitor::fgkHwMaskRCU = 0x7000;
83 //____________________________________________________________________________
84 AliTPCMonitor::AliTPCMonitor(char* name, char* title) :
85 AliTPCMonitorConfig(name,title),
86 fPad(new Int_t*[GetMaxHwAddr()]),
87 fPadMapHw(new Float_t[GetMaxHwAddr()]),
88 fPadMapRCU(new Int_t*[GetMaxHwAddr()]),
104 fHistAddrMapIndex(0),
106 fHistAddrBaseMean(0),
110 fHistDistrSumIROC(0),
111 fHistDistrMaxIROC(0),
112 fHistDistrSumOROC(0),
113 fHistDistrMaxOROC(0),
114 fHistDistrBase2dIROC(0),
115 fHistDistrBase2dOROC(0),
116 fHistDistrBaseRmsIROC(0),
117 fHistDistrBaseMeanIROC(0),
118 fHistDistrBaseRmsOROC(0),
119 fHistDistrBaseMeanOROC(0),
122 fHistList(new TObjArray()),
149 fMapEqidsSec(new Int_t*[36]),
150 fMapEqidsRcu(new Int_t[1000]),
158 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[GetTimeBins()];}
159 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];}
160 for(Int_t i = 0; i<36; i++) { fMapEqidsSec[i] = new Int_t[6];}
164 if (!gDirectory->GetList())
166 Warning("Build","Current directory is not a valid directory");
169 AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(GetName());
172 Warning("Build","Replacing existing histogram: %s (Potential memory leak).",GetName());
173 gDirectory->GetList()->Remove(hold);
175 gDirectory->Append(this);
182 //____________________________________________________________________________
183 AliTPCMonitor::AliTPCMonitor(const AliTPCMonitor &monitor):
184 AliTPCMonitorConfig(monitor.GetName(),monitor.GetTitle()),
185 fPad(new Int_t*[GetMaxHwAddr()]),
186 fPadMapHw(new Float_t[GetMaxHwAddr()]),
187 fPadMapRCU(new Int_t*[GetMaxHwAddr()]),
203 fHistAddrMapIndex(0),
205 fHistAddrBaseMean(0),
209 fHistDistrSumIROC(0),
210 fHistDistrMaxIROC(0),
211 fHistDistrSumOROC(0),
212 fHistDistrMaxOROC(0),
213 fHistDistrBase2dIROC(0),
214 fHistDistrBase2dOROC(0),
215 fHistDistrBaseRmsIROC(0),
216 fHistDistrBaseMeanIROC(0),
217 fHistDistrBaseRmsOROC(0),
218 fHistDistrBaseMeanOROC(0),
221 fHistList(new TObjArray()),
222 fkNRowsIroc(monitor.fkNRowsIroc),
223 fkNRowsOroc(monitor.fkNRowsOroc),
224 fkNPadsIroc(monitor.fkNPadsIroc),
225 fkNPadsOroc(monitor.fkNPadsOroc),
226 fkNPadMinIroc(monitor.fkNPadMinIroc),
227 fkNPadMinOroc(monitor.fkNPadMinOroc),
228 fkNPadMaxIroc(monitor.fkNPadMaxIroc),
229 fkNPadMaxOroc(monitor.fkNPadMaxOroc),
230 fVerb(monitor.fVerb),
231 fLastEv(monitor.fLastEv),
232 fEventNumber(monitor.fEventNumber),
233 fEventNumberOld(monitor.fEventNumberOld),
234 fDisableFit(monitor.fDisableFit),
235 fExecGlob(monitor.fExecGlob),
236 fExecPlaneMax(monitor.fExecPlaneMax),
237 fExecPadIrocRms(monitor.fExecPadIrocRms),
238 fExecPadOrocRms(monitor.fExecPadOrocRms),
239 fRunId(monitor.fRunId),
240 fEqId(monitor.fEqId),
241 fPadUsedRoc(monitor.fPadUsedRoc),
242 fPadUsedHwAddr(monitor.fPadUsedHwAddr),
243 fGdcId(monitor.fGdcId),
244 fLdcId(monitor.fLdcId),
245 fLdcIdOld(monitor.fLdcIdOld),
246 fMapEqidsSec(new Int_t*[36]),
247 fMapEqidsRcu(new Int_t[1000]),
248 fMirror(monitor.fMirror),
249 fChannelIter(monitor.fChannelIter),
250 fMapHand(monitor.fMapHand),
251 fRawReader(monitor.fRawReader)
255 fHistIROC=(TH2F*)monitor.fHistIROC->Clone(); fHistList->Add(fHistIROC);
256 fHistOROC=(TH2F*)monitor.fHistOROC->Clone(); fHistList->Add(fHistOROC);
257 fHistIROCIndex=(TH2S*)monitor.fHistIROCIndex->Clone(); fHistList->Add(fHistIROCIndex);
258 fHistOROCIndex=(TH2S*)monitor.fHistOROCIndex->Clone(); fHistList->Add(fHistOROCIndex);
259 fHistIROCTime=(TH2F*)monitor.fHistIROCTime->Clone(); fHistList->Add(fHistIROCTime);
260 fHistOROCTime=(TH2F*)monitor.fHistOROCTime->Clone(); fHistList->Add(fHistOROCTime);
261 fHistIROCClone=(TH2F*)monitor.fHistIROCClone->Clone(); fHistList->Add(fHistIROCClone);
262 fHistOROCClone=(TH2F*)monitor.fHistOROCClone->Clone(); fHistList->Add(fHistOROCClone);
263 fHistIROCRMS=(TH2F*)monitor.fHistIROCRMS->Clone(); fHistList->Add(fHistIROCRMS);
264 fHistOROCRMS=(TH2F*)monitor.fHistOROCRMS->Clone(); fHistList->Add(fHistOROCRMS);
265 fHistIROCBASE=(TH2F*)monitor.fHistIROCBASE->Clone(); fHistList->Add(fHistIROCBASE);
266 fHistOROCBASE=(TH2F*)monitor.fHistOROCBASE->Clone(); fHistList->Add(fHistOROCBASE);
267 fHistIROCSUM=(TH2F*)monitor.fHistIROCSUM->Clone(); fHistList->Add(fHistIROCSUM);
268 fHistOROCSUM=(TH2F*)monitor.fHistOROCSUM->Clone(); fHistList->Add(fHistOROCSUM);
270 fHistChannelTime=(TH2F*)monitor.fHistChannelTime->Clone(); fHistList->Add(fHistChannelTime);
272 fHistAddrMapIndex=(TH1F*)monitor.fHistAddrMapIndex->Clone(); fHistList->Add(fHistAddrMapIndex);
273 fHistAddrMaxAdc=(TH1F*)monitor.fHistAddrMaxAdc->Clone(); fHistList->Add(fHistAddrMaxAdc);
274 fHistAddrBaseMean=(TH1F*)monitor.fHistAddrBaseMean->Clone(); fHistList->Add(fHistAddrBaseMean);
275 fHistAddrMaxAdcX=(TH1F*)monitor.fHistAddrMaxAdcX->Clone(); fHistList->Add(fHistAddrMaxAdcX);
276 fHistAddrAdcSum=(TH1F*)monitor.fHistAddrAdcSum->Clone(); fHistList->Add(fHistAddrAdcSum);
277 fHistAddrBaseRms=(TH1F*)monitor.fHistAddrBaseRms->Clone(); fHistList->Add(fHistAddrBaseRms);
280 fHistDistrSumIROC=(TH1F*)monitor.fHistDistrSumIROC->Clone(); fHistList->Add(fHistDistrSumIROC);
281 fHistDistrMaxIROC=(TH1F*)monitor.fHistDistrMaxIROC->Clone(); fHistList->Add(fHistDistrMaxIROC);
282 fHistDistrSumOROC=(TH1F*)monitor.fHistDistrSumOROC->Clone(); fHistList->Add(fHistDistrSumOROC);
283 fHistDistrMaxOROC=(TH1F*)monitor.fHistDistrMaxOROC->Clone(); fHistList->Add(fHistDistrMaxOROC);
285 fHistDistrBase2dIROC=(TH2F*)monitor.fHistDistrBase2dIROC->Clone(); fHistList->Add(fHistDistrBase2dIROC);
286 fHistDistrBase2dOROC=(TH2F*)monitor.fHistDistrBase2dOROC->Clone(); fHistList->Add(fHistDistrBase2dOROC);
287 fHistDistrBaseRmsIROC=(TH1D*)monitor.fHistDistrBaseRmsIROC->Clone(); fHistList->Add(fHistDistrBaseRmsIROC);
288 fHistDistrBaseMeanIROC=(TH1D*)monitor.fHistDistrBaseMeanIROC->Clone(); fHistList->Add(fHistDistrBaseMeanIROC);
289 fHistDistrBaseRmsOROC=(TH1D*)monitor.fHistDistrBaseRmsOROC->Clone(); fHistList->Add(fHistDistrBaseRmsOROC);
290 fHistDistrBaseMeanOROC=(TH1D*)monitor.fHistDistrBaseMeanOROC->Clone(); fHistList->Add(fHistDistrBaseMeanOROC);
292 fHistGlobalMaxA=(TH2S*)monitor.fHistGlobalMaxA->Clone(); fHistList->Add(fHistGlobalMaxA);
293 fHistGlobalMaxC=(TH2S*)monitor.fHistGlobalMaxC->Clone(); fHistList->Add(fHistGlobalMaxC);
295 // fPad = new Int_t*[monitor.GetMaxHwAddr()];
296 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[monitor.GetTimeBins()];}
298 //fPadMapRCU = new Int_t*[monitor.GetMaxHwAddr()];
299 for(Int_t i = 0; i<monitor.GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];}
301 //fPadMapHw = new Float_t[monitor.GetMaxHwAddr()];
303 //fMapEqidsRcu = new Int_t[1000];
304 //fMapEqidsSec = new Int_t*[36];
305 for(Int_t i = 0; i<36; i++) { fMapEqidsSec[i] = new Int_t[6];}
310 if (!gDirectory->GetList())
312 Warning("Build","Current directory is not a valid directory");
317 AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(monitor.GetName());
320 Warning("Build","Replacing existing histogram: %s (Potential memory leak).",monitor.GetName());
321 gDirectory->GetList()->Remove(hold);
323 gDirectory->Append(this);
329 //____________________________________________________________________________
331 AliTPCMonitor &AliTPCMonitor:: operator= (const AliTPCMonitor& monitor)
333 // assigment operator
336 ((AliTPCMonitorConfig *)this)->operator=(monitor);
337 fkNRowsIroc=monitor.fkNRowsIroc;
338 fkNRowsOroc=monitor.fkNRowsOroc;
339 fkNPadsIroc=monitor.fkNPadsIroc;
340 fkNPadsOroc=monitor.fkNPadsOroc;
341 fkNPadMinIroc=monitor.fkNPadMinIroc;
342 fkNPadMinOroc=monitor.fkNPadMinOroc;
343 fkNPadMaxIroc=monitor.fkNPadMaxIroc;
344 fkNPadMaxOroc=monitor.fkNPadMaxOroc;
346 fLastEv=monitor.fLastEv;
347 fEventNumber=monitor.fEventNumber;
348 fEventNumberOld=monitor.fEventNumberOld;
349 fDisableFit=monitor.fDisableFit;
350 fExecGlob=monitor.fExecGlob;
351 fExecPlaneMax=monitor.fExecPlaneMax;
352 fExecPadIrocRms=monitor.fExecPadIrocRms;
353 fExecPadOrocRms=monitor.fExecPadOrocRms;
354 fRunId=monitor.fRunId;
356 fPadUsedRoc=monitor.fPadUsedRoc;
357 fPadUsedHwAddr=monitor.fPadUsedHwAddr;
358 fGdcId=monitor.fGdcId;
359 fLdcId=monitor.fLdcId;
360 fLdcIdOld=monitor.fLdcIdOld;
361 fMapHand=monitor.fMapHand;
362 fRawReader=monitor.fRawReader;
365 fHistList = new TObjArray();
366 fHistIROC=(TH2F*)monitor.fHistIROC->Clone(); fHistList->Add(fHistIROC);
367 fHistOROC=(TH2F*)monitor.fHistOROC->Clone(); fHistList->Add(fHistOROC);
368 fHistIROCIndex=(TH2S*)monitor.fHistIROCIndex->Clone(); fHistList->Add(fHistIROCIndex);
369 fHistOROCIndex=(TH2S*)monitor.fHistOROCIndex->Clone(); fHistList->Add(fHistOROCIndex);
370 fHistIROCTime=(TH2F*)monitor.fHistIROCTime->Clone(); fHistList->Add(fHistIROCTime);
371 fHistOROCTime=(TH2F*)monitor.fHistOROCTime->Clone(); fHistList->Add(fHistOROCTime);
372 fHistIROCClone=(TH2F*)monitor.fHistIROCClone->Clone(); fHistList->Add(fHistIROCClone);
373 fHistOROCClone=(TH2F*)monitor.fHistOROCClone->Clone(); fHistList->Add(fHistOROCClone);
374 fHistIROCRMS=(TH2F*)monitor.fHistIROCRMS->Clone(); fHistList->Add(fHistIROCRMS);
375 fHistOROCRMS=(TH2F*)monitor.fHistOROCRMS->Clone(); fHistList->Add(fHistOROCRMS);
376 fHistIROCBASE=(TH2F*)monitor.fHistIROCBASE->Clone(); fHistList->Add(fHistIROCBASE);
377 fHistOROCBASE=(TH2F*)monitor.fHistOROCBASE->Clone(); fHistList->Add(fHistOROCBASE);
378 fHistIROCSUM=(TH2F*)monitor.fHistIROCSUM->Clone(); fHistList->Add(fHistIROCSUM);
379 fHistOROCSUM=(TH2F*)monitor.fHistOROCSUM->Clone(); fHistList->Add(fHistOROCSUM);
381 fHistChannelTime=(TH2F*)monitor.fHistChannelTime->Clone(); fHistList->Add(fHistChannelTime);
383 fHistAddrMapIndex=(TH1F*)monitor.fHistAddrMapIndex->Clone(); fHistList->Add(fHistAddrMapIndex);
384 fHistAddrMaxAdc=(TH1F*)monitor.fHistAddrMaxAdc->Clone(); fHistList->Add(fHistAddrMaxAdc);
385 fHistAddrBaseMean=(TH1F*)monitor.fHistAddrBaseMean->Clone(); fHistList->Add(fHistAddrBaseMean);
386 fHistAddrMaxAdcX=(TH1F*)monitor.fHistAddrMaxAdcX->Clone(); fHistList->Add(fHistAddrMaxAdcX);
387 fHistAddrAdcSum=(TH1F*)monitor.fHistAddrAdcSum->Clone(); fHistList->Add(fHistAddrAdcSum);
388 fHistAddrBaseRms=(TH1F*)monitor.fHistAddrBaseRms->Clone(); fHistList->Add(fHistAddrBaseRms);
391 fHistDistrSumIROC=(TH1F*)monitor.fHistDistrSumIROC->Clone(); fHistList->Add(fHistDistrSumIROC);
392 fHistDistrMaxIROC=(TH1F*)monitor.fHistDistrMaxIROC->Clone(); fHistList->Add(fHistDistrMaxIROC);
393 fHistDistrSumOROC=(TH1F*)monitor.fHistDistrSumOROC->Clone(); fHistList->Add(fHistDistrSumOROC);
394 fHistDistrMaxOROC=(TH1F*)monitor.fHistDistrMaxOROC->Clone(); fHistList->Add(fHistDistrMaxOROC);
396 fHistDistrBase2dIROC=(TH2F*)monitor.fHistDistrBase2dIROC->Clone(); fHistList->Add(fHistDistrBase2dIROC);
397 fHistDistrBase2dOROC=(TH2F*)monitor.fHistDistrBase2dOROC->Clone(); fHistList->Add(fHistDistrBase2dOROC);
398 fHistDistrBaseRmsIROC=(TH1D*)monitor.fHistDistrBaseRmsIROC->Clone(); fHistList->Add(fHistDistrBaseRmsIROC);
399 fHistDistrBaseMeanIROC=(TH1D*)monitor.fHistDistrBaseMeanIROC->Clone(); fHistList->Add(fHistDistrBaseMeanIROC);
400 fHistDistrBaseRmsOROC=(TH1D*)monitor.fHistDistrBaseRmsOROC->Clone(); fHistList->Add(fHistDistrBaseRmsOROC);
401 fHistDistrBaseMeanOROC=(TH1D*)monitor.fHistDistrBaseMeanOROC->Clone(); fHistList->Add(fHistDistrBaseMeanOROC);
403 fHistGlobalMaxA=(TH2S*)monitor.fHistGlobalMaxA->Clone(); fHistList->Add(fHistGlobalMaxA);
404 fHistGlobalMaxC=(TH2S*)monitor.fHistGlobalMaxC->Clone(); fHistList->Add(fHistGlobalMaxC);
406 fPad = new Int_t*[monitor.GetMaxHwAddr()];
407 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[monitor.GetTimeBins()];}
409 fPadMapRCU = new Int_t*[monitor.GetMaxHwAddr()];
410 for(Int_t i = 0; i<monitor.GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];}
412 fPadMapHw = new Float_t[monitor.GetMaxHwAddr()];
414 fMapEqidsRcu = new Int_t[1000];
415 fMapEqidsSec = new Int_t*[36];
416 for(Int_t i = 0; i<36; i++) { fMapEqidsSec[i] = new Int_t[6];}
421 if (!gDirectory->GetList())
423 Warning("Build","Current directory is not a valid directory");
426 AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(monitor.GetName());
429 Warning("Build","Replacing existing histogram: %s (Potential memory leak).",monitor.GetName());
430 gDirectory->GetList()->Remove(hold);
432 gDirectory->Append(this);
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 = ReadDataNew(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 = ReadDataNew(sectorid);
539 SetLastSectorDisplayed(sectorid) ;
540 fMapHand->ReadfecHwMap(GetLastSector());
543 SetEventProcessed(1);
546 //__________________________________________________________________
547 Int_t AliTPCMonitor::ReadDataNew(Int_t secid)
549 // Read Data File/Stream for specified Format.
550 // Payload will be extracted from either ROOT or DATE format
551 // and passed to FillHistsDecode for decoding of the adc information
554 fRawReader = AliRawReader::Create(GetFile());
555 SetLastProcFile(GetFile());
556 } else if (TString(GetLastProcFile())!=GetFile()) {
558 fRawReader = AliRawReader::Create(GetFile());
559 // printf("New file!!!\n");
560 SetLastProcFile(GetFile());
564 AliWarning("Coult not initialize raw reader");
569 while(skip && GetProcNextEvent())
571 if(fVerb) cout << "AliTPCMonitor::ReadDataNew get event " << endl;
572 if(fRawReader->IsA()==AliRawReaderRoot::Class()){
573 AliInfo(Form("Root, NextEvent: %d\n",GetEventID()));
574 if (!fRawReader->GotoEvent(GetEventID())){AliError("Could not get next Event"); return 11 ;}
575 } else if(!fRawReader->NextEvent()) { AliError("Could not get next Event"); return 11 ;}
576 // skip all events but physics, calibration and software trigger events!
577 UInt_t eventType=fRawReader->GetType();
578 if ( !(eventType==AliRawEventHeaderBase::kPhysicsEvent ||
579 eventType==AliRawEventHeaderBase::kCalibrationEvent ||
580 eventType==AliRawEventHeaderBase::kSystemSoftwareTriggerEvent ||
581 eventType==AliRawEventHeaderBase::kDetectorSoftwareTriggerEvent) ) {
582 if (fVerb) cout<< "Skipping event! Its neither of 'physics, calibration and software trigger event'" << endl;
583 if(fRawReader->IsA()==AliRawReaderRoot::Class()){
584 if (fEventNumber<fRawReader->GetNumberOfEvents()-1) ++fEventNumber;
585 else {AliError("No more events");return 11;}
590 //test if the TPC has data
592 fRawReader->Select("TPC");
593 Int_t eventNr=fRawReader->GetEventIndex();
594 if (!fRawReader->ReadNextData(data)) {
596 AliInfo(Form("%d / %d",fEventNumber,fRawReader->GetNumberOfEvents()));
597 if(fRawReader->IsA()==AliRawReaderRoot::Class()){
598 if (fEventNumber<fRawReader->GetNumberOfEvents()-1){
600 // printf("inc conter\n");
603 AliError("No more events");
608 fEventNumber = eventNr;
609 fEventNumberOld = eventNr;
612 AliInfo(Form("secid: %d",secid));
614 //========================== Histogram filling ======================
616 AliAltroRawStreamV3 *altro=new AliAltroRawStreamV3(fRawReader);
617 altro->SelectRawData("TPC");
622 Int_t nextHwAddress = 0;
630 while ( altro->NextDDL() ){
631 fGdcId = fRawReader->GetGDCId() ;
632 fLdcId = fRawReader->GetLDCId() ;
633 fRunId = fRawReader->GetRunNumber() ;
634 fEqId = fRawReader->GetEquipmentId();
635 rcupatch = GetRCUPatch(fRunId, fEqId);
636 Int_t rcupatchSector=rcupatch%6;
637 lastrcuid = (rcupatch+1000);
639 Int_t currentSector=rcupatch/6;
641 if(fLdcIdOld!=fLdcId && fChannelIter!=0) {
644 FillGlobal(GetLastSector());
646 if (fVerb) printf("filled sector: %d\n",GetLastSector());
651 // printf("RET: filled sector: %d\n",GetLastSector());
653 // if (rcupatch/6!=secid) continue;
658 if (!CheckEqId(secid,fEqId)) continue;
659 if (fVerb) printf("Sector: %d, RCU patch: %d, LDC: %d, EqId: %d\n",currentSector,rcupatch, fLdcId, fEqId);
661 while ( altro->NextChannel() ){
662 hw=altro->GetHWAddress();
663 nextHwAddress = ( hw + (rcupatchSector<<12) );
664 fPad[fChannelIter][0] = nextHwAddress ;
665 fPadMapHw[nextHwAddress] = fChannelIter ;
667 while ( altro->NextBunch() ){
668 Int_t startTbin = (Int_t)altro->GetStartTimeBin();
669 Int_t bunchlength = (Int_t)altro->GetBunchLength();
670 const UShort_t *sig = altro->GetSignals();
671 for (Int_t iTimeBin = 0; iTimeBin<bunchlength; iTimeBin++){
672 Int_t adc=(Int_t)sig[iTimeBin];
673 Int_t ntime=startTbin-iTimeBin;
674 //fill channel information
675 fPad[fChannelIter][ntime] = adc;
676 if( (adc>maxADC) && (ntime>=GetRangeMaxAdcMin()) && (ntime<GetRangeMaxAdcMax() )) {maxADC = adc;maxx = ntime ;}
677 if( (ntime>=GetRangeSumMin()) && (ntime<GetRangeSumMax() )) {sum+=adc; sumn++;}
681 //get pedestal, noise
682 Float_t pedestal=TMath::Mean(GetRangeBaseMax()-GetRangeBaseMin(),fPad[fChannelIter]+GetRangeBaseMin());
683 Float_t noise =TMath::RMS(GetRangeBaseMax()-GetRangeBaseMin(),fPad[fChannelIter]+GetRangeBaseMin());
684 fHistAddrMaxAdc->SetBinContent(nextHwAddress,maxADC-GetPedestals()*pedestal);
690 fHistDistrBase2dIROC->Fill(pedestal,noise);
691 fHistDistrSumIROC->Fill(sum);
692 fHistDistrMaxIROC->Fill(maxADC-pedestal*GetPedestals());
693 fHistDistrSumIROC->Fill(sum -sumn*pedestal*GetPedestals());
697 fHistDistrBase2dOROC->Fill(pedestal,noise);
698 fHistDistrSumOROC->Fill(sum);
699 fHistDistrMaxOROC->Fill(maxADC-pedestal*GetPedestals());
700 fHistDistrSumOROC->Fill(sum -sumn*pedestal*GetPedestals());
703 fHistAddrAdcSum->SetBinContent( nextHwAddress,sum);
704 fHistAddrMapIndex->SetBinContent(nextHwAddress,fChannelIter);
705 fHistAddrBaseMean->SetBinContent(nextHwAddress,pedestal);
706 fHistAddrMaxAdcX->SetBinContent( nextHwAddress,maxx);
707 fHistAddrBaseRms->SetBinContent( nextHwAddress,noise);
712 SetLastSector(rcupatch/6);
713 if(fChannelIter!=0 && secid==-1 ) SetSectorFilled(rcupatch/6);
717 if(fChannelIter!=0 && secid==-1) { FillGlobal(GetLastSector());}
731 //____________________________________________________________________________
732 void AliTPCMonitor::FillHistsPadPlane()
734 // Fill 2Dim histograms for IROC and OROC (max , rms and sum)
736 if(fVerb)cout << "AliTPCMonitor::FillHistsPadPlane() Start " << endl;
737 if(fVerb)PrintConfig();
744 for(Int_t ch = 0; ch<fChannelIter; ch++)
747 fHistChannelTime->SetCellContent(ch,0,hwadd);
749 for(Int_t bin = 1; bin <GetTimeBins(); bin++)
751 if( fHistChannelTime->GetCellContent(ch,bin)!=0) cout << " cellcontent already set " << endl;
752 if( GetPedestals()==1 ) fHistChannelTime->SetCellContent(ch,bin,(fPad[ch][bin]- fHistAddrBaseMean->GetBinContent(hwadd)));
753 else fHistChannelTime->SetCellContent(ch,bin,(fPad[ch][bin]));
756 pad = fMapHand->GetPad( hwadd);
757 row = fMapHand->GetPadRow(hwadd);
758 padmax = fMapHand->GetNumofPads(row);
762 fHistIROC->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrMaxAdc->GetBinContent( hwadd));
763 fHistIROCIndex->SetCellContent(row +1 ,pad +55 -padmax/2 +1,ch);
764 fHistIROCRMS->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrBaseRms->GetBinContent( hwadd));
765 fHistIROCBASE->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrBaseMean->GetBinContent(hwadd));
766 fHistIROCSUM->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrAdcSum->GetBinContent( hwadd));
770 fHistOROC->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrMaxAdc->GetBinContent( hwadd));
771 fHistOROCIndex->SetCellContent(row-63 +1 ,pad +70 -padmax/2 +1,ch);
772 fHistOROCRMS->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrBaseRms->GetBinContent( hwadd));
773 fHistOROCBASE->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrBaseMean->GetBinContent(hwadd));
774 fHistOROCSUM->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrAdcSum->GetBinContent( hwadd));
778 fHistChannelTime->GetXaxis()->SetRange(0,fChannelIter);
779 fHistChannelTime->GetYaxis()->SetRange(0,GetTimeBins());
784 //____________________________________________________________________________
785 void AliTPCMonitor::ResetArrays()
788 for(Int_t row = 0 ; row < fkNRowsIroc; row++)
790 for(Int_t pad = 0 ; pad < fkNPadsIroc ; pad++)
792 fHistIROCIndex->SetCellContent(row+1,pad+1,-1);
795 for(Int_t row = 0 ; row < fkNRowsOroc; row++)
797 for(Int_t pad = 0 ; pad < fkNPadsOroc ; pad++)
799 fHistOROCIndex->SetCellContent(row+1,pad+1,-1);
803 for(Int_t ch= 0; ch<GetMaxHwAddr(); ch++)
805 fHistAddrMaxAdcX->SetBinContent(ch,-1);
806 fHistAddrMapIndex->SetBinContent(ch,-1);
807 fHistAddrMaxAdc->SetBinContent( ch, 0);
808 fHistAddrBaseMean->SetBinContent( ch, 0);
809 fHistAddrAdcSum->SetBinContent( ch, 0);
810 fHistAddrBaseRms->SetBinContent(ch, 0);
813 for(Int_t ch = 0; ch< GetNumOfChannels(); ch++)
815 for(Int_t bin = 0; bin< GetTimeBins(); bin++)
820 for(Int_t ch = 0; ch< GetMaxHwAddr(); ch++)
823 fPadMapRCU[ch][0]=-1;
824 fPadMapRCU[ch][1]=-1;
825 fPadMapRCU[ch][2]=-1;
826 fPadMapRCU[ch][3]=-1;
827 fPadMapRCU[ch][4]=-1;
828 fPadMapRCU[ch][5]=-1;
834 //____________________________________________________________________________
835 void AliTPCMonitor::ResetHistos()
838 for(Int_t i =0; i<fHistList->GetEntries(); i++)
840 TString name=fHistList->At(i)->GetName();
841 if(GetProcNextEvent()==0 && (name=="SIDE A" || name=="SIDE C")) continue;
842 ((TH1*)fHistList->At(i))->Reset();
847 //____________________________________________________________________________
848 void AliTPCMonitor::DeleteHistos()
851 for(Int_t i =0; i<fHistList->GetEntries(); i++)
853 delete (TH1*)fHistList->At(i);
858 //__________________________________________________________________
859 Int_t AliTPCMonitor::CheckEqId(Int_t secid,Int_t eqid)
861 // Check if equipment id corresponds to any rcu patch in sector
862 // Equipment ids changed during commisioning in 2006 (starting from run 704)
863 // However Runids started from 0 again in 2007
864 // Now only runids from commissioning in 2006 after runid 704 and all new ones are supported.
865 // Comment in equipment check for runids < 704 if old runs should be processed
867 if(fVerb) cout << "AliTPCMonitor::CheckEqId : SectorId " << secid << " EquipmentId " << eqid << " runid " << fRunId << endl;
869 //skip all eqids which do not belong to the TPC
870 if ( eqid<768||eqid>983 ) return 0;
872 // if(fRunId<704 && 0) // commented out --> runs with runid < 704 in 2006 are not recognized anymore
874 // if( (secid>-1) && (secid<36) ) // if ( secid is in range) { take only specific eqids} else { take all }
876 // if( (secid==13) && ( eqid!=408 && eqid!=409 && eqid!=509 && eqid!=512 && eqid!=513 && eqid!=517 )) {passed=0;}
877 // else if( (secid==4) && ( eqid!=404 && eqid!=504 && eqid!=407 && eqid!=503 && eqid!=508 && eqid!=506 )) {passed=0;}
879 // else {if(fVerb) cout << "passed check "<< endl; }
883 if( (secid>-1) && (secid<36) ) // if ( secid is in range) { take only specific eqids} else { take all }
885 if(eqid!=fMapEqidsSec[secid][0] && eqid!= fMapEqidsSec[secid][1] && eqid!=fMapEqidsSec[secid][2] &&
886 eqid!=fMapEqidsSec[secid][3] && eqid!= fMapEqidsSec[secid][4] && eqid!=fMapEqidsSec[secid][5] ) {passed=0;}
888 else {if(fVerb) cout << "passed check "<< endl;}
894 //__________________________________________________________________
895 void AliTPCMonitor::SetEqIds()
897 // Set mapping for equipment ids
898 for(Int_t i = 0; i<36 ; i++)
900 for(Int_t j = 0; j<6; j++)
902 if(j<2) fMapEqidsSec[i][j]= 768+i*2+j;
903 else fMapEqidsSec[i][j]= 840+i*4+j-2;
907 for(Int_t i = 0; i<36 ; i++)
909 for(Int_t j = 0; j<6; j++)
911 if(j<2) fMapEqidsRcu[768+i*2+j] = i*6 +j;
912 else fMapEqidsRcu[840+i*4+j-2] = i*6 +j;
917 //__________________________________________________________________
918 void AliTPCMonitor::FillGlobal(Int_t sector)
921 // Fill global histograms with max adc for each channel
924 if((sector/18) ==0) hglob = fHistGlobalMaxA;
925 else hglob = fHistGlobalMaxC;
927 Float_t rotsec = (2*TMath::Pi()/18.0);
928 Float_t rot = (-rotsec*(sector%18) +4*rotsec);
930 Float_t m11 = TMath::Cos(rot);
931 Float_t m12 = TMath::Sin(rot);
932 Float_t m21 = -1*TMath::Sin(rot);
933 Float_t m22 = TMath::Cos(rot);
935 Int_t max = 0; // use integer for global view
947 for(Int_t hw = 0; hw<fHistAddrMaxAdc->GetNbinsX(); hw++)
949 max = (Int_t)fHistAddrMaxAdc->GetBinContent(hw);
952 pad = fMapHand->GetPad( hw);
953 row = fMapHand->GetPadRow(hw);
954 if (row==-1) continue;
955 padmax = fMapHand->GetNumofPads(row);
956 if (sector%36>17) fMirror=-1;
958 GetXY(xval ,yval , padmax,row ,pad);
959 xdr = xval*m11 +yval*m12;
960 ydr = xval*m21 +yval*m22;
961 if(hglob->GetBinContent(hglob->GetXaxis()->FindBin(xdr),hglob->GetYaxis()->FindBin(ydr))==0) hglob->Fill(xdr,ydr,(Int_t)max);
967 //__________________________________________________________________
968 void AliTPCMonitor::GetXY( Double_t& xval , Double_t& yval , Int_t padmax, Int_t row , Int_t pad) const
970 // Get x and y position of pad
974 xval = fMirror*( 2*padmax -4*pad -2);
975 yval = 852.25 +7.5*row;
979 xval = fMirror*( 3*padmax -6*pad -3);
980 if((row-63)<63) { yval = 10*(row-63) +1351; }
981 else { yval = 15*(row-63-64)+1993.5; }
986 //__________________________________________________________________
987 Int_t AliTPCMonitor::GetPadAtX(Float_t xval, Int_t row, Int_t padmax) const
989 // Get pad number at given position in x
992 if(row<63) {pad = (Int_t)( ( (xval/fMirror) +2 -2*padmax)/-4);}
993 else {pad = (Int_t)( ( (xval/fMirror) +3 -3*padmax)/-6);}
995 if(pad>=padmax) return -1;
1000 //__________________________________________________________________
1001 Int_t AliTPCMonitor::GetPadAtX(Float_t xval, Int_t row) const
1004 // Get pad number at given position in x
1006 Int_t padmax = fMapHand->GetNumofPads(row);
1009 if(row<63) {pad = (Int_t)( ( (xval/fMirror) +2 -2*padmax)/-4);}
1010 else {pad = (Int_t)( ( (xval/fMirror) +3 -3*padmax)/-6);}
1012 if(pad>=padmax) return -1;
1017 //__________________________________________________________________
1018 void AliTPCMonitor::DrawHists(Int_t histos)
1021 // Draw sets of histograms
1022 // histos==1 : 2Dim histos for MAX adc and add executables
1023 // histos==2 : distributions max/rms/sum
1024 // histos==3 : global max adc for specified SideA/C
1027 if(fVerb) cout << " Draw histos " << endl;
1029 if(GetLastSector()/18==0 ) cside="A";
1032 TString titleSEC = Form("Sector %i Side %s Run : %05i EventID %i " ,GetLastSector()%18,cside.Data(),fRunId, fEventNumber);
1033 TString titleEvent= Form("Time <-> Channles %s" ,titleSEC.Data());
1034 TString titleIROC = Form("IROC %s" ,titleSEC.Data());
1035 TString titleOROC = Form("OROC %s" ,titleSEC.Data());
1037 TString titleMAX = Form("Max (timebin: %i,%i) %s" ,GetRangeMaxAdcMin(),GetRangeMaxAdcMax(),titleSEC.Data());
1038 TString titleSUM = Form("Sum (timebin: %i,%i) %s" ,GetRangeSumMin() ,GetRangeSumMax() ,titleSEC.Data());
1039 TString titleBASE = Form("Baseline RMS<->Mean (timebin: %i-%i) %s" ,GetRangeBaseMin() ,GetRangeBaseMax() ,titleSEC.Data());
1040 TString titleMEAN = Form("Baseline Mean (timebin: %i-%i) %s" ,GetRangeBaseMin() ,GetRangeBaseMax() ,titleSEC.Data());
1041 TString titleRMS = Form("Baseline RMS (timebin: %i-%i) %s" ,GetRangeBaseMin() ,GetRangeBaseMax() ,titleSEC.Data());
1045 // IROC _______________________________________________________________
1047 ciroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("ciroc");
1050 ciroc = CreateCanvas("ciroc");
1055 fHistIROC->SetXTitle("row");
1056 fHistIROC->SetYTitle("pad");
1057 if(GetPedestals()) fHistIROC->SetZTitle("max ADC (baseline sub)");
1058 else fHistIROC->SetZTitle("max ADC ");
1059 fHistIROC->SetTitle(titleIROC.Data());
1060 fHistIROC->SetMinimum(0.01);
1061 fHistIROC->Draw("COLZ");
1062 ciroc->UseCurrentStyle();
1065 fHistIROCTime->SetXTitle("row"); fHistIROCTime->SetZTitle("peak time (fit)"); fHistIROCTime->SetYTitle("pad"); fHistIROCTime->SetTitle(titleIROC.Data());
1066 fHistIROCRMS->SetXTitle("row"); fHistIROCRMS->SetZTitle( "baseline rms (ADC)"); fHistIROCRMS->SetYTitle("pad"); fHistIROCRMS->SetTitle(titleIROC.Data());
1070 coroc =(TCanvas*)gROOT->GetListOfCanvases()->FindObject("coroc");
1072 coroc = CreateCanvas("coroc");
1077 fHistOROC->SetXTitle("row");
1078 fHistOROC->SetYTitle("pad");
1079 if(GetPedestals()) fHistOROC->SetZTitle("max ADC (baseline sub)");
1080 else fHistOROC->SetZTitle("max ADC ");
1081 fHistOROC->SetTitle(titleOROC.Data());
1082 fHistOROC->SetMinimum(0.01);
1083 fHistOROC->Draw("COLZ");
1084 coroc->UseCurrentStyle();
1087 fHistOROCTime->SetXTitle("row"); fHistOROCTime->SetZTitle("peak time (fit) (timebins)"); fHistOROCTime->SetYTitle("pad"); fHistOROCTime->SetTitle(titleOROC.Data());
1088 fHistOROCRMS->SetXTitle("row"); fHistOROCRMS->SetZTitle("baseline rms (ADC)"); fHistOROCRMS->SetYTitle("pad"); fHistOROCRMS->SetTitle(titleOROC.Data());
1091 TString namesum=Form("ADC sum (bins: %i, %i)",GetRangeSumMin() ,GetRangeSumMax() );
1092 fHistIROCSUM->SetXTitle("row");
1093 fHistIROCSUM->SetZTitle(namesum.Data());
1094 fHistIROCSUM->SetYTitle("pad");
1095 fHistIROCSUM->SetTitle(titleIROC.Data());
1097 fHistOROCSUM->SetXTitle("row");
1098 fHistOROCSUM->SetZTitle(namesum);
1099 fHistOROCSUM->SetYTitle("pad");
1100 fHistOROCSUM->SetTitle(titleOROC.Data());
1103 TString namebase=Form("base mean (timbebin: %i, %i )",GetRangeBaseMin(),GetRangeBaseMax());
1104 fHistIROCBASE->SetXTitle("row");
1105 fHistIROCBASE->SetZTitle(namebase.Data());
1106 fHistIROCBASE->SetYTitle("pad");
1107 fHistIROCBASE->SetTitle(titleIROC.Data());
1109 fHistOROCBASE->SetXTitle("row");
1110 fHistOROCBASE->SetZTitle(namebase);
1111 fHistOROCBASE->SetYTitle("pad");
1112 fHistOROCBASE->SetTitle(titleOROC.Data());
1114 if(fHistIROCClone) fHistIROCClone->Delete();
1115 if(fHistOROCClone) fHistOROCClone->Delete();
1116 fHistIROCClone = (TH2F*)fHistIROC->Clone("fHistIROCClone");
1117 fHistOROCClone = (TH2F*)fHistOROC->Clone("fHistOROCClone");
1120 if(fExecPlaneMax==0)
1122 TString carry1=Form(".x %s/TPC/AliTPCMonitorExec.C(1)",gSystem->Getenv("ALICE_ROOT"));
1123 ciroc->AddExec("pad",carry1.Data());
1124 coroc->AddExec("pad",carry1.Data());
1126 TString carry2=Form(".x %s/TPC/AliTPCMonitorExec.C(2)",gSystem->Getenv("ALICE_ROOT"));
1127 ciroc->AddExec("row",carry2.Data());
1128 coroc->AddExec("row",carry2.Data());
1136 // MAX ADC distribution ____________________________________________
1138 cmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cmax");
1139 if(!cmax) cmax = CreateCanvas("cmax");
1142 fHistDistrMaxIROC->GetXaxis()->SetRangeUser(0.0,1000.0);
1143 fHistDistrMaxIROC->SetXTitle("max ADC (ADC)");
1144 fHistDistrMaxIROC->SetYTitle("counts");
1145 fHistDistrMaxIROC->SetTitle(titleMAX.Data());
1146 fHistDistrMaxIROC->Draw("");
1147 fHistDistrMaxOROC->SetLineColor(2);
1148 fHistDistrMaxOROC->Draw("same");
1150 if(fHistDistrMaxOROC->GetMaximum()> fHistDistrMaxIROC->GetMaximum()) fHistDistrMaxIROC->SetMaximum(fHistDistrMaxOROC->GetMaximum()*1.1);
1152 TLegend* legio = new TLegend(0.6,0.6,0.8,0.8);
1153 legio->SetFillColor(0);
1154 legio->AddEntry(fHistDistrMaxIROC,"IROC","l");
1155 legio->AddEntry(fHistDistrMaxOROC,"OROC","l");
1156 legio->Draw("same");
1158 // ADC sum distribution
1160 csum = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("csum");
1161 if(!csum) csum = CreateCanvas("csum") ;
1164 fHistDistrSumIROC->SetXTitle("sum ADC (ADC)");
1165 fHistDistrSumIROC->SetYTitle("counts");
1166 fHistDistrSumIROC->SetTitle(titleSUM.Data());
1167 fHistDistrSumIROC->Draw("");
1168 fHistDistrSumOROC->SetLineColor(2);
1169 fHistDistrSumOROC->Draw("same");
1170 if(fHistDistrSumOROC->GetMaximum()> fHistDistrSumIROC->GetMaximum()) fHistDistrSumIROC->SetMaximum(fHistDistrSumOROC->GetMaximum()*1.1);
1171 legio->Draw("same");
1173 // BASELINE MEAN distribution
1174 TCanvas* cbasemean = 0;
1175 cbasemean = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cbasemean");
1176 if(!cbasemean) cbasemean = CreateCanvas("cbasemean");
1179 fHistDistrBaseMeanIROC = fHistDistrBase2dIROC->ProjectionX("fHistDistrBaseMeanIROC");
1180 fHistDistrBaseMeanIROC->SetXTitle("base mean (ADC)");
1181 fHistDistrBaseMeanIROC->SetYTitle("counts");
1182 fHistDistrBaseMeanIROC->SetTitle(titleMEAN.Data());
1183 fHistDistrBaseMeanIROC->Draw("");
1185 fHistDistrBaseMeanOROC = fHistDistrBase2dOROC->ProjectionX("fHistDistrBaseMeanOROC");
1186 fHistDistrBaseMeanOROC->SetLineColor(2);
1187 fHistDistrBaseMeanOROC->Draw("same");
1188 if(fHistDistrBaseMeanOROC->GetMaximum()>fHistDistrBaseMeanIROC->GetMaximum()) fHistDistrBaseMeanIROC->SetMaximum(fHistDistrBaseMeanOROC->GetMaximum()*1.1);
1189 legio->Draw("same");
1191 TCanvas* cbaserms = 0;
1192 cbaserms = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cbaserms");
1193 if(!cbaserms) cbaserms = CreateCanvas("cbaserms") ;
1196 // BASELINE RMS distribution
1197 fHistDistrBaseRmsIROC = fHistDistrBase2dIROC->ProjectionY("fHistDistrBaseRmsIROC");
1198 fHistDistrBaseRmsIROC->SetXTitle("base rms (ADC)");
1199 fHistDistrBaseRmsIROC->SetYTitle("counts");
1200 fHistDistrBaseRmsIROC->SetTitle(titleRMS.Data());
1201 fHistDistrBaseRmsIROC->Draw("");
1203 fHistDistrBaseRmsOROC = fHistDistrBase2dOROC->ProjectionY("fHistDistrBaseRmsOROC");
1204 fHistDistrBaseRmsOROC->SetLineColor(2);
1205 fHistDistrBaseRmsOROC->Draw("same");
1206 if(fHistDistrBaseRmsOROC->GetMaximum()>fHistDistrBaseRmsIROC->GetMaximum()) fHistDistrBaseRmsIROC->SetMaximum(fHistDistrBaseRmsOROC->GetMaximum()*1.1);
1207 legio->Draw("same");
1211 cbasemean->Update();
1216 // GLOBAL MAX ADC _________________________________
1217 if(GetProcNextEvent()==1)
1222 if(!(cglobC=(TCanvas*)gROOT->GetListOfCanvases()->FindObject("SIDE C all"))) cglobC = CreateCanvas("SIDE C all");
1223 if(!(cglobA=(TCanvas*)gROOT->GetListOfCanvases()->FindObject("SIDE A all"))) cglobA = CreateCanvas("SIDE A all");
1225 TString globtitle1=Form("SIDE A Run %05i (EventID %i)",fRunId,fEventNumber);
1226 TString globtitle2=Form("SIDE C Run %05i (EventID %i)",fRunId,fEventNumber);
1228 fHistGlobalMaxA->SetTitle(globtitle1.Data());
1229 fHistGlobalMaxC->SetTitle(globtitle2.Data());
1230 fHistGlobalMaxA->SetXTitle("x/mm");
1231 fHistGlobalMaxA->SetYTitle("y/mm");
1232 fHistGlobalMaxC->SetXTitle("x/mm");
1233 fHistGlobalMaxC->SetYTitle("y/mm");
1235 if(GetPedestals()==0) { fHistGlobalMaxA->SetZTitle("max adc (not baseline sub)"); fHistGlobalMaxC->SetZTitle("max adc (not baseline sub)"); }
1236 else { fHistGlobalMaxA->SetZTitle("max adc "); fHistGlobalMaxC->SetZTitle("max adc "); }
1238 fHistGlobalMaxA->SetMinimum(0.01);
1239 fHistGlobalMaxC->SetMinimum(0.01);
1241 cglobC->cd() ; fHistGlobalMaxC->Draw("COLZ");
1242 cglobA->cd() ; fHistGlobalMaxA->Draw("COLZ");
1244 TString nameom=Form(".x %s/TPC/AliTPCMonitorExec.C(3)",gSystem->Getenv("ALICE_ROOT"));
1248 if(fVerb)cout << " set exec " << nameom.Data() << endl;
1249 cglobC->AddExec("glob",nameom.Data());
1250 cglobA->AddExec("glob",nameom.Data());
1255 cglobC->DeleteExec("glob");
1256 cglobA->DeleteExec("glob");
1258 if(fVerb) cout << " set exec " << nameom.Data() << endl;
1259 cglobC->AddExec("glob",nameom.Data());
1260 cglobA->AddExec("glob",nameom.Data());
1272 //__________________________________________________________________
1273 void AliTPCMonitor::DrawRMSMap()
1275 // Draw 2Dim rms histos for IROC and OROC
1276 // and set executables for canvases
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");
1283 crmsiroc->cd(); fHistIROCRMS->Draw("COLZ");
1284 crmsoroc->cd(); fHistOROCRMS->Draw("COLZ");
1286 TString carry1=Form(".x %s/TPC/AliTPCMonitorExec.C(1)",gSystem->Getenv("ALICE_ROOT"));
1287 TString carry2=Form(".x %s/TPC/AliTPCMonitorExec.C(2)",gSystem->Getenv("ALICE_ROOT"));
1289 if(fExecPadIrocRms==0)
1291 crmsiroc->AddExec("pad",carry1.Data());
1292 crmsiroc->AddExec("row",carry2.Data());
1296 if(fExecPadOrocRms==0)
1298 crmsoroc->AddExec("pad",carry1.Data());
1299 crmsoroc->AddExec("row",carry2.Data());
1310 //__________________________________________________________________
1311 void AliTPCMonitor::ExecPad()
1314 // Executable for Pad
1315 // Show time profile for channel the mouse is pointing at
1317 Int_t event = gPad->GetEvent();
1318 if (event != 51) return;
1320 TObject *select = gPad->GetSelected();
1322 if(!select->InheritsFrom("TH2")) { return; }
1323 gPad->GetCanvas()->FeedbackMode(kTRUE);
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);
1336 // Char_t namehist[50];
1343 Float_t ybinmin = 0;
1344 Float_t ybinmax = 0;
1346 // Check wich Canvas executed the event
1348 namesel=select->GetName();
1349 if(namesel=="fHistOROC" || namesel=="fHistOROCRMS" || namesel=="fHistOROCTime" )
1353 projhist=Form("ProjectionOROC");
1354 namecanv=Form("coroc_ch");
1355 fHistIndex = fHistOROCIndex;
1357 if(namesel=="fHistIROC" || namesel=="fHistIROCRMS" || namesel=="fHistIROCTime" )
1361 projhist=Form("ProjectionIROC");
1362 namecanv=Form("ciroc_ch");
1363 fHistIndex = fHistIROCIndex;
1366 // Check if Canvas already existed and get Ranges from former Prjection histogram
1367 if((cpad=(TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv)))
1370 if(gROOT->Get(projhist))
1373 xbinmin = ((TH1D*)gROOT->Get(projhist))->GetXaxis()->GetFirst();
1374 xbinmax = ((TH1D*)gROOT->Get(projhist))->GetXaxis()->GetLast();
1375 ybinmin = ((TH1D*)gROOT->Get(projhist))->GetMinimum();
1376 ybinmax = ((TH1D*)gROOT->Get(projhist))->GetMaximum();
1377 delete gROOT->Get("legfit");
1378 delete gROOT->Get("fg");
1383 cpad = CreateCanvas(namecanv); cpad->cd();
1387 if (!fHistIndex) return;
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;
1393 TH1D *hp=(TH1D*)gROOT->Get(projhist);
1394 if(!hp) hp=new TH1D(projhist,projhist,GetTimeBins(),0,GetTimeBins());//delete gROOT->Get(projhist);
1396 // TH1D *hp = (TH1D*)(((TH1D*)fHistChannelTime->ProjectionY("hp",binchannel,binchannel))->Clone(projhist));
1397 // TH1D *hp = fHistChannelTime->ProjectionY(projhist,binchannel,binchannel);
1399 Int_t nbinsx=fHistChannelTime->GetNbinsX();
1400 for (Int_t itb=0;itb<GetTimeBins();++itb){
1401 hp->GetArray()[itb]=fHistChannelTime->GetArray()[binchannel+itb*(nbinsx+2)];
1406 // Make title and Pave for channel Info
1407 Int_t npadRow , npad , nhw , nmax , hwadd;
1409 hwadd = (Int_t)fHistChannelTime->GetCellContent(binchannel,0);
1410 fPadUsedHwAddr = hwadd;
1412 if(rocid==0)npadRow = fMapHand->GetPadRow(hwadd);
1413 else npadRow = fMapHand->GetPadRow(hwadd)-63;
1414 npad = fMapHand->GetPad(hwadd);
1416 nmax = (Int_t)hp->GetMaximum();
1419 TPaveText* legstat = new TPaveText(0.18,0.65,0.3,0.8,"NDC");
1421 Int_t connector = fMapHand->GetFECconnector(hwadd);
1422 Int_t fecnr = fMapHand->GetFECfromHw(hwadd);
1423 Int_t fecch = fMapHand->GetFECchannel(hwadd);
1424 Int_t altrochip = fMapHand->GetAltro(hwadd);
1425 Int_t altrochannel= (fMapHand->GetAltroChannel(hwadd))%16;
1426 Int_t fecloc = fMapHand->U2fGetFECinRCU(fecnr) ;
1427 Int_t feclocbran = fMapHand->U2fGetFECinBranch(fecnr);
1428 Int_t branch = fMapHand->U2fGetBranch(fecnr);
1431 Short_t fecget = (hwadd & fgkHwMaskFEC) >> 7;
1432 Short_t branchget = (hwadd & fgkHwMaskBranch)>> 11;
1434 legstat->AddText(Form("Branch (map) \t %i (%i) \n",branchget,branch));
1435 legstat->AddText(Form("Fec in patch \t %i \n",fecloc));
1436 legstat->AddText(Form("Fec in branch (map)\t %i (%i)\n",fecget,feclocbran));
1437 legstat->AddText(Form("Connector \t %i \n",connector));
1438 legstat->AddText(Form("Fec No. \t %i \n",fecnr));
1439 legstat->AddText(Form("Fec chan \t %i \n",fecch));
1440 legstat->AddText(Form("Altro chip\t %i \n",altrochip));
1441 legstat->AddText(Form("Altro chan\t %i \n",altrochannel));
1443 TString title=Form("Row=%d Pad=%d Hw =%d maxADC =%d count =%d",npadRow,npad,nhw,nmax,binchannel);
1445 // hp->SetName(projhist);
1446 hp->SetTitleSize(0.04);
1447 hp->SetTitle(title.Data());
1448 hp->SetYTitle("ADC");
1449 hp->SetXTitle("Timebin");
1450 hp->GetXaxis()->SetTitleColor(1);
1454 hp->GetXaxis()->SetRange(xbinmin,xbinmax);
1455 hp->SetMinimum(ybinmin);
1456 hp->SetMaximum(ybinmax);
1460 hp->SetMinimum(0.0);
1461 hp->SetMaximum(1000.0);
1468 if(GetPedestals() && fDisableFit==0)
1470 Int_t maxx = (Int_t)fHistAddrMaxAdcX->GetBinContent(hwadd);
1471 Float_t max = (Float_t)fHistAddrMaxAdc->GetBinContent(hwadd);
1472 Float_t base = (Float_t)fHistAddrBaseMean->GetBinContent(hwadd);
1475 if( ((max+base)/base)>1.2)
1477 TF1* fg = new TF1("fg",AliTPCMonitor::Gamma4,maxx-5,maxx+5,4);
1478 fg->SetParName(0,"Normalisation");
1479 fg->SetParName(1,"Minimum");
1480 fg->SetParName(2,"Width");
1481 fg->SetParName(3,"Base");
1482 fg->SetParameter(0,max);
1483 fg->SetParameter(1,maxx-2);
1484 fg->SetParameter(2,1.5);
1485 fg->FixParameter(3,0);
1486 fg->SetLineColor(4);
1487 fg->SetLineWidth(1);
1490 TLegend* legfit = new TLegend(0.6,0.7,0.7,0.8);
1491 legfit->AddEntry("fg","#Gamma 4 fit","l");
1492 legfit->SetFillColor(0);
1493 legfit->SetName("legfit");
1494 legfit->Draw("same");
1498 legstat->SetFillColor(0);
1499 legstat->Draw("same");
1504 //__________________________________________________________________
1505 void AliTPCMonitor::ExecRow()
1508 // Executable for Pad
1509 // Show profile of max adc over given pad row
1510 // and 2dim histo adc(pad-in-row,time bin)
1512 Int_t event = gPad->GetEvent();
1513 if (event != 61) return;
1515 TObject *select = gPad->GetSelected();
1517 if(!select->InheritsFrom("TH2")) { return; }
1521 const Char_t *rowhist="hrowtime";
1522 const Char_t *rowhistxmax="hxmax";
1523 const Char_t *rowhistmax="hrowmax";
1526 Int_t px = gPad->GetEventX();
1527 Int_t py = gPad->GetEventY();
1528 Float_t upy = gPad->AbsPixeltoY(py);
1529 Float_t upx = gPad->AbsPixeltoX(px);
1530 Float_t y = gPad->PadtoY(upy);
1531 Float_t x = gPad->PadtoX(upx);
1533 TCanvas*crowtime = 0;
1534 TCanvas*crowmax = 0;
1537 TH2S* fHistIndex = 0;
1539 // ranges from already existing histos
1540 Int_t rowtimexmin = 0;
1541 Int_t rowtimexmax = 0;
1542 Int_t rowtimeymin = 0;
1543 Int_t rowtimeymax = 0;
1544 Float_t rowtimezmin = 0;
1545 Float_t rowtimezmax = 0;
1547 Int_t profrowxmin = 0;
1548 Int_t profrowxmax = 0;
1549 Double_t profrowymin = 0;
1550 Double_t profrowymax = 0;
1552 Int_t profxxmin = 0;
1553 Int_t profxxmax = 0;
1554 Double_t profxymin = 0;
1555 Double_t profxymax = 0;
1560 TString name=select->GetName();
1561 if( name=="fHistIROC" || name=="fHistIROCRMS" ) { fHistIndex = fHistIROCIndex; rocid =1; }
1562 else if(name=="fHistOROC" || name=="fHistOROCRMS" ) { fHistIndex = fHistOROCIndex; rocid =2; }
1563 else { cout << " not implemented for this histo " << endl; return; }
1565 gPad->GetCanvas()->FeedbackMode(kTRUE);
1569 // check if canvases exist //
1570 crowtime = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crowtime");
1571 crowmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crowmax");
1572 cxmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cxmax");
1574 if(!crowtime) crowtime = CreateCanvas("crowtime") ;
1575 if(!crowmax) crowmax = CreateCanvas("crowmax") ;
1576 if(!cxmax ) cxmax = CreateCanvas("cxmax") ;
1578 // check ranges of already existing histos
1579 if(gROOT->Get(rowhist))
1581 rowtimexmin = ((TH2F*)gROOT->Get(rowhist))->GetXaxis()->GetFirst();
1582 rowtimexmax = ((TH2F*)gROOT->Get(rowhist))->GetXaxis()->GetLast();
1583 rowtimeymin = ((TH2F*)gROOT->Get(rowhist))->GetYaxis()->GetFirst();
1584 rowtimeymax = ((TH2F*)gROOT->Get(rowhist))->GetYaxis()->GetLast();
1585 rowtimezmin = ((TH2F*)gROOT->Get(rowhist))->GetMinimum();
1586 rowtimezmax = ((TH2F*)gROOT->Get(rowhist))->GetMaximum();
1588 profrowxmin = ((TH1F*)gROOT->Get(rowhistmax))->GetXaxis()->GetFirst();
1589 profrowxmax = ((TH1F*)gROOT->Get(rowhistmax))->GetXaxis()->GetLast();
1590 profrowymin = ((TH1F*)gROOT->Get(rowhistmax))->GetMinimum();
1591 profrowymax = ((TH1F*)gROOT->Get(rowhistmax))->GetMaximum();
1593 profxxmin = ((TH1F*)gROOT->Get(rowhistxmax))->GetXaxis()->GetFirst();
1594 profxxmax = ((TH1F*)gROOT->Get(rowhistxmax))->GetXaxis()->GetLast();
1595 profxymin = ((TH1F*)gROOT->Get(rowhistxmax))->GetMinimum();
1596 profxymax = ((TH1F*)gROOT->Get(rowhistxmax))->GetMaximum();
1600 delete gROOT->Get(rowhist);
1601 delete gROOT->Get(rowhistmax);
1602 delete gROOT->Get("hxmax");
1603 delete gROOT->Get("legrow");
1606 // get channel for xy bin -> getRow -> getNrows -> getHw for each Pad in Row -> get channel for each hw -> make proj
1607 Int_t testy = fHistIndex->GetYaxis()->FindBin(y);
1608 Int_t testx = fHistIndex->GetXaxis()->FindBin(x);
1609 Int_t binchannel = (Int_t)fHistIndex->GetCellContent(testx,testy);
1611 if(binchannel>30000) return;
1612 if(binchannel<=0 ) { crowtime->Update() ; crowmax->Update() ; return ; }
1615 Int_t hwadd = (Int_t)fHistChannelTime->GetCellContent(binchannel,0);
1616 Int_t row = fMapHand->GetPadRow(hwadd);
1617 Int_t pad = fMapHand->GetPad(hwadd) ;
1618 Int_t numofpads = fMapHand->GetNumofPads(row);
1621 TH2F *hrowtime = new TH2F(rowhist , "" ,numofpads,0,numofpads,GetTimeBins(),0.0,GetTimeBins());
1622 TH1F *hrowmax = new TH1F(rowhistmax , "" ,numofpads,0,numofpads);
1623 TH1F *hxmax = new TH1F(rowhistxmax, "" ,159,0,159 );
1625 // Row profile ///////////
1626 if(fVerb) cout << " Number of pads " << numofpads << endl;
1627 for(Int_t padnr = 0; padnr<numofpads;padnr++)
1629 Int_t addrinrow = fMapHand->GetPadAddInRow(row,padnr );
1630 Int_t channel = (Int_t)fHistAddrMapIndex->GetBinContent(addrinrow);
1631 if(channel==-1) continue;
1633 hrowmax->SetBinContent(padnr+1,fHistAddrMaxAdc->GetBinContent(addrinrow));
1634 TH1D *hp = fHistChannelTime->ProjectionY("hp",channel,channel);
1635 for(Int_t time = 0;time<GetTimeBins();time++) {
1637 Float_t val = hp->GetBinContent(time);
1638 hrowtime->SetCellContent(padnr+1,time+1,val);
1642 // X profile /////////////
1643 Double_t xval = 0.0;
1644 Double_t yval = 0.0;
1645 GetXY(xval,yval,numofpads,row,pad);
1649 for(Int_t nrow = 0; nrow<159; nrow++)
1651 padnr = GetPadAtX(xval,nrow);
1654 hw = fMapHand->GetPadAddInRow(nrow,padnr);
1655 if(fPadMapHw[hw]==-1){ continue ; }
1656 else { hxmax->SetBinContent(nrow+1,fHistAddrMaxAdc->GetBinContent(hw)) ; }
1661 hxmax->SetTitle(Form("max adc in pads at x=%5.1f mm",xval));
1662 hxmax->SetXTitle("row");
1663 if(!GetPedestals()) hxmax->SetYTitle("max adc (baseline sub.)");
1664 else hxmax->SetYTitle("max adc ");
1665 hxmax->SetMinimum(0.01);
1670 hxmax->GetXaxis()->SetRange(profxxmin,profxxmax);
1671 hxmax->SetMinimum(profxymin);
1672 hxmax->SetMaximum(profxymax);
1681 title.Form("%s Row=%d",((TH2*)select)->GetTitle(),row) ;
1682 titlemax.Form("IROC max/sum Row=%d",row );
1684 title.Form("%s Row=%d",((TH2*)select)->GetTitle(),row-63);
1685 titlemax.Form("OROC max/sum Row=%d",row-63);
1688 if(fVerb) cout << " set name " << endl;
1693 hrowtime->SetTitleSize(0.04);
1694 hrowtime->SetTitle(title.Data());
1695 hrowtime->SetYTitle("timbin");
1696 hrowtime->SetXTitle("pad in row");
1697 hrowtime->SetZTitle("signal (ADC)");
1699 hrowtime->GetXaxis()->SetTitleColor(1);
1700 hrowtime->SetMaximum(1000.0);
1701 hrowtime->SetMinimum(0.0);
1705 hrowtime->GetXaxis()->SetRange(rowtimexmin,rowtimexmax);
1706 hrowtime->GetYaxis()->SetRange(rowtimeymin,rowtimeymax);
1707 hrowtime->SetMinimum(rowtimezmin);
1708 hrowtime->SetMaximum(rowtimezmax);
1711 hrowtime->Draw("COLZ");
1712 crowtime->UseCurrentStyle();
1715 // max and sum /////////////////////////
1718 hrowmax->GetXaxis()->SetRange(profrowxmin,profrowxmax);
1719 hrowmax->SetMinimum(profrowymin);
1720 hrowmax->SetMaximum(profrowymax);
1722 hrowmax->SetTitleSize(0.04);
1723 hrowmax->SetTitle(title.Data());
1724 hrowmax->SetYTitle("max adc");
1725 hrowmax->SetXTitle("pad in row");
1726 hrowmax->GetXaxis()->SetTitleColor(1);
1728 hrowmax->SetLineColor(2);
1735 //__________________________________________________________________
1736 void AliTPCMonitor::Write10bitChannel()
1739 // Write 10 bit words form histogram for active(last pointed) channel
1741 if(fPadUsedHwAddr==-1){ AliWarning(" No active pad "); return ;}
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];
1747 TString filenameroot;
1748 TString filenamedat;
1751 if(fPadUsedRoc==1) { projhist.Form("ProjectionOROC"); }
1752 if(fPadUsedRoc==0) { projhist.Form("ProjectionIROC"); }
1754 filenamedat.Form("Channel_Run%05i_EventID_%i_Pad_%i_Row_%i.dat" ,fRunId,fEventNumber,pad,row);
1755 filenameroot.Form("Channel_Run%05i_EventID_%i_Pad_%i_Row_%i.root" ,fRunId,fEventNumber,pad,row);
1758 if((hpr=(TH1D*)gROOT->Get(projhist)))
1761 TFile f(filenameroot.Data(),"recreate");
1766 ofstream datout(filenamedat.Data(),ios::out);
1767 datout <<"Timebin \t ADC value " << endl;
1768 for(Int_t i = 1; i <GetTimeBins(); i++)
1770 datout << i << " \t \t " << fPad[channel][i] << endl;
1776 AliWarning("No projection histo found ");
1780 //__________________________________________________________________
1781 void AliTPCMonitor::ExecTransform()
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
1791 TString namehtrimag;
1792 TString namehtrreal;
1795 if(fPadUsedRoc==1) { namecanv="coroc_ch_trans"; namecanv2="coroc_ch_trans2"; projhist="ProjectionOROC"; }
1796 if(fPadUsedRoc==0) { namecanv="ciroc_ch_trans"; namecanv2="ciroc_ch_trans2"; projhist="ProjectionIROC"; }
1800 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 ;}
1801 else hproj = (TH1D*)gROOT->Get(projhist.Data()) ;
1804 if(fPadUsedRoc==1) { namehtrimag="htransimagfreq_oroc"; namehtrreal="htransrealfreq_oroc"; namehtrmag="htransmagfreq_oroc"; }
1805 else { namehtrimag="htransimagfreq_iroc"; namehtrreal="htransrealfreq_iroc"; namehtrmag="htransmagfreq_iroc"; }
1807 if( gROOT->Get(namehtrimag.Data())) delete gROOT->Get(namehtrimag.Data());
1808 if( gROOT->Get(namehtrreal.Data())) delete gROOT->Get(namehtrreal.Data());
1809 if( gROOT->Get(namehtrmag.Data())) delete gROOT->Get(namehtrmag.Data());
1811 TCanvas *ctrans = 0;
1812 if(!(ctrans = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv.Data())))
1814 ctrans = CreateCanvas(namecanv.Data());
1815 ctrans->Divide(1,2);
1817 TCanvas *ctrans2 = 0;
1818 if(!(ctrans2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv2.Data())))
1820 ctrans2 = CreateCanvas(namecanv2.Data());
1821 // ctrans2->Divide(1,2);
1824 Int_t binfirst = hproj->GetXaxis()->GetFirst();
1825 Int_t binlast = hproj->GetXaxis()->GetLast();
1826 Int_t bins = binlast -binfirst +1;
1829 for(Int_t pot = 0; pot<=10 ; pot++)
1831 Int_t comp = (Int_t)TMath::Power(2,pot);
1832 if(bins>=comp)power = pot;
1835 bins = (Int_t)TMath::Power(2,power);
1837 // sampling frequency ;
1838 Double_t deltat = 1.0/(Float_t)GetSamplingFrequency();
1841 TH1D* htransrealfreq = new TH1D(namehtrreal.Data(),namehtrreal.Data(),10000,-1/(2*deltat),1/(2*deltat));
1842 TH1D* htransimagfreq = new TH1D(namehtrimag.Data(),namehtrimag.Data(),10000,-1/(2*deltat),1/(2*deltat));
1843 TH1D* htransmag = new TH1D(namehtrmag.Data(),namehtrmag.Data(),10000,-1/(2*deltat),1/(2*deltat));
1848 if(fPadUsedRoc==1) { titlereal="OROC DFT real part"; titleimag="OROC DFT imag part"; titlemag="OROC DFT magnitude"; }
1849 else { titlereal="IROC DFT real part"; titleimag="IROC DFT imag part"; titlemag="IROC DFT magnitude"; }
1851 htransrealfreq->SetTitle(titlereal.Data()); htransrealfreq->SetXTitle("f/hz"); htransrealfreq->SetYTitle("z_{real}(f)");
1852 htransimagfreq->SetTitle(titleimag.Data()); htransimagfreq->SetXTitle("f/hz"); htransimagfreq->SetYTitle("z_{imag}(f)");
1853 htransmag->SetTitle(titlemag.Data()); htransmag->SetXTitle("f/hz"); htransmag->SetYTitle("mag(f)");
1855 // create complex packed data array
1856 const Int_t kdatasiz = 2*bins;
1857 Double_t* data = new Double_t[kdatasiz];
1858 for(Int_t i=0;i<2*bins;i++) { data[i] = 0.0;}
1859 for(Int_t i=0;i<bins;i++) { data[2*i] = (Double_t)hproj->GetBinContent(binfirst+i); }
1861 // make fourier transformation
1862 AliTPCMonitorFFT* four = new AliTPCMonitorFFT();
1863 four->ComplexRadix2ForwardWrap(data,1,bins);
1865 // write output and fill histos forward
1866 Double_t freq = 0.0;
1867 for(Int_t i=0;i<2*bins;i++)
1871 if(i<(bins/2)) { freq = i/(bins*deltat) ; }
1872 else { freq = -1*((bins-i)/(bins*deltat)); }
1873 htransrealfreq->Fill( freq,data[2*i] );
1874 htransimagfreq->Fill( freq,data[2*i+1]);
1875 htransmag->Fill( freq, TMath::Sqrt(data[2*i]*data[2*i]+data[2*i+1]*data[2*i+1]) );
1880 htransrealfreq->Draw();
1882 htransimagfreq->Draw();
1891 //__________________________________________________________________
1892 void AliTPCMonitor::ShowSel(Int_t* compval)
1895 // Show only selected components
1896 // First restore original histogram from clone
1897 // Than remove all not matching pads form histos
1899 Int_t connector = 0;
1901 Int_t altrochip = 0;
1902 Int_t feclocbran = 0;
1909 Float_t maxiroc = fHistIROCClone->GetMaximum();
1910 Float_t maxoroc = fHistOROCClone->GetMaximum();
1913 // restore original histos
1914 for(Int_t row = 0; row<fkNRowsIroc; row++)
1916 for(Int_t pad = 0; pad<fkNPadsIroc; pad++)
1918 index = (Int_t)fHistIROCIndex->GetCellContent(row+1,pad+1);
1919 if(index==-1)continue;
1920 else fHistIROC->SetCellContent(row+1,pad+1,fHistIROCClone->GetCellContent(row+1,pad+1));
1923 for(Int_t row = 0; row<fkNRowsOroc; row++)
1925 for(Int_t pad = 0; pad<fkNPadsOroc; pad++)
1927 index = (Int_t)fHistOROCIndex->GetCellContent(row+1,pad+1);
1928 if(index==-1)continue;
1929 else fHistOROC->SetCellContent(row+1,pad+1,fHistOROCClone->GetCellContent(row+1,pad+1));
1934 // remove not matching entries from fHistIROC/fHistOROC
1937 TH2S* fHistIndex =0;
1941 for(Int_t row = 0; row< (fkNRowsIroc + fkNRowsOroc); row++)
1943 if(row<fkNRowsIroc) { fHist=fHistIROC ; fHistIndex = fHistIROCIndex; npads = fkNPadsIroc; subrows =0 ;}
1944 else { fHist=fHistOROC ; fHistIndex = fHistOROCIndex; npads = fkNPadsOroc; subrows =fkNRowsIroc;}
1946 for(Int_t pad = 0; pad<npads; pad++)
1948 index = (Int_t)fHistIndex->GetCellContent(row -subrows +1,pad+1);
1949 if(index==-1) continue ;
1950 hwadd = (Int_t)fHistChannelTime->GetCellContent(index,0);
1953 fecnr = fMapHand->GetFECfromHw(hwadd);
1954 if(compval[0]!=-1 && fecnr!=compval[0]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1957 rcuget = (hwadd & fgkHwMaskRCU)>> 12;
1958 if(compval[1]!=-1 && rcuget!=compval[1]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1961 branch = fMapHand->U2fGetBranch(fecnr) ;
1962 if(compval[2]!=-1 && branch!=compval[2]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1965 feclocbran= fMapHand->U2fGetFECinBranch(fecnr) ;
1966 if(compval[3]!=-1 && feclocbran!=compval[3]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1969 connector = fMapHand->GetFECconnector(hwadd);
1970 if(compval[4]!=-1 && connector!=compval[4]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1973 altrochip = fMapHand->GetAltro(hwadd);
1974 if(compval[5]!=-1 && altrochip!=compval[5]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1981 if(gROOT->GetListOfCanvases()->FindObject("ciroc"))
1983 c1 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("ciroc");
1985 fHistIROC->Draw("COLZ");
1986 fHistIROC->SetMaximum(maxiroc);
1987 fHistIROC->SetMinimum(0.0);
1990 if(gROOT->GetListOfCanvases()->FindObject("coroc"))
1992 c2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("coroc");
1994 fHistOROC->Draw("COLZ");
1995 fHistOROC->SetMaximum(maxoroc);
1996 fHistOROC->SetMinimum(0.0);
2002 //__________________________________________________________________
2003 void AliTPCMonitor::ResizeCanv()
2005 // Resize canvases and delete some of them
2007 TString carry1=Form(".x %s/TPC/AliTPCMonitorExec.C(1)",gSystem->Getenv("ALICE_ROOT"));
2008 TString carry3=Form(".x %s/TPC/AliTPCMonitorExec.C(2)",gSystem->Getenv("ALICE_ROOT"));
2009 if(fVerb) cout << " canv 1 " << endl;
2011 if(gROOT->GetListOfCanvases()->FindObject( "coroc_ch")) { delete gROOT->GetListOfCanvases()->FindObject("coroc_ch") ; }
2012 if(gROOT->GetListOfCanvases()->FindObject( "ciroc_ch")) { delete gROOT->GetListOfCanvases()->FindObject("ciroc_ch") ; }
2014 // for 2dim plots delete create and draw again
2015 if(gROOT->GetListOfCanvases()->FindObject("ciroc"))
2017 delete gROOT->GetListOfCanvases()->FindObject("ciroc");
2018 TCanvas* ciroc = CreateCanvas("ciroc");
2020 fHistIROC->Draw("COLZ");
2021 ciroc->AddExec("pad",carry1.Data());
2022 ciroc->AddExec("row",carry3.Data());
2026 // for 2dim plots delete create and draw again
2027 if(gROOT->GetListOfCanvases()->FindObject("coroc"))
2029 delete gROOT->GetListOfCanvases()->FindObject("coroc");
2030 TCanvas* coroc = CreateCanvas("coroc");
2032 fHistOROC->Draw("COLZ");
2034 coroc->AddExec("pad",carry1.Data());
2035 coroc->AddExec("row",carry3.Data());
2040 if(gROOT->GetListOfCanvases()->FindObject( "cbasemean")) { delete gROOT->GetListOfCanvases()->FindObject("cbasemean"); }
2041 if(gROOT->GetListOfCanvases()->FindObject( "cbase")) { delete gROOT->GetListOfCanvases()->FindObject("cbase");}
2042 if(gROOT->GetListOfCanvases()->FindObject( "cbaserms")) { delete gROOT->GetListOfCanvases()->FindObject("cbaserms"); }
2043 if(gROOT->GetListOfCanvases()->FindObject( "cmax")) { delete gROOT->GetListOfCanvases()->FindObject("cmax"); }
2044 if(gROOT->GetListOfCanvases()->FindObject( "csum")) { delete gROOT->GetListOfCanvases()->FindObject("csum"); }
2045 if(gROOT->GetListOfCanvases()->FindObject( "ciroc_ch_trans")) { delete gROOT->GetListOfCanvases()->FindObject("ciroc_ch_trans");}
2046 if(gROOT->GetListOfCanvases()->FindObject( "coroc_ch_trans")) { delete gROOT->GetListOfCanvases()->FindObject("coroc_ch_trans");}
2047 if(gROOT->GetListOfCanvases()->FindObject( "crowtime")) { delete gROOT->GetListOfCanvases()->FindObject("crowtime"); }
2048 if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); }
2049 if(gROOT->GetListOfCanvases()->FindObject( "cxmax")) { delete gROOT->GetListOfCanvases()->FindObject("cxmax"); }
2050 if(gROOT->GetListOfCanvases()->FindObject( "crmsoroc")) { delete gROOT->GetListOfCanvases()->FindObject("crmsoroc"); fExecPadOrocRms = 0; }
2051 if(gROOT->GetListOfCanvases()->FindObject( "crmsiroc")) { delete gROOT->GetListOfCanvases()->FindObject("crmsiroc"); fExecPadIrocRms = 0; }
2052 if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); }
2053 if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); }
2060 //__________________________________________________________________
2061 Int_t AliTPCMonitor::ExecProcess()
2063 // Executable for global Histogram
2064 // Will be called from /TPC/AliTPCMonitorExec.C(3)
2065 // Call ProcessEvent for same event and sector pointed at
2070 Int_t event = gPad->GetEvent();
2071 if(event != 61) return -1;
2073 TObject *select = gPad->GetSelected();
2074 if(!select) return -1;
2075 TString name=select->GetName();
2076 if(!select->InheritsFrom("TH2")) {gPad->SetUniqueID(0); return -1; }
2077 if( name=="hglobal" || name=="SIDE A" ) side = 0;
2078 else if( name=="hglobal2" || name=="SIDE C" ) side = 1;
2081 Int_t px = gPad->GetEventX();
2082 Int_t py = gPad->GetEventY();
2083 Float_t upy = gPad->AbsPixeltoY(py);
2084 Float_t upx = gPad->AbsPixeltoX(px);
2085 Float_t y = gPad->PadtoY(upy);
2086 Float_t x = gPad->PadtoX(upx);
2088 Int_t testy = ((TH2*)select)->GetYaxis()->FindBin(y);
2089 Int_t testx = ((TH2*)select)->GetXaxis()->FindBin(x);
2090 if(((TH2*)select)->GetCellContent(testx,testy)==0) return -1 ;
2092 Float_t alpha = 0.0;
2093 if(x>0.0 && y > 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(x/y)));
2094 if(x>0.0 && y < 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(y/x)));
2095 if(x<0.0 && y < 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(x/y)));
2096 if(x<0.0 && y > 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(y/x)));
2098 if(x>0.0 && y < 0.0) alpha += ( TMath::Pi()/2);
2099 if(x<0.0 && y < 0.0) alpha += ( TMath::Pi());
2100 if(x<0.0 && y > 0.0) alpha += (1.5*TMath::Pi());
2102 sector = (Int_t)(alpha/(2*TMath::Pi()/18.0));
2103 if(alpha> (sector+0.5)*(2*TMath::Pi()/18.0)) sector+=1;
2105 if(sector==18 && side ==0 ) {
2106 AliWarning("There was a wromg assignment of sector 0 with sector 18. Check sectors");
2110 sector = (18-sector +4)%18;
2111 SetLastSector(sector+ side*18);
2112 SetProcNextEvent(0);
2114 if(fVerb) cout << "AliTPCMonitor::ExecProcess() next side " << side << " next sector " << sector << endl;
2116 return (Int_t)ProcessEvent();
2120 //__________________________________________________________________
2121 Int_t AliTPCMonitor::GetRCUPatch(Int_t runid, Int_t eqid) const
2124 // Return RCU patch index for given equipment id eqid
2129 if ( eqid<768 || eqid>983 ) return 0; //no TPC eqid
2130 // if(eqid>=1000) return 0;
2131 patch = fMapEqidsRcu[eqid] ;
2135 if(eqid==408) {patch = 13*6+4 +0; }
2136 if(eqid==409) {patch = 13*6+5 +0; }
2137 if(eqid==509) {patch = 13*6+0 +0; }
2138 if(eqid==512) {patch = 13*6+3 +0; }
2139 if(eqid==513) {patch = 13*6+1 +0; }
2140 if(eqid==517) {patch = 13*6+2 +0; }
2142 if(eqid==404) {patch = 4*6+5 +0; }
2143 if(eqid==504) {patch = 4*6+4 +0; }
2144 if(eqid==407) {patch = 4*6+3 +0; }
2145 if(eqid==503) {patch = 4*6+2 +0; }
2146 if(eqid==508) {patch = 4*6+1 +0; }
2147 if(eqid==506) {patch = 4*6+0 +0; }
2152 //__________________________________________________________________
2153 void AliTPCMonitor::DumpHeader(AliRawReader * reader) const
2155 // Dump Event header for format
2157 cout << "EventHeader : fReader->GetEquipmentSize() :" << reader->GetEquipmentSize() << endl;
2158 cout << "EventHeader : fReader->GetType() :" << reader->GetType() << endl;
2159 cout << "EventHeader : fReader->GetRunNumber() :" << reader->GetRunNumber() << endl;
2160 cout << "EventHeader : fReader->GetEventId() :" << *(reader->GetEventId()) << endl;
2161 cout << "EventHeader : fReader->GetLDCId() :" << reader->GetLDCId() << endl;
2162 cout << "EventHeader : fReader->GetGDCId() :" << reader->GetGDCId() << endl;
2166 //__________________________________________________________________
2167 Double_t AliTPCMonitor::Gamma4(Double_t* x, Double_t* par) {
2169 // Gamma4 function used to fit signals
2170 // Defined in sections: diverging branch set to 0
2174 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];
2180 //__________________________________________________________________
2181 TCanvas* AliTPCMonitor::CreateCanvas(const Char_t* name)
2187 Int_t xoffset = GetCanvasXOffset();
2188 Int_t xsize = GetCanvasXSize();
2189 Int_t ysize = GetCanvasYSize();
2190 Int_t xspace = GetCanvasXSpace();
2191 Int_t yspace = GetCanvasYSpace();
2194 // ROC 2dim max distribution
2195 if( sname=="coroc") { 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(sname=="ciroc") { 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(sname=="crmsoroc") { 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(sname=="crmsiroc") { 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(sname=="SIDE C all") { 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(sname=="SIDE A all") { 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(sname=="cmax") { canv = new TCanvas("cmax" ,"cmax" , -1+xoffset, 3*yspace ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; }
2205 else if(sname=="csum") { canv = new TCanvas("csum" ,"csum" , xspace+xoffset, 3*yspace ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; }
2206 else if(sname=="cbasemean") { 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(sname=="cbaserms") { 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(sname=="coroc_ch") { 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(sname=="ciroc_ch") { 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(sname=="coroc_ch_trans") { 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(sname=="ciroc_ch_trans") { 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 else if(sname=="coroc_ch_trans2") { canv = new TCanvas("coroc_ch_trans2","coroc_ch_trans2",(Int_t)(3.0*xspace+xoffset),(Int_t)(yspace+0.5*ysize),(Int_t)(1.5*xsize),(Int_t)(1.5*ysize)); return canv; }
2215 else if(sname=="ciroc_ch_trans2") { canv = new TCanvas("ciroc_ch_trans2","ciroc_ch_trans2",(Int_t)(3.0*xspace+xoffset), 0 ,(Int_t)(1.5*xsize),(Int_t)(1.5*ysize)); return canv; }
2216 // row profile histograms
2217 else if(sname=="crowtime") { canv = new TCanvas("crowtime" ,"crowtime" , 1*xspace+xoffset, 2*yspace +ysize ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; }
2218 else if(sname=="crowmax") { canv = new TCanvas("crowmax" ,"crowmax" , 2*xspace+xoffset, 2*yspace +ysize ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; }
2219 else if(sname=="cxmax") { canv = new TCanvas("cxmax" ,"cxmax" , 3*xspace+xoffset, 2*yspace +ysize ,(Int_t)(1.0*xsize),(Int_t)(1.0*ysize)); return canv; }
2220 else { cout << " Warning Canvas name unknown " << endl; return 0 ; }
2223 //__________________________________________________________________
2224 void AliTPCMonitor::WriteHistos()
2226 // Writes all available histograms to a file in current directory
2227 // File name will be specified by : sector, side, runid and eventnumber
2229 if(GetEventProcessed())
2231 AliInfo("Write histos to file");
2232 TString name=Form("SIDE_%i_SECTOR_%02i_RUN_%05i_EventID_%06i.root",(GetLastSector()/18),(GetLastSector()%18),fRunId,fEventNumber);
2233 TFile* f = new TFile(name.Data(),"recreate");
2234 for(Int_t i =0; i<fHistList->GetEntries(); i++)
2236 if(((TH1*)fHistList->At(i))!=0)
2238 ((TH1*)fHistList->At(i))->Write();
2246 AliError("No Event Processed : Chose Format , File and push 'Next Event' ");
2251 //__________________________________________________________________
2252 TH1* AliTPCMonitor::GetHisto(char* histname)
2255 // Returns histogram specified by histname
2256 // check available names for histos in CreateHistos()
2259 if((TH1*)fHistList->FindObject(histname))
2261 hist = (TH1*)fHistList->FindObject(histname);
2265 cout << " AliTPCMonitor::GetHisto :: Can not find histo with name " << histname << endl;