]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Tasks/AliAnalysisTaskFlowStrange.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / AliAnalysisTaskFlowStrange.cxx
CommitLineData
24373b38 1/*************************************************************************
2* Copyright(c) 1998-2008,ALICE Experiment at CERN,All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use,copy,modify and distribute this software and its *
8* documentation strictly for non-commercial purposes is hereby granted *
9* without fee,provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15
16/////////////////////////////////////////////////////
17// AliAnalysisTaskFlowStrange:
18// Analysis task to select K0/Lambda candidates for flow analysis.
19// Authors: Cristian Ivan (civan@cern.ch)
20// Carlos Perez (cperez@cern.ch)
21// Pawel Debski (pdebski@cern.ch)
22//////////////////////////////////////////////////////
23
24#include "TChain.h"
25#include "TList.h"
26#include "TH1D.h"
27#include "TH2D.h"
28#include "TH3D.h"
29#include "TF1.h"
30#include "TProfile.h"
31#include "TProfile2D.h"
32#include "TVector3.h"
33#include "TStopwatch.h"
34#include "TFile.h"
35
36#include "TRandom3.h"
37
38#include "AliAnalysisManager.h"
39#include "AliInputEventHandler.h"
40
41#include "AliVVertex.h"
42#include "AliVVZERO.h"
43#include "AliStack.h"
44#include "AliMCEvent.h"
45
46#include "AliESDEvent.h"
47#include "AliESDtrack.h"
48#include "AliESDVertex.h"
49#include "AliESDv0.h"
50#include "AliESDtrackCuts.h"
51
52#include "AliAODEvent.h"
53#include "AliAODTrack.h"
54#include "AliAODVertex.h"
55#include "AliAODv0.h"
56#include "AliAODTracklets.h"
57#include "AliAODHeader.h"
58
59#include "AliAODMCHeader.h"
60#include "AliAODMCParticle.h"
61#include "TClonesArray.h"
62#include "TDatabasePDG.h"
63#include "TParticlePDG.h"
64
65#include "TMath.h"
66#include "TObjArray.h"
67#include "AliFlowCandidateTrack.h"
68
69#include "AliFlowTrackCuts.h"
70#include "AliFlowEventCuts.h"
71#include "AliFlowEvent.h"
72#include "AliFlowBayesianPID.h"
73#include "AliFlowCommonConstants.h"
74#include "AliFlowVector.h"
75
76#include "AliAnalysisTaskFlowStrange.h"
77
78ClassImp(AliAnalysisTaskFlowStrange)
79
80//=======================================================================
81AliAnalysisTaskFlowStrange::AliAnalysisTaskFlowStrange() :
82 AliAnalysisTaskSE(),
83 fPIDResponse(NULL),
84 fFB1(NULL),
85 fFB1024(NULL),
86 fTPCevent(NULL),
87 fVZEevent(NULL),
88 fCandidates(NULL),
89 fList(NULL),
90 fRunNumber(-1),
91 fDebug(0),
92 fQAlevel(0),
93 fReadESD(kFALSE),
94 fReadMC(kFALSE),
6c0d2d67 95 fAddPiToMCReactionPlane(kTRUE),
512ced40 96 fPostMatched(0),
24373b38 97 fAvoidExec(kFALSE),
98 fSkipSelection(kFALSE),
52476a4c 99 fSkipVn(kFALSE),
24373b38 100 fUseFP(kFALSE),
101 fRunOnpA(kFALSE),
102 fRunOnpp(kFALSE),
103 fExtraEventRejection(kFALSE),
6c0d2d67 104 fSkipCentralitySelection(kFALSE),
24373b38 105 fCentMethod("V0MTRK"),
106 fCentPerMin(0),
107 fCentPerMax(100),
108 fThisCent(-1.0),
6c0d2d67 109 fV0M(0.0),
110 fTRK(0.0),
111 fPriVtxZ(0.0),
112 fSPDVtxZ(0.0),
113 fSPDtracklets(0),
114 fVZETotM(0.0),
115 fRefMultTPC(0),
116 fRefMultHyb(0),
512ced40 117 fVertexZcut(10.0),
24373b38 118 fExcludeTPCEdges(kFALSE),
119 fSpecie(0),
120 fOnline(kFALSE),
121 fHomemade(kFALSE),
122 fWhichPsi(1),
123 fVZEsave(kFALSE),
124 fVZEload(NULL),
125 fVZEResponse(NULL),
126 fVZEmb(kFALSE),
127 fVZEByDisk(kTRUE),
128 fVZECa(0),
129 fVZECb(3),
130 fVZEAa(0),
131 fVZEAb(3),
132 fVZEQA(NULL),
6c0d2d67 133 fHarmonic(2),
24373b38 134 fPsi2(0.0),
135 fMCEP(0.0),
6c0d2d67 136 fQVZEACos(0.0),
137 fQVZEASin(0.0),
138 fQVZECCos(0.0),
139 fQVZECSin(0.0),
140 fQVZEA(0.0),
141 fQVZEC(0.0),
52476a4c 142 fVZEWarning(kFALSE),
6c0d2d67 143 fQTPCACos(0.0),
144 fQTPCASin(0.0),
145 fQTPCCCos(0.0),
146 fQTPCCSin(0.0),
147 fQTPC2hCos(0.0),
148 fQTPC2hSin(0.0),
149 fQTPCA(0.0),
150 fQTPCC(0.0),
151 fQTPCA_nTracks(0),
152 fQTPCC_nTracks(0),
153 fSkipTerminate(kTRUE),
24373b38 154 fMassBins(0),
155 fMinMass(0.0),
156 fMaxMass(0.0),
52476a4c 157 fPtBins(0),
24373b38 158 fRFPFilterBit(1),
159 fRFPminPt(0.2),
160 fRFPmaxPt(5.0),
6c0d2d67 161 fRFPAminEta(0.0),
162 fRFPAmaxEta(+0.8),
163 fRFPCminEta(-0.8),
164 fRFPCmaxEta(0.0),
24373b38 165 fRFPTPCsignal(10.0),
166 fRFPmaxIPxy(2.4),
167 fRFPmaxIPz(3.2),
168 fRFPTPCncls(70),
169 fDecayMass(0.0),
170 fDecayPhi(0.0),
171 fDecayEta(0.0),
172 fDecayPt(0.0),
173 fDecayDCAdaughters(0.0),
174 fDecayCosinePointingAngleXY(0.0),
175 fDecayRadXY(0.0),
176 fDecayDecayLength(0.0),
52476a4c 177 fDecayDecayLengthLab(0.0),
24373b38 178 fDecayQt(0.0),
179 fDecayAlpha(0.0),
180 fDecayRapidity(0.0),
181 fDecayProductIPXY(0.0),
512ced40
RAB
182 fDecayIPneg(0.0),
183 fDecayIPpos(0.0),
184 fDecayXneg(0.0),
185 fDecayXpos(0.0),
24373b38 186 fDecayIDneg(-1),
187 fDecayIDpos(-1),
188 fDecayID(-1),
512ced40
RAB
189 fDecayMatchOrigin(0.0),
190 fDecayMatchPhi(0.0),
191 fDecayMatchEta(0.0),
192 fDecayMatchPt(0.0),
193 fDecayMatchRadXY(0.0),
24373b38 194 fDecayMinEta(0.0),
195 fDecayMaxEta(0.0),
196 fDecayMinPt(0.0),
197 fDecayMaxDCAdaughters(0.0),
198 fDecayMinCosinePointingAngleXY(0.0),
199 fDecayMinQt(0.0),
200 fDecayAPCutPie(kTRUE),
52476a4c 201 fDecayStopPIDAtPt(3.0),
24373b38 202 fDecayMinRadXY(0.0),
203 fDecayMaxDecayLength(0.0),
204 fDecayMaxProductIPXY(0.0),
205 fDecayMaxRapidity(0.0),
206 fDaughterPhi(0.0),
207 fDaughterEta(0.0),
208 fDaughterPt(0.0),
209 fDaughterNClsTPC(0),
52476a4c 210 fDaughterNClsITS(0),
24373b38 211 fDaughterCharge(0),
212 fDaughterNFClsTPC(0),
213 fDaughterNSClsTPC(0),
214 fDaughterChi2PerNClsTPC(0.0),
215 fDaughterXRows(0.0),
216 fDaughterImpactParameterXY(0.0),
217 fDaughterImpactParameterZ(0.0),
218 fDaughterStatus(0),
512ced40 219 fDaughterITScm(0),
24373b38 220 fDaughterNSigmaPID(0.0),
221 fDaughterKinkIndex(0),
6c0d2d67 222 fDaughterAtSecPhi(0.0),
223 fDaughterAtSecEta(0.0),
224 fDaughterAtSecPt(0.0),
512ced40
RAB
225 fDaughterMatchPhi(0.0),
226 fDaughterMatchEta(0.0),
227 fDaughterMatchPt(0.0),
228 fDaughterMatchImpactParameterXY(0.0),
229 fDaughterMatchImpactParameterZ(0.0),
24373b38 230 fDaughterUnTag(kTRUE),
231 fDaughterMinEta(0.0),
232 fDaughterMaxEta(0.0),
233 fDaughterMinPt(0.0),
234 fDaughterMinNClsTPC(0),
52476a4c 235 fDaughterMinNClsITS(-1),
24373b38 236 fDaughterMinXRows(0),
237 fDaughterMaxChi2PerNClsTPC(0.0),
238 fDaughterMinXRowsOverNClsFTPC(0.0),
239 fDaughterMinImpactParameterXY(0.0),
52476a4c 240 fDaughterMaxNSigmaPID(0.0),
241 fDaughterSPDRequireAny(kFALSE),
242 fDaughterITSrefit(kFALSE) {
24373b38 243 //ctor
52476a4c 244 for(Int_t i=0; i!=100; ++i) fPtBinEdge[i]=0;
512ced40 245 for(Int_t i=0; i!=6; ++i) fDaughterITSConfig[i]=-1;
6c0d2d67 246 for(Int_t i=0; i!=2000; ++i) fQTPCA_fID[i]=-1;
247 for(Int_t i=0; i!=2000; ++i) fQTPCC_fID[i]=-1;
52476a4c 248 for(Int_t i=0; i!=64; ++i) fVZEextW[i]=1;
24373b38 249}
250//=======================================================================
251AliAnalysisTaskFlowStrange::AliAnalysisTaskFlowStrange(const char *name) :
252 AliAnalysisTaskSE(name),
253 fPIDResponse(NULL),
254 fFB1(NULL),
255 fFB1024(NULL),
256 fTPCevent(NULL),
257 fVZEevent(NULL),
258 fCandidates(NULL),
259 fList(NULL),
260 fRunNumber(-1),
261 fDebug(0),
262 fQAlevel(0),
263 fReadESD(kFALSE),
264 fReadMC(kFALSE),
6c0d2d67 265 fAddPiToMCReactionPlane(kTRUE),
512ced40 266 fPostMatched(0),
24373b38 267 fAvoidExec(kFALSE),
268 fSkipSelection(kFALSE),
52476a4c 269 fSkipVn(kFALSE),
24373b38 270 fUseFP(kFALSE),
271 fRunOnpA(kFALSE),
272 fRunOnpp(kFALSE),
273 fExtraEventRejection(kFALSE),
6c0d2d67 274 fSkipCentralitySelection(kFALSE),
24373b38 275 fCentMethod("V0MTRK"),
276 fCentPerMin(0),
277 fCentPerMax(100),
278 fThisCent(-1.0),
6c0d2d67 279 fV0M(0.0),
280 fTRK(0.0),
281 fPriVtxZ(0.0),
282 fSPDVtxZ(0.0),
283 fSPDtracklets(0),
284 fVZETotM(0.0),
285 fRefMultTPC(0),
286 fRefMultHyb(0),
512ced40 287 fVertexZcut(10.0),
24373b38 288 fExcludeTPCEdges(kFALSE),
289 fSpecie(0),
290 fOnline(kFALSE),
291 fHomemade(kFALSE),
292 fWhichPsi(1),
293 fVZEsave(kFALSE),
294 fVZEload(NULL),
295 fVZEResponse(NULL),
296 fVZEmb(kFALSE),
297 fVZEByDisk(kTRUE),
298 fVZECa(0),
299 fVZECb(3),
300 fVZEAa(0),
301 fVZEAb(3),
302 fVZEQA(NULL),
6c0d2d67 303 fHarmonic(2),
24373b38 304 fPsi2(0.0),
305 fMCEP(0.0),
6c0d2d67 306 fQVZEACos(0.0),
307 fQVZEASin(0.0),
308 fQVZECCos(0.0),
309 fQVZECSin(0.0),
310 fQVZEA(0.0),
311 fQVZEC(0.0),
52476a4c 312 fVZEWarning(kFALSE),
6c0d2d67 313 fQTPCACos(0.0),
314 fQTPCASin(0.0),
315 fQTPCCCos(0.0),
316 fQTPCCSin(0.0),
317 fQTPC2hCos(0.0),
318 fQTPC2hSin(0.0),
319 fQTPCA(0.0),
320 fQTPCC(0.0),
321 fQTPCA_nTracks(0),
322 fQTPCC_nTracks(0),
323 fSkipTerminate(kTRUE),
24373b38 324 fMassBins(0),
325 fMinMass(0.0),
326 fMaxMass(0.0),
52476a4c 327 fPtBins(0),
24373b38 328 fRFPFilterBit(1),
329 fRFPminPt(0.2),
330 fRFPmaxPt(5.0),
6c0d2d67 331 fRFPAminEta(0.0),
332 fRFPAmaxEta(+0.8),
333 fRFPCminEta(-0.8),
334 fRFPCmaxEta(0.0),
24373b38 335 fRFPTPCsignal(10.0),
336 fRFPmaxIPxy(2.4),
337 fRFPmaxIPz(3.2),
338 fRFPTPCncls(70),
339 fDecayMass(0.0),
340 fDecayPhi(0.0),
341 fDecayEta(0.0),
342 fDecayPt(0.0),
343 fDecayDCAdaughters(0.0),
344 fDecayCosinePointingAngleXY(0.0),
345 fDecayRadXY(0.0),
346 fDecayDecayLength(0.0),
52476a4c 347 fDecayDecayLengthLab(0.0),
24373b38 348 fDecayQt(0.0),
349 fDecayAlpha(0.0),
350 fDecayRapidity(0.0),
351 fDecayProductIPXY(0.0),
512ced40
RAB
352 fDecayIPneg(0.0),
353 fDecayIPpos(0.0),
354 fDecayXneg(0.0),
355 fDecayXpos(0.0),
24373b38 356 fDecayIDneg(-1),
357 fDecayIDpos(-1),
358 fDecayID(-1),
512ced40
RAB
359 fDecayMatchOrigin(0.0),
360 fDecayMatchPhi(0.0),
361 fDecayMatchEta(0.0),
362 fDecayMatchPt(0.0),
363 fDecayMatchRadXY(0.0),
24373b38 364 fDecayMinEta(0.0),
365 fDecayMaxEta(0.0),
366 fDecayMinPt(0.0),
367 fDecayMaxDCAdaughters(0.0),
368 fDecayMinCosinePointingAngleXY(0.0),
369 fDecayMinQt(0.0),
370 fDecayAPCutPie(kTRUE),
52476a4c 371 fDecayStopPIDAtPt(3.0),
24373b38 372 fDecayMinRadXY(0.0),
373 fDecayMaxDecayLength(0.0),
374 fDecayMaxProductIPXY(0.0),
375 fDecayMaxRapidity(0.0),
376 fDaughterPhi(0.0),
377 fDaughterEta(0.0),
378 fDaughterPt(0.0),
379 fDaughterNClsTPC(0),
52476a4c 380 fDaughterNClsITS(0),
24373b38 381 fDaughterCharge(0),
382 fDaughterNFClsTPC(0),
383 fDaughterNSClsTPC(0),
384 fDaughterChi2PerNClsTPC(0.0),
385 fDaughterXRows(0.0),
386 fDaughterImpactParameterXY(0.0),
387 fDaughterImpactParameterZ(0.0),
388 fDaughterStatus(0),
512ced40 389 fDaughterITScm(0),
24373b38 390 fDaughterNSigmaPID(0.0),
391 fDaughterKinkIndex(0),
6c0d2d67 392 fDaughterAtSecPhi(0.0),
393 fDaughterAtSecEta(0.0),
394 fDaughterAtSecPt(0.0),
512ced40
RAB
395 fDaughterMatchPhi(0.0),
396 fDaughterMatchEta(0.0),
397 fDaughterMatchPt(0.0),
398 fDaughterMatchImpactParameterXY(0.0),
399 fDaughterMatchImpactParameterZ(0.0),
24373b38 400 fDaughterUnTag(kTRUE),
401 fDaughterMinEta(0.0),
402 fDaughterMaxEta(0.0),
403 fDaughterMinPt(0.0),
404 fDaughterMinNClsTPC(0),
52476a4c 405 fDaughterMinNClsITS(-1),
24373b38 406 fDaughterMinXRows(0),
407 fDaughterMaxChi2PerNClsTPC(0.0),
408 fDaughterMinXRowsOverNClsFTPC(0.0),
409 fDaughterMinImpactParameterXY(0.0),
52476a4c 410 fDaughterMaxNSigmaPID(0.0),
411 fDaughterSPDRequireAny(kFALSE),
412 fDaughterITSrefit(kFALSE) {
24373b38 413 //ctor
52476a4c 414 for(Int_t i=0; i!=100; ++i) fPtBinEdge[i]=0;
512ced40 415 for(Int_t i=0; i!=6; ++i) fDaughterITSConfig[i]=-1;
6c0d2d67 416 for(Int_t i=0; i!=2000; ++i) fQTPCA_fID[i]=-1;
417 for(Int_t i=0; i!=2000; ++i) fQTPCC_fID[i]=-1;
52476a4c 418 for(Int_t i=0; i!=64; ++i) fVZEextW[i]=1;
24373b38 419 DefineInput( 0,TChain::Class());
420 DefineOutput(1,TList::Class());
421 DefineOutput(2,AliFlowEventSimple::Class()); // TPC object
422 DefineOutput(3,AliFlowEventSimple::Class()); // VZE object
423}
424//=======================================================================
425AliAnalysisTaskFlowStrange::~AliAnalysisTaskFlowStrange() {
426 //dtor
427 if (fCandidates) delete fCandidates;
428 if (fTPCevent) delete fTPCevent;
429 if (fVZEevent) delete fVZEevent;
430 if (fList) delete fList;
431}
432//=======================================================================
52476a4c 433void AliAnalysisTaskFlowStrange::SetPtEdges(Int_t n, Double_t *p) {
434 fPtBins = n;
435 for(int i=0;i!=n+1;++i) fPtBinEdge[i] = p[i];
436}
437//=======================================================================
6c0d2d67 438TList* AliAnalysisTaskFlowStrange::RunTerminateAgain(TList *lst) {
52476a4c 439 if(!lst) return NULL;
6c0d2d67 440 fList = lst;
441 fSpecie = Int_t( ((TProfile*)((TList*)fList->FindObject("Event"))->FindObject("Configuration"))->GetBinContent(kSpecie) );
442 fSkipSelection = ((TProfile*)((TList*)fList->FindObject("Event"))->FindObject("Configuration"))->GetBinContent(kSkipSelection);
443 fReadMC = ((TProfile*)((TList*)fList->FindObject("Event"))->FindObject("Configuration"))->GetBinContent(kReadMC);
444 Terminate(NULL);
445 return fList;
446}
447//=======================================================================
52476a4c 448void AliAnalysisTaskFlowStrange::PrintConfig() {
449 //DUMP for main task
450 printf("******************************\n");
451 printf("<TASK Configuration> %s\n",GetName());
452 printf(" fDebug %d\n",fDebug);
453 printf(" fQAlevel %d\n",fQAlevel);
454 printf(" fExtraEventRejection %s\n",fExtraEventRejection?"kTRUE":"kFALSE");
455 printf(" fCentMethod %s\n",fCentMethod.Data());
456 printf(" fCentPerMin %d\n",fCentPerMin);
457 printf(" fCentPerMax %d\n",fCentPerMax);
458 printf(" fVextexZcut %f\n",fVertexZcut);
459 printf(" fRunOnpA %s\n",fRunOnpA?"kTRUE":"kFALSE");
460 printf(" fRunOnpp %s\n",fRunOnpp?"kTRUE":"kFALSE");
461 printf(" fReadESD %s\n",fReadESD?"kTRUE":"kFALSE");
462 printf(" fReadMC %s\n",fReadMC?"kTRUE":"kFALSE");
463 if(fReadMC) {
464 printf(" fAddPiToMCReactionPlane %s\n",fAddPiToMCReactionPlane?"kTRUE":"kFALSE");
465 printf(" fPostMatched %d\n",fPostMatched);
466 printf(" fAvoidExec %s\n",fAvoidExec?"kTRUE":"kFALSE");
467 printf(" fSkipCentralitySelection %s\n",fSkipCentralitySelection?"kTRUE":"kFALSE");
468 }
469 printf(" fVZEsave %s\n",fVZEsave?"kTRUE":"kFALSE");
470 if(fVZEload) {
471 printf(" fVZEload %d runs\n",fVZEload->GetEntries());
472 printf(" fVZEmb %s\n",fVZEmb?"kTRUE":"kFALSE");
473 printf(" fVZEByDisk %s\n",fVZEByDisk?"kTRUE":"kFALSE");
474 }
475 printf(" fHarmonic %d\n",fHarmonic);
476 printf(" fWhichPsi %d\n",fWhichPsi);
477 printf(" fVZECa %d\n",fVZECa);
478 printf(" fVZECb %d\n",fVZECb);
479 printf(" fVZEAa %d\n",fVZEAa);
480 printf(" fVZEAb %d\n",fVZEAb);
481 printf(" fRFPFilterBit %d\n",fRFPFilterBit);
482 printf(" fRFPminPt %f\n",fRFPminPt);
483 printf(" fRFPmaxPt %f\n",fRFPmaxPt);
484 printf(" fRFPAminEta %f\n",fRFPAminEta);
485 printf(" fRFPAmaxEta %f\n",fRFPAmaxEta);
486 printf(" fRFPCminEta %f\n",fRFPCminEta);
487 printf(" fRFPCmaxEta %f\n",fRFPCmaxEta);
488 printf(" fRFPmaxIPxy %f\n",fRFPmaxIPxy);
489 printf(" fRFPmaxIPz %f\n",fRFPmaxIPz);
490 printf(" fRFPTPCsignal %f\n",fRFPTPCsignal);
491 printf(" fRFPTPCncls %d\n",fRFPTPCncls);
492 printf(" fExcludeTPCEdges %s\n",fExcludeTPCEdges?"kTRUE":"kFALSE");
493 printf(" fSkipSelection %s\n",fSkipSelection?"kTRUE":"kFALSE");
494 if(!fSkipSelection) {
495 printf(" fSpecie %d\n",fSpecie);
496 printf(" fPtBins %d\n |",fPtBins);
497 for(int i=0; i!=fPtBins+1; ++i) printf("%f|",fPtBinEdge[i]); printf("\n");
498 if(fSpecie<90) {
499 printf(" fMassBins %d\n",fMassBins);
500 printf(" fMinMass %f\n",fMinMass);
501 printf(" fMaxMass %f\n",fMaxMass);
502 }
503 }
504 printf(" fSkipVn %s\n",fSkipVn?"kTRUE":"kFALSE");
505 if(!fSkipVn) {
506 printf(" fUseFP %s\n",fUseFP?"kTRUE":"kFALSE");
507 }
508 MyPrintConfig();
509}
510//=======================================================================
511void AliAnalysisTaskFlowStrange::MyPrintConfig() {
512 // Dump for derived task
513 printf("==================================\n");
514 printf("<FlowStrange> \n");
515 if(!fSkipSelection) {
516 if(fReadESD) {
517 printf(" fOnline %s\n",fOnline?"kTRUE":"kFALSE");
518 printf(" fHomemade %s\n",fHomemade?"kTRUE":"kFALSE");
519 }
520 printf(" fDecayMinEta %f\n",fDecayMinEta);
521 printf(" fDecayMaxEta %f\n",fDecayMaxEta);
522 printf(" fDecayMinPt %f\n",fDecayMinPt);
523 printf(" fDecayMaxDCAdaughters %f\n",fDecayMaxDCAdaughters);
524 printf(" fDecayMinCosinePointingAngleXY %f\n",fDecayMinCosinePointingAngleXY);
525 printf(" fDecayMinQt %f\n",fDecayMinQt);
526 printf(" fDecayAPCutPie %s\n",fDecayAPCutPie?"kTRUE":"kFALSE");
527 printf(" fDecayStopPIDAtPt %f\n",fDecayStopPIDAtPt);
528 printf(" fDecayMinRadXY %f\n",fDecayMinRadXY);
529 printf(" fDecayMaxDecayLength %f\n",fDecayMaxDecayLength);
530 printf(" fDecayMaxProductIPXY %f\n",fDecayMaxProductIPXY);
531 printf(" fDecayMaxRapidity %f\n",fDecayMaxRapidity);
532 }
533 printf(" fDaughterUnTag %s\n",fDaughterUnTag?"kTRUE":"kFALSE");
534 printf(" fDaughterMinEta %f\n",fDaughterMinEta);
535 printf(" fDaughterMaxEta %f\n",fDaughterMaxEta);
536 printf(" fDaughterMinPt %f\n",fDaughterMinPt);
537 printf(" fDaughterMinNClsTPC %d\n",fDaughterMinNClsTPC);
538 printf(" fDaughterMinXRows %d\n",fDaughterMinXRows);
539 printf(" fDaughterMaxChi2PerNClsTPC %f\n",fDaughterMaxChi2PerNClsTPC);
540 printf(" fDaughterMinXRowsOverNClsFTPC %f\n",fDaughterMinXRowsOverNClsFTPC);
541 printf(" fDaughterMinImpactParameterXY %f\n",fDaughterMinImpactParameterXY);
542 printf(" fDaughterMaxNSigmaPID %f\n",fDaughterMaxNSigmaPID);
543}
544//=======================================================================
24373b38 545void AliAnalysisTaskFlowStrange::UserCreateOutputObjects() {
546 //UserCreateOutputObjects
52476a4c 547 if(fDebug) PrintConfig();
24373b38 548 fList=new TList();
549 fList->SetOwner();
550 AddQAEvents();
551 AddQACandidates();
24373b38 552 if(fReadESD) MakeFilterBits();
553
554 AliFlowCommonConstants *cc = AliFlowCommonConstants::GetMaster();
555 cc->SetNbinsMult(3000); cc->SetMultMin(0); cc->SetMultMax(30000);
6c0d2d67 556 cc->SetNbinsPt(100); cc->SetPtMin(0.0); cc->SetPtMax(20.0);
24373b38 557 cc->SetNbinsPhi(100); cc->SetPhiMin(0.0); cc->SetPhiMax(TMath::TwoPi());
558 cc->SetNbinsEta(100); cc->SetEtaMin(-5.0); cc->SetEtaMax(+5.0);
559 cc->SetNbinsQ(100); cc->SetQMin(0.0); cc->SetQMax(3.0);
560 cc->SetNbinsMass(fMassBins);
561 cc->SetMassMin(fMinMass);
562 cc->SetMassMax(fMaxMass);
563
564 //loading pid response
565 AliAnalysisManager *man = AliAnalysisManager::GetAnalysisManager();
566 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
567 fPIDResponse = inputHandler->GetPIDResponse();
568
6c0d2d67 569 if(fUseFP) {
570 fTPCevent = new AliFlowEvent(100);
571 fVZEevent = new AliFlowEvent(100);
572 //array of candidates
573 fCandidates = new TObjArray(100);
574 fCandidates->SetOwner();
575 }
24373b38 576 PostData(1,fList);
577 if(fUseFP) { // for connection to the flow package
578 PostData(2,fTPCevent);
579 PostData(3,fVZEevent);
580 }
581
582 gRandom->SetSeed();
583}
584//=======================================================================
52476a4c 585void AliAnalysisTaskFlowStrange::MyUserCreateOutputObjects() {
586 TList *tList;
587 TH1D *tH1D;
588 TH2D *tH2D;
589
590 //reconstruction
591 if(fReadESD) {
592 tList=new TList(); tList->SetName("ESD_TrkAll"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
593 tList=new TList(); tList->SetName("ESD_TrkSel"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
594 tH2D = new TH2D("NPAIR", "NPAIR;NPOS;NNEG",1000,0,5000,1000,0,5000); tList->Add(tH2D);
595 tH2D = new TH2D("PtIPXY","PtIPXY;Pt;IPxy", 100,0,10,200,-10,+10); tList->Add(tH2D);
596 }
597 //aod prefilter candidates
598 tList=new TList(); tList->SetName("V0SAll"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);
599 tH2D = new TH2D("V0SADC","V0S AFTER DAUGHTER CUTS;V0ALL;V0IMW",100,0,1000,100,0,1000); tList->Add(tH2D);
600 tList=new TList(); tList->SetName("AllDau"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
601 //candidates
602 tList=new TList(); tList->SetName("V0SSel"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);
603 tList=new TList(); tList->SetName("SelDau"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
604 //flow
605 if(!fSkipVn) {
606 tList=new TList(); tList->SetName("V0SAllVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
607 tList=new TList(); tList->SetName("V0SSelVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
608 }
609 // IN-OUT
610 if(fQAlevel>1) {
611 tList=new TList(); tList->SetName("V0SAllIP"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);
612 tList=new TList(); tList->SetName("V0SAllOP"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);
613 tList=new TList(); tList->SetName("V0SSelIP"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);
614 tList=new TList(); tList->SetName("V0SSelOP"); tList->SetOwner(); AddCandidatesSpy(tList); fList->Add(tList);
615 }
616 //match
617 if(fReadMC) {
618 tList=new TList(); tList->SetName("STATMC"); tList->SetOwner(); fList->Add(tList);
619 tH1D = new TH1D("Events", "Events",5,0.5,5.5); tList->Add(tH1D);
620 tH1D->GetXaxis()->SetBinLabel(1,"Selected events");
621 tH1D->GetXaxis()->SetBinLabel(2,"Stack found");
622 tH1D->GetXaxis()->SetBinLabel(3,"Daughters in stack");
623 tH1D->GetXaxis()->SetBinLabel(4,"Correspond to decay");
624 tH1D->GetXaxis()->SetBinLabel(5,"Decay has mother");
625 tList=new TList(); tList->SetName("Mth"); tList->SetOwner(); AddCandidatesSpy(tList,true); fList->Add(tList);
626 tList=new TList(); tList->SetName("MthDau"); tList->SetOwner(); AddTrackSpy(tList,true); fList->Add(tList);
627 tList=new TList(); tList->SetName("MthPosPos"); tList->SetOwner(); AddCandidatesSpy(tList,true); fList->Add(tList);
628 tList=new TList(); tList->SetName("MthNegNeg"); tList->SetOwner(); AddCandidatesSpy(tList,true); fList->Add(tList);
629 tList=new TList(); tList->SetName("MthPosNeg"); tList->SetOwner(); AddCandidatesSpy(tList,true); fList->Add(tList);
630 tList=new TList(); tList->SetName("MthNegDau"); tList->SetOwner(); AddTrackSpy(tList,true); fList->Add(tList);
631 tList=new TList(); tList->SetName("MthPosDau"); tList->SetOwner(); AddTrackSpy(tList,true); fList->Add(tList);
632 tList=new TList(); tList->SetName("MthFeedDown"); tList->SetOwner(); AddCandidatesSpy(tList,true); fList->Add(tList);
633 tList=new TList(); tList->SetName("UnMth"); tList->SetOwner(); AddCandidatesSpy(tList,false); fList->Add(tList);
634 tList=new TList(); tList->SetName("UnMthDau"); tList->SetOwner(); AddTrackSpy(tList,false); fList->Add(tList);
635 if(!fSkipVn) {
636 tList=new TList(); tList->SetName("V0SMthVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
637 tList=new TList(); tList->SetName("V0SMthPosPosVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
638 tList=new TList(); tList->SetName("V0SMthNegNegVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
639 tList=new TList(); tList->SetName("V0SMthPosNegVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
640 tList=new TList(); tList->SetName("V0SUnMthVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
641 }
642 }
643}
644//=======================================================================
24373b38 645void AliAnalysisTaskFlowStrange::AddQAEvents() {
646 // function to add event qa
647 TH1D *tH1D;
648 TProfile *tProfile;
649 TList *tQAEvents=new TList();
650 tQAEvents->SetName("Event");
651 tQAEvents->SetOwner();
652 tH1D = new TH1D("Events","Number of Events",6,0,6); tQAEvents->Add(tH1D);
653 tH1D->GetXaxis()->SetBinLabel(1,"exec");
654 tH1D->GetXaxis()->SetBinLabel(2,"userexec");
655 tH1D->GetXaxis()->SetBinLabel(3,"reached");
656 tH1D->GetXaxis()->SetBinLabel(4,"selected");
657 tH1D->GetXaxis()->SetBinLabel(5,"rejectedByLowQw");
658 tH1D->GetXaxis()->SetBinLabel(6,"rejectedByErrorLoadVZEcal");
6c0d2d67 659 tProfile = new TProfile("Configuration","Configuration",10,0.5,10.5); tQAEvents->Add(tProfile);
660 tProfile->Fill(kSpecie,fSpecie,1);
661 tProfile->GetXaxis()->SetBinLabel(kSpecie,"fSpecie");
662 tProfile->Fill(kHarmonic,fHarmonic,1);
663 tProfile->GetXaxis()->SetBinLabel(kHarmonic,"fHarmonic");
664 tProfile->Fill(kReadMC,fReadMC,1);
665 tProfile->GetXaxis()->SetBinLabel(kReadMC,"fReadMC");
666 tProfile->Fill(kSkipSelection,fSkipSelection,1);
667 tProfile->GetXaxis()->SetBinLabel(kSkipSelection,"fSkipSelection");
24373b38 668 tH1D = new TH1D("POI","POIs;multiplicity",800,0,800); tQAEvents->Add(tH1D);
669 tH1D = new TH1D("UNTAG","UNTAG;Untagged Daughters",800,0,800);tQAEvents->Add(tH1D);
670 tH1D = new TH1D("RealTime","RealTime;LogT sec",2000,-10,+10); tQAEvents->Add(tH1D);
671 fList->Add(tQAEvents);
6c0d2d67 672 AddEventSpy("EventsRaw");
c41a93af 673 AddEventSpy("EventsReached");
674 AddEventSpy("EventsSelected");
52476a4c 675 AddEventSpy("EventsAnalyzed");
24373b38 676 AddMakeQSpy();
52476a4c 677 AddVZEQA();
24373b38 678}
679//=======================================================================
c41a93af 680void AliAnalysisTaskFlowStrange::AddEventSpy(TString name) {
24373b38 681 TH1D *tH1D;
682 TH2D *tH2D;
683 TList *tList=new TList();
c41a93af 684 tList->SetName(name.Data());
24373b38 685 tList->SetOwner();
6c0d2d67 686 tH2D = new TH2D("VTXZ","VTXZ;PriVtxZ;SPDVtxZ",60,-25,+25,60,-25,+25); tList->Add( tH2D );
c41a93af 687 tH2D = new TH2D("CCCC","CCCC;V0M;TRK",60,-10,110,60,-10,110); tList->Add( tH2D );
2adcf041 688 tH2D = new TH2D("HYBTPC","HYBTPC;TPC ONLY;HYBRID",100,0,3000,100,0,3000); tList->Add( tH2D );
689 tH1D = new TH1D("HYBTPCRat","HYBTPCRat;TPC/HYB",120,0.2,2.2); tList->Add( tH1D );
6c0d2d67 690 tH2D = new TH2D("SPDVZE","SPDVZE;SPD Tracklets;Total Multiplicity in VZERO",100,0,3500,100,0,25000); tList->Add( tH2D );
2adcf041 691 tH1D = new TH1D("SPDVZERat","SPDVZERat;TotalMultiplicityVZERO/SPDTracklets",120,2,+12); tList->Add( tH1D );
c41a93af 692 if(fReadMC) {
c41a93af 693 tH1D = new TH1D("MCEP","MCEP;MCEP",100,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
24373b38 694 }
695 fList->Add(tList);
696}
697//=======================================================================
6c0d2d67 698void AliAnalysisTaskFlowStrange::FillEventSpy(TString name) {
699 ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject("VTXZ"))->Fill( fPriVtxZ, fSPDVtxZ );
700 ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject("CCCC"))->Fill( fV0M, fTRK );
2adcf041 701 ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject("HYBTPC"))->Fill( fRefMultTPC, fRefMultHyb );
702 if(fRefMultHyb>0)
703 ((TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject("HYBTPCRat"))->Fill( double(fRefMultTPC)/double(fRefMultHyb) );
6c0d2d67 704 ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject("SPDVZE"))->Fill( fSPDtracklets, fVZETotM );
2adcf041 705 if(fSPDtracklets>0)
706 ((TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject("SPDVZERat"))->Fill( fVZETotM/fSPDtracklets );
6c0d2d67 707 if(fReadMC) {
708 ((TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject("MCEP"))->Fill( fMCEP );
709 }
710}
711//=======================================================================
24373b38 712void AliAnalysisTaskFlowStrange::AddMakeQSpy() {
24373b38 713 TH1D *tH1D;
714 TH2D *tH2D;
715 TProfile *tPF1;
716 TList *tList=new TList();
717 tList->SetName("MakeQSpy");
718 tList->SetOwner();
6c0d2d67 719 fList->Add(tList);
24373b38 720 tH1D = new TH1D("RFPTPC","TPC Refrence Multiplicity;multiplicity",3000,0,3000); tList->Add( tH1D );
721 tH1D = new TH1D("RFPVZE","VZERO Reference Multiplicity;multiplicity",3000,0,30000); tList->Add( tH1D );
2adcf041 722 tH1D = new TH1D("QmTPC","TPC Normalized Q vector;|Q|/#sqrt{M}",360,0,7); tList->Add( tH1D );
52476a4c 723 tH1D = new TH1D("QmVZEA","VZEROA Normalized Q vector;|Q|/#sqrt{W}",360,0,7); tList->Add( tH1D );
724 tH1D = new TH1D("QmVZEC","VZEROC Normalized Q vector;|Q|/#sqrt{W}",360,0,7); tList->Add( tH1D );
24373b38 725 tH2D = new TH2D("TPCAllPhiEta","TPCall;Phi;Eta",180,0,TMath::TwoPi(),80,-0.9,+0.9); tList->Add( tH2D );
726 tH2D = new TH2D("VZEAllPhiEta","VZEall;Phi;Eta",20,0,TMath::TwoPi(),40,-4.0,+6.0); tList->Add( tH2D );
727 tH1D = new TH1D("TPCPSI","TPCPSI;PSI",72,0,TMath::Pi()); tList->Add( tH1D );
728 tH1D = new TH1D("TPCPSIA","TPCPSIA;PSIA",72,0,TMath::Pi()); tList->Add( tH1D );
6c0d2d67 729 tH1D = new TH1D("TPCPSIC","TPCPSIC;PSIC",72,0,TMath::Pi()); tList->Add( tH1D );
24373b38 730 tH1D = new TH1D("VZEPSI","VZEPSI;PSI",72,0,TMath::Pi()); tList->Add( tH1D );
731 tH1D = new TH1D("VZEPSIA","VZEPSIA;PSIA",72,0,TMath::Pi()); tList->Add( tH1D );
6c0d2d67 732 tH1D = new TH1D("VZEPSIC","VZEPSIC;PSIC",72,0,TMath::Pi()); tList->Add( tH1D );
52476a4c 733 tH2D = new TH2D("PSI_TPCAVZEC","PSI_TPCAVZEC",72,0,TMath::Pi(),72,0,TMath::Pi()); tList->Add( tH2D );
734 tH2D = new TH2D("PSI_TPCCVZEA","PSI_TPCAVZEC",72,0,TMath::Pi(),72,0,TMath::Pi()); tList->Add( tH2D );
735 tH2D = new TH2D("PSI_TPCVZE","PSI_TPCVZE",72,0,TMath::Pi(),72,0,TMath::Pi()); tList->Add( tH2D );
6c0d2d67 736 tPF1 = new TProfile("TPCQm","TPCQm",6,0.5,6.5); tList->Add( tPF1 );
737 tPF1->GetXaxis()->SetBinLabel(1,"Qcy"); tPF1->GetXaxis()->SetBinLabel(2,"Qcx");
738 tPF1->GetXaxis()->SetBinLabel(3,"Qay"); tPF1->GetXaxis()->SetBinLabel(4,"Qax");
24373b38 739 tPF1->GetXaxis()->SetBinLabel(5,"Qy"); tPF1->GetXaxis()->SetBinLabel(6,"Qx");
6c0d2d67 740 tPF1 = new TProfile("VZEQm","VZEQm",6,0.5,6.5); tList->Add( tPF1 );
741 tPF1->GetXaxis()->SetBinLabel(1,"Qcy"); tPF1->GetXaxis()->SetBinLabel(2,"Qcx");
742 tPF1->GetXaxis()->SetBinLabel(3,"Qay"); tPF1->GetXaxis()->SetBinLabel(4,"Qax");
24373b38 743 tPF1->GetXaxis()->SetBinLabel(5,"Qy"); tPF1->GetXaxis()->SetBinLabel(6,"Qx");
6c0d2d67 744 tPF1 = new TProfile("QmVZEAQmVZEC","QmVZEAQmVZEC",1,0.5,1.5,"s"); tList->Add( tPF1 );
745 tPF1 = new TProfile("QmVZEASQUARED","QmVZEASQUARED",1,0.5,1.5,"s"); tList->Add( tPF1 );
746 tPF1 = new TProfile("QmVZECSQUARED","QmVZECSQUARED",1,0.5,1.5,"s"); tList->Add( tPF1 );
747 tPF1 = new TProfile("QmTPCQmVZEA","QmTPCQmVZEA",1,0.5,1.5,"s"); tList->Add( tPF1 );
748 tPF1 = new TProfile("QmTPCQmVZEC","QmTPCQmVZEC",1,0.5,1.5,"s"); tList->Add( tPF1 );
749 tH1D = new TH1D("ChiSquaredVZEA","ChiSquaredVZEC",1,0.5,1.5); tList->Add( tH1D );
750 tH1D = new TH1D("ChiSquaredVZEC","ChiSquaredVZEC",1,0.5,1.5); tList->Add( tH1D );
751 if(fReadMC) {
752 tH1D = new TH1D("PSIMCDIFFTPC","PSIMCDIFFTPC;MC-TPC",72,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
753 tH1D = new TH1D("PSIMCDIFFTPCA","PSIMCDIFFTPCA;MC-TPCA",72,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
754 tH1D = new TH1D("PSIMCDIFFTPCC","PSIMCDIFFTPCC;MC-TPCC",72,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
755 tH1D = new TH1D("PSIMCDIFFVZE","PSIMCDIFFVZE;MC-VZE",72,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
756 tH1D = new TH1D("PSIMCDIFFVZEA","PSIMCDIFFVZEA;MC-VZEA",72,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
757 tH1D = new TH1D("PSIMCDIFFVZEC","PSIMCDIFFVZEC;MC-VZEC",72,-TMath::TwoPi(),TMath::TwoPi()); tList->Add( tH1D );
24373b38 758 }
6c0d2d67 759 tList=new TList(); tList->SetName("TPCRFPall"); tList->SetOwner(); AddTPCRFPSpy(tList); fList->Add(tList);
760 tList=new TList(); tList->SetName("TPCRFPsel"); tList->SetOwner(); AddTPCRFPSpy(tList); fList->Add(tList);
24373b38 761}
762//=======================================================================
763void AliAnalysisTaskFlowStrange::AddQACandidates() {
764 // function to add histogramming for candidates
765 if(fSkipSelection) return;
24373b38 766 TList *tList;
767 TH1D *tH1D;
24373b38 768
52476a4c 769 //charge particles (benchmark)
770 if(fSpecie>=90) {
6c0d2d67 771 tList=new TList(); tList->SetName("TrkAll"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
772 tList=new TList(); tList->SetName("TrkSel"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
52476a4c 773 if(!fSkipVn) {
774 tList=new TList(); tList->SetName("TrkAllVn"); tList->SetOwner(); AddTrackVn(tList); fList->Add(tList);
775 tList=new TList(); tList->SetName("TrkSelVn"); tList->SetOwner(); AddTrackVn(tList); fList->Add(tList);
776 }
6c0d2d67 777 //match
778 if(fReadMC) {
779 tList=new TList(); tList->SetName("STATMC"); tList->SetOwner(); fList->Add(tList);
780 tH1D = new TH1D("Events", "Events",3,0.5,3.5); tList->Add(tH1D);
781 tH1D->GetXaxis()->SetBinLabel(1,"Selected events");
782 tH1D->GetXaxis()->SetBinLabel(2,"Stack found");
783 tH1D->GetXaxis()->SetBinLabel(3,"Track in stack");
784 tList=new TList(); tList->SetName("Mth"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
785 tList=new TList(); tList->SetName("MthPos"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
786 tList=new TList(); tList->SetName("MthNeg"); tList->SetOwner(); AddTrackSpy(tList); fList->Add(tList);
52476a4c 787 if(!fSkipVn) {
788 tList=new TList(); tList->SetName("MthVn"); tList->SetOwner(); AddTrackVn(tList); fList->Add(tList);
789 tList=new TList(); tList->SetName("MthPosVn"); tList->SetOwner(); AddTrackVn(tList); fList->Add(tList);
790 tList=new TList(); tList->SetName("MthNegVn"); tList->SetOwner(); AddTrackVn(tList); fList->Add(tList);
791 }
6c0d2d67 792 }
24373b38 793 }
794 //stack
795 if(fReadMC) {
6c0d2d67 796 tList=new TList(); tList->SetName("MCTPionGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
797 tList=new TList(); tList->SetName("MCTKaonGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
24373b38 798 tList=new TList(); tList->SetName("MCTK0sGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
6c0d2d67 799 tList=new TList(); tList->SetName("MCTProtonGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
24373b38 800 tList=new TList(); tList->SetName("MCTLdaGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
801 tList=new TList(); tList->SetName("MCTPhiGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
802 tList=new TList(); tList->SetName("MCTXiGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
6c0d2d67 803 tList=new TList(); tList->SetName("MCTOmegaGenAcc"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
804 tList=new TList(); tList->SetName("MCTPion"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
805 tList=new TList(); tList->SetName("MCTKaon"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
24373b38 806 tList=new TList(); tList->SetName("MCTK0s"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
807 tList=new TList(); tList->SetName("MCTLda"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
6c0d2d67 808 tList=new TList(); tList->SetName("MCTProton"); tList->SetOwner(); AddMCParticleSpy(tList); fList->Add(tList);
24373b38 809 }
52476a4c 810 MyUserCreateOutputObjects();
24373b38 811}
812//=======================================================================
813void AliAnalysisTaskFlowStrange::Exec(Option_t* option) {
814 // bypassing ::exec (needed because of AMPT)
815 ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(0);
816 if(fAvoidExec) {
817 AliAnalysisTaskFlowStrange::UserExec(option);
818 } else {
819 AliAnalysisTaskSE::Exec(option);
820 }
821}
822//=======================================================================
823void AliAnalysisTaskFlowStrange::UserExec(Option_t *option) {
824 // bridge
825 ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(1);
826 AliAnalysisTaskFlowStrange::MyUserExec(option);
827}
828//=======================================================================
829void AliAnalysisTaskFlowStrange::MyNotifyRun() {
24373b38 830 if(fVZEsave) AddVZEROResponse();
831}
832//=======================================================================
833Bool_t AliAnalysisTaskFlowStrange::CalibrateEvent() {
834 if(fVZEsave) SaveVZEROResponse();
24373b38 835 Bool_t okay=kTRUE;
836 if(fVZEload) {
837 LoadVZEROResponse();
838 if(!fVZEResponse) okay = kFALSE;
839 }
840 return okay;
841}
842//=======================================================================
6c0d2d67 843Bool_t AliAnalysisTaskFlowStrange::AcceptAAEvent(AliESDEvent*) {
844 // ESD reading discontinued: TO BE UPDATED
845 /*
24373b38 846 Double_t acceptEvent=kTRUE;
847 Double_t tTPCVtxZ = tESD->GetPrimaryVertexTPC()->GetZ();
848 if(tESD->GetPrimaryVertexTPC()->GetNContributors()<=0) return kFALSE;
849 Double_t tSPDVtxZ = tESD->GetPrimaryVertexSPD()->GetZ();
850 if(tESD->GetPrimaryVertexSPD()->GetNContributors()<=0) return kFALSE;
851 // EventCuts
852 AliCentrality *cent = tESD->GetCentrality();
853 Double_t cc1, cc2;
854 cc1 = cent->GetCentralityPercentile("V0M");
855 cc2 = cent->GetCentralityPercentile("TRK");
856 TString mycent = fCentMethod;
857 if(fCentMethod.Contains("V0MTRK")) {
858 acceptEvent = TMath::Abs(cc1-cc2)>5.0?kFALSE:acceptEvent; // a la Alex
859 mycent = "V0M";
860 }
861 fThisCent = cent->GetCentralityPercentile( mycent );
862 acceptEvent = (fThisCent<fCentPerMin||fThisCent>fCentPerMax)?kFALSE:acceptEvent;
863 acceptEvent = TMath::Abs(tTPCVtxZ-tSPDVtxZ)>0.5?kFALSE:acceptEvent;
512ced40 864 acceptEvent = TMath::Abs(tTPCVtxZ)>fVertexZcut?kFALSE:acceptEvent;
c41a93af 865 ((TH2D*)((TList*)fList->FindObject("EventsReached"))->FindObject("VTXZ"))->Fill( tTPCVtxZ, tSPDVtxZ );
866 ((TH2D*)((TList*)fList->FindObject("EventsReached"))->FindObject("CCCC"))->Fill( cc1, cc2 );
24373b38 867 // EndOfCuts
c41a93af 868 if(acceptEvent) {
869 ((TH2D*)((TList*)fList->FindObject("EventsSelected"))->FindObject("VTXZ"))->Fill( tTPCVtxZ, tSPDVtxZ );
870 ((TH2D*)((TList*)fList->FindObject("EventsSelected"))->FindObject("CCCC"))->Fill( cc1, cc2 );
871 }
24373b38 872 return acceptEvent;
6c0d2d67 873 */
874 return kFALSE;
24373b38 875}
876//=======================================================================
6c0d2d67 877Bool_t AliAnalysisTaskFlowStrange::MinimumRequirementsAA(AliAODEvent *tAOD) {
878 fRunNumber = tAOD->GetRunNumber();
0a918d8d 879 AliCentrality *cent = ((AliVAODHeader*)tAOD->GetHeader())->GetCentralityP();
6c0d2d67 880 fV0M = cent->GetCentralityPercentile("V0M");
881 fTRK = cent->GetCentralityPercentile("TRK");
24373b38 882 TString mycent = fCentMethod;
883 if(fCentMethod.Contains("V0MTRK")) {
24373b38 884 mycent = "V0M";
885 }
886 fThisCent = cent->GetCentralityPercentile( mycent );
6c0d2d67 887 fPriVtxZ = tAOD->GetPrimaryVertex()->GetZ();
888 fSPDVtxZ = tAOD->GetPrimaryVertexSPD()->GetZ();
889 fSPDtracklets = tAOD->GetTracklets()->GetNumberOfTracklets();
890 fVZETotM = tAOD->GetVZEROData()->GetMTotV0A() + tAOD->GetVZEROData()->GetMTotV0C();
891 int hyb_fb = 272; // for 2010h::AOD086
892 if(fRunNumber>=166529&&fRunNumber<=170593) {
893 hyb_fb = 768; // for 2011h::AOD145
894 }
895 fRefMultTPC = RefMult(tAOD,128);
896 fRefMultHyb = RefMult(tAOD,hyb_fb);
24373b38 897 if(fReadMC) {
6c0d2d67 898 fMCEP = -999;
24373b38 899 AliAODMCHeader *mcHeader = dynamic_cast<AliAODMCHeader*>(tAOD->GetList()->FindObject(AliAODMCHeader::StdBranchName()));
6c0d2d67 900 if(mcHeader) {
901 fMCEP = mcHeader->GetReactionPlaneAngle();
902 if(fAddPiToMCReactionPlane) fMCEP += (gRandom->Rndm()>0.5)*TMath::Pi();
24373b38 903 }
24373b38 904 }
6c0d2d67 905 // centrality selection health
906 // cut in Vtx 10 & NContributors
907 if(!fSkipCentralitySelection) if(fThisCent<0||fThisCent>100) return kFALSE;
908 // vtx z position compatibility within 5 mm
909 if(TMath::Abs(fPriVtxZ-fSPDVtxZ)>0.5) return kFALSE;
2adcf041 910 if(fExtraEventRejection) {
911 // specific cuts for 2010h (AOD086)
912 if(fRunNumber>=136851&&fRunNumber<=139517) {
271404e1 913 if(fRefMultTPC>1.118*fRefMultHyb+100) return kFALSE;
914 if(fRefMultTPC<1.118*fRefMultHyb-100) return kFALSE;
2adcf041 915 }
916 // specific cuts for 2011h (AOD145)
917 if(fRunNumber>=166529&&fRunNumber<=170593) {
271404e1 918 if(fRefMultTPC>1.205*fRefMultHyb+100) return kFALSE;
919 if(fRefMultTPC<1.205*fRefMultHyb-100) return kFALSE;
2adcf041 920 }
c41a93af 921 }
6c0d2d67 922 return kTRUE;
923}
924//=======================================================================
925Bool_t AliAnalysisTaskFlowStrange::AcceptAAEvent(AliAODEvent *tAOD) {
926 Bool_t minimum = MinimumRequirementsAA(tAOD);
927 FillEventSpy("EventsRaw");
928 if(!minimum) return kFALSE;
929
930 Double_t acceptEvent=kTRUE;
931 TString mycent = fCentMethod;
932 if(fCentMethod.Contains("V0MTRK")) {
933 acceptEvent = TMath::Abs(fV0M-fTRK)>5.0?kFALSE:acceptEvent;
934 mycent = "V0M";
24373b38 935 }
6c0d2d67 936 if(!fSkipCentralitySelection) acceptEvent = (fThisCent<fCentPerMin||fThisCent>fCentPerMax)?kFALSE:acceptEvent;
937 acceptEvent = TMath::Abs(fPriVtxZ)>fVertexZcut?kFALSE:acceptEvent;
938 // HISTOGRAMMING
939 FillEventSpy("EventsReached");
940 if(acceptEvent) FillEventSpy("EventsSelected");
24373b38 941 return acceptEvent;
942}
943//=======================================================================
6c0d2d67 944Bool_t AliAnalysisTaskFlowStrange::AcceptPPEvent(AliAODEvent*) {
945 // PP reading discontinued: TO BE UPDATED
946 /*
24373b38 947 Double_t acceptEvent=kTRUE;
948 Double_t tVtxZ = tAOD->GetPrimaryVertex()->GetZ();
949 if(tAOD->GetPrimaryVertex()->GetNContributors()<=0) return kFALSE;
950 Double_t tSPDVtxZ = tAOD->GetPrimaryVertexSPD()->GetZ();
951 if(tAOD->GetPrimaryVertexSPD()->GetNContributors()<=0) return kFALSE;
952 // EventCuts
953 AliCentrality *cent = tAOD->GetHeader()->GetCentralityP();
954 Double_t cc1, cc2;
955 cc1 = cent->GetCentralityPercentile("V0M");
956 cc2 = cent->GetCentralityPercentile("TRK");
957 fThisCent = GetReferenceMultiplicity();
958 //for pp i use fCentPerXXX to select on multiplicity
959 acceptEvent = (fThisCent<fCentPerMin||fThisCent>fCentPerMax)?kFALSE:acceptEvent;
960 acceptEvent = TMath::Abs(tVtxZ-tSPDVtxZ)>0.5?kFALSE:acceptEvent;
512ced40 961 acceptEvent = TMath::Abs(tVtxZ)>fVertexZcut?kFALSE:acceptEvent;
c41a93af 962 ((TH2D*)((TList*)fList->FindObject("EventsReached"))->FindObject("VTXZ"))->Fill( tVtxZ, tSPDVtxZ );
963 ((TH2D*)((TList*)fList->FindObject("EventsReached"))->FindObject("CCCC"))->Fill( cc1, cc2 );
24373b38 964 // EndOfCuts
c41a93af 965 if(acceptEvent) {
966 ((TH2D*)((TList*)fList->FindObject("EventsSelected"))->FindObject("VTXZ"))->Fill( tVtxZ, tSPDVtxZ );
967 ((TH2D*)((TList*)fList->FindObject("EventsSelected"))->FindObject("CCCC"))->Fill( cc1, cc2 );
968 }
24373b38 969 return acceptEvent;
6c0d2d67 970 */
971 return kFALSE;
24373b38 972}
973//=======================================================================
974Int_t AliAnalysisTaskFlowStrange::GetReferenceMultiplicity() { //toberefined
975 AliAODEvent *tAOD = (AliAODEvent *) InputEvent();
976 if(!tAOD) return -1;
977 AliAODTrack *track;
978 Int_t rawN = tAOD->GetNumberOfTracks();
979 Int_t ref=0;
980 for(Int_t id=0; id!=rawN; ++id) {
f15c1f69 981 track = dynamic_cast<AliAODTrack*>(tAOD->GetTrack(id));
982 if(!track) AliFatal("Not a standard AOD");
24373b38 983 if(!track->TestFilterBit(fRFPFilterBit)) continue;
984 ++ref;
985 }
986 return ref;
987}
988//=======================================================================
6c0d2d67 989Bool_t AliAnalysisTaskFlowStrange::AcceptPAEvent(AliAODEvent*) {
990 // PA reading discontinued: TO BE UPDATED
991 /*
24373b38 992 //if(aod->GetHeader()->GetEventNumberESDFile() == 0) return; //rejecting first chunk NOT NEEDED ANYMORE
0a918d8d 993 Int_t bc2 = ((AliVAODHeader*)tAOD->GetHeader())->GetIRInt2ClosestInteractionMap();
24373b38 994 if(bc2!=0) return kFALSE;
0a918d8d 995 Int_t bc1 = ((AliVAODHeader*)tAOD->GetHeader())->GetIRInt1ClosestInteractionMap();
24373b38 996 if(bc1!=0) return kFALSE;
997 Short_t isPileup = tAOD->IsPileupFromSPD(5);
998 if(isPileup!=0) return kFALSE;
999 if(tAOD->GetHeader()->GetRefMultiplicityComb08()<0) return kFALSE;
1000
1001 const AliAODVertex* spdVtx = tAOD->GetPrimaryVertexSPD();
1002 if(!spdVtx) return kFALSE;
1003 if(spdVtx->GetNContributors()<=0) return kFALSE;
1004
1005 const AliAODVertex* tpcVtx=NULL;
1006 Int_t nVertices = tAOD->GetNumberOfVertices();
1007 for(Int_t iVertices = 0; iVertices < nVertices; iVertices++){
1008 const AliAODVertex* vertex = tAOD->GetVertex(iVertices);
1009 if (vertex->GetType() != AliAODVertex::kMainTPC) continue;
1010 tpcVtx = vertex;
1011 }
1012 if(!tpcVtx) return kFALSE;
1013 if(tpcVtx->GetNContributors()<=0) return kFALSE;
1014 Double_t tTPCVtxZ = tpcVtx->GetZ();
1015 Double_t tSPDVtxZ = spdVtx->GetZ();
1016 if (TMath::Abs(tSPDVtxZ - tTPCVtxZ)>2.0) return kFALSE;
1017 if(plpMV(tAOD)) return kFALSE;
1018
1019 Double_t acceptEvent=kTRUE;
1020 // EventCuts
1021 AliCentrality *cent = tAOD->GetHeader()->GetCentralityP();
1022 Double_t cc1, cc2;
1023 cc1 = cent->GetCentralityPercentile("V0M");
1024 cc2 = cent->GetCentralityPercentile("TRK");
1025 if(fCentMethod.Contains("V0MTRK")) fCentMethod = "V0M";
1026 fThisCent = cent->GetCentralityPercentile( fCentMethod );
1027 acceptEvent = (fThisCent<fCentPerMin||fThisCent>fCentPerMax)?kFALSE:acceptEvent;
512ced40 1028 acceptEvent = TMath::Abs(tTPCVtxZ)>fVertexZcut?kFALSE:acceptEvent;
24373b38 1029 // EndOfCuts
c41a93af 1030 ((TH2D*)((TList*)fList->FindObject("EventsReached"))->FindObject("VTXZ"))->Fill( tTPCVtxZ, tSPDVtxZ );
1031 ((TH2D*)((TList*)fList->FindObject("EventsReached"))->FindObject("CCCC"))->Fill( cc1, cc2 );
1032 if(acceptEvent) {
1033 ((TH2D*)((TList*)fList->FindObject("EventsSelected"))->FindObject("VTXZ"))->Fill( tTPCVtxZ, tSPDVtxZ );
1034 ((TH2D*)((TList*)fList->FindObject("EventsSelected"))->FindObject("CCCC"))->Fill( cc1, cc2 );
1035 }
24373b38 1036 return acceptEvent;
6c0d2d67 1037 */
1038 return kFALSE;
24373b38 1039}
1040//=======================================================================
1041void AliAnalysisTaskFlowStrange::MyUserExec(Option_t *) {
1042 // MAIN ROUTINE
1043 TStopwatch tTime;
1044 tTime.Start();
6c0d2d67 1045 if(fDebug) {
1046 printf("****************\n");
1047 printf("****************\n");
1048 printf("**::MyUserExec()\n");
1049 }
1050 if(fUseFP) fCandidates->SetLast(-1);
24373b38 1051 AliESDEvent *tESD=dynamic_cast<AliESDEvent*>(InputEvent());
1052 AliAODEvent *tAOD=dynamic_cast<AliAODEvent*>(InputEvent());
6c0d2d67 1053 Int_t prevRun = fRunNumber;
24373b38 1054 //=>check event
1055 Bool_t acceptEvent=kFALSE;
1056 if(fReadESD) {
1057 if(!tESD) {ResetContainers(); Publish(); return;}
1058 acceptEvent = fRunOnpp?kFALSE:fRunOnpA?kFALSE:AcceptAAEvent(tESD);
24373b38 1059 } else {
1060 if(!tAOD) {ResetContainers(); Publish(); return;}
1061 acceptEvent = fRunOnpp?AcceptPPEvent(tAOD):fRunOnpA?AcceptPAEvent(tAOD):AcceptAAEvent(tAOD);
24373b38 1062 }
6c0d2d67 1063 if(prevRun!=fRunNumber) {
24373b38 1064 MyNotifyRun();
1065 }
1066 ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(2);
1067 //=>does the event clear?
1068 if(!acceptEvent) {ResetContainers(); Publish(); return;}
1069 // healthy event incomming
1070 if( !CalibrateEvent() ) { // saves/retrieves/qas VZEROCAL
1071 ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(5);
1072 ResetContainers(); Publish(); return; // issue retrieving callibration
1073 }
6c0d2d67 1074 // loads Q vectors
1075 MakeQVectors();
1076 if(fPsi2<-0.1) {
1077 ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(4);
1078 ResetContainers(); Publish(); return;
24373b38 1079 }
6c0d2d67 1080 //}
24373b38 1081 ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("Events"))->Fill(3);
6c0d2d67 1082 //=>great, lets do our stuff!
52476a4c 1083 FillEventSpy("EventsAnalyzed");
1084 FillVZEQA();
24373b38 1085 //=>load candidates
1086 if(!fSkipSelection) {
1087 if(fReadESD) {
1088 ReadFromESD(tESD);
1089 } else {
1090 if(fSpecie<10) ReadFromAODv0(tAOD);
1091 else ChargeParticles(tAOD);
1092 }
6c0d2d67 1093 if(fUseFP) AddCandidates();
24373b38 1094 //=>flow
1095 //=>done
1096 }
1097 tTime.Stop();
1098 ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("RealTime"))->Fill( TMath::Log( tTime.RealTime() ) );
1099 Publish();
1100}
1101//=======================================================================
1102void AliAnalysisTaskFlowStrange::Publish() {
1103 PostData(1,fList);
1104 if(fUseFP) {
1105 PostData(2,fTPCevent);
1106 PostData(3,fVZEevent);
1107 }
1108}
1109//=======================================================================
1110void AliAnalysisTaskFlowStrange::ReadFromESD(AliESDEvent *tESD) {
1111 AliStack *stack=NULL;
1112 if(fReadMC) {
1113 AliMCEvent *mcevent=NULL;
1114 mcevent = MCEvent();
1115 if(mcevent) stack = mcevent->Stack();
1116 }
1117
1118 Int_t num = tESD->GetNumberOfTracks();
1119 AliESDtrack *myTrack;
1120 Int_t plist[3000], nlist[3000], np=0, nn=0;
1121 Double_t pd0[3000], nd0[3000];
1122 for (Int_t i=0; i!=num; ++i) {
1123 myTrack = (AliESDtrack*) tESD->GetTrack(i);
1124 if(!myTrack) continue;
1125 LoadTrack(myTrack);
6c0d2d67 1126 FillTrackSpy("ESD_TrkAll");
24373b38 1127 if(!AcceptDaughter()) continue;
6c0d2d67 1128 FillTrackSpy("ESD_TrkSel");
1129 ((TH2D*)((TList*)fList->FindObject("ESD_TrkSel"))->FindObject("PtIPXY" ))->Fill( myTrack->Pt(), fDaughterImpactParameterXY );
24373b38 1130 if( myTrack->Charge()>0 ) {
1131 pd0[np] = fDaughterImpactParameterXY;
1132 plist[np++] = i;
1133 } else {
1134 nd0[nn] = fDaughterImpactParameterXY;
1135 nlist[nn++] = i;
1136 }
1137 }
6c0d2d67 1138 ((TH1D*)((TList*)fList->FindObject("ESD_TrkSel"))->FindObject("NPAIR" ))->Fill( np,nn );
24373b38 1139 const AliESDVertex *vtx = tESD->GetPrimaryVertex();
1140 AliESDtrack *pT, *nT;
1141 for(int p=0; p!=np; ++p) {
1142 pT = (AliESDtrack*) tESD->GetTrack( plist[p] );
1143 for(int n=0; n!=nn; ++n) {
1144 nT = (AliESDtrack*) tESD->GetTrack( nlist[n] );
1145 fDecayProductIPXY = pd0[p]*nd0[n];
1146 AliExternalTrackParam pETP(*pT), nETP(*nT);
1147 Double_t xa, xb;
1148 pETP.GetDCA(&nETP,tESD->GetMagneticField(),xa,xb);
1149 fDecayDCAdaughters = pETP.PropagateToDCA(&nETP,tESD->GetMagneticField());
1150 AliESDv0 vertex( nETP,nlist[n], pETP,plist[p] );
1151 fDecayCosinePointingAngleXY = CosThetaPointXY( &vertex, vtx );
1152 fDecayRadXY = DecayLengthXY( &vertex, vtx );
1153 fDecayPt = vertex.Pt();
1154 fDecayPhi = vertex.Phi();
1155 fDecayEta = vertex.Eta();
1156 Double_t pmx, pmy, pmz, nmx, nmy, nmz;
1157 vertex.GetNPxPyPz(nmx,nmy,nmz);
1158 vertex.GetPPxPyPz(pmx,pmy,pmz);
1159 TVector3 mom1(pmx,pmy,pmz), mom2(nmx,nmy,nmz), mom(vertex.Px(),vertex.Py(),vertex.Pz());
1160 Double_t qlpos = mom1.Dot(mom)/mom.Mag();
1161 Double_t qlneg = mom2.Dot(mom)/mom.Mag();
1162 fDecayQt = mom1.Perp(mom);
1163 fDecayAlpha = (qlpos-qlneg)/(qlpos+qlneg);
1164 Double_t mpi = 0.13957018;
1165 if(fSpecie==0) {
1166 Double_t eppi = TMath::Sqrt( mpi*mpi + pmx*pmx + pmy*pmy + pmz*pmz );
1167 Double_t enpi = TMath::Sqrt( mpi*mpi + nmx*nmx + nmy*nmy + nmz*nmz );
1168 fDecayMass = TMath::Sqrt( mpi*mpi + mpi*mpi + 2*(eppi*enpi - pmx*nmx - pmy*nmy - pmz*nmz ) );
1169 fDecayRapidity = vertex.RapK0Short();
1170 } else {
1171 Double_t mpr = 0.938272013;
1172 Double_t epi, epr;
1173 if(fDecayAlpha>0) {
1174 epr = TMath::Sqrt( mpr*mpr + pmx*pmx + pmy*pmy + pmz*pmz );
1175 epi = TMath::Sqrt( mpi*mpi + nmx*nmx + nmy*nmy + nmz*nmz );
1176 } else {
1177 epi = TMath::Sqrt( mpi*mpi + pmx*pmx + pmy*pmy + pmz*pmz );
1178 epr = TMath::Sqrt( mpr*mpr + nmx*nmx + nmy*nmy + nmz*nmz );
1179 }
1180 fDecayMass = TMath::Sqrt( mpi*mpi + mpr*mpr + 2*(epi*epr - pmx*nmx - pmy*nmy - pmz*nmz ) );
1181 fDecayRapidity = vertex.RapLambda();
1182 }
1183 Double_t energy = TMath::Sqrt( fDecayMass*fDecayMass + vertex.Px()*vertex.Px() + vertex.Py()*vertex.Py() + vertex.Pz()*vertex.Pz() );
1184 Double_t gamma = energy/fDecayMass;
1185 fDecayDecayLength = DecayLength( &vertex, vtx )/gamma;
52476a4c 1186 fDecayDecayLengthLab = DecayLength( &vertex, vtx );
24373b38 1187 Double_t dPHI = fDecayPhi;
1188 Double_t dDPHI = dPHI - fPsi2;
1189 if( dDPHI < 0 ) dDPHI += TMath::TwoPi();
1190 if( dDPHI > TMath::Pi() ) dDPHI = TMath::TwoPi()-dDPHI;
1191 if(fQAlevel>1) {
6c0d2d67 1192 if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) ) FillCandidateSpy("V0SAllOP");
1193 else FillCandidateSpy("V0SAllIP");
24373b38 1194 }
6c0d2d67 1195 FillCandidateSpy("V0SAll");
1196 ((TH2D*)((TList*)fList->FindObject("V0SAll"))->FindObject("D0PD0N"))->Fill( pd0[p],nd0[n] );
1197 ((TH2D*)((TList*)fList->FindObject("V0SAll"))->FindObject("XPOSXNEG"))->Fill( xa, xb );
24373b38 1198 if(!AcceptCandidate()) continue;
1199 if(fDecayMass<fMinMass) continue;
1200 if(fDecayMass>fMaxMass) continue;
1201 // PID missing
1202 if(fQAlevel>1) {
6c0d2d67 1203 if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) ) FillCandidateSpy("V0SSelOP");
1204 else FillCandidateSpy("V0SSelIP");
24373b38 1205 }
6c0d2d67 1206 FillCandidateSpy("V0SSel");
1207 ((TH2D*)((TList*)fList->FindObject("V0SSel"))->FindObject("D0PD0N"))->Fill( pd0[p],nd0[n] );
1208 ((TH2D*)((TList*)fList->FindObject("V0SSel"))->FindObject("XPOSXNEG"))->Fill( xa, xb );
24373b38 1209
1210 fDecayIDneg = nT->GetID();
1211 fDecayIDpos = pT->GetID();
6c0d2d67 1212 if(fUseFP) MakeTrack();
52476a4c 1213 LoadTrack(pT); FillTrackSpy("SelDau");
1214 LoadTrack(nT); FillTrackSpy("SelDau");
24373b38 1215
1216 //===== BEGIN OF MCMATCH
1217 if(stack) {
1218 bool matched = false;
1219 Int_t labelpos = pT->GetLabel();
1220 Int_t labelneg = nT->GetLabel();
1221 Double_t rOri=-1;
1222 if( labelpos>0 && labelneg>0 ) {
1223 TParticle *mcpos = stack->Particle( labelpos );
1224 TParticle *mcneg = stack->Particle( labelneg );
1225 Int_t pdgRecPos = mcpos->GetPdgCode();
1226 Int_t pdgRecNeg = mcneg->GetPdgCode();
1227 if( pdgRecPos==211&&pdgRecNeg==-211 ) if(mcpos->GetMother(0)>0) {
1228 if( mcpos->GetMother(0)==mcneg->GetMother(0) ) {
1229 TParticle *mcmot = stack->Particle( mcpos->GetMother(0) );
1230 rOri = TMath::Sqrt( mcmot->Vx()*mcmot->Vx() + mcmot->Vy()*mcmot->Vy() );
1231 if( TMath::Abs(mcmot->GetPdgCode())==310) {
1232 if(mcmot->GetNDaughters()==2) matched=true;
1233 }
1234 }
1235 }
1236 }
1237 if(matched) {
6c0d2d67 1238 FillCandidateSpy("Mth");
1239 ((TH2D*)((TList*)fList->FindObject("Mth"))->FindObject("D0PD0N"))->Fill( pd0[p],nd0[n] );
1240 ((TH2D*)((TList*)fList->FindObject("Mth"))->FindObject("XPOSXNEG"))->Fill( xa, xb );
1241 ((TH1D*)((TList*)fList->FindObject("Mth"))->FindObject("MCOrigin"))->Fill( rOri );
1242 LoadTrack(pT); FillTrackSpy("MthDau");
1243 LoadTrack(nT); FillTrackSpy("MthDau");
24373b38 1244 }
1245 }
1246 //===== END OF MCMATCH
1247 }
1248 }
1249}
1250//=======================================================================
1251void AliAnalysisTaskFlowStrange::ReadStack(TClonesArray* mcArray) {
1252 if(!mcArray) return;
6c0d2d67 1253 AliAODMCParticle *myMCTrack;//, *iMCDau, *jMCDau;
24373b38 1254 for(int i=0; i!=mcArray->GetEntriesFast(); ++i) {
1255 myMCTrack = dynamic_cast<AliAODMCParticle*>(mcArray->At( i ));
1256 if(!myMCTrack) continue;
6c0d2d67 1257 /*
24373b38 1258 int tPDG=310;
1259 if(fSpecie>0) tPDG = 3122;
1260 if( TMath::Abs(myMCTrack->PdgCode())==tPDG )
1261 if( myMCTrack->GetNDaughters() == 2 ) {
1262 Int_t iDau = myMCTrack->GetDaughter(0);
1263 Int_t jDau = myMCTrack->GetDaughter(1);
1264 AliAODMCParticle *posDau=NULL;
1265 AliAODMCParticle *negDau=NULL;
1266 if(iDau>0&&jDau>0) {
1267 iMCDau = dynamic_cast<AliAODMCParticle*>(mcArray->At( iDau ));
1268 jMCDau = dynamic_cast<AliAODMCParticle*>(mcArray->At( jDau ));
1269 if(iMCDau) {
1270 if(iMCDau->Charge()>0) posDau=iMCDau;
1271 else negDau=iMCDau;
1272 }
1273 if(jMCDau) {
1274 if(jMCDau->Charge()>0) posDau=jMCDau;
1275 else negDau=jMCDau;
1276 }
1277 } //got two daughters
1278 if(posDau&&negDau) {
1279 Double_t dx = myMCTrack->Xv() - posDau->Xv();
1280 Double_t dy = myMCTrack->Yv() - posDau->Yv();
1281 Double_t dz = myMCTrack->Zv() - posDau->Zv();
1282 fDecayRadXY = TMath::Sqrt( dx*dx + dy*dy );
1283 TVector3 momPos(posDau->Px(),posDau->Py(),posDau->Pz());
1284 TVector3 momNeg(negDau->Px(),negDau->Py(),negDau->Pz());
1285 TVector3 momTot(myMCTrack->Px(),myMCTrack->Py(),myMCTrack->Pz());
1286 Double_t qlpos = momPos.Dot(momTot)/momTot.Mag();
1287 Double_t qlneg = momNeg.Dot(momTot)/momTot.Mag();
1288 fDecayQt = momPos.Perp(momTot);
1289 fDecayAlpha = 1.-2./(1.+qlpos/qlneg);
1290 fDecayMass = myMCTrack->GetCalcMass();
1291 Double_t energy = myMCTrack->E();
1292 Double_t gamma = energy/fDecayMass;
1293 fDecayDecayLength = TMath::Sqrt(dx*dx+dy*dy+dz*dz)/gamma;
1294 fDecayPt = myMCTrack->Pt();
1295 fDecayPhi = myMCTrack->Phi();
1296 fDecayEta = myMCTrack->Eta();
1297 fDecayRapidity = myMCTrack->Y();
1298 fDecayDCAdaughters = 0;
1299 fDecayCosinePointingAngleXY = 1;
1300 fDecayProductIPXY = -1;
1301 if(AcceptCandidate()) FillCandidateSpy("GenTru");
1302 }
1303 } // k0/lda with two daughters
6c0d2d67 1304 */
24373b38 1305 //==== BEGIN TRACK CUTS
1306 if(myMCTrack->Eta()<-0.8) continue;
1307 if(myMCTrack->Eta()>+0.8) continue;
52476a4c 1308 if(myMCTrack->Y()<-0.5) continue;
1309 if(myMCTrack->Y()>+0.5) continue;
24373b38 1310 //==== END TRACK CUTS
1311 switch( TMath::Abs(myMCTrack->PdgCode()) ) {
6c0d2d67 1312 case (211): //pi
1313 FillMCParticleSpy( "MCTPion", myMCTrack );
1314 if( myMCTrack->IsPrimary() )
1315 FillMCParticleSpy( "MCTPionGenAcc", myMCTrack );
1316 break;
1317 case (321): //kaon
1318 FillMCParticleSpy( "MCTKaon", myMCTrack );
1319 if( myMCTrack->IsPrimary() )
1320 FillMCParticleSpy( "MCTKaonGenAcc", myMCTrack );
1321 break;
24373b38 1322 case (310): //k0s
1323 FillMCParticleSpy( "MCTK0s", myMCTrack );
1324 if( myMCTrack->IsPrimary() )
1325 FillMCParticleSpy( "MCTK0sGenAcc", myMCTrack );
1326 break;
6c0d2d67 1327 case (2212): //proton
1328 FillMCParticleSpy( "MCTProton", myMCTrack );
1329 if( myMCTrack->IsPrimary() )
1330 FillMCParticleSpy( "MCTProtonGenAcc", myMCTrack );
1331 break;
24373b38 1332 case (3122): //lda
1333 FillMCParticleSpy( "MCTLda", myMCTrack );
1334 if( myMCTrack->IsPrimary() )
1335 FillMCParticleSpy( "MCTLdaGenAcc", myMCTrack );
1336 break;
1337 case (333): //phi
1338 if( myMCTrack->IsPrimary() )
1339 FillMCParticleSpy( "MCTPhiGenAcc", myMCTrack );
1340 break;
1341 case (3312): //xi
1342 if( myMCTrack->IsPrimary() )
1343 FillMCParticleSpy( "MCTXiGenAcc", myMCTrack );
1344 break;
6c0d2d67 1345 case (3334): //omega
1346 if( myMCTrack->IsPrimary() )
1347 FillMCParticleSpy( "MCTOmegaGenAcc", myMCTrack );
1348 break;
24373b38 1349 }
24373b38 1350 }
1351}
1352//=======================================================================
1353Double_t AliAnalysisTaskFlowStrange::CosThetaPointXY(AliESDv0 *me, const AliVVertex *vtx) {
1354 TVector3 mom( me->Px(), me->Py(), 0 );
1355 TVector3 fli( me->Xv()-vtx->GetX(), me->Yv()-vtx->GetY(), 0 );
1356 Double_t ctp = mom.Dot(fli) / mom.Mag() / fli.Mag();
1357 return ctp;
1358}
1359//=======================================================================
1360Double_t AliAnalysisTaskFlowStrange::CosThetaPointXY(AliAODv0 *me, const AliVVertex *vtx) {
1361 TVector3 mom( me->Px(), me->Py(), 0 );
1362 TVector3 fli( me->Xv()-vtx->GetX(), me->Yv()-vtx->GetY(), 0 );
1363 Double_t ctp = mom.Dot(fli) / mom.Mag() / fli.Mag();
1364 return ctp;
1365}
1366//=======================================================================
1367Double_t AliAnalysisTaskFlowStrange::DecayLengthXY(AliESDv0 *me, const AliVVertex *vtx) {
1368 Double_t dx = me->Xv()-vtx->GetX();
1369 Double_t dy = me->Yv()-vtx->GetY();
1370 Double_t dxy = TMath::Sqrt( dx*dx + dy*dy );
1371 return dxy;
1372}
1373//=======================================================================
1374Double_t AliAnalysisTaskFlowStrange::DecayLengthXY(AliAODv0 *me, const AliVVertex *vtx) {
1375 Double_t dx = me->Xv()-vtx->GetX();
1376 Double_t dy = me->Yv()-vtx->GetY();
1377 Double_t dxy = TMath::Sqrt( dx*dx + dy*dy );
1378 return dxy;
1379}
1380//=======================================================================
1381Double_t AliAnalysisTaskFlowStrange::DecayLength(AliESDv0 *me, const AliVVertex *vtx) {
1382 Double_t dx = me->Xv()-vtx->GetX();
1383 Double_t dy = me->Yv()-vtx->GetY();
1384 Double_t dz = me->Zv()-vtx->GetZ();
1385 Double_t dxy = TMath::Sqrt( dx*dx + dy*dy + dz*dz );
1386 return dxy;
1387}
1388//=======================================================================
1389Double_t AliAnalysisTaskFlowStrange::DecayLength(AliAODv0 *me, const AliVVertex *vtx) {
1390 Double_t dx = me->Xv()-vtx->GetX();
1391 Double_t dy = me->Yv()-vtx->GetY();
1392 Double_t dz = me->Zv()-vtx->GetZ();
1393 Double_t dxy = TMath::Sqrt( dx*dx + dy*dy + dz*dz );
1394 return dxy;
1395}
1396//=======================================================================
1397void AliAnalysisTaskFlowStrange::ReadFromAODv0(AliAODEvent *tAOD) {
1398 TClonesArray* mcArray=NULL;
1399 if(fReadMC) {
1400 mcArray = dynamic_cast<TClonesArray*>(tAOD->FindListObject(AliAODMCParticle::StdBranchName()));
1401 ReadStack(mcArray);
1402 }
1403
1404 Int_t nV0s = tAOD->GetNumberOfV0s();
1405 AliAODv0 *myV0;
1406 Int_t v0all=0, v0imw=0;
1407 for (Int_t i=0; i!=nV0s; ++i) {
1408 myV0 = (AliAODv0*) tAOD->GetV0(i);
1409 if(!myV0) continue;
1410 if(!fOnline) if(myV0->GetOnFlyStatus() ) continue;
1411 if(fOnline) if(!myV0->GetOnFlyStatus() ) continue;
52476a4c 1412
1413 fDecayPt = myV0->Pt();
1414 fDecayPhi = myV0->Phi();
1415 fDecayEta = myV0->Eta();
1416
24373b38 1417 AliAODTrack *iT, *jT;
1418 AliAODVertex *vtx = tAOD->GetPrimaryVertex();
1419 Double_t pos[3],cov[6];
1420 vtx->GetXYZ(pos);
1421 vtx->GetCovarianceMatrix(cov);
1422 const AliESDVertex vESD(pos,cov,100.,100);
1423 // TESTING CHARGE
1424 int iPos, iNeg;
1425 iT=(AliAODTrack*) myV0->GetDaughter(0);
1426 if(iT->Charge()>0) {
1427 iPos = 0; iNeg = 1;
1428 } else {
1429 iPos = 1; iNeg = 0;
1430 }
1431 // END OF TEST
1432
1433 iT=(AliAODTrack*) myV0->GetDaughter(iPos); // positive
1434 AliESDtrack ieT( iT );
1435 ieT.SetTPCClusterMap( iT->GetTPCClusterMap() );
1436 ieT.SetTPCSharedMap( iT->GetTPCSharedMap() );
1437 ieT.SetTPCPointsF( iT->GetTPCNclsF() );
1438 ieT.PropagateToDCA(&vESD, tAOD->GetMagneticField(), 100);
1439 LoadTrack(&ieT,iT->Chi2perNDF());
1440 Float_t ip[2];
1441 ieT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
1442 fDaughterImpactParameterXY = ip[0];
1443 fDaughterImpactParameterZ = ip[1];
512ced40 1444 fDecayIPpos = fDaughterImpactParameterXY; //ieT.GetD(pos[0], pos[1], tAOD->GetMagneticField());
52476a4c 1445 FillTrackSpy("AllDau");
1446 if(!AcceptDaughter(fDecayPt<2.0?kTRUE:kFALSE)) continue;
24373b38 1447
1448 jT=(AliAODTrack*) myV0->GetDaughter(iNeg); // negative
1449 AliESDtrack jeT( jT );
1450 jeT.SetTPCClusterMap( jT->GetTPCClusterMap() );
1451 jeT.SetTPCSharedMap( jT->GetTPCSharedMap() );
1452 jeT.SetTPCPointsF( jT->GetTPCNclsF() );
1453 jeT.PropagateToDCA(&vESD, tAOD->GetMagneticField(), 100);
1454 LoadTrack(&jeT,jT->Chi2perNDF());
1455 jeT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
1456 fDaughterImpactParameterXY = ip[0];
1457 fDaughterImpactParameterZ = ip[1];
512ced40 1458 fDecayIPneg = fDaughterImpactParameterXY; //jeT.GetD(pos[0], pos[1], tAOD->GetMagneticField());
52476a4c 1459 FillTrackSpy("AllDau");
1460 if(!AcceptDaughter(fDecayPt<2.0?kTRUE:kFALSE)) continue;
512ced40 1461
24373b38 1462 if( fExcludeTPCEdges ) {
1463 if( IsAtTPCEdge(iT->Phi(),iT->Pt(),+1,tAOD->GetMagneticField()) ) continue;
1464 if( IsAtTPCEdge(jT->Phi(),jT->Pt(),-1,tAOD->GetMagneticField()) ) continue;
1465 }
512ced40 1466 ieT.GetDCA(&jeT,tAOD->GetMagneticField(),fDecayXpos,fDecayXneg);
24373b38 1467 /*
1468 // cutting out population close to TPC edges :: strange excess saw in 2010
1469 if( fExcludeTPCEdges ) {
1470 Double_t phimod = myV0->Phi();
1471 int sectors[6] = {5,6,9,10,11,12};
1472 for(int ii=0; ii!=6; ++ii)
1473 if( (phimod<(sectors[ii]+1)*TMath::Pi()/9.0) && (phimod>sectors[ii]*TMath::Pi()/9.0) )
1474 return 0;
1475 }
1476 */
1477 if(fSpecie==0)
1478 fDecayRapidity = myV0->RapK0Short();
1479 else
1480 fDecayRapidity = myV0->RapLambda();
1481 fDecayDCAdaughters = myV0->DcaV0Daughters();
1482 fDecayCosinePointingAngleXY = CosThetaPointXY( myV0, vtx );
1483 fDecayRadXY = DecayLengthXY( myV0, vtx );
512ced40 1484 fDecayProductIPXY = fDecayIPpos*fDecayIPneg;
24373b38 1485 fDecayQt = myV0->PtArmV0();
1486 fDecayAlpha = myV0->AlphaV0(); // AlphaV0 -> AODRecoDecat::Alpha -> return 1.-2./(1.+QlProng(0)/QlProng(1));
1487 if(myV0->ChargeProng(iPos)<0) fDecayAlpha = -fDecayAlpha; // protects for a change in convention
1488 fDecayPt = myV0->Pt();
1489 fDecayEta = myV0->Eta();
1490 if( fSpecie==0 ) {
1491 fDecayMass = myV0->MassK0Short();
1492 } else {
1493 if(fDecayAlpha>0) fDecayMass = myV0->MassLambda();
1494 else fDecayMass = myV0->MassAntiLambda();
1495 }
1496 v0all++;
1497 if(fDecayMass<fMinMass) continue;
1498 if(fDecayMass>fMaxMass) continue;
1499 v0imw++;
1500 Double_t energy = TMath::Sqrt( fDecayMass*fDecayMass + myV0->Px()*myV0->Px() + myV0->Py()*myV0->Py() + myV0->Pz()*myV0->Pz() );
1501 Double_t gamma = energy/fDecayMass;
1502 fDecayDecayLength = DecayLength( myV0, vtx )/gamma;
52476a4c 1503 fDecayDecayLengthLab = DecayLength( myV0, vtx );
24373b38 1504 Double_t dPHI = fDecayPhi;
1505 Double_t dDPHI = dPHI - fPsi2;
1506 if( dDPHI < 0 ) dDPHI += TMath::TwoPi();
1507 if( dDPHI > TMath::Pi() ) dDPHI = TMath::TwoPi()-dDPHI;
1508 if(fQAlevel>1) {
6c0d2d67 1509 if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) ) FillCandidateSpy("V0SAllOP");
1510 else FillCandidateSpy("V0SAllIP");
24373b38 1511 }
6c0d2d67 1512 FillCandidateSpy("V0SAll");
52476a4c 1513 if(!fSkipVn)
1514 FillDecayVn("V0SAllVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
1515
24373b38 1516 if(!AcceptCandidate()) continue;
52476a4c 1517
1518 if(fDecayPt<fDecayStopPIDAtPt) {
1519 if( fSpecie==0 ) {//PID for kzero::pion+pion
1520 if( !PassesPIDCuts(&ieT,AliPID::kPion) ) continue; //positive track
1521 if( !PassesPIDCuts(&jeT,AliPID::kPion) ) continue; //negative track
1522 } else { //PID for lambda::proton+pion
24373b38 1523 if(fDecayAlpha>0) {
52476a4c 1524 if( !PassesPIDCuts(&ieT,AliPID::kProton) ) continue; //positive track
1525 if( !PassesPIDCuts(&jeT,AliPID::kPion) ) continue; //negative track
24373b38 1526 } else {
52476a4c 1527 if( !PassesPIDCuts(&jeT,AliPID::kProton) ) continue; //negative track
1528 if( !PassesPIDCuts(&ieT,AliPID::kPion) ) continue; //positive track
24373b38 1529 }
1530 }
52476a4c 1531 }
24373b38 1532 if(fQAlevel>1) {
6c0d2d67 1533 if( (dDPHI>TMath::PiOver4()) && (dDPHI<3*TMath::PiOver4()) ) FillCandidateSpy("V0SSelOP");
1534 else FillCandidateSpy("V0SSelIP");
24373b38 1535 }
6c0d2d67 1536 FillCandidateSpy("V0SSel");
52476a4c 1537 if(!fSkipVn)
1538 FillDecayVn("V0SSelVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
512ced40
RAB
1539 // ============================
1540 // Posting for FlowAnalysis
1541 if(!fPostMatched) {
1542 fDecayIDneg = iT->GetID();
1543 fDecayIDpos = jT->GetID();
6c0d2d67 1544 if(fUseFP) MakeTrack();
512ced40
RAB
1545 }
1546 // ============================
24373b38 1547 LoadTrack(&ieT,iT->Chi2perNDF());
1548 ieT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
1549 fDaughterImpactParameterXY = ip[0];
1550 fDaughterImpactParameterZ = ip[1];
52476a4c 1551 FillTrackSpy("SelDau");
24373b38 1552 LoadTrack(&jeT,jT->Chi2perNDF());
1553 jeT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
1554 fDaughterImpactParameterXY = ip[0];
1555 fDaughterImpactParameterZ = ip[1];
52476a4c 1556 FillTrackSpy("SelDau");
512ced40
RAB
1557 //===== BEGIN OF MCMATCH
1558 if(fReadMC) ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 1 ); // Selected event
24373b38 1559 if(mcArray) {
512ced40 1560 ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 2 ); // Stack found
24373b38 1561 bool matched = false;
1562 bool feeddown = false;
1563 Int_t labelpos = iT->GetLabel();
1564 Int_t labelneg = jT->GetLabel();
512ced40
RAB
1565 AliAODMCParticle *mcpos = (AliAODMCParticle*) mcArray->At( TMath::Abs(labelpos) );
1566 AliAODMCParticle *mcneg = (AliAODMCParticle*) mcArray->At( TMath::Abs(labelneg) );
1567 if( mcpos && mcneg ) {
1568 ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 3 ); // Daughters in stack
24373b38 1569 Int_t pdgRecPos = mcpos->GetPdgCode();
1570 Int_t pdgRecNeg = mcneg->GetPdgCode();
1571 int pospdg=211, negpdg=211;
1572 int mompdg=310, fdwpdg=333;
1573 if(fSpecie>0) {
1574 mompdg=3122;
1575 fdwpdg=3312;
1576 if(fDecayAlpha>0) {
1577 pospdg=2212; negpdg=211;
1578 } else {
1579 negpdg=2212; pospdg=211;
1580 }
1581 }
1582 if( TMath::Abs(pdgRecPos)==pospdg&&TMath::Abs(pdgRecNeg)==negpdg )
512ced40 1583 if(mcpos->GetMother()>-1)
24373b38 1584 if( mcpos->GetMother()==mcneg->GetMother() ) {
1585 AliAODMCParticle *mcmot = (AliAODMCParticle*) mcArray->At( mcpos->GetMother() );
512ced40
RAB
1586 fDecayMatchOrigin = TMath::Sqrt( mcmot->Xv()*mcmot->Xv() + mcmot->Yv()*mcmot->Yv() );
1587 fDecayMatchPt = mcmot->Pt();
1588 fDecayMatchEta = mcmot->Eta();
1589 fDecayMatchPhi = mcmot->Phi();
24373b38 1590 if( TMath::Abs(mcmot->GetPdgCode())==mompdg) {
1591 if(mcmot->GetNDaughters()==2) {
512ced40 1592 ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 4 ); // Correspond to decay
24373b38 1593 matched=true;
1594 Double_t dx = mcmot->Xv() - mcpos->Xv();
1595 Double_t dy = mcmot->Yv() - mcpos->Yv();
512ced40 1596 fDecayMatchRadXY = TMath::Sqrt( dx*dx + dy*dy );
24373b38 1597 }
512ced40
RAB
1598 if(mcmot->GetMother()>-1) {
1599 ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 5 ); // Decay has mother
24373b38 1600 AliAODMCParticle *mcfdw = (AliAODMCParticle*) mcArray->At( mcmot->GetMother() );
1601 if( TMath::Abs(mcfdw->GetPdgCode())==fdwpdg)
1602 feeddown=true;
1603 } // k0/lda have mother
1604 } // mother matches k0/lda
1605 } // both have same mother
512ced40 1606 }
24373b38 1607 if(matched) {
6c0d2d67 1608 FillCandidateSpy("Mth",true);
52476a4c 1609 if(!fSkipVn)
1610 FillDecayVn("V0SMthVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
512ced40
RAB
1611 if(fPostMatched>0) {
1612 fDecayIDneg = iT->GetID();
1613 fDecayIDpos = jT->GetID();
6c0d2d67 1614 if(fUseFP) MakeTrack();
512ced40
RAB
1615 }
1616 if(labelpos<0&&labelneg<0) {
6c0d2d67 1617 FillCandidateSpy("MthNegNeg",true);
52476a4c 1618 if(!fSkipVn)
1619 FillDecayVn("V0SMthNegNegVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
6c0d2d67 1620 } else if(labelpos>0&&labelneg>0) {
52476a4c 1621 if(!fSkipVn)
1622 FillDecayVn("V0SMthPosPosVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
512ced40 1623 } else if(labelpos*labelneg<0) {
6c0d2d67 1624 FillCandidateSpy("MthPosNeg",true);
52476a4c 1625 if(!fSkipVn)
1626 FillDecayVn("V0SMthPosNegVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
512ced40 1627 }
6c0d2d67 1628 AliAODVertex *secvtx = myV0->GetSecondaryVtx();
1629 Double_t possec[3],covsec[6];
1630 secvtx->GetXYZ(possec);
1631 secvtx->GetCovarianceMatrix(covsec);
1632 const AliESDVertex vSecVtx(possec,covsec,100.,100);
1633 AliESDtrack trackAtSecI( iT );
1634 trackAtSecI.SetTPCClusterMap( iT->GetTPCClusterMap() );
1635 trackAtSecI.SetTPCSharedMap( iT->GetTPCSharedMap() );
1636 trackAtSecI.SetTPCPointsF( iT->GetTPCNclsF() );
1637 trackAtSecI.PropagateToDCA(&vSecVtx, tAOD->GetMagneticField(), 100);
1638 fDaughterAtSecPhi = trackAtSecI.Phi();
1639 fDaughterAtSecEta = trackAtSecI.Eta();
1640 fDaughterAtSecPt = trackAtSecI.Pt();
24373b38 1641 LoadTrack(&ieT,iT->Chi2perNDF());
512ced40
RAB
1642 fDaughterMatchPhi=mcpos->Phi();
1643 fDaughterMatchEta=mcpos->Eta();
1644 fDaughterMatchPt=mcpos->Pt();
24373b38 1645 ieT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
1646 fDaughterImpactParameterXY = ip[0];
1647 fDaughterImpactParameterZ = ip[1];
6c0d2d67 1648 FillTrackSpy("MthDau",true);
1649 if(labelpos<0||labelneg<0) FillTrackSpy("MthNegDau",true);
1650 else FillTrackSpy("MthPosDau",true);
1651 AliESDtrack trackAtSecJ( jT );
1652 trackAtSecJ.SetTPCClusterMap( jT->GetTPCClusterMap() );
1653 trackAtSecJ.SetTPCSharedMap( jT->GetTPCSharedMap() );
1654 trackAtSecJ.SetTPCPointsF( jT->GetTPCNclsF() );
1655 trackAtSecJ.PropagateToDCA(&vSecVtx, tAOD->GetMagneticField(), 100);
1656 fDaughterAtSecPhi = trackAtSecJ.Phi();
1657 fDaughterAtSecEta = trackAtSecJ.Eta();
1658 fDaughterAtSecPt = trackAtSecJ.Pt();
24373b38 1659 LoadTrack(&jeT,jT->Chi2perNDF());
512ced40
RAB
1660 fDaughterMatchPhi=mcneg->Phi();
1661 fDaughterMatchEta=mcneg->Eta();
1662 fDaughterMatchPt=mcneg->Pt();
24373b38 1663 jeT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
1664 fDaughterImpactParameterXY = ip[0];
1665 fDaughterImpactParameterZ = ip[1];
6c0d2d67 1666 FillTrackSpy("MthDau",true);
1667 if(labelpos<0||labelneg<0) FillTrackSpy("MthNegDau",true);
1668 else FillTrackSpy("MthPosDau",true);
512ced40 1669 } else {
6c0d2d67 1670 FillCandidateSpy("UnMth",false);
52476a4c 1671 if(!fSkipVn)
1672 FillDecayVn("V0SUnMthVn",fDecayMass,fDecayPt,fDecayPhi,fDecayEta,fDecayIDpos,fDecayIDneg);
512ced40
RAB
1673 if(fPostMatched<0) {
1674 fDecayIDneg = iT->GetID();
1675 fDecayIDpos = jT->GetID();
6c0d2d67 1676 if(fUseFP) MakeTrack();
512ced40
RAB
1677 }
1678 LoadTrack(&ieT,iT->Chi2perNDF());
512ced40
RAB
1679 ieT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
1680 fDaughterImpactParameterXY = ip[0];
1681 fDaughterImpactParameterZ = ip[1];
6c0d2d67 1682 FillTrackSpy("UnMthDau",false);
512ced40 1683 LoadTrack(&jeT,jT->Chi2perNDF());
512ced40
RAB
1684 jeT.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
1685 fDaughterImpactParameterXY = ip[0];
1686 fDaughterImpactParameterZ = ip[1];
6c0d2d67 1687 FillTrackSpy("UnMthDau",false);
24373b38 1688 }
1689 if(feeddown) {
6c0d2d67 1690 FillCandidateSpy("MthFeedDown",true);
24373b38 1691 }
1692 }
1693 //===== END OF MCMATCH
1694 }
6c0d2d67 1695 ((TH2D*)((TList*)fList->FindObject("V0SAll"))->FindObject("V0SADC"))->Fill( v0all,v0imw );
52476a4c 1696 if(!fSkipVn) {
1697 QCStoreDecayVn("V0SAllVn");
1698 QCStoreDecayVn("V0SSelVn");
1699 if(fReadMC) {
1700 QCStoreDecayVn("V0SMthVn");
1701 QCStoreDecayVn("V0SMthNegNegVn");
1702 QCStoreDecayVn("V0SMthPosPosVn");
1703 QCStoreDecayVn("V0SMthPosNegVn");
1704 }
6c0d2d67 1705 }
24373b38 1706 return;
1707}
1708//=======================================================================
1709Bool_t AliAnalysisTaskFlowStrange::PassesPIDCuts(AliESDtrack *myTrack, AliPID::EParticleType pid) {
1710 Bool_t pass=kTRUE;
1711 if(fPIDResponse) {
1712 fDaughterNSigmaPID = fPIDResponse->NumberOfSigmasTPC(myTrack,pid);
1713 if( TMath::Abs(fDaughterNSigmaPID) > fDaughterMaxNSigmaPID )
1714 pass = kFALSE;
1715 }
1716 return pass;
1717}
1718//=======================================================================
1719void AliAnalysisTaskFlowStrange::ChargeParticles(AliAODEvent *tAOD) {
6c0d2d67 1720 //benchmark purposes
24373b38 1721 if(!tAOD) return;
6c0d2d67 1722 TClonesArray* mcArray=NULL;
1723 if(fReadMC) {
1724 mcArray = dynamic_cast<TClonesArray*>(tAOD->FindListObject(AliAODMCParticle::StdBranchName()));
1725 ReadStack(mcArray);
1726 }
24373b38 1727 for(int i=0; i!=tAOD->GetNumberOfTracks(); ++i) {
f15c1f69 1728 AliAODTrack *t = dynamic_cast<AliAODTrack*>(tAOD->GetTrack( i ));
24373b38 1729 if(!t) continue;
6c0d2d67 1730 if( !t->TestFilterBit(1) ) continue;
24373b38 1731 fDecayMass=0.0; // using mass as nsigmas control plot
1732 if(fPIDResponse) { // PID
1733 switch(fSpecie) { // TPC PID only
1734 case(kPION):
1735 fDecayMass = fPIDResponse->NumberOfSigmasTPC(t,AliPID::kPion);
1736 break;
1737 case(kKAON):
1738 fDecayMass = fPIDResponse->NumberOfSigmasTPC(t,AliPID::kKaon);
1739 break;
1740 case(kPROTON):
1741 fDecayMass = fPIDResponse->NumberOfSigmasTPC(t,AliPID::kProton);
1742 break;
1743 }
1744 }
1745 Bool_t pass = kTRUE;
1746 if( TMath::Abs(fDecayMass) > 3.0 ) pass=kFALSE;
6c0d2d67 1747 if( t->Eta()<-0.5 || t->Eta()>+0.5 ) pass=kFALSE;
24373b38 1748 if( t->Pt()<0.2 || t->Pt()>20.0 ) pass=kFALSE;
24373b38 1749 AliESDtrack et( t );
1750 et.SetTPCClusterMap( t->GetTPCClusterMap() );
1751 et.SetTPCSharedMap( t->GetTPCSharedMap() );
1752 et.SetTPCPointsF( t->GetTPCNclsF() );
1753 Float_t ip[2];
1754 LoadTrack(&et,t->Chi2perNDF());
1755 AliAODVertex *vtx = tAOD->GetPrimaryVertex();
1756 Double_t pos[3];
1757 vtx->GetXYZ(pos);
1758 et.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
1759 fDaughterImpactParameterXY = ip[0];
1760 fDaughterImpactParameterZ = ip[1];
24373b38 1761
6c0d2d67 1762 FillTrackSpy("TrkAll");
52476a4c 1763 if(!fSkipVn)
1764 FillTrackVn("TrkAllVn",t->Pt(),t->Phi(),t->Eta(),t->GetID());
6c0d2d67 1765 if(!pass) continue;
1766 FillTrackSpy("TrkSel");
52476a4c 1767 if(!fSkipVn)
1768 FillTrackVn("TrkSelVn",t->Pt(),t->Phi(),t->Eta(),t->GetID());
6c0d2d67 1769 if(fReadMC) {
1770 ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 1 ); // Selected event
1771 if(mcArray) {
1772 ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 2 ); // Stack found
1773 bool matched = false;
1774 Int_t label = t->GetLabel();
1775 AliAODMCParticle *mcpar = (AliAODMCParticle*) mcArray->At( TMath::Abs(label) );
1776 if( mcpar ) {
1777 ((TH1D*)((TList*)fList->FindObject("STATMC"))->FindObject("Events"))->Fill( 3 ); // Particle in stack
1778 Int_t pdgmcpar = TMath::Abs(mcpar->GetPdgCode());
1779 switch(fSpecie) {
1780 case(kPION):
1781 if(pdgmcpar==211) matched = true;
1782 break;
1783 case(kKAON):
1784 if(pdgmcpar==211) matched = true;
1785 break;
1786 case(kPROTON):
1787 if(pdgmcpar==2212) matched = true;
1788 break;
1789 }
1790 if(!mcpar->IsPrimary()) matched = false;
1791 }
1792 if(matched) {
1793 FillTrackSpy("Mth");
52476a4c 1794 if(!fSkipVn)
1795 FillTrackVn("MthVn",t->Pt(),t->Phi(),t->Eta(),t->GetID());
6c0d2d67 1796 if(label<0) {
1797 FillTrackSpy("MthNeg");
52476a4c 1798 if(!fSkipVn)
1799 FillTrackVn("MthNegVn",t->Pt(),t->Phi(),t->Eta(),t->GetID());
6c0d2d67 1800 } else {
1801 FillTrackSpy("MthPos");
52476a4c 1802 if(!fSkipVn)
1803 FillTrackVn("MthPosVn",t->Pt(),t->Phi(),t->Eta(),t->GetID());
6c0d2d67 1804 }
1805 }
1806 }
1807 }
1808 if(fUseFP) {
1809 fDecayPt=t->Pt();
1810 fDecayPhi=t->Phi();
1811 fDecayEta=t->Eta();
1812 fDecayID=t->GetID();
1813 MakeTrack();
1814 }
1815 }
52476a4c 1816 if(!fSkipVn) {
1817 QCStoreTrackVn("TrkAllVn");
1818 QCStoreTrackVn("TrkSelVn");
1819 if(fReadMC) {
1820 QCStoreTrackVn("MthVn");
1821 QCStoreTrackVn("MthNegVn");
1822 QCStoreTrackVn("MthPosVn");
1823 }
24373b38 1824 }
1825 return;
1826}
1827//=======================================================================
52476a4c 1828void AliAnalysisTaskFlowStrange::ComputeChi2VZERO() {
6c0d2d67 1829 Double_t MeanQaQc = ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZEAQmVZEC"))->GetBinContent( 1 );
1830 Double_t MeanQaQa = ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZEASQUARED"))->GetBinContent( 1 );
1831 Double_t MeanQcQc = ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZECSQUARED"))->GetBinContent( 1 );
1832 Double_t MeanQaQt = ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmTPCQmVZEA"))->GetBinContent( 1 );
1833 Double_t MeanQcQt = ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmTPCQmVZEC"))->GetBinContent( 1 );
1834 if(!TMath::AreEqualAbs(MeanQaQt,0,1e-10)&&!TMath::AreEqualAbs(MeanQcQt,0,1e-10)&&!TMath::AreEqualAbs(MeanQaQc,0,1e-10)) {
1835 Double_t OneOverChiSquaredVZEA = MeanQaQa*MeanQcQt/MeanQaQc/MeanQaQt-1;
1836 Double_t OneOverChiSquaredVZEC = MeanQcQc*MeanQaQt/MeanQaQc/MeanQcQt-1;
1837 if(!TMath::AreEqualAbs(OneOverChiSquaredVZEA,0,1e-10)&&!TMath::AreEqualAbs(OneOverChiSquaredVZEC,0,1e-10)) {
1838 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("ChiSquaredVZEA"))->SetBinContent( 1, 1/OneOverChiSquaredVZEA );
1839 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("ChiSquaredVZEC"))->SetBinContent( 1, 1/OneOverChiSquaredVZEC );
1840 }
1841 }
52476a4c 1842}
1843//=======================================================================
1844void AliAnalysisTaskFlowStrange::Terminate(Option_t *) {
1845 //terminate
1846 if(fSkipTerminate) return;
1847 ComputeChi2VZERO();
6c0d2d67 1848 if(fSkipSelection) return;
52476a4c 1849 if(fSkipVn) return;
6c0d2d67 1850 if(fSpecie<10) {
1851 ComputeDecayVn("V0SAllVn");
1852 ComputeDecayVn("V0SSelVn");
1853 if(fReadMC) {
1854 ComputeDecayVn("V0SMthVn");
1855 ComputeDecayVn("V0SMthPosPosVn");
1856 ComputeDecayVn("V0SMthNegNegVn");
1857 ComputeDecayVn("V0SMthPosNegVn");
1858 ComputeDecayVn("V0SUnMthVn");
1859 }
1860 } else {
1861 ComputeTrackVn("TrkAllVn");
1862 ComputeTrackVn("TrkSelVn");
1863 if(fReadMC) {
1864 ComputeTrackVn("MthVn");
1865 ComputeTrackVn("MthPosVn");
1866 ComputeTrackVn("MthNegVn");
1867 }
1868 }
24373b38 1869}
1870//=======================================================================
1871void AliAnalysisTaskFlowStrange::MakeTrack() {
1872 // create track for flow tasks
1873 if(fCandidates->GetLast()+5>fCandidates->GetSize()) {
1874 fCandidates->Expand( fCandidates->GetSize()+20 );
1875 }
1876 Bool_t overwrite = kTRUE;
1877 AliFlowCandidateTrack *oTrack = (static_cast<AliFlowCandidateTrack*> (fCandidates->At( fCandidates->GetLast()+1 )));
1878 if( !oTrack ) { // creates new
1879 oTrack = new AliFlowCandidateTrack();
1880 overwrite = kFALSE;
1881 } else { // overwrites
1882 oTrack->ClearMe();
1883 }
1884 oTrack->SetMass(fDecayMass);
1885 oTrack->SetPt(fDecayPt);
1886 oTrack->SetPhi(fDecayPhi);
1887 oTrack->SetEta(fDecayEta);
1888 if(fSpecie<10) {
1889 oTrack->AddDaughter(fDecayIDpos);
1890 oTrack->AddDaughter(fDecayIDneg);
1891 } else {
1892 oTrack->SetID( fDecayID );
1893 }
1894 oTrack->SetForPOISelection(kTRUE);
1895 oTrack->SetForRPSelection(kFALSE);
1896 if(overwrite) {
1897 fCandidates->SetLast( fCandidates->GetLast()+1 );
1898 } else {
1899 fCandidates->AddLast(oTrack);
1900 }
1901 return;
1902}
1903//=======================================================================
1904void AliAnalysisTaskFlowStrange::AddCandidates() {
1905 // adds candidates to flow events (untaging if necessary)
1906 if(fDebug) printf("FlowEventTPC %d tracks | %d RFP | %d POI\n",fTPCevent->NumberOfTracks(),fTPCevent->GetNumberOfRPs(),fTPCevent->GetNumberOfPOIs());
1907 if(fDebug) printf("FlowEventVZE %d tracks | %d RFP | %d POI\n",fVZEevent->NumberOfTracks(),fVZEevent->GetNumberOfRPs(),fVZEevent->GetNumberOfPOIs());
1908 if(fDebug) printf("I received %d candidates\n",fCandidates->GetEntriesFast());
1909 Int_t untagged=0;
1910 Int_t poi=0;
1911 for(int iCand=0; iCand!=fCandidates->GetEntriesFast(); ++iCand ) {
1912 AliFlowCandidateTrack *cand = static_cast<AliFlowCandidateTrack*>(fCandidates->At(iCand));
1913 if(!cand) continue;
1914 cand->SetForPOISelection(kTRUE);
1915 cand->SetForRPSelection(kFALSE);
1916 poi++;
6c0d2d67 1917 //if(fDebug) printf(" >Checking at candidate %d with %d daughters: mass %f\n",iCand,cand->GetNDaughters(),cand->Mass());
24373b38 1918 if(fSpecie<10) { // DECAYS
1919 // untagging ===>
1920 if(fDaughterUnTag) {
1921 for(int iDau=0; iDau!=cand->GetNDaughters(); ++iDau) {
1922 if(fDebug) printf(" >Daughter %d with fID %d", iDau, cand->GetIDDaughter(iDau));
1923 for(int iRPs=0; iRPs!=fTPCevent->NumberOfTracks(); ++iRPs ) {
1924 AliFlowTrack *iRP = static_cast<AliFlowTrack*>(fTPCevent->GetTrack( iRPs ));
1925 if(!iRP) continue;
1926 if(!iRP->InRPSelection()) continue;
1927 if(cand->GetIDDaughter(iDau) == iRP->GetID()) {
1928 if(fDebug) printf(" was in RP set");
1929 ++untagged;
1930 iRP->SetForRPSelection(kFALSE);
1931 fTPCevent->SetNumberOfRPs( fTPCevent->GetNumberOfRPs() -1 );
1932 }
1933 }
1934 if(fDebug) printf("\n");
1935 }
1936 }
1937 // <=== untagging
1938 fTPCevent->InsertTrack( ((AliFlowTrack*) cand) );
1939 } else { // CHARGED
1940 // adding only new tracks and tagging accordingly ===>
1941 Bool_t found=kFALSE;
1942 for(int iRPs=0; iRPs!=fTPCevent->NumberOfTracks(); ++iRPs ) {
1943 AliFlowTrack *iRP = static_cast<AliFlowTrack*>(fTPCevent->GetTrack( iRPs ));
1944 if(!iRP) continue;
1945 if(!iRP->InRPSelection()) continue;
1946 if(cand->GetID() == iRP->GetID()) {
1947 if(fDebug) printf(" >charged track (%d) was also found in RP set (adding poi tag)\n",cand->GetID());
6c0d2d67 1948 iRP->SetMass( cand->Mass() );
24373b38 1949 iRP->SetForPOISelection(kTRUE);
1950 found = kTRUE;
1951 }
1952 }
1953 if(!found) // not found adding track
1954 fTPCevent->InsertTrack( ((AliFlowTrack*) cand) );
1955 }
1956 fVZEevent->InsertTrack( ((AliFlowTrack*) cand) );
1957 } //END OF LOOP
1958 fTPCevent->SetNumberOfPOIs( poi );
1959 fVZEevent->SetNumberOfPOIs( poi );
1960 ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("POI"))->Fill( poi );
1961 ((TH1D*)((TList*)fList->FindObject("Event"))->FindObject("UNTAG"))->Fill( untagged );
1962 if(fDebug) printf("FlowEventTPC %d tracks | %d RFP | %d POI\n",fTPCevent->NumberOfTracks(),fTPCevent->GetNumberOfRPs(),fTPCevent->GetNumberOfPOIs());
1963 if(fDebug) printf("FlowEventVZE %d tracks | %d RFP | %d POI\n",fVZEevent->NumberOfTracks(),fVZEevent->GetNumberOfRPs(),fVZEevent->GetNumberOfPOIs());
1964}
1965//=======================================================================
1966void AliAnalysisTaskFlowStrange::PushBackFlowTrack(AliFlowEvent *flowevent, Double_t pt, Double_t phi, Double_t eta, Double_t w, Int_t id) {
1967 AliFlowTrack rfp;
1968 rfp.SetPt(pt);
1969 rfp.SetPhi(phi);
1970 rfp.SetEta(eta);
1971 rfp.SetWeight(w);
1972 rfp.SetForRPSelection(kTRUE);
1973 rfp.SetForPOISelection(kFALSE);
6c0d2d67 1974 rfp.SetMass(-999);
24373b38 1975 rfp.SetID(id);
1976 flowevent->InsertTrack( &rfp );
1977}
1978//=======================================================================
1979Bool_t AliAnalysisTaskFlowStrange::IsAtTPCEdge(Double_t phi,Double_t pt,Int_t charge,Double_t b) {
1980 // Origin: Alex Dobrin
1981 // Implemented by Carlos Perez
1982 TF1 cutLo("cutLo", "-0.01/x+pi/18.0-0.015", 0, 100);
1983 TF1 cutHi("cutHi", "0.55/x/x+pi/18.0+0.03", 0, 100);
1984 Double_t phimod = phi;
1985 if(b<0) phimod = TMath::TwoPi()-phimod; //for negatve polarity field
1986 if(charge<0) phimod = TMath::TwoPi()-phimod; //for negatve charge
1987 phimod += TMath::Pi()/18.0;
1988 phimod = fmod(phimod, TMath::Pi()/9.0);
1989 if( phimod<cutHi.Eval(pt) && phimod>cutLo.Eval(pt) )
1990 return kTRUE;
1991
1992 return kFALSE;
1993}
1994//=======================================================================
1995void AliAnalysisTaskFlowStrange::MakeQVectors() {
1996 //computes event plane and updates fPsi2
1997 //if there is a problem fPsi->-1
1998 fPsi2=-1;
52476a4c 1999 fVZEWarning=kFALSE;
24373b38 2000 //=>loading event
6c0d2d67 2001 MakeQVZE(InputEvent());
2002 MakeQTPC(InputEvent());
2003 if(fUseFP&&fReadMC) {
c41a93af 2004 fVZEevent->SetMCReactionPlaneAngle( fMCEP );
2005 fTPCevent->SetMCReactionPlaneAngle( fMCEP );
2006 }
6c0d2d67 2007 if(fDebug) {
2008 printf("**::MakeQVectors()");
2009 printf(" fQVZEACos %.16f | fQVZEASin %.16f || fQVZEA %.3f | fQVZEC %.3f \n",fQVZEACos, fQVZEASin, fQVZEA, fQVZEC);
2010 printf(" nQTPA_nTracks %d | fQTPC_nTracks %d || fQTPCA %.3f | fQTPCC %.3f \n",fQTPCA_nTracks, fQTPCC_nTracks, fQTPCA, fQTPCC);
2011 printf(" fQTPCACos %.16f | fQTPCASin %.16f || fQTPC2hCos %.16f | fQTPC2hSin %.16f \n",fQTPCACos, fQTPCASin, fQTPC2hCos, fQTPC2hSin);
2012 }
52476a4c 2013 FillMakeQSpy();
2014}
2015//=======================================================================
2016void AliAnalysisTaskFlowStrange::FillMakeQSpy() {
24373b38 2017 //=>computing psi
2018 //VZERO
52476a4c 2019 Double_t qvzecos,qvzesin,psivzea,psivzec,psivze,qvze, qvzea, qvzec;
6c0d2d67 2020 psivzea = ( TMath::Pi()+TMath::ATan2(-fQVZEASin,-fQVZEACos) )/fHarmonic;
2021 psivzec = ( TMath::Pi()+TMath::ATan2(-fQVZECSin,-fQVZECCos) )/fHarmonic;
2022 qvzecos = fQVZEACos + fQVZECCos;
2023 qvzesin = fQVZEASin + fQVZECSin;
52476a4c 2024 qvzea = fQVZEA;
2025 qvzec = fQVZEC;
6c0d2d67 2026 qvze = fQVZEA + fQVZEC;
2027 psivze = ( TMath::Pi()+TMath::ATan2(-qvzesin,-qvzecos) )/fHarmonic;
24373b38 2028 //TPC
6c0d2d67 2029 Double_t qtpccos,qtpcsin,psitpca,psitpcc,psitpc,qtpc;
2030 psitpca = ( TMath::Pi()+TMath::ATan2(-fQTPCASin,-fQTPCACos) )/fHarmonic;
2031 psitpcc = ( TMath::Pi()+TMath::ATan2(-fQTPCCSin,-fQTPCCCos) )/fHarmonic;
2032 qtpccos = fQTPCACos + fQTPCCCos;
2033 qtpcsin = fQTPCASin + fQTPCCSin;
2034 qtpc = fQTPCA + fQTPCC;
2035 psitpc = ( TMath::Pi()+TMath::ATan2(-qtpcsin,-qtpccos) )/fHarmonic;
24373b38 2036 //=>does the event clear?
2037 switch(fWhichPsi) {
2038 case(1): //VZERO
52476a4c 2039 if(fVZEWarning) return;
24373b38 2040 fPsi2 = psivze;
2041 break;
2042 case(2): //TPC
6c0d2d67 2043 if(fQTPCA<2||fQTPCC<2) return;
24373b38 2044 fPsi2 = psitpc;
2045 break;
2046 }
6c0d2d67 2047 //computing physical Qm vectors
2048 Double_t vzec_qmcos = fQVZECCos/fQVZEC;
2049 Double_t vzec_qmsin = fQVZECSin/fQVZEC;
2050 Double_t vzec_qmnor = TMath::Sqrt( vzec_qmcos*vzec_qmcos + vzec_qmsin*vzec_qmsin );
2051 Double_t vzea_qmcos = fQVZEACos/fQVZEA;
2052 Double_t vzea_qmsin = fQVZEASin/fQVZEA;
2053 Double_t vzea_qmnor = TMath::Sqrt( vzea_qmcos*vzea_qmcos + vzea_qmsin*vzea_qmsin );
2054 Double_t vze_qmcos = qvzecos/qvze;
2055 Double_t vze_qmsin = qvzesin/qvze;
2056 Double_t vze_qmnor = TMath::Sqrt( vze_qmcos*vze_qmcos + vze_qmsin*vze_qmsin );
2057 Double_t tpcc_qmcos = fQTPCCCos/fQTPCC;
2058 Double_t tpcc_qmsin = fQTPCCSin/fQTPCC;
2059 Double_t tpcc_qmnor = TMath::Sqrt( tpcc_qmcos*tpcc_qmcos + tpcc_qmsin*tpcc_qmsin );
2060 Double_t tpca_qmcos = fQTPCACos/fQTPCA;
2061 Double_t tpca_qmsin = fQTPCASin/fQTPCA;
2062 Double_t tpca_qmnor = TMath::Sqrt( tpca_qmcos*tpca_qmcos + tpca_qmsin*tpca_qmsin );
2063 Double_t tpc_qmcos = qtpccos/qtpc;
2064 Double_t tpc_qmsin = qtpcsin/qtpc;
2065 Double_t tpc_qmnor = TMath::Sqrt( tpc_qmcos*tpc_qmcos + tpc_qmsin*tpc_qmsin );
24373b38 2066 //=>great! recording
2067 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEPSI"))->Fill( psivze );
2068 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEPSIA"))->Fill( psivzea );
6c0d2d67 2069 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEPSIC"))->Fill( psivzec );
2070 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("RFPVZE"))->Fill( qvze );
52476a4c 2071 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZEA"))->Fill( vzea_qmnor*TMath::Sqrt(qvzea) );
2072 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZEC"))->Fill( vzec_qmnor*TMath::Sqrt(qvzec) );
24373b38 2073 //------
2074 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCPSI"))->Fill( psitpc );
2075 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCPSIA"))->Fill( psitpca );
6c0d2d67 2076 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCPSIC"))->Fill( psitpcc );
2077 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("RFPTPC"))->Fill( qtpc );
2adcf041 2078 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmTPC"))->Fill( tpc_qmnor*TMath::Sqrt(qtpc) );
24373b38 2079 //------
52476a4c 2080 ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSI_TPCAVZEC"))->Fill( psitpca, psivzec );
2081 ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSI_TPCCVZEA"))->Fill( psitpcc, psivzea );
2082 ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSI_TPCVZE"))->Fill( psitpc, psivze );
2083
6c0d2d67 2084 if(fReadMC) {
2085 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSIMCDIFFTPC"))->Fill( psitpc-fMCEP );
2086 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSIMCDIFFTPCA"))->Fill( psitpca-fMCEP );
2087 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSIMCDIFFTPCC"))->Fill( psitpcc-fMCEP );
2088 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSIMCDIFFVZE"))->Fill( psivze-fMCEP );
2089 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSIMCDIFFVZEA"))->Fill( psivzea-fMCEP );
2090 ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("PSIMCDIFFVZEC"))->Fill( psivzec-fMCEP );
2091 }
24373b38 2092 //------
6c0d2d67 2093 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCQm"))->Fill( 1., tpcc_qmsin, tpcc_qmnor );
2094 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCQm"))->Fill( 2., tpcc_qmcos, tpcc_qmnor );
2095 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCQm"))->Fill( 3., tpca_qmsin, tpca_qmnor );
2096 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCQm"))->Fill( 4., tpca_qmcos, tpca_qmnor );
2097 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCQm"))->Fill( 5., tpc_qmsin, tpc_qmnor );
2098 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCQm"))->Fill( 6., tpc_qmcos, tpc_qmnor );
2099 //------
2100 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEQm"))->Fill( 1., vzec_qmsin, vzec_qmnor );
2101 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEQm"))->Fill( 2., vzec_qmcos, vzec_qmnor );
2102 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEQm"))->Fill( 3., vzea_qmsin, vzea_qmnor );
2103 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEQm"))->Fill( 4., vzea_qmcos, vzea_qmnor );
2104 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEQm"))->Fill( 5., vze_qmsin, vze_qmnor );
2105 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEQm"))->Fill( 6., vze_qmcos, vze_qmnor );
2106 //------
2107 Double_t vzeqaqc = vzec_qmcos*vzea_qmcos + vzec_qmsin*vzea_qmsin;
2108 Double_t vzeqatpcq = vzea_qmcos*tpc_qmcos + vzea_qmsin*tpc_qmsin;
2109 Double_t vzeqctpcq = vzec_qmcos*tpc_qmcos + vzec_qmsin*tpc_qmsin;
2110 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZEAQmVZEC"))->Fill( 1., vzeqaqc, vze_qmnor );
2111 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZEASQUARED"))->Fill( 1., vzea_qmnor*vzea_qmnor, vze_qmnor );
2112 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmVZECSQUARED"))->Fill( 1., vzec_qmnor*vzec_qmnor, vze_qmnor );
2113 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmTPCQmVZEA"))->Fill( 1., vzeqatpcq, vze_qmnor );
2114 ((TProfile*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("QmTPCQmVZEC"))->Fill( 1., vzeqctpcq, vze_qmnor );
24373b38 2115 return;
2116}
2117//=======================================================================
6c0d2d67 2118void AliAnalysisTaskFlowStrange::MakeQVZE(AliVEvent *tevent) {
24373b38 2119 //=>cleaning
6c0d2d67 2120 if(fUseFP) fVZEevent->ClearFast(); // flowpackage
24373b38 2121 //=>computing
6c0d2d67 2122 fQVZEACos=fQVZEASin=fQVZEA=fQVZECCos=fQVZECSin=fQVZEC=0;
24373b38 2123 Int_t rfp=0;
2124 Double_t eta, phi, w;
2125 //v0c -> qa
2126 for(int id=fVZECa*8;id!=8+fVZECb*8;++id) {
2127 eta = -3.45+0.5*(id/8);
2128 phi = TMath::PiOver4()*(0.5+id%8);
52476a4c 2129 w = tevent->GetVZEROEqMultiplicity(id);
2130 if(w<3) fVZEWarning=kTRUE;
2131 w *= fVZEextW[id];
6c0d2d67 2132 fQVZECCos += w*TMath::Cos(fHarmonic*phi);
2133 fQVZECSin += w*TMath::Sin(fHarmonic*phi);
2134 fQVZEC += w;
24373b38 2135 ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEAllPhiEta"))->Fill( phi, eta, w );
2136 rfp++;
6c0d2d67 2137 if(fUseFP) PushBackFlowTrack(fVZEevent,0,phi,eta,w,0); // flowpackage
24373b38 2138 }
2139 //v0a -> qb
2140 for(int id=32+fVZEAa*8;id!=40+fVZEAb*8;++id) {
2141 eta = +4.8-0.6*((id/8)-4);
2142 phi = TMath::PiOver4()*(0.5+id%8);
52476a4c 2143 w = tevent->GetVZEROEqMultiplicity(id);
2144 if(w<3) fVZEWarning=kTRUE;
2145 w *= fVZEextW[id];
6c0d2d67 2146 fQVZEACos += w*TMath::Cos(fHarmonic*phi);
2147 fQVZEASin += w*TMath::Sin(fHarmonic*phi);
2148 fQVZEA += w;
24373b38 2149 ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEAllPhiEta"))->Fill( phi, eta, w );
2150 rfp++;
6c0d2d67 2151 if(fUseFP) PushBackFlowTrack(fVZEevent,0,phi,eta,w,0); // flowpackage
2152 }
2153 if(fUseFP) { // flowpackage
2154 fVZEevent->SetNumberOfRPs(rfp);
2155 if(fDebug>0) printf("Inserted tracks in FlowEventVZE %d ==> %.1f\n",fVZEevent->NumberOfTracks(),fQVZEC+fQVZEA);
24373b38 2156 }
24373b38 2157}
2158//=======================================================================
2159void AliAnalysisTaskFlowStrange::AddTPCRFPSpy(TList *me) {
2160 TH1D *tH1D;
2161 tH1D = new TH1D("PT", "PT", 50,0,5); me->Add(tH1D);
2162 tH1D = new TH1D("PHI", "PHI", 90,0,TMath::TwoPi()); me->Add(tH1D);
2163 tH1D = new TH1D("ETA", "ETA", 40,-1,+1); me->Add(tH1D);
2164 tH1D = new TH1D("TPCS", "TPC Signal", 100,0,500); me->Add(tH1D);
2165 tH1D = new TH1D("IPXY", "IPXY", 100,-2,+2); me->Add(tH1D);
2166 tH1D = new TH1D("IPZ", "IPZ", 100,-2,+2); me->Add(tH1D);
2167 // TPC
2168 tH1D = new TH1D("TPCNCLS", "NCLS", 170,-0.5,+169.5); me->Add(tH1D);
2169 tH1D = new TH1D("TPCSHCL", "NSCLS / NCLS", 100,0,1); me->Add(tH1D);
2170 tH1D = new TH1D("TPCFICL", "NCLS1I / NCLS",100,0,1); me->Add(tH1D);
2171 tH1D = new TH1D("TPCXRNF", "XROW / NFCLS", 100,0,1.5); me->Add(tH1D);
2172 tH1D = new TH1D("TPCRCHI", "CHI2 / NCLS", 50,0,5); me->Add(tH1D);
2173 // ITS
2174 tH1D = new TH1D("ITSNCLS", "NCLS", 7,-0.5,+6.5); me->Add(tH1D);
2175 tH1D = new TH1D("ITSRCHI", "CHI2 / NCLS", 50,0,5); me->Add(tH1D);
2176
2177}
2178//=======================================================================
2179Bool_t AliAnalysisTaskFlowStrange::PassesRFPTPCCuts(AliESDtrack *track, Double_t aodchi2cls, Float_t aodipxy, Float_t aodipz) {
2180 if(track->GetKinkIndex(0)>0) return kFALSE;
2181 if( (track->GetStatus()&AliESDtrack::kTPCrefit)==0 ) return kFALSE;
2182 Double_t pt = track->Pt();
2183 Double_t phi = track->Phi();
2184 Double_t eta = track->Eta();
2185 Double_t tpcs = track->GetTPCsignal();
2186 Float_t ipxy, ipz;
2187 track->GetImpactParameters(ipxy,ipz);
2188 Int_t cls = track->GetTPCclusters(0);
2189 Double_t xrows, findcls, chi2;
2190 findcls = track->GetTPCNclsF();
2191 xrows = track->GetTPCCrossedRows();
2192 chi2 = track->GetTPCchi2();
2193 Double_t rchi2 = chi2/cls;
2194 if(!fReadESD) {
2195 rchi2 = aodchi2cls;
2196 ipxy = aodipxy;
2197 ipz = aodipz;
2198 }
2199 Double_t xrnfcls = xrows/findcls;
2200 Double_t scls, cls1i, itschi2;
2201 Int_t itscls;
2202 cls1i = track->GetTPCNclsIter1();
2203 scls = track->GetTPCnclsS();
2204 itscls = track->GetITSclusters(0);
2205 itschi2 = track->GetITSchi2();
2206 Double_t shcl = scls/cls;
2207 Double_t ficl = cls1i/cls;
2208 Double_t itsrchi2 = itscls/itschi2;
2209 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("PT"))->Fill( pt );
2210 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("PHI"))->Fill( phi );
2211 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("ETA"))->Fill( eta );
2212 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCS"))->Fill( tpcs );
2213 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("IPXY"))->Fill( ipxy );
2214 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("IPZ"))->Fill( ipz );
2215 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCNCLS"))->Fill( cls );
2216 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCSHCL"))->Fill( shcl );
2217 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCFICL"))->Fill( ficl );
2218 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCXRNF"))->Fill( xrnfcls );
2219 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("TPCRCHI"))->Fill( rchi2 );
2220 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("ITSNCLS"))->Fill( itscls );
2221 ((TH1D*)((TList*)fList->FindObject("TPCRFPall"))->FindObject("ITSRCHI"))->Fill( itsrchi2 );
2222 if(pt<fRFPminPt) return kFALSE; //0.2
2223 if(pt>fRFPmaxPt) return kFALSE; //5.0
6c0d2d67 2224 if(eta<fRFPCminEta||(eta>fRFPCmaxEta&&eta<fRFPAminEta)||eta>fRFPAmaxEta) return kFALSE; // -0.8 0.0 0.0 +0.8
24373b38 2225 if(tpcs<fRFPTPCsignal) return kFALSE; //10.0
2226 if( TMath::Sqrt(ipxy*ipxy/fRFPmaxIPxy/fRFPmaxIPxy+ipz*ipz/fRFPmaxIPz/fRFPmaxIPz)>1 ) return kFALSE; //2.4 3.2
2227 if(cls<fRFPTPCncls) return kFALSE; //70
2228 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("PT"))->Fill( pt );
2229 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("PHI"))->Fill( phi );
2230 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("ETA"))->Fill( eta );
2231 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCS"))->Fill( tpcs );
2232 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("IPXY"))->Fill( ipxy );
2233 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("IPZ"))->Fill( ipz );
2234 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCNCLS"))->Fill( cls );
2235 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCSHCL"))->Fill( shcl );
2236 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCFICL"))->Fill( ficl );
2237 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCXRNF"))->Fill( xrnfcls );
2238 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("TPCRCHI"))->Fill( rchi2 );
2239 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("ITSNCLS"))->Fill( itscls );
2240 ((TH1D*)((TList*)fList->FindObject("TPCRFPsel"))->FindObject("ITSRCHI"))->Fill( itsrchi2 );
2241 return kTRUE;
2242}
2243//=======================================================================
6c0d2d67 2244void AliAnalysisTaskFlowStrange::MakeQTPC(AliVEvent *tevent) {
24373b38 2245 AliESDEvent *tESD = (AliESDEvent*) (tevent);
2246 AliAODEvent *tAOD = (AliAODEvent*) (tevent);
2247 if(fReadESD) {
2248 if(!tESD) return;
6c0d2d67 2249 MakeQTPC(tESD);
24373b38 2250 } else {
2251 if(!tAOD) return;
6c0d2d67 2252 MakeQTPC(tAOD);
24373b38 2253 }
2254}
2255//=======================================================================
6c0d2d67 2256void AliAnalysisTaskFlowStrange::MakeQTPC(AliAODEvent *tAOD) {
24373b38 2257 //=>cleaning
6c0d2d67 2258 if(fUseFP) fTPCevent->ClearFast(); // flowpackage
2259 fQTPCACos=fQTPCASin=fQTPCA=fQTPC2hCos=0;
2260 fQTPCCCos=fQTPCCSin=fQTPCC=fQTPC2hSin=0;
2261 fQTPCA_nTracks = 0;
2262 fQTPCC_nTracks = 0;
24373b38 2263 Int_t rfp=0;
2264 Double_t eta, phi, w;
2265 //=>aod stuff
2266 AliAODVertex *vtx = tAOD->GetPrimaryVertex();
2267 Double_t pos[3],cov[6];
2268 vtx->GetXYZ(pos);
2269 vtx->GetCovarianceMatrix(cov);
2270 const AliESDVertex vESD(pos,cov,100.,100);
2271 AliAODTrack *track;
2272 //=>looping
2273 Int_t rawN = tAOD->GetNumberOfTracks();
2274 for(Int_t id=0; id!=rawN; ++id) {
f15c1f69 2275 track = dynamic_cast<AliAODTrack*>(tAOD->GetTrack(id));
d25cdca4 2276 if(!track) {
2277 AliFatal("Not a standard AOD");
2278 return; // shut up coverity
2279 }
24373b38 2280 //=>cuts
2281 if(!track->TestFilterBit(fRFPFilterBit)) continue;
2282 if( fExcludeTPCEdges )
2283 if( IsAtTPCEdge( track->Phi(), track->Pt(), track->Charge(), tAOD->GetMagneticField() ) ) continue;
2284 AliESDtrack etrack( track );
2285 etrack.SetTPCClusterMap( track->GetTPCClusterMap() );
2286 etrack.SetTPCSharedMap( track->GetTPCSharedMap() );
2287 etrack.SetTPCPointsF( track->GetTPCNclsF() );
2288 Float_t ip[2];
2289 etrack.GetDZ(pos[0], pos[1], pos[2], tAOD->GetMagneticField(), ip);
2290 if(!PassesRFPTPCCuts(&etrack,track->Chi2perNDF(),ip[0],ip[1])) continue;
2291 //=>collecting info
2292 phi = track->Phi();
2293 eta = track->Eta();
2294 w = 1;
6c0d2d67 2295 if(eta<0) {
2296 fQTPCCCos += w*TMath::Cos(fHarmonic*phi);
2297 fQTPCCSin += w*TMath::Sin(fHarmonic*phi);
2298 fQTPCC += w;
2299 fQTPCC_fID[fQTPCC_nTracks++] = track->GetID();
24373b38 2300 } else {
6c0d2d67 2301 fQTPCACos += w*TMath::Cos(fHarmonic*phi);
2302 fQTPCASin += w*TMath::Sin(fHarmonic*phi);
2303 fQTPCA += w;
2304 fQTPCA_fID[fQTPCA_nTracks++] = track->GetID();
24373b38 2305 }
6c0d2d67 2306 fQTPC2hCos += w*TMath::Cos(2.0*fHarmonic*phi);
2307 fQTPC2hSin += w*TMath::Sin(2.0*fHarmonic*phi);
24373b38 2308 rfp++;
6c0d2d67 2309 ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCAllPhiEta"))->Fill( phi, eta, w );
2310 if(fUseFP) PushBackFlowTrack(fTPCevent,track->Pt(),phi,eta,w,track->GetID()); // flow package
2311 }
2312 if(fUseFP) {
2313 fTPCevent->SetNumberOfRPs(rfp);
2314 if(fDebug) printf("Inserted tracks in FlowEventTPC %d ==> %.1f\n",fTPCevent->NumberOfTracks(),fQTPCA+fQTPCC);
24373b38 2315 }
24373b38 2316}
2317//=======================================================================
6c0d2d67 2318void AliAnalysisTaskFlowStrange::MakeQTPC(AliESDEvent *tESD) {
24373b38 2319 //=>cleaning
6c0d2d67 2320 if(fUseFP) fTPCevent->ClearFast(); // flow package
2321 fQTPCACos=fQTPCASin=fQTPCA=0;
2322 fQTPCCCos=fQTPCCSin=fQTPCC=0;
2323 fQTPCA_nTracks = 0;
2324 fQTPCC_nTracks = 0;
24373b38 2325 Int_t rfp=0;
2326 Double_t eta, phi, w;
2327 //=>looping
2328 AliESDtrack *track;
2329 Int_t rawN = tESD->GetNumberOfTracks();
2330 for(Int_t id=0; id!=rawN; ++id) {
2331 track = tESD->GetTrack(id);
2332 //=>cuts
2333 if( fExcludeTPCEdges )
2334 if( IsAtTPCEdge( track->Phi(), track->Pt(), track->Charge(), tESD->GetMagneticField() ) ) continue;
2335 if(!PassesFilterBit(track)) continue;
2336 if(!PassesRFPTPCCuts(track)) continue;
2337 //=>collecting info
2338 phi = track->Phi();
2339 eta = track->Eta();
2340 w = 1;
24373b38 2341 if(eta<0) {
6c0d2d67 2342 fQTPCCCos += w*TMath::Cos(fHarmonic*phi);
2343 fQTPCCSin += w*TMath::Sin(fHarmonic*phi);
2344 fQTPCC += w;
2345 fQTPCC_fID[fQTPCC_nTracks++] = track->GetID();
24373b38 2346 } else {
6c0d2d67 2347 fQTPCACos += w*TMath::Cos(fHarmonic*phi);
2348 fQTPCASin += w*TMath::Sin(fHarmonic*phi);
2349 fQTPCA += w;
2350 fQTPCA_fID[fQTPCA_nTracks++] = track->GetID();
24373b38 2351 }
24373b38 2352 rfp++;
6c0d2d67 2353 ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCAllPhiEta"))->Fill( phi, eta, w );
2354 if(fUseFP) PushBackFlowTrack(fTPCevent,track->Pt(),phi,eta,w,track->GetID()); // flowpackage
2355 }
2356 if(fUseFP) {
2357 fTPCevent->SetNumberOfRPs(rfp);
2358 if(fDebug) printf("Inserted tracks in FlowEventTPC %d ==> %.1f\n",fTPCevent->NumberOfTracks(),fQTPCA+fQTPCC);
24373b38 2359 }
24373b38 2360}
2361//=======================================================================
2362void AliAnalysisTaskFlowStrange::AddMCParticleSpy(TList *me) {
2363 TH1D *tH1D;
2364 TH2D *tH2D;
512ced40 2365 TProfile *tPro;
52476a4c 2366 tH1D = new TH1D("Pt", "Pt", fPtBins,fPtBinEdge); me->Add(tH1D);
24373b38 2367 tH1D = new TH1D("Phi", "Phi", 100,0,TMath::TwoPi()); me->Add(tH1D);
2368 tH1D = new TH1D("Eta", "Eta", 100,-1,+1); me->Add(tH1D);
52476a4c 2369 tH1D = new TH1D("Y", "Y", 100,-1,+1); me->Add(tH1D);
24373b38 2370 tH1D = new TH1D("Rad2", "Rad2", 1000,0,+100); me->Add(tH1D);
52476a4c 2371 tH2D = new TH2D("Dphi", "phi-MCEP;pt;dphi",fPtBins,fPtBinEdge, 72,0,TMath::Pi()); me->Add(tH2D);
2372 tPro = new TProfile("Cos2dphi","Cos2dphi",fPtBins,fPtBinEdge); me->Add(tPro);
24373b38 2373 return;
2374}
2375//=======================================================================
2376void AliAnalysisTaskFlowStrange::FillMCParticleSpy(TString listName, AliAODMCParticle *p) {
2377 ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Pt" ))->Fill( p->Pt() );
2378 ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Eta" ))->Fill( p->Eta() );
52476a4c 2379 ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Y" ))->Fill( p->Y() );
24373b38 2380 ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Phi" ))->Fill( p->Phi() );
2381 ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Rad2" ))->Fill( TMath::Sqrt( p->Xv()*p->Xv() +
2382 p->Yv()*p->Yv() ) );
2383 ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Dphi" ))->Fill( p->Pt(), GetMCDPHI(p->Phi()) );
512ced40 2384 ((TProfile*)((TList*)fList->FindObject(listName.Data()))->FindObject("Cos2dphi" ))->Fill( p->Pt(), TMath::Cos( 2*GetMCDPHI(p->Phi()) ), 1 );
24373b38 2385 return;
2386}
2387//=======================================================================
2388Double_t AliAnalysisTaskFlowStrange::GetMCDPHI(Double_t phi) {
2389 Double_t dDPHI = phi - fMCEP;
6c0d2d67 2390 //if( dDPHI < 0 ) dDPHI += TMath::TwoPi();
2391 //if( dDPHI > TMath::Pi() ) dDPHI = TMath::TwoPi()-dDPHI;
24373b38 2392 return dDPHI;
2393}
2394//=======================================================================
2395void AliAnalysisTaskFlowStrange::FillMCParticleSpy(TString listName, TParticle *p) {
2396 ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Pt" ))->Fill( p->Pt() );
2397 ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Eta" ))->Fill( p->Eta() );
2398 ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Phi" ))->Fill( p->Phi() );
2399 ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("Rad2" ))->Fill( TMath::Sqrt( p->Vx()*p->Vx() +
2400 p->Vy()*p->Vy() ) );
2401 return;
2402}
2403//=======================================================================
512ced40
RAB
2404void AliAnalysisTaskFlowStrange::AddCandidatesSpy(TList *me,Bool_t res) {
2405 TH1D *tH1D;
24373b38 2406 TH2D *tH2D;
512ced40
RAB
2407 TProfile *tPro;
2408 TProfile2D *tPro2;
52476a4c 2409 tH2D = new TH2D("PhiEta", "PhiEta;Phi;Eta", 100,0,TMath::TwoPi(),100,-1,+1); me->Add(tH2D);
2410 tH2D = new TH2D("PtRAP", "PtRAP;Pt;Y", fPtBins,fPtBinEdge,100,-1,+1); me->Add(tH2D);
2411 tH2D = new TH2D("PtDCA", "PtDCA;Pt;DCA", fPtBins,fPtBinEdge,100,0,1.5); me->Add(tH2D);
2412 tH2D = new TH2D("PtCTP", "PtCTP;Pt;CTP", fPtBins,fPtBinEdge,100,0.95,+1);me->Add(tH2D);
2413 tH2D = new TH2D("PtD0D0", "PtD0D0;Pt;D0D0", fPtBins,fPtBinEdge,100,-5,+5); me->Add(tH2D);
2414 tH2D = new TH2D("PtRad2", "PtRad2;Pt;RadXY",fPtBins,fPtBinEdge,100,0,+50); me->Add(tH2D);
2415 tH2D = new TH2D("PtDL", "PtDL;Pt;DL", fPtBins,fPtBinEdge,100,0,+50); me->Add(tH2D);
2416 tH2D = new TH2D("PtDLlab", "PtDL;Pt;DLlab", fPtBins,fPtBinEdge,100,0,+100); me->Add(tH2D);
2417 tH2D = new TH2D("PtMASS", "PtMASS;Pt;MASS", fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); me->Add(tH2D);
24373b38 2418 tH2D = new TH2D("APPOS", "APPOS;alphaPOS;QtPOS",100,-2,+2,100,0,0.3); me->Add(tH2D);
2419 tH2D = new TH2D("D0PD0N", "D0PD0N;D0P;D0N", 200,-10,+10,200,-10,+10); me->Add(tH2D);
2420 tH2D = new TH2D("XPOSXNEG","XPOSXNEG;XPOS;XNEG", 200,-50,+50,200,-50,+50); me->Add(tH2D);
512ced40
RAB
2421 if(fReadMC) {
2422 if(res) {
52476a4c 2423 tH1D = new TH1D("MCOrigin","MCOrigin;Rad2", 1000,0,50); me->Add(tH1D);
2424 tH2D = new TH2D("PHIRes","PHIRes;PHI;MC-DAT", 72,0,TMath::TwoPi(),100,-0.12,+0.12); me->Add(tH2D);
2425 tH2D = new TH2D("ETARes","ETARes;ETA;MC-DAT", 16,-0.8,+0.8,100,-0.2,+0.2); me->Add(tH2D);
2426 tH2D = new TH2D("PTRes", "PTRes;Pt;MC-DAT", fPtBins,fPtBinEdge,100,-0.4,+0.4); me->Add(tH2D);
2427 tH2D = new TH2D("RXYRes","RXYRes;RXY;MC-DAT", 100,0,50,100,-4.0,+4.0); me->Add(tH2D);
512ced40 2428 }
52476a4c 2429 tH2D = new TH2D("PTDPHIMC","PtDPHIMC;Pt;PHI-MCEP",fPtBins,fPtBinEdge,72,0,TMath::Pi()); me->Add(tH2D);
2430 tPro = new TProfile("Cos2dphiMC", "Cos2dphiMC",fPtBins,fPtBinEdge); me->Add(tPro);
2431 tPro2=new TProfile2D("C2DPHIMCMASS","C2DPHIMCMASS",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); me->Add(tPro2);
512ced40 2432 }
24373b38 2433 return;
2434}
2435//=======================================================================
512ced40 2436void AliAnalysisTaskFlowStrange::FillCandidateSpy(TString listName, Bool_t fillRes) {
24373b38 2437 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PhiEta"))->Fill( fDecayPhi, fDecayEta );
2438 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtRAP" ))->Fill( fDecayPt, fDecayRapidity );
2439 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtDCA" ))->Fill( fDecayPt, fDecayDCAdaughters );
2440 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtCTP" ))->Fill( fDecayPt, fDecayCosinePointingAngleXY );
2441 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtD0D0"))->Fill( fDecayPt, fDecayProductIPXY );
2442 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtRad2"))->Fill( fDecayPt, fDecayRadXY );
2443 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtDL" ))->Fill( fDecayPt, fDecayDecayLength );
52476a4c 2444 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtDLlab"))->Fill( fDecayPt, fDecayDecayLengthLab );
24373b38 2445 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PtMASS"))->Fill( fDecayPt, fDecayMass );
2446 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("APPOS" ))->Fill( fDecayAlpha, fDecayQt );
512ced40
RAB
2447 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("D0PD0N"))->Fill( fDecayIPpos, fDecayIPneg );
2448 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("XPOSXNEG"))->Fill( fDecayXpos, fDecayXneg );
2449 if(fReadMC) {
2450 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PTDPHIMC" ))->Fill( fDecayPt, GetMCDPHI( fDecayPhi ) );
2451 ((TProfile*)((TList*)fList->FindObject(listName.Data()))->FindObject("Cos2dphiMC" ))->Fill( fDecayPt, TMath::Cos( 2*GetMCDPHI(fDecayPhi) ), 1 );
512ced40
RAB
2452 ((TProfile2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("C2DPHIMCMASS" ))->Fill(fDecayPt,fDecayMass,TMath::Cos(2*GetMCDPHI(fDecayPhi)), 1 );
2453 if(fillRes) {
2454 ((TH1D*)((TList*)fList->FindObject(listName.Data()))->FindObject("MCOrigin"))->Fill( fDecayMatchOrigin );
2455 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PHIRes"))->Fill( fDecayPhi, fDecayMatchPhi-fDecayPhi );
2456 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("ETARes"))->Fill( fDecayEta, fDecayMatchEta-fDecayEta );
2457 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PTRes"))->Fill( fDecayPt, fDecayMatchPt-fDecayPt );
2458 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("RXYRes"))->Fill( fDecayRadXY, fDecayMatchRadXY-fDecayRadXY );
2459 }
2460 }
24373b38 2461}
2462//=======================================================================
2463Bool_t AliAnalysisTaskFlowStrange::AcceptCandidate() {
2464 if(fDecayEta<fDecayMinEta) return kFALSE;
2465 if(fDecayEta>fDecayMaxEta) return kFALSE;
2466 if(fDecayPt<fDecayMinPt) return kFALSE;
2467 if(fDecayProductIPXY>fDecayMaxProductIPXY) return kFALSE;
2468 if(fDecayDCAdaughters>fDecayMaxDCAdaughters) return kFALSE;
2469 if(fDecayCosinePointingAngleXY<fDecayMinCosinePointingAngleXY) return kFALSE;
2470 if(fDecayRadXY<fDecayMinRadXY) return kFALSE;
24373b38 2471 if(TMath::Abs(fDecayRapidity)>fDecayMaxRapidity) return kFALSE;
2472 if(fSpecie==0) {
2473 if(fDecayAPCutPie) {
2474 if(fDecayQt/TMath::Abs(fDecayAlpha)<fDecayMinQt) return kFALSE;
2475 } else {
2476 if(fDecayQt<fDecayMinQt) return kFALSE;
2477 }
512ced40
RAB
2478 if(fDecayDecayLength>fDecayMaxDecayLength*2.6842) return kFALSE;
2479 } else {
2480 if(fDecayDecayLength>fDecayMaxDecayLength*7.89) return kFALSE;
24373b38 2481 }
2482 if(fSpecie==1) if(fDecayAlpha>0) return kFALSE;
2483 if(fSpecie==2) if(fDecayAlpha<0) return kFALSE;
2484 return kTRUE;
2485}
2486//=======================================================================
6c0d2d67 2487void AliAnalysisTaskFlowStrange::AddTrackSpy(TList *me,Bool_t res) {
24373b38 2488 TH2D *tH2D;
52476a4c 2489 tH2D = new TH2D("PHIETA", "PHIETA;PHI;ETA", 100,0,TMath::TwoPi(),100,-2,2); me->Add(tH2D);
2490 tH2D = new TH2D("PTTRACKDECAY", "PTTRACKDECAY;PT;PT", 100,0,10,fPtBins,fPtBinEdge); me->Add(tH2D);
2491 tH2D = new TH2D("IPXYIPZ", "IPXYIPZ;IPXY;IPZ", 100,-10,+10,100,-10,+10); me->Add(tH2D);
2492 tH2D = new TH2D("PTTPCNCLS", "PTTPCNCLS;PT;NCLS", fPtBins,fPtBinEdge,170,0,170); me->Add(tH2D);
2493 tH2D = new TH2D("PTITSNCLS", "PTITSNCLS;PT;NCLS", fPtBins,fPtBinEdge,7,-0.5,6.5); me->Add(tH2D);
2494 tH2D = new TH2D("PTITSLAY", "PTITSLAY;PT;ITSLAYER", fPtBins,fPtBinEdge,6,-0.5,+5.5);me->Add(tH2D);
2495 tH2D = new TH2D("PTITSTPCrefit","PTITSTPCrefit;PT", fPtBins,fPtBinEdge,2,-0.5,+1.5);me->Add(tH2D);
512ced40
RAB
2496 tH2D->GetYaxis()->SetBinLabel(1,"ITS refit");
2497 tH2D->GetYaxis()->SetBinLabel(2,"TPC refit");
24373b38 2498 tH2D = new TH2D("POSTPCNCLCHI2","POSTPCNCLCHI2;NCLS;CHI2/NCLS", 170,0,170,100,0,8); me->Add(tH2D);
2499 tH2D = new TH2D("POSTPCNFCLNXR","POSTPCNFCLNXR;NFCLS;NXR", 170,0,170,170,0,170); me->Add(tH2D);
2500 tH2D = new TH2D("POSTPCNCLNFCL","POSTPCNCLNFCL;NCLS;NFCLS", 170,0,170,170,0,170); me->Add(tH2D);
2501 tH2D = new TH2D("POSTPCNCLNSCL","POSTPCNCLNSCL;NCLS;NSCLS", 170,0,170,170,0,170); me->Add(tH2D);
2502 tH2D = new TH2D("NEGTPCNCLCHI2","NEGTPCNCLCHI2;NCLS;CHI2/NCLS", 170,0,170,100,0,8); me->Add(tH2D);
2503 tH2D = new TH2D("NEGTPCNFCLNXR","NEGTPCNFCLNXR;NFCLS;NXR", 170,0,170,170,0,170); me->Add(tH2D);
2504 tH2D = new TH2D("NEGTPCNCLNFCL","NEGTPCNCLNFCL;NCLS;NFCLS", 170,0,170,170,0,170); me->Add(tH2D);
2505 tH2D = new TH2D("NEGTPCNCLNSCL","NEGTPCNCLNSCL;NCLS;NSCLS", 170,0,170,170,0,170); me->Add(tH2D);
6c0d2d67 2506 if(fReadMC) {
2507 TProfile *tPro;
52476a4c 2508 tPro = new TProfile("COSNDPHIMC","COSNDPHIMC",fPtBins,fPtBinEdge); me->Add(tPro);
6c0d2d67 2509 }
512ced40 2510 if(res) {
52476a4c 2511 tH2D = new TH2D("PHIRes", "PHIRes;PHI;MC-DAT", 72,0,TMath::TwoPi(),100,-0.12,+0.12); me->Add(tH2D);
2512 tH2D = new TH2D("ETARes", "ETARes;ETA;MC-DAT", 16,-0.8,+0.8,100,-0.2,+0.2); me->Add(tH2D);
2513 tH2D = new TH2D("PTRes", "PTRes;Pt;MC-DAT", fPtBins,fPtBinEdge,100,-0.4,+0.4); me->Add(tH2D);
512ced40 2514 }
24373b38 2515}
2516//=======================================================================
512ced40 2517void AliAnalysisTaskFlowStrange::FillTrackSpy(TString listName,Bool_t res) {
24373b38 2518 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PHIETA" ))->Fill( fDaughterPhi, fDaughterEta );
52476a4c 2519 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTTRACKDECAY" ))->Fill( fDaughterPt, fDecayPt );
24373b38 2520 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "IPXYIPZ" ))->Fill( fDaughterImpactParameterXY, fDaughterImpactParameterZ );
2521 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTTPCNCLS" ))->Fill( fDaughterPt, fDaughterNClsTPC );
52476a4c 2522 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSNCLS" ))->Fill( fDaughterPt, fDaughterNClsITS );
512ced40
RAB
2523 if( TESTBIT(fDaughterITScm,0) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSLAY" ))->Fill( fDaughterPt, 0 );
2524 if( TESTBIT(fDaughterITScm,1) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSLAY" ))->Fill( fDaughterPt, 1 );
2525 if( TESTBIT(fDaughterITScm,2) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSLAY" ))->Fill( fDaughterPt, 2 );
2526 if( TESTBIT(fDaughterITScm,3) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSLAY" ))->Fill( fDaughterPt, 3 );
2527 if( TESTBIT(fDaughterITScm,4) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSLAY" ))->Fill( fDaughterPt, 4 );
2528 if( TESTBIT(fDaughterITScm,5) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSLAY" ))->Fill( fDaughterPt, 5 );
2529 if( (fDaughterStatus&AliESDtrack::kITSrefit) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSTPCrefit" ))->Fill( fDaughterPt, 0 );
2530 if( (fDaughterStatus&AliESDtrack::kTPCrefit) ) ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( "PTITSTPCrefit" ))->Fill( fDaughterPt, 1 );
24373b38 2531 TString ch="NEG";
2532 if(fDaughterCharge>0) ch="POS";
2533 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( Form("%sTPCNCLCHI2",ch.Data()) ))->Fill( fDaughterNClsTPC, fDaughterChi2PerNClsTPC );
2534 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( Form("%sTPCNFCLNXR",ch.Data()) ))->Fill( fDaughterNFClsTPC, fDaughterXRows );
2535 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( Form("%sTPCNCLNFCL",ch.Data()) ))->Fill( fDaughterNClsTPC, fDaughterNFClsTPC );
2536 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject( Form("%sTPCNCLNSCL",ch.Data()) ))->Fill( fDaughterNClsTPC, fDaughterNSClsTPC );
6c0d2d67 2537 if(fReadMC) {
2538 Double_t cosn = TMath::Cos( fHarmonic*GetMCDPHI(fDaughterPhi) );
2539 ((TProfile*)((TList*)fList->FindObject(listName.Data()))->FindObject("COSNDPHIMC" ))->Fill( fDaughterPt, cosn, 1 );
2540 }
512ced40 2541 if(res) {
6c0d2d67 2542 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PHIRes"))->Fill( fDaughterPhi, fDaughterMatchPhi-fDaughterAtSecPhi );
2543 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("ETARes"))->Fill( fDaughterEta, fDaughterMatchEta-fDaughterAtSecEta );
2544 ((TH2D*)((TList*)fList->FindObject(listName.Data()))->FindObject("PTRes"))->Fill( fDaughterPt, fDaughterMatchPt-fDaughterAtSecPt );
512ced40 2545 }
24373b38 2546}
2547//=======================================================================
2548void AliAnalysisTaskFlowStrange::LoadTrack(AliESDtrack *myTrack, Double_t aodChi2NDF) {
2549 fDaughterCharge = myTrack->Charge();
2550 fDaughterXRows = myTrack->GetTPCCrossedRows();
2551 fDaughterNFClsTPC = myTrack->GetTPCNclsF();
2552 fDaughterNSClsTPC = myTrack->GetTPCnclsS();
2553 fDaughterNClsTPC = myTrack->GetTPCclusters(0);
2554 if(fReadESD) {
2555 if(fDaughterNClsTPC>0) fDaughterChi2PerNClsTPC = myTrack->GetTPCchi2()/fDaughterNClsTPC;
2556 } else {
2557 fDaughterChi2PerNClsTPC = aodChi2NDF;
2558 }
2559 myTrack->GetImpactParameters(fDaughterImpactParameterXY,fDaughterImpactParameterZ);
2560 fDaughterStatus = myTrack->GetStatus();
512ced40 2561 fDaughterITScm = myTrack->GetITSClusterMap();
24373b38 2562 fDaughterPhi = myTrack->Phi();
2563 fDaughterEta = myTrack->Eta();
2564 fDaughterPt = myTrack->Pt();
2565 fDaughterKinkIndex = myTrack->GetKinkIndex(0);
52476a4c 2566 fDaughterNClsITS=0;
2567 for(Int_t lay=0; lay!=6; ++lay)
2568 if(TESTBIT(fDaughterITScm,lay)) fDaughterNClsITS++;
24373b38 2569}
2570//=======================================================================
52476a4c 2571Bool_t AliAnalysisTaskFlowStrange::AcceptDaughter(Bool_t strongITS) {
24373b38 2572 if(fDaughterKinkIndex>0) return kFALSE;
2573 if( (fDaughterStatus&AliESDtrack::kTPCrefit)==0 ) return kFALSE;
2574 if(fDaughterNFClsTPC<1) return kFALSE;
2575 if(fDaughterPt<fDaughterMinPt) return kFALSE;
2576 if(fDaughterEta<fDaughterMinEta) return kFALSE;
2577 if(fDaughterEta>fDaughterMaxEta) return kFALSE;
2578 if(fDaughterNClsTPC<fDaughterMinNClsTPC) return kFALSE;
2579 if(fDaughterXRows<fDaughterMinXRows) return kFALSE;
2580 if(fDaughterChi2PerNClsTPC>fDaughterMaxChi2PerNClsTPC) return kFALSE;
2581 if(TMath::Abs(fDaughterImpactParameterXY)<fDaughterMinImpactParameterXY) return kFALSE;
2582 if(fDaughterXRows<fDaughterMinXRowsOverNClsFTPC*fDaughterNFClsTPC) return kFALSE;
52476a4c 2583 if(strongITS) {
2584 if( (fDaughterITSrefit) & ((fDaughterStatus&AliESDtrack::kITSrefit)==0) ) return kFALSE;
2585 for(Int_t lay=0; lay!=6; ++lay)
2586 if(fDaughterITSConfig[lay]>-0.5) {
2587 if(fDaughterITSConfig[lay]) {
2588 if(!TESTBIT(fDaughterITScm,lay)) return kFALSE;
2589 } else {
2590 if(TESTBIT(fDaughterITScm,lay)) return kFALSE;
2591 }
512ced40 2592 }
52476a4c 2593 if(fDaughterNClsITS<fDaughterMinNClsITS) return kFALSE;
2594 if(fDaughterSPDRequireAny) {
2595 if( !TESTBIT(fDaughterITScm,0)&&!TESTBIT(fDaughterITScm,1)) return kFALSE;
512ced40 2596 }
52476a4c 2597 }
24373b38 2598 return kTRUE;
2599}
2600//=======================================================================
2601Double_t AliAnalysisTaskFlowStrange::GetWDist(const AliVVertex* v0, const AliVVertex* v1) {
2602 // calculate sqrt of weighted distance to other vertex
2603 if (!v0 || !v1) {
2604 printf("One of vertices is not valid\n");
2605 return 0;
2606 }
2607 static TMatrixDSym vVb(3);
2608 double dist = -1;
2609 double dx = v0->GetX()-v1->GetX();
2610 double dy = v0->GetY()-v1->GetY();
2611 double dz = v0->GetZ()-v1->GetZ();
2612 double cov0[6],cov1[6];
2613 v0->GetCovarianceMatrix(cov0);
2614 v1->GetCovarianceMatrix(cov1);
2615 vVb(0,0) = cov0[0]+cov1[0];
2616 vVb(1,1) = cov0[2]+cov1[2];
2617 vVb(2,2) = cov0[5]+cov1[5];
2618 vVb(1,0) = vVb(0,1) = cov0[1]+cov1[1];
2619 vVb(0,2) = vVb(1,2) = vVb(2,0) = vVb(2,1) = 0.;
2620 vVb.InvertFast();
2621 if (!vVb.IsValid()) {printf("Singular Matrix\n"); return dist;}
2622 dist = vVb(0,0)*dx*dx + vVb(1,1)*dy*dy + vVb(2,2)*dz*dz
2623 + 2*vVb(0,1)*dx*dy + 2*vVb(0,2)*dx*dz + 2*vVb(1,2)*dy*dz;
2624 return dist>0 ? TMath::Sqrt(dist) : -1;
2625}
2626//=======================================================================
2627Bool_t AliAnalysisTaskFlowStrange::plpMV(const AliVEvent *event) {
2628 // check for multi-vertexer pile-up
2629 const AliAODEvent *aod = (const AliAODEvent*)event;
2630 const AliESDEvent *esd = (const AliESDEvent*)event;
2631 //
2632 const int kMinPlpContrib = 5;
2633 const double kMaxPlpChi2 = 5.0;
2634 const double kMinWDist = 15;
2635 //
2636 if (!aod && !esd) {
2637 printf("Event is neither of AOD nor ESD\n");
2638 exit(1);
2639 }
2640 //
2641 const AliVVertex* vtPrm = 0;
2642 const AliVVertex* vtPlp = 0;
2643 int nPlp = 0;
2644 //
2645 if (aod) {
2646 if ( !(nPlp=aod->GetNumberOfPileupVerticesTracks()) ) return kFALSE;
2647 vtPrm = aod->GetPrimaryVertex();
2648 if (vtPrm == aod->GetPrimaryVertexSPD()) return kTRUE; // there are pile-up vertices but no primary
2649 }
2650 else {
2651 if ( !(nPlp=esd->GetNumberOfPileupVerticesTracks())) return kFALSE;
2652 vtPrm = esd->GetPrimaryVertexTracks();
2653 if (((AliESDVertex*)vtPrm)->GetStatus()!=1) return kTRUE; // there are pile-up vertices but no primary
2654 }
2655 //int bcPrim = vtPrm->GetBC();
2656 //
2657 for (int ipl=0;ipl<nPlp;ipl++) {
2658 vtPlp = aod ? (const AliVVertex*)aod->GetPileupVertexTracks(ipl) : (const AliVVertex*)esd->GetPileupVertexTracks(ipl);
2659 //
2660 if (vtPlp->GetNContributors() < kMinPlpContrib) continue;
2661 if (vtPlp->GetChi2perNDF() > kMaxPlpChi2) continue;
2662 // int bcPlp = vtPlp->GetBC();
2663 // if (bcPlp!=AliVTrack::kTOFBCNA && TMath::Abs(bcPlp-bcPrim)>2) return kTRUE; // pile-up from other BC
2664 //
2665 double wDst = GetWDist(vtPrm,vtPlp);
2666 if (wDst<kMinWDist) continue;
2667 //
2668 return kTRUE; // pile-up: well separated vertices
2669 }
2670 //
2671 return kFALSE;
2672 //
2673}
2674//=======================================================================
2675void AliAnalysisTaskFlowStrange::MakeFilterBits() {
2676 //FilterBit 1
2677 fFB1 = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
2678 //FilterBit1024
2679 fFB1024 = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kTRUE,1);
2680 fFB1024->SetMinNCrossedRowsTPC(120);
2681 fFB1024->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
2682 fFB1024->SetMaxChi2PerClusterITS(36);
2683 fFB1024->SetMaxFractionSharedTPCClusters(0.4);
2684 fFB1024->SetMaxChi2TPCConstrainedGlobal(36);
2685 fFB1024->SetEtaRange(-0.9,0.9);
2686 fFB1024->SetPtRange(0.15, 1e10);
2687}
2688//=======================================================================
2689Bool_t AliAnalysisTaskFlowStrange::PassesFilterBit(AliESDtrack *track) {
2690 Bool_t ret=kFALSE;
2691 switch(fRFPFilterBit) {
2692 case(1024):
2693 ret = fFB1024->AcceptTrack(track);
2694 break;
2695 default:
2696 ret = fFB1->AcceptTrack(track);
2697 }
2698 return ret;
2699}
2700//=======================================================================
2701void AliAnalysisTaskFlowStrange::LoadVZEROResponse() {
2702 if(fVZEResponse) {
2703 TString run = fVZEResponse->GetTitle();
2704 if( run.Atoi() == fRunNumber ) return;
2705 fVZEResponse = NULL;
2706 }
2707 //==>loading
2708 fVZEResponse = dynamic_cast<TH2D*> (fVZEload->FindObject( Form("%d",fRunNumber) ));
2709 if(fVZEResponse) {
2710 printf("New VZE calibration: run %d || %s -> Entries %.0f\n",fRunNumber, fVZEResponse->GetTitle(),fVZEResponse->GetEntries());
52476a4c 2711 //=>external weights
2712 for(int i=0;i!=64;++i) fVZEextW[i]=1;
2713 if(!fVZEsave) {
2714 Double_t minC = fCentPerMin, maxC = fCentPerMax;
2715 if(fVZEmb) {
2716 minC = 0;
2717 maxC = 80;
2718 }
2719 Int_t ybinmin = fVZEResponse->GetYaxis()->FindBin(minC+1e-6);
2720 Int_t ybinmax = fVZEResponse->GetYaxis()->FindBin(maxC-1e-6);
2721 if(fSkipCentralitySelection) {
2722 ybinmin=-1;
2723 ybinmax=-1;
2724 }
2725 for(int i=0;i!=64;++i) fVZEextW[i] = fVZEResponse->Integral(i+1,i+1,ybinmin,ybinmax)/(maxC-minC);
2726 //ring-wise normalization
2727 Double_t ring[8];
2728 for(int j=0; j!=8; ++j) {
2729 ring[j]=0;
2730 for(int i=0;i!=8;++i) ring[j] += fVZEextW[j*8+i]/8;
2731 }
2732 //disk-wise normalization
2733 Double_t disk[2];
2734 int xbinmin, xbinmax;
2735 xbinmin = 1+8*fVZECa;
2736 xbinmax = 8+8*fVZECb;
2737 disk[0] = fVZEResponse->Integral(xbinmin,xbinmax,ybinmin,ybinmax)/(maxC-minC)/(xbinmax-xbinmin+1);
2738 xbinmin = 33+8*fVZEAa;
2739 xbinmax = 40+8*fVZEAb;
2740 disk[1] = fVZEResponse->Integral(xbinmin,xbinmax,ybinmin,ybinmax)/(maxC-minC)/(xbinmax-xbinmin+1);
2741 //for(int i=0;i!=64;++i) printf("CELL %d -> W = %f ||",i,fVZEextW[i]);
2742 if(fVZEByDisk) {
2743 for(int i=0;i!=64;++i) fVZEextW[i] = disk[i/32]/fVZEextW[i];
2744 } else {
2745 for(int i=0;i!=64;++i) fVZEextW[i] = ring[i/8]/fVZEextW[i];
2746 }
2747 //for(int i=0;i!=64;++i) printf(" W = %f \n",fVZEextW[i]);
2748 }
24373b38 2749 } else {
6c0d2d67 2750 printf("VZE calibration: requested but not found!!!\n");
24373b38 2751 }
2752}
2753//=======================================================================
2754void AliAnalysisTaskFlowStrange::AddVZEQA() {
52476a4c 2755 TProfile2D *prof;
2756 TH2D *tH2D;
2757 TList *tList = new TList();
2758 tList->SetName( "VZEQA" );
2759 tList->SetOwner();
2760 fList->Add( tList );
2761 tH2D = new TH2D("EQU","EQU;VZEeqmult-VZEmult;cell",100,-5,+5,64,0,64); tList->Add( tH2D );
2762 prof = new TProfile2D("LINbefCAL","LINbef;VZEcell;VZEeqmult;SPDtrkl", 64,0,64,350,0,700,0,10000); tList->Add( prof );
2763 prof = new TProfile2D("LINaftCAL","LINaft;VZEcell;VZEeqmult;SPDtrkl", 64,0,64,350,0,700,0,10000); tList->Add( prof );
2764}
2765//=======================================================================
2766void AliAnalysisTaskFlowStrange::FillVZEQA() {
2767 AliESDEvent *tESD = (AliESDEvent*) (InputEvent());
2768 AliAODEvent *tAOD = (AliAODEvent*) (InputEvent());
2769 if(fReadESD) {
2770 if(!tESD) return;
2771 //FillVZEQA(tESD);
2772 } else {
2773 if(!tAOD) return;
2774 FillVZEQA(tAOD);
24373b38 2775 }
24373b38 2776}
2777//=======================================================================
52476a4c 2778void AliAnalysisTaskFlowStrange::FillVZEQA(AliAODEvent *tAOD) {
2779 AliVVZERO *vzero = tAOD->GetVZEROData();
2780 AliAODTracklets *tracklets = tAOD->GetTracklets();
24373b38 2781 if(!vzero) return;
2782 if(!tracklets) return;
2783 Double_t mult, eqmult;
52476a4c 2784 Int_t trkl = tracklets->GetNumberOfTracklets();
24373b38 2785 for(int id=0; id!=64; ++id) {
24373b38 2786 mult = vzero->GetMultiplicity(id);
52476a4c 2787 eqmult = tAOD->GetVZEROEqMultiplicity(id);
2788 ((TH2D*) ((TList*) fList->FindObject("VZEQA"))->FindObject("EQU"))->Fill(eqmult-mult,id);
2789 ((TProfile2D*) ((TList*) fList->FindObject("VZEQA"))->FindObject( "LINbefCAL" ))->Fill(id,eqmult,trkl,1);
2790 ((TProfile2D*) ((TList*) fList->FindObject("VZEQA"))->FindObject( "LINaftCAL" ))->Fill(id,eqmult*fVZEextW[id],trkl,1);
24373b38 2791 }
2792}
2793//=======================================================================
2794void AliAnalysisTaskFlowStrange::AddVZEROResponse() {
2795 fVZEResponse = NULL;
2796 AliVEvent *event = InputEvent();
2797 if(!event) return;
2798 Int_t thisrun = event->GetRunNumber();
6c0d2d67 2799 fVZEResponse = new TH2D( Form("%d",thisrun), Form("%d;cell;CC",thisrun), 64,0,64, 110, -10, 100);
24373b38 2800 fList->Add(fVZEResponse);
2801}
2802//=======================================================================
2803void AliAnalysisTaskFlowStrange::SaveVZEROResponse() {
2804 if(!fVZEResponse) return;
2805 AliVEvent *event = InputEvent();
2806 if(!event) return;
2807 Double_t w;
52476a4c 2808 // reject event with low ocupancy in VZERO
2809 // for centralities below 60% this should not happen anyway
2810 Double_t rejectEvent = kFALSE;
2811 for(int id=0; id!=64; ++id) {
2812 w = event->GetVZEROEqMultiplicity(id);
2813 if(w<3) rejectEvent = kTRUE;
2814 }
2815 if(rejectEvent) return;
2816 // saves weights
24373b38 2817 for(int id=0; id!=64; ++id) {
2818 w = event->GetVZEROEqMultiplicity(id);
2819 fVZEResponse->Fill(id,fThisCent,w);
2820 }
2821}
2822//=======================================================================
6c0d2d67 2823Int_t AliAnalysisTaskFlowStrange::RefMult(AliAODEvent *tAOD, Int_t fb) {
2824 Int_t found = 0;
2825 for(int i=0; i!=tAOD->GetNumberOfTracks(); ++i) {
f15c1f69 2826 AliAODTrack *t = dynamic_cast<AliAODTrack*>(tAOD->GetTrack( i ));
6c0d2d67 2827 if(!t) continue;
2828 if( !t->TestFilterBit(fb) ) continue;
2829 if( t->Eta()<-0.8 || t->Eta()>+0.8 ) continue;
2830 if( t->Pt()<0.2 || t->Pt()>5.0 ) continue;
2831 if( t->GetTPCNcls()<70 ) continue;
2832 //if( t->GetTPCsignal()<10.0 ) continue;
2833 if( t->Chi2perNDF()<0.2 ) continue;
2834 ++found;
2835 }
2836 return found;
2837}
2838//=======================================================================
24373b38 2839Int_t AliAnalysisTaskFlowStrange::RefMultTPC() {
2840 AliAODEvent *ev = dynamic_cast<AliAODEvent*> (InputEvent());
2841 if(!ev) return -1;
2842 Int_t found = 0;
2843 for(int i=0; i!=ev->GetNumberOfTracks(); ++i) {
f15c1f69 2844 AliAODTrack *t = dynamic_cast<AliAODTrack*>(ev->GetTrack( i ));
24373b38 2845 if(!t) continue;
2846 if( !t->TestFilterBit(1) ) continue;
2847 if( t->Eta()<-0.8 || t->Eta()>+0.8 ) continue;
2848 if( t->Pt()<0.2 || t->Pt()>5.0 ) continue;
2849 if( t->GetTPCNcls()<70 ) continue;
2850 if( t->GetTPCsignal()<10.0 ) continue;
2851 if( t->Chi2perNDF()<0.2 ) continue;
2852 ++found;
2853 }
2854 return found;
2855}
2856//=======================================================================
2857Int_t AliAnalysisTaskFlowStrange::RefMultGlobal() {
2858 AliAODEvent *ev = dynamic_cast<AliAODEvent*> (InputEvent());
2859 if(!ev) return -1;
2860 Int_t found = 0;
2861 for(int i=0; i!=ev->GetNumberOfTracks(); ++i) {
f15c1f69 2862 AliAODTrack *t = dynamic_cast<AliAODTrack*>(ev->GetTrack( i ));
24373b38 2863 if(!t) continue;
2864 if( !t->TestFilterBit(16) ) continue;
2865 if( t->Eta()<-0.8 || t->Eta()>+0.8 ) continue;
2866 if( t->Pt()<0.2 || t->Pt()>5.0 ) continue;
2867 if( t->GetTPCNcls()<70 ) continue;
2868 if( t->GetTPCsignal()<10.0 ) continue;
2869 if( t->Chi2perNDF()<0.1 ) continue;
2870 Double_t b[3], bcov[3];
2871 if( !t->PropagateToDCA(ev->GetPrimaryVertex(),ev->GetMagneticField(),100,b,bcov) ) continue;
2872 if( b[0]>+0.3 || b[0]<-0.3 || b[1]>+0.3 || b[1]<-0.3) continue;
2873 ++found;
2874 }
2875 return found;
2876}
2877//=======================================================================
6c0d2d67 2878void AliAnalysisTaskFlowStrange::ResetContainers() {
2879 if(fUseFP) {
2880 fTPCevent->ClearFast();
2881 fVZEevent->ClearFast();
2882 }
2883}
2884//=======================================================================
2885void AliAnalysisTaskFlowStrange::AddTrackVn(TList *tList) {
2886 TProfile *tProfile;
2887 TH1D *tH1D;
6c0d2d67 2888 // vze
52476a4c 2889 tProfile = new TProfile("SP_uVZEA","u x Q_{VZEA}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2890 tProfile = new TProfile("SP_uVZEC","u x Q_{VZEC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2891 tProfile = new TProfile("SP_VZEAVZEC","Q_{VZEA} x Q_{VZEC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2892 tProfile = new TProfile("SP_VZEATPC","Q_{VZEA} x Q_{TPC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2893 tProfile = new TProfile("SP_VZECTPC","Q_{VZEC} x Q_{TPC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2894 // error
52476a4c 2895 tProfile = new TProfile("SP_uVZEAuVZEC","u x Q_{VZEA} . u x Q_{VZEC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2896 tProfile = new TProfile("SP_uVZEAVZEAVZEC","u x Q_{VZEA} . Q_{VZEA} x Q_{VZEC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2897 tProfile = new TProfile("SP_uVZECVZEAVZEC","u x Q_{VZEC} . Q_{VZEA} x Q_{VZEC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2898 // tpc
52476a4c 2899 tProfile = new TProfile("SP_uTPCA","u x Q_{TPCA}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2900 tProfile = new TProfile("SP_uTPCC","u x Q_{TPCC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2901 tProfile = new TProfile("SP_TPCATPCC","Q_{TPCA} x Q_{TPCC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2902 // error
52476a4c 2903 tProfile = new TProfile("SP_uTPCATPCATPCC","u x Q_{TPCA} . Q_{TPCA} x Q_{TPCC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2904 tProfile = new TProfile("SP_uTPCCTPCATPCC","u x Q_{TPCC} . Q_{TPCA} x Q_{TPCC}",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2905 // control
52476a4c 2906 tH1D = new TH1D("QC_HistPt_P","HistPt_P",fPtBins,fPtBinEdge); tList->Add( tH1D );
2907 tH1D = new TH1D("QC_HistPt_Q","HistPt_Q",fPtBins,fPtBinEdge); tList->Add( tH1D );
6c0d2d67 2908 // qc
52476a4c 2909 tProfile = new TProfile("QC_C2","QC_C2",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2910 tProfile = new TProfile("QC_C4","QC_C4",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2911 tProfile = new TProfile("QC_DC2","QC_DC2",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2912 tProfile = new TProfile("QC_DC4","QC_DC4",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2913 tProfile = new TProfile("QC_C2C4","QC_C2C4",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2914 tProfile = new TProfile("QC_C2DC2","QC_C2DC2",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2915 tProfile = new TProfile("QC_C2DC4","QC_C2DC4",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2916 tProfile = new TProfile("QC_C4DC2","QC_C4DC2",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2917 tProfile = new TProfile("QC_C4DC4","QC_C4DC4",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2918 tProfile = new TProfile("QC_DC2DC4","QC_DC2DC4",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2919 // qc transient
52476a4c 2920 tProfile = new TProfile("QC_pCos","QC_pCos",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2921 tProfile = new TProfile("QC_pSin","QC_pSin",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2922 tProfile = new TProfile("QC_qCos","QC_qCos",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2923 tProfile = new TProfile("QC_qSin","QC_qSin",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2924 tProfile = new TProfile("QC_q2hCos","QC_q2hCos",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2925 tProfile = new TProfile("QC_q2hSin","QC_q2hSin",fPtBins,fPtBinEdge,-3,+3,"s"); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2926 // measurements
52476a4c 2927 tH1D = new TH1D("SP_vnVZEA","SP_vnVZEA",fPtBins,fPtBinEdge); tList->Add( tH1D );
2928 tH1D = new TH1D("SP_vnVZEC","SP_vnVZEC",fPtBins,fPtBinEdge); tList->Add( tH1D );
2929 tH1D = new TH1D("SP_vnTPCA","SP_vnTPCA",fPtBins,fPtBinEdge); tList->Add( tH1D );
2930 tH1D = new TH1D("SP_vnTPCC","SP_vnTPCC",fPtBins,fPtBinEdge); tList->Add( tH1D );
2931 tH1D = new TH1D("QC_Cum2","QC_Cum2",fPtBins,fPtBinEdge); tList->Add( tH1D );
2932 tH1D = new TH1D("QC_Cum4","QC_Cum4",fPtBins,fPtBinEdge); tList->Add( tH1D );
2933 tH1D = new TH1D("QC_DCum2","QC_DCum2",fPtBins,fPtBinEdge); tList->Add( tH1D );
2934 tH1D = new TH1D("QC_DCum4","QC_DCum4",fPtBins,fPtBinEdge); tList->Add( tH1D );
2935 tH1D = new TH1D("SP_vnVZEGA","SP_vnVZEGA",fPtBins,fPtBinEdge); tList->Add( tH1D );
2936 tH1D = new TH1D("SP_vnVZEWA","SP_vnVZEWA",fPtBins,fPtBinEdge); tList->Add( tH1D );
2937 tH1D = new TH1D("SP_vnTPCAA","SP_vnTPCAA",fPtBins,fPtBinEdge); tList->Add( tH1D );
2938 tH1D = new TH1D("QC_vn2","QC_vn2",fPtBins,fPtBinEdge); tList->Add( tH1D );
2939 tH1D = new TH1D("QC_vn4","QC_vn4",fPtBins,fPtBinEdge); tList->Add( tH1D );
6c0d2d67 2940 if(fReadMC) {
2941 TH2D *tH2D;
52476a4c 2942 tProfile = new TProfile("MC_COSNDPHI","MC_COSNDPHI",fPtBins,fPtBinEdge,-3,+3); tList->Add( tProfile );
6c0d2d67 2943 tH2D = new TH2D("MC_COSNDPHI_uQVZEA","MC_COSNDPHI_uQVZEA",100,-1,+1,100,-0.3,+0.3); tList->Add( tH2D );
2944 tH2D = new TH2D("MC_COSNDPHI_uQVZEC","MC_COSNDPHI_uQVZEC",100,-1,+1,100,-0.3,+0.3); tList->Add( tH2D );
2945 tH2D = new TH2D("MC_COSNDPHI_uQTPCA","MC_COSNDPHI_uQTPCA",100,-1,+1,100,-0.3,+0.3); tList->Add( tH2D );
2946 tH2D = new TH2D("MC_COSNDPHI_uQTPCC","MC_COSNDPHI_uQTPCC",100,-1,+1,100,-0.3,+0.3); tList->Add( tH2D );
2947 }
2948}
2949//=======================================================================
2950void AliAnalysisTaskFlowStrange::AddDecayVn(TList *tList) {
2951 TProfile2D *tProfile;
2952 TH2D *tH2D;
52476a4c 2953 // decay
2954 tH2D = new TH2D("DecayYield_PtMass","Decay_PtMass",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
2955 tProfile = new TProfile2D("DecayAvgPt_PtMass","Decay_PtMass",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2956 // vze
52476a4c 2957 tProfile = new TProfile2D("SP_uVZEA","u x Q_{VZEA}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2958 tProfile = new TProfile2D("SP_uVZEC","u x Q_{VZEC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2959 tProfile = new TProfile2D("SP_VZEAVZEC","Q_{VZEA} x Q_{VZEC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2960 tProfile = new TProfile2D("SP_VZEATPC","Q_{VZEA} x Q_{TPC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2961 tProfile = new TProfile2D("SP_VZECTPC","Q_{VZEC} x Q_{TPC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2962 // error
52476a4c 2963 tProfile = new TProfile2D("SP_uVZEAuVZEC","u x Q_{VZEA} . u x Q_{VZEC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2964 tProfile = new TProfile2D("SP_uVZEAVZEAVZEC","u x Q_{VZEA} . Q_{VZEA} x Q_{VZEC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2965 tProfile = new TProfile2D("SP_uVZECVZEAVZEC","u x Q_{VZEC} . Q_{VZEA} x Q_{VZEC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2966 // tpc
52476a4c 2967 tProfile = new TProfile2D("SP_uTPCA","u x Q_{TPCA}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2968 tProfile = new TProfile2D("SP_uTPCC","u x Q_{TPCC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2969 tProfile = new TProfile2D("SP_TPCATPCC","Q_{TPCA} x Q_{TPCC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2970 // error
52476a4c 2971 tProfile = new TProfile2D("SP_uTPCATPCATPCC","u x Q_{TPCA} . Q_{TPCA} x Q_{TPCC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2972 tProfile = new TProfile2D("SP_uTPCCTPCATPCC","u x Q_{TPCC} . Q_{TPCA} x Q_{TPCC}",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2973 // control
52476a4c 2974 tH2D = new TH2D("QC_HistPt_P","HistPt_P",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
2975 tH2D = new TH2D("QC_HistPt_Q","HistPt_Q",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
6c0d2d67 2976 // qc
52476a4c 2977 tProfile = new TProfile2D("QC_C2","QC_C2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2978 tProfile = new TProfile2D("QC_C4","QC_C4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2979 tProfile = new TProfile2D("QC_DC2","QC_DC2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2980 tProfile = new TProfile2D("QC_DC4","QC_DC4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2981 tProfile = new TProfile2D("QC_C2C4","QC_C2C4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2982 tProfile = new TProfile2D("QC_C2DC2","QC_C2DC2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2983 tProfile = new TProfile2D("QC_C2DC4","QC_C2DC4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2984 tProfile = new TProfile2D("QC_C4DC2","QC_C4DC2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2985 tProfile = new TProfile2D("QC_C4DC4","QC_C4DC4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2986 tProfile = new TProfile2D("QC_DC2DC4","QC_DC2DC4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2987 // qc transient
52476a4c 2988 tProfile = new TProfile2D("QC_pCos","QC_pCos",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2989 tProfile = new TProfile2D("QC_pSin","QC_pSin",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2990 tProfile = new TProfile2D("QC_qCos","QC_qCos",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2991 tProfile = new TProfile2D("QC_qSin","QC_qSin",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2992 tProfile = new TProfile2D("QC_q2hCos","QC_q2hCos",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
2993 tProfile = new TProfile2D("QC_q2hSin","QC_q2hSin",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass,"s"); tList->Add( tProfile ); tProfile->Sumw2();
6c0d2d67 2994 // measurements
52476a4c 2995 tH2D = new TH2D("SP_vnVZEA","SP_vnVZEA",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
2996 tH2D = new TH2D("SP_vnVZEC","SP_vnVZEC",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
2997 tH2D = new TH2D("SP_vnTPCA","SP_vnTPCA",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
2998 tH2D = new TH2D("SP_vnTPCC","SP_vnTPCC",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
2999 tH2D = new TH2D("QC_Cum2","QC_Cum2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
3000 tH2D = new TH2D("QC_Cum4","QC_Cum4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
3001 tH2D = new TH2D("QC_DCum2","QC_DCum2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
3002 tH2D = new TH2D("QC_DCum4","QC_DCum4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
3003 tH2D = new TH2D("SP_vnVZEGA","SP_vnVZEGA",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
3004 tH2D = new TH2D("SP_vnVZEWA","SP_vnVZEWA",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
3005 tH2D = new TH2D("SP_vnTPCAA","SP_vnTPCAA",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
3006 tH2D = new TH2D("QC_vn2","QC_vn2",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
3007 tH2D = new TH2D("QC_vn4","QC_vn4",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tH2D );
3008 if(fReadMC) {
3009 tProfile = new TProfile2D("MC_COSNDPHI","MC_COSNDPHI",fPtBins,fPtBinEdge,fMassBins,fMinMass,fMaxMass); tList->Add( tProfile );
3010 }
3011}
3012//=======================================================================
3013TList* AliAnalysisTaskFlowStrange::RebinDecayVn(Int_t nbins, Int_t *bins) {
3014 TList *out = new TList();
3015 out->SetOwner();
3016 out->SetName( fList->GetName() );
3017
3018 TList *ori, *end;
3019
3020 ori = (TList*) fList->FindObject("Event");
3021 out->Add( ori );
3022
3023 ori = (TList*) fList->FindObject("MakeQSpy");
3024 out->Add( ori );
3025
3026 ori = (TList*) fList->FindObject("V0SAllVn");
3027 end = RebinDecayVn(ori,nbins,bins);
3028 end->SetName( ori->GetName() ); out->Add( end );
3029
3030 ori = (TList*) fList->FindObject("V0SSelVn");
3031 end = RebinDecayVn(ori,nbins,bins);
3032 end->SetName( ori->GetName() ); out->Add( end );
3033
6c0d2d67 3034 if(fReadMC) {
52476a4c 3035 ori = (TList*) fList->FindObject("V0SMthVn");
3036 end = RebinDecayVn(ori,nbins,bins);
3037 end->SetName( ori->GetName() ); out->Add( end );
3038
3039 ori = (TList*) fList->FindObject("V0SMthPosPosVn");
3040 end = RebinDecayVn(ori,nbins,bins);
3041 end->SetName( ori->GetName() ); out->Add( end );
3042
3043 ori = (TList*) fList->FindObject("V0SMthNegNegVn");
3044 end = RebinDecayVn(ori,nbins,bins);
3045 end->SetName( ori->GetName() ); out->Add( end );
3046
3047 ori = (TList*) fList->FindObject("V0SMthPosNegVn");
3048 end = RebinDecayVn(ori,nbins,bins);
3049 end->SetName( ori->GetName() ); out->Add( end );
3050
3051 ori = (TList*) fList->FindObject("V0SUnMthVn");
3052 end = RebinDecayVn(ori,nbins,bins);
3053 end->SetName( ori->GetName() ); out->Add( end );
6c0d2d67 3054 }
52476a4c 3055
3056 return out;
3057}
3058//=======================================================================
3059TList* AliAnalysisTaskFlowStrange::RebinDecayVn(TList *tList,Int_t nbins, Int_t *bins) {
3060 // getting expected number of mass bins
3061 int sum=0;
3062 for(int i=0; i!=nbins; ++i) sum += bins[i];
3063
3064 TList *list = new TList();
3065 list->SetOwner();
3066
3067 Int_t npt;
3068 Double_t pt[200], mass[200];
3069 TH2D *tH2D;
3070
3071 tH2D = ((TH2D*)tList->FindObject( "DecayYield_PtMass" ));
3072 list->Add(tH2D); //keeping it as it is
3073 int nmassbins = tH2D->GetNbinsY();
3074 //consistency check
3075 if( nmassbins!=sum ) {
3076 printf("Error: incompatible binning %d vs %d\nBYE\n",nmassbins,sum);
3077 return NULL;
3078 }
3079 //reading pts
3080 npt = tH2D->GetNbinsX();
3081 for(int i=0; i!=npt+1; ++i) pt[i] = tH2D->GetXaxis()->GetBinLowEdge(i+1);
3082 //making mass bins
3083 for(int i=0,j=0; i!=nbins+1; ++i) {
3084 mass[i] = tH2D->GetYaxis()->GetBinLowEdge(j+1);
3085 j += bins[i];
3086 }
3087 //TProfile2D migrating info
3088 TProfile2D *tProfileOld, *tProfileNew;
3089 TString tprofiles[31] = {"DecayAvgPt_PtMass","SP_uVZEA","SP_uVZEC","SP_VZEAVZEC","SP_VZEATPC",
3090 "SP_VZECTPC","SP_uVZEAuVZEC","SP_uVZEAVZEAVZEC","SP_uVZECVZEAVZEC","SP_uTPCA",
3091 "SP_uTPCC","SP_TPCATPCC","SP_uTPCATPCATPCC","SP_uTPCCTPCATPCC","QC_C2",
3092 "QC_C4","QC_DC2","QC_DC4","QC_C2C4","QC_C2DC2",
3093 "QC_C2DC4","QC_C4DC2","QC_C4DC4","QC_DC2DC4","QC_pCos",
3094 "QC_pSin","QC_qCos","QC_qSin","QC_q2hCos","QC_q2hSin",
3095 "MC_COSNDPHI"};
3096 for(int i=0; i!=31; ++i) {
3097 tProfileOld = (TProfile2D*) tList->FindObject( tprofiles[i].Data() );
3098 if(!tProfileOld) continue;
3099 TArrayD *oldsw2 = tProfileOld->GetSumw2();
3100 TArrayD *oldbsw2 = tProfileOld->GetBinSumw2();
3101 tProfileNew = new TProfile2D( tprofiles[i].Data(), tprofiles[i].Data(),
3102 npt,pt,nbins,mass,"s");
3103 tProfileNew->Sumw2();
3104 list->Add( tProfileNew );
3105 TArrayD *newsw2 = tProfileNew->GetSumw2();
3106 TArrayD *newbsw2 = tProfileNew->GetBinSumw2();
3107 for(int x=1; x!=tProfileOld->GetNbinsX()+1; ++x) { //pt
3108 for(int y=1; y!=tProfileNew->GetNbinsY()+1; ++y) { //mass
3109 Double_t sContent=0;
3110 Double_t sEntries=0;
3111 Double_t sSqWeigh=0;
3112 Double_t sSqBWeig=0;
3113 Int_t binnew = tProfileNew->GetBin(x,y);
3114 Double_t minmass = tProfileNew->GetYaxis()->GetBinLowEdge( y );
3115 Double_t maxmass = tProfileNew->GetYaxis()->GetBinLowEdge( y+1 );
3116 Int_t minbin = tProfileOld->GetYaxis()->FindBin( minmass+1e-10 );
3117 Int_t maxbin = tProfileOld->GetYaxis()->FindBin( maxmass-1e-10 );
3118 for(int k=minbin; k!=maxbin+1; ++k) {
3119 Int_t binold = tProfileOld->GetBin(x,k);
3120 Double_t wk = tProfileOld->GetBinEntries( binold );
3121 Double_t yk = tProfileOld->GetBinContent( binold );
3122 sEntries += wk;
3123 sContent += wk*yk;
3124 sSqWeigh += oldsw2->At(binold);
3125 if(oldbsw2->GetSize()) sSqBWeig += oldbsw2->At(binold);
3126 }
3127 tProfileNew->SetBinEntries( binnew, sEntries );
3128 tProfileNew->SetBinContent( binnew, sContent );
3129 newsw2->SetAt(sSqWeigh, binnew);
3130 if(oldbsw2->GetSize()) newbsw2->SetAt(sSqBWeig, binnew);
3131 }
3132 }
3133 tProfileOld = NULL;
3134 }
3135 //TH2D all new blank
3136 TString th2ds[15] = {"QC_HisPt_P","QC_HistPt_Q","SP_vnVZEA","SP_vnVZEC","SP_vnTPCA",
3137 "SP_vnTPCC","QC_Cum2","QC_Cum4","QC_DCum2","QC_DCum4",
3138 "SP_vnVZEGA","SP_vnVZEWA","SP_vnTPCAA","QC_vn2","QC_vn4"};
3139 for(int i=0; i!=15; ++i) {
3140 tH2D = new TH2D( th2ds[i].Data(),th2ds[i].Data(),
3141 npt,pt,nbins,mass);
3142 list->Add(tH2D);
3143 }
3144 return list;
3145
3146 //int nmass = tH2Dold->GetNbinsY();
3147
3148 /*
3149 // decay
3150 TString nam[38] = {
3151 for(int i=0; i!=38; ++i) {
3152 tProfile = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( nam[i].Data() ));
3153 if(i==o) { // binning
3154 nxs = tProfile->GetXaxis()->GetNbins();
3155 nys = tProfile->GetYaxis()->GetNbins();
3156 if(pt) {
3157 nxs = nbins;
3158 *nx = *bins;
3159 for(int y=0; y!=nys; ++y)
3160 ny[y] = tProfile->GetYaxis()->GetBinLowEdge(y+1);
3161 } else {
3162 nys = nbins;
3163 *ny = *bins;
3164 for(int x=0; x!=nxs; ++x)
3165 nx[x] = tProfile->GetXaxis()->GetBinLowEdge(x+1);
3166 }
3167 }
3168 tProfileNew = new TProfile2D(tProfile->GetName(),tProfile->GetTitle(),nxs,nx,nys,ny,"s"); list->Add( tProfileNew );
3169 if(pt) {
3170 for(int y=0; y!=nys; ++y) {
3171
3172 for(int x=0; x!=nxs; ++x) {
3173 }
3174 }
3175 } else {
3176
3177 }
3178 }
3179 */
6c0d2d67 3180}
3181//=======================================================================
3182void AliAnalysisTaskFlowStrange::QCStoreTrackVn(TString name) {
3183 // getting transients
3184 TProfile *pCos = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pCos" ));
3185 TProfile *pSin = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pSin" ));
3186 TProfile *qCos = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qCos" ));
3187 TProfile *qSin = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qSin" ));
3188 TProfile *q2hCos = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hCos" ));
3189 TProfile *q2hSin = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hSin" ));
3190 if(fDebug) {
3191 printf("**QCStoreTrackVn( %s )\n",name.Data());
3192 printf(" Read %.0f entries in p set and %.0f entries in q set\n",pCos->GetEntries(),qCos->GetEntries());
3193 printf(" pCos[5] %.16f | pSin[5] %.16f \n", pCos->GetBinContent(5), pSin->GetBinContent(5));
3194 printf(" qCos[5] %.16f | qSin[5] %.16f \n", qCos->GetBinContent(5), qSin->GetBinContent(5));
3195 printf(" q2hCos[5] %.16f | q2hSin[5] %.16f \n", q2hCos->GetBinContent(5), q2hSin->GetBinContent(5));
3196 }
3197 // filling {2} and {4} correlator
3198 TProfile *c2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2" ));
3199 TProfile *c4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4" ));
3200 TProfile *dc2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2" ));
3201 TProfile *dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC4" ));
3202 TProfile *c2c4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2C4" ));
3203 TProfile *c2dc2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC2" ));
3204 TProfile *c2dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC4" ));
3205 TProfile *c4dc2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC2" ));
3206 TProfile *c4dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC4" ));
3207 TProfile *dc2dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2DC4" ));
3208 double tpc_qcos = fQTPCACos + fQTPCCCos;
3209 double tpc_qsin = fQTPCASin + fQTPCCSin;
3210 double tpc_qsqr = tpc_qcos*tpc_qcos + tpc_qsin*tpc_qsin;
3211 double tpc_q2hsqr = fQTPC2hCos*fQTPC2hCos + fQTPC2hSin*fQTPC2hSin;
3212 double tpc_qmul = fQTPCA + fQTPCC;
3213 int n = c2->GetNbinsX();
3214 for(int i=1; i!=n+1; ++i) {
3215 double mp = pCos->GetBinEntries( i );
3216 if( mp<1 ) { if(fDebug>2) printf(" bin %d:: mp (%.16f) < 1!\n",i,mp); continue; }
3217 double mm1 = tpc_qmul*(tpc_qmul-1);
3218 if( mm1<1e-100 ) { if(fDebug>2) printf(" bin %d:: mm1<1e-100!\n",i); continue; }
3219 double mq = qCos->GetBinEntries( i );
3220 double mpmmq = mp*tpc_qmul-mq;
3221 if( mpmmq<1e-100 ) { if(fDebug>2) printf(" bin %d:: mpmmq<1e-100!\n",i); continue; }
3222 double pt = c2->GetBinCenter( i );
3223 double pcos = pCos->GetBinContent( i )*mp;
3224 double psin = pSin->GetBinContent( i )*mp;
3225 double qcos = qCos->GetBinContent( i )*mq;
3226 double qsin = qSin->GetBinContent( i )*mq;
3227 double q2hcos = q2hCos->GetBinContent( i )*mq;
3228 double q2hsin = q2hSin->GetBinContent( i )*mq;
3229 double pQ = pcos*tpc_qcos+psin*tpc_qsin;
3230 double q2nQnQn = (qcos*tpc_qcos + qsin*tpc_qsin)*tpc_qcos + (qsin*tpc_qcos-qcos*tpc_qsin)*tpc_qsin;
3231 double pnQnQ2n = (pcos*tpc_qcos - psin*tpc_qsin)*fQTPC2hCos + (psin*tpc_qcos+pcos*tpc_qsin)*fQTPC2hSin;
3232 double tC2 = (tpc_qsqr-tpc_qmul)/mm1;
3233 double tDC2 = (pQ-mq)/mpmmq;
3234 c2->Fill( pt, tC2, mm1 );
3235 dc2->Fill( pt, tDC2, mpmmq );
3236 c2dc2->Fill( pt, tC2*tDC2, mm1*mpmmq );
3237 double mm1m2m3 = tpc_qmul*(tpc_qmul-1)*(tpc_qmul-2)*(tpc_qmul-3);
3238 if(mm1m2m3<1e-100) continue;
3239 double mpm3mqm1m2 = (mp*tpc_qmul-3*mq)*(tpc_qmul-1)*(tpc_qmul-2);
3240 if(mpm3mqm1m2<1e-100) continue;
3241 double req2hqnqn = fQTPC2hCos*(tpc_qcos*tpc_qcos-tpc_qsin*tpc_qsin)+2*fQTPC2hSin*tpc_qcos*tpc_qsin;
3242 double tC4 = (tpc_qsqr*tpc_qsqr + tpc_q2hsqr - 2*req2hqnqn - 2*(2*tpc_qsqr*(tpc_qmul-2)-tpc_qmul*(tpc_qmul-3)))/mm1m2m3;
3243 double tDC4 = pQ*tpc_qsqr -q2nQnQn -pnQnQ2n -2*(tpc_qmul-1)*pQ -2*mq*(tpc_qsqr-tpc_qmul+3) +6*(qcos*tpc_qcos+qsin*tpc_qsin) +(q2hcos*fQTPC2hCos+q2hsin*fQTPC2hSin);
3244 tDC4 /= mpm3mqm1m2;
3245 c4->Fill( pt, tC4, mm1m2m3 );
3246 dc4->Fill( pt, tDC4, mpm3mqm1m2 );
3247 c2c4->Fill( pt, tC2*tC4, mm1*mm1m2m3 );
3248 c2dc4->Fill( pt, tC2*tDC4, mm1*mpm3mqm1m2 );
3249 c4dc2->Fill( pt, tC4*tDC2, mm1m2m3*mpmmq );
3250 c4dc4->Fill( pt, tC4*tDC4, mm1m2m3*mpm3mqm1m2 );
3251 dc2dc4->Fill( pt, tDC2*tDC4, mpmmq*mpm3mqm1m2 );
3252 }
3253 // clean for next event
3254 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qCos" ))->Reset();
3255 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qSin" ))->Reset();
3256 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hCos" ))->Reset();
3257 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hSin" ))->Reset();
3258 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pCos" ))->Reset();
3259 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pSin" ))->Reset();
3260}
3261//=======================================================================
3262void AliAnalysisTaskFlowStrange::QCStoreDecayVn(TString name) {
3263 // getting transients
3264 TProfile2D *pCos = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pCos" ));
3265 TProfile2D *pSin = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pSin" ));
3266 TProfile2D *qCos = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qCos" ));
3267 TProfile2D *qSin = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qSin" ));
3268 TProfile2D *q2hCos = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hCos" ));
3269 TProfile2D *q2hSin = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hSin" ));
3270 if(fDebug) {
3271 printf("**QCStoreTrackVn( %s )\n",name.Data());
3272 printf(" Read %.0f entries in p set and %.0f entries in q set\n",pCos->GetEntries(),qCos->GetEntries());
3273 printf(" pCos[5][5] %.16f | pSin[5][5] %.16f \n", pCos->GetBinContent(5,5), pSin->GetBinContent(5,5));
3274 printf(" qCos[5][5] %.16f | qSin[5][5] %.16f \n", qCos->GetBinContent(5,5), qSin->GetBinContent(5,5));
3275 printf(" q2hCos[5][5] %.16f | q2hSin[5][5] %.16f \n", q2hCos->GetBinContent(5,5), q2hSin->GetBinContent(5,5));
3276 }
3277 // filling {2} and {4} correlator
3278 TProfile2D *c2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2" ));
3279 TProfile2D *c4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4" ));
3280 TProfile2D *dc2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2" ));
3281 TProfile2D *dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC4" ));
3282 TProfile2D *c2c4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2C4" ));
3283 TProfile2D *c2dc2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC2" ));
3284 TProfile2D *c2dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC4" ));
3285 TProfile2D *c4dc2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC2" ));
3286 TProfile2D *c4dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC4" ));
3287 TProfile2D *dc2dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2DC4" ));
3288 double tpc_qcos = fQTPCACos + fQTPCCCos;
3289 double tpc_qsin = fQTPCASin + fQTPCCSin;
3290 double tpc_qsqr = tpc_qcos*tpc_qcos + tpc_qsin*tpc_qsin;
3291 double tpc_q2hsqr = fQTPC2hCos*fQTPC2hCos + fQTPC2hSin*fQTPC2hSin;
3292 double tpc_qmul = fQTPCA + fQTPCC;
3293 int n = c2->GetNbinsX();
3294 int m = c2->GetNbinsY();
3295 for(int i=1; i!=n+1; ++i) {
3296 double pt = c2->GetXaxis()->GetBinCenter( i );
3297 for(int j=1; j!=m+1; ++j) {
3298 double ms = c2->GetYaxis()->GetBinCenter( j );
3299 int k = pCos->GetBin(i,j);
3300 double mp = pCos->GetBinEntries( k );
3301 if( mp<1 ) { if(fDebug>2) printf(" bin %d,%d:: mp (%.16f) < 1!\n",i,j,mp); continue; }
3302 double mm1 = tpc_qmul*(tpc_qmul-1);
3303 if( mm1<1e-100 ) { if(fDebug>2) printf(" bin %d,%d:: mm1<1e-100!\n",i,j); continue; }
3304 double mq = qCos->GetBinEntries( k );
3305 double mpmmq = mp*tpc_qmul-mq;
3306 if( mpmmq<1e-100 ) { if(fDebug>2) printf(" bin %d,%d:: mpmmq<1e-100!\n",i,j); continue; }
3307 double pcos = pCos->GetBinContent( i,j )*mp;
3308 double psin = pSin->GetBinContent( i,j )*mp;
3309 double qcos = qCos->GetBinContent( i,j )*mq;
3310 double qsin = qSin->GetBinContent( i,j )*mq;
3311 double q2hcos = q2hCos->GetBinContent( i,j )*mq;
3312 double q2hsin = q2hSin->GetBinContent( i,j )*mq;
3313 double pQ = pcos*tpc_qcos+psin*tpc_qsin;
3314 double q2nQnQn = (qcos*tpc_qcos + qsin*tpc_qsin)*tpc_qcos + (qsin*tpc_qcos-qcos*tpc_qsin)*tpc_qsin;
3315 double pnQnQ2n = (pcos*tpc_qcos - psin*tpc_qsin)*fQTPC2hCos + (psin*tpc_qcos+pcos*tpc_qsin)*fQTPC2hSin;
3316 double tC2 = (tpc_qsqr-tpc_qmul)/mm1;
3317 double tDC2 = (pQ-mq)/mpmmq;
3318 c2->Fill( pt, ms, tC2, mm1 );
3319 dc2->Fill( pt, ms, tDC2, mpmmq );
3320 c2dc2->Fill( pt, ms, tC2*tDC2, mm1*mpmmq );
3321 double mm1m2m3 = tpc_qmul*(tpc_qmul-1)*(tpc_qmul-2)*(tpc_qmul-3);
3322 if(mm1m2m3<1e-100) continue;
3323 double mpm3mqm1m2 = (mp*tpc_qmul-3*mq)*(tpc_qmul-1)*(tpc_qmul-2);
3324 if(mpm3mqm1m2<1e-100) continue;
3325 double req2hqnqn = fQTPC2hCos*(tpc_qcos*tpc_qcos-tpc_qsin*tpc_qsin)+2*fQTPC2hSin*tpc_qcos*tpc_qsin;
3326 double tC4 = (tpc_qsqr*tpc_qsqr + tpc_q2hsqr - 2*req2hqnqn - 2*(2*tpc_qsqr*(tpc_qmul-2)-tpc_qmul*(tpc_qmul-3)))/mm1m2m3;
3327 double tDC4 = pQ*tpc_qsqr -q2nQnQn -pnQnQ2n -2*(tpc_qmul-1)*pQ -2*mq*(tpc_qsqr-tpc_qmul+3) +6*(qcos*tpc_qcos+qsin*tpc_qsin) +(q2hcos*fQTPC2hCos+q2hsin*fQTPC2hSin);
3328 tDC4 /= mpm3mqm1m2;
3329 c4->Fill( pt, ms, tC4, mm1m2m3 );
3330 dc4->Fill( pt, ms, tDC4, mpm3mqm1m2 );
3331 c2c4->Fill( pt, ms, tC2*tC4, mm1*mm1m2m3 );
3332 c2dc4->Fill( pt, ms, tC2*tDC4, mm1*mpm3mqm1m2 );
3333 c4dc2->Fill( pt, ms, tC4*tDC2, mm1m2m3*mpmmq );
3334 c4dc4->Fill( pt, ms, tC4*tDC4, mm1m2m3*mpm3mqm1m2 );
3335 dc2dc4->Fill( pt, ms, tDC2*tDC4, mpmmq*mpm3mqm1m2 );
3336 }
3337 }
3338 // clean for next event
3339 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qCos" ))->Reset();
3340 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qSin" ))->Reset();
3341 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hCos" ))->Reset();
3342 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hSin" ))->Reset();
3343 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pCos" ))->Reset();
3344 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pSin" ))->Reset();
3345}
3346//=======================================================================
3347void AliAnalysisTaskFlowStrange::FillTrackVn(TString name,Double_t pt,Double_t phi,Double_t eta,Int_t fid) {
3348 // reading vze qm
3349 Double_t vzec_qmcos = fQVZECCos/fQVZEC;
3350 Double_t vzec_qmsin = fQVZECSin/fQVZEC;
3351 Double_t vzea_qmcos = fQVZEACos/fQVZEA;
3352 Double_t vzea_qmsin = fQVZEASin/fQVZEA;
3353 // reading tpc qm
3354 Double_t tpcc_qmcos = fQTPCCCos/fQTPCC;
3355 Double_t tpcc_qmsin = fQTPCCSin/fQTPCC;
3356 Double_t tpca_qmcos = fQTPCACos/fQTPCA;
3357 Double_t tpca_qmsin = fQTPCASin/fQTPCA;
3358 Double_t qtpc = fQTPCA+fQTPCC;
3359 Double_t tpc_qmcos = (fQTPCACos+fQTPCCCos)/qtpc;
3360 Double_t tpc_qmsin = (fQTPCASin+fQTPCCSin)/qtpc;
3361 // computing u
3362 Double_t cosn = TMath::Cos(fHarmonic*phi);
3363 Double_t sinn = TMath::Sin(fHarmonic*phi);
3364 Double_t cos2n = TMath::Cos(2.0*fHarmonic*phi);
3365 Double_t sin2n = TMath::Sin(2.0*fHarmonic*phi);
3366 // Scalar Product
3367 Double_t uQ, uQa, uQc, qaqc;
3368 // filling flow with vze
3369 qaqc = (vzea_qmcos*vzec_qmcos + vzea_qmsin*vzec_qmsin);
3370 uQa = (cosn*vzea_qmcos + sinn*vzea_qmsin);
3371 uQc = (cosn*vzec_qmcos + sinn*vzec_qmsin);
3372 Double_t cosmc = TMath::Cos( fHarmonic*GetMCDPHI(phi) );
3373 if(fReadMC) {
3374 ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "MC_COSNDPHI_uQVZEA" ))->Fill( cosmc,uQa );
3375 ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "MC_COSNDPHI_uQVZEC" ))->Fill( cosmc,uQc );
3376 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "MC_COSNDPHI" ))->Fill( pt,cosmc );
3377 }
3378 Double_t qaqt = (vzea_qmcos*tpc_qmcos + vzea_qmsin*tpc_qmsin);
3379 Double_t qcqt = (vzec_qmcos*tpc_qmcos + vzec_qmsin*tpc_qmsin);
3380 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEA" ))->Fill( pt,uQa,fQVZEA );
3381 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEC" ))->Fill( pt,uQc,fQVZEC );
3382 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEAVZEC" ))->Fill( pt,qaqc,fQVZEA*fQVZEC );
3383 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEATPC" ))->Fill( pt,qaqt,fQVZEA*qtpc );
3384 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZECTPC" ))->Fill( pt,qcqt,fQVZEC*qtpc );
3385 // error vze
3386 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAuVZEC" ))->Fill( pt,uQa*uQc,fQVZEA*fQVZEC );
3387 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAVZEAVZEC" ))->Fill( pt,uQa*qaqc,fQVZEA*fQVZEA*fQVZEC );
3388 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZECVZEAVZEC" ))->Fill( pt,uQc*qaqc,fQVZEC*fQVZEA*fQVZEC );
3389 // filling flow with tpc
3390 qaqc = (tpca_qmcos*tpcc_qmcos + tpca_qmsin*tpcc_qmsin);
3391 if(eta<0) {
3392 uQ = (cosn*tpca_qmcos + sinn*tpca_qmsin);
3393 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCA" ))->Fill( pt,uQ,fQTPCA );
3394 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCATPCATPCC" ))->Fill( pt,uQ*qaqc,fQTPCA*fQTPCA*fQTPCC );
3395 if(fReadMC) {
3396 ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "MC_COSNDPHI_uQTPCA" ))->Fill( cosmc,uQ );
3397 }
3398 } else {
3399 uQ = (cosn*tpcc_qmcos + sinn*tpcc_qmsin);
3400 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCC" ))->Fill( pt,uQ,fQTPCC );
3401 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCCTPCATPCC" ))->Fill( pt,uQ*qaqc,fQTPCC*fQTPCA*fQTPCC );
3402 if(fReadMC) {
3403 ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "MC_COSNDPHI_uQTPCC" ))->Fill( cosmc,uQ );
24373b38 3404 }
3405 }
6c0d2d67 3406 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_TPCATPCC" ))->Fill( pt,qaqc,fQTPCA*fQTPCC );
3407 // QC
3408 ((TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_HistPt_P" ))->Fill( pt );
3409 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pCos" ))->Fill( pt, cosn, 1.0 );
3410 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pSin" ))->Fill( pt, sinn, 1.0 );
3411 if(InQTPC(fid)) {
3412 ((TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_HistPt_Q" ))->Fill( pt );
3413 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qCos" ))->Fill( pt, cosn, 1.0 );
3414 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qSin" ))->Fill( pt, sinn, 1.0 );
3415 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hCos" ))->Fill( pt, cos2n, 1.0 );
3416 ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hSin" ))->Fill( pt, sin2n, 1.0 );
3417 }
3418}
3419//=======================================================================
3420void AliAnalysisTaskFlowStrange::FillDecayVn(TString name,Double_t ms,Double_t pt,Double_t phi,Double_t eta,Int_t fid1,Int_t fid2) {
52476a4c 3421 ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "DecayYield_PtMass" ))->Fill( pt,ms );
3422 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "DecayAvgPt_PtMass" ))->Fill( pt,ms,pt );
3423
6c0d2d67 3424 // reading vze qm
3425 Double_t vzec_qmcos = fQVZECCos/fQVZEC;
3426 Double_t vzec_qmsin = fQVZECSin/fQVZEC;
3427 Double_t vzea_qmcos = fQVZEACos/fQVZEA;
3428 Double_t vzea_qmsin = fQVZEASin/fQVZEA;
3429 // reading tpc qm
3430 Double_t tpcc_qmcos = fQTPCCCos/fQTPCC;
3431 Double_t tpcc_qmsin = fQTPCCSin/fQTPCC;
3432 Double_t tpca_qmcos = fQTPCACos/fQTPCA;
3433 Double_t tpca_qmsin = fQTPCASin/fQTPCA;
3434 Double_t qtpc = fQTPCA+fQTPCC;
3435 Double_t tpc_qmcos = (fQTPCACos+fQTPCCCos)/qtpc;
3436 Double_t tpc_qmsin = (fQTPCASin+fQTPCCSin)/qtpc;
3437 // computing u
3438 Double_t cosn = TMath::Cos(fHarmonic*phi);
3439 Double_t sinn = TMath::Sin(fHarmonic*phi);
3440 Double_t cos2n = TMath::Cos(2.0*fHarmonic*phi);
3441 Double_t sin2n = TMath::Sin(2.0*fHarmonic*phi);
3442 // Scalar Product
3443 Double_t uQ, uQa, uQc, qaqc;
3444 // filling flow with vze
3445 qaqc = (vzea_qmcos*vzec_qmcos + vzea_qmsin*vzec_qmsin);
3446 uQa = (cosn*vzea_qmcos + sinn*vzea_qmsin);
3447 uQc = (cosn*vzec_qmcos + sinn*vzec_qmsin);
3448 Double_t cosmc = TMath::Cos( fHarmonic*GetMCDPHI(phi) );
3449 if(fReadMC) {
3450 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "MC_COSNDPHI" ))->Fill( pt,ms,cosmc );
3451 }
3452 Double_t qaqt = (vzea_qmcos*tpc_qmcos + vzea_qmsin*tpc_qmsin);
3453 Double_t qcqt = (vzec_qmcos*tpc_qmcos + vzec_qmsin*tpc_qmsin);
3454 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEA" ))->Fill( pt,ms,uQa,fQVZEA );
3455 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEC" ))->Fill( pt,ms,uQc,fQVZEC );
3456 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEAVZEC" ))->Fill( pt,ms,qaqc,fQVZEA*fQVZEC );
3457 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEATPC" ))->Fill( pt,ms,qaqt,fQVZEA*qtpc );
3458 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZECTPC" ))->Fill( pt,ms,qcqt,fQVZEC*qtpc );
3459 // error vze
3460 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAuVZEC" ))->Fill( pt,ms,uQa*uQc,fQVZEA*fQVZEC );
3461 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAVZEAVZEC" ))->Fill( pt,ms,uQa*qaqc,fQVZEA*fQVZEA*fQVZEC );
3462 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZECVZEAVZEC" ))->Fill( pt,ms,uQc*qaqc,fQVZEC*fQVZEA*fQVZEC );
3463 // filling flow with tpc
3464 qaqc = (tpca_qmcos*tpcc_qmcos + tpca_qmsin*tpcc_qmsin);
3465 if(eta<0) {
3466 uQ = (cosn*tpca_qmcos + sinn*tpca_qmsin);
3467 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCA" ))->Fill( pt,ms,uQ,fQTPCA );
3468 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCATPCATPCC" ))->Fill( pt,ms,uQ*qaqc,fQTPCA*fQTPCA*fQTPCC );
3469 } else {
3470 uQ = (cosn*tpcc_qmcos + sinn*tpcc_qmsin);
3471 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCC" ))->Fill( pt,ms,uQ,fQTPCC );
3472 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCCTPCATPCC" ))->Fill( pt,ms,uQ*qaqc,fQTPCC*fQTPCA*fQTPCC );
3473 }
3474 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_TPCATPCC" ))->Fill( pt,ms,qaqc,fQTPCA*fQTPCC );
3475 // QC
3476 ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_HistPt_P" ))->Fill( pt,ms );
3477 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pCos" ))->Fill( pt, ms, cosn, 1.0 );
3478 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_pSin" ))->Fill( pt, ms, sinn, 1.0 );
3479 if(InQTPC(fid1)||InQTPC(fid2)) {
3480 ((TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_HistPt_Q" ))->Fill( pt,ms );
3481 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qCos" ))->Fill( pt, ms, cosn, 1.0 );
3482 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_qSin" ))->Fill( pt, ms, sinn, 1.0 );
3483 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hCos" ))->Fill( pt, ms, cos2n, 1.0 );
3484 ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_q2hSin" ))->Fill( pt, ms, sin2n, 1.0 );
3485 }
3486}
3487//=======================================================================
3488Bool_t AliAnalysisTaskFlowStrange::InQTPC(Int_t id) {
3489 Bool_t ret = kFALSE;
3490 for(int i=0; i!=fQTPCA_nTracks; ++i)
3491 if(fQTPCA_fID[i]==id) {
3492 ret=kTRUE;
3493 break;
3494 }
3495 if(ret) return kTRUE;
3496 for(int i=0; i!=fQTPCC_nTracks; ++i)
3497 if(fQTPCC_fID[i]==id) {
3498 ret=kTRUE;
3499 break;
3500 }
3501 return ret;
24373b38 3502}
3503//=======================================================================
6c0d2d67 3504void AliAnalysisTaskFlowStrange::ComputeTrackVn(TString name) {
3505 TProfile *uQa, *uQc, *qaqc, *uQaqaqc, *uQcqaqc;
3506 TArrayD *pasww, *pbsww, *pcsww;
3507 //ScalarProducr TPC
3508 printf("<<%s>> SP TPC\n",name.Data());
3509 uQa = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCA" );
3510 uQc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCC" );
3511 qaqc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_TPCATPCC" );
3512 uQaqaqc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCATPCATPCC" );
3513 uQcqaqc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCCTPCATPCC" );
3514 pasww = uQa->GetBinSumw2();
3515 pbsww = uQc->GetBinSumw2();
3516 pcsww = qaqc->GetBinSumw2();
3517 //
3518 TH1D *sptpca = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnTPCA" );
3519 TH1D *sptpcc = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnTPCC" );
3520 TH1D *sptpcaa = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnTPCAA" );
3521 //
3522 for(Int_t i=1; i!=sptpcaa->GetNbinsX()+1; ++i) {
3523 sptpcaa->SetBinContent(i,0);
3524 sptpcaa->SetBinError(i,0);
3525 sptpca->SetBinContent(i,0);
3526 sptpca->SetBinError(i,0);
3527 sptpcc->SetBinContent(i,0);
3528 sptpcc->SetBinError(i,0);
3529 double a = uQa->GetBinContent(i);
3530 double b = uQc->GetBinContent(i);
3531 double c = qaqc->GetBinContent(i);
3532 //if(TMath::AreEqualAbs(a,0,1e-100)) continue;
3533 //if(TMath::AreEqualAbs(b,0,1e-100)) continue;
3534 if(c<1e-100) continue;
3535 // nominal sptpca
3536 double vna = a/TMath::Sqrt(c);
3537 sptpca->SetBinContent(i,vna);
3538 // nominal sptpcc
3539 double vnc = b/TMath::Sqrt(c);
3540 sptpcc->SetBinContent(i,vnc);
3541 // nominal sptpc
3542 double vn = (vna + vnc)/2.0;
3543 sptpcaa->SetBinContent(i,vn);
3544 // errors
3545 double asw = uQa->GetBinEntries(i);
3546 double bsw = uQc->GetBinEntries(i);
3547 double csw = qaqc->GetBinEntries(i);
3548 if(asw<1e-100||bsw<1e-100||csw<1e-100) continue;
3549 double asww = pasww->At(i);
3550 double bsww = pbsww->At(i);
3551 double csww = pcsww->At(i);
3552 if(asww<1e-100||bsww<1e-100||csww<1e-100) continue;
3553 if((1<1e-100+asww/asw/asw)||(1<1e-100+bsww/bsw/bsw)||(1<1e-100+csww/csw/csw)) continue;
3554 if(TMath::AreEqualAbs(asww,asw*asw,1e-100)||
3555 TMath::AreEqualAbs(bsww,bsw*bsw,1e-100)||
3556 TMath::AreEqualAbs(csww,csw*csw,1e-100)) continue;
3557 double ac = uQaqaqc->GetBinContent(i);
3558 double bc = uQcqaqc->GetBinContent(i);
3559 double acsw = uQaqaqc->GetBinEntries(i);
3560 double bcsw = uQcqaqc->GetBinEntries(i);
3561 double ea = uQa->GetBinError(i)*TMath::Sqrt(asww)/asw/TMath::Sqrt(1-asww/asw/asw);
3562 double eb = uQc->GetBinError(i)*TMath::Sqrt(bsww)/bsw/TMath::Sqrt(1-bsww/bsw/bsw);
3563 double ec = qaqc->GetBinError(i)*TMath::Sqrt(csww)/csw/TMath::Sqrt(1-csww/csw/csw);
3564 //printf("%d >> ea^2 %.16f |||| asww %.16f | asw %.16f | 1-asww/asw/asw %.16f \n", i,ea, asww, asw, 1-asww/asw/asw);
3565 //printf("%d >> eb^2 %.16f |||| bsww %.16f | bsw %.16f | 1-bsww/bsw/bsw %.16f \n", i,eb, bsww, bsw, 1-bsww/bsw/bsw);
3566 //printf("%d >> ec^2 %.16f |||| csww %.16f | csw %.16f | 1-csww/csw/csw %.16f \n", i,ec, csww, csw, 1-csww/csw/csw);
3567 double ebc = (bc-b*c)/(1-bcsw/bsw/csw)*bcsw/bsw/csw;
3568 double eac = (ac-a*c)/(1-acsw/asw/csw)*acsw/asw/csw;
3569 double evna = 1.0/TMath::Abs(c) * ( ea*ea + vna*vna/TMath::Abs(c)/4.0*ec*ec - vna/TMath::Sqrt(c)*eac );
3570 double evnc = 1.0/TMath::Abs(c) * ( eb*eb + vnc*vnc/TMath::Abs(c)/4.0*ec*ec - vnc/TMath::Sqrt(c)*ebc );
3571 //printf("%d >> evna^2 %.16f |||| ea %.16f | ec %.16f | eac %.16f | c %.16f\n", i,evna, ea, ec, eac,c);
3572 //printf("%d >> evnc^2 %.16f |||| eb %.16f | ec %.16f | ebc %.16f | c %.16f\n", i,evnc, eb, ec, ebc,c);
3573 if(evna>1e-100) evna = TMath::Sqrt(evna); else evna=0;
3574 if(evnc>1e-100) evnc = TMath::Sqrt(evnc); else evnc=0;
3575 sptpca->SetBinError(i,evna);
3576 sptpcc->SetBinError(i,evnc);
3577 sptpcaa->SetBinError(i,TMath::Sqrt(evna*evna+evnc*evnc)/2.0);
3578 }
3579 //ScalarProduct VZE
3580 printf("<<%s>> SP VZE\n",name.Data());
3581 double cvzea2 = ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("ChiSquaredVZEA"))->GetBinContent( 1 );
3582 double cvzec2 = ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("ChiSquaredVZEC"))->GetBinContent( 1 );
3583 if( TMath::AreEqualAbs(cvzea2+cvzec2,0,1e-100) ) return;
3584 uQa = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEA" );
3585 uQc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEC" );
3586 qaqc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEAVZEC" );
3587 uQaqaqc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAVZEAVZEC" );
3588 uQcqaqc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZECVZEAVZEC" );
3589 pasww = uQa->GetBinSumw2();
3590 pbsww = uQc->GetBinSumw2();
3591 pcsww = qaqc->GetBinSumw2();
3592 //
3593 TProfile *qaqt = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEATPC" );
3594 TProfile *qcqt = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZECTPC" );
3595 TProfile *uQauQc = (TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAuVZEC" );
3596 //
3597 TH1D *spvzea = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEA" );
3598 TH1D *spvzec = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEC" );
3599 TH1D *spvzega = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEGA" );
3600 TH1D *spvzewa = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEWA" );
3601 for(Int_t i=1; i!=spvzewa->GetNbinsX()+1; ++i) {
3602 spvzega->SetBinContent(i,0);
3603 spvzega->SetBinError(i,0);
3604 spvzewa->SetBinContent(i,0);
3605 spvzewa->SetBinError(i,0);
3606 spvzea->SetBinContent(i,0);
3607 spvzea->SetBinError(i,0);
3608 spvzec->SetBinContent(i,0);
3609 spvzec->SetBinError(i,0);
2adcf041 3610 double asw = uQa->GetBinEntries(i);
3611 double bsw = uQc->GetBinEntries(i);
3612 double csw = qaqc->GetBinEntries(i);
3613 if(asw<1e-1||bsw<1e-1||csw<1e-1) continue;
3614 double asww = pasww->At(i);
3615 double bsww = pbsww->At(i);
3616 double csww = pcsww->At(i);
3617 if(asww<1e-1||bsww<1e-1||csww<1e-1) continue;
3618 if((1<asww/asw/asw)||(1<bsww/bsw/bsw)||(1<csww/csw/csw)) continue;
6c0d2d67 3619 double a = uQa->GetBinContent(i);
3620 double b = uQc->GetBinContent(i);
3621 double c = qaqc->GetBinContent(i);
3622 double at = qaqt->GetBinContent(i);
3623 double bt = qcqt->GetBinContent(i);
2adcf041 3624 if(TMath::AreEqualAbs(a,0,1e-10)) continue;
3625 if(TMath::AreEqualAbs(b,0,1e-10)) continue;
3626 if(TMath::AreEqualAbs(c,0,1e-10)) continue;
3627 if(TMath::AreEqualAbs(at,0,1e-10)) continue;
3628 if(TMath::AreEqualAbs(bt,0,1e-10)) continue;
6c0d2d67 3629 // nominal spvzea
3630 double aa = c*at/bt;
3631 if(aa<1e-100) continue;
3632 double vna = a/TMath::Sqrt(aa);
3633 spvzea->SetBinContent(i,vna);
3634 // nominal spvzec
3635 double bb = c*bt/at;
3636 if(bb<1e-100) continue;
3637 double vnc = b/TMath::Sqrt(bb);
3638 spvzec->SetBinContent(i,vnc);
3639 //nominal spvzewa
3640 double vnwa = (cvzea2*vna + cvzec2*vnc) / (cvzea2+cvzec2);
3641 spvzewa->SetBinContent(i,vnwa);
3642 // nominal spvzega
3643 double vnga = a*b/c;
3644 if(vnga<1e-100) continue;
3645 vnga = TMath::Sqrt(vnga);
3646 spvzega->SetBinContent(i,vnga);
3647 // errors
6c0d2d67 3648 double ab = uQauQc->GetBinContent(i);
3649 double ac = uQaqaqc->GetBinContent(i);
3650 double bc = uQcqaqc->GetBinContent(i);
3651 double absw = uQauQc->GetBinEntries(i);
3652 double acsw = uQaqaqc->GetBinEntries(i);
3653 double bcsw = uQcqaqc->GetBinEntries(i);
6c0d2d67 3654 double ea = uQa->GetBinError(i)*TMath::Sqrt(asww)/asw/TMath::Sqrt(1-asww/asw/asw);
3655 double eb = uQc->GetBinError(i)*TMath::Sqrt(bsww)/bsw/TMath::Sqrt(1-bsww/bsw/bsw);
3656 double ec = qaqc->GetBinError(i)*TMath::Sqrt(csww)/csw/TMath::Sqrt(1-csww/csw/csw);
2adcf041 3657 if(TMath::AreEqualAbs(1,absw/asw/bsw,1e-100)||TMath::AreEqualAbs(1,bcsw/bsw/csw,1e-100)||TMath::AreEqualAbs(1,acsw/asw/csw,1e-100)) continue;
6c0d2d67 3658 double eab = (ab-a*b)/(1-absw/asw/bsw)*absw/asw/bsw;
3659 double ebc = (bc-b*c)/(1-bcsw/bsw/csw)*bcsw/bsw/csw;
3660 double eac = (ac-a*c)/(1-acsw/asw/csw)*acsw/asw/csw;
3661 double nc, nec, neac, nebc;
3662 nc = c*at/bt;
3663 nec = ec*at/bt;
3664 neac = eac*at/bt;
3665 nebc = ebc*at/bt;
3666 double evna = 1.0/TMath::Abs(nc*nc*nc) * ( nc*nc*ea*ea + a*a/4.0*nec*nec - a*TMath::Abs(nc)*neac*neac );
3667 nc = c*bt/at;
3668 nec = ec*bt/at;
3669 neac = eac*bt/at;
3670 nebc = ebc*bt/at;
3671 double evnc = 1.0/TMath::Abs(nc*nc*nc) * ( nc*nc*eb*eb + b*b/4.0*nec*nec - b*TMath::Abs(nc)*nebc*nebc );
3672 if(evna>1e-100) evna = TMath::Sqrt(evna); else evna=0;
3673 if(evnc>1e-100) evnc = TMath::Sqrt(evnc); else evnc=0;
3674 spvzea->SetBinError(i,evna);
3675 spvzec->SetBinError(i,evnc);
3676 double evnwa = TMath::Sqrt( cvzea2*cvzea2*evna*evna + cvzec2*cvzec2*evnc*evnc )/(cvzea2+cvzec2);
3677 spvzewa->SetBinError(i,evnwa);
3678 double evnga = 0.25/c/c * ( TMath::Abs(b*c/a)*ea*ea + TMath::Abs(a*c/b)*eb*eb + TMath::Abs(a*b/c)*ec*ec + 2*c*eab - 2*a*ebc - 2*b*eac );
3679 if(evnga>1e-100) evnga = TMath::Sqrt(evnga); else evnga=0;
3680 spvzega->SetBinError(i,evnga);
3681 }
3682 printf("<<%s>> QC TPC\n",name.Data());
3683 //Qcumulants
3684 TH1D *resC2 = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_Cum2" );
3685 TH1D *resC4 = (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_Cum4" );
3686 TH1D *resDC2= (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DCum2" );
3687 TH1D *resDC4= (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DCum4" );
3688 TH1D *resvn2= (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_vn2" );
3689 TH1D *resvn4= (TH1D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_vn4" );
3690 //correlators
3691 TProfile *c2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2" ));
3692 TProfile *c4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4" ));
3693 TProfile *dc2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2" ));
3694 TProfile *dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC4" ));
3695 TProfile *c2c4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2C4" ));
3696 TProfile *c2dc2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC2" ));
3697 TProfile *c2dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC4" ));
3698 TProfile *c4dc2 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC2" ));
3699 TProfile *c4dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC4" ));
3700 TProfile *dc2dc4 = ((TProfile*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2DC4" ));
3701 TArrayD *c2sww = c2->GetBinSumw2();
3702 TArrayD *c4sww = c4->GetBinSumw2();
3703 TArrayD *dc2sww= dc2->GetBinSumw2();
3704 TArrayD *dc4sww= dc4->GetBinSumw2();
3705 for(Int_t i=1; i!=resvn2->GetNbinsX()+1; ++i) {
3706 // cn{2}
3707 double v_c2sw = c2->GetBinEntries(i);
3708 if(v_c2sw<1e-100) continue;
3709 double v_c2sww = c2sww->At(i);
3710 double v_c2 = c2->GetBinContent(i);
3711 double e_c2 = TMath::Sqrt(v_c2sww)/v_c2sw*c2->GetBinError(i);
3712 double cum2 = v_c2;
3713 double ecum2= e_c2;
3714 resC2->SetBinContent(i, cum2 );
3715 resC2->SetBinError(i, ecum2 );
3716 // cn{4}
3717 double v_c4sw = c4->GetBinEntries(i);
3718 if(v_c4sw<1e-100) continue;
3719 double v_c4sww = c4sww->At(i);
3720 double v_c4 = c4->GetBinContent(i);
3721 double e_c4 = TMath::Sqrt(v_c4sww)/v_c4sw*c4->GetBinError(i);
3722 double v_c2c4 = c2c4->GetBinContent(i);
3723 double v_c2c4sw = c2c4->GetBinEntries(i);
3724 if(TMath::AreEqualAbs(v_c2c4sw/v_c2sw/v_c4sw,1,1e-100)) continue;
3725 double covc2c4 = v_c2c4sw/v_c2sw/v_c4sw*(v_c2c4 - v_c2*v_c4)/(1-v_c2c4sw/v_c2sw/v_c4sw);
3726 double cum4 = v_c4 - 2*v_c2*v_c2;
3727 double ecum4= 16.0*v_c2*v_c2*e_c2*e_c2 + e_c4*e_c4 - 8.0*v_c2*covc2c4;
3728 if(ecum4<1e-100) continue;
3729 ecum4 = TMath::Sqrt( ecum4 );
3730 resC4->SetBinContent(i, cum4 );
3731 resC4->SetBinError(i, ecum4 );
3732 // dn{2}
3733 double v_dc2sw = dc2->GetBinEntries(i);
3734 if(v_dc2sw<1) continue;
3735 double v_dc2 = dc2->GetBinContent(i);
3736 double v_dc2sww = dc2sww->At(i);
3737 double e_dc2 = TMath::Sqrt(v_dc2sww)/v_dc2sw*dc2->GetBinError(i);
3738 double dcum2 = v_dc2;
3739 double edcum2= e_dc2;
3740 resDC2->SetBinContent(i, dcum2 );
3741 resDC2->SetBinError(i, edcum2 );
3742 // v2{2}
3743 if(v_c2<1e-100) continue;
3744 double dv22 = v_dc2/TMath::Sqrt(v_c2);
3745 double v_c2dc2 = c2dc2->GetBinContent(i);
3746 double v_c2dc2sw = c2dc2->GetBinEntries(i);
3747 if(TMath::AreEqualAbs(v_c2dc2sw/v_c2sw/v_dc2sw,1,1e-100)) continue;
3748 double covc2dc2 = v_c2dc2sw/v_c2sw/v_dc2sw*(v_c2dc2 - v_c2*v_dc2)/(1-v_c2dc2sw/v_c2sw/v_dc2sw);
3749 double edv22 = 0.25/v_c2/v_c2/v_c2*(v_dc2*v_dc2*e_c2*e_c2 + 4*v_c2*v_c2*e_dc2*e_dc2 - 4*v_c2*v_dc2*covc2dc2);
3750 //printf("%d >> dv22 %.16f || edv22^2 %.16f |||| v_c2dc2 %.16f | v_c2dc2sw %.16f | covc2dc2 %.16f \n", i,dv22,edv22,v_c2dc2,v_c2dc2sw,covc2dc2);
3751 if(edv22<1e-100) continue;
3752 edv22 = TMath::Sqrt(edv22);
3753 resvn2->SetBinContent(i,dv22);
3754 resvn2->SetBinError(i,edv22);
3755 // dn{4}
3756 double v_dc4sw = dc4->GetBinEntries(i);
3757 if(v_dc4sw<1) continue;
3758 double v_dc4 = dc4->GetBinContent(i);
3759 double v_dc4sww = dc4sww->At(i);
3760 double e_dc4 = TMath::Sqrt(v_dc4sww)/v_dc4sw*dc4->GetBinError(i);
3761 double dcum4 = v_dc4 - 2*v_c2*v_dc2;
3762 double v_c2dc4 = c2dc4->GetBinContent(i);
3763 double v_c2dc4sw = c2dc4->GetBinEntries(i);
3764 if(TMath::AreEqualAbs(v_c2dc4sw/v_c2sw/v_dc4sw,1,1e-100)) continue;
3765 double covc2dc4 = v_c2dc4sw/v_c2sw/v_dc4sw*(v_c2dc4 - v_c2*v_dc4)/(1-v_c2dc4sw/v_c2sw/v_dc4sw);
3766 double v_dc2dc4 = dc2dc4->GetBinContent(i);
3767 double v_dc2dc4sw = dc2dc4->GetBinEntries(i);
3768 if(TMath::AreEqualAbs(v_dc2dc4sw/v_dc2sw/v_dc4sw,1,1e-100)) continue;
3769 double covdc2dc4 = v_dc2dc4sw/v_dc2sw/v_dc4sw*(v_dc2dc4 - v_dc2*v_dc4)/(1-v_dc2dc4sw/v_dc2sw/v_dc4sw);
3770 double edcum4= ( +4.0*v_dc2*v_dc2*e_c2*e_c2
3771 +4.0*v_c2*v_c2*e_dc2*e_dc2
3772 +e_dc4*e_dc4
3773 +8.0*v_c2*v_dc2*covc2dc2
3774 -4.0*v_dc2*covc2dc4
3775 -4.0*v_c2*covdc2dc4 );
3776 if(edcum4<1e-100) continue;
3777 edcum4 = TMath::Sqrt(edcum4);
3778 resDC4->SetBinContent(i, dcum4 );
3779 resDC4->SetBinError(i, edcum4 );
3780 // v2{4}
3781 if(cum4>1e-100) continue;
3782 double dv24 = -dcum4/TMath::Power(-cum4,0.75);
3783 double dterm1 = 2*v_c2*v_c2*v_dc2 - 3*v_c2*v_dc4 + 2*v_c4*v_dc2;
3784 double dterm2 = 9.0/16.0*dcum4*dcum4;
3785 double dterm3 = 4.0*v_c2*v_c2*cum4*cum4;
3786 double dterm4 = cum4*cum4;
3787 double dterm5 = -3.0/2.0*dcum4*dterm1;
3788 double dterm6 = -4.0*v_c2*cum4*dterm1;
3789 double dterm7 = -2.0*cum4*dterm1;
3790 double dterm8 = 3.0*v_c2*cum4*dcum4;
3791 double dterm9 = 3.0/2.0*cum4*dcum4;
3792 double dterm10= 4*v_c2*cum4*cum4;
3793 double v_c4dc2 = c4dc2->GetBinContent(i);
3794 double v_c4dc2sw = c4dc2->GetBinEntries(i);
3795 if(TMath::AreEqualAbs(v_c4dc2sw/v_c4sw/v_dc2sw,1,1e-100)) continue;
3796 double covc4dc2 = v_c4dc2sw/v_c4sw/v_dc2sw*(v_c4dc2 - v_c4*v_dc2)/(1-v_c4dc2sw/v_c4sw/v_dc2sw);
3797 double v_c4dc4 = c4dc4->GetBinContent(i);
3798 double v_c4dc4sw = c4dc4->GetBinEntries(i);
3799 if(TMath::AreEqualAbs(v_c4dc4sw/v_c4sw/v_dc4sw,1,1e-100)) continue;
3800 double covc4dc4 = v_c4dc4sw/v_c4sw/v_dc4sw*(v_c4dc4 - v_c4*v_dc4)/(1-v_c4dc4sw/v_c4sw/v_dc4sw);
3801 double edv24= 1.0/TMath::Power(-cum4,3.5)*(+dterm1*dterm1*e_c2*e_c2
3802 +dterm2*e_c4*e_c4
3803 +dterm3*e_dc2*e_dc2
3804 +dterm4*e_dc4*e_dc4
3805 -dterm5*covc2c4
3806 -dterm6*covc2dc2
3807 +dterm7*covc2dc4
3808 +dterm8*covc4dc2
3809 -dterm9*covc4dc4
3810 -dterm10*covdc2dc4);
3811 if(edv24<1e-100) continue;
3812 edv24 = TMath::Sqrt(edv24);
3813 resvn4->SetBinContent(i,dv24);
3814 resvn4->SetBinError(i,edv24);
3815 }
3816}
3817//=======================================================================
3818void AliAnalysisTaskFlowStrange::ComputeDecayVn(TString name) {
3819 TProfile2D *uQa, *uQc, *qaqc, *uQaqaqc, *uQcqaqc;
3820 TArrayD *pasww, *pbsww, *pcsww;
3821 //ScalarProducr TPC
3822 printf("<<%s>> SP TPC\n",name.Data());
3823 uQa = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCA" );
3824 uQc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCC" );
3825 qaqc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_TPCATPCC" );
3826 uQaqaqc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCATPCATPCC" );
3827 uQcqaqc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uTPCCTPCATPCC" );
3828 pasww = uQa->GetBinSumw2();
3829 pbsww = uQc->GetBinSumw2();
3830 pcsww = qaqc->GetBinSumw2();
3831 //
3832 TH2D *sptpca = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnTPCA" );
3833 TH2D *sptpcc = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnTPCC" );
3834 TH2D *sptpcaa = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnTPCAA" );
3835 //
3836 for(Int_t i=1; i!=sptpcaa->GetNbinsX()+1; ++i) {
3837 for(Int_t j=1; j!=sptpcaa->GetNbinsY()+1; ++j) {
3838 sptpcaa->SetBinContent(i,j,0);
3839 sptpcaa->SetBinError(i,j,0);
3840 sptpca->SetBinContent(i,j,0);
3841 sptpca->SetBinError(i,j,0);
3842 sptpcc->SetBinContent(i,j,0);
3843 sptpcc->SetBinError(i,j,0);
3844 double a = uQa->GetBinContent(i,j);
3845 double b = uQc->GetBinContent(i,j);
3846 double c = qaqc->GetBinContent(i,j);
3847 //if(TMath::AreEqualAbs(a,0,1e-100)) continue;
3848 //if(TMath::AreEqualAbs(b,0,1e-100)) continue;
52476a4c 3849 if(c<1e-100) {printf("skipping i=%d, j=%d due to c=%.16f\n",i,j,c); continue;}
6c0d2d67 3850 // nominal sptpca
3851 double vna = a/TMath::Sqrt(c);
52476a4c 3852 sptpca->SetBinContent(i,j,vna);
6c0d2d67 3853 // nominal sptpcc
3854 double vnc = b/TMath::Sqrt(c);
52476a4c 3855 sptpcc->SetBinContent(i,j,vnc);
6c0d2d67 3856 // nominal sptpc
3857 double vn = (vna + vnc)/2.0;
52476a4c 3858 sptpcaa->SetBinContent(i,j,vn);
6c0d2d67 3859 // errors
3860 int k = sptpcaa->GetBin(i,j);
3861 double asw = uQa->GetBinEntries(k);
3862 double bsw = uQc->GetBinEntries(k);
3863 double csw = qaqc->GetBinEntries(k);
52476a4c 3864 if(asw<1e-100||bsw<1e-100||csw<1e-100) {printf("skipping i=%d, j=%d due to asw=%f or bsw=%f or csw=%f\n",i,j,asw,bsw,csw); continue;}
6c0d2d67 3865 double asww = pasww->At(k);
3866 double bsww = pbsww->At(k);
3867 double csww = pcsww->At(k);
52476a4c 3868 if(asww<1e-100||bsww<1e-100||csww<1e-100) {printf("skipping i=%d, j=%d due to asww=%f or bsww=%f or csww=%f\n",i,j,asww,bsww,csww); continue;}
3869 if((1<1e-100+asww/asw/asw)||(1<1e-100+bsww/bsw/bsw)||(1<1e-100+csww/csw/csw)) {printf("skipping i=%d, j=%d due to COVa=%f or COVb=%f or COVc=%f\n",i,j,asww/asw/asw,bsww/bsw/bsw,csww/csw/csw); continue;}
6c0d2d67 3870 if(TMath::AreEqualAbs(asww,asw*asw,1e-100)||
3871 TMath::AreEqualAbs(bsww,bsw*bsw,1e-100)||
52476a4c 3872 TMath::AreEqualAbs(csww,csw*csw,1e-100)) {printf("skipping i=%d, j=%d due to funny coincidence\n",i,j); continue;}
6c0d2d67 3873 double ac = uQaqaqc->GetBinContent(i,j);
3874 double bc = uQcqaqc->GetBinContent(i,j);
3875 double acsw = uQaqaqc->GetBinEntries(k);
3876 double bcsw = uQcqaqc->GetBinEntries(k);
3877 double ea = uQa->GetBinError(i,j)*TMath::Sqrt(asww)/asw/TMath::Sqrt(1-asww/asw/asw);
3878 double eb = uQc->GetBinError(i,j)*TMath::Sqrt(bsww)/bsw/TMath::Sqrt(1-bsww/bsw/bsw);
3879 double ec = qaqc->GetBinError(i,j)*TMath::Sqrt(csww)/csw/TMath::Sqrt(1-csww/csw/csw);
3880 //printf("%d >> ea^2 %.16f |||| asww %.16f | asw %.16f | 1-asww/asw/asw %.16f \n", i,ea, asww, asw, 1-asww/asw/asw);
3881 //printf("%d >> eb^2 %.16f |||| bsww %.16f | bsw %.16f | 1-bsww/bsw/bsw %.16f \n", i,eb, bsww, bsw, 1-bsww/bsw/bsw);
3882 //printf("%d >> ec^2 %.16f |||| csww %.16f | csw %.16f | 1-csww/csw/csw %.16f \n", i,ec, csww, csw, 1-csww/csw/csw);
3883 double ebc = (bc-b*c)/(1-bcsw/bsw/csw)*bcsw/bsw/csw;
3884 double eac = (ac-a*c)/(1-acsw/asw/csw)*acsw/asw/csw;
3885 double evna = 1.0/TMath::Abs(c) * ( ea*ea + vna*vna/TMath::Abs(c)/4.0*ec*ec - vna/TMath::Sqrt(c)*eac );
3886 double evnc = 1.0/TMath::Abs(c) * ( eb*eb + vnc*vnc/TMath::Abs(c)/4.0*ec*ec - vnc/TMath::Sqrt(c)*ebc );
3887 //printf("%d >> evna^2 %.16f |||| ea %.16f | ec %.16f | eac %.16f | c %.16f\n", i,evna, ea, ec, eac,c);
3888 //printf("%d >> evnc^2 %.16f |||| eb %.16f | ec %.16f | ebc %.16f | c %.16f\n", i,evnc, eb, ec, ebc,c);
3889 if(evna>1e-100) evna = TMath::Sqrt(evna); else evna=0;
3890 if(evnc>1e-100) evnc = TMath::Sqrt(evnc); else evnc=0;
3891 sptpca->SetBinError(i,j,evna);
3892 sptpcc->SetBinError(i,j,evnc);
3893 sptpcaa->SetBinError(i,j,TMath::Sqrt(evna*evna+evnc*evnc)/2.0);
3894 }
3895 }
3896 //ScalarProduct VZE
3897 printf("<<%s>> SP VZE\n",name.Data());
3898 double cvzea2 = ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("ChiSquaredVZEA"))->GetBinContent( 1 );
3899 double cvzec2 = ((TH1D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("ChiSquaredVZEC"))->GetBinContent( 1 );
3900 if( TMath::AreEqualAbs(cvzea2+cvzec2,0,1e-100) ) return;
3901 uQa = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEA" );
3902 uQc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEC" );
3903 qaqc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEAVZEC" );
3904 uQaqaqc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAVZEAVZEC" );
3905 uQcqaqc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZECVZEAVZEC" );
3906 pasww = uQa->GetBinSumw2();
3907 pbsww = uQc->GetBinSumw2();
3908 pcsww = qaqc->GetBinSumw2();
3909 //
3910 TProfile2D *qaqt = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZEATPC" );
3911 TProfile2D *qcqt = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_VZECTPC" );
3912 TProfile2D *uQauQc = (TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_uVZEAuVZEC" );
3913 //
3914 TH2D *spvzea = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEA" );
3915 TH2D *spvzec = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEC" );
3916 TH2D *spvzega = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEGA" );
3917 TH2D *spvzewa = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "SP_vnVZEWA" );
3918 for(Int_t i=1; i!=spvzewa->GetNbinsX()+1; ++i) {
52476a4c 3919 for(Int_t j=1; j!=spvzewa->GetNbinsY()+1; ++j) {
6c0d2d67 3920 spvzega->SetBinContent(i,j,0);
3921 spvzega->SetBinError(i,j,0);
3922 spvzewa->SetBinContent(i,j,0);
3923 spvzewa->SetBinError(i,j,0);
3924 spvzea->SetBinContent(i,j,0);
3925 spvzea->SetBinError(i,j,0);
3926 spvzec->SetBinContent(i,j,0);
3927 spvzec->SetBinError(i,j,0);
3928 double a = uQa->GetBinContent(i,j);
3929 double b = uQc->GetBinContent(i,j);
3930 double c = qaqc->GetBinContent(i,j);
3931 double at = qaqt->GetBinContent(i,j);
3932 double bt = qcqt->GetBinContent(i,j);
52476a4c 3933 if(TMath::AreEqualAbs(a,0,1e-100)) {printf("skipping A\n"); continue;}
3934 if(TMath::AreEqualAbs(b,0,1e-100)) {printf("skipping B\n"); continue;}
3935 if(TMath::AreEqualAbs(c,0,1e-100)) {printf("skipping C\n"); continue;}
3936 if(TMath::AreEqualAbs(at,0,1e-100)) {printf("skipping AT\n"); continue;}
3937 if(TMath::AreEqualAbs(bt,0,1e-100)) {printf("skipping CT\n"); continue;}
6c0d2d67 3938 // nominal spvzea
3939 double aa = c*at/bt;
52476a4c 3940 if(aa<1e-100) {printf("AA\n"); continue;}
6c0d2d67 3941 double vna = a/TMath::Sqrt(aa);
52476a4c 3942 spvzea->SetBinContent(i,j,vna);
6c0d2d67 3943 // nominal spvzec
3944 double bb = c*bt/at;
52476a4c 3945 if(bb<1e-100) {printf("BB\n"); continue;}
6c0d2d67 3946 double vnc = b/TMath::Sqrt(bb);
3947 spvzec->SetBinContent(i,j,vnc);
3948 //nominal spvzewa
3949 double vnwa = (cvzea2*vna + cvzec2*vnc) / (cvzea2+cvzec2);
52476a4c 3950 spvzewa->SetBinContent(i,j,vnwa);
6c0d2d67 3951 // nominal spvzega
3952 double vnga = a*b/c;
3953 if(vnga<1e-100) continue;
3954 vnga = TMath::Sqrt(vnga);
3955 spvzega->SetBinContent(i,j,vnga);
3956 // errors
3957 int k = spvzea->GetBin(i,j);
3958 double asw = uQa->GetBinEntries(k);
3959 double bsw = uQc->GetBinEntries(k);
3960 double csw = qaqc->GetBinEntries(k);
3961 if(asw<1e-100||bsw<1e-100||csw<1e-100) continue;
3962 double asww = pasww->At(k);
3963 double bsww = pbsww->At(k);
3964 double csww = pcsww->At(k);
3965 if(asww<1e-100||bsww<1e-100||csww<1e-100) continue;
3966 if((1<asww/asw/asw)||(1<bsww/bsw/bsw)||(1<csww/csw/csw)) continue;
3967 double ab = uQauQc->GetBinContent(i,j);
3968 double ac = uQaqaqc->GetBinContent(i,j);
3969 double bc = uQcqaqc->GetBinContent(i,j);
3970 double absw = uQauQc->GetBinEntries(k);
3971 double acsw = uQaqaqc->GetBinEntries(k);
3972 double bcsw = uQcqaqc->GetBinEntries(k);
3973 if(TMath::AreEqualAbs(1,absw/asw/bsw,1e-100)||TMath::AreEqualAbs(1,bcsw/bsw/csw,1e-100)||TMath::AreEqualAbs(1,acsw/asw/csw,1e-100)) continue;
3974 double ea = uQa->GetBinError(i,j)*TMath::Sqrt(asww)/asw/TMath::Sqrt(1-asww/asw/asw);
3975 double eb = uQc->GetBinError(i,j)*TMath::Sqrt(bsww)/bsw/TMath::Sqrt(1-bsww/bsw/bsw);
3976 double ec = qaqc->GetBinError(i,j)*TMath::Sqrt(csww)/csw/TMath::Sqrt(1-csww/csw/csw);
3977 double eab = (ab-a*b)/(1-absw/asw/bsw)*absw/asw/bsw;
3978 double ebc = (bc-b*c)/(1-bcsw/bsw/csw)*bcsw/bsw/csw;
3979 double eac = (ac-a*c)/(1-acsw/asw/csw)*acsw/asw/csw;
3980 double nc, nec, neac, nebc;
3981 nc = c*at/bt;
3982 nec = ec*at/bt;
3983 neac = eac*at/bt;
3984 nebc = ebc*at/bt;
3985 double evna = 1.0/TMath::Abs(nc*nc*nc) * ( nc*nc*ea*ea + a*a/4.0*nec*nec - a*TMath::Abs(nc)*neac*neac );
3986 nc = c*bt/at;
3987 nec = ec*bt/at;
3988 neac = eac*bt/at;
3989 nebc = ebc*bt/at;
3990 double evnc = 1.0/TMath::Abs(nc*nc*nc) * ( nc*nc*eb*eb + b*b/4.0*nec*nec - b*TMath::Abs(nc)*nebc*nebc );
3991 if(evna>1e-100) evna = TMath::Sqrt(evna); else evna=0;
3992 if(evnc>1e-100) evnc = TMath::Sqrt(evnc); else evnc=0;
3993 spvzea->SetBinError(i,j,evna);
3994 spvzec->SetBinError(i,j,evnc);
3995 double evnwa = TMath::Sqrt( cvzea2*cvzea2*evna*evna + cvzec2*cvzec2*evnc*evnc )/(cvzea2+cvzec2);
3996 spvzewa->SetBinError(i,j,evnwa);
3997 double evnga = 0.25/c/c * ( TMath::Abs(b*c/a)*ea*ea + TMath::Abs(a*c/b)*eb*eb + TMath::Abs(a*b/c)*ec*ec + 2*c*eab - 2*a*ebc - 2*b*eac );
3998 if(evnga>1e-100) evnga = TMath::Sqrt(evnga); else evnga=0;
3999 spvzega->SetBinError(i,j,evnga);
4000 }
4001 }
4002 printf("<<%s>> QC TPC\n",name.Data());
4003 //Qcumulants
4004 TH2D *resC2 = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_Cum2" );
4005 TH2D *resC4 = (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_Cum4" );
4006 TH2D *resDC2= (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DCum2" );
4007 TH2D *resDC4= (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DCum4" );
4008 TH2D *resvn2= (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_vn2" );
4009 TH2D *resvn4= (TH2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_vn4" );
4010 //correlators
4011 TProfile2D *c2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2" ));
4012 TProfile2D *c4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4" ));
4013 TProfile2D *dc2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2" ));
4014 TProfile2D *dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC4" ));
4015 TProfile2D *c2c4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2C4" ));
4016 TProfile2D *c2dc2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC2" ));
4017 TProfile2D *c2dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C2DC4" ));
4018 TProfile2D *c4dc2 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC2" ));
4019 TProfile2D *c4dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_C4DC4" ));
4020 TProfile2D *dc2dc4 = ((TProfile2D*)((TList*)fList->FindObject(name.Data()))->FindObject( "QC_DC2DC4" ));
4021 TArrayD *c2sww = c2->GetBinSumw2();
4022 TArrayD *c4sww = c4->GetBinSumw2();
4023 TArrayD *dc2sww= dc2->GetBinSumw2();
4024 TArrayD *dc4sww= dc4->GetBinSumw2();
4025 for(Int_t i=1; i!=resvn2->GetNbinsX()+1; ++i) {
4026 for(Int_t j=1; j!=resvn2->GetNbinsY()+1; ++j) {
4027 // cn{2}
4028 int k = c2->GetBin(i,j);
4029 double v_c2sw = c2->GetBinEntries(k);
4030 if(v_c2sw<1e-100) continue;
4031 double v_c2sww = c2sww->At(k);
4032 double v_c2 = c2->GetBinContent(i,j);
4033 double e_c2 = TMath::Sqrt(v_c2sww)/v_c2sw*c2->GetBinError(i,j);
4034 double cum2 = v_c2;
4035 double ecum2= e_c2;
4036 resC2->SetBinContent(i,j, cum2 );
4037 resC2->SetBinError(i,j, ecum2 );
4038 // cn{4}
4039 double v_c4sw = c4->GetBinEntries(k);
4040 if(v_c4sw<1e-100) continue;
4041 double v_c4sww = c4sww->At(k);
4042 double v_c4 = c4->GetBinContent(i,j);
4043 double e_c4 = TMath::Sqrt(v_c4sww)/v_c4sw*c4->GetBinError(i,j);
4044 double v_c2c4 = c2c4->GetBinContent(i,j);
4045 double v_c2c4sw = c2c4->GetBinEntries(k);
4046 if(TMath::AreEqualAbs(v_c2c4sw/v_c2sw/v_c4sw,1,1e-100)) continue;
4047 double covc2c4 = v_c2c4sw/v_c2sw/v_c4sw*(v_c2c4 - v_c2*v_c4)/(1-v_c2c4sw/v_c2sw/v_c4sw);
4048 double cum4 = v_c4 - 2*v_c2*v_c2;
4049 double ecum4= 16.0*v_c2*v_c2*e_c2*e_c2 + e_c4*e_c4 - 8.0*v_c2*covc2c4;
4050 if(ecum4<1e-100) continue;
4051 ecum4 = TMath::Sqrt( ecum4 );
4052 resC4->SetBinContent(i,j, cum4 );
4053 resC4->SetBinError(i,j, ecum4 );
4054 // dn{2}
4055 double v_dc2sw = dc2->GetBinEntries(k);
4056 if(v_dc2sw<1) continue;
4057 double v_dc2 = dc2->GetBinContent(i,j);
4058 double v_dc2sww = dc2sww->At(k);
4059 double e_dc2 = TMath::Sqrt(v_dc2sww)/v_dc2sw*dc2->GetBinError(i,j);
4060 double dcum2 = v_dc2;
4061 double edcum2= e_dc2;
4062 resDC2->SetBinContent(i,j, dcum2 );
4063 resDC2->SetBinError(i,j, edcum2 );
4064 // v2{2}
4065 if(v_c2<1e-100) continue;
4066 double dv22 = v_dc2/TMath::Sqrt(v_c2);
4067 double v_c2dc2 = c2dc2->GetBinContent(i,j);
4068 double v_c2dc2sw = c2dc2->GetBinEntries(k);
4069 if(TMath::AreEqualAbs(v_c2dc2sw/v_c2sw/v_dc2sw,1,1e-100)) continue;
4070 double covc2dc2 = v_c2dc2sw/v_c2sw/v_dc2sw*(v_c2dc2 - v_c2*v_dc2)/(1-v_c2dc2sw/v_c2sw/v_dc2sw);
4071 double edv22 = 0.25/v_c2/v_c2/v_c2*(v_dc2*v_dc2*e_c2*e_c2 + 4*v_c2*v_c2*e_dc2*e_dc2 - 4*v_c2*v_dc2*covc2dc2);
4072 //printf("%d >> dv22 %.16f || edv22^2 %.16f |||| v_c2dc2 %.16f | v_c2dc2sw %.16f | covc2dc2 %.16f \n", i,dv22,edv22,v_c2dc2,v_c2dc2sw,covc2dc2);
4073 if(edv22<1e-100) continue;
4074 edv22 = TMath::Sqrt(edv22);
4075 resvn2->SetBinContent(i,j,dv22);
4076 resvn2->SetBinError(i,j,edv22);
4077 // dn{4}
4078 double v_dc4sw = dc4->GetBinEntries(k);
4079 if(v_dc4sw<1) continue;
4080 double v_dc4 = dc4->GetBinContent(i,j);
4081 double v_dc4sww = dc4sww->At(k);
4082 double e_dc4 = TMath::Sqrt(v_dc4sww)/v_dc4sw*dc4->GetBinError(i,j);
4083 double dcum4 = v_dc4 - 2*v_c2*v_dc2;
4084 double v_c2dc4 = c2dc4->GetBinContent(i,j);
4085 double v_c2dc4sw = c2dc4->GetBinEntries(k);
4086 if(TMath::AreEqualAbs(v_c2dc4sw/v_c2sw/v_dc4sw,1,1e-100)) continue;
4087 double covc2dc4 = v_c2dc4sw/v_c2sw/v_dc4sw*(v_c2dc4 - v_c2*v_dc4)/(1-v_c2dc4sw/v_c2sw/v_dc4sw);
4088 double v_dc2dc4 = dc2dc4->GetBinContent(i,j);
4089 double v_dc2dc4sw = dc2dc4->GetBinEntries(k);
4090 if(TMath::AreEqualAbs(v_dc2dc4sw/v_dc2sw/v_dc4sw,1,1e-100)) continue;
4091 double covdc2dc4 = v_dc2dc4sw/v_dc2sw/v_dc4sw*(v_dc2dc4 - v_dc2*v_dc4)/(1-v_dc2dc4sw/v_dc2sw/v_dc4sw);
4092 double edcum4= ( +4.0*v_dc2*v_dc2*e_c2*e_c2
4093 +4.0*v_c2*v_c2*e_dc2*e_dc2
4094 +e_dc4*e_dc4
4095 +8.0*v_c2*v_dc2*covc2dc2
4096 -4.0*v_dc2*covc2dc4
4097 -4.0*v_c2*covdc2dc4 );
4098 if(edcum4<1e-100) continue;
4099 edcum4 = TMath::Sqrt(edcum4);
4100 resDC4->SetBinContent(i,j, dcum4 );
4101 resDC4->SetBinError(i,j, edcum4 );
4102 // v2{4}
4103 if(cum4>1e-100) continue;
4104 double dv24 = -dcum4/TMath::Power(-cum4,0.75);
4105 double dterm1 = 2*v_c2*v_c2*v_dc2 - 3*v_c2*v_dc4 + 2*v_c4*v_dc2;
4106 double dterm2 = 9.0/16.0*dcum4*dcum4;
4107 double dterm3 = 4.0*v_c2*v_c2*cum4*cum4;
4108 double dterm4 = cum4*cum4;
4109 double dterm5 = -3.0/2.0*dcum4*dterm1;
4110 double dterm6 = -4.0*v_c2*cum4*dterm1;
4111 double dterm7 = -2.0*cum4*dterm1;
4112 double dterm8 = 3.0*v_c2*cum4*dcum4;
4113 double dterm9 = 3.0/2.0*cum4*dcum4;
4114 double dterm10= 4*v_c2*cum4*cum4;
4115 double v_c4dc2 = c4dc2->GetBinContent(i,j);
4116 double v_c4dc2sw = c4dc2->GetBinEntries(k);
4117 if(TMath::AreEqualAbs(v_c4dc2sw/v_c4sw/v_dc2sw,1,1e-100)) continue;
4118 double covc4dc2 = v_c4dc2sw/v_c4sw/v_dc2sw*(v_c4dc2 - v_c4*v_dc2)/(1-v_c4dc2sw/v_c4sw/v_dc2sw);
4119 double v_c4dc4 = c4dc4->GetBinContent(i,j);
4120 double v_c4dc4sw = c4dc4->GetBinEntries(k);
4121 if(TMath::AreEqualAbs(v_c4dc4sw/v_c4sw/v_dc4sw,1,1e-100)) continue;
4122 double covc4dc4 = v_c4dc4sw/v_c4sw/v_dc4sw*(v_c4dc4 - v_c4*v_dc4)/(1-v_c4dc4sw/v_c4sw/v_dc4sw);
4123 double edv24= 1.0/TMath::Power(-cum4,3.5)*(+dterm1*dterm1*e_c2*e_c2
4124 +dterm2*e_c4*e_c4
4125 +dterm3*e_dc2*e_dc2
4126 +dterm4*e_dc4*e_dc4
4127 -dterm5*covc2c4
4128 -dterm6*covc2dc2
4129 +dterm7*covc2dc4
4130 +dterm8*covc4dc2
4131 -dterm9*covc4dc4
4132 -dterm10*covdc2dc4);
4133 if(edv24<1e-100) continue;
4134 edv24 = TMath::Sqrt(edv24);
4135 resvn4->SetBinContent(i,j,dv24);
4136 resvn4->SetBinError(i,j,edv24);
4137 }
4138 }
24373b38 4139}
52476a4c 4140
4141//=======================================================================
4142void AliAnalysisTaskFlowStrange::OpenToyModel() {
4143 fList = new TList();
4144 fList->SetOwner();
4145
4146 TList *tList;
4147 tList=new TList(); tList->SetName("ToyVn"); tList->SetOwner(); AddDecayVn(tList); fList->Add(tList);
4148 AddMakeQSpy();
4149
4150 fRFPAminEta=-0.9;
4151 fRFPAmaxEta=0.0;
4152 fRFPCminEta=0.0;
4153 fRFPCmaxEta=+0.9;
4154}
4155//=======================================================================
4156void AliAnalysisTaskFlowStrange::CloseToyModel() {
4157 ComputeChi2VZERO();
4158 ComputeDecayVn("ToyVn");
4159}
4160//=======================================================================
4161void AliAnalysisTaskFlowStrange::MakeToyEvent( Int_t seed, Int_t m_decay,Double_t v_decay,
4162 Double_t mass_decay_mu,Double_t mass_decay_sg,
4163 Int_t m_bgr,Double_t v_bgr,
4164 Int_t mtpc_a,Double_t v_tpca,Int_t mtpc_c,Double_t v_tpcc,
4165 Int_t mvze_a,Double_t v_vzea,Int_t mvze_c,Double_t v_vzec ) {
4166 gRandom->SetSeed( seed );
4167 // QVectors
4168 fMCEP = gRandom->Rndm()*TMath::Pi();
4169 TF1 tf1_tpca( "dphitpca", Form("1+2*%f*TMath::Cos(2*x)",v_tpca),0,TMath::TwoPi() );
4170 TF1 tf1_tpcc( "dphitpcc", Form("1+2*%f*TMath::Cos(2*x)",v_tpcc),0,TMath::TwoPi() );
4171 TF1 tf1_vzea( "dphivzea", Form("1+2*%f*TMath::Cos(2*x)",v_vzea),0,TMath::TwoPi() );
4172 TF1 tf1_vzec( "dphivzec", Form("1+2*%f*TMath::Cos(2*x)",v_vzec),0,TMath::TwoPi() );
4173 TF1 tf1_decay( "dphidecay", Form("1+2*%f*TMath::Cos(2*x)",v_decay),0,TMath::TwoPi() );
4174 TF1 tf1_bgr( "dphibgr", Form("1+2*%f*TMath::Cos(2*x)",v_bgr),0,TMath::TwoPi() );
4175 Double_t phi, eta;
4176 fQTPCACos=fQTPCASin=fQTPCA=0;
4177 fQTPCCCos=fQTPCCSin=fQTPCC=0;
4178 fQTPC2hCos=fQTPC2hSin=0;
4179 fQVZEACos=fQVZEASin=fQVZEA=0;
4180 fQVZECCos=fQVZECSin=fQVZEC=0;
4181 for(int m=0; m!=mtpc_a; ++m) {
4182 phi = tf1_tpca.GetRandom() + fMCEP;
4183 if(phi>TMath::TwoPi()) phi -= TMath::TwoPi();
4184 eta = gRandom->Rndm()*(fRFPAmaxEta-fRFPAminEta)+fRFPAminEta;
4185 fQTPCACos += TMath::Cos(fHarmonic*phi);
4186 fQTPCASin += TMath::Sin(fHarmonic*phi);
4187 fQTPCA += 1;
4188 fQTPC2hCos += TMath::Cos(2*fHarmonic*phi);
4189 fQTPC2hSin += TMath::Sin(2*fHarmonic*phi);
4190 fQTPCA_fID[m] = -99;
4191 ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCAllPhiEta"))->Fill( phi, eta );
4192 }
4193 for(int m=0; m!=mtpc_c; ++m) {
4194 phi = tf1_tpcc.GetRandom() + fMCEP;
4195 if(phi>TMath::TwoPi()) phi -= TMath::TwoPi();
4196 eta = gRandom->Rndm()*(fRFPCmaxEta-fRFPCminEta)+fRFPCminEta;
4197 fQTPCCCos += TMath::Cos(fHarmonic*phi);
4198 fQTPCCSin += TMath::Sin(fHarmonic*phi);
4199 fQTPCC += 1;
4200 fQTPC2hCos += TMath::Cos(2*fHarmonic*phi);
4201 fQTPC2hSin += TMath::Sin(2*fHarmonic*phi);
4202 fQTPCC_fID[m] = -99;
4203 ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("TPCAllPhiEta"))->Fill( phi, eta );
4204 }
4205 for(int m=0; m!=mvze_a; ++m) {
4206 phi = tf1_vzea.GetRandom() + fMCEP;
4207 if(phi>TMath::TwoPi()) phi -= TMath::TwoPi();
4208 eta = gRandom->Rndm()*2-3.5;
4209 fQVZEACos += TMath::Cos(fHarmonic*phi);
4210 fQVZEASin += TMath::Sin(fHarmonic*phi);
4211 fQVZEA += 1;
4212 ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEAllPhiEta"))->Fill( phi, eta );
4213 }
4214 for(int m=0; m!=mvze_c; ++m) {
4215 phi = tf1_vzec.GetRandom() + fMCEP;
4216 if(phi>TMath::TwoPi()) phi -= TMath::TwoPi();
4217 eta = gRandom->Rndm()*2+2.5;
4218 fQVZECCos += TMath::Cos(fHarmonic*phi);
4219 fQVZECSin += TMath::Sin(fHarmonic*phi);
4220 fQVZEC += 1;
4221 ((TH2D*)((TList*)fList->FindObject("MakeQSpy"))->FindObject("VZEAllPhiEta"))->Fill( phi, eta );
4222 }
4223 fQTPCA_nTracks = mtpc_a;
4224 fQTPCC_nTracks = mtpc_c;
4225 FillMakeQSpy();
4226
4227 //decays
4228 double ptrange = fPtBinEdge[fPtBins] - fPtBinEdge[0];
4229 double pt, mass;
4230 for(int m=0; m!=m_decay; ++m) {
4231 phi = tf1_decay.GetRandom() + fMCEP;
4232 if(phi>TMath::TwoPi()) phi -= TMath::TwoPi();
4233 eta = gRandom->Rndm()*1.6-0.8;
4234 pt = gRandom->Rndm()*ptrange + fPtBinEdge[0];
4235 mass = gRandom->Gaus(mass_decay_mu,mass_decay_sg);
4236 FillDecayVn("ToyVn",mass,pt,phi,eta,+999,+999);
4237 }
4238 for(int m=0; m!=m_bgr; ++m) {
4239 phi = tf1_bgr.GetRandom() + fMCEP;
4240 if(phi>TMath::TwoPi()) phi -= TMath::TwoPi();
4241 eta = gRandom->Rndm()*1.6-0.8;
4242 pt = gRandom->Rndm()*ptrange + fPtBinEdge[0];
4243 mass = gRandom->Rndm()*(fMaxMass-fMinMass)+fMinMass;
4244 FillDecayVn("ToyVn",mass,pt,phi,eta,+999,+999);
4245 }
4246 QCStoreDecayVn("ToyVn");
4247
4248}