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