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