AliPhysics  master (3d17d9d)
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  fBGMCParticleEventCounter(NULL),
40  fBGEventBufferCounter(NULL),
41  fBGProbability(NULL),
42  fBGEventVertex(NULL),
43  fNBinsZ(0),
44  fNBinsMultiplicity(0),
45  fBinLimitsArrayZ(NULL),
46  fBinLimitsArrayMultiplicity(NULL),
47  fBGEvents(),
48  fBGEventsENeg(),
49  fBGEventsMeson(),
50  fBGEventsMCParticle()
51 {
52  // constructor
53 }
54 
55 //_____________________________________________________________________________________________________________________________
57  TObject(),
58  fNEvents(nEvents),
59  fBGEventCounter(NULL),
60  fBGEventENegCounter(NULL),
61  fBGEventMesonCounter(NULL),
62  fBGMCParticleEventCounter(NULL),
63  fBGEventBufferCounter(NULL),
64  fBGProbability(NULL),
65  fBGEventVertex(NULL),
66  fNBinsZ(binsZ),
67  fNBinsMultiplicity(binsMultiplicity),
68  fBinLimitsArrayZ(NULL),
69  fBinLimitsArrayMultiplicity(NULL),
70  fBGEvents(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
71  fBGEventsENeg(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))),
72  fBGEventsMeson(binsZ,AliGammaConversionMotherMultipicityVector(binsMultiplicity,AliGammaConversionMotherBGEventVector(nEvents))),
73  fBGEventsMCParticle(binsZ,AliGammaMCParticleMultipicityVector(binsMultiplicity,AliGammaMCParticleBGEventVector(nEvents)))
74 {
75  // constructor
76 }
77 
78 
79 //_____________________________________________________________________________________________________________________________
81  Int_t nEvents, Bool_t useTrackMult, Int_t mode, Int_t binsZ, Int_t binsMultiplicity) :
82  TObject(),
83  fNEvents(nEvents),
84  fBGEventCounter(NULL),
85  fBGEventENegCounter(NULL),
89  fBGProbability(NULL),
90  fBGEventVertex(NULL),
91  fNBinsZ(binsZ),
92  fNBinsMultiplicity(binsMultiplicity),
93  fBinLimitsArrayZ(NULL),
99 {
100  // constructor
102 
103  // Initializing z vertex bins
105  if(fNBinsZ==9){
106  Double_t fBinLimitsArraySector[9] = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5};
107  for (Int_t i = 0; i < fNBinsZ; i++){
108  fBinLimitsArrayZ[i] = fBinLimitsArraySector[i];
109  }
110  } else {
111  if(collisionSystem > 0 && collisionSystem < 8){ // PbPb
112  Double_t fBinLimitsArrayZPbPb[8] = {-50, -5.5, -2.9, -0.65, 1.45, 3.65, 6.15, 50};
113  for (Int_t i = 0; i < fNBinsZ; i++){
114  fBinLimitsArrayZ[i] = fBinLimitsArrayZPbPb[i];
115  }
116  } else if(collisionSystem == 0){ // pp
117  Double_t fBinLimitsArrayZpp[8] = {-50, -3.375, -1.605, -0.225, 1.065, 2.445, 4.245, 50};
118  for (Int_t i = 0; i < fNBinsZ; i++){
119  fBinLimitsArrayZ[i] = fBinLimitsArrayZpp[i];
120  }
121  } else { // pPb
122  Double_t fBinLimitsArrayZpPb[8] = {-50, -5.85, -3.35, -1.15, 0.85, 2.95, 5.55, 50};
123  for (Int_t i = 0; i < fNBinsZ; i++){
124  fBinLimitsArrayZ[i] = fBinLimitsArrayZpPb[i];
125  }
126  }
127  }
128 
129  // Initializing multiplicity bins
131  if(useTrackMult){ // multiplicity binning based on number of good global tracks
132  // default pp values
133  Double_t fBinLimitsArrayMultiplicitypp[5] = {0., 8.5, 16.5, 27.5, 200.};
134  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
135  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypp[i];
136  }
137  if(collisionSystem > 0 && collisionSystem < 8){ // PbPb values
138  if(centMin == 0 && centMax == 5){ // 0-5% central
139  Double_t fBinLimitsArrayMultiplicityPbPb0005[5] = {0., 1540., 1665., 1780., 5000};
140  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
141  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0005[i];
142  }
143  } else if(centMin == 0 && centMax == 10){ // 0-10% central
144  Double_t fBinLimitsArrayMultiplicityPbPb0010[5] = {0., 1360., 1520., 1685., 5000};
145  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
146  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0010[i];
147  }
148  } else if(centMin == 0 && centMax == 20){ // 0-20% central
149  Double_t fBinLimitsArrayMultiplicityPbPb0020[5] = {0., 1110., 1360., 1600., 5000};
150  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
151  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0020[i];
152  }
153  } else if(centMin == 0 && centMax == 80){ // 0-80% central
154  Double_t fBinLimitsArrayMultiplicityPbPb0080[5] = {0., 890., 1240., 1540., 5000};
155  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
156  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0080[i];
157  }
158  } else if(centMin == 5 && centMax == 10){ // 5-10% central
159  Double_t fBinLimitsArrayMultiplicityPbPb0510[5] = {0., 1250., 1345., 1445., 5000};
160  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
161  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0510[i];
162  }
163  } else if(centMin == 10 && centMax == 20){ // 10-20% central
164  Double_t fBinLimitsArrayMultiplicityPbPb1020[5] = {0., 915., 1020., 1130., 5000};
165  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
166  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb1020[i];
167  }
168  } else if(centMin == 20 && centMax == 40){ // 20-40% central
169  Double_t fBinLimitsArrayMultiplicityPbPb2040[5] = {0., 510., 625., 730., 5000};
170  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
171  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb2040[i];
172  }
173  } else if(centMin == 40 && centMax == 80){ // 40-80% central
174  Double_t fBinLimitsArrayMultiplicityPbPb4080[5] = {0., 185., 250., 300., 5000};
175  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
176  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb4080[i];
177  }
178  } else if(centMin == 60 && centMax == 80){ // 60-80% central
179  Double_t fBinLimitsArrayMultiplicityPbPb6080[5] = {0., 55., 80., 100., 5000};
180  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
181  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb6080[i];
182  }
183  } else { // all other centrality classes
184  Double_t fBinLimitsArrayMultiplicityPbPb[5] = {0., 510., 625., 730., 5000};
185  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
186  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb[i];
187  }
188  }
189  } else if(collisionSystem == 8 || collisionSystem == 9){ // pPb
190  Double_t fBinLimitsArrayMultiplicitypPb[5] = {0., 7.5, 16.5, 29.5, 500};
191  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
192  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb[i];
193  }
194  if(centMin == 0 && centMax == 20){ // pPb 0-20 %
195  Double_t fBinLimitsArrayMultiplicitypPb0020[5] = {0., 31.5, 40.5, 50.5, 500};
196  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
197  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb0020[i];
198  }
199  } else if(centMin == 20 && centMax == 40){
200  Double_t fBinLimitsArrayMultiplicitypPb2040[5] = {0., 19.5, 25.5, 32.5, 500};
201  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
202  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb2040[i];
203  }
204  } else if(centMin == 40 && centMax == 60){
205  Double_t fBinLimitsArrayMultiplicitypPb4060[5] = {0., 12.5, 16.5, 22.5, 500};
206  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
207  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb4060[i];
208  }
209  } else if(centMin == 60 && centMax == 80){
210  Double_t fBinLimitsArrayMultiplicitypPb6080[5] = {0., 5.5, 9.5, 13.5, 500};
211  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
212  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb6080[i];
213  }
214  } else if(centMin == 60 && centMax == 100){
215  Double_t fBinLimitsArrayMultiplicitypPb60100[5] = {0., 2.5, 6.5, 11.5, 500};
216  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
217  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypPb60100[i];
218  }
219  }
220  }
221  } else{ // Initializing Multiplicity binning with photon Mult
222  if (mode == 0 || mode == 1 || mode == 2 || mode == 3) { // settings for PCM-PCM, PCM-Dalitz PCM-EMC, PCM-PHOS
223  if(collisionSystem > 0 && collisionSystem < 8){ // settings PbPb
224  if(centMin == 0 && centMax == 5){ // 0-5%
225  Double_t fBinLimitsArrayMultiplicityPbPb0005[5] = {1., 60., 75., 90., 200.};
226  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
227  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0005[i];
228  }
229  } else if(centMin == 5 && centMax == 10){ // 5-10%
230  Double_t fBinLimitsArrayMultiplicityPbPb0510[5] = {1., 45., 58., 75., 200.};
231  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
232  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0510[i];
233  }
234  } else if(centMin == 0 && centMax == 10){ // 0-10%
235  Double_t fBinLimitsArrayMultiplicityPbPb0010[5] = {1., 50., 65., 90., 200.};
236  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
237  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0010[i];
238  }
239  } else if(centMin == 10 && centMax == 20){ //10-20%
240  Double_t fBinLimitsArrayMultiplicityPbPb1020[5] = {1., 30., 40., 60., 200.};
241  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
242  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb1020[i];
243  }
244  } else if(centMin == 0 && centMax == 20){ // 0-20%
245  Double_t fBinLimitsArrayMultiplicityPbPb0020[5] = {1., 30., 50., 70., 200.};
246  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
247  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0020[i];
248  }
249  } else if(centMin == 20 && centMax == 40){ // 20-40%
250  Double_t fBinLimitsArrayMultiplicityPbPb2040[5] = {1., 12., 20., 30., 200.};
251  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
252  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb2040[i];
253  }
254  } else if(centMin == 30 && centMax == 50){ // 30-50%
255  Double_t fBinLimitsArrayMultiplicityPbPb2040[5] = {1., 5., 11., 17., 200.};
256  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
257  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb2040[i];
258  }
259  } else if(centMin == 40 && centMax == 60){ // 40-60%
260  Double_t fBinLimitsArrayMultiplicityPbPb4060[5] = {1., 4., 7., 13., 200.};
261  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
262  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb4060[i];
263  }
264  } else if(centMin == 60 && centMax == 80){ // 60-80%
265  Double_t fBinLimitsArrayMultiplicityPbPb6080[5] = {1., 3., 4., 5., 200.};
266  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
267  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb6080[i];
268  }
269  } else if(centMin == 40 && centMax == 80){ // 40-80%
270  Double_t fBinLimitsArrayMultiplicityPbPb4080[5] = {1., 3., 4., 9., 200.};
271  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
272  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb4080[i];
273  }
274  } else if(centMin == 0 && (centMax == 80 || centMax == 90)){ // 0-80%
275  Double_t fBinLimitsArrayMultiplicityPbPb0080[5] = {1., 5., 20., 60., 200.};
276  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
277  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0080[i];
278  }
279  } else if(centMin == 20 && centMax == 50){ // 20-50%
280  Double_t fBinLimitsArrayMultiplicityPbPb2050[5] = {1., 8., 18., 30., 200.};
281  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
282  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb2050[i];
283  }
284  } else{ // default PbPb
285  Double_t fBinLimitsArrayMultiplicityPbPb[5] = {1., 5., 20., 60., 200.};
286  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
287  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb[i];
288  }
289  }
290  } else {
291  // pp & pPb defaults
292  if (mode == 0 || mode == 1){
293  Double_t fBinLimitsArrayMultiplicitypp[5] = {2., 3., 4., 5., 9999.};
294  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
295  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypp[i];
296  }
297  } else {
298  Double_t fBinLimitsArrayMultiplicitypp_pPbConvCalo[5] = {1., 2., 3., 4., 9999};
299  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
300  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypp_pPbConvCalo[i];
301  }
302  }
303  }
304  } else if (mode == 4 || mode == 5){ // setting for EMC, PHOS
305  if(collisionSystem > 0 && collisionSystem < 8){ // settings PbPb
306  if(centMin == 0 && centMax == 5){ // 0-5%
307  Double_t fBinLimitsArrayMultiplicityPbPb0005[5] = {2., 15., 22., 30., 200.};
308  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
309  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0005[i];
310  }
311  } else if(centMin == 5 && centMax == 10){ // 5-10%
312  Double_t fBinLimitsArrayMultiplicityPbPb0510[5] = {2., 13., 17., 25., 200.};
313  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
314  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0510[i];
315  }
316  } else if(centMin == 0 && centMax == 10){ // 0-10%
317  Double_t fBinLimitsArrayMultiplicityPbPb0010[5] = {2., 15., 21., 27., 200.};
318  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
319  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0010[i];
320  }
321  } else if(centMin == 10 && centMax == 20){ //10-20%
322  Double_t fBinLimitsArrayMultiplicityPbPb1020[5] = {2., 8., 13., 19., 200.};
323  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
324  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb1020[i];
325  }
326  } else if(centMin == 0 && centMax == 20){ // 0-20%
327  Double_t fBinLimitsArrayMultiplicityPbPb0020[5] = {2., 11., 17., 24., 200.};
328  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
329  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0020[i];
330  }
331  } else if(centMin == 20 && centMax == 40){ // 20-40%
332  Double_t fBinLimitsArrayMultiplicityPbPb2040[5] = {2., 6., 11., 18., 200.};
333  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
334  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb2040[i];
335  }
336  } else if(centMin == 30 && centMax == 50){ // 30-50%
337  Double_t fBinLimitsArrayMultiplicityPbPb2040[5] = {2., 6., 11., 20., 200.};
338  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
339  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb2040[i];
340  }
341  } else if(centMin == 40 && centMax == 60){ // 40-60%
342  Double_t fBinLimitsArrayMultiplicityPbPb4060[5] = {2., 3., 4., 7., 200.};
343  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
344  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb4060[i];
345  }
346  } else if(centMin == 60 && centMax == 80){ // 60-80%
347  Double_t fBinLimitsArrayMultiplicityPbPb6080[5] = {2., 3., 4., 6., 200.};
348  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
349  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb6080[i];
350  }
351  } else if(centMin == 40 && centMax == 80){ // 40-80%
352  Double_t fBinLimitsArrayMultiplicityPbPb4080[5] = {2., 3., 4., 7., 200.};
353  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
354  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb4080[i];
355  }
356  } else if(centMin == 0 && (centMax == 80 || centMax == 90)){ // 0-80%
357  Double_t fBinLimitsArrayMultiplicityPbPb0080[5] = {2., 4., 10., 30., 200.};
358  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
359  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb0080[i];
360  }
361  } else if(centMin == 20 && centMax == 50){ // 20-50%
362  Double_t fBinLimitsArrayMultiplicityPbPb2050[5] = {2., 4., 7., 15., 200.};
363  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
364  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb2050[i];
365  }
366  } else{ // default PbPb
367  Double_t fBinLimitsArrayMultiplicityPbPb[5] = {2., 4., 10., 30., 200.};
368  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
369  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicityPbPb[i];
370  }
371  }
372  } else {
373  //seperate settings for pp/pPb
374  Double_t fBinLimitsArrayMultiplicitypp_pPbCaloCalo[5] = {2., 3., 4., 5., 9999};
375  for (Int_t i = 0; i < fNBinsMultiplicity; i++){
376  fBinLimitsArrayMultiplicity[i] = fBinLimitsArrayMultiplicitypp_pPbCaloCalo[i];
377  }
378  }
379  }
380  }
381 
383 }
384 
385 //_____________________________________________________________________________________________________________________________
387  TObject(original),
388  fNEvents(original.fNEvents),
394  fBGProbability(original.fBGProbability),
395  fBGEventVertex(original.fBGEventVertex),
396  fNBinsZ(original.fNBinsZ),
400  fBGEvents(original.fBGEvents),
401  fBGEventsENeg(original.fBGEventsENeg),
402  fBGEventsMeson(original.fBGEventsMeson),
404 {
405  //copy constructor
406 }
407 
408 //_____________________________________________________________________________________________________________________________
410 {
411  // assignment operator
412  return *this;
413 }
414 
415 //_____________________________________________________________________________________________________________________________
417 
418  if(fBGEventCounter){
419  for(Int_t z=0;z<fNBinsZ;z++){
420  delete[] fBGEventCounter[z];
421  }
422  delete[] fBGEventCounter;
423  fBGEventCounter = NULL;
424  }
425 
426  if(fBGEventVertex){
427  for(Int_t z=0;z<fNBinsZ;z++){
428  for(Int_t m=0;m<fNBinsMultiplicity;m++){
429  delete [] fBGEventVertex[z][m];
430  }
431  delete [] fBGEventVertex[z];
432  }
433  delete [] fBGEventVertex;
434  }
435 
437  for(Int_t z=0;z<fNBinsZ;z++){
438  delete[] fBGEventENegCounter[z];
439  }
440  delete[] fBGEventENegCounter;
441  fBGEventENegCounter = NULL;
442  }
443 
445  for(Int_t z=0;z<fNBinsZ;z++){
446  delete[] fBGEventMesonCounter[z];
447  }
448  delete[] fBGEventMesonCounter;
449  fBGEventMesonCounter = NULL;
450  }
451 
453  for(Int_t z=0;z<fNBinsZ;z++){
454  delete[] fBGMCParticleEventCounter[z];
455  }
456  delete[] fBGMCParticleEventCounter;
458  }
459 
461  for(Int_t z=0;z<fNBinsZ;z++){
462  delete[] fBGEventBufferCounter[z];
463  }
464  delete[] fBGEventMesonCounter;
465  fBGEventMesonCounter = NULL;
466  }
467 
468  if(fBinLimitsArrayZ){
469  delete[] fBinLimitsArrayZ;
470  }
471 
474  }
475 }
476 
477 //_____________________________________________________________________________________________________________________________
478 void AliGammaConversionAODBGHandler::Initialize(Double_t * const zBinLimitsArray, Double_t * const multiplicityBinLimitsArray){
479  // see header file for documantation
480 
481  if(zBinLimitsArray){
482  fBinLimitsArrayZ = zBinLimitsArray;
483  }
484  else{
485  //Print warning
486  }
487 
488  if(multiplicityBinLimitsArray){
489  fBinLimitsArrayMultiplicity = multiplicityBinLimitsArray ;
490  }
491  else{
492  //Print warning
493  }
494  if(fBGEventCounter == NULL){
496  }
497  for(Int_t z=0;z<fNBinsZ;z++){
499  }
500 
501  for(Int_t z=0;z<fNBinsZ;z++){
502  for(Int_t m=0;m<fNBinsMultiplicity;m++){
503  fBGEventCounter[z][m]=0;
504  }
505  }
506 
507  if(fBGEventMesonCounter == NULL){
509  }
510  for(Int_t z=0;z<fNBinsZ;z++){
512  }
513 
514 
515  if(fBGEventBufferCounter == NULL){
517  }
518  for(Int_t z=0;z<fNBinsZ;z++){
520  }
521 
522  for(Int_t z=0;z<fNBinsZ;z++){
523  for(Int_t m=0;m<fNBinsMultiplicity;m++){
524  fBGEventMesonCounter[z][m]=0;
525  fBGEventBufferCounter[z][m] =0;
526  }
527  }
528 
529 
530  if(fBGEventVertex == NULL){
532  }
533  for(Int_t z=0; z < fNBinsZ; z++){
535  }
536  for(Int_t z=0;z<fNBinsZ;z++){
537  for(Int_t m=0;m<fNBinsMultiplicity; m++){
539  }
540  }
541  if( fBGEventENegCounter == NULL){
543  }
544 
545  for(Int_t z=0; z < fNBinsZ; z++){
547  }
548 
549  for(Int_t z=0;z<fNBinsZ;z++){
550  for(Int_t m=0;m<fNBinsMultiplicity; m++){
551  fBGEventENegCounter[z][m] = 0;
552  }
553  }
554 
555  if( fBGMCParticleEventCounter == NULL){
557  }
558 
559  for(Int_t z=0; z < fNBinsZ; z++){
561  }
562 
563  for(Int_t z=0;z<fNBinsZ;z++){
564  for(Int_t m=0;m<fNBinsMultiplicity; m++){
565  fBGMCParticleEventCounter[z][m] = 0;
566  }
567  }
568 
569 
570  if(fBGProbability == NULL){
572  }
573  for(Int_t z=0; z < fNBinsZ; z++){
575  }
576  Double_t BGProbabilityLookup[7][4] =
577  {
578  {0.243594,0.279477,0.305104,0.315927},
579  {0.241964,0.272995,0.307165,0.292248},
580  {0.241059,0.27509,0.283657,0.310512},
581  {0.23888,0.283418,0.297232,0.348188},
582  {0.245555,0.281218,0.317236,0.323495},
583  {0.244572,0.259498,0.278383,0.284696},
584  {0.24703, 0.275265,0.284004,0.343584}
585  };
586  for(Int_t z=0;z<fNBinsZ;z++){
587  for(Int_t m=0;m<fNBinsMultiplicity; m++){
588  if((z<7)&&(m<4)){
589  fBGProbability[z][m] = BGProbabilityLookup[z][m];
590  }else{
591  fBGProbability[z][m] = 1;
592  }
593  }
594  }
595 
596 }
597 
598 //_____________________________________________________________________________________________________________________________
600  // see header file for documantation
601  if(fNBinsZ<2 || zvalue<=fBinLimitsArrayZ[0]){
602  return 0;
603  }
604 
605  for(Int_t i=0; i<fNBinsZ-1 ;i++){
606  if(zvalue >= fBinLimitsArrayZ[i] && zvalue <= fBinLimitsArrayZ[i+1]){
607  return i;
608  }
609  }
610  return fNBinsZ-1;
611 }
612 
613 //_____________________________________________________________________________________________________________________________
615  // see header file for documantation
616  if(fNBinsMultiplicity<2){
617  return 0;
618  }
619 
620  for(Int_t i=0; i<fNBinsMultiplicity-1 ;i++){
621  if(multiplicity >= fBinLimitsArrayMultiplicity[i] && multiplicity < fBinLimitsArrayMultiplicity[i+1]){
622  return i;
623  }
624  }
625  return fNBinsMultiplicity-1;
626 }
627 
628 //_____________________________________________________________________________________________________________________________
629 void AliGammaConversionAODBGHandler::AddEvent(TList* const eventGammas,Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
630 
631  // see header file for documantation
632 
633  // cout<<"Entering the AddEvent function"<<endl;
634 
635  Int_t z = GetZBinIndex(zvalue);
636  Int_t m = GetMultiplicityBinIndex(multiplicity);
637 
638  if(fBGEventCounter[z][m] >= fNEvents){
639  fBGEventCounter[z][m]=0;
640  }
641  Int_t eventCounter=fBGEventCounter[z][m];
642 
643  /*
644  if(fBGEventVertex[z][m][eventCounter]){
645  delete fBGEventVertex[z][m][eventCounter];
646  }
647  */
648  fBGEventVertex[z][m][eventCounter].fX = xvalue;
649  fBGEventVertex[z][m][eventCounter].fY = yvalue;
650  fBGEventVertex[z][m][eventCounter].fZ = zvalue;
651  fBGEventVertex[z][m][eventCounter].fEP = epvalue;
652 
653  //first clear the vector
654  // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
655  // cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
656 
657  // cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
658  for(UInt_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
659  delete (AliAODConversionPhoton*)(fBGEvents[z][m][eventCounter][d]);
660  }
661  fBGEvents[z][m][eventCounter].clear();
662 
663  // add the gammas to the vector
664  for(Int_t i=0; i< eventGammas->GetEntries();i++){
665  // AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
666  fBGEvents[z][m][eventCounter].push_back(new AliAODConversionPhoton(*(AliAODConversionPhoton*)(eventGammas->At(i))));
667  }
668  fBGEventCounter[z][m]++;
669 }
670 //_____________________________________________________________________________________________________________________________
671 void AliGammaConversionAODBGHandler::AddMesonEvent(TList* const eventMothers, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
672 
673  // see header file for documantation
674  // cout<<"Entering the AddEvent function"<<endl;
675  Int_t z = GetZBinIndex(zvalue);
676  Int_t m = GetMultiplicityBinIndex(multiplicity);
677 
678  if(fBGEventMesonCounter[z][m] >= fNEvents){
679  fBGEventMesonCounter[z][m]=0;
680  }
681 
682  Int_t eventCounter=fBGEventMesonCounter[z][m];
683 
684  fBGEventVertex[z][m][eventCounter].fX = xvalue;
685  fBGEventVertex[z][m][eventCounter].fY = yvalue;
686  fBGEventVertex[z][m][eventCounter].fZ = zvalue;
687  fBGEventVertex[z][m][eventCounter].fEP = epvalue;
688 
689  //first clear the vector
690  for(UInt_t d=0;d<fBGEventsMeson[z][m][eventCounter].size();d++){
691  delete (AliAODConversionMother*)(fBGEventsMeson[z][m][eventCounter][d]);
692  }
693  fBGEventsMeson[z][m][eventCounter].clear();
694 
695  // add the gammas to the vector
696  for(Int_t i=0; i< eventMothers->GetEntries();i++){
697  fBGEventsMeson[z][m][eventCounter].push_back(new AliAODConversionMother(*(AliAODConversionMother*)(eventMothers->At(i))));
698  }
699  fBGEventMesonCounter[z][m]++;
700 }
701 
702 void AliGammaConversionAODBGHandler::AddMesonEvent(const std::vector<AliAODConversionMother> &eventMother, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
703  Int_t z = GetZBinIndex(zvalue);
704  Int_t m = GetMultiplicityBinIndex(multiplicity);
705 
706  if(fBGEventMesonCounter[z][m] >= fNEvents){
707  fBGEventMesonCounter[z][m]=0;
708  }
709 
710  Int_t eventCounter=fBGEventMesonCounter[z][m];
711 
712  fBGEventVertex[z][m][eventCounter].fX = xvalue;
713  fBGEventVertex[z][m][eventCounter].fY = yvalue;
714  fBGEventVertex[z][m][eventCounter].fZ = zvalue;
715  fBGEventVertex[z][m][eventCounter].fEP = epvalue;
716 
717  //first clear the vector
718  for(UInt_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){
719  delete (AliAODConversionMother*)(fBGEventsMeson[z][m][eventCounter][d]);
720  }
721  fBGEventsMeson[z][m][eventCounter].clear();
722 
723  // add the gammas to the vector
724  for(const auto &mother : eventMother){
725  fBGEventsMeson[z][m][eventCounter].push_back(new AliAODConversionMother(mother));
726  }
727  fBGEventMesonCounter[z][m]++;
728 }
729 
730 //_____________________________________________________________________________________________________________________________
731 void AliGammaConversionAODBGHandler::AddElectronEvent(TClonesArray* const eventENeg, Double_t zvalue, Int_t multiplicity){
732 
733  Int_t z = GetZBinIndex(zvalue);
734  Int_t m = GetMultiplicityBinIndex(multiplicity);
735 
736  if(fBGEventENegCounter[z][m] >= fNEvents){
737  fBGEventENegCounter[z][m]=0;
738  }
739  Int_t eventENegCounter=fBGEventENegCounter[z][m];
740 
741  //first clear the vector
742  // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl;
743  // cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl;
744 
745  // cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl;
746  for(UInt_t d=0;d<fBGEventsENeg[z][m][eventENegCounter].size();d++){
747  delete (AliAODConversionPhoton*)(fBGEventsENeg[z][m][eventENegCounter][d]);
748  }
749 
750  fBGEventsENeg[z][m][eventENegCounter].clear();
751 
752  // add the electron to the vector
753  for(Int_t i=0; i< eventENeg->GetEntriesFast();i++){
754  // AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
755  fBGEventsENeg[z][m][eventENegCounter].push_back(new AliAODConversionPhoton(*(AliAODConversionPhoton*)(eventENeg->At(i))));
756  }
757  fBGEventENegCounter[z][m]++;
758 }
759 
760 //_____________________________________________________________________________________________________________________________
761 void AliGammaConversionAODBGHandler::AddMCParticleEvent(TList* const eventGammas,Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue){
762 
763  // see header file for documantation
764 
765  // cout<<"Entering the AddEvent function"<<endl;
766 
767  Int_t z = GetZBinIndex(zvalue);
768  Int_t m = GetMultiplicityBinIndex(multiplicity);
769 
770  if(fBGMCParticleEventCounter[z][m] >= fNEvents){
772  }
773  Int_t eventCounter=fBGMCParticleEventCounter[z][m];
774 
775  fBGEventVertex[z][m][eventCounter].fX = xvalue;
776  fBGEventVertex[z][m][eventCounter].fY = yvalue;
777  fBGEventVertex[z][m][eventCounter].fZ = zvalue;
778  fBGEventVertex[z][m][eventCounter].fEP = epvalue;
779 
780  for(UInt_t d=0;d<fBGEventsMCParticle[z][m][eventCounter].size();d++){
781  delete (AliAODMCParticle*)(fBGEventsMCParticle[z][m][eventCounter][d]);
782  }
783  fBGEventsMCParticle[z][m][eventCounter].clear();
784 
785  // add the gammas to the vector
786  for(Int_t i=0; i< eventGammas->GetEntries();i++){
787  // AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)));
788  fBGEventsMCParticle[z][m][eventCounter].push_back(new AliAODMCParticle(*(AliAODMCParticle*)(eventGammas->At(i))));
789  }
791 }
792 //_____________________________________________________________________________________________________________________________
794  //see headerfile for documentation
795  return &(fBGEvents[zbin][mbin][event]);
796 }
797 //_____________________________________________________________________________________________________________________________
799  //see headerfile for documentation
800  return &(fBGEventsMCParticle[zbin][mbin][event]);
801 }
802 
803 //_____________________________________________________________________________________________________________________________
805  //see headerfile for documentation
806  return &(fBGEventsMeson[zbin][mbin][event]);
807 }
808 
809 //_____________________________________________________________________________________________________________________________
811  return fBGEventBufferCounter[binz][binMult];
812 }
813 
814 //_____________________________________________________________________________________________________________________________
816  //see headerfile for documentation
817  Int_t z = GetZBinIndex(zvalue);
818  Int_t m = GetMultiplicityBinIndex(multiplicity);
819  return &(fBGEventsENeg[z][m][event]);
820 }
821 
822 //_____________________________________________________________________________________________________________________________
824  //see headerfile for documentation
825  for(Int_t z=0;z<fNBinsZ;z++){
826  if(z==2){
827  cout<<"Getting the data for z bin: "<<z<<endl;
828  for(Int_t multiplicity=0;multiplicity<fNBinsMultiplicity;multiplicity++){
829  if(multiplicity==2){
830  cout<<"Getting the data for multiplicity bin: "<<multiplicity<<endl;
831  for(Int_t event=0;event<fNEvents;event++){
832  if(fBGEvents[z][multiplicity][event].size()>0){
833  cout<<"Event: "<<event<<" has: "<<fBGEvents[z][multiplicity][event].size()<<endl;
834  }
835  }
836  }
837  }
838  }
839  }
840 }
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
unsigned int UInt_t
Definition: External.C:33
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)
AliAODMCParticleVector * GetBGGoodV0sMC(Int_t zbin, Int_t mbin, Int_t event)
void Initialize(Double_t *const zBinLimitsArray, Double_t *const multiplicityBinLimitsArray)
std::vector< AliGammaConversionMotherAODVector > AliGammaConversionMotherBGEventVector
std::vector< AliAODMCParticle * > AliAODMCParticleVector
Double_t nEvents
plot quality messages
Int_t mode
Definition: anaM.C:41
std::vector< AliGammaMCParticleBGEventVector > AliGammaMCParticleMultipicityVector
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)
std::vector< AliGammaConversionAODVector > AliGammaConversionBGEventVector
std::vector< AliAODMCParticleVector > AliGammaMCParticleBGEventVector
bool Bool_t
Definition: External.C:53
void AddMCParticleEvent(TList *const eventGammas, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue=-100)
Double_t centMin
AliGammaConversionMotherBGVector fBGEventsMeson