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