]>
Commit | Line | Data |
---|---|---|
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 | |
43 | ClassImp(AliEMCALQADataMakerSim) | |
44 | ||
45 | //____________________________________________________________________________ | |
46 | AliEMCALQADataMakerSim::AliEMCALQADataMakerSim() : | |
47 | AliQADataMakerSim(AliQA::GetDetName(AliQA::kEMCAL), "EMCAL Quality Assurance Data Maker") | |
48 | { | |
49 | // ctor | |
50 | } | |
51 | ||
52 | //____________________________________________________________________________ | |
53 | AliEMCALQADataMakerSim::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 | //__________________________________________________________________ | |
62 | AliEMCALQADataMakerSim& AliEMCALQADataMakerSim::operator = (const AliEMCALQADataMakerSim& qadm ) | |
63 | { | |
64 | // Assign operator. | |
65 | this->~AliEMCALQADataMakerSim(); | |
66 | new(this) AliEMCALQADataMakerSim(qadm); | |
67 | return *this; | |
68 | } | |
69 | ||
70 | //____________________________________________________________________________ | |
57acd2d2 | 71 | void AliEMCALQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray ** list) |
94594e5d | 72 | { |
73 | //Detector specific actions at end of cycle | |
74 | // do the QA checking | |
75 | AliQAChecker::Instance()->Run(AliQA::kEMCAL, task, list) ; | |
76 | } | |
77 | ||
78 | //____________________________________________________________________________ | |
79 | void AliEMCALQADataMakerSim::InitHits() | |
80 | { | |
81 | // create Hits histograms in Hits subdir | |
601c73e3 | 82 | TH1F * h0 = new TH1F("hEmcalHits", "Hits energy distribution in EMCAL", 200, 0., 2.) ; //GeV |
94594e5d | 83 | h0->Sumw2() ; |
84 | Add2HitsList(h0, 0) ; | |
601c73e3 | 85 | TH1I * h1 = new TH1I("hEmcalHitsMul", "Hits multiplicity distribution in EMCAL", 1000, 0, 10000) ; |
94594e5d | 86 | h1->Sumw2() ; |
87 | Add2HitsList(h1, 1) ; | |
88 | } | |
89 | ||
90 | //____________________________________________________________________________ | |
91 | void AliEMCALQADataMakerSim::InitDigits() | |
92 | { | |
93 | // create Digits histograms in Digits subdir | |
601c73e3 | 94 | TH1I * h0 = new TH1I("hEmcalDigits", "Digits amplitude distribution in EMCAL", 500, 0, 500) ; |
94594e5d | 95 | h0->Sumw2() ; |
96 | Add2DigitsList(h0, 0) ; | |
601c73e3 | 97 | TH1I * h1 = new TH1I("hEmcalDigitsMul", "Digits multiplicity distribution in EMCAL", 200, 0, 2000) ; |
94594e5d | 98 | h1->Sumw2() ; |
99 | Add2DigitsList(h1, 1) ; | |
100 | } | |
101 | ||
102 | //____________________________________________________________________________ | |
103 | void AliEMCALQADataMakerSim::InitSDigits() | |
104 | { | |
105 | // create SDigits histograms in SDigits subdir | |
601c73e3 | 106 | TH1F * h0 = new TH1F("hEmcalSDigits", "SDigits energy distribution in EMCAL", 200, 0., 20.) ; |
94594e5d | 107 | h0->Sumw2() ; |
108 | Add2SDigitsList(h0, 0) ; | |
601c73e3 | 109 | TH1I * h1 = new TH1I("hEmcalSDigitsMul", "SDigits multiplicity distribution in EMCAL", 500, 0, 5000) ; |
94594e5d | 110 | h1->Sumw2() ; |
111 | Add2SDigitsList(h1, 1) ; | |
112 | } | |
113 | ||
114 | //____________________________________________________________________________ | |
115 | void AliEMCALQADataMakerSim::MakeHits(TClonesArray * hits) | |
116 | { | |
117 | //make QA data from Hits | |
118 | ||
119 | GetHitsData(1)->Fill(hits->GetEntriesFast()) ; | |
120 | TIter next(hits) ; | |
121 | AliEMCALHit * hit ; | |
122 | while ( (hit = dynamic_cast<AliEMCALHit *>(next())) ) { | |
123 | GetHitsData(0)->Fill( hit->GetEnergy()) ; | |
124 | } | |
125 | ||
126 | } | |
127 | ||
128 | //____________________________________________________________________________ | |
129 | void AliEMCALQADataMakerSim::MakeHits(TTree * hitTree) | |
130 | { | |
131 | // make QA data from Hit Tree | |
132 | ||
133 | TClonesArray * hits = new TClonesArray("AliEMCALHit", 1000); | |
134 | ||
135 | TBranch * branch = hitTree->GetBranch("EMCAL") ; | |
136 | if ( ! branch ) { | |
137 | AliWarning("EMCAL branch in Hit Tree not found") ; | |
138 | } else { | |
139 | TClonesArray * tmp = new TClonesArray("AliEMCALHit", 1000) ; | |
140 | branch->SetAddress(&tmp) ; | |
141 | Int_t index = 0 ; | |
142 | for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) { | |
143 | branch->GetEntry(ientry) ; | |
144 | for (Int_t ihit = 0 ; ihit < tmp->GetEntries() ; ihit++) { | |
145 | AliEMCALHit * hit = dynamic_cast<AliEMCALHit *> (tmp->At(ihit)) ; | |
146 | new((*hits)[index]) AliEMCALHit(*hit) ; | |
147 | index++ ; | |
148 | } | |
149 | } | |
150 | tmp->Delete() ; | |
151 | delete tmp ; | |
152 | MakeHits(hits) ; | |
153 | } | |
154 | } | |
155 | ||
156 | //____________________________________________________________________________ | |
157 | void AliEMCALQADataMakerSim::MakeDigits(TClonesArray * digits) | |
158 | { | |
159 | // makes data from Digits | |
160 | ||
161 | GetDigitsData(1)->Fill(digits->GetEntriesFast()) ; | |
162 | TIter next(digits) ; | |
163 | AliEMCALDigit * digit ; | |
164 | while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) { | |
165 | GetDigitsData(0)->Fill( digit->GetAmp()) ; | |
166 | } | |
167 | ||
168 | } | |
169 | ||
170 | //____________________________________________________________________________ | |
171 | void AliEMCALQADataMakerSim::MakeDigits(TTree * digitTree) | |
172 | { | |
173 | // makes data from Digit Tree | |
174 | TClonesArray * digits = new TClonesArray("AliEMCALDigit", 1000) ; | |
175 | ||
176 | TBranch * branch = digitTree->GetBranch("EMCAL") ; | |
177 | if ( ! branch ) { | |
178 | AliWarning("EMCAL branch in Digit Tree not found") ; | |
179 | } else { | |
180 | branch->SetAddress(&digits) ; | |
181 | branch->GetEntry(0) ; | |
182 | MakeDigits(digits) ; | |
183 | } | |
184 | ||
185 | } | |
186 | ||
187 | //____________________________________________________________________________ | |
188 | void AliEMCALQADataMakerSim::MakeSDigits(TClonesArray * sdigits) | |
189 | { | |
190 | // makes data from SDigits | |
601c73e3 | 191 | //Need a copy of the SDigitizer to calibrate the sdigit amplitude to |
192 | //energy in GeV | |
193 | AliEMCALSDigitizer* sDigitizer = new AliEMCALSDigitizer(); | |
194 | ||
94594e5d | 195 | GetSDigitsData(1)->Fill(sdigits->GetEntriesFast()) ; |
196 | TIter next(sdigits) ; | |
197 | AliEMCALDigit * sdigit ; | |
198 | while ( (sdigit = dynamic_cast<AliEMCALDigit *>(next())) ) { | |
601c73e3 | 199 | GetSDigitsData(0)->Fill( sDigitizer->Calibrate(sdigit->GetAmp())) ; |
94594e5d | 200 | } |
201 | ||
601c73e3 | 202 | delete sDigitizer; |
94594e5d | 203 | } |
204 | ||
205 | //____________________________________________________________________________ | |
206 | void AliEMCALQADataMakerSim::MakeSDigits(TTree * sdigitTree) | |
207 | { | |
208 | // makes data from SDigit Tree | |
209 | TClonesArray * sdigits = new TClonesArray("AliEMCALDigit", 1000) ; | |
210 | ||
211 | TBranch * branch = sdigitTree->GetBranch("EMCAL") ; | |
212 | if ( ! branch ) { | |
213 | AliWarning("EMCAL branch in SDigit Tree not found") ; | |
214 | } else { | |
215 | branch->SetAddress(&sdigits) ; | |
216 | branch->GetEntry(0) ; | |
217 | MakeSDigits(sdigits) ; | |
218 | } | |
219 | ||
220 | } | |
221 | ||
222 | //____________________________________________________________________________ | |
223 | void AliEMCALQADataMakerSim::StartOfDetectorCycle() | |
224 | { | |
225 | //Detector specific actions at start of cycle | |
226 | ||
227 | } |