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: AliVZEROQADataMakerSim.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 "AliVZEROdigit.h"
36 #include "AliVZEROhit.h"
37 #include "AliVZEROQADataMakerSim.h"
38 #include "AliQAChecker.h"
40 ClassImp(AliVZEROQADataMakerSim)
42 //____________________________________________________________________________
43 AliVZEROQADataMakerSim::AliVZEROQADataMakerSim() :
44 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kVZERO), "VZERO Quality Assurance Data Maker")
52 //____________________________________________________________________________
53 AliVZEROQADataMakerSim::AliVZEROQADataMakerSim(const AliVZEROQADataMakerSim& qadm) :
58 SetName((const char*)qadm.GetName()) ;
59 SetTitle((const char*)qadm.GetTitle());
62 //__________________________________________________________________
63 AliVZEROQADataMakerSim& AliVZEROQADataMakerSim::operator = (const AliVZEROQADataMakerSim& qadm )
66 this->~AliVZEROQADataMakerSim();
67 new(this) AliVZEROQADataMakerSim(qadm);
70 //____________________________________________________________________________
71 void AliVZEROQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
73 //Detector specific actions at end of cycle
75 AliQAChecker::Instance()->Run(AliQAv1::kVZERO, task, list) ;
79 //____________________________________________________________________________
80 void AliVZEROQADataMakerSim::InitHits()
83 // create Hits histograms in Hits subdir
84 const Bool_t expert = kTRUE ;
85 const Bool_t image = kTRUE ;
87 TH1I * h0 = new TH1I("hHitMultiplicity", "Hit multiplicity distribution in VZERO;# of Hits;Entries", 300, 0, 299) ;
89 Add2HitsList(h0, 0, !expert, image) ;
91 TH1I * h1 = new TH1I("hHitCellNumber", "Hit cell distribution in VZERO;# of Hits;Entries", 80, 0, 79) ;
93 Add2HitsList(h1, 1, !expert, image) ;
97 //____________________________________________________________________________
98 void AliVZEROQADataMakerSim::InitDigits()
100 // create Digits histograms in Digits subdir
101 const Bool_t expert = kTRUE ;
102 const Bool_t image = kTRUE ;
110 // create Digits histograms in Digits subdir
111 TH1I * h0 = new TH1I("hDigitMultiplicity", "Digits multiplicity distribution in VZERO;# of Digits;Entries", 100, 0, 99) ;
113 Add2DigitsList(h0, 0, !expert, image) ;
115 for (Int_t i=0; i<64; i++)
117 sprintf(TDCname, "hDigitTDC%d", i);
118 sprintf(texte,"Digit TDC in cell %d; TDC value;Entries",i);
119 fhDigTDC[i] = new TH1I(TDCname,texte,300,0.,149.);
121 sprintf(ADCname,"hDigitADC%d",i);
122 sprintf(texte,"Digit ADC in cell %d;ADC value;Entries",i);
123 fhDigADC[i]= new TH1I(ADCname,texte,1024,0.,1023.);
125 Add2DigitsList(fhDigTDC[i],i+1, !expert, image);
126 Add2DigitsList(fhDigADC[i],i+1+64, !expert, image);
131 //____________________________________________________________________________
132 void AliVZEROQADataMakerSim::MakeHits(TClonesArray * hits)
134 //make QA data from Hits
136 // Check id histograms already created for this Event Specie
137 if ( ! GetHitsData(0) )
140 GetHitsData(0)->Fill(hits->GetEntriesFast()) ; // fills Hit multiplicity
141 Int_t nhits = hits->GetEntriesFast();
142 for (Int_t ihit=0;ihit<nhits;ihit++)
144 AliVZEROhit * VZEROHit = (AliVZEROhit*) hits->UncheckedAt(ihit);
146 AliError("The unchecked hit doesn't exist");
149 GetHitsData(1)->Fill(VZEROHit->Cell());
154 //____________________________________________________________________________
156 void AliVZEROQADataMakerSim::MakeHits(TTree *hitTree)
158 //fills QA histos for Hits
159 TClonesArray * hits = new TClonesArray("AliVZEROhit", 1000);
161 TBranch * branch = hitTree->GetBranch("VZERO") ;
163 AliWarning("VZERO branch in Hit Tree not found") ;
167 branch->SetAddress(&hits);
169 AliError("Branch VZERO hit not found");
172 // Check id histograms already created for this Event Specie
173 if ( ! GetHitsData(0) )
176 Int_t ntracks = (Int_t) hitTree->GetEntries();
178 if (ntracks<=0) return;
179 // Start loop on tracks in the hits containers
180 for (Int_t track=0; track<ntracks;track++) {
181 branch->GetEntry(track);
182 GetHitsData(0)->Fill(hits->GetEntriesFast()) ; // fills Hit multiplicity
183 Int_t nhits = hits->GetEntriesFast();
184 for (Int_t ihit=0;ihit<nhits;ihit++)
186 AliVZEROhit * VZEROHit = (AliVZEROhit*) hits->UncheckedAt(ihit);
188 AliError("The unchecked hit doesn't exist");
191 GetHitsData(1)->Fill(VZEROHit->Cell());
198 //____________________________________________________________________________
199 void AliVZEROQADataMakerSim::MakeDigits(TClonesArray * digits)
201 // makes data from Digits
203 // Check id histograms already created for this Event Specie
204 if ( ! GetDigitsData(0) )
207 GetDigitsData(0)->Fill(digits->GetEntriesFast()) ;
209 AliVZEROdigit *VZERODigit ;
210 while ( (VZERODigit = dynamic_cast<AliVZEROdigit *>(next())) ) {
211 Int_t PMNumber = VZERODigit->PMNumber();
212 GetDigitsData(PMNumber +1)->Fill( VZERODigit->Time()) ; // in 100 of picoseconds
213 GetDigitsData(PMNumber +1+64)->Fill( VZERODigit->ADC()) ;
218 //____________________________________________________________________________
219 void AliVZEROQADataMakerSim::MakeDigits(TTree *digitTree)
221 // makes data from Digit Tree
223 TClonesArray * digits = new TClonesArray("AliVZEROdigit", 1000) ;
225 TBranch * branch = digitTree->GetBranch("VZERODigit") ;
227 AliWarning("VZERO branch in Digit Tree not found") ;
229 branch->SetAddress(&digits) ;
230 branch->GetEntry(0) ;
236 //____________________________________________________________________________
237 void AliVZEROQADataMakerSim::StartOfDetectorCycle()
239 //Detector specific actions at start of cycle