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);
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);
136 //____________________________________________________________________________
137 void AliPMDQADataMakerRec::InitRecPoints()
139 // create Reconstructed Points histograms in RecPoints subdir
142 TH2F * h0 = new TH2F("hPreXY","RecPoints Y vs X PRE(PMD)", 100,-100.,100.,100,-100.,100.);
143 Add2RecPointsList(h0,0);
145 TH2F * h1 = new TH2F("hCpvXY","RecPoints Y vs X CPV(PMD)", 100,-100.,100.,100,-100.,100.);
146 Add2RecPointsList(h1,1);
149 // Ncell distribution in a cluster
153 const Bool_t expert = kTRUE ;
154 const Bool_t image = kTRUE ;
156 TH1F * h0 = new TH1F("hPreDdl0Ncell","PRE: Ddl0 Ncell in a cluster;# of cells;Counts",50,0.,50.);
158 Add2RecPointsList(h0, 0, !expert, image);
161 TH1F * h1 = new TH1F("hPreDdl1Ncell","PRE: Ddl1 Ncell in a cluste;# of cells;Countsr",50,0.,50.);
163 Add2RecPointsList(h1, 1, !expert, image);
166 TH1F * h2 = new TH1F("hPreDdl2Ncell","PRE: Ddl2 Ncell in a cluster;# of cells;Counts",50,0.,50.);
168 Add2RecPointsList(h2, 2, !expert, image);
171 TH1F * h3 = new TH1F("hPreDdl3Ncell","PRE: Ddl3 Ncell in a cluster;# of cells;Counts",50,0.,50.);
173 Add2RecPointsList(h3, 3, !expert, image);
177 TH1F * h4 = new TH1F("hCpvDdl4Ncell","CPV: Ddl4 Ncell in a cluster;# of cells;Counts",50,0.,50.);
179 Add2RecPointsList(h4, 4, !expert, image);
181 TH1F * h5 = new TH1F("hCpvDdl5Ncell","CPV: Ddl5 Ncell in a cluster;# of cells;Counts",50,0.,50.);
183 Add2RecPointsList(h5, 5, !expert, image);
187 TH2I *h6 = new TH2I("hPre10","Cluster - DDL1 vs DDL0;DDL0;DDL1", 100,0,200,100,0,200);
188 Add2RecPointsList(h6,6, !expert, image);
190 TH2I *h7 = new TH2I("hPre32","Cluster - DDL3 vs DDL2;DDL2;DDL3", 100,0,200,100,0,200);
191 Add2RecPointsList(h7,7, !expert, image);
193 TH2I *h8 = new TH2I("hCpv54","Cluster - DDL5 vs DDL4;DDL4;DDL5", 100,0,200,100,0,200);
194 Add2RecPointsList(h8,8, !expert, image);
200 //____________________________________________________________________________
202 void AliPMDQADataMakerRec::InitESDs()
204 //Create histograms to controll ESD
206 const Bool_t expert = kTRUE ;
207 const Bool_t image = kTRUE ;
209 TH1F *h0 = new TH1F("hPreClADC","Cluster ADC of PRE plane;# of clusters;Counts",500,0.,10000.);
211 Add2ESDsList(h0, 0, !expert, image) ;
213 TH1F *h1 = new TH1F("hCpvClADC","Cluster ADC of CPV plane;# of clusters;Counts",500,0.,10000.);
215 Add2ESDsList(h1, 1, !expert, image) ;
217 TH2I *h2 = new TH2I("hPmdClMult","Cluster Multiplicity: PRE vs. CPVplane;CPV multiplicity;PRE Multiplicity",100,0,1000,100,0,1000);
219 Add2ESDsList(h2, 2, !expert, image) ;
222 TH1I * h3 = new TH1I("hCpvClMult","Cluster Multiplicity of CPV plane",100,0.,1000.);
224 Add2ESDsList(h3, 3, !expert, image) ;
229 //____________________________________________________________________________
230 void AliPMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
232 //Fill prepared histograms with Raw digit properties
234 TObjArray *pmdddlcont = 0x0;
235 pmdddlcont = new TObjArray();
236 AliPMDRawStream stream(rawReader);
238 AliPMDddldata *pmdddl = 0x0;
243 Float_t xx = 0., yy = 0.;
247 while ((iddl = stream.DdlData(pmdddlcont)) >=0)
249 Int_t ientries = pmdddlcont->GetEntries();
250 //printf(" ======= DDLNO = %d ientries = %d \n", iddl, ientries);
252 for (Int_t ient = 0; ient < ientries; ient++)
254 //AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont->UncheckedAt(ient);
255 pmdddl = (AliPMDddldata*)pmdddlcont->UncheckedAt(ient);
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();
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;
271 Int_t ipp = 10000*smn + 100*row + col;
275 GetRawsData(0)->Fill(ipp, sig);
276 GetRawsData(2)->Fill(ipp);
283 else if(smn >= 12 && smn < 24)
290 cc.RectGeomCellPos(smn,xpad,ypad,xx,yy);
291 GetRawsData(4)->Fill(xx,yy);
295 GetRawsData(1)->Fill(ipp, sig);
296 GetRawsData(3)->Fill(ipp);
303 else if(smn >= 12 && smn < 24)
309 cc.RectGeomCellPos(smn,xpad,ypad,xx,yy);
310 GetRawsData(5)->Fill(xx,yy);
316 pmdddlcont->Delete();
323 //____________________________________________________________________________
324 void AliPMDQADataMakerRec::MakeDigits()
326 // makes data from Digits
328 Int_t cpvmul = 0, premul = 0;
330 TIter next(fDigitsArray) ;
331 AliPMDdigit * digit ;
332 while ( (digit = dynamic_cast<AliPMDdigit *>(next())) )
334 if(digit->GetDetector() == 0)
336 GetDigitsData(0)->Fill( digit->GetADC()) ;
339 if(digit->GetDetector() == 1)
341 GetDigitsData(1)->Fill( digit->GetADC());
346 if (premul > 0) GetDigitsData(2)->Fill(premul);
347 if (cpvmul > 0) GetDigitsData(3)->Fill(cpvmul);
352 //____________________________________________________________________________
353 void AliPMDQADataMakerRec::MakeDigits(TTree * digitTree)
355 // makes data from Digit Tree
358 fDigitsArray->Clear() ;
360 fDigitsArray = new TClonesArray("AliPMDdigit", 1000) ;
362 TBranch * branch = digitTree->GetBranch("PMDDigit") ;
365 AliWarning("PMD branch in Digit Tree not found") ;
369 branch->SetAddress(&fDigitsArray) ;
370 for (Int_t ient = 0; ient < branch->GetEntries(); ient++)
372 branch->GetEntry(ient) ;
379 //____________________________________________________________________________
380 void AliPMDQADataMakerRec::MakeRecPoints(TTree * clustersTree)
382 // makes data from RecPoints
384 Int_t multDdl0 = 0, multDdl1 = 0, multDdl2 = 0;
385 Int_t multDdl3 = 0, multDdl4 = 0, multDdl5 = 0;
387 AliPMDrecpoint1 * recpoint;
390 fRecPointsArray->Clear() ;
392 fRecPointsArray = new TClonesArray("AliPMDrecpoint1", 1000) ;
394 TBranch * branch = clustersTree->GetBranch("PMDRecpoint") ;
398 AliWarning("PMD branch in Recpoints Tree not found") ;
402 branch->SetAddress(&fRecPointsArray) ;
404 for (Int_t imod = 0; imod < branch->GetEntries(); imod++)
406 branch->GetEntry(imod) ;
408 TIter next(fRecPointsArray) ;
410 while ( (recpoint = dynamic_cast<AliPMDrecpoint1 *>(next())) )
412 //Float_t xpos = recpoint->GetClusX();
413 //Float_t ypos = recpoint->GetClusY();
414 //Int_t smn = recpoint->GetSMNumber();
416 if(recpoint->GetDetector() == 0)
418 if(recpoint->GetSMNumber() >= 0 && recpoint->GetSMNumber() < 6)
420 GetRecPointsData(0)->Fill(recpoint->GetClusCells());
423 if(recpoint->GetSMNumber() >= 6 && recpoint->GetSMNumber() < 12)
425 GetRecPointsData(1)->Fill(recpoint->GetClusCells());
428 if(recpoint->GetSMNumber() >= 12 && recpoint->GetSMNumber() < 18)
430 GetRecPointsData(2)->Fill(recpoint->GetClusCells());
433 if(recpoint->GetSMNumber() >= 18 && recpoint->GetSMNumber() < 24)
435 GetRecPointsData(3)->Fill(recpoint->GetClusCells());
440 if(recpoint->GetDetector() == 1)
442 if((recpoint->GetSMNumber() >= 0 && recpoint->GetSMNumber() < 6) ||
443 (recpoint->GetSMNumber() >= 18 && recpoint->GetSMNumber() < 24))
445 GetRecPointsData(4)->Fill(recpoint->GetClusCells());
448 if(recpoint->GetSMNumber() >= 6 && recpoint->GetSMNumber() < 18 )
450 GetRecPointsData(5)->Fill(recpoint->GetClusCells());
458 GetRecPointsData(6)->Fill(multDdl0,multDdl1);
459 GetRecPointsData(7)->Fill(multDdl2,multDdl3);
460 GetRecPointsData(8)->Fill(multDdl4,multDdl5);
463 //____________________________________________________________________________
465 void AliPMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
467 // make QA data from ESDs
469 Int_t premul = 0, cpvmul = 0;
471 for (Int_t icl = 0; icl < esd->GetNumberOfPmdTracks(); icl++)
473 AliESDPmdTrack *pmdtr = esd->GetPmdTrack(icl);
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();
483 if (pmdtr->GetDetector() == 0)
485 GetESDsData(0)->Fill(adc);
488 if (pmdtr->GetDetector() == 1)
490 GetESDsData(1)->Fill(adc) ;
495 GetESDsData(2)->Fill(cpvmul,premul) ;
496 //GetESDsData(3)->Fill(cpvmul) ;
499 //____________________________________________________________________________
501 void AliPMDQADataMakerRec::StartOfDetectorCycle()
503 //Detector specific actions at start of cycle
506 //____________________________________________________________________________
507 void AliPMDQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
509 //Detector specific actions at end of cycle
510 // do the QA checking
511 AliQAChecker::Instance()->Run(AliQAv1::kPMD, task, list) ;