]>
Commit | Line | Data |
---|---|---|
5e55d806 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt * | |
5 | * Version 1.0 * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | //////////////////////////////////////////////// | |
17 | //--------------------------------------------- | |
18 | // Class for handling of background calculation | |
19 | //--------------------------------------------- | |
20 | //////////////////////////////////////////////// | |
21 | ||
22 | #include "AliGammaConversionBGHandler.h" | |
23 | #include "AliKFParticle.h" | |
24 | #include "AliAnalysisTaskGammaConversion.h" | |
25 | ||
26 | using namespace std; | |
27 | ||
28 | ClassImp(AliGammaConversionBGHandler) | |
29 | ||
30 | AliGammaConversionBGHandler::AliGammaConversionBGHandler() : | |
31 | TObject(), | |
32 | fNEvents(10), | |
33 | fBGEventCounter(NULL), | |
7f3c7cc6 | 34 | fBGEventENegCounter(NULL), |
111d75df | 35 | fBGProbability(NULL), |
5ce758b0 | 36 | fBGEventVertex(NULL), |
5e55d806 | 37 | fNBinsZ(0), |
38 | fNBinsMultiplicity(0), | |
39 | fBinLimitsArrayZ(NULL), | |
40 | fBinLimitsArrayMultiplicity(NULL), | |
7f3c7cc6 | 41 | fBGEvents(), |
42 | fBGEventsENeg() | |
5e55d806 | 43 | { |
44 | // constructor | |
45 | } | |
46 | ||
47 | AliGammaConversionBGHandler::AliGammaConversionBGHandler(UInt_t binsZ,UInt_t binsMultiplicity,UInt_t nEvents) : | |
48 | TObject(), | |
49 | fNEvents(nEvents), | |
50 | fBGEventCounter(NULL), | |
7f3c7cc6 | 51 | fBGEventENegCounter(NULL), |
111d75df | 52 | fBGProbability(NULL), |
5ce758b0 | 53 | fBGEventVertex(NULL), |
5e55d806 | 54 | fNBinsZ(binsZ), |
55 | fNBinsMultiplicity(binsMultiplicity), | |
56 | fBinLimitsArrayZ(NULL), | |
57 | fBinLimitsArrayMultiplicity(NULL), | |
7f3c7cc6 | 58 | fBGEvents(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))), |
59 | fBGEventsENeg(binsZ,AliGammaConversionMultipicityVector(binsMultiplicity,AliGammaConversionBGEventVector(nEvents))) | |
5e55d806 | 60 | { |
61 | // constructor | |
62 | } | |
63 | ||
64 | AliGammaConversionBGHandler::AliGammaConversionBGHandler(const AliGammaConversionBGHandler & original) : | |
65 | TObject(original), | |
66 | fNEvents(original.fNEvents), | |
67 | fBGEventCounter(original.fBGEventCounter), | |
7f3c7cc6 | 68 | fBGEventENegCounter(original.fBGEventENegCounter), |
111d75df | 69 | fBGProbability(original.fBGProbability), |
5ce758b0 | 70 | fBGEventVertex(original.fBGEventVertex), |
5e55d806 | 71 | fNBinsZ(original.fNBinsZ), |
72 | fNBinsMultiplicity(original.fNBinsMultiplicity), | |
73 | fBinLimitsArrayZ(original.fBinLimitsArrayZ), | |
74 | fBinLimitsArrayMultiplicity(original.fBinLimitsArrayMultiplicity), | |
7f3c7cc6 | 75 | fBGEvents(original.fBGEvents), |
76 | fBGEventsENeg(original.fBGEventsENeg) | |
5e55d806 | 77 | { |
78 | //copy constructor | |
79 | } | |
80 | ||
81 | AliGammaConversionBGHandler & AliGammaConversionBGHandler::operator = (const AliGammaConversionBGHandler & /*source*/) | |
82 | { | |
83 | // assignment operator | |
84 | return *this; | |
85 | } | |
86 | ||
87 | AliGammaConversionBGHandler::~AliGammaConversionBGHandler(){ | |
88 | ||
89 | //Kenneth remember to clear memory!!!!!!!!!!!!!!!!!!!!! | |
90 | if(fBGEventCounter){ | |
91 | for(Int_t z=0;z<fNBinsZ;z++){ | |
92 | delete[] fBGEventCounter[z]; | |
93 | } | |
94 | delete[] fBGEventCounter; | |
95 | fBGEventCounter = NULL; | |
96 | } | |
5ce758b0 | 97 | |
98 | if(fBGEventVertex){ | |
99 | for(Int_t z=0;z<fNBinsZ;z++){ | |
100 | for(Int_t m=0;m<fNBinsMultiplicity;m++){ | |
101 | delete [] fBGEventVertex[z][m]; | |
102 | } | |
103 | delete [] fBGEventVertex[z]; | |
104 | } | |
105 | delete [] fBGEventVertex; | |
106 | } | |
107 | ||
7f3c7cc6 | 108 | if(fBGEventENegCounter){ |
109 | for(Int_t z=0;z<fNBinsZ;z++){ | |
110 | delete[] fBGEventENegCounter[z]; | |
111 | } | |
112 | delete[] fBGEventENegCounter; | |
113 | fBGEventENegCounter = NULL; | |
114 | } | |
115 | ||
5e55d806 | 116 | if(fBinLimitsArrayZ){ |
117 | delete[] fBinLimitsArrayZ; | |
118 | } | |
119 | ||
120 | if(fBinLimitsArrayMultiplicity){ | |
121 | delete[] fBinLimitsArrayMultiplicity; | |
122 | } | |
123 | } | |
124 | ||
037dc2db | 125 | void AliGammaConversionBGHandler::Initialize(Double_t * const zBinLimitsArray, Double_t * const multiplicityBinLimitsArray){ |
5e55d806 | 126 | // see header file for documantation |
127 | ||
128 | if(zBinLimitsArray){ | |
129 | fBinLimitsArrayZ = zBinLimitsArray; | |
130 | } | |
131 | else{ | |
132 | //Print warning | |
133 | } | |
134 | ||
135 | if(multiplicityBinLimitsArray){ | |
136 | fBinLimitsArrayMultiplicity = multiplicityBinLimitsArray ; | |
137 | } | |
138 | else{ | |
139 | //Print warning | |
140 | } | |
63e16c52 | 141 | if(fBGEventCounter == NULL){ |
142 | fBGEventCounter= new Int_t*[fNBinsZ]; | |
143 | } | |
5e55d806 | 144 | for(Int_t z=0;z<fNBinsZ;z++){ |
145 | fBGEventCounter[z]=new Int_t[fNBinsMultiplicity]; | |
146 | } | |
037dc2db | 147 | |
148 | for(Int_t z=0;z<fNBinsZ;z++){ | |
149 | for(Int_t m=0;m<fNBinsMultiplicity;m++){ | |
150 | fBGEventCounter[z][m]=0; | |
151 | } | |
152 | } | |
153 | ||
5ce758b0 | 154 | if(fBGEventVertex == NULL){ |
155 | fBGEventVertex = new GammaConversionVertex**[fNBinsZ]; | |
156 | } | |
157 | for(Int_t z=0; z < fNBinsZ; z++){ | |
158 | fBGEventVertex[z]= new GammaConversionVertex*[fNBinsMultiplicity]; | |
159 | } | |
160 | for(Int_t z=0;z<fNBinsZ;z++){ | |
161 | for(Int_t m=0;m<fNBinsMultiplicity; m++){ | |
162 | fBGEventVertex[z][m]= new GammaConversionVertex[fNEvents]; | |
163 | } | |
164 | } | |
7f3c7cc6 | 165 | if( fBGEventENegCounter == NULL){ |
166 | fBGEventENegCounter = new Int_t*[fNBinsZ]; | |
167 | } | |
111d75df | 168 | |
7f3c7cc6 | 169 | for(Int_t z=0; z < fNBinsZ; z++){ |
170 | fBGEventENegCounter[z] = new Int_t[fNBinsMultiplicity]; | |
171 | } | |
111d75df | 172 | |
7f3c7cc6 | 173 | for(Int_t z=0;z<fNBinsZ;z++){ |
174 | for(Int_t m=0;m<fNBinsMultiplicity; m++){ | |
175 | fBGEventENegCounter[z][m] = 0; | |
176 | } | |
177 | } | |
178 | ||
111d75df | 179 | if(fBGProbability == NULL){ |
180 | fBGProbability = new Double_t*[fNBinsZ]; | |
181 | } | |
182 | for(Int_t z=0; z < fNBinsZ; z++){ | |
183 | fBGProbability[z] = new Double_t[fNBinsMultiplicity]; | |
184 | } | |
185 | ||
186 | for(Int_t z=0;z<fNBinsZ;z++){ | |
187 | for(Int_t m=0;m<fNBinsMultiplicity; m++){ | |
188 | fBGProbability[z][m] = 0; | |
189 | } | |
190 | } | |
191 | //filling the probability | |
192 | fBGProbability[0][0] = 0.243594; | |
193 | fBGProbability[0][1] = 0.279477; | |
194 | fBGProbability[0][2] = 0.305104; | |
195 | fBGProbability[0][3] = 0.315927; | |
196 | fBGProbability[1][0] = 0.241964; | |
197 | fBGProbability[1][1] = 0.272995; | |
198 | fBGProbability[1][2] = 0.307165; | |
199 | fBGProbability[1][3] = 0.292248; | |
200 | fBGProbability[2][0] = 0.241059; | |
201 | fBGProbability[2][1] = 0.27509; | |
202 | fBGProbability[2][2] = 0.283657; | |
203 | fBGProbability[2][3] = 0.310512; | |
204 | fBGProbability[3][0] = 0.23888; | |
205 | fBGProbability[3][1] = 0.283418; | |
206 | fBGProbability[3][2] = 0.297232; | |
207 | fBGProbability[3][3] = 0.348188; | |
208 | fBGProbability[4][0] = 0.245555; | |
209 | fBGProbability[4][1] = 0.281218; | |
210 | fBGProbability[4][2] = 0.317236; | |
211 | fBGProbability[4][3] = 0.323495; | |
212 | fBGProbability[5][0] = 0.244572; | |
213 | fBGProbability[5][1] = 0.259498; | |
214 | fBGProbability[5][2] = 0.278383; | |
215 | fBGProbability[5][3] = 0.284696; | |
216 | fBGProbability[6][0] = 0.24703; | |
217 | fBGProbability[6][1] = 0.275265; | |
218 | fBGProbability[6][2] = 0.284004; | |
219 | fBGProbability[6][3] = 0.343584; | |
220 | ||
5e55d806 | 221 | } |
222 | ||
037dc2db | 223 | Int_t AliGammaConversionBGHandler::GetZBinIndex(Double_t zvalue) const{ |
5e55d806 | 224 | // see header file for documantation |
225 | if(fNBinsZ<2 || zvalue<=fBinLimitsArrayZ[0]){ | |
226 | return 0; | |
227 | } | |
228 | ||
229 | for(Int_t i=0; i<fNBinsZ-1 ;i++){ | |
230 | if(zvalue >= fBinLimitsArrayZ[i] && zvalue <= fBinLimitsArrayZ[i+1]){ | |
231 | return i; | |
232 | } | |
233 | } | |
234 | return fNBinsZ-1; | |
235 | } | |
236 | ||
037dc2db | 237 | Int_t AliGammaConversionBGHandler::GetMultiplicityBinIndex(Int_t multiplicity) const{ |
5e55d806 | 238 | // see header file for documantation |
239 | if(fNBinsMultiplicity<2){ | |
240 | return 0; | |
241 | } | |
242 | ||
243 | for(Int_t i=0; i<fNBinsMultiplicity-1 ;i++){ | |
5ce758b0 | 244 | if(multiplicity >= fBinLimitsArrayMultiplicity[i] && multiplicity < fBinLimitsArrayMultiplicity[i+1]){ |
5e55d806 | 245 | return i; |
246 | } | |
247 | } | |
248 | return fNBinsMultiplicity-1; | |
249 | } | |
250 | ||
5ce758b0 | 251 | void AliGammaConversionBGHandler::AddEvent(TClonesArray * const eventGammas,Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity){ |
5e55d806 | 252 | // see header file for documantation |
253 | ||
037dc2db | 254 | // cout<<"Entering the AddEvent function"<<endl; |
255 | ||
5e55d806 | 256 | Int_t z = GetZBinIndex(zvalue); |
257 | Int_t m = GetMultiplicityBinIndex(multiplicity); | |
258 | ||
26923b22 | 259 | if(fBGEventCounter[z][m] >= fNEvents){ |
5e55d806 | 260 | fBGEventCounter[z][m]=0; |
261 | } | |
262 | Int_t eventCounter=fBGEventCounter[z][m]; | |
037dc2db | 263 | |
5ce758b0 | 264 | /* |
265 | if(fBGEventVertex[z][m][eventCounter]){ | |
266 | delete fBGEventVertex[z][m][eventCounter]; | |
267 | } | |
268 | */ | |
269 | fBGEventVertex[z][m][eventCounter].fX = xvalue; | |
270 | fBGEventVertex[z][m][eventCounter].fY = yvalue; | |
271 | fBGEventVertex[z][m][eventCounter].fZ = zvalue; | |
272 | ||
037dc2db | 273 | //first clear the vector |
274 | // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl; | |
275 | // cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl; | |
5e55d806 | 276 | |
037dc2db | 277 | // cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl; |
278 | for(UInt_t d=0;d<fBGEvents[z][m][eventCounter].size();d++){ | |
279 | delete (AliKFParticle*)(fBGEvents[z][m][eventCounter][d]); | |
280 | } | |
281 | fBGEvents[z][m][eventCounter].clear(); | |
5ce758b0 | 282 | |
5e55d806 | 283 | // add the gammas to the vector |
284 | for(Int_t i=0; i< eventGammas->GetEntriesFast();i++){ | |
037dc2db | 285 | // AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i))); |
286 | fBGEvents[z][m][eventCounter].push_back(new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i)))); | |
5e55d806 | 287 | } |
26923b22 | 288 | fBGEventCounter[z][m]++; |
5e55d806 | 289 | } |
7f3c7cc6 | 290 | void AliGammaConversionBGHandler::AddElectronEvent(TClonesArray* const eventENeg, Double_t zvalue, Int_t multiplicity){ |
291 | ||
292 | Int_t z = GetZBinIndex(zvalue); | |
293 | Int_t m = GetMultiplicityBinIndex(multiplicity); | |
294 | ||
295 | if(fBGEventENegCounter[z][m] >= fNEvents){ | |
296 | fBGEventENegCounter[z][m]=0; | |
297 | } | |
298 | ||
299 | ||
300 | Int_t eventENegCounter=fBGEventENegCounter[z][m]; | |
301 | ||
302 | //first clear the vector | |
303 | // cout<<"Size of vector: "<<fBGEvents[z][m][eventCounter].size()<<endl; | |
304 | // cout<<"Checking the entries: Z="<<z<<", M="<<m<<", eventCounter="<<eventCounter<<endl; | |
305 | ||
306 | // cout<<"The size of this vector is: "<<fBGEvents[z][m][eventCounter].size()<<endl; | |
307 | for(UInt_t d=0;d<fBGEventsENeg[z][m][eventENegCounter].size();d++){ | |
308 | delete (AliKFParticle*)(fBGEventsENeg[z][m][eventENegCounter][d]); | |
309 | } | |
310 | ||
311 | fBGEventsENeg[z][m][eventENegCounter].clear(); | |
312 | ||
313 | // add the electron to the vector | |
314 | for(Int_t i=0; i< eventENeg->GetEntriesFast();i++){ | |
315 | // AliKFParticle *t = new AliKFParticle(*(AliKFParticle*)(eventGammas->At(i))); | |
316 | fBGEventsENeg[z][m][eventENegCounter].push_back(new AliKFParticle(*(AliKFParticle*)(eventENeg->At(i)))); | |
317 | } | |
318 | ||
319 | fBGEventENegCounter[z][m]++; | |
5e55d806 | 320 | |
7f3c7cc6 | 321 | |
322 | } | |
5ce758b0 | 323 | AliGammaConversionKFVector* AliGammaConversionBGHandler::GetBGGoodV0s(Int_t zbin, Int_t mbin, Int_t event){ |
037dc2db | 324 | //see headerfile for documentation |
5ce758b0 | 325 | return &(fBGEvents[zbin][mbin][event]); |
5e55d806 | 326 | } |
7f3c7cc6 | 327 | AliGammaConversionKFVector* AliGammaConversionBGHandler::GetBGGoodENeg(Int_t event, Double_t zvalue, Int_t multiplicity){ |
328 | ||
26923b22 | 329 | |
7f3c7cc6 | 330 | //see headerfile for documentation |
331 | Int_t z = GetZBinIndex(zvalue); | |
332 | Int_t m = GetMultiplicityBinIndex(multiplicity); | |
333 | return &(fBGEventsENeg[z][m][event]); | |
334 | ||
335 | ||
336 | } | |
26923b22 | 337 | void AliGammaConversionBGHandler::PrintBGArray(){ |
037dc2db | 338 | //see headerfile for documentation |
26923b22 | 339 | for(Int_t z=0;z<fNBinsZ;z++){ |
037dc2db | 340 | if(z==2){ |
341 | cout<<"Getting the data for z bin: "<<z<<endl; | |
342 | for(Int_t multiplicity=0;multiplicity<fNBinsMultiplicity;multiplicity++){ | |
343 | if(multiplicity==2){ | |
344 | cout<<"Getting the data for multiplicity bin: "<<multiplicity<<endl; | |
345 | for(Int_t event=0;event<fNEvents;event++){ | |
346 | if(fBGEvents[z][multiplicity][event].size()>0){ | |
347 | cout<<"Event: "<<event<<" has: "<<fBGEvents[z][multiplicity][event].size()<<endl; | |
348 | } | |
349 | } | |
26923b22 | 350 | } |
351 | } | |
352 | } | |
353 | } | |
354 | } |