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