Line data Source code
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 : // --- Standard library ---
17 : #include <Riostream.h>
18 : // --- ROOT system ---
19 : #include <TClonesArray.h>
20 : #include <TFile.h>
21 : #include <TH1F.h>
22 : #include <TH2F.h>
23 : #include <TBranch.h>
24 : #include <TTree.h>
25 : // --- AliRoot header files ---
26 : #include "AliLog.h"
27 : #include "AliQAChecker.h"
28 : #include "AliZDCQADataMakerSim.h"
29 : #include "AliZDCHit.h"
30 : #include "AliZDCDigit.h"
31 :
32 12 : ClassImp(AliZDCQADataMakerSim)
33 :
34 : //____________________________________________________________________________
35 : AliZDCQADataMakerSim::AliZDCQADataMakerSim() :
36 3 : AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kZDC), "ZDC Quality Assurance Data Maker")
37 5 : {
38 : // ctor
39 2 : }
40 :
41 : //____________________________________________________________________________
42 : AliZDCQADataMakerSim::AliZDCQADataMakerSim(const AliZDCQADataMakerSim& qadm) :
43 0 : AliQADataMakerSim()
44 0 : {
45 : //copy ctor
46 0 : SetName((const char*)qadm.GetName());
47 0 : SetTitle((const char*)qadm.GetTitle());
48 0 : }
49 :
50 : //__________________________________________________________________
51 : AliZDCQADataMakerSim& AliZDCQADataMakerSim::operator = (const AliZDCQADataMakerSim& qadm )
52 : {
53 : // Equal operator.
54 0 : this->~AliZDCQADataMakerSim();
55 0 : new(this) AliZDCQADataMakerSim(qadm);
56 0 : return *this;
57 0 : }
58 :
59 : //____________________________________________________________________________
60 : void AliZDCQADataMakerSim::InitHits()
61 : {
62 : // create Hits histograms in Hits subdir
63 : //
64 : const Bool_t expert = kTRUE ;
65 : const Bool_t image = kTRUE ;
66 :
67 2 : TH1F * hHitsZNCTot = new TH1F("hHitsZNCTot", "Signal in ZNC; N_{phe}", 100, 0., 6000.);
68 1 : TH1F * hHitsZNATot = new TH1F("hHitsZNATot", "Signal in ZNA; N_{phe}", 100, 0., 6000.);
69 1 : TH1F * hHitsZPCTot = new TH1F("hHitsZPCTot", "Signal in ZPC; N_{phe}", 100, 0., 6000.);
70 1 : TH1F * hHitsZPATot = new TH1F("hHitsZPATot", "Signal in ZPA; N_{phe}", 100, 0., 6000.);
71 1 : Add2HitsList(hHitsZNCTot, 0, !expert, image);
72 1 : Add2HitsList(hHitsZNATot, 1, !expert, image);
73 1 : Add2HitsList(hHitsZPCTot, 2, !expert, image);
74 1 : Add2HitsList(hHitsZPATot, 3, !expert, image);
75 : //
76 1 : TH1F * hHitsSumQZNC = new TH1F("hHitsSumQZNC", "Signal in 4 ZNC PMQ; N_{phe}",100, 0., 4000.);
77 1 : TH1F * hHitsSumQZNA = new TH1F("hHitsSumQZNA", "Signal in 4 ZNA PMQ; N_{phe}",100, 0., 4000.);
78 1 : TH1F * hHitsSumQZPC = new TH1F("hHitsSumQZPC", "Signal in 4 ZPC PMQ; N_{phe}",100, 0., 4000.);
79 1 : TH1F * hHitsSumQZPA = new TH1F("hHitsSumQZPA", "Signal in 4 ZPA PMQ; N_{phe}",100, 0., 4000.);
80 1 : Add2HitsList(hHitsSumQZNC, 4, expert, !image);
81 1 : Add2HitsList(hHitsSumQZNA, 5, expert, !image);
82 1 : Add2HitsList(hHitsSumQZPC, 6, expert, !image);
83 1 : Add2HitsList(hHitsSumQZPA, 7, expert, !image);
84 : //
85 1 : TH1F * hHitsPMCZNC = new TH1F("hHitsPMCZNC", "Signal in ZNC PMC; N_{phe}",100, 0., 4000.);
86 1 : TH1F * hHitsPMCZNA = new TH1F("hHitsPMCZNA", "Signal in ZNA PMC; N_{phe}",100, 0., 4000.);
87 1 : TH1F * hHitsPMCZPC = new TH1F("hHitsPMCZPC", "Signal in ZPC PMC; N_{phe}",100, 0., 4000.);
88 1 : TH1F * hHitsPMCZPA = new TH1F("hHitsPMCZPA", "Signal in ZPA PMC; N_{phe}",100, 0., 4000.);
89 1 : Add2HitsList(hHitsPMCZNC, 8, expert, !image);
90 1 : Add2HitsList(hHitsPMCZNA, 9, expert, !image);
91 1 : Add2HitsList(hHitsPMCZPC, 10, expert, !image);
92 1 : Add2HitsList(hHitsPMCZPA, 11, expert, !image);
93 :
94 1 : ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
95 1 : }
96 :
97 :
98 : //____________________________________________________________________________
99 : void AliZDCQADataMakerSim::InitDigits()
100 : {
101 : // create Digits histograms in Digits subdir
102 : //
103 : const Bool_t expert = kTRUE ;
104 : const Bool_t image = kTRUE ;
105 :
106 : // ------------------- HIGH GAIN CHAIN ---------------------------
107 2 : TH1F * hDigZNCTot = new TH1F("hDigZNCTot", "Signal in ZNC;Amplitude [ADC counts];Counts", 100, 0., 6000.);
108 1 : TH1F * hDigZNATot = new TH1F("hDigZNATot", "Signal in ZNA;Amplitude [ADC counts];Counts", 100, 0., 6000.);
109 1 : TH1F * hDigZPCTot = new TH1F("hDigZPCTot", "Signal in ZPC;Amplitude [ADC counts];Counts", 100, 0., 6000.);
110 1 : TH1F * hDigZPATot = new TH1F("hDigZPATot", "Signal in ZPA;Amplitude [ADC counts];Counts", 100, 0., 6000.);
111 1 : Add2DigitsList(hDigZNCTot, 0, !expert, image);
112 1 : Add2DigitsList(hDigZNATot, 1, !expert, image);
113 1 : Add2DigitsList(hDigZPCTot, 2, !expert, image);
114 1 : Add2DigitsList(hDigZPATot, 3, !expert, image);
115 : //
116 1 : TH1F * hDigSumQZNC = new TH1F("hDigSumQZNC", "Signal in 4 ZNC PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);
117 1 : TH1F * hDigSumQZNA = new TH1F("hDigSumQZNA", "Signal in 4 ZNA PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);
118 1 : TH1F * hDigSumQZPC = new TH1F("hDigSumQZPC", "Signal in 4 ZPC PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);
119 1 : TH1F * hDigSumQZPA = new TH1F("hDigSumQZPA", "Signal in 4 ZPA PMQ;Amplitude [ADC counts];Counts",100, 0., 4000.);
120 1 : Add2DigitsList(hDigSumQZNC, 4, expert, !image);
121 1 : Add2DigitsList(hDigSumQZNA, 5, expert, !image);
122 1 : Add2DigitsList(hDigSumQZPC, 6, expert, !image);
123 1 : Add2DigitsList(hDigSumQZPA, 7, expert, !image);
124 : //
125 1 : TH1F * hDigPMCZNC = new TH1F("hDigPMCZNC", "Signal in ZNC PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);
126 1 : TH1F * hDigPMCZNA = new TH1F("hDigPMCZNA", "Signal in ZNA PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);
127 1 : TH1F * hDigPMCZPC = new TH1F("hDigPMCZPC", "Signal in ZPC PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);
128 1 : TH1F * hDigPMCZPA = new TH1F("hDigPMCZPA", "Signal in ZPA PMC;Amplitude [ADC counts];Counts",100, 0., 4000.);
129 1 : Add2DigitsList(hDigPMCZNC, 8, expert, !image);
130 1 : Add2DigitsList(hDigPMCZNA, 9, expert, !image);
131 1 : Add2DigitsList(hDigPMCZPC, 10, expert, !image);
132 1 : Add2DigitsList(hDigPMCZPA, 11, expert, !image);
133 : //
134 : //
135 1 : ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
136 1 : }
137 :
138 : //____________________________________________________________________________
139 : void AliZDCQADataMakerSim::MakeHits()
140 : {
141 : //filling QA histos for Hits
142 :
143 : // Check id histograms already created for this Event Specie
144 224 : if( !GetHitsData(0) ) InitHits();
145 :
146 112 : TIter next(fHitsArray);
147 : AliZDCHit * hit;
148 : Float_t adcSum_ZNC=0., adcSum_ZNA=0., adcSum_ZPC=0., adcSum_ZPA=0.;
149 : Float_t adcSumQ_ZNC=0., adcSumQ_ZNA=0., adcSumQ_ZPC=0., adcSumQ_ZPA=0.;
150 496 : while((hit = dynamic_cast<AliZDCHit *>(next()))){
151 24 : if(hit->GetVolume(0)==1){
152 0 : adcSumQ_ZNC += hit->GetLightPMQ();
153 0 : adcSum_ZNC += hit->GetLightPMC() + hit->GetLightPMQ();
154 : //
155 0 : FillHitsData(8,hit->GetLightPMC());
156 : }
157 24 : else if(hit->GetVolume(0)==4){
158 0 : adcSumQ_ZNA += hit->GetLightPMQ();
159 0 : adcSum_ZNA += hit->GetLightPMC() + hit->GetLightPMQ();
160 : //
161 0 : FillHitsData(9,hit->GetLightPMC());
162 : }
163 24 : else if(hit->GetVolume(0)==2){
164 0 : adcSumQ_ZNC += hit->GetLightPMQ();
165 0 : adcSum_ZNC += hit->GetLightPMC() + hit->GetLightPMQ();
166 : //
167 0 : FillHitsData(10,hit->GetLightPMC());
168 : }
169 24 : else if(hit->GetVolume(0)==5){
170 0 : adcSumQ_ZNC += hit->GetLightPMQ();
171 0 : adcSum_ZNC += hit->GetLightPMC() + hit->GetLightPMQ();
172 : //
173 0 : FillHitsData(11,hit->GetLightPMC());
174 : }
175 : //
176 12 : FillHitsData(0,adcSum_ZNC);
177 12 : FillHitsData(1,adcSum_ZNA);
178 12 : FillHitsData(2,adcSum_ZPC);
179 12 : FillHitsData(3,adcSum_ZPA);
180 : //
181 12 : FillHitsData(4,adcSumQ_ZNC);
182 12 : FillHitsData(5,adcSumQ_ZNA);
183 12 : FillHitsData(6,adcSumQ_ZPC);
184 12 : FillHitsData(7,adcSumQ_ZPA);
185 : }
186 112 : }
187 :
188 : //___________________________________________________________________________
189 : void AliZDCQADataMakerSim::MakeHits(TTree * hitTree)
190 : {
191 : // make QA data from Hit Tree
192 8 : if(!hitTree){
193 0 : AliError("Can't get ZDC hit tree!!");
194 0 : return;
195 : }
196 :
197 4 : TBranch * branch = hitTree->GetBranch("ZDC") ;
198 :
199 4 : if(!branch){
200 0 : AliError("ZDC branch in Hit Tree not found!");
201 0 : return;
202 : }
203 :
204 7 : if(fHitsArray) fHitsArray->Clear() ;
205 2 : else fHitsArray = new TClonesArray("AliZDCHit", 1000);
206 :
207 4 : branch->SetAddress(&fHitsArray) ;
208 232 : for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
209 112 : branch->GetEntry(ientry) ;
210 112 : MakeHits() ;
211 112 : fHitsArray->Clear() ;
212 : }
213 : //
214 4 : IncEvCountCycleHits();
215 4 : IncEvCountTotalHits();
216 : //
217 8 : }
218 :
219 : //___________________________________________________________________________
220 : void AliZDCQADataMakerSim::MakeDigits(TTree *digitTree)
221 : {
222 : // makes data from Digit Tree
223 8 : if( !GetDigitsData(0) ) InitDigits();
224 :
225 4 : if(!digitTree){
226 0 : AliError("Can't get ZDC digit tree!!");
227 0 : return;
228 : }
229 :
230 4 : TBranch * branch = digitTree->GetBranch("ZDC");
231 4 : if(!branch){
232 0 : AliError("ZDC branch in digit tree not found");
233 0 : return;
234 : }
235 :
236 4 : AliZDCDigit *digit = 0x0;
237 4 : branch->SetAddress(&digit);
238 :
239 : Float_t adcSum_ZNC=0., adcSum_ZNA=0., adcSum_ZPC=0., adcSum_ZPA=0.;
240 : Float_t adcSumQ_ZNC=0., adcSumQ_ZNA=0., adcSumQ_ZPC=0., adcSumQ_ZPA=0.;
241 : // Float_t adcSum_ZNC_lg=0., adcSum_ZNA_lg=0., adcSum_ZPC_lg=0., adcSum_ZPA_lg=0.;
242 : // Float_t adcSumQ_ZNC_lg=0., adcSumQ_ZNA_lg=0., adcSumQ_ZPC_lg=0., adcSumQ_ZPA_lg=0.;
243 :
244 4 : Int_t ndig = digitTree->GetEntries();
245 392 : for(Int_t i=0; i<ndig; i++){
246 192 : branch->GetEntry(i);
247 :
248 240 : if(digit->GetSector(0)==1 && digit->GetSector(1)!=5){
249 40 : adcSum_ZNC += digit->GetADCValue(0);
250 : //adcSum_ZNC_lg += digit->GetADCValue(1);
251 : //
252 40 : if(digit->GetSector(1)!=0){
253 32 : adcSumQ_ZNC += digit->GetADCValue(0);
254 : //adcSumQ_ZNC_lg+= digit->GetADCValue(1);
255 32 : }
256 : else{
257 8 : FillDigitsData(8,digit->GetADCValue(0));
258 : //FillDigitsData(20,digit->GetADCValue(1));
259 : }
260 : }
261 304 : else if(digit->GetSector(0)==2){
262 192 : adcSum_ZPC += digit->GetADCValue(0);
263 : //adcSum_ZPC_lg += digit->GetADCValue(1);
264 : //
265 40 : if(digit->GetSector(1)!=0){
266 32 : adcSumQ_ZPC += digit->GetADCValue(0);
267 : //adcSumQ_ZPC_lg+= digit->GetADCValue(1);
268 32 : }
269 : else{
270 8 : FillDigitsData(10,digit->GetADCValue(0));
271 : //FillDigitsData(22,digit->GetADCValue(1));
272 : }
273 : }
274 160 : else if(digit->GetSector(0)==4 && digit->GetSector(1)!=5){
275 40 : adcSum_ZNA += digit->GetADCValue(0);
276 : //adcSum_ZNA_lg += digit->GetADCValue(1);
277 : //
278 40 : if(digit->GetSector(1)!=0){
279 32 : adcSumQ_ZNA += digit->GetADCValue(0);
280 : //adcSumQ_ZNA_lg+= digit->GetADCValue(1);
281 32 : }
282 : else{
283 8 : FillDigitsData(9,digit->GetADCValue(0));
284 : //FillDigitsData(21,digit->GetADCValue(1));
285 : }
286 : }
287 72 : else if(digit->GetSector(0)==5){
288 40 : adcSum_ZPA += digit->GetADCValue(0);
289 : //adcSum_ZPA_lg += digit->GetADCValue(1);
290 : //
291 40 : if(digit->GetSector(1)!=0){
292 32 : adcSumQ_ZPA += digit->GetADCValue(0);
293 : //adcSumQ_ZPA_lg+= digit->GetADCValue(1);
294 32 : }
295 : else{
296 8 : FillDigitsData(11,digit->GetADCValue(0));
297 : //FillDigitsData(23,digit->GetADCValue(1));
298 : }
299 : }
300 : }
301 : //
302 4 : FillDigitsData(0,adcSum_ZNC);
303 4 : FillDigitsData(1,adcSum_ZNA);
304 4 : FillDigitsData(2,adcSum_ZPC);
305 4 : FillDigitsData(3,adcSum_ZPA);
306 : //
307 4 : FillDigitsData(4,adcSumQ_ZNC);
308 4 : FillDigitsData(5,adcSumQ_ZNA);
309 4 : FillDigitsData(6,adcSumQ_ZPC);
310 4 : FillDigitsData(7,adcSumQ_ZPA);
311 : //
312 4 : IncEvCountCycleDigits();
313 4 : IncEvCountTotalDigits();
314 : //
315 8 : }
316 :
317 : //____________________________________________________________________________
318 : void AliZDCQADataMakerSim::StartOfDetectorCycle()
319 : {
320 : //Detector specific actions at start of cycle
321 :
322 12 : }
323 :
324 : //____________________________________________________________________________
325 : void AliZDCQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
326 : {
327 : // Detector specific actions at end of cycle
328 : // do the QA checking
329 18 : ResetEventTrigClasses();
330 9 : AliQAChecker::Instance()->Run(AliQAv1::kZDC, task, list);
331 9 : }
|