]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FEMTOSCOPY/K0Analysis/PLamAnalysis/AliAnalysisTaskProtonLambda.h
New CMake build implementation
[u/mrichter/AliRoot.git] / PWGCF / FEMTOSCOPY / K0Analysis / PLamAnalysis / AliAnalysisTaskProtonLambda.h
1 #ifndef ALIANALYSISTASKPROTONLAMBDA_H
2 #define ALIANALYSISTASKPROTONLAMBDA_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 // Task to study femtoscopic proton-lambda correlations
8 // Author: Hans Beck, Hans.Beck@cern.ch
9
10 // Includes. All classes used in the .h file need to be included.
11 // Your task compiles with forward declaration and including in the .cxx
12 // file, but forward declaration will fail when loading this task from
13 // a library and just including this .h file.
14 /* #include <TH1F.h> */
15 /* #include <TH2F.h> */
16 /* #include <TH3F.h> */
17 /* #include <TList.h> */
18 /* #include <TAxis.h> */
19 class TH1F;
20 class TH2F;
21 class TH3F;
22 #include <THnSparse.h>
23 class TList;
24 class TAxis;
25
26 #include <AliAnalysisTaskSE.h>
27 /* #include <AliTPCPIDResponse.h> */
28 /* #include <AliPIDResponse.h> */
29 class AliTPCPIDResponse;
30 class AliPIDResponse;
31
32 #include <AliAODEvent.h>
33 #include <AliAODVertex.h>
34 #include <AliAODv0.h>
35 #include <AliAODTrack.h>
36
37 class AliAnalysisTaskProtonLambda : public AliAnalysisTaskSE {
38   // Forward declaration for nested classes
39  private:
40   class FemtoBufferTrack;
41   class FemtoBufferV0;
42   class FemtoBufferEvent;
43   class FemtoBuffer;
44  public:
45   AliAnalysisTaskProtonLambda();                 // Dummy constructor
46   AliAnalysisTaskProtonLambda(const char *name); // Constructor
47   virtual ~AliAnalysisTaskProtonLambda();                // Destructor
48   AliAnalysisTaskProtonLambda(const AliAnalysisTaskProtonLambda& atpl); // Not implemented
49   AliAnalysisTaskProtonLambda& operator=(const AliAnalysisTaskProtonLambda& atpl); //Not implemented
50   
51   void   UserCreateOutputObjects();  // Called once at the beginning
52   void   UserExec(Option_t *option); // Main loop
53   void   Terminate(Option_t *);      // Called once at the end
54   
55  private:
56   void   ProcessOffline(AliAODv0 *v0, AliAODTrack *pTrack, AliAODTrack *nTrack);    //! Use offline V0 finder
57   void   ProcessOnTheFly(AliAODv0 *v0, AliAODTrack *pTrack, AliAODTrack *nTrack);   //! Use on-the-fly V0 finder
58   void   ProcessTOF(AliAODTrack *track);         // Use Tof for 1.0 GeV/c < p < 3.25 GeV/c
59   void   ProcessTPC(AliAODTrack *track);         // Use TPC for p < 0.75 GeV/c
60   void   ProcessHybrid(AliAODTrack *track);      // Preselection via TPC, identification w/ Tof 0.75 GeV/c < p < 1.0 GeV/c
61   void   CleaningProcedure();         // Assure uniqueness of all daughters and primaries
62   void   ProcessReal();               // TTR cut & qinv calc for real events
63   void   ProcessMixed();              // TTR cut & qinv calc for mixed events
64   void   ProcessRealBackground();     // Check procedure with lambda background from sideband, real events
65   void   ProcessMixedBackground();    // Check procedure with lambda background from sideband, real events
66
67   Float_t Qinv(FemtoBufferV0 v01, FemtoBufferV0 v02);           // Calcs Qinv for (anti-)Lam(anti-)Lam
68   Float_t Qinv(FemtoBufferV0 v0, FemtoBufferTrack track);       // Calcs Qinv for (anti-)Lam(anti-)Pro
69   Float_t Qinv(FemtoBufferTrack track, FemtoBufferV0 v0);       // Calls Qinv(v0, track)
70   Float_t QinvProPro(FemtoBufferTrack proTrack1,
71                      FemtoBufferTrack proTrack2);               // Calcs Qinv for proton proton
72   Float_t QinvPioPro(FemtoBufferTrack pioTrack,
73                      FemtoBufferTrack proTrack);                // Calcs Qinv for pion proton
74   Float_t QinvConstr(FemtoBufferV0 v0, FemtoBufferTrack track); // w/ vtx constraint for pri pro
75   Float_t QinvConstr(FemtoBufferTrack track, FemtoBufferV0 v0); // Calls QinvConstr(v0, track)
76   Float_t Minv(FemtoBufferV0 v01, FemtoBufferV0 v02);           // Calcs Minv for (anti-)Lam(anti-)Lam
77   Float_t Minv(FemtoBufferV0 v0, FemtoBufferTrack track);       // Calcs Minv for (anti-)Lam(anti-)Pro
78   Float_t Minv(FemtoBufferTrack track, FemtoBufferV0 v0);       // Calls Minv(v0, track)
79   Float_t mt(FemtoBufferTrack track, FemtoBufferV0 v0);         // mt of pair
80   Float_t mt(FemtoBufferV0 v0, FemtoBufferTrack track);         //    ""
81   Float_t mt(FemtoBufferV0 v01, FemtoBufferV0 v02);             //    ""
82   static Float_t ktSquared(FemtoBufferV0 v01, FemtoBufferV0 v02);      // kt squared
83   static Float_t ktSquared(FemtoBufferTrack track, FemtoBufferV0 v0);  //    ""
84   static Float_t ktSquared(FemtoBufferV0 v0, FemtoBufferTrack track);  //    ""
85   static Float_t calcDist(const Float_t r1[3], const Float_t r2[3]);   // Calcs the distance between vector r1 and r2
86   //  static Float_t calcDistSft(const Float_t r1[3], const Float_t r2[3], 
87   //                         const FemtoBufferEvent *evt1,
88   //                         const FemtoBufferEvent *evt2);            // Calcs the distance between vector r1 and r2 shifting them first to originate both in (0,0,0)
89   Bool_t  goodDCA(AliAODTrack *track);                  //! Does a cut on the DCAxy value and fills a histogram
90   Float_t RapidityProton(AliAODTrack *track);           //! Rapidity assuming proton mass
91   //  void    getTPConlyV0Info(const AliAODTrack *posDaughter,const AliAODTrack *negDaughter, Double_t tpcV0Mom[3], Double_t TPConlyV0MinvLam, Double_t TPConlyV0MinvALam);   //! Get V0 momentum and invariant mass using TPC only tracks
92
93   // For AOD tracks, need a function to get the dca
94   static Float_t DCAxy(const AliAODTrack *track, const AliVEvent *evt); 
95   void StoreGlobalTrackReference(AliAODTrack *track);      // Store pointer to global track
96   void ResetGlobalTrackReference();                        // Reset all pointers to global tracks
97   Bool_t acceptTrack(const AliAODTrack *track);            // Famous crossed rows / findable clusters
98   Bool_t GoodTPCFitMapSharedMap(const AliAODTrack *track); // Rejects shared clusters, primaries
99   Bool_t GoodTPCFitMapSharedMap(const AliAODTrack *pTrack,
100                                 const AliAODTrack *nTrack);// Rejects shared clusters, two V0 daughters
101   Float_t GetCorrectedTOFSignal(const AliVTrack *track);   // Return correct TOF signal for old and new AODs
102   void FillDedxHist(const AliVTrack *track);               // Fill dE/dx histograms
103
104   const Bool_t   fkUseOnTheFly;            //! Use on-the-fly or offline V0 finder
105   const Float_t  fkAbsZvertexCut;          //! Values of Zvertex and centrality cut
106   const Float_t  fkCentCut;                //! are needed for event mixing
107   const Float_t  fkLamMass;                //! PDG-Mass of the lambda particle
108   const Float_t  fkProMass;                //! PDG-Mass of the lambda particle
109   const Float_t  fkPioMass;                //! PDG-Mass of the lambda particle
110
111   Double_t       fPrimaryVtxPosition[3];   //! Position of prim. vertex
112
113   AliPIDResponse  *fPIDResponse;           //! PID response object
114   AliTPCPIDResponse *fTpcResponse;         //! Bethe-Bloch parametrisation
115
116
117   FemtoBuffer     *fFemtoBuffer;           //! Event mixing: event collection
118   
119   AliAODEvent     *fAOD;                   //! AOD event
120   AliAODVertex    *fPrimaryVtx;            //! AOD vertex
121
122   TList           *fOutputList;            //! V0 output list 
123   TList           *fOutputPrimaries;       //! Primaries output list
124   TList           *fOutput2Part;           //! Two-particle output list
125
126   // Store pointers to global tracks for pid and dca
127   AliAODTrack     **fGTI;                  //! Array of pointers, just nicely sorted according to the id
128   const UShort_t  fTrackBuffSize;          //! Size fo the above array, ~12000 for PbPb
129   //
130   //! ---------        Histograms        ---------
131   //
132   TH1F        *fHistGoodEvent;                  //! Control hist for event cuts
133
134   // Low memory version: just get rid of a lot of histograms
135   /* TH2F        *fHistPrimaryVertexPosXY;         //! Primary vertex position in XY */
136   /* TH1F        *fHistPrimaryVertexPosZ;          //! Primary vertex position in Z */
137   /* TH1F        *fHistTrackMultiplicity;          //! Track multiplicity distribution */
138
139   /* TH1F        *fHistShareV0pos;                 //! Number of shared clusters, V0 pos daughter */
140   /* TH1F        *fHistShareV0neg;                 //! Number of shared clusters, V0 neg daughter */
141
142   /* TH2F        *fHistPosTofBeforeCut;            //! Tof signal for pos. daughter w/o cut */
143   /* TH2F        *fHistPosTofAfterCut;             //! Tof signal for pos. daughter with cut */
144   /* TH2F        *fHistNegTofBeforeCut;            //! Tof signal for pos. daughter w/o cut */
145   /* TH2F        *fHistNegTofAfterCut;             //! Tof signal for pos. daughter with cut */
146   /* TH2F        *fHistPosTpcBeforeCut;            //! Tpc signal for pos. daughter w/o cut */
147   /* TH2F        *fHistPosTpcAfterCut;             //! Tpc signal for pos. daughter with cut */
148   /* TH2F        *fHistNegTpcBeforeCut;            //! Tpc signal for pos. daughter w/o cut */
149   /* TH2F        *fHistNegTpcAfterCut;             //! Tpc signal for pos. daughter with cut */
150   
151   /* TH2F        *fHistGoodV0;                     //! Control histogram for cuts */
152   /* TH2F        *fHistCorrectSigns;               //! Check of sign of tracks */
153   /* TH2F        *fHistDcaPosToPrimVertex;         //! DCA of pos daughter to primary vertex */
154   /* TH2F        *fHistDcaNegToPrimVertex;         //! DCA of neg daughter to primary vertex */
155   /* TH2F        *fHistDcaPosToPrimVertexZoom;     //! Zoom */
156   /* TH2F        *fHistDcaNegToPrimVertexZoom;     //! Zoom */
157   /* TH2F        *fHistRadiusV0;                   //! Radial position of V0 vertex */
158   /* TH2F        *fHistDecayLengthV0;              //! Dist prim. vertex - V0 vertex */
159   /* TH2F        *fHistDcaV0Daughters;             //! DCA of daughters */
160   /* TH2F        *fHistChi2;                       //! Chi2 for V0 vertex */
161   /* TH2F        *fHistCosPointAngle;              //! Cosine of pointing angle */
162   /* TH2F        *fHistCosPointAngleZoom;          //! Zoom */
163
164   TH1F        *fHistSideBandOffLam;             //! Off: side band background lambda
165   TH1F        *fHistSideBandOffALam;            //! Off: side band background anti-lambda
166
167   TH2F        *fHistTPCNclsPosOffLam;           //! Off: lam-mass vs TPCNcls(pos daughter)
168   TH2F        *fHistTPCNclsNegOffLam;           //! Off: lam-mass vs TPCNcls(neg daughter)
169   TH2F        *fHistTPCNclsPosOffALam;          //! Off: alam-mass vs TPCNcls(pos daughter)
170   TH2F        *fHistTPCNclsNegOffALam;          //! Off: alam-mass vs TPCNcls(neg daughter)
171   /* TH2F        *fHistPosNsigmaTpcOffLam;         //! */
172   /* TH2F        *fHistPosNsigmaTpcOffALam;        //! */
173   /* TH2F        *fHistNegNsigmaTpcOffLam;         //! */
174   /* TH2F        *fHistNegNsigmaTpcOffALam;        //! */
175   /* TH2F        *fHistUseTofOffLam;               //! */
176   /* TH2F        *fHistUseTofOffALam;              //! */
177   /* TH2F        *fHistDcaPosOffLam;               //! Off: lam-mass vs DCA(pos - prim. vertex) */
178   /* TH2F        *fHistDcaPosOffALam;              //! Off: alam-mass vs DCA(pos - prim. vertex) */
179   /* TH2F        *fHistDcaNegOffLam;               //! Off: lam-mass vs DCA(neg - prim. vertex) */
180   /* TH2F        *fHistDcaNegOffALam;              //! Off: alam-mass vs DCA(neg - prim. vertex) */
181   /* TH2F        *fHistDcaV0DaughtersOffLam;       //! Off: lam-mass vs DCA(V0-daughters) */
182   /* TH2F        *fHistDcaV0DaughtersOffALam;      //! Off: alam-mass vs DCA(V0-daughters) */
183   /* TH2F        *fHistCosPointLamOff;             //! Off: lam-mass vs cosine(pointing angle) */
184   /* TH2F        *fHistCosPointALamOff;            //! Off: Alam-mass vs cosine(pointing angle) */
185   /* TH2F        *fHistCosPointLamZoomOff;         //! Zoom */
186   /* TH2F        *fHistCosPointALamZoomOff;        //! Zoom */
187   /* TH2F        *fHistV0RadiusLamOff;             //! Off: lam-mass vs radial position(V0) */
188   /* TH2F        *fHistV0RadiusALamOff;            //! Off: alam-mass vs radial position(V0) */
189   /* TH2F        *fHistV0DecayLengthLamOff;        //! Off: lam-mass vs decay length(V0) */
190   /* TH2F        *fHistV0DecayLengthALamOff;       //! Off: alam-mass vs decay length(V0) */
191   /* TH2F        *fHistDcaV0PriVertexLamOff;       //! Off: lam-mass vs dca (prim. vertex - V0) */
192   /* TH2F        *fHistDcaV0PriVertexALamOff;      //! Off: alam-mass vs dca (prim. vertex - V0) */
193   TH1F        *fHistMassLambdaOff;              //! Off: invariant mass assuming lambda
194   TH1F        *fHistMassAntiLambdaOff;          //! Off: invariant mass assuming anti-lambda
195   /* TH2F        *fHistPtVsMassLambdaOff;          //! Off: lam-mass vs pt(V0) */
196   /* TH2F        *fHistPtVsMassAntiLambdaOff;      //! Off: alam-mass vs pt(V0) */
197   TH3F        *fHistYPtMassLamOff;              //! Off: lam-mass vs y-pt
198   TH3F        *fHistYPtMassALamOff;             //! Off: alam-mass vs y-pt
199   /* TH2F        *fHistPtVsYLambdaOff;             //! Off: y-pt (lambda) */
200   /* TH2F        *fHistPtVsYAntiLambdaOff;         //! Off: y-pt (anti-lambda) */
201   
202   TH1F        *fHistSideBandOnLam;              //! On-the-fly: side band background lambda
203   TH1F        *fHistSideBandOnALam;             //! On-the-fly: side band background anti-lambda
204
205   /* TH2F        *fHistLikeSignOnLam;              //! On-the-fly: lambda mass vs signs of pairs */
206   /* TH2F        *fHistLikeSignOnALam;             //! On-the-fly: antilambda mass vs signs of pairs */
207   TH2F        *fHistTPCNclsPosOnLam;            //! On: lam-mass vs TPCNcls(pos daughter)
208   TH2F        *fHistTPCNclsNegOnLam;            //! On: lam-mass vs TPCNcls(neg daughter)
209   TH2F        *fHistTPCNclsPosOnALam;           //! On: alam-mass vs TPCNcls(pos daughter)
210   TH2F        *fHistTPCNclsNegOnALam;           //! On: alam-mass vs TPCNcls(neg daughter)
211   /* TH2F        *fHistPosNsigmaTpcOnLam;          //! */
212   /* TH2F        *fHistPosNsigmaTpcOnALam;         //! */
213   /* TH2F        *fHistNegNsigmaTpcOnLam;          //! */
214   /* TH2F        *fHistNegNsigmaTpcOnALam;         //!  */
215   /* TH2F        *fHistUseTofOnLam;                //! */
216   /* TH2F        *fHistUseTofOnALam;               //! */
217   /* TH2F        *fHistDcaPosOnLam;                //! On: lam-mass vs DCA(pos - prim. vertex) */
218   /* TH2F        *fHistDcaPosOnALam;               //! On: alam-mass vs DCA(pos - prim. vertex) */
219   /* TH2F        *fHistDcaNegOnLam;                //! On: lam-mass vs DCA(neg - prim. vertex) */
220   /* TH2F        *fHistDcaNegOnALam;               //! On: alam-mass vs DCA(neg - prim. vertex) */
221   /* TH2F        *fHistDcaV0DaughtersOnLam;        //! On: lam-mass vs DCA(V0-daughters) */
222   /* TH2F        *fHistDcaV0DaughtersOnALam;       //! On: alam-mass vs DCA(V0-daughters) */
223   /* TH2F        *fHistCosPointLamOn;              //! On: lam-mass vs cosine(pointing angle) */
224   /* TH2F        *fHistCosPointALamOn;             //! On: Alam-mass vs cosine(pointing angle) */
225   /* TH2F        *fHistCosPointLamZoomOn;          //! Zoom */
226   /* TH2F        *fHistCosPointALamZoomOn;         //! Zoom */
227   /* TH2F        *fHistV0RadiusLamOn;              //! On: lam-mass vs radial position(V0) */
228   /* TH2F        *fHistV0RadiusALamOn;             //! On: alam-mass vs radial position(V0) */
229   /* TH2F        *fHistV0DecayLengthLamOn;         //! On: lam-mass vs decay length(V0) */
230   /* TH2F        *fHistV0DecayLengthALamOn;        //! On: alam-mass vs decay length(V0) */
231   /* TH2F        *fHistDcaV0PriVertexLamOn;        //! On: lam-mass vs dca (prim. vertex - V0) */
232   /* TH2F        *fHistDcaV0PriVertexALamOn;       //! On: alam-mass vs dca (prim. vertex - V0) */
233   /* TH2F        *fHistChi2TPCPosLamOn;            //! On: Chi2 TPC clusters */
234   /* TH2F        *fHistChi2TPCPosALamOn;           //! */
235   /* TH2F        *fHistChi2TPCNegLamOn;            //! */
236   /* TH2F        *fHistChi2TPCNegALamOn;           //! */
237   /* TH1F        *fHistMinvTPConlyLamOn;           //! On: minv w/ TPC only daughters, lambda */
238   /* TH1F        *fHistMinvTPConlyALamOn;          //! On:        --""--             , anti-lambda */
239   TH1F        *fHistMassLambdaOn;               //! On: invariant mass assuming lambda
240   TH1F        *fHistMassAntiLambdaOn;           //! On: invariant mass assuming anti-lambda
241   /* TH2F        *fHistPtVsMassLambdaOn;           //! On: lam-mass vs pt(V0) */
242   /* TH2F        *fHistPtVsMassAntiLambdaOn;       //! On: alam-mass vs pt(V0) */
243   TH3F        *fHistYPtMassLamOn;               //! On: lam-mass vs y-pt
244   TH3F        *fHistYPtMassALamOn;              //! On: alam-mass vs y-pt
245   /* TH2F        *fHistPtVsYLambdaOn;              //! On: y-pt (lambda) */
246   /* TH2F        *fHistPtVsYAntiLambdaOn;          //! On: y-pt (anti-lambda) */
247
248   /* TH3F        *fHistMomDiffLam;                 //! Momentum difference standard V0 / */
249   /* TH3F        *fHistMomDiffALam;                //! TPC only V0 */
250   /* TH3F        *fHistMomDiffBgLam;               //! */
251   /* TH3F        *fHistMomDiffBgALam;              //! */
252   /* TH3F        *fHistMomDiffWoSPDLam;            //! Momentum difference standard V0 / */
253   /* TH3F        *fHistMomDiffWoSPDALam;           //! TPC only V0, only tracks without  */
254   /* TH3F        *fHistMomDiffWoSPDBgLam;          //! SPD hits */
255   /* TH3F        *fHistMomDiffWoSPDBgALam;         //! */
256
257   // Primary particles
258   TH1F        *fPriHistShare;                   //! Primaries: number of shared clusters
259   // ToF histograms
260   /* TH1F        *fPriHistPosNsigmaTof;            //! Primaries: Nsigma TOF distribution (pos) */
261   TH2F        *fPriHistPosNsigmaTofVsP;         //! Pri: Nsigma TOF vs total momentum (pos)
262   TH2F        *fPriHistPosNsigmaTofVsPt;        //! Pri: Nsigma TOF vs transverse momentum (pos)
263   /* TH1F        *fPriHistNegNsigmaTof;            //! Primaries: Nsigma TOF distribution (neg) */
264   TH2F        *fPriHistNegNsigmaTofVsP;         //! Pri: Nsigma TOF vs total momentum (neg)
265   TH2F        *fPriHistNegNsigmaTofVsPt;        //! Pri: Nsigma TOF vs transverse momentum (neg)
266   TH2F        *fPriHistTOFsignalPosVsP;         //! Pri: TOF signal vs p (pos)
267   TH2F        *fPriHistTOFsignalPosVsPt;        //! Pri: TOF signal vs pt (pos)
268   TH2F        *fPriHistTOFsignalNegVsP;         //! Pri: TOF signal vs p (neg)
269   TH2F        *fPriHistTOFsignalNegVsPt;        //! Pri: TOF signal vs pt (neg)
270   // Hybrid analysis: dEdx & ToF histograms
271   TH1F        *fPriHistHybridTOFsigPosWoTPC;    //! Pri: TOF signal without dEdx selection (pos)
272   TH1F        *fPriHistHybridTOFsigPosTPCok;    //! Pri: TOF signal with dEdx selection (pos)
273   TH1F        *fPriHistHybridTOFsigNegWoTPC;    //! Pri: TOF signal without dEdx selection (neg)
274   TH1F        *fPriHistHybridTOFsigNegTPCok;    //! Pri: TOF signal with dEdx selection (neg)
275
276   /* TH1F        *fPriHistHasTofPos;               //! Pri: 1 = TOFpid bit is there, 0 else */
277   TH2F        *fPriHistTPCsignalPos;            //! Pri: TPC dE/dx signal vs p
278   /* TH2F        *fPriHistNsigmaTPCPos;            //! Pri: Nsigma TPC distribution vs p */
279   /* TH2F        *fPriHistTPCsignalTOFcutPos;      //! Pri: dE/dx vs p + TOF sigma(proton) > -10 */
280   /* TH2F        *fPriHistNsigmaTPCTOFcutPos;      //! Pri: Nsigma TPC vs p + TOF sigma(proton) > -10 */
281   TH2F        *fPriHistTPCsignalLowPPos;        //! Pri: dEdx for 0.1 < p < 0.3
282   TH2F        *fPriHistTPCsignalMedPPos;        //! Pri: dEdx for 0.3 < p < 0.9
283   TH2F        *fPriHistTPCsignalHigPPos;        //! Pri: dEdx for 0.9 < p < 1.9
284
285   /* TH1F        *fPriHistHasTofNeg;               //! Pri: 1 = TOFpid bit is there, 0 else */
286   TH2F        *fPriHistTPCsignalNeg;            //! Pri: TPC dE/dx signal vs p
287   /* TH2F        *fPriHistNsigmaTPCNeg;            //! Pri: Nsigma TPC distribution vs p */
288   /* TH2F        *fPriHistTPCsignalTOFcutNeg;      //! Pri:   " + TOF sigma(proton) > -10 */
289   /* TH2F        *fPriHistNsigmaTPCTOFcutNeg;      //! Pri: Nsigma TPC vs p + TOF sigma(proton) > -10 */
290   TH2F        *fPriHistTPCsignalLowPNeg;        //! Pri: dEdx for 0.1 < p < 0.3
291   TH2F        *fPriHistTPCsignalMedPNeg;        //! Pri: dEdx for 0.3 < p < 0.9
292   TH2F        *fPriHistTPCsignalHigPNeg;        //! Pri: dEdx for 0.9 < p < 1.9
293
294   TH3F        *fPriHistDCAxyYPtPro;             //! Pri: DCAxy vs (y,pt) for protons
295   TH3F        *fPriHistDCAxyYPtAPro;            //! Pri: DCAxy vs (y,pt) for anti-protons
296
297   /*        // Histograms for two particle observables */
298   /* TH2F        *f2HistLamLamMeanMinDistProReal;     //! TTR: Real events */
299   /* TH2F        *f2HistLamLamMeanMinDistPioReal;     //!  */
300   /* TH2F        *f2HistLamProMeanMinDistProReal;     //!  */
301   /* TH2F        *f2HistALamALamMeanMinDistAProReal;  //!  */
302   /* TH2F        *f2HistALamALamMeanMinDistPioReal;   //!  */
303   /* TH2F        *f2HistALamAProMeanMinDistAProReal;  //!  */
304   /* TH2F        *f2HistSftLamLamMeanMinDistProReal;     //! TTR: Shifted pri vtx */
305   /* TH2F        *f2HistSftLamLamMeanMinDistPioReal;     //!  */
306   /* TH2F        *f2HistSftLamProMeanMinDistProReal;     //!  */
307   /* TH2F        *f2HistSftALamALamMeanMinDistAProReal;  //!  */
308   /* TH2F        *f2HistSftALamALamMeanMinDistPioReal;   //!  */
309   /* TH2F        *f2HistSftALamAProMeanMinDistAProReal;  //!  */
310   /* TH2F        *f2HistSftIrocLamLamMeanMinDistProReal;     //! TTR: Shifted pri vtx: IROCs */
311   /* TH2F        *f2HistSftIrocLamLamMeanMinDistPioReal;     //!  */
312   /* TH2F        *f2HistSftIrocLamProMeanMinDistProReal;     //!  */
313   /* TH2F        *f2HistSftIrocALamALamMeanMinDistAProReal;  //!  */
314   /* TH2F        *f2HistSftIrocALamALamMeanMinDistPioReal;   //!  */
315   /* TH2F        *f2HistSftIrocALamAProMeanMinDistAProReal;  //!  */
316   /* TH2F        *f2HistSftOrocLamLamMeanMinDistProReal;     //! TTR: Shifted pri vtx: OROCs */
317   /* TH2F        *f2HistSftOrocLamLamMeanMinDistPioReal;     //!  */
318   /* TH2F        *f2HistSftOrocLamProMeanMinDistProReal;     //!  */
319   /* TH2F        *f2HistSftOrocALamALamMeanMinDistAProReal;  //!  */
320   /* TH2F        *f2HistSftOrocALamALamMeanMinDistPioReal;   //!  */
321   /* TH2F        *f2HistSftOrocALamAProMeanMinDistAProReal;  //!  */
322     
323   // transverse mass mt of the pair
324   /* TH1F        *f2HistMtLamLamReal;     //! */
325   TH1F        *f2HistMtLamProReal;     //!
326   /* TH1F        *f2HistMtALamALamReal;   //! */
327   TH1F        *f2HistMtALamAProReal;   //!
328   // .. for low q pairs only
329   /* TH1F        *f2HistMtLowQLamLamReal;     //! */
330   TH1F        *f2HistMtLowQLamProReal;     //!
331   /* TH1F        *f2HistMtLowQALamALamReal;   //! */
332   TH1F        *f2HistMtLowQALamAProReal;   //!
333
334   // September '12: use a THnSparseF with 4 dimensions
335   // for pro lam: qinv propro, mean d propro
336   // min d propro, qinv lampro
337   THnSparseF       *LamProReal;  //!
338   THnSparseF       *ALamAProReal;//!
339
340   // Changed on march 4th: all correlation functions vs 
341   // distances to try out diff. cuts
342   /* TH3F        *f3HistLamLamQinvReal;                //! Qinv distribution real events */
343   /* TH3F        *f3HistALamALamQinvReal;              //!                 */
344   /* TH3F        *f3HistLamLamMinvReal;                //! Minv distribution real events */
345   /* TH3F        *f3HistLamProMinvReal;                //! */
346   /* TH3F        *f3HistALamALamMinvReal;              //!                 */
347   /* TH3F        *f3HistALamAProMinvReal;              //! */
348
349  // Background lambdas: real events
350   /* TH2F        *f2HistBgLamBgLamMeanMinDistProReal;   //! TTR: Real events */
351   /* TH2F        *f2HistBgLamBgLamMeanMinDistPioReal;   //!  */
352   /* TH2F        *f2HistBgLamProMeanMinDistProReal;     //!  */
353   /* TH2F        *f2HistBgALamBgALamMeanMinDistAProReal;//!  */
354   /* TH2F        *f2HistBgALamBgALamMeanMinDistPioReal; //!  */
355   /* TH2F        *f2HistBgALamAProMeanMinDistAProReal;  //!  */
356   /* TH2F        *f2HistSftBgLamBgLamMeanMinDistProReal;   //! TTR: Shifted pri vtx */
357   /* TH2F        *f2HistSftBgLamBgLamMeanMinDistPioReal;   //!  */
358   /* TH2F        *f2HistSftBgLamProMeanMinDistProReal;     //!  */
359   /* TH2F        *f2HistSftBgALamBgALamMeanMinDistAProReal;//!  */
360   /* TH2F        *f2HistSftBgALamBgALamMeanMinDistPioReal; //!  */
361   /* TH2F        *f2HistSftBgALamAProMeanMinDistAProReal;  //!  */
362   /* TH2F        *f2HistSftIrocBgLamBgLamMeanMinDistProReal;   //! TTR: Shifted pri vtx: IROCs */
363   /* TH2F        *f2HistSftIrocBgLamBgLamMeanMinDistPioReal;   //!  */
364   /* TH2F        *f2HistSftIrocBgLamProMeanMinDistProReal;     //!  */
365   /* TH2F        *f2HistSftIrocBgALamBgALamMeanMinDistAProReal;//!  */
366   /* TH2F        *f2HistSftIrocBgALamBgALamMeanMinDistPioReal; //!  */
367   /* TH2F        *f2HistSftIrocBgALamAProMeanMinDistAProReal;  //!  */
368   /* TH2F        *f2HistSftOrocBgLamBgLamMeanMinDistProReal;   //! TTR: Shifted pri vtx: OROCs */
369   /* TH2F        *f2HistSftOrocBgLamBgLamMeanMinDistPioReal;   //!  */
370   /* TH2F        *f2HistSftOrocBgLamProMeanMinDistProReal;     //!  */
371   /* TH2F        *f2HistSftOrocBgALamBgALamMeanMinDistAProReal;//!  */
372   /* TH2F        *f2HistSftOrocBgALamBgALamMeanMinDistPioReal; //!  */
373   /* TH2F        *f2HistSftOrocBgALamAProMeanMinDistAProReal;  //!  */
374
375   // September '12: use a THnSparseF with 4 dimensions
376   // for pro lam: qinv propro, mean d propro
377   // min d propro, qinv lampro
378   THnSparseF       *BgLamProReal;  //!
379   THnSparseF       *BgALamAProReal;//!
380
381   /* TH3F        *f3HistBgLamBgLamQinvReal;             //! Qinv distribution real events */
382   /* TH3F        *f3HistBgALamBgALamQinvReal;           //!                 */
383  
384   // Mixed events
385   /* TH2F        *f2HistLamLamMeanMinDistProMixed;      //! TTR: Mixed events */
386   /* TH2F        *f2HistLamLamMeanMinDistPioMixed;      //!  */
387   /* TH2F        *f2HistLamProMeanMinDistProMixed;      //!  */
388   /* TH2F        *f2HistALamALamMeanMinDistAProMixed;   //!  */
389   /* TH2F        *f2HistALamALamMeanMinDistPioMixed;    //!  */
390   /* TH2F        *f2HistALamAProMeanMinDistAProMixed;   //!  */
391   /* TH2F        *f2HistSftLamLamMeanMinDistProMixed;      //! TTR: Mixed events, shifted pri vtx */
392   /* TH2F        *f2HistSftLamLamMeanMinDistPioMixed;      //!  */
393   /* TH2F        *f2HistSftLamProMeanMinDistProMixed;      //!  */
394   /* TH2F        *f2HistSftALamALamMeanMinDistAProMixed;   //!  */
395   /* TH2F        *f2HistSftALamALamMeanMinDistPioMixed;    //!  */
396   /* TH2F        *f2HistSftALamAProMeanMinDistAProMixed;   //!  */
397   /* TH2F        *f2HistSftIrocLamLamMeanMinDistProMixed;      //! TTR: Mixed events, shifted pri vtx, IROCs */
398   /* TH2F        *f2HistSftIrocLamLamMeanMinDistPioMixed;      //!  */
399   /* TH2F        *f2HistSftIrocLamProMeanMinDistProMixed;      //!  */
400   /* TH2F        *f2HistSftIrocALamALamMeanMinDistAProMixed;   //!  */
401   /* TH2F        *f2HistSftIrocALamALamMeanMinDistPioMixed;    //!  */
402   /* TH2F        *f2HistSftIrocALamAProMeanMinDistAProMixed;   //!  */
403   /* TH2F        *f2HistSftOrocLamLamMeanMinDistProMixed;      //! TTR: Mixed events, shifted pri vtx, OROCs */
404   /* TH2F        *f2HistSftOrocLamLamMeanMinDistPioMixed;      //!  */
405   /* TH2F        *f2HistSftOrocLamProMeanMinDistProMixed;      //!  */
406   /* TH2F        *f2HistSftOrocALamALamMeanMinDistAProMixed;   //!  */
407   /* TH2F        *f2HistSftOrocALamALamMeanMinDistPioMixed;    //!  */
408   /* TH2F        *f2HistSftOrocALamAProMeanMinDistAProMixed;   //!  */
409
410   // September '12: use a THnSparseF with 4 dimensions
411   // for pro lam: qinv propro, mean d propro
412   // min d propro, qinv lampro
413   THnSparseF       *LamProMixed; //!
414   THnSparseF       *ALamAProMixed;//!
415
416   /* TH3F        *f3HistLamLamQinvMixed;                //! Qinv distribution mixed events */
417   /* TH3F        *f3HistALamALamQinvMixed;              //!                 */
418   /* TH3F        *f3HistLamLamMinvMixed;                //! Minv distribution mixed events */
419   /* TH3F        *f3HistLamProMinvMixed;                //! */
420   /* TH3F        *f3HistALamALamMinvMixed;              //!                 */
421   /* TH3F        *f3HistALamAProMinvMixed;              //! */
422    // Background lambdas: mixed events
423   /* TH2F        *f2HistBgLamBgLamMeanMinDistProMixed;   //! TTR: Mixed events */
424   /* TH2F        *f2HistBgLamBgLamMeanMinDistPioMixed;   //!  */
425   /* TH2F        *f2HistBgLamProMeanMinDistProMixed;     //!  */
426   /* TH2F        *f2HistBgALamBgALamMeanMinDistAProMixed;//!  */
427   /* TH2F        *f2HistBgALamBgALamMeanMinDistPioMixed; //!  */
428   /* TH2F        *f2HistBgALamAProMeanMinDistAProMixed;  //!  */
429   /* TH2F        *f2HistSftBgLamBgLamMeanMinDistProMixed;   //! TTR: Mixed events, shifted pri vtx */
430   /* TH2F        *f2HistSftBgLamBgLamMeanMinDistPioMixed;   //!  */
431   /* TH2F        *f2HistSftBgLamProMeanMinDistProMixed;     //!  */
432   /* TH2F        *f2HistSftBgALamBgALamMeanMinDistAProMixed;//!  */
433   /* TH2F        *f2HistSftBgALamBgALamMeanMinDistPioMixed; //!  */
434   /* TH2F        *f2HistSftBgALamAProMeanMinDistAProMixed;  //!  */
435   /* TH2F        *f2HistSftIrocBgLamBgLamMeanMinDistProMixed;   //! TTR: Mixed events, shifted pri vtx, IROCs */
436   /* TH2F        *f2HistSftIrocBgLamBgLamMeanMinDistPioMixed;   //!  */
437   /* TH2F        *f2HistSftIrocBgLamProMeanMinDistProMixed;     //!  */
438   /* TH2F        *f2HistSftIrocBgALamBgALamMeanMinDistAProMixed;//!  */
439   /* TH2F        *f2HistSftIrocBgALamBgALamMeanMinDistPioMixed; //!  */
440   /* TH2F        *f2HistSftIrocBgALamAProMeanMinDistAProMixed;  //!  */
441   /* TH2F        *f2HistSftOrocBgLamBgLamMeanMinDistProMixed;   //! TTR: Mixed events, shifted pri vtx, OROCs */
442   /* TH2F        *f2HistSftOrocBgLamBgLamMeanMinDistPioMixed;   //!  */
443   /* TH2F        *f2HistSftOrocBgLamProMeanMinDistProMixed;     //!  */
444   /* TH2F        *f2HistSftOrocBgALamBgALamMeanMinDistAProMixed;//!  */
445   /* TH2F        *f2HistSftOrocBgALamBgALamMeanMinDistPioMixed; //!  */
446   /* TH2F        *f2HistSftOrocBgALamAProMeanMinDistAProMixed;  //!  */
447
448   // September '12: use a THnSparseF with 4 dimensions
449   // for pro lam: qinv propro, mean d propro
450   // min d propro, qinv lampro
451   THnSparseF       *BgLamProMixed;   //!
452   THnSparseF       *BgALamAProMixed; //!
453
454   /* TH3F        *f3HistBgLamBgLamQinvMixed;             //! Qinv distribution mixed events */
455   /* TH3F        *f3HistBgALamBgALamQinvMixed;           //!                 */
456
457  private:
458   //  ------------------------------------
459   //
460   //    Nested classes for event mixing
461   //    Features are 
462   //    * low memory usage as only needed variables
463   //      are stored and not, e.g., the full AliAODTrack
464   //    * it's fast, as memory allocation occours
465   //      only once and no deep copying is done
466   //      when doing the fifo shift and reseting
467   //      the event. Resetting and shifting could
468   //      be reduced to only a few integer assignments.
469   //      
470   //  ------------------------------------
471
472
473   class FemtoBufferTrack{// Charged tracks
474   public:
475     FemtoBufferTrack();                               // Constructor
476     FemtoBufferTrack(const AliAODTrack *track,
477                      const Float_t bfield,
478                      const Float_t priVtx[3]);           // Constructor
479     ~FemtoBufferTrack(){;}                            // Destructor, nothing to do.
480     FemtoBufferTrack(const FemtoBufferTrack& fbt);    // Copy constructor
481     FemtoBufferTrack& operator=(const FemtoBufferTrack& fbt); // Assignment operator
482     void Set(const AliAODTrack *track,                // Set parameters of the FemtoBufferTrack
483              const Float_t bfield,                    // to these of the given AliAODtrack
484              const Float_t priVtx[3]);    
485     void Set(const AliAODTrack *track,                // Overloaded fct that just
486              const Float_t bfield,                    // calls Set(..,Float)
487              const Double_t priVtx[3]);
488     // Two functions to get the global and shifted positions. Both is not trivial as
489     // tracks in ALICE get propagated in the local system
490     // Shifted for studying all events shifted to (0,0,0)
491     void GetShiftedPositionAtShiftedRadii(const AliAODTrack *track,
492                                           const Float_t bfield, const Float_t priVtx[3]); 
493     // Global if not shifted
494     void GetGlobalPositionAtGlobalRadii(const AliAODTrack *track,
495                                         const Float_t bfield);
496     Bool_t UseIt() const {return fID!=65535;}          // Use entry? eg. set to false by cleaning procedure
497     void   SetBadFlag(){fID=65535;}                   // Can only set 'bad track' flag
498     // Interpretation of ALICE coding rule RC14 is that FemtoBufferTrack is a private member
499     // of AliAnalysisTaskProtonLambda, so the following data member are private
500     UShort_t fID;               //! Unique track id (->AliAODTrack.h), UShort_t goes to 65000
501     Double_t fP[3];             //! Momentum of track
502     /* Float_t  fXglobal[9][3];    //! Global positions at different global radii */
503     Float_t  fXshifted[9][3];   //! Shifted positions at different shifted radii
504   };
505   
506   class FemtoBufferV0{// V0 vertices
507   public:
508     // Constructors n stuff
509     FemtoBufferV0();                          // Constructor
510     FemtoBufferV0(const AliAODv0 *v0,const AliAODTrack *posDaughter,const AliAODTrack *negDaughter,
511                   const Double_t bfield, Double_t priVtxPos[3]);   // Constructor
512     ~FemtoBufferV0(){;}                       // Destructor, nothing to do.
513     FemtoBufferV0(const FemtoBufferV0 &fbv);  // Copy constructor
514     FemtoBufferV0& operator=(const FemtoBufferV0 &fbv);// Assignment operator
515     // Functions
516     void Set(const AliAODv0 *v0,const AliAODTrack *posDaughter,const AliAODTrack *negDaughter
517              ,const Double_t bfield, Double_t priVtxPos[3]); // Set properties of this to these of v0
518     Bool_t UseIt() const {return fCosPoint>0;} // Use entry? eg. set to false by cleaning procedure
519     void SetBadFlag(){fCosPoint=-9999.;fPosDaughter.SetBadFlag();
520       fNegDaughter.SetBadFlag();}               // Can only set 'bad track' flag
521     // Data member
522     Double_t fP[3];                 //! Momentum (x,y,z)
523     Float_t fCosPoint;              //! Cosine of pointing angle 
524     FemtoBufferTrack fPosDaughter;  //! Positive daughter of the V0
525     FemtoBufferTrack fNegDaughter;  //! Negative daughter fo the V0
526   };
527   
528   class FemtoBufferEvent{// Event 
529   public:
530     FemtoBufferEvent();                       // Constructor
531     FemtoBufferEvent(const UShort_t priTrackBuff,const UShort_t V0Buff, 
532                      const Double_t bfield,const Double_t priVtxPos[3]); // Constructor
533     FemtoBufferEvent(const UShort_t priTrackBuff,const UShort_t V0Buff); // Constructor
534     FemtoBufferEvent(const FemtoBufferEvent &fbe);           // Copy constructor
535     // Assignment operator won't change the size of the arrays!
536     FemtoBufferEvent& operator=(const FemtoBufferEvent &fbe); // Assignment operator
537     ~FemtoBufferEvent();                       // Destructor
538     void Reset(const Double_t bfield, const Double_t priVtxPos[3]);// Resets the event with new variables given
539     
540     // Functions to add particles to the event
541     void AddPro(const AliAODTrack *track);      // Add a proton to this event  
542     void AddAPro(const AliAODTrack *track);     // Add a anti-proton this actual event  
543     void AddLam(const AliAODv0 *v0,const AliAODTrack *posDaughter,const AliAODTrack *negDaughter); 
544     // Add a lamba to this event
545     void AddALam(const AliAODv0 *v0,const AliAODTrack *posDaughter,const AliAODTrack *negDaughter);
546     // Add a anti-lambda to this event  
547     void AddBgLam(const AliAODv0 *v0,const AliAODTrack *posDaughter,const AliAODTrack *negDaughter); 
548     // Add lambda background to this event
549     void AddBgALam(const AliAODv0 *v0,const AliAODTrack *posDaughter,const AliAODTrack *negDaughter); 
550     // Add anti-lambda background to this event
551     
552     // Getters for the event properties, no setters as you're not supposed to change them :)
553     // The fBfield and fPriVtxPos get set on each 'reset' for a new event and the limits get set 
554     // on creation of the event
555     Double_t GetBfield()const{return fBfield;}            // Getter for magnetic field of event
556     void GetVtxPos(Double_t xyz[3])const{for(Int_t i=0;i<3;i++)xyz[i]=fPriVtxPos[i];} // Get the xyz of the vertex.
557     UShort_t GetPriTrackLim()const{return fPriTrackLim;}  // Get the size of the array for primary tracks
558     UShort_t GetV0Lim()const{return fV0Lim;}              // Get the size of the array for V0s
559     // The number of tracks stored in the event
560     UShort_t GetNPro()const{return fNProTracks;}       // Number of stored protons
561     UShort_t GetNAPro()const{return fNAProTracks;}     // .. anti-protons
562     UShort_t GetNLam()const{return fNLamTracks;}       // .. lambda 
563     UShort_t GetNALam()const{return fNALamTracks;}     // .. anti-lambda
564     UShort_t GetNBgLam()const{return fNBgLamTracks;}   // .. background lambda
565     UShort_t GetNBgALam()const{return fNBgALamTracks;} // .. background anti-lambda
566
567     // Data member, sorry for this private public private mixture,
568     // but what's this reorder warning? sometimes it's there, st not..
569   private:
570     // Size of the arrays for tracks. Constant and private to reflect the idea that
571     // the arrays get allocated only once to avoid excessive memory allocation
572     const UShort_t fPriTrackLim;   // Limit for primary tracks
573     const UShort_t fV0Lim;         // Limit for V0s
574   public:
575     // Pointer to array of ...
576     FemtoBufferTrack *fProTracks;          //! Proton tracks
577     FemtoBufferTrack *fAProTracks;         //! Anti-proton tracks
578     
579     FemtoBufferV0    *fLamTracks;          //! Lambda tracks
580     FemtoBufferV0    *fALamTracks;         //! Anti-lambda tracks
581     
582     FemtoBufferV0    *fBgLamTracks;        //! Background lambda tracks
583     FemtoBufferV0    *fBgALamTracks;       //! Background anti-lambda tracks
584   private:
585     // Number of stored tracks in the event
586     UShort_t fNProTracks;    // Number of stored protons
587     UShort_t fNAProTracks;   // Number of stored anti-protons
588     UShort_t fNLamTracks;    // Number of stored lambdas
589     UShort_t fNALamTracks;   // Number of stored anti-lambdas
590     UShort_t fNBgLamTracks;  // Number of stored lambdas
591     UShort_t fNBgALamTracks; // Number of stored anti-lambdas
592
593     // Double_t needed??? magnetic field probably is like 5.0 and not 5.0000120047
594     Double_t fBfield;               // Magnetic field in ALICE unit [kG]
595     Double_t fPriVtxPos[3];         // Primary vtx position
596   };
597   
598   class FemtoBuffer { // Holds the events
599   public:
600     FemtoBuffer();           // Dummy constructor
601     FemtoBuffer(const UChar_t ZvertexBins,const UChar_t CentBins,const UChar_t MixBuff,
602                 const UShort_t PriTrackLim,const UShort_t V0Lim,const Float_t AbsZvertexCut,const Float_t CentCut); // Constructor
603     FemtoBuffer(const FemtoBuffer &fb); //Ctor
604     FemtoBuffer& operator=(const AliAnalysisTaskProtonLambda::FemtoBuffer&); // Assignment
605     ~FemtoBuffer();          // Destructor
606     void ShiftAndAdd(AliAODEvent *evt); // Discard last event, shift all, set first one
607     void ShiftAndAdd(const Double_t bfield,const Double_t priVtxPos[3],const Float_t centrality); // Discard last event, shift all, set first one
608     FemtoBufferEvent *GetEvt(const UChar_t i)const{return fCurEvt[i];}; // Returns a pointer to the i'th event of the current event mixing class
609     UChar_t GetMixBuffSize()const{return fkMixBuffSize;}// Returns the number of events held in every mixing bin
610                                  
611   private:
612     const UChar_t fkZvertexBins;           // Number of bins in Zvertex
613     const UChar_t fkCentBins;              // Number of bins in centrality
614     const UChar_t fkMixBuffSize;           // Number of stored events
615     const UShort_t fkPriTrackLim;          // Buffer size protons per event
616     const UShort_t fkV0Lim;                // Buffer size lambdas per event
617
618     const TAxis *fZvertexAxis;          //! To find Zvertex bin
619     const TAxis *fCentAxis;             //! To find centrality bin
620
621     FemtoBufferEvent **fCurEvt;//! Array of pointer to the set of the current events
622                                      //  Note that the pointer won't be constant
623     FemtoBufferEvent ****fEC;  //! The internal thing where the events
624                                      //  are stored. 
625                                      //  fEC stands for event collection.
626   };
627   
628   ClassDef(AliAnalysisTaskProtonLambda, 1);
629 };
630
631 #endif