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 **************************************************************************/
20 Produces the data needed to calculate the quality assurance.
21 All data must be mergeable objects.
22 Y. Schutz CERN July 2007
25 // --- ROOT system ---
26 #include <TClonesArray.h>
32 // --- Standard library ---
34 // --- AliRoot header files ---
35 #include "AliESDCaloCluster.h"
36 #include "AliESDEvent.h"
38 #include "AliPHOSDigit.h"
39 #include "AliPHOSHit.h"
40 #include "AliPHOSQADataMaker.h"
41 #include "AliQAChecker.h"
42 #include "AliPHOSCpvRecPoint.h"
43 #include "AliPHOSEmcRecPoint.h"
44 #include "AliPHOSRecParticle.h"
45 #include "AliPHOSTrackSegment.h"
46 #include "AliPHOSRawDecoder.h"
48 ClassImp(AliPHOSQADataMaker)
50 //____________________________________________________________________________
51 AliPHOSQADataMaker::AliPHOSQADataMaker() :
52 AliQADataMaker(AliQA::GetDetName(AliQA::kPHOS), "PHOS Quality Assurance Data Maker")
57 //____________________________________________________________________________
58 AliPHOSQADataMaker::AliPHOSQADataMaker(const AliPHOSQADataMaker& qadm) :
62 SetName((const char*)qadm.GetName()) ;
63 SetTitle((const char*)qadm.GetTitle());
66 //__________________________________________________________________
67 AliPHOSQADataMaker& AliPHOSQADataMaker::operator = (const AliPHOSQADataMaker& qadm )
70 this->~AliPHOSQADataMaker();
71 new(this) AliPHOSQADataMaker(qadm);
75 //____________________________________________________________________________
76 void AliPHOSQADataMaker::EndOfDetectorCycle(AliQA::TASKINDEX task, TList * list)
78 //Detector specific actions at end of cycle
80 AliQAChecker::Instance()->Run(AliQA::kPHOS, task, list) ;
83 //____________________________________________________________________________
84 void AliPHOSQADataMaker::InitESDs()
86 //create ESDs histograms in ESDs subdir
87 TH1F * h0 = new TH1F("hPhosESDs", "ESDs energy distribution in PHOS", 100, 0., 100.) ;
90 TH1I * h1 = new TH1I("hPhosESDsMul", "ESDs multiplicity distribution in PHOS", 100, 0., 100) ;
95 //____________________________________________________________________________
96 void AliPHOSQADataMaker::InitHits()
98 // create Hits histograms in Hits subdir
99 TH1F * h0 = new TH1F("hPhosHits", "Hits energy distribution in PHOS", 100, 0., 100.) ;
101 Add2HitsList(h0, 0) ;
102 TH1I * h1 = new TH1I("hPhosHitsMul", "Hits multiplicity distribution in PHOS", 500, 0., 10000) ;
104 Add2HitsList(h1, 1) ;
107 //____________________________________________________________________________
108 void AliPHOSQADataMaker::InitDigits()
110 // create Digits histograms in Digits subdir
111 TH1I * h0 = new TH1I("hPhosDigits", "Digits amplitude distribution in PHOS", 500, 0, 5000) ;
113 Add2DigitsList(h0, 0) ;
114 TH1I * h1 = new TH1I("hPhosDigitsMul", "Digits multiplicity distribution in PHOS", 500, 0, 1000) ;
116 Add2DigitsList(h1, 1) ;
119 //____________________________________________________________________________
120 //void AliPHOSQADataMaker::InitRecParticles()
122 // // create Reconstructed particles histograms in RecParticles subdir
123 // fhRecParticles = new TH1F("hPhosRecParticles", "RecParticles energy distribution in PHOS", 100, 0., 100.) ;
124 // fhRecParticles->Sumw2() ;
125 // fhRecParticlesMul = new TH1I("hPhosRecParticlesMul", "RecParticles multiplicity distribution in PHOS", 100, 0, 100) ;
126 // fhRecParticlesMul->Sumw2() ;
129 //____________________________________________________________________________
130 void AliPHOSQADataMaker::InitRecPoints()
132 // create Reconstructed Points histograms in RecPoints subdir
133 TH1F * h0 = new TH1F("hEmcPhosRecPoints", "EMCA RecPoints energy distribution in PHOS", 100, 0., 100.) ;
135 Add2RecPointsList(h0, 0) ;
136 TH1I * h1 = new TH1I("hEmcPhosRecPointsMul", "EMCA RecPoints multiplicity distribution in PHOS", 100, 0, 100) ;
138 Add2RecPointsList(h1, 1) ;
140 TH1F * h2 = new TH1F("hCpvPhosRecPoints", "CPV RecPoints energy distribution in PHOS", 100, 0., 100.) ;
142 Add2RecPointsList(h2, 2) ;
143 TH1I * h3 = new TH1I("hCpvPhosRecPointsMul", "CPV RecPoints multiplicity distribution in PHOS", 100, 0, 100) ;
145 Add2RecPointsList(h3, 3) ;
148 //____________________________________________________________________________
149 void AliPHOSQADataMaker::InitRaws()
151 // create Raws histograms in Raws subdir
152 const Int_t modMax = 5 ;
153 TH2I * h0[modMax*2] ;
156 for (Int_t mod = 0; mod < modMax; mod++) {
157 sprintf(title, "Low Gain Rows x Columns for PHOS module %d", mod) ;
158 sprintf(name, "hLowPHOSxyMod%d", mod) ;
159 h0[mod] = new TH2I(name, title, 64, 1, 65, 56, 1, 57) ;
160 Add2RawsList(h0[mod], mod) ;
161 sprintf(title, "High Gain Rows x Columns for PHOS module %d", mod) ;
162 sprintf(name, "hHighPHOSxyMod%d", mod) ;
163 h0[mod+modMax] = new TH2I(name, title, 64, 1, 65, 56, 1, 57) ;
164 Add2RawsList(h0[mod+modMax], mod+modMax) ;
166 TH1I * h10 = new TH1I("hLowPhosModules", "Low Gain Hits in EMCA PHOS modules", 6, 0, 6) ;
168 Add2RawsList(h10, 10) ;
169 TH1I * h11 = new TH1I("hHighPhosModules", "High Gain Hits in EMCA PHOS modules", 6, 0, 6) ;
171 Add2RawsList(h11, 11) ;
172 TH1F * h12 = new TH1F("hLowPhosRawtime", "Low Gain Time of raw hits in PHOS", 100, 0, 100.) ;
174 Add2RawsList(h12, 12) ;
175 TH1F * h13 = new TH1F("hHighPhosRawtime", "High Gain Time of raw hits in PHOS", 100, 0, 100.) ;
177 Add2RawsList(h13, 13) ;
178 TH1F * h14 = new TH1F("hLowPhosRawEnergy", "Low Gain Energy of raw hits in PHOS", 100, 0., 100.) ;
180 Add2RawsList(h14, 14) ;
181 TH1F * h15 = new TH1F("hHighPhosRawEnergy", "High Gain Energy of raw hits in PHOS", 100, 0., 100.) ;
183 Add2RawsList(h15, 15) ;
187 //____________________________________________________________________________
188 void AliPHOSQADataMaker::InitSDigits()
190 // create SDigits histograms in SDigits subdir
191 TH1F * h0 = new TH1F("hPhosSDigits", "SDigits energy distribution in PHOS", 100, 0., 100.) ;
193 Add2SDigitsList(h0, 0) ;
194 TH1I * h1 = new TH1I("hPhosSDigitsMul", "SDigits multiplicity distribution in PHOS", 500, 0, 10000) ;
196 Add2SDigitsList(h1, 1) ;
199 //____________________________________________________________________________
200 //void AliPHOSQADataMaker::InitTrackSegments()
202 // // create Track Segments histograms in TrackSegments subdir
203 // fhTrackSegments = new TH1F("hPhosTrackSegments", "TrackSegments EMC-CPV distance in PHOS", 500, 0., 5000.) ;
204 // fhTrackSegments->Sumw2() ;
205 // fhTrackSegmentsMul = new TH1I("hPhosTrackSegmentsMul", "TrackSegments multiplicity distribution in PHOS", 100, 0, 100) ;
206 // fhTrackSegmentsMul->Sumw2() ;
209 //____________________________________________________________________________
210 void AliPHOSQADataMaker::MakeESDs(AliESDEvent * esd)
212 // make QA data from ESDs
215 for ( Int_t index = esd->GetFirstPHOSCluster(); index < esd->GetNumberOfCaloClusters() ; index++ ) {
216 AliESDCaloCluster * clu = esd->GetCaloCluster(index) ;
217 if ( clu->IsPHOS() ) {
218 GetESDsData(0)->Fill(clu->E()) ;
222 GetESDsData(1)->Fill(count) ;
225 //____________________________________________________________________________
226 void AliPHOSQADataMaker::MakeHits(TClonesArray * hits)
228 //make QA data from Hits
230 GetHitsData(1)->Fill(hits->GetEntriesFast()) ;
233 while ( (hit = dynamic_cast<AliPHOSHit *>(next())) ) {
234 GetHitsData(0)->Fill( hit->GetEnergy()) ;
238 //____________________________________________________________________________
239 void AliPHOSQADataMaker::MakeHits(TTree * hitTree)
241 // make QA data from Hit Tree
243 TClonesArray * hits = new TClonesArray("AliPHOSHit", 1000);
245 TBranch * branch = hitTree->GetBranch("PHOS") ;
247 AliWarning("PHOS branch in Hit Tree not found") ;
249 TClonesArray * tmp = new TClonesArray("AliPHOSHit", 1000) ;
250 branch->SetAddress(&tmp) ;
252 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
253 branch->GetEntry(ientry) ;
254 for (Int_t ihit = 0 ; ihit < tmp->GetEntries() ; ihit++) {
255 AliPHOSHit * hit = dynamic_cast<AliPHOSHit *> (tmp->At(ihit)) ;
256 new((*hits)[index]) AliPHOSHit(*hit) ;
266 //____________________________________________________________________________
267 void AliPHOSQADataMaker::MakeDigits(TClonesArray * digits)
269 // makes data from Digits
271 GetDigitsData(1)->Fill(digits->GetEntriesFast()) ;
273 AliPHOSDigit * digit ;
274 while ( (digit = dynamic_cast<AliPHOSDigit *>(next())) ) {
275 GetDigitsData(0)->Fill( digit->GetEnergy()) ;
279 //____________________________________________________________________________
280 void AliPHOSQADataMaker::MakeDigits(TTree * digitTree)
282 // makes data from Digit Tree
283 TClonesArray * digits = new TClonesArray("AliPHOSDigit", 1000) ;
285 TBranch * branch = digitTree->GetBranch("PHOS") ;
287 AliWarning("PHOS branch in Digit Tree not found") ;
289 branch->SetAddress(&digits) ;
290 branch->GetEntry(0) ;
295 //____________________________________________________________________________
296 // void AliPHOSQADataMaker::MakeRecParticles(TTree * recpar)
298 // // makes data from RecParticles
300 // TClonesArray * recparticles = dynamic_cast<TClonesArray*>(fData) ;
301 // fhRecParticlesMul->Fill(recparticles->GetEntriesFast()) ;
302 // TIter next(recparticles) ;
303 // AliPHOSRecParticle * recparticle ;
304 // while ( (recparticle = dynamic_cast<AliPHOSRecParticle *>(next())) ) {
305 // fhRecParticles->Fill( recparticle->Energy()) ;
309 //____________________________________________________________________________
310 void AliPHOSQADataMaker::MakeRaws(AliRawReader* rawReader)
312 const Int_t modMax = 5 ;
314 AliPHOSRawDecoder decoder(rawReader);
315 decoder.SetOldRCUFormat(kTRUE);
316 decoder.SubtractPedestals(kTRUE);
319 while (decoder.NextDigit()) {
320 Int_t module = decoder.GetModule() ;
321 Int_t row = decoder.GetRow() ;
322 Int_t col = decoder.GetColumn() ;
323 Double_t time = decoder.GetTime() ;
324 Double_t energy = decoder.GetEnergy() ;
325 Bool_t lowGain = decoder.IsLowGain();
327 GetRawsData(module)->Fill(row, col) ;
328 GetRawsData(10)->Fill(module) ;
329 GetRawsData(12)->Fill(time) ;
330 GetRawsData(14)->Fill(energy) ;
332 GetRawsData(module+modMax)->Fill(row, col) ;
333 GetRawsData(11)->Fill(module) ;
334 GetRawsData(13)->Fill(time) ;
335 GetRawsData(15)->Fill(energy) ;
337 //AliInfo(Form(" %d %d %d %d %f %f\n", count, module, row, col, time, energy)) ;
342 //____________________________________________________________________________
343 void AliPHOSQADataMaker::MakeRecPoints(TTree * clustersTree)
346 // makes data from RecPoints
347 TBranch *emcbranch = clustersTree->GetBranch("PHOSEmcRP");
349 AliError("can't get the branch with the PHOS EMC clusters !");
352 TObjArray * emcrecpoints = new TObjArray(100) ;
353 emcbranch->SetAddress(&emcrecpoints);
354 emcbranch->GetEntry(0);
356 GetRecPointsData(1)->Fill(emcrecpoints->GetEntriesFast()) ;
357 TIter next(emcrecpoints) ;
358 AliPHOSEmcRecPoint * rp ;
359 while ( (rp = dynamic_cast<AliPHOSEmcRecPoint *>(next())) ) {
360 GetRecPointsData(0)->Fill( rp->GetEnergy()) ;
362 emcrecpoints->Delete();
366 TBranch *cpvbranch = clustersTree->GetBranch("PHOSCpvRP");
368 AliError("can't get the branch with the PHOS CPV clusters !");
371 TObjArray *cpvrecpoints = new TObjArray(100) ;
372 cpvbranch->SetAddress(&cpvrecpoints);
373 cpvbranch->GetEntry(0);
375 GetRecPointsData(1)->Fill(cpvrecpoints->GetEntriesFast()) ;
376 TIter next(cpvrecpoints) ;
377 AliPHOSCpvRecPoint * rp ;
378 while ( (rp = dynamic_cast<AliPHOSCpvRecPoint *>(next())) ) {
379 GetRecPointsData(0)->Fill( rp->GetEnergy()) ;
381 cpvrecpoints->Delete();
386 //____________________________________________________________________________
387 void AliPHOSQADataMaker::MakeSDigits(TClonesArray * sdigits)
389 // makes data from SDigits
391 GetSDigitsData(1)->Fill(sdigits->GetEntriesFast()) ;
392 TIter next(sdigits) ;
393 AliPHOSDigit * sdigit ;
394 while ( (sdigit = dynamic_cast<AliPHOSDigit *>(next())) ) {
395 GetSDigitsData(0)->Fill( sdigit->GetEnergy()) ;
399 //____________________________________________________________________________
400 void AliPHOSQADataMaker::MakeSDigits(TTree * sdigitTree)
402 // makes data from SDigit Tree
403 TClonesArray * sdigits = new TClonesArray("AliPHOSDigit", 1000) ;
405 TBranch * branch = sdigitTree->GetBranch("PHOS") ;
407 AliWarning("PHOS branch in SDigit Tree not found") ;
409 branch->SetAddress(&sdigits) ;
410 branch->GetEntry(0) ;
411 MakeSDigits(sdigits) ;
415 //____________________________________________________________________________
416 // void AliPHOSQADataMaker::MakeTrackSegments(TTree * ts)
418 // // makes data from TrackSegments
420 // TClonesArray * tracksegments = dynamic_cast<TClonesArray*>(fData) ;
422 // fhTrackSegmentsMul->Fill(tracksegments->GetEntriesFast()) ;
423 // TIter next(tracksegments) ;
424 // AliPHOSTrackSegment * ts ;
425 // while ( (ts = dynamic_cast<AliPHOSTrackSegment *>(next())) ) {
426 // fhTrackSegments->Fill( ts->GetCpvDistance()) ;
430 //____________________________________________________________________________
431 void AliPHOSQADataMaker::StartOfDetectorCycle()
433 //Detector specific actions at start of cycle