]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/vertexingHF/AliAnalysisTaskSELc2V0bachelorTMVA.h
Update in Lc task (ChiaraZ)
[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);
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  private:
114   
115   EBachelor CheckBachelor(AliAODRecoCascadeHF *part, AliAODTrack* bachelor, TClonesArray *mcArray);
116   EK0S CheckK0S(AliAODRecoCascadeHF *part, AliAODv0* v0part, TClonesArray *mcArray);
117   //EK0S CheckK0S(AliAODRecoCascadeHF *part, AliAODTrack* v0part, TClonesArray *mcArray );
118   Int_t FindV0Label(AliAODRecoDecay* v0part, TClonesArray *mcArray) const;
119   Int_t FindLcLabel(AliAODRecoCascadeHF* cascade, TClonesArray *mcArray) const;
120   Int_t CallKFVertexing(AliAODRecoCascadeHF *cascade, AliAODv0* v0part, AliAODTrack* bach, TClonesArray *mcArray, 
121                         Double_t* V0KF, Double_t* errV0KF, Double_t* LcKF, Double_t* errLcKF,
122                         Double_t* distances, Double_t* armPolKF);
123
124   AliAnalysisTaskSELc2V0bachelorTMVA(const AliAnalysisTaskSELc2V0bachelorTMVA &source);
125   AliAnalysisTaskSELc2V0bachelorTMVA& operator=(const AliAnalysisTaskSELc2V0bachelorTMVA& source); 
126   
127   Bool_t fUseMCInfo;          // Use MC info
128   TList *fOutput;             // User output1: list of trees
129
130   // define the histograms
131   TH1F *fCEvents;                    // Histogram to check selected events
132   AliPIDResponse *fPIDResponse;      //! PID response object
133   AliPIDCombined *fPIDCombined;      //! combined PID response object
134   Bool_t fIsK0sAnalysis;             // switch between Lpi and K0sp
135   AliNormalizationCounter *fCounter; // AliNormalizationCounter on output slot 4
136   AliRDHFCutsLctoV0 *fAnalCuts;      // Cuts - sent to output slot 5
137   TList *fListCuts;                  // list of cuts
138   Bool_t fUseOnTheFlyV0;             // flag to analyze also on-the-fly V0 candidates
139   Bool_t fIsEventSelected;           // flag for event selected
140
141   TTree   *fVariablesTreeSgn;        //! tree of the candidate variables after track selection (Signal)
142   TTree   *fVariablesTreeBkg;        //! tree of the candidate variables after track selection (Background)
143   Float_t *fCandidateVariables;      //! variables to be written to the tree
144
145   Bool_t fIspA;                       // flag for running on pA
146
147   TH1F* fHistoEvents;                 // histogram with number of events analyzed
148   TH1F* fHistoLc;                     // histogram with number of Lc
149   TH1F* fHistoLcOnTheFly;             // histogram with number of Lc with on-the-fly V0
150   Bool_t fFillOnlySgn;                // flag to fill only signal (speeding up processing)
151   TH1F* fHistoLcBeforeCuts;           // histogram with number of Lc before any cut 
152   TH1F* fHistoFiducialAcceptance;     // histogram to check FiducialAcceptance cut
153   TH2F* fHistoCodesSgn;               // histogram with codes for bachelor and V0 for signal
154   TH2F* fHistoCodesBkg;               // histogram with codes for bachelor and V0 for background
155   TH1F* fHistoLcpKpiBeforeCuts;       // histogram number of true Lc-->pKpi (3 prong) before any cut
156   AliAODVertex *fVtx1;                // primary vertex
157
158   TH1D* fHistoDistanceLcToPrimVtx;    // KF: distance Lc vertex from primary vertex   
159   TH1D* fHistoDistanceV0ToPrimVtx;    // KF: distance V0 vertex from primary vertex   
160   TH1D* fHistoDistanceV0ToLc;         // KF: distance V0 vertex from Lc vertex    
161
162   TH1D* fHistoDistanceLcToPrimVtxSgn; // KF: distance of signal Lc vertex from primary vertex    
163   TH1D* fHistoDistanceV0ToPrimVtxSgn; // KF: distance for signal Lc of V0 vertex from primary vertex   
164   TH1D* fHistoDistanceV0ToLcSgn;      // KF: distance for signal Lc of V0 vertex from Lc vertex 
165          
166   TH1D* fHistoVtxLcResidualToPrimVtx; // KF: residual wrt MC of distance Lc vertex from primary vertex (MC - KF)
167   TH1D* fHistoVtxV0ResidualToPrimVtx; // KF: residual wrt MC of distance V0 vertex from primary vertex (MC - KF)
168   TH1D* fHistoVtxV0ResidualToLc;      // KF: residual wrt MC of distance V0 vertex from Lc vertex (MC - KF)
169
170   TH1D* fHistoMassV0All;              // KF: mass for all V0 reconstructed with KF
171   TH1D* fHistoDecayLengthV0All;       // KF: decay length for all V0 reconstructed with KF
172   TH1D* fHistoLifeTimeV0All;          // KF: life time for all V0 reconstructed with KF
173
174   TH1D* fHistoMassV0True;             // KF: mass for true V0 reconstructed with KF
175   TH1D* fHistoDecayLengthV0True;      // KF: decay length for true V0 reconstructed with KF
176   TH1D* fHistoLifeTimeV0True;         // KF: life time for true V0 reconstructed with KF
177
178   TH1D* fHistoMassV0TrueFromAOD;      // KF: AOD mass for true V0 reconstructed with KF
179
180   TH1D* fHistoMassV0TrueK0S;          // KF: mass for true V0 which are really K0S reconstructed with KF
181   TH1D* fHistoDecayLengthV0TrueK0S;   // KF: decay length for true V0 which are really K0S reconstructed with KF
182   TH1D* fHistoLifeTimeV0TrueK0S;      // KF: life time for true V0 which are really K0S reconstructed with KF
183
184   TH1D* fHistoMassV0TrueK0SFromAOD;   // KF: AOD mass for true V0 which are really K0S reconstructed with KF
185
186   TH1D* fHistoMassLcAll;              // KF: mass for all Lc reconstructed with KF
187   TH1D* fHistoDecayLengthLcAll;       // KF: decay length for all Lc reconstructed with KF
188   TH1D* fHistoLifeTimeLcAll;          // KF: life time for all Lc reconstructed with KF
189
190   TH1D* fHistoMassLcTrue;             // KF: mass for true cascades reconstructed with KF
191   TH1D* fHistoDecayLengthLcTrue;      // KF: decay length for true cascades reconstructed with KF
192   TH1D* fHistoLifeTimeLcTrue;         // KF: life time for true cascades reconstructed with KF
193
194   TH1D* fHistoMassLcTrueFromAOD;      // KF: AOD mass for true cascades reconstructed with KF
195
196   TH1D* fHistoMassV0fromLcAll;        // KF: mass of V0 for all cascades reconstructed with KF
197   TH1D* fHistoDecayLengthV0fromLcAll; // KF: decay length of V0 for all cascades reconstructed with KF
198   TH1D* fHistoLifeTimeV0fromLcAll;    // KF: life time of V0 for all cascades reconstructed with KF
199
200   TH1D* fHistoMassV0fromLcTrue;       // KF: mass of V0 for true cascades reconstructed with KF
201   TH1D* fHistoDecayLengthV0fromLcTrue;// KF: decay length of V0 for true cascades reconstructed with KF
202   TH1D* fHistoLifeTimeV0fromLcTrue;   // KF: life time of V0 for true cascades reconstructed with KF
203
204   TH1D* fHistoMassLcSgn;              // KF: mass of signal Lc reconstructed with KF
205   TH1D* fHistoMassLcSgnFromAOD;       // KF: AOD mass of signal Lc reconstructed with KF
206   TH1D* fHistoDecayLengthLcSgn;       // KF: decay length of signal Lc reconstructed with KF
207   TH1D* fHistoLifeTimeLcSgn;          // KF: life time of signal Lc reconstructed with KF
208
209   TH1D* fHistoMassV0fromLcSgn;        // KF: mass of V0 for signal Lc reconstructed with KF
210   TH1D* fHistoDecayLengthV0fromLcSgn; // KF: decay length of V0 for signal Lc reconstructed with KF
211   TH1D* fHistoLifeTimeV0fromLcSgn;    // KF: life time of V0 for signal Lc reconstructed with KF
212
213   TH2D* fHistoKF;                     // KF: V0 code vs Lc code from KF (mass, decaylength, lifetime considered) 
214   TH1D* fHistoKFV0;                   // KF: V0 code from KF (mass, decaylength, lifetime considered) 
215   TH1D* fHistoKFLc;                   // KF: Lc code from KF (mass, decaylength, lifetime considered) 
216
217   TH2D* fHistoMassKFV0;               // KF: mass vs mass error for V0 from KF  
218   TH2D* fHistoDecayLengthKFV0;        // KF: decay length vs decay length error for V0 from KF
219   TH2D* fHistoLifeTimeKFV0;           // KF: life time vs life time error for V0 from KF
220
221   TH2D* fHistoMassKFLc;               // KF: mass vs mass error for Lc from KF
222   TH2D* fHistoDecayLengthKFLc;        // KF: decay length vs decay length error for Lc from KF
223   TH2D* fHistoLifeTimeKFLc;           // KF: life time vs life time error for Lc from KF
224
225   TH2D* fHistoArmenterosPodolanskiV0KF;      // KF: Armeteros-Podolanski plot for all V0 from KF
226   TH2D* fHistoArmenterosPodolanskiV0KFSgn;   // KF: Armeteros-Podolanski plot for V0 from signal Lc from KF
227   TH2D* fHistoArmenterosPodolanskiV0AOD;     // KF: AOD Armeteros-Podolanski plot for all V0 from KF
228   TH2D* fHistoArmenterosPodolanskiV0AODSgn;  // KF: AOD Armeteros-Podolanski plot for V0 from signal Lc from KF
229
230   TList *fOutputKF;             // User output1: list of histograms from KF
231
232   Int_t fmcLabelLc;             // label of candidate    
233   Bool_t ftopoConstraint;       // flag to use topological constraints in KF
234   Bool_t fCallKFVertexing;      // flag to decide whether to call or not KF
235   Bool_t fKeepingOnlyHIJINGBkg; // flag to fill bkg with only candidates that have daughters generated by HIJING (to be used for enriched MC)
236   AliVertexingHFUtils* fUtils;  // AliVertexingHFUtils used to check the generator of a specific candidate
237   TH1F* fHistoBackground;       // histo to check the number of candidates with at least one daughter for the injected signal
238
239   ClassDef(AliAnalysisTaskSELc2V0bachelorTMVA,2); // class for Lc->p K0
240 };
241
242 #endif
243