AliPhysics  b752f14 (b752f14)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliGammaConversionAODBGHandler.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: Martin Wilde, Friederike Bock, Daniel Lohner, Svein Lindal *
5  * based on previous version by Kenneth Aamodt and Ana Marin *
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 
18 //---------------------------------------------
19 // Class for handling of background calculation
20 //---------------------------------------------
22 
24 #include "AliKFParticle.h"
25 #include "AliAODConversionPhoton.h"
26 #include "AliAODConversionMother.h"
27 
28 using namespace std;
29 
31 
32 //_____________________________________________________________________________________________________________________________
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()
48 {
49  // constructor
50 }
51 
52 //_____________________________________________________________________________________________________________________________
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)))
68 {
69  // constructor
70 }
71 
72 
73 //_____________________________________________________________________________________________________________________________
75  Int_t nEvents, Bool_t useTrackMult, Int_t mode, Int_t binsZ, Int_t binsMultiplicity) :
76  TObject(),
77  fNEvents(nEvents),
78  fBGEventCounter(NULL),
79  fBGEventENegCounter(NULL),
80  fBGEventMesonCounter(NULL),
81  fBGProbability(NULL),
82  fBGEventVertex(NULL),
83  fNBinsZ(binsZ),
84  fNBinsMultiplicity(binsMultiplicity),
85  fBinLimitsArrayZ(NULL),
86  fBinLimitsArrayMultiplicity(NULL),
87  fBGEvents(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
88  fBGEventsENeg(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
89  fBGEventsMeson(binsZ,AliGammaConversionMotherMultipicityVector(binsMultiplicity,AliGammaConversionMotherBGEventVector(nEvents)))
90 {
91  // constructor
92  if(fNBinsZ>8) fNBinsZ = 8;
94 
95  // Initializing z vertex bins
97  if(collisionSystem > 0 && collisionSystem < 8){ // PbPb
98  Double_t fBinLimitsArrayZPbPb[8] = {-50, -5.5, -2.9, -0.65,
99  1.45, 3.65, 6.15, 50};
100  for (Int_t i = 0; i < fNBinsZ; i++){
101  fBinLimitsArrayZ[i] = fBinLimitsArrayZPbPb[i];
102  }
103  } else if(collisionSystem == 0){ // pp
104  Double_t fBinLimitsArrayZpp[8] = {-50, -3.375, -1.605, -0.225,
105  1.065, 2.445, 4.245, 50};
106  for (Int_t i = 0; i < fNBinsZ; i++){
107  fBinLimitsArrayZ[i] = fBinLimitsArrayZpp[i];
108  }
109  } else { // pPb
110  Double_t fBinLimitsArrayZpPb[8] = {-50, -5.85, -3.35, -1.15,
111  0.85, 2.95, 5.55, 50};
112  for (Int_t i = 0; i < fNBinsZ; i++){
113  fBinLimitsArrayZ[i] = fBinLimitsArrayZpPb[i];
114  }
115  }
116 
117  // Initializing multiplicity bins
119  if(useTrackMult){ // multiplicity binning based on number of good global tracks
120  // default pp values
121  Double_t fBinLimitsArrayMultiplicitypp[5] = {0., 8.5, 16.5, 27.5, 200.};
122  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
123  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypp[i];
124  }
125  if(collisionSystem > 0 && collisionSystem < 8){ // PbPb values
126  if(centMin == 0 && centMax == 5){ // 0-5% central
127  Double_t fBinLimitsArrayMultiplicityPbPb0005[5] = {0., 1540., 1665., 1780., 5000};
128  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
129  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0005[i];
130  }
131  } else if(centMin == 0 && centMax == 10){ // 0-10% central
132  Double_t fBinLimitsArrayMultiplicityPbPb0010[5] = {0., 1360., 1520., 1685., 5000};
133  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
134  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0010[i];
135  }
136  } else if(centMin == 0 && centMax == 20){ // 0-20% central
137  Double_t fBinLimitsArrayMultiplicityPbPb0020[5] = {0., 1110., 1360., 1600., 5000};
138  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
139  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0020[i];
140  }
141  } else if(centMin == 0 && centMax == 80){ // 0-80% central
142  Double_t fBinLimitsArrayMultiplicityPbPb0080[5] = {0., 890., 1240., 1540., 5000};
143  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
144  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0080[i];
145  }
146  } else if(centMin == 5 && centMax == 10){ // 5-10% central
147  Double_t fBinLimitsArrayMultiplicityPbPb0510[5] = {0., 1250., 1345., 1445., 5000};
148  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
149  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0510[i];
150  }
151  } else if(centMin == 10 && centMax == 20){ // 10-20% central
152  Double_t fBinLimitsArrayMultiplicityPbPb1020[5] = {0., 915., 1020., 1130., 5000};
153  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
154  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb1020[i];
155  }
156  } else if(centMin == 20 && centMax == 40){ // 20-40% central
157  Double_t fBinLimitsArrayMultiplicityPbPb2040[5] = {0., 510., 625., 730., 5000};
158  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
159  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb2040[i];
160  }
161  } else if(centMin == 40 && centMax == 80){ // 40-80% central
162  Double_t fBinLimitsArrayMultiplicityPbPb4080[5] = {0., 185., 250., 300., 5000};
163  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
164  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb4080[i];
165  }
166  } else if(centMin == 60 && centMax == 80){ // 60-80% central
167  Double_t fBinLimitsArrayMultiplicityPbPb6080[5] = {0., 55., 80., 100., 5000};
168  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
169  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb6080[i];
170  }
171  } else { // all other centrality classes
172  Double_t fBinLimitsArrayMultiplicityPbPb[5] = {0., 510., 625., 730., 5000};
173  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
174  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb[i];
175  }
176  }
177  } else if(collisionSystem == 8 || collisionSystem == 9){ // pPb
178  Double_t fBinLimitsArrayMultiplicitypPb[5] = {0., 7.5, 16.5, 29.5, 500};
179  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
180  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb[i];
181  }
182  if(centMin == 0 && centMax == 20){ // pPb 0-20 %
183  Double_t fBinLimitsArrayMultiplicitypPb0020[5] = {0., 31.5, 40.5, 50.5, 500};
184  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
185  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb0020[i];
186  }
187  } else if(centMin == 20 && centMax == 40){
188  Double_t fBinLimitsArrayMultiplicitypPb2040[5] = {0., 19.5, 25.5, 32.5, 500};
189  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
190  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb2040[i];
191  }
192  } else if(centMin == 40 && centMax == 60){
193  Double_t fBinLimitsArrayMultiplicitypPb4060[5] = {0., 12.5, 16.5, 22.5, 500};
194  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
195  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb4060[i];
196  }
197  } else if(centMin == 60 && centMax == 80){
198  Double_t fBinLimitsArrayMultiplicitypPb6080[5] = {0., 5.5, 9.5, 13.5, 500};
199  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
200  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb6080[i];
201  }
202  } else if(centMin == 60 && centMax == 100){
203  Double_t fBinLimitsArrayMultiplicitypPb60100[5] = {0., 2.5, 6.5, 11.5, 500};
204  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
205  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb60100[i];
206  }
207  }
208  }
209  } else{ // Initializing Multiplicity binning with photon Mult
210  if (mode == 0 || mode == 1) { // settings for Conv-Conv && Conv-Dalitz
211  // pp & pPb defaults
212  Double_t fBinLimitsArrayMultiplicitypp[5] = {2., 3., 4., 5., 9999.};
213  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
214  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypp[i];
215  }
216  if(collisionSystem > 0 && collisionSystem < 8){ // settings PbPb
217  if(centMin == 0 && centMax == 5){ // 0-5%
218  Double_t fBinLimitsArrayMultiplicityPbPb0005[5] = {0., 27., 31., 36., 100.};
219  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
220  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0005[i];
221  }
222  } else if(centMin == 0 && centMax == 10){ // 0-10%
223  Double_t fBinLimitsArrayMultiplicityPbPb0010[5] = {0., 25., 30., 36., 100.};
224  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
225  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0010[i];
226  }
227  } else if(centMin == 0 && centMax == 20){ // 0-20%
228  Double_t fBinLimitsArrayMultiplicityPbPb0020[5] = {0., 22., 27., 33., 100.};
229  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
230  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0020[i];
231  }
232  } else if(centMin == 0 && centMax == 80){ // 0-80%
233  Double_t fBinLimitsArrayMultiplicityPbPb0080[5] = {0., 18., 25., 32., 100.};
234  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
235  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0080[i];
236  }
237  } else if(centMin == 5 && centMax == 10){ // 5-10%
238  Double_t fBinLimitsArrayMultiplicityPbPb0510[5] = {0., 23., 27., 32., 100.};
239  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
240  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0510[i];
241  }
242  } else if(centMin == 10 && centMax == 20){ //10-20%
243  Double_t fBinLimitsArrayMultiplicityPbPb1020[5] = {0., 18., 22., 27., 100.};
244  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
245  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb1020[i];
246  }
247  } else if(centMin == 20 && centMax == 40){ // 20-40%
248  Double_t fBinLimitsArrayMultiplicityPbPb2040[5] = {0., 11., 14., 18., 100.};
249  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
250  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb2040[i];
251  }
252  } else if(centMin == 40 && centMax == 80){ // 40-80%
253  Double_t fBinLimitsArrayMultiplicityPbPb4080[5] = {0., 5., 7., 11., 100.};
254  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
255  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb4080[i];
256  }
257  } else if(centMin == 60 && centMax == 80){ // 60-80%
258  Double_t fBinLimitsArrayMultiplicityPbPb6080[5] = {0., 2., 3., 5., 100.};
259  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
260  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb6080[i];
261  }
262  } else{ // default PbPb
263  Double_t fBinLimitsArrayMultiplicityPbPb[5] = {0., 11., 14., 18., 100.};
264  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
265  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb[i];
266  }
267  }
268  }
269  } else if (mode == 2 || mode == 3 || mode == 4 || mode == 5){ // setting for EMCAL-Conv, PHOS-Conv, EMCAL-EMCAL, PHOS-PHOS
270  if(collisionSystem > 0 && collisionSystem < 8){ // settings PbPb
271  if(centMin == 0 && centMax == 5){ // 0-5%
272  Double_t fBinLimitsArrayMultiplicityPbPb0005[5] = {0., 27., 31., 36., 100.};
273  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
274  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0005[i];
275  }
276  } else if(centMin == 0 && centMax == 10){ // 0-10%
277  Double_t fBinLimitsArrayMultiplicityPbPb0010[5] = {0., 25., 30., 36., 100.};
278  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
279  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0010[i];
280  }
281  } else if(centMin == 0 && centMax == 20){ // 0-20%
282  Double_t fBinLimitsArrayMultiplicityPbPb0020[5] = {0., 22., 27., 33., 100.};
283  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
284  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0020[i];
285  }
286  } else if(centMin == 0 && centMax == 80){ // 0-80%
287  Double_t fBinLimitsArrayMultiplicityPbPb0080[5] = {0., 18., 25., 32., 100.};
288  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
289  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0080[i];
290  }
291  } else if(centMin == 5 && centMax == 10){ // 5-10%
292  Double_t fBinLimitsArrayMultiplicityPbPb0510[5] = {0., 23., 27., 32., 100.};
293  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
294  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0510[i];
295  }
296  } else if(centMin == 10 && centMax == 20){ //10-20%
297  Double_t fBinLimitsArrayMultiplicityPbPb1020[5] = {0., 18., 22., 27., 100.};
298  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
299  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb1020[i];
300  }
301  } else if(centMin == 20 && centMax == 40){ // 20-40%
302  Double_t fBinLimitsArrayMultiplicityPbPb2040[5] = {0., 11., 14., 18., 100.};
303  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
304  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb2040[i];
305  }
306  } else if(centMin == 40 && centMax == 80){ // 40-80%
307  Double_t fBinLimitsArrayMultiplicityPbPb4080[5] = {0., 5., 7., 11., 100.};
308  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
309  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb4080[i];
310  }
311  } else if(centMin == 60 && centMax == 80){ // 60-80%
312  Double_t fBinLimitsArrayMultiplicityPbPb6080[5] = {0., 2., 3., 5., 100.};
313  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
314  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb6080[i];
315  }
316  } else{ // default PbPb
317  Double_t fBinLimitsArrayMultiplicityPbPb[5] = {0., 11., 14., 18., 100.};
318  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
319  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb[i];
320  }
321  }
322  }
323  else
324  {
325  //seperate settings for ConvCalo and CaloCalo for pp/pPb
326  if (mode == 2 || mode == 3){ //ConvCalo
327  Double_t fBinLimitsArrayMultiplicitypp_pPbConvCalo[5] = {1., 2., 3., 4., 9999};
328  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
329  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypp_pPbConvCalo[i];
330  }
331  }
332  else{ //CaloCalo
333  Double_t fBinLimitsArrayMultiplicitypp_pPbCaloCalo[5] = {2., 3., 4., 5., 9999};
334  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
335  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypp_pPbCaloCalo[i];
336  }
337  }
338  }
339  }
340  }
341 
343 }
344 
345 //_____________________________________________________________________________________________________________________________
347  TObject(original),
348  fNEvents(original.fNEvents),
349  fBGEventCounter(original.fBGEventCounter),
350  fBGEventENegCounter(original.fBGEventENegCounter),
351  fBGEventMesonCounter(original.fBGEventMesonCounter),
352  fBGProbability(original.fBGProbability),
353  fBGEventVertex(original.fBGEventVertex),
354  fNBinsZ(original.fNBinsZ),
355  fNBinsMultiplicity(original.fNBinsMultiplicity),
356  fBinLimitsArrayZ(original.fBinLimitsArrayZ),
357  fBinLimitsArrayMultiplicity(original.fBinLimitsArrayMultiplicity),
358  fBGEvents(original.fBGEvents),
359  fBGEventsENeg(original.fBGEventsENeg),
360  fBGEventsMeson(original.fBGEventsMeson)
361 {
362  //copy constructor
363 }
364 
365 //_____________________________________________________________________________________________________________________________
367 {
368  // assignment operator
369  return *this;
370 }
371 
372 //_____________________________________________________________________________________________________________________________
374 
375  if(fBGEventCounter){
376  for(Int_t z=0;z<fNBinsZ;z++){
377  delete[] fBGEventCounter[z];
378  }
379  delete[] fBGEventCounter;
380  fBGEventCounter = NULL;
381  }
382 
383  if(fBGEventVertex){
384  for(Int_t z=0;z<fNBinsZ;z++){
385  for(Int_t m=0;m<fNBinsMultiplicity;m++){
386  delete [] fBGEventVertex[z][m];
387  }
388  delete [] fBGEventVertex[z];
389  }
390  delete [] fBGEventVertex;
391  }
392 
394  for(Int_t z=0;z<fNBinsZ;z++){
395  delete[] fBGEventENegCounter[z];
396  }
397  delete[] fBGEventENegCounter;
398  fBGEventENegCounter = NULL;
399  }
400 
402  for(Int_t z=0;z<fNBinsZ;z++){
403  delete[] fBGEventMesonCounter[z];
404  }
405  delete[] fBGEventMesonCounter;
406  fBGEventMesonCounter = NULL;
407  }
408 
409  if(fBinLimitsArrayZ){
410  delete[] fBinLimitsArrayZ;
411  }
412 
415  }
416 }
417 
418 //_____________________________________________________________________________________________________________________________
419 void AliGammaConversionAODBGHandler::Initialize(Double_t * const zBinLimitsArray, Double_t * const multiplicityBinLimitsArray){
420  // see header file for documantation
421 
422  if(zBinLimitsArray){
423  fBinLimitsArrayZ = zBinLimitsArray;
424  }
425  else{
426  //Print warning
427  }
428 
429  if(multiplicityBinLimitsArray){
430  fBinLimitsArrayMultiplicity = multiplicityBinLimitsArray ;
431  }
432  else{
433  //Print warning
434  }
435  if(fBGEventCounter == NULL){
437  }
438  for(Int_t z=0;z<fNBinsZ;z++){
440  }
441 
442  for(Int_t z=0;z<fNBinsZ;z++){
443  for(Int_t m=0;m<fNBinsMultiplicity;m++){
444  fBGEventCounter[z][m]=0;
445  }
446  }
447 
448  if(fBGEventMesonCounter == NULL){
450  }
451  for(Int_t z=0;z<fNBinsZ;z++){
453  }
454 
455  for(Int_t z=0;z<fNBinsZ;z++){
456  for(Int_t m=0;m<fNBinsMultiplicity;m++){
457  fBGEventMesonCounter[z][m]=0;
458  }
459  }
460 
461 
462  if(fBGEventVertex == NULL){
464  }
465  for(Int_t z=0; z < fNBinsZ; z++){
467  }
468  for(Int_t z=0;z<fNBinsZ;z++){
469  for(Int_t m=0;m<fNBinsMultiplicity; m++){
471  }
472  }
473  if( fBGEventENegCounter == NULL){
475  }
476 
477  for(Int_t z=0; z < fNBinsZ; z++){
479  }
480 
481  for(Int_t z=0;z<fNBinsZ;z++){
482  for(Int_t m=0;m<fNBinsMultiplicity; m++){
483  fBGEventENegCounter[z][m] = 0;
484  }
485  }
486 
487  if(fBGProbability == NULL){
489  }
490  for(Int_t z=0; z < fNBinsZ; z++){
492  }
493 
494  for(Int_t z=0;z<fNBinsZ;z++){
495  for(Int_t m=0;m<fNBinsMultiplicity; m++){
496  fBGProbability[z][m] = 0;
497  }
498  }
499  //filling the probability
500  fBGProbability[0][0] = 0.243594;
501  fBGProbability[0][1] = 0.279477;
502  fBGProbability[0][2] = 0.305104;
503  fBGProbability[0][3] = 0.315927;
504  fBGProbability[1][0] = 0.241964;
505  fBGProbability[1][1] = 0.272995;
506  fBGProbability[1][2] = 0.307165;
507  fBGProbability[1][3] = 0.292248;
508  fBGProbability[2][0] = 0.241059;
509  fBGProbability[2][1] = 0.27509;
510  fBGProbability[2][2] = 0.283657;
511  fBGProbability[2][3] = 0.310512;
512  fBGProbability[3][0] = 0.23888;
513  fBGProbability[3][1] = 0.283418;
514  fBGProbability[3][2] = 0.297232;
515  fBGProbability[3][3] = 0.348188;
516  fBGProbability[4][0] = 0.245555;
517  fBGProbability[4][1] = 0.281218;
518  fBGProbability[4][2] = 0.317236;
519  fBGProbability[4][3] = 0.323495;
520  fBGProbability[5][0] = 0.244572;
521  fBGProbability[5][1] = 0.259498;
522  fBGProbability[5][2] = 0.278383;
523  fBGProbability[5][3] = 0.284696;
524  fBGProbability[6][0] = 0.24703;
525  fBGProbability[6][1] = 0.275265;
526  fBGProbability[6][2] = 0.284004;
527  fBGProbability[6][3] = 0.343584;
528 
529 }
530 
531 //_____________________________________________________________________________________________________________________________
533  // see header file for documantation
534  if(fNBinsZ<2 || zvalue<=fBinLimitsArrayZ[0]){
535  return 0;
536  }
537 
538  for(Int_t i=0; i<fNBinsZ-1 ;i++){
539  if(zvalue >= fBinLimitsArrayZ[i] && zvalue <= fBinLimitsArrayZ[i+1]){
540  return i;
541  }
542  }
543  return fNBinsZ-1;
544 }
545 
546 //_____________________________________________________________________________________________________________________________
548  // see header file for documantation
549  if(fNBinsMultiplicity<2){
550  return 0;
551  }
552 
553  for(Int_t i=0; i<fNBinsMultiplicity-1 ;i++){
554  if(multiplicity >= fBinLimitsArrayMultiplicity[i] && multiplicity < fBinLimitsArrayMultiplicity[i+1]){
555  return i;
556  }
557  }
558  return fNBinsMultiplicity-1;
559 }
560 
561 //_____________________________________________________________________________________________________________________________
562 void AliGammaConversionAODBGHandler::AddEvent(TList* const eventGammas,Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
563 
564  // see header file for documantation
565 
566  // cout<<"Entering the AddEvent function"<<endl;
567 
568  Int_t z = GetZBinIndex(zvalue);
569  Int_t m = GetMultiplicityBinIndex(multiplicity);
570 
571  if(fBGEventCounter[z][m] >= fNEvents){
572  fBGEventCounter[z][m]=0;
573  }
574  Int_t eventCounter=fBGEventCounter[z][m];
575 
576  /*
577  if(fBGEventVertex[z][m][eventCounter]){
578  delete fBGEventVertex[z][m][eventCounter];
579  }
580  */
581  fBGEventVertex[z][m][eventCounter].fX = xvalue;
582  fBGEventVertex[z][m][eventCounter].fY = yvalue;
583  fBGEventVertex[z][m][eventCounter].fZ = zvalue;
584  fBGEventVertex[z][m][eventCounter].fEP = epvalue;
585 
586  //first clear the vector
587  // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
588  // cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
589 
590  // cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
591  for(Int_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
592  delete (AliAODConversionPhoton*)(fBGEvents[z][m][eventCounter][d]);
593  }
594  fBGEvents[z][m][eventCounter].clear();
595 
596  // add the gammas to the vector
597  for(Int_t i=0; i< eventGammas->GetEntries();i++){
598  // AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
599  fBGEvents[z][m][eventCounter].push_back(new AliAODConversionPhoton(*(AliAODConversionPhoton*)(eventGammas->At(i))));
600  }
601  fBGEventCounter[z][m]++;
602 }
603 
604 //_____________________________________________________________________________________________________________________________
605 void AliGammaConversionAODBGHandler::AddMesonEvent(TList* const eventMothers, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
606 
607  // see header file for documantation
608  // cout<<"Entering the AddEvent function"<<endl;
609  Int_t z = GetZBinIndex(zvalue);
610  Int_t m = GetMultiplicityBinIndex(multiplicity);
611 
612  if(fBGEventMesonCounter[z][m] >= fNEvents){
613  fBGEventMesonCounter[z][m]=0;
614  }
615  Int_t eventCounter=fBGEventMesonCounter[z][m];
616 
617  fBGEventVertex[z][m][eventCounter].fX = xvalue;
618  fBGEventVertex[z][m][eventCounter].fY = yvalue;
619  fBGEventVertex[z][m][eventCounter].fZ = zvalue;
620  fBGEventVertex[z][m][eventCounter].fEP = epvalue;
621 
622  //first clear the vector
623  for(Int_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
624  delete (AliAODConversionMother*)(fBGEventsMeson[z][m][eventCounter][d]);
625  }
626  fBGEventsMeson[z][m][eventCounter].clear();
627 
628  // add the gammas to the vector
629  for(Int_t i=0; i< eventMothers->GetEntries();i++){
630  fBGEventsMeson[z][m][eventCounter].push_back(new AliAODConversionMother(*(AliAODConversionMother*)(eventMothers->At(i))));
631  }
632  fBGEventMesonCounter[z][m]++;
633 }
634 
635 void AliGammaConversionAODBGHandler::AddMesonEvent(const std::vector<AliAODConversionMother> &eventMother, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
636  Int_t z = GetZBinIndex(zvalue);
637  Int_t m = GetMultiplicityBinIndex(multiplicity);
638 
639  if(fBGEventMesonCounter[z][m] >= fNEvents){
640  fBGEventMesonCounter[z][m]=0;
641  }
642  Int_t eventCounter=fBGEventMesonCounter[z][m];
643 
644  fBGEventVertex[z][m][eventCounter].fX = xvalue;
645  fBGEventVertex[z][m][eventCounter].fY = yvalue;
646  fBGEventVertex[z][m][eventCounter].fZ = zvalue;
647  fBGEventVertex[z][m][eventCounter].fEP = epvalue;
648 
649  //first clear the vector
650  for(Int_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
651  delete (AliAODConversionMother*)(fBGEventsMeson[z][m][eventCounter][d]);
652  }
653  fBGEventsMeson[z][m][eventCounter].clear();
654 
655  // add the gammas to the vector
656  for(const auto &mother : eventMother){
657  fBGEventsMeson[z][m][eventCounter].push_back(new AliAODConversionMother(mother));
658  }
659  fBGEventMesonCounter[z][m]++;
660 }
661 
662 //_____________________________________________________________________________________________________________________________
663 void AliGammaConversionAODBGHandler::AddElectronEvent(TClonesArray* const eventENeg, Double_t zvalue, Int_t multiplicity){
664 
665  Int_t z = GetZBinIndex(zvalue);
666  Int_t m = GetMultiplicityBinIndex(multiplicity);
667 
668  if(fBGEventENegCounter[z][m] >= fNEvents){
669  fBGEventENegCounter[z][m]=0;
670  }
671  Int_t eventENegCounter=fBGEventENegCounter[z][m];
672 
673  //first clear the vector
674  // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
675  // cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
676 
677  // cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
678  for(Int_t d=0;d<fBGEventsENeg[z][m][eventENegCounter].size();d++){
679  delete (AliAODConversionPhoton*)(fBGEventsENeg[z][m][eventENegCounter][d]);
680  }
681 
682  fBGEventsENeg[z][m][eventENegCounter].clear();
683 
684  // add the electron to the vector
685  for(Int_t i=0; i< eventENeg->GetEntriesFast();i++){
686  // AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
687  fBGEventsENeg[z][m][eventENegCounter].push_back(new AliAODConversionPhoton(*(AliAODConversionPhoton*)(eventENeg->At(i))));
688  }
689  fBGEventENegCounter[z][m]++;
690 }
691 
692 //_____________________________________________________________________________________________________________________________
694  //see headerfile for documentation
695  return &(fBGEvents[zbin][mbin][event]);
696 }
697 
698 //_____________________________________________________________________________________________________________________________
700  //see headerfile for documentation
701  return &(fBGEventsMeson[zbin][mbin][event]);
702 }
703 
704 //_____________________________________________________________________________________________________________________________
706  return fBGEventsMeson[binz][binMult].size();
707 }
708 
709 //_____________________________________________________________________________________________________________________________
711  //see headerfile for documentation
712  Int_t z = GetZBinIndex(zvalue);
713  Int_t m = GetMultiplicityBinIndex(multiplicity);
714  return &(fBGEventsENeg[z][m][event]);
715 }
716 
717 //_____________________________________________________________________________________________________________________________
719  //see headerfile for documentation
720  for(Int_t z=0;z<fNBinsZ;z++){
721  if(z==2){
722  cout<<"Getting the data for z bin: "<<z<<endl;
723  for(Int_t multiplicity=0;multiplicity<fNBinsMultiplicity;multiplicity++){
724  if(multiplicity==2){
725  cout<<"Getting the data for multiplicity bin: "<<multiplicity<<endl;
726  for(Int_t event=0;event<fNEvents;event++){
727  if(fBGEvents[z][multiplicity][event].size()>0){
728  cout<<"Event: "<<event<<" has: "<<fBGEvents[z][multiplicity][event].size()<<endl;
729  }
730  }
731  }
732  }
733  }
734  }
735 }
ClassImp(AliGammaConversionAODBGHandler) AliGammaConversionAODBGHandler
double Double_t
Definition: External.C:58
std::vector< AliGammaConversionBGEventVector > AliGammaConversionMultipicityVector
Int_t GetNBackgroundEventsInBuffer(Int_t binz, int binMult) const
GammaConversionVertex *** fBGEventVertex
prob per bin
void AddMesonEvent(TList *const eventMothers, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue=-100)
AliGammaConversionAODVector * GetBGGoodENeg(Int_t event, Double_t zvalue, Int_t multiplicity)
AliGammaConversionBGVector fBGEvents
bin limit multiplicity array
std::vector< AliGammaConversionMotherBGEventVector > AliGammaConversionMotherMultipicityVector
AliGammaConversionAODBGHandler & operator=(const AliGammaConversionAODBGHandler &g)
std::vector< AliAODConversionPhoton * > AliGammaConversionAODVector
int Int_t
Definition: External.C:63
void AddEvent(TList *const eventGammas, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue=-100)
std::vector< AliAODConversionMother * > AliGammaConversionMotherAODVector
void AddElectronEvent(TClonesArray *const eventENeg, Double_t zvalue, Int_t multiplicity)
void Initialize(Double_t *const zBinLimitsArray, Double_t *const multiplicityBinLimitsArray)
std::vector< AliGammaConversionMotherAODVector > AliGammaConversionMotherBGEventVector
Int_t mode
Definition: anaM.C:41
Double_t centMax
Int_t ** fBGEventMesonCounter
bg electron counter
AliGammaConversionAODVector * GetBGGoodV0s(Int_t zbin, Int_t mbin, Int_t event)
Double_t * fBinLimitsArrayMultiplicity
bin limits z array
AliGammaConversionMotherAODVector * GetBGGoodMesons(Int_t zbin, Int_t mbin, Int_t event)
Float_t nEvents[nProd]
Input train file.
std::vector< AliGammaConversionAODVector > AliGammaConversionBGEventVector
bool Bool_t
Definition: External.C:53
Double_t centMin
AliGammaConversionMotherBGVector fBGEventsMeson