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 "AliPMDrecpoint1.h"
39 #include "AliPMDRawStream.h"
40 #include "AliPMDddldata.h"
41 #include "AliPMDUtility.h"
42 #include "AliESDPmdTrack.h"
43 //#include "AliPMDRecoParam.h"
45 ClassImp(AliPMDQADataMakerRec)
47 //____________________________________________________________________________
48 AliPMDQADataMakerRec::AliPMDQADataMakerRec() :
49 AliQADataMakerRec(AliQA::GetDetName(AliQA::kPMD), "PMD Quality Assurance Data Maker")
54 //____________________________________________________________________________
55 AliPMDQADataMakerRec::AliPMDQADataMakerRec(const AliPMDQADataMakerRec& qadm) :
59 SetName((const char*)qadm.GetName()) ;
60 SetTitle((const char*)qadm.GetTitle());
63 //__________________________________________________________________
64 AliPMDQADataMakerRec& AliPMDQADataMakerRec::operator = (const AliPMDQADataMakerRec& qadm )
67 this->~AliPMDQADataMakerRec();
68 new(this) AliPMDQADataMakerRec(qadm);
73 //____________________________________________________________________________
74 void AliPMDQADataMakerRec::InitRaws()
76 // create Raws histograms in Raws subdir
78 const Bool_t saveForCorr = kTRUE;
81 TH1I * h0 = new TH1I("hPreEdepM0","ADC Distribution PRE - Module 0", 100, 0, 2000);
85 TH1I * h1 = new TH1I("hPreEdepM1","ADC Distribution PRE - Module 1", 100, 0, 2000);
89 TH1I * h2 = new TH1I("hPreEdepM2","ADC Distribution PRE - Module 2", 100, 0, 2000);
93 TH1I * h3 = new TH1I("hPreEdepM3","ADC Distribution PRE - Module 3", 100, 0, 2000);
97 TH1I * h4 = new TH1I("hPreEdepM4","ADC Distribution PRE - Module 4", 100, 0, 2000);
101 TH1I * h5 = new TH1I("hPreEdepM5","ADC Distribution PRE - Module 5", 100, 0, 2000);
105 TH1I * h6 = new TH1I("hPreEdepM6","ADC Distribution PRE - Module 6", 100, 0, 2000);
109 TH1I * h7 = new TH1I("hPreEdepM7","ADC Distribution PRE - Module 7", 100, 0, 2000);
113 TH1I * h8 = new TH1I("hPreEdepM8","ADC Distribution PRE - Module 8", 100, 0, 2000);
117 TH1I * h9 = new TH1I("hPreEdepM9","ADC Distribution PRE - Module 9", 100, 0, 2000);
121 TH1I * h10 = new TH1I("hPreEdepM10","ADC Distribution PRE - Module 10", 100, 0, 2000);
123 Add2RawsList(h10, 10);
125 TH1I * h11 = new TH1I("hPreEdepM11","ADC Distribution PRE - Module 11", 100, 0, 2000);
127 Add2RawsList(h11, 11);
129 TH1I * h12 = new TH1I("hPreEdepM12","ADC Distribution PRE - Module 12", 100, 0, 2000);
131 Add2RawsList(h12, 12);
133 TH1I * h13 = new TH1I("hPreEdepM13","ADC Distribution PRE - Module 13", 100, 0, 2000);
135 Add2RawsList(h13, 13);
137 TH1I * h14 = new TH1I("hPreEdepM14","ADC Distribution PRE - Module 14", 100, 0, 2000);
139 Add2RawsList(h14, 14);
141 TH1I * h15 = new TH1I("hPreEdepM15","ADC Distribution PRE - Module 15", 100, 0, 2000);
143 Add2RawsList(h15, 15);
145 TH1I * h16 = new TH1I("hPreEdepM16","ADC Distribution PRE - Module 16", 100, 0, 2000);
147 Add2RawsList(h16, 16);
149 TH1I * h17 = new TH1I("hPreEdepM17","ADC Distribution PRE - Module 17", 100, 0, 2000);
151 Add2RawsList(h17, 17);
153 TH1I * h18 = new TH1I("hPreEdepM18","ADC Distribution PRE - Module 18", 100, 0, 2000);
155 Add2RawsList(h18, 18);
157 TH1I * h19 = new TH1I("hPreEdepM19","ADC Distribution PRE - Module 19", 100, 0, 2000);
159 Add2RawsList(h19, 19);
161 TH1I * h20 = new TH1I("hPreEdepM20","ADC Distribution PRE - Module 20", 100, 0, 2000);
163 Add2RawsList(h20, 20);
165 TH1I * h21 = new TH1I("hPreEdepM21","ADC Distribution PRE - Module 21", 100, 0, 2000);
167 Add2RawsList(h21, 21);
169 TH1I * h22 = new TH1I("hPreEdepM22","ADC Distribution PRE - Module 22", 100, 0, 2000);
171 Add2RawsList(h22, 22);
173 TH1I * h23 = new TH1I("hPreEdepM23","ADC Distribution PRE - Module 23", 100, 0, 2000);
175 Add2RawsList(h23, 23);
179 TH1I * h24 = new TH1I("hCpvEdepM24","ADC Distribution CPV - Module 24", 100, 0, 2000);
181 Add2RawsList(h24, 24);
183 TH1I * h25 = new TH1I("hCpvEdepM25","ADC Distribution CPV - Module 25", 100, 0, 2000);
185 Add2RawsList(h25, 25);
187 TH1I * h26 = new TH1I("hCpvEdepM26","ADC Distribution CPV - Module 26", 100, 0, 2000);
189 Add2RawsList(h26, 26);
191 TH1I * h27 = new TH1I("hCpvEdepM27","ADC Distribution CPV - Module 27", 100, 0, 2000);
193 Add2RawsList(h27, 27);
195 TH1I * h28 = new TH1I("hCpvEdepM28","ADC Distribution CPV - Module 28", 100, 0, 2000);
197 Add2RawsList(h28, 28);
199 TH1I * h29 = new TH1I("hCpvEdepM29","ADC Distribution CPV - Module 29", 100, 0, 2000);
201 Add2RawsList(h29, 29);
203 TH1I * h30 = new TH1I("hCpvEdepM30","ADC Distribution CPV - Module 30", 100, 0, 2000);
205 Add2RawsList(h30, 30);
207 TH1I * h31 = new TH1I("hCpvEdepM31","ADC Distribution CPV - Module 31", 100, 0, 2000);
209 Add2RawsList(h31, 31);
211 TH1I * h32 = new TH1I("hCpvEdepM32","ADC Distribution CPV - Module 32", 100, 0, 2000);
213 Add2RawsList(h32, 32);
215 TH1I * h33 = new TH1I("hCpvEdepM33","ADC Distribution CPV - Module 33", 100, 0, 2000);
217 Add2RawsList(h33, 33);
219 TH1I * h34 = new TH1I("hCpvEdepM34","ADC Distribution CPV - Module 34", 100, 0, 2000);
221 Add2RawsList(h34, 34);
223 TH1I * h35 = new TH1I("hCpvEdepM35","ADC Distribution CPV - Module 35", 100, 0, 2000);
225 Add2RawsList(h35, 35);
227 TH1I * h36 = new TH1I("hCpvEdepM36","ADC Distribution CPV - Module 36", 100, 0, 2000);
229 Add2RawsList(h36, 36);
231 TH1I * h37 = new TH1I("hCpvEdepM37","ADC Distribution CPV - Module 37", 100, 0, 2000);
233 Add2RawsList(h37, 37);
235 TH1I * h38 = new TH1I("hCpvEdepM38","ADC Distribution CPV - Module 38", 100, 0, 2000);
237 Add2RawsList(h38, 38);
239 TH1I * h39 = new TH1I("hCpvEdepM39","ADC Distribution CPV - Module 39", 100, 0, 2000);
241 Add2RawsList(h39, 39);
243 TH1I * h40 = new TH1I("hCpvEdepM40","ADC Distribution CPV - Module 40", 100, 0, 2000);
245 Add2RawsList(h40, 40);
247 TH1I * h41 = new TH1I("hCpvEdepM41","ADC Distribution CPV - Module 41", 100, 0, 2000);
249 Add2RawsList(h41, 41);
251 TH1I * h42 = new TH1I("hCpvEdepM42","ADC Distribution CPV - Module 42", 100, 0, 2000);
253 Add2RawsList(h42, 42);
255 TH1I * h43 = new TH1I("hCpvEdepM43","ADC Distribution CPV - Module 43", 100, 0, 2000);
257 Add2RawsList(h43, 43);
259 TH1I * h44 = new TH1I("hCpvEdepM44","ADC Distribution CPV - Module 44", 100, 0, 2000);
261 Add2RawsList(h44, 44);
263 TH1I * h45 = new TH1I("hCpvEdepM45","ADC Distribution CPV - Module 45", 100, 0, 2000);
265 Add2RawsList(h45, 45);
267 TH1I * h46 = new TH1I("hCpvEdepM46","ADC Distribution CPV - Module 46", 100, 0, 2000);
269 Add2RawsList(h46, 46);
271 TH1I * h47 = new TH1I("hCpvEdepM47","ADC Distribution CPV - Module 47", 100, 0, 2000);
273 Add2RawsList(h47, 47);
276 // Y vs. X for PRE and CPV planes
278 TH2F * h48 = new TH2F("hPreXY","PRE plane",200,-100.,100.,200,-100.,100.);
279 Add2RawsList(h48, 48,saveForCorr);//Ajay
280 //Add2RawsList(h48, 48);//Ajay
281 TH2F * h49 = new TH2F("hCpvXY","CPV plane",200,-100.,100.,200,-100.,100.);
282 Add2RawsList(h49, 49,saveForCorr);//Ajay
283 //Add2RawsList(h49, 49);//Ajay
286 //____________________________________________________________________________
287 void AliPMDQADataMakerRec::InitRecPoints()
289 // create Reconstructed Points histograms in RecPoints subdir
292 TH2F * h0 = new TH2F("hPreXY","RecPoints Y vs X PRE(PMD)", 100,-100.,100.,100,-100.,100.);
293 Add2RecPointsList(h0,0);
295 TH2F * h1 = new TH2F("hCpvXY","RecPoints Y vs X CPV(PMD)", 100,-100.,100.,100,-100.,100.);
296 Add2RecPointsList(h1,1);
299 // Ncell distribution in a cluster
303 TH1F * h0 = new TH1F("hPreDdl0Ncell","PRE: Ddl0 Ncell in a cluster",50,0.,50.);
305 Add2RecPointsList(h0, 0);
308 TH1F * h1 = new TH1F("hPreDdl1Ncell","PRE: Ddl1 Ncell in a cluster",50,0.,50.);
310 Add2RecPointsList(h1, 1);
313 TH1F * h2 = new TH1F("hPreDdl2Ncell","PRE: Ddl2 Ncell in a cluster",50,0.,50.);
315 Add2RecPointsList(h2, 2);
318 TH1F * h3 = new TH1F("hPreDdl3Ncell","PRE: Ddl3 Ncell in a cluster",50,0.,50.);
320 Add2RecPointsList(h3, 3);
324 TH1F * h4 = new TH1F("hCpvDdl4Ncell","CPV: Ddl4 Ncell in a cluster",50,0.,50.);
326 Add2RecPointsList(h4, 4);
328 TH1F * h5 = new TH1F("hCpvDdl5Ncell","CPV: Ddl5 Ncell in a cluster",50,0.,50.);
330 Add2RecPointsList(h5, 5);
334 TH2I *h6 = new TH2I("hPre10","Cluster - DDL1 vs DDL0", 100,0,200,100,0,200);
335 Add2RecPointsList(h6,6);
337 TH2I *h7 = new TH2I("hPre32","Cluster - DDL3 vs DDL2", 100,0,200,100,0,200);
338 Add2RecPointsList(h7,7);
340 TH2I *h8 = new TH2I("hCpv54","Cluster - DDL5 vs DDL4", 100,0,200,100,0,200);
341 Add2RecPointsList(h8,8);
347 //____________________________________________________________________________
349 void AliPMDQADataMakerRec::InitESDs()
351 //Create histograms to controll ESD
353 TH1F *h0 = new TH1F("hPreClADC","Cluster ADC of PRE plane",500,0.,10000.);
355 Add2ESDsList(h0, 0) ;
357 TH1F *h1 = new TH1F("hCpvClADC","Cluster ADC of CPV plane",500,0.,10000.);
359 Add2ESDsList(h1, 1) ;
361 TH2I *h2 = new TH2I("hPmdClMult","Cluster Multiplicity: PRE vs. CPVplane",100,0,1000,100,0,1000);
363 Add2ESDsList(h2, 2) ;
366 TH1I * h3 = new TH1I("hCpvClMult","Cluster Multiplicity of CPV plane",100,0.,1000.);
368 Add2ESDsList(h3, 3) ;
373 //____________________________________________________________________________
374 void AliPMDQADataMakerRec::MakeRaws(AliRawReader* rawReader)
376 //Fill prepared histograms with Raw digit properties
378 TObjArray *pmdddlcont = 0x0;
379 pmdddlcont = new TObjArray();
380 AliPMDRawStream stream(rawReader);
382 AliPMDddldata *pmdddl = 0x0;
391 while ((iddl = stream.DdlData(pmdddlcont)) >=0)
393 Int_t ientries = pmdddlcont->GetEntries();
394 //printf(" ======= DDLNO = %d ientries = %d \n", iddl, ientries);
396 for (Int_t ient = 0; ient < ientries; ient++)
398 //AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont->UncheckedAt(ient);
399 pmdddl = (AliPMDddldata*)pmdddlcont->UncheckedAt(ient);
401 Int_t det = pmdddl->GetDetector();
402 Int_t smn = pmdddl->GetSMN();
403 Int_t mcm = pmdddl->GetMCM();
404 //Int_t chno = pmdddl->GetChannel();
405 Int_t row = pmdddl->GetRow();
406 Int_t col = pmdddl->GetColumn();
407 Int_t sig = pmdddl->GetSignal();
409 if (mcm == 0 || smn == -1) continue;
413 GetRawsData(smn)->Fill(sig);
419 else if(smn >= 12 && smn < 24)
424 cc.RectGeomCellPos(smn,xpad,ypad,xx,yy);
425 GetRawsData(48)->Fill(xx,yy);
429 GetRawsData(24+smn)->Fill(sig);
435 else if(smn >= 12 && smn < 24)
441 cc.RectGeomCellPos(smn,xpad,ypad,xx,yy);
442 GetRawsData(49)->Fill(xx,yy);
448 pmdddlcont->Delete();
455 //____________________________________________________________________________
456 void AliPMDQADataMakerRec::MakeRecPoints(TTree * clustersTree)
458 // makes data from RecPoints
460 Int_t multDdl0 = 0, multDdl1 = 0, multDdl2 = 0;
461 Int_t multDdl3 = 0, multDdl4 = 0, multDdl5 = 0;
463 AliPMDrecpoint1 * recpoint;
465 TClonesArray * recpoints = 0x0;
466 recpoints = new TClonesArray("AliPMDrecpoint1", 1000) ;
468 TBranch * branch = clustersTree->GetBranch("PMDRecpoint") ;
469 branch->SetAddress(&recpoints) ;
473 AliWarning("PMD branch in Recpoints Tree not found") ;
477 for (Int_t imod = 0; imod < branch->GetEntries(); imod++)
479 branch->GetEntry(imod) ;
481 TIter next(recpoints) ;
483 while ( (recpoint = dynamic_cast<AliPMDrecpoint1 *>(next())) )
485 //Float_t xpos = recpoint->GetClusX();
486 //Float_t ypos = recpoint->GetClusY();
487 //Int_t smn = recpoint->GetSMNumber();
489 if(recpoint->GetDetector() == 0)
491 if(recpoint->GetSMNumber() >= 0 && recpoint->GetSMNumber() < 6)
493 GetRecPointsData(0)->Fill(recpoint->GetClusCells());
496 if(recpoint->GetSMNumber() >= 6 && recpoint->GetSMNumber() < 12)
498 GetRecPointsData(1)->Fill(recpoint->GetClusCells());
501 if(recpoint->GetSMNumber() >= 12 && recpoint->GetSMNumber() < 18)
503 GetRecPointsData(2)->Fill(recpoint->GetClusCells());
506 if(recpoint->GetSMNumber() >= 18 && recpoint->GetSMNumber() < 24)
508 GetRecPointsData(3)->Fill(recpoint->GetClusCells());
513 if(recpoint->GetDetector() == 1)
515 if((recpoint->GetSMNumber() >= 0 && recpoint->GetSMNumber() < 6) ||
516 (recpoint->GetSMNumber() >= 18 && recpoint->GetSMNumber() < 24))
518 GetRecPointsData(4)->Fill(recpoint->GetClusCells());
521 if(recpoint->GetSMNumber() >= 6 && recpoint->GetSMNumber() < 18 )
523 GetRecPointsData(5)->Fill(recpoint->GetClusCells());
531 GetRecPointsData(6)->Fill(multDdl0,multDdl1);
532 GetRecPointsData(7)->Fill(multDdl2,multDdl3);
533 GetRecPointsData(8)->Fill(multDdl4,multDdl5);
539 //____________________________________________________________________________
541 void AliPMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
543 // make QA data from ESDs
545 Int_t premul = 0, cpvmul = 0;
547 for (Int_t icl = 0; icl < esd->GetNumberOfPmdTracks(); icl++)
549 AliESDPmdTrack *pmdtr = esd->GetPmdTrack(icl);
551 //Int_t det = pmdtr->GetDetector();
552 //Float_t clsX = pmdtr->GetClusterX();
553 //Float_t clsY = pmdtr->GetClusterY();
554 //Float_t clsZ = pmdtr->GetClusterZ();
555 //Float_t ncell = pmdtr->GetClusterCells();
556 Float_t adc = pmdtr->GetClusterADC();
557 //Float_t pid = pmdtr->GetClusterPID();
559 if (pmdtr->GetDetector() == 0)
561 GetESDsData(0)->Fill(adc);
564 if (pmdtr->GetDetector() == 1)
566 GetESDsData(1)->Fill(adc) ;
571 GetESDsData(2)->Fill(cpvmul,premul) ;
572 //GetESDsData(3)->Fill(cpvmul) ;
575 //____________________________________________________________________________
577 void AliPMDQADataMakerRec::StartOfDetectorCycle()
579 //Detector specific actions at start of cycle
582 //____________________________________________________________________________
583 void AliPMDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray ** list)
585 //Detector specific actions at end of cycle
586 // do the QA checking
587 AliQAChecker::Instance()->Run(AliQA::kPMD, task, list) ;