]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelorTMVA.h
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliAnalysisTaskSELc2V0bachelorTMVA.h
1 #ifndef ALIANALYSISTASKSELC2V0BACHELORTMVA_H
2 #define ALIANALYSISTASKSELC2V0BACHELORTMVA_H
3 /**************************************************************************
4  * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
5  *                                                                        *
6  * Author: The ALICE Off-line Project.                                    *
7  * Contributors are mentioned in the code where appropriate.              *
8  *                                                                        *
9  * Permission to use, copy, modify and distribute this software and its   *
10  * documentation strictly for non-commercial purposes is hereby granted   *
11  * without fee, provided that the above copyright notice appears in all   *
12  * copies and that both the copyright notice and this permission notice   *
13  * appear in the supporting documentation. The authors make no claims     *
14  * about the suitability of this software for any purpose. It is          *
15  * provided "as is" without express or implied warranty.                  *
16  **************************************************************************/
17
18 /* $Id: AliAnalysisTaskSELc2V0bachelorTMVA.h 61835 2013-04-05 23:07:23Z fprino $ */ 
19
20 #include "TROOT.h"
21 #include "TSystem.h"
22
23 #include "AliAnalysisTaskSE.h"
24 #include "AliAODEvent.h"
25 #include "AliAODMCHeader.h"
26 #include "AliPID.h"
27 #include "AliAODTrack.h"
28 #include "AliAODVertex.h"
29 #include "AliAODRecoDecay.h"
30 #include "AliPIDResponse.h"
31 #include "AliPIDCombined.h"
32 #include "AliTPCPIDResponse.h"
33 #include "AliRDHFCutsLctoV0.h"
34 #include "AliNormalizationCounter.h"
35 #include "AliVertexingHFUtils.h"
36 #include "AliAODRecoCascadeHF.h"
37
38 class TH1F;
39 class TH1D;
40
41 class AliAnalysisTaskSELc2V0bachelorTMVA : public AliAnalysisTaskSE 
42 {
43   
44  public:
45
46   enum EBachelor {
47     kBachInvalid = -1,
48     kBachFake = 0,
49     kBachNoProton = 1,
50     kBachPrimary = 2,
51     kBachNoLambdaMother = 3,
52     kBachDifferentLambdaMother = 4,
53     kBachCorrectLambdaMother = 5 };
54
55   enum EK0S {
56     kK0SInvalid = -1,
57     kK0SFake = 0,
58     kK0SNoK0S = 1,
59     kK0SWithoutMother = 2,
60     kK0SNotFromK0 = 3,
61     kK0Primary = 4, 
62     kK0NoLambdaMother = 5,
63     kK0DifferentLambdaMother = 6,
64     kK0CorrectLambdaMother = 7 };    
65   
66   AliAnalysisTaskSELc2V0bachelorTMVA();
67   AliAnalysisTaskSELc2V0bachelorTMVA(const Char_t* name, AliRDHFCutsLctoV0* cutsA,
68                                  Bool_t useOnTheFly=kFALSE);
69   virtual ~AliAnalysisTaskSELc2V0bachelorTMVA();
70
71   // Implementation of interface methods  
72   virtual void UserCreateOutputObjects();
73   virtual void Init();
74   virtual void LocalInit() {Init();}
75   virtual void UserExec(Option_t *option);
76   virtual void Terminate(Option_t *option);
77  
78   // histos
79   void FillLc2pK0Sspectrum(AliAODRecoCascadeHF *part, Int_t isLc,
80                            Int_t &nSelectedAnal, AliRDHFCutsLctoV0 *cutsAnal,
81                            TClonesArray *mcArray, Int_t iLctopK0s);
82
83   void MakeAnalysisForLc2prK0S(TClonesArray *arrayLctopK0s,
84                                TClonesArray *mcArray,
85                                Int_t &nSelectedAnal, AliRDHFCutsLctoV0 *cutsAnal, 
86                                TClonesArray *array3Prong, AliAODMCHeader *aodheader);
87  
88   // set MC usage
89   void SetMC(Bool_t theMCon) {fUseMCInfo = theMCon;}
90   Bool_t GetMC() const {return fUseMCInfo;}
91
92   void SetK0sAnalysis(Bool_t a) {fIsK0sAnalysis=a;}
93   Bool_t GetK0sAnalysis() const {return fIsK0sAnalysis;}
94
95   void SetUseOnTheFlyV0(Bool_t a) { fUseOnTheFlyV0=a; }
96   Bool_t GetUseOnTheFlyV0() { return fUseOnTheFlyV0; }
97
98   void SetIspA(Bool_t a) { fIspA=a; }
99   Bool_t GetIspA() { return fIspA; }
100
101   void SetFillOnlySgn(Bool_t a) { fFillOnlySgn=a; }
102   Bool_t GetFillOnlySgn() { return fFillOnlySgn; }
103
104   void SetTopoConstraint(Bool_t a) { ftopoConstraint=a; }
105   Bool_t GetTopoConstraint() { return ftopoConstraint; }
106
107   void SetCallKFVertexing(Bool_t a) { fCallKFVertexing=a; }
108   Bool_t GetCallKFVertexing() { return fCallKFVertexing; }
109
110   void SetKeepingKeepingOnlyHIJINGBkg(Bool_t a) { fKeepingOnlyHIJINGBkg = a;}
111   Bool_t GetKeepingOnlyHIJINGBkg() {return fKeepingOnlyHIJINGBkg;}
112
113   void SetKFCutChi2NDF(Float_t a) {fCutKFChi2NDF = a;}
114   Float_t GetKFCutChi2NDF() {return fCutKFChi2NDF;}
115
116   void SetKFCutDeviationFromVtx(Float_t a) {fCutKFDeviationFromVtx = a;}
117   Float_t GetKFCutDeviationFromVtx() {return fCutKFDeviationFromVtx;}
118
119   void SetKFCutDeviationFromVtxV0(Float_t a) {fCutKFDeviationFromVtxV0 = a;}
120   Float_t GetKFCutDeviationFromVtxV0() {return fCutKFDeviationFromVtxV0;}
121
122   void SetKeepingKeepingOnlyPYTHIABkg(Bool_t a) { fKeepingOnlyPYTHIABkg = a;}
123   Bool_t GetKeepingOnlyPYTHIABkg() {return fKeepingOnlyPYTHIABkg;}
124         
125   void SetTriggerMask(ULong64_t c) { fTriggerMask = c;} 
126         
127  private:
128   
129   EBachelor CheckBachelor(AliAODRecoCascadeHF *part, AliAODTrack* bachelor, TClonesArray *mcArray);
130   EK0S CheckK0S(AliAODRecoCascadeHF *part, AliAODv0* v0part, TClonesArray *mcArray);
131   //EK0S CheckK0S(AliAODRecoCascadeHF *part, AliAODTrack* v0part, TClonesArray *mcArray );
132   Int_t FindV0Label(AliAODRecoDecay* v0part, TClonesArray *mcArray) const;
133   Int_t FindLcLabel(AliAODRecoCascadeHF* cascade, TClonesArray *mcArray) const;
134   Int_t CallKFVertexing(AliAODRecoCascadeHF *cascade, AliAODv0* v0part, AliAODTrack* bach, TClonesArray *mcArray, 
135                         Double_t* V0KF, Double_t* errV0KF, Double_t* LcKF, Double_t* errLcKF,
136                         Double_t* distances, Double_t* armPolKF);
137
138   void FillMCHisto(TClonesArray *mcArray);
139
140   AliAnalysisTaskSELc2V0bachelorTMVA(const AliAnalysisTaskSELc2V0bachelorTMVA &source);
141   AliAnalysisTaskSELc2V0bachelorTMVA& operator=(const AliAnalysisTaskSELc2V0bachelorTMVA& source); 
142   
143   Bool_t fUseMCInfo;          // Use MC info
144   TList *fOutput;             //! User output1: list of trees
145
146   // define the histograms
147   TH1F *fCEvents;                    //! Histogram to check selected events
148   AliPIDResponse *fPIDResponse;      //! PID response object
149   AliPIDCombined *fPIDCombined;      //! combined PID response object
150   Bool_t fIsK0sAnalysis;             // switch between Lpi and K0sp
151   AliNormalizationCounter *fCounter; //! AliNormalizationCounter on output slot 4
152   AliRDHFCutsLctoV0 *fAnalCuts;      // Cuts - sent to output slot 5
153   TList *fListCuts;                  // list of cuts
154   Bool_t fUseOnTheFlyV0;             // flag to analyze also on-the-fly V0 candidates
155   Bool_t fIsEventSelected;           // flag for event selected
156
157   TTree   *fVariablesTreeSgn;        //! tree of the candidate variables after track selection (Signal)
158   TTree   *fVariablesTreeBkg;        //! tree of the candidate variables after track selection (Background)
159   Float_t *fCandidateVariables;      //! variables to be written to the tree
160
161   Bool_t fIspA;                       // flag for running on pA
162
163   TH1F* fHistoEvents;                 //! histogram with number of events analyzed
164   TH1F* fHistoLc;                     //! histogram with number of Lc
165   TH1F* fHistoLcOnTheFly;             //! histogram with number of Lc with on-the-fly V0
166   Bool_t fFillOnlySgn;                // flag to fill only signal (speeding up processing)
167   TH1F* fHistoLcBeforeCuts;           //! histogram with number of Lc before any cut 
168   TH1F* fHistoFiducialAcceptance;     //! histogram to check FiducialAcceptance cut
169   TH2F* fHistoCodesSgn;               //! histogram with codes for bachelor and V0 for signal
170   TH2F* fHistoCodesBkg;               //! histogram with codes for bachelor and V0 for background
171   TH1F* fHistoLcpKpiBeforeCuts;       //! histogram number of true Lc-->pKpi (3 prong) before any cut
172   AliAODVertex *fVtx1;                // primary vertex
173
174   TH1D* fHistoDistanceLcToPrimVtx;    //! KF: distance Lc vertex from primary vertex   
175   TH1D* fHistoDistanceV0ToPrimVtx;    //! KF: distance V0 vertex from primary vertex   
176   TH1D* fHistoDistanceV0ToLc;         //! KF: distance V0 vertex from Lc vertex    
177
178   TH1D* fHistoDistanceLcToPrimVtxSgn; //! KF: distance of signal Lc vertex from primary vertex    
179   TH1D* fHistoDistanceV0ToPrimVtxSgn; //! KF: distance for signal Lc of V0 vertex from primary vertex   
180   TH1D* fHistoDistanceV0ToLcSgn;      //! KF: distance for signal Lc of V0 vertex from Lc vertex 
181          
182   TH1D* fHistoVtxLcResidualToPrimVtx; //! KF: residual wrt MC of distance Lc vertex from primary vertex (MC - KF)
183   TH1D* fHistoVtxV0ResidualToPrimVtx; //! KF: residual wrt MC of distance V0 vertex from primary vertex (MC - KF)
184   TH1D* fHistoVtxV0ResidualToLc;      //! KF: residual wrt MC of distance V0 vertex from Lc vertex (MC - KF)
185
186   TH1D* fHistoMassV0All;              //! KF: mass for all V0 reconstructed with KF
187   TH1D* fHistoDecayLengthV0All;       //! KF: decay length for all V0 reconstructed with KF
188   TH1D* fHistoLifeTimeV0All;          //! KF: life time for all V0 reconstructed with KF
189
190   TH1D* fHistoMassV0True;             //! KF: mass for true V0 reconstructed with KF
191   TH1D* fHistoDecayLengthV0True;      //! KF: decay length for true V0 reconstructed with KF
192   TH1D* fHistoLifeTimeV0True;         //! KF: life time for true V0 reconstructed with KF
193
194   TH1D* fHistoMassV0TrueFromAOD;      //! KF: AOD mass for true V0 reconstructed with KF
195
196   TH1D* fHistoMassV0TrueK0S;          //! KF: mass for true V0 which are really K0S reconstructed with KF
197   TH1D* fHistoDecayLengthV0TrueK0S;   //! KF: decay length for true V0 which are really K0S reconstructed with KF
198   TH1D* fHistoLifeTimeV0TrueK0S;      //! KF: life time for true V0 which are really K0S reconstructed with KF
199
200   TH1D* fHistoMassV0TrueK0SFromAOD;   //! KF: AOD mass for true V0 which are really K0S reconstructed with KF
201
202   TH1D* fHistoMassLcAll;              //! KF: mass for all Lc reconstructed with KF
203   TH1D* fHistoDecayLengthLcAll;       //! KF: decay length for all Lc reconstructed with KF
204   TH1D* fHistoLifeTimeLcAll;          //! KF: life time for all Lc reconstructed with KF
205
206   TH1D* fHistoMassLcTrue;             //! KF: mass for true cascades reconstructed with KF
207   TH1D* fHistoDecayLengthLcTrue;      //! KF: decay length for true cascades reconstructed with KF
208   TH1D* fHistoLifeTimeLcTrue;         //! KF: life time for true cascades reconstructed with KF
209
210   TH1D* fHistoMassLcTrueFromAOD;      //! KF: AOD mass for true cascades reconstructed with KF
211
212   TH1D* fHistoMassV0fromLcAll;        //! KF: mass of V0 for all cascades reconstructed with KF
213   TH1D* fHistoDecayLengthV0fromLcAll; //! KF: decay length of V0 for all cascades reconstructed with KF
214   TH1D* fHistoLifeTimeV0fromLcAll;    //! KF: life time of V0 for all cascades reconstructed with KF
215
216   TH1D* fHistoMassV0fromLcTrue;       //! KF: mass of V0 for true cascades reconstructed with KF
217   TH1D* fHistoDecayLengthV0fromLcTrue;//! KF: decay length of V0 for true cascades reconstructed with KF
218   TH1D* fHistoLifeTimeV0fromLcTrue;   //! KF: life time of V0 for true cascades reconstructed with KF
219
220   TH1D* fHistoMassLcSgn;              //! KF: mass of signal Lc reconstructed with KF
221   TH1D* fHistoMassLcSgnFromAOD;       //! KF: AOD mass of signal Lc reconstructed with KF
222   TH1D* fHistoDecayLengthLcSgn;       //! KF: decay length of signal Lc reconstructed with KF
223   TH1D* fHistoLifeTimeLcSgn;          //! KF: life time of signal Lc reconstructed with KF
224
225   TH1D* fHistoMassV0fromLcSgn;        //! KF: mass of V0 for signal Lc reconstructed with KF
226   TH1D* fHistoDecayLengthV0fromLcSgn; //! KF: decay length of V0 for signal Lc reconstructed with KF
227   TH1D* fHistoLifeTimeV0fromLcSgn;    //! KF: life time of V0 for signal Lc reconstructed with KF
228
229   TH2D* fHistoKF;                     //! KF: V0 code vs Lc code from KF (mass, decaylength, lifetime considered) 
230   TH1D* fHistoKFV0;                   //! KF: V0 code from KF (mass, decaylength, lifetime considered) 
231   TH1D* fHistoKFLc;                   //! KF: Lc code from KF (mass, decaylength, lifetime considered) 
232
233   TH2D* fHistoMassKFV0;               //! KF: mass vs mass error for V0 from KF  
234   TH2D* fHistoDecayLengthKFV0;        //! KF: decay length vs decay length error for V0 from KF
235   TH2D* fHistoLifeTimeKFV0;           //! KF: life time vs life time error for V0 from KF
236
237   TH2D* fHistoMassKFLc;               //! KF: mass vs mass error for Lc from KF
238   TH2D* fHistoDecayLengthKFLc;        //! KF: decay length vs decay length error for Lc from KF
239   TH2D* fHistoLifeTimeKFLc;           //! KF: life time vs life time error for Lc from KF
240
241   TH2D* fHistoArmenterosPodolanskiV0KF;      //! KF: Armeteros-Podolanski plot for all V0 from KF
242   TH2D* fHistoArmenterosPodolanskiV0KFSgn;   //! KF: Armeteros-Podolanski plot for V0 from signal Lc from KF
243   TH2D* fHistoArmenterosPodolanskiV0AOD;     //! KF: AOD Armeteros-Podolanski plot for all V0 from KF
244   TH2D* fHistoArmenterosPodolanskiV0AODSgn;  //! KF: AOD Armeteros-Podolanski plot for V0 from signal Lc from KF
245
246   TList *fOutputKF;             //! User output1: list of histograms from KF
247
248   Int_t fmcLabelLc;             // label of candidate    
249   Bool_t ftopoConstraint;       // flag to use topological constraints in KF
250   Bool_t fCallKFVertexing;      // flag to decide whether to call or not KF
251   Bool_t fKeepingOnlyHIJINGBkg; // flag to fill bkg with only candidates that have daughters generated by HIJING (to be used for enriched MC)
252   AliVertexingHFUtils* fUtils;  // AliVertexingHFUtils used to check the generator of a specific candidate
253   TH1F* fHistoBackground;       //! histo to check the number of candidates with at least one daughter for the injected signal
254   Float_t fCutKFChi2NDF;        // cut for KF on chi2/NDF
255   Float_t fCutKFDeviationFromVtx; // cut for KF on distance to primary vtx
256   Float_t fCutKFDeviationFromVtxV0; // cut for KF on distance to primary vtx for V0
257   Int_t fCurrentEvent;              // current event number - for debug purposes
258   Double_t fBField;                   // magnetic field of current event
259   Bool_t fKeepingOnlyPYTHIABkg;       // flag to allow to use only PYTHIA tracks for background
260   TH1F* fHistoMCLcK0SpGen;            //! histo with MC Lc --> K0S + p
261   TH1F* fHistoMCLcK0SpGenAcc;         //! histo with MC Lc --> K0S + p
262   TH1F* fHistoMCLcK0SpGenLimAcc;      //! histo with MC Lc --> K0S + p
263
264   ULong64_t fTriggerMask;                         // mask to the trigger word returned by the physics selection
265         
266   ClassDef(AliAnalysisTaskSELc2V0bachelorTMVA, 8); // class for Lc->p K0
267 };
268
269 #endif
270