fixed violations
[u/mrichter/AliRoot.git] / CORRFW / AliCFEventClassCuts.cxx
CommitLineData
563113d0 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// To select on the Event Class: look at the Trigger mask and the ZDC info.
16// Only pp-running trigger types implemented so far
17// handles all masks for the trigger description
18// and some general combinations like MB1,MB2,MB3
19// The argument of IsSelected member function (passed object) is cast into
20// an AliVEvent, but cuts have a true meaning only for AliESD(AOD)Event
21// type objects.
22// The class derives from AliCFCutBase
23// Author:S.Arcelli Silvia.Arcelli@cern.ch
24//
25//
26#include "TH1F.h"
27#include "TList.h"
28#include "AliLog.h"
29#include "TMath.h"
30#include "AliVEvent.h"
31#include "AliCFEventClassCuts.h"
32ClassImp(AliCFEventClassCuts)
33//____________________________________________________________________
34AliCFEventClassCuts::AliCFEventClassCuts() :
35 AliCFCutBase(),
36 fTriggerType(0),
37 fTriggerAND(kFALSE),
38 fZDCN1EnergyMin(-1.e99),
39 fZDCP1EnergyMin(-1.e99),
40 fZDCN2EnergyMin(-1.e99),
41 fZDCP2EnergyMin(-1.e99),
42 fZDCEM1EnergyMin(-1.e99),
43 fZDCEM2EnergyMin(-1.e99),
44 fZDCN1EnergyMax(1.e99),
45 fZDCP1EnergyMax(1.e99),
46 fZDCN2EnergyMax(1.e99),
47 fZDCP2EnergyMax(1.e99),
48 fZDCEM1EnergyMax(1.e99),
49 fZDCEM2EnergyMax(1.e99),
50 fBitMap(0x0),
51 fhNBinsTrigger(0),
52 fhBinLimTrigger(0),
53 fhNBinsZDCEnN1(0),
54 fhBinLimZDCEnN1(0),
55 fhNBinsZDCEnP1(0),
56 fhBinLimZDCEnP1(0),
57 fhNBinsZDCEnN2(0),
58 fhBinLimZDCEnN2(0),
59 fhNBinsZDCEnP2(0),
60 fhBinLimZDCEnP2(0),
61 fhNBinsZDCEnEM1(0),
62 fhBinLimZDCEnEM1(0),
63 fhNBinsZDCEnEM2(0),
64 fhBinLimZDCEnEM2(0)
65{
66 //
67 //ctor
68 //
69
70 fBitMap=new TBits(0);
71 Initialise();
72}
73//____________________________________________________________________
74AliCFEventClassCuts::AliCFEventClassCuts(Char_t* name, Char_t* title) :
75 AliCFCutBase(name,title),
76 fTriggerType(0),
77 fTriggerAND(kFALSE),
78 fZDCN1EnergyMin(-1.e99),
79 fZDCP1EnergyMin(-1.e99),
80 fZDCN2EnergyMin(-1.e99),
81 fZDCP2EnergyMin(-1.e99),
82 fZDCEM1EnergyMin(-1.e99),
83 fZDCEM2EnergyMin(-1.e99),
84 fZDCN1EnergyMax(1.e99),
85 fZDCP1EnergyMax(1.e99),
86 fZDCN2EnergyMax(1.e99),
87 fZDCP2EnergyMax(1.e99),
88 fZDCEM1EnergyMax(1.e99),
89 fZDCEM2EnergyMax(1.e99),
90 fBitMap(0x0),
91 fhNBinsTrigger(0),
92 fhBinLimTrigger(0),
93 fhNBinsZDCEnN1(0),
94 fhBinLimZDCEnN1(0),
95 fhNBinsZDCEnP1(0),
96 fhBinLimZDCEnP1(0),
97 fhNBinsZDCEnN2(0),
98 fhBinLimZDCEnN2(0),
99 fhNBinsZDCEnP2(0),
100 fhBinLimZDCEnP2(0),
101 fhNBinsZDCEnEM1(0),
102 fhBinLimZDCEnEM1(0),
103 fhNBinsZDCEnEM2(0),
104 fhBinLimZDCEnEM2(0)
105{
106 //
107 //ctor
108 //
109 fBitMap=new TBits(0);
110 Initialise();
111 }
112//____________________________________________________________________
113AliCFEventClassCuts::AliCFEventClassCuts(const AliCFEventClassCuts& c) :
114 AliCFCutBase(c),
115 fTriggerType(c.fTriggerType),
116 fTriggerAND(c.fTriggerAND),
117 fZDCN1EnergyMin(c.fZDCN1EnergyMin),
118 fZDCP1EnergyMin(c.fZDCP1EnergyMin),
119 fZDCN2EnergyMin(c.fZDCN2EnergyMin),
120 fZDCP2EnergyMin(c.fZDCP2EnergyMin),
121 fZDCEM1EnergyMin(c.fZDCEM1EnergyMin),
122 fZDCEM2EnergyMin(c.fZDCEM2EnergyMin),
123 fZDCN1EnergyMax(c.fZDCN1EnergyMax),
124 fZDCP1EnergyMax(c.fZDCP1EnergyMax),
125 fZDCN2EnergyMax(c.fZDCN2EnergyMax),
126 fZDCP2EnergyMax(c.fZDCP2EnergyMax),
127 fZDCEM1EnergyMax(c.fZDCEM1EnergyMax),
128 fZDCEM2EnergyMax(c.fZDCEM2EnergyMax),
129 fBitMap(c.fBitMap),
130 fhNBinsTrigger(c.fhNBinsTrigger),
131 fhBinLimTrigger(c.fhBinLimTrigger ),
132 fhNBinsZDCEnN1(c.fhNBinsZDCEnN1),
133 fhBinLimZDCEnN1(c.fhBinLimZDCEnN1),
134 fhNBinsZDCEnP1(c.fhNBinsZDCEnP1),
135 fhBinLimZDCEnP1(c.fhBinLimZDCEnP1),
136 fhNBinsZDCEnN2(c.fhNBinsZDCEnN2),
137 fhBinLimZDCEnN2(c.fhBinLimZDCEnN2),
138 fhNBinsZDCEnP2(c.fhNBinsZDCEnP2),
139 fhBinLimZDCEnP2(c.fhBinLimZDCEnP2),
140 fhNBinsZDCEnEM1(c.fhNBinsZDCEnEM1),
141 fhBinLimZDCEnEM1(c.fhBinLimZDCEnEM1),
142 fhNBinsZDCEnEM2(c.fhNBinsZDCEnEM2),
143 fhBinLimZDCEnEM2(c.fhBinLimZDCEnEM2)
144
145{
146 //
147 //copy constructor
148 //
149}
150//____________________________________________________________________
151AliCFEventClassCuts& AliCFEventClassCuts::operator=(const AliCFEventClassCuts& c){
152 //
153 // Assignment operator
154 //
155 if (this != &c) {
156 AliCFCutBase::operator=(c) ;
157 fTriggerType = c.fTriggerType ;
158 fTriggerAND = c.fTriggerAND ;
159 fZDCN1EnergyMin = c.fZDCN1EnergyMin;
160 fZDCP1EnergyMin = c.fZDCP1EnergyMin;
161 fZDCN2EnergyMin = c.fZDCN2EnergyMin;
162 fZDCP2EnergyMin = c.fZDCP2EnergyMin;
163 fZDCEM1EnergyMin = c.fZDCEM1EnergyMin;
164 fZDCEM2EnergyMin = c.fZDCEM2EnergyMin;
165 fZDCN1EnergyMax = c.fZDCN1EnergyMax;
166 fZDCP1EnergyMax = c.fZDCP1EnergyMax;
167 fZDCN2EnergyMax = c.fZDCN2EnergyMax;
168 fZDCP2EnergyMax = c.fZDCP2EnergyMax;
169 fZDCEM1EnergyMax = c.fZDCEM1EnergyMax;
170 fZDCEM2EnergyMax = c.fZDCEM2EnergyMax;
171 fBitMap = c.fBitMap;
172 fhNBinsTrigger = c.fhNBinsTrigger;
173 fhBinLimTrigger = c.fhBinLimTrigger ;
174 fhNBinsZDCEnN1 = c.fhNBinsZDCEnN1;
175 fhBinLimZDCEnN1 = c.fhBinLimZDCEnN1;
176 fhNBinsZDCEnP1 = c.fhNBinsZDCEnP1;
177 fhBinLimZDCEnP1 = c.fhBinLimZDCEnP1;
178 fhNBinsZDCEnN2 = c.fhNBinsZDCEnN2;
179 fhBinLimZDCEnN2 = c.fhBinLimZDCEnN2;
180 fhNBinsZDCEnP2 = c.fhNBinsZDCEnP2;
181 fhBinLimZDCEnP2 = c.fhBinLimZDCEnP2;
182 fhNBinsZDCEnEM1 = c.fhNBinsZDCEnEM1;
183 fhBinLimZDCEnEM1 = c.fhBinLimZDCEnEM1;
184 fhNBinsZDCEnEM2 = c.fhNBinsZDCEnEM2;
185 fhBinLimZDCEnEM2 = c.fhBinLimZDCEnEM2;
186 }
187
188
189 for (Int_t i=0; i<c.kNCuts; i++){
190 for (Int_t j=0; j<c.kNStepQA; j++){
191 if(c.fhQA[i][j]) fhQA[i][j] = (TH1F*)c.fhQA[i][j]->Clone();
192 }
193 }
194
195 return *this ;
196}
197
198//____________________________________________________________________
199AliCFEventClassCuts::~AliCFEventClassCuts()
200{
201 //
202 // destructor
203 //
204 for (Int_t i=0; i<kNCuts; i++){
205 for (Int_t j=0; j<kNStepQA; j++){
206 if(fhQA[i][j]) delete fhQA[i][j];
207 }
208 }
209
210 if(fBitMap)delete fBitMap;
211 if(fhBinLimTrigger)delete fhBinLimTrigger;
212 if(fhBinLimZDCEnN1)delete fhBinLimZDCEnN1;
213 if(fhBinLimZDCEnP1)delete fhBinLimZDCEnP1;
214 if(fhBinLimZDCEnN2)delete fhBinLimZDCEnN2;
215 if(fhBinLimZDCEnP2)delete fhBinLimZDCEnP2;
216 if(fhBinLimZDCEnEM1)delete fhBinLimZDCEnEM1;
217 if(fhBinLimZDCEnEM2)delete fhBinLimZDCEnEM2;
218
219}
220//__________________________________________________________________________________
221void AliCFEventClassCuts::Init() {
222 //
223 // initialises all histograms and the TList which holds the histograms
224 //
225 if(fIsQAOn)
226 DefineHistograms();
227}
228//__________________________________________________________________________________
229//__________________________________________________________________________________
230void AliCFEventClassCuts::Initialise()
231{
232 //
233 //initialization
234 //
235
236 //
237 // sets pointers to histos to zero
238 //
239
240 for(Int_t i=0; i<kNCuts; i++){
241 for(Int_t j =0; j<kNStepQA; j++){
242 fhQA[i][j]=0x0;
243 }
244 }
245
246 //set default bin number/ranges for QA histograms
247
248 SetHistogramBins(kTrigger,23,-0.5,22.5);
249 SetHistogramBins(kZDCEnergyN1,800,-500,7500);
250 SetHistogramBins(kZDCEnergyP1,800,-500,7500);
251 SetHistogramBins(kZDCEnergyN2,800,-500,7500);
252 SetHistogramBins(kZDCEnergyP2,800,-500,7500);
253 SetHistogramBins(kZDCEnergyEM1,800,-500,7500);
254 SetHistogramBins(kZDCEnergyEM2,800,-500,7500);
255
256}
257//____________________________________________________________________
258Bool_t AliCFEventClassCuts::IsSelected(TObject* obj) {
259 //
260 //Check if the requested cuts are passed
261 //
262
263 TBits* bitmap = SelectionBitMap(obj);
264
265 Bool_t isSelected = kTRUE;
266
267 for (UInt_t icut=0; icut<bitmap->GetNbits();icut++)
268 if(!bitmap->TestBitNumber(icut)) isSelected = kFALSE;
269
270 return isSelected;
271}
272
273//____________________________________________________________________
274TBits *AliCFEventClassCuts::SelectionBitMap(TObject* obj) {
275 //
276 //cut on trigger type (just pp running trigger types implemented so far)
277 //and on the energy observed in the ZDC. The argument is cast into
278 //an AliVEvent, but has true meaning only for AliESDEvent type objects.
279 //Check if the requested cuts are passed and return a bitmap
280 //
281
282 for(Int_t j=0;j<kNCuts;j++)fBitMap->SetBitNumber(j,kFALSE);
283 AliVEvent* esd = dynamic_cast<AliVEvent *>(obj);
284 if (!esd ) return fBitMap ;
285
286
287 //now start checking the cuts
288 //first assume the event will be accepted:
289 for(Int_t j=0;j<kNCuts;j++)fBitMap->SetBitNumber(j,kTRUE);
290
291
292 //Check the trigger:
293
294 //look at the Trigger mask in current event
295 TBits *triggerBitMap=new TBits(0);
296 TriggerBitMap(esd,triggerBitMap);
297 //now compare to what was requested as a Trigger:
298 if(fTriggerType.GetNbits()>0)fBitMap->SetBitNumber(0,kFALSE); //trigger required, initialize to false
299 for(Int_t j=0;j<kNTriggers+kNTriggersMB;j++){
300 if(fTriggerType.TestBitNumber(j)){
301 if(!fTriggerAND){
302 if(triggerBitMap->TestBitNumber(j) == fTriggerType.TestBitNumber(j)){
303 fBitMap->SetBitNumber(0,kTRUE);
304
305 break;// @least one requested bit fired, ok
306 }
307 }else{
308 if(!triggerBitMap->TestBitNumber(j)){
309 break;
310 }
311 }
312 }
313 }
314
315 delete triggerBitMap;
316 //Then, cut on the energy observed in the ZDC
317
318 if( esd->GetZDCN1Energy()<fZDCN1EnergyMin || esd->GetZDCN1Energy()>fZDCN1EnergyMax)fBitMap->SetBitNumber(1,kFALSE);
319 if( esd->GetZDCP1Energy()<fZDCP1EnergyMin || esd->GetZDCP1Energy()>fZDCP1EnergyMax)fBitMap->SetBitNumber(2,kFALSE);
320 if( esd->GetZDCN2Energy()<fZDCN2EnergyMin || esd->GetZDCN2Energy()>fZDCN2EnergyMax)fBitMap->SetBitNumber(3,kFALSE);
321 if( esd->GetZDCP2Energy()<fZDCP2EnergyMin || esd->GetZDCP2Energy()>fZDCP2EnergyMax)fBitMap->SetBitNumber(4,kFALSE);
322 if( esd->GetZDCEMEnergy(0)<fZDCEM1EnergyMin || esd->GetZDCEMEnergy(0)>fZDCEM1EnergyMax)fBitMap->SetBitNumber(5,kFALSE);
323 if( esd->GetZDCEMEnergy(1)<fZDCEM2EnergyMin || esd->GetZDCEMEnergy(1)>fZDCEM2EnergyMax)fBitMap->SetBitNumber(6,kFALSE);
324 return fBitMap;
325
326}
327//_____________________________________________________________________________
328Bool_t AliCFEventClassCuts::IsTriggered(AliVEvent* ev, TriggerType trigger) {
329 //
330 //look at the Trigger mask in current event
331 TBits *triggerBitMap=new TBits(0);
332 TriggerBitMap(ev,triggerBitMap);
333 Bool_t isTriggered=kFALSE;
334 if(triggerBitMap->TestBitNumber(trigger))isTriggered=kTRUE;
335 delete triggerBitMap;
336 return isTriggered;
337
338}
339//_____________________________________________________________________________
340void AliCFEventClassCuts::TriggerBitMap(AliVEvent* ev, TBits *bitmapT ) {
341 //
342
343 for(Int_t itrig=0;itrig<kNTriggers+kNTriggersMB;itrig++)bitmapT->SetBitNumber(itrig,kFALSE);
344 if (!ev ) return;
345
346 ULong64_t triggerMask = ev->GetTriggerMask();
347 //run over the different triggers in the mask, and check which bits have fired
348 for(Int_t itrig=0;itrig<kNTriggers;itrig++){
349 bitmapT->SetBitNumber(itrig,kFALSE);
350 if (triggerMask&(0x1 <<itrig)){
351 bitmapT->SetBitNumber(itrig,kTRUE);
352 }
353 }
354
355 //Trigger combinations, Minimum bias triggers
356
357 //MB1 case: (GFO || V0OR) && !BG
358 if((bitmapT->TestBitNumber(5) || (bitmapT->TestBitNumber(0) || bitmapT->TestBitNumber(1))) && !bitmapT->TestBitNumber(2)) bitmapT->SetBitNumber(17,kTRUE);
359
360 //MB2 case: (GFO && V0OR) && !BG
361 if((bitmapT->TestBitNumber(5) && (bitmapT->TestBitNumber(0) || bitmapT->TestBitNumber(1))) && !bitmapT->TestBitNumber(2)) bitmapT->SetBitNumber(18,kTRUE);
362
363 //MB3 case : (GFO && V0AND) && !BG
364 if((bitmapT->TestBitNumber(5) && (bitmapT->TestBitNumber(0) && bitmapT->TestBitNumber(1))) && !bitmapT->TestBitNumber(2)) bitmapT->SetBitNumber(19,kTRUE);
365
366 //MB4 case: (GFO || V0AND) && !BG
367 if((bitmapT->TestBitNumber(5) || (bitmapT->TestBitNumber(0) && bitmapT->TestBitNumber(1))) && !bitmapT->TestBitNumber(2)) bitmapT->SetBitNumber(20,kTRUE);
368
369 //MB5 case:: GFO && !BG
370 if(bitmapT->TestBitNumber(5) && !bitmapT->TestBitNumber(2)) bitmapT->SetBitNumber(21,kTRUE);
371
372 return;
373}
374//__________________________________________________________________________________
375void AliCFEventClassCuts::GetBitMap(TObject* obj, TBits* bitmap){
376 //
377 // retrieve the pointer to the bitmap
378 //
379
380 bitmap = SelectionBitMap(obj);
381
382}
383//__________________________________________________________________________________
384void AliCFEventClassCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t *bins)
385{
386 //
387 // QA histogram axis parameters
388 // variable bin size:user inputs nbins and the vector of bin limits
389 //
390
391 switch(index){
392 case kTrigger:
393 fhNBinsTrigger=nbins;
394 fhBinLimTrigger=new Double_t[nbins+1];
395 for(Int_t i=0;i<nbins+1;i++)fhBinLimTrigger[i]=bins[i];
396 break;
397
398 case kZDCEnergyN1:
399 fhNBinsZDCEnN1=nbins;
400 fhBinLimZDCEnN1=new Double_t[nbins+1];
401 for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnN1[i]=bins[i];
402 break;
403
404 case kZDCEnergyP1:
405 fhNBinsZDCEnP1=nbins;
406 fhBinLimZDCEnP1=new Double_t[nbins+1];
407 for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnP1[i]=bins[i];
408 break;
409
410 case kZDCEnergyN2:
411 fhNBinsZDCEnN2=nbins;
412 fhBinLimZDCEnN2=new Double_t[nbins+1];
413 for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnN2[i]=bins[i];
414 break;
415
416 case kZDCEnergyP2:
417 fhNBinsZDCEnP2=nbins;
418 fhBinLimZDCEnP2=new Double_t[nbins+1];
419 for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnP2[i]=bins[i];
420 break;
421
422 case kZDCEnergyEM1:
423 fhNBinsZDCEnEM1=nbins;
424 fhBinLimZDCEnEM1=new Double_t[nbins+1];
425 for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnEM1[i]=bins[i];
426 break;
427
428 case kZDCEnergyEM2:
429 fhNBinsZDCEnEM2=nbins;
430 fhBinLimZDCEnEM2=new Double_t[nbins+1];
431 for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnEM2[i]=bins[i];
432 break;
433
434 }
435
436}
437//__________________________________________________________________________________
438void AliCFEventClassCuts::SetHistogramBins(Int_t index, Int_t nbins, Double_t xmin, Double_t xmax)
439{
440 //
441 // QA histogram axis parameters
442 // fixed bin size: user inputs nbins, xmin and xmax
443 //
444 switch(index){
445 case kTrigger:
446 fhNBinsTrigger=nbins;
447 fhBinLimTrigger=new Double_t[nbins+1];
448 for(Int_t i=0;i<nbins+1;i++)fhBinLimTrigger[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
449 break;
450
451 case kZDCEnergyN1:
452 fhNBinsZDCEnN1=nbins;
453 fhBinLimZDCEnN1=new Double_t[nbins+1];
454 for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnN1[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
455 break;
456
457 case kZDCEnergyP1:
458 fhNBinsZDCEnP1=nbins;
459 fhBinLimZDCEnP1=new Double_t[nbins+1];
460 for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnP1[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
461 break;
462
463 case kZDCEnergyN2:
464 fhNBinsZDCEnN2=nbins;
465 fhBinLimZDCEnN2=new Double_t[nbins+1];
466 for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnN2[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
467 break;
468
469 case kZDCEnergyP2:
470 fhNBinsZDCEnP2=nbins;
471 fhBinLimZDCEnP2=new Double_t[nbins+1];
472 for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnP2[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
473 break;
474
475 case kZDCEnergyEM1:
476 fhNBinsZDCEnEM1=nbins;
477 fhBinLimZDCEnEM1=new Double_t[nbins+1];
478 for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnEM1[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
479 break;
480
481 case kZDCEnergyEM2:
482 fhNBinsZDCEnEM2=nbins;
483 fhBinLimZDCEnEM2=new Double_t[nbins+1];
484 for(Int_t i=0;i<nbins+1;i++)fhBinLimZDCEnEM2[i]=xmin+i*(xmax-xmin)/Double_t(nbins);
485 break;
486 }
487}
488//__________________________________________________________________________________
489 void AliCFEventClassCuts::DefineHistograms() {
490 //
491 // histograms for cut variables
492 //
493 Int_t color = 2;
494
495 if(!fIsQAOn) {
496 AliInfo(Form("Nn QA histos requested, Please first set the QA flag on!"));
497 return;
498 }
499
500 // book QA histograms
501
502 Char_t str[256];
503 for (Int_t i=0; i<kNStepQA; i++) {
504 if (i==0) sprintf(str," ");
505 else sprintf(str,"_cut");
506
507 fhQA[kTrigger][i] = new TH1F(Form("%s_TriggerBits%s",GetName(),str), "",fhNBinsTrigger,fhBinLimTrigger);
508 fhQA[kZDCEnergyN1][i] = new TH1F(Form("%s_ZDC_Energy_N1%s",GetName(),str), "",fhNBinsZDCEnN1,fhBinLimZDCEnN1);
509 fhQA[kZDCEnergyP1][i] = new TH1F(Form("%s_ZDC_Energy_P1%s",GetName(),str), "",fhNBinsZDCEnP1,fhBinLimZDCEnP1);
510 fhQA[kZDCEnergyN2][i] = new TH1F(Form("%s_ZDC_Energy_N2%s",GetName(),str), "",fhNBinsZDCEnN2,fhBinLimZDCEnN2);
511 fhQA[kZDCEnergyP2][i] = new TH1F(Form("%s_ZDC_Energy_P2%s",GetName(),str), "",fhNBinsZDCEnP2,fhBinLimZDCEnP2);
512 fhQA[kZDCEnergyEM1][i] = new TH1F(Form("%s_ZDC_Energy_EM1%s",GetName(),str), "",fhNBinsZDCEnEM1,fhBinLimZDCEnEM1);
513 fhQA[kZDCEnergyEM2][i] = new TH1F(Form("%s_ZDC_Energy_EM2%s",GetName(),str), "",fhNBinsZDCEnEM2,fhBinLimZDCEnEM2);
514
515
516 fhQA[kTrigger][i] ->SetXTitle("Trigger Bits");
517 fhQA[kZDCEnergyN1][i] ->SetXTitle("ZDC Energy N1 (GeV)");
518 fhQA[kZDCEnergyP1][i] ->SetXTitle("ZDC Energy P1 (GeV)");
519 fhQA[kZDCEnergyN2][i] ->SetXTitle("ZDC Energy N2 (GeV)");
520 fhQA[kZDCEnergyP2][i] ->SetXTitle("ZDC Energy P2 (GeV)");
521 fhQA[kZDCEnergyEM1][i] ->SetXTitle("ZDC Energy EM1 (GeV)");
522 fhQA[kZDCEnergyEM2][i] ->SetXTitle("ZDC Energy EM2 (GeV)");
523
524 }
525
526 for(Int_t i=0; i<kNCuts; i++) fhQA[i][1]->SetLineColor(color);
527
528}
529//__________________________________________________________________________________
530void AliCFEventClassCuts::FillHistograms(TObject* obj, Bool_t b)
531{
532 //
533 // fill the QA histograms
534 //
535 if(!fIsQAOn) return;
536
537 // cast TObject into VParticle
538 AliVEvent* esd = dynamic_cast<AliVEvent *>(obj);
539 if (!esd ) return ;
540
541 // index = 0: fill histograms before cuts
542 // index = 1: fill histograms after cuts
543 Int_t index = -1;
544 index = ((b) ? 1 : 0);
545
546
547 //look at the Trigger mask in current event
548 TBits *triggerBitMap=new TBits(0);
549 TriggerBitMap(esd, triggerBitMap);
550
551 //trigger Mask
552 for(Int_t itrig=0;itrig<kNTriggers+kNTriggersMB;itrig++){
553 if(triggerBitMap->TestBitNumber(itrig)){
554 fhQA[kTrigger][index]->Fill(itrig);
555 }
556 }
557
558 delete triggerBitMap;
559
560 //ZDC Quantities
561 fhQA[kZDCEnergyN1][index]->Fill(esd->GetZDCN1Energy());
562 fhQA[kZDCEnergyP1][index]->Fill(esd->GetZDCP1Energy());
563 fhQA[kZDCEnergyN2][index]->Fill(esd->GetZDCN2Energy());
564 fhQA[kZDCEnergyP2][index]->Fill(esd->GetZDCP2Energy());
565 fhQA[kZDCEnergyEM1][index]->Fill(esd->GetZDCEMEnergy(0));
566 fhQA[kZDCEnergyEM2][index]->Fill(esd->GetZDCEMEnergy(1));
567
568}
569//__________________________________________________________________________________
570void AliCFEventClassCuts::AddQAHistograms(TList *list) const {
571 //
572 // saves the histograms in a TList
573 //
574 if(!fIsQAOn) return;
575
576 for (Int_t j=0; j<kNStepQA; j++) {
577 for(Int_t i=0; i<kNCuts; i++)
578 list->Add(fhQA[i][j]);
579 }
580}