]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALQADataMakerSim.cxx
Removing a comma that gcc 3.4 does not like ;-)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALQADataMakerSim.cxx
CommitLineData
94594e5d 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 Produces the data needed to calculate the quality assurance.
18 All data must be mergeable objects.
19
20 Based on PHOS code written by
21 Y. Schutz CERN July 2007
22*/
23
24// --- ROOT system ---
25#include <TClonesArray.h>
26#include <TFile.h>
27#include <TH1F.h>
28#include <TH1I.h>
29#include <TH2F.h>
30#include <TTree.h>
31
32// --- Standard library ---
33
34// --- AliRoot header files ---
35#include "AliESDCaloCluster.h"
36#include "AliLog.h"
37#include "AliEMCALDigit.h"
38#include "AliEMCALHit.h"
39#include "AliEMCALQADataMakerSim.h"
40#include "AliQAChecker.h"
601c73e3 41#include "AliEMCALSDigitizer.h"
94594e5d 42
43ClassImp(AliEMCALQADataMakerSim)
44
45//____________________________________________________________________________
46 AliEMCALQADataMakerSim::AliEMCALQADataMakerSim() :
4e25ac79 47 AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kEMCAL), "EMCAL Quality Assurance Data Maker")
94594e5d 48{
49 // ctor
50}
51
52//____________________________________________________________________________
53AliEMCALQADataMakerSim::AliEMCALQADataMakerSim(const AliEMCALQADataMakerSim& qadm) :
54 AliQADataMakerSim()
55{
56 //copy ctor
57 SetName((const char*)qadm.GetName()) ;
58 SetTitle((const char*)qadm.GetTitle());
59}
60
61//__________________________________________________________________
62AliEMCALQADataMakerSim& AliEMCALQADataMakerSim::operator = (const AliEMCALQADataMakerSim& qadm )
63{
64 // Assign operator.
65 this->~AliEMCALQADataMakerSim();
66 new(this) AliEMCALQADataMakerSim(qadm);
67 return *this;
68}
69
70//____________________________________________________________________________
4e25ac79 71void AliEMCALQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
94594e5d 72{
73 //Detector specific actions at end of cycle
74 // do the QA checking
4e25ac79 75 AliQAChecker::Instance()->Run(AliQAv1::kEMCAL, task, list) ;
94594e5d 76}
77
78//____________________________________________________________________________
79void AliEMCALQADataMakerSim::InitHits()
80{
81 // create Hits histograms in Hits subdir
7d297381 82 const Bool_t expert = kTRUE ;
83 const Bool_t image = kTRUE ;
84
db72ff3b 85 TH1F * h0 = new TH1F("hEmcalHits", "Hits energy distribution in EMCAL;Energy [MeV];Counts", 200, 0., 2.) ; //GeV
94594e5d 86 h0->Sumw2() ;
7d297381 87 Add2HitsList(h0, 0, !expert, image) ;
db72ff3b 88 TH1I * h1 = new TH1I("hEmcalHitsMul", "Hits multiplicity distribution in EMCAL;# of Hits;Entries", 1000, 0, 10000) ;
94594e5d 89 h1->Sumw2() ;
7d297381 90 Add2HitsList(h1, 1, !expert, image) ;
94594e5d 91}
92
93//____________________________________________________________________________
94void AliEMCALQADataMakerSim::InitDigits()
95{
96 // create Digits histograms in Digits subdir
7d297381 97 const Bool_t expert = kTRUE ;
98 const Bool_t image = kTRUE ;
99
db72ff3b 100 TH1I * h0 = new TH1I("hEmcalDigits", "Digits amplitude distribution in EMCAL;Amplitude [ADC counts];Counts", 500, 0, 500) ;
94594e5d 101 h0->Sumw2() ;
7d297381 102 Add2DigitsList(h0, 0, !expert, image) ;
db72ff3b 103 TH1I * h1 = new TH1I("hEmcalDigitsMul", "Digits multiplicity distribution in EMCAL;# of Digits;Entries", 200, 0, 2000) ;
94594e5d 104 h1->Sumw2() ;
7d297381 105 Add2DigitsList(h1, 1, !expert, image) ;
94594e5d 106}
107
108//____________________________________________________________________________
109void AliEMCALQADataMakerSim::InitSDigits()
110{
111 // create SDigits histograms in SDigits subdir
7d297381 112 const Bool_t expert = kTRUE ;
113 const Bool_t image = kTRUE ;
114
db72ff3b 115 TH1F * h0 = new TH1F("hEmcalSDigits", "SDigits energy distribution in EMCAL;Energy [MeV];Counts", 200, 0., 20.) ;
94594e5d 116 h0->Sumw2() ;
7d297381 117 Add2SDigitsList(h0, 0, !expert, image) ;
db72ff3b 118 TH1I * h1 = new TH1I("hEmcalSDigitsMul", "SDigits multiplicity distribution in EMCAL;# of SDigits;Entries", 500, 0, 5000) ;
94594e5d 119 h1->Sumw2() ;
7d297381 120 Add2SDigitsList(h1, 1, !expert, image) ;
94594e5d 121}
122
123//____________________________________________________________________________
124void AliEMCALQADataMakerSim::MakeHits(TClonesArray * hits)
125{
126 //make QA data from Hits
127
eca4fa66 128
129 // Check id histograms already created for this Event Specie
130 if ( ! GetHitsData(0) )
131 InitHits() ;
132
94594e5d 133 GetHitsData(1)->Fill(hits->GetEntriesFast()) ;
134 TIter next(hits) ;
135 AliEMCALHit * hit ;
136 while ( (hit = dynamic_cast<AliEMCALHit *>(next())) ) {
137 GetHitsData(0)->Fill( hit->GetEnergy()) ;
138 }
139
140}
141
142//____________________________________________________________________________
143void AliEMCALQADataMakerSim::MakeHits(TTree * hitTree)
144{
145 // make QA data from Hit Tree
146
147 TClonesArray * hits = new TClonesArray("AliEMCALHit", 1000);
148
149 TBranch * branch = hitTree->GetBranch("EMCAL") ;
150 if ( ! branch ) {
151 AliWarning("EMCAL branch in Hit Tree not found") ;
152 } else {
153 TClonesArray * tmp = new TClonesArray("AliEMCALHit", 1000) ;
154 branch->SetAddress(&tmp) ;
155 Int_t index = 0 ;
156 for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
157 branch->GetEntry(ientry) ;
158 for (Int_t ihit = 0 ; ihit < tmp->GetEntries() ; ihit++) {
159 AliEMCALHit * hit = dynamic_cast<AliEMCALHit *> (tmp->At(ihit)) ;
160 new((*hits)[index]) AliEMCALHit(*hit) ;
161 index++ ;
162 }
163 }
164 tmp->Delete() ;
165 delete tmp ;
166 MakeHits(hits) ;
167 }
168}
169
170//____________________________________________________________________________
171void AliEMCALQADataMakerSim::MakeDigits(TClonesArray * digits)
172{
173 // makes data from Digits
174
eca4fa66 175
176 // Check id histograms already created for this Event Specie
177 if ( ! GetDigitsData(0) )
178 InitDigits() ;
179
94594e5d 180 GetDigitsData(1)->Fill(digits->GetEntriesFast()) ;
181 TIter next(digits) ;
182 AliEMCALDigit * digit ;
183 while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) {
184 GetDigitsData(0)->Fill( digit->GetAmp()) ;
185 }
186
187}
188
189//____________________________________________________________________________
190void AliEMCALQADataMakerSim::MakeDigits(TTree * digitTree)
191{
192 // makes data from Digit Tree
193 TClonesArray * digits = new TClonesArray("AliEMCALDigit", 1000) ;
194
195 TBranch * branch = digitTree->GetBranch("EMCAL") ;
196 if ( ! branch ) {
197 AliWarning("EMCAL branch in Digit Tree not found") ;
198 } else {
199 branch->SetAddress(&digits) ;
200 branch->GetEntry(0) ;
201 MakeDigits(digits) ;
202 }
203
204}
205
206//____________________________________________________________________________
207void AliEMCALQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
208{
209 // makes data from SDigits
601c73e3 210 //Need a copy of the SDigitizer to calibrate the sdigit amplitude to
211 //energy in GeV
eca4fa66 212
213 // Check id histograms already created for this Event Specie
214 if ( ! GetSDigitsData(0) )
215 InitSDigits() ;
216
601c73e3 217 AliEMCALSDigitizer* sDigitizer = new AliEMCALSDigitizer();
218
94594e5d 219 GetSDigitsData(1)->Fill(sdigits->GetEntriesFast()) ;
220 TIter next(sdigits) ;
221 AliEMCALDigit * sdigit ;
222 while ( (sdigit = dynamic_cast<AliEMCALDigit *>(next())) ) {
601c73e3 223 GetSDigitsData(0)->Fill( sDigitizer->Calibrate(sdigit->GetAmp())) ;
94594e5d 224 }
225
601c73e3 226 delete sDigitizer;
94594e5d 227}
228
229//____________________________________________________________________________
230void AliEMCALQADataMakerSim::MakeSDigits(TTree * sdigitTree)
231{
232 // makes data from SDigit Tree
233 TClonesArray * sdigits = new TClonesArray("AliEMCALDigit", 1000) ;
234
235 TBranch * branch = sdigitTree->GetBranch("EMCAL") ;
236 if ( ! branch ) {
237 AliWarning("EMCAL branch in SDigit Tree not found") ;
238 } else {
239 branch->SetAddress(&sdigits) ;
240 branch->GetEntry(0) ;
241 MakeSDigits(sdigits) ;
242 }
243
244}
245
246//____________________________________________________________________________
247void AliEMCALQADataMakerSim::StartOfDetectorCycle()
248{
249 //Detector specific actions at start of cycle
250
251}