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 "AliRawEventHeaderBase.h"
58 #include "AliAltroRawStreamV3.h"
66 #include "TDirectory.h"
68 #include "TPaveText.h"
70 #include <Riostream.h>
72 ClassImp(AliTPCMonitor)
74 const Int_t AliTPCMonitor::fgkHwMaskFEC = 0x0780;
75 const Int_t AliTPCMonitor::fgkHwMaskBranch = 0x0800;
76 const Int_t AliTPCMonitor::fgkHwMaskFECChannel = 0x007f;
77 const Int_t AliTPCMonitor::fgkHwMaskAltroChannel = 0x000f;
78 const Int_t AliTPCMonitor::fgkHwMaskAltroChip = 0x0070;
79 const Int_t AliTPCMonitor::fgkHwMaskRCU = 0x7000;
81 //____________________________________________________________________________
82 AliTPCMonitor::AliTPCMonitor(char* name, char* title) :
83 AliTPCMonitorConfig(name,title),
84 fPad(new Int_t*[GetMaxHwAddr()]),
85 fPadMapHw(new Float_t[GetMaxHwAddr()]),
86 fPadMapRCU(new Int_t*[GetMaxHwAddr()]),
102 fHistAddrMapIndex(0),
104 fHistAddrBaseMean(0),
108 fHistDistrSumIROC(0),
109 fHistDistrMaxIROC(0),
110 fHistDistrSumOROC(0),
111 fHistDistrMaxOROC(0),
112 fHistDistrBase2dIROC(0),
113 fHistDistrBase2dOROC(0),
114 fHistDistrBaseRmsIROC(0),
115 fHistDistrBaseMeanIROC(0),
116 fHistDistrBaseRmsOROC(0),
117 fHistDistrBaseMeanOROC(0),
120 fHistList(new TObjArray()),
147 fMapEqidsSec(new Int_t*[36]),
148 fMapEqidsRcu(new Int_t[1000]),
156 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[GetTimeBins()];}
157 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];}
158 for(Int_t i = 0; i<36; i++) { fMapEqidsSec[i] = new Int_t[6];}
162 if (!gDirectory->GetList())
164 Warning("Build","Current directory is not a valid directory");
167 AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(GetName());
170 Warning("Build","Replacing existing histogram: %s (Potential memory leak).",GetName());
171 gDirectory->GetList()->Remove(hold);
173 gDirectory->Append(this);
180 //____________________________________________________________________________
181 AliTPCMonitor::AliTPCMonitor(const AliTPCMonitor &monitor):
182 AliTPCMonitorConfig(monitor.GetName(),monitor.GetTitle()),
183 fPad(new Int_t*[GetMaxHwAddr()]),
184 fPadMapHw(new Float_t[GetMaxHwAddr()]),
185 fPadMapRCU(new Int_t*[GetMaxHwAddr()]),
201 fHistAddrMapIndex(0),
203 fHistAddrBaseMean(0),
207 fHistDistrSumIROC(0),
208 fHistDistrMaxIROC(0),
209 fHistDistrSumOROC(0),
210 fHistDistrMaxOROC(0),
211 fHistDistrBase2dIROC(0),
212 fHistDistrBase2dOROC(0),
213 fHistDistrBaseRmsIROC(0),
214 fHistDistrBaseMeanIROC(0),
215 fHistDistrBaseRmsOROC(0),
216 fHistDistrBaseMeanOROC(0),
219 fHistList(new TObjArray()),
220 fkNRowsIroc(monitor.fkNRowsIroc),
221 fkNRowsOroc(monitor.fkNRowsOroc),
222 fkNPadsIroc(monitor.fkNPadsIroc),
223 fkNPadsOroc(monitor.fkNPadsOroc),
224 fkNPadMinIroc(monitor.fkNPadMinIroc),
225 fkNPadMinOroc(monitor.fkNPadMinOroc),
226 fkNPadMaxIroc(monitor.fkNPadMaxIroc),
227 fkNPadMaxOroc(monitor.fkNPadMaxOroc),
228 fVerb(monitor.fVerb),
229 fLastEv(monitor.fLastEv),
230 fEventNumber(monitor.fEventNumber),
231 fEventNumberOld(monitor.fEventNumberOld),
232 fDisableFit(monitor.fDisableFit),
233 fExecGlob(monitor.fExecGlob),
234 fExecPlaneMax(monitor.fExecPlaneMax),
235 fExecPadIrocRms(monitor.fExecPadIrocRms),
236 fExecPadOrocRms(monitor.fExecPadOrocRms),
237 fRunId(monitor.fRunId),
238 fEqId(monitor.fEqId),
239 fPadUsedRoc(monitor.fPadUsedRoc),
240 fPadUsedHwAddr(monitor.fPadUsedHwAddr),
241 fGdcId(monitor.fGdcId),
242 fLdcId(monitor.fLdcId),
243 fLdcIdOld(monitor.fLdcIdOld),
244 fMapEqidsSec(new Int_t*[36]),
245 fMapEqidsRcu(new Int_t[1000]),
246 fMirror(monitor.fMirror),
247 fChannelIter(monitor.fChannelIter),
248 fMapHand(monitor.fMapHand),
249 fRawReader(monitor.fRawReader)
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 fRawReader=monitor.fRawReader;
363 fHistList = new TObjArray();
364 fHistIROC=(TH2F*)monitor.fHistIROC->Clone(); fHistList->Add(fHistIROC);
365 fHistOROC=(TH2F*)monitor.fHistOROC->Clone(); fHistList->Add(fHistOROC);
366 fHistIROCIndex=(TH2S*)monitor.fHistIROCIndex->Clone(); fHistList->Add(fHistIROCIndex);
367 fHistOROCIndex=(TH2S*)monitor.fHistOROCIndex->Clone(); fHistList->Add(fHistOROCIndex);
368 fHistIROCTime=(TH2F*)monitor.fHistIROCTime->Clone(); fHistList->Add(fHistIROCTime);
369 fHistOROCTime=(TH2F*)monitor.fHistOROCTime->Clone(); fHistList->Add(fHistOROCTime);
370 fHistIROCClone=(TH2F*)monitor.fHistIROCClone->Clone(); fHistList->Add(fHistIROCClone);
371 fHistOROCClone=(TH2F*)monitor.fHistOROCClone->Clone(); fHistList->Add(fHistOROCClone);
372 fHistIROCRMS=(TH2F*)monitor.fHistIROCRMS->Clone(); fHistList->Add(fHistIROCRMS);
373 fHistOROCRMS=(TH2F*)monitor.fHistOROCRMS->Clone(); fHistList->Add(fHistOROCRMS);
374 fHistIROCBASE=(TH2F*)monitor.fHistIROCBASE->Clone(); fHistList->Add(fHistIROCBASE);
375 fHistOROCBASE=(TH2F*)monitor.fHistOROCBASE->Clone(); fHistList->Add(fHistOROCBASE);
376 fHistIROCSUM=(TH2F*)monitor.fHistIROCSUM->Clone(); fHistList->Add(fHistIROCSUM);
377 fHistOROCSUM=(TH2F*)monitor.fHistOROCSUM->Clone(); fHistList->Add(fHistOROCSUM);
379 fHistChannelTime=(TH2F*)monitor.fHistChannelTime->Clone(); fHistList->Add(fHistChannelTime);
381 fHistAddrMapIndex=(TH1F*)monitor.fHistAddrMapIndex->Clone(); fHistList->Add(fHistAddrMapIndex);
382 fHistAddrMaxAdc=(TH1F*)monitor.fHistAddrMaxAdc->Clone(); fHistList->Add(fHistAddrMaxAdc);
383 fHistAddrBaseMean=(TH1F*)monitor.fHistAddrBaseMean->Clone(); fHistList->Add(fHistAddrBaseMean);
384 fHistAddrMaxAdcX=(TH1F*)monitor.fHistAddrMaxAdcX->Clone(); fHistList->Add(fHistAddrMaxAdcX);
385 fHistAddrAdcSum=(TH1F*)monitor.fHistAddrAdcSum->Clone(); fHistList->Add(fHistAddrAdcSum);
386 fHistAddrBaseRms=(TH1F*)monitor.fHistAddrBaseRms->Clone(); fHistList->Add(fHistAddrBaseRms);
389 fHistDistrSumIROC=(TH1F*)monitor.fHistDistrSumIROC->Clone(); fHistList->Add(fHistDistrSumIROC);
390 fHistDistrMaxIROC=(TH1F*)monitor.fHistDistrMaxIROC->Clone(); fHistList->Add(fHistDistrMaxIROC);
391 fHistDistrSumOROC=(TH1F*)monitor.fHistDistrSumOROC->Clone(); fHistList->Add(fHistDistrSumOROC);
392 fHistDistrMaxOROC=(TH1F*)monitor.fHistDistrMaxOROC->Clone(); fHistList->Add(fHistDistrMaxOROC);
394 fHistDistrBase2dIROC=(TH2F*)monitor.fHistDistrBase2dIROC->Clone(); fHistList->Add(fHistDistrBase2dIROC);
395 fHistDistrBase2dOROC=(TH2F*)monitor.fHistDistrBase2dOROC->Clone(); fHistList->Add(fHistDistrBase2dOROC);
396 fHistDistrBaseRmsIROC=(TH1D*)monitor.fHistDistrBaseRmsIROC->Clone(); fHistList->Add(fHistDistrBaseRmsIROC);
397 fHistDistrBaseMeanIROC=(TH1D*)monitor.fHistDistrBaseMeanIROC->Clone(); fHistList->Add(fHistDistrBaseMeanIROC);
398 fHistDistrBaseRmsOROC=(TH1D*)monitor.fHistDistrBaseRmsOROC->Clone(); fHistList->Add(fHistDistrBaseRmsOROC);
399 fHistDistrBaseMeanOROC=(TH1D*)monitor.fHistDistrBaseMeanOROC->Clone(); fHistList->Add(fHistDistrBaseMeanOROC);
401 fHistGlobalMaxA=(TH2S*)monitor.fHistGlobalMaxA->Clone(); fHistList->Add(fHistGlobalMaxA);
402 fHistGlobalMaxC=(TH2S*)monitor.fHistGlobalMaxC->Clone(); fHistList->Add(fHistGlobalMaxC);
404 fPad = new Int_t*[monitor.GetMaxHwAddr()];
405 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[monitor.GetTimeBins()];}
407 fPadMapRCU = new Int_t*[monitor.GetMaxHwAddr()];
408 for(Int_t i = 0; i<monitor.GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];}
410 fPadMapHw = new Float_t[monitor.GetMaxHwAddr()];
412 fMapEqidsRcu = new Int_t[1000];
413 fMapEqidsSec = new Int_t*[36];
414 for(Int_t i = 0; i<36; i++) { fMapEqidsSec[i] = new Int_t[6];}
419 if (!gDirectory->GetList())
421 Warning("Build","Current directory is not a valid directory");
424 AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(monitor.GetName());
427 Warning("Build","Replacing existing histogram: %s (Potential memory leak).",monitor.GetName());
428 gDirectory->GetList()->Remove(hold);
430 gDirectory->Append(this);
437 //____________________________________________________________________________
438 AliTPCMonitor::~AliTPCMonitor()
442 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { delete[] fPad[i] ;}
443 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { delete[] fPadMapRCU[i];}
448 //____________________________________________________________________________
449 void AliTPCMonitor::CreateHistos()
451 // Create histograms to be displayed
453 if(fVerb) cout << " create new ones " << endl;
454 fHistIROC = new TH2F("fHistIROC" ,"fHistIROC" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROC);
455 fHistOROC = new TH2F("fHistOROC" ,"fHistOROC" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROC);
457 fHistIROCIndex = new TH2S("fHistIROCIndex" ,"fHistIROCIndex" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCIndex);
458 fHistOROCIndex = new TH2S("fHistOROCIndex" ,"fHistOROCIndex" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCIndex);
460 fHistIROCTime = new TH2F("fHistIROCTime" ,"fHistIROCTime" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCTime);
461 fHistOROCTime = new TH2F("fHistOROCTime" ,"fHistOROCTime" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCTime);
463 fHistIROCRMS = new TH2F("fHistIROCRMS" ,"fHistIROCRMS" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCRMS);
464 fHistOROCRMS = new TH2F("fHistOROCRMS" ,"fHistOROCRMS" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCRMS);
466 fHistIROCSUM = new TH2F("fHistIROCSUM" ,"fHistIROCSUM" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCSUM);
467 fHistOROCSUM = new TH2F("fHistOROCSUM" ,"fHistOROCSUM" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCSUM);
469 fHistIROCBASE = new TH2F("fHistIROCBASE" ,"fHistIROCBASE" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROCBASE);
470 fHistOROCBASE = new TH2F("fHistOROCBASE" ,"fHistOROCBASE" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROCBASE);
473 fHistChannelTime = new TH2F("fHistChannelTime" ,"fHistChannelTime" ,GetNumOfChannels(),0,GetNumOfChannels(),GetTimeBins(),0,GetTimeBins());fHistList->Add(fHistChannelTime);
474 fHistAddrMapIndex = new TH1F("fHistAddrMapIndex" ,"fHistAddrMapIndex" ,GetMaxHwAddr() ,0,GetMaxHwAddr()); fHistList->Add(fHistAddrMapIndex);
475 fHistAddrMaxAdc = new TH1F("fHistAddrMaxAdc" ,"fHistAddrMaxAdc" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrMaxAdc);
476 fHistAddrMaxAdcX = new TH1F("fHistAddrMaxAdcX" ,"fHistAddrMaxAdcX" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrMaxAdcX);
477 fHistAddrBaseMean = new TH1F("fHistAddrBaseMean" ,"fHistAddrBaseMean" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrBaseMean);
478 fHistAddrAdcSum = new TH1F("fHistAddrAdcSum" ,"fHistAddrAdcSum" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrAdcSum);
479 fHistAddrBaseRms = new TH1F("fHistAddrBaseRms" ,"fHistAddrBaseRms" ,GetMaxHwAddr(),0,GetMaxHwAddr()); fHistList->Add(fHistAddrBaseRms);
480 fHistDistrSumIROC = new TH1F("fHistDistrSumIROC" ,"fHistDistrSumIROC" ,400,0.0,4000.0); fHistList->Add(fHistDistrSumIROC);
481 fHistDistrMaxIROC = new TH1F("fHistDistrMaxIROC" ,"fHistDistrMaxIROC" ,500,0.0,1000.0); fHistList->Add(fHistDistrMaxIROC);
482 fHistDistrSumOROC = new TH1F("fHistDistrSumOROC" ,"fHistDistrSumOROC" ,400,0.0,4000.0); fHistList->Add(fHistDistrSumOROC);
483 fHistDistrMaxOROC = new TH1F("fHistDistrMaxOROC" ,"fHistDistrMaxOROC" ,500,0.0,1000.0); fHistList->Add(fHistDistrMaxOROC);
485 fHistDistrBase2dIROC = new TH2F("fHistDistrBase2dIROC" ,"fHistDistrBase2dIROC",100,0.0,100.0,100,0.0,10.0); fHistList->Add(fHistDistrBase2dIROC);
486 fHistDistrBase2dOROC = new TH2F("fHistDistrBase2dOROC" ,"fHistDistrBase2dOROC",100,0.0,100.0,100,0.0,10.0); fHistList->Add(fHistDistrBase2dOROC);
488 fHistGlobalMaxA = new TH2S("SIDE A" ,"SIDE A" ,500,-3000,3000,500,-3000,3000); fHistList->Add(fHistGlobalMaxA);
489 fHistGlobalMaxC = new TH2S("SIDE C" ,"SIDE C" ,500,-3000,3000,500,-3000,3000); fHistList->Add(fHistGlobalMaxC);
493 //____________________________________________________________________________
494 Int_t AliTPCMonitor::ProcessEvent()
497 // Depending on the value of the sector id all sectors (sectorid == -1) are processed.
499 // In this case only the maximum values are calculated per pad and filled to the global histograms
500 // In a second loop the last processed(displayed) sector will be processed (sectorid!=-1)
501 // again and the baseline rms and further quantities are calculated
503 // If only one sector should be processed SetProcOneSector(1) should be set.
504 // In this case only the specified (last/last displayed) sector will be processed.
506 // If GetProcNextEvent()==0 the same event will be processed again
510 Int_t retflag = 0; // id of last sector + 1000, or error flag
511 if(GetProcNextEvent()==1 && fLastEv) { AliInfo("Last event already processed"); }
512 if(GetProcNextEvent()==1) ResetSectorArray();
515 if(GetProcNextEvent()==0 || GetProcOneSector()==1 ) sectorid = GetLastSector();
519 retflag = ReadDataNew(sectorid);
521 SetLastProcFile(GetFile());
523 if(retflag>=10 && retflag<1000){ AliError("Could not read event properly: Check file name and format or try next event"); return 0 ;}
528 if(sectorid==-1 && retflag >1000)
530 AliInfo("Second read cycle");
532 if(GetLastSectorDisplayed()==-1) {sectorid = GetLastSector() ; }
533 else {sectorid = GetLastSectorDisplayed(); SetLastSector(sectorid) ; }
534 retflag = ReadDataNew(sectorid);
537 SetLastSectorDisplayed(sectorid) ;
538 fMapHand->ReadfecHwMap(GetLastSector());
541 SetEventProcessed(1);
544 //__________________________________________________________________
545 Int_t AliTPCMonitor::ReadDataNew(Int_t secid)
547 // Read Data File/Stream for specified Format.
548 // Payload will be extracted from either ROOT or DATE format
549 // and passed to FillHistsDecode for decoding of the adc information
552 fRawReader = AliRawReader::Create(GetFile());
553 SetLastProcFile(GetFile());
554 } else if (strcmp(GetLastProcFile(),GetFile())!=0){
556 fRawReader = AliRawReader::Create(GetFile());
557 // printf("New file!!!\n");
558 SetLastProcFile(GetFile());
562 AliWarning("Coult not initialize raw reader");
567 while(skip && GetProcNextEvent())
569 if(fVerb) cout << "AliTPCMonitor::ReadDataNew get event " << endl;
570 if(!fRawReader->NextEvent()) { AliError("Could not get next Event"); return 11 ;}
571 // skip all events but physics, calibration and software trigger events!
572 UInt_t eventType=fRawReader->GetType();
573 if ( !(eventType==AliRawEventHeaderBase::kPhysicsEvent ||
574 eventType==AliRawEventHeaderBase::kCalibrationEvent ||
575 eventType==AliRawEventHeaderBase::kSystemSoftwareTriggerEvent ||
576 eventType==AliRawEventHeaderBase::kDetectorSoftwareTriggerEvent) ) {
577 if (fVerb) cout<< "Skipping event! Its neither of 'physics, calibration and software trigger event'" << endl;
581 //test if the TPC has data
583 fRawReader->Select("TPC");
584 if (!fRawReader->ReadNextData(data)) skip=kTRUE;
585 fEventNumber = fRawReader->GetEventIndex();
586 fEventNumberOld = fRawReader->GetEventIndex();
589 // printf("secid: %d\n",secid);
591 //========================== Histogram filling ======================
593 AliAltroRawStreamV3 *altro=new AliAltroRawStreamV3(fRawReader);
594 altro->SelectRawData("TPC");
599 Int_t nextHwAddress = 0;
607 while ( altro->NextDDL() ){
608 fGdcId = fRawReader->GetGDCId() ;
609 fLdcId = fRawReader->GetLDCId() ;
610 fRunId = fRawReader->GetRunNumber() ;
611 fEqId = fRawReader->GetEquipmentId();
612 rcupatch = GetRCUPatch(fRunId, fEqId);
613 Int_t rcupatchSector=rcupatch%6;
614 lastrcuid = (rcupatch+1000);
615 // printf("RCU patch: %d, LDC: %d, EqId: %d\n",rcupatch, fLdcId, fEqId);
616 if(fLdcIdOld!=fLdcId && fChannelIter!=0) {
619 FillGlobal(GetLastSector());
621 // printf("filled sector: %d\n",GetLastSector());
627 // if (rcupatch/6!=secid) continue;
631 if (!CheckEqId(secid,fEqId)) continue;
632 while ( altro->NextChannel() ){
633 hw=altro->GetHWAddress();
634 nextHwAddress = ( hw + (rcupatchSector<<12) );
635 fPad[fChannelIter][0] = nextHwAddress ;
636 fPadMapHw[nextHwAddress] = fChannelIter ;
638 while ( altro->NextBunch() ){
639 Int_t startTbin = (Int_t)altro->GetStartTimeBin();
640 Int_t bunchlength = (Int_t)altro->GetBunchLength();
641 const UShort_t *sig = altro->GetSignals();
642 for (Int_t iTimeBin = 0; iTimeBin<bunchlength; iTimeBin++){
643 Int_t adc=(Int_t)sig[iTimeBin];
644 Int_t ntime=startTbin-iTimeBin;
645 //fill channel information
646 fPad[fChannelIter][ntime] = adc;
647 if( (adc>maxADC) && (ntime>=GetRangeMaxAdcMin()) && (ntime<GetRangeMaxAdcMax() )) {maxADC = adc;maxx = ntime ;}
648 if( (ntime>=GetRangeSumMin()) && (ntime<GetRangeSumMax() )) {sum+=adc; sumn++;}
652 //get pedestal, noise
653 Float_t pedestal=TMath::Mean(GetRangeBaseMax()-GetRangeBaseMin(),fPad[fChannelIter]+GetRangeBaseMin());
654 Float_t noise =TMath::RMS(GetRangeBaseMax()-GetRangeBaseMin(),fPad[fChannelIter]+GetRangeBaseMin());
655 fHistAddrMaxAdc->SetBinContent(nextHwAddress,maxADC-GetPedestals()*pedestal);
661 fHistDistrBase2dIROC->Fill(pedestal,noise);
662 fHistDistrSumIROC->Fill(sum);
663 fHistDistrMaxIROC->Fill(maxADC-pedestal*GetPedestals());
664 fHistDistrSumIROC->Fill(sum -sumn*pedestal*GetPedestals());
668 fHistDistrBase2dOROC->Fill(pedestal,noise);
669 fHistDistrSumOROC->Fill(sum);
670 fHistDistrMaxOROC->Fill(maxADC-pedestal*GetPedestals());
671 fHistDistrSumOROC->Fill(sum -sumn*pedestal*GetPedestals());
674 fHistAddrAdcSum->SetBinContent( nextHwAddress,sum);
675 fHistAddrMapIndex->SetBinContent(nextHwAddress,fChannelIter);
676 fHistAddrBaseMean->SetBinContent(nextHwAddress,pedestal);
677 fHistAddrMaxAdcX->SetBinContent( nextHwAddress,maxx);
678 fHistAddrBaseRms->SetBinContent( nextHwAddress,noise);
683 SetLastSector(rcupatch/6);
684 if(fChannelIter!=0 && secid==-1 ) SetSectorFilled(rcupatch/6);
688 if(fChannelIter!=0 && secid==-1) { FillGlobal(GetLastSector());}
702 //____________________________________________________________________________
703 void AliTPCMonitor::FillHistsPadPlane()
705 // Fill 2Dim histograms for IROC and OROC (max , rms and sum)
707 if(fVerb)cout << "AliTPCMonitor::FillHistsPadPlane() Start " << endl;
708 if(fVerb)PrintConfig();
715 for(Int_t ch = 0; ch<fChannelIter; ch++)
718 fHistChannelTime->SetCellContent(ch,0,hwadd);
720 for(Int_t bin = 1; bin <GetTimeBins(); bin++)
722 if( fHistChannelTime->GetCellContent(ch,bin)!=0) cout << " cellcontent already set " << endl;
723 if( GetPedestals()==1 ) fHistChannelTime->SetCellContent(ch,bin,(fPad[ch][bin]- fHistAddrBaseMean->GetBinContent(hwadd)));
724 else fHistChannelTime->SetCellContent(ch,bin,(fPad[ch][bin]));
727 pad = fMapHand->GetPad( hwadd);
728 row = fMapHand->GetPadRow(hwadd);
729 padmax = fMapHand->GetNumofPads(row);
733 fHistIROC->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrMaxAdc->GetBinContent( hwadd));
734 fHistIROCIndex->SetCellContent(row +1 ,pad +55 -padmax/2 +1,ch);
735 fHistIROCRMS->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrBaseRms->GetBinContent( hwadd));
736 fHistIROCBASE->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrBaseMean->GetBinContent(hwadd));
737 fHistIROCSUM->SetCellContent( row +1 ,pad +55 -padmax/2 +1,fHistAddrAdcSum->GetBinContent( hwadd));
741 fHistOROC->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrMaxAdc->GetBinContent( hwadd));
742 fHistOROCIndex->SetCellContent(row-63 +1 ,pad +70 -padmax/2 +1,ch);
743 fHistOROCRMS->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrBaseRms->GetBinContent( hwadd));
744 fHistOROCBASE->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrBaseMean->GetBinContent(hwadd));
745 fHistOROCSUM->SetCellContent( row-63 +1 ,pad +70 -padmax/2 +1,fHistAddrAdcSum->GetBinContent( hwadd));
749 fHistChannelTime->GetXaxis()->SetRange(0,fChannelIter);
750 fHistChannelTime->GetYaxis()->SetRange(0,GetTimeBins());
755 //____________________________________________________________________________
756 void AliTPCMonitor::ResetArrays()
759 for(Int_t row = 0 ; row < fkNRowsIroc; row++)
761 for(Int_t pad = 0 ; pad < fkNPadsIroc ; pad++)
763 fHistIROCIndex->SetCellContent(row+1,pad+1,-1);
766 for(Int_t row = 0 ; row < fkNRowsOroc; row++)
768 for(Int_t pad = 0 ; pad < fkNPadsOroc ; pad++)
770 fHistOROCIndex->SetCellContent(row+1,pad+1,-1);
774 for(Int_t ch= 0; ch<GetMaxHwAddr(); ch++)
776 fHistAddrMaxAdcX->SetBinContent(ch,-1);
777 fHistAddrMapIndex->SetBinContent(ch,-1);
778 fHistAddrMaxAdc->SetBinContent( ch, 0);
779 fHistAddrBaseMean->SetBinContent( ch, 0);
780 fHistAddrAdcSum->SetBinContent( ch, 0);
781 fHistAddrBaseRms->SetBinContent(ch, 0);
784 for(Int_t ch = 0; ch< GetNumOfChannels(); ch++)
786 for(Int_t bin = 0; bin< GetTimeBins(); bin++)
791 for(Int_t ch = 0; ch< GetMaxHwAddr(); ch++)
794 fPadMapRCU[ch][0]=-1;
795 fPadMapRCU[ch][1]=-1;
796 fPadMapRCU[ch][2]=-1;
797 fPadMapRCU[ch][3]=-1;
798 fPadMapRCU[ch][4]=-1;
799 fPadMapRCU[ch][5]=-1;
805 //____________________________________________________________________________
806 void AliTPCMonitor::ResetHistos()
809 for(Int_t i =0; i<fHistList->GetEntries(); i++)
811 if(GetProcNextEvent()==0 && strcmp(((TH1*)fHistList->At(i))->GetName(),"SIDE A")==0) continue;
812 if(GetProcNextEvent()==0 && strcmp(((TH1*)fHistList->At(i))->GetName(),"SIDE C")==0) continue;
813 ((TH1*)fHistList->At(i))->Reset();
818 //____________________________________________________________________________
819 void AliTPCMonitor::DeleteHistos()
822 for(Int_t i =0; i<fHistList->GetEntries(); i++)
824 delete (TH1*)fHistList->At(i);
829 //__________________________________________________________________
830 Int_t AliTPCMonitor::CheckEqId(Int_t secid,Int_t eqid)
832 // Check if equipment id corresponds to any rcu patch in sector
833 // Equipment ids changed during commisioning in 2006 (starting from run 704)
834 // However Runids started from 0 again in 2007
835 // Now only runids from commissioning in 2006 after runid 704 and all new ones are supported.
836 // Comment in equipment check for runids < 704 if old runs should be processed
838 if(fVerb) cout << "AliTPCMonitor::CheckEqId : SectorId " << secid << " EquipmentId " << eqid << " runid " << fRunId << endl;
840 //skip all eqids which do not belong to the TPC
841 if ( eqid<768||eqid>983 ) return 0;
843 if(fRunId<704 && 0) // commented out --> runs with runid < 704 in 2006 are not recognized anymore
845 if( (secid>-1) && (secid<36) ) // if ( secid is in range) { take only specific eqids} else { take all }
847 if( (secid==13) && ( eqid!=408 && eqid!=409 && eqid!=509 && eqid!=512 && eqid!=513 && eqid!=517 )) {passed=0;}
848 else if( (secid==4) && ( eqid!=404 && eqid!=504 && eqid!=407 && eqid!=503 && eqid!=508 && eqid!=506 )) {passed=0;}
850 else {if(fVerb) cout << "passed check "<< endl; }
854 if( (secid>-1) && (secid<36) ) // if ( secid is in range) { take only specific eqids} else { take all }
856 if(eqid!=fMapEqidsSec[secid][0] && eqid!= fMapEqidsSec[secid][1] && eqid!=fMapEqidsSec[secid][2] &&
857 eqid!=fMapEqidsSec[secid][3] && eqid!= fMapEqidsSec[secid][4] && eqid!=fMapEqidsSec[secid][5] ) {passed=0;}
859 else {if(fVerb) cout << "passed check "<< endl;}
865 //__________________________________________________________________
866 void AliTPCMonitor::SetEqIds()
868 // Set mapping for equipment ids
869 for(Int_t i = 0; i<36 ; i++)
871 for(Int_t j = 0; j<6; j++)
873 if(j<2) fMapEqidsSec[i][j]= 768+i*2+j;
874 else fMapEqidsSec[i][j]= 840+i*4+j-2;
878 for(Int_t i = 0; i<36 ; i++)
880 for(Int_t j = 0; j<6; j++)
882 if(j<2) fMapEqidsRcu[768+i*2+j] = i*6 +j;
883 else fMapEqidsRcu[840+i*4+j-2] = i*6 +j;
888 //__________________________________________________________________
889 void AliTPCMonitor::FillGlobal(Int_t sector)
892 // Fill global histograms with max adc for each channel
895 if((sector/18) ==0) hglob = fHistGlobalMaxA;
896 else hglob = fHistGlobalMaxC;
898 Float_t rotsec = (2*TMath::Pi()/18.0);
899 Float_t rot = (-rotsec*(sector%18) +4*rotsec);
901 Float_t m11 = TMath::Cos(rot);
902 Float_t m12 = TMath::Sin(rot);
903 Float_t m21 = -1*TMath::Sin(rot);
904 Float_t m22 = TMath::Cos(rot);
906 Int_t max = 0; // use integer for global view
918 for(Int_t hw = 0; hw<fHistAddrMaxAdc->GetNbinsX(); hw++)
920 max = (Int_t)fHistAddrMaxAdc->GetBinContent(hw);
923 pad = fMapHand->GetPad( hw);
924 row = fMapHand->GetPadRow(hw);
925 padmax = fMapHand->GetNumofPads(row);
926 if (sector%36>17) fMirror=-1;
928 GetXY(xval ,yval , padmax,row ,pad);
929 xdr = xval*m11 +yval*m12;
930 ydr = xval*m21 +yval*m22;
931 if(hglob->GetBinContent(hglob->GetXaxis()->FindBin(xdr),hglob->GetYaxis()->FindBin(ydr))==0) hglob->Fill(xdr,ydr,(Int_t)max);
937 //__________________________________________________________________
938 void AliTPCMonitor::GetXY( Double_t& xval , Double_t& yval , Int_t padmax, Int_t row , Int_t pad) const
940 // Get x and y position of pad
944 xval = fMirror*( 2*padmax -4*pad -2);
945 yval = 852.25 +7.5*row;
949 xval = fMirror*( 3*padmax -6*pad -3);
950 if((row-63)<63) { yval = 10*(row-63) +1351; }
951 else { yval = 15*(row-63-64)+1993.5; }
956 //__________________________________________________________________
957 Int_t AliTPCMonitor::GetPadAtX(Float_t xval, Int_t row, Int_t padmax) const
959 // Get pad number at given position in x
962 if(row<63) {pad = (Int_t)( ( (xval/fMirror) +2 -2*padmax)/-4);}
963 else {pad = (Int_t)( ( (xval/fMirror) +3 -3*padmax)/-6);}
965 if(pad>=padmax) return -1;
970 //__________________________________________________________________
971 Int_t AliTPCMonitor::GetPadAtX(Float_t xval, Int_t row) const
974 // Get pad number at given position in x
976 Int_t padmax = fMapHand->GetNumofPads(row);
979 if(row<63) {pad = (Int_t)( ( (xval/fMirror) +2 -2*padmax)/-4);}
980 else {pad = (Int_t)( ( (xval/fMirror) +3 -3*padmax)/-6);}
982 if(pad>=padmax) return -1;
987 //__________________________________________________________________
988 void AliTPCMonitor::DrawHists(Int_t histos)
991 // Draw sets of histograms
992 // histos==1 : 2Dim histos for MAX adc and add executables
993 // histos==2 : distributions max/rms/sum
994 // histos==3 : global max adc for specified SideA/C
997 if(fVerb) cout << " Draw histos " << endl;
999 if(GetLastSector()/18==0 ) sprintf(cside,"A");
1000 else sprintf(cside,"C");
1002 Char_t titleSEC[256]; sprintf(titleSEC ,"Sector %i Side %s Run : %05i EventID %i " ,GetLastSector()%18,cside,fRunId, fEventNumber);
1003 Char_t titleEvent[256]; sprintf(titleEvent ,"Time <-> Channles %s" ,titleSEC);
1004 Char_t titleIROC[256]; sprintf(titleIROC ,"IROC %s" ,titleSEC);
1005 Char_t titleOROC[256]; sprintf(titleOROC ,"OROC %s" ,titleSEC);
1007 Char_t titleMAX[256]; sprintf(titleMAX ,"Max (timebin: %i,%i) %s" ,GetRangeMaxAdcMin(),GetRangeMaxAdcMax(),titleSEC);
1008 Char_t titleSUM[256]; sprintf(titleSUM ,"Sum (timebin: %i,%i) %s" ,GetRangeSumMin() ,GetRangeSumMax() ,titleSEC);
1009 Char_t titleBASE[256]; sprintf(titleBASE ,"Baseline RMS<->Mean (timebin: %i-%i) %s" ,GetRangeBaseMin() ,GetRangeBaseMax() ,titleSEC);
1010 Char_t titleMEAN[256]; sprintf(titleMEAN ,"Baseline Mean (timebin: %i-%i) %s" ,GetRangeBaseMin() ,GetRangeBaseMax() ,titleSEC);
1011 Char_t titleRMS[256] ; sprintf(titleRMS ,"Baseline RMS (timebin: %i-%i) %s" ,GetRangeBaseMin() ,GetRangeBaseMax() ,titleSEC);
1015 // IROC _______________________________________________________________
1017 ciroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("ciroc");
1020 ciroc = CreateCanvas("ciroc");
1025 fHistIROC->SetXTitle("row");
1026 fHistIROC->SetYTitle("pad");
1027 if(GetPedestals()) fHistIROC->SetZTitle("max ADC (baseline sub)");
1028 else fHistIROC->SetZTitle("max ADC ");
1029 fHistIROC->SetTitle(titleIROC);
1030 fHistIROC->SetMinimum(0.01);
1031 fHistIROC->Draw("COLZ");
1032 ciroc->UseCurrentStyle();
1035 fHistIROCTime->SetXTitle("row"); fHistIROCTime->SetZTitle("peak time (fit)"); fHistIROCTime->SetYTitle("pad"); fHistIROCTime->SetTitle(titleIROC);
1036 fHistIROCRMS->SetXTitle("row"); fHistIROCRMS->SetZTitle( "baseline rms (ADC)"); fHistIROCRMS->SetYTitle("pad"); fHistIROCRMS->SetTitle(titleIROC);
1040 coroc =(TCanvas*)gROOT->GetListOfCanvases()->FindObject("coroc");
1042 coroc = CreateCanvas("coroc");
1047 fHistOROC->SetXTitle("row");
1048 fHistOROC->SetYTitle("pad");
1049 if(GetPedestals()) fHistOROC->SetZTitle("max ADC (baseline sub)");
1050 else fHistOROC->SetZTitle("max ADC ");
1051 fHistOROC->SetTitle(titleOROC);
1052 fHistOROC->SetMinimum(0.01);
1053 fHistOROC->Draw("COLZ");
1054 coroc->UseCurrentStyle();
1057 fHistOROCTime->SetXTitle("row"); fHistOROCTime->SetZTitle("peak time (fit) (timebins)"); fHistOROCTime->SetYTitle("pad"); fHistOROCTime->SetTitle(titleOROC);
1058 fHistOROCRMS->SetXTitle("row"); fHistOROCRMS->SetZTitle("baseline rms (ADC)"); fHistOROCRMS->SetYTitle("pad"); fHistOROCRMS->SetTitle(titleOROC);
1061 Char_t namesum[256] ; sprintf(namesum,"ADC sum (bins: %i, %i)",GetRangeSumMin() ,GetRangeSumMax() );
1062 fHistIROCSUM->SetXTitle("row"); fHistIROCSUM->SetZTitle(namesum); fHistIROCSUM->SetYTitle("pad"); fHistIROCSUM->SetTitle(titleIROC);
1063 fHistOROCSUM->SetXTitle("row"); fHistOROCSUM->SetZTitle(namesum); fHistOROCSUM->SetYTitle("pad"); fHistOROCSUM->SetTitle(titleOROC);
1066 Char_t namebase[256] ; sprintf(namebase ,"base mean (timbebin: %i, %i )",GetRangeBaseMin(),GetRangeBaseMax());
1067 fHistIROCBASE->SetXTitle("row"); fHistIROCBASE->SetZTitle(namebase); fHistIROCBASE->SetYTitle("pad"); fHistIROCBASE->SetTitle(titleIROC);
1068 fHistOROCBASE->SetXTitle("row"); fHistOROCBASE->SetZTitle(namebase); fHistOROCBASE->SetYTitle("pad"); fHistOROCBASE->SetTitle(titleOROC);
1070 if(fHistIROCClone) fHistIROCClone->Delete();
1071 if(fHistOROCClone) fHistOROCClone->Delete();
1072 fHistIROCClone = (TH2F*)fHistIROC->Clone("fHistIROCClone");
1073 fHistOROCClone = (TH2F*)fHistOROC->Clone("fHistOROCClone");
1076 if(fExecPlaneMax==0)
1079 sprintf(carry1,".x %s/TPC/AliTPCMonitorExec.C(1)",gSystem->Getenv("ALICE_ROOT"));
1080 ciroc->AddExec("pad",carry1);
1081 coroc->AddExec("pad",carry1);
1084 sprintf(carry2,".x %s/TPC/AliTPCMonitorExec.C(2)",gSystem->Getenv("ALICE_ROOT"));
1085 ciroc->AddExec("row",carry2);
1086 coroc->AddExec("row",carry2);
1094 // MAX ADC distribution ____________________________________________
1096 cmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cmax");
1097 if(!cmax) cmax = CreateCanvas("cmax");
1100 fHistDistrMaxIROC->GetXaxis()->SetRangeUser(0.0,1000.0);
1101 fHistDistrMaxIROC->SetXTitle("max ADC (ADC)");
1102 fHistDistrMaxIROC->SetYTitle("counts");
1103 fHistDistrMaxIROC->SetTitle(titleMAX);
1104 fHistDistrMaxIROC->Draw("");
1105 fHistDistrMaxOROC->SetLineColor(2);
1106 fHistDistrMaxOROC->Draw("same");
1108 if(fHistDistrMaxOROC->GetMaximum()> fHistDistrMaxIROC->GetMaximum()) fHistDistrMaxIROC->SetMaximum(fHistDistrMaxOROC->GetMaximum()*1.1);
1110 TLegend* legio = new TLegend(0.6,0.6,0.8,0.8);
1111 legio->SetFillColor(0);
1112 legio->AddEntry(fHistDistrMaxIROC,"IROC","l");
1113 legio->AddEntry(fHistDistrMaxOROC,"OROC","l");
1114 legio->Draw("same");
1116 // ADC sum distribution
1118 csum = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("csum");
1119 if(!csum) csum = CreateCanvas("csum") ;
1122 fHistDistrSumIROC->SetXTitle("sum ADC (ADC)");
1123 fHistDistrSumIROC->SetYTitle("counts");
1124 fHistDistrSumIROC->SetTitle(titleSUM);
1125 fHistDistrSumIROC->Draw("");
1126 fHistDistrSumOROC->SetLineColor(2);
1127 fHistDistrSumOROC->Draw("same");
1128 if(fHistDistrSumOROC->GetMaximum()> fHistDistrSumIROC->GetMaximum()) fHistDistrSumIROC->SetMaximum(fHistDistrSumOROC->GetMaximum()*1.1);
1129 legio->Draw("same");
1131 // BASELINE MEAN distribution
1132 TCanvas* cbasemean = 0;
1133 cbasemean = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cbasemean");
1134 if(!cbasemean) cbasemean = CreateCanvas("cbasemean");
1137 fHistDistrBaseMeanIROC = fHistDistrBase2dIROC->ProjectionX("fHistDistrBaseMeanIROC");
1138 fHistDistrBaseMeanIROC->SetXTitle("base mean (ADC)");
1139 fHistDistrBaseMeanIROC->SetYTitle("counts");
1140 fHistDistrBaseMeanIROC->SetTitle(titleMEAN);
1141 fHistDistrBaseMeanIROC->Draw("");
1143 fHistDistrBaseMeanOROC = fHistDistrBase2dOROC->ProjectionX("fHistDistrBaseMeanOROC");
1144 fHistDistrBaseMeanOROC->SetLineColor(2);
1145 fHistDistrBaseMeanOROC->Draw("same");
1146 if(fHistDistrBaseMeanOROC->GetMaximum()>fHistDistrBaseMeanIROC->GetMaximum()) fHistDistrBaseMeanIROC->SetMaximum(fHistDistrBaseMeanOROC->GetMaximum()*1.1);
1147 legio->Draw("same");
1149 TCanvas* cbaserms = 0;
1150 cbaserms = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cbaserms");
1151 if(!cbaserms) cbaserms = CreateCanvas("cbaserms") ;
1154 // BASELINE RMS distribution
1155 fHistDistrBaseRmsIROC = fHistDistrBase2dIROC->ProjectionY("fHistDistrBaseRmsIROC");
1156 fHistDistrBaseRmsIROC->SetXTitle("base rms (ADC)");
1157 fHistDistrBaseRmsIROC->SetYTitle("counts");
1158 fHistDistrBaseRmsIROC->SetTitle(titleRMS);
1159 fHistDistrBaseRmsIROC->Draw("");
1161 fHistDistrBaseRmsOROC = fHistDistrBase2dOROC->ProjectionY("fHistDistrBaseRmsOROC");
1162 fHistDistrBaseRmsOROC->SetLineColor(2);
1163 fHistDistrBaseRmsOROC->Draw("same");
1164 if(fHistDistrBaseRmsOROC->GetMaximum()>fHistDistrBaseRmsIROC->GetMaximum()) fHistDistrBaseRmsIROC->SetMaximum(fHistDistrBaseRmsOROC->GetMaximum()*1.1);
1165 legio->Draw("same");
1169 cbasemean->Update();
1174 // GLOBAL MAX ADC _________________________________
1175 if(GetProcNextEvent()==1)
1180 if(!(cglobC=(TCanvas*)gROOT->GetListOfCanvases()->FindObject("SIDE C all"))) cglobC = CreateCanvas("SIDE C all");
1181 if(!(cglobA=(TCanvas*)gROOT->GetListOfCanvases()->FindObject("SIDE A all"))) cglobA = CreateCanvas("SIDE A all");
1183 Char_t globtitle1[256]; sprintf(globtitle1,"SIDE A Run %05i (EventID %i)",fRunId,fEventNumber);
1184 Char_t globtitle2[256]; sprintf(globtitle2,"SIDE C Run %05i (EventID %i)",fRunId,fEventNumber);
1186 fHistGlobalMaxA->SetTitle(globtitle1);
1187 fHistGlobalMaxC->SetTitle(globtitle2);
1188 fHistGlobalMaxA->SetXTitle("x/mm");
1189 fHistGlobalMaxA->SetYTitle("y/mm");
1190 fHistGlobalMaxC->SetXTitle("x/mm");
1191 fHistGlobalMaxC->SetYTitle("y/mm");
1193 if(GetPedestals()==0) { fHistGlobalMaxA->SetZTitle("max adc (not baseline sub)"); fHistGlobalMaxC->SetZTitle("max adc (not baseline sub)"); }
1194 else { fHistGlobalMaxA->SetZTitle("max adc "); fHistGlobalMaxC->SetZTitle("max adc "); }
1196 fHistGlobalMaxA->SetMinimum(0.01);
1197 fHistGlobalMaxC->SetMinimum(0.01);
1199 cglobC->cd() ; fHistGlobalMaxC->Draw("COLZ");
1200 cglobA->cd() ; fHistGlobalMaxA->Draw("COLZ");
1203 sprintf(nameom,".x %s/TPC/AliTPCMonitorExec.C(3)",gSystem->Getenv("ALICE_ROOT"));
1207 if(fVerb)cout << " set exec " << nameom << endl;
1208 cglobC->AddExec("glob",nameom);
1209 cglobA->AddExec("glob",nameom);
1214 cglobC->DeleteExec("glob");
1215 cglobA->DeleteExec("glob");
1217 if(fVerb) cout << " set exec " << nameom << endl;
1218 cglobC->AddExec("glob",nameom);
1219 cglobA->AddExec("glob",nameom);
1231 //__________________________________________________________________
1232 void AliTPCMonitor::DrawRMSMap()
1234 // Draw 2Dim rms histos for IROC and OROC
1235 // and set executables for canvases
1237 TCanvas* crmsoroc =0;
1238 TCanvas* crmsiroc =0;
1239 if(!(crmsoroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crmsoroc"))) crmsoroc = CreateCanvas("crmsoroc");
1240 if(!(crmsiroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crmsiroc"))) crmsiroc = CreateCanvas("crmsiroc");
1242 crmsiroc->cd(); fHistIROCRMS->Draw("COLZ");
1243 crmsoroc->cd(); fHistOROCRMS->Draw("COLZ");
1245 Char_t carry1[100]; sprintf(carry1,".x %s/TPC/AliTPCMonitorExec.C(1)",gSystem->Getenv("ALICE_ROOT"));
1246 Char_t carry2[100]; sprintf(carry2,".x %s/TPC/AliTPCMonitorExec.C(2)",gSystem->Getenv("ALICE_ROOT"));
1248 if(fExecPadIrocRms==0)
1250 crmsiroc->AddExec("pad",carry1);
1251 crmsiroc->AddExec("row",carry2);
1255 if(fExecPadOrocRms==0)
1257 crmsoroc->AddExec("pad",carry1);
1258 crmsoroc->AddExec("row",carry2);
1269 //__________________________________________________________________
1270 void AliTPCMonitor::ExecPad()
1273 // Executable for Pad
1274 // Show time profile for channel the mouse is pointing at
1276 Int_t event = gPad->GetEvent();
1277 if (event != 51) return;
1279 TObject *select = gPad->GetSelected();
1281 if(!select->InheritsFrom("TH2")) { return; }
1282 gPad->GetCanvas()->FeedbackMode(kTRUE);
1285 Int_t px = gPad->GetEventX();
1286 Int_t py = gPad->GetEventY();
1287 Float_t upy = gPad->AbsPixeltoY(py);
1288 Float_t upx = gPad->AbsPixeltoX(px);
1289 Float_t y = gPad->PadtoY(upy);
1290 Float_t x = gPad->PadtoX(upx);
1295 // Char_t namehist[50];
1296 Char_t projhist[60];
1297 Char_t namesel[256];
1298 Char_t namecanv[256];
1302 Float_t ybinmin = 0;
1303 Float_t ybinmax = 0;
1305 // Check wich Canvas executed the event
1307 sprintf(namesel,select->GetName());
1308 if(strcmp(namesel,"fHistOROC")==0 || strcmp(namesel,"fHistOROCRMS")==0 || strcmp(namesel,"fHistOROCTime")==0 )
1312 sprintf(projhist,"ProjectionOROC");
1313 sprintf(namecanv,"coroc_ch");
1314 fHistIndex = fHistOROCIndex;
1316 if(strcmp(namesel,"fHistIROC")==0 || strcmp(namesel,"fHistIROCRMS")==0 || strcmp(namesel,"fHistIROCTime")==0 )
1320 sprintf(projhist,"ProjectionIROC");
1321 sprintf(namecanv,"ciroc_ch");
1322 fHistIndex = fHistIROCIndex;
1325 // Check if Canvas already existed and get Ranges from former Prjection histogram
1326 if((cpad=(TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv)))
1329 if(gROOT->Get(projhist))
1332 xbinmin = ((TH1D*)gROOT->Get(projhist))->GetXaxis()->GetFirst();
1333 xbinmax = ((TH1D*)gROOT->Get(projhist))->GetXaxis()->GetLast();
1334 ybinmin = ((TH1D*)gROOT->Get(projhist))->GetMinimum();
1335 ybinmax = ((TH1D*)gROOT->Get(projhist))->GetMaximum();
1336 delete gROOT->Get("legfit");
1337 delete gROOT->Get("fg");
1342 cpad = CreateCanvas(namecanv); cpad->cd();
1346 Int_t testy = fHistIndex->GetYaxis()->FindBin(y);
1347 Int_t testx = fHistIndex->GetXaxis()->FindBin(x);
1348 Int_t binchannel = (Int_t)fHistIndex->GetCellContent(testx,testy);
1349 if(binchannel>30000 || binchannel<0) return;
1351 TH1D *hp=(TH1D*)gROOT->Get(projhist);
1352 if(!hp) hp=new TH1D(projhist,projhist,GetTimeBins(),0,GetTimeBins());//delete gROOT->Get(projhist);
1354 // TH1D *hp = (TH1D*)(((TH1D*)fHistChannelTime->ProjectionY("hp",binchannel,binchannel))->Clone(projhist));
1355 // TH1D *hp = fHistChannelTime->ProjectionY(projhist,binchannel,binchannel);
1357 Int_t nbinsx=fHistChannelTime->GetNbinsX();
1358 for (Int_t itb=0;itb<GetTimeBins();++itb){
1359 hp->GetArray()[itb]=fHistChannelTime->GetArray()[binchannel+itb*(nbinsx+2)];
1364 // Make title and Pave for channel Info
1366 Int_t npadRow , npad , nhw , nmax , hwadd;
1368 hwadd = (Int_t)fHistChannelTime->GetCellContent(binchannel,0);
1369 fPadUsedHwAddr = hwadd;
1371 if(rocid==0)npadRow = fMapHand->GetPadRow(hwadd);
1372 else npadRow = fMapHand->GetPadRow(hwadd)-63;
1373 npad = fMapHand->GetPad(hwadd);
1375 nmax = (Int_t)hp->GetMaximum();
1378 TPaveText* legstat = new TPaveText(0.18,0.65,0.3,0.8,"NDC");
1380 Int_t connector = fMapHand->GetFECconnector(hwadd);
1381 Int_t fecnr = fMapHand->GetFECfromHw(hwadd);
1382 Int_t fecch = fMapHand->GetFECchannel(hwadd);
1383 Int_t altrochip = fMapHand->GetAltro(hwadd);
1384 Int_t altrochannel= (fMapHand->GetAltroChannel(hwadd))%16;
1385 Int_t fecloc = fMapHand->U2fGetFECinRCU(fecnr) ;
1386 Int_t feclocbran = fMapHand->U2fGetFECinBranch(fecnr);
1387 Int_t branch = fMapHand->U2fGetBranch(fecnr);
1390 Short_t fecget = (hwadd & fgkHwMaskFEC) >> 7;
1391 Short_t branchget = (hwadd & fgkHwMaskBranch)>> 11;
1394 Char_t nstat1[100]; Char_t nstat2[100]; Char_t nstat3[100]; Char_t nstat4[100];
1395 Char_t nstat5[100]; Char_t nstat6[100]; Char_t nstat7[100]; Char_t nstat8[100];
1397 sprintf(nstat1,"Branch (map) \t %i (%i) \n",branchget,branch);
1398 sprintf(nstat2,"Fec in patch \t %i \n",fecloc);
1399 sprintf(nstat8,"Fec in branch (map)\t %i (%i)\n",fecget,feclocbran);
1400 sprintf(nstat7,"Connector \t %i \n",connector);
1401 sprintf(nstat3,"Fec No. \t %i \n",fecnr);
1402 sprintf(nstat4,"Fec chan \t %i \n",fecch);
1403 sprintf(nstat5,"Altro chip\t %i \n",altrochip);
1404 sprintf(nstat6,"Altro chan\t %i \n",altrochannel);
1406 legstat->AddText(nstat1); legstat->AddText(nstat2); legstat->AddText(nstat8); legstat->AddText(nstat7);
1407 legstat->AddText(nstat3); legstat->AddText(nstat4); legstat->AddText(nstat5); legstat->AddText(nstat6);
1409 sprintf(title,"Row=%d Pad=%d Hw =%d maxADC =%d count =%d",npadRow,npad,nhw,nmax,binchannel);
1411 // hp->SetName(projhist);
1412 hp->SetTitleSize(0.04);
1413 hp->SetTitle(title);
1414 hp->SetYTitle("ADC");
1415 hp->SetXTitle("Timebin");
1416 hp->GetXaxis()->SetTitleColor(1);
1420 hp->GetXaxis()->SetRange(xbinmin,xbinmax);
1421 hp->SetMinimum(ybinmin);
1422 hp->SetMaximum(ybinmax);
1426 hp->SetMinimum(0.0);
1427 hp->SetMaximum(1000.0);
1434 if(GetPedestals() && fDisableFit==0)
1436 Int_t maxx = (Int_t)fHistAddrMaxAdcX->GetBinContent(hwadd);
1437 Float_t max = (Float_t)fHistAddrMaxAdc->GetBinContent(hwadd);
1438 Float_t base = (Float_t)fHistAddrBaseMean->GetBinContent(hwadd);
1441 if( ((max+base)/base)>1.2)
1443 TF1* fg = new TF1("fg",AliTPCMonitor::Gamma4,maxx-5,maxx+5,4);
1444 fg->SetParName(0,"Normalisation");
1445 fg->SetParName(1,"Minimum");
1446 fg->SetParName(2,"Width");
1447 fg->SetParName(3,"Base");
1448 fg->SetParameter(0,max);
1449 fg->SetParameter(1,maxx-2);
1450 fg->SetParameter(2,1.5);
1451 fg->FixParameter(3,0);
1452 fg->SetLineColor(4);
1453 fg->SetLineWidth(1);
1456 TLegend* legfit = new TLegend(0.6,0.7,0.7,0.8);
1457 legfit->AddEntry("fg","#Gamma 4 fit","l");
1458 legfit->SetFillColor(0);
1459 legfit->SetName("legfit");
1460 legfit->Draw("same");
1464 legstat->SetFillColor(0);
1465 legstat->Draw("same");
1470 //__________________________________________________________________
1471 void AliTPCMonitor::ExecRow()
1474 // Executable for Pad
1475 // Show profile of max adc over given pad row
1476 // and 2dim histo adc(pad-in-row,time bin)
1478 Int_t event = gPad->GetEvent();
1479 if (event != 61) return;
1481 TObject *select = gPad->GetSelected();
1483 if(!select->InheritsFrom("TH2")) { return; }
1486 // Char_t namehist[50];
1488 Char_t rowhistsum[60];
1489 Char_t rowhistmax[60];
1490 Char_t rowhistxmax[60];
1492 sprintf(rowhist, "hrowtime");
1493 sprintf(rowhistxmax ,"hxmax");
1494 sprintf(rowhistmax , "hrowmax");
1497 Int_t px = gPad->GetEventX();
1498 Int_t py = gPad->GetEventY();
1499 Float_t upy = gPad->AbsPixeltoY(py);
1500 Float_t upx = gPad->AbsPixeltoX(px);
1501 Float_t y = gPad->PadtoY(upy);
1502 Float_t x = gPad->PadtoX(upx);
1504 TCanvas*crowtime = 0;
1505 TCanvas*crowmax = 0;
1508 TH2S* fHistIndex = 0;
1510 // ranges from already existing histos
1511 Int_t rowtimexmin = 0;
1512 Int_t rowtimexmax = 0;
1513 Int_t rowtimeymin = 0;
1514 Int_t rowtimeymax = 0;
1515 Float_t rowtimezmin = 0;
1516 Float_t rowtimezmax = 0;
1518 Int_t profrowxmin = 0;
1519 Int_t profrowxmax = 0;
1520 Double_t profrowymin = 0;
1521 Double_t profrowymax = 0;
1523 Int_t profxxmin = 0;
1524 Int_t profxxmax = 0;
1525 Double_t profxymin = 0;
1526 Double_t profxymax = 0;
1532 if( strcmp(select->GetName(),"fHistIROC")==0 || strcmp(select->GetName(),"fHistIROCRMS")==0 ) { fHistIndex = fHistIROCIndex; rocid =1; }
1533 else if(strcmp(select->GetName(),"fHistOROC")==0 || strcmp(select->GetName(),"fHistOROCRMS")==0 ) { fHistIndex = fHistOROCIndex; rocid =2; }
1534 else { cout << " not implemented for this histo " << endl; return; }
1536 gPad->GetCanvas()->FeedbackMode(kTRUE);
1540 // check if canvases exist //
1541 crowtime = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crowtime");
1542 crowmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crowmax");
1543 cxmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cxmax");
1545 if(!crowtime) crowtime = CreateCanvas("crowtime") ;
1546 if(!crowmax) crowmax = CreateCanvas("crowmax") ;
1547 if(!cxmax ) cxmax = CreateCanvas("cxmax") ;
1549 // check ranges of already existing histos
1550 if(gROOT->Get(rowhist))
1552 rowtimexmin = ((TH2F*)gROOT->Get(rowhist))->GetXaxis()->GetFirst();
1553 rowtimexmax = ((TH2F*)gROOT->Get(rowhist))->GetXaxis()->GetLast();
1554 rowtimeymin = ((TH2F*)gROOT->Get(rowhist))->GetYaxis()->GetFirst();
1555 rowtimeymax = ((TH2F*)gROOT->Get(rowhist))->GetYaxis()->GetLast();
1556 rowtimezmin = ((TH2F*)gROOT->Get(rowhist))->GetMinimum();
1557 rowtimezmax = ((TH2F*)gROOT->Get(rowhist))->GetMaximum();
1559 profrowxmin = ((TH1F*)gROOT->Get(rowhistmax))->GetXaxis()->GetFirst();
1560 profrowxmax = ((TH1F*)gROOT->Get(rowhistmax))->GetXaxis()->GetLast();
1561 profrowymin = ((TH1F*)gROOT->Get(rowhistmax))->GetMinimum();
1562 profrowymax = ((TH1F*)gROOT->Get(rowhistmax))->GetMaximum();
1564 profxxmin = ((TH1F*)gROOT->Get(rowhistxmax))->GetXaxis()->GetFirst();
1565 profxxmax = ((TH1F*)gROOT->Get(rowhistxmax))->GetXaxis()->GetLast();
1566 profxymin = ((TH1F*)gROOT->Get(rowhistxmax))->GetMinimum();
1567 profxymax = ((TH1F*)gROOT->Get(rowhistxmax))->GetMaximum();
1571 delete gROOT->Get(rowhist);
1572 delete gROOT->Get(rowhistmax);
1573 delete gROOT->Get(rowhistsum);
1574 delete gROOT->Get("hxmax");
1575 delete gROOT->Get("legrow");
1578 // get channel for xy bin -> getRow -> getNrows -> getHw for each Pad in Row -> get channel for each hw -> make proj
1579 Int_t testy = fHistIndex->GetYaxis()->FindBin(y);
1580 Int_t testx = fHistIndex->GetXaxis()->FindBin(x);
1581 Int_t binchannel = (Int_t)fHistIndex->GetCellContent(testx,testy);
1583 if(binchannel>30000) return;
1584 if(binchannel<=0 ) { crowtime->Update() ; crowmax->Update() ; return ; }
1587 Int_t hwadd = (Int_t)fHistChannelTime->GetCellContent(binchannel,0);
1588 Int_t row = fMapHand->GetPadRow(hwadd);
1589 Int_t pad = fMapHand->GetPad(hwadd) ;
1590 Int_t numofpads = fMapHand->GetNumofPads(row);
1593 TH2F *hrowtime = new TH2F(rowhist , "" ,numofpads,0,numofpads,GetTimeBins(),0.0,GetTimeBins());
1594 TH1F *hrowmax = new TH1F(rowhistmax , "" ,numofpads,0,numofpads);
1595 TH1F *hxmax = new TH1F(rowhistxmax, "" ,159,0,159 );
1597 // Row profile ///////////
1598 if(fVerb) cout << " Number of pads " << numofpads << endl;
1599 for(Int_t padnr = 0; padnr<numofpads;padnr++)
1601 Int_t addrinrow = fMapHand->GetPadAddInRow(row,padnr );
1602 Int_t channel = (Int_t)fHistAddrMapIndex->GetBinContent(addrinrow);
1603 if(channel==-1) continue;
1605 hrowmax->SetBinContent(padnr+1,fHistAddrMaxAdc->GetBinContent(addrinrow));
1606 TH1D *hp = fHistChannelTime->ProjectionY("hp",channel,channel);
1607 for(Int_t time = 0;time<GetTimeBins();time++) {
1609 Float_t val = hp->GetBinContent(time);
1610 hrowtime->SetCellContent(padnr+1,time+1,val);
1614 // X profile /////////////
1615 Double_t xval = 0.0;
1616 Double_t yval = 0.0;
1617 GetXY(xval,yval,numofpads,row,pad);
1621 for(Int_t nrow = 0; nrow<159; nrow++)
1623 padnr = GetPadAtX(xval,nrow);
1626 hw = fMapHand->GetPadAddInRow(nrow,padnr);
1627 if(fPadMapHw[hw]==-1){ continue ; }
1628 else { hxmax->SetBinContent(nrow+1,fHistAddrMaxAdc->GetBinContent(hw)) ; }
1633 Char_t hxtitle[50] ; sprintf(hxtitle,"max adc in pads at x=%5.1f mm",xval);
1634 hxmax->SetTitle(hxtitle);
1635 hxmax->SetXTitle("row");
1636 if(!GetPedestals()) hxmax->SetYTitle("max adc (baseline sub.)");
1637 else hxmax->SetYTitle("max adc ");
1638 hxmax->SetMinimum(0.01);
1643 hxmax->GetXaxis()->SetRange(profxxmin,profxxmax);
1644 hxmax->SetMinimum(profxymin);
1645 hxmax->SetMaximum(profxymax);
1652 Char_t titlemax[256];
1653 if(rocid==1) {sprintf(title,"%s Row=%d",((TH2*)select)->GetTitle(),row) ; sprintf(titlemax,"IROC max/sum Row=%d",row );}
1654 else {sprintf(title,"%s Row=%d",((TH2*)select)->GetTitle(),row-63); sprintf(titlemax,"OROC max/sum Row=%d",row-63);}
1655 if(fVerb) cout << " set name " << endl;
1660 hrowtime->SetTitleSize(0.04);
1661 hrowtime->SetTitle(title);
1662 hrowtime->SetYTitle("timbin");
1663 hrowtime->SetXTitle("pad in row");
1664 hrowtime->SetZTitle("signal (ADC)");
1666 hrowtime->GetXaxis()->SetTitleColor(1);
1667 hrowtime->SetMaximum(1000.0);
1668 hrowtime->SetMinimum(0.0);
1672 hrowtime->GetXaxis()->SetRange(rowtimexmin,rowtimexmax);
1673 hrowtime->GetYaxis()->SetRange(rowtimeymin,rowtimeymax);
1674 hrowtime->SetMinimum(rowtimezmin);
1675 hrowtime->SetMaximum(rowtimezmax);
1678 hrowtime->Draw("COLZ");
1679 crowtime->UseCurrentStyle();
1682 // max and sum /////////////////////////
1685 hrowmax->GetXaxis()->SetRange(profrowxmin,profrowxmax);
1686 hrowmax->SetMinimum(profrowymin);
1687 hrowmax->SetMaximum(profrowymax);
1689 hrowmax->SetTitleSize(0.04);
1690 hrowmax->SetTitle(title);
1691 hrowmax->SetYTitle("max adc");
1692 hrowmax->SetXTitle("pad in row");
1693 hrowmax->GetXaxis()->SetTitleColor(1);
1695 hrowmax->SetLineColor(2);
1702 //__________________________________________________________________
1703 void AliTPCMonitor::Write10bitChannel()
1706 // Write 10 bit words form histogram for active(last pointed) channel
1708 if(fPadUsedHwAddr==-1){ AliWarning(" No active pad "); return ;}
1710 Int_t pad = (Int_t)fMapHand->GetPad( fPadUsedHwAddr);
1711 Int_t row = (Int_t)fMapHand->GetPadRow(fPadUsedHwAddr);
1712 Int_t channel = (Int_t)fPadMapHw[fPadUsedHwAddr];
1714 Char_t filenameroot[256];
1715 Char_t filenamedat[256];
1716 Char_t projhist[256];
1718 if(fPadUsedRoc==1) { sprintf(projhist,"ProjectionOROC"); }
1719 if(fPadUsedRoc==0) { sprintf(projhist,"ProjectionIROC"); }
1721 sprintf(filenamedat, "Channel_Run%05i_EventID_%i_Pad_%i_Row_%i.dat" ,fRunId,fEventNumber,pad,row);
1722 sprintf(filenameroot,"Channel_Run%05i_EventID_%i_Pad_%i_Row_%i.root" ,fRunId,fEventNumber,pad,row);
1725 if((hpr=(TH1D*)gROOT->Get(projhist)))
1728 TFile f(filenameroot,"recreate");
1733 ofstream datout(filenamedat,ios::out);
1734 datout <<"Timebin \t ADC value " << endl;
1735 for(Int_t i = 1; i <GetTimeBins(); i++)
1737 datout << i << " \t \t " << fPad[channel][i] << endl;
1743 AliWarning("No projection histo found ");
1747 //__________________________________________________________________
1748 void AliTPCMonitor::ExecTransform()
1751 // Make Fast Fourier Transformation for active pad
1752 // fft is only performed for a data sample of size 2^n
1753 // reduce window according to largest power of 2 which is smaller than the viewing range
1755 Char_t namecanv[256];
1756 Char_t namecanv2[256];
1757 Char_t projhist[256];
1758 Char_t namehtrimag[256];
1759 Char_t namehtrreal[256];
1760 Char_t namehtrmag[256];
1762 if(fPadUsedRoc==1) { sprintf(namecanv,"coroc_ch_trans") ; sprintf(namecanv2,"coroc_ch_trans2") ; sprintf(projhist,"ProjectionOROC"); }
1763 if(fPadUsedRoc==0) { sprintf(namecanv,"ciroc_ch_trans") ; sprintf(namecanv2,"ciroc_ch_trans2") ; sprintf(projhist,"ProjectionIROC"); }
1767 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 ;}
1768 else hproj = (TH1D*)gROOT->Get(projhist) ;
1771 if(fPadUsedRoc==1) { sprintf(namehtrimag,"htransimagfreq_oroc"); sprintf(namehtrreal,"htransrealfreq_oroc"); sprintf(namehtrmag,"htransmagfreq_oroc"); }
1772 else { sprintf(namehtrimag,"htransimagfreq_iroc"); sprintf(namehtrreal,"htransrealfreq_iroc"); sprintf(namehtrmag,"htransmagfreq_iroc"); }
1774 if( gROOT->Get(namehtrimag)) delete gROOT->Get(namehtrimag);
1775 if( gROOT->Get(namehtrreal)) delete gROOT->Get(namehtrreal);
1776 if( gROOT->Get(namehtrmag)) delete gROOT->Get(namehtrmag);
1778 TCanvas *ctrans = 0;
1779 if(!(ctrans = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv)))
1781 ctrans = CreateCanvas(namecanv);
1782 ctrans->Divide(1,2);
1784 TCanvas *ctrans2 = 0;
1785 if(!(ctrans2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv2)))
1787 ctrans2 = CreateCanvas(namecanv2);
1788 // ctrans2->Divide(1,2);
1791 Int_t binfirst = hproj->GetXaxis()->GetFirst();
1792 Int_t binlast = hproj->GetXaxis()->GetLast();
1793 Int_t bins = binlast -binfirst +1;
1796 for(Int_t pot = 0; pot<=10 ; pot++)
1798 Int_t comp = (Int_t)TMath::Power(2,pot);
1799 if(bins>=comp)power = pot;
1802 bins = (Int_t)TMath::Power(2,power);
1804 // sampling frequency ;
1805 Double_t deltat = 1.0/(Float_t)GetSamplingFrequency();
1808 TH1D* htransrealfreq = new TH1D(namehtrreal,namehtrreal,10000,-1/(2*deltat),1/(2*deltat));
1809 TH1D* htransimagfreq = new TH1D(namehtrimag,namehtrimag,10000,-1/(2*deltat),1/(2*deltat));
1810 TH1D* htransmag = new TH1D(namehtrmag,namehtrmag,10000,-1/(2*deltat),1/(2*deltat));
1812 Char_t titlereal[256];
1813 Char_t titleimag[256];
1814 Char_t titlemag[256];
1815 if(fPadUsedRoc==1) { sprintf(titlereal,"OROC DFT real part"); sprintf(titleimag,"OROC DFT imag part"); sprintf(titlemag,"OROC DFT magnitude"); }
1816 else { sprintf(titlereal,"IROC DFT real part"); sprintf(titleimag,"IROC DFT imag part"); sprintf(titlemag,"IROC DFT magnitude"); }
1818 htransrealfreq->SetTitle(titlereal); htransrealfreq->SetXTitle("f/hz"); htransrealfreq->SetYTitle("z_{real}(f)");
1819 htransimagfreq->SetTitle(titleimag); htransimagfreq->SetXTitle("f/hz"); htransimagfreq->SetYTitle("z_{imag}(f)");
1820 htransmag->SetTitle(titlemag); htransmag->SetXTitle("f/hz"); htransmag->SetYTitle("mag(f)");
1822 // create complex packed data array
1823 const Int_t kdatasiz = 2*bins;
1824 Double_t* data = new Double_t[kdatasiz];
1825 for(Int_t i=0;i<2*bins;i++) { data[i] = 0.0;}
1826 for(Int_t i=0;i<bins;i++) { data[2*i] = (Double_t)hproj->GetBinContent(binfirst+i); }
1828 // make fourier transformation
1829 AliTPCMonitorFFT* four = new AliTPCMonitorFFT();
1830 four->ComplexRadix2ForwardWrap(data,1,bins);
1832 // write output and fill histos forward
1833 Double_t freq = 0.0;
1834 for(Int_t i=0;i<2*bins;i++)
1838 if(i<(bins/2)) { freq = i/(bins*deltat) ; }
1839 else { freq = -1*((bins-i)/(bins*deltat)); }
1840 htransrealfreq->Fill( freq,data[2*i] );
1841 htransimagfreq->Fill( freq,data[2*i+1]);
1842 htransmag->Fill( freq, TMath::Sqrt(data[2*i]*data[2*i]+data[2*i+1]*data[2*i+1]) );
1847 htransrealfreq->Draw();
1849 htransimagfreq->Draw();
1858 //__________________________________________________________________
1859 void AliTPCMonitor::ShowSel(Int_t* compval)
1862 // Show only selected components
1863 // First restore original histogram from clone
1864 // Than remove all not matching pads form histos
1866 Int_t connector = 0;
1868 Int_t altrochip = 0;
1869 Int_t feclocbran = 0;
1876 Float_t maxiroc = fHistIROCClone->GetMaximum();
1877 Float_t maxoroc = fHistOROCClone->GetMaximum();
1880 // restore original histos
1881 for(Int_t row = 0; row<fkNRowsIroc; row++)
1883 for(Int_t pad = 0; pad<fkNPadsIroc; pad++)
1885 index = (Int_t)fHistIROCIndex->GetCellContent(row+1,pad+1);
1886 if(index==-1)continue;
1887 else fHistIROC->SetCellContent(row+1,pad+1,fHistIROCClone->GetCellContent(row+1,pad+1));
1890 for(Int_t row = 0; row<fkNRowsOroc; row++)
1892 for(Int_t pad = 0; pad<fkNPadsOroc; pad++)
1894 index = (Int_t)fHistOROCIndex->GetCellContent(row+1,pad+1);
1895 if(index==-1)continue;
1896 else fHistOROC->SetCellContent(row+1,pad+1,fHistOROCClone->GetCellContent(row+1,pad+1));
1901 // remove not matching entries from fHistIROC/fHistOROC
1904 TH2S* fHistIndex =0;
1908 for(Int_t row = 0; row< (fkNRowsIroc + fkNRowsOroc); row++)
1910 if(row<fkNRowsIroc) { fHist=fHistIROC ; fHistIndex = fHistIROCIndex; npads = fkNPadsIroc; subrows =0 ;}
1911 else { fHist=fHistOROC ; fHistIndex = fHistOROCIndex; npads = fkNPadsOroc; subrows =fkNRowsIroc;}
1913 for(Int_t pad = 0; pad<npads; pad++)
1915 index = (Int_t)fHistIndex->GetCellContent(row -subrows +1,pad+1);
1916 if(index==-1) continue ;
1917 hwadd = (Int_t)fHistChannelTime->GetCellContent(index,0);
1920 fecnr = fMapHand->GetFECfromHw(hwadd);
1921 if(compval[0]!=-1 && fecnr!=compval[0]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1924 rcuget = (hwadd & fgkHwMaskRCU)>> 12;
1925 if(compval[1]!=-1 && rcuget!=compval[1]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1928 branch = fMapHand->U2fGetBranch(fecnr) ;
1929 if(compval[2]!=-1 && branch!=compval[2]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1932 feclocbran= fMapHand->U2fGetFECinBranch(fecnr) ;
1933 if(compval[3]!=-1 && feclocbran!=compval[3]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1936 connector = fMapHand->GetFECconnector(hwadd);
1937 if(compval[4]!=-1 && connector!=compval[4]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1940 altrochip = fMapHand->GetAltro(hwadd);
1941 if(compval[5]!=-1 && altrochip!=compval[5]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1948 if(gROOT->GetListOfCanvases()->FindObject("ciroc"))
1950 c1 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("ciroc");
1952 fHistIROC->Draw("COLZ");
1953 fHistIROC->SetMaximum(maxiroc);
1954 fHistIROC->SetMinimum(0.0);
1957 if(gROOT->GetListOfCanvases()->FindObject("coroc"))
1959 c2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("coroc");
1961 fHistOROC->Draw("COLZ");
1962 fHistOROC->SetMaximum(maxoroc);
1963 fHistOROC->SetMinimum(0.0);
1969 //__________________________________________________________________
1970 void AliTPCMonitor::ResizeCanv()
1972 // Resize canvases and delete some of them
1975 sprintf(carry1,".x %s/TPC/AliTPCMonitorExec.C(1)",gSystem->Getenv("ALICE_ROOT"));
1977 sprintf(carry3,".x %s/TPC/AliTPCMonitorExec.C(2)",gSystem->Getenv("ALICE_ROOT"));
1978 if(fVerb) cout << " canv 1 " << endl;
1980 if(gROOT->GetListOfCanvases()->FindObject( "coroc_ch")) { delete gROOT->GetListOfCanvases()->FindObject("coroc_ch") ; }
1981 if(gROOT->GetListOfCanvases()->FindObject( "ciroc_ch")) { delete gROOT->GetListOfCanvases()->FindObject("ciroc_ch") ; }
1983 // for 2dim plots delete create and draw again
1984 if(gROOT->GetListOfCanvases()->FindObject("ciroc"))
1986 delete gROOT->GetListOfCanvases()->FindObject("ciroc");
1987 TCanvas* ciroc = CreateCanvas("ciroc");
1989 fHistIROC->Draw("COLZ");
1990 ciroc->AddExec("pad",carry1);
1991 ciroc->AddExec("row",carry3);
1995 // for 2dim plots delete create and draw again
1996 if(gROOT->GetListOfCanvases()->FindObject("coroc"))
1998 delete gROOT->GetListOfCanvases()->FindObject("coroc");
1999 TCanvas* coroc = CreateCanvas("coroc");
2001 fHistOROC->Draw("COLZ");
2003 coroc->AddExec("pad",carry1);
2004 coroc->AddExec("row",carry3);
2009 if(gROOT->GetListOfCanvases()->FindObject( "cbasemean")) { delete gROOT->GetListOfCanvases()->FindObject("cbasemean"); }
2010 if(gROOT->GetListOfCanvases()->FindObject( "cbase")) { delete gROOT->GetListOfCanvases()->FindObject("cbase");}
2011 if(gROOT->GetListOfCanvases()->FindObject( "cbaserms")) { delete gROOT->GetListOfCanvases()->FindObject("cbaserms"); }
2012 if(gROOT->GetListOfCanvases()->FindObject( "cmax")) { delete gROOT->GetListOfCanvases()->FindObject("cmax"); }
2013 if(gROOT->GetListOfCanvases()->FindObject( "csum")) { delete gROOT->GetListOfCanvases()->FindObject("csum"); }
2014 if(gROOT->GetListOfCanvases()->FindObject( "ciroc_ch_trans")) { delete gROOT->GetListOfCanvases()->FindObject("ciroc_ch_trans");}
2015 if(gROOT->GetListOfCanvases()->FindObject( "coroc_ch_trans")) { delete gROOT->GetListOfCanvases()->FindObject("coroc_ch_trans");}
2016 if(gROOT->GetListOfCanvases()->FindObject( "crowtime")) { delete gROOT->GetListOfCanvases()->FindObject("crowtime"); }
2017 if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); }
2018 if(gROOT->GetListOfCanvases()->FindObject( "cxmax")) { delete gROOT->GetListOfCanvases()->FindObject("cxmax"); }
2019 if(gROOT->GetListOfCanvases()->FindObject( "crmsoroc")) { delete gROOT->GetListOfCanvases()->FindObject("crmsoroc"); fExecPadOrocRms = 0; }
2020 if(gROOT->GetListOfCanvases()->FindObject( "crmsiroc")) { delete gROOT->GetListOfCanvases()->FindObject("crmsiroc"); fExecPadIrocRms = 0; }
2021 if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); }
2022 if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); }
2029 //__________________________________________________________________
2030 Int_t AliTPCMonitor::ExecProcess()
2032 // Executable for global Histogram
2033 // Will be called from /TPC/AliTPCMonitorExec.C(3)
2034 // Call ProcessEvent for same event and sector pointed at
2039 Int_t event = gPad->GetEvent();
2040 if(event != 61) return -1;
2042 TObject *select = gPad->GetSelected();
2043 if(!select) return -1;
2044 if(!select->InheritsFrom("TH2")) {gPad->SetUniqueID(0); return -1; }
2045 if( strcmp(select->GetName(),"hglobal" )==0 || ( strcmp(select->GetName(),"SIDE A" )==0) ) side = 0;
2046 else if( strcmp(select->GetName(),"hglobal2")==0 || ( strcmp(select->GetName(),"SIDE C" )==0) ) side = 1;
2049 Int_t px = gPad->GetEventX();
2050 Int_t py = gPad->GetEventY();
2051 Float_t upy = gPad->AbsPixeltoY(py);
2052 Float_t upx = gPad->AbsPixeltoX(px);
2053 Float_t y = gPad->PadtoY(upy);
2054 Float_t x = gPad->PadtoX(upx);
2056 Int_t testy = ((TH2*)select)->GetYaxis()->FindBin(y);
2057 Int_t testx = ((TH2*)select)->GetXaxis()->FindBin(x);
2058 if(((TH2*)select)->GetCellContent(testx,testy)==0) return -1 ;
2060 Float_t alpha = 0.0;
2061 if(x>0.0 && y > 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(x/y)));
2062 if(x>0.0 && y < 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(y/x)));
2063 if(x<0.0 && y < 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(x/y)));
2064 if(x<0.0 && y > 0.0) alpha = TMath::Abs(TMath::ATan(TMath::Abs(y/x)));
2066 if(x>0.0 && y < 0.0) alpha += ( TMath::Pi()/2);
2067 if(x<0.0 && y < 0.0) alpha += ( TMath::Pi());
2068 if(x<0.0 && y > 0.0) alpha += (1.5*TMath::Pi());
2070 sector = (Int_t)(alpha/(2*TMath::Pi()/18.0));
2071 if(alpha> (sector+0.5)*(2*TMath::Pi()/18.0)) sector+=1;
2073 if(sector==18 && side ==0 ) {
2074 AliWarning("There was a wromg assignment of sector 0 with sector 18. Check sectors");
2078 sector = (18-sector +4)%18;
2079 SetLastSector(sector+ side*18);
2080 SetProcNextEvent(0);
2082 if(fVerb) cout << "AliTPCMonitor::ExecProcess() next side " << side << " next sector " << sector << endl;
2084 return (Int_t)ProcessEvent();
2088 //__________________________________________________________________
2089 Int_t AliTPCMonitor::GetRCUPatch(Int_t runid, Int_t eqid) const
2092 // Return RCU patch index for given equipment id eqid
2095 if ( eqid<768 || eqid>983 ) return 0; //no TPC eqid
2098 if(eqid>=1000) return 0;
2099 patch = fMapEqidsRcu[eqid] ;
2103 if(eqid==408) {patch = 13*6+4 +0; }
2104 if(eqid==409) {patch = 13*6+5 +0; }
2105 if(eqid==509) {patch = 13*6+0 +0; }
2106 if(eqid==512) {patch = 13*6+3 +0; }
2107 if(eqid==513) {patch = 13*6+1 +0; }
2108 if(eqid==517) {patch = 13*6+2 +0; }
2110 if(eqid==404) {patch = 4*6+5 +0; }
2111 if(eqid==504) {patch = 4*6+4 +0; }
2112 if(eqid==407) {patch = 4*6+3 +0; }
2113 if(eqid==503) {patch = 4*6+2 +0; }
2114 if(eqid==508) {patch = 4*6+1 +0; }
2115 if(eqid==506) {patch = 4*6+0 +0; }
2120 //__________________________________________________________________
2121 void AliTPCMonitor::DumpHeader(AliRawReader * reader) const
2123 // Dump Event header for format
2125 cout << "EventHeader : fReader->GetEquipmentSize() :" << reader->GetEquipmentSize() << endl;
2126 cout << "EventHeader : fReader->GetType() :" << reader->GetType() << endl;
2127 cout << "EventHeader : fReader->GetRunNumber() :" << reader->GetRunNumber() << endl;
2128 cout << "EventHeader : fReader->GetEventId() :" << *(reader->GetEventId()) << endl;
2129 cout << "EventHeader : fReader->GetLDCId() :" << reader->GetLDCId() << endl;
2130 cout << "EventHeader : fReader->GetGDCId() :" << reader->GetGDCId() << endl;
2134 //__________________________________________________________________
2135 Double_t AliTPCMonitor::Gamma4(Double_t* x, Double_t* par) {
2137 // Gamma4 function used to fit signals
2138 // Defined in sections: diverging branch set to 0
2142 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];
2148 //__________________________________________________________________
2149 TCanvas* AliTPCMonitor::CreateCanvas(const Char_t* name)
2155 Int_t xoffset = GetCanvasXOffset();
2156 Int_t xsize = GetCanvasXSize();
2157 Int_t ysize = GetCanvasYSize();
2158 Int_t xspace = GetCanvasXSpace();
2159 Int_t yspace = GetCanvasYSpace();
2161 // ROC 2dim max distribution
2162 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; }
2163 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; }
2164 // ROC 2dim rms distribution
2165 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; }
2166 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; }
2167 // Global ADC max Histos
2168 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; }
2169 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; }
2170 // 1 dim max sum basekine distribution
2171 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; }
2172 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; }
2173 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; }
2174 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; }
2175 // Projections of single channel
2176 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; }
2177 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; }
2178 // FFT for single channel
2179 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; }
2180 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; }
2181 else if(strcmp(name,"coroc_ch_trans2")==0) { 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; }
2182 else if(strcmp(name,"ciroc_ch_trans2")==0) { 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; }
2183 // row profile histograms
2184 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; }
2185 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; }
2186 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; }
2187 else { cout << " Warning Canvas name unknown " << endl; return 0 ; }
2190 //__________________________________________________________________
2191 void AliTPCMonitor::WriteHistos()
2193 // Writes all available histograms to a file in current directory
2194 // File name will be specified by : sector, side, runid and eventnumber
2196 if(GetEventProcessed())
2198 AliInfo("Write histos to file");
2200 sprintf(name,"SIDE_%i_SECTOR_%02i_RUN_%05i_EventID_%06i.root",(GetLastSector()/18),(GetLastSector()%18),fRunId,fEventNumber);
2201 TFile* f = new TFile(name,"recreate");
2202 for(Int_t i =0; i<fHistList->GetEntries(); i++)
2204 if(((TH1*)fHistList->At(i))!=0)
2206 ((TH1*)fHistList->At(i))->Write();
2214 AliError("No Event Processed : Chose Format , File and push 'Next Event' ");
2219 //__________________________________________________________________
2220 TH1* AliTPCMonitor::GetHisto(char* histname)
2223 // Returns histogram specified by histname
2224 // check available names for histos in CreateHistos()
2227 if((TH1*)fHistList->FindObject(histname))
2229 hist = (TH1*)fHistList->FindObject(histname);
2233 cout << " AliTPCMonitor::GetHisto :: Can not find histo with name " << histname << endl;