]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/FEMTOSCOPY/Chaoticity/AliFourPion.cxx
Updates to allow pp and pPb analysis
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / Chaoticity / AliFourPion.cxx
CommitLineData
be9ef9f9 1#include <iostream>
2#include <math.h>
3#include "TChain.h"
4#include "TFile.h"
5#include "TKey.h"
6#include "TObject.h"
7#include "TObjString.h"
8#include "TList.h"
9#include "TTree.h"
10#include "TH1F.h"
11#include "TH1D.h"
12#include "TH2D.h"
13#include "TH3D.h"
14#include "TProfile.h"
15#include "TProfile2D.h"
16#include "TCanvas.h"
17#include "TRandom3.h"
18#include "TF1.h"
19
20#include "AliAnalysisTask.h"
21#include "AliAnalysisManager.h"
22
23
24#include "AliESDEvent.h"
25#include "AliESDInputHandler.h"
26#include "AliESDtrackCuts.h"
27
28#include "AliAODEvent.h"
29#include "AliAODInputHandler.h"
30#include "AliAODMCParticle.h"
31#include "AliAnalysisUtils.h"
32
33#include "AliFourPion.h"
34
35#define PI 3.1415927
36#define G_Coeff 0.006399 // 2*pi*alpha*M_pion
42802bba 37#define FmToGeV 0.19733 // conversion of Fm to GeV
fcb16ac9 38#define kappa3 0.15 // kappa3 Edgeworth coefficient (non-Gaussian features of C2)
39#define kappa4 0.32 // kappa4 Edgeworth coefficient (non-Gaussian features of C2)
42802bba 40#define kappa3Fit 0.1 // kappa3 for c4QS fit
41#define kappa4Fit 0.5 // kappa4 for c4QS fit
be9ef9f9 42
43// Author: Dhevan Gangadharan
44
45ClassImp(AliFourPion)
46
47//________________________________________________________________________
48AliFourPion::AliFourPion():
49AliAnalysisTaskSE(),
50 fname(0),
51 fAOD(0x0),
52 fOutputList(0x0),
53 fPIDResponse(0x0),
54 fEC(0x0),
55 fEvt(0x0),
56 fTempStruct(0x0),
57 fRandomNumber(0x0),
58 fLEGO(kTRUE),
59 fMCcase(kFALSE),
60 fAODcase(kTRUE),
61 fPbPbcase(kTRUE),
62 fGenerateSignal(kFALSE),
63 fGeneratorOnly(kFALSE),
be9ef9f9 64 fTabulatePairs(kFALSE),
95567836 65 fLinearInterpolation(kTRUE),
42802bba 66 fMixedChargeCut(kFALSE),
be9ef9f9 67 fRMax(11),
68 ffcSq(0.7),
80507acf 69 ffcSqMRC(0.6),
be9ef9f9 70 fFilterBit(7),
71 fMaxChi2NDF(10),
72 fMinTPCncls(0),
73 fBfield(0),
74 fMbin(0),
75 fFSIindex(0),
76 fEDbin(0),
77 fMbins(fCentBins),
78 fMultLimit(0),
79 fCentBinLowLimit(0),
80 fCentBinHighLimit(1),
0207c034 81 fTriggerType(0),
be9ef9f9 82 fEventCounter(0),
83 fEventsToMix(0),
84 fZvertexBins(0),
85 fMultLimits(),
42802bba 86 fMinPt(0.16),
87 fMaxPt(1.0),
be9ef9f9 88 fQcut(0),
89 fQLowerCut(0),
90 fNormQcutLow(0),
91 fNormQcutHigh(0),
92 fKupperBound(0),
93 fQupperBoundQ2(0),
94 fQupperBoundQ3(0),
95 fQupperBoundQ4(0),
96 fQbinsQ2(1),
97 fQbinsQ3(1),
98 fQbinsQ4(1),
99 fQupperBoundWeights(0),
100 fKstepT(),
101 fKstepY(),
102 fKmeanT(),
103 fKmeanY(),
104 fKmiddleT(),
105 fKmiddleY(),
106 fQstep(0),
107 fQstepWeights(0),
108 fQmean(),
109 fDampStart(0),
110 fDampStep(0),
111 fTPCTOFboundry(0),
112 fTOFboundry(0),
113 fSigmaCutTPC(2.0),
114 fSigmaCutTOF(2.0),
4bf06935 115 fMinSepPairEta(0.02),
116 fMinSepPairPhi(0.045),
be9ef9f9 117 fShareQuality(0),
118 fShareFraction(0),
119 fTrueMassP(0),
120 fTrueMassPi(0),
121 fTrueMassK(0),
122 fTrueMassKs(0),
123 fTrueMassLam(0),
124 fKtIndexL(0),
125 fKtIndexH(0),
126 fQoIndexL(0),
127 fQoIndexH(0),
128 fQsIndexL(0),
129 fQsIndexH(0),
130 fQlIndexL(0),
131 fQlIndexH(0),
132 fDummyB(0),
133 fKT3transition(0.3),
134 fKT4transition(0.3),
95567836 135 farrP1(),
136 farrP2(),
b71263d0 137 fDefaultsCharSwitch(),
138 fLowQPairSwitch_E0E0(),
139 fLowQPairSwitch_E0E1(),
140 fLowQPairSwitch_E0E2(),
141 fLowQPairSwitch_E0E3(),
6bb6954b 142 fLowQPairSwitch_E1E1(),
b71263d0 143 fLowQPairSwitch_E1E2(),
144 fLowQPairSwitch_E1E3(),
145 fLowQPairSwitch_E2E3(),
146 fNormQPairSwitch_E0E0(),
147 fNormQPairSwitch_E0E1(),
148 fNormQPairSwitch_E0E2(),
149 fNormQPairSwitch_E0E3(),
6bb6954b 150 fNormQPairSwitch_E1E1(),
b71263d0 151 fNormQPairSwitch_E1E2(),
152 fNormQPairSwitch_E1E3(),
153 fNormQPairSwitch_E2E3(),
80507acf 154 fMomResC2SC(0x0),
155 fMomResC2MC(0x0),
5591748e 156 fWeightmuonCorrection(0x0)
be9ef9f9 157{
158 // Default constructor
159 for(Int_t mb=0; mb<fMbins; mb++){
160 for(Int_t edB=0; edB<fEDbins; edB++){
161 for(Int_t c1=0; c1<2; c1++){
162 for(Int_t c2=0; c2<2; c2++){
163 for(Int_t term=0; term<2; term++){
164
165 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fTerms2=0x0;
166
167 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fIdeal = 0x0;
168 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fSmeared = 0x0;
169 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSL = 0x0;
170 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSLQW = 0x0;
171 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[1].fTerms2OSL = 0x0;
172 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[1].fTerms2OSLQW = 0x0;
173
174 }// term_2
175
176
177 for(Int_t c3=0; c3<2; c3++){
178 for(Int_t term=0; term<5; term++){
179
180 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fNorm3 = 0x0;
181 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTerms3 = 0x0;
b71263d0 182 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fKfactor = 0x0;
be9ef9f9 183 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTwoPartNorm = 0x0;
184
185 }// term_3
b71263d0 186
187 for(Int_t c4=0; c4<2; c4++){
6bb6954b 188 for(Int_t term=0; term<13; term++){
b71263d0 189
190 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fNorm4 = 0x0;
191 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTerms4 = 0x0;
192 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fKfactor = 0x0;
193 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTwoPartNorm = 0x0;
194
195 }// term_4
196
197 }// c4
be9ef9f9 198 }//c3
199 }//c2
200 }//c1
201 for(Int_t tKbin=0; tKbin<fKbinsT; tKbin++){
202 for(Int_t yKbin=0; yKbin<fKbinsY; yKbin++){
203 KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[0].fTerms2ThreeD = 0x0;
204 KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[1].fTerms2ThreeD = 0x0;
205 }
206 }
207
208 }// ED
209 }// Mbin
210
211 // Initialize FSI histograms
212 for(Int_t i=0; i<12; i++){
213 fFSIss[i]=0x0;
214 fFSIos[i]=0x0;
215 }
216
217
218 // Initialize fNormWeight and fNormWeightErr to 0
219 for(Int_t i=0; i<3; i++){// Kt iterator
220 for(Int_t j=0; j<10; j++){// Mbin iterator
221 fNormWeight[i][j]=0x0;
222 }
223 }
224
225
226}
227//________________________________________________________________________
228AliFourPion::AliFourPion(const Char_t *name)
229: AliAnalysisTaskSE(name),
230 fname(name),
231 fAOD(0x0),
232 fOutputList(0x0),
233 fPIDResponse(0x0),
234 fEC(0x0),
235 fEvt(0x0),
236 fTempStruct(0x0),
237 fRandomNumber(0x0),
238 fLEGO(kTRUE),
239 fMCcase(kFALSE),
240 fAODcase(kTRUE),
241 fPbPbcase(kTRUE),
242 fGenerateSignal(kFALSE),
243 fGeneratorOnly(kFALSE),
be9ef9f9 244 fTabulatePairs(kFALSE),
95567836 245 fLinearInterpolation(kTRUE),
42802bba 246 fMixedChargeCut(kFALSE),
be9ef9f9 247 fRMax(11),
248 ffcSq(0.7),
80507acf 249 ffcSqMRC(0.6),
be9ef9f9 250 fFilterBit(7),
251 fMaxChi2NDF(10),
252 fMinTPCncls(0),
253 fBfield(0),
254 fMbin(0),
255 fFSIindex(0),
256 fEDbin(0),
257 fMbins(fCentBins),
258 fMultLimit(0),
259 fCentBinLowLimit(0),
260 fCentBinHighLimit(1),
0207c034 261 fTriggerType(0),
be9ef9f9 262 fEventCounter(0),
263 fEventsToMix(0),
264 fZvertexBins(0),
265 fMultLimits(),
42802bba 266 fMinPt(0.16),
267 fMaxPt(1.0),
be9ef9f9 268 fQcut(0),
269 fQLowerCut(0),
270 fNormQcutLow(0),
271 fNormQcutHigh(0),
272 fKupperBound(0),
273 fQupperBoundQ2(0),
274 fQupperBoundQ3(0),
275 fQupperBoundQ4(0),
276 fQbinsQ2(1),
277 fQbinsQ3(1),
278 fQbinsQ4(1),
279 fQupperBoundWeights(0),
280 fKstepT(),
281 fKstepY(),
282 fKmeanT(),
283 fKmeanY(),
284 fKmiddleT(),
285 fKmiddleY(),
286 fQstep(0),
287 fQstepWeights(0),
288 fQmean(),
289 fDampStart(0),
290 fDampStep(0),
291 fTPCTOFboundry(0),
292 fTOFboundry(0),
293 fSigmaCutTPC(2.0),
294 fSigmaCutTOF(2.0),
4bf06935 295 fMinSepPairEta(0.02),
296 fMinSepPairPhi(0.045),
be9ef9f9 297 fShareQuality(0),
298 fShareFraction(0),
299 fTrueMassP(0),
300 fTrueMassPi(0),
301 fTrueMassK(0),
302 fTrueMassKs(0),
303 fTrueMassLam(0),
304 fKtIndexL(0),
305 fKtIndexH(0),
306 fQoIndexL(0),
307 fQoIndexH(0),
308 fQsIndexL(0),
309 fQsIndexH(0),
310 fQlIndexL(0),
311 fQlIndexH(0),
312 fDummyB(0),
313 fKT3transition(0.3),
314 fKT4transition(0.3),
95567836 315 farrP1(),
316 farrP2(),
b71263d0 317 fDefaultsCharSwitch(),
318 fLowQPairSwitch_E0E0(),
319 fLowQPairSwitch_E0E1(),
320 fLowQPairSwitch_E0E2(),
321 fLowQPairSwitch_E0E3(),
6bb6954b 322 fLowQPairSwitch_E1E1(),
b71263d0 323 fLowQPairSwitch_E1E2(),
324 fLowQPairSwitch_E1E3(),
325 fLowQPairSwitch_E2E3(),
326 fNormQPairSwitch_E0E0(),
327 fNormQPairSwitch_E0E1(),
328 fNormQPairSwitch_E0E2(),
329 fNormQPairSwitch_E0E3(),
6bb6954b 330 fNormQPairSwitch_E1E1(),
b71263d0 331 fNormQPairSwitch_E1E2(),
332 fNormQPairSwitch_E1E3(),
333 fNormQPairSwitch_E2E3(),
80507acf 334 fMomResC2SC(0x0),
335 fMomResC2MC(0x0),
5591748e 336 fWeightmuonCorrection(0x0)
be9ef9f9 337{
338 // Main constructor
339 fAODcase=kTRUE;
6432c081 340
be9ef9f9 341
342
343 for(Int_t mb=0; mb<fMbins; mb++){
344 for(Int_t edB=0; edB<fEDbins; edB++){
345 for(Int_t c1=0; c1<2; c1++){
346 for(Int_t c2=0; c2<2; c2++){
347 for(Int_t term=0; term<2; term++){
348
349 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fTerms2=0x0;
350
351 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fIdeal = 0x0;
352 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fSmeared = 0x0;
353 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSL = 0x0;
354 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSLQW = 0x0;
355 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[1].fTerms2OSL = 0x0;
356 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[1].fTerms2OSLQW = 0x0;
357
358 }// term_2
359
360 for(Int_t c3=0; c3<2; c3++){
361 for(Int_t term=0; term<5; term++){
362
363 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fNorm3 = 0x0;
364 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTerms3 = 0x0;
b71263d0 365 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fKfactor = 0x0;
be9ef9f9 366 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTwoPartNorm = 0x0;
367
368 }// term_3
b71263d0 369
370 for(Int_t c4=0; c4<2; c4++){
6bb6954b 371 for(Int_t term=0; term<13; term++){
b71263d0 372
373 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fNorm4 = 0x0;
374 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTerms4 = 0x0;
375 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fKfactor = 0x0;
376 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTwoPartNorm = 0x0;
377
378 }// term_4
379 }// c4
be9ef9f9 380 }//c3
381 }//c2
382 }//c1
383
384 for(Int_t tKbin=0; tKbin<fKbinsT; tKbin++){
385 for(Int_t yKbin=0; yKbin<fKbinsY; yKbin++){
386 KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[0].fTerms2ThreeD = 0x0;
387 KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[1].fTerms2ThreeD = 0x0;
388 }
389 }
390
391 }// ED
392 }// Mbin
393
394 // Initialize FSI histograms
395 for(Int_t i=0; i<12; i++){
396 fFSIss[i]=0x0;
397 fFSIos[i]=0x0;
398 }
399
400 // Initialize fNormWeight and fNormWeightErr to 0
401 for(Int_t i=0; i<3; i++){// Kt iterator
402 for(Int_t j=0; j<10; j++){// Mbin iterator
403 fNormWeight[i][j]=0x0;
404 }
405 }
406
407
408 DefineOutput(1, TList::Class());
409}
410//________________________________________________________________________
411AliFourPion::AliFourPion(const AliFourPion &obj)
412 : AliAnalysisTaskSE(obj.fname),
413 fname(obj.fname),
414 fAOD(obj.fAOD),
415 //fESD(obj.fESD),
416 fOutputList(obj.fOutputList),
417 fPIDResponse(obj.fPIDResponse),
418 fEC(obj.fEC),
419 fEvt(obj.fEvt),
420 fTempStruct(obj.fTempStruct),
421 fRandomNumber(obj.fRandomNumber),
422 fLEGO(obj.fLEGO),
423 fMCcase(obj.fMCcase),
424 fAODcase(obj.fAODcase),
425 fPbPbcase(obj.fPbPbcase),
426 fGenerateSignal(obj.fGenerateSignal),
427 fGeneratorOnly(obj.fGeneratorOnly),
be9ef9f9 428 fTabulatePairs(obj.fTabulatePairs),
95567836 429 fLinearInterpolation(obj.fLinearInterpolation),
42802bba 430 fMixedChargeCut(obj.fMixedChargeCut),
be9ef9f9 431 fRMax(obj.fRMax),
432 ffcSq(obj.ffcSq),
80507acf 433 ffcSqMRC(obj.ffcSqMRC),
be9ef9f9 434 fFilterBit(obj.fFilterBit),
435 fMaxChi2NDF(obj.fMaxChi2NDF),
436 fMinTPCncls(obj.fMinTPCncls),
437 fBfield(obj.fBfield),
438 fMbin(obj.fMbin),
439 fFSIindex(obj.fFSIindex),
440 fEDbin(obj.fEDbin),
441 fMbins(obj.fMbins),
442 fMultLimit(obj.fMultLimit),
443 fCentBinLowLimit(obj.fCentBinLowLimit),
444 fCentBinHighLimit(obj.fCentBinHighLimit),
0207c034 445 fTriggerType(obj.fTriggerType),
be9ef9f9 446 fEventCounter(obj.fEventCounter),
447 fEventsToMix(obj.fEventsToMix),
448 fZvertexBins(obj.fZvertexBins),
449 fMultLimits(),
42802bba 450 fMinPt(obj.fMinPt),
451 fMaxPt(obj.fMaxPt),
452 fQcut(obj.fQcut),
be9ef9f9 453 fQLowerCut(obj.fQLowerCut),
454 fNormQcutLow(0),
455 fNormQcutHigh(0),
456 fKupperBound(obj.fKupperBound),
457 fQupperBoundQ2(obj.fQupperBoundQ2),
458 fQupperBoundQ3(obj.fQupperBoundQ3),
459 fQupperBoundQ4(obj.fQupperBoundQ4),
460 fQbinsQ2(obj.fQbinsQ2),
461 fQbinsQ3(obj.fQbinsQ3),
462 fQbinsQ4(obj.fQbinsQ4),
463 fQupperBoundWeights(obj.fQupperBoundWeights),
464 fKstepT(),
465 fKstepY(),
466 fKmeanT(),
467 fKmeanY(),
468 fKmiddleT(),
469 fKmiddleY(),
470 fQstep(obj.fQstep),
471 fQstepWeights(obj.fQstepWeights),
472 fQmean(),
473 fDampStart(obj.fDampStart),
474 fDampStep(obj.fDampStep),
475 fTPCTOFboundry(obj.fTPCTOFboundry),
476 fTOFboundry(obj.fTOFboundry),
477 fSigmaCutTPC(obj.fSigmaCutTPC),
478 fSigmaCutTOF(obj.fSigmaCutTOF),
479 fMinSepPairEta(obj.fMinSepPairEta),
480 fMinSepPairPhi(obj.fMinSepPairPhi),
481 fShareQuality(obj.fShareQuality),
482 fShareFraction(obj.fShareFraction),
483 fTrueMassP(obj.fTrueMassP),
484 fTrueMassPi(obj.fTrueMassPi),
485 fTrueMassK(obj.fTrueMassK),
486 fTrueMassKs(obj.fTrueMassKs),
487 fTrueMassLam(obj.fTrueMassLam),
488 fKtIndexL(obj.fKtIndexL),
489 fKtIndexH(obj.fKtIndexH),
490 fQoIndexL(obj.fQoIndexL),
491 fQoIndexH(obj.fQoIndexH),
492 fQsIndexL(obj.fQsIndexL),
493 fQsIndexH(obj.fQsIndexH),
494 fQlIndexL(obj.fQlIndexL),
495 fQlIndexH(obj.fQlIndexH),
496 fDummyB(obj.fDummyB),
497 fKT3transition(obj.fKT3transition),
498 fKT4transition(obj.fKT4transition),
95567836 499 farrP1(),
500 farrP2(),
b71263d0 501 fDefaultsCharSwitch(),
502 fLowQPairSwitch_E0E0(),
503 fLowQPairSwitch_E0E1(),
504 fLowQPairSwitch_E0E2(),
505 fLowQPairSwitch_E0E3(),
6bb6954b 506 fLowQPairSwitch_E1E1(),
b71263d0 507 fLowQPairSwitch_E1E2(),
508 fLowQPairSwitch_E1E3(),
509 fLowQPairSwitch_E2E3(),
510 fNormQPairSwitch_E0E0(),
511 fNormQPairSwitch_E0E1(),
512 fNormQPairSwitch_E0E2(),
513 fNormQPairSwitch_E0E3(),
6bb6954b 514 fNormQPairSwitch_E1E1(),
b71263d0 515 fNormQPairSwitch_E1E2(),
516 fNormQPairSwitch_E1E3(),
517 fNormQPairSwitch_E2E3(),
80507acf 518 fMomResC2SC(obj.fMomResC2SC),
519 fMomResC2MC(obj.fMomResC2MC),
5591748e 520 fWeightmuonCorrection(obj.fWeightmuonCorrection)
be9ef9f9 521{
522 // Copy Constructor
523
524 for(Int_t i=0; i<12; i++){
525 fFSIss[i]=obj.fFSIss[i];
526 fFSIos[i]=obj.fFSIos[i];
527 }
528
529 // Initialize fNormWeight and fNormWeightErr to 0
530 for(Int_t i=0; i<3; i++){// Kt iterator
531 for(Int_t j=0; j<10; j++){// Mbin iterator
532 fNormWeight[i][j]=0x0;
533 }
534 }
535
536
537}
538//________________________________________________________________________
539AliFourPion &AliFourPion::operator=(const AliFourPion &obj)
540{
541 // Assignment operator
542 if (this == &obj)
543 return *this;
544
545 fname = obj.fname;
546 fAOD = obj.fAOD;
547 fOutputList = obj.fOutputList;
548 fPIDResponse = obj.fPIDResponse;
549 fEC = obj.fEC;
550 fEvt = obj.fEvt;
551 fTempStruct = obj.fTempStruct;
552 fRandomNumber = obj.fRandomNumber;
553 fLEGO = fLEGO;
554 fMCcase = obj.fMCcase;
555 fAODcase = obj.fAODcase;
556 fPbPbcase = obj.fPbPbcase;
557 fGenerateSignal = obj.fGenerateSignal;
558 fGeneratorOnly = obj.fGeneratorOnly;
be9ef9f9 559 fTabulatePairs = obj.fTabulatePairs;
95567836 560 fLinearInterpolation = obj.fLinearInterpolation;
42802bba 561 fMixedChargeCut = obj.fMixedChargeCut;
be9ef9f9 562 fRMax = obj.fRMax;
563 ffcSq = obj.ffcSq;
80507acf 564 ffcSqMRC = obj.ffcSqMRC;
be9ef9f9 565 fFilterBit = obj.fFilterBit;
566 fMaxChi2NDF = obj.fMaxChi2NDF;
567 fMinTPCncls = obj.fMinTPCncls;
568 fBfield = obj.fBfield;
569 fMbin = obj.fMbin;
570 fFSIindex = obj.fFSIindex;
571 fEDbin = obj.fEDbin;
572 fMbins = obj.fMbins;
573 fMultLimit = obj.fMultLimit;
574 fCentBinLowLimit = obj.fCentBinLowLimit;
575 fCentBinHighLimit = obj.fCentBinHighLimit;
0207c034 576 fTriggerType = obj.fTriggerType;
be9ef9f9 577 fEventCounter = obj.fEventCounter;
578 fEventsToMix = obj.fEventsToMix;
579 fZvertexBins = obj.fZvertexBins;
42802bba 580 fMinPt = obj.fMinPt;
581 fMaxPt = obj.fMaxPt;
582 fQcut = obj.fQcut;
be9ef9f9 583 fQLowerCut = obj.fQLowerCut;
584 fKupperBound = obj.fKupperBound;
585 fQupperBoundQ2 = obj.fQupperBoundQ2;
586 fQupperBoundQ3 = obj.fQupperBoundQ3;
587 fQupperBoundQ4 = obj.fQupperBoundQ4;
588 fQbinsQ2 = obj.fQbinsQ2;
589 fQbinsQ3 = obj.fQbinsQ3;
590 fQbinsQ4 = obj.fQbinsQ4;
591 fQupperBoundWeights = obj.fQupperBoundWeights;
592 fQstep = obj.fQstep;
593 fQstepWeights = obj.fQstepWeights;
594 fDampStart = obj.fDampStart;
595 fDampStep = obj.fDampStep;
596 fTPCTOFboundry = obj.fTPCTOFboundry;
597 fTOFboundry = obj.fTOFboundry;
598 fSigmaCutTPC = obj.fSigmaCutTPC;
599 fSigmaCutTOF = obj.fSigmaCutTOF;
600 fMinSepPairEta = obj.fMinSepPairEta;
601 fMinSepPairPhi = obj.fMinSepPairPhi;
602 fShareQuality = obj.fShareQuality;
603 fShareFraction = obj.fShareFraction;
604 fTrueMassP = obj.fTrueMassP;
605 fTrueMassPi = obj.fTrueMassPi;
606 fTrueMassK = obj.fTrueMassK;
607 fTrueMassKs = obj.fTrueMassKs;
608 fTrueMassLam = obj.fTrueMassLam;
609 fKtIndexL = obj.fKtIndexL;
610 fKtIndexH = obj.fKtIndexH;
611 fQoIndexL = obj.fQoIndexL;
612 fQoIndexH = obj.fQoIndexH;
613 fQsIndexL = obj.fQsIndexL;
614 fQsIndexH = obj.fQsIndexH;
615 fQlIndexL = obj.fQlIndexL;
616 fQlIndexH = obj.fQlIndexH;
617 fDummyB = obj.fDummyB;
618 fKT3transition = obj.fKT3transition;
619 fKT4transition = obj.fKT4transition;
80507acf 620 fMomResC2SC = obj.fMomResC2SC;
621 fMomResC2MC = obj.fMomResC2MC;
5591748e 622 fWeightmuonCorrection = obj.fWeightmuonCorrection;
be9ef9f9 623
624 for(Int_t i=0; i<12; i++){
625 fFSIss[i]=obj.fFSIss[i];
626 fFSIos[i]=obj.fFSIos[i];
627 }
628 for(Int_t i=0; i<3; i++){// Kt iterator
629 for(Int_t j=0; j<10; j++){// Mbin iterator
630 fNormWeight[i][j]=obj.fNormWeight[i][j];
631 }
632 }
633
634 return (*this);
635}
636//________________________________________________________________________
637AliFourPion::~AliFourPion()
638{
639 // Destructor
640 if(fAOD) delete fAOD;
641 //if(fESD) delete fESD;
642 if(fOutputList) delete fOutputList;
643 if(fPIDResponse) delete fPIDResponse;
644 if(fEC) delete fEC;
645 if(fEvt) delete fEvt;
646 if(fTempStruct) delete [] fTempStruct;
647 if(fRandomNumber) delete fRandomNumber;
80507acf 648 if(fMomResC2SC) delete fMomResC2SC;
649 if(fMomResC2MC) delete fMomResC2MC;
5591748e 650 if(fWeightmuonCorrection) delete fWeightmuonCorrection;
651
b71263d0 652 for(Int_t j=0; j<kMultLimitPbPb; j++){
653 if(fLowQPairSwitch_E0E0[j]) delete [] fLowQPairSwitch_E0E0[j];
654 if(fLowQPairSwitch_E0E1[j]) delete [] fLowQPairSwitch_E0E1[j];
655 if(fLowQPairSwitch_E0E2[j]) delete [] fLowQPairSwitch_E0E2[j];
656 if(fLowQPairSwitch_E0E3[j]) delete [] fLowQPairSwitch_E0E3[j];
6bb6954b 657 if(fLowQPairSwitch_E1E1[j]) delete [] fLowQPairSwitch_E1E1[j];
b71263d0 658 if(fLowQPairSwitch_E1E2[j]) delete [] fLowQPairSwitch_E1E2[j];
659 if(fLowQPairSwitch_E1E3[j]) delete [] fLowQPairSwitch_E1E3[j];
660 if(fLowQPairSwitch_E2E3[j]) delete [] fLowQPairSwitch_E2E3[j];
661 //
662 if(fNormQPairSwitch_E0E0[j]) delete [] fNormQPairSwitch_E0E0[j];
663 if(fNormQPairSwitch_E0E1[j]) delete [] fNormQPairSwitch_E0E1[j];
664 if(fNormQPairSwitch_E0E2[j]) delete [] fNormQPairSwitch_E0E2[j];
665 if(fNormQPairSwitch_E0E3[j]) delete [] fNormQPairSwitch_E0E3[j];
6bb6954b 666 if(fNormQPairSwitch_E1E1[j]) delete [] fNormQPairSwitch_E1E1[j];
b71263d0 667 if(fNormQPairSwitch_E1E2[j]) delete [] fNormQPairSwitch_E1E2[j];
668 if(fNormQPairSwitch_E1E3[j]) delete [] fNormQPairSwitch_E1E3[j];
669 if(fNormQPairSwitch_E2E3[j]) delete [] fNormQPairSwitch_E2E3[j];
670 }
be9ef9f9 671
672 //
673 for(Int_t mb=0; mb<fMbins; mb++){
674 for(Int_t edB=0; edB<fEDbins; edB++){
675 for(Int_t c1=0; c1<2; c1++){
676 for(Int_t c2=0; c2<2; c2++){
677 for(Int_t term=0; term<2; term++){
678
679 if(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fTerms2) delete Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fTerms2;
680
681 if(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fIdeal) delete Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fIdeal;
682 if(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fSmeared) delete Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fSmeared;
683 if(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSL) delete Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSL;
684 if(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSLQW) delete Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSLQW;
685 if(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[1].fTerms2OSL) delete Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[1].fTerms2OSL;
686 if(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[1].fTerms2OSLQW) delete Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[1].fTerms2OSLQW;
687 //
688 if(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMCqinv) delete Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMCqinv;
689 if(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMCqinvQW) delete Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMCqinvQW;
690 }// term_2
691
692 for(Int_t c3=0; c3<2; c3++){
693 for(Int_t term=0; term<5; term++){
694
695 if(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fNorm3) delete Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fNorm3;
696 if(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTerms3) delete Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTerms3;
b71263d0 697 if(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fKfactor) delete Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fKfactor;
42802bba 698 if(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fKfactorWeighted) delete Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fKfactorWeighted;
be9ef9f9 699 //
700 if(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTwoPartNorm) delete Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTwoPartNorm;
701
702 }// term_3
b71263d0 703
704 for(Int_t c4=0; c4<2; c4++){
6bb6954b 705 for(Int_t term=0; term<13; term++){
b71263d0 706
707 if(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fNorm4) delete Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fNorm4;
708 if(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTerms4) delete Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTerms4;
709 if(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fKfactor) delete Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fKfactor;
42802bba 710 if(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fKfactorWeighted) delete Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fKfactorWeighted;
b71263d0 711 //
712 if(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTwoPartNorm) delete Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTwoPartNorm;
713 }// term_4
714
715 }//c4
be9ef9f9 716 }//c3
717 }//c2
718 }//c1
719 for(Int_t tKbin=0; tKbin<fKbinsT; tKbin++){
720 for(Int_t yKbin=0; yKbin<fKbinsY; yKbin++){
721 if(KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[0].fTerms2ThreeD) delete KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[0].fTerms2ThreeD;
722 if(KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[1].fTerms2ThreeD) delete KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[1].fTerms2ThreeD;
723 }
724 }
725
726 }// ED
727 }// Mbin
728
729
730 for(Int_t i=0; i<12; i++){
731 if(fFSIss[i]) delete fFSIss[i];
732 if(fFSIos[i]) delete fFSIos[i];
733 }
734 for(Int_t i=0; i<3; i++){// Kt iterator
735 for(Int_t j=0; j<10; j++){// Mbin iterator
736 if(fNormWeight[i][j]) delete fNormWeight[i][j];
737 }
738 }
739
740}
741//________________________________________________________________________
742void AliFourPion::ParInit()
743{
744 cout<<"AliFourPion MyInit() call"<<endl;
745 cout<<"lego:"<<fLEGO<<" MCcase:"<<fMCcase<<" PbPbcase:"<<fPbPbcase<<" TabulatePairs:"<<fTabulatePairs<<" GenSignal:"<<fGenerateSignal<<" CentLow:"<<fCentBinLowLimit<<" CentHigh:"<<fCentBinHighLimit<<" RMax:"<<fRMax<<" fc^2:"<<ffcSq<<" FB:"<<fFilterBit<<" MaxChi2/NDF:"<<fMaxChi2NDF<<" MinTPCncls:"<<fMinTPCncls<<" MinPairSepEta:"<<fMinSepPairEta<<" MinPairSepPhi:"<<fMinSepPairPhi<<" NsigTPC:"<<fSigmaCutTPC<<" NsigTOF:"<<fSigmaCutTOF<<endl;
746
747 fRandomNumber = new TRandom3();
748 fRandomNumber->SetSeed(0);
749
750 //
751 fEventCounter=0;
752 fEventsToMix=3;
753 fZvertexBins=2;//2
754
755 fTPCTOFboundry = 0.6;// TPC pid used below this momentum, TOF above but below TOF_boundry
756 fTOFboundry = 2.1;// TOF pid used below this momentum
757
758 ////////////////////////////////////////////////
759 // PadRow Pair Cuts
760 fShareQuality = .5;// max
761 fShareFraction = .05;// max
762 ////////////////////////////////////////////////
763
0207c034 764 // pp and pPb mult limits
765 fMultLimits[0]=0, fMultLimits[1]=5; fMultLimits[2]=10; fMultLimits[3]=15; fMultLimits[4]=20;
766 fMultLimits[5]=30, fMultLimits[6]=40; fMultLimits[7]=50; fMultLimits[8]=70; fMultLimits[9]=100;
767 fMultLimits[10]=150;
be9ef9f9 768
769
770
771 if(fPbPbcase) {// PbPb
772 fMultLimit=kMultLimitPbPb;
773 fMbins=fCentBins;
774 fQcut=0.1;
b71263d0 775 fNormQcutLow = 0.15;// 0.15
776 fNormQcutHigh = 0.2;// 0.175
be9ef9f9 777 }else {// pp
778 fMultLimit=kMultLimitpp;
0207c034 779 fMbins=1;
be9ef9f9 780 fQcut=0.6;
781 fNormQcutLow = 1.0;
782 fNormQcutHigh = 1.5;
783 }
784
785 fQLowerCut = 0.005;// was 0.005
786 fKupperBound = 1.0;
787 //
788 fKstepY[0] = 1.6;
789 fKmeanY[0] = 0;// central y
790 fKmiddleY[0] = 0;
791
792 // 4x1 (Kt: 0-0.25, 0.25-0.35, 0.35-0.45, 0.45-1.0)
793 if(fKbinsT==4){
794 fKstepT[0] = 0.25; fKstepT[1] = 0.1; fKstepT[2] = 0.1; fKstepT[3] = 0.55;
795 fKmeanT[0] = 0.212; fKmeanT[1] = 0.299; fKmeanT[2] = 0.398; fKmeanT[3] = 0.576;
796 fKmiddleT[0] = 0.125; fKmiddleT[1] = 0.3; fKmiddleT[2] = 0.4; fKmiddleT[3] = 0.725;
797 }
798 // 3x1 (Kt: 0-0.3, 0.3-0.45, 0.45-1.0)
799 if(fKbinsT==3){
800 fKstepT[0] = 0.3; fKstepT[1] = 0.15; fKstepT[2] = 0.55;
801 fKmeanT[0] = 0.240; fKmeanT[1] = 0.369; fKmeanT[2] = 0.576;
802 fKmiddleT[0] = 0.15; fKmiddleT[1] = 0.375; fKmiddleT[2] = 0.725;
803 }
804 // 2x1 (Kt: 0-0.35, 0.35-1.0)
805 if(fKbinsT==2){
806 fKstepT[0] = 0.35; fKstepT[1] = 0.65;
807 fKmeanT[0] = 0.264; fKmeanT[1] = 0.500;
808 fKmiddleT[0] = 0.175; fKmiddleT[1] = 0.675;
809 }
810
811 //
812 fQupperBoundWeights = 0.2;
813 fQupperBoundQ2 = 2.0;
5591748e 814 fQupperBoundQ3 = 0.6;
815 fQupperBoundQ4 = 0.6;
be9ef9f9 816 fQbinsQ2 = fQupperBoundQ2/0.005;
817 fQbinsQ3 = fQupperBoundQ3/0.005;
818 fQbinsQ4 = fQupperBoundQ4/0.005;
819 fQstepWeights = fQupperBoundWeights/Float_t(kQbinsWeights);
820 for(Int_t i=0; i<kQbinsWeights; i++) {fQmean[i]=(i+0.5)*fQstepWeights;}
821 //
822 fDampStart = 0.5;// was 0.3, then 0.5
823 fDampStep = 0.02;
824
825 //
be9ef9f9 826
827 fEC = new AliFourPionEventCollection **[fZvertexBins];
828 for(UShort_t i=0; i<fZvertexBins; i++){
829
0207c034 830 fEC[i] = new AliFourPionEventCollection *[fMbinsMixing];
be9ef9f9 831
0207c034 832 for(UShort_t j=0; j<fMbinsMixing; j++){
be9ef9f9 833
834 fEC[i][j] = new AliFourPionEventCollection(fEventsToMix+1, fMultLimit, kMCarrayLimit, fMCcase);
835 }
836 }
837
b71263d0 838 for(Int_t i=0; i<kMultLimitPbPb; i++) fDefaultsCharSwitch[i]='0';
839 for(Int_t i=0; i<kMultLimitPbPb; i++) {
840 fLowQPairSwitch_E0E0[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
841 fLowQPairSwitch_E0E1[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
842 fLowQPairSwitch_E0E2[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
843 fLowQPairSwitch_E0E3[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
6bb6954b 844 fLowQPairSwitch_E1E1[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
b71263d0 845 fLowQPairSwitch_E1E2[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
846 fLowQPairSwitch_E1E3[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
847 fLowQPairSwitch_E2E3[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
848 //
849 fNormQPairSwitch_E0E0[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
850 fNormQPairSwitch_E0E1[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
851 fNormQPairSwitch_E0E2[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
852 fNormQPairSwitch_E0E3[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
6bb6954b 853 fNormQPairSwitch_E1E1[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
b71263d0 854 fNormQPairSwitch_E1E2[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
855 fNormQPairSwitch_E1E3[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
856 fNormQPairSwitch_E2E3[i] = new TArrayC(kMultLimitPbPb,fDefaultsCharSwitch);
857 }
be9ef9f9 858
859 fTempStruct = new AliFourPionTrackStruct[fMultLimit];
b71263d0 860
861
be9ef9f9 862 fTrueMassP=0.93827, fTrueMassPi=0.13957, fTrueMassK=0.493677, fTrueMassKs=0.497614, fTrueMassLam=1.11568;
863
864
865
866 // Set weights, Coulomb corrections, and Momentum resolution corrections manually if not on LEGO
867 if(!fLEGO) {
868 SetFSICorrelations(fLEGO);// Read in 2-particle and 3-particle FSI correlations
869 if(!fTabulatePairs) SetWeightArrays(fLEGO);// Set Weight Array
870 if(!fMCcase && !fTabulatePairs) SetMomResCorrections(fLEGO);// Read Momentum resolution file
5591748e 871 if(!fMCcase && !fTabulatePairs) SetMuonCorrections(fLEGO);// Read Muon corrections
be9ef9f9 872 }
873
874 /////////////////////////////////////////////
875 /////////////////////////////////////////////
876
877}
878//________________________________________________________________________
879void AliFourPion::UserCreateOutputObjects()
880{
881 // Create histograms
882 // Called once
883
884 ParInit();// Initialize my settings
885
886
887 fOutputList = new TList();
888 fOutputList->SetOwner();
889
890 TH3F *fVertexDist = new TH3F("fVertexDist","Vertex Distribution",20,-1,1, 20,-1,1, 600,-30,30);
891 fVertexDist->GetXaxis()->SetTitle("X Vertex (cm)");
892 fVertexDist->GetYaxis()->SetTitle("Y Vertex (cm)");
893 fVertexDist->GetZaxis()->SetTitle("Z Vertex (cm)");
894 fOutputList->Add(fVertexDist);
895
896
897 TH2F *fDCAxyDistPlus = new TH2F("fDCAxyDistPlus","DCA distribution",300,0,3., 50,0,5);
898 fOutputList->Add(fDCAxyDistPlus);
899 TH2F *fDCAzDistPlus = new TH2F("fDCAzDistPlus","DCA distribution",300,0,3., 50,0,5);
900 fOutputList->Add(fDCAzDistPlus);
901 TH2F *fDCAxyDistMinus = new TH2F("fDCAxyDistMinus","DCA distribution",300,0,3., 50,0,5);
902 fOutputList->Add(fDCAxyDistMinus);
903 TH2F *fDCAzDistMinus = new TH2F("fDCAzDistMinus","DCA distribution",300,0,3., 50,0,5);
904 fOutputList->Add(fDCAzDistMinus);
905
906
907 TH1F *fEvents1 = new TH1F("fEvents1","Events vs. fMbin",fMbins,.5,fMbins+.5);
908 fOutputList->Add(fEvents1);
909 TH1F *fEvents2 = new TH1F("fEvents2","Events vs. fMbin",fMbins,.5,fMbins+.5);
910 fOutputList->Add(fEvents2);
911
912 TH1F *fMultDist0 = new TH1F("fMultDist0","Multiplicity Distribution",fMultLimit,-.5,fMultLimit-.5);
913 fMultDist0->GetXaxis()->SetTitle("Multiplicity");
914 fOutputList->Add(fMultDist0);
915
916 TH1F *fMultDist1 = new TH1F("fMultDist1","Multiplicity Distribution",fMultLimit,-.5,fMultLimit-.5);
917 fMultDist1->GetXaxis()->SetTitle("Multiplicity");
918 fOutputList->Add(fMultDist1);
919
920 TH1F *fMultDist2 = new TH1F("fMultDist2","Multiplicity Distribution",fMultLimit,-.5,fMultLimit-.5);
921 fMultDist2->GetXaxis()->SetTitle("Multiplicity");
922 fOutputList->Add(fMultDist2);
923
924 TH1F *fMultDist3 = new TH1F("fMultDist3","Multiplicity Distribution",fMultLimit,-.5,fMultLimit-.5);
925 fMultDist3->GetXaxis()->SetTitle("Multiplicity");
926 fOutputList->Add(fMultDist3);
927
0207c034 928 TH3F *fChPtEtaDist = new TH3F("fChPtEtaDist","fChPtEtaDist",2,-1.1,1.1, 300,0,3., 28,-1.4,1.4);
929 fOutputList->Add(fChPtEtaDist);
930 TH3F *fChPhiPtDist = new TH3F("fChPhiPtDist","fChPhiPtDist",2,-1.1,1.1, 120,0,2*PI, 300,0,3.);
931 fOutputList->Add(fChPhiPtDist);
be9ef9f9 932
0207c034 933 TH2F *fCentEtaDist = new TH2F("fCentEtaDist","",10,-.5,9.5, 28,-1.4,1.4);
934 fOutputList->Add(fCentEtaDist);
935 TH2F *fCentPtDist = new TH2F("fCentPtDist","",10,-.5,9.5, 600,0,3.);
936 fOutputList->Add(fCentPtDist);
937
be9ef9f9 938 TH3F *fTOFResponse = new TH3F("fTOFResponse","TOF relative time",20,0,100, 200,0,2, 4000,-20000,20000);
939 fOutputList->Add(fTOFResponse);
940 TH3F *fTPCResponse = new TH3F("fTPCResponse","TPCsignal",20,0,100, 200,0,2, 1000,0,1000);
941 fOutputList->Add(fTPCResponse);
942
fac2d84b 943 TH1F *fRejectedPairs = new TH1F("fRejectedPairs","",400,0,2);
be9ef9f9 944 fOutputList->Add(fRejectedPairs);
fac2d84b 945 TH1F *fRejectedPairsWeighting = new TH1F("fAcceptedPairsWeighting","",400,0,2);
946 fOutputList->Add(fRejectedPairsWeighting);
947 TH1F *fTotalPairsWeighting = new TH1F("fTotalPairsWeighting","",400,0,2);
948 fOutputList->Add(fTotalPairsWeighting);
949 //
950 TH1F *fRejectedPairsMC = new TH1F("fRejectedPairsMC","",400,0,2);
951 fOutputList->Add(fRejectedPairsMC);
952 TH1F *fRejectedPairsWeightingMC = new TH1F("fAcceptedPairsWeightingMC","",400,0,2);
953 fOutputList->Add(fRejectedPairsWeightingMC);
954 TH1F *fTotalPairsWeightingMC = new TH1F("fTotalPairsWeightingMC","",400,0,2);
955 fOutputList->Add(fTotalPairsWeightingMC);
956
be9ef9f9 957 TH1I *fRejectedEvents = new TH1I("fRejectedEvents","",fMbins,0.5,fMbins+.5);
958 fOutputList->Add(fRejectedEvents);
fac2d84b 959
be9ef9f9 960 TH3F *fPairsDetaDPhiNum = new TH3F("fPairsDetaDPhiNum","",10,-.5,9.5, 200,-0.2,0.2, 600,-0.3,0.3);
961 if(fMCcase) fOutputList->Add(fPairsDetaDPhiNum);
962 TH3F *fPairsDetaDPhiDen = new TH3F("fPairsDetaDPhiDen","",10,-.5,9.5, 200,-0.2,0.2, 600,-0.3,0.3);
963 if(fMCcase) fOutputList->Add(fPairsDetaDPhiDen);
964 TH3F *fPairsShareFracDPhiNum = new TH3F("fPairsShareFracDPhiNum","",10,-.5,9.5, 159,0,1, 600,-0.3,0.3);
965 if(fMCcase) fOutputList->Add(fPairsShareFracDPhiNum);
966 TH3F *fPairsShareFracDPhiDen = new TH3F("fPairsShareFracDPhiDen","",10,-.5,9.5, 159,0,1, 600,-0.3,0.3);
967 if(fMCcase) fOutputList->Add(fPairsShareFracDPhiDen);
968 TH3D* fPairsPadRowNum = new TH3D("fPairsPadRowNum","", 20,0,1, 159,0,1, 40,0,0.2);
969 if(fMCcase) fOutputList->Add(fPairsPadRowNum);
970 TH3D* fPairsPadRowDen = new TH3D("fPairsPadRowDen","", 20,0,1, 159,0,1, 40,0,0.2);
971 if(fMCcase) fOutputList->Add(fPairsPadRowDen);
972
973
974
975 TH2D *fResonanceOSPairs = new TH2D("fResonanceOSPairs","",fMbins,.5,fMbins+.5, 1000,0,2);
976 if(fMCcase) fOutputList->Add(fResonanceOSPairs);
977 TH2D *fAllOSPairs = new TH2D("fAllOSPairs","",fMbins,.5,fMbins+.5, 1000,0,2);
978 if(fMCcase) fOutputList->Add(fAllOSPairs);
979
980 TH3D *fPrimarySCPionPairs = new TH3D("fPrimarySCPionPairs","",fMbins,.5,fMbins+.5, 20,0,1, 20,0,0.2);
981 if(fMCcase) fOutputList->Add(fPrimarySCPionPairs);
982 TH3D *fAllSCPionPairs = new TH3D("fAllSCPionPairs","",fMbins,.5,fMbins+.5, 20,0,1, 20,0,0.2);
983 if(fMCcase) fOutputList->Add(fAllSCPionPairs);
984 TH3D *fPrimaryMCPionPairs = new TH3D("fPrimaryMCPionPairs","",fMbins,.5,fMbins+.5, 20,0,1, 20,0,0.2);
985 if(fMCcase) fOutputList->Add(fPrimaryMCPionPairs);
986 TH3D *fAllMCPionPairs = new TH3D("fAllMCPionPairs","",fMbins,.5,fMbins+.5, 20,0,1, 20,0,0.2);
987 if(fMCcase) fOutputList->Add(fAllMCPionPairs);
988
989 //
990 TH1D *fMuonParents = new TH1D("fMuonParents","",500,0.5,500.5);
991 if(fMCcase) fOutputList->Add(fMuonParents);
992 TH1D *fSecondaryMuonParents = new TH1D("fSecondaryMuonParents","",500,0.5,500.5);
993 if(fMCcase) fOutputList->Add(fSecondaryMuonParents);
994 TH3D *fMuonPionDeltaQinv = new TH3D("fMuonPionDeltaQinv","",2,-0.5,1.5, 20,0,1, 100,-0.2,0.2);
995 if(fMCcase) fOutputList->Add(fMuonPionDeltaQinv);
996 TH1D *fPionCandidates = new TH1D("fPionCandidates","",500,0.5,500.5);
997 if(fMCcase) fOutputList->Add(fPionCandidates);
998 //
999
1000
1001 TProfile *fAvgMult = new TProfile("fAvgMult","",fMbins,.5,fMbins+.5, 0,1500,"");
1002 fOutputList->Add(fAvgMult);
1003
1004 TH2D *fTrackChi2NDF = new TH2D("fTrackChi2NDF","",20,0,100, 100,0,10);
1005 fOutputList->Add(fTrackChi2NDF);
1006 TH2D *fTrackTPCncls = new TH2D("fTrackTPCncls","",20,0,100, 110,50,160);
1007 fOutputList->Add(fTrackTPCncls);
1008
1009
1010 TH1D *fTPNRejects3pion1 = new TH1D("fTPNRejects3pion1","",fQbinsQ3,0,fQupperBoundQ3);
1011 fOutputList->Add(fTPNRejects3pion1);
1012 TH1D *fTPNRejects3pion2 = new TH1D("fTPNRejects3pion2","",fQbinsQ3,0,fQupperBoundQ3);
1013 fOutputList->Add(fTPNRejects3pion2);
1014 TH1D *fTPNRejects4pion1 = new TH1D("fTPNRejects4pion1","",fQbinsQ4,0,fQupperBoundQ4);
1015 fOutputList->Add(fTPNRejects4pion1);
1016
1017 TH3D *fKT3DistTerm1 = new TH3D("fKT3DistTerm1","",fMbins,.5,fMbins+.5, 20,0,1, 20,0,0.2);
1018 TH3D *fKT3DistTerm5 = new TH3D("fKT3DistTerm5","",fMbins,.5,fMbins+.5, 20,0,1, 20,0,0.2);
1019 fOutputList->Add(fKT3DistTerm1);
1020 fOutputList->Add(fKT3DistTerm5);
1021 TH3D *fKT4DistTerm1 = new TH3D("fKT4DistTerm1","",fMbins,.5,fMbins+.5, 20,0,1, 20,0,0.2);
6bb6954b 1022 TH3D *fKT4DistTerm13 = new TH3D("fKT4DistTerm13","",fMbins,.5,fMbins+.5, 20,0,1, 20,0,0.2);
be9ef9f9 1023 fOutputList->Add(fKT4DistTerm1);
6bb6954b 1024 fOutputList->Add(fKT4DistTerm13);
be9ef9f9 1025
1026
1027 TProfile2D *fKT3AvgpT = new TProfile2D("fKT3AvgpT","",fMbins,.5,fMbins+.5, 2,-0.5,1.5, 0.,1.0,"");
1028 fOutputList->Add(fKT3AvgpT);
1029 TProfile2D *fKT4AvgpT = new TProfile2D("fKT4AvgpT","",fMbins,.5,fMbins+.5, 2,-0.5,1.5, 0.,1.0,"");
1030 fOutputList->Add(fKT4AvgpT);
4bf06935 1031 TH3D* fQ3AvgpTENsum0 = new TH3D("fQ3AvgpTENsum0","", 2,-0.5,1.5, fQbinsQ3,0,fQupperBoundQ3, 180,0.1,1.0);
1032 fOutputList->Add(fQ3AvgpTENsum0);
1033 TH3D* fQ3AvgpTENsum3 = new TH3D("fQ3AvgpTENsum3","", 2,-0.5,1.5, fQbinsQ3,0,fQupperBoundQ3, 180,0.1,1.0);
1034 fOutputList->Add(fQ3AvgpTENsum3);
1035 TH3D* fQ3AvgpTENsum6 = new TH3D("fQ3AvgpTENsum6","", 2,-0.5,1.5, fQbinsQ3,0,fQupperBoundQ3, 180,0.1,1.0);
1036 fOutputList->Add(fQ3AvgpTENsum6);
1037 //
1038 TH3D* fQ4AvgpTENsum0 = new TH3D("fQ4AvgpTENsum0","", 2,-0.5,1.5, fQbinsQ4,0,fQupperBoundQ4, 180,0.1,1.0);
1039 fOutputList->Add(fQ4AvgpTENsum0);
1040 TH3D* fQ4AvgpTENsum1 = new TH3D("fQ4AvgpTENsum1","", 2,-0.5,1.5, fQbinsQ4,0,fQupperBoundQ4, 180,0.1,1.0);
1041 fOutputList->Add(fQ4AvgpTENsum1);
1042 TH3D* fQ4AvgpTENsum2 = new TH3D("fQ4AvgpTENsum2","", 2,-0.5,1.5, fQbinsQ4,0,fQupperBoundQ4, 180,0.1,1.0);
1043 fOutputList->Add(fQ4AvgpTENsum2);
1044 TH3D* fQ4AvgpTENsum3 = new TH3D("fQ4AvgpTENsum3","", 2,-0.5,1.5, fQbinsQ4,0,fQupperBoundQ4, 180,0.1,1.0);
1045 fOutputList->Add(fQ4AvgpTENsum3);
1046 TH3D* fQ4AvgpTENsum6 = new TH3D("fQ4AvgpTENsum6","", 2,-0.5,1.5, fQbinsQ4,0,fQupperBoundQ4, 180,0.1,1.0);
1047 fOutputList->Add(fQ4AvgpTENsum6);
be9ef9f9 1048
1049 TH1D *fMCWeight3DTerm1SC = new TH1D("fMCWeight3DTerm1SC","", 20,0,0.2);
1050 TH1D *fMCWeight3DTerm1SCden = new TH1D("fMCWeight3DTerm1SCden","", 20,0,0.2);
1051 TH1D *fMCWeight3DTerm2SC = new TH1D("fMCWeight3DTerm2SC","", 20,0,0.2);
1052 TH1D *fMCWeight3DTerm2SCden = new TH1D("fMCWeight3DTerm2SCden","", 20,0,0.2);
1053 TH1D *fMCWeight3DTerm1MC = new TH1D("fMCWeight3DTerm1MC","", 20,0,0.2);
1054 TH1D *fMCWeight3DTerm1MCden = new TH1D("fMCWeight3DTerm1MCden","", 20,0,0.2);
1055 TH1D *fMCWeight3DTerm2MC = new TH1D("fMCWeight3DTerm2MC","", 20,0,0.2);
1056 TH1D *fMCWeight3DTerm2MCden = new TH1D("fMCWeight3DTerm2MCden","", 20,0,0.2);
1057 TH1D *fMCWeight3DTerm3MC = new TH1D("fMCWeight3DTerm3MC","", 20,0,0.2);
1058 TH1D *fMCWeight3DTerm3MCden = new TH1D("fMCWeight3DTerm3MCden","", 20,0,0.2);
1059 TH1D *fMCWeight3DTerm4MC = new TH1D("fMCWeight3DTerm4MC","", 20,0,0.2);
1060 TH1D *fMCWeight3DTerm4MCden = new TH1D("fMCWeight3DTerm4MCden","", 20,0,0.2);
1061 fOutputList->Add(fMCWeight3DTerm1SC);
1062 fOutputList->Add(fMCWeight3DTerm1SCden);
1063 fOutputList->Add(fMCWeight3DTerm2SC);
1064 fOutputList->Add(fMCWeight3DTerm2SCden);
1065 fOutputList->Add(fMCWeight3DTerm1MC);
1066 fOutputList->Add(fMCWeight3DTerm1MCden);
1067 fOutputList->Add(fMCWeight3DTerm2MC);
1068 fOutputList->Add(fMCWeight3DTerm2MCden);
1069 fOutputList->Add(fMCWeight3DTerm3MC);
1070 fOutputList->Add(fMCWeight3DTerm3MCden);
1071 fOutputList->Add(fMCWeight3DTerm4MC);
1072 fOutputList->Add(fMCWeight3DTerm4MCden);
1073
1074
6432c081 1075
1076 for(Int_t mb=0; mb<fMbins; mb++){
0207c034 1077 if(fPbPbcase) {if((mb < fCentBinLowLimit) || (mb > fCentBinHighLimit)) continue;}
be9ef9f9 1078
6432c081 1079 for(Int_t edB=0; edB<fEDbins; edB++){
1080 for(Int_t c1=0; c1<2; c1++){
1081 for(Int_t c2=0; c2<2; c2++){
1082 for(Int_t term=0; term<2; term++){
1083
1084 TString *nameEx2 = new TString("TwoParticle_Charge1_");
1085 *nameEx2 += c1;
1086 nameEx2->Append("_Charge2_");
1087 *nameEx2 += c2;
1088 nameEx2->Append("_M_");
1089 *nameEx2 += mb;
1090 nameEx2->Append("_ED_");
1091 *nameEx2 += edB;
1092 nameEx2->Append("_Term_");
1093 *nameEx2 += term+1;
1094
1095 if( (c1+c2)==1 ) {if(c1!=0) continue;}// skip degenerate histogram
1096
1097
1098 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fTerms2 = new TH2D(nameEx2->Data(),"Two Particle Distribution",20,0,1, fQbinsQ2,0,fQupperBoundQ2);
1099 fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fTerms2);
1100 TString *nameEx2QW=new TString(nameEx2->Data());
1101 nameEx2QW->Append("_QW");
1102 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fTerms2QW = new TH2D(nameEx2QW->Data(),"Two Particle Distribution",20,0,1, fQbinsQ2,0,fQupperBoundQ2);
1103 fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fTerms2QW);
1104 TString *nameAvgP=new TString(nameEx2->Data());
1105 nameAvgP->Append("_AvgP");
1106 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fAvgP = new TProfile2D(nameAvgP->Data(),"",10,0,1, fQbinsQ2,0,fQupperBoundQ2, 0.,1.0,"");
1107 fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fAvgP);
1108
1109 TString *nameUnitMult=new TString(nameEx2->Data());
1110 nameUnitMult->Append("_UnitMult");
1111 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fUnitMultBin = new TH2D(nameUnitMult->Data(),"Two Particle Distribution",21,0.5,21.5, fQbinsQ2,0,fQupperBoundQ2);
1112 fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fUnitMultBin);
1113
1114 if(fMCcase){
1115 // Momentum resolution histos
1116 TString *nameIdeal = new TString(nameEx2->Data());
1117 nameIdeal->Append("_Ideal");
1118 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fIdeal = new TH2D(nameIdeal->Data(),"Two Particle Distribution",11,0.5,11.5, fQbinsQ2,0,fQupperBoundQ2);
1119 if(mb==0) fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fIdeal);
1120 TString *nameSmeared = new TString(nameEx2->Data());
1121 nameSmeared->Append("_Smeared");
1122 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fSmeared = new TH2D(nameSmeared->Data(),"Two Particle Distribution",11,0.5,11.5, fQbinsQ2,0,fQupperBoundQ2);
1123 if(mb==0) fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fSmeared);
1124 //
1125 // Muon correction histos
1126 TString *nameMuonIdeal=new TString(nameEx2->Data());
1127 nameMuonIdeal->Append("_MuonIdeal");
1128 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMuonIdeal = new TH2D(nameMuonIdeal->Data(),"", 11,0.5,11.5, fQbinsQ2,0,fQupperBoundQ2);
1129 if(mb==0 && edB==0) fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMuonIdeal);
1130 TString *nameMuonSmeared=new TString(nameEx2->Data());
1131 nameMuonSmeared->Append("_MuonSmeared");
1132 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMuonSmeared = new TH2D(nameMuonSmeared->Data(),"", 11,0.5,11.5, fQbinsQ2,0,fQupperBoundQ2);
1133 if(mb==0 && edB==0) fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMuonSmeared);
1134 //
1135 TString *nameMuonPionK2=new TString(nameEx2->Data());
1136 nameMuonPionK2->Append("_MuonPionK2");
1137 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMuonPionK2 = new TH2D(nameMuonPionK2->Data(),"", 11,0.5,11.5, fQbinsQ2,0,fQupperBoundQ2);
1138 if(mb==0 && edB==0) fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMuonPionK2);
1139 //
1140 TString *namePionPionK2=new TString(nameEx2->Data());
1141 namePionPionK2->Append("_PionPionK2");
1142 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fPionPionK2 = new TH2D(namePionPionK2->Data(),"", 11,0.5,11.5, fQbinsQ2,0,fQupperBoundQ2);
1143 if(mb==0 && edB==0) fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fPionPionK2);
1144 //
1145 //
1146 TString *nameEx2MC=new TString(nameEx2->Data());
1147 nameEx2MC->Append("_MCqinv");
1148 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMCqinv = new TH1D(nameEx2MC->Data(),"", fQbinsQ2,0,fQupperBoundQ2);
1149 fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMCqinv);
1150 TString *nameEx2MCQW=new TString(nameEx2->Data());
1151 nameEx2MCQW->Append("_MCqinvQW");
1152 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMCqinvQW = new TH1D(nameEx2MCQW->Data(),"", fQbinsQ2,0,fQupperBoundQ2);
1153 fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fMCqinvQW);
1154 //
1155 TString *nameEx2PIDpurityDen=new TString(nameEx2->Data());
1156 nameEx2PIDpurityDen->Append("_PIDpurityDen");
1157 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fPIDpurityDen = new TH2D(nameEx2PIDpurityDen->Data(),"Two Particle Distribution",20,0,1, fQbinsQ2,0,fQupperBoundQ2);
1158 fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fPIDpurityDen);
1159 TString *nameEx2PIDpurityNum=new TString(nameEx2->Data());
1160 nameEx2PIDpurityNum->Append("_PIDpurityNum");
1161 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fPIDpurityNum = new TH3D(nameEx2PIDpurityNum->Data(),"Two Particle Distribution",16,0.5,16.5, 20,0,1, fQbinsQ2,0,fQupperBoundQ2);
1162 fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].fPIDpurityNum);
1163 }
1164 TString *nameEx2OSLB1 = new TString(nameEx2->Data());
1165 nameEx2OSLB1->Append("_osl_b1");
1166 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSL = new TH3D(nameEx2OSLB1->Data(),"Two Particle Distribution",kQbinsWeights,0,fQupperBoundWeights, kQbinsWeights,0,fQupperBoundWeights, kQbinsWeights,0,fQupperBoundWeights);
1167 fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSL);
1168 nameEx2OSLB1->Append("_QW");
1169 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSLQW = new TH3D(nameEx2OSLB1->Data(),"Two Particle Distribution",kQbinsWeights,0,fQupperBoundWeights, kQbinsWeights,0,fQupperBoundWeights, kQbinsWeights,0,fQupperBoundWeights);
1170 fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[0].fTerms2OSLQW);
1171 //
1172 TString *nameEx2OSLB2 = new TString(nameEx2->Data());
1173 nameEx2OSLB2->Append("_osl_b2");
1174 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[1].fTerms2OSL = new TH3D(nameEx2OSLB2->Data(),"Two Particle Distribution",kQbinsWeights,0,fQupperBoundWeights, kQbinsWeights,0,fQupperBoundWeights, kQbinsWeights,0,fQupperBoundWeights);
1175 fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[1].fTerms2OSL);
1176 nameEx2OSLB2->Append("_QW");
1177 Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[1].fTerms2OSLQW = new TH3D(nameEx2OSLB2->Data(),"Two Particle Distribution",kQbinsWeights,0,fQupperBoundWeights, kQbinsWeights,0,fQupperBoundWeights, kQbinsWeights,0,fQupperBoundWeights);
1178 fOutputList->Add(Charge1[c1].Charge2[c2].MB[mb].EDB[edB].TwoPT[term].OSL_ktbin[1].fTerms2OSLQW);
1179
1180 }// term_2
1181
1182
1183
1184 // skip 3-particle if Tabulate6DPairs is true
1185 if(fTabulatePairs) continue;
1186
1187 for(Int_t c3=0; c3<2; c3++){
1188 for(Int_t term=0; term<5; term++){
be9ef9f9 1189
6432c081 1190 TString *namePC3 = new TString("ThreeParticle_Charge1_");
1191 *namePC3 += c1;
1192 namePC3->Append("_Charge2_");
1193 *namePC3 += c2;
1194 namePC3->Append("_Charge3_");
1195 *namePC3 += c3;
1196 namePC3->Append("_M_");
1197 *namePC3 += mb;
1198 namePC3->Append("_ED_");
1199 *namePC3 += edB;
1200 namePC3->Append("_Term_");
1201 *namePC3 += term+1;
be9ef9f9 1202
6432c081 1203 ///////////////////////////////////////
1204 // skip degenerate histograms
1205 if( (c1+c2+c3)==1) {if(c3!=1) continue;}
1206 if( (c1+c2+c3)==2) {if(c1!=0) continue;}
1207 /////////////////////////////////////////
be9ef9f9 1208
be9ef9f9 1209
6432c081 1210 TString *nameNorm=new TString(namePC3->Data());
1211 nameNorm->Append("_Norm");
1212 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fNorm3 = new TH1D(nameNorm->Data(),"Norm",1,-0.5,0.5);
1213 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fNorm3);
1214 //
be9ef9f9 1215
6432c081 1216 TString *name1DQ=new TString(namePC3->Data());
1217 name1DQ->Append("_1D");
1218 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTerms3 = new TH1D(name1DQ->Data(),"", fQbinsQ3,0,fQupperBoundQ3);
1219 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTerms3);
1220 //
1221 TString *nameKfactor=new TString(namePC3->Data());
1222 nameKfactor->Append("_Kfactor");
1223 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fKfactor = new TProfile(nameKfactor->Data(),"", fQbinsQ3,0,fQupperBoundQ3, 0,100, "");
1224 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fKfactor);
1225 //
80507acf 1226 TString *nameKfactorW=new TString(namePC3->Data());
1227 nameKfactorW->Append("_KfactorWeighted");
1228 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fKfactorWeighted = new TProfile(nameKfactorW->Data(),"", fQbinsQ3,0,fQupperBoundQ3, 0,100, "");
1229 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fKfactorWeighted);
1230 //
6432c081 1231 TString *nameMeanQinv=new TString(namePC3->Data());
1232 nameMeanQinv->Append("_MeanQinv");
1233 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fMeanQinv = new TProfile(nameMeanQinv->Data(),"", fQbinsQ3,0,fQupperBoundQ3, 0,.2, "");
1234 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fMeanQinv);
1235
1236 if(fMCcase==kTRUE){
1237 // Momentum resolution correction histos
1238 TString *nameMomResIdeal=new TString(namePC3->Data());
1239 nameMomResIdeal->Append("_Ideal");
1240 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fIdeal = new TH2D(nameMomResIdeal->Data(),"", 11,0.5,11.5, fQbinsQ3,0,fQupperBoundQ3);
1241 if(mb==0) fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fIdeal);
1242 TString *nameMomResSmeared=new TString(namePC3->Data());
1243 nameMomResSmeared->Append("_Smeared");
1244 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fSmeared = new TH2D(nameMomResSmeared->Data(),"", 11,0.5,11.5, fQbinsQ3,0,fQupperBoundQ3);
1245 if(mb==0) fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fSmeared);
be9ef9f9 1246 // Muon correction histos
6432c081 1247 TString *nameMuonIdeal=new TString(namePC3->Data());
be9ef9f9 1248 nameMuonIdeal->Append("_MuonIdeal");
6432c081 1249 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fMuonIdeal = new TH3D(nameMuonIdeal->Data(),"", 2,0.5,2.5, 11,0.5,11.5, fQbinsQ3,0,fQupperBoundQ3);
1250 if(mb==0 && edB==0 && term<4) fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fMuonIdeal);
1251 TString *nameMuonSmeared=new TString(namePC3->Data());
be9ef9f9 1252 nameMuonSmeared->Append("_MuonSmeared");
6432c081 1253 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fMuonSmeared = new TH3D(nameMuonSmeared->Data(),"", 2,0.5,2.5, 11,0.5,11.5, fQbinsQ3,0,fQupperBoundQ3);
1254 if(mb==0 && edB==0 && term<4) fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fMuonSmeared);
be9ef9f9 1255 //
6432c081 1256 TString *nameMuonPionK3=new TString(namePC3->Data());
1257 nameMuonPionK3->Append("_MuonPionK3");
1258 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fMuonPionK3 = new TH3D(nameMuonPionK3->Data(),"", 2,0.5,2.5, 11,0.5,11.5, fQbinsQ3,0,fQupperBoundQ3);
1259 if(mb==0 && edB==0 && term<4) fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fMuonPionK3);
be9ef9f9 1260 //
6432c081 1261 TString *namePionPionK3=new TString(namePC3->Data());
1262 namePionPionK3->Append("_PionPionK3");
1263 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fPionPionK3 = new TH3D(namePionPionK3->Data(),"", 2,0.5,2.5, 11,0.5,11.5, fQbinsQ3,0,fQupperBoundQ3);
1264 if(mb==0 && edB==0 && term<4) fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fPionPionK3);
1265
1266 }// MCcase
1267 //
1268 if(c1==c2 && c1==c3 && term==4 ){
1269 TString *nameTwoPartNorm=new TString(namePC3->Data());
1270 nameTwoPartNorm->Append("_TwoPartNorm");
1271 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTwoPartNorm = new TH2D(nameTwoPartNorm->Data(),"", kDENtypes,0.5,kDENtypes+0.5, fQbinsQ3,0,fQupperBoundQ3);
1272 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTwoPartNorm);
be9ef9f9 1273 //
6432c081 1274 TString *nameTwoPartNegNorm=new TString(namePC3->Data());
1275 nameTwoPartNegNorm->Append("_TwoPartNegNorm");
1276 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTwoPartNegNorm = new TH2D(nameTwoPartNegNorm->Data(),"", kDENtypes,0.5,kDENtypes+0.5, fQbinsQ3,0,fQupperBoundQ3);
1277 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTwoPartNegNorm);
be9ef9f9 1278 //
6432c081 1279 TString *nameTwoPartNormErr=new TString(namePC3->Data());
1280 nameTwoPartNormErr->Append("_TwoPartNormErr");
1281 Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTwoPartNormErr = new TH2D(nameTwoPartNormErr->Data(),"", kDENtypes,0.5,kDENtypes+0.5, fQbinsQ3,0,fQupperBoundQ3);
1282 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].MB[mb].EDB[edB].ThreePT[term].fTwoPartNormErr);
1283 }// term=4
be9ef9f9 1284
6432c081 1285 }// term_3
be9ef9f9 1286
6432c081 1287 for(Int_t c4=0; c4<2; c4++){
1288 for(Int_t term=0; term<13; term++){
1289
1290 TString *namePC4 = new TString("FourParticle_Charge1_");
1291 *namePC4 += c1;
1292 namePC4->Append("_Charge2_");
1293 *namePC4 += c2;
1294 namePC4->Append("_Charge3_");
1295 *namePC4 += c3;
1296 namePC4->Append("_Charge4_");
1297 *namePC4 += c4;
1298 namePC4->Append("_M_");
1299 *namePC4 += mb;
1300 namePC4->Append("_ED_");
1301 *namePC4 += edB;
1302 namePC4->Append("_Term_");
1303 *namePC4 += term+1;
be9ef9f9 1304
1305 ///////////////////////////////////////
1306 // skip degenerate histograms
6432c081 1307 if( (c1+c2+c3+c4)==1) {if(c4!=1) continue;}
1308 if( (c1+c2+c3+c4)==2) {if(c3+c4!=2) continue;}
1309 if( (c1+c2+c3+c4)==3) {if(c1!=0) continue;}
be9ef9f9 1310 /////////////////////////////////////////
1311
6432c081 1312 TString *nameNorm=new TString(namePC4->Data());
be9ef9f9 1313 nameNorm->Append("_Norm");
6432c081 1314 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fNorm4 = new TH1D(nameNorm->Data(),"Norm",1,-0.5,0.5);
1315 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fNorm4);
be9ef9f9 1316 //
6432c081 1317 TString *name1DQ=new TString(namePC4->Data());
be9ef9f9 1318 name1DQ->Append("_1D");
6432c081 1319 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTerms4 = new TH1D(name1DQ->Data(),"", fQbinsQ4,0,fQupperBoundQ4);
1320 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTerms4);
be9ef9f9 1321 //
6432c081 1322 TString *nameKfactor=new TString(namePC4->Data());
be9ef9f9 1323 nameKfactor->Append("_Kfactor");
6432c081 1324 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fKfactor = new TProfile(nameKfactor->Data(),"", fQbinsQ4,0,fQupperBoundQ4, 0,100, "");
1325 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fKfactor);
be9ef9f9 1326 //
80507acf 1327 TString *nameKfactorW=new TString(namePC4->Data());
1328 nameKfactorW->Append("_KfactorWeighted");
1329 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fKfactorWeighted = new TProfile(nameKfactorW->Data(),"", fQbinsQ4,0,fQupperBoundQ4, 0,100, "");
1330 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fKfactorWeighted);
1331 //
6432c081 1332 if(c1==c2 && c1==c3 && c1==c4 && term==12 ){
1333 TString *nameTwoPartNorm=new TString(namePC4->Data());
1334 nameTwoPartNorm->Append("_TwoPartNorm");
1335 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTwoPartNorm = new TH2D(nameTwoPartNorm->Data(),"", kDENtypes,0.5,kDENtypes+0.5, fQbinsQ4,0,fQupperBoundQ4);
1336 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTwoPartNorm);
1337 //
1338 TString *nameTwoPartNegNorm=new TString(namePC4->Data());
1339 nameTwoPartNegNorm->Append("_TwoPartNegNorm");
1340 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTwoPartNegNorm = new TH2D(nameTwoPartNegNorm->Data(),"", kDENtypes,0.5,kDENtypes+0.5, fQbinsQ4,0,fQupperBoundQ4);
1341 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTwoPartNegNorm);
1342 //
1343 TString *nameTwoPartNormErr=new TString(namePC4->Data());
1344 nameTwoPartNormErr->Append("_TwoPartNormErr");
1345 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTwoPartNormErr = new TH2D(nameTwoPartNormErr->Data(),"", kDENtypes,0.5,kDENtypes+0.5, fQbinsQ4,0,fQupperBoundQ4);
1346 fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fTwoPartNormErr);
1347 }
be9ef9f9 1348
1349 if(fMCcase==kTRUE){
1350 // Momentum resolution correction histos
6432c081 1351 TString *nameMomResIdeal=new TString(namePC4->Data());
be9ef9f9 1352 nameMomResIdeal->Append("_Ideal");
6432c081 1353 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fIdeal = new TH2D(nameMomResIdeal->Data(),"", 11,0.5,11.5, fQbinsQ4,0,fQupperBoundQ4);
1354 if(mb==0) fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fIdeal);
1355 TString *nameMomResSmeared=new TString(namePC4->Data());
be9ef9f9 1356 nameMomResSmeared->Append("_Smeared");
6432c081 1357 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fSmeared = new TH2D(nameMomResSmeared->Data(),"", 11,0.5,11.5, fQbinsQ4,0,fQupperBoundQ4);
1358 if(mb==0) fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fSmeared);
be9ef9f9 1359 // Muon correction histos
6432c081 1360 TString *nameMuonIdeal=new TString(namePC4->Data());
be9ef9f9 1361 nameMuonIdeal->Append("_MuonIdeal");
6432c081 1362 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fMuonIdeal = new TH3D(nameMuonIdeal->Data(),"", 2,0.5,2.5, 11,0.5,11.5, fQbinsQ4,0,fQupperBoundQ4);
1363 if(mb==0 && edB==0 && term<12) fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fMuonIdeal);
1364 TString *nameMuonSmeared=new TString(namePC4->Data());
be9ef9f9 1365 nameMuonSmeared->Append("_MuonSmeared");
6432c081 1366 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fMuonSmeared = new TH3D(nameMuonSmeared->Data(),"", 2,0.5,2.5, 11,0.5,11.5, fQbinsQ4,0,fQupperBoundQ4);
1367 if(mb==0 && edB==0 && term<12) fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fMuonSmeared);
be9ef9f9 1368 //
6432c081 1369 TString *nameMuonPionK4=new TString(namePC4->Data());
1370 nameMuonPionK4->Append("_MuonPionK4");
1371 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fMuonPionK4 = new TH3D(nameMuonPionK4->Data(),"", 2,0.5,2.5, 11,0.5,11.5, fQbinsQ4,0,fQupperBoundQ4);
1372 if(mb==0 && edB==0 && term<12) fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fMuonPionK4);
be9ef9f9 1373 //
6432c081 1374 TString *namePionPionK4=new TString(namePC4->Data());
1375 namePionPionK4->Append("_PionPionK4");
1376 Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fPionPionK4 = new TH3D(namePionPionK4->Data(),"", 2,0.5,2.5, 11,0.5,11.5, fQbinsQ4,0,fQupperBoundQ4);
1377 if(mb==0 && edB==0 && term<12) fOutputList->Add(Charge1[c1].Charge2[c2].Charge3[c3].Charge4[c4].MB[mb].EDB[edB].FourPT[term].fPionPionK4);
be9ef9f9 1378
1379 }// MCcase
be9ef9f9 1380
6432c081 1381
be9ef9f9 1382 }
6432c081 1383 }
1384
1385 }//c3
1386 }//c2
1387 }//c1
1388 }// ED
1389 }// mbin
be9ef9f9 1390
be9ef9f9 1391
1392
1393 if(fTabulatePairs){
1394
1395 for(Int_t tKbin=0; tKbin<fKbinsT; tKbin++){
1396 for(Int_t yKbin=0; yKbin<fKbinsY; yKbin++){
1397 for(Int_t mb=0; mb<fMbins; mb++){
1398 for(Int_t edB=0; edB<fEDbins; edB++){
1399
1400 TString *nameNum = new TString("TPN_num_Kt_");
1401 *nameNum += tKbin;
1402 nameNum->Append("_Ky_");
1403 *nameNum += yKbin;
1404 nameNum->Append("_M_");
1405 *nameNum += mb;
1406 nameNum->Append("_ED_");
1407 *nameNum += edB;
1408
1409 TString *nameDen = new TString("TPN_den_Kt_");
1410 *nameDen += tKbin;
1411 nameDen->Append("_Ky_");
1412 *nameDen += yKbin;
1413 nameDen->Append("_M_");
1414 *nameDen += mb;
1415 nameDen->Append("_ED_");
1416 *nameDen += edB;
1417
1418 if(edB==0){
1419 KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[0].fTerms2ThreeD = new TH3D(nameNum->Data(),"", kQbinsWeights,0,fQupperBoundWeights, kQbinsWeights,0,fQupperBoundWeights, kQbinsWeights,0,fQupperBoundWeights);
1420 fOutputList->Add(KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[0].fTerms2ThreeD);
1421
1422 KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[1].fTerms2ThreeD = new TH3D(nameDen->Data(),"", kQbinsWeights,0,fQupperBoundWeights, kQbinsWeights,0,fQupperBoundWeights, kQbinsWeights,0,fQupperBoundWeights);
1423 fOutputList->Add(KT[tKbin].KY[yKbin].MB[mb].EDB[edB].TwoPT[1].fTerms2ThreeD);
1424 }
1425
1426 }
1427 }
1428 }
1429 }
1430
1431 }
1432
1433
1434 TProfile *fQsmearMean = new TProfile("fQsmearMean","",2,0.5,2.5, -0.2,0.2,"");
1435 fOutputList->Add(fQsmearMean);
1436 TProfile *fQsmearSq = new TProfile("fQsmearSq","",2,0.5,2.5, -2,2,"");
1437 fOutputList->Add(fQsmearSq);
1438 TH2D *fQ2Res = new TH2D("fQ2Res","",20,0,1, 200,-.2,.2);
1439 fOutputList->Add(fQ2Res);
1440 TH2D *fQ3Res = new TH2D("fQ3Res","",20,0,1, 200,-.3,.3);
1441 fOutputList->Add(fQ3Res);
1442 TH2D *fQ4Res = new TH2D("fQ4Res","",20,0,1, 200,-.4,.4);
1443 fOutputList->Add(fQ4Res);
1444
0207c034 1445 TH2D *DistQinv4pion = new TH2D("DistQinv4pion","",6,0.5,6.5, fQbinsQ2,0,fQupperBoundQ2);
be9ef9f9 1446 fOutputList->Add(DistQinv4pion);
0207c034 1447 TH2D *DistQinvMC4pion = new TH2D("DistQinvMC4pion","",6,0.5,6.5, fQbinsQ2,0,fQupperBoundQ2);
be9ef9f9 1448 if(fMCcase) fOutputList->Add(DistQinvMC4pion);
1449
0207c034 1450 TH2D *fAvgQ12VersusQ3 = new TH2D("fAvgQ12VersusQ3","",40,0,0.2, fQbinsQ3,0,fQupperBoundQ3);
be9ef9f9 1451 fOutputList->Add(fAvgQ12VersusQ3);
0207c034 1452 TH2D *fAvgQ13VersusQ3 = new TH2D("fAvgQ13VersusQ3","",40,0,0.2, fQbinsQ3,0,fQupperBoundQ3);
be9ef9f9 1453 fOutputList->Add(fAvgQ13VersusQ3);
0207c034 1454 TH2D *fAvgQ23VersusQ3 = new TH2D("fAvgQ23VersusQ3","",40,0,0.2, fQbinsQ3,0,fQupperBoundQ3);
be9ef9f9 1455 fOutputList->Add(fAvgQ23VersusQ3);
1456
5591748e 1457 TH1D *fDistPionParents4 = new TH1D("fDistPionParents4","",4,0.5,4.5);
1458 fOutputList->Add(fDistPionParents4);
1459
6432c081 1460 TH2D *fDistTPCNclsFindable = new TH2D("fDistTPCNclsFindable","", 100,0,0.5, 201,-0.5,200.5);
1461 fDistTPCNclsFindable->GetXaxis()->SetTitle("pT (GeV/c)"); fDistTPCNclsFindable->GetYaxis()->SetTitle("Ncls Findable");
1462 fOutputList->Add(fDistTPCNclsFindable);
1463 TProfile *fProfileTPCNclsFindable = new TProfile("fProfileTPCNclsFindable","",100,0,0.5, 0,200, "");
1464 fProfileTPCNclsFindable->GetXaxis()->SetTitle("pT (GeV/c)"); fProfileTPCNclsFindable->GetYaxis()->SetTitle("<Ncls Findable>");
1465 fOutputList->Add(fProfileTPCNclsFindable);
1466 //
1467 TH2D *fDistTPCNclsCrossed = new TH2D("fDistTPCNclsCrossed","",100,0,0.5, 201,-0.5,200.5);
1468 fDistTPCNclsCrossed->GetXaxis()->SetTitle("pT (GeV/c)"); fDistTPCNclsCrossed->GetYaxis()->SetTitle("Ncls Crossed");
1469 fOutputList->Add(fDistTPCNclsCrossed);
1470 TProfile *fProfileTPCNclsCrossed = new TProfile("fProfileTPCNclsCrossed","",100,0,0.5, 0,200, "");
1471 fProfileTPCNclsCrossed->GetXaxis()->SetTitle("pT (GeV/c)"); fProfileTPCNclsCrossed->GetYaxis()->SetTitle("<Ncls Crossed>");
1472 fOutputList->Add(fProfileTPCNclsCrossed);
1473 //
1474 TH2D *fDistTPCNclsFindableRatio = new TH2D("fDistTPCNclsFindableRatio","",100,0,0.5, 100,0,1);
1475 fDistTPCNclsFindableRatio->GetXaxis()->SetTitle("pT (GeV/c)"); fDistTPCNclsFindableRatio->GetYaxis()->SetTitle("Ncls / Ncls Findable");
1476 fOutputList->Add(fDistTPCNclsFindableRatio);
1477 TProfile *fProfileTPCNclsFindableRatio = new TProfile("fProfileTPCNclsFindableRatio","",100,0,0.5, 0,1, "");
1478 fProfileTPCNclsFindableRatio->GetXaxis()->SetTitle("pT (GeV/c)"); fProfileTPCNclsFindableRatio->GetYaxis()->SetTitle("<Ncls / Ncls Findable>");
1479 fOutputList->Add(fProfileTPCNclsFindableRatio);
1480 //
1481 TH2D *fDistTPCNclsCrossedRatio = new TH2D("fDistTPCNclsCrossedRatio","",100,0,0.5, 100,0,1);
1482 fDistTPCNclsCrossedRatio->GetXaxis()->SetTitle("pT (GeV/c)"); fDistTPCNclsCrossedRatio->GetYaxis()->SetTitle("Ncls / Ncls Crossed");
1483 fOutputList->Add(fDistTPCNclsCrossedRatio);
1484 TProfile *fProfileTPCNclsCrossedRatio = new TProfile("fProfileTPCNclsCrossedRatio","",100,0,0.5, 0,1, "");
1485 fProfileTPCNclsCrossedRatio->GetXaxis()->SetTitle("pT (GeV/c)"); fProfileTPCNclsCrossedRatio->GetYaxis()->SetTitle("<Ncls / Ncls Crossed>");
1486 fOutputList->Add(fProfileTPCNclsCrossedRatio);
1487
42802bba 1488 TH2D *fc4QSFitNum = new TH2D("fc4QSFitNum","",7,0.5,7.5, fQbinsQ4,0,fQupperBoundQ4);
1489 fOutputList->Add(fc4QSFitNum);
1490 TH2D *fc4QSFitDen = new TH2D("fc4QSFitDen","",7,0.5,7.5, fQbinsQ4,0,fQupperBoundQ4);
1491 fOutputList->Add(fc4QSFitDen);
1492
be9ef9f9 1493 ////////////////////////////////////
1494 ///////////////////////////////////
1495
1496 PostData(1, fOutputList);
1497}
1498
1499//________________________________________________________________________
1500void AliFourPion::UserExec(Option_t *)
1501{
1502 // Main loop
1503 // Called for each event
1504 //cout<<"=========== Event # "<<fEventCounter+1<<" ==========="<<endl;
1505 fEventCounter++;
0207c034 1506 if(fEventCounter%1000==0) cout<<"=========== Event # "<<fEventCounter<<" ==========="<<endl;
1507
be9ef9f9 1508 if(!fAODcase) {cout<<"ESDs not supported"<<endl; return;}
1509
1510 fAOD = dynamic_cast<AliAODEvent*> (InputEvent());
1511 if (!fAOD) {Printf("ERROR: fAOD not available"); return;}
1512
1513
1514 // Trigger Cut
1515 if(fAOD->GetRunNumber() >= 136851 && fAOD->GetRunNumber() <= 139517){// 10h data
1516 Bool_t isSelected1 = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
1517 if(!isSelected1 && !fMCcase) {return;}
1518 }else if(fAOD->GetRunNumber() >= 167693 && fAOD->GetRunNumber() <= 170593){// 11h data
1519 Bool_t isSelected1 = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kCentral);
1520 Bool_t isSelected2 = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kSemiCentral);
1521 if(!isSelected1 && !isSelected2 && !fMCcase) {return;}
0207c034 1522 }else {
1523 Bool_t isSelected[4]={kFALSE};
1524 isSelected[0] = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
1525 isSelected[1] = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kAny);
1526 isSelected[2] = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kINT7);
1527 isSelected[3] = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kHighMult);
1528 if(!isSelected[fTriggerType] && !fMCcase) return;
1529 }
1530
be9ef9f9 1531 ///////////////////////////////////////////////////////////
1532 const AliAODVertex *primaryVertexAOD;
1533 AliCentrality *centrality;// for AODs and ESDs
1534
1535
1536 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
1537 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
1538 fPIDResponse = inputHandler->GetPIDResponse();
1539
1540
1541 TClonesArray *mcArray = 0x0;
1542 if(fMCcase){
1543 if(fAODcase){
1544 mcArray = (TClonesArray*)fAOD->FindListObject(AliAODMCParticle::StdBranchName());
1545 if(!mcArray || mcArray->GetEntriesFast() >= kMCarrayLimit){
1546 cout<<"No MC particle branch found or Array too large!!"<<endl;
1547 return;
1548 }
1549 }
1550 }
1551
1552
1553 UInt_t status=0;
1554 Int_t positiveTracks=0, negativeTracks=0;
1555 Int_t myTracks=0, pionCount=0, kaonCount=0, protonCount=0;
1556
1557 Double_t vertex[3]={0};
1558 Int_t zbin=0;
1559 Double_t zstep=2*10/Double_t(fZvertexBins), zstart=-10.;
1560 /////////////////////////////////////////////////
4bf06935 1561 // ratio of Real data to HIJING reconstructed pT (10 MeV bins)
0207c034 1562 //Double_t HIJINGptWeights[100]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.590355, 0.672751, 0.795686, 0.848618, 0.861539, 0.874636, 0.880394, 0.87923, 0.885105, 0.888841, 0.892765, 0.896278, 0.899725, 0.903054, 0.907074, 0.91066, 0.913765, 0.918804, 0.923374, 0.929005, 0.935538, 0.942802, 0.949584, 0.956928, 0.963521, 0.972898, 0.981403, 0.989027, 0.997965, 1.00558, 1.01372, 1.02148, 1.03064, 1.04131, 1.05199, 1.06319, 1.07698, 1.09113, 1.10416, 1.11662, 1.12823, 1.14161, 1.15455, 1.1683, 1.18439, 1.19696, 1.21124, 1.22607, 1.24087, 1.25386, 1.26666, 1.27374, 1.2821, 1.29218, 1.30137, 1.30795, 1.31512, 1.32047, 1.32571, 1.33242, 1.3376, 1.34084, 1.34644, 1.34978, 1.35259, 1.35149, 1.35534, 1.3541, 1.35808, 1.36003, 1.35981, 1.36037, 1.35774, 1.35814, 1.35796, 1.35764, 1.35517, 1.34804, 1.34797, 1.33822, 1.32501, 1.30844, 1.2971, 1.27107};
1563 Float_t HIJINGq2WeightsSC[200]={0.72, 0.723886, 0.770856, 0.799396, 0.815821, 0.827209, 0.833142, 0.837393, 0.839721, 0.842022, 0.84374, 0.845376, 0.84732, 0.848803, 0.850515, 0.852089, 0.853712, 0.855571, 0.857279, 0.85894, 0.860671, 0.862479, 0.863945, 0.865519, 0.867301, 0.868955, 0.870215, 0.871652, 0.873089, 0.874289, 0.875633, 0.876694, 0.877712, 0.878681, 0.879694, 0.88073, 0.881459, 0.882039, 0.882761, 0.88334, 0.884004, 0.884455, 0.884816, 0.885327, 0.88556, 0.885997, 0.886291, 0.886526, 0.886975, 0.887374, 0.887712, 0.888016, 0.888627, 0.888971, 0.889295, 0.889845, 0.890088, 0.890599, 0.890893, 0.891363, 0.891598, 0.892019, 0.892141, 0.892256, 0.892372, 0.892276, 0.892012, 0.891801, 0.891554, 0.891267, 0.891074, 0.890822, 0.890737, 0.890768, 0.89081, 0.890987, 0.89124, 0.891499, 0.891887, 0.892403, 0.892978, 0.893485, 0.894214, 0.894858, 0.895669, 0.896584, 0.897447, 0.89844, 0.899375, 0.900527, 0.901568, 0.902717, 0.903952, 0.905128, 0.90645, 0.907729, 0.909055, 0.910516, 0.911916, 0.913396, 0.914911, 0.91645, 0.918067, 0.919725, 0.921435, 0.923185, 0.925044, 0.926784, 0.928747, 0.930641, 0.932574, 0.934767, 0.93666, 0.938805, 0.94098, 0.943166, 0.945492, 0.947778, 0.950146, 0.952474, 0.954981, 0.957334, 0.959891, 0.96247, 0.965063, 0.967719, 0.97025, 0.973033, 0.975868, 0.978622, 0.981536, 0.984275, 0.987362, 0.990211, 0.993284, 0.996277, 0.999363, 1.00251, 1.00555, 1.00883, 1.01209, 1.01519, 1.01853, 1.02184, 1.0252, 1.02866, 1.03206, 1.03545, 1.03881, 1.04227, 1.04569, 1.04914, 1.05259, 1.056, 1.05953, 1.063, 1.06652, 1.07005, 1.07353, 1.07719, 1.0808, 1.08426, 1.08763, 1.09136, 1.09486, 1.0985, 1.10199, 1.10562, 1.10933, 1.11293, 1.11628, 1.11992, 1.1236, 1.12736, 1.13088, 1.13448, 1.13815, 1.14168, 1.14537, 1.1489, 1.15255, 1.15629, 1.15981, 1.16349, 1.16699, 1.17076, 1.17445, 1.17833, 1.18188, 1.18551, 1.18928, 1.19318, 1.19691, 1.20059, 1.20455, 1.20817, 1.21199, 1.21609, 1.21977, 1.22367};
1564 Float_t HIJINGq2WeightsMC[200]={0.83, 0.833821, 0.834928, 0.836263, 0.837359, 0.83809, 0.838463, 0.840012, 0.840868, 0.842129, 0.843379, 0.844784, 0.846186, 0.847562, 0.849184, 0.850567, 0.85239, 0.854038, 0.855708, 0.857257, 0.859145, 0.860831, 0.862469, 0.864066, 0.865664, 0.867224, 0.868654, 0.870187, 0.871525, 0.872742, 0.874066, 0.875166, 0.876261, 0.877325, 0.878249, 0.879089, 0.879897, 0.880624, 0.881234, 0.881898, 0.88248, 0.882964, 0.883452, 0.883857, 0.884323, 0.884818, 0.885157, 0.885589, 0.88595, 0.886352, 0.886864, 0.887326, 0.887809, 0.888366, 0.888873, 0.889273, 0.889781, 0.890211, 0.890571, 0.891011, 0.891294, 0.891612, 0.891867, 0.892072, 0.89211, 0.891951, 0.891729, 0.891513, 0.891194, 0.890843, 0.89054, 0.890331, 0.890168, 0.890082, 0.890156, 0.890266, 0.890395, 0.890707, 0.891075, 0.891482, 0.891972, 0.89255, 0.893115, 0.893882, 0.89471, 0.895582, 0.896505, 0.897537, 0.898425, 0.89959, 0.900708, 0.901903, 0.903061, 0.904374, 0.905684, 0.907069, 0.908443, 0.909809, 0.911322, 0.912849, 0.914481, 0.916016, 0.917755, 0.919439, 0.921197, 0.922945, 0.924892, 0.926703, 0.928648, 0.930665, 0.932648, 0.934779, 0.936863, 0.939002, 0.941158, 0.943437, 0.945753, 0.948068, 0.950428, 0.952854, 0.955338, 0.957853, 0.960329, 0.962977, 0.965578, 0.968212, 0.970931, 0.97373, 0.97653, 0.979386, 0.982208, 0.985161, 0.988179, 0.991104, 0.994135, 0.997152, 1.00033, 1.00348, 1.00664, 1.00977, 1.01307, 1.01632, 1.01975, 1.02304, 1.02628, 1.02974, 1.03302, 1.03653, 1.03986, 1.04345, 1.04684, 1.05039, 1.05374, 1.05738, 1.06089, 1.06444, 1.06794, 1.07139, 1.07506, 1.07841, 1.08201, 1.08563, 1.08919, 1.09277, 1.09637, 1.10003, 1.10361, 1.10713, 1.11064, 1.11432, 1.11795, 1.12165, 1.12533, 1.1289, 1.13251, 1.13617, 1.13979, 1.1435, 1.14709, 1.15079, 1.15436, 1.15803, 1.16164, 1.16529, 1.1688, 1.17255, 1.17619, 1.17996, 1.18369, 1.18727, 1.19104, 1.19478, 1.1986, 1.20233, 1.20613, 1.20977, 1.21385, 1.21761, 1.22134, 1.22535};
1565 //
1566 Float_t HIJINGq3WeightsSC[35]={0.946, 0.946, 0.946171, 0.92177, 0.958284, 0.986155, 0.99244, 0.999372, 1.00152, 1.00427, 1.00328, 1.00546, 1.00546, 1.00628, 1.00586, 1.00446, 1.00496, 1.00427, 1.00413, 1.00354, 1.00322, 1.00266, 1.00158, 1.00123, 1.00048, 0.999826, 0.99901, 0.997586, 0.996728, 0.994507, 0.993044, 0.990995, 0.989289, 0.988248, 0.988455};
1567 Float_t HIJINGq3WeightsMC[35]={0.634, 0.63488, 0.963204, 0.977364, 0.992797, 1.00015, 1.00179, 1.00467, 1.00602, 1.00635, 1.00665, 1.00677, 1.00643, 1.00601, 1.00562, 1.00542, 1.00494, 1.0048, 1.00406, 1.0036, 1.00297, 1.0025, 1.00178, 1.00126, 1.00035, 0.999798, 0.998795, 0.997544, 0.996334, 0.994345, 0.992467, 0.991007, 0.988918, 0.9877, 0.98789};
1568 //
1569 Float_t HIJINGq4WeightsSC[50]={0.88, 0.88, 0.88, 0.88, 0.88, 0.88, 0.889957, 0.911624, 0.932747, 0.959097, 0.987571, 0.974175, 0.974291, 0.985743, 0.989953, 0.988542, 0.992858, 0.995232, 0.995808, 0.997182, 0.997073, 0.99795, 0.998597, 0.999141, 0.999598, 1.00026, 1.0002, 1.00061, 1.0003, 1.00054, 1.0006, 1.00082, 1.00094, 1.00092, 1.00058, 1.00036, 0.999695, 0.999366, 0.998782, 0.998301, 0.997107, 0.995746, 0.994276, 0.992814, 0.992403, 0.992536, 0.994614, 0.982908, 0.992077, .99};
1570 Float_t HIJINGq4WeightsMC1[50]={0.82, 0.82, 0.82, 0.82, 0.82, 0.823248, 0.917691, 0.960501, 0.96697, 0.972048, 0.984931, 0.98916, 0.986344, 0.992934, 0.996263, 0.996503, 0.996566, 0.997508, 0.998417, 0.999181, 0.999746, 0.999707, 1.00034, 1.00065, 1.00081, 1.00104, 1.0009, 1.00097, 1.00088, 1.00111, 1.00101, 1.00095, 1.00078, 1.00069, 1.00037, 1.00002, 0.999555, 0.998796, 0.998073, 0.997315, 0.9964, 0.994994, 0.993685, 0.990758, 0.990211, 0.987958, 0.980713, 0.985536, 0.923206, 0.92};
1571 Float_t HIJINGq4WeightsMC2[50]={0.88, 0.88, 0.88, 0.88, 0.885817, 0.9888, 1.00199, 0.974765, 0.987792, 0.989186, 0.984239, 0.991871, 0.992879, 0.995809, 0.997829, 0.998076, 0.998521, 0.998509, 0.999429, 0.999958, 1.00029, 1.00064, 1.00052, 1.00095, 1.00107, 1.00121, 1.0011, 1.00123, 1.00106, 1.00111, 1.00108, 1.00097, 1.00078, 1.00066, 1.00038, 0.999903, 0.99931, 0.998711, 0.997939, 0.997057, 0.99611, 0.994732, 0.993368, 0.991332, 0.989286, 0.987895, 0.983888, 0.986218, 0.945475, .94};
1572
be9ef9f9 1573
be9ef9f9 1574 Float_t centralityPercentile=0;
4bf06935 1575 Float_t cStep=5.0, cStepMixing=5.0, cStart=0;
12f1dc46 1576 Int_t MbinMixing=0;
be9ef9f9 1577
1578 if(fAODcase){// AOD case
1579
1580 if(fPbPbcase){
1581 centrality = fAOD->GetCentrality();
1582 centralityPercentile = centrality->GetCentralityPercentile("V0M");
1583 if(centralityPercentile == 0) {cout<<"Centrality = 0, skipping event"<<endl; return;}
1584 if((centralityPercentile < 5*fCentBinLowLimit) || (centralityPercentile>= 5*(fCentBinHighLimit+1))) {/*cout<<"Centrality out of Range. Skipping Event"<<endl;*/ return;}
1585 cout<<"Centrality % = "<<centralityPercentile<<endl;
1586 }
1587
b71263d0 1588
be9ef9f9 1589 ((TH1F*)fOutputList->FindObject("fMultDist0"))->Fill(fAOD->GetNumberOfTracks());
1590
1591 // Pile-up rejection
1592 AliAnalysisUtils *AnaUtil=new AliAnalysisUtils();
1593 if(!fPbPbcase) AnaUtil->SetUseMVPlpSelection(kTRUE);// use Multi-Vertex tool for pp and pPb
1594 else AnaUtil->SetUseMVPlpSelection(kFALSE);
1595 Bool_t pileUpCase=AnaUtil->IsPileUpEvent(fAOD);
1596 if(pileUpCase) return;
1597
1598 ////////////////////////////////
1599 // Vertexing
1600 ((TH1F*)fOutputList->FindObject("fMultDist1"))->Fill(fAOD->GetNumberOfTracks());
1601 primaryVertexAOD = fAOD->GetPrimaryVertex();
1602 vertex[0]=primaryVertexAOD->GetX(); vertex[1]=primaryVertexAOD->GetY(); vertex[2]=primaryVertexAOD->GetZ();
1603
0207c034 1604 if(fabs(vertex[2]) > 10) {/*cout<<"Zvertex Out of Range. Skip Event"<<endl;*/ return;} // Z-Vertex Cut
be9ef9f9 1605 ((TH3F*)fOutputList->FindObject("fVertexDist"))->Fill(vertex[0], vertex[1], vertex[2]);
1606
1607 if(!fMCcase && primaryVertexAOD->GetNContributors() < 1) {cout<<"Bad Vertex. Skip Event"<<endl; return;}
1608
1609 ((TH1F*)fOutputList->FindObject("fMultDist2"))->Fill(fAOD->GetNumberOfTracks());
1610
1611 fBfield = fAOD->GetMagneticField();
1612
1613 for(Int_t i=0; i<fZvertexBins; i++){
1614 if( (vertex[2] >= zstart+i*zstep) && (vertex[2] < zstart+(i+1)*zstep) ){
1615 zbin=i;
1616 break;
1617 }
1618 }
1619
1620
1621
1622 /////////////////////////////
1623 // Create Shuffled index list
1624 Int_t randomIndex[fAOD->GetNumberOfTracks()];
1625 for (Int_t i = 0; i < fAOD->GetNumberOfTracks(); i++) randomIndex[i]=i;
1626 Shuffle(randomIndex,0,fAOD->GetNumberOfTracks()-1);
1627 /////////////////////////////
4bf06935 1628
be9ef9f9 1629
1630 // Track loop
1631 for (Int_t i = 0; i < fAOD->GetNumberOfTracks(); i++) {
1632 AliAODTrack* aodtrack = fAOD->GetTrack(randomIndex[i]);
1633 if (!aodtrack) continue;
1634 if(myTracks >= fMultLimit) {cout<<"More tracks than Track Limit"<<endl; return;}
1635
1636 status=aodtrack->GetStatus();
1637
1638 if(!aodtrack->TestFilterBit(BIT(fFilterBit))) continue;// AOD filterBit cut
1639 ((TH2D*)fOutputList->FindObject("fTrackChi2NDF"))->Fill(centralityPercentile, aodtrack->Chi2perNDF());
1640 ((TH2D*)fOutputList->FindObject("fTrackTPCncls"))->Fill(centralityPercentile, aodtrack->GetTPCncls());
1641 if(aodtrack->GetTPCNcls() < fMinTPCncls) continue;// TPC nCluster cut
1642 if(aodtrack->Chi2perNDF() > fMaxChi2NDF) continue;
1643
1644 if(fFilterBit != 7){
1645 Bool_t goodTrackOtherFB = kFALSE;
1646 for (Int_t j = 0; j < fAOD->GetNumberOfTracks(); j++) {
1647 AliAODTrack* aodtrack2 = fAOD->GetTrack(randomIndex[j]);
1648 if(!aodtrack2) continue;
1649 if(!aodtrack2->TestFilterBit(BIT(fFilterBit))) continue;
1650
1651 if(-(aodtrack->GetID()+1)==aodtrack2->GetID()) {goodTrackOtherFB=kTRUE; break;}
1652
1653 }
1654 if(!goodTrackOtherFB) continue;
1655 }
1656
1657
86528e76 1658 if(aodtrack->Pt() < 0.16) continue;
be9ef9f9 1659 if(fabs(aodtrack->Eta()) > 0.8) continue;
1660
1661
1662 Bool_t goodMomentum = aodtrack->GetPxPyPz( fTempStruct[myTracks].fP);
1663 if(!goodMomentum) continue;
1664 aodtrack->GetXYZ( fTempStruct[myTracks].fX);
1665
0207c034 1666
be9ef9f9 1667 Double_t dca2[2]={0};
1668 dca2[0] = sqrt( pow(fTempStruct[myTracks].fX[0] - vertex[0],2) + pow(fTempStruct[myTracks].fX[1] - vertex[1],2));
1669 dca2[1] = sqrt( pow(fTempStruct[myTracks].fX[2] - vertex[2],2));
1670 Double_t dca3d = sqrt( pow(dca2[0],2) + pow(dca2[1],2));
1671
1672 fTempStruct[myTracks].fStatus = status;
1673 fTempStruct[myTracks].fFiltermap = aodtrack->GetFilterMap();
1674 fTempStruct[myTracks].fId = aodtrack->GetID();
1675 //
1676 fTempStruct[myTracks].fLabel = aodtrack->GetLabel();
1677 fTempStruct[myTracks].fPhi = atan2(fTempStruct[myTracks].fP[1], fTempStruct[myTracks].fP[0]);
1678 if(fTempStruct[myTracks].fPhi < 0) fTempStruct[myTracks].fPhi += 2*PI;
1679 fTempStruct[myTracks].fPt = sqrt(pow(fTempStruct[myTracks].fP[0],2) + pow(fTempStruct[myTracks].fP[1],2));
1680 fTempStruct[myTracks].fMom = sqrt( pow(fTempStruct[myTracks].fPt,2) + pow(fTempStruct[myTracks].fP[2],2) );
1681 fTempStruct[myTracks].fEta = aodtrack->Eta();
1682 fTempStruct[myTracks].fCharge = aodtrack->Charge();
1683 fTempStruct[myTracks].fDCAXY = dca2[0];
1684 fTempStruct[myTracks].fDCAZ = dca2[1];
1685 fTempStruct[myTracks].fDCA = dca3d;
1686 fTempStruct[myTracks].fClusterMap = aodtrack->GetTPCClusterMap();
1687 fTempStruct[myTracks].fSharedMap = aodtrack->GetTPCSharedMap();
1688
1689
1690
86528e76 1691 if(fTempStruct[myTracks].fMom > 0.9999) continue;// upper P bound
1692
be9ef9f9 1693
1694
1695 // PID section
1696 fTempStruct[myTracks].fElectron = kFALSE;
1697 fTempStruct[myTracks].fPion = kFALSE;
1698 fTempStruct[myTracks].fKaon = kFALSE;
1699 fTempStruct[myTracks].fProton = kFALSE;
1700
1701 Float_t nSigmaTPC[5];
1702 Float_t nSigmaTOF[5];
1703 nSigmaTPC[0]=10; nSigmaTPC[1]=10; nSigmaTPC[2]=10; nSigmaTPC[3]=10; nSigmaTPC[4]=10;
1704 nSigmaTOF[0]=10; nSigmaTOF[1]=10; nSigmaTOF[2]=10; nSigmaTOF[3]=10; nSigmaTOF[4]=10;
1705 fTempStruct[myTracks].fTOFhit = kFALSE;// default
1706 Float_t signalTPC=0, signalTOF=0;
1707 Double_t integratedTimesTOF[10]={0};
1708
1709
1710 Bool_t DoPIDWorkAround=kTRUE;
1711 //if(fFilterBit == 7) DoPIDWorkAround=kTRUE;
1712 if(fMCcase && !fPbPbcase) DoPIDWorkAround=kFALSE;
1713 if(DoPIDWorkAround==kFALSE && fabs(fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kPion)) < 900) {
1714 nSigmaTPC[0]=fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kElectron);
1715 nSigmaTPC[1]=fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kMuon);
1716 nSigmaTPC[2]=fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kPion);
1717 nSigmaTPC[3]=fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kKaon);
1718 nSigmaTPC[4]=fPIDResponse->NumberOfSigmasTPC(aodtrack,AliPID::kProton);
1719 //
1720 nSigmaTOF[0]=fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kElectron);
1721 nSigmaTOF[1]=fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kMuon);
1722 nSigmaTOF[2]=fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kPion);
1723 nSigmaTOF[3]=fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kKaon);
1724 nSigmaTOF[4]=fPIDResponse->NumberOfSigmasTOF(aodtrack,AliPID::kProton);
1725 signalTPC = aodtrack->GetTPCsignal();
1726 if( (status&AliESDtrack::kTOFpid)!=0 && (status&AliESDtrack::kTIME)!=0 && (status&AliESDtrack::kTOFout)!=0 && (status&AliESDtrack::kTOFmismatch)<=0){// good tof hit
1727 fTempStruct[myTracks].fTOFhit = kTRUE;
1728 signalTOF = aodtrack->GetTOFsignal();
1729 aodtrack->GetIntegratedTimes(integratedTimesTOF);
1730 }else fTempStruct[myTracks].fTOFhit = kFALSE;
1731
1732 }else {// FilterBit 7 PID workaround
1733
1734 for(Int_t j = 0; j < fAOD->GetNumberOfTracks(); j++) {
1735 AliAODTrack* aodTrack2 = fAOD->GetTrack(j);
1736 if (!aodTrack2) continue;
1737 if(aodtrack->GetID() != (-aodTrack2->GetID() - 1)) continue;// (-aodTrack2->GetID() - 1)
1738
1739 UInt_t status2=aodTrack2->GetStatus();
1740
1741 nSigmaTPC[0]=fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kElectron);
1742 nSigmaTPC[1]=fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kMuon);
1743 nSigmaTPC[2]=fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kPion);
1744 nSigmaTPC[3]=fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kKaon);
1745 nSigmaTPC[4]=fPIDResponse->NumberOfSigmasTPC(aodTrack2,AliPID::kProton);
1746 //
1747 nSigmaTOF[0]=fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kElectron);
1748 nSigmaTOF[1]=fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kMuon);
1749 nSigmaTOF[2]=fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kPion);
1750 nSigmaTOF[3]=fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kKaon);
1751 nSigmaTOF[4]=fPIDResponse->NumberOfSigmasTOF(aodTrack2,AliPID::kProton);
1752 signalTPC = aodTrack2->GetTPCsignal();
1753
1754 if( (status2&AliESDtrack::kTOFpid)!=0 && (status2&AliESDtrack::kTIME)!=0 && (status2&AliESDtrack::kTOFout)!=0 && (status2&AliESDtrack::kTOFmismatch)<=0){// good tof hit
1755 fTempStruct[myTracks].fTOFhit = kTRUE;
1756 signalTOF = aodTrack2->GetTOFsignal();
1757 aodTrack2->GetIntegratedTimes(integratedTimesTOF);
1758 }else fTempStruct[myTracks].fTOFhit = kFALSE;
1759
6432c081 1760 //if(aodTrack2->Pt()<0.2) cout<<aodTrack2->GetTPCNclsF()<<" "<<aodTrack2->GetTPCNCrossedRows()<<" "<<aodTrack2->GetTPCNcls()<<" "<<aodTrack2->GetTPCFoundFraction()<<endl;
1761
1762
be9ef9f9 1763 }// aodTrack2
1764 }// FilterBit 7 PID workaround
1765
1766
1767 ///////////////////
1768 ((TH3F*)fOutputList->FindObject("fTPCResponse"))->Fill(centralityPercentile, fTempStruct[myTracks].fMom, signalTPC);
1769 if(fTempStruct[myTracks].fTOFhit) {
1770 ((TH3F*)fOutputList->FindObject("fTOFResponse"))->Fill(centralityPercentile, fTempStruct[myTracks].fMom, signalTOF - integratedTimesTOF[3]);
1771 }
1772 ///////////////////
1773
1774 // Use TOF if good hit and above threshold
1775 if(fTempStruct[myTracks].fTOFhit && fTempStruct[myTracks].fMom > fTPCTOFboundry){
1776 if(fabs(nSigmaTOF[0])<fSigmaCutTOF) fTempStruct[myTracks].fElectron = kTRUE;// Electron candidate
1777 if(fabs(nSigmaTOF[2])<fSigmaCutTOF) fTempStruct[myTracks].fPion = kTRUE;// Pion candidate
1778 if(fabs(nSigmaTOF[3])<fSigmaCutTOF) fTempStruct[myTracks].fKaon = kTRUE;// Kaon candidate
1779 if(fabs(nSigmaTOF[4])<fSigmaCutTOF) fTempStruct[myTracks].fProton = kTRUE;// Proton candidate
1780 }else {// TPC info instead
1781 if(fabs(nSigmaTPC[0])<fSigmaCutTPC) fTempStruct[myTracks].fElectron = kTRUE;// Electron candidate
1782 if(fabs(nSigmaTPC[2])<fSigmaCutTPC) fTempStruct[myTracks].fPion = kTRUE;// Pion candidate
1783 if(fabs(nSigmaTPC[3])<fSigmaCutTPC) fTempStruct[myTracks].fKaon = kTRUE;// Kaon candidate
1784 if(fabs(nSigmaTPC[4])<fSigmaCutTPC) fTempStruct[myTracks].fProton = kTRUE;// Proton candidate
1785 }
1786
1787
1788 // Ensure there is only 1 candidate per track
1789 if(fTempStruct[myTracks].fElectron && fTempStruct[myTracks].fMom < 0.45) continue;// Remove electron band
1790 if(!fTempStruct[myTracks].fPion && !fTempStruct[myTracks].fKaon && !fTempStruct[myTracks].fProton) continue;
1791 if(!fTempStruct[myTracks].fPion) continue;// only pions
1792 if(fTempStruct[myTracks].fPion && fTempStruct[myTracks].fKaon) continue;
1793 if(fTempStruct[myTracks].fPion && fTempStruct[myTracks].fProton) continue;
1794 if(fTempStruct[myTracks].fKaon && fTempStruct[myTracks].fProton) continue;
0207c034 1795
be9ef9f9 1796
1797
1798
1799 if(fTempStruct[myTracks].fCharge==+1) {
1800 ((TH2F*)fOutputList->FindObject("fDCAxyDistPlus"))->Fill(fTempStruct[myTracks].fPt, dca2[0]);
1801 ((TH2F*)fOutputList->FindObject("fDCAzDistPlus"))->Fill(fTempStruct[myTracks].fPt, dca2[1]);
1802 }else {
1803 ((TH2F*)fOutputList->FindObject("fDCAxyDistMinus"))->Fill(fTempStruct[myTracks].fPt, dca2[0]);
1804 ((TH2F*)fOutputList->FindObject("fDCAzDistMinus"))->Fill(fTempStruct[myTracks].fPt, dca2[1]);
1805 }
1806
0207c034 1807 ((TH3F*)fOutputList->FindObject("fChPhiPtDist"))->Fill(aodtrack->Charge(), aodtrack->Phi(), aodtrack->Pt());
1808 ((TH3F*)fOutputList->FindObject("fChPtEtaDist"))->Fill(aodtrack->Charge(), aodtrack->Pt(), aodtrack->Eta());
1809 ((TH2F*)fOutputList->FindObject("fCentPtDist"))->Fill(int(centralityPercentile/5.), aodtrack->Pt());
1810 ((TH2F*)fOutputList->FindObject("fCentEtaDist"))->Fill(int(centralityPercentile/5.), aodtrack->Eta());
1811
6432c081 1812 ((TH2D*)fOutputList->FindObject("fDistTPCNclsFindable"))->Fill(aodtrack->Pt(), aodtrack->GetTPCNclsF());
1813 ((TProfile*)fOutputList->FindObject("fProfileTPCNclsFindable"))->Fill(aodtrack->Pt(), aodtrack->GetTPCNclsF());
1814 //
1815 ((TH2D*)fOutputList->FindObject("fDistTPCNclsCrossed"))->Fill(aodtrack->Pt(), aodtrack->GetTPCNCrossedRows());
1816 ((TProfile*)fOutputList->FindObject("fProfileTPCNclsCrossed"))->Fill(aodtrack->Pt(), aodtrack->GetTPCNCrossedRows());
1817 //
1818 if(aodtrack->GetTPCNclsF() > 0){
1819 ((TH2D*)fOutputList->FindObject("fDistTPCNclsFindableRatio"))->Fill(aodtrack->Pt(), double(aodtrack->GetTPCNcls())/double(aodtrack->GetTPCNclsF()));
1820 ((TProfile*)fOutputList->FindObject("fProfileTPCNclsFindableRatio"))->Fill(aodtrack->Pt(), double(aodtrack->GetTPCNcls())/double(aodtrack->GetTPCNclsF()));
1821 }
1822 //
1823 ((TH2D*)fOutputList->FindObject("fDistTPCNclsCrossedRatio"))->Fill(aodtrack->Pt(), aodtrack->GetTPCFoundFraction());
1824 ((TProfile*)fOutputList->FindObject("fProfileTPCNclsCrossedRatio"))->Fill(aodtrack->Pt(), aodtrack->GetTPCFoundFraction());
1825
1826
be9ef9f9 1827 if(fTempStruct[myTracks].fPion) {// pions
1828 fTempStruct[myTracks].fEaccepted = sqrt(pow(fTempStruct[myTracks].fMom,2) + pow(fTrueMassPi,2));
1829 fTempStruct[myTracks].fKey = 1;
1830 }else if(fTempStruct[myTracks].fKaon){// kaons
1831 fTempStruct[myTracks].fEaccepted = sqrt(pow(fTempStruct[myTracks].fMom,2) + pow(fTrueMassK,2));;
1832 fTempStruct[myTracks].fKey = 10;
1833 }else{// protons
1834 fTempStruct[myTracks].fEaccepted = sqrt(pow(fTempStruct[myTracks].fMom,2) + pow(fTrueMassP,2));;
1835 fTempStruct[myTracks].fKey = 100;
1836 }
1837
1838
1839
1840 if(aodtrack->Charge() > 0) positiveTracks++;
1841 else negativeTracks++;
1842
1843 if(fTempStruct[myTracks].fPion) pionCount++;
1844 if(fTempStruct[myTracks].fKaon) kaonCount++;
1845 if(fTempStruct[myTracks].fProton) protonCount++;
1846
1847 myTracks++;
1848
1849 if(fMCcase){// muon mothers
1850 AliAODMCParticle *tempMCTrack=(AliAODMCParticle*)mcArray->At(abs(aodtrack->GetLabel()));
1851 if(abs(tempMCTrack->GetPdgCode())==13 && tempMCTrack->GetMother()>0){// muons
1852 AliAODMCParticle *parent=(AliAODMCParticle*)mcArray->At(tempMCTrack->GetMother());
1853 if(parent->IsPhysicalPrimary()){
1854 ((TH1D*)fOutputList->FindObject("fMuonParents"))->Fill(abs(parent->GetPdgCode()));
1855 }else ((TH1D*)fOutputList->FindObject("fSecondaryMuonParents"))->Fill(abs(parent->GetPdgCode()));
1856 }
1857 ((TH1D*)fOutputList->FindObject("fPionCandidates"))->Fill(abs(tempMCTrack->GetPdgCode()));
1858 }
1859 }
1860 //cout<<"kinkcount = "<<kinkcount<<" pionkinks = "<<pionkinks<<" primarypionkinks = "<<primarypionkinks<<endl;
1861 }else {// ESD tracks
1862 cout<<"ESDs not supported currently"<<endl;
1863 return;
1864 }
1865
1866 // Generator info only
1867 if(fMCcase && fGeneratorOnly){
1868 myTracks=0; pionCount=0; kaonCount=0; protonCount=0;// reset track counters
1869 for(Int_t mctrackN=0; mctrackN<mcArray->GetEntriesFast(); mctrackN++){
1870 if(myTracks >= fMultLimit) {cout<<"More tracks than Track Limit"<<endl; return;}
1871 if(myTracks >= 1300) continue;// additional cut to limit high mult events which exceed pair # limits
1872
1873 AliAODMCParticle *mcParticle = (AliAODMCParticle*)mcArray->At(mctrackN);
1874 if(!mcParticle) continue;
1875 if(fabs(mcParticle->Eta())>0.8) continue;
1876 if(mcParticle->Charge()!=-3 && mcParticle->Charge()!=+3) continue;// x3 by convention
86528e76 1877 if(mcParticle->Pt() < 0.16 || mcParticle->Pt() > 1.0) continue;
be9ef9f9 1878 if(!mcParticle->IsPrimary()) continue;
1879 if(!mcParticle->IsPhysicalPrimary()) continue;
1880 if(abs(mcParticle->GetPdgCode())!=211) continue;
1881
1882 fTempStruct[myTracks].fP[0] = mcParticle->Px();
1883 fTempStruct[myTracks].fP[1] = mcParticle->Py();
1884 fTempStruct[myTracks].fP[2] = mcParticle->Pz();
1885 fTempStruct[myTracks].fX[0] = 0.; fTempStruct[myTracks].fX[1] = 0.; fTempStruct[myTracks].fX[2] = 0.;
1886
1887 fTempStruct[myTracks].fId = myTracks;// use my track counter
1888 fTempStruct[myTracks].fLabel = mctrackN;
1889 fTempStruct[myTracks].fPhi = atan2(fTempStruct[myTracks].fP[1], fTempStruct[myTracks].fP[0]);
1890 if(fTempStruct[myTracks].fPhi < 0) fTempStruct[myTracks].fPhi += 2*PI;
1891 fTempStruct[myTracks].fPt = sqrt(pow(fTempStruct[myTracks].fP[0],2) + pow(fTempStruct[myTracks].fP[1],2));
1892 fTempStruct[myTracks].fMom = sqrt( pow(fTempStruct[myTracks].fPt,2) + pow(fTempStruct[myTracks].fP[2],2) );
1893 fTempStruct[myTracks].fEta = mcParticle->Eta();
1894 fTempStruct[myTracks].fCharge = int(mcParticle->Charge()/3.);
1895 fTempStruct[myTracks].fDCAXY = 0.;
1896 fTempStruct[myTracks].fDCAZ = 0.;
1897 fTempStruct[myTracks].fDCA = 0.;
1898 fTempStruct[myTracks].fPion = kTRUE;
1899 fTempStruct[myTracks].fEaccepted = sqrt(pow(fTempStruct[myTracks].fMom,2) + pow(fTrueMassPi,2));
1900 fTempStruct[myTracks].fKey = 1;
1901
1902 myTracks++;
1903 pionCount++;
1904 }
1905 }
1906
1907 if(myTracks >= 1) {
1908 ((TH1F*)fOutputList->FindObject("fMultDist3"))->Fill(myTracks);
1909 }
1910
1911
1912 //cout<<"There are "<<myTracks<<" myTracks"<<endl;
1913 //cout<<"pionCount = "<<pionCount<<" kaonCount = "<<kaonCount<<" protonCount = "<<protonCount<<endl;
6432c081 1914 //return;
be9ef9f9 1915
1916 /////////////////////////////////////////
1917 // Pion Multiplicity Cut (To ensure all Correlation orders are present in each event)
0207c034 1918 if(myTracks < 4) {/*cout<<"Less than 4 tracks. Skipping Event."<<endl;*/ return;}
be9ef9f9 1919 /////////////////////////////////////////
1920
1921
1922 ////////////////////////////////
1923 ///////////////////////////////
1924 // Mbin determination
1925 //
1926 // Mbin set to Pion Count Only for pp!!!!!!!
1927 fMbin=-1;
1928 if(!fPbPbcase){
0207c034 1929
1930 if(pionCount >= fMultLimits[3] && pionCount < fMultLimits[10]) fMbin=0;// only 1 bin
1931
1932 for(Int_t i=0; i<fMbinsMixing; i++){// event-mixing M bin
1933 if( ( pionCount >= fMultLimits[i]) && ( pionCount < fMultLimits[i+1]) ){
1934 MbinMixing=i;// 0 = lowest mult
1935 break;
1936 }
be9ef9f9 1937 }
0207c034 1938
be9ef9f9 1939 }else{
29d2e579 1940 for(Int_t i=0; i<fCentBins; i++){// correlation analysis M bin
be9ef9f9 1941 if( (centralityPercentile >= cStart+i*cStep) && (centralityPercentile < cStart+(i+1)*cStep) ){
1942 fMbin=i;// 0 = most central
1943 break;
1944 }
1945 }
0207c034 1946 for(Int_t i=0; i<fMbinsMixing; i++){// event-mixing M bin
29d2e579 1947 if( (centralityPercentile >= cStart+i*cStepMixing) && (centralityPercentile < cStart+(i+1)*cStepMixing) ){
1948 MbinMixing=i;// 0 = most central
1949 break;
1950 }
1951 }
be9ef9f9 1952 }
0207c034 1953
1954 if(fMbin==-1) {return;}
be9ef9f9 1955
1956 ///////////////////
1957 // can only be called after fMbin has been set
1958 // Radius parameter only matters for Monte-Carlo data
1959 SetFSIindex(fRMax);
1960 ///////////////////
1961
1962 Int_t rBinForTPNMomRes = 10;
1963 if(fMbin==0) {rBinForTPNMomRes=10;}// 10 fm with EW (fRMax should be 11 for normal running)
1964 else if(fMbin==1) {rBinForTPNMomRes=9;}
1965 else if(fMbin<=3) {rBinForTPNMomRes=8;}
1966 else if(fMbin<=5) {rBinForTPNMomRes=7;}
1967 else {rBinForTPNMomRes=6;}
1968
1969 //////////////////////////////////////////////////
1970 fEDbin=0;// Extra Dimension bin (Kt, (Kt-Psi),....)
1971 //////////////////////////////////////////////////
1972
1973
1974
1975 ((TH1F*)fOutputList->FindObject("fEvents1"))->Fill(fMbin+1);
1976 ((TProfile*)fOutputList->FindObject("fAvgMult"))->Fill(fMbin+1., pionCount);
1977
1978 ////////////////////////////////////
1979 // Add event to buffer if > 0 tracks
1980 if(myTracks > 0){
29d2e579 1981 fEC[zbin][MbinMixing]->FIFOShift();
1982 (fEvt) = fEC[zbin][MbinMixing]->fEvtStr;
be9ef9f9 1983 (fEvt)->fNtracks = myTracks;
1984 (fEvt)->fFillStatus = 1;
1985 for(Int_t i=0; i<myTracks; i++) (fEvt)->fTracks[i] = fTempStruct[i];
1986 if(fMCcase){
1987 (fEvt)->fMCarraySize = mcArray->GetEntriesFast();
1988 for(Int_t i=0; i<mcArray->GetEntriesFast(); i++) {
1989 AliAODMCParticle *tempMCTrack = (AliAODMCParticle*)mcArray->At(i);
1990 (fEvt)->fMCtracks[i].fPx = tempMCTrack->Px();
1991 (fEvt)->fMCtracks[i].fPy = tempMCTrack->Py();
1992 (fEvt)->fMCtracks[i].fPz = tempMCTrack->Pz();
1993 (fEvt)->fMCtracks[i].fPtot = sqrt(pow(tempMCTrack->Px(),2)+pow(tempMCTrack->Py(),2)+pow(tempMCTrack->Pz(),2));
1994 (fEvt)->fMCtracks[i].fPdgCode = tempMCTrack->GetPdgCode();
1995 (fEvt)->fMCtracks[i].fMotherLabel = tempMCTrack->GetMother();
1996 }
1997 }
1998 }
4bf06935 1999
be9ef9f9 2000
2001
2002 Float_t qinv12=0, qinv13=0, qinv14=0, qinv23=0, qinv24=0, qinv34=0;
2003 Float_t qout=0, qside=0, qlong=0;
2004 Float_t kT12=0;
2005 Float_t q3=0, q3MC=0;
2006 Float_t q4=0, q4MC=0;
2007 Int_t ch1=0, ch2=0, ch3=0, ch4=0;
2008 Int_t bin1=0, bin2=0, bin3=0, bin4=0;
2009 Float_t pVect1[4]={0};
2010 Float_t pVect2[4]={0};
2011 Float_t pVect3[4]={0};
2012 Float_t pVect4[4]={0};
2013 Float_t pVect1MC[4]={0};
2014 Float_t pVect2MC[4]={0};
2015 Float_t pVect3MC[4]={0};
2016 Float_t pVect4MC[4]={0};
2017 Float_t Pparent1[4]={0};
2018 Float_t Pparent2[4]={0};
2019 Float_t Pparent3[4]={0};
2020 Float_t Pparent4[4]={0};
2021 Float_t weight12=0, weight13=0, weight14=0, weight23=0, weight24=0, weight34=0;
2022 Float_t weight12Err=0, weight13Err=0, weight14Err=0, weight23Err=0, weight24Err=0, weight34Err=0;
5591748e 2023 Float_t weight12CC[3]={0};
2024 Float_t weight13CC[3]={0};
2025 Float_t weight14CC[3]={0};
2026 Float_t weight23CC[3]={0};
2027 Float_t weight24CC[3]={0};
2028 Float_t weight34CC[3]={0};
ab890ec3 2029 //Float_t weight12CC_e=0, weight13CC_e=0, weight14CC_e=0, weight23CC_e=0, weight24CC_e=0, weight34CC_e=0;
2030 Float_t weightTotal=0;//, weightTotalErr=0;
be9ef9f9 2031 Float_t qinv12MC=0, qinv13MC=0, qinv14MC=0, qinv23MC=0, qinv24MC=0, qinv34MC=0;
2032 Float_t parentQinv12=0, parentQinv13=0, parentQinv14=0, parentQinv23=0, parentQinv24=0, parentQinv34=0;
2033 Float_t parentQ3=0;
2034 Float_t FSICorr12=0, FSICorr13=0, FSICorr14=0, FSICorr23=0, FSICorr24=0, FSICorr34=0;
2035 Bool_t pionParent1=kFALSE, pionParent2=kFALSE, pionParent3=kFALSE, pionParent4=kFALSE;
2036 Bool_t FilledMCpair12=kFALSE, FilledMCtriplet123=kFALSE;
6432c081 2037 Bool_t Positive1stTripletWeights=kTRUE, Positive2ndTripletWeights=kTRUE;
ab890ec3 2038 Float_t T12=0, T13=0, T14=0, T23=0, T24=0, T34=0;
80507acf 2039 Int_t momBin12=1, momBin13=1, momBin14=1, momBin23=1, momBin24=1, momBin34=1;
2040 Float_t MomResCorr12=1.0, MomResCorr13=1.0, MomResCorr14=1.0, MomResCorr23=1.0, MomResCorr24=1.0, MomResCorr34=1.0;
be9ef9f9 2041 //
2042 AliAODMCParticle *mcParticle1=0x0;
2043 AliAODMCParticle *mcParticle2=0x0;
2044
2045
2046 ////////////////////
b71263d0 2047 //Int_t PairCount[7]={0};
2048 //Int_t NormPairCount[7]={0};
be9ef9f9 2049 Int_t KT3index=0, KT4index=0;
2050
b71263d0 2051 // reset to defaults
0207c034 2052 for(Int_t i=0; i<fMultLimit; i++) {
b71263d0 2053 fLowQPairSwitch_E0E0[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
2054 fLowQPairSwitch_E0E1[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
2055 fLowQPairSwitch_E0E2[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
2056 fLowQPairSwitch_E0E3[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
6bb6954b 2057 fLowQPairSwitch_E1E1[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
b71263d0 2058 fLowQPairSwitch_E1E2[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
2059 fLowQPairSwitch_E1E3[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
2060 fLowQPairSwitch_E2E3[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
2061 //
2062 fNormQPairSwitch_E0E0[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
2063 fNormQPairSwitch_E0E1[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
2064 fNormQPairSwitch_E0E2[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
2065 fNormQPairSwitch_E0E3[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
6bb6954b 2066 fNormQPairSwitch_E1E1[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
b71263d0 2067 fNormQPairSwitch_E1E2[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
2068 fNormQPairSwitch_E1E3[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
2069 fNormQPairSwitch_E2E3[i]->Set(kMultLimitPbPb,fDefaultsCharSwitch);
2070 }
5591748e 2071
b71263d0 2072
2073 //////////////////////////////////////////
2074 // make low-q pair storage and normalization-pair storage
2075 //
2076 for(Int_t en1=0; en1<=2; en1++){// 1st event number (en1=0 is the same event as current event)
2077 for(Int_t en2=en1; en2<=3; en2++){// 2nd event number (en2=0 is the same event as current event)
6bb6954b 2078 if(en1>1 && en1==en2) continue;
2079
b71263d0 2080 for (Int_t i=0; i<(fEvt+en1)->fNtracks; i++) {// 1st particle
2081 for (Int_t j=i+1; j<(fEvt+en2)->fNtracks; j++) {// 2nd particle
2082
5591748e 2083
b71263d0 2084 pVect1[0]=(fEvt+en1)->fTracks[i].fEaccepted; pVect2[0]=(fEvt+en2)->fTracks[j].fEaccepted;
2085 pVect1[1]=(fEvt+en1)->fTracks[i].fP[0]; pVect2[1]=(fEvt+en2)->fTracks[j].fP[0];
2086 pVect1[2]=(fEvt+en1)->fTracks[i].fP[1]; pVect2[2]=(fEvt+en2)->fTracks[j].fP[1];
2087 pVect1[3]=(fEvt+en1)->fTracks[i].fP[2]; pVect2[3]=(fEvt+en2)->fTracks[j].fP[2];
2088 ch1 = Int_t(((fEvt+en1)->fTracks[i].fCharge + 1)/2.);
2089 ch2 = Int_t(((fEvt+en2)->fTracks[j].fCharge + 1)/2.);
2090
2091 qinv12 = GetQinv(pVect1, pVect2);
2092 kT12 = sqrt(pow(pVect1[1]+pVect2[1],2) + pow(pVect1[2]+pVect2[2],2))/2.;
2093 SetFillBins2(ch1, ch2, bin1, bin2);
2094
80507acf 2095 if(qinv12 < fQLowerCut) continue;// remove unwanted low-q pairs (also a type of track splitting/merging cut)
2096 if(ch1 == ch2 && !fGeneratorOnly){
fac2d84b 2097 Int_t tempChGroup[2]={0,0};
80507acf 2098 if(en1==0 && en2==1) ((TH1F*)fOutputList->FindObject("fTotalPairsWeighting"))->Fill(qinv12, MCWeight(tempChGroup, 10, ffcSqMRC, qinv12, 0.));
b71263d0 2099 if(!AcceptPair((fEvt+en1)->fTracks[i], (fEvt+en2)->fTracks[j])) {
2100 if(en1==0 && en2==0) ((TH1F*)fOutputList->FindObject("fRejectedPairs"))->Fill(qinv12);
2101 continue;
be9ef9f9 2102 }
80507acf 2103 if(en1==0 && en2==1) ((TH1F*)fOutputList->FindObject("fAcceptedPairsWeighting"))->Fill(qinv12, MCWeight(tempChGroup, 10, ffcSqMRC, qinv12, 0.));
fac2d84b 2104 }
42802bba 2105 if(fMixedChargeCut && ch1 != ch2 && !fGeneratorOnly && !fMCcase){// remove +- low-q pairs to keep balance between ++ and +- contributions to multi-particle Q3,Q4 projections
fac2d84b 2106 Int_t tempChGroup[2]={0,1};
80507acf 2107 if(en1==0 && en2==1) ((TH1F*)fOutputList->FindObject("fTotalPairsWeightingMC"))->Fill(qinv12, MCWeight(tempChGroup, 10, ffcSqMRC, qinv12, 0.));
fac2d84b 2108 if(!AcceptPairPM((fEvt+en1)->fTracks[i], (fEvt+en2)->fTracks[j])) {
2109 if(en1==0 && en2==0) ((TH1F*)fOutputList->FindObject("fRejectedPairsMC"))->Fill(qinv12);
2110 continue;
2111 }
80507acf 2112 if(en1==0 && en2==1) ((TH1F*)fOutputList->FindObject("fAcceptedPairsWeightingMC"))->Fill(qinv12, MCWeight(tempChGroup, 10, ffcSqMRC, qinv12, 0.));
42802bba 2113 }
b71263d0 2114
2115 GetQosl(pVect1, pVect2, qout, qside, qlong);
2116 if( (en1+en2==0)) {
86528e76 2117 if(!fGenerateSignal) Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[0].fTerms2->Fill(kT12, qinv12);
b71263d0 2118 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[0].fTerms2QW->Fill(kT12, qinv12, qinv12);
2119 // osl frame
2120 if((kT12 > 0.2) && (kT12 < 0.3)){
2121 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[en2].OSL_ktbin[0].fTerms2OSL->Fill(fabs(qout), fabs(qside), fabs(qlong));
2122 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[en2].OSL_ktbin[0].fTerms2OSLQW->Fill(fabs(qout), fabs(qside), fabs(qlong), qinv12);
be9ef9f9 2123 }
b71263d0 2124 if((kT12 > 0.6) && (kT12 < 0.7)){
2125 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[en2].OSL_ktbin[1].fTerms2OSL->Fill(fabs(qout), fabs(qside), fabs(qlong));
2126 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[en2].OSL_ktbin[1].fTerms2OSLQW->Fill(fabs(qout), fabs(qside), fabs(qlong), qinv12);
be9ef9f9 2127 }
b71263d0 2128 // unit mult bins
2129 if( (fEvt+en1)->fNtracks%100==0){
2130 Int_t kTindex=0;
2131 if(kT12>0.3) kTindex=1;
2132 Int_t UnitMultBin = int((fEvt+en1)->fNtracks / 100.) + 1;
2133 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[kTindex].TwoPT[0].fUnitMultBin->Fill(UnitMultBin, qinv12);
be9ef9f9 2134 }
2135
b71263d0 2136 }
2137 if( (en1+en2==1)) {
86528e76 2138 if(!fGenerateSignal) Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[1].fTerms2->Fill(kT12, qinv12);
b71263d0 2139 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[1].fTerms2QW->Fill(kT12, qinv12, qinv12);
2140 // osl frame
2141 if((kT12 > 0.2) && (kT12 < 0.3)){
2142 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[fEDbin].TwoPT[en2].OSL_ktbin[0].fTerms2OSL->Fill(fabs(qout), fabs(qside), fabs(qlong));
2143 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[fEDbin].TwoPT[en2].OSL_ktbin[0].fTerms2OSLQW->Fill(fabs(qout), fabs(qside), fabs(qlong), qinv12);
2144 }
2145 if((kT12 > 0.6) && (kT12 < 0.7)){
2146 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[fEDbin].TwoPT[en2].OSL_ktbin[1].fTerms2OSL->Fill(fabs(qout), fabs(qside), fabs(qlong));
2147 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[fEDbin].TwoPT[en2].OSL_ktbin[1].fTerms2OSLQW->Fill(fabs(qout), fabs(qside), fabs(qlong), qinv12);
be9ef9f9 2148 }
b71263d0 2149 // unit mult bins
2150 if( (fEvt+en1)->fNtracks%100==0){
2151 Int_t kTindex=0;
2152 if(kT12>0.3) kTindex=1;
2153 Int_t UnitMultBin = int((fEvt+en1)->fNtracks / 100.) + 1;
2154 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[kTindex].TwoPT[1].fUnitMultBin->Fill(UnitMultBin, qinv12);
be9ef9f9 2155 }
b71263d0 2156 }
2157 //////////////////////////////////////////
6bb6954b 2158 if(fTabulatePairs && en1==0 && en2<=1 && bin1==bin2){
b71263d0 2159 Float_t kY = 0;
2160 Int_t kTbin=-1, kYbin=-1;
86528e76 2161 Bool_t PairToReject=kFALSE;
2162 if((fEvt+en1)->fTracks[i].fPt < fMinPt || (fEvt+en1)->fTracks[i].fPt > fMaxPt) PairToReject=kTRUE;
2163 if((fEvt+en2)->fTracks[j].fPt < fMinPt || (fEvt+en2)->fTracks[j].fPt > fMaxPt) PairToReject=kTRUE;
2164 if(!PairToReject){
2165 for(Int_t kIt=0; kIt<fKbinsT; kIt++) {if(kT12 < (fKmiddleT[kIt] + fKstepT[kIt]/2.)) {kTbin = kIt; break;}}
2166 for(Int_t kIt=0; kIt<fKbinsY; kIt++) {if(kY < (fKmiddleY[kIt] + fKstepY[kIt]/2.)) {kYbin = kIt; break;}}
2167 if((kTbin<0) || (kYbin<0)) {cout<<"problem!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<endl; continue;}
2168 if((kTbin>=fKbinsT) || (kYbin>=fKbinsY)) {cout<<"problem!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<endl; continue;}
2169 if(fGenerateSignal && en2==0) {
2170 Int_t chGroup2[2]={ch1,ch2};
2171 Float_t WInput = MCWeight(chGroup2, fRMax, ffcSqMRC, qinv12, kT12);
b71263d0 2172 KT[kTbin].KY[kYbin].MB[fMbin].EDB[0].TwoPT[en2].fTerms2ThreeD->Fill(fabs(qout), fabs(qside), fabs(qlong), WInput);
86528e76 2173 }else KT[kTbin].KY[kYbin].MB[fMbin].EDB[0].TwoPT[en2].fTerms2ThreeD->Fill(fabs(qout), fabs(qside), fabs(qlong));
2174 }
b71263d0 2175 }
2176
2177 //////////////////////////////////////////////////////////////////////////////
86528e76 2178
b71263d0 2179 if(qinv12 <= fQcut) {
b71263d0 2180 if(en1==0 && en2==0) {fLowQPairSwitch_E0E0[i]->AddAt('1',j);}
2181 if(en1==0 && en2==1) {fLowQPairSwitch_E0E1[i]->AddAt('1',j);}
2182 if(en1==0 && en2==2) {fLowQPairSwitch_E0E2[i]->AddAt('1',j);}
2183 if(en1==0 && en2==3) {fLowQPairSwitch_E0E3[i]->AddAt('1',j);}
6bb6954b 2184 if(en1==1 && en2==1) {fLowQPairSwitch_E1E1[i]->AddAt('1',j);}
b71263d0 2185 if(en1==1 && en2==2) {fLowQPairSwitch_E1E2[i]->AddAt('1',j);}
2186 if(en1==1 && en2==3) {fLowQPairSwitch_E1E3[i]->AddAt('1',j);}
2187 if(en1==2 && en2==3) {fLowQPairSwitch_E2E3[i]->AddAt('1',j);}
2188 }
2189 if((qinv12 >= fNormQcutLow) && (qinv12 < fNormQcutHigh)) {
b71263d0 2190 if(en1==0 && en2==0) {fNormQPairSwitch_E0E0[i]->AddAt('1',j);}
2191 if(en1==0 && en2==1) {fNormQPairSwitch_E0E1[i]->AddAt('1',j);}
2192 if(en1==0 && en2==2) {fNormQPairSwitch_E0E2[i]->AddAt('1',j);}
2193 if(en1==0 && en2==3) {fNormQPairSwitch_E0E3[i]->AddAt('1',j);}
6bb6954b 2194 if(en1==1 && en2==1) {fNormQPairSwitch_E1E1[i]->AddAt('1',j);}
b71263d0 2195 if(en1==1 && en2==2) {fNormQPairSwitch_E1E2[i]->AddAt('1',j);}
2196 if(en1==1 && en2==3) {fNormQPairSwitch_E1E3[i]->AddAt('1',j);}
2197 if(en1==2 && en2==3) {fNormQPairSwitch_E2E3[i]->AddAt('1',j);}
be9ef9f9 2198 }
b71263d0 2199
be9ef9f9 2200 }
2201 }
2202 }
b71263d0 2203 }
be9ef9f9 2204
b71263d0 2205 //cout<<PairCount[0]<<" "<<PairCount[1]<<" "<<PairCount[2]<<" "<<PairCount[3]<<" "<<PairCount[4]<<" "<<PairCount[5]<<" "<<PairCount[6]<<endl;
2206 //cout<<NormPairCount[0]<<" "<<NormPairCount[1]<<" "<<NormPairCount[2]<<" "<<NormPairCount[3]<<" "<<NormPairCount[4]<<" "<<NormPairCount[5]<<" "<<NormPairCount[6]<<endl;
2207 ///////////////////////////////////////////////////
2208 // Do not use pairs from events with too many pairs
2209
2210 ((TH1F*)fOutputList->FindObject("fEvents2"))->Fill(fMbin+1);
2211
2212 ///////////////////////////////////////////////////
2213
2214
2215 if(fTabulatePairs) return;
be9ef9f9 2216
fac2d84b 2217 /*TF1 *SCpairWeight = new TF1("SCpairWeight","[0] + [1]*x + [2]*exp(-[3]*x)",0,0.2);// same-charge pair weight for monte-carlo data without two-track cuts.
2218 SCpairWeight->FixParameter(0, 0.959);
2219 SCpairWeight->FixParameter(1, 0.278);
2220 SCpairWeight->FixParameter(2, -1.759);
2221 SCpairWeight->FixParameter(3, 115.107);*/
2222
b71263d0 2223 ////////////////////////////////////////////////////
2224 ////////////////////////////////////////////////////
2225 // Normalization counting of 3- and 4-particle terms
2226 for(Int_t en2=0; en2<=1; en2++){// 2nd event number (en2=0 is the same event as current event)
2227 for(Int_t en3=en2; en3<=2; en3++){// 3rd event number
6bb6954b 2228 if(en2==0 && en3>2) continue;// not needed config
b71263d0 2229 if(en2==1 && en3==en2) continue;// not needed config
2230 for(Int_t en4=en3; en4<=3; en4++){// 4th event number
2231 if(en3==0 && en4>1) continue;// not needed config
6bb6954b 2232 if(en3==1 && en4==3) continue;// not needed configs
2233 if(en3==2 && (en2+en3+en4)!=6) continue;// not needed configs
b71263d0 2234
2235 for (Int_t i=0; i<myTracks; i++) {// 1st particle
2236 pVect1[1]=(fEvt)->fTracks[i].fP[0];
2237 pVect1[2]=(fEvt)->fTracks[i].fP[1];
2238 pVect1[3]=(fEvt)->fTracks[i].fP[2];
2239 ch1 = Int_t(((fEvt)->fTracks[i].fCharge + 1)/2.);
be9ef9f9 2240
b71263d0 2241 for (Int_t j=i+1; j<(fEvt+en2)->fNtracks; j++) {// 2nd particle
b71263d0 2242 if(en2==0) {if(fNormQPairSwitch_E0E0[i]->At(j)=='0') continue;}
2243 else {if(fNormQPairSwitch_E0E1[i]->At(j)=='0') continue;}
2244
2245 pVect2[1]=(fEvt+en2)->fTracks[j].fP[0];
2246 pVect2[2]=(fEvt+en2)->fTracks[j].fP[1];
2247 pVect2[3]=(fEvt+en2)->fTracks[j].fP[2];
2248 ch2 = Int_t(((fEvt+en2)->fTracks[j].fCharge + 1)/2.);
2249
2250 for (Int_t k=j+1; k<(fEvt+en3)->fNtracks; k++) {// 3rd particle
b71263d0 2251 if(en3==0) {
2252 if(fNormQPairSwitch_E0E0[i]->At(k)=='0') continue;
2253 if(fNormQPairSwitch_E0E0[j]->At(k)=='0') continue;
2254 }else if(en3==1){
2255 if(fNormQPairSwitch_E0E1[i]->At(k)=='0') continue;
2256 if(fNormQPairSwitch_E0E1[j]->At(k)=='0') continue;
2257 }else{
2258 if(fNormQPairSwitch_E0E2[i]->At(k)=='0') continue;
2259 if(fNormQPairSwitch_E1E2[j]->At(k)=='0') continue;
2260 }
be9ef9f9 2261
b71263d0 2262 pVect3[1]=(fEvt+en3)->fTracks[k].fP[0];
2263 pVect3[2]=(fEvt+en3)->fTracks[k].fP[1];
2264 pVect3[3]=(fEvt+en3)->fTracks[k].fP[2];
2265 ch3 = Int_t(((fEvt+en3)->fTracks[k].fCharge + 1)/2.);
2266 Bool_t fill2=kFALSE, fill3=kFALSE, fill4=kFALSE;
2267 SetFillBins3(ch1, ch2, ch3, 1, bin1, bin2, bin3, fill2, fill3, fill4);
2268
2269 Float_t KT3 = sqrt(pow(pVect1[1]+pVect2[1]+pVect3[1],2) + pow(pVect1[2]+pVect2[2]+pVect3[2],2))/3.;
2270 if(KT3<=fKT3transition) KT3index=0;
2271 else KT3index=1;
2272
2273 if(en2==0 && en3==0 && en4==0) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fNorm3->Fill(0);
2274 if(en2==1 && en3==2 && en4==3) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fNorm3->Fill(0);
2275 if(en2==0 && en3==1 && en4==2) {
2276 if(fill2) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fNorm3->Fill(0);
2277 if(fill3) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fNorm3->Fill(0);
2278 if(fill4) Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fNorm3->Fill(0);
2279 }
2280
2281
2282 for (Int_t l=k+1; l<(fEvt+en4)->fNtracks; l++) {// 4th particle
b71263d0 2283 if(en4==0){
2284 if(fNormQPairSwitch_E0E0[i]->At(l)=='0') continue;
2285 if(fNormQPairSwitch_E0E0[j]->At(l)=='0') continue;
2286 if(fNormQPairSwitch_E0E0[k]->At(l)=='0') continue;
2287 }else if(en4==1){
6bb6954b 2288 if(en3==0){
2289 if(fNormQPairSwitch_E0E1[i]->At(l)=='0') continue;
2290 if(fNormQPairSwitch_E0E1[j]->At(l)=='0') continue;
2291 if(fNormQPairSwitch_E0E1[k]->At(l)=='0') continue;
2292 }else{
2293 if(fNormQPairSwitch_E0E1[i]->At(l)=='0') continue;
2294 if(fNormQPairSwitch_E0E1[j]->At(l)=='0') continue;
2295 if(fNormQPairSwitch_E1E1[k]->At(l)=='0') continue;
2296 }
b71263d0 2297 }else if(en4==2){
2298 if(fNormQPairSwitch_E0E2[i]->At(l)=='0') continue;
2299 if(fNormQPairSwitch_E0E2[j]->At(l)=='0') continue;
2300 if(fNormQPairSwitch_E1E2[k]->At(l)=='0') continue;
be9ef9f9 2301 }else{
b71263d0 2302 if(fNormQPairSwitch_E0E3[i]->At(l)=='0') continue;
2303 if(fNormQPairSwitch_E1E3[j]->At(l)=='0') continue;
2304 if(fNormQPairSwitch_E2E3[k]->At(l)=='0') continue;
be9ef9f9 2305 }
86528e76 2306
b71263d0 2307 pVect4[1]=(fEvt+en4)->fTracks[l].fP[0];
2308 pVect4[2]=(fEvt+en4)->fTracks[l].fP[1];
2309 pVect4[3]=(fEvt+en4)->fTracks[l].fP[2];
2310 ch4 = Int_t(((fEvt+en4)->fTracks[l].fCharge + 1)/2.);
2311 Float_t KT4 = sqrt(pow(pVect1[1]+pVect2[1]+pVect3[1]+pVect4[1],2) + pow(pVect1[2]+pVect2[2]+pVect3[2]+pVect4[2],2))/4.;
2312 if(KT4<=fKT4transition) KT4index=0;
2313 else KT4index=1;
be9ef9f9 2314
6bb6954b 2315 Bool_t FillTerms[13]={kFALSE};
b71263d0 2316 SetFillBins4(ch1, ch2, ch3, ch4, bin1, bin2, bin3, bin4, en2+en3+en4, FillTerms);
2317 //
6bb6954b 2318 for(int ft=0; ft<13; ft++) {
b71263d0 2319 if(FillTerms[ft]) Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[ft].fNorm4->Fill(0.);
be9ef9f9 2320 }
be9ef9f9 2321
b71263d0 2322
be9ef9f9 2323 }
2324 }
b71263d0 2325 }
2326 }
2327
be9ef9f9 2328 }
2329 }
b71263d0 2330 }
be9ef9f9 2331
6bb6954b 2332
0207c034 2333
be9ef9f9 2334
2335 ///////////////////////////////////////////////////////////////////////
2336 ///////////////////////////////////////////////////////////////////////
2337 ///////////////////////////////////////////////////////////////////////
2338 //
2339 //
2340 // Start the Main Correlation Analysis
2341 //
2342 //
2343 ///////////////////////////////////////////////////////////////////////
6bb6954b 2344
be9ef9f9 2345
2346
2347 ////////////////////////////////////////////////////
2348 ////////////////////////////////////////////////////
2349 for(Int_t en2=0; en2<=1; en2++){// 2nd event number (en2=0 is the same event as current event)
2350 for(Int_t en3=en2; en3<=2; en3++){// 3rd event number
6bb6954b 2351 if(en2==0 && en3>2) continue;// not needed config
be9ef9f9 2352 if(en2==1 && en3==en2) continue;// not needed config
2353 for(Int_t en4=en3; en4<=3; en4++){// 4th event number
2354 if(en3==0 && en4>1) continue;// not needed config
6bb6954b 2355 if(en3==1 && en4==3) continue;// not needed configs
2356 if(en3==2 && (en2+en3+en4)!=6) continue;// not needed configs
2357
be9ef9f9 2358 Int_t ENsum=en2+en3+en4;// 0 or 1 or 3 or 6
4bf06935 2359
be9ef9f9 2360 /////////////////////////////////////////////////////////////
2361 for (Int_t i=0; i<myTracks; i++) {// 1st particle
2362 pVect1[0]=(fEvt)->fTracks[i].fEaccepted;
2363 pVect1[1]=(fEvt)->fTracks[i].fP[0];
2364 pVect1[2]=(fEvt)->fTracks[i].fP[1];
2365 pVect1[3]=(fEvt)->fTracks[i].fP[2];
2366 ch1 = Int_t(((fEvt)->fTracks[i].fCharge + 1)/2.);
86528e76 2367 if((fEvt)->fTracks[i].fPt < fMinPt) continue;
2368 if((fEvt)->fTracks[i].fPt > fMaxPt) continue;
be9ef9f9 2369
2370 /////////////////////////////////////////////////////////////
2371 for (Int_t j=i+1; j<(fEvt+en2)->fNtracks; j++) {// 2nd particle
b71263d0 2372 if(en2==0) {if(fLowQPairSwitch_E0E0[i]->At(j)=='0') continue;}
2373 else {if(fLowQPairSwitch_E0E1[i]->At(j)=='0') continue;}
86528e76 2374 if((fEvt+en2)->fTracks[j].fPt < fMinPt) continue;
2375 if((fEvt+en2)->fTracks[j].fPt > fMaxPt) continue;
2376
be9ef9f9 2377 pVect2[0]=(fEvt+en2)->fTracks[j].fEaccepted;
2378 pVect2[1]=(fEvt+en2)->fTracks[j].fP[0];
2379 pVect2[2]=(fEvt+en2)->fTracks[j].fP[1];
2380 pVect2[3]=(fEvt+en2)->fTracks[j].fP[2];
2381 ch2 = Int_t(((fEvt+en2)->fTracks[j].fCharge + 1)/2.);
2382 qinv12 = GetQinv(pVect1, pVect2);
2383 kT12 = sqrt(pow(pVect1[1]+pVect2[1],2) + pow(pVect1[2]+pVect2[2],2))/2.;
2384 SetFillBins2(ch1, ch2, bin1, bin2);
2385 Int_t kTindex=0;
2386 if(kT12<=0.3) kTindex=0;
2387 else kTindex=1;
2388
2389 FSICorr12 = FSICorrelation(ch1,ch2, qinv12);
2390
2391 // two particle terms filled during tabulation of low-q pairs
2392
2393
2394 if(fMCcase){
2395 FilledMCpair12=kFALSE;
2396
6bb6954b 2397 if(ch1==ch2 && fMbin==0 && qinv12<0.2 && ENsum!=2 && ENsum!=3 && ENsum!=6){
be9ef9f9 2398 for(Int_t rstep=0; rstep<10; rstep++){
2399 Float_t coeff = (rstep)*0.2*(0.18/1.2);
2400 Float_t phi1 = (fEvt)->fTracks[i].fPhi - asin((fEvt)->fTracks[i].fCharge*(0.1*fBfield)*coeff/(fEvt)->fTracks[i].fPt);
2401 if(phi1 > 2*PI) phi1 -= 2*PI;
2402 if(phi1 < 0) phi1 += 2*PI;
2403 Float_t phi2 = (fEvt+en2)->fTracks[j].fPhi - asin((fEvt+en2)->fTracks[j].fCharge*(0.1*fBfield)*coeff/(fEvt+en2)->fTracks[j].fPt);
2404 if(phi2 > 2*PI) phi2 -= 2*PI;
2405 if(phi2 < 0) phi2 += 2*PI;
2406 Float_t deltaphi = phi1 - phi2;
2407 if(deltaphi > PI) deltaphi -= PI;
2408 if(deltaphi < -PI) deltaphi += PI;
2409
2410 if(ENsum==0) ((TH3F*)fOutputList->FindObject("fPairsDetaDPhiNum"))->Fill(rstep, (fEvt)->fTracks[i].fEta-(fEvt+en2)->fTracks[j].fEta, deltaphi);
2411 else ((TH3F*)fOutputList->FindObject("fPairsDetaDPhiDen"))->Fill(rstep, (fEvt)->fTracks[i].fEta-(fEvt+en2)->fTracks[j].fEta, deltaphi);
2412 }
2413
2414 }// pair selection
2415
2416 // Check that label does not exceed stack size
2417 if((fEvt)->fTracks[i].fLabel < (fEvt)->fMCarraySize && (fEvt+en2)->fTracks[j].fLabel < (fEvt+en2)->fMCarraySize){
2418 if(ENsum==0 && abs((fEvt+en2)->fTracks[j].fLabel) == abs((fEvt)->fTracks[i].fLabel)) continue;
2419 pVect1MC[0]=sqrt(pow((fEvt)->fMCtracks[abs((fEvt)->fTracks[i].fLabel)].fPtot,2)+pow(fTrueMassPi,2));
2420 pVect2MC[0]=sqrt(pow((fEvt+en2)->fMCtracks[abs((fEvt+en2)->fTracks[j].fLabel)].fPtot,2)+pow(fTrueMassPi,2));
2421 pVect1MC[1]=(fEvt)->fMCtracks[abs((fEvt)->fTracks[i].fLabel)].fPx; pVect2MC[1]=(fEvt+en2)->fMCtracks[abs((fEvt+en2)->fTracks[j].fLabel)].fPx;
2422 pVect1MC[2]=(fEvt)->fMCtracks[abs((fEvt)->fTracks[i].fLabel)].fPy; pVect2MC[2]=(fEvt+en2)->fMCtracks[abs((fEvt+en2)->fTracks[j].fLabel)].fPy;
2423 pVect1MC[3]=(fEvt)->fMCtracks[abs((fEvt)->fTracks[i].fLabel)].fPz; pVect2MC[3]=(fEvt+en2)->fMCtracks[abs((fEvt+en2)->fTracks[j].fLabel)].fPz;
2424 qinv12MC = GetQinv(pVect1MC, pVect2MC);
86528e76 2425 Int_t chGroup2[2]={ch1,ch2};
2426
2427 if(fGenerateSignal && (ENsum==0 || ENsum==6)){
2428 if(ENsum==0) {
2429 Float_t WInput = MCWeight(chGroup2, fRMax, ffcSqMRC, qinv12MC, 0.);
2430 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[0].fTerms2->Fill(kT12, qinv12, WInput);
2431 }else{
2432 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[1].fTerms2->Fill(kT12, qinv12);
2433 }
2434 }
be9ef9f9 2435
2436 if(qinv12<0.1 && ch1==ch2 && ENsum==0) {
2437 ((TProfile*)fOutputList->FindObject("fQsmearMean"))->Fill(1.,qinv12-qinv12MC);
2438 ((TProfile*)fOutputList->FindObject("fQsmearSq"))->Fill(1.,1000.*pow(qinv12-qinv12MC,2));
2439 ((TH2D*)fOutputList->FindObject("fQ2Res"))->Fill(kT12, qinv12-qinv12MC);
2440 }
2441
2442 // secondary contamination
2443 if(ENsum==0){
2444 mcParticle1 = (AliAODMCParticle*)mcArray->At(abs((fEvt)->fTracks[i].fLabel));
2445 mcParticle2 = (AliAODMCParticle*)mcArray->At(abs((fEvt+en2)->fTracks[j].fLabel));
2446 if(!mcParticle1 || !mcParticle2) continue;
2447 if(abs(mcParticle1->GetPdgCode())==211 && abs(mcParticle2->GetPdgCode())==211){
2448 if(ch1==ch2) {
2449 ((TH3D*)fOutputList->FindObject("fAllSCPionPairs"))->Fill(fMbin+1, kT12, qinv12);
2450 if(!mcParticle1->IsSecondaryFromWeakDecay() && !mcParticle2->IsSecondaryFromWeakDecay()) {
2451 ((TH3D*)fOutputList->FindObject("fPrimarySCPionPairs"))->Fill(fMbin+1, kT12, qinv12);
2452 }
2453 }else{
2454 ((TH3D*)fOutputList->FindObject("fAllMCPionPairs"))->Fill(fMbin+1, kT12, qinv12);
2455 if(!mcParticle1->IsSecondaryFromWeakDecay() && !mcParticle2->IsSecondaryFromWeakDecay()) {
2456 ((TH3D*)fOutputList->FindObject("fPrimaryMCPionPairs"))->Fill(fMbin+1, kT12, qinv12);
2457 }
2458 }
2459 }
2460 }
2461
2462 if(ENsum==6){// all mixed events
86528e76 2463
be9ef9f9 2464 Float_t rForQW=5.0;
2465 if(fFSIindex<=1) rForQW=10;
2466 else if(fFSIindex==2) rForQW=9;
2467 else if(fFSIindex==3) rForQW=8;
2468 else if(fFSIindex==4) rForQW=7;
2469 else if(fFSIindex==5) rForQW=6;
2470 else if(fFSIindex==6) rForQW=5;
2471 else if(fFSIindex==7) rForQW=4;
2472 else if(fFSIindex==8) rForQW=3;
2473 else rForQW=2;
2474
2475
80507acf 2476 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[1].fMCqinv->Fill(qinv12MC, MCWeight(chGroup2, rForQW, ffcSqMRC, qinv12MC, 0.));// was 4,5
2477 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[1].fMCqinvQW->Fill(qinv12MC, qinv12MC*MCWeight(chGroup2, rForQW, ffcSqMRC, qinv12MC, 0.));// was 4,5
be9ef9f9 2478 // pion purity
2479 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[1].fPIDpurityDen->Fill(kT12, qinv12);
2480 Int_t SCNumber = 1;
2481 Int_t PdgCodeSum = abs((fEvt)->fMCtracks[abs((fEvt)->fTracks[i].fLabel)].fPdgCode) + abs((fEvt+en2)->fMCtracks[abs((fEvt+en2)->fTracks[j].fLabel)].fPdgCode);
2482 if(PdgCodeSum==22) SCNumber=1;// e-e
2483 else if(PdgCodeSum==24) SCNumber=2;// e-mu
2484 else if(PdgCodeSum==222) SCNumber=3;// e-pi
2485 else if(PdgCodeSum==332) SCNumber=4;// e-k
2486 else if(PdgCodeSum==2223) SCNumber=5;// e-p
2487 else if(PdgCodeSum==26) SCNumber=6;// mu-mu
2488 else if(PdgCodeSum==224) SCNumber=7;// mu-pi
2489 else if(PdgCodeSum==334) SCNumber=8;// mu-k
2490 else if(PdgCodeSum==2225) SCNumber=9;// mu-p
2491 else if(PdgCodeSum==422) SCNumber=10;// pi-pi
2492 else if(PdgCodeSum==532) SCNumber=11;// pi-k
2493 else if(PdgCodeSum==2423) SCNumber=12;// pi-p
2494 else if(PdgCodeSum==642) SCNumber=13;// k-k
2495 else if(PdgCodeSum==2533) SCNumber=14;// k-p
2496 else if(PdgCodeSum==4424) SCNumber=15;// p-p
2497 else {SCNumber=16;}
2498
2499 Charge1[bin1].Charge2[bin2].MB[fMbin].EDB[0].TwoPT[1].fPIDpurityNum->Fill(SCNumber, kT12, qinv12);
2500
2501 ///////////////////////
2502 // muon contamination
2503 Pparent1[0]=pVect1MC[0]; Pparent1[1]=pVect1MC[1]; Pparent1[2]=pVect1MC[2]; Pparent1[3]=pVect1MC[3];
2504 Pparent2[0]=pVect2MC[0]; Pparent2[1]=pVect2MC[1]; Pparent2[2]=pVect2MC[2]; Pparent2[3]=pVect2MC[3];
2505 pionParent1=kFALSE; pionParent2=kFALSE;
2506 FilledMCpair12=kTRUE;
2507 //
2508 if(abs((fEvt)->fMCtracks[abs((fEvt)->fTracks[i].fLabel)].fPdgCode)==13 || abs((fEvt+en2)->fMCtracks[abs((fEvt+en2)->fTracks[j].fLabel)].fPdgCode)==13){// muon check
2509 Int_t MotherLabel1 = (fEvt)->fMCtracks[abs((fEvt)->fTracks[i].fLabel)].fMotherLabel;
2510 if(abs((fEvt)->fMCtracks[MotherLabel1].fPdgCode)==211) {
2511 pionParent1=kTRUE;
2512 Pparent1[1] = (fEvt)->fMCtracks[MotherLabel1].fPx; Pparent1[2] = (fEvt)->fMCtracks[MotherLabel1].fPy; Pparent1[3] = (fEvt)->fMCtracks[MotherLabel1].fPz;
2513 Pparent1[0] = sqrt(pow(Pparent1[1],2)+pow(Pparent1[2],2)+pow(Pparent1[3],2)+pow(fTrueMassPi,2));
2514 }
2515 //
2516 if(abs((fEvt+en2)->fMCtracks[abs((fEvt+en2)->fTracks[j].fLabel)].fPdgCode)==13) {
2517 Int_t MotherLabel2 = (fEvt+en2)->fMCtracks[abs((fEvt+en2)->fTracks[j].fLabel)].fMotherLabel;
2518 if(abs((fEvt+en2)->fMCtracks[MotherLabel2].fPdgCode)==211) {
2519 pionParent2=kTRUE;
2520 Pparent2[1] = (fEvt+en2)->fMCtracks[MotherLabel2].fPx; Pparent2[2] = (fEvt+en2)->fMCtracks[MotherLabel2].fPy; Pparent2[3] = (fEvt+en2)->fMCtracks[MotherLabel2].fPz;
2521 Pparent2[0] = sqrt(pow(Pparent2[1],2)+pow(Pparent2[2],2)+pow(Pparent2[3],2)+pow(fTrueMassPi,2));
2522 }
2523 }
2524
2525 parentQinv12 = GetQinv(Pparent1, Pparent2);
2526
2527 if(pionParent1 || pionParent2){
2528 if(parentQinv12 > 0.001 && parentQinv12 < 0.3){
2529 Float_t muonPionK12 = FSICorrelation(ch1, ch2, qinv12MC);
2530 Float_t pionPionK12 = FSICorrelation(ch1, ch2, parentQinv12);
2531 for(Int_t term=1; term<=2; term++){
2532 for(Int_t Riter=0; Riter<fRVALUES; Riter++){
2533 Float_t Rvalue = 5+Riter;
2534 Float_t WInput = 1.0;
2535 if(term==1) {
2536 WInput = MCWeight(chGroup2, Rvalue, 1.0, parentQinv12, 0.);
5591748e 2537 }else{
be9ef9f9 2538 muonPionK12 = 1.0; pionPionK12=1.0;
2539 }
5591748e 2540
be9ef9f9 2541 Charge1[bin1].Charge2[bin2].MB[0].EDB[0].TwoPT[term-1].fMuonSmeared->Fill(Rvalue, qinv12MC, WInput);
2542 Charge1[bin1].Charge2[bin2].MB[0].EDB[0].TwoPT[term-1].fMuonIdeal->Fill(Rvalue, parentQinv12, WInput);
2543 Charge1[bin1].Charge2[bin2].MB[0].EDB[0].TwoPT[term-1].fMuonPionK2->Fill(Rvalue, qinv12MC, muonPionK12);
2544 Charge1[bin1].Charge2[bin2].MB[0].EDB[0].TwoPT[term-1].fPionPionK2->Fill(Rvalue, parentQinv12, pionPionK12);
2545 }// Riter
2546 }// term loop
2547
2548 if(ch1==ch2) ((TH3D*)fOutputList->FindObject("fMuonPionDeltaQinv"))->Fill(0., kT12, qinv12MC-parentQinv12);
2549 else ((TH3D*)fOutputList->FindObject("fMuonPionDeltaQinv"))->Fill(1., kT12, qinv12MC-parentQinv12);
2550 }// parentQ check
2551 }// pion parent check
2552 }// muon check
2553
2554
0207c034 2555 Int_t indexq2 = qinv12 / 0.005;
2556 if(indexq2 >=200) indexq2=199;
2557 Float_t WSpectrum = HIJINGq2WeightsSC[indexq2];
2558 if(ch1!=ch2) WSpectrum = HIJINGq2WeightsMC[indexq2];
be9ef9f9 2559 // momentum resolution
2560 for(Int_t Riter=0; Riter<fRVALUES; Riter++){
2561 Float_t Rvalue = 5+Riter;
80507acf 2562 Float_t WInput = MCWeight(chGroup2, Rvalue, ffcSqMRC, qinv12MC, 0.);
0207c034 2563 Charge1[bin1].Charge2[bin2].MB[0].EDB[kTindex].TwoPT[0].fIdeal->Fill(Rvalue, qinv12MC, WInput * WSpectrum);
2564 Charge1[bin1].Charge2[bin2].MB[0].EDB[kTindex].TwoPT[1].fIdeal->Fill(Rvalue, qinv12MC, WSpectrum);
2565 Charge1[bin1].Charge2[bin2].MB[0].EDB[kTindex].TwoPT[0].fSmeared->Fill(Rvalue, qinv12, WInput * WSpectrum);
2566 Charge1[bin1].Charge2[bin2].MB[0].EDB[kTindex].TwoPT[1].fSmeared->Fill(Rvalue, qinv12, WSpectrum);
be9ef9f9 2567 }
2568
2569 }// ENsum check
2570 }// MC array check
2571 }// MC case
2572
2573
6bb6954b 2574
be9ef9f9 2575 /////////////////////////////////////////////////////////////
2576 for (Int_t k=j+1; k<(fEvt+en3)->fNtracks; k++) {// 3rd particle
b71263d0 2577 if(en3==0) {
2578 if(fLowQPairSwitch_E0E0[i]->At(k)=='0') continue;
2579 if(fLowQPairSwitch_E0E0[j]->At(k)=='0') continue;
2580 }else if(en3==1){
2581 if(fLowQPairSwitch_E0E1[i]->At(k)=='0') continue;
2582 if(fLowQPairSwitch_E0E1[j]->At(k)=='0') continue;
2583 }else{
2584 if(fLowQPairSwitch_E0E2[i]->At(k)=='0') continue;
2585 if(fLowQPairSwitch_E1E2[j]->At(k)=='0') continue;
be9ef9f9 2586 }
86528e76 2587 if((fEvt+en3)->fTracks[k].fPt < fMinPt) continue;
2588 if((fEvt+en3)->fTracks[k].fPt > fMaxPt) continue;
2589
be9ef9f9 2590 pVect3[0]=(fEvt+en3)->fTracks[k].fEaccepted;
2591 pVect3[1]=(fEvt+en3)->fTracks[k].fP[0];
2592 pVect3[2]=(fEvt+en3)->fTracks[k].fP[1];
2593 pVect3[3]=(fEvt+en3)->fTracks[k].fP[2];
2594 ch3 = Int_t(((fEvt+en3)->fTracks[k].fCharge + 1)/2.);
2595 qinv13 = GetQinv(pVect1, pVect3);
2596 qinv23 = GetQinv(pVect2, pVect3);
2597 q3 = sqrt(pow(qinv12,2) + pow(qinv13,2) + pow(qinv23,2));
86528e76 2598 Int_t chGroup3[3]={ch1,ch2,ch3};
2599 Float_t QinvMCGroup3[3]={0};
2600 Float_t kTGroup3[3]={0};
be9ef9f9 2601 FilledMCtriplet123 = kFALSE;
0207c034 2602 if(fMCcase){
86528e76 2603 if((fEvt+en3)->fTracks[k].fLabel == (fEvt+en2)->fTracks[j].fLabel) continue;
2604 if((fEvt+en3)->fTracks[k].fLabel == (fEvt)->fTracks[i].fLabel) continue;
2605
2606 pVect3MC[0]=sqrt(pow((fEvt+en3)->fMCtracks[abs((fEvt+en3)->fTracks[k].fLabel)].fPtot,2)+pow(fTrueMassPi,2));
2607 pVect3MC[1]=(fEvt+en3)->fMCtracks[abs((fEvt+en3)->fTracks[k].fLabel)].fPx;
2608 pVect3MC[2]=(fEvt+en3)->fMCtracks[abs((fEvt+en3)->fTracks[k].fLabel)].fPy;
2609 pVect3MC[3]=(fEvt+en3)->fMCtracks[abs((fEvt+en3)->fTracks[k].fLabel)].fPz;
2610 qinv13MC = GetQinv(pVect1MC, pVect3MC);
2611 qinv23MC = GetQinv(pVect2MC, pVect3MC);
2612 QinvMCGroup3[0] = qinv12MC; QinvMCGroup3[1] = qinv13MC; QinvMCGroup3[2] = qinv23MC;
2613 }
2614
be9ef9f9 2615
2616 Bool_t fill2=kFALSE, fill3=kFALSE, fill4=kFALSE;
2617 SetFillBins3(ch1, ch2, ch3, 1, bin1, bin2, bin3, fill2, fill3, fill4);
2618
2619 Float_t KT3 = sqrt(pow(pVect1[1]+pVect2[1]+pVect3[1],2) + pow(pVect1[2]+pVect2[2]+pVect3[2],2))/3.;
2620 if(KT3<=fKT3transition) KT3index=0;
2621 else KT3index=1;
2622
2623 FSICorr13 = FSICorrelation(ch1,ch3, qinv13);
2624 FSICorr23 = FSICorrelation(ch2,ch3, qinv23);
80507acf 2625 if(!fGenerateSignal && !fMCcase) {
2626 momBin12 = fMomResC2SC->GetYaxis()->FindBin(qinv12);
2627 momBin13 = fMomResC2SC->GetYaxis()->FindBin(qinv13);
2628 momBin23 = fMomResC2SC->GetYaxis()->FindBin(qinv23);
2629 if(momBin12 >= 20) momBin12 = 19;
2630 if(momBin13 >= 20) momBin13 = 19;
2631 if(momBin23 >= 20) momBin23 = 19;
2632 //
2633 if(ch1==ch2) MomResCorr12 = fMomResC2SC->GetBinContent(rBinForTPNMomRes, momBin12);
2634 else MomResCorr12 = fMomResC2MC->GetBinContent(rBinForTPNMomRes, momBin12);
2635 if(ch1==ch3) MomResCorr13 = fMomResC2SC->GetBinContent(rBinForTPNMomRes, momBin13);
2636 else MomResCorr13 = fMomResC2MC->GetBinContent(rBinForTPNMomRes, momBin13);
2637 if(ch2==ch3) MomResCorr23 = fMomResC2SC->GetBinContent(rBinForTPNMomRes, momBin23);
2638 else MomResCorr23 = fMomResC2MC->GetBinContent(rBinForTPNMomRes, momBin23);
2639 }
be9ef9f9 2640 if(ENsum==0) {
86528e76 2641 Float_t Winput=1.0;
2642 if(fMCcase && fGenerateSignal) Winput = MCWeight3(1, fRMax, ffcSqMRC, chGroup3, QinvMCGroup3, kTGroup3);
2643 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fTerms3->Fill(q3, Winput);
2644 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fKfactor->Fill(q3, 1/(FSICorr12*FSICorr13*FSICorr23), Winput);
2645 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fKfactorWeighted->Fill(q3, 1/(FSICorr12*FSICorr13*FSICorr23), MomResCorr12*MomResCorr13*MomResCorr23 * Winput);
be9ef9f9 2646 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fMeanQinv->Fill(q3, qinv12);
2647 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fMeanQinv->Fill(q3, qinv13);
2648 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[0].fMeanQinv->Fill(q3, qinv23);
2649 }
2650 if(ENsum==6) {
2651 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fTerms3->Fill(q3);
2652 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fMeanQinv->Fill(q3, qinv12);
2653 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fMeanQinv->Fill(q3, qinv13);
2654 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fMeanQinv->Fill(q3, qinv23);
2655 }
2656 if(ENsum==3){
86528e76 2657 Float_t Winput=1.0;
be9ef9f9 2658 if(fill2) {
86528e76 2659 if(fMCcase && fGenerateSignal) Winput = MCWeight3(2, fRMax, ffcSqMRC, chGroup3, QinvMCGroup3, kTGroup3);
2660 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fTerms3->Fill(q3, Winput);
2661 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fKfactor->Fill(q3, 1/(FSICorr12), Winput);
2662 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fKfactorWeighted->Fill(q3, 1/(FSICorr12), MomResCorr12 * Winput);
be9ef9f9 2663 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fMeanQinv->Fill(q3, qinv12);
2664 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fMeanQinv->Fill(q3, qinv13);
2665 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[1].fMeanQinv->Fill(q3, qinv23);
2666 }if(fill3) {
86528e76 2667 if(fMCcase && fGenerateSignal) Winput = MCWeight3(3, fRMax, ffcSqMRC, chGroup3, QinvMCGroup3, kTGroup3);
2668 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fTerms3->Fill(q3, Winput);
2669 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fKfactor->Fill(q3, 1/(FSICorr12), Winput);
2670 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fKfactorWeighted->Fill(q3, 1/(FSICorr12), MomResCorr12 * Winput);
be9ef9f9 2671 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fMeanQinv->Fill(q3, qinv12);
2672 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fMeanQinv->Fill(q3, qinv13);
2673 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[2].fMeanQinv->Fill(q3, qinv23);
2674 }if(fill4) {
86528e76 2675 if(fMCcase && fGenerateSignal) Winput = MCWeight3(4, fRMax, ffcSqMRC, chGroup3, QinvMCGroup3, kTGroup3);
2676 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fTerms3->Fill(q3, Winput);
2677 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fKfactor->Fill(q3, 1/(FSICorr12), Winput);
2678 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fKfactorWeighted->Fill(q3, 1/(FSICorr12), MomResCorr12 * Winput);
be9ef9f9 2679 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fMeanQinv->Fill(q3, qinv12);
2680 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fMeanQinv->Fill(q3, qinv13);
2681 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[3].fMeanQinv->Fill(q3, qinv23);
2682 }
2683 }
2684
2685 // r3 denominator
0207c034 2686 if(ENsum==6 && ch1==ch2 && ch1==ch3 && fPbPbcase){
6432c081 2687 Positive1stTripletWeights = kTRUE;
be9ef9f9 2688 //
2689 GetWeight(pVect1, pVect2, weight12, weight12Err);
2690 GetWeight(pVect1, pVect3, weight13, weight13Err);
2691 GetWeight(pVect2, pVect3, weight23, weight23Err);
2692
2693 if(sqrt(fabs(weight12*weight13*weight23)) > 1.0) {// weight should never be larger than 1
2694 if(fMbin==0 && bin1==0) {
2695 ((TH1D*)fOutputList->FindObject("fTPNRejects3pion1"))->Fill(q3, sqrt(fabs(weight12*weight13*weight23)));
2696 }
2697 }else{
2698
5591748e 2699 Float_t MuonCorr12=1.0, MuonCorr13=1.0, MuonCorr23=1.0;
be9ef9f9 2700 if(!fGenerateSignal && !fMCcase) {
5591748e 2701 MuonCorr12 = fWeightmuonCorrection->GetBinContent(rBinForTPNMomRes, momBin12);
2702 MuonCorr13 = fWeightmuonCorrection->GetBinContent(rBinForTPNMomRes, momBin13);
2703 MuonCorr23 = fWeightmuonCorrection->GetBinContent(rBinForTPNMomRes, momBin23);
be9ef9f9 2704 }
fac2d84b 2705
5591748e 2706 // no MRC, no Muon Correction
2707 weight12CC[0] = ((weight12+1) - ffcSq*FSICorr12 - (1-ffcSq));
2708 weight12CC[0] /= FSICorr12*ffcSq;
2709 weight13CC[0] = ((weight13+1) - ffcSq*FSICorr13 - (1-ffcSq));
2710 weight13CC[0] /= FSICorr13*ffcSq;
2711 weight23CC[0] = ((weight23+1) - ffcSq*FSICorr23 - (1-ffcSq));
2712 weight23CC[0] /= FSICorr23*ffcSq;
2713 if(weight12CC[0] > 0 && weight13CC[0] > 0 && weight23CC[0] > 0){
2714 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fTwoPartNorm->Fill(1, q3, sqrt(weight12CC[0]*weight13CC[0]*weight23CC[0]));
2715 }
2716 // no Muon Correction
2717 weight12CC[1] = ((weight12+1)*MomResCorr12 - ffcSq*FSICorr12 - (1-ffcSq));
2718 weight12CC[1] /= FSICorr12*ffcSq;
2719 weight13CC[1] = ((weight13+1)*MomResCorr13 - ffcSq*FSICorr13 - (1-ffcSq));
2720 weight13CC[1] /= FSICorr13*ffcSq;
2721 weight23CC[1] = ((weight23+1)*MomResCorr23 - ffcSq*FSICorr23 - (1-ffcSq));
2722 weight23CC[1] /= FSICorr23*ffcSq;
2723 if(weight12CC[1] > 0 && weight13CC[1] > 0 && weight23CC[1] > 0){
2724 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fTwoPartNorm->Fill(2, q3, sqrt(weight12CC[1]*weight13CC[1]*weight23CC[1]));
2725 }
2726 // both Corrections
2727 weight12CC[2] = ((weight12+1)*MomResCorr12 - ffcSq*FSICorr12 - (1-ffcSq));
2728 weight12CC[2] /= FSICorr12*ffcSq;
2729 weight12CC[2] *= MuonCorr12;
2730 weight13CC[2] = ((weight13+1)*MomResCorr13 - ffcSq*FSICorr13 - (1-ffcSq));
2731 weight13CC[2] /= FSICorr13*ffcSq;
2732 weight13CC[2] *= MuonCorr13;
2733 weight23CC[2] = ((weight23+1)*MomResCorr23 - ffcSq*FSICorr23 - (1-ffcSq));
2734 weight23CC[2] /= FSICorr23*ffcSq;
2735 weight23CC[2] *= MuonCorr23;
6432c081 2736
5591748e 2737 if(weight12CC[2] < 0 || weight13CC[2] < 0 || weight23CC[2] < 0) {// C2^QS can never be less than unity
be9ef9f9 2738 if(fMbin==0 && bin1==0) {
5591748e 2739 ((TH1D*)fOutputList->FindObject("fTPNRejects3pion2"))->Fill(q3, sqrt(fabs(weight12CC[2]*weight13CC[2]*weight23CC[2])));
be9ef9f9 2740 }
6432c081 2741 if(weight12CC[2] < 0) weight12CC[2]=0;
2742 if(weight13CC[2] < 0) weight13CC[2]=0;
2743 if(weight23CC[2] < 0) weight23CC[2]=0;
2744 Positive1stTripletWeights = kFALSE;
2745 }
2746 /////////////////////////////////////////////////////
2747 weightTotal = sqrt(weight12CC[2]*weight13CC[2]*weight23CC[2]);
2748 /////////////////////////////////////////////////////
2749 if(Positive1stTripletWeights){
5591748e 2750 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fTwoPartNorm->Fill(3, q3, weightTotal);
ab890ec3 2751 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fTwoPartNorm->Fill(4, q3, 1);
6432c081 2752 }else{
2753 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fTwoPartNegNorm->Fill(4, q3, 1);
2754 }
0207c034 2755
6432c081 2756 //
2757 // Full Weight reconstruction
2758
2759 for(Int_t RcohIndex=0; RcohIndex<2; RcohIndex++){// Rcoh=0, then Rcoh=Rch
9c0557fb 2760 for(Int_t GIndex=0; GIndex<50; GIndex++){
2761 Int_t FillBin = 5 + RcohIndex*50 + GIndex;
6432c081 2762 Float_t G = 0.02*GIndex;
2763 if(RcohIndex==0){
2764 T12 = (-2*G*(1-G) + sqrt(pow(2*G*(1-G),2) + 4*pow(1-G,2)*weight12CC[2])) / (2*pow(1-G,2));
2765 T13 = (-2*G*(1-G) + sqrt(pow(2*G*(1-G),2) + 4*pow(1-G,2)*weight13CC[2])) / (2*pow(1-G,2));
2766 T23 = (-2*G*(1-G) + sqrt(pow(2*G*(1-G),2) + 4*pow(1-G,2)*weight23CC[2])) / (2*pow(1-G,2));
2767 weightTotal = 2*G*(1-G)*(T12 + T13 + T23) + pow(1-G,2)*(T12*T12 + T13*T13 + T23*T23);
2768 weightTotal += 2*G*pow(1-G,2)*(T12*T13 + T12*T23 + T13*T23) + 2*pow(1-G,3)*T12*T13*T23;
2769 }else{
95567836 2770 T12 = sqrt(weight12CC[2] / (1-G*G));
2771 T13 = sqrt(weight13CC[2] / (1-G*G));
2772 T23 = sqrt(weight23CC[2] / (1-G*G));
2773 weightTotal = (1-G*G)*(T12*T12 + T13*T13 + T23*T23);
2774 weightTotal += (6*G*pow(1-G,2) + 2*pow(1-G,3)) * T12*T13*T23;
6432c081 2775 }
2776 if(Positive1stTripletWeights){
ab890ec3 2777 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fTwoPartNorm->Fill(FillBin, q3, weightTotal);
6432c081 2778 }else{
2779 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fTwoPartNegNorm->Fill(FillBin, q3, weightTotal);
ab890ec3 2780 }
2781 }
6432c081 2782 }
2783 //
2784 /*weight12CC_e = weight12Err*MomResCorr12 / FSICorr12 / ffcSq * MuonCorr12;
43046300 2785 weight13CC_e = weight13Err*MomResCorr13 / FSICorr13 / ffcSq * MuonCorr13;
2786 weight23CC_e = weight23Err*MomResCorr23 / FSICorr23 / ffcSq * MuonCorr23;
2787 if(weight12CC[2]*weight13CC[2]*weight23CC[2] > 0){
6432c081 2788 weightTotalErr = pow(2 * sqrt(3) * weight12CC_e*weight13CC[2]*weight23CC[2] / sqrt(weight12CC[2]*weight13CC[2]*weight23CC[2]),2);
43046300 2789 }
2790 weightTotalErr += pow(weight12CC_e,2) + pow(weight13CC_e,2) + pow(weight23CC_e,2);
ab890ec3 2791 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[fMbin].EDB[KT3index].ThreePT[4].fTwoPartNormErr->Fill(4, q3, weightTotalErr);*/
5591748e 2792
be9ef9f9 2793 }// 1st r3 den check
5591748e 2794
be9ef9f9 2795 }// r3 den
2796
4bf06935 2797
2798 if(ch1==ch2 && ch1==ch3){
2799 Float_t pt1=sqrt(pow(pVect1[1],2)+pow(pVect1[2],2));
2800 Float_t pt2=sqrt(pow(pVect2[1],2)+pow(pVect2[2],2));
2801 Float_t pt3=sqrt(pow(pVect3[1],2)+pow(pVect3[2],2));
2802 if(ENsum==0){
2803 ((TH3D*)fOutputList->FindObject("fKT3DistTerm1"))->Fill(fMbin+1, KT3, q3);
2804 if(q3<0.1){
2805 ((TProfile2D*)fOutputList->FindObject("fKT3AvgpT"))->Fill(fMbin+1, KT3index, pt1);
2806 ((TProfile2D*)fOutputList->FindObject("fKT3AvgpT"))->Fill(fMbin+1, KT3index, pt2);
2807 ((TProfile2D*)fOutputList->FindObject("fKT3AvgpT"))->Fill(fMbin+1, KT3index, pt3);
2808 }
2809 }
2810 if(fMbin==0){
2811 if(ENsum==0){
2812 ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum0"))->Fill(KT3index, q3, pt1);
2813 ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum0"))->Fill(KT3index, q3, pt2);
2814 ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum0"))->Fill(KT3index, q3, pt3);
2815 }
2816 if(ENsum==3){
2817 ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum3"))->Fill(KT3index, q3, pt1);
2818 ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum3"))->Fill(KT3index, q3, pt2);
2819 ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum3"))->Fill(KT3index, q3, pt3);
2820 }
2821 if(ENsum==6){
2822 ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum6"))->Fill(KT3index, q3, pt1);
2823 ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum6"))->Fill(KT3index, q3, pt2);
2824 ((TH3D*)fOutputList->FindObject("fQ3AvgpTENsum6"))->Fill(KT3index, q3, pt3);
9c0557fb 2825 }
be9ef9f9 2826 }
9c0557fb 2827
be9ef9f9 2828 }
2829 if(ch1==ch2 && ch1==ch3 && ENsum==6) ((TH3D*)fOutputList->FindObject("fKT3DistTerm5"))->Fill(fMbin+1, KT3, q3);
2830
2831
2832
2833
2834 if(fMCcase && ENsum==6 && FilledMCpair12){// for momentum resolution and muon correction
2835 if((fEvt+en3)->fTracks[k].fLabel < (fEvt+en3)->fMCarraySize){
2836
2837 pVect3MC[0]=sqrt(pow((fEvt+en3)->fMCtracks[abs((fEvt+en3)->fTracks[k].fLabel)].fPtot,2)+pow(fTrueMassPi,2));
2838 pVect3MC[1]=(fEvt+en3)->fMCtracks[abs((fEvt+en3)->fTracks[k].fLabel)].fPx;
2839 pVect3MC[2]=(fEvt+en3)->fMCtracks[abs((fEvt+en3)->fTracks[k].fLabel)].fPy;
2840 pVect3MC[3]=(fEvt+en3)->fMCtracks[abs((fEvt+en3)->fTracks[k].fLabel)].fPz;
2841 qinv13MC = GetQinv(pVect1MC, pVect3MC);
2842 qinv23MC = GetQinv(pVect2MC, pVect3MC);
2843
2844 q3MC = sqrt(pow(qinv12MC,2)+pow(qinv13MC,2)+pow(qinv23MC,2));
2845 if(q3<0.1 && ch1==ch2 && ch1==ch3) ((TH2D*)fOutputList->FindObject("fQ3Res"))->Fill(KT3, q3-q3MC);
2846
4bf06935 2847 //Float_t TripletWeightTTC=1.0;// same-charge weights to mimic two-track depletion of same-charge pairs
fac2d84b 2848 //if(ch1==ch2 && qinv12>0.006) TripletWeightTTC *= SCpairWeight->Eval(qinv12);
2849 //if(ch1==ch3 && qinv13>0.006) TripletWeightTTC *= SCpairWeight->Eval(qinv13);
2850 //if(ch2==ch3 && qinv23>0.006) TripletWeightTTC *= SCpairWeight->Eval(qinv23);
2851
86528e76 2852
be9ef9f9 2853 Pparent3[0]=pVect3MC[0]; Pparent3[1]=pVect3MC[1]; Pparent3[2]=pVect3MC[2]; Pparent3[3]=pVect3MC[3];
2854 pionParent3=kFALSE;
2855
2856 if(abs((fEvt+en3)->fMCtracks[abs((fEvt+en3)->fTracks[k].fLabel)].fPdgCode)==13){// muon check
2857 Int_t MotherLabel3 = (fEvt+en3)->fMCtracks[abs((fEvt+en3)->fTracks[k].fLabel)].fMotherLabel;
2858 if(abs((fEvt+en3)->fMCtracks[MotherLabel3].fPdgCode)==211) {
2859 pionParent3=kTRUE;
2860 Pparent3[1] = (fEvt+en3)->fMCtracks[MotherLabel3].fPx; Pparent3[2] = (fEvt+en3)->fMCtracks[MotherLabel3].fPy; Pparent3[3] = (fEvt+en3)->fMCtracks[MotherLabel3].fPz;
2861 Pparent3[0] = sqrt(pow(Pparent3[1],2)+pow(Pparent3[2],2)+pow(Pparent3[3],2)+pow(fTrueMassPi,2));
2862 }
2863 }
2864
2865 parentQinv13 = GetQinv(Pparent1, Pparent3);
2866 parentQinv23 = GetQinv(Pparent2, Pparent3);
2867 parentQ3 = sqrt(pow(parentQinv12,2) + pow(parentQinv13,2) + pow(parentQinv23,2));
2868
2869 if(parentQinv12 > 0.001 && parentQinv13 > 0.001 && parentQinv23 > 0.001 && parentQ3 < 0.5){
2870 FilledMCtriplet123=kTRUE;
2871 if(pionParent1 || pionParent2 || pionParent3) {// want at least one pion-->muon
2872
2873 Float_t parentQinvGroup3[3]={parentQinv12, parentQinv13, parentQinv23};
2874 //Float_t parentkTGroup3[3]={float(sqrt(pow(Pparent1[1]+Pparent2[1],2) + pow(Pparent1[2]+Pparent2[2],2))/2.),
2875 //float(sqrt(pow(Pparent1[1]+Pparent3[1],2) + pow(Pparent1[2]+Pparent3[2],2))/2.),
2876 //float(sqrt(pow(Pparent2[1]+Pparent3[1],2) + pow(Pparent2[2]+Pparent3[2],2))/2.)};
2877 Float_t parentkTGroup3[3]={0};
2878
2879 ((TH2D*)fOutputList->FindObject("fAvgQ12VersusQ3"))->Fill(parentQ3, parentQinv12);
2880 ((TH2D*)fOutputList->FindObject("fAvgQ13VersusQ3"))->Fill(parentQ3, parentQinv13);
2881 ((TH2D*)fOutputList->FindObject("fAvgQ23VersusQ3"))->Fill(parentQ3, parentQinv23);
2882
5591748e 2883 for(Int_t term=1; term<=4; term++){
2884 if(term==1) {}
2885 else if(term==2) {if(!pionParent1 && !pionParent2) continue;}
2886 else if(term==3) {if(!pionParent1 && !pionParent3) continue;}
2887 else {if(!pionParent2 && !pionParent3) continue;}
be9ef9f9 2888 for(Int_t Riter=0; Riter<fRVALUES; Riter++){
2889 Float_t Rvalue = 5+Riter;
2890 Float_t WInput = MCWeight3(term, Rvalue, 1.0, chGroup3, parentQinvGroup3, parentkTGroup3);
2891 Float_t WInputParentFSI = MCWeightFSI3(term, Rvalue, 1.0, chGroup3, parentQinvGroup3);
2892 Float_t WInputFSI = MCWeightFSI3(term, Rvalue, 1.0, chGroup3, QinvMCGroup3);
4bf06935 2893 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[0].ThreePT[term-1].fMuonSmeared->Fill(1, Rvalue, q3MC, WInput);
2894 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[0].ThreePT[term-1].fMuonIdeal->Fill(1, Rvalue, parentQ3, WInput);
2895 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[0].ThreePT[term-1].fMuonPionK3->Fill(1, Rvalue, q3MC, WInputFSI);
2896 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[0].ThreePT[term-1].fPionPionK3->Fill(1, Rvalue, parentQ3, WInputParentFSI);
5591748e 2897 //
4bf06935 2898 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[0].ThreePT[term-1].fMuonSmeared->Fill(2, Rvalue, q3MC);
2899 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[0].ThreePT[term-1].fMuonIdeal->Fill(2, Rvalue, parentQ3);
2900 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[0].ThreePT[term-1].fMuonPionK3->Fill(2, Rvalue, q3MC);
2901 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[0].ThreePT[term-1].fPionPionK3->Fill(2, Rvalue, parentQ3);
be9ef9f9 2902 }// Riter
2903 }// term loop
2904
2905 }// pion parent check
2906 }// parentQ check (muon correction)
4bf06935 2907
0207c034 2908
2909 Int_t indexq3 = q3 / 0.005;
2910 if(indexq3 >=35) indexq3=34;
2911 Float_t WSpectrum = HIJINGq3WeightsSC[indexq3];
2912 if(ch1!=ch2 || ch1!=ch3) WSpectrum = HIJINGq3WeightsMC[indexq3];
be9ef9f9 2913 // 3-pion momentum resolution
2914 for(Int_t term=1; term<=5; term++){
2915 for(Int_t Riter=0; Riter<fRVALUES; Riter++){
2916 Float_t Rvalue = 5+Riter;
80507acf 2917 Float_t WInput = MCWeight3(term, Rvalue, ffcSqMRC, chGroup3, QinvMCGroup3, kTGroup3);
0207c034 2918 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[KT3index].ThreePT[term-1].fIdeal->Fill(Rvalue, q3MC, WInput*WSpectrum);
2919 Charge1[bin1].Charge2[bin2].Charge3[bin3].MB[0].EDB[KT3index].ThreePT[term-1].fSmeared->Fill(Rvalue, q3, WInput*WSpectrum);
be9ef9f9 2920 }
2921 }
2922
2923 }// 3rd particle label check
2924 }// MCcase and ENsum==6
2925
5591748e 2926
be9ef9f9 2927
2928
5591748e 2929 /////////////////////////////////////////////////////////////
be9ef9f9 2930 for (Int_t l=k+1; l<(fEvt+en4)->fNtracks; l++) {// 4th particle
b71263d0 2931 if(en4==0){
2932 if(fLowQPairSwitch_E0E0[i]->At(l)=='0') continue;
2933 if(fLowQPairSwitch_E0E0[j]->At(l)=='0') continue;
2934 if(fLowQPairSwitch_E0E0[k]->At(l)=='0') continue;
2935 }else if(en4==1){
6bb6954b 2936 if(en3==0){
2937 if(fLowQPairSwitch_E0E1[i]->At(l)=='0') continue;
2938 if(fLowQPairSwitch_E0E1[j]->At(l)=='0') continue;
2939 if(fLowQPairSwitch_E0E1[k]->At(l)=='0') continue;
2940 }else{
2941 if(fLowQPairSwitch_E0E1[i]->At(l)=='0') continue;
2942 if(fLowQPairSwitch_E0E1[j]->At(l)=='0') continue;
2943 if(fLowQPairSwitch_E1E1[k]->At(l)=='0') continue;
2944 }
b71263d0 2945 }else if(en4==2){
2946 if(fLowQPairSwitch_E0E2[i]->At(l)=='0') continue;
2947 if(fLowQPairSwitch_E0E2[j]->At(l)=='0') continue;
2948 if(fLowQPairSwitch_E1E2[k]->At(l)=='0') continue;
2949 }else{
2950 if(fLowQPairSwitch_E0E3[i]->At(l)=='0') continue;
2951 if(fLowQPairSwitch_E1E3[j]->At(l)=='0') continue;
2952 if(fLowQPairSwitch_E2E3[k]->At(l)=='0') continue;
be9ef9f9 2953 }
86528e76 2954 if((fEvt+en4)->fTracks[l].fPt < fMinPt) continue;
2955 if((fEvt+en4)->fTracks[l].fPt > fMaxPt) continue;
2956
be9ef9f9 2957 pVect4[0]=(fEvt+en4)->fTracks[l].fEaccepted;
2958 pVect4[1]=(fEvt+en4)->fTracks[l].fP[0];
2959 pVect4[2]=(fEvt+en4)->fTracks[l].fP[1];
2960 pVect4[3]=(fEvt+en4)->fTracks[l].fP[2];
2961 ch4 = Int_t(((fEvt+en4)->fTracks[l].fCharge + 1)/2.);
2962 qinv14 = GetQinv(pVect1, pVect4);
2963 qinv24 = GetQinv(pVect2, pVect4);
2964 qinv34 = GetQinv(pVect3, pVect4);
2965 q4 = sqrt(pow(q3,2) + pow(qinv14,2) + pow(qinv24,2) + pow(qinv34,2));
86528e76 2966 Int_t chGroup4[4]={ch1,ch2,ch3,ch4};
2967 Float_t QinvMCGroup4[6]={0};
2968 Float_t kTGroup4[6]={0};
2969
0207c034 2970 if(fMCcase){// for momentum resolution and muon correction
86528e76 2971 if((fEvt+en4)->fTracks[l].fLabel == (fEvt+en3)->fTracks[k].fLabel) continue;
2972 if((fEvt+en4)->fTracks[l].fLabel == (fEvt+en2)->fTracks[j].fLabel) continue;
2973 if((fEvt+en4)->fTracks[l].fLabel == (fEvt)->fTracks[i].fLabel) continue;
2974
2975 pVect4MC[0]=sqrt(pow((fEvt+en4)->fMCtracks[abs((fEvt+en4)->fTracks[l].fLabel)].fPtot,2)+pow(fTrueMassPi,2));
2976 pVect4MC[1]=(fEvt+en4)->fMCtracks[abs((fEvt+en4)->fTracks[l].fLabel)].fPx;
2977 pVect4MC[2]=(fEvt+en4)->fMCtracks[abs((fEvt+en4)->fTracks[l].fLabel)].fPy;
2978 pVect4MC[3]=(fEvt+en4)->fMCtracks[abs((fEvt+en4)->fTracks[l].fLabel)].fPz;
2979 qinv14MC = GetQinv(pVect1MC, pVect4MC);
2980 qinv24MC = GetQinv(pVect2MC, pVect4MC);
2981 qinv34MC = GetQinv(pVect3MC, pVect4MC);
2982
2983 QinvMCGroup4[0] = qinv12MC; QinvMCGroup4[1] = qinv13MC; QinvMCGroup4[2] = qinv14MC;
2984 QinvMCGroup4[3] = qinv23MC; QinvMCGroup4[4] = qinv24MC; QinvMCGroup4[5] = qinv34MC;
2985 //if(q4<0.1 && ENsum==0 && bin1==bin2 && bin1==bin3 && bin1==bin4) cout<<q4<<" "<<fRMax<<" "<<ffcSqMRC<<" "<<chGroup4[0]<<" "<<chGroup4[1]<<" "<<chGroup4[2]<<" "<<chGroup4[3]<<" "<<QinvMCGroup4[0]<<" "<<QinvMCGroup4[1]<<" "<<QinvMCGroup4[2]<<" "<<QinvMCGroup4[3]<<" "<<QinvMCGroup4[4]<<" "<<QinvMCGroup4[5]<<endl;
be9ef9f9 2986
86528e76 2987 }
be9ef9f9 2988 if(ch1==ch2 && ch1==ch3 && ch1==ch4 && ENsum==6){
2989 ((TH2D*)fOutputList->FindObject("DistQinv4pion"))->Fill(1, qinv12); ((TH2D*)fOutputList->FindObject("DistQinv4pion"))->Fill(2, qinv13);
2990 ((TH2D*)fOutputList->FindObject("DistQinv4pion"))->Fill(3, qinv14); ((TH2D*)fOutputList->FindObject("DistQinv4pion"))->Fill(4, qinv23);
2991 ((TH2D*)fOutputList->FindObject("DistQinv4pion"))->Fill(5, qinv24); ((TH2D*)fOutputList->FindObject("DistQinv4pion"))->Fill(6, qinv34);
2992 }
2993
2994 Float_t KT4 = sqrt(pow(pVect1[1]+pVect2[1]+pVect3[1]+pVect4[1],2) + pow(pVect1[2]+pVect2[2]+pVect3[2]+pVect4[2],2))/4.;
2995 if(KT4<=fKT4transition) KT4index=0;
2996 else KT4index=1;
2997
2998 FSICorr14 = FSICorrelation(ch1,ch4, qinv14);
2999 FSICorr24 = FSICorrelation(ch2,ch4, qinv24);
3000 FSICorr34 = FSICorrelation(ch3,ch4, qinv34);
80507acf 3001
3002 if(!fGenerateSignal && !fMCcase) {
3003 momBin14 = fMomResC2SC->GetYaxis()->FindBin(qinv14);
3004 momBin24 = fMomResC2SC->GetYaxis()->FindBin(qinv24);
3005 momBin34 = fMomResC2SC->GetYaxis()->FindBin(qinv34);
3006 if(momBin14 >= 20) momBin14 = 19;
3007 if(momBin24 >= 20) momBin24 = 19;
3008 if(momBin34 >= 20) momBin34 = 19;
3009 //
3010 if(ch1==ch4) MomResCorr14 = fMomResC2SC->GetBinContent(rBinForTPNMomRes, momBin14);
3011 else MomResCorr14 = fMomResC2MC->GetBinContent(rBinForTPNMomRes, momBin14);
3012 if(ch2==ch4) MomResCorr24 = fMomResC2SC->GetBinContent(rBinForTPNMomRes, momBin24);
3013 else MomResCorr24 = fMomResC2MC->GetBinContent(rBinForTPNMomRes, momBin24);
3014 if(ch3==ch4) MomResCorr34 = fMomResC2SC->GetBinContent(rBinForTPNMomRes, momBin34);
3015 else MomResCorr34 = fMomResC2MC->GetBinContent(rBinForTPNMomRes, momBin34);
3016 }
3017
6bb6954b 3018 Bool_t FillTerms[13]={kFALSE};
be9ef9f9 3019 SetFillBins4(ch1, ch2, ch3, ch4, bin1, bin2, bin3, bin4, ENsum, FillTerms);
3020 //
6bb6954b 3021 for(int ft=0; ft<13; ft++) {
be9ef9f9 3022 Float_t FSIfactor = 1.0;
80507acf 3023 Float_t MomResWeight = 1.0;
86528e76 3024 Float_t WInput = 1.0;
3025 if(fMCcase && fGenerateSignal) WInput = MCWeight4(ft+1, fRMax, ffcSqMRC, chGroup4, QinvMCGroup4, kTGroup4);
80507acf 3026 if(ft==0) {
3027 FSIfactor = 1/(FSICorr12 * FSICorr13 * FSICorr14 * FSICorr23 * FSICorr24 * FSICorr34);
3028 MomResWeight = MomResCorr12 * MomResCorr13 * MomResCorr14 * MomResCorr23 * MomResCorr24 * MomResCorr34;
3029 }else if(ft<=4) {
3030 FSIfactor = 1/(FSICorr12 * FSICorr13 * FSICorr23);
3031 MomResWeight = MomResCorr12 * MomResCorr13 * MomResCorr23;
3032 }else if(ft<=10) {
3033 FSIfactor = 1/(FSICorr12);
3034 MomResWeight = MomResCorr12;
3035 }else if(ft==11) {
3036 FSIfactor = 1/(FSICorr12 * FSICorr34);
3037 MomResWeight = MomResCorr12 * MomResCorr34;
3038 }else {FSIfactor = 1.0; MomResWeight = 1.0;}
be9ef9f9 3039 if(FillTerms[ft]) {
86528e76 3040 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[ft].fTerms4->Fill(q4, WInput);
3041 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[ft].fKfactor->Fill(q4, FSIfactor, WInput);
3042 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[ft].fKfactorWeighted->Fill(q4, FSIfactor, MomResWeight*WInput);
be9ef9f9 3043 }
3044 }
3045
3046 /////////////////////////////////////////////////////////////
3047 // r4{2}
0207c034 3048 if(ch1==ch2 && ch1==ch3 && ch1==ch4 && ENsum==6 && fPbPbcase){
6432c081 3049 Positive2ndTripletWeights=kTRUE;
3050 //
be9ef9f9 3051 GetWeight(pVect1, pVect4, weight14, weight14Err);
3052 GetWeight(pVect2, pVect4, weight24, weight24Err);
3053 GetWeight(pVect3, pVect4, weight34, weight34Err);
3054
5591748e 3055 Float_t MuonCorr14=1.0, MuonCorr24=1.0, MuonCorr34=1.0;
be9ef9f9 3056 if(!fGenerateSignal && !fMCcase) {
5591748e 3057 MuonCorr14 = fWeightmuonCorrection->GetBinContent(rBinForTPNMomRes, momBin14);
3058 MuonCorr24 = fWeightmuonCorrection->GetBinContent(rBinForTPNMomRes, momBin24);
3059 MuonCorr34 = fWeightmuonCorrection->GetBinContent(rBinForTPNMomRes, momBin34);
be9ef9f9 3060 }
5591748e 3061
3062 // no MRC, no Muon Correction
3063 weight14CC[0] = ((weight14+1) - ffcSq*FSICorr14 - (1-ffcSq));
3064 weight14CC[0] /= FSICorr14*ffcSq;
3065 weight24CC[0] = ((weight24+1) - ffcSq*FSICorr24 - (1-ffcSq));
3066 weight24CC[0] /= FSICorr24*ffcSq;
3067 weight34CC[0] = ((weight34+1) - ffcSq*FSICorr34 - (1-ffcSq));
3068 weight34CC[0] /= FSICorr34*ffcSq;
3069 if(weight14CC[0] > 0 && weight24CC[0] > 0 && weight34CC[0] > 0 && weight12CC[0] > 0 && weight13CC[0] > 0 && weight23CC[0] > 0){
3070 weightTotal = sqrt(weight12CC[0]*weight13CC[0]*weight24CC[0]*weight34CC[0]);
3071 weightTotal += sqrt(weight12CC[0]*weight14CC[0]*weight23CC[0]*weight34CC[0]);
3072 weightTotal += sqrt(weight13CC[0]*weight14CC[0]*weight23CC[0]*weight24CC[0]);
3073 weightTotal /= 3.;
3074 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fTwoPartNorm->Fill(1, q4, weightTotal);
3075 }
3076 // no Muon Correction
3077 weight14CC[1] = ((weight14+1)*MomResCorr14 - ffcSq*FSICorr14 - (1-ffcSq));
3078 weight14CC[1] /= FSICorr14*ffcSq;
3079 weight24CC[1] = ((weight24+1)*MomResCorr24 - ffcSq*FSICorr24 - (1-ffcSq));
3080 weight24CC[1] /= FSICorr24*ffcSq;
3081 weight34CC[1] = ((weight34+1)*MomResCorr34 - ffcSq*FSICorr34 - (1-ffcSq));
3082 weight34CC[1] /= FSICorr34*ffcSq;
3083 if(weight14CC[1] > 0 && weight24CC[1] > 0 && weight34CC[1] > 0 && weight12CC[1] > 0 && weight13CC[1] > 0 && weight23CC[1] > 0){
3084 weightTotal = sqrt(weight12CC[1]*weight13CC[1]*weight24CC[1]*weight34CC[1]);
3085 weightTotal += sqrt(weight12CC[1]*weight14CC[1]*weight23CC[1]*weight34CC[1]);
3086 weightTotal += sqrt(weight13CC[1]*weight14CC[1]*weight23CC[1]*weight24CC[1]);
3087 weightTotal /= 3.;
3088 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fTwoPartNorm->Fill(2, q4, weightTotal);
3089 }
3090 // both corrections
3091 weight14CC[2] = ((weight14+1)*MomResCorr14 - ffcSq*FSICorr14 - (1-ffcSq));
3092 weight14CC[2] /= FSICorr14*ffcSq;
3093 weight14CC[2] *= MuonCorr14;
3094 weight24CC[2] = ((weight24+1)*MomResCorr24 - ffcSq*FSICorr24 - (1-ffcSq));
3095 weight24CC[2] /= FSICorr24*ffcSq;
3096 weight24CC[2] *= MuonCorr24;
3097 weight34CC[2] = ((weight34+1)*MomResCorr34 - ffcSq*FSICorr34 - (1-ffcSq));
3098 weight34CC[2] /= FSICorr34*ffcSq;
3099 weight34CC[2] *= MuonCorr34;
3100
3101 if(weight14CC[2] < 0 || weight24CC[2] < 0 || weight34CC[2] < 0) {// C2^QS can never be less than unity
3102 if(fMbin==0 && bin1==0 && KT4index==0) {
3103 ((TH1D*)fOutputList->FindObject("fTPNRejects4pion1"))->Fill(q4, sqrt(fabs(weight12CC[2]*weight23CC[2]*weight34CC[2]*weight14CC[2])));
be9ef9f9 3104 }
6432c081 3105 if(weight14CC[2] < 0) weight14CC[2]=0;
3106 if(weight24CC[2] < 0) weight24CC[2]=0;
3107 if(weight34CC[2] < 0) weight34CC[2]=0;
3108 Positive2ndTripletWeights=kFALSE;
3109 }
3110 /////////////////////////////////////////////////////
3111 weightTotal = sqrt(weight12CC[2]*weight13CC[2]*weight24CC[2]*weight34CC[2]);
3112 weightTotal += sqrt(weight12CC[2]*weight14CC[2]*weight23CC[2]*weight34CC[2]);
3113 weightTotal += sqrt(weight13CC[2]*weight14CC[2]*weight23CC[2]*weight24CC[2]);
3114 weightTotal /= 3.;
3115 if(Positive1stTripletWeights && Positive2ndTripletWeights){
5591748e 3116 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fTwoPartNorm->Fill(3, q4, weightTotal);
ab890ec3 3117 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fTwoPartNorm->Fill(4, q4, 1);
6432c081 3118 }else{
3119 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fTwoPartNegNorm->Fill(4, q4, 1);
3120 }
3121 // Full Weight reconstruction
3122 for(Int_t RcohIndex=0; RcohIndex<2; RcohIndex++){// Rcoh=0, then Rcoh=Rch
86528e76 3123 for(Int_t GIndex=0; GIndex<50; GIndex++){// 20 is enough
9c0557fb 3124 Int_t FillBin = 5 + RcohIndex*50 + GIndex;
6432c081 3125 Float_t G = 0.02*GIndex;
3126 if(RcohIndex==0){// Rcoh=0
3127 Float_t a = pow(1-G,2);
3128 Float_t b = 2*G*(1-G);
3129 T12 = (-b + sqrt(pow(b,2) + 4*a*weight12CC[2])) / (2*a);
3130 T13 = (-b + sqrt(pow(b,2) + 4*a*weight13CC[2])) / (2*a);
3131 T14 = (-b + sqrt(pow(b,2) + 4*a*weight14CC[2])) / (2*a);
3132 T23 = (-b + sqrt(pow(b,2) + 4*a*weight23CC[2])) / (2*a);
3133 T24 = (-b + sqrt(pow(b,2) + 4*a*weight24CC[2])) / (2*a);
3134 T34 = (-b + sqrt(pow(b,2) + 4*a*weight34CC[2])) / (2*a);
3135 weightTotal = 2*G*(1-G)*(T12 + T13 + T14 + T23 + T24 + T34) + pow(1-G,2)*(T12*T12 + T13*T13 + T14*T14 + T23*T23 + T24*T24 + T34*T34);// 2-pion
3136 weightTotal += 2*G*pow(1-G,3)*(T12*T34*T34 + T12*T12*T34 + T13*T24*T24 + T13*T13*T24 + T14*T23*T23 + T14*T14*T23);// 2-pair
3137 weightTotal += pow(1-G,4)*(pow(T12,2)*pow(T34,2) + pow(T13,2)*pow(T24,2) + pow(T14,2)*pow(T23,2));// 2-pair fully chaotic
3138 weightTotal += 2*G*pow(1-G,2)*(T12*T13 + T12*T23 + T13*T23 + T12*T14 + T12*T24 + T14*T24);// 3-pion
3139 weightTotal += 2*G*pow(1-G,2)*(T13*T14 + T13*T34 + T14*T34 + T23*T24 + T23*T34 + T24*T34);// 3-pion
3140 weightTotal += 2*pow(1-G,3)*(T12*T13*T23 + T12*T14*T24 + T13*T14*T34 + T23*T24*T34);// 3-pion fully chaotic
3141 weightTotal += 2*G*pow(1-G,3)*(T12*T14*T34 + T12*T14*T23 + T12*T23*T34 + T14*T23*T34);// 4-pion
3142 weightTotal += 2*G*pow(1-G,3)*(T12*T13*T34 + T12*T34*T24 + T12*T24*T13 + T13*T24*T34);// 4-pion
3143 weightTotal += 2*G*pow(1-G,3)*(T14*T13*T23 + T14*T13*T24 + T13*T23*T24 + T14*T24*T23);// 4-pion
3144 weightTotal += 2*pow(1-G,4)*(T12*T13*T24*T34 + T12*T14*T23*T34 + T13*T14*T23*T24);// 4-pion fully chaotic
3145 }else{// Rcoh=Rch
95567836 3146 T12 = sqrt(weight12CC[2] / (1-G*G));
3147 T13 = sqrt(weight13CC[2] / (1-G*G));
3148 T14 = sqrt(weight14CC[2] / (1-G*G));
3149 T23 = sqrt(weight23CC[2] / (1-G*G));
3150 T24 = sqrt(weight24CC[2] / (1-G*G));
3151 T34 = sqrt(weight34CC[2] / (1-G*G));
3152 weightTotal = (1-G*G)*(T12*T12 + T13*T13 + T14*T14 + T23*T23 + T24*T24 + T34*T34);// 2-pion
3153 weightTotal += (4*G*pow(1-G,3)+pow(1-G,4))*(pow(T12,2)*pow(T34,2) + pow(T13,2)*pow(T24,2) + pow(T14,2)*pow(T23,2));// 2-pair
3154 weightTotal += (6*G*pow(1-G,2) + 2*pow(1-G,3))*(T12*T13*T23);// 3-pion
3155 weightTotal += (6*G*pow(1-G,2) + 2*pow(1-G,3))*(T12*T14*T24);// 3-pion
3156 weightTotal += (6*G*pow(1-G,2) + 2*pow(1-G,3))*(T13*T14*T34);// 3-pion
3157 weightTotal += (6*G*pow(1-G,2) + 2*pow(1-G,3))*(T23*T24*T34);// 3-pion
3158 weightTotal += (8*G*pow(1-G,3) + 2*pow(1-G,4))*(T12*T13*T24*T34);// 4-pion
3159 weightTotal += (8*G*pow(1-G,3) + 2*pow(1-G,4))*(T12*T14*T23*T34);// 4-pion
3160 weightTotal += (8*G*pow(1-G,3) + 2*pow(1-G,4))*(T13*T14*T23*T24);// 4-pion
6432c081 3161 }
3162 if(Positive1stTripletWeights && Positive2ndTripletWeights){
ab890ec3 3163 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fTwoPartNorm->Fill(FillBin, q4, weightTotal);
6432c081 3164 }else{
3165 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fTwoPartNegNorm->Fill(FillBin, q4, weightTotal);
ab890ec3 3166 }
3167 }
6432c081 3168 }
3169 // stat errors
3170 /*weight14CC_e = weight14Err*MomResCorr14 / FSICorr14 / ffcSq * MuonCorr14;
43046300 3171 weight24CC_e = weight24Err*MomResCorr24 / FSICorr24 / ffcSq * MuonCorr24;
3172 weight34CC_e = weight34Err*MomResCorr34 / FSICorr34 / ffcSq * MuonCorr34;
3173 if(weight12CC[2]*weight13CC[2]*weight24CC[2]*weight34CC[2] > 0){
6432c081 3174 weightTotalErr = pow( 6 * 2 * weight12CC_e*weight13CC[2]*weight24CC[2]*weight34CC[2] / sqrt(weight12CC[2]*weight13CC[2]*weight24CC[2]*weight34CC[2]),2);
43046300 3175 }
3176 if(weight12CC[2]*weight13CC[2]*weight23CC[2] > 0){
6432c081 3177 weightTotalErr += pow( 8 * sqrt(3) * weight12CC_e*weight13CC[2]*weight23CC[2] / sqrt(weight12CC[2]*weight13CC[2]*weight23CC[2]),2);
43046300 3178 }
3179 weightTotalErr += 2*(pow(weight12CC_e*weight34CC[2],2) + pow(weight13CC_e*weight24CC[2],2) + pow(weight14CC_e*weight23CC[2],2));
3180 weightTotalErr += pow(weight12CC_e,2) + pow(weight13CC_e,2) + pow(weight14CC_e,2) + pow(weight23CC_e,2) + pow(weight24CC_e,2) + pow(weight34CC_e,2);
3181 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[fMbin].EDB[KT4index].FourPT[12].fTwoPartNormErr->Fill(4, q4, weightTotalErr);
6432c081 3182 */
42802bba 3183 if(fMbin==0 && KT4index==0){
3184 for(Int_t Rindex=0; Rindex<7; Rindex++){
3185 Float_t R = (6. + Rindex)/FmToGeV;
3186 Float_t arg12=qinv12*R;
3187 Float_t arg13=qinv13*R;
3188 Float_t arg14=qinv14*R;
3189 Float_t arg23=qinv23*R;
3190 Float_t arg24=qinv24*R;
3191 Float_t arg34=qinv34*R;
3192 // Exchange Amplitudes
3193 Float_t EA12 = exp(-pow(arg12,2)/2.)*(1 + kappa3Fit/(6.*pow(2.,1.5))*(8.*pow(arg12,3) - 12.*arg12) + kappa4Fit/(24.*pow(2.,2))*(16.*pow(arg12,4) -48.*pow(arg12,2) + 12));
3194 Float_t EA13 = exp(-pow(arg13,2)/2.)*(1 + kappa3Fit/(6.*pow(2.,1.5))*(8.*pow(arg13,3) - 12.*arg13) + kappa4Fit/(24.*pow(2.,2))*(16.*pow(arg13,4) -48.*pow(arg13,2) + 12));
3195 Float_t EA14 = exp(-pow(arg14,2)/2.)*(1 + kappa3Fit/(6.*pow(2.,1.5))*(8.*pow(arg14,3) - 12.*arg14) + kappa4Fit/(24.*pow(2.,2))*(16.*pow(arg14,4) -48.*pow(arg14,2) + 12));
3196 Float_t EA23 = exp(-pow(arg23,2)/2.)*(1 + kappa3Fit/(6.*pow(2.,1.5))*(8.*pow(arg23,3) - 12.*arg23) + kappa4Fit/(24.*pow(2.,2))*(16.*pow(arg23,4) -48.*pow(arg23,2) + 12));
3197 Float_t EA24 = exp(-pow(arg24,2)/2.)*(1 + kappa3Fit/(6.*pow(2.,1.5))*(8.*pow(arg24,3) - 12.*arg24) + kappa4Fit/(24.*pow(2.,2))*(16.*pow(arg24,4) -48.*pow(arg24,2) + 12));
3198 Float_t EA34 = exp(-pow(arg34,2)/2.)*(1 + kappa3Fit/(6.*pow(2.,1.5))*(8.*pow(arg34,3) - 12.*arg34) + kappa4Fit/(24.*pow(2.,2))*(16.*pow(arg34,4) -48.*pow(arg34,2) + 12));
3199 //
3200 Float_t TotalCorrelation = 1 + 2*(EA12*EA13*EA24*EA34 + EA12*EA14*EA23*EA34 + EA13*EA14*EA23*EA24);
3201 ((TH2D*)fOutputList->FindObject("fc4QSFitNum"))->Fill(Rindex+1, q4, TotalCorrelation);
3202 ((TH2D*)fOutputList->FindObject("fc4QSFitDen"))->Fill(Rindex+1, q4);
3203 }
3204 }
3205 }// SC and ENsum=6
be9ef9f9 3206 /////////////////////////////////////////////////////////////
6bb6954b 3207
4bf06935 3208 if(ch1==ch2 && ch1==ch3 && ch1==ch4){
3209 Float_t pt1=sqrt(pow(pVect1[1],2)+pow(pVect1[2],2));
3210 Float_t pt2=sqrt(pow(pVect2[1],2)+pow(pVect2[2],2));
3211 Float_t pt3=sqrt(pow(pVect3[1],2)+pow(pVect3[2],2));
3212 Float_t pt4=sqrt(pow(pVect4[1],2)+pow(pVect4[2],2));
3213 if(ENsum==0){
3214 ((TH3D*)fOutputList->FindObject("fKT4DistTerm1"))->Fill(fMbin+1, KT4, q4);
3215 if(q4<0.105){
3216 ((TProfile2D*)fOutputList->FindObject("fKT4AvgpT"))->Fill(fMbin+1, KT4index, pt1);
3217 ((TProfile2D*)fOutputList->FindObject("fKT4AvgpT"))->Fill(fMbin+1, KT4index, pt2);
3218 ((TProfile2D*)fOutputList->FindObject("fKT4AvgpT"))->Fill(fMbin+1, KT4index, pt3);
3219 ((TProfile2D*)fOutputList->FindObject("fKT4AvgpT"))->Fill(fMbin+1, KT4index, pt4);
9c0557fb 3220 }
be9ef9f9 3221 }
4bf06935 3222 if(fMbin==0){
3223 if(ENsum==0){
3224 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum0"))->Fill(KT4index, q4, pt1);
3225 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum0"))->Fill(KT4index, q4, pt2);
3226 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum0"))->Fill(KT4index, q4, pt3);
3227 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum0"))->Fill(KT4index, q4, pt4);
3228 }else if(ENsum==1){
3229 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum1"))->Fill(KT4index, q4, pt1);
3230 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum1"))->Fill(KT4index, q4, pt2);
3231 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum1"))->Fill(KT4index, q4, pt3);
3232 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum1"))->Fill(KT4index, q4, pt4);
3233 }else if(ENsum==2){
3234 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum2"))->Fill(KT4index, q4, pt1);
3235 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum2"))->Fill(KT4index, q4, pt2);
3236 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum2"))->Fill(KT4index, q4, pt3);
3237 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum2"))->Fill(KT4index, q4, pt4);
3238 }else if(ENsum==3){
3239 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum3"))->Fill(KT4index, q4, pt1);
3240 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum3"))->Fill(KT4index, q4, pt2);
3241 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum3"))->Fill(KT4index, q4, pt3);
3242 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum3"))->Fill(KT4index, q4, pt4);
3243 }else{// 6
3244 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum6"))->Fill(KT4index, q4, pt1);
3245 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum6"))->Fill(KT4index, q4, pt2);
3246 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum6"))->Fill(KT4index, q4, pt3);
3247 ((TH3D*)fOutputList->FindObject("fQ4AvgpTENsum6"))->Fill(KT4index, q4, pt4);
3248 }
3249
3250 }
be9ef9f9 3251 }
4bf06935 3252
6bb6954b 3253 if(ch1==ch2 && ch1==ch3 && ch1==ch4 && ENsum==6) ((TH3D*)fOutputList->FindObject("fKT4DistTerm13"))->Fill(fMbin+1, KT4, q4);
3254
be9ef9f9 3255
3256 // momenumtum resolution and muon corrections
3257 if(fMCcase && ENsum==6 && FilledMCtriplet123){// for momentum resolution and muon correction
3258 if((fEvt+en4)->fTracks[l].fLabel < (fEvt+en4)->fMCarraySize){
3259
3260 pVect4MC[0]=sqrt(pow((fEvt+en4)->fMCtracks[abs((fEvt+en4)->fTracks[l].fLabel)].fPtot,2)+pow(fTrueMassPi,2));
3261 pVect4MC[1]=(fEvt+en4)->fMCtracks[abs((fEvt+en4)->fTracks[l].fLabel)].fPx;
3262 pVect4MC[2]=(fEvt+en4)->fMCtracks[abs((fEvt+en4)->fTracks[l].fLabel)].fPy;
3263 pVect4MC[3]=(fEvt+en4)->fMCtracks[abs((fEvt+en4)->fTracks[l].fLabel)].fPz;
3264 qinv14MC = GetQinv(pVect1MC, pVect4MC);
3265 qinv24MC = GetQinv(pVect2MC, pVect4MC);
3266 qinv34MC = GetQinv(pVect3MC, pVect4MC);
3267
3268 q4MC = sqrt(pow(q3MC,2) + pow(qinv14MC,2) + pow(qinv24MC,2) + pow(qinv34MC,2));
3269 if(q4<0.1 && ch1==ch2 && ch1==ch3 && ch1==ch4) ((TH2D*)fOutputList->FindObject("fQ4Res"))->Fill(KT4, q4-q4MC);
3270 if(ch1==ch2 && ch1==ch3 && ch1==ch4) {
5591748e 3271 ((TH2D*)fOutputList->FindObject("DistQinvMC4pion"))->Fill(1, qinv12MC); ((TH2D*)fOutputList->FindObject("DistQinvMC4pion"))->Fill(2, qinv13MC);
3272 ((TH2D*)fOutputList->FindObject("DistQinvMC4pion"))->Fill(3, qinv14MC); ((TH2D*)fOutputList->FindObject("DistQinvMC4pion"))->Fill(4, qinv23MC);
be9ef9f9 3273 ((TH2D*)fOutputList->FindObject("DistQinvMC4pion"))->Fill(5, qinv24MC); ((TH2D*)fOutputList->FindObject("DistQinvMC4pion"))->Fill(6, qinv34MC);
3274 }
fac2d84b 3275
4bf06935 3276 //Float_t QuadWeightTTC=1.0;// same-charge weights to mimic two-track depletion of same-charge pairs
fac2d84b 3277 //if(ch1==ch2 && qinv12>0.006) QuadWeightTTC *= SCpairWeight->Eval(qinv12);
3278 //if(ch1==ch3 && qinv13>0.006) QuadWeightTTC *= SCpairWeight->Eval(qinv13);
3279 //if(ch1==ch4 && qinv14>0.006) QuadWeightTTC *= SCpairWeight->Eval(qinv14);
3280 //if(ch2==ch3 && qinv23>0.006) QuadWeightTTC *= SCpairWeight->Eval(qinv23);
3281 //if(ch2==ch4 && qinv24>0.006) QuadWeightTTC *= SCpairWeight->Eval(qinv24);
3282 //if(ch3==ch4 && qinv34>0.006) QuadWeightTTC *= SCpairWeight->Eval(qinv34);
3283
3284
86528e76 3285
be9ef9f9 3286 Pparent4[0]=pVect4MC[0]; Pparent4[1]=pVect4MC[1]; Pparent4[2]=pVect4MC[2]; Pparent4[3]=pVect4MC[3];
3287 pionParent4=kFALSE;
3288 if(abs((fEvt+en4)->fMCtracks[abs((fEvt+en4)->fTracks[l].fLabel)].fPdgCode)==13){// muon check
3289 Int_t MotherLabel4 = (fEvt+en4)->fMCtracks[abs((fEvt+en4)->fTracks[l].fLabel)].fMotherLabel;
3290 if(abs((fEvt+en4)->fMCtracks[MotherLabel4].fPdgCode)==211) {
3291 pionParent4=kTRUE;
3292 Pparent4[1] = (fEvt+en4)->fMCtracks[MotherLabel4].fPx; Pparent4[2] = (fEvt+en4)->fMCtracks[MotherLabel4].fPy; Pparent4[3] = (fEvt+en4)->fMCtracks[MotherLabel4].fPz;
3293 Pparent4[0] = sqrt(pow(Pparent4[1],2)+pow(Pparent4[2],2)+pow(Pparent4[3],2)+pow(fTrueMassPi,2));
3294 }
3295 }
3296
3297 parentQinv14 = GetQinv(Pparent1, Pparent4);
3298 parentQinv24 = GetQinv(Pparent2, Pparent4);
3299 parentQinv34 = GetQinv(Pparent3, Pparent4);
3300 Float_t parentQ4 = sqrt(pow(parentQ3,2) + pow(parentQinv14,2) + pow(parentQinv24,2) + pow(parentQinv34,2));
3301
3302 if(parentQinv14 > 0.001 && parentQinv24 > 0.001 && parentQinv34 > 0.001 && parentQ4 < 0.5){
3303 if(pionParent1 || pionParent2 || pionParent3 || pionParent4) {// want at least one pion-->muon
3304
5591748e 3305 if(pionParent1) ((TH1D*)fOutputList->FindObject("fDistPionParents4"))->Fill(1);
3306 if(pionParent2) ((TH1D*)fOutputList->FindObject("fDistPionParents4"))->Fill(2);
3307 if(pionParent3) ((TH1D*)fOutputList->FindObject("fDistPionParents4"))->Fill(3);
3308 if(pionParent4) ((TH1D*)fOutputList->FindObject("fDistPionParents4"))->Fill(4);
be9ef9f9 3309 Float_t parentQinvGroup4[6]={parentQinv12, parentQinv13, parentQinv14, parentQinv23, parentQinv24, parentQinv34};
3310 Float_t parentkTGroup4[6]={0};
3311
5591748e 3312 for(Int_t term=1; term<=12; term++){
3313 if(term==1) {}
3314 else if(term==2) {if(!pionParent1 && !pionParent2 && !pionParent3) continue;}
3315 else if(term==3) {if(!pionParent1 && !pionParent2 && !pionParent4) continue;}
3316 else if(term==4) {if(!pionParent1 && !pionParent3 && !pionParent4) continue;}
3317 else if(term==5) {if(!pionParent2 && !pionParent3 && !pionParent4) continue;}
3318 else if(term==6) {if(!pionParent1 && !pionParent2) continue;}
3319 else if(term==7) {if(!pionParent1 && !pionParent3) continue;}
3320 else if(term==8) {if(!pionParent1 && !pionParent4) continue;}
3321 else if(term==9) {if(!pionParent2 && !pionParent3) continue;}
3322 else if(term==10) {if(!pionParent2 && !pionParent4) continue;}
3323 else if(term==11) {if(!pionParent3 && !pionParent4) continue;}
3324 else {}
be9ef9f9 3325 for(Int_t Riter=0; Riter<fRVALUES; Riter++){
3326 Float_t Rvalue = 5+Riter;
3327 Float_t WInput = MCWeight4(term, Rvalue, 1.0, chGroup4, parentQinvGroup4, parentkTGroup4);
3328 Float_t WInputParentFSI = MCWeightFSI4(term, Rvalue, 1.0, chGroup4, parentQinvGroup4);
3329 Float_t WInputFSI = MCWeightFSI4(term, Rvalue, 1.0, chGroup4, QinvMCGroup4);
4bf06935 3330 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[0].FourPT[term-1].fMuonSmeared->Fill(1, Rvalue, q4MC, WInput);
3331 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[0].FourPT[term-1].fMuonIdeal->Fill(1, Rvalue, parentQ4, WInput);
3332 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[0].FourPT[term-1].fMuonPionK4->Fill(1, Rvalue, q4MC, WInputFSI);
3333 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[0].FourPT[term-1].fPionPionK4->Fill(1, Rvalue, parentQ4, WInputParentFSI);
5591748e 3334 //
4bf06935 3335 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[0].FourPT[term-1].fMuonSmeared->Fill(2, Rvalue, q4MC);
3336 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[0].FourPT[term-1].fMuonIdeal->Fill(2, Rvalue, parentQ4);
3337 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[0].FourPT[term-1].fMuonPionK4->Fill(2, Rvalue, q4MC);
3338 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[0].FourPT[term-1].fPionPionK4->Fill(2, Rvalue, parentQ4);
be9ef9f9 3339 }// Riter
3340 }// term loop
3341
3342 }// pion parent check
3343 }// parentQ check (muon correction)
4bf06935 3344
0207c034 3345 Int_t indexq4 = q4 / 0.005;
3346 if(indexq4 >=50) indexq4=49;
3347 Float_t WSpectrum = HIJINGq4WeightsSC[indexq4];
3348 if((ch1+ch2+ch3+ch4)==3 || (ch1+ch2+ch3+ch4)==1) WSpectrum = HIJINGq4WeightsMC1[indexq4];
3349 if((ch1+ch2+ch3+ch4)==2) WSpectrum = HIJINGq4WeightsMC2[indexq4];
be9ef9f9 3350 // 4-pion momentum resolution
6bb6954b 3351 for(Int_t term=1; term<=13; term++){
be9ef9f9 3352 for(Int_t Riter=0; Riter<fRVALUES; Riter++){
3353 Float_t Rvalue = 5+Riter;
80507acf 3354 Float_t WInput = MCWeight4(term, Rvalue, ffcSqMRC, chGroup4, QinvMCGroup4, kTGroup4);
0207c034 3355 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[KT4index].FourPT[term-1].fIdeal->Fill(Rvalue, q4MC, WInput*WSpectrum);
3356 Charge1[bin1].Charge2[bin2].Charge3[bin3].Charge4[bin4].MB[0].EDB[KT4index].FourPT[term-1].fSmeared->Fill(Rvalue, q4, WInput*WSpectrum);
be9ef9f9 3357 }
3358 }
0207c034 3359
be9ef9f9 3360 }// label check particle 4
3361 }// MCcase
3362
3363 }// 4th particle
3364 }// 3rd particle
3365 }// 2nd particle
3366 }// 1st particle
3367
3368 }// en4
3369 }// en3
3370 }// en2
3371
3372
3373
3374
3375
3376
3377
3378 // Post output data.
3379 PostData(1, fOutputList);
3380
3381}
3382//________________________________________________________________________
3383void AliFourPion::Terminate(Option_t *)
3384{
3385 // Called once at the end of the query
3386
3387 cout<<"Done"<<endl;
3388
3389}
3390//________________________________________________________________________
3391Bool_t AliFourPion::AcceptPair(AliFourPionTrackStruct first, AliFourPionTrackStruct second)
3392{
3393
3394 if(fabs(first.fEta-second.fEta) > fMinSepPairEta) return kTRUE;
3395
3396 // propagate through B field to r=1m
3397 Float_t phi1 = first.fPhi - asin(first.fCharge*(0.1*fBfield)*0.15/first.fPt);// 0.15 for D=1m
3398 if(phi1 > 2*PI) phi1 -= 2*PI;
3399 if(phi1 < 0) phi1 += 2*PI;
3400 Float_t phi2 = second.fPhi - asin(second.fCharge*(0.1*fBfield)*0.15/second.fPt);// 0.15 for D=1m
3401 if(phi2 > 2*PI) phi2 -= 2*PI;
3402 if(phi2 < 0) phi2 += 2*PI;
3403
3404 Float_t deltaphi = phi1 - phi2;
3405 if(deltaphi > PI) deltaphi -= 2*PI;
3406 if(deltaphi < -PI) deltaphi += 2*PI;
3407 deltaphi = fabs(deltaphi);
3408
3409 if(deltaphi < fMinSepPairPhi) return kFALSE;// Min Separation
3410
3411
3412 // propagate through B field to r=1.6m
3413 phi1 = first.fPhi - asin(first.fCharge*(0.1*fBfield)*0.24/first.fPt);// mine. 0.24 for D=1.6m
3414 if(phi1 > 2*PI) phi1 -= 2*PI;
3415 if(phi1 < 0) phi1 += 2*PI;
3416 phi2 = second.fPhi - asin(second.fCharge*(0.1*fBfield)*0.24/second.fPt);// mine. 0.24 for D=1.6m
3417 if(phi2 > 2*PI) phi2 -= 2*PI;
3418 if(phi2 < 0) phi2 += 2*PI;
3419
3420 deltaphi = phi1 - phi2;
3421 if(deltaphi > PI) deltaphi -= 2*PI;
3422 if(deltaphi < -PI) deltaphi += 2*PI;
3423 deltaphi = fabs(deltaphi);
3424
3425 if(deltaphi < fMinSepPairPhi) return kFALSE;// Min Separation
3426
3427
3428
3429 //
3430
42802bba 3431 /* Int_t ncl1 = first.fClusterMap.GetNbits();
be9ef9f9 3432 Int_t ncl2 = second.fClusterMap.GetNbits();
3433 Int_t sumCls = 0; Int_t sumSha = 0; Int_t sumQ = 0;
3434 Double_t shfrac = 0; Double_t qfactor = 0;
3435 for(Int_t imap = 0; imap < ncl1 && imap < ncl2; imap++) {
3436 if (first.fClusterMap.TestBitNumber(imap) && second.fClusterMap.TestBitNumber(imap)) {// Both clusters
3437 if (first.fSharedMap.TestBitNumber(imap) && second.fSharedMap.TestBitNumber(imap)) { // Shared
3438 sumQ++;
3439 sumCls+=2;
3440 sumSha+=2;}
3441 else {sumQ--; sumCls+=2;}
3442 }
3443 else if (first.fClusterMap.TestBitNumber(imap) || second.fClusterMap.TestBitNumber(imap)) {// Non shared
3444 sumQ++;
3445 sumCls++;}
3446 }
3447 if (sumCls>0) {
3448 qfactor = sumQ*1.0/sumCls;
3449 shfrac = sumSha*1.0/sumCls;
3450 }
3451
3452 if(qfactor > fShareQuality || shfrac > fShareFraction) return kFALSE;
42802bba 3453 */
be9ef9f9 3454
3455 return kTRUE;
3456
3457
fac2d84b 3458}
3459//________________________________________________________________________
3460Bool_t AliFourPion::AcceptPairPM(AliFourPionTrackStruct first, AliFourPionTrackStruct second)
3461{// optional pair cuts for +- pairs
3462
3463 if(fabs(first.fEta-second.fEta) > fMinSepPairEta) return kTRUE;
3464
3465 // propagate through B field to r=1m
3466 Float_t phi1 = first.fPhi - asin(1.*(0.1*fBfield)*0.15/first.fPt);// 0.15 for D=1m
3467 if(phi1 > 2*PI) phi1 -= 2*PI;
3468 if(phi1 < 0) phi1 += 2*PI;
3469 Float_t phi2 = second.fPhi - asin(1.*(0.1*fBfield)*0.15/second.fPt);// 0.15 for D=1m
3470 if(phi2 > 2*PI) phi2 -= 2*PI;
3471 if(phi2 < 0) phi2 += 2*PI;
3472
3473 Float_t deltaphi = phi1 - phi2;
3474 if(deltaphi > PI) deltaphi -= 2*PI;
3475 if(deltaphi < -PI) deltaphi += 2*PI;
3476 deltaphi = fabs(deltaphi);
3477
3478 if(deltaphi < fMinSepPairPhi) return kFALSE;// Min Separation
3479
3480
3481 // propagate through B field to r=1.6m
3482 phi1 = first.fPhi - asin(1.*(0.1*fBfield)*0.24/first.fPt);// mine. 0.24 for D=1.6m
3483 if(phi1 > 2*PI) phi1 -= 2*PI;
3484 if(phi1 < 0) phi1 += 2*PI;
3485 phi2 = second.fPhi - asin(1.*(0.1*fBfield)*0.24/second.fPt);// mine. 0.24 for D=1.6m
3486 if(phi2 > 2*PI) phi2 -= 2*PI;
3487 if(phi2 < 0) phi2 += 2*PI;
3488
3489 deltaphi = phi1 - phi2;
3490 if(deltaphi > PI) deltaphi -= 2*PI;
3491 if(deltaphi < -PI) deltaphi += 2*PI;
3492 deltaphi = fabs(deltaphi);
3493
3494 if(deltaphi < fMinSepPairPhi) return kFALSE;// Min Separation
3495
3496 return kTRUE;
3497
be9ef9f9 3498}
3499//________________________________________________________________________
fcb16ac9 3500Float_t AliFourPion::Gamov(Int_t chargeBin1, Int_t chargeBin2, Float_t qinv)
be9ef9f9 3501{
3502 Float_t arg = G_Coeff/qinv;
3503
3504 if(chargeBin1==chargeBin2) return (exp(arg)-1)/(arg);
3505 else {return (exp(-arg)-1)/(-arg);}
3506
3507}
3508//________________________________________________________________________
3509void AliFourPion::Shuffle(Int_t *iarr, Int_t i1, Int_t i2)
3510{
3511 Int_t j, k;
3512 Int_t a = i2 - i1;
3513 for (Int_t i = i1; i < i2+1; i++) {
3514 j = (Int_t) (gRandom->Rndm() * a);
3515 k = iarr[j];
3516 iarr[j] = iarr[i];
3517 iarr[i] = k;
3518 }
3519}
3520
3521
3522//________________________________________________________________________
3523Float_t AliFourPion::GetQinv(Float_t track1[], Float_t track2[]){
3524
3525 Float_t qinv = sqrt( fabs(pow(track1[1]-track2[1],2) + pow(track1[2]-track2[2],2) + pow(track1[3]-track2[3],2) - pow(track1[0]-track2[0],2)) );
3526 return qinv;
3527
3528}
3529//________________________________________________________________________
3530void AliFourPion::GetQosl(Float_t track1[], Float_t track2[], Float_t& qout, Float_t& qside, Float_t& qlong){
3531
3532 Float_t p0 = track1[0] + track2[0];
3533 Float_t px = track1[1] + track2[1];
3534 Float_t py = track1[2] + track2[2];
3535 Float_t pz = track1[3] + track2[3];
3536
3537 Float_t mt = sqrt(p0*p0 - pz*pz);
3538 Float_t pt = sqrt(px*px + py*py);
3539
3540 Float_t v0 = track1[0] - track2[0];
3541 Float_t vx = track1[1] - track2[1];
3542 Float_t vy = track1[2] - track2[2];
3543 Float_t vz = track1[3] - track2[3];
3544
3545 qout = (px*vx + py*vy)/pt;
3546 qside = (px*vy - py*vx)/pt;
3547 qlong = (p0*vz - pz*v0)/mt;
3548}
3549//________________________________________________________________________
3550void AliFourPion::SetWeightArrays(Bool_t legoCase, TH3F *histos[AliFourPion::fKbinsT][AliFourPion::fCentBins]){
3551
3552 if(legoCase){
3553 cout<<"LEGO call to SetWeightArrays"<<endl;
3554
3555 for(Int_t tKbin=0; tKbin<fKbinsT; tKbin++){
3556 for(Int_t mb=0; mb<fCentBins; mb++){
3557 fNormWeight[tKbin][mb] = (TH3F*)histos[tKbin][mb]->Clone();
3558 fNormWeight[tKbin][mb]->SetDirectory(0);
3559 }
3560 }
3561
3562 }else{
3563
3564 TFile *wFile = new TFile("WeightFile.root","READ");
3565 if(!wFile->IsOpen()) {cout<<"No Weight File!!!!!!!!!!"<<endl; return;}
3566 else cout<<"Good Weight File Found!"<<endl;
3567
3568 for(Int_t tKbin=0; tKbin<fKbinsT; tKbin++){
3569 for(Int_t mb=0; mb<fCentBins; mb++){
3570
3571 TString *name = new TString("Weight_Kt_");
3572 *name += tKbin;
3573 name->Append("_Ky_0");
3574 name->Append("_M_");
3575 *name += mb;
3576 name->Append("_ED_0");
3577
3578
3579 fNormWeight[tKbin][mb] = (TH3F*)wFile->Get(name->Data());
3580 fNormWeight[tKbin][mb]->SetDirectory(0);
3581
3582
3583 }//mb
3584 }//kt
3585
3586 wFile->Close();
3587 }
3588
3589 cout<<"Done reading weight file"<<endl;
3590
3591}
3592//________________________________________________________________________
3593void AliFourPion::GetWeight(Float_t track1[], Float_t track2[], Float_t& wgt, Float_t& wgtErr){
3594
3595 Float_t kt=sqrt( pow(track1[1]+track2[1],2) + pow(track1[2]+track2[2],2))/2.;
3596 //
3597 Float_t qOut=0,qSide=0,qLong=0;
3598 GetQosl(track1, track2, qOut, qSide, qLong);
3599 qOut = fabs(qOut);
3600 qSide = fabs(qSide);
3601 qLong = fabs(qLong);
3602 Float_t wd=0, xd=0, yd=0, zd=0;
3603 //Float_t qinvtemp=GetQinv(0,track1, track2);
3604 //
3605
3606 if(kt < fKmeanT[0]) {fKtIndexL=0; fKtIndexH=1;}
3607 else if(kt >= fKmeanT[fKbinsT-1]) {fKtIndexL=fKbinsT-2; fKtIndexH=fKbinsT-1;}
3608 else {
3609 for(Int_t i=0; i<fKbinsT-1; i++){
3610 if((kt >= fKmeanT[i]) && (kt < fKmeanT[i+1])) {fKtIndexL=i; fKtIndexH=i+1; break;}
3611 }
3612 }
3613 wd = (kt-fKmeanT[fKtIndexL])/(fKmeanT[fKtIndexH]-fKmeanT[fKtIndexL]);
4e2838bf 3614 if(fMaxPt<=0.251) {fKtIndexL=0; fKtIndexH=0; wd=0;}
3615 if(fMinPt>0.249 && fKtIndexL==0) {fKtIndexL=1; wd=0;}
be9ef9f9 3616 //
be9ef9f9 3617 if(qOut < fQmean[0]) {fQoIndexL=0; fQoIndexH=0; xd=0;}
3618 else if(qOut >= fQmean[kQbinsWeights-1]) {fQoIndexL=kQbinsWeights-1; fQoIndexH=kQbinsWeights-1; xd=1;}
3619 else {
3620 for(Int_t i=0; i<kQbinsWeights-1; i++){
3621 if((qOut >= fQmean[i]) && (qOut < fQmean[i+1])) {fQoIndexL=i; fQoIndexH=i+1; break;}
95567836 3622 }
be9ef9f9 3623 xd = (qOut-fQmean[fQoIndexL])/(fQmean[fQoIndexH]-fQmean[fQoIndexL]);
3624 }
3625 //
3626 if(qSide < fQmean[0]) {fQsIndexL=0; fQsIndexH=0; yd=0;}
3627 else if(qSide >= fQmean[kQbinsWeights-1]) {fQsIndexL=kQbinsWeights-1; fQsIndexH=kQbinsWeights-1; yd=1;}
3628 else {
3629 for(Int_t i=0; i<kQbinsWeights-1; i++){
3630 if((qSide >= fQmean[i]) && (qSide < fQmean[i+1])) {fQsIndexL=i; fQsIndexH=i+1; break;}
3631 }
3632 yd = (qSide-fQmean[fQsIndexL])/(fQmean[fQsIndexH]-fQmean[fQsIndexL]);
3633 }
3634 //
3635 if(qLong < fQmean[0]) {fQlIndexL=0; fQlIndexH=0; zd=0;}
3636 else if(qLong >= fQmean[kQbinsWeights-1]) {fQlIndexL=kQbinsWeights-1; fQlIndexH=kQbinsWeights-1; zd=1;}
3637 else {
3638 for(Int_t i=0; i<kQbinsWeights-1; i++){
3639 if((qLong >= fQmean[i]) && (qLong < fQmean[i+1])) {fQlIndexL=i; fQlIndexH=i+1; break;}
3640 }
3641 zd = (qLong-fQmean[fQlIndexL])/(fQmean[fQlIndexH]-fQmean[fQlIndexL]);
3642 }
3643 //
95567836 3644 if(fLinearInterpolation){// Linear Interpolation of osl
3645 // w interpolation (kt)
3646 Float_t c000 = fNormWeight[fKtIndexL][fMbin]->GetBinContent(fQoIndexL+1, fQsIndexL+1, fQlIndexL+1)*(1-wd) + fNormWeight[fKtIndexH][fMbin]->GetBinContent(fQoIndexL+1, fQsIndexL+1, fQlIndexL+1)*wd;
3647 Float_t c100 = fNormWeight[fKtIndexL][fMbin]->GetBinContent(fQoIndexH+1, fQsIndexL+1, fQlIndexL+1)*(1-wd) + fNormWeight[fKtIndexH][fMbin]->GetBinContent(fQoIndexH+1, fQsIndexL+1, fQlIndexL+1)*wd;
3648 Float_t c010 = fNormWeight[fKtIndexL][fMbin]->GetBinContent(fQoIndexL+1, fQsIndexH+1, fQlIndexL+1)*(1-wd) + fNormWeight[fKtIndexH][fMbin]->GetBinContent(fQoIndexL+1, fQsIndexH+1, fQlIndexL+1)*wd;
3649 Float_t c001 = fNormWeight[fKtIndexL][fMbin]->GetBinContent(fQoIndexL+1, fQsIndexL+1, fQlIndexH+1)*(1-wd) + fNormWeight[fKtIndexH][fMbin]->GetBinContent(fQoIndexL+1, fQsIndexL+1, fQlIndexH+1)*wd;
3650 Float_t c110 = fNormWeight[fKtIndexL][fMbin]->GetBinContent(fQoIndexH+1, fQsIndexH+1, fQlIndexL+1)*(1-wd) + fNormWeight[fKtIndexH][fMbin]->GetBinContent(fQoIndexH+1, fQsIndexH+1, fQlIndexL+1)*wd;
3651 Float_t c101 = fNormWeight[fKtIndexL][fMbin]->GetBinContent(fQoIndexH+1, fQsIndexL+1, fQlIndexH+1)*(1-wd) + fNormWeight[fKtIndexH][fMbin]->GetBinContent(fQoIndexH+1, fQsIndexL+1, fQlIndexH+1)*wd;
3652 Float_t c011 = fNormWeight[fKtIndexL][fMbin]->GetBinContent(fQoIndexL+1, fQsIndexH+1, fQlIndexH+1)*(1-wd) + fNormWeight[fKtIndexH][fMbin]->GetBinContent(fQoIndexL+1, fQsIndexH+1, fQlIndexH+1)*wd;
3653 Float_t c111 = fNormWeight[fKtIndexL][fMbin]->GetBinContent(fQoIndexH+1, fQsIndexH+1, fQlIndexH+1)*(1-wd) + fNormWeight[fKtIndexH][fMbin]->GetBinContent(fQoIndexH+1, fQsIndexH+1, fQlIndexH+1)*wd;
3654 // x interpolation (qOut)
3655 Float_t c00 = c000*(1-xd) + c100*xd;
3656 Float_t c10 = c010*(1-xd) + c110*xd;
3657 Float_t c01 = c001*(1-xd) + c101*xd;
3658 Float_t c11 = c011*(1-xd) + c111*xd;
3659 // y interpolation (qSide)
3660 Float_t c0 = c00*(1-yd) + c10*yd;
3661 Float_t c1 = c01*(1-yd) + c11*yd;
3662 // z interpolation (qLong)
3663 wgt = (c0*(1-zd) + c1*zd);
3664 }else{// cubic interpolation of osl
3665
3666 for(Int_t x=0; x<4; x++){
3667 for(Int_t y=0; y<4; y++){
3668 for(Int_t z=0; z<4; z++){
3669 Int_t binO = fQoIndexL + x;
3670 Int_t binS = fQsIndexL + y;
3671 Int_t binL = fQlIndexL + z;
3672 if(binO<=0) binO = 1;
3673 if(binS<=0) binS = 1;
3674 if(binL<=0) binL = 1;
3675 if(binO>kQbinsWeights) binO = kQbinsWeights;
3676 if(binS>kQbinsWeights) binS = kQbinsWeights;
3677 if(binL>kQbinsWeights) binL = kQbinsWeights;
3678 farrP1[x][y][z] = fNormWeight[fKtIndexL][fMbin]->GetBinContent(binO,binS,binL);
3679 farrP2[x][y][z] = fNormWeight[fKtIndexH][fMbin]->GetBinContent(binO,binS,binL);
3680 }
3681 }
3682 }
3683 Float_t coord[3]={xd, yd, zd};
3684 Float_t c0 = nCubicInterpolate(3, (Float_t*) farrP1, coord);
3685 Float_t c1 = nCubicInterpolate(3, (Float_t*) farrP2, coord);
3686 // kT interpolation
3687 wgt = c0*(1-wd) + c1*wd;
3688 }
be9ef9f9 3689 ////
3690
43046300 3691 // simplified stat error
3692 Float_t avgErr = fNormWeight[fKtIndexL][fMbin]->GetBinError(fQoIndexH+1,fQsIndexH+1,fQlIndexH+1);
3693 avgErr += fNormWeight[fKtIndexH][fMbin]->GetBinError(fQoIndexL+1,fQsIndexL+1,fQlIndexL+1);
3694 avgErr /= 2.;
3695 //
3696 wgtErr = avgErr;
be9ef9f9 3697
3698
3699}
3700//________________________________________________________________________
3701Float_t AliFourPion::MCWeight(Int_t c[2], Float_t R, Float_t fcSq, Float_t qinv, Float_t k12){
3702
3703 Float_t radius = R/0.19733;// convert to GeV (starts at 5 fm, was 3 fm)
3704 Float_t r12=radius*(1-k12/2.0);
3705 SetFSIindex(R);
3706 Float_t coulCorr12 = FSICorrelation(c[0], c[1], qinv);
3707 if(c[0]==c[1]){
3708 Float_t arg=qinv*r12;
3709 Float_t EW = 1 + kappa3/(6.*pow(2.,1.5))*(8.*pow(arg,3) - 12.*arg);
3710 EW += kappa4/(24.*pow(2.,2))*(16.*pow(arg,4) -48.*pow(arg,2) + 12);
3711 return ((1-fcSq) + fcSq*(1 + exp(-pow(qinv*r12,2))*pow(EW,2))*coulCorr12);
3712 }else {
3713 return ((1-fcSq) + fcSq*coulCorr12);
3714 }
3715
3716}
3717//________________________________________________________________________
3718Float_t AliFourPion::MCWeightOSL(Int_t charge1, Int_t charge2, Int_t r, Int_t dampIndex, Float_t qinv, Float_t qo, Float_t qs, Float_t ql){
3719
3720 Float_t radiusOut = Float_t(r)/0.19733;// convert to GeV (starts at 5 fm, was 3 fm)
3721 Float_t radiusSide = radiusOut;
3722 Float_t radiusLong = radiusOut;
3723 Float_t myDamp = fDampStart + (fDampStep)*dampIndex;
3724 Float_t coulCorr12 = FSICorrelation(charge1, charge2, qinv);
3725 if(charge1==charge2){
3726 return ((1-myDamp) + myDamp*(1 + exp(-pow(qo*radiusOut,2)) * exp(-pow(qs*radiusSide,2)) * exp(-pow(ql*radiusLong,2)))*coulCorr12);
3727 }else {
3728 return ((1-myDamp) + myDamp*coulCorr12);
3729 }
3730
3731}
3732
3733//________________________________________________________________________
3734Float_t AliFourPion::MCWeight3(Int_t term, Float_t R, Float_t fcSq, Int_t c[3], Float_t qinv[3], Float_t kT[3]){
3735 // FSI + QS correlations
3736 if(term==5) return 1.0;
3737
3738 Float_t radius=R/0.19733;
3739 Float_t r12=radius*(1-kT[0]/2.0);
3740 Float_t r13=radius*(1-kT[1]/2.0);
3741 Float_t r23=radius*(1-kT[2]/2.0);
3742
3743 Float_t fc = sqrt(fcSq);
3744
3745 SetFSIindex(R);
3746 Float_t Kfactor12 = FSICorrelation(c[0],c[1], qinv[0]);// K2
3747 Float_t Kfactor13 = FSICorrelation(c[0],c[2], qinv[1]);// K2
3748 Float_t Kfactor23 = FSICorrelation(c[1],c[2], qinv[2]);// K2
3749
3750 if(c[0]==c[1] && c[0]==c[2]){// all three of the same charge
3751 Float_t arg12=qinv[0]*r12;
3752 Float_t arg13=qinv[1]*r13;
3753 Float_t arg23=qinv[2]*r23;
3754 Float_t EW12 = 1 + kappa3/(6.*pow(2.,1.5))*(8.*pow(arg12,3) - 12.*arg12);
3755 EW12 += kappa4/(24.*pow(2.,2))*(16.*pow(arg12,4) -48.*pow(arg12,2) + 12);
3756 Float_t EW13 = 1 + kappa3/(6.*pow(2.,1.5))*(8.*pow(arg13,3) - 12.*arg13);
3757 EW13 += kappa4/(24.*pow(2.,2))*(16.*pow(arg13,4) -48.*pow(arg13,2) + 12);
3758 Float_t EW23 = 1 + kappa3/(6.*pow(2.,1.5))*(8.*pow(arg23,3) - 12.*arg23);
3759 EW23 += kappa4/(24.*pow(2.,2))*(16.*pow(arg23,4) -48.*pow(arg23,2) + 12);
3760 if(term==1){
3761 Float_t C3QS = 1 + exp(-pow(qinv[0]*r12,2))*pow(EW12,2) + exp(-pow(qinv[1]*r13,2))*pow(EW13,2) + exp(-pow(qinv[2]*r23,2))*pow(EW23,2);
3762 C3QS += 2*exp(-(pow(r12,2)*pow(qinv[0],2) + pow(r13,2)*pow(qinv[1],2) + pow(r23,2)*pow(qinv[2],2))/2.)*EW12*EW13*EW23;
3763 Float_t C3 = pow(1-fc,3) + 3*fc*pow(1-fc,2);
3764 C3 += pow(fc,2)*(1-fc)*(1+exp(-pow(qinv[0]*r12,2))*pow(EW12,2))*Kfactor12;
3765 C3 += pow(fc,2)*(1-fc)*(1+exp(-pow(qinv[1]*r13,2))*pow(EW13,2))*Kfactor13;
3766 C3 += pow(fc,2)*(1-fc)*(1+exp(-pow(qinv[2]*r23,2))*pow(EW23,2))*Kfactor23;
3767 C3 += pow(fc,3)*C3QS*Kfactor12*Kfactor13*Kfactor23;
3768 return C3;
3769 }else if(term==2){
3770 return ((1-fcSq) + fcSq*(1 + exp(-pow(qinv[0]*r12,2))*pow(EW12,2))*Kfactor12);
3771 }else if(term==3){
3772 return ((1-fcSq) + fcSq*(1 + exp(-pow(qinv[1]*r13,2))*pow(EW13,2))*Kfactor13);
3773 }else if(term==4){
3774 return ((1-fcSq) + fcSq*(1 + exp(-pow(qinv[2]*r23,2))*pow(EW23,2))*Kfactor23);
3775 }else return 1.0;
3776
3777 }else{// mixed charge case
3778 Float_t arg=qinv[0]*r12;
3779 Float_t KfactorSC = Kfactor12;
3780 Float_t KfactorMC1 = Kfactor13;
3781 Float_t KfactorMC2 = Kfactor23;
3782 if(c[0]==c[2]) {arg=qinv[1]*r13; KfactorSC = Kfactor13; KfactorMC1 = Kfactor12; KfactorMC2 = Kfactor23;}
3783 if(c[1]==c[2]) {arg=qinv[2]*r23; KfactorSC = Kfactor23; KfactorMC1 = Kfactor12; KfactorMC2 = Kfactor13;}
3784 Float_t EW = 1 + kappa3/(6.*pow(2.,1.5))*(8.*pow(arg,3) - 12.*arg);
3785 EW += kappa4/(24.*pow(2.,2))*(16.*pow(arg,4) -48.*pow(arg,2) + 12);
3786 if(term==1){
3787 Float_t C3QS = 1 + exp(-pow(arg,2))*pow(EW,2);
3788 Float_t C3 = pow(1-fc,3) + 3*fc*pow(1-fc,2);
3789 C3 += pow(fc,2)*(1-fc)*(1+exp(-pow(arg,2))*pow(EW,2))*KfactorSC;
3790 C3 += pow(fc,2)*(1-fc)*KfactorMC1;
3791 C3 += pow(fc,2)*(1-fc)*KfactorMC2;
3792 C3 += pow(fc,3)*C3QS*KfactorSC*KfactorMC1*KfactorMC2;
3793 return C3;
3794 }else if(term==2){
3795 if( (c[0]+c[1]+c[2])==1) return ((1-fcSq) + fcSq*(1 + exp(-pow(arg,2))*pow(EW,2))*KfactorSC);
3796 else return ((1-fcSq) + fcSq*KfactorMC1);// doesn't matter MC1 or MC2
3797 }else if(term==3){
3798 return ((1-fcSq) + fcSq*KfactorMC1);// doesn't matter MC1 or MC2
3799 }else if(term==4){
3800 if( (c[0]+c[1]+c[2])==2) return ((1-fcSq) + fcSq*(1 + exp(-pow(arg,2))*pow(EW,2))*KfactorSC);
3801 else return ((1-fcSq) + fcSq*KfactorMC1);// doesn't matter MC1 or MC2
3802 }else return 1.0;
3803 }
3804
3805}
3806//________________________________________________________________________
3807Float_t AliFourPion::MCWeightFSI3(Int_t term, Float_t R, Float_t fcSq, Int_t c[3], Float_t qinv[3]){
3808 // FSI only (no QS correlations)
3809 if(term==5) return 1.0;
3810
3811 Float_t fc = sqrt(fcSq);
3812 SetFSIindex(R);
3813 Float_t Kfactor12 = FSICorrelation(c[0],c[1], qinv[0]);// K2
3814 Float_t Kfactor13 = FSICorrelation(c[0],c[2], qinv[1]);// K2
3815 Float_t Kfactor23 = FSICorrelation(c[1],c[2], qinv[2]);// K2
3816
3817 if(c[0]==c[1] && c[0]==c[2]){// all three of the same charge
3818 if(term==1){
3819 Float_t C3 = pow(1-fc,3) + 3*fc*pow(1-fc,2);
3820 C3 += pow(fc,2)*(1-fc)*Kfactor12;
3821 C3 += pow(fc,2)*(1-fc)*Kfactor13;
3822 C3 += pow(fc,2)*(1-fc)*Kfactor23;
3823 C3 += pow(fc,3)*Kfactor12*Kfactor13*Kfactor23;
3824 return C3;
3825 }else if(term==2){
3826 return ((1-fcSq) + fcSq*Kfactor12);
3827 }else if(term==3){
3828 return ((1-fcSq) + fcSq*Kfactor13);
3829 }else if(term==4){
3830 return ((1-fcSq) + fcSq*Kfactor23);
3831 }else return 1.0;
3832
3833 }else{// mixed charge case
3834 Float_t KfactorSC = Kfactor12;
3835 Float_t KfactorMC1 = Kfactor13;
3836 Float_t KfactorMC2 = Kfactor23;
3837 if(c[0]==c[2]) {KfactorSC = Kfactor13; KfactorMC1 = Kfactor12; KfactorMC2 = Kfactor23;}
3838 if(c[1]==c[2]) {KfactorSC = Kfactor23; KfactorMC1 = Kfactor12; KfactorMC2 = Kfactor13;}
3839 if(term==1){
3840 Float_t C3 = pow(1-fc,3) + 3*fc*pow(1-fc,2);
3841 C3 += pow(fc,2)*(1-fc)*KfactorSC;
3842 C3 += pow(fc,2)*(1-fc)*KfactorMC1;
3843 C3 += pow(fc,2)*(1-fc)*KfactorMC2;
3844 C3 += pow(fc,3)*KfactorSC*KfactorMC1*KfactorMC2;
3845 return C3;
3846 }else if(term==2){
3847 if( (c[0]+c[1]+c[2])==1) return ((1-fcSq) + fcSq*KfactorSC);
3848 else return ((1-fcSq) + fcSq*KfactorMC1);// doesn't matter MC1 or MC2
3849 }else if(term==3){
3850 return ((1-fcSq) + fcSq*KfactorMC1);// doesn't matter MC1 or MC2
3851 }else if(term==4){
3852 if( (c[0]+c[1]+c[2])==2) return ((1-fcSq) + fcSq*KfactorSC);
3853 else return ((1-fcSq) + fcSq*KfactorMC1);// doesn't matter MC1 or MC2
3854 }else return 1.0;
3855 }
3856
3857}
3858//________________________________________________________________________
3859Float_t AliFourPion::MCWeight4(Int_t term, Float_t R, Float_t fcSq, Int_t c[4], Float_t qinv[6], Float_t kT[6]){
6bb6954b 3860 if(term==13) return 1.0;
be9ef9f9 3861
3862 // Charge ordering:
3863 // ----, ---+, --++, -+++, ++++
3864 //
3865 // term ordering:
3866 // Term 1: 1-2-3-4 (all same-event)
3867 // Term 2: 1-2-3 4 (particle 4 from different event)
3868 // Term 3: 1-2-4 3 (particle 3 from different event)
3869 // Term 4: 1-3-4 2 (particle 2 from different event)
3870 // Term 5: 2-3-4 1 (particle 1 from different event)
3871 // Term 6: 1-2 3 4 (particle 1 and 2 from same event)
3872 // Term 7: 1-3 2 4
3873 // Term 8: 1-4 2 3
3874 // Term 9: 2-3 1 4
3875 // Term 10: 2-4 1 3
3876 // Term 11: 3-4 1 2
3877 // Term 12: 1 2 3 4 (all from different events)
3878
3879 Float_t radius = R/0.19733;
3880 Float_t r[6]={0};
3881 r[0]=radius*(1-kT[0]/2.0);
3882 r[1]=radius*(1-kT[1]/2.0);
3883 r[2]=radius*(1-kT[2]/2.0);
3884 r[3]=radius*(1-kT[3]/2.0);
3885 r[4]=radius*(1-kT[4]/2.0);
3886 r[5]=radius*(1-kT[5]/2.0);
3887
3888 Int_t ChargeSum=c[0]+c[1]+c[2]+c[3];
3889
3890 Float_t fc = sqrt(fcSq);
3891 SetFSIindex(R);
3892 Float_t Kfactor12 = FSICorrelation(c[0],c[1], qinv[0]);// K2
3893 Float_t Kfactor13 = FSICorrelation(c[0],c[2], qinv[1]);// K2
3894 Float_t Kfactor14 = FSICorrelation(c[0],c[3], qinv[2]);// K2
3895 Float_t Kfactor23 = FSICorrelation(c[1],c[2], qinv[3]);// K2
3896 Float_t Kfactor24 = FSICorrelation(c[1],c[3], qinv[4]);// K2
3897 Float_t Kfactor34 = FSICorrelation(c[2],c[3], qinv[5]);// K2
3898 Float_t arg12=qinv[0]*r[0];
3899 Float_t arg13=qinv[1]*r[1];
3900 Float_t arg14=qinv[2]*r[2];
3901 Float_t arg23=qinv[3]*r[3];
3902 Float_t arg24=qinv[4]*r[4];
3903 Float_t arg34=qinv[5]*r[5];
3904 // Exchange Amplitudes
3905 Float_t EA12 = exp(-pow(arg12,2)/2.)*(1 + kappa3/(6.*pow(2.,1.5))*(8.*pow(arg12,3) - 12.*arg12) + kappa4/(24.*pow(2.,2))*(16.*pow(arg12,4) -48.*pow(arg12,2) + 12));
3906 Float_t EA13 = exp(-pow(arg13,2)/2.)*(1 + kappa3/(6.*pow(2.,1.5))*(8.*pow(arg13,3) - 12.*arg13) + kappa4/(24.*pow(2.,2))*(16.*pow(arg13,4) -48.*pow(arg13,2) + 12));
3907 Float_t EA14 = exp(-pow(arg14,2)/2.)*(1 + kappa3/(6.*pow(2.,1.5))*(8.*pow(arg14,3) - 12.*arg14) + kappa4/(24.*pow(2.,2))*(16.*pow(arg14,4) -48.*pow(arg14,2) + 12));
3908 Float_t EA23 = exp(-pow(arg23,2)/2.)*(1 + kappa3/(6.*pow(2.,1.5))*(8.*pow(arg23,3) - 12.*arg23) + kappa4/(24.*pow(2.,2))*(16.*pow(arg23,4) -48.*pow(arg23,2) + 12));
3909 Float_t EA24 = exp(-pow(arg24,2)/2.)*(1 + kappa3/(6.*pow(2.,1.5))*(8.*pow(arg24,3) - 12.*arg24) + kappa4/(24.*pow(2.,2))*(16.*pow(arg24,4) -48.*pow(arg24,2) + 12));
3910 Float_t EA34 = exp(-pow(arg34,2)/2.)*(1 + kappa3/(6.*pow(2.,1.5))*(8.*pow(arg34,3) - 12.*arg34) + kappa4/(24.*pow(2.,2))*(16.*pow(arg34,4) -48.*pow(arg34,2) + 12));
3911
3912 if(c[0]==c[1] && c[0]==c[2] && c[0]==c[3]){// ---- and ++++ configuration
3913
3914 if(term==1){
3915 Float_t C4QS = 1 + pow(EA12,2) + pow(EA13,2) + pow(EA14,2) + pow(EA23,2) + pow(EA24,2) + pow(EA34,2);// baseline + single pairs
3916 C4QS += pow(EA12,2) * pow(EA34,2);// 2-pairs
3917 C4QS += pow(EA13,2) * pow(EA24,2);// 2-pairs
3918 C4QS += pow(EA14,2) * pow(EA23,2);// 2-pairs
3919 C4QS += 2*EA12*EA13*EA23 + 2*EA12*EA14*EA24 + 2*EA13*EA14*EA34 + 2*EA23*EA24*EA34;// 3-particle exhange
3920 C4QS += 3*EA12*EA23*EA34*EA14 + 3*EA12*EA13*EA34*EA24;// 4-particle exchange
3921 Float_t C4 = pow(1-fc,4) + 4*fc*pow(1-fc,3);
3922 C4 += pow(fc,2)*pow(1-fc,2)*( (1 + pow(EA12,2))*Kfactor12 + (1 + pow(EA13,2))*Kfactor13 + (1 + pow(EA14,2))*Kfactor14 );
3923 C4 += pow(fc,2)*pow(1-fc,2)*( (1 + pow(EA23,2))*Kfactor23 + (1 + pow(EA24,2))*Kfactor24 + (1 + pow(EA34,2))*Kfactor34);
3924 C4 += pow(fc,3)*(1-fc)*(1 + pow(EA12,2) + pow(EA13,2) + pow(EA23,2) + 2*EA12*EA13*EA23) * Kfactor12*Kfactor13*Kfactor23;
3925 C4 += pow(fc,3)*(1-fc)*(1 + pow(EA12,2) + pow(EA14,2) + pow(EA24,2) + 2*EA12*EA14*EA24) * Kfactor12*Kfactor14*Kfactor24;
3926 C4 += pow(fc,3)*(1-fc)*(1 + pow(EA13,2) + pow(EA14,2) + pow(EA34,2) + 2*EA13*EA14*EA34) * Kfactor13*Kfactor14*Kfactor34;
3927 C4 += pow(fc,3)*(1-fc)*(1 + pow(EA23,2) + pow(EA24,2) + pow(EA34,2) + 2*EA23*EA24*EA34) * Kfactor23*Kfactor24*Kfactor34;
3928 C4 += pow(fc,4)*C4QS*Kfactor12*Kfactor13*Kfactor14*Kfactor23*Kfactor24*Kfactor34;
3929 return C4;
3930 }else if(term<=5){
3931 Float_t EA1=0, EA2=0, EA3=0, Kpair1=0, Kpair2=0, Kpair3=0;
3932 if(term==2) {EA1=EA12; EA2=EA13; EA3=EA23; Kpair1=Kfactor12; Kpair2=Kfactor13; Kpair3=Kfactor23;}
3933 else if(term==3) {EA1=EA12; EA2=EA14; EA3=EA24; Kpair1=Kfactor12; Kpair2=Kfactor14; Kpair3=Kfactor24;}
3934 else if(term==4) {EA1=EA13; EA2=EA14; EA3=EA34; Kpair1=Kfactor13; Kpair2=Kfactor14; Kpair3=Kfactor34;}
3935 else {EA1=EA23; EA2=EA24; EA3=EA34; Kpair1=Kfactor23; Kpair2=Kfactor24; Kpair3=Kfactor34;}
3936 Float_t C3QS = 1 + pow(EA1,2) + pow(EA2,2) + pow(EA3,2);
3937 C3QS += 2*EA1*EA2*EA3;
3938 Float_t C3 = pow(1-fc,3) + 3*fc*pow(1-fc,2);
3939 C3 += pow(fc,2)*(1-fc)*( (1+pow(EA1,2))*Kpair1 + (1+pow(EA2,2))*Kpair2 + (1+pow(EA3,2))*Kpair3 );
3940 C3 += pow(fc,3)*C3QS*Kpair1*Kpair2*Kpair3;
3941 return C3;
3942 }else if(term<=11){
3943 if(term==6) return ((1-fcSq) + fcSq*(1 + pow(EA12,2))*Kfactor12);
3944 else if(term==7) return ((1-fcSq) + fcSq*(1 + pow(EA13,2))*Kfactor13);
3945 else if(term==8) return ((1-fcSq) + fcSq*(1 + pow(EA14,2))*Kfactor14);
3946 else if(term==9) return ((1-fcSq) + fcSq*(1 + pow(EA23,2))*Kfactor23);
3947 else if(term==10) return ((1-fcSq) + fcSq*(1 + pow(EA24,2))*Kfactor24);
3948 else return ((1-fcSq) + fcSq*(1 + pow(EA34,2))*Kfactor34);
6bb6954b 3949 }else if(term==12){
5591748e 3950 Float_t C22 = (1-fcSq) + fcSq*(1 + pow(EA12,2))*Kfactor12;
3951 C22 *= (1-fcSq) + fcSq*(1 + pow(EA34,2))*Kfactor34;
6bb6954b 3952 return C22;
be9ef9f9 3953 }else return 1.0;
3954
3955 }else{// mixed charge case
3956 if( ChargeSum==1 || ChargeSum==3){// ---+ and -+++ configuration
3957 Float_t EA1=0, EA2=0, EA3=0, Kpair1=0, Kpair2=0, Kpair3=0, Kpair4=0, Kpair5=0, Kpair6=0;
3958 Int_t c_OddOneOut = 1;
3959 if(ChargeSum==3) c_OddOneOut = 0;
3960 //
3961 if(c[0]==c_OddOneOut) {EA1=EA23; EA2=EA24; EA3=EA34; Kpair1=Kfactor23; Kpair2=Kfactor24; Kpair3=Kfactor34; Kpair4=Kfactor12; Kpair5=Kfactor13; Kpair6=Kfactor14;}
3962 else if(c[1]==c_OddOneOut) {EA1=EA13; EA2=EA14; EA3=EA34; Kpair1=Kfactor13; Kpair2=Kfactor14; Kpair3=Kfactor34; Kpair4=Kfactor12; Kpair5=Kfactor23; Kpair6=Kfactor24;}
3963 else if(c[2]==c_OddOneOut) {EA1=EA12; EA2=EA14; EA3=EA24; Kpair1=Kfactor12; Kpair2=Kfactor14; Kpair3=Kfactor24; Kpair4=Kfactor13; Kpair5=Kfactor23; Kpair6=Kfactor34;}
3964 else {EA1=EA12; EA2=EA13; EA3=EA23; Kpair1=Kfactor12; Kpair2=Kfactor13; Kpair3=Kfactor23; Kpair4=Kfactor14; Kpair5=Kfactor24; Kpair6=Kfactor34;}
3965
3966 if(term==1){
3967 Float_t C3QS = 1 + pow(EA1,2) + pow(EA2,2) + pow(EA3,2) + 2*EA1*EA2*EA3;
3968 Float_t C4 = pow(1-fc,4) + 4*fc*pow(1-fc,3);
3969 C4 += pow(fc,2)*pow(1-fc,2)*( (1 + pow(EA1,2))*Kpair1 + (1 + pow(EA2,2))*Kpair2 + (1 + pow(EA3,2))*Kpair3 );
3970 C4 += pow(fc,2)*pow(1-fc,2)*( Kpair4 + Kpair5 + Kpair6 );
3971 C4 += pow(fc,3)*(1-fc)*(1 + pow(EA1,2) + pow(EA2,2) + pow(EA3,2) + 2*EA1*EA2*EA3) * Kpair1*Kpair2*Kpair3;
3972 C4 += pow(fc,3)*(1-fc)*( (1 + pow(EA1,2))*Kpair1*Kpair4*Kpair5 + (1+pow(EA2,2))*Kpair2*Kpair4*Kpair6 + (1+pow(EA3,2))*Kpair3*Kpair5*Kpair6);// doesn't matter which MC K's
3973 C4 += pow(fc,4)*C3QS*Kfactor12*Kfactor13*Kfactor14*Kfactor23*Kfactor24*Kfactor34;
3974 return C4;
3975 }else if( (term==2 && ChargeSum==1) || (term==5 && ChargeSum==3)){
3976 Float_t C3QS = 1 + pow(EA1,2) + pow(EA2,2) + pow(EA3,2) + 2*EA1*EA2*EA3;
3977 Float_t C3 = pow(1-fc,3) + 3*fc*pow(1-fc,2);
3978 C3 += pow(fc,2)*(1-fc)*(1+pow(EA1,2))*Kpair1;
3979 C3 += pow(fc,2)*(1-fc)*(1+pow(EA2,2))*Kpair2;
3980 C3 += pow(fc,2)*(1-fc)*(1+pow(EA3,2))*Kpair3;
3981 C3 += pow(fc,3)*C3QS*Kpair1*Kpair2*Kpair3;
3982 return C3;
3983 }else if(term<=5){// one SC pair, two MC pairs
3984 Float_t C3 = pow(1-fc,3) + 3*fc*pow(1-fc,2);
3985 C3 += pow(fc,2)*(1-fc)*(1+pow(EA1,2))*Kpair1;// any SC pair will do
3986 C3 += pow(fc,2)*(1-fc)*Kpair4;// any MC pair will do
3987 C3 += pow(fc,2)*(1-fc)*Kpair5;// any MC pair will do
3988 C3 += pow(fc,3)*(1+pow(EA1,2))*Kpair1*Kpair4*Kpair5;
3989 return C3;
3990 }else if(term==6 || term==7){
3991 if(ChargeSum==1) return ((1-fcSq) + fcSq*(1 + pow(EA1,2))*Kpair1);// any SC pair will do
3992 else return ((1-fcSq) + fcSq*Kpair4);// any MC pair will do
3993 }else if(term==8){
3994 return ((1-fcSq) + fcSq*Kpair4);// any MC pair will do
3995 }else if(term==9){
3996 return ((1-fcSq) + fcSq*(1 + pow(EA1,2))*Kpair1);// any SC pair will do
6bb6954b 3997 }else if(term==10 || term==11){
be9ef9f9 3998 if(ChargeSum==3) return ((1-fcSq) + fcSq*(1 + pow(EA1,2))*Kpair1);// any SC pair will do
3999 else return ((1-fcSq) + fcSq*Kpair4);// any MC pair will do
6bb6954b 4000 }else return 1.0;// for 12 and 13
be9ef9f9 4001 }else{// --++ configuration
4002 Float_t EA1=0, EA2=0, Kpair1=0, Kpair2=0, Kpair3=0, Kpair4=0, Kpair5=0, Kpair6=0;
4003 if(c[0]==c[1]) {EA1=EA12; EA2=EA34; Kpair1=Kfactor12; Kpair2=Kfactor34; Kpair3=Kfactor13; Kpair4=Kfactor14; Kpair5=Kfactor23; Kpair6=Kfactor24;}
4004 else if(c[0]==c[2]) {EA1=EA13; EA2=EA24; Kpair1=Kfactor13; Kpair2=Kfactor24; Kpair3=Kfactor12; Kpair4=Kfactor14; Kpair5=Kfactor23; Kpair6=Kfactor34;}
4005 else {EA1=EA14; EA2=EA23; Kpair1=Kfactor14; Kpair2=Kfactor23; Kpair3=Kfactor12; Kpair4=Kfactor13; Kpair5=Kfactor24; Kpair6=Kfactor34;}
4006 //
4007 if(term==1){
4008 Float_t C2QS = 1 + pow(EA1,2)*pow(EA2,2);
4009 Float_t C4 = pow(1-fc,4) + 4*fc*pow(1-fc,3);
4010 C4 += pow(fc,2)*pow(1-fc,2)*( (1 + pow(EA1,2))*Kpair1 + (1 + pow(EA2,2))*Kpair2 );
4011 C4 += pow(fc,2)*pow(1-fc,2)*( Kpair3 + Kpair4 + Kpair5 + Kpair6 );
4012 C4 += pow(fc,3)*(1-fc)*( (1 + pow(EA1,2))*Kpair1*Kpair3*Kpair4 + (1 + pow(EA2,2))*Kpair2*Kpair3*Kpair4);
4013 C4 += pow(fc,3)*(1-fc)*( (1 + pow(EA1,2))*Kpair1*Kpair5*Kpair6 + (1 + pow(EA2,2))*Kpair2*Kpair5*Kpair6);// doesn't matter which two MC K's used
4014 C4 += pow(fc,4)*C2QS*Kfactor12*Kfactor13*Kfactor14*Kfactor23*Kfactor24*Kfactor34;
4015 return C4;
4016 }else if(term<=5){
4017 Float_t C3 = pow(1-fc,3) + 3*fc*pow(1-fc,2);
4018 C3 += pow(fc,2)*(1-fc)*(1+pow(EA1,2))*Kpair1;// any SC pair will do
4019 C3 += pow(fc,2)*(1-fc)*Kpair4;// any MC pair will do
4020 C3 += pow(fc,2)*(1-fc)*Kpair6;// any MC pair will do
4021 C3 += pow(fc,3)*(1+pow(EA1,2))*Kpair1*Kpair4*Kpair6;
4022 return C3;
4023 }else if(term==6 || term==11){
4024 return ((1-fcSq) + fcSq*(1 + pow(EA1,2))*Kpair1);// any SC pair will do
fcb16ac9 4025 }else if(term!=12 && term !=13){
be9ef9f9 4026 return ((1-fcSq) + fcSq*Kpair3);// any MC pair will do
fcb16ac9 4027 }else if(term==12){
4028 Float_t C22 = (1-fcSq) + fcSq*(1 + pow(EA1,2))*Kpair1;
4029 C22 *= (1-fcSq) + fcSq*(1 + pow(EA2,2))*Kpair2;
4030 return C22;
be9ef9f9 4031 }else return 1.0;
4032 }
4033 }
4034
4035}
4036//________________________________________________________________________
4037Float_t AliFourPion::MCWeightFSI4(Int_t term, Float_t R, Float_t fcSq, Int_t c[4], Float_t qinv[6]){
6bb6954b 4038 if(term==13) return 1.0;
be9ef9f9 4039
4040 Int_t ChargeSum=c[0]+c[1]+c[2]+c[3];
4041
4042 Float_t fc = sqrt(fcSq);
4043 SetFSIindex(R);
4044 Float_t Kfactor12 = FSICorrelation(c[0],c[1], qinv[0]);// K2
4045 Float_t Kfactor13 = FSICorrelation(c[0],c[2], qinv[1]);// K2
4046 Float_t Kfactor14 = FSICorrelation(c[0],c[3], qinv[2]);// K2
4047 Float_t Kfactor23 = FSICorrelation(c[1],c[2], qinv[3]);// K2
4048 Float_t Kfactor24 = FSICorrelation(c[1],c[3], qinv[4]);// K2
4049 Float_t Kfactor34 = FSICorrelation(c[2],c[3], qinv[5]);// K2
4050
4051 if(c[0]==c[1] && c[0]==c[2] && c[0]==c[3]){// ---- and ++++ configuration
4052
4053 if(term==1){
4054 Float_t C4 = pow(1-fc,4) + 4*fc*pow(1-fc,3);
4055 C4 += pow(fc,2)*pow(1-fc,2)*( Kfactor12 + Kfactor13 + Kfactor14 );
4056 C4 += pow(fc,2)*pow(1-fc,2)*( Kfactor23 + Kfactor24 + Kfactor34 );
4057 C4 += pow(fc,3)*(1-fc) * Kfactor12*Kfactor13*Kfactor23;
4058 C4 += pow(fc,3)*(1-fc) * Kfactor12*Kfactor14*Kfactor24;
4059 C4 += pow(fc,3)*(1-fc) * Kfactor13*Kfactor14*Kfactor34;
4060 C4 += pow(fc,3)*(1-fc) * Kfactor23*Kfactor24*Kfactor34;
4061 C4 += pow(fc,4) * Kfactor12*Kfactor13*Kfactor14*Kfactor23*Kfactor24*Kfactor34;
4062 return C4;
4063 }else if(term<=5){
4064 Float_t Kpair1=0, Kpair2=0, Kpair3=0;
4065 if(term==2) {Kpair1=Kfactor12; Kpair2=Kfactor13; Kpair3=Kfactor23;}
4066 else if(term==3) {Kpair1=Kfactor12; Kpair2=Kfactor14; Kpair3=Kfactor24;}
4067 else if(term==4) {Kpair1=Kfactor13; Kpair2=Kfactor14; Kpair3=Kfactor34;}
4068 else {Kpair1=Kfactor23; Kpair2=Kfactor24; Kpair3=Kfactor34;}
4069 Float_t C3 = pow(1-fc,3) + 3*fc*pow(1-fc,2);
4070 C3 += pow(fc,2)*(1-fc)*( Kpair1 + Kpair2 + Kpair3 );
4071 C3 += pow(fc,3)*Kpair1*Kpair2*Kpair3;
4072 return C3;
4073 }else if(term<=11){
4074 if(term==6) return ((1-fcSq) + fcSq*Kfactor12);
4075 else if(term==7) return ((1-fcSq) + fcSq*Kfactor13);
4076 else if(term==8) return ((1-fcSq) + fcSq*Kfactor14);
4077 else if(term==9) return ((1-fcSq) + fcSq*Kfactor23);
4078 else if(term==10) return ((1-fcSq) + fcSq*Kfactor24);
4079 else return ((1-fcSq) + fcSq*Kfactor34);
6bb6954b 4080 }else if(term==12){
5591748e 4081 Float_t C22 = (1-fcSq) + fcSq*Kfactor12;
4082 C22 *= (1-fcSq) + fcSq*Kfactor34;
6bb6954b 4083 return C22;
be9ef9f9 4084 }else return 1.0;
4085
4086 }else{// mixed charge case
4087 if( ChargeSum==1 || ChargeSum==3){// ---+ and -+++ configuration
4088 Float_t Kpair1=0, Kpair2=0, Kpair3=0, Kpair4=0, Kpair5=0, Kpair6=0;
4089 Int_t c_OddOneOut = 1;
4090 if(ChargeSum==3) c_OddOneOut = 0;
4091 //
4092 if(c[0]==c_OddOneOut) {Kpair1=Kfactor23; Kpair2=Kfactor24; Kpair3=Kfactor34; Kpair4=Kfactor12; Kpair5=Kfactor13; Kpair6=Kfactor14;}
4093 else if(c[1]==c_OddOneOut) {Kpair1=Kfactor13; Kpair2=Kfactor14; Kpair3=Kfactor34; Kpair4=Kfactor12; Kpair5=Kfactor23; Kpair6=Kfactor24;}
4094 else if(c[2]==c_OddOneOut) {Kpair1=Kfactor12; Kpair2=Kfactor14; Kpair3=Kfactor24; Kpair4=Kfactor13; Kpair5=Kfactor23; Kpair6=Kfactor34;}
4095 else {Kpair1=Kfactor12; Kpair2=Kfactor13; Kpair3=Kfactor23; Kpair4=Kfactor14; Kpair5=Kfactor24; Kpair6=Kfactor34;}
4096
4097 if(term==1){
4098 Float_t C4 = pow(1-fc,4) + 4*fc*pow(1-fc,3);
4099 C4 += pow(fc,2)*pow(1-fc,2)*( Kpair1 + Kpair2 + Kpair3 );
4100 C4 += pow(fc,2)*pow(1-fc,2)*( Kpair4 + Kpair5 + Kpair6 );
4101 C4 += pow(fc,3)*(1-fc)*Kpair1*Kpair2*Kpair3;
4102 C4 += pow(fc,3)*(1-fc)*(Kpair1*Kpair4*Kpair5 + Kpair2*Kpair4*Kpair6 + Kpair3*Kpair5*Kpair6);// doesn't matter which two MC K's used
4103 C4 += pow(fc,4)*Kfactor12*Kfactor13*Kfactor14*Kfactor23*Kfactor24*Kfactor34;
4104 return C4;
4105 }else if( (term==2 && ChargeSum==1) || (term==5 && ChargeSum==3)){
4106 Float_t C3 = pow(1-fc,3) + 3*fc*pow(1-fc,2);
4107 C3 += pow(fc,2)*(1-fc)*Kpair1;
4108 C3 += pow(fc,2)*(1-fc)*Kpair2;
4109 C3 += pow(fc,2)*(1-fc)*Kpair3;
4110 C3 += pow(fc,3)*Kpair1*Kpair2*Kpair3;
4111 return C3;
4112 }else if(term<=5){// one SC pair, two MC pairs
4113 Float_t C3 = pow(1-fc,3) + 3*fc*pow(1-fc,2);
4114 C3 += pow(fc,2)*(1-fc)*Kpair1;// any SC pair will do
4115 C3 += pow(fc,2)*(1-fc)*Kpair4;// any MC pair will do
4116 C3 += pow(fc,2)*(1-fc)*Kpair5;// any MC pair will do
4117 C3 += pow(fc,3)*Kpair1*Kpair4*Kpair5;
4118 return C3;
4119 }else if(term==6 || term==7){
4120 if(ChargeSum==1) return ((1-fcSq) + fcSq*Kpair1);// any SC pair will do
4121 else return ((1-fcSq) + fcSq*Kpair4);// any MC pair will do
4122 }else if(term==8){
4123 return ((1-fcSq) + fcSq*Kpair4);// any MC pair will do
4124 }else if(term==9){
4125 return ((1-fcSq) + fcSq*Kpair1);// any SC pair will do
6bb6954b 4126 }else if(term==10 || term==11){
be9ef9f9 4127 if(ChargeSum==3) return ((1-fcSq) + fcSq*Kpair1);// any SC pair will do
4128 else return ((1-fcSq) + fcSq*Kpair4);// any MC pair will do
6bb6954b 4129 }else return 1.0;// 12 and 13
be9ef9f9 4130 }else{// --++ configuration
4131 Float_t Kpair1=0, Kpair2=0, Kpair3=0, Kpair4=0, Kpair5=0, Kpair6=0;
4132 if(c[0]==c[1]) {Kpair1=Kfactor12; Kpair2=Kfactor34; Kpair3=Kfactor13; Kpair4=Kfactor14; Kpair5=Kfactor23; Kpair6=Kfactor24;}
4133 else if(c[0]==c[2]) {Kpair1=Kfactor13; Kpair2=Kfactor24; Kpair3=Kfactor12; Kpair4=Kfactor14; Kpair5=Kfactor23; Kpair6=Kfactor34;}
4134 else {Kpair1=Kfactor14; Kpair2=Kfactor23; Kpair3=Kfactor12; Kpair4=Kfactor13; Kpair5=Kfactor24; Kpair6=Kfactor34;}
4135 //
4136 if(term==1){
4137 Float_t C4 = pow(1-fc,4) + 4*fc*pow(1-fc,3);
4138 C4 += pow(fc,2)*pow(1-fc,2)*( Kpair1 + Kpair2 + Kpair3 + Kpair4 + Kpair5 + Kpair6);
4139 C4 += pow(fc,3)*(1-fc)*( Kpair1*Kpair3*Kpair4 + Kpair2*Kpair3*Kpair4 + Kpair1*Kpair5*Kpair6 + Kpair2*Kpair5*Kpair6);
4140 C4 += pow(fc,4)*Kfactor12*Kfactor13*Kfactor14*Kfactor23*Kfactor24*Kfactor34;
4141 return C4;
4142 }else if(term<=5){
4143 Float_t C3 = pow(1-fc,3) + 3*fc*pow(1-fc,2);
4144 C3 += pow(fc,2)*(1-fc)*Kpair1;// any SC pair will do
4145 C3 += pow(fc,2)*(1-fc)*Kpair4;// any MC pair will do
4146 C3 += pow(fc,2)*(1-fc)*Kpair6;// any MC pair will do
4147 C3 += pow(fc,3)*Kpair1*Kpair4*Kpair6;
4148 return C3;
4149 }else if(term==6 || term==11){
4150 return ((1-fcSq) + fcSq*Kpair1);// any SC pair will do
6bb6954b 4151 }else if(term !=12 && term !=13){
be9ef9f9 4152 return ((1-fcSq) + fcSq*Kpair3);// any MC pair will do
fcb16ac9 4153 }else if(term==12){
4154 Float_t C22 = (1-fcSq) + fcSq*Kpair1;
4155 C22 *= (1-fcSq) + fcSq*Kpair2;
4156 return C22;
be9ef9f9 4157 }else return 1.0;
4158 }
4159 }
4160
4161}
4162//________________________________________________________________________
80507acf 4163void AliFourPion::SetMomResCorrections(Bool_t legoCase, TH2D *temp2DSC, TH2D *temp2DMC){
be9ef9f9 4164
4165
4166 if(legoCase){
4167 cout<<"LEGO call to SetMomResCorrections"<<endl;
80507acf 4168 fMomResC2SC = (TH2D*)temp2DSC->Clone();
4169 fMomResC2SC->SetDirectory(0);
4170 fMomResC2MC = (TH2D*)temp2DMC->Clone();
4171 fMomResC2MC->SetDirectory(0);
be9ef9f9 4172 }else {
4173 TFile *momResFile = new TFile("MomResFile.root","READ");
4174 if(!momResFile->IsOpen()) {
4175 cout<<"No momentum resolution file found"<<endl;
4176 AliFatal("No momentum resolution file found. Kill process.");
4177 }else {cout<<"Good Momentum Resolution File Found!"<<endl;}
4178
80507acf 4179 TH2D *temp2DSC2 = (TH2D*)momResFile->Get("MRC_C2_SC");
4180 fMomResC2SC = (TH2D*)temp2DSC2->Clone();
4181 fMomResC2SC->SetDirectory(0);
4182 //
4183 TH2D *temp2DMC2 = (TH2D*)momResFile->Get("MRC_C2_MC");
4184 fMomResC2MC = (TH2D*)temp2DMC2->Clone();
4185 fMomResC2MC->SetDirectory(0);
4186 //
be9ef9f9 4187 momResFile->Close();
4188 }
4189
4190
80507acf 4191 for(Int_t bx=1; bx<=fMomResC2SC->GetNbinsX(); bx++){
4192 for(Int_t by=1; by<=fMomResC2SC->GetNbinsY(); by++){
4193 if(fMomResC2SC->GetBinContent(bx,by) > 1.5) fMomResC2SC->SetBinContent(bx,by, 1.0);// Maximum is ~1.02
4194 if(fMomResC2SC->GetBinContent(bx,by) < 0.8) fMomResC2SC->SetBinContent(bx,by, 1.0);// Minimum is ~0.8
4195 if(fMomResC2MC->GetBinContent(bx,by) > 1.5) fMomResC2MC->SetBinContent(bx,by, 1.0);// Maximum is ~1.02
4196 if(fMomResC2MC->GetBinContent(bx,by) < 0.8) fMomResC2MC->SetBinContent(bx,by, 1.0);// Minimum is ~0.8
be9ef9f9 4197 }
4198 }
80507acf 4199
be9ef9f9 4200 cout<<"Done reading momentum resolution file"<<endl;
4201}
4202//________________________________________________________________________
4203void AliFourPion::SetFSICorrelations(Bool_t legoCase, TH1D *tempss[12], TH1D *tempos[12]){
4204 // read in 2-particle and 3-particle FSI correlations = K2 & K3
4205 // 2-particle input histo from file is binned in qinv. 3-particle in qinv of each pair
4206 if(legoCase){
4207 cout<<"LEGO call to SetFSICorrelations"<<endl;
4208 for(Int_t MB=0; MB<12; MB++) {
4209 fFSIss[MB] = (TH1D*)tempss[MB]->Clone();
4210 fFSIos[MB] = (TH1D*)tempos[MB]->Clone();
4211 //
4212 fFSIss[MB]->SetDirectory(0);
4213 fFSIos[MB]->SetDirectory(0);
4214 }
4215 }else {
4216 cout<<"non LEGO call to SetFSICorrelations"<<endl;
4217 TFile *fsifile = new TFile("KFile.root","READ");
4218 if(!fsifile->IsOpen()) {
4219 cout<<"No FSI file found"<<endl;
4220 AliFatal("No FSI file found. Kill process.");
4221 }else {cout<<"Good FSI File Found!"<<endl;}
4222
4223 TH1D *temphistoSS[12];
4224 TH1D *temphistoOS[12];
4225 for(Int_t MB=0; MB<12; MB++) {
4226 TString *nameK2SS = new TString("K2ss_");
4227 *nameK2SS += MB;
4228 temphistoSS[MB] = (TH1D*)fsifile->Get(nameK2SS->Data());
4229 //
4230 TString *nameK2OS = new TString("K2os_");
4231 *nameK2OS += MB;
4232 temphistoOS[MB] = (TH1D*)fsifile->Get(nameK2OS->Data());
4233 //
4234 fFSIss[MB] = (TH1D*)temphistoSS[MB]->Clone();
4235 fFSIos[MB] = (TH1D*)temphistoOS[MB]->Clone();
4236 fFSIss[MB]->SetDirectory(0);
4237 fFSIos[MB]->SetDirectory(0);
4238 }
4239 //
4240
4241 fsifile->Close();
4242 }
4243
4244 cout<<"Done reading FSI file"<<endl;
4245}
4246//________________________________________________________________________
4247Float_t AliFourPion::FSICorrelation(Int_t charge1, Int_t charge2, Float_t qinv){
4248 // returns 2-particle Coulomb correlations = K2
4249 Int_t qbinL = fFSIss[fFSIindex]->GetXaxis()->FindBin(qinv-fFSIss[fFSIindex]->GetXaxis()->GetBinWidth(1)/2.);
4250 Int_t qbinH = qbinL+1;
4251 if(qbinL <= 0) return 1.0;
fcb16ac9 4252 if(qbinH > fFSIss[fFSIindex]->GetNbinsX()) {
4253 if(charge1!=charge2) {
4254 Float_t ScaleFac = (fFSIos[fFSIindex]->GetBinContent(fFSIos[fFSIindex]->GetNbinsX()-1) - 1);
4255 ScaleFac /= (Gamov(charge1, charge2, fFSIos[fFSIindex]->GetXaxis()->GetBinCenter(fFSIos[fFSIindex]->GetNbinsX()-1)) - 1);
4256 return ( (Gamov(charge1, charge2, qinv)-1)*ScaleFac + 1);
4257 }else{
4258 Float_t ScaleFac = (fFSIss[fFSIindex]->GetBinContent(fFSIss[fFSIindex]->GetNbinsX()-1) - 1);
4259 ScaleFac /= (Gamov(charge1, charge2, fFSIss[fFSIindex]->GetXaxis()->GetBinCenter(fFSIss[fFSIindex]->GetNbinsX()-1)) - 1);
4260 return ( (Gamov(charge1, charge2, qinv)-1)*ScaleFac + 1);
4261 }
4262 }
be9ef9f9 4263
4264 Float_t slope=0;
4265 if(charge1==charge2){
4266 slope = fFSIss[fFSIindex]->GetBinContent(qbinL) - fFSIss[fFSIindex]->GetBinContent(qbinH);
4267 slope /= fFSIss[fFSIindex]->GetXaxis()->GetBinCenter(qbinL) - fFSIss[fFSIindex]->GetXaxis()->GetBinCenter(qbinH);
4268 return (slope*(qinv - fFSIss[fFSIindex]->GetXaxis()->GetBinCenter(qbinL)) + fFSIss[fFSIindex]->GetBinContent(qbinL));
4269 }else {
4270 slope = fFSIos[fFSIindex]->GetBinContent(qbinL) - fFSIos[fFSIindex]->GetBinContent(qbinH);
4271 slope /= fFSIos[fFSIindex]->GetXaxis()->GetBinCenter(qbinL) - fFSIos[fFSIindex]->GetXaxis()->GetBinCenter(qbinH);
4272 return (slope*(qinv - fFSIos[fFSIindex]->GetXaxis()->GetBinCenter(qbinL)) + fFSIos[fFSIindex]->GetBinContent(qbinL));
4273 }
4274}
4275//________________________________________________________________________
4276void AliFourPion::SetFillBins2(Int_t c1, Int_t c2, Int_t &b1, Int_t &b2){
4277 if((c1+c2)==1) {b1=0; b2=1;}// Re-assign to merge degenerate histos
4278 else {b1=c1; b2=c2;}
4279}
4280//________________________________________________________________________
4281void AliFourPion::SetFillBins3(Int_t c1, Int_t c2, Int_t c3, Short_t part, Int_t &b1, Int_t &b2, Int_t &b3, Bool_t &fill2, Bool_t &fill3, Bool_t &fill4){
4282
4283 // "part" specifies which pair is from the same event. Only relevant for terms 2-4
4284 Bool_t seSS=kFALSE;
4285 if(part==1) {// default case (irrelevant for term 1 and term 5)
4286 if(c1==c2) seSS=kTRUE;
4287 }
4288 if(part==2){
4289 if(c1==c3) seSS=kTRUE;
4290 }
4291
4292
4293 // fill2, fill3, fill4 are only used for Cumulant Terms 2,3,4
4294 if( (c1+c2+c3)==1) {
4295 b1=0; b2=0; b3=1;// Re-assign to merge degenerate histos
4296 //
4297 if(seSS) fill2=kTRUE;
4298 else {fill3=kTRUE; fill4=kTRUE;}
4299 //
4300 }else if( (c1+c2+c3)==2) {
4301 b1=0; b2=1; b3=1;
4302 //
4303 if(!seSS) {fill2=kTRUE; fill3=kTRUE;}
4304 else fill4=kTRUE;
4305 //
4306 }else {
4307 b1=c1; b2=c2; b3=c3;
4308 fill2=kTRUE; fill3=kTRUE; fill4=kTRUE;
4309 }
4310
4311}
4312//________________________________________________________________________
6bb6954b 4313void AliFourPion::SetFillBins4(Int_t c1, Int_t c2, Int_t c3, Int_t c4, Int_t &b1, Int_t &b2, Int_t &b3, Int_t &b4, Int_t ENsum, Bool_t fillTerm[13]){
be9ef9f9 4314
4315 // fill2, fill3, fill4 are only used for Cumulant Terms 2,3,4
4316 if( (c1+c2+c3+c4)==0 || (c1+c2+c3+c4)==4) {// all of the same charge: ---- or ++++
4317
4318 b1=c1; b2=c2; b3=c3; b4=c4;
4319 if(ENsum==0) fillTerm[0]=kTRUE;
4320 else if(ENsum==1) {fillTerm[1]=kTRUE; fillTerm[2]=kTRUE; fillTerm[3]=kTRUE; fillTerm[4]=kTRUE;}
6bb6954b 4321 else if(ENsum==2) {fillTerm[11]=kTRUE;}
be9ef9f9 4322 else if(ENsum==3) {fillTerm[5]=kTRUE; fillTerm[6]=kTRUE; fillTerm[7]=kTRUE; fillTerm[8]=kTRUE; fillTerm[9]=kTRUE; fillTerm[10]=kTRUE;}
6bb6954b 4323 else fillTerm[12]=kTRUE;
be9ef9f9 4324
4325 }else if( (c1+c2+c3+c4)==1) {// one positive charge: ---+
4326
4327 b1=0; b2=0; b3=0; b4=1;// Re-assign to merge degenerate histos
4328 if(ENsum==0) fillTerm[0]=kTRUE;
4329 else if(ENsum==1){
4330 if(c4==1) fillTerm[1]=kTRUE;
4331 else {fillTerm[2]=kTRUE; fillTerm[3]=kTRUE; fillTerm[4]=kTRUE;}
6bb6954b 4332 }else if(ENsum==2){
4333 fillTerm[11]=kTRUE;
be9ef9f9 4334 }else if(ENsum==3){
4335 if(c3==1 || c4==1) {fillTerm[5]=kTRUE; fillTerm[6]=kTRUE; fillTerm[8]=kTRUE;}
4336 else {fillTerm[7]=kTRUE; fillTerm[9]=kTRUE; fillTerm[10]=kTRUE;}
6bb6954b 4337 }else fillTerm[12]=kTRUE;
be9ef9f9 4338
4339 }else if( (c1+c2+c3+c4)==2) {// two positive charges: --++
4340
4341 b1=0; b2=0; b3=1; b4=1;// Re-assign to merge degenerate histos
4342 if(ENsum==0) fillTerm[0]=kTRUE;
4343 else if(ENsum==1){
4344 if(c4==1) {fillTerm[1]=kTRUE; fillTerm[2]=kTRUE;}
4345 else {fillTerm[3]=kTRUE; fillTerm[4]=kTRUE;}
6bb6954b 4346 }else if(ENsum==2){
4347 if( (c1+c2)==0) fillTerm[11]=kTRUE;
be9ef9f9 4348 }else if(ENsum==3){
4349 if( (c1+c2)==0) fillTerm[5]=kTRUE;
4350 else if( (c1+c2)==1) {fillTerm[6]=kTRUE; fillTerm[7]=kTRUE; fillTerm[8]=kTRUE; fillTerm[9]=kTRUE;}
4351 else fillTerm[10]=kTRUE;
6bb6954b 4352 }else fillTerm[12]=kTRUE;
be9ef9f9 4353
4354 }else{// three positive charges
4355
4356 b1=0; b2=1; b3=1; b4=1;// Re-assign to merge degenerate histos
4357 if(ENsum==0) fillTerm[0]=kTRUE;
4358 else if(ENsum==1){
4359 if(c4==0) fillTerm[4]=kTRUE;
4360 else {fillTerm[1]=kTRUE; fillTerm[2]=kTRUE; fillTerm[3]=kTRUE;}
6bb6954b 4361 }else if(ENsum==2){
4362 fillTerm[11]=kTRUE;
be9ef9f9 4363 }else if(ENsum==3){
4364 if(c3==0 || c4==0) {fillTerm[8]=kTRUE; fillTerm[9]=kTRUE; fillTerm[10]=kTRUE;}
4365 else {fillTerm[5]=kTRUE; fillTerm[6]=kTRUE; fillTerm[7]=kTRUE;}
6bb6954b 4366 }else fillTerm[12]=kTRUE;
be9ef9f9 4367
4368 }
4369
4370}
4371//________________________________________________________________________
4372void AliFourPion::SetFSIindex(Float_t R){
4373 if(!fMCcase){
4374 if(fPbPbcase){
4375 if(fMbin==0) fFSIindex = 0;//0-5%
4376 else if(fMbin==1) fFSIindex = 1;//5-10%
4377 else if(fMbin<=3) fFSIindex = 2;//10-20%
4378 else if(fMbin<=5) fFSIindex = 3;//20-30%
4379 else if(fMbin<=7) fFSIindex = 4;//30-40%
4380 else if(fMbin<=9) fFSIindex = 5;//40-50%
4381 else if(fMbin<=12) fFSIindex = 6;//40-50%
4382 else if(fMbin<=15) fFSIindex = 7;//40-50%
4383 else if(fMbin<=18) fFSIindex = 8;//40-50%
4384 else fFSIindex = 8;//90-100%
4385 }else fFSIindex = 9;// pp and pPb
4386 }else{// FSI binning for MC
4387 if(R>=10.) fFSIindex = 0;
4388 else if(R>=9.) fFSIindex = 1;
4389 else if(R>=8.) fFSIindex = 2;
4390 else if(R>=7.) fFSIindex = 3;
4391 else if(R>=6.) fFSIindex = 4;
4392 else if(R>=5.) fFSIindex = 5;
4393 else if(R>=4.) fFSIindex = 6;
4394 else if(R>=3.) fFSIindex = 7;
4395 else if(R>=2.) fFSIindex = 8;
4396 else fFSIindex = 9;
4397 }
4398}
5591748e 4399//________________________________________________________________________
4400void AliFourPion::SetMuonCorrections(Bool_t legoCase, TH2D *tempMuon){
4401 if(legoCase){
4402 cout<<"LEGO call to SetMuonCorrections"<<endl;
4403 fWeightmuonCorrection = (TH2D*)tempMuon->Clone();
4404 fWeightmuonCorrection->SetDirectory(0);
4405 }else {
4406 cout<<"non LEGO call to SetMuonCorrections"<<endl;
4407 TFile *MuonFile=new TFile("MuonCorrection.root","READ");
4408 if(!MuonFile->IsOpen()) {
4409 cout<<"No Muon file found"<<endl;
4410 AliFatal("No Muon file found. Kill process.");
4411 }else {cout<<"Good Muon File Found!"<<endl;}
4412
4413 fWeightmuonCorrection = (TH2D*)MuonFile->Get("WeightmuonCorrection");
4414 fWeightmuonCorrection->SetDirectory(0);
4415 //
4416 MuonFile->Close();
4417 }
4418 cout<<"Done reading Muon file"<<endl;
4419}
95567836 4420//________________________________________________________________________
4421Float_t AliFourPion::cubicInterpolate (Float_t p[4], Float_t x) {
4422 return p[1] + 0.5 * x*(p[2] - p[0] + x*(2.0*p[0] - 5.0*p[1] + 4.0*p[2] - p[3] + x*(3.0*(p[1] - p[2]) + p[3] - p[0])));// Paulinternet
4423}
4424//________________________________________________________________________
4425Float_t AliFourPion::nCubicInterpolate (Int_t n, Float_t* p, Float_t coordinates[]) {
4426
4427 if (n == 1) {
4428 return cubicInterpolate(p, *coordinates);
4429 }
4430 else {
4431 Float_t arr[4];
4432 Int_t skip = 1 << (n - 1) * 2;
4433 arr[0] = nCubicInterpolate(n - 1, p, coordinates + 1);
4434 arr[1] = nCubicInterpolate(n - 1, p + skip, coordinates + 1);
4435 arr[2] = nCubicInterpolate(n - 1, p + 2*skip, coordinates + 1);
4436 arr[3] = nCubicInterpolate(n - 1, p + 3*skip, coordinates + 1);
4437 return cubicInterpolate(arr, *coordinates);
4438 }
4439}