]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PMD/AliPMDQADataMakerRec.cxx
several changes: 1) check for overflow before fitting, not using fit results 2) keep...
[u/mrichter/AliRoot.git] / PMD / AliPMDQADataMakerRec.cxx
... / ...
CommitLineData
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 *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16
17/*
18 Produces the data needed to calculate the quality assurance.
19 All data must be mergeable objects.
20 B.K. Nandi
21*/
22
23// --- ROOT system ---
24#include <TClonesArray.h>
25#include <TFile.h>
26#include <TH1F.h>
27#include <TH1I.h>
28#include <TH2F.h>
29
30// --- Standard library ---
31
32// --- AliRoot header files ---
33
34#include "AliESDEvent.h"
35#include "AliLog.h"
36#include "AliPMDQADataMakerRec.h"
37#include "AliQAChecker.h"
38#include "AliPMDdigit.h"
39#include "AliPMDrecpoint1.h"
40#include "AliPMDRawStream.h"
41#include "AliPMDddldata.h"
42#include "AliPMDUtility.h"
43#include "AliESDPmdTrack.h"
44//#include "AliPMDRecoParam.h"
45
46ClassImp(AliPMDQADataMakerRec)
47
48//____________________________________________________________________________
49 AliPMDQADataMakerRec::AliPMDQADataMakerRec() :
50 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kPMD), "PMD Quality Assurance Data Maker")
51{
52 // ctor
53}
54
55//____________________________________________________________________________
56AliPMDQADataMakerRec::AliPMDQADataMakerRec(const AliPMDQADataMakerRec& qadm) :
57 AliQADataMakerRec()
58{
59 //copy ctor
60 SetName((const char*)qadm.GetName()) ;
61 SetTitle((const char*)qadm.GetTitle());
62}
63
64//__________________________________________________________________
65AliPMDQADataMakerRec& AliPMDQADataMakerRec::operator = (const AliPMDQADataMakerRec& qadm )
66{
67 // Equal operator.
68 this->~AliPMDQADataMakerRec();
69 new(this) AliPMDQADataMakerRec(qadm);
70 return *this;
71}
72
73
74//____________________________________________________________________________
75void AliPMDQADataMakerRec::InitRaws()
76{
77 // create Raws histograms in Raws subdir
78
79 const Bool_t expert = kTRUE ;
80 const Bool_t saveCorr = kTRUE ;
81 const Bool_t image = kTRUE ;
82
83 TH1F *hCellAdcPRE = new TH1F("hCellAdcPRE", "Cell Wise ADC fill for PRE Shower Plane;Cells in SMN-ROW-COL;ADC", 234795, 0, 234795);
84
85 Add2RawsList(hCellAdcPRE, 0, !expert, image, !saveCorr);
86
87
88 TH1F *hCellAdcCPV = new TH1F("hCellAdcCPV", "Cell Wise ADC fill for CPV Veto Plane;Cells in SMN-ROW-COL;ADC", 234795, 0, 234795);
89
90 Add2RawsList(hCellAdcCPV, 1, !expert, image, !saveCorr);
91
92
93 TH1F *hCalibEntPRE = new TH1F("hCalibEntPRE", "Cell Wise Frequency for PRE Shower Plane;Cells in SMN-ROW-COL;Frequency", 234795, 0, 234795);
94
95 Add2RawsList(hCalibEntPRE, 2, !expert, image, !saveCorr);
96
97
98 TH1F *hCellEntCPV = new TH1F("hCellEntCPV", "Cell Wise Frequency for CPV Veto Plane;Cells in SMN-ROW-COL;Frequency", 234795, 0, 234795);
99
100 Add2RawsList(hCellEntCPV, 3, !expert, image, !saveCorr);
101
102
103 TH2F *hPreXY = new TH2F("hPreXY","PRE plane;X [cm];Y [cm]",200,-100.,100.,200,-100.,100.);
104 Add2RawsList(hPreXY, 4, !expert, !image, saveCorr);
105
106 TH2F *hCpvXY = new TH2F("hCpvXY","CPV plane;X [cm];Y [cm]",200,-100.,100.,200,-100.,100.);
107 Add2RawsList(hCpvXY, 5, !expert, !image, saveCorr);
108
109
110}
111
112//____________________________________________________________________________
113void AliPMDQADataMakerRec::InitDigits()
114{
115 // create Digits histograms in Digits subdir
116 const Bool_t expert = kTRUE ;
117 const Bool_t image = kTRUE ;
118
119 TH1F *h0 = new TH1F("hPreDigitsEdep","Digits energy distribution in PRE(PMD);Amplitude [ADC counts];Counts", 100, 0., 2000.);
120 h0->Sumw2();
121 Add2DigitsList(h0, 0, !expert, image);
122
123 TH1F *h1 = new TH1F("hCpvDigitsEdep","Digits energy distribution in CPV(PMD);Amplitude [ADC counts];Counts", 100, 0., 2000.);
124 h1->Sumw2();
125 Add2DigitsList(h1, 1, !expert, image);
126
127 TH1I *h2 = new TH1I("hPreDigitsMult","Digits multiplicity distribution in PRE(PMD);# of Digits;Entries", 500, 0, 1000) ;
128 h2->Sumw2();
129 Add2DigitsList(h2, 2, !expert, image);
130
131 TH1I *h3 = new TH1I("hCpvDigitsMult","Digits multiplicity distribution in CPV(PMD);# of Digits;Entries", 500, 0, 1000);
132 h3->Sumw2();
133 Add2DigitsList(h3, 3, !expert, image);
134}
135
136//____________________________________________________________________________
137void AliPMDQADataMakerRec::InitRecPoints()
138{
139 // create Reconstructed Points histograms in RecPoints subdir
140
141 /*
142 TH2F * h0 = new TH2F("hPreXY","RecPoints Y vs X PRE(PMD)", 100,-100.,100.,100,-100.,100.);
143 Add2RecPointsList(h0,0);
144
145 TH2F * h1 = new TH2F("hCpvXY","RecPoints Y vs X CPV(PMD)", 100,-100.,100.,100,-100.,100.);
146 Add2RecPointsList(h1,1);
147 */
148
149 // Ncell distribution in a cluster
150
151 // PRE plane
152
153 const Bool_t expert = kTRUE ;
154 const Bool_t image = kTRUE ;
155
156 TH1F * h0 = new TH1F("hPreDdl0Ncell","PRE: Ddl0 Ncell in a cluster;# of cells;Counts",50,0.,50.);
157 h0->Sumw2();
158 Add2RecPointsList(h0, 0, !expert, image);
159
160
161 TH1F * h1 = new TH1F("hPreDdl1Ncell","PRE: Ddl1 Ncell in a cluste;# of cells;Countsr",50,0.,50.);
162 h1->Sumw2();
163 Add2RecPointsList(h1, 1, !expert, image);
164
165
166 TH1F * h2 = new TH1F("hPreDdl2Ncell","PRE: Ddl2 Ncell in a cluster;# of cells;Counts",50,0.,50.);
167 h2->Sumw2();
168 Add2RecPointsList(h2, 2, !expert, image);
169
170
171 TH1F * h3 = new TH1F("hPreDdl3Ncell","PRE: Ddl3 Ncell in a cluster;# of cells;Counts",50,0.,50.);
172 h3->Sumw2();
173 Add2RecPointsList(h3, 3, !expert, image);
174
175 // CPV plane
176
177 TH1F * h4 = new TH1F("hCpvDdl4Ncell","CPV: Ddl4 Ncell in a cluster;# of cells;Counts",50,0.,50.);
178 h4->Sumw2();
179 Add2RecPointsList(h4, 4, !expert, image);
180
181 TH1F * h5 = new TH1F("hCpvDdl5Ncell","CPV: Ddl5 Ncell in a cluster;# of cells;Counts",50,0.,50.);
182 h5->Sumw2();
183 Add2RecPointsList(h5, 5, !expert, image);
184
185 // Correlation plot
186
187 TH2I *h6 = new TH2I("hPre10","Cluster - DDL1 vs DDL0;DDL0;DDL1", 100,0,200,100,0,200);
188 Add2RecPointsList(h6,6, !expert, image);
189
190 TH2I *h7 = new TH2I("hPre32","Cluster - DDL3 vs DDL2;DDL2;DDL3", 100,0,200,100,0,200);
191 Add2RecPointsList(h7,7, !expert, image);
192
193 TH2I *h8 = new TH2I("hCpv54","Cluster - DDL5 vs DDL4;DDL4;DDL5", 100,0,200,100,0,200);
194 Add2RecPointsList(h8,8, !expert, image);
195
196
197
198}
199
200//____________________________________________________________________________
201
202void AliPMDQADataMakerRec::InitESDs()
203{
204 //Create histograms to controll ESD
205
206 const Bool_t expert = kTRUE ;
207 const Bool_t image = kTRUE ;
208
209 TH1F *h0 = new TH1F("hPreClADC","Cluster ADC of PRE plane;# of clusters;Counts",500,0.,10000.);
210 h0->Sumw2();
211 Add2ESDsList(h0, 0, !expert, image) ;
212
213 TH1F *h1 = new TH1F("hCpvClADC","Cluster ADC of CPV plane;# of clusters;Counts",500,0.,10000.);
214 h1->Sumw2();
215 Add2ESDsList(h1, 1, !expert, image) ;
216
217 TH2I *h2 = new TH2I("hPmdClMult","Cluster Multiplicity: PRE vs. CPVplane;CPV multiplicity;PRE Multiplicity",100,0,1000,100,0,1000);
218 h2->Sumw2();
219 Add2ESDsList(h2, 2, !expert, image) ;
220
221/*
222 TH1I * h3 = new TH1I("hCpvClMult","Cluster Multiplicity of CPV plane",100,0.,1000.);
223 h3->Sumw2();
224 Add2ESDsList(h3, 3, !expert, image) ;
225*/
226
227}
228
229//____________________________________________________________________________
230void AliPMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
231{
232 //Fill prepared histograms with Raw digit properties
233
234 TObjArray *pmdddlcont = 0x0;
235 pmdddlcont = new TObjArray();
236 AliPMDRawStream stream(rawReader);
237
238 AliPMDddldata *pmdddl = 0x0;
239
240 Int_t iddl = -1;
241 Int_t xpad = -1;
242 Int_t ypad = -1;
243 Float_t xx, yy;
244
245 AliPMDUtility cc;
246
247 while ((iddl = stream.DdlData(pmdddlcont)) >=0)
248 {
249 Int_t ientries = pmdddlcont->GetEntries();
250 //printf(" ======= DDLNO = %d ientries = %d \n", iddl, ientries);
251
252 for (Int_t ient = 0; ient < ientries; ient++)
253 {
254 //AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont->UncheckedAt(ient);
255 pmdddl = (AliPMDddldata*)pmdddlcont->UncheckedAt(ient);
256
257 Int_t det = pmdddl->GetDetector();
258 Int_t smn = pmdddl->GetSMN();
259 Int_t mcm = pmdddl->GetMCM();
260 //Int_t chno = pmdddl->GetChannel();
261 Int_t row = pmdddl->GetRow();
262 Int_t col = pmdddl->GetColumn();
263 Int_t sig = pmdddl->GetSignal();
264
265 if (mcm == 0) continue;
266 if (det < 0 || det > 1) continue;
267 if (smn < 0 || smn > 23) continue;
268 if (row < 0 || row > 47) continue;
269 if (col < 0 || col > 95) continue;
270
271 Int_t ipp = 10000*smn + 100*row + col;
272
273 if (det == 0)
274 {
275 GetRawsData(0)->Fill(ipp, sig);
276 GetRawsData(2)->Fill(ipp);
277
278 if(smn < 12)
279 {
280 xpad = col;
281 ypad = row;
282 }
283 else if(smn >= 12 && smn < 24)
284 {
285 xpad = row;
286 ypad = col;
287 }
288
289
290 cc.RectGeomCellPos(smn,xpad,ypad,xx,yy);
291 GetRawsData(4)->Fill(xx,yy);
292 }
293 if (det == 1)
294 {
295 GetRawsData(1)->Fill(ipp, sig);
296 GetRawsData(3)->Fill(ipp);
297
298 if(smn < 12)
299 {
300 xpad = col;
301 ypad = row;
302 }
303 else if(smn >= 12 && smn < 24)
304 {
305 xpad = row;
306 ypad = col;
307 }
308
309 cc.RectGeomCellPos(smn,xpad,ypad,xx,yy);
310 GetRawsData(5)->Fill(xx,yy);
311
312 }
313
314 }
315
316 pmdddlcont->Delete();
317 }
318
319 delete pmdddlcont;
320 pmdddlcont = 0x0;
321
322}
323//____________________________________________________________________________
324void AliPMDQADataMakerRec::MakeDigits()
325{
326 // makes data from Digits
327
328 Int_t cpvmul = 0, premul = 0;
329
330 TIter next(fDigitsArray) ;
331 AliPMDdigit * digit ;
332 while ( (digit = dynamic_cast<AliPMDdigit *>(next())) )
333 {
334 if(digit->GetDetector() == 0)
335 {
336 GetDigitsData(0)->Fill( digit->GetADC()) ;
337 premul++;
338 }
339 if(digit->GetDetector() == 1)
340 {
341 GetDigitsData(1)->Fill( digit->GetADC());
342 cpvmul++;
343 }
344 }
345
346 if (premul > 0) GetDigitsData(2)->Fill(premul);
347 if (cpvmul > 0) GetDigitsData(3)->Fill(cpvmul);
348
349
350}
351
352//____________________________________________________________________________
353void AliPMDQADataMakerRec::MakeDigits(TTree * digitTree)
354{
355 // makes data from Digit Tree
356
357 if (fDigitsArray)
358 fDigitsArray->Clear() ;
359 else
360 fDigitsArray = new TClonesArray("AliPMDdigit", 1000) ;
361
362 TBranch * branch = digitTree->GetBranch("PMDDigit") ;
363 branch->SetAddress(&fDigitsArray) ;
364
365 if ( ! branch )
366 {
367 AliWarning("PMD branch in Digit Tree not found") ;
368 }
369 else
370 {
371 for (Int_t ient = 0; ient < branch->GetEntries(); ient++)
372 {
373 branch->GetEntry(ient) ;
374 MakeDigits() ;
375 }
376
377 }
378}
379
380//____________________________________________________________________________
381void AliPMDQADataMakerRec::MakeRecPoints(TTree * clustersTree)
382{
383 // makes data from RecPoints
384
385 Int_t multDdl0 = 0, multDdl1 = 0, multDdl2 = 0;
386 Int_t multDdl3 = 0, multDdl4 = 0, multDdl5 = 0;
387
388 AliPMDrecpoint1 * recpoint;
389
390 if (fRecPointsArray)
391 fRecPointsArray->Clear() ;
392 else
393 fRecPointsArray = new TClonesArray("AliPMDrecpoint1", 1000) ;
394
395 TBranch * branch = clustersTree->GetBranch("PMDRecpoint") ;
396 branch->SetAddress(&fRecPointsArray) ;
397
398 if ( ! branch )
399 {
400 AliWarning("PMD branch in Recpoints Tree not found") ;
401 }
402 else
403 {
404 for (Int_t imod = 0; imod < branch->GetEntries(); imod++)
405 {
406 branch->GetEntry(imod) ;
407
408 TIter next(fRecPointsArray) ;
409
410 while ( (recpoint = dynamic_cast<AliPMDrecpoint1 *>(next())) )
411 {
412 //Float_t xpos = recpoint->GetClusX();
413 //Float_t ypos = recpoint->GetClusY();
414 //Int_t smn = recpoint->GetSMNumber();
415
416 if(recpoint->GetDetector() == 0)
417 {
418 if(recpoint->GetSMNumber() >= 0 && recpoint->GetSMNumber() < 6)
419 {
420 GetRecPointsData(0)->Fill(recpoint->GetClusCells());
421 multDdl0++;
422 }
423 if(recpoint->GetSMNumber() >= 6 && recpoint->GetSMNumber() < 12)
424 {
425 GetRecPointsData(1)->Fill(recpoint->GetClusCells());
426 multDdl1++;
427 }
428 if(recpoint->GetSMNumber() >= 12 && recpoint->GetSMNumber() < 18)
429 {
430 GetRecPointsData(2)->Fill(recpoint->GetClusCells());
431 multDdl2++;
432 }
433 if(recpoint->GetSMNumber() >= 18 && recpoint->GetSMNumber() < 24)
434 {
435 GetRecPointsData(3)->Fill(recpoint->GetClusCells());
436 multDdl3++;
437 }
438 }
439
440 if(recpoint->GetDetector() == 1)
441 {
442 if((recpoint->GetSMNumber() >= 0 && recpoint->GetSMNumber() < 6) ||
443 (recpoint->GetSMNumber() >= 18 && recpoint->GetSMNumber() < 24))
444 {
445 GetRecPointsData(4)->Fill(recpoint->GetClusCells());
446 multDdl4++;
447 }
448 if(recpoint->GetSMNumber() >= 6 && recpoint->GetSMNumber() < 18 )
449 {
450 GetRecPointsData(5)->Fill(recpoint->GetClusCells());
451 multDdl5++;
452 }
453 }
454 }
455 }
456 }
457
458 GetRecPointsData(6)->Fill(multDdl0,multDdl1);
459 GetRecPointsData(7)->Fill(multDdl2,multDdl3);
460 GetRecPointsData(8)->Fill(multDdl4,multDdl5);
461}
462
463//____________________________________________________________________________
464
465void AliPMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
466{
467 // make QA data from ESDs
468
469 Int_t premul = 0, cpvmul = 0;
470
471 for (Int_t icl = 0; icl < esd->GetNumberOfPmdTracks(); icl++)
472 {
473 AliESDPmdTrack *pmdtr = esd->GetPmdTrack(icl);
474
475 //Int_t det = pmdtr->GetDetector();
476 //Float_t clsX = pmdtr->GetClusterX();
477 //Float_t clsY = pmdtr->GetClusterY();
478 //Float_t clsZ = pmdtr->GetClusterZ();
479 //Float_t ncell = pmdtr->GetClusterCells();
480 Float_t adc = pmdtr->GetClusterADC();
481 //Float_t pid = pmdtr->GetClusterPID();
482
483 if (pmdtr->GetDetector() == 0)
484 {
485 GetESDsData(0)->Fill(adc);
486 premul++;
487 }
488 if (pmdtr->GetDetector() == 1)
489 {
490 GetESDsData(1)->Fill(adc) ;
491 cpvmul++;
492 }
493 }
494
495 GetESDsData(2)->Fill(cpvmul,premul) ;
496 //GetESDsData(3)->Fill(cpvmul) ;
497}
498
499//____________________________________________________________________________
500
501void AliPMDQADataMakerRec::StartOfDetectorCycle()
502{
503 //Detector specific actions at start of cycle
504
505}
506//____________________________________________________________________________
507void AliPMDQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
508{
509 //Detector specific actions at end of cycle
510 // do the QA checking
511 AliQAChecker::Instance()->Run(AliQAv1::kPMD, task, list) ;
512}