]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PMD/AliPMDQADataMakerSim.cxx
Input number added to Print
[u/mrichter/AliRoot.git] / PMD / AliPMDQADataMakerSim.cxx
CommitLineData
a9523c3e 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#include <TTree.h>
30
31// --- Standard library ---
32
33// --- AliRoot header files ---
34
35#include "AliLog.h"
36#include "AliPMDhit.h"
37#include "AliPMDsdigit.h"
38#include "AliPMDdigit.h"
39#include "AliPMDQADataMakerSim.h"
40#include "AliQAChecker.h"
41
42ClassImp(AliPMDQADataMakerSim)
43
44//____________________________________________________________________________
45AliPMDQADataMakerSim::AliPMDQADataMakerSim() :
4e25ac79 46 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kPMD), "PMD Quality Assurance Data Maker")
a9523c3e 47{
48 // ctor
49}
50
51//____________________________________________________________________________
52AliPMDQADataMakerSim::AliPMDQADataMakerSim(const AliPMDQADataMakerSim& qadm) :
53 AliQADataMakerSim()
54{
55 //copy ctor
56 SetName((const char*)qadm.GetName()) ;
57 SetTitle((const char*)qadm.GetTitle());
58}
59
60//__________________________________________________________________
61AliPMDQADataMakerSim& AliPMDQADataMakerSim::operator = (const AliPMDQADataMakerSim& qadm )
62{
63 // Assign operator.
64 this->~AliPMDQADataMakerSim();
65 new(this) AliPMDQADataMakerSim(qadm);
66 return *this;
67}
68
69//____________________________________________________________________________
70void AliPMDQADataMakerSim::InitHits()
71{
72 // create Hits histograms in Hits subdir
7d297381 73 const Bool_t expert = kTRUE ;
74 const Bool_t image = kTRUE ;
75
db72ff3b 76 TH1F *h0 = new TH1F("hPreHitsEdep","Hits energy distribution PRE(PMD);Energy [keV];Counts", 500, 0., 500.);
7d297381 77 h0->Sumw2() ;
78 Add2HitsList(h0, 0, !expert, image) ;
79
db72ff3b 80 TH1F *h1 = new TH1F("hCpvHitsEdep","Hits energy distribution CPV(PMD);Energy [keV];Counts", 500, 0., 500.);
7d297381 81 h1->Sumw2() ;
82 Add2HitsList(h1, 1, !expert, image) ;
83
db72ff3b 84 TH1I *h2 = new TH1I("hPreHitsMult","Hits multiplicity distribution in PRE(PMD);# of Hits;Entries", 500, 0, 3000) ;
7d297381 85 h2->Sumw2() ;
86 Add2HitsList(h2, 2, !expert, image) ;
87
db72ff3b 88 TH1I *h3 = new TH1I("hCpvHitsMult","Hits multiplicity distribution in PRE(PMD);# of Hits;Entries", 500, 0, 3000) ;
7d297381 89 h2->Sumw2() ;
90 Add2HitsList(h3, 3, !expert, image) ;
92664bc8 91 //
92 ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
a9523c3e 93}
94
95//____________________________________________________________________________
96void AliPMDQADataMakerSim::InitSDigits()
97{
98 // create SDigits histograms in SDigits subdir
7d297381 99 const Bool_t expert = kTRUE ;
100 const Bool_t image = kTRUE ;
101
db72ff3b 102 TH1F *h0 = new TH1F("hPreSDigitsEdep","SDigits energy distribution in(keV) PRE(PMD);Energy [keV];Counts", 500, 0., 500.);
7d297381 103 h0->Sumw2();
104 Add2SDigitsList(h0, 0, !expert, image);
105
db72ff3b 106 TH1F *h1 = new TH1F("hCpvSDigitsEdep","SDigits energy distribution in (keV)CPV(PMD);Energy [keV];Counts", 500, 0., 500.);
7d297381 107 h1->Sumw2();
108 Add2SDigitsList(h1, 1, !expert, image);
109
db72ff3b 110 TH1I *h2 = new TH1I("hPreSDigitsMult","SDigits multiplicity distribution in PRE(PMD);# of SDigits;Entries", 500, 0., 1000.);
7d297381 111 h2->Sumw2();
112 Add2SDigitsList(h2, 2, !expert, image);
113
db72ff3b 114 TH1I *h3 = new TH1I("hCpvSDigitsMult","SDigits multiplicity distribution in CPV(PMD);# of SDigits;Entries", 500, 0., 1000.);
7d297381 115 h3->Sumw2();
116 Add2SDigitsList(h3, 3, !expert, image);
92664bc8 117 //
118 ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line
a9523c3e 119}
120
121//____________________________________________________________________________
122void AliPMDQADataMakerSim::InitDigits()
123{
124 // create Digits histograms in Digits subdir
7d297381 125 const Bool_t expert = kTRUE ;
126 const Bool_t image = kTRUE ;
127
db72ff3b 128 TH1F *h0 = new TH1F("hPreDigitsEdep","Digits energy distribution in PRE(PMD);Amplitude [ADC counts];Counts", 100, 0., 2000.);
7d297381 129 h0->Sumw2();
130 Add2DigitsList(h0, 0, !expert, image);
131
db72ff3b 132 TH1F *h1 = new TH1F("hCpvDigitsEdep","Digits energy distribution in CPV(PMD);Amplitude [ADC counts];Counts", 100, 0., 2000.);
7d297381 133 h1->Sumw2();
134 Add2DigitsList(h1, 1, !expert, image);
135
db72ff3b 136 TH1I *h2 = new TH1I("hPreDigitsMult","Digits multiplicity distribution in PRE(PMD);# of Digits;Entries", 500, 0, 1000) ;
7d297381 137 h2->Sumw2();
138 Add2DigitsList(h2, 2, !expert, image);
139
db72ff3b 140 TH1I *h3 = new TH1I("hCpvDigitsMult","Digits multiplicity distribution in CPV(PMD);# of Digits;Entries", 500, 0, 1000);
7d297381 141 h3->Sumw2();
142 Add2DigitsList(h3, 3, !expert, image);
92664bc8 143 //
144 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
a9523c3e 145}
146
147//____________________________________________________________________________
6252ceeb 148void AliPMDQADataMakerSim::MakeHits()
a9523c3e 149{
150 //make QA data from Hits
151
eca4fa66 152 Int_t premul = 0, cpvmul = 0;
db06ef51 153 Float_t edepkev = 0.;
154 TIter next(fHitsArray);
155 AliPMDhit * hit;
2c1131dd 156
db06ef51 157 while ( (hit = dynamic_cast<AliPMDhit *>(next())) )
158 {
159 if (hit->Z() > 361.5)
160 {
161 edepkev = (hit->GetEnergy())/1000.;
92664bc8 162 FillHitsData(0,edepkev);
db06ef51 163 premul++;
164 }
165 else if (hit->Z() < 361.5)
166 {
167 edepkev = (hit->GetEnergy())/1000.;
92664bc8 168 FillHitsData(1,edepkev);
db06ef51 169 cpvmul++;
170 }
a9523c3e 171 }
db06ef51 172
173 if(premul <= 0)
a9523c3e 174 {
92664bc8 175 FillHitsData(2,-1.);
a9523c3e 176 }
db06ef51 177 else
a9523c3e 178 {
92664bc8 179 FillHitsData(2,premul);
a9523c3e 180 }
db06ef51 181
182 if(cpvmul <= 0)
a9523c3e 183 {
92664bc8 184 FillHitsData(3,-1.);
a9523c3e 185 }
db06ef51 186 else
a9523c3e 187 {
92664bc8 188 FillHitsData(3,cpvmul);
a9523c3e 189 }
db06ef51 190
a9523c3e 191}
192
193//____________________________________________________________________________
194void AliPMDQADataMakerSim::MakeHits(TTree * hitTree)
195{
db06ef51 196 // make QA data from Hit Tree
197
198 TBranch * branch = hitTree->GetBranch("PMD") ;
199 if ( ! branch )
a9523c3e 200 {
db06ef51 201 AliWarning("PMD branch in Hit Tree not found") ;
202 return;
a9523c3e 203 }
204
6252ceeb 205 if (fHitsArray)
206 fHitsArray->Clear() ;
207 else
208 fHitsArray = new TClonesArray("AliPMDhit", 1000);
a9523c3e 209
6252ceeb 210 branch->SetAddress(&fHitsArray);
a9523c3e 211
6252ceeb 212 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
213 branch->GetEntry(ientry) ;
214 MakeHits();
215 fHitsArray->Clear() ;
216 }
92664bc8 217 //
218 IncEvCountCycleHits();
219 IncEvCountTotalHits();
220 //
a9523c3e 221}
222//____________________________________________________________________________
6252ceeb 223void AliPMDQADataMakerSim::MakeSDigits()
a9523c3e 224{
225 // makes data from SDigits
226
eca4fa66 227 Int_t cpvmul = 0, premul = 0;
db06ef51 228 Float_t edepkev = 0.;
229
230 TIter next(fSDigitsArray) ;
231 AliPMDsdigit * sdigit ;
232 while ( (sdigit = dynamic_cast<AliPMDsdigit *>(next())) )
a9523c3e 233 {
db06ef51 234 if(sdigit->GetDetector() == 0)
a9523c3e 235 {
2c1131dd 236 edepkev = (sdigit->GetCellEdep())/1000.;
92664bc8 237 FillSDigitsData(0,edepkev);
2c1131dd 238 premul++;
a9523c3e 239 }
db06ef51 240 if(sdigit->GetDetector() == 1)
a9523c3e 241 {
2c1131dd 242 edepkev = (sdigit->GetCellEdep())/1000.;
92664bc8 243 FillSDigitsData(1,edepkev);
2c1131dd 244 cpvmul++;
a9523c3e 245 }
246
247 }
92664bc8 248 if (premul > 0) FillSDigitsData(2,premul);
249 if (cpvmul > 0) FillSDigitsData(3,cpvmul);
db06ef51 250
a9523c3e 251}
252
253//____________________________________________________________________________
254void AliPMDQADataMakerSim::MakeSDigits(TTree * sdigitTree)
255{
256 // makes data from SDigit Tree
db06ef51 257
6252ceeb 258 if (fSDigitsArray)
259 fSDigitsArray->Clear() ;
260 else
261 fSDigitsArray = new TClonesArray("AliPMDsdigit", 1000) ;
a9523c3e 262
db06ef51 263 TBranch * branch = sdigitTree->GetBranch("PMDSDigit") ;
264 if ( ! branch )
265 {
6252ceeb 266 AliWarning("PMD branch in SDigit Tree not found") ;
db06ef51 267 }
268 else
269 {
270 branch->SetAddress(&fSDigitsArray) ;
271 branch->GetEntry(0) ;
272 MakeSDigits() ;
a9523c3e 273 }
92664bc8 274 //
275 IncEvCountCycleSDigits();
276 IncEvCountTotalSDigits();
277 //
a9523c3e 278}
279
280//____________________________________________________________________________
6252ceeb 281void AliPMDQADataMakerSim::MakeDigits()
a9523c3e 282{
283 // makes data from Digits
eca4fa66 284
285 Int_t cpvmul = 0, premul = 0;
db06ef51 286
287 TIter next(fDigitsArray) ;
288 AliPMDdigit * digit ;
289 while ( (digit = dynamic_cast<AliPMDdigit *>(next())) )
a9523c3e 290 {
db06ef51 291 if(digit->GetDetector() == 0)
a9523c3e 292 {
92664bc8 293 FillDigitsData(0, digit->GetADC()) ;
db06ef51 294 premul++;
a9523c3e 295 }
db06ef51 296 if(digit->GetDetector() == 1)
a9523c3e 297 {
92664bc8 298 FillDigitsData(1, digit->GetADC());
db06ef51 299 cpvmul++;
a9523c3e 300 }
301 }
db06ef51 302
92664bc8 303 if (premul > 0) FillDigitsData(2,premul);
304 if (cpvmul > 0) FillDigitsData(3,cpvmul);
db06ef51 305
306
a9523c3e 307}
308
309//____________________________________________________________________________
310void AliPMDQADataMakerSim::MakeDigits(TTree * digitTree)
311{
312 // makes data from Digit Tree
313
6252ceeb 314 if (fDigitsArray)
315 fDigitsArray->Clear() ;
316 else
317 fDigitsArray = new TClonesArray("AliPMDdigit", 1000) ;
db06ef51 318
319 TBranch * branch = digitTree->GetBranch("PMDDigit") ;
a9523c3e 320
db06ef51 321 if ( ! branch )
a9523c3e 322 {
db06ef51 323 AliWarning("PMD branch in Digit Tree not found") ;
a9523c3e 324 }
db06ef51 325 else
a9523c3e 326 {
db06ef51 327 branch->SetAddress(&fDigitsArray) ;
328 for (Int_t ient = 0; ient < branch->GetEntries(); ient++)
a9523c3e 329 {
db06ef51 330 branch->GetEntry(ient) ;
331 MakeDigits() ;
332 fDigitsArray->Clear() ;
333
a9523c3e 334 }
6252ceeb 335
a9523c3e 336 }
92664bc8 337 //
338 IncEvCountCycleDigits();
339 IncEvCountTotalDigits();
340 //
a9523c3e 341}
342
343
344//____________________________________________________________________________
345
346void AliPMDQADataMakerSim::StartOfDetectorCycle()
347{
348 //Detector specific actions at start of cycle
349
350}
351//____________________________________________________________________________
352
4e25ac79 353void AliPMDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
a9523c3e 354{
355 //Detector specific actions at end of cycle
356 // do the QA checking
4e25ac79 357 AliQAChecker::Instance()->Run(AliQAv1::kPMD, task, list) ;
a9523c3e 358}