added functionality to PWGGA/GammaConv/AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero.cxx
[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//_____________________________________________________________________________________________________________________________
11c1e680 74AliGammaConversionAODBGHandler::AliGammaConversionAODBGHandler(UInt_t collisionSystem,UInt_t centMin,UInt_t centMax,UInt_t nEvents, Bool_t useTrackMult) :
f61c548e 75 TObject(),
76 fNEvents(nEvents),
77 fBGEventCounter(NULL),
78 fBGEventENegCounter(NULL),
79 fBGEventMesonCounter(NULL),
80 fBGProbability(NULL),
81 fBGEventVertex(NULL),
82 fNBinsZ(8),
83 fNBinsMultiplicity(5),
84 fBinLimitsArrayZ(NULL),
85 fBinLimitsArrayMultiplicity(NULL),
86 fBGEvents(fNBinsZ,AliGammaConversionMultipicityVector(fNBinsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
87 fBGEventsENeg(fNBinsZ,AliGammaConversionMultipicityVector(fNBinsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
88 fBGEventsMeson(fNBinsZ,AliGammaConversionMotherMultipicityVector(fNBinsMultiplicity,AliGammaConversionMotherBGEventVector(nEvents)))
11c1e680 89{
f61c548e 90 // constructor
91
92 fBinLimitsArrayZ= new Double_t[8] ;
93 if(collisionSystem > 0 && collisionSystem < 8){ // PbPb
94 fBinLimitsArrayZ[0] = -50.00;
95 fBinLimitsArrayZ[1] = -5.5;
96 fBinLimitsArrayZ[2] = -2.9;
97 fBinLimitsArrayZ[3] = -0.65;
98 fBinLimitsArrayZ[4] = 1.45;
99 fBinLimitsArrayZ[5] = 3.65;
100 fBinLimitsArrayZ[6] = 6.15;
101 fBinLimitsArrayZ[7] = 50;
102 }
103 else if(collisionSystem == 0){
104 fBinLimitsArrayZ[0] = -50.00;
105 fBinLimitsArrayZ[1] = -3.375;
106 fBinLimitsArrayZ[2] = -1.605;
107 fBinLimitsArrayZ[3] = -0.225;
108 fBinLimitsArrayZ[4] = 1.065;
109 fBinLimitsArrayZ[5] = 2.445;
110 fBinLimitsArrayZ[6] = 4.245;
111 fBinLimitsArrayZ[7] = 50.00;
112 }
113 else{
114 fBinLimitsArrayZ[0] = -50.00;
115 fBinLimitsArrayZ[1] = -5.85;
116 fBinLimitsArrayZ[2] = -3.35;
117 fBinLimitsArrayZ[3] = -1.15;
118 fBinLimitsArrayZ[4] = 0.85;
119 fBinLimitsArrayZ[5] = 2.95;
120 fBinLimitsArrayZ[6] = 5.55;
121 fBinLimitsArrayZ[7] = 50.00;
122 }
123
124
11c1e680 125
f61c548e 126 fBinLimitsArrayMultiplicity= new Double_t[5];
127 if(useTrackMult){ // pp
128 fBinLimitsArrayMultiplicity[0] = 0;
129 fBinLimitsArrayMultiplicity[1] = 8.5;
130 fBinLimitsArrayMultiplicity[2] = 16.5;
131 fBinLimitsArrayMultiplicity[3] = 27.5;
132 fBinLimitsArrayMultiplicity[4] = 200.;
133 if(collisionSystem > 0 && collisionSystem < 8){ // PbPb
134 if(centMin == 0 && centMax == 5){
135 fBinLimitsArrayMultiplicity[0] = 0.;
136 fBinLimitsArrayMultiplicity[1] = 1540.;
137 fBinLimitsArrayMultiplicity[2] = 1665.;
138 fBinLimitsArrayMultiplicity[3] = 1780.;
139 fBinLimitsArrayMultiplicity[4] = 5000.;
140 }
141 else if(centMin == 0 && centMax == 10){
142 fBinLimitsArrayMultiplicity[0] = 0.;
143 fBinLimitsArrayMultiplicity[1] = 1360.;
144 fBinLimitsArrayMultiplicity[2] = 1520.;
145 fBinLimitsArrayMultiplicity[3] = 1685.;
146 fBinLimitsArrayMultiplicity[4] = 5000.;
147 }
148 else if(centMin == 0 && centMax == 20){
149 fBinLimitsArrayMultiplicity[0] = 0.;
150 fBinLimitsArrayMultiplicity[1] = 1110.;
151 fBinLimitsArrayMultiplicity[2] = 1360.;
152 fBinLimitsArrayMultiplicity[3] = 1600.;
153 fBinLimitsArrayMultiplicity[4] = 5000.;
154 }
155 else if(centMin == 0 && centMax == 80){
156 fBinLimitsArrayMultiplicity[0] = 0.;
157 fBinLimitsArrayMultiplicity[1] = 890.;
158 fBinLimitsArrayMultiplicity[2] = 1240.;
159 fBinLimitsArrayMultiplicity[3] = 1540.;
160 fBinLimitsArrayMultiplicity[4] = 5000.;
161 }
162 else if(centMin == 5 && centMax == 10){
163 fBinLimitsArrayMultiplicity[0] = 0.;
164 fBinLimitsArrayMultiplicity[1] = 1250.;
165 fBinLimitsArrayMultiplicity[2] = 1345.;
166 fBinLimitsArrayMultiplicity[3] = 1445.;
167 fBinLimitsArrayMultiplicity[4] = 5000.;
168 }
169 else if(centMin == 10 && centMax == 20){
170 fBinLimitsArrayMultiplicity[0] = 0.;
171 fBinLimitsArrayMultiplicity[1] = 915.;
172 fBinLimitsArrayMultiplicity[2] = 1020.;
173 fBinLimitsArrayMultiplicity[3] = 1130.;
174 fBinLimitsArrayMultiplicity[4] = 5000.;
175 }
176 else if(centMin == 20 && centMax == 40){
177 fBinLimitsArrayMultiplicity[0] = 0.;
178 fBinLimitsArrayMultiplicity[1] = 510.;
179 fBinLimitsArrayMultiplicity[2] = 625.;
180 fBinLimitsArrayMultiplicity[3] = 730.;
181 fBinLimitsArrayMultiplicity[4] = 5000.;
182 }
183 else if(centMin == 40 && centMax == 80){
184 fBinLimitsArrayMultiplicity[0] = 0.;
185 fBinLimitsArrayMultiplicity[1] = 185.;
186 fBinLimitsArrayMultiplicity[2] = 250.;
187 fBinLimitsArrayMultiplicity[3] = 300.;
188 fBinLimitsArrayMultiplicity[4] = 5000.;
189 }
190 else if(centMin == 60 && centMax == 80){
191 fBinLimitsArrayMultiplicity[0] = 0.;
192 fBinLimitsArrayMultiplicity[1] = 55.;
193 fBinLimitsArrayMultiplicity[2] = 80.;
194 fBinLimitsArrayMultiplicity[3] = 100.;
195 fBinLimitsArrayMultiplicity[4] = 5000.;
196 }
197 else{ // Std 20-40
198 fBinLimitsArrayMultiplicity[0] = 0.;
199 fBinLimitsArrayMultiplicity[1] = 510.;
200 fBinLimitsArrayMultiplicity[2] = 625.;
201 fBinLimitsArrayMultiplicity[3] = 730.;
202 fBinLimitsArrayMultiplicity[4] = 5000.;
203 }
204 }
205
206 else if(collisionSystem == 8 || collisionSystem == 9){ //pPb
207
208 fBinLimitsArrayMultiplicity[0] = 0.;
209 fBinLimitsArrayMultiplicity[1] = 7.5;
210 fBinLimitsArrayMultiplicity[2] = 16.5;
211 fBinLimitsArrayMultiplicity[3] = 29.5;
212 fBinLimitsArrayMultiplicity[4] = 500.;
213
214 if(centMin == 0 && centMax == 20){
215 fBinLimitsArrayMultiplicity[0] = 0.;
216 fBinLimitsArrayMultiplicity[1] = 31.5;
217 fBinLimitsArrayMultiplicity[2] = 40.5;
218 fBinLimitsArrayMultiplicity[3] = 50.5;
219 fBinLimitsArrayMultiplicity[4] = 500.;
220 } else if(centMin == 20 && centMax == 40){
221 fBinLimitsArrayMultiplicity[0] = 0.;
222 fBinLimitsArrayMultiplicity[1] = 19.5;
223 fBinLimitsArrayMultiplicity[2] = 25.5;
224 fBinLimitsArrayMultiplicity[3] = 32.5;
225 fBinLimitsArrayMultiplicity[4] = 500.;
226 } else if(centMin == 40 && centMax == 60){
227 fBinLimitsArrayMultiplicity[0] = 0.;
228 fBinLimitsArrayMultiplicity[1] = 12.5;
229 fBinLimitsArrayMultiplicity[2] = 16.5;
230 fBinLimitsArrayMultiplicity[3] = 22.5;
231 fBinLimitsArrayMultiplicity[4] = 500.;
232 } else if(centMin == 60 && centMax == 80){
233 fBinLimitsArrayMultiplicity[0] = 0.;
234 fBinLimitsArrayMultiplicity[1] = 5.5;
235 fBinLimitsArrayMultiplicity[2] = 9.5;
236 fBinLimitsArrayMultiplicity[3] = 13.5;
237 fBinLimitsArrayMultiplicity[4] = 500.;
238 } else if(centMin == 60 && centMax == 100){
239 fBinLimitsArrayMultiplicity[0] = 0.;
240 fBinLimitsArrayMultiplicity[1] = 2.5;
241 fBinLimitsArrayMultiplicity[2] = 6.5;
242 fBinLimitsArrayMultiplicity[3] = 11.5;
243 fBinLimitsArrayMultiplicity[4] = 500.;
244 }
245 }
246 }
247 else{// pp or pPb V0 Mult
248 fBinLimitsArrayMultiplicity[0] = 2;
249 fBinLimitsArrayMultiplicity[1] = 3;
250 fBinLimitsArrayMultiplicity[2] = 4;
251 fBinLimitsArrayMultiplicity[3] = 5;
252 fBinLimitsArrayMultiplicity[4] = 9999;
253 if(collisionSystem > 0 && collisionSystem < 8){ // PbPb
254 if(centMin == 0 && centMax == 5){
255 fBinLimitsArrayMultiplicity[0] = 0.;
256 fBinLimitsArrayMultiplicity[1] = 27.;
257 fBinLimitsArrayMultiplicity[2] = 31.;
258 fBinLimitsArrayMultiplicity[3] = 36.;
259 fBinLimitsArrayMultiplicity[4] = 100.;
260 }
261 else if(centMin == 0 && centMax == 10){
262 fBinLimitsArrayMultiplicity[0] = 0.;
263 fBinLimitsArrayMultiplicity[1] = 25.;
264 fBinLimitsArrayMultiplicity[2] = 30.;
265 fBinLimitsArrayMultiplicity[3] = 36.;
266 fBinLimitsArrayMultiplicity[4] = 100.;
267 }
268 else if(centMin == 0 && centMax == 20){
269 fBinLimitsArrayMultiplicity[0] = 0.;
270 fBinLimitsArrayMultiplicity[1] = 22.;
271 fBinLimitsArrayMultiplicity[2] = 27.;
272 fBinLimitsArrayMultiplicity[3] = 33.;
273 fBinLimitsArrayMultiplicity[4] = 100.;
274 }
275 else if(centMin == 0 && centMax == 80){
276 fBinLimitsArrayMultiplicity[0] = 0.;
277 fBinLimitsArrayMultiplicity[1] = 18.;
278 fBinLimitsArrayMultiplicity[2] = 25.;
279 fBinLimitsArrayMultiplicity[3] = 32.;
280 fBinLimitsArrayMultiplicity[4] = 100.;
281 }
282 else if(centMin == 5 && centMax == 10){
283 fBinLimitsArrayMultiplicity[0] = 0.;
284 fBinLimitsArrayMultiplicity[1] = 23.;
285 fBinLimitsArrayMultiplicity[2] = 27.;
286 fBinLimitsArrayMultiplicity[3] = 32.;
287 fBinLimitsArrayMultiplicity[4] = 100.;
288 }
289 else if(centMin == 10 && centMax == 20){
290 fBinLimitsArrayMultiplicity[0] = 0.;
291 fBinLimitsArrayMultiplicity[1] = 18.;
292 fBinLimitsArrayMultiplicity[2] = 22.;
293 fBinLimitsArrayMultiplicity[3] = 27.;
294 fBinLimitsArrayMultiplicity[4] = 100.;
295 }
296 else if(centMin == 20 && centMax == 40){
297 fBinLimitsArrayMultiplicity[0] = 0.;
298 fBinLimitsArrayMultiplicity[1] = 11.;
299 fBinLimitsArrayMultiplicity[2] = 14.;
300 fBinLimitsArrayMultiplicity[3] = 18.;
301 fBinLimitsArrayMultiplicity[4] = 100.;
302 }
303 else if(centMin == 40 && centMax == 80){
304 fBinLimitsArrayMultiplicity[0] = 0.;
305 fBinLimitsArrayMultiplicity[1] = 5.;
306 fBinLimitsArrayMultiplicity[2] = 7.;
307 fBinLimitsArrayMultiplicity[3] = 11.;
308 fBinLimitsArrayMultiplicity[4] = 100.;
309 }
310 else if(centMin == 60 && centMax == 80){
311 fBinLimitsArrayMultiplicity[0] = 0.;
312 fBinLimitsArrayMultiplicity[1] = 2.;
313 fBinLimitsArrayMultiplicity[2] = 3.;
314 fBinLimitsArrayMultiplicity[3] = 5.;
315 fBinLimitsArrayMultiplicity[4] = 100.;
316 }
317 else{ // Std 20-40
318 fBinLimitsArrayMultiplicity[0] = 0.;
319 fBinLimitsArrayMultiplicity[1] = 11.;
320 fBinLimitsArrayMultiplicity[2] = 14.;
321 fBinLimitsArrayMultiplicity[3] = 18.;
322 fBinLimitsArrayMultiplicity[4] = 100.;
323 }
324 }
325 }
326
327 Initialize(fBinLimitsArrayZ,fBinLimitsArrayMultiplicity);
11c1e680 328}
329
f61c548e 330//_____________________________________________________________________________________________________________________________
2bb2434e 331AliGammaConversionAODBGHandler::AliGammaConversionAODBGHandler(const AliGammaConversionAODBGHandler & original) :
f61c548e 332 TObject(original),
333 fNEvents(original.fNEvents),
334 fBGEventCounter(original.fBGEventCounter),
335 fBGEventENegCounter(original.fBGEventENegCounter),
336 fBGEventMesonCounter(original.fBGEventMesonCounter),
337 fBGProbability(original.fBGProbability),
338 fBGEventVertex(original.fBGEventVertex),
339 fNBinsZ(original.fNBinsZ),
340 fNBinsMultiplicity(original.fNBinsMultiplicity),
341 fBinLimitsArrayZ(original.fBinLimitsArrayZ),
342 fBinLimitsArrayMultiplicity(original.fBinLimitsArrayMultiplicity),
343 fBGEvents(original.fBGEvents),
344 fBGEventsENeg(original.fBGEventsENeg),
345 fBGEventsMeson(original.fBGEventsMeson)
2bb2434e 346{
f61c548e 347 //copy constructor
2bb2434e 348}
349
f61c548e 350//_____________________________________________________________________________________________________________________________
2bb2434e 351AliGammaConversionAODBGHandler & AliGammaConversionAODBGHandler::operator = (const AliGammaConversionAODBGHandler & /*source*/)
352{
f61c548e 353 // assignment operator
354 return *this;
2bb2434e 355}
356
f61c548e 357//_____________________________________________________________________________________________________________________________
2bb2434e 358AliGammaConversionAODBGHandler::~AliGammaConversionAODBGHandler(){
359
f61c548e 360 if(fBGEventCounter){
361 for(Int_t z=0;z<fNBinsZ;z++){
362 delete[] fBGEventCounter[z];
363 }
364 delete[] fBGEventCounter;
365 fBGEventCounter = NULL;
366 }
367
368 if(fBGEventVertex){
369 for(Int_t z=0;z<fNBinsZ;z++){
370 for(Int_t m=0;m<fNBinsMultiplicity;m++){
371 delete [] fBGEventVertex[z][m];
372 }
373 delete [] fBGEventVertex[z];
374 }
375 delete [] fBGEventVertex;
376 }
377
378 if(fBGEventENegCounter){
379 for(Int_t z=0;z<fNBinsZ;z++){
380 delete[] fBGEventENegCounter[z];
381 }
382 delete[] fBGEventENegCounter;
383 fBGEventENegCounter = NULL;
384 }
385
386 if(fBGEventMesonCounter){
387 for(Int_t z=0;z<fNBinsZ;z++){
388 delete[] fBGEventMesonCounter[z];
389 }
390 delete[] fBGEventMesonCounter;
391 fBGEventMesonCounter = NULL;
392 }
393
394 if(fBinLimitsArrayZ){
395 delete[] fBinLimitsArrayZ;
396 }
397
398 if(fBinLimitsArrayMultiplicity){
399 delete[] fBinLimitsArrayMultiplicity;
400 }
2bb2434e 401}
402
f61c548e 403//_____________________________________________________________________________________________________________________________
2bb2434e 404void AliGammaConversionAODBGHandler::Initialize(Double_t * const zBinLimitsArray, Double_t * const multiplicityBinLimitsArray){
405 // see header file for documantation
406
f61c548e 407 if(zBinLimitsArray){
408 fBinLimitsArrayZ = zBinLimitsArray;
409 }
410 else{
411 //Print warning
412 }
413
414 if(multiplicityBinLimitsArray){
415 fBinLimitsArrayMultiplicity = multiplicityBinLimitsArray ;
416 }
417 else{
418 //Print warning
419 }
420 if(fBGEventCounter == NULL){
421 fBGEventCounter= new Int_t*[fNBinsZ];
422 }
423 for(Int_t z=0;z<fNBinsZ;z++){
424 fBGEventCounter[z]=new Int_t[fNBinsMultiplicity];
425 }
426
427 for(Int_t z=0;z<fNBinsZ;z++){
428 for(Int_t m=0;m<fNBinsMultiplicity;m++){
429 fBGEventCounter[z][m]=0;
430 }
431 }
432
433 if(fBGEventMesonCounter == NULL){
434 fBGEventMesonCounter= new Int_t*[fNBinsZ];
435 }
436 for(Int_t z=0;z<fNBinsZ;z++){
437 fBGEventMesonCounter[z]=new Int_t[fNBinsMultiplicity];
438 }
439
440 for(Int_t z=0;z<fNBinsZ;z++){
441 for(Int_t m=0;m<fNBinsMultiplicity;m++){
442 fBGEventMesonCounter[z][m]=0;
443 }
444 }
445
446
447 if(fBGEventVertex == NULL){
448 fBGEventVertex = new GammaConversionVertex**[fNBinsZ];
449 }
450 for(Int_t z=0; z < fNBinsZ; z++){
451 fBGEventVertex[z]= new GammaConversionVertex*[fNBinsMultiplicity];
452 }
453 for(Int_t z=0;z<fNBinsZ;z++){
454 for(Int_t m=0;m<fNBinsMultiplicity; m++){
455 fBGEventVertex[z][m]= new GammaConversionVertex[fNEvents];
456 }
457 }
458 if( fBGEventENegCounter == NULL){
459 fBGEventENegCounter = new Int_t*[fNBinsZ];
460 }
461
462 for(Int_t z=0; z < fNBinsZ; z++){
463 fBGEventENegCounter[z] = new Int_t[fNBinsMultiplicity];
464 }
465
466 for(Int_t z=0;z<fNBinsZ;z++){
467 for(Int_t m=0;m<fNBinsMultiplicity; m++){
468 fBGEventENegCounter[z][m] = 0;
469 }
470 }
471
472 if(fBGProbability == NULL){
473 fBGProbability = new Double_t*[fNBinsZ];
474 }
475 for(Int_t z=0; z < fNBinsZ; z++){
476 fBGProbability[z] = new Double_t[fNBinsMultiplicity];
477 }
478
479 for(Int_t z=0;z<fNBinsZ;z++){
480 for(Int_t m=0;m<fNBinsMultiplicity; m++){
481 fBGProbability[z][m] = 0;
482 }
483 }
484 //filling the probability
485 fBGProbability[0][0] = 0.243594;
486 fBGProbability[0][1] = 0.279477;
487 fBGProbability[0][2] = 0.305104;
488 fBGProbability[0][3] = 0.315927;
489 fBGProbability[1][0] = 0.241964;
490 fBGProbability[1][1] = 0.272995;
491 fBGProbability[1][2] = 0.307165;
492 fBGProbability[1][3] = 0.292248;
493 fBGProbability[2][0] = 0.241059;
494 fBGProbability[2][1] = 0.27509;
495 fBGProbability[2][2] = 0.283657;
496 fBGProbability[2][3] = 0.310512;
497 fBGProbability[3][0] = 0.23888;
498 fBGProbability[3][1] = 0.283418;
499 fBGProbability[3][2] = 0.297232;
500 fBGProbability[3][3] = 0.348188;
501 fBGProbability[4][0] = 0.245555;
502 fBGProbability[4][1] = 0.281218;
503 fBGProbability[4][2] = 0.317236;
504 fBGProbability[4][3] = 0.323495;
505 fBGProbability[5][0] = 0.244572;
506 fBGProbability[5][1] = 0.259498;
507 fBGProbability[5][2] = 0.278383;
508 fBGProbability[5][3] = 0.284696;
509 fBGProbability[6][0] = 0.24703;
510 fBGProbability[6][1] = 0.275265;
511 fBGProbability[6][2] = 0.284004;
512 fBGProbability[6][3] = 0.343584;
513
2bb2434e 514}
515
f61c548e 516//_____________________________________________________________________________________________________________________________
2bb2434e 517Int_t AliGammaConversionAODBGHandler::GetZBinIndex(Double_t zvalue) const{
f61c548e 518 // see header file for documantation
519 if(fNBinsZ<2 || zvalue<=fBinLimitsArrayZ[0]){
520 return 0;
521 }
522
523 for(Int_t i=0; i<fNBinsZ-1 ;i++){
524 if(zvalue >= fBinLimitsArrayZ[i] && zvalue <= fBinLimitsArrayZ[i+1]){
525 return i;
526 }
527 }
528 return fNBinsZ-1;
2bb2434e 529}
530
f61c548e 531//_____________________________________________________________________________________________________________________________
2bb2434e 532Int_t AliGammaConversionAODBGHandler::GetMultiplicityBinIndex(Int_t multiplicity) const{
f61c548e 533 // see header file for documantation
534 if(fNBinsMultiplicity<2){
535 return 0;
536 }
537
538 for(Int_t i=0; i<fNBinsMultiplicity-1 ;i++){
539 if(multiplicity >= fBinLimitsArrayMultiplicity[i] && multiplicity < fBinLimitsArrayMultiplicity[i+1]){
540 return i;
541 }
542 }
543 return fNBinsMultiplicity-1;
2bb2434e 544}
545
f61c548e 546//_____________________________________________________________________________________________________________________________
ae4f2cfb 547void AliGammaConversionAODBGHandler::AddEvent(TList* const eventGammas,Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
548
f61c548e 549 // see header file for documantation
550
551 // cout<<"Entering the AddEvent function"<<endl;
2bb2434e 552
f61c548e 553 Int_t z = GetZBinIndex(zvalue);
554 Int_t m = GetMultiplicityBinIndex(multiplicity);
555
556 if(fBGEventCounter[z][m] >= fNEvents){
557 fBGEventCounter[z][m]=0;
558 }
559 Int_t eventCounter=fBGEventCounter[z][m];
560
561 /*
562 if(fBGEventVertex[z][m][eventCounter]){
563 delete fBGEventVertex[z][m][eventCounter];
564 }
565 */
566 fBGEventVertex[z][m][eventCounter].fX = xvalue;
567 fBGEventVertex[z][m][eventCounter].fY = yvalue;
568 fBGEventVertex[z][m][eventCounter].fZ = zvalue;
569 fBGEventVertex[z][m][eventCounter].fEP = epvalue;
570
571 //first clear the vector
572 // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
573 // cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
574
575 // cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
576 for(UInt_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
577 delete (AliAODConversionPhoton*)(fBGEvents[z][m][eventCounter][d]);
578 }
579 fBGEvents[z][m][eventCounter].clear();
580
581 // add the gammas to the vector
582 for(Int_t i=0; i< eventGammas->GetEntries();i++){
583 // AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
584 fBGEvents[z][m][eventCounter].push_back(new AliAODConversionPhoton(*(AliAODConversionPhoton*)(eventGammas->At(i))));
585 }
586 fBGEventCounter[z][m]++;
2bb2434e 587}
2bb2434e 588
f61c548e 589//_____________________________________________________________________________________________________________________________
590void AliGammaConversionAODBGHandler::AddMesonEvent(TList* const eventMothers, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
2bb2434e 591
f61c548e 592 // see header file for documantation
593 // cout<<"Entering the AddEvent function"<<endl;
594 Int_t z = GetZBinIndex(zvalue);
595 Int_t m = GetMultiplicityBinIndex(multiplicity);
2bb2434e 596
f61c548e 597 if(fBGEventMesonCounter[z][m] >= fNEvents){
598 fBGEventMesonCounter[z][m]=0;
599 }
600 Int_t eventCounter=fBGEventMesonCounter[z][m];
601
602 fBGEventVertex[z][m][eventCounter].fX = xvalue;
603 fBGEventVertex[z][m][eventCounter].fY = yvalue;
604 fBGEventVertex[z][m][eventCounter].fZ = zvalue;
605 fBGEventVertex[z][m][eventCounter].fEP = epvalue;
606
607 //first clear the vector
608 for(UInt_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
609 delete (AliAODConversionMother*)(fBGEventsMeson[z][m][eventCounter][d]);
610 }
611 fBGEventsMeson[z][m][eventCounter].clear();
612
613 // add the gammas to the vector
614 for(Int_t i=0; i< eventMothers->GetEntries();i++){
615 fBGEventsMeson[z][m][eventCounter].push_back(new AliAODConversionMother(*(AliAODConversionMother*)(eventMothers->At(i))));
616 }
617 fBGEventMesonCounter[z][m]++;
618}
2bb2434e 619
2bb2434e 620
f61c548e 621//_____________________________________________________________________________________________________________________________
622void AliGammaConversionAODBGHandler::AddElectronEvent(TClonesArray* const eventENeg, Double_t zvalue, Int_t multiplicity){
2bb2434e 623
f61c548e 624 Int_t z = GetZBinIndex(zvalue);
625 Int_t m = GetMultiplicityBinIndex(multiplicity);
2bb2434e 626
f61c548e 627 if(fBGEventENegCounter[z][m] >= fNEvents){
628 fBGEventENegCounter[z][m]=0;
629 }
630 Int_t eventENegCounter=fBGEventENegCounter[z][m];
631
632 //first clear the vector
633 // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
634 // cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
635
636 // cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
637 for(UInt_t d=0;d<fBGEventsENeg[z][m][eventENegCounter].size();d++){
638 delete (AliAODConversionPhoton*)(fBGEventsENeg[z][m][eventENegCounter][d]);
639 }
2bb2434e 640
f61c548e 641 fBGEventsENeg[z][m][eventENegCounter].clear();
2bb2434e 642
f61c548e 643 // add the electron to the vector
644 for(Int_t i=0; i< eventENeg->GetEntriesFast();i++){
645 // AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
646 fBGEventsENeg[z][m][eventENegCounter].push_back(new AliAODConversionPhoton(*(AliAODConversionPhoton*)(eventENeg->At(i))));
647 }
648 fBGEventENegCounter[z][m]++;
2bb2434e 649}
f61c548e 650
651//_____________________________________________________________________________________________________________________________
2bb2434e 652AliGammaConversionAODVector* AliGammaConversionAODBGHandler::GetBGGoodV0s(Int_t zbin, Int_t mbin, Int_t event){
f61c548e 653 //see headerfile for documentation
654 return &(fBGEvents[zbin][mbin][event]);
2bb2434e 655}
2bb2434e 656
f61c548e 657//_____________________________________________________________________________________________________________________________
658AliGammaConversionMotherAODVector* AliGammaConversionAODBGHandler::GetBGGoodMesons(Int_t zbin, Int_t mbin, Int_t event){
659 //see headerfile for documentation
660 return &(fBGEventsMeson[zbin][mbin][event]);
661}
2bb2434e 662
f61c548e 663//_____________________________________________________________________________________________________________________________
664AliGammaConversionAODVector* AliGammaConversionAODBGHandler::GetBGGoodENeg(Int_t event, Double_t zvalue, Int_t multiplicity){
665 //see headerfile for documentation
666 Int_t z = GetZBinIndex(zvalue);
667 Int_t m = GetMultiplicityBinIndex(multiplicity);
668 return &(fBGEventsENeg[z][m][event]);
2bb2434e 669}
f61c548e 670
671//_____________________________________________________________________________________________________________________________
2bb2434e 672void AliGammaConversionAODBGHandler::PrintBGArray(){
f61c548e 673 //see headerfile for documentation
674 for(Int_t z=0;z<fNBinsZ;z++){
675 if(z==2){
676 cout<<"Getting the data for z bin: "<<z<<endl;
677 for(Int_t multiplicity=0;multiplicity<fNBinsMultiplicity;multiplicity++){
678 if(multiplicity==2){
679 cout<<"Getting the data for multiplicity bin: "<<multiplicity<<endl;
680 for(Int_t event=0;event<fNEvents;event++){
681 if(fBGEvents[z][multiplicity][event].size()>0){
682 cout<<"Event: "<<event<<" has: "<<fBGEvents[z][multiplicity][event].size()<<endl;
683 }
684 }
685 }
686 }
687 }
688 }
2bb2434e 689}