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>
31 // --- Standard library ---
33 // --- AliRoot header files ---
36 #include "AliPMDhit.h"
37 #include "AliPMDsdigit.h"
38 #include "AliPMDdigit.h"
39 #include "AliPMDQADataMakerSim.h"
40 #include "AliQAChecker.h"
42 ClassImp(AliPMDQADataMakerSim)
44 //____________________________________________________________________________
45 AliPMDQADataMakerSim::AliPMDQADataMakerSim() :
46 AliQADataMakerSim(AliQA::GetDetName(AliQA::kPMD), "PMD Quality Assurance Data Maker")
51 //____________________________________________________________________________
52 AliPMDQADataMakerSim::AliPMDQADataMakerSim(const AliPMDQADataMakerSim& qadm) :
56 SetName((const char*)qadm.GetName()) ;
57 SetTitle((const char*)qadm.GetTitle());
60 //__________________________________________________________________
61 AliPMDQADataMakerSim& AliPMDQADataMakerSim::operator = (const AliPMDQADataMakerSim& qadm )
64 this->~AliPMDQADataMakerSim();
65 new(this) AliPMDQADataMakerSim(qadm);
69 //____________________________________________________________________________
70 void AliPMDQADataMakerSim::InitHits()
72 // create Hits histograms in Hits subdir
74 TH1F *h0 = new TH1F("hPreHitsEdep","Hits energy distribution in PRE(PMD)", 100, 0., 2000.);
78 TH1F *h1 = new TH1F("hCpvHitsEdep","Hits energy distribution in CPV(PMD)", 100, 0., 2000.);
82 TH1I *h2 = new TH1I("hPreHitsMult","Hits multiplicity distribution in PRE(PMD)", 500, 0, 10000) ;
86 TH1I *h3 = new TH1I("hCpvHitsMult","Hits multiplicity distribution in PRE(PMD)", 500, 0, 10000) ;
91 //____________________________________________________________________________
92 void AliPMDQADataMakerSim::InitSDigits()
94 // create SDigits histograms in SDigits subdir
96 TH1F *h0 = new TH1F("hPreSDigitsEdep","SDigits energy distribution in PRE(PMD)", 100, 0., 2000.);
98 Add2SDigitsList(h0, 0);
100 TH1F *h1 = new TH1F("hCpvSDigitsEdep","SDigits energy distribution in CPV(PMD)", 100, 0., 2000.);
102 Add2SDigitsList(h1, 1);
104 TH1I *h2 = new TH1I("hPreSDigitsMult","SDigits multiplicity distribution in PRE(PMD)", 500, 0., 5000.);
106 Add2SDigitsList(h2, 2);
108 TH1I *h3 = new TH1I("hCpvSDigitsMult","SDigits multiplicity distribution in CPV(PMD)", 500, 0., 5000.);
110 Add2SDigitsList(h3, 3);
114 //____________________________________________________________________________
115 void AliPMDQADataMakerSim::InitDigits()
117 // create Digits histograms in Digits subdir
119 TH1F *h0 = new TH1F("hPreDigitsEdep","Digits energy distribution in PRE(PMD)", 100, 0., 2000.);
121 Add2DigitsList(h0, 0);
123 TH1F *h1 = new TH1F("hCpvDigitsEdep","Digits energy distribution in CPV(PMD)", 100, 0., 2000.);
125 Add2DigitsList(h1, 1);
127 TH1I *h2 = new TH1I("hPreDigitsMult","Digits multiplicity distribution in PRE(PMD)", 500, 0, 5000) ;
129 Add2DigitsList(h2, 2);
131 TH1I *h3 = new TH1I("hCpvDigitsMult","Digits multiplicity distribution in CPV(PMD)", 500, 0, 5000);
133 Add2DigitsList(h3, 3);
137 //____________________________________________________________________________
138 void AliPMDQADataMakerSim::MakeHits(TClonesArray *hits)
140 //make QA data from Hits
142 Int_t premul = 0, cpvmul = 0;
147 while ( (hit = dynamic_cast<AliPMDhit *>(next())) )
149 if (hit->Z() > 361.5)
151 GetHitsData(0)->Fill(hit->GetEnergy());
154 else if (hit->Z() < 361.5)
156 GetHitsData(1)->Fill(hit->GetEnergy());
163 GetHitsData(2)->Fill(-1.);
167 GetHitsData(2)->Fill(premul);
172 GetHitsData(3)->Fill(-1.);
176 GetHitsData(3)->Fill(cpvmul);
181 //____________________________________________________________________________
182 void AliPMDQADataMakerSim::MakeHits(TTree * hitTree)
184 // make QA data from Hit Tree
186 TBranch * branch = hitTree->GetBranch("PMD") ;
189 AliWarning("PMD branch in Hit Tree not found") ;
193 static TClonesArray statichits("AliPMDhit", 1000);
195 TClonesArray *hits = &statichits;
196 static TClonesArray staticdummy("AliPMDhit", 1000);
198 TClonesArray *dummy = &staticdummy;
199 branch->SetAddress(&dummy);
202 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
203 branch->GetEntry(ientry) ;
204 for (Int_t ihit = 0 ; ihit < dummy->GetEntries() ; ihit++) {
205 AliPMDhit * hit = dynamic_cast<AliPMDhit *> (dummy->At(ihit)) ;
206 new((*hits)[index]) AliPMDhit(*hit) ;
215 //____________________________________________________________________________
216 void AliPMDQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
218 // makes data from SDigits
220 Int_t cpvmul = 0, premul = 0;
222 TIter next(sdigits) ;
223 AliPMDsdigit * sdigit ;
224 while ( (sdigit = dynamic_cast<AliPMDsdigit *>(next())) )
226 if(sdigit->GetDetector() == 0)
228 GetSDigitsData(0)->Fill( sdigit->GetCellEdep());
231 if(sdigit->GetDetector() == 1)
233 GetSDigitsData(1)->Fill( sdigit->GetCellEdep());
238 if (premul > 0) GetSDigitsData(2)->Fill(premul);
239 if (cpvmul > 0) GetSDigitsData(3)->Fill(cpvmul);
243 //____________________________________________________________________________
244 void AliPMDQADataMakerSim::MakeSDigits(TTree * sdigitTree)
246 // makes data from SDigit Tree
248 TClonesArray * sdigits = new TClonesArray("AliPMDsdigit", 1000) ;
250 TBranch * branch = sdigitTree->GetBranch("PMDSDigit") ;
251 branch->SetAddress(&sdigits) ;
255 AliWarning("PMD branch in SDigit Tree not found") ;
259 for (Int_t ient = 0; ient < branch->GetEntries(); ient++)
261 branch->GetEntry(ient) ;
262 MakeSDigits(sdigits) ;
267 //____________________________________________________________________________
268 void AliPMDQADataMakerSim::MakeDigits(TClonesArray * digits)
270 // makes data from Digits
272 Int_t cpvmul = 0, premul = 0;
275 AliPMDdigit * digit ;
276 while ( (digit = dynamic_cast<AliPMDdigit *>(next())) )
278 if(digit->GetDetector() == 0)
280 GetDigitsData(0)->Fill( digit->GetADC()) ;
283 if(digit->GetDetector() == 1)
285 GetDigitsData(1)->Fill( digit->GetADC());
290 if (premul > 0) GetDigitsData(2)->Fill(premul);
291 if (cpvmul > 0) GetDigitsData(3)->Fill(cpvmul);
296 //____________________________________________________________________________
297 void AliPMDQADataMakerSim::MakeDigits(TTree * digitTree)
299 // makes data from Digit Tree
301 TClonesArray * digits = new TClonesArray("AliPMDdigit", 1000) ;
303 TBranch * branch = digitTree->GetBranch("PMDDigit") ;
304 branch->SetAddress(&digits) ;
308 AliWarning("PMD branch in Digit Tree not found") ;
312 for (Int_t ient = 0; ient < branch->GetEntries(); ient++)
315 branch->GetEntry(ient) ;
323 //____________________________________________________________________________
325 void AliPMDQADataMakerSim::StartOfDetectorCycle()
327 //Detector specific actions at start of cycle
330 //____________________________________________________________________________
332 void AliPMDQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
334 //Detector specific actions at end of cycle
335 // do the QA checking
336 AliQAChecker::Instance()->Run(AliQA::kPMD, task, list) ;