]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/vertexingHF/AliCFTaskVertexingHF.h
Code for computing MC efficiency for Lc->K0s+proton (Annalisa)
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliCFTaskVertexingHF.h
1 #ifndef ALICFTASKVERTEXINGHF_H
2 #define ALICFTASKVERTEXINGHF_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 //-----------------------------------------------------------------------
21 // Class for HF corrections as a function of many variables and step 
22 // Author : C. Zampolli, CERN
23 //                      D. Caffarri, Univ & INFN Padova caffarri@pd.infn.it
24 // Base class for HF Unfolding - agrelli@uu.nl
25 //-----------------------------------------------------------------------
26
27
28 #include "AliAnalysisTaskSE.h"
29 #include "AliCFVertexingHF2Prong.h"
30 #include "AliCFVertexingHF3Prong.h"
31 #include "AliCFVertexingHFLctoV0bachelor.h"
32 #include "AliCFVertexingHF.h"
33 #include <TH1F.h>
34
35 class TH1I;
36 class TParticle ;
37 class TFile ;
38 class TClonesArray ;
39 class AliCFManager;
40 class AliAODRecoDecay;
41 class AliAODRecoDecayHF2Prong;
42 class AliAODMCParticle;
43 class THnSparse;
44 class TF1;
45 class AliRDHFCuts;
46 class AliCFVertexingHF2Prong;
47 class AliCFVertexingHF3Prong;
48
49 class AliCFTaskVertexingHF: public AliAnalysisTaskSE {
50 public:
51         
52         enum {
53                 kStepGeneratedLimAcc = 0,
54                 kStepGenerated       = 1,
55                 kStepAcceptance      = 2,
56                 kStepVertex          = 3,
57                 kStepRefit           = 4,
58                 kStepReconstructed   = 5,
59                 kStepRecoAcceptance  = 6,
60                 kStepRecoITSClusters = 7,
61                 kStepRecoPPR         = 8,
62                 kStepRecoPID         = 9
63         };
64
65         enum {
66                 kSnail = 0,    // slow configuration, all variables
67                 kCheetah = 1   // fast configuration, only a subset of variables
68         };
69
70         enum {
71           kAll = 0,   // all decays (resonant + non-resonant)
72           kNonResonant = 1, // only non resonant
73           kL1520 = 2,  // Lc --> L(1520) + p
74           kKstar = 3,  // Lc --> K* + pi
75           kDelta = 4   // Lc --> Delta + K
76         };
77         
78         AliCFTaskVertexingHF();
79         AliCFTaskVertexingHF(const Char_t* name, AliRDHFCuts* cuts, TF1* func = 0x0);
80         AliCFTaskVertexingHF& operator= (const AliCFTaskVertexingHF& c);
81         AliCFTaskVertexingHF(const AliCFTaskVertexingHF& c);
82         virtual ~AliCFTaskVertexingHF();
83         
84         // ANALYSIS FRAMEWORK STUFF to loop on data and fill output objects
85         void     UserCreateOutputObjects();
86         void     UserExec(Option_t *option);
87         void     Init();
88         void     LocalInit() {Init();}
89         void     Terminate(Option_t *);
90         
91         // UNFOLDING
92         void     SetCorrelationMatrix(THnSparse* h) {fCorrelation=h;}
93         void     SetAcceptanceUnf(Bool_t AcceptanceUnf) {fAcceptanceUnf = AcceptanceUnf;}
94         Bool_t   GetAcceptanceUnf() const {return fAcceptanceUnf;}
95         
96         
97         // CORRECTION FRAMEWORK RELATED FUNCTIONS
98         void           SetCFManager(AliCFManager* io) {fCFManager = io;}   // global correction manager
99         AliCFManager * GetCFManager()                 {return fCFManager;} // get corr manager
100         
101         // Setters (and getters) for the config macro
102         void    SetFillFromGenerated(Bool_t flag) {fFillFromGenerated = flag;}
103         Bool_t  GetFillFromGenerated() const {return fFillFromGenerated;}
104         void    SetDecayChannel (Int_t decayChannel) {fDecayChannel = decayChannel;}
105         Int_t   GetDecayChannel () {return fDecayChannel;}
106         void     SetUseWeight(Bool_t useWeight){fUseWeight=useWeight;}
107         Bool_t   GetUseWeight() const {return fUseWeight;}
108         Double_t GetWeight(Float_t pt);
109         Double_t dNdptFit(Float_t pt, Double_t* par);
110
111         void SetUseFlatPtWeight(Bool_t useWeight){fUseFlatPtWeight=useWeight; fUseWeight=useWeight;}
112         Bool_t GetUseFlatPtWeight() const {return fUseFlatPtWeight;}
113         void SetUseZWeight(Bool_t useWeight){fUseZWeight=useWeight;}
114         Bool_t GetUseZWeight() const {return fUseZWeight;}
115         Double_t GetZWeight(Float_t z, Int_t runnumber);
116         Double_t DodzFit(Float_t z, Double_t* par);
117
118         void SetUseNchWeight(Bool_t useWeight){fUseNchWeight=useWeight;}
119         Bool_t GetUseNchWeight() const {return fUseNchWeight;}
120         void SetMCNchHisto(TH1F* h){
121           if(fHistoMCNch) delete fHistoMCNch;
122           fHistoMCNch=new TH1F(*h);
123         }
124         void CreateMeasuredNchHisto();
125         Double_t GetNchWeight(Int_t nch);
126
127         void   SetDselection(UShort_t originDselection) {fOriginDselection=originDselection;}
128         UShort_t GetDselection (){return fOriginDselection;}
129         void SetSign(Char_t isSign) {fSign = isSign;}
130         Char_t GetSign() {return fSign;}
131          
132         void SetCentralitySelection(Bool_t centSelec = kTRUE) {fCentralitySelection = centSelec;}   
133         Bool_t GetCentralitySelection() {return fCentralitySelection;} 
134
135         void SetFakeSelection(Int_t fakeSel = 0) {fFakeSelection=fakeSel;}
136         Int_t GetFakeSelection(){return fFakeSelection;}
137
138         void SetRejectCandidateIfNotFromQuark(Bool_t opt){fRejectIfNoQuark=opt;}
139         Bool_t GetRejectCandidateIfNotFromQuark(){return fRejectIfNoQuark;}
140
141         void SetUseMCVertex(Bool_t opt){fUseMCVertex=opt;}
142         Bool_t GetUseMCVertex(){return fUseMCVertex;}
143         
144
145         void SetKeepDsViaPhi(){fDsOption=1;}
146         void SetKeepDsViaK0star(){fDsOption=2;}
147         void SetKeepAllDs(){fDsOption=3;}
148         void SetCountAllDs(){fGenDsOption=AliCFVertexingHF3Prong::kCountAllDsKKpi;}
149         void SetCountDsViaPhi(){fGenDsOption=AliCFVertexingHF3Prong::kCountPhipi;}
150         void SetCountDsViaK0star(){fGenDsOption=AliCFVertexingHF3Prong::kCountK0stK;}
151         void SetCountResonantDs(){fGenDsOption=AliCFVertexingHF3Prong::kCountResonant;}
152         void SetCountNonResonantDs(){fGenDsOption=AliCFVertexingHF3Prong::kCountNonResonant;}
153
154         Bool_t ProcessDs(Int_t returnCodeDs) const;
155
156         void SetConfiguration(Int_t configuration) {(configuration == kSnail) ? Printf("Slow configuration chosen, all variables will be used!") : Printf("Fast configuration chosen, all variablesOnly pt, y, phi, ct, fake, z_vtx, centrality and multiplicity will be used!"); fConfiguration = configuration;} 
157         Int_t GetConfiguration() const {return fConfiguration;} 
158         
159         void SetWeightFunction(TF1* func) {fFuncWeight = func;}
160         TF1* GetWeightFunction() const {return fFuncWeight;}
161
162         void SetResonantDecay(UInt_t resonantDecay) {fResonantDecay = resonantDecay;}
163         UInt_t GetResonantDecay() const {return fResonantDecay;}
164
165         void SetKeepLctoK0Sp() {fLctoV0bachelorOption=1;}
166         void SetKeepLctoLambdaBarpi() {fLctoV0bachelorOption=2;}
167         void SetKeepLctoLambdapi() {fLctoV0bachelorOption=4;}
168         void SetKeepLctoV0bachelor() {fLctoV0bachelorOption=7;}
169
170         void SetCountAllLctoBachelor(){fGenLctoV0bachelorOption=AliCFVertexingHFLctoV0bachelor::kCountAllLctoV0;}
171         void SetCountLctoK0Sp(){fGenLctoV0bachelorOption=AliCFVertexingHFLctoV0bachelor::kCountK0Sp;}
172         void SetCountLambdaBarpi(){fGenLctoV0bachelorOption=AliCFVertexingHFLctoV0bachelor::kCountLambdapi;}
173
174         Bool_t ProcessLctoV0Bachelor(Int_t returnCodeDs) const;
175
176 protected:
177         AliCFManager   *fCFManager;   //  pointer to the CF manager
178         TH1I *fHistEventsProcessed;   //! simple histo for monitoring the number of events processed
179         THnSparse* fCorrelation;      //  response matrix for unfolding
180         Int_t fCountMC;               //  MC particle found
181         Int_t fCountAcc;              //  MC particle found that satisfy acceptance cuts
182         Int_t fCountVertex;       //  Reco particle found that satisfy vertex constrained
183         Int_t fCountRefit;        //  Reco particle found that satisfy kTPCrefit and kITSrefit
184         Int_t fCountReco;             //  Reco particle found that satisfy cuts
185         Int_t fCountRecoAcc;          //  Reco particle found that satisfy cuts in requested acceptance
186         Int_t fCountRecoITSClusters;  //  Reco particle found that satisfy cuts in n. of ITS clusters
187         Int_t fCountRecoPPR;          //  Reco particle found that satisfy cuts in PPR
188         Int_t fCountRecoPID;          //Reco PID step 
189         Int_t fEvents;                //  n. of events
190         Int_t fDecayChannel;          // decay channel to configure the task
191         Bool_t fFillFromGenerated;    //  flag to indicate whether data container should be filled with generated values also for reconstructed particles
192         UShort_t fOriginDselection;      // flag to select D0 origins. 0 Only from charm 1 only from beauty 2 both from charm and beauty
193         Bool_t fAcceptanceUnf;        //  flag for unfolding before or after cuts.
194         AliRDHFCuts* fCuts;            // cuts
195         Bool_t fUseWeight;             //flag to decide whether to use pt-weights != 1 when filling the container or not
196         Double_t fWeight;              //weight used to fill the container
197         Bool_t fUseFlatPtWeight;       // flag to decide to use a flat pt shape
198         Bool_t fUseZWeight;           // flag to decide whether to use z-vtx weights != 1 when filling the container or not
199         Bool_t fUseNchWeight;         // flag to decide whether to use Ncharged weights != 1 when filling the container or not
200         Int_t fNvar;                   // number of variables for the container
201         TString fPartName;    // D meson name
202         TString fDauNames;    // daughter in fin state
203         Char_t fSign;                 // flag to decide wheter to keep D0 only (0), D0bar only (1), or both D0 and D0bar (2)
204         Bool_t fCentralitySelection;  //flag to switch off the centrality selection
205         Int_t  fFakeSelection;  //selection flag for fakes tracks 
206         Bool_t fRejectIfNoQuark;  // flag to remove events not geenrated with PYTHIA
207         Bool_t fUseMCVertex;  // flag to use MC vertex (useful when runnign in pp)
208         Int_t  fDsOption;     // Ds decay option (selection level)
209         Int_t  fGenDsOption;     // Ds decay option (generation level)
210         Int_t fConfiguration; // configuration (slow / fast) of the CF --> different variables will be allocated (all / reduced number)
211         TF1* fFuncWeight;     // user-defined function to be used to calculate weights
212         TH1F* fHistoMeasNch;  // histogram with measured Nch distribution (pp 7 TeV)
213         TH1F* fHistoMCNch;  // histogram with Nch distribution from MC production
214         UInt_t fResonantDecay;  // resonant deacy channel to be used if the CF should be run on resonant channels only
215         Int_t fLctoV0bachelorOption; // Lc->V0+bachelor decay option (selection level)
216         Int_t fGenLctoV0bachelorOption; // Lc->V0+bachelor decay option (generation level)
217
218         ClassDef(AliCFTaskVertexingHF,13); // class for HF corrections as a function of many variables
219 };
220
221 #endif