7448551d740151ab41331bc7ebe3b26f0c6b6da3
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliAnalysisTaskSELc2V0bachelor.h
1 #ifndef ALIANALYSISTASKSELC2V0BACHELOR_H
2 #define ALIANALYSISTASKSELC2V0BACHELOR_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$ */ 
19
20 #include "TROOT.h"
21 #include "TSystem.h"
22
23 #include "AliAnalysisTaskSE.h"
24 #include "AliAODEvent.h"
25 #include "AliPID.h"
26 #include "AliAODTrack.h"
27 #include "AliPIDResponse.h"
28 #include "AliTPCPIDResponse.h"
29 #include "AliRDHFCutsLctoV0.h"
30 #include "AliNormalizationCounter.h"
31
32 class TH1F;
33
34 class AliAnalysisTaskSELc2V0bachelor : public AliAnalysisTaskSE 
35 {
36   
37  public:
38   
39   AliAnalysisTaskSELc2V0bachelor();
40   AliAnalysisTaskSELc2V0bachelor(const Char_t* name, AliRDHFCutsLctoV0* cuts,
41                                  Bool_t useOnTheFly=kFALSE, Bool_t writeVariableTree=kTRUE, Bool_t additionalChecks=kFALSE);
42   virtual ~AliAnalysisTaskSELc2V0bachelor();
43
44   // Implementation of interface methods  
45   virtual void UserCreateOutputObjects();
46   virtual void Init();
47   virtual void LocalInit() {Init();}
48   virtual void UserExec(Option_t *option);
49   virtual void Terminate(Option_t *option);
50  
51   // histos
52   void FillLc2pK0Sspectrum(AliAODRecoCascadeHF *part, Int_t isLc,
53                            Int_t &nSelectedAnal, AliRDHFCutsLctoV0 *cutsAnal,
54                            TClonesArray *mcArray);
55
56   void MakeAnalysisForLc2prK0S(TClonesArray *arrayLctopK0S,
57                                TClonesArray *mcArray,
58                                Int_t &nSelectedAnal, AliRDHFCutsLctoV0 *cutsAnal);
59  
60   // set MC usage
61   void SetMC(Bool_t theMCon) {fUseMCInfo = theMCon;}
62   Bool_t GetMC() const {return fUseMCInfo;}
63
64   // set flag for additional checks
65   void SetAdditionalChecks(Bool_t additionalChecks) {fAdditionalChecks = additionalChecks;}
66   Bool_t GetAdditionalChecks() const {return fAdditionalChecks;}
67
68   void FillArmPodDistribution(AliAODv0 *vZero, TString histoTitle, TList *histoList);
69
70   void SetK0SAnalysis(Bool_t a) {fIsK0SAnalysis=a;}
71   Bool_t GetK0SAnalysis() const {return fIsK0SAnalysis;}
72
73   void SetUseOnTheFlyV0(Bool_t a) { fUseOnTheFlyV0=a; }
74   Bool_t GetUseOnTheFlyV0() { return fUseOnTheFlyV0; }
75
76  private:
77   
78   void CheckEventSelection(AliAODEvent *aodEvent);
79   void CheckEventSelectionWithCandidates(AliAODEvent *aodEvent);
80   void CheckCandidatesAtDifferentLevels(AliAODRecoCascadeHF *part,AliRDHFCutsLctoV0* cutsAnal);
81   void FillTheTree(AliAODRecoCascadeHF *part, AliRDHFCutsLctoV0 *cutsAnal, TClonesArray *mcArray, Int_t isLc);
82   void DefineTreeVariables();
83
84   Int_t MatchToMC(AliAODRecoCascadeHF *lc2bacV0,
85                   Int_t *pdgDgLc2bacV0, Int_t *pdgDgV0,
86                   TClonesArray *mcArray);
87
88   Int_t SearchLcDaughter(TClonesArray *arrayMC, Int_t iii);
89
90   void DefineGeneralHistograms();
91   void DefineAnalysisHistograms();
92   void DefineK0SHistos();
93   void  FillAnalysisHistograms(AliAODRecoCascadeHF *part, Bool_t isBachelorID, TString appendthis);
94
95   AliAnalysisTaskSELc2V0bachelor(const AliAnalysisTaskSELc2V0bachelor &source);
96   AliAnalysisTaskSELc2V0bachelor& operator=(const AliAnalysisTaskSELc2V0bachelor& source); 
97   
98   Double_t Det(Double_t a00,Double_t a01,
99                Double_t a10,Double_t a11) const;
100   Double_t Det(Double_t a00,Double_t a01,Double_t a02,
101                Double_t a10,Double_t a11,Double_t a12,
102                Double_t a20,Double_t a21,Double_t a22) const;
103   Double_t PropagateToDCA(AliAODv0 *v, AliAODTrack *bachelor, Double_t b,
104                           Double_t &xVtxLc, Double_t &yVtxLc, Double_t &zVtxLc,
105                           Double_t &pxVtxLc, Double_t &pyVtxLc, Double_t &pzVtxLc);
106
107   Double_t GetAlpha(Double_t xyz[3],Double_t pxpypz[3]);
108
109   Bool_t fUseMCInfo;          // Use MC info
110   TList *fOutput;             // User output slot 1 // general histos
111   TList *fOutputAll;          // User output slot 4 // histos without pid and cut on V0
112   TList *fOutputPIDBach;      // User output slot 5 // histos with PID on Bachelor
113
114   TH1F *fCEvents;                    // Histogram to check selected events
115   AliPIDResponse *fPIDResponse;      //! PID response object
116   Bool_t fIsK0SAnalysis;             // switch between Lpi and K0Sp
117   AliNormalizationCounter *fCounter; // AliNormalizationCounter on output slot 2
118   AliRDHFCutsLctoV0 *fAnalCuts;      // Cuts - sent to output slot 3
119   //TList *fListCuts;                  // list of cuts
120   Bool_t fUseOnTheFlyV0;             // flag to analyze also on-the-fly V0 candidates
121   Bool_t fIsEventSelected;           // flag for event selected
122
123   Bool_t    fWriteVariableTree;       // flag to decide whether to write the candidate variables on a tree variables
124   TTree    *fVariablesTree;           //! tree of the candidate variables after track selection on output slot 4
125   Float_t *fCandidateVariables;       //! variables to be written to the tree
126   AliAODVertex *fVtx1;                // primary vertex
127   Float_t fBzkG;                      // magnetic field value [kG]
128   Bool_t fAdditionalChecks;           // flag to fill additional histograms
129
130   ClassDef(AliAnalysisTaskSELc2V0bachelor,4); // class for Lc->p K0
131 };
132
133 #endif
134