1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Produces the data needed to calculate the quality assurance.
19 All data must be mergeable objects.
23 // --- ROOT system ---
24 #include <TClonesArray.h>
30 // --- Standard library ---
32 // --- AliRoot header files ---
34 #include "AliESDEvent.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"
46 ClassImp(AliPMDQADataMakerRec)
48 //____________________________________________________________________________
49 AliPMDQADataMakerRec::AliPMDQADataMakerRec() :
50 AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kPMD), "PMD Quality Assurance Data Maker")
55 //____________________________________________________________________________
56 AliPMDQADataMakerRec::AliPMDQADataMakerRec(const AliPMDQADataMakerRec& qadm) :
60 SetName((const char*)qadm.GetName()) ;
61 SetTitle((const char*)qadm.GetTitle());
64 //__________________________________________________________________
65 AliPMDQADataMakerRec& AliPMDQADataMakerRec::operator = (const AliPMDQADataMakerRec& qadm )
68 this->~AliPMDQADataMakerRec();
69 new(this) AliPMDQADataMakerRec(qadm);
74 //____________________________________________________________________________
75 void AliPMDQADataMakerRec::InitRaws()
77 // create Raws histograms in Raws subdir
79 const Bool_t expert = kTRUE ;
80 const Bool_t saveCorr = kTRUE ;
81 const Bool_t image = kTRUE ;
83 TH1F *hCellAdcPRE = new TH1F("hCellAdcPRE", "Cell Wise ADC fill for PRE Shower Plane;Cells in SMN-ROW-COL;ADC", 234795, 0, 234795);
85 Add2RawsList(hCellAdcPRE, 0, !expert, image, !saveCorr);
88 TH1F *hCellAdcCPV = new TH1F("hCellAdcCPV", "Cell Wise ADC fill for CPV Veto Plane;Cells in SMN-ROW-COL;ADC", 234795, 0, 234795);
90 Add2RawsList(hCellAdcCPV, 1, !expert, image, !saveCorr);
93 TH1F *hCalibEntPRE = new TH1F("hCalibEntPRE", "Cell Wise Frequency for PRE Shower Plane;Cells in SMN-ROW-COL;Frequency", 234795, 0, 234795);
95 Add2RawsList(hCalibEntPRE, 2, !expert, image, !saveCorr);
98 TH1F *hCellEntCPV = new TH1F("hCellEntCPV", "Cell Wise Frequency for CPV Veto Plane;Cells in SMN-ROW-COL;Frequency", 234795, 0, 234795);
100 Add2RawsList(hCellEntCPV, 3, !expert, image, !saveCorr);
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);
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);
109 ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
112 //____________________________________________________________________________
113 void AliPMDQADataMakerRec::InitDigits()
115 // create Digits histograms in Digits subdir
116 const Bool_t expert = kTRUE ;
117 const Bool_t image = kTRUE ;
119 TH1F *h0 = new TH1F("hPreDigitsEdep","Digits energy distribution in PRE(PMD);Amplitude [ADC counts];Counts", 100, 0., 2000.);
121 Add2DigitsList(h0, 0, !expert, image);
123 TH1F *h1 = new TH1F("hCpvDigitsEdep","Digits energy distribution in CPV(PMD);Amplitude [ADC counts];Counts", 100, 0., 2000.);
125 Add2DigitsList(h1, 1, !expert, image);
127 TH1I *h2 = new TH1I("hPreDigitsMult","Digits multiplicity distribution in PRE(PMD);# of Digits;Entries", 500, 0, 1000) ;
129 Add2DigitsList(h2, 2, !expert, image);
131 TH1I *h3 = new TH1I("hCpvDigitsMult","Digits multiplicity distribution in CPV(PMD);# of Digits;Entries", 500, 0, 1000);
133 Add2DigitsList(h3, 3, !expert, image);
135 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
138 //____________________________________________________________________________
139 void AliPMDQADataMakerRec::InitRecPoints()
141 // create Reconstructed Points histograms in RecPoints subdir
144 TH2F * h0 = new TH2F("hPreXY","RecPoints Y vs X PRE(PMD)", 100,-100.,100.,100,-100.,100.);
145 Add2RecPointsList(h0,0);
147 TH2F * h1 = new TH2F("hCpvXY","RecPoints Y vs X CPV(PMD)", 100,-100.,100.,100,-100.,100.);
148 Add2RecPointsList(h1,1);
151 // Ncell distribution in a cluster
155 const Bool_t expert = kTRUE ;
156 const Bool_t image = kTRUE ;
158 TH1F * h0 = new TH1F("hPreDdl0Ncell","PRE: Ddl0 Ncell in a cluster;# of cells;Counts",50,0.,50.);
160 Add2RecPointsList(h0, 0, !expert, image);
163 TH1F * h1 = new TH1F("hPreDdl1Ncell","PRE: Ddl1 Ncell in a cluste;# of cells;Countsr",50,0.,50.);
165 Add2RecPointsList(h1, 1, !expert, image);
168 TH1F * h2 = new TH1F("hPreDdl2Ncell","PRE: Ddl2 Ncell in a cluster;# of cells;Counts",50,0.,50.);
170 Add2RecPointsList(h2, 2, !expert, image);
173 TH1F * h3 = new TH1F("hPreDdl3Ncell","PRE: Ddl3 Ncell in a cluster;# of cells;Counts",50,0.,50.);
175 Add2RecPointsList(h3, 3, !expert, image);
179 TH1F * h4 = new TH1F("hCpvDdl4Ncell","CPV: Ddl4 Ncell in a cluster;# of cells;Counts",50,0.,50.);
181 Add2RecPointsList(h4, 4, !expert, image);
183 TH1F * h5 = new TH1F("hCpvDdl5Ncell","CPV: Ddl5 Ncell in a cluster;# of cells;Counts",50,0.,50.);
185 Add2RecPointsList(h5, 5, !expert, image);
189 TH2I *h6 = new TH2I("hPre10","Cluster - DDL1 vs DDL0;DDL0;DDL1", 100,0,200,100,0,200);
190 Add2RecPointsList(h6,6, !expert, image);
192 TH2I *h7 = new TH2I("hPre32","Cluster - DDL3 vs DDL2;DDL2;DDL3", 100,0,200,100,0,200);
193 Add2RecPointsList(h7,7, !expert, image);
195 TH2I *h8 = new TH2I("hCpv54","Cluster - DDL5 vs DDL4;DDL4;DDL5", 100,0,200,100,0,200);
196 Add2RecPointsList(h8,8, !expert, image);
198 ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
201 //____________________________________________________________________________
203 void AliPMDQADataMakerRec::InitESDs()
205 //Create histograms to controll ESD
207 const Bool_t expert = kTRUE ;
208 const Bool_t image = kTRUE ;
210 TH1F *h0 = new TH1F("hPreClADC","Cluster ADC of PRE plane;# of clusters;Counts",500,0.,10000.);
212 Add2ESDsList(h0, 0, !expert, image) ;
214 TH1F *h1 = new TH1F("hCpvClADC","Cluster ADC of CPV plane;# of clusters;Counts",500,0.,10000.);
216 Add2ESDsList(h1, 1, !expert, image) ;
218 TH2I *h2 = new TH2I("hPmdClMult","Cluster Multiplicity: PRE vs. CPVplane;CPV multiplicity;PRE Multiplicity",100,0,1000,100,0,1000);
220 Add2ESDsList(h2, 2, !expert, image) ;
223 TH1I * h3 = new TH1I("hCpvClMult","Cluster Multiplicity of CPV plane",100,0.,1000.);
225 Add2ESDsList(h3, 3, !expert, image) ;
228 ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
231 //____________________________________________________________________________
232 void AliPMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
234 //Fill prepared histograms with Raw digit properties
236 TObjArray *pmdddlcont = 0x0;
237 pmdddlcont = new TObjArray();
238 AliPMDRawStream stream(rawReader);
240 AliPMDddldata *pmdddl = 0x0;
245 Float_t xx = 0., yy = 0.;
249 while ((iddl = stream.DdlData(pmdddlcont)) >=0)
251 Int_t ientries = pmdddlcont->GetEntries();
252 //printf(" ======= DDLNO = %d ientries = %d \n", iddl, ientries);
254 for (Int_t ient = 0; ient < ientries; ient++)
256 //AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont->UncheckedAt(ient);
257 pmdddl = (AliPMDddldata*)pmdddlcont->UncheckedAt(ient);
259 Int_t det = pmdddl->GetDetector();
260 Int_t smn = pmdddl->GetSMN();
261 Int_t mcm = pmdddl->GetMCM();
262 //Int_t chno = pmdddl->GetChannel();
263 Int_t row = pmdddl->GetRow();
264 Int_t col = pmdddl->GetColumn();
265 Int_t sig = pmdddl->GetSignal();
267 if (mcm == 0) continue;
268 if (det < 0 || det > 1) continue;
269 if (smn < 0 || smn > 23) continue;
270 if (row < 0 || row > 47) continue;
271 if (col < 0 || col > 95) continue;
273 Int_t ipp = 10000*smn + 100*row + col;
277 FillRawsData(0,ipp, sig);
285 else if(smn >= 12 && smn < 24)
292 cc.RectGeomCellPos(smn,xpad,ypad,xx,yy);
293 FillRawsData(4,xx,yy);
297 FillRawsData(1,ipp, sig);
305 else if(smn >= 12 && smn < 24)
311 cc.RectGeomCellPos(smn,xpad,ypad,xx,yy);
312 FillRawsData(5,xx,yy);
318 pmdddlcont->Delete();
324 IncEvCountCycleRaws();
325 IncEvCountTotalRaws();
328 //____________________________________________________________________________
329 void AliPMDQADataMakerRec::MakeDigits()
331 // makes data from Digits
333 Int_t cpvmul = 0, premul = 0;
335 TIter next(fDigitsArray) ;
336 AliPMDdigit * digit ;
337 while ( (digit = dynamic_cast<AliPMDdigit *>(next())) )
339 if(digit->GetDetector() == 0)
341 FillDigitsData(0, digit->GetADC()) ;
344 if(digit->GetDetector() == 1)
346 FillDigitsData(1, digit->GetADC());
351 if (premul > 0) FillDigitsData(2,premul);
352 if (cpvmul > 0) FillDigitsData(3,cpvmul);
357 //____________________________________________________________________________
358 void AliPMDQADataMakerRec::MakeDigits(TTree * digitTree)
360 // makes data from Digit Tree
363 fDigitsArray->Clear() ;
365 fDigitsArray = new TClonesArray("AliPMDdigit", 1000) ;
367 TBranch * branch = digitTree->GetBranch("PMDDigit") ;
368 if ( ! branch ) {AliWarning("PMD branch in Digit Tree not found"); return;}
370 branch->SetAddress(&fDigitsArray) ;
371 for (Int_t ient = 0; ient < branch->GetEntries(); ient++) {
372 branch->GetEntry(ient) ;
376 IncEvCountCycleDigits();
377 IncEvCountTotalDigits();
381 //____________________________________________________________________________
382 void AliPMDQADataMakerRec::MakeRecPoints(TTree * clustersTree)
384 // makes data from RecPoints
386 Int_t multDdl0 = 0, multDdl1 = 0, multDdl2 = 0;
387 Int_t multDdl3 = 0, multDdl4 = 0, multDdl5 = 0;
389 AliPMDrecpoint1 * recpoint;
392 fRecPointsArray->Clear() ;
394 fRecPointsArray = new TClonesArray("AliPMDrecpoint1", 1000) ;
396 TBranch * branch = clustersTree->GetBranch("PMDRecpoint") ;
400 AliWarning("PMD branch in Recpoints Tree not found") ;
404 branch->SetAddress(&fRecPointsArray) ;
406 for (Int_t imod = 0; imod < branch->GetEntries(); imod++)
408 branch->GetEntry(imod) ;
410 TIter next(fRecPointsArray) ;
412 while ( (recpoint = dynamic_cast<AliPMDrecpoint1 *>(next())) )
414 //Float_t xpos = recpoint->GetClusX();
415 //Float_t ypos = recpoint->GetClusY();
416 //Int_t smn = recpoint->GetSMNumber();
418 if(recpoint->GetDetector() == 0)
420 if(recpoint->GetSMNumber() >= 0 && recpoint->GetSMNumber() < 6)
422 FillRecPointsData(0,recpoint->GetClusCells());
425 if(recpoint->GetSMNumber() >= 6 && recpoint->GetSMNumber() < 12)
427 FillRecPointsData(1,recpoint->GetClusCells());
430 if(recpoint->GetSMNumber() >= 12 && recpoint->GetSMNumber() < 18)
432 FillRecPointsData(2,recpoint->GetClusCells());
435 if(recpoint->GetSMNumber() >= 18 && recpoint->GetSMNumber() < 24)
437 FillRecPointsData(3,recpoint->GetClusCells());
442 if(recpoint->GetDetector() == 1)
444 if((recpoint->GetSMNumber() >= 0 && recpoint->GetSMNumber() < 6) ||
445 (recpoint->GetSMNumber() >= 18 && recpoint->GetSMNumber() < 24))
447 FillRecPointsData(4,recpoint->GetClusCells());
450 if(recpoint->GetSMNumber() >= 6 && recpoint->GetSMNumber() < 18 )
452 FillRecPointsData(5,recpoint->GetClusCells());
460 FillRecPointsData(6,multDdl0,multDdl1);
461 FillRecPointsData(7,multDdl2,multDdl3);
462 FillRecPointsData(8,multDdl4,multDdl5);
464 IncEvCountCycleRecPoints();
465 IncEvCountTotalRecPoints();
469 //____________________________________________________________________________
471 void AliPMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
473 // make QA data from ESDs
475 Int_t premul = 0, cpvmul = 0;
477 for (Int_t icl = 0; icl < esd->GetNumberOfPmdTracks(); icl++)
479 AliESDPmdTrack *pmdtr = esd->GetPmdTrack(icl);
481 //Int_t det = pmdtr->GetDetector();
482 //Float_t clsX = pmdtr->GetClusterX();
483 //Float_t clsY = pmdtr->GetClusterY();
484 //Float_t clsZ = pmdtr->GetClusterZ();
485 //Float_t ncell = pmdtr->GetClusterCells();
486 Float_t adc = pmdtr->GetClusterADC();
487 //Float_t pid = pmdtr->GetClusterPID();
489 if (pmdtr->GetDetector() == 0)
494 if (pmdtr->GetDetector() == 1)
496 FillESDsData(1,adc) ;
501 FillESDsData(2,cpvmul,premul) ;
502 //FillESDsData(3,cpvmul) ;
504 IncEvCountCycleESDs();
505 IncEvCountTotalESDs();
509 //____________________________________________________________________________
511 void AliPMDQADataMakerRec::StartOfDetectorCycle()
513 //Detector specific actions at start of cycle
516 //____________________________________________________________________________
517 void AliPMDQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
519 //Detector specific actions at end of cycle
520 // do the QA checking
521 AliQAChecker::Instance()->Run(AliQAv1::kPMD, task, list) ;