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