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 **************************************************************************/
17 /* $Id: AliADQADataMakerSim.cxx 23123 2007-12-18 09:08:18Z hristov $ */
20 // Produces the data needed to calculate the quality assurance.
21 // All data must be mergeable objects.
25 // --- ROOT system ---
26 #include <TClonesArray.h>
29 #include <TDirectory.h>
30 // --- Standard library ---
32 // --- AliRoot header files ---
33 #include "AliESDEvent.h"
35 #include "AliADdigit.h"
36 #include "AliADSDigit.h"
38 #include "AliADQADataMakerSim.h"
39 #include "AliQAChecker.h"
41 ClassImp(AliADQADataMakerSim)
43 //____________________________________________________________________________
44 AliADQADataMakerSim::AliADQADataMakerSim() :
45 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kAD), "AD Quality Assurance Data Maker")
53 //____________________________________________________________________________
54 AliADQADataMakerSim::AliADQADataMakerSim(const AliADQADataMakerSim& qadm) :
59 SetName((const char*)qadm.GetName()) ;
60 SetTitle((const char*)qadm.GetTitle());
63 //__________________________________________________________________
64 AliADQADataMakerSim& AliADQADataMakerSim::operator = (const AliADQADataMakerSim& qadm )
67 this->~AliADQADataMakerSim();
68 new(this) AliADQADataMakerSim(qadm);
71 //____________________________________________________________________________
72 void AliADQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
74 //Detector specific actions at end of cycle
76 ResetEventTrigClasses();
77 AliQAChecker::Instance()->Run(AliQAv1::kAD, task, list) ;
81 //____________________________________________________________________________
82 void AliADQADataMakerSim::InitHits()
85 // create Hits histograms in Hits subdir
86 const Bool_t expert = kTRUE ;
87 const Bool_t image = kTRUE ;
89 TH1I * h0 = new TH1I("hHitMultiplicity", "Hit multiplicity distribution in AD;# of Hits;Entries", 300, 0, 299) ;
91 Add2HitsList(h0, 0, !expert, image) ;
93 TH1I * h1 = new TH1I("hHitCellNumber", "Hit cell distribution in AD;Cell;# of Hits", 16, 0, 16) ;
95 Add2HitsList(h1, 1, !expert, image) ;
97 TH1I * h2 = new TH1I("hHitNPhotons", "Number of photons per hit in AD;# of Photons;Entries", 1000, 0, 50000) ;
99 Add2HitsList(h2, 2, expert, image) ;
102 ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
106 //____________________________________________________________________________
107 void AliADQADataMakerSim::InitSDigits()
109 // create Digits histograms in Digits subdir
110 const Bool_t expert = kTRUE ;
111 const Bool_t image = kTRUE ;
113 TH1I *fhSDigCharge[16];
115 // create SDigits histograms in SDigits subdir
116 TH1I * h0 = new TH1I("hSDigitMultiplicity", "SDigits multiplicity distribution in AD;# of Digits;Entries", 100, 0, 99) ;
118 Add2DigitsList(h0, 0, !expert, image) ;
120 for (Int_t i=0; i<16; i++)
122 fhSDigCharge[i] = new TH1I(Form("hSDigitCharge%d", i),Form("SDigit charges in cell %d; Time;Entries",i),1700,0.,1700);
124 Add2SDigitsList(fhSDigCharge[i],i+1, !expert, image);
128 ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line
133 //____________________________________________________________________________
134 void AliADQADataMakerSim::InitDigits()
136 // create Digits histograms in Digits subdir
137 const Bool_t expert = kTRUE ;
138 const Bool_t image = kTRUE ;
143 // create Digits histograms in Digits subdir
144 TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in AD;# of Digits;Entries", 100, 0, 99) ;
146 Add2DigitsList(h0, 0, !expert, image) ;
148 for (Int_t i=0; i<16; i++)
150 fhDigTDC[i] = new TH1I(Form("hDigitTDC%d", i),Form("Digit TDC in cell %d; TDC value;Entries",i),300,0.,149.);
151 fhDigADC[i]= new TH1I(Form("hDigitADC%d", i),Form("Digit ADC in cell %d;ADC value;Entries",i),1024,0.,1023.);
153 Add2DigitsList(fhDigTDC[i],i+1, !expert, image);
154 Add2DigitsList(fhDigADC[i],i+1+16, !expert, image);
157 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
161 //____________________________________________________________________________
162 void AliADQADataMakerSim::MakeHits()
164 //make QA data from Hits
166 Int_t nhits = fHitsArray->GetEntriesFast();
167 FillHitsData(0,nhits) ; // fills Hit multiplicity
168 for (Int_t ihit=0;ihit<nhits;ihit++)
170 AliADhit * ADHit = (AliADhit*) fHitsArray->UncheckedAt(ihit);
172 AliError("The unchecked hit doesn't exist");
175 FillHitsData(1,ADHit->GetCell());
176 FillHitsData(2,ADHit->GetNphot());
181 //____________________________________________________________________________
183 void AliADQADataMakerSim::MakeHits(TTree *hitTree)
185 //fills QA histos for Hits
187 fHitsArray->Clear() ;
189 fHitsArray = new TClonesArray("AliADhit", 1000);
191 TBranch * branch = hitTree->GetBranch("AD") ;
193 AliWarning("AD branch in Hit Tree not found") ;
197 branch->SetAddress(&fHitsArray);
199 AliError("Branch AD hit not found");
202 // Check id histograms already created for this Event Specie
203 if ( ! GetHitsData(0) )
206 Int_t ntracks = (Int_t) hitTree->GetEntries();
208 if (ntracks<=0) return;
209 // Start loop on tracks in the hits containers
210 for (Int_t track=0; track<ntracks;track++) {
211 branch->GetEntry(track);
212 Int_t nhits = fHitsArray->GetEntriesFast();
213 FillHitsData(0,nhits) ; // fills Hit multiplicity
214 for (Int_t ihit=0;ihit<nhits;ihit++)
216 AliADhit * ADHit = (AliADhit*) fHitsArray->UncheckedAt(ihit);
218 AliError("The unchecked hit doesn't exist");
221 FillHitsData(1,ADHit->GetCell());
222 FillHitsData(2,ADHit->GetNphot());
227 IncEvCountCycleHits();
228 IncEvCountTotalHits();
234 //____________________________________________________________________________
235 void AliADQADataMakerSim::MakeSDigits(TTree *sdigitTree)
237 // makes data from Digit Tree
240 fSDigitsArray->Clear() ;
242 fSDigitsArray = new TClonesArray("AliADSDigit", 1000) ;
244 TBranch * branch = sdigitTree->GetBranch("ADSDigit") ;
246 AliWarning("AD branch in SDigit Tree not found") ;
248 branch->SetAddress(&fSDigitsArray) ;
249 branch->GetEntry(0) ;
253 IncEvCountCycleDigits();
254 IncEvCountTotalDigits();
258 //____________________________________________________________________________
259 void AliADQADataMakerSim::MakeSDigits()
261 // makes data from SDigits
263 FillSDigitsData(0,fSDigitsArray->GetEntriesFast()) ;
264 TIter next(fSDigitsArray) ;
265 AliADSDigit *ADSDigit ;
266 while ( (ADSDigit = dynamic_cast<AliADSDigit *>(next())) ) {
267 Int_t PMNumber = ADSDigit->PMNumber();
268 FillSDigitsData(PMNumber +1, ADSDigit->GetNBins()) ;
273 //____________________________________________________________________________
274 void AliADQADataMakerSim::MakeDigits()
276 // makes data from Digits
278 FillDigitsData(0,fDigitsArray->GetEntriesFast()) ;
279 TIter next(fDigitsArray) ;
280 AliADdigit *ADDigit ;
281 while ( (ADDigit = dynamic_cast<AliADdigit *>(next())) ) {
282 Int_t PMNumber = ADDigit->PMNumber();
283 FillDigitsData(PMNumber +1, ADDigit->Time()) ; // in 100 of picoseconds
284 FillDigitsData(PMNumber +1+16, ADDigit->ADC()) ;
288 //____________________________________________________________________________
289 void AliADQADataMakerSim::MakeDigits(TTree *digitTree)
291 // makes data from Digit Tree
294 fDigitsArray->Clear() ;
296 fDigitsArray = new TClonesArray("AliADdigit", 1000) ;
298 TBranch * branch = digitTree->GetBranch("ADDigit") ;
300 AliWarning("AD branch in Digit Tree not found") ;
302 branch->SetAddress(&fDigitsArray) ;
303 branch->GetEntry(0) ;
307 IncEvCountCycleDigits();
308 IncEvCountTotalDigits();
313 //____________________________________________________________________________
314 void AliADQADataMakerSim::StartOfDetectorCycle()
316 //Detector specific actions at start of cycle