suppress off-line finders ( vertex etc.)
[u/mrichter/AliRoot.git] / TPC / AliTPCMonitor.cxx
CommitLineData
48265b32 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
5312f439 9 * without fee, provided that the above copyright notice appears in all *
48265b32 10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17$Log$
fb3305d1 18Revision 1.3 2007/10/12 13:36:27 cvetan
19Coding convention fixes from Stefan
20
ca7b8371 21Revision 1.2 2007/09/18 09:44:45 cvetan
22Sorting out some issues concerning the compilation with and without DATE support
23
1954d2d0 24Revision 1.1 2007/09/17 10:23:31 cvetan
25New TPC monitoring package from Stefan Kniege. The monitoring package can be started by running TPCMonitor.C macro located in macros folder.
26
48265b32 27*/
28
ca7b8371 29////////////////////////////////////////////////////////////////////////
fb3305d1 30////
31//// AliTPCMonitor class
32////
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
36////
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.
41////
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.
44////
45//// Author: Stefan Kniege, IKF, Frankfurt
46////
47////
ca7b8371 48/////////////////////////////////////////////////////////////////////////
49
5312f439 50
ca7b8371 51
52#include "AliLog.h"
53#include "AliTPCMonitor.h"
54#include "AliTPCMonitorMappingHandler.h"
ca7b8371 55#include "AliTPCMonitorFFT.h"
ca7b8371 56#include "AliRawReader.h"
949d8707 57#include "AliRawReaderRoot.h"
ac940b58 58#include "AliRawEventHeaderBase.h"
5312f439 59#include "AliAltroRawStreamV3.h"
ca7b8371 60#include "TH2F.h"
61#include "TF1.h"
62#include "TMath.h"
63#include "TCanvas.h"
64#include "TH3S.h"
65#include "TLegend.h"
66#include "TROOT.h"
67#include "TDirectory.h"
68#include "TSystem.h"
5dbad769 69#include "TString.h"
ca7b8371 70#include "TPaveText.h"
71#include "TFile.h"
72#include <Riostream.h>
ca7b8371 73
48265b32 74ClassImp(AliTPCMonitor)
75
5312f439 76const Int_t AliTPCMonitor::fgkHwMaskFEC = 0x0780;
77const Int_t AliTPCMonitor::fgkHwMaskBranch = 0x0800;
78const Int_t AliTPCMonitor::fgkHwMaskFECChannel = 0x007f;
79const Int_t AliTPCMonitor::fgkHwMaskAltroChannel = 0x000f;
80const Int_t AliTPCMonitor::fgkHwMaskAltroChip = 0x0070;
81const Int_t AliTPCMonitor::fgkHwMaskRCU = 0x7000;
82
48265b32 83//____________________________________________________________________________
ca7b8371 84AliTPCMonitor::AliTPCMonitor(char* name, char* title) :
5312f439 85AliTPCMonitorConfig(name,title),
86fPad(new Int_t*[GetMaxHwAddr()]),
87fPadMapHw(new Float_t[GetMaxHwAddr()]),
88fPadMapRCU(new Int_t*[GetMaxHwAddr()]),
89fHistIROC(0),
90fHistOROC(0),
91fHistIROCIndex(0),
92fHistOROCIndex(0),
93fHistIROCTime(0),
94fHistOROCTime(0),
95fHistIROCClone(0),
96fHistOROCClone(0),
97fHistIROCRMS(0),
98fHistOROCRMS(0),
99fHistIROCBASE(0),
100fHistOROCBASE(0),
101fHistIROCSUM(0),
102fHistOROCSUM(0),
103fHistChannelTime(0),
104fHistAddrMapIndex(0),
105fHistAddrMaxAdc(0),
106fHistAddrBaseMean(0),
107fHistAddrMaxAdcX(0),
108fHistAddrAdcSum(0),
109fHistAddrBaseRms(0),
110fHistDistrSumIROC(0),
111fHistDistrMaxIROC(0),
112fHistDistrSumOROC(0),
113fHistDistrMaxOROC(0),
114fHistDistrBase2dIROC(0),
115fHistDistrBase2dOROC(0),
116fHistDistrBaseRmsIROC(0),
117fHistDistrBaseMeanIROC(0),
118fHistDistrBaseRmsOROC(0),
119fHistDistrBaseMeanOROC(0),
120fHistGlobalMaxA(0),
121fHistGlobalMaxC(0),
122fHistList(new TObjArray()),
123
124fkNRowsIroc(63),
125fkNRowsOroc(96),
126
127fkNPadsIroc(110),
128fkNPadsOroc(140),
129fkNPadMinIroc(-55),
130fkNPadMinOroc(-70),
131fkNPadMaxIroc(55),
132fkNPadMaxOroc(70),
133fVerb(0),
134fLastEv(0),
135fEventNumber(0),
136fEventNumberOld(0),
137fDisableFit(0),
138fExecGlob(0),
139fExecPlaneMax(0),
140fExecPadIrocRms(0),
141fExecPadOrocRms(0),
142fRunId(0),
143fEqId(0),
144fPadUsedRoc(-1),
145fPadUsedHwAddr(-1),
146fGdcId(0),
147fLdcId(0),
148fLdcIdOld(1),
149fMapEqidsSec(new Int_t*[36]),
150fMapEqidsRcu(new Int_t[1000]),
151fMirror(1),
152fChannelIter(0),
153fMapHand(0),
154fRawReader(0)
48265b32 155{
5312f439 156 // Constructor
48265b32 157
48265b32 158 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[GetTimeBins()];}
48265b32 159 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];}
48265b32 160 for(Int_t i = 0; i<36; i++) { fMapEqidsSec[i] = new Int_t[6];}
5312f439 161
162 if (gDirectory)
163 {
164 if (!gDirectory->GetList())
48265b32 165 {
5312f439 166 Warning("Build","Current directory is not a valid directory");
167 return;
168 }
169 AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(GetName());
170 if(hold)
171 {
172 Warning("Build","Replacing existing histogram: %s (Potential memory leak).",GetName());
173 gDirectory->GetList()->Remove(hold);
ca7b8371 174 }
5312f439 175 gDirectory->Append(this);
176 }
ca7b8371 177 CreateHistos();
178 SetEqIds();
5312f439 179
ca7b8371 180}
48265b32 181
ca7b8371 182//____________________________________________________________________________
183AliTPCMonitor::AliTPCMonitor(const AliTPCMonitor &monitor):
5312f439 184AliTPCMonitorConfig(monitor.GetName(),monitor.GetTitle()),
185fPad(new Int_t*[GetMaxHwAddr()]),
186fPadMapHw(new Float_t[GetMaxHwAddr()]),
187fPadMapRCU(new Int_t*[GetMaxHwAddr()]),
188fHistIROC(0),
189fHistOROC(0),
190fHistIROCIndex(0),
191fHistOROCIndex(0),
192fHistIROCTime(0),
193fHistOROCTime(0),
194fHistIROCClone(0),
195fHistOROCClone(0),
196fHistIROCRMS(0),
197fHistOROCRMS(0),
198fHistIROCBASE(0),
199fHistOROCBASE(0),
200fHistIROCSUM(0),
201fHistOROCSUM(0),
202fHistChannelTime(0),
203fHistAddrMapIndex(0),
204fHistAddrMaxAdc(0),
205fHistAddrBaseMean(0),
206fHistAddrMaxAdcX(0),
207fHistAddrAdcSum(0),
208fHistAddrBaseRms(0),
209fHistDistrSumIROC(0),
210fHistDistrMaxIROC(0),
211fHistDistrSumOROC(0),
212fHistDistrMaxOROC(0),
213fHistDistrBase2dIROC(0),
214fHistDistrBase2dOROC(0),
215fHistDistrBaseRmsIROC(0),
216fHistDistrBaseMeanIROC(0),
217fHistDistrBaseRmsOROC(0),
218fHistDistrBaseMeanOROC(0),
219fHistGlobalMaxA(0),
220fHistGlobalMaxC(0),
221fHistList(new TObjArray()),
222fkNRowsIroc(monitor.fkNRowsIroc),
223fkNRowsOroc(monitor.fkNRowsOroc),
224fkNPadsIroc(monitor.fkNPadsIroc),
225fkNPadsOroc(monitor.fkNPadsOroc),
226fkNPadMinIroc(monitor.fkNPadMinIroc),
227fkNPadMinOroc(monitor.fkNPadMinOroc),
228fkNPadMaxIroc(monitor.fkNPadMaxIroc),
229fkNPadMaxOroc(monitor.fkNPadMaxOroc),
230fVerb(monitor.fVerb),
231fLastEv(monitor.fLastEv),
232fEventNumber(monitor.fEventNumber),
233fEventNumberOld(monitor.fEventNumberOld),
234fDisableFit(monitor.fDisableFit),
235fExecGlob(monitor.fExecGlob),
236fExecPlaneMax(monitor.fExecPlaneMax),
237fExecPadIrocRms(monitor.fExecPadIrocRms),
238fExecPadOrocRms(monitor.fExecPadOrocRms),
239fRunId(monitor.fRunId),
240fEqId(monitor.fEqId),
241fPadUsedRoc(monitor.fPadUsedRoc),
242fPadUsedHwAddr(monitor.fPadUsedHwAddr),
243fGdcId(monitor.fGdcId),
244fLdcId(monitor.fLdcId),
245fLdcIdOld(monitor.fLdcIdOld),
246fMapEqidsSec(new Int_t*[36]),
247fMapEqidsRcu(new Int_t[1000]),
248fMirror(monitor.fMirror),
249fChannelIter(monitor.fChannelIter),
250fMapHand(monitor.fMapHand),
251fRawReader(monitor.fRawReader)
ca7b8371 252{
253 // copy constructor
254
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);
269
270 fHistChannelTime=(TH2F*)monitor.fHistChannelTime->Clone(); fHistList->Add(fHistChannelTime);
271
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);
5312f439 278
ca7b8371 279
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);
5312f439 284
ca7b8371 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);
291
292 fHistGlobalMaxA=(TH2S*)monitor.fHistGlobalMaxA->Clone(); fHistList->Add(fHistGlobalMaxA);
293 fHistGlobalMaxC=(TH2S*)monitor.fHistGlobalMaxC->Clone(); fHistList->Add(fHistGlobalMaxC);
294
5312f439 295 // fPad = new Int_t*[monitor.GetMaxHwAddr()];
ca7b8371 296 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[monitor.GetTimeBins()];}
297
5312f439 298 //fPadMapRCU = new Int_t*[monitor.GetMaxHwAddr()];
ca7b8371 299 for(Int_t i = 0; i<monitor.GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];}
300
301 //fPadMapHw = new Float_t[monitor.GetMaxHwAddr()];
302
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];}
48265b32 306 SetEqIds();
ca7b8371 307
5312f439 308 if (gDirectory)
309 {
310 if (!gDirectory->GetList())
ca7b8371 311 {
5312f439 312 Warning("Build","Current directory is not a valid directory");
313
314 }
315 else
316 {
317 AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(monitor.GetName());
318 if(hold)
319 {
320 Warning("Build","Replacing existing histogram: %s (Potential memory leak).",monitor.GetName());
321 gDirectory->GetList()->Remove(hold);
322 }
323 gDirectory->Append(this);
324 }
325 }
ca7b8371 326}
327
328
329//____________________________________________________________________________
48265b32 330
ca7b8371 331AliTPCMonitor &AliTPCMonitor:: operator= (const AliTPCMonitor& monitor)
332{
333 // assigment operator
334 if(this!=&monitor)
5312f439 335 {
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;
345 fVerb=monitor.fVerb;
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;
355 fEqId=monitor.fEqId;
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;
363
364
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);
380
381 fHistChannelTime=(TH2F*)monitor.fHistChannelTime->Clone(); fHistList->Add(fHistChannelTime);
382
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);
389
390
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);
395
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);
402
403 fHistGlobalMaxA=(TH2S*)monitor.fHistGlobalMaxA->Clone(); fHistList->Add(fHistGlobalMaxA);
404 fHistGlobalMaxC=(TH2S*)monitor.fHistGlobalMaxC->Clone(); fHistList->Add(fHistGlobalMaxC);
405
406 fPad = new Int_t*[monitor.GetMaxHwAddr()];
407 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { fPad[i] = new Int_t[monitor.GetTimeBins()];}
408
409 fPadMapRCU = new Int_t*[monitor.GetMaxHwAddr()];
410 for(Int_t i = 0; i<monitor.GetMaxHwAddr(); i++) { fPadMapRCU[i] = new Int_t[6];}
411
412 fPadMapHw = new Float_t[monitor.GetMaxHwAddr()];
413
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];}
417 SetEqIds();
418
419 if (gDirectory)
ca7b8371 420 {
5312f439 421 if (!gDirectory->GetList())
422 {
423 Warning("Build","Current directory is not a valid directory");
424 return *this;
425 }
426 AliTPCMonitor *hold = (AliTPCMonitor*)gDirectory->GetList()->FindObject(monitor.GetName());
427 if(hold)
428 {
429 Warning("Build","Replacing existing histogram: %s (Potential memory leak).",monitor.GetName());
430 gDirectory->GetList()->Remove(hold);
431 }
432 gDirectory->Append(this);
ca7b8371 433 }
5312f439 434 }
ca7b8371 435 return *this;
48265b32 436}
ca7b8371 437
438
48265b32 439//____________________________________________________________________________
440AliTPCMonitor::~AliTPCMonitor()
441{
442 // Destructor
443
444 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { delete[] fPad[i] ;}
445 for(Int_t i = 0; i<GetMaxHwAddr(); i++) { delete[] fPadMapRCU[i];}
446 delete[] fPadMapHw ;
447 DeleteHistos();
448}
449
450//____________________________________________________________________________
451void AliTPCMonitor::CreateHistos()
452{
5312f439 453 // Create histograms to be displayed
454
48265b32 455 if(fVerb) cout << " create new ones " << endl;
ca7b8371 456 fHistIROC = new TH2F("fHistIROC" ,"fHistIROC" ,fkNRowsIroc,0,fkNRowsIroc,fkNPadsIroc, fkNPadMinIroc, fkNPadMaxIroc); fHistList->Add(fHistIROC);
5312f439 457 fHistOROC = new TH2F("fHistOROC" ,"fHistOROC" ,fkNRowsOroc,0,fkNRowsOroc,fkNPadsOroc, fkNPadMinOroc, fkNPadMaxOroc); fHistList->Add(fHistOROC);
458
ca7b8371 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);
5312f439 461
ca7b8371 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);
48265b32 464
ca7b8371 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);
5312f439 467
ca7b8371 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);
5312f439 470
ca7b8371 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);
5312f439 473
474
48265b32 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);
5312f439 486
48265b32 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);
489
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);
492
493 ResetArrays();
494}
495//____________________________________________________________________________
496Int_t AliTPCMonitor::ProcessEvent()
497{
498 // Process Event
499 // Depending on the value of the sector id all sectors (sectorid == -1) are processed.
500 //
501 // In this case only the maximum values are calculated per pad and filled to the global histograms
5312f439 502 // In a second loop the last processed(displayed) sector will be processed (sectorid!=-1)
48265b32 503 // again and the baseline rms and further quantities are calculated
504 //
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.
507 //
508 // If GetProcNextEvent()==0 the same event will be processed again
5312f439 509
510
48265b32 511 Int_t sectorid = 0;
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();
515
516
517 if(GetProcNextEvent()==0 || GetProcOneSector()==1 ) sectorid = GetLastSector();
518 else sectorid = -1;
519
5312f439 520 // first iteration
521 retflag = ReadDataNew(sectorid);
48265b32 522
523 SetLastProcFile(GetFile());
524
525 if(retflag>=10 && retflag<1000){ AliError("Could not read event properly: Check file name and format or try next event"); return 0 ;}
526
527 DrawHists(3);
528
5312f439 529 // second iteration
530 if(sectorid==-1 && retflag >1000)
531 {
532 AliInfo("Second read cycle");
533 SetProcNextEvent(0);
534 if(GetLastSectorDisplayed()==-1) {sectorid = GetLastSector() ; }
535 else {sectorid = GetLastSectorDisplayed(); SetLastSector(sectorid) ; }
536 retflag = ReadDataNew(sectorid);
537 }
48265b32 538
539 SetLastSectorDisplayed(sectorid) ;
540 fMapHand->ReadfecHwMap(GetLastSector());
541 FillHistsPadPlane();
542 DrawHists(1);
543 SetEventProcessed(1);
544 return retflag;
545}
48265b32 546//__________________________________________________________________
5312f439 547Int_t AliTPCMonitor::ReadDataNew(Int_t secid)
48265b32 548{
5312f439 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
552
553 if (!fRawReader){
554 fRawReader = AliRawReader::Create(GetFile());
555 SetLastProcFile(GetFile());
5dbad769 556 } else if (TString(GetLastProcFile())!=GetFile()) {
5312f439 557 delete fRawReader;
558 fRawReader = AliRawReader::Create(GetFile());
559// printf("New file!!!\n");
560 SetLastProcFile(GetFile());
561 }
48265b32 562
5312f439 563 if (!fRawReader){
564 AliWarning("Coult not initialize raw reader");
565 return 11;
566 }
48265b32 567
5312f439 568 Bool_t skip=kTRUE;
569 while(skip && GetProcNextEvent())
ac940b58 570 {
5312f439 571 if(fVerb) cout << "AliTPCMonitor::ReadDataNew get event " << endl;
949d8707 572 if(fRawReader->IsA()==AliRawReaderRoot::Class()){
5dbad769 573 AliInfo(Form("Root, NextEvent: %d\n",GetEventID()));
949d8707 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 ;}
5312f439 576 // skip all events but physics, calibration and software trigger events!
577 UInt_t eventType=fRawReader->GetType();
ac940b58 578 if ( !(eventType==AliRawEventHeaderBase::kPhysicsEvent ||
579 eventType==AliRawEventHeaderBase::kCalibrationEvent ||
580 eventType==AliRawEventHeaderBase::kSystemSoftwareTriggerEvent ||
581 eventType==AliRawEventHeaderBase::kDetectorSoftwareTriggerEvent) ) {
5312f439 582 if (fVerb) cout<< "Skipping event! Its neither of 'physics, calibration and software trigger event'" << endl;
909c8c99 583 if(fRawReader->IsA()==AliRawReaderRoot::Class()){
584 if (fEventNumber<fRawReader->GetNumberOfEvents()-1) ++fEventNumber;
585 else {AliError("No more events");return 11;}
586 }
5312f439 587 continue;
ac940b58 588 }
5312f439 589 skip=kFALSE;
1d32f273 590 //test if the TPC has data
591 UChar_t *data=0;
592 fRawReader->Select("TPC");
909c8c99 593 Int_t eventNr=fRawReader->GetEventIndex();
594 if (!fRawReader->ReadNextData(data)) {
595 skip=kTRUE;
5dbad769 596 AliInfo(Form("%d / %d",fEventNumber,fRawReader->GetNumberOfEvents()));
909c8c99 597 if(fRawReader->IsA()==AliRawReaderRoot::Class()){
598 if (fEventNumber<fRawReader->GetNumberOfEvents()-1){
599 ++eventNr;
5dbad769 600// printf("inc conter\n");
909c8c99 601 }
602 else {
603 AliError("No more events");
604 return 11;
605 }
606 }
607 }
608 fEventNumber = eventNr;
609 fEventNumberOld = eventNr;
ac940b58 610 }
48265b32 611
5dbad769 612 AliInfo(Form("secid: %d",secid));
48265b32 613
5312f439 614 //========================== Histogram filling ======================
615 ResetHistos() ;
616 AliAltroRawStreamV3 *altro=new AliAltroRawStreamV3(fRawReader);
617 altro->SelectRawData("TPC");
618 altro->Reset();
619 fChannelIter=0;
48265b32 620
48265b32 621 Int_t hw = 0;
48265b32 622 Int_t nextHwAddress = 0;
5312f439 623 Int_t rcupatch = 0;
624 Int_t maxADC = 0;
625 Int_t maxx = 0;
626 Int_t sum = 0;
627 Int_t sumn = 0;
628 Int_t lastrcuid = 0;
629
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);
5dbad769 638
639 Int_t currentSector=rcupatch/6;
640
5312f439 641 if(fLdcIdOld!=fLdcId && fChannelIter!=0) {
642 if(secid==-1)
4c6d06dc 643 {
5312f439 644 FillGlobal(GetLastSector());
645 ResetArrays();
5dbad769 646 if (fVerb) printf("filled sector: %d\n",GetLastSector());
5312f439 647 fChannelIter =0;
648 }
5dbad769 649// else
650// {
651// printf("RET: filled sector: %d\n",GetLastSector());
652// return lastrcuid;
5312f439 653// if (rcupatch/6!=secid) continue;
5dbad769 654// }
5312f439 655// fChannelIter=0;
656 }
5dbad769 657
5312f439 658 if (!CheckEqId(secid,fEqId)) continue;
5dbad769 659 if (fVerb) printf("Sector: %d, RCU patch: %d, LDC: %d, EqId: %d\n",currentSector,rcupatch, fLdcId, fEqId);
660
5312f439 661 while ( altro->NextChannel() ){
662 hw=altro->GetHWAddress();
663 nextHwAddress = ( hw + (rcupatchSector<<12) );
664 fPad[fChannelIter][0] = nextHwAddress ;
48265b32 665 fPadMapHw[nextHwAddress] = fChannelIter ;
5312f439 666 maxADC=0;
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++;}
678
679 }
680 }
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);
48265b32 685
686 if(secid!=-1)
5312f439 687 {
688 if(rcupatchSector<2)
689 {
690 fHistDistrBase2dIROC->Fill(pedestal,noise);
691 fHistDistrSumIROC->Fill(sum);
692 fHistDistrMaxIROC->Fill(maxADC-pedestal*GetPedestals());
693 fHistDistrSumIROC->Fill(sum -sumn*pedestal*GetPedestals());
694 }
695 else
696 {
697 fHistDistrBase2dOROC->Fill(pedestal,noise);
698 fHistDistrSumOROC->Fill(sum);
699 fHistDistrMaxOROC->Fill(maxADC-pedestal*GetPedestals());
700 fHistDistrSumOROC->Fill(sum -sumn*pedestal*GetPedestals());
701 }
702
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);
708 }
709
710 ++fChannelIter;
48265b32 711 }
5312f439 712 SetLastSector(rcupatch/6);
713 if(fChannelIter!=0 && secid==-1 ) SetSectorFilled(rcupatch/6);
714 fLdcIdOld = fLdcId ;
715 }
716 delete altro;
717 if(fChannelIter!=0 && secid==-1) { FillGlobal(GetLastSector());}
718 return lastrcuid;
48265b32 719}
720
721
5312f439 722
723
724
725
726
727
728
729
730
48265b32 731//____________________________________________________________________________
732void AliTPCMonitor::FillHistsPadPlane()
733{
734 // Fill 2Dim histograms for IROC and OROC (max , rms and sum)
735
736 if(fVerb)cout << "AliTPCMonitor::FillHistsPadPlane() Start " << endl;
737 if(fVerb)PrintConfig();
5312f439 738
48265b32 739 Int_t pad = 0;
740 Int_t row = 0;
741 Int_t padmax = 0;
742 Int_t hwadd = 0;
743
5312f439 744 for(Int_t ch = 0; ch<fChannelIter; ch++)
745 {
746 hwadd= fPad[ch][0];
747 fHistChannelTime->SetCellContent(ch,0,hwadd);
748
749 for(Int_t bin = 1; bin <GetTimeBins(); bin++)
48265b32 750 {
5312f439 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]));
754 }
755
756 pad = fMapHand->GetPad( hwadd);
757 row = fMapHand->GetPadRow(hwadd);
758 padmax = fMapHand->GetNumofPads(row);
759
760 if(row<63)
761 {
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));
48265b32 767 }
5312f439 768 else
769 {
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));
775 }
776 }
48265b32 777
778 fHistChannelTime->GetXaxis()->SetRange(0,fChannelIter);
779 fHistChannelTime->GetYaxis()->SetRange(0,GetTimeBins());
780}
781
782
783
784//____________________________________________________________________________
785void AliTPCMonitor::ResetArrays()
786{
5312f439 787 // Reset data arrays
788 for(Int_t row = 0 ; row < fkNRowsIroc; row++)
789 {
790 for(Int_t pad = 0 ; pad < fkNPadsIroc ; pad++)
48265b32 791 {
5312f439 792 fHistIROCIndex->SetCellContent(row+1,pad+1,-1);
48265b32 793 }
5312f439 794 }
795 for(Int_t row = 0 ; row < fkNRowsOroc; row++)
796 {
797 for(Int_t pad = 0 ; pad < fkNPadsOroc ; pad++)
48265b32 798 {
5312f439 799 fHistOROCIndex->SetCellContent(row+1,pad+1,-1);
48265b32 800 }
5312f439 801 }
48265b32 802
5312f439 803 for(Int_t ch= 0; ch<GetMaxHwAddr(); ch++)
804 {
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);
811 }
48265b32 812
813 for(Int_t ch = 0; ch< GetNumOfChannels(); ch++)
5312f439 814 {
815 for(Int_t bin = 0; bin< GetTimeBins(); bin++)
48265b32 816 {
5312f439 817 fPad[ch][bin] = 0;
48265b32 818 }
5312f439 819 }
820 for(Int_t ch = 0; ch< GetMaxHwAddr(); ch++)
821 {
822 fPadMapHw[ch]=-1;
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;
829 }
48265b32 830 fPadUsedHwAddr=-1;
831}
832
833
834//____________________________________________________________________________
835void AliTPCMonitor::ResetHistos()
836{
5312f439 837 // Reset all but
48265b32 838 for(Int_t i =0; i<fHistList->GetEntries(); i++)
5312f439 839 {
5dbad769 840 TString name=fHistList->At(i)->GetName();
841 if(GetProcNextEvent()==0 && (name=="SIDE A" || name=="SIDE C")) continue;
5312f439 842 ((TH1*)fHistList->At(i))->Reset();
843 }
48265b32 844 ResetArrays();
845}
846
847//____________________________________________________________________________
848void AliTPCMonitor::DeleteHistos()
849{
5312f439 850 // Delete histograms
48265b32 851 for(Int_t i =0; i<fHistList->GetEntries(); i++)
5312f439 852 {
853 delete (TH1*)fHistList->At(i);
854 }
48265b32 855}
856
857
858//__________________________________________________________________
859Int_t AliTPCMonitor::CheckEqId(Int_t secid,Int_t eqid)
860{
5312f439 861 // Check if equipment id corresponds to any rcu patch in sector
48265b32 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
5312f439 866
48265b32 867 if(fVerb) cout << "AliTPCMonitor::CheckEqId : SectorId " << secid << " EquipmentId " << eqid << " runid " << fRunId << endl;
868 Int_t passed =1;
ac940b58 869 //skip all eqids which do not belong to the TPC
870 if ( eqid<768||eqid>983 ) return 0;
871 //
5dbad769 872// if(fRunId<704 && 0) // commented out --> runs with runid < 704 in 2006 are not recognized anymore
873// {
874// if( (secid>-1) && (secid<36) ) // if ( secid is in range) { take only specific eqids} else { take all }
875// {
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;}
878// }
879// else {if(fVerb) cout << "passed check "<< endl; }
880// }
881// else
882// {
5312f439 883 if( (secid>-1) && (secid<36) ) // if ( secid is in range) { take only specific eqids} else { take all }
48265b32 884 {
5312f439 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;}
48265b32 887 }
5312f439 888 else {if(fVerb) cout << "passed check "<< endl;}
5dbad769 889// }
5312f439 890
48265b32 891 return passed;
892}
893
894//__________________________________________________________________
895void AliTPCMonitor::SetEqIds()
896{
897 // Set mapping for equipment ids
5312f439 898 for(Int_t i = 0; i<36 ; i++)
899 {
900 for(Int_t j = 0; j<6; j++)
901 {
902 if(j<2) fMapEqidsSec[i][j]= 768+i*2+j;
903 else fMapEqidsSec[i][j]= 840+i*4+j-2;
48265b32 904 }
5312f439 905 }
48265b32 906
907 for(Int_t i = 0; i<36 ; i++)
5312f439 908 {
909 for(Int_t j = 0; j<6; j++)
910 {
911 if(j<2) fMapEqidsRcu[768+i*2+j] = i*6 +j;
912 else fMapEqidsRcu[840+i*4+j-2] = i*6 +j;
48265b32 913 }
5312f439 914 }
48265b32 915}
916
917//__________________________________________________________________
918void AliTPCMonitor::FillGlobal(Int_t sector)
919{
5312f439 920
921 // Fill global histograms with max adc for each channel
48265b32 922
923 TH2S* hglob =0;
924 if((sector/18) ==0) hglob = fHistGlobalMaxA;
925 else hglob = fHistGlobalMaxC;
926
927 Float_t rotsec = (2*TMath::Pi()/18.0);
928 Float_t rot = (-rotsec*(sector%18) +4*rotsec);
929
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);
934
935 Int_t max = 0; // use integer for global view
936
937 Double_t xval = 0.0;
938 Double_t yval = 0.0;
939
940 Int_t pad = 0;
941 Int_t row = 0;
942 Int_t padmax = 0;
943
944 Float_t xdr = 0;
945 Float_t ydr = 0;
946
5312f439 947 for(Int_t hw = 0; hw<fHistAddrMaxAdc->GetNbinsX(); hw++)
948 {
949 max = (Int_t)fHistAddrMaxAdc->GetBinContent(hw);
950 if(max!=-1)
48265b32 951 {
5312f439 952 pad = fMapHand->GetPad( hw);
953 row = fMapHand->GetPadRow(hw);
c60053f6 954 if (row==-1) continue;
5312f439 955 padmax = fMapHand->GetNumofPads(row);
956 if (sector%36>17) fMirror=-1;
957 else 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);
48265b32 962 }
5312f439 963 }
48265b32 964}
965
966
967//__________________________________________________________________
ca7b8371 968void AliTPCMonitor::GetXY( Double_t& xval , Double_t& yval , Int_t padmax, Int_t row , Int_t pad) const
48265b32 969{
970 // Get x and y position of pad
971
5312f439 972 if(row<63)
973 {
974 xval = fMirror*( 2*padmax -4*pad -2);
975 yval = 852.25 +7.5*row;
976 }
977 else
978 {
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; }
982 }
48265b32 983
984}
985
986//__________________________________________________________________
ca7b8371 987Int_t AliTPCMonitor::GetPadAtX(Float_t xval, Int_t row, Int_t padmax) const
48265b32 988{
989 // Get pad number at given position in x
990 Int_t pad = 0;
991
992 if(row<63) {pad = (Int_t)( ( (xval/fMirror) +2 -2*padmax)/-4);}
993 else {pad = (Int_t)( ( (xval/fMirror) +3 -3*padmax)/-6);}
994
995 if(pad>=padmax) return -1;
996 else return pad ;
997
998}
999
1000//__________________________________________________________________
ca7b8371 1001Int_t AliTPCMonitor::GetPadAtX(Float_t xval, Int_t row) const
48265b32 1002{
5312f439 1003
48265b32 1004 // Get pad number at given position in x
5312f439 1005
48265b32 1006 Int_t padmax = fMapHand->GetNumofPads(row);
1007 Int_t pad = 0;
1008
1009 if(row<63) {pad = (Int_t)( ( (xval/fMirror) +2 -2*padmax)/-4);}
1010 else {pad = (Int_t)( ( (xval/fMirror) +3 -3*padmax)/-6);}
1011
1012 if(pad>=padmax) return -1;
1013 else return pad ;
1014
1015}
1016
1017//__________________________________________________________________
1018void AliTPCMonitor::DrawHists(Int_t histos)
1019{
5312f439 1020
48265b32 1021 // Draw sets of histograms
1022 // histos==1 : 2Dim histos for MAX adc and add executables
5312f439 1023 // histos==2 : distributions max/rms/sum
48265b32 1024 // histos==3 : global max adc for specified SideA/C
5312f439 1025
1026
1027 if(fVerb) cout << " Draw histos " << endl;
5dbad769 1028 TString cside;
1029 if(GetLastSector()/18==0 ) cside="A";
1030 else cside="C";
48265b32 1031
5dbad769 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());
48265b32 1036
5dbad769 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());
5312f439 1042
1043 if(histos==1)
1044 {
48265b32 1045 // IROC _______________________________________________________________
5312f439 1046 TCanvas* ciroc = 0;
1047 ciroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("ciroc");
1048 if(!ciroc)
1049 {
1050 ciroc = CreateCanvas("ciroc");
1051 fExecPlaneMax=0;
1052 }
1053 ciroc->cd();
1054
1055 fHistIROC->SetXTitle("row");
1056 fHistIROC->SetYTitle("pad");
1057 if(GetPedestals()) fHistIROC->SetZTitle("max ADC (baseline sub)");
1058 else fHistIROC->SetZTitle("max ADC ");
5dbad769 1059 fHistIROC->SetTitle(titleIROC.Data());
5312f439 1060 fHistIROC->SetMinimum(0.01);
1061 fHistIROC->Draw("COLZ");
1062 ciroc->UseCurrentStyle();
1063
1064
5dbad769 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());
5312f439 1067
48265b32 1068 // OROC
5312f439 1069 TCanvas* coroc = 0;
1070 coroc =(TCanvas*)gROOT->GetListOfCanvases()->FindObject("coroc");
1071 if(!coroc) {
1072 coroc = CreateCanvas("coroc");
1073 fExecPlaneMax=0;
1074 }
1075 coroc->cd();
1076
1077 fHistOROC->SetXTitle("row");
1078 fHistOROC->SetYTitle("pad");
1079 if(GetPedestals()) fHistOROC->SetZTitle("max ADC (baseline sub)");
1080 else fHistOROC->SetZTitle("max ADC ");
5dbad769 1081 fHistOROC->SetTitle(titleOROC.Data());
5312f439 1082 fHistOROC->SetMinimum(0.01);
1083 fHistOROC->Draw("COLZ");
1084 coroc->UseCurrentStyle();
1085
1086
5dbad769 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());
1089
1090 // SUM
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());
5312f439 1096
5dbad769 1097 fHistOROCSUM->SetXTitle("row");
1098 fHistOROCSUM->SetZTitle(namesum);
1099 fHistOROCSUM->SetYTitle("pad");
1100 fHistOROCSUM->SetTitle(titleOROC.Data());
48265b32 1101
5dbad769 1102 // BASE
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());
1108
1109 fHistOROCBASE->SetXTitle("row");
1110 fHistOROCBASE->SetZTitle(namebase);
1111 fHistOROCBASE->SetYTitle("pad");
1112 fHistOROCBASE->SetTitle(titleOROC.Data());
5312f439 1113
1114 if(fHistIROCClone) fHistIROCClone->Delete();
1115 if(fHistOROCClone) fHistOROCClone->Delete();
1116 fHistIROCClone = (TH2F*)fHistIROC->Clone("fHistIROCClone");
1117 fHistOROCClone = (TH2F*)fHistOROC->Clone("fHistOROCClone");
1118
48265b32 1119 // Executables
5312f439 1120 if(fExecPlaneMax==0)
48265b32 1121 {
5dbad769 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());
5312f439 1125
5dbad769 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());
5312f439 1129 fExecPlaneMax=1;
1130 }
1131 coroc->Update();
1132 ciroc->Update();
1133 }
1134 else if(histos==2)
1135 {
48265b32 1136 // MAX ADC distribution ____________________________________________
5312f439 1137 TCanvas* cmax = 0;
1138 cmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cmax");
1139 if(!cmax) cmax = CreateCanvas("cmax");
48265b32 1140
5312f439 1141 cmax->cd();
1142 fHistDistrMaxIROC->GetXaxis()->SetRangeUser(0.0,1000.0);
1143 fHistDistrMaxIROC->SetXTitle("max ADC (ADC)");
1144 fHistDistrMaxIROC->SetYTitle("counts");
5dbad769 1145 fHistDistrMaxIROC->SetTitle(titleMAX.Data());
5312f439 1146 fHistDistrMaxIROC->Draw("");
1147 fHistDistrMaxOROC->SetLineColor(2);
1148 fHistDistrMaxOROC->Draw("same");
48265b32 1149
5312f439 1150 if(fHistDistrMaxOROC->GetMaximum()> fHistDistrMaxIROC->GetMaximum()) fHistDistrMaxIROC->SetMaximum(fHistDistrMaxOROC->GetMaximum()*1.1);
1151
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");
48265b32 1157
1158 // ADC sum distribution
5312f439 1159 TCanvas* csum = 0;
1160 csum = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("csum");
1161 if(!csum) csum = CreateCanvas("csum") ;
1162 csum->cd();
48265b32 1163
5312f439 1164 fHistDistrSumIROC->SetXTitle("sum ADC (ADC)");
1165 fHistDistrSumIROC->SetYTitle("counts");
5dbad769 1166 fHistDistrSumIROC->SetTitle(titleSUM.Data());
5312f439 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");
48265b32 1172
1173 // BASELINE MEAN distribution
5312f439 1174 TCanvas* cbasemean = 0;
1175 cbasemean = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cbasemean");
1176 if(!cbasemean) cbasemean = CreateCanvas("cbasemean");
1177 cbasemean->cd();
1178
1179 fHistDistrBaseMeanIROC = fHistDistrBase2dIROC->ProjectionX("fHistDistrBaseMeanIROC");
1180 fHistDistrBaseMeanIROC->SetXTitle("base mean (ADC)");
1181 fHistDistrBaseMeanIROC->SetYTitle("counts");
5dbad769 1182 fHistDistrBaseMeanIROC->SetTitle(titleMEAN.Data());
5312f439 1183 fHistDistrBaseMeanIROC->Draw("");
48265b32 1184
5312f439 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");
48265b32 1190
5312f439 1191 TCanvas* cbaserms = 0;
1192 cbaserms = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cbaserms");
1193 if(!cbaserms) cbaserms = CreateCanvas("cbaserms") ;
1194 cbaserms->cd();
48265b32 1195
1196 // BASELINE RMS distribution
5312f439 1197 fHistDistrBaseRmsIROC = fHistDistrBase2dIROC->ProjectionY("fHistDistrBaseRmsIROC");
1198 fHistDistrBaseRmsIROC->SetXTitle("base rms (ADC)");
1199 fHistDistrBaseRmsIROC->SetYTitle("counts");
5dbad769 1200 fHistDistrBaseRmsIROC->SetTitle(titleRMS.Data());
5312f439 1201 fHistDistrBaseRmsIROC->Draw("");
48265b32 1202
5312f439 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");
48265b32 1208
5312f439 1209 cmax->Update();
1210 csum->Update();
1211 cbasemean->Update();
1212 cbaserms->Update();
1213 }
48265b32 1214 else if(histos==3)
5312f439 1215 {
48265b32 1216 // GLOBAL MAX ADC _________________________________
5312f439 1217 if(GetProcNextEvent()==1)
1218 {
1219 TCanvas* cglobA =0;
1220 TCanvas* cglobC =0;
1221
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");
48265b32 1224
5dbad769 1225 TString globtitle1=Form("SIDE A Run %05i (EventID %i)",fRunId,fEventNumber);
1226 TString globtitle2=Form("SIDE C Run %05i (EventID %i)",fRunId,fEventNumber);
5312f439 1227
5dbad769 1228 fHistGlobalMaxA->SetTitle(globtitle1.Data());
1229 fHistGlobalMaxC->SetTitle(globtitle2.Data());
5312f439 1230 fHistGlobalMaxA->SetXTitle("x/mm");
1231 fHistGlobalMaxA->SetYTitle("y/mm");
1232 fHistGlobalMaxC->SetXTitle("x/mm");
1233 fHistGlobalMaxC->SetYTitle("y/mm");
1234
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 "); }
1237
1238 fHistGlobalMaxA->SetMinimum(0.01);
1239 fHistGlobalMaxC->SetMinimum(0.01);
1240
1241 cglobC->cd() ; fHistGlobalMaxC->Draw("COLZ");
1242 cglobA->cd() ; fHistGlobalMaxA->Draw("COLZ");
1243
5dbad769 1244 TString nameom=Form(".x %s/TPC/AliTPCMonitorExec.C(3)",gSystem->Getenv("ALICE_ROOT"));
5312f439 1245
1246 if(fExecGlob==0)
1247 {
5dbad769 1248 if(fVerb)cout << " set exec " << nameom.Data() << endl;
1249 cglobC->AddExec("glob",nameom.Data());
1250 cglobA->AddExec("glob",nameom.Data());
5312f439 1251 fExecGlob = 1;
1252 }
1253 else
1254 {
1255 cglobC->DeleteExec("glob");
1256 cglobA->DeleteExec("glob");
1257
5dbad769 1258 if(fVerb) cout << " set exec " << nameom.Data() << endl;
1259 cglobC->AddExec("glob",nameom.Data());
1260 cglobA->AddExec("glob",nameom.Data());
5312f439 1261
1262 }
1263 cglobC->Update();
1264 cglobA->Update();
48265b32 1265 }
5312f439 1266
1267 }
48265b32 1268}
1269
1270
1271
1272//__________________________________________________________________
1273void AliTPCMonitor::DrawRMSMap()
1274{
5312f439 1275 // Draw 2Dim rms histos for IROC and OROC
48265b32 1276 // and set executables for canvases
1277
1278 TCanvas* crmsoroc =0;
1279 TCanvas* crmsiroc =0;
1280 if(!(crmsoroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crmsoroc"))) crmsoroc = CreateCanvas("crmsoroc");
1281 if(!(crmsiroc = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crmsiroc"))) crmsiroc = CreateCanvas("crmsiroc");
5312f439 1282
48265b32 1283 crmsiroc->cd(); fHistIROCRMS->Draw("COLZ");
1284 crmsoroc->cd(); fHistOROCRMS->Draw("COLZ");
5312f439 1285
5dbad769 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"));
48265b32 1288
5312f439 1289 if(fExecPadIrocRms==0)
1290 {
5dbad769 1291 crmsiroc->AddExec("pad",carry1.Data());
1292 crmsiroc->AddExec("row",carry2.Data());
5312f439 1293 fExecPadIrocRms=1;
1294 }
1295
1296 if(fExecPadOrocRms==0)
1297 {
5dbad769 1298 crmsoroc->AddExec("pad",carry1.Data());
1299 crmsoroc->AddExec("row",carry2.Data());
5312f439 1300 fExecPadOrocRms=1;
1301 }
48265b32 1302
1303 crmsiroc->Update();
1304 crmsoroc->Update();
1305
5312f439 1306 DrawHists(2);
1307
48265b32 1308}
1309
1310//__________________________________________________________________
1311void AliTPCMonitor::ExecPad()
1312{
5312f439 1313
1314 // Executable for Pad
1315 // Show time profile for channel the mouse is pointing at
48265b32 1316
1317 Int_t event = gPad->GetEvent();
1318 if (event != 51) return;
1319
1320 TObject *select = gPad->GetSelected();
1321 if(!select) return;
1322 if(!select->InheritsFrom("TH2")) { return; }
1323 gPad->GetCanvas()->FeedbackMode(kTRUE);
1324
1325 // get position
1326 Int_t px = gPad->GetEventX();
1327 Int_t py = gPad->GetEventY();
1328 Float_t upy = gPad->AbsPixeltoY(py);
1329 Float_t upx = gPad->AbsPixeltoX(px);
1330 Float_t y = gPad->PadtoY(upy);
1331 Float_t x = gPad->PadtoX(upx);
5312f439 1332
48265b32 1333 Int_t setrange = 0;
1334
1335 TCanvas* cpad = 0;
1336 // Char_t namehist[50];
5dbad769 1337 TString projhist;
1338 TString namesel;
1339 TString namecanv;
5312f439 1340
ca7b8371 1341 Int_t xbinmin = 0;
1342 Int_t xbinmax = 0;
1343 Float_t ybinmin = 0;
1344 Float_t ybinmax = 0;
1345 Int_t rocid = 0;
5312f439 1346 // Check wich Canvas executed the event
48265b32 1347 TH2S* fHistIndex=0;
5dbad769 1348 namesel=select->GetName();
1349 if(namesel=="fHistOROC" || namesel=="fHistOROCRMS" || namesel=="fHistOROCTime" )
5312f439 1350 {
1351 rocid = 1;
1352 fPadUsedRoc =1;
5dbad769 1353 projhist=Form("ProjectionOROC");
1354 namecanv=Form("coroc_ch");
5312f439 1355 fHistIndex = fHistOROCIndex;
1356 }
5dbad769 1357 if(namesel=="fHistIROC" || namesel=="fHistIROCRMS" || namesel=="fHistIROCTime" )
5312f439 1358 {
1359 rocid = 0;
1360 fPadUsedRoc=0;
5dbad769 1361 projhist=Form("ProjectionIROC");
1362 namecanv=Form("ciroc_ch");
5312f439 1363 fHistIndex = fHistIROCIndex;
1364 }
48265b32 1365
5312f439 1366 // Check if Canvas already existed and get Ranges from former Prjection histogram
1367 if((cpad=(TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv)))
1368 {
1369 cpad->cd();
1370 if(gROOT->Get(projhist))
48265b32 1371 {
5312f439 1372 setrange = 1;
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");
48265b32 1379 }
5312f439 1380 }
1381 else
1382 {
1383 cpad = CreateCanvas(namecanv); cpad->cd();
1384 }
48265b32 1385
5312f439 1386 // Get Bin
5dbad769 1387 if (!fHistIndex) return;
48265b32 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;
5312f439 1392
1393 TH1D *hp=(TH1D*)gROOT->Get(projhist);
1394 if(!hp) hp=new TH1D(projhist,projhist,GetTimeBins(),0,GetTimeBins());//delete gROOT->Get(projhist);
1395 // Get Projection
1396// TH1D *hp = (TH1D*)(((TH1D*)fHistChannelTime->ProjectionY("hp",binchannel,binchannel))->Clone(projhist));
1397// TH1D *hp = fHistChannelTime->ProjectionY(projhist,binchannel,binchannel);
1398// hp->Reset();
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)];
1402 }
1403// printf("hi\n");
1404// return;
48265b32 1405
1406 // Make title and Pave for channel Info
48265b32 1407 Int_t npadRow , npad , nhw , nmax , hwadd;
1408
1409 hwadd = (Int_t)fHistChannelTime->GetCellContent(binchannel,0);
1410 fPadUsedHwAddr = hwadd;
1411
ca7b8371 1412 if(rocid==0)npadRow = fMapHand->GetPadRow(hwadd);
1413 else npadRow = fMapHand->GetPadRow(hwadd)-63;
1414 npad = fMapHand->GetPad(hwadd);
1415 nhw = hwadd;
1416 nmax = (Int_t)hp->GetMaximum();
48265b32 1417
5312f439 1418
48265b32 1419 TPaveText* legstat = new TPaveText(0.18,0.65,0.3,0.8,"NDC");
5312f439 1420
48265b32 1421 Int_t connector = fMapHand->GetFECconnector(hwadd);
ca7b8371 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);
48265b32 1429
5312f439 1430
1431 Short_t fecget = (hwadd & fgkHwMaskFEC) >> 7;
1432 Short_t branchget = (hwadd & fgkHwMaskBranch)>> 11;
1433
5dbad769 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));
5312f439 1442
5dbad769 1443 TString title=Form("Row=%d Pad=%d Hw =%d maxADC =%d count =%d",npadRow,npad,nhw,nmax,binchannel);
48265b32 1444
5312f439 1445// hp->SetName(projhist);
48265b32 1446 hp->SetTitleSize(0.04);
5dbad769 1447 hp->SetTitle(title.Data());
48265b32 1448 hp->SetYTitle("ADC");
1449 hp->SetXTitle("Timebin");
1450 hp->GetXaxis()->SetTitleColor(1);
1451
5312f439 1452 if(setrange)
1453 {
1454 hp->GetXaxis()->SetRange(xbinmin,xbinmax);
1455 hp->SetMinimum(ybinmin);
1456 hp->SetMaximum(ybinmax);
1457 }
1458 else
1459 {
1460 hp->SetMinimum(0.0);
1461 hp->SetMaximum(1000.0);
1462 }
48265b32 1463
1464 cpad->cd();
1465 hp->Draw();
1466
1467 // Make Fit to peak
5312f439 1468 if(GetPedestals() && fDisableFit==0)
1469 {
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);
1473 if(base!=0)
48265b32 1474 {
5312f439 1475 if( ((max+base)/base)>1.2)
1476 {
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);
1488 hp->Fit("fg","RQ");
1489
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");
1495 }
48265b32 1496 }
5312f439 1497 }
48265b32 1498 legstat->SetFillColor(0);
1499 legstat->Draw("same");
1500 cpad->Update();
1501 return;
1502}
1503
1504//__________________________________________________________________
1505void AliTPCMonitor::ExecRow()
1506{
5312f439 1507
1508 // Executable for Pad
1509 // Show profile of max adc over given pad row
1510 // and 2dim histo adc(pad-in-row,time bin)
1511
48265b32 1512 Int_t event = gPad->GetEvent();
1513 if (event != 61) return;
1514 gPad->cd();
1515 TObject *select = gPad->GetSelected();
1516 if(!select) return;
1517 if(!select->InheritsFrom("TH2")) { return; }
5312f439 1518
ca7b8371 1519 Int_t rocid = 0;
48265b32 1520
5dbad769 1521 const Char_t *rowhist="hrowtime";
1522 const Char_t *rowhistxmax="hxmax";
1523 const Char_t *rowhistmax="hrowmax";
48265b32 1524
5312f439 1525 // get position
48265b32 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);
1532
ca7b8371 1533 TCanvas*crowtime = 0;
1534 TCanvas*crowmax = 0;
1535 TCanvas*cxmax = 0;
48265b32 1536
1537 TH2S* fHistIndex = 0;
5312f439 1538
1539 // ranges from already existing histos
ca7b8371 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;
48265b32 1546
fb3305d1 1547 Int_t profrowxmin = 0;
1548 Int_t profrowxmax = 0;
1549 Double_t profrowymin = 0;
1550 Double_t profrowymax = 0;
5312f439 1551
ca7b8371 1552 Int_t profxxmin = 0;
1553 Int_t profxxmax = 0;
1554 Double_t profxymin = 0;
1555 Double_t profxymax = 0;
5312f439 1556
1557
48265b32 1558 Int_t setrange = 0;
5312f439 1559
5dbad769 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; }
48265b32 1564
1565 gPad->GetCanvas()->FeedbackMode(kTRUE);
1566
5312f439 1567
1568
48265b32 1569 // check if canvases exist //
ca7b8371 1570 crowtime = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crowtime");
1571 crowmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("crowmax");
1572 cxmax = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("cxmax");
48265b32 1573
ca7b8371 1574 if(!crowtime) crowtime = CreateCanvas("crowtime") ;
1575 if(!crowmax) crowmax = CreateCanvas("crowmax") ;
1576 if(!cxmax ) cxmax = CreateCanvas("cxmax") ;
48265b32 1577
5312f439 1578 // check ranges of already existing histos
1579 if(gROOT->Get(rowhist))
1580 {
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();
1587
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();
1592
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();
1597
1598 setrange =1;
1599
1600 delete gROOT->Get(rowhist);
1601 delete gROOT->Get(rowhistmax);
5312f439 1602 delete gROOT->Get("hxmax");
1603 delete gROOT->Get("legrow");
1604 }
48265b32 1605
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);
1610
1611 if(binchannel>30000) return;
ca7b8371 1612 if(binchannel<=0 ) { crowtime->Update() ; crowmax->Update() ; return ; }
48265b32 1613
5312f439 1614 // get hwaddress
48265b32 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);
1619
5312f439 1620 // create histos
ca7b8371 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 );
48265b32 1624
1625 // Row profile ///////////
1626 if(fVerb) cout << " Number of pads " << numofpads << endl;
5312f439 1627 for(Int_t padnr = 0; padnr<numofpads;padnr++)
1628 {
1629 Int_t addrinrow = fMapHand->GetPadAddInRow(row,padnr );
1630 Int_t channel = (Int_t)fHistAddrMapIndex->GetBinContent(addrinrow);
1631 if(channel==-1) continue;
1632
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++) {
48265b32 1636
5312f439 1637 Float_t val = hp->GetBinContent(time);
1638 hrowtime->SetCellContent(padnr+1,time+1,val);
48265b32 1639 }
5312f439 1640 }
48265b32 1641
1642 // X profile /////////////
1643 Double_t xval = 0.0;
1644 Double_t yval = 0.0;
1645 GetXY(xval,yval,numofpads,row,pad);
1646
5312f439 1647 Int_t padnr = 0;
48265b32 1648 Int_t hw = 0;
1649 for(Int_t nrow = 0; nrow<159; nrow++)
5312f439 1650 {
1651 padnr = GetPadAtX(xval,nrow);
1652 if(padnr>=0)
48265b32 1653 {
5312f439 1654 hw = fMapHand->GetPadAddInRow(nrow,padnr);
1655 if(fPadMapHw[hw]==-1){ continue ; }
1656 else { hxmax->SetBinContent(nrow+1,fHistAddrMaxAdc->GetBinContent(hw)) ; }
48265b32 1657 }
5312f439 1658 }
48265b32 1659
ca7b8371 1660 cxmax->cd();
5dbad769 1661 hxmax->SetTitle(Form("max adc in pads at x=%5.1f mm",xval));
ca7b8371 1662 hxmax->SetXTitle("row");
1663 if(!GetPedestals()) hxmax->SetYTitle("max adc (baseline sub.)");
1664 else hxmax->SetYTitle("max adc ");
1665 hxmax->SetMinimum(0.01);
1666 hxmax->Draw("l");
48265b32 1667
1668 if(setrange)
5312f439 1669 {
1670 hxmax->GetXaxis()->SetRange(profxxmin,profxxmax);
1671 hxmax->SetMinimum(profxymin);
1672 hxmax->SetMaximum(profxymax);
1673 }
48265b32 1674
ca7b8371 1675 cxmax->Update();
5312f439 1676
ca7b8371 1677 crowtime->cd();
5dbad769 1678 TString title;
1679 TString titlemax;
1680 if(rocid==1) {
1681 title.Form("%s Row=%d",((TH2*)select)->GetTitle(),row) ;
1682 titlemax.Form("IROC max/sum Row=%d",row );
1683 } else {
1684 title.Form("%s Row=%d",((TH2*)select)->GetTitle(),row-63);
1685 titlemax.Form("OROC max/sum Row=%d",row-63);
1686 }
1687
48265b32 1688 if(fVerb) cout << " set name " << endl;
1689
5312f439 1690
48265b32 1691 // row vs time
ca7b8371 1692 crowtime->cd();
1693 hrowtime->SetTitleSize(0.04);
5dbad769 1694 hrowtime->SetTitle(title.Data());
ca7b8371 1695 hrowtime->SetYTitle("timbin");
1696 hrowtime->SetXTitle("pad in row");
1697 hrowtime->SetZTitle("signal (ADC)");
5312f439 1698
ca7b8371 1699 hrowtime->GetXaxis()->SetTitleColor(1);
1700 hrowtime->SetMaximum(1000.0);
1701 hrowtime->SetMinimum(0.0);
48265b32 1702
5312f439 1703 if(setrange)
1704 {
1705 hrowtime->GetXaxis()->SetRange(rowtimexmin,rowtimexmax);
1706 hrowtime->GetYaxis()->SetRange(rowtimeymin,rowtimeymax);
1707 hrowtime->SetMinimum(rowtimezmin);
1708 hrowtime->SetMaximum(rowtimezmax);
1709 }
1710
ca7b8371 1711 hrowtime->Draw("COLZ");
1712 crowtime->UseCurrentStyle();
1713 crowtime->Update();
5312f439 1714
48265b32 1715 // max and sum /////////////////////////
ca7b8371 1716 crowmax->cd();
48265b32 1717 if(setrange) {
fb3305d1 1718 hrowmax->GetXaxis()->SetRange(profrowxmin,profrowxmax);
1719 hrowmax->SetMinimum(profrowymin);
1720 hrowmax->SetMaximum(profrowymax);
48265b32 1721 }
ca7b8371 1722 hrowmax->SetTitleSize(0.04);
5dbad769 1723 hrowmax->SetTitle(title.Data());
ca7b8371 1724 hrowmax->SetYTitle("max adc");
1725 hrowmax->SetXTitle("pad in row");
1726 hrowmax->GetXaxis()->SetTitleColor(1);
5312f439 1727
ca7b8371 1728 hrowmax->SetLineColor(2);
5312f439 1729 hrowmax->Draw("l");
ca7b8371 1730 crowmax->Update();
48265b32 1731
1732 return;
1733}
1734
1735//__________________________________________________________________
1736void AliTPCMonitor::Write10bitChannel()
1737{
1738
5312f439 1739 // Write 10 bit words form histogram for active(last pointed) channel
48265b32 1740
1741 if(fPadUsedHwAddr==-1){ AliWarning(" No active pad "); return ;}
1742
5312f439 1743 Int_t pad = (Int_t)fMapHand->GetPad( fPadUsedHwAddr);
1744 Int_t row = (Int_t)fMapHand->GetPadRow(fPadUsedHwAddr);
48265b32 1745 Int_t channel = (Int_t)fPadMapHw[fPadUsedHwAddr];
1746
5dbad769 1747 TString filenameroot;
1748 TString filenamedat;
1749 TString projhist;
5312f439 1750
5dbad769 1751 if(fPadUsedRoc==1) { projhist.Form("ProjectionOROC"); }
1752 if(fPadUsedRoc==0) { projhist.Form("ProjectionIROC"); }
48265b32 1753
5dbad769 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);
48265b32 1756
5312f439 1757 TH1D* hpr = 0;
1758 if((hpr=(TH1D*)gROOT->Get(projhist)))
1759 {
1760 // root histo
5dbad769 1761 TFile f(filenameroot.Data(),"recreate");
5312f439 1762 hpr->Write();
1763 f.Close();
1764
1765 // raw singal
5dbad769 1766 ofstream datout(filenamedat.Data(),ios::out);
5312f439 1767 datout <<"Timebin \t ADC value " << endl;
1768 for(Int_t i = 1; i <GetTimeBins(); i++)
48265b32 1769 {
5312f439 1770 datout << i << " \t \t " << fPad[channel][i] << endl;
48265b32 1771 }
5312f439 1772 datout.close();
1773 }
48265b32 1774 else
5312f439 1775 {
1776 AliWarning("No projection histo found ");
1777 }
48265b32 1778}
1779
1780//__________________________________________________________________
1781void AliTPCMonitor::ExecTransform()
1782{
5312f439 1783
48265b32 1784 // Make Fast Fourier Transformation for active pad
1785 // fft is only performed for a data sample of size 2^n
5312f439 1786 // reduce window according to largest power of 2 which is smaller than the viewing range
1787
5dbad769 1788 TString namecanv;
1789 TString namecanv2;
1790 TString projhist;
1791 TString namehtrimag;
1792 TString namehtrreal;
1793 TString namehtrmag;
48265b32 1794
5dbad769 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"; }
5312f439 1797
48265b32 1798 TH1D* hproj = 0;
1799
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 ;}
5dbad769 1801 else hproj = (TH1D*)gROOT->Get(projhist.Data()) ;
5312f439 1802
48265b32 1803
5dbad769 1804 if(fPadUsedRoc==1) { namehtrimag="htransimagfreq_oroc"; namehtrreal="htransrealfreq_oroc"; namehtrmag="htransmagfreq_oroc"; }
1805 else { namehtrimag="htransimagfreq_iroc"; namehtrreal="htransrealfreq_iroc"; namehtrmag="htransmagfreq_iroc"; }
5312f439 1806
5dbad769 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());
5312f439 1810
48265b32 1811 TCanvas *ctrans = 0;
5dbad769 1812 if(!(ctrans = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv.Data())))
ac940b58 1813 {
5dbad769 1814 ctrans = CreateCanvas(namecanv.Data());
ac940b58 1815 ctrans->Divide(1,2);
1816 }
1817 TCanvas *ctrans2 = 0;
5dbad769 1818 if(!(ctrans2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject(namecanv2.Data())))
ac940b58 1819 {
5dbad769 1820 ctrans2 = CreateCanvas(namecanv2.Data());
ac940b58 1821// ctrans2->Divide(1,2);
1822 }
5312f439 1823
ca7b8371 1824 Int_t binfirst = hproj->GetXaxis()->GetFirst();
1825 Int_t binlast = hproj->GetXaxis()->GetLast();
1826 Int_t bins = binlast -binfirst +1;
5312f439 1827
48265b32 1828 Int_t power = 0;
ac940b58 1829 for(Int_t pot = 0; pot<=10 ; pot++)
1830 {
1831 Int_t comp = (Int_t)TMath::Power(2,pot);
1832 if(bins>=comp)power = pot;
1833 }
5312f439 1834
48265b32 1835 bins = (Int_t)TMath::Power(2,power);
5312f439 1836
48265b32 1837 // sampling frequency ;
ca7b8371 1838 Double_t deltat = 1.0/(Float_t)GetSamplingFrequency();
5312f439 1839
48265b32 1840 // output histo
5dbad769 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));
5312f439 1844
5dbad769 1845 TString titlereal;
1846 TString titleimag;
1847 TString titlemag;
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"; }
5312f439 1850
5dbad769 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)");
5312f439 1854
1855 // create complex packed data array
ca7b8371 1856 const Int_t kdatasiz = 2*bins;
1857 Double_t* data = new Double_t[kdatasiz];
48265b32 1858 for(Int_t i=0;i<2*bins;i++) { data[i] = 0.0;}
ca7b8371 1859 for(Int_t i=0;i<bins;i++) { data[2*i] = (Double_t)hproj->GetBinContent(binfirst+i); }
5312f439 1860
48265b32 1861 // make fourier transformation
1862 AliTPCMonitorFFT* four = new AliTPCMonitorFFT();
1863 four->ComplexRadix2ForwardWrap(data,1,bins);
5312f439 1864
1865 // write output and fill histos forward
48265b32 1866 Double_t freq = 0.0;
ac940b58 1867 for(Int_t i=0;i<2*bins;i++)
1868 {
1869 if(i<bins)
48265b32 1870 {
ac940b58 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]) );
48265b32 1876 }
ac940b58 1877 }
5312f439 1878
48265b32 1879 ctrans->cd(1);
ca7b8371 1880 htransrealfreq->Draw();
48265b32 1881 ctrans->cd(2);
ca7b8371 1882 htransimagfreq->Draw();
48265b32 1883 ctrans->Update();
ac940b58 1884 ctrans2->cd();
1885 htransmag->Draw();
1886 ctrans2->Update();
48265b32 1887 delete four;
4ce766eb 1888 delete [] data;
48265b32 1889}
1890
1891//__________________________________________________________________
ca7b8371 1892void AliTPCMonitor::ShowSel(Int_t* compval)
48265b32 1893{
1894
5312f439 1895 // Show only selected components
1896 // First restore original histogram from clone
1897 // Than remove all not matching pads form histos
48265b32 1898
1899 Int_t connector = 0;
ca7b8371 1900 Int_t fecnr = 0;
fb3305d1 1901 Int_t altrochip = 0;
ca7b8371 1902 Int_t feclocbran = 0;
48265b32 1903 Int_t branch = 0;
1904 Short_t rcuget = 0;
1905 Int_t emptyI = 1;
1906 Int_t index = -1;
1907 Int_t hwadd = 0;
5312f439 1908
48265b32 1909 Float_t maxiroc = fHistIROCClone->GetMaximum();
1910 Float_t maxoroc = fHistOROCClone->GetMaximum();
48265b32 1911
5312f439 1912
1913 // restore original histos
1914 for(Int_t row = 0; row<fkNRowsIroc; row++)
1915 {
1916 for(Int_t pad = 0; pad<fkNPadsIroc; pad++)
48265b32 1917 {
48265b32 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));
48265b32 1921 }
5312f439 1922 }
1923 for(Int_t row = 0; row<fkNRowsOroc; row++)
1924 {
1925 for(Int_t pad = 0; pad<fkNPadsOroc; pad++)
48265b32 1926 {
5312f439 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));
48265b32 1930 }
5312f439 1931 }
48265b32 1932
1933
1934 // remove not matching entries from fHistIROC/fHistOROC
1935
1936 TH2F* fHist =0;
1937 TH2S* fHistIndex =0;
1938 Int_t npads =0;
1939 Int_t subrows =0;
1940
5312f439 1941 for(Int_t row = 0; row< (fkNRowsIroc + fkNRowsOroc); row++)
1942 {
1943 if(row<fkNRowsIroc) { fHist=fHistIROC ; fHistIndex = fHistIROCIndex; npads = fkNPadsIroc; subrows =0 ;}
1944 else { fHist=fHistOROC ; fHistIndex = fHistOROCIndex; npads = fkNPadsOroc; subrows =fkNRowsIroc;}
1945
1946 for(Int_t pad = 0; pad<npads; pad++)
48265b32 1947 {
5312f439 1948 index = (Int_t)fHistIndex->GetCellContent(row -subrows +1,pad+1);
1949 if(index==-1) continue ;
1950 hwadd = (Int_t)fHistChannelTime->GetCellContent(index,0);
1951
1952 // global fecnr
1953 fecnr = fMapHand->GetFECfromHw(hwadd);
1954 if(compval[0]!=-1 && fecnr!=compval[0]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1955
1956 // rcu
1957 rcuget = (hwadd & fgkHwMaskRCU)>> 12;
1958 if(compval[1]!=-1 && rcuget!=compval[1]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1959
1960 // branch
1961 branch = fMapHand->U2fGetBranch(fecnr) ;
1962 if(compval[2]!=-1 && branch!=compval[2]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1963
1964 // local fec
1965 feclocbran= fMapHand->U2fGetFECinBranch(fecnr) ;
1966 if(compval[3]!=-1 && feclocbran!=compval[3]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
48265b32 1967
5312f439 1968 // connector
1969 connector = fMapHand->GetFECconnector(hwadd);
1970 if(compval[4]!=-1 && connector!=compval[4]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1971
1972 // Altro chip
1973 altrochip = fMapHand->GetAltro(hwadd);
1974 if(compval[5]!=-1 && altrochip!=compval[5]) { fHist->SetCellContent(row-subrows+1,pad+1,0); continue; }
1975 emptyI =0;
48265b32 1976 }
5312f439 1977 }
48265b32 1978
1979 TCanvas* c1 =0;
1980 TCanvas* c2 =0;
5312f439 1981 if(gROOT->GetListOfCanvases()->FindObject("ciroc"))
1982 {
1983 c1 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("ciroc");
1984 c1->cd() ;
1985 fHistIROC->Draw("COLZ");
1986 fHistIROC->SetMaximum(maxiroc);
1987 fHistIROC->SetMinimum(0.0);
1988 c1->Update();
1989 }
1990 if(gROOT->GetListOfCanvases()->FindObject("coroc"))
1991 {
1992 c2 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("coroc");
1993 c2->cd() ;
1994 fHistOROC->Draw("COLZ");
1995 fHistOROC->SetMaximum(maxoroc);
1996 fHistOROC->SetMinimum(0.0);
1997 c2->Update();
1998 }
48265b32 1999 return ;
2000}
2001
2002//__________________________________________________________________
2003void AliTPCMonitor::ResizeCanv()
2004{
2005 // Resize canvases and delete some of them
2006
5dbad769 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"));
48265b32 2009 if(fVerb) cout << " canv 1 " << endl;
2010
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") ; }
2013
2014 // for 2dim plots delete create and draw again
5312f439 2015 if(gROOT->GetListOfCanvases()->FindObject("ciroc"))
2016 {
2017 delete gROOT->GetListOfCanvases()->FindObject("ciroc");
2018 TCanvas* ciroc = CreateCanvas("ciroc");
2019 ciroc->cd();
2020 fHistIROC->Draw("COLZ");
5dbad769 2021 ciroc->AddExec("pad",carry1.Data());
2022 ciroc->AddExec("row",carry3.Data());
5312f439 2023 fExecPlaneMax=1;
2024 ciroc->Update();
2025 }
48265b32 2026 // for 2dim plots delete create and draw again
5312f439 2027 if(gROOT->GetListOfCanvases()->FindObject("coroc"))
2028 {
2029 delete gROOT->GetListOfCanvases()->FindObject("coroc");
2030 TCanvas* coroc = CreateCanvas("coroc");
2031 coroc->cd();
2032 fHistOROC->Draw("COLZ");
2033
5dbad769 2034 coroc->AddExec("pad",carry1.Data());
2035 coroc->AddExec("row",carry3.Data());
5312f439 2036 coroc->Update();
2037 fExecPlaneMax=1;
2038 }
48265b32 2039
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");}
ca7b8371 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"); }
48265b32 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; }
ca7b8371 2052 if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); }
2053 if(gROOT->GetListOfCanvases()->FindObject( "crowmax")) { delete gROOT->GetListOfCanvases()->FindObject("crowmax"); }
5312f439 2054
48265b32 2055}
2056
2057
2058
2059
2060//__________________________________________________________________
2061Int_t AliTPCMonitor::ExecProcess()
2062{
2063 // Executable for global Histogram
2064 // Will be called from /TPC/AliTPCMonitorExec.C(3)
5312f439 2065 // Call ProcessEvent for same event and sector pointed at
48265b32 2066
2067 Int_t side = 0;
2068 Int_t sector = 0;
2069
2070 Int_t event = gPad->GetEvent();
2071 if(event != 61) return -1;
2072
2073 TObject *select = gPad->GetSelected();
2074 if(!select) return -1;
75b27bdb 2075 TString name=select->GetName();
48265b32 2076 if(!select->InheritsFrom("TH2")) {gPad->SetUniqueID(0); return -1; }
5dbad769 2077 if( name=="hglobal" || name=="SIDE A" ) side = 0;
2078 else if( name=="hglobal2" || name=="SIDE C" ) side = 1;
5312f439 2079
48265b32 2080 // get position
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);
5312f439 2087
48265b32 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 ;
5312f439 2091
48265b32 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)));
2097
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());
2101
2102 sector = (Int_t)(alpha/(2*TMath::Pi()/18.0));
2103 if(alpha> (sector+0.5)*(2*TMath::Pi()/18.0)) sector+=1;
2104
2105 if(sector==18 && side ==0 ) {
2106 AliWarning("There was a wromg assignment of sector 0 with sector 18. Check sectors");
2107 sector =0;
2108 }
2109
2110 sector = (18-sector +4)%18;
2111 SetLastSector(sector+ side*18);
2112 SetProcNextEvent(0);
2113
2114 if(fVerb) cout << "AliTPCMonitor::ExecProcess() next side " << side << " next sector " << sector << endl;
2115
2116 return (Int_t)ProcessEvent();
5312f439 2117
48265b32 2118}
2119
2120//__________________________________________________________________
fb3305d1 2121Int_t AliTPCMonitor::GetRCUPatch(Int_t runid, Int_t eqid) const
48265b32 2122{
2123
5312f439 2124 // Return RCU patch index for given equipment id eqid
48265b32 2125 Int_t patch = 0;
2126 //if(runid>=704)
2127 if(runid>=0)
5312f439 2128 {
5dbad769 2129 if ( eqid<768 || eqid>983 ) return 0; //no TPC eqid
c60053f6 2130// if(eqid>=1000) return 0;
5312f439 2131 patch = fMapEqidsRcu[eqid] ;
2132 }
48265b32 2133 else
5312f439 2134 {
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; }
2141
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; }
2148 }
48265b32 2149 return patch;
2150}
2151
2152//__________________________________________________________________
5312f439 2153void AliTPCMonitor::DumpHeader(AliRawReader * reader) const
48265b32 2154{
5312f439 2155 // Dump Event header for format
2156
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;
48265b32 2163}
2164
48265b32 2165
2166//__________________________________________________________________
2167Double_t AliTPCMonitor::Gamma4(Double_t* x, Double_t* par) {
2168
2169 // Gamma4 function used to fit signals
5312f439 2170 // Defined in sections: diverging branch set to 0
48265b32 2171
5312f439 2172 Double_t val = 0.0;
48265b32 2173 if(x[0] > par[1])
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];
5312f439 2175 else
48265b32 2176 val = 0;
2177 return val;
2178}
2179
2180//__________________________________________________________________
a6e0ebfe 2181TCanvas* AliTPCMonitor::CreateCanvas(const Char_t* name)
48265b32 2182{
5312f439 2183 // Create Canvases
48265b32 2184
2185 TCanvas* canv =0;
2186
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();
5dbad769 2192
2193 TString sname=name;
48265b32 2194 // ROC 2dim max distribution
5dbad769 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; }
48265b32 2197 // ROC 2dim rms distribution
5dbad769 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; }
48265b32 2200 // Global ADC max Histos
5dbad769 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; }
48265b32 2203 // 1 dim max sum basekine distribution
5dbad769 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; }
48265b32 2208 // Projections of single channel
5dbad769 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; }
48265b32 2211 // FFT for single channel
5dbad769 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; }
48265b32 2216 // row profile histograms
5dbad769 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; }
48265b32 2220 else { cout << " Warning Canvas name unknown " << endl; return 0 ; }
2221}
2222
2223//__________________________________________________________________
2224void AliTPCMonitor::WriteHistos()
2225{
2226 // Writes all available histograms to a file in current directory
5312f439 2227 // File name will be specified by : sector, side, runid and eventnumber
48265b32 2228
2229 if(GetEventProcessed())
5312f439 2230 {
2231 AliInfo("Write histos to file");
5dbad769 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");
5312f439 2234 for(Int_t i =0; i<fHistList->GetEntries(); i++)
48265b32 2235 {
5312f439 2236 if(((TH1*)fHistList->At(i))!=0)
2237 {
2238 ((TH1*)fHistList->At(i))->Write();
2239 }
48265b32 2240 }
5312f439 2241 f->ls();
2242 f->Close();
2243 }
48265b32 2244 else
5312f439 2245 {
2246 AliError("No Event Processed : Chose Format , File and push 'Next Event' ");
2247 }
48265b32 2248}
2249
2250
2251//__________________________________________________________________
2252TH1* AliTPCMonitor::GetHisto(char* histname)
2253{
2254
2255 // Returns histogram specified by histname
2256 // check available names for histos in CreateHistos()
2257
2258 TH1* hist = 0;
2259 if((TH1*)fHistList->FindObject(histname))
5312f439 2260 {
2261 hist = (TH1*)fHistList->FindObject(histname);
2262 }
2263 else
2264 {
2265 cout << " AliTPCMonitor::GetHisto :: Can not find histo with name " << histname << endl;
2266 }
48265b32 2267 return hist ;
2268}