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"
47 #include "AliPHOSReconstructor.h"
48 #include "AliPHOSRecoParam.h"
50 ClassImp(AliPHOSQADataMaker)
52 //____________________________________________________________________________
53 AliPHOSQADataMaker::AliPHOSQADataMaker() :
54 AliQADataMaker(AliQA::GetDetName(AliQA::kPHOS), "PHOS Quality Assurance Data Maker")
59 //____________________________________________________________________________
60 AliPHOSQADataMaker::AliPHOSQADataMaker(const AliPHOSQADataMaker& qadm) :
64 SetName((const char*)qadm.GetName()) ;
65 SetTitle((const char*)qadm.GetTitle());
68 //__________________________________________________________________
69 AliPHOSQADataMaker& AliPHOSQADataMaker::operator = (const AliPHOSQADataMaker& qadm )
72 this->~AliPHOSQADataMaker();
73 new(this) AliPHOSQADataMaker(qadm);
77 //____________________________________________________________________________
78 void AliPHOSQADataMaker::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray * list)
80 //Detector specific actions at end of cycle
82 AliQAChecker::Instance()->Run(AliQA::kPHOS, task, list) ;
85 //____________________________________________________________________________
86 void AliPHOSQADataMaker::InitESDs()
88 //create ESDs histograms in ESDs subdir
90 TH1F * h0 = new TH1F("hPhosESDs", "ESDs energy distribution in PHOS", 100, 0., 100.) ;
93 TH1I * h1 = new TH1I("hPhosESDsMul", "ESDs multiplicity distribution in PHOS", 100, 0., 100) ;
98 //____________________________________________________________________________
99 void AliPHOSQADataMaker::InitHits()
101 // create Hits histograms in Hits subdir
102 TH1F * h0 = new TH1F("hPhosHits", "Hits energy distribution in PHOS", 100, 0., 100.) ;
104 Add2HitsList(h0, 0) ;
105 TH1I * h1 = new TH1I("hPhosHitsMul", "Hits multiplicity distribution in PHOS", 500, 0., 10000) ;
107 Add2HitsList(h1, 1) ;
110 //____________________________________________________________________________
111 void AliPHOSQADataMaker::InitDigits()
113 // create Digits histograms in Digits subdir
114 TH1I * h0 = new TH1I("hPhosDigits", "Digits amplitude distribution in PHOS", 500, 0, 5000) ;
116 Add2DigitsList(h0, 0) ;
117 TH1I * h1 = new TH1I("hPhosDigitsMul", "Digits multiplicity distribution in PHOS", 500, 0, 1000) ;
119 Add2DigitsList(h1, 1) ;
122 //____________________________________________________________________________
123 //void AliPHOSQADataMaker::InitRecParticles()
125 // // create Reconstructed particles histograms in RecParticles subdir
126 // fhRecParticles = new TH1F("hPhosRecParticles", "RecParticles energy distribution in PHOS", 100, 0., 100.) ;
127 // fhRecParticles->Sumw2() ;
128 // fhRecParticlesMul = new TH1I("hPhosRecParticlesMul", "RecParticles multiplicity distribution in PHOS", 100, 0, 100) ;
129 // fhRecParticlesMul->Sumw2() ;
132 //____________________________________________________________________________
133 void AliPHOSQADataMaker::InitRecPoints()
135 // create Reconstructed Points histograms in RecPoints subdir
136 TH1F * h0 = new TH1F("hEmcPhosRecPoints", "EMCA RecPoints energy distribution in PHOS", 100, 0., 100.) ;
138 Add2RecPointsList(h0, 0) ;
139 TH1I * h1 = new TH1I("hEmcPhosRecPointsMul", "EMCA RecPoints multiplicity distribution in PHOS", 100, 0, 100) ;
141 Add2RecPointsList(h1, 1) ;
143 TH1F * h2 = new TH1F("hCpvPhosRecPoints", "CPV RecPoints energy distribution in PHOS", 100, 0., 100.) ;
145 Add2RecPointsList(h2, 2) ;
146 TH1I * h3 = new TH1I("hCpvPhosRecPointsMul", "CPV RecPoints multiplicity distribution in PHOS", 100, 0, 100) ;
148 Add2RecPointsList(h3, 3) ;
151 //____________________________________________________________________________
152 void AliPHOSQADataMaker::InitRaws()
154 // create Raws histograms in Raws subdir
155 const Int_t modMax = 5 ;
156 TH2I * h0[modMax*2] ;
159 for (Int_t mod = 0; mod < modMax; mod++) {
160 sprintf(title, "Low Gain Rows x Columns for PHOS module %d", mod) ;
161 sprintf(name, "hLowPHOSxyMod%d", mod) ;
162 h0[mod] = new TH2I(name, title, 64, 1, 65, 56, 1, 57) ;
163 Add2RawsList(h0[mod], mod) ;
164 sprintf(title, "High Gain Rows x Columns for PHOS module %d", mod) ;
165 sprintf(name, "hHighPHOSxyMod%d", mod) ;
166 h0[mod+modMax] = new TH2I(name, title, 64, 1, 65, 56, 1, 57) ;
167 Add2RawsList(h0[mod+modMax], mod+modMax) ;
169 TH1I * h10 = new TH1I("hLowPhosModules", "Low Gain Hits in EMCA PHOS modules", 6, 0, 6) ;
171 Add2RawsList(h10, 10) ;
172 TH1I * h11 = new TH1I("hHighPhosModules", "High Gain Hits in EMCA PHOS modules", 6, 0, 6) ;
174 Add2RawsList(h11, 11) ;
175 TH1F * h12 = new TH1F("hLowPhosRawtime", "Low Gain Time of raw hits in PHOS", 100, 0, 100.) ;
177 Add2RawsList(h12, 12) ;
178 TH1F * h13 = new TH1F("hHighPhosRawtime", "High Gain Time of raw hits in PHOS", 100, 0, 100.) ;
180 Add2RawsList(h13, 13) ;
181 TH1F * h14 = new TH1F("hLowPhosRawEnergy", "Low Gain Energy of raw hits in PHOS", 100, 0., 100.) ;
183 Add2RawsList(h14, 14) ;
184 TH1F * h15 = new TH1F("hHighPhosRawEnergy", "High Gain Energy of raw hits in PHOS", 100, 0., 100.) ;
186 Add2RawsList(h15, 15) ;
190 //____________________________________________________________________________
191 void AliPHOSQADataMaker::InitSDigits()
193 // create SDigits histograms in SDigits subdir
194 TH1F * h0 = new TH1F("hPhosSDigits", "SDigits energy distribution in PHOS", 100, 0., 100.) ;
196 Add2SDigitsList(h0, 0) ;
197 TH1I * h1 = new TH1I("hPhosSDigitsMul", "SDigits multiplicity distribution in PHOS", 500, 0, 10000) ;
199 Add2SDigitsList(h1, 1) ;
202 //____________________________________________________________________________
203 //void AliPHOSQADataMaker::InitTrackSegments()
205 // // create Track Segments histograms in TrackSegments subdir
206 // fhTrackSegments = new TH1F("hPhosTrackSegments", "TrackSegments EMC-CPV distance in PHOS", 500, 0., 5000.) ;
207 // fhTrackSegments->Sumw2() ;
208 // fhTrackSegmentsMul = new TH1I("hPhosTrackSegmentsMul", "TrackSegments multiplicity distribution in PHOS", 100, 0, 100) ;
209 // fhTrackSegmentsMul->Sumw2() ;
212 //____________________________________________________________________________
213 void AliPHOSQADataMaker::MakeESDs(AliESDEvent * esd)
215 // make QA data from ESDs
218 for ( Int_t index = 0; index < esd->GetNumberOfCaloClusters() ; index++ ) {
219 AliESDCaloCluster * clu = esd->GetCaloCluster(index) ;
220 if ( clu->IsPHOS() ) {
221 GetESDsData(0)->Fill(clu->E()) ;
225 GetESDsData(1)->Fill(count) ;
228 //____________________________________________________________________________
229 void AliPHOSQADataMaker::MakeHits(TClonesArray * hits)
231 //make QA data from Hits
233 GetHitsData(1)->Fill(hits->GetEntriesFast()) ;
236 while ( (hit = dynamic_cast<AliPHOSHit *>(next())) ) {
237 GetHitsData(0)->Fill( hit->GetEnergy()) ;
241 //____________________________________________________________________________
242 void AliPHOSQADataMaker::MakeHits(TTree * hitTree)
244 // make QA data from Hit Tree
246 TClonesArray * hits = new TClonesArray("AliPHOSHit", 1000);
248 TBranch * branch = hitTree->GetBranch("PHOS") ;
250 AliWarning("PHOS branch in Hit Tree not found") ;
252 TClonesArray * tmp = new TClonesArray("AliPHOSHit", 1000) ;
253 branch->SetAddress(&tmp) ;
255 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
256 branch->GetEntry(ientry) ;
257 for (Int_t ihit = 0 ; ihit < tmp->GetEntries() ; ihit++) {
258 AliPHOSHit * hit = dynamic_cast<AliPHOSHit *> (tmp->At(ihit)) ;
259 new((*hits)[index]) AliPHOSHit(*hit) ;
269 //____________________________________________________________________________
270 void AliPHOSQADataMaker::MakeDigits(TClonesArray * digits)
272 // makes data from Digits
274 GetDigitsData(1)->Fill(digits->GetEntriesFast()) ;
276 AliPHOSDigit * digit ;
277 while ( (digit = dynamic_cast<AliPHOSDigit *>(next())) ) {
278 GetDigitsData(0)->Fill( digit->GetEnergy()) ;
282 //____________________________________________________________________________
283 void AliPHOSQADataMaker::MakeDigits(TTree * digitTree)
285 // makes data from Digit Tree
286 TClonesArray * digits = new TClonesArray("AliPHOSDigit", 1000) ;
288 TBranch * branch = digitTree->GetBranch("PHOS") ;
290 AliWarning("PHOS branch in Digit Tree not found") ;
292 branch->SetAddress(&digits) ;
293 branch->GetEntry(0) ;
298 //____________________________________________________________________________
299 // void AliPHOSQADataMaker::MakeRecParticles(TTree * recpar)
301 // // makes data from RecParticles
303 // TClonesArray * recparticles = dynamic_cast<TClonesArray*>(fData) ;
304 // fhRecParticlesMul->Fill(recparticles->GetEntriesFast()) ;
305 // TIter next(recparticles) ;
306 // AliPHOSRecParticle * recparticle ;
307 // while ( (recparticle = dynamic_cast<AliPHOSRecParticle *>(next())) ) {
308 // fhRecParticles->Fill( recparticle->Energy()) ;
312 //____________________________________________________________________________
313 void AliPHOSQADataMaker::MakeRaws(AliRawReader* rawReader)
315 const Int_t modMax = 5 ;
317 AliPHOSRawDecoder decoder(rawReader);
318 decoder.SubtractPedestals(AliPHOSReconstructor::GetRecoParamEmc()->SubtractPedestals());
320 while (decoder.NextDigit()) {
321 Int_t module = decoder.GetModule() ;
322 Int_t row = decoder.GetRow() ;
323 Int_t col = decoder.GetColumn() ;
324 Double_t time = decoder.GetTime() ;
325 Double_t energy = decoder.GetEnergy() ;
326 Bool_t lowGain = decoder.IsLowGain();
328 GetRawsData(module)->Fill(row, col) ;
329 GetRawsData(10)->Fill(module) ;
330 GetRawsData(12)->Fill(time) ;
331 GetRawsData(14)->Fill(energy) ;
333 GetRawsData(module+modMax)->Fill(row, col) ;
334 GetRawsData(11)->Fill(module) ;
335 GetRawsData(13)->Fill(time) ;
336 GetRawsData(15)->Fill(energy) ;
338 //AliInfo(Form(" %d %d %d %d %f %f\n", count, module, row, col, time, energy)) ;
343 //____________________________________________________________________________
344 void AliPHOSQADataMaker::MakeRecPoints(TTree * clustersTree)
347 // makes data from RecPoints
348 TBranch *emcbranch = clustersTree->GetBranch("PHOSEmcRP");
350 AliError("can't get the branch with the PHOS EMC clusters !");
353 TObjArray * emcrecpoints = new TObjArray(100) ;
354 emcbranch->SetAddress(&emcrecpoints);
355 emcbranch->GetEntry(0);
357 GetRecPointsData(1)->Fill(emcrecpoints->GetEntriesFast()) ;
358 TIter next(emcrecpoints) ;
359 AliPHOSEmcRecPoint * rp ;
360 while ( (rp = dynamic_cast<AliPHOSEmcRecPoint *>(next())) ) {
361 GetRecPointsData(0)->Fill( rp->GetEnergy()) ;
363 emcrecpoints->Delete();
367 TBranch *cpvbranch = clustersTree->GetBranch("PHOSCpvRP");
369 AliError("can't get the branch with the PHOS CPV clusters !");
372 TObjArray *cpvrecpoints = new TObjArray(100) ;
373 cpvbranch->SetAddress(&cpvrecpoints);
374 cpvbranch->GetEntry(0);
376 GetRecPointsData(1)->Fill(cpvrecpoints->GetEntriesFast()) ;
377 TIter next(cpvrecpoints) ;
378 AliPHOSCpvRecPoint * rp ;
379 while ( (rp = dynamic_cast<AliPHOSCpvRecPoint *>(next())) ) {
380 GetRecPointsData(0)->Fill( rp->GetEnergy()) ;
382 cpvrecpoints->Delete();
387 //____________________________________________________________________________
388 void AliPHOSQADataMaker::MakeSDigits(TClonesArray * sdigits)
390 // makes data from SDigits
392 GetSDigitsData(1)->Fill(sdigits->GetEntriesFast()) ;
393 TIter next(sdigits) ;
394 AliPHOSDigit * sdigit ;
395 while ( (sdigit = dynamic_cast<AliPHOSDigit *>(next())) ) {
396 GetSDigitsData(0)->Fill( sdigit->GetEnergy()) ;
400 //____________________________________________________________________________
401 void AliPHOSQADataMaker::MakeSDigits(TTree * sdigitTree)
403 // makes data from SDigit Tree
404 TClonesArray * sdigits = new TClonesArray("AliPHOSDigit", 1000) ;
406 TBranch * branch = sdigitTree->GetBranch("PHOS") ;
408 AliWarning("PHOS branch in SDigit Tree not found") ;
410 branch->SetAddress(&sdigits) ;
411 branch->GetEntry(0) ;
412 MakeSDigits(sdigits) ;
416 //____________________________________________________________________________
417 // void AliPHOSQADataMaker::MakeTrackSegments(TTree * ts)
419 // // makes data from TrackSegments
421 // TClonesArray * tracksegments = dynamic_cast<TClonesArray*>(fData) ;
423 // fhTrackSegmentsMul->Fill(tracksegments->GetEntriesFast()) ;
424 // TIter next(tracksegments) ;
425 // AliPHOSTrackSegment * ts ;
426 // while ( (ts = dynamic_cast<AliPHOSTrackSegment *>(next())) ) {
427 // fhTrackSegments->Fill( ts->GetCpvDistance()) ;
431 //____________________________________________________________________________
432 void AliPHOSQADataMaker::StartOfDetectorCycle()
434 //Detector specific actions at start of cycle