TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliGammaConversionAODBGHandler.cxx
CommitLineData
2bb2434e 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
f61c548e 4 * Author: Martin Wilde, Friederike Bock, Daniel Lohner, Svein Lindal *
5 * based on previous version by Kenneth Aamodt and Ana Marin *
2bb2434e 6 * Version 1.0 *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
17////////////////////////////////////////////////
18//---------------------------------------------
19// Class for handling of background calculation
20//---------------------------------------------
21////////////////////////////////////////////////
22
23#include "AliGammaConversionAODBGHandler.h"
24#include "AliKFParticle.h"
25#include "AliAODConversionPhoton.h"
26#include "AliAODConversionMother.h"
2bb2434e 27
28using namespace std;
29
30ClassImp(AliGammaConversionAODBGHandler)
31
f61c548e 32//_____________________________________________________________________________________________________________________________
2bb2434e 33AliGammaConversionAODBGHandler::AliGammaConversionAODBGHandler() :
f61c548e 34 TObject(),
35 fNEvents(10),
36 fBGEventCounter(NULL),
37 fBGEventENegCounter(NULL),
38 fBGEventMesonCounter(NULL),
39 fBGProbability(NULL),
40 fBGEventVertex(NULL),
41 fNBinsZ(0),
42 fNBinsMultiplicity(0),
43 fBinLimitsArrayZ(NULL),
44 fBinLimitsArrayMultiplicity(NULL),
45 fBGEvents(),
46 fBGEventsENeg(),
47 fBGEventsMeson()
2bb2434e 48{
f61c548e 49 // constructor
2bb2434e 50}
51
f61c548e 52//_____________________________________________________________________________________________________________________________
2bb2434e 53AliGammaConversionAODBGHandler::AliGammaConversionAODBGHandler(UInt_t binsZ,UInt_t binsMultiplicity,UInt_t nEvents) :
f61c548e 54 TObject(),
55 fNEvents(nEvents),
56 fBGEventCounter(NULL),
57 fBGEventENegCounter(NULL),
58 fBGEventMesonCounter(NULL),
59 fBGProbability(NULL),
60 fBGEventVertex(NULL),
61 fNBinsZ(binsZ),
62 fNBinsMultiplicity(binsMultiplicity),
63 fBinLimitsArrayZ(NULL),
64 fBinLimitsArrayMultiplicity(NULL),
65 fBGEvents(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
66 fBGEventsENeg(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
67 fBGEventsMeson(binsZ,AliGammaConversionMotherMultipicityVector(binsMultiplicity,AliGammaConversionMotherBGEventVector(nEvents)))
2bb2434e 68{
f61c548e 69 // constructor
2bb2434e 70}
71
11c1e680 72
f61c548e 73//_____________________________________________________________________________________________________________________________
cfd87ccd 74AliGammaConversionAODBGHandler::AliGammaConversionAODBGHandler(UInt_t collisionSystem, UInt_t centMin, UInt_t centMax,
75 UInt_t nEvents, Bool_t useTrackMult, UInt_t mode, UInt_t binsZ, UInt_t binsMultiplicity) :
f61c548e 76 TObject(),
77 fNEvents(nEvents),
78 fBGEventCounter(NULL),
79 fBGEventENegCounter(NULL),
80 fBGEventMesonCounter(NULL),
81 fBGProbability(NULL),
82 fBGEventVertex(NULL),
cfd87ccd 83 fNBinsZ(binsZ),
84 fNBinsMultiplicity(binsMultiplicity),
f61c548e 85 fBinLimitsArrayZ(NULL),
86 fBinLimitsArrayMultiplicity(NULL),
cfd87ccd 87 fBGEvents(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
88 fBGEventsENeg(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
89 fBGEventsMeson(binsZ,AliGammaConversionMotherMultipicityVector(binsMultiplicity,AliGammaConversionMotherBGEventVector(nEvents)))
11c1e680 90{
f61c548e 91 // constructor
cfd87ccd 92 if (fNBinsZ>8)fNBinsZ = 8;
f61c548e 93
cfd87ccd 94 if (mode == 0 || mode == 1){
95 if (fNBinsMultiplicity>5)fNBinsMultiplicity = 5;
96 } else if (mode == 2 || mode == 3 || mode == 4 || mode == 5){
97 if (useTrackMult){
98 if (fNBinsMultiplicity>5)fNBinsMultiplicity = 5;
99 } else {
100 if (fNBinsMultiplicity>7)fNBinsMultiplicity = 7;
101 }
102 } else {
103 if (fNBinsMultiplicity>5)fNBinsMultiplicity = 5;
104 }
105 // Initializing z vertex bins
106 fBinLimitsArrayZ= new Double_t[fNBinsZ] ;
f61c548e 107 if(collisionSystem > 0 && collisionSystem < 8){ // PbPb
cfd87ccd 108 Double_t fBinLimitsArrayZPbPb[8] = {-50, -5.5, -2.9, -0.65,
109 1.45, 3.65, 6.15, 50};
110 for (Int_t i = 0; i < fNBinsZ; i++){
111 fBinLimitsArrayZ[i] = fBinLimitsArrayZPbPb[i];
112 }
113 } else if(collisionSystem == 0){ // pp
114 Double_t fBinLimitsArrayZpp[8] = {-50, -3.375, -1.605, -0.225,
115 1.065, 2.445, 4.245, 50};
116 for (Int_t i = 0; i < fNBinsZ; i++){
117 fBinLimitsArrayZ[i] = fBinLimitsArrayZpp[i];
118 }
119 } else { // pPb
120 Double_t fBinLimitsArrayZpPb[8] = {-50, -5.85, -3.35, -1.15,
121 0.85, 2.95, 5.55, 50};
122 for (Int_t i = 0; i < fNBinsZ; i++){
123 fBinLimitsArrayZ[i] = fBinLimitsArrayZpPb[i];
124 }
f61c548e 125 }
11c1e680 126
cfd87ccd 127 // Initializing multiplicity bins
128 fBinLimitsArrayMultiplicity= new Double_t[fNBinsMultiplicity];
129 if(useTrackMult){ // multiplicity binning based on number of good global tracks
130 // default pp values
131 Double_t fBinLimitsArrayMultiplicitypp[5] = {0., 8.5, 16.5, 27.5, 200.};
132 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
133 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypp[i];
134 }
135 if(collisionSystem > 0 && collisionSystem < 8){ // PbPb values
136 if(centMin == 0 && centMax == 5){ // 0-5% central
137 Double_t fBinLimitsArrayMultiplicityPbPb0005[5] = {0., 1540., 1665., 1780., 5000};
138 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
139 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0005[i];
140 }
141 } else if(centMin == 0 && centMax == 10){ // 0-10% central
142 Double_t fBinLimitsArrayMultiplicityPbPb0010[5] = {0., 1360., 1520., 1685., 5000};
143 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
144 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0010[i];
145 }
146 } else if(centMin == 0 && centMax == 20){ // 0-20% central
147 Double_t fBinLimitsArrayMultiplicityPbPb0020[5] = {0., 1110., 1360., 1600., 5000};
148 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
149 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0020[i];
150 }
151 } else if(centMin == 0 && centMax == 80){ // 0-80% central
152 Double_t fBinLimitsArrayMultiplicityPbPb0080[5] = {0., 890., 1240., 1540., 5000};
153 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
154 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0080[i];
155 }
156 } else if(centMin == 5 && centMax == 10){ // 5-10% central
157 Double_t fBinLimitsArrayMultiplicityPbPb0510[5] = {0., 1250., 1345., 1445., 5000};
158 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
159 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0510[i];
160 }
161 } else if(centMin == 10 && centMax == 20){ // 10-20% central
162 Double_t fBinLimitsArrayMultiplicityPbPb1020[5] = {0., 915., 1020., 1130., 5000};
163 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
164 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb1020[i];
165 }
166 } else if(centMin == 20 && centMax == 40){ // 20-40% central
167 Double_t fBinLimitsArrayMultiplicityPbPb2040[5] = {0., 510., 625., 730., 5000};
168 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
169 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb2040[i];
170 }
171 } else if(centMin == 40 && centMax == 80){ // 40-80% central
172 Double_t fBinLimitsArrayMultiplicityPbPb4080[5] = {0., 185., 250., 300., 5000};
173 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
174 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb4080[i];
175 }
176 } else if(centMin == 60 && centMax == 80){ // 60-80% central
177 Double_t fBinLimitsArrayMultiplicityPbPb6080[5] = {0., 55., 80., 100., 5000};
178 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
179 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb6080[i];
180 }
181 } else { // all other centrality classes
182 Double_t fBinLimitsArrayMultiplicityPbPb[5] = {0., 510., 625., 730., 5000};
183 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
184 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb[i];
185 }
f61c548e 186 }
cfd87ccd 187 } else if(collisionSystem == 8 || collisionSystem == 9){ // pPb
188 Double_t fBinLimitsArrayMultiplicitypPb[5] = {0., 7.5, 16.5, 29.5, 500};
189 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
190 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb[i];
191 }
192 if(centMin == 0 && centMax == 20){ // pPb 0-20 %
193 Double_t fBinLimitsArrayMultiplicitypPb0020[5] = {0., 31.5, 40.5, 50.5, 500};
194 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
195 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb0020[i];
196 }
f61c548e 197 } else if(centMin == 20 && centMax == 40){
cfd87ccd 198 Double_t fBinLimitsArrayMultiplicitypPb2040[5] = {0., 19.5, 25.5, 32.5, 500};
199 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
200 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb2040[i];
201 }
f61c548e 202 } else if(centMin == 40 && centMax == 60){
cfd87ccd 203 Double_t fBinLimitsArrayMultiplicitypPb4060[5] = {0., 12.5, 16.5, 22.5, 500};
204 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
205 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb4060[i];
206 }
f61c548e 207 } else if(centMin == 60 && centMax == 80){
cfd87ccd 208 Double_t fBinLimitsArrayMultiplicitypPb6080[5] = {0., 5.5, 9.5, 13.5, 500};
209 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
210 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb6080[i];
211 }
f61c548e 212 } else if(centMin == 60 && centMax == 100){
cfd87ccd 213 Double_t fBinLimitsArrayMultiplicitypPb60100[5] = {0., 2.5, 6.5, 11.5, 500};
214 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
215 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb60100[i];
216 }
f61c548e 217 }
218 }
cfd87ccd 219 } else{ // Initializing Multiplicity binning with photon Mult
220 if (mode == 0 || mode == 1) { // settings for Conv-Conv && Conv-Dalitz
221 // pp & pPb defaults
222 Double_t fBinLimitsArrayMultiplicitypp[5] = {2., 3., 4., 5., 9999.};
223 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
224 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypp[i];
225 }
226 if(collisionSystem > 0 && collisionSystem < 8){ // settings PbPb
227 if(centMin == 0 && centMax == 5){ // 0-5%
228 Double_t fBinLimitsArrayMultiplicityPbPb0005[5] = {0., 27., 31., 36., 100.};
229 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
230 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0005[i];
231 }
232 } else if(centMin == 0 && centMax == 10){ // 0-10%
233 Double_t fBinLimitsArrayMultiplicityPbPb0010[5] = {0., 25., 30., 36., 100.};
234 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
235 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0010[i];
236 }
237 } else if(centMin == 0 && centMax == 20){ // 0-20%
238 Double_t fBinLimitsArrayMultiplicityPbPb0020[5] = {0., 22., 27., 33., 100.};
239 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
240 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0020[i];
241 }
242 } else if(centMin == 0 && centMax == 80){ // 0-80%
243 Double_t fBinLimitsArrayMultiplicityPbPb0080[5] = {0., 18., 25., 32., 100.};
244 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
245 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0080[i];
246 }
247 } else if(centMin == 5 && centMax == 10){ // 5-10%
248 Double_t fBinLimitsArrayMultiplicityPbPb0510[5] = {0., 23., 27., 32., 100.};
249 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
250 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0510[i];
251 }
252 } else if(centMin == 10 && centMax == 20){ //10-20%
253 Double_t fBinLimitsArrayMultiplicityPbPb1020[5] = {0., 18., 22., 27., 100.};
254 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
255 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb1020[i];
256 }
257 } else if(centMin == 20 && centMax == 40){ // 20-40%
258 Double_t fBinLimitsArrayMultiplicityPbPb2040[5] = {0., 11., 14., 18., 100.};
259 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
260 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb2040[i];
261 }
262 } else if(centMin == 40 && centMax == 80){ // 40-80%
263 Double_t fBinLimitsArrayMultiplicityPbPb4080[5] = {0., 5., 7., 11., 100.};
264 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
265 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb4080[i];
266 }
267 } else if(centMin == 60 && centMax == 80){ // 60-80%
268 Double_t fBinLimitsArrayMultiplicityPbPb6080[5] = {0., 2., 3., 5., 100.};
269 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
270 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb6080[i];
271 }
272 } else{ // default PbPb
273 Double_t fBinLimitsArrayMultiplicityPbPb[5] = {0., 11., 14., 18., 100.};
274 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
275 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb[i];
276 }
277 }
f61c548e 278 }
cfd87ccd 279 } else if (mode == 2 || mode == 3 || mode == 4 || mode == 5){ // setting for EMCAL-Conv, PHOS-Conv, EMCAL-EMCAL, PHOS-PHOS
280 Double_t fBinLimitsArrayMultiplicitypp[7] = {0., 2., 3., 4., 8., 15., 9999.};
281 for (Int_t i = 0; i < fNBinsMultiplicity; i++){
282 fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypp[i];
283 }
284 }
285 }
f61c548e 286
287 Initialize(fBinLimitsArrayZ,fBinLimitsArrayMultiplicity);
11c1e680 288}
289
f61c548e 290//_____________________________________________________________________________________________________________________________
2bb2434e 291AliGammaConversionAODBGHandler::AliGammaConversionAODBGHandler(const AliGammaConversionAODBGHandler & original) :
f61c548e 292 TObject(original),
293 fNEvents(original.fNEvents),
294 fBGEventCounter(original.fBGEventCounter),
295 fBGEventENegCounter(original.fBGEventENegCounter),
296 fBGEventMesonCounter(original.fBGEventMesonCounter),
297 fBGProbability(original.fBGProbability),
298 fBGEventVertex(original.fBGEventVertex),
299 fNBinsZ(original.fNBinsZ),
300 fNBinsMultiplicity(original.fNBinsMultiplicity),
301 fBinLimitsArrayZ(original.fBinLimitsArrayZ),
302 fBinLimitsArrayMultiplicity(original.fBinLimitsArrayMultiplicity),
303 fBGEvents(original.fBGEvents),
304 fBGEventsENeg(original.fBGEventsENeg),
305 fBGEventsMeson(original.fBGEventsMeson)
2bb2434e 306{
f61c548e 307 //copy constructor
2bb2434e 308}
309
f61c548e 310//_____________________________________________________________________________________________________________________________
2bb2434e 311AliGammaConversionAODBGHandler & AliGammaConversionAODBGHandler::operator = (const AliGammaConversionAODBGHandler & /*source*/)
312{
f61c548e 313 // assignment operator
314 return *this;
2bb2434e 315}
316
f61c548e 317//_____________________________________________________________________________________________________________________________
2bb2434e 318AliGammaConversionAODBGHandler::~AliGammaConversionAODBGHandler(){
319
f61c548e 320 if(fBGEventCounter){
321 for(Int_t z=0;z<fNBinsZ;z++){
322 delete[] fBGEventCounter[z];
323 }
324 delete[] fBGEventCounter;
325 fBGEventCounter = NULL;
326 }
327
328 if(fBGEventVertex){
329 for(Int_t z=0;z<fNBinsZ;z++){
330 for(Int_t m=0;m<fNBinsMultiplicity;m++){
331 delete [] fBGEventVertex[z][m];
332 }
333 delete [] fBGEventVertex[z];
334 }
335 delete [] fBGEventVertex;
336 }
337
338 if(fBGEventENegCounter){
339 for(Int_t z=0;z<fNBinsZ;z++){
340 delete[] fBGEventENegCounter[z];
341 }
342 delete[] fBGEventENegCounter;
343 fBGEventENegCounter = NULL;
344 }
345
346 if(fBGEventMesonCounter){
347 for(Int_t z=0;z<fNBinsZ;z++){
348 delete[] fBGEventMesonCounter[z];
349 }
350 delete[] fBGEventMesonCounter;
351 fBGEventMesonCounter = NULL;
352 }
353
354 if(fBinLimitsArrayZ){
355 delete[] fBinLimitsArrayZ;
356 }
357
358 if(fBinLimitsArrayMultiplicity){
359 delete[] fBinLimitsArrayMultiplicity;
360 }
2bb2434e 361}
362
f61c548e 363//_____________________________________________________________________________________________________________________________
2bb2434e 364void AliGammaConversionAODBGHandler::Initialize(Double_t * const zBinLimitsArray, Double_t * const multiplicityBinLimitsArray){
365 // see header file for documantation
366
f61c548e 367 if(zBinLimitsArray){
368 fBinLimitsArrayZ = zBinLimitsArray;
369 }
370 else{
371 //Print warning
372 }
373
374 if(multiplicityBinLimitsArray){
375 fBinLimitsArrayMultiplicity = multiplicityBinLimitsArray ;
376 }
377 else{
378 //Print warning
379 }
380 if(fBGEventCounter == NULL){
381 fBGEventCounter= new Int_t*[fNBinsZ];
382 }
383 for(Int_t z=0;z<fNBinsZ;z++){
384 fBGEventCounter[z]=new Int_t[fNBinsMultiplicity];
385 }
386
387 for(Int_t z=0;z<fNBinsZ;z++){
388 for(Int_t m=0;m<fNBinsMultiplicity;m++){
389 fBGEventCounter[z][m]=0;
390 }
391 }
392
393 if(fBGEventMesonCounter == NULL){
394 fBGEventMesonCounter= new Int_t*[fNBinsZ];
395 }
396 for(Int_t z=0;z<fNBinsZ;z++){
397 fBGEventMesonCounter[z]=new Int_t[fNBinsMultiplicity];
398 }
399
400 for(Int_t z=0;z<fNBinsZ;z++){
401 for(Int_t m=0;m<fNBinsMultiplicity;m++){
402 fBGEventMesonCounter[z][m]=0;
403 }
404 }
405
406
407 if(fBGEventVertex == NULL){
408 fBGEventVertex = new GammaConversionVertex**[fNBinsZ];
409 }
410 for(Int_t z=0; z < fNBinsZ; z++){
411 fBGEventVertex[z]= new GammaConversionVertex*[fNBinsMultiplicity];
412 }
413 for(Int_t z=0;z<fNBinsZ;z++){
414 for(Int_t m=0;m<fNBinsMultiplicity; m++){
415 fBGEventVertex[z][m]= new GammaConversionVertex[fNEvents];
416 }
417 }
418 if( fBGEventENegCounter == NULL){
419 fBGEventENegCounter = new Int_t*[fNBinsZ];
420 }
421
422 for(Int_t z=0; z < fNBinsZ; z++){
423 fBGEventENegCounter[z] = new Int_t[fNBinsMultiplicity];
424 }
425
426 for(Int_t z=0;z<fNBinsZ;z++){
427 for(Int_t m=0;m<fNBinsMultiplicity; m++){
428 fBGEventENegCounter[z][m] = 0;
429 }
430 }
431
432 if(fBGProbability == NULL){
433 fBGProbability = new Double_t*[fNBinsZ];
434 }
435 for(Int_t z=0; z < fNBinsZ; z++){
436 fBGProbability[z] = new Double_t[fNBinsMultiplicity];
437 }
438
439 for(Int_t z=0;z<fNBinsZ;z++){
440 for(Int_t m=0;m<fNBinsMultiplicity; m++){
441 fBGProbability[z][m] = 0;
442 }
443 }
444 //filling the probability
445 fBGProbability[0][0] = 0.243594;
446 fBGProbability[0][1] = 0.279477;
447 fBGProbability[0][2] = 0.305104;
448 fBGProbability[0][3] = 0.315927;
449 fBGProbability[1][0] = 0.241964;
450 fBGProbability[1][1] = 0.272995;
451 fBGProbability[1][2] = 0.307165;
452 fBGProbability[1][3] = 0.292248;
453 fBGProbability[2][0] = 0.241059;
454 fBGProbability[2][1] = 0.27509;
455 fBGProbability[2][2] = 0.283657;
456 fBGProbability[2][3] = 0.310512;
457 fBGProbability[3][0] = 0.23888;
458 fBGProbability[3][1] = 0.283418;
459 fBGProbability[3][2] = 0.297232;
460 fBGProbability[3][3] = 0.348188;
461 fBGProbability[4][0] = 0.245555;
462 fBGProbability[4][1] = 0.281218;
463 fBGProbability[4][2] = 0.317236;
464 fBGProbability[4][3] = 0.323495;
465 fBGProbability[5][0] = 0.244572;
466 fBGProbability[5][1] = 0.259498;
467 fBGProbability[5][2] = 0.278383;
468 fBGProbability[5][3] = 0.284696;
469 fBGProbability[6][0] = 0.24703;
470 fBGProbability[6][1] = 0.275265;
471 fBGProbability[6][2] = 0.284004;
472 fBGProbability[6][3] = 0.343584;
473
2bb2434e 474}
475
f61c548e 476//_____________________________________________________________________________________________________________________________
2bb2434e 477Int_t AliGammaConversionAODBGHandler::GetZBinIndex(Double_t zvalue) const{
f61c548e 478 // see header file for documantation
479 if(fNBinsZ<2 || zvalue<=fBinLimitsArrayZ[0]){
480 return 0;
481 }
482
483 for(Int_t i=0; i<fNBinsZ-1 ;i++){
484 if(zvalue >= fBinLimitsArrayZ[i] && zvalue <= fBinLimitsArrayZ[i+1]){
485 return i;
486 }
487 }
488 return fNBinsZ-1;
2bb2434e 489}
490
f61c548e 491//_____________________________________________________________________________________________________________________________
2bb2434e 492Int_t AliGammaConversionAODBGHandler::GetMultiplicityBinIndex(Int_t multiplicity) const{
f61c548e 493 // see header file for documantation
494 if(fNBinsMultiplicity<2){
495 return 0;
496 }
497
498 for(Int_t i=0; i<fNBinsMultiplicity-1 ;i++){
499 if(multiplicity >= fBinLimitsArrayMultiplicity[i] && multiplicity < fBinLimitsArrayMultiplicity[i+1]){
500 return i;
501 }
502 }
503 return fNBinsMultiplicity-1;
2bb2434e 504}
505
f61c548e 506//_____________________________________________________________________________________________________________________________
ae4f2cfb 507void AliGammaConversionAODBGHandler::AddEvent(TList* const eventGammas,Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
508
f61c548e 509 // see header file for documantation
510
511 // cout<<"Entering the AddEvent function"<<endl;
2bb2434e 512
f61c548e 513 Int_t z = GetZBinIndex(zvalue);
514 Int_t m = GetMultiplicityBinIndex(multiplicity);
515
516 if(fBGEventCounter[z][m] >= fNEvents){
517 fBGEventCounter[z][m]=0;
518 }
519 Int_t eventCounter=fBGEventCounter[z][m];
520
521 /*
522 if(fBGEventVertex[z][m][eventCounter]){
523 delete fBGEventVertex[z][m][eventCounter];
524 }
525 */
526 fBGEventVertex[z][m][eventCounter].fX = xvalue;
527 fBGEventVertex[z][m][eventCounter].fY = yvalue;
528 fBGEventVertex[z][m][eventCounter].fZ = zvalue;
529 fBGEventVertex[z][m][eventCounter].fEP = epvalue;
530
531 //first clear the vector
532 // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
533 // cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
534
535 // cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
536 for(UInt_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
537 delete (AliAODConversionPhoton*)(fBGEvents[z][m][eventCounter][d]);
538 }
539 fBGEvents[z][m][eventCounter].clear();
540
541 // add the gammas to the vector
542 for(Int_t i=0; i< eventGammas->GetEntries();i++){
543 // AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
544 fBGEvents[z][m][eventCounter].push_back(new AliAODConversionPhoton(*(AliAODConversionPhoton*)(eventGammas->At(i))));
545 }
546 fBGEventCounter[z][m]++;
2bb2434e 547}
2bb2434e 548
f61c548e 549//_____________________________________________________________________________________________________________________________
550void AliGammaConversionAODBGHandler::AddMesonEvent(TList* const eventMothers, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
2bb2434e 551
f61c548e 552 // see header file for documantation
553 // cout<<"Entering the AddEvent function"<<endl;
554 Int_t z = GetZBinIndex(zvalue);
555 Int_t m = GetMultiplicityBinIndex(multiplicity);
2bb2434e 556
f61c548e 557 if(fBGEventMesonCounter[z][m] >= fNEvents){
558 fBGEventMesonCounter[z][m]=0;
559 }
560 Int_t eventCounter=fBGEventMesonCounter[z][m];
561
562 fBGEventVertex[z][m][eventCounter].fX = xvalue;
563 fBGEventVertex[z][m][eventCounter].fY = yvalue;
564 fBGEventVertex[z][m][eventCounter].fZ = zvalue;
565 fBGEventVertex[z][m][eventCounter].fEP = epvalue;
566
567 //first clear the vector
568 for(UInt_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
569 delete (AliAODConversionMother*)(fBGEventsMeson[z][m][eventCounter][d]);
570 }
571 fBGEventsMeson[z][m][eventCounter].clear();
572
573 // add the gammas to the vector
574 for(Int_t i=0; i< eventMothers->GetEntries();i++){
575 fBGEventsMeson[z][m][eventCounter].push_back(new AliAODConversionMother(*(AliAODConversionMother*)(eventMothers->At(i))));
576 }
577 fBGEventMesonCounter[z][m]++;
578}
2bb2434e 579
2bb2434e 580
f61c548e 581//_____________________________________________________________________________________________________________________________
582void AliGammaConversionAODBGHandler::AddElectronEvent(TClonesArray* const eventENeg, Double_t zvalue, Int_t multiplicity){
2bb2434e 583
f61c548e 584 Int_t z = GetZBinIndex(zvalue);
585 Int_t m = GetMultiplicityBinIndex(multiplicity);
2bb2434e 586
f61c548e 587 if(fBGEventENegCounter[z][m] >= fNEvents){
588 fBGEventENegCounter[z][m]=0;
589 }
590 Int_t eventENegCounter=fBGEventENegCounter[z][m];
591
592 //first clear the vector
593 // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
594 // cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
595
596 // cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
597 for(UInt_t d=0;d<fBGEventsENeg[z][m][eventENegCounter].size();d++){
598 delete (AliAODConversionPhoton*)(fBGEventsENeg[z][m][eventENegCounter][d]);
599 }
2bb2434e 600
f61c548e 601 fBGEventsENeg[z][m][eventENegCounter].clear();
2bb2434e 602
f61c548e 603 // add the electron to the vector
604 for(Int_t i=0; i< eventENeg->GetEntriesFast();i++){
605 // AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
606 fBGEventsENeg[z][m][eventENegCounter].push_back(new AliAODConversionPhoton(*(AliAODConversionPhoton*)(eventENeg->At(i))));
607 }
608 fBGEventENegCounter[z][m]++;
2bb2434e 609}
f61c548e 610
611//_____________________________________________________________________________________________________________________________
2bb2434e 612AliGammaConversionAODVector* AliGammaConversionAODBGHandler::GetBGGoodV0s(Int_t zbin, Int_t mbin, Int_t event){
f61c548e 613 //see headerfile for documentation
614 return &(fBGEvents[zbin][mbin][event]);
2bb2434e 615}
2bb2434e 616
f61c548e 617//_____________________________________________________________________________________________________________________________
618AliGammaConversionMotherAODVector* AliGammaConversionAODBGHandler::GetBGGoodMesons(Int_t zbin, Int_t mbin, Int_t event){
619 //see headerfile for documentation
620 return &(fBGEventsMeson[zbin][mbin][event]);
621}
2bb2434e 622
f61c548e 623//_____________________________________________________________________________________________________________________________
624AliGammaConversionAODVector* AliGammaConversionAODBGHandler::GetBGGoodENeg(Int_t event, Double_t zvalue, Int_t multiplicity){
625 //see headerfile for documentation
626 Int_t z = GetZBinIndex(zvalue);
627 Int_t m = GetMultiplicityBinIndex(multiplicity);
628 return &(fBGEventsENeg[z][m][event]);
2bb2434e 629}
f61c548e 630
631//_____________________________________________________________________________________________________________________________
2bb2434e 632void AliGammaConversionAODBGHandler::PrintBGArray(){
f61c548e 633 //see headerfile for documentation
634 for(Int_t z=0;z<fNBinsZ;z++){
635 if(z==2){
636 cout<<"Getting the data for z bin: "<<z<<endl;
637 for(Int_t multiplicity=0;multiplicity<fNBinsMultiplicity;multiplicity++){
638 if(multiplicity==2){
639 cout<<"Getting the data for multiplicity bin: "<<multiplicity<<endl;
640 for(Int_t event=0;event<fNEvents;event++){
641 if(fBGEvents[z][multiplicity][event].size()>0){
642 cout<<"Event: "<<event<<" has: "<<fBGEvents[z][multiplicity][event].size()<<endl;
643 }
644 }
645 }
646 }
647 }
648 }
2bb2434e 649}