]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/vertexingHF/AliCFTaskVertexingHF.h
Update for D* v2 (Robert)
[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 "AliCFVertexingHF.h"
32
33 class TH1I;
34 class TParticle ;
35 class TFile ;
36 class TClonesArray ;
37 class AliCFManager;
38 class AliAODRecoDecay;
39 class AliAODRecoDecayHF2Prong;
40 class AliAODMCParticle;
41 class THnSparse;
42 class TF1;
43 class AliRDHFCuts;
44 class AliCFVertexingHF2Prong;
45 class AliCFVertexingHF3Prong;
46
47 class AliCFTaskVertexingHF: public AliAnalysisTaskSE {
48 public:
49         
50         enum {
51                 kStepGeneratedLimAcc = 0,
52                 kStepGenerated       = 1,
53                 kStepAcceptance      = 2,
54                 kStepVertex          = 3,
55                 kStepRefit           = 4,
56                 kStepReconstructed   = 5,
57                 kStepRecoAcceptance  = 6,
58                 kStepRecoITSClusters = 7,
59                 kStepRecoPPR         = 8,
60                 kStepRecoPID         = 9
61         };
62
63         enum {
64                 kSnail = 0,    // slow configuration, all variables
65                 kCheetah = 1   // fast configuration, only a subset of variables
66         };
67         
68         AliCFTaskVertexingHF();
69         AliCFTaskVertexingHF(const Char_t* name, AliRDHFCuts* cuts, TF1* func = 0x0);
70         AliCFTaskVertexingHF& operator= (const AliCFTaskVertexingHF& c);
71         AliCFTaskVertexingHF(const AliCFTaskVertexingHF& c);
72         virtual ~AliCFTaskVertexingHF();
73         
74         // ANALYSIS FRAMEWORK STUFF to loop on data and fill output objects
75         void     UserCreateOutputObjects();
76         void     UserExec(Option_t *option);
77         void     Init();
78         void     LocalInit() {Init();}
79         void     Terminate(Option_t *);
80         
81         // UNFOLDING
82         void     SetCorrelationMatrix(THnSparse* h) {fCorrelation=h;}
83         void     SetAcceptanceUnf(Bool_t AcceptanceUnf) {fAcceptanceUnf = AcceptanceUnf;}
84         Bool_t   GetAcceptanceUnf() const {return fAcceptanceUnf;}
85         
86         
87         // CORRECTION FRAMEWORK RELATED FUNCTIONS
88         void           SetCFManager(AliCFManager* io) {fCFManager = io;}   // global correction manager
89         AliCFManager * GetCFManager()                 {return fCFManager;} // get corr manager
90         
91         // Setters (and getters) for the config macro
92         void    SetFillFromGenerated(Bool_t flag) {fFillFromGenerated = flag;}
93         Bool_t  GetFillFromGenerated() const {return fFillFromGenerated;}
94         void    SetDecayChannel (Int_t decayChannel) {fDecayChannel = decayChannel;}
95         Int_t   GetDecayChannel () {return fDecayChannel;}
96         void     SetUseWeight(Bool_t useWeight){fUseWeight=useWeight;}
97         Bool_t   GetUseWeight() const {return fUseWeight;}
98         Double_t GetWeight(Float_t pt);
99         Double_t dNdptFit(Float_t pt, Double_t* par);
100
101         void SetUseFlatPtWeight(Bool_t useWeight){fUseFlatPtWeight=useWeight; fUseWeight=useWeight;}
102         Bool_t GetUseFlatPtWeight() const {return fUseFlatPtWeight;}
103         void SetUseZWeight(Bool_t useWeight){fUseZWeight=useWeight;}
104         Bool_t GetUseZWeight() const {return fUseZWeight;}
105         Double_t GetZWeight(Float_t z, Int_t runnumber);
106         Double_t DodzFit(Float_t z, Double_t* par);
107         
108         void   SetDselection(UShort_t originDselection) {fOriginDselection=originDselection;}
109         UShort_t GetDselection (){return fOriginDselection;}
110         void SetSign(Char_t isSign) {fSign = isSign;}
111         Char_t GetSign() {return fSign;}
112          
113         void SetCentralitySelection(Bool_t centSelec = kTRUE) {fCentralitySelection = centSelec;}   
114         Bool_t GetCentralitySelection() {return fCentralitySelection;} 
115
116         void SetFakeSelection(Int_t fakeSel = 0) {fFakeSelection=fakeSel;}
117         Int_t GetFakeSelection(){return fFakeSelection;}
118
119         void SetRejectCandidateIfNotFromQuark(Bool_t opt){fRejectIfNoQuark=opt;}
120         Bool_t GetRejectCandidateIfNotFromQuark(){return fRejectIfNoQuark;}
121
122         void SetUseMCVertex(Bool_t opt){fUseMCVertex=opt;}
123         Bool_t GetUseMCVertex(){return fUseMCVertex;}
124         
125
126         void SetKeepDsViaPhi(){fDsOption=1;}
127         void SetKeepDsViaK0star(){fDsOption=2;}
128         void SetKeepAllDs(){fDsOption=3;}
129         void SetCountAllDs(){fGenDsOption=AliCFVertexingHF3Prong::kCountAllDsKKpi;}
130         void SetCountDsViaPhi(){fGenDsOption=AliCFVertexingHF3Prong::kCountPhipi;}
131         void SetCountDsViaK0star(){fGenDsOption=AliCFVertexingHF3Prong::kCountK0stK;}
132         void SetCountResonantDs(){fGenDsOption=AliCFVertexingHF3Prong::kCountResonant;}
133         void SetCountNonResonantDs(){fGenDsOption=AliCFVertexingHF3Prong::kCountNonResonant;}
134
135         Bool_t ProcessDs(Int_t returnCodeDs) const;
136
137         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;} 
138         Int_t GetConfiguration() const {return fConfiguration;} 
139         
140         void SetWeightFunction(TF1* func) {fFuncWeight = func;}
141         TF1* GetWeightFunction() const {return fFuncWeight;}
142         
143 protected:
144         AliCFManager   *fCFManager;   //  pointer to the CF manager
145         TH1I *fHistEventsProcessed;   //! simple histo for monitoring the number of events processed
146         THnSparse* fCorrelation;      //  response matrix for unfolding
147         Int_t fCountMC;               //  MC particle found
148         Int_t fCountAcc;              //  MC particle found that satisfy acceptance cuts
149         Int_t fCountVertex;       //  Reco particle found that satisfy vertex constrained
150         Int_t fCountRefit;        //  Reco particle found that satisfy kTPCrefit and kITSrefit
151         Int_t fCountReco;             //  Reco particle found that satisfy cuts
152         Int_t fCountRecoAcc;          //  Reco particle found that satisfy cuts in requested acceptance
153         Int_t fCountRecoITSClusters;  //  Reco particle found that satisfy cuts in n. of ITS clusters
154         Int_t fCountRecoPPR;          //  Reco particle found that satisfy cuts in PPR
155         Int_t fCountRecoPID;          //Reco PID step 
156         Int_t fEvents;                //  n. of events
157         Int_t fDecayChannel;          // decay channel to configure the task
158         Bool_t fFillFromGenerated;    //  flag to indicate whether data container should be filled with generated values also for reconstructed particles
159         UShort_t fOriginDselection;      // flag to select D0 origins. 0 Only from charm 1 only from beauty 2 both from charm and beauty
160         Bool_t fAcceptanceUnf;        //  flag for unfolding before or after cuts.
161         AliRDHFCuts* fCuts;            // cuts
162         Bool_t fUseWeight;             //flag to decide whether to use pt-weights != 1 when filling the container or not
163         Double_t fWeight;              //weight used to fill the container
164         Bool_t fUseFlatPtWeight;       // flag to decide to use a flat pt shape
165         Bool_t fUseZWeight;           // flag to decide whether to use z-vtx weights != 1 when filling the container or not
166         Int_t fNvar;                   // number of variables for the container
167         TString fPartName;    // D meson name
168         TString fDauNames;    // daughter in fin state
169         Char_t fSign;                 // flag to decide wheter to keep D0 only (0), D0bar only (1), or both D0 and D0bar (2)
170         Bool_t fCentralitySelection;  //flag to switch off the centrality selection
171         Int_t  fFakeSelection;  //selection flag for fakes tracks 
172         Bool_t fRejectIfNoQuark;  // flag to remove events not geenrated with PYTHIA
173         Bool_t fUseMCVertex;  // flag to use MC vertex (useful when runnign in pp)
174         Int_t  fDsOption;     // Ds decay option (selection level)
175         Int_t  fGenDsOption;     // Ds decay option (generation level)
176         Int_t fConfiguration; // configuration (slow / fast) of the CF --> different variables will be allocated (all / reduced number)
177         TF1* fFuncWeight;     // user-defined function to be used to calculate weights
178
179         ClassDef(AliCFTaskVertexingHF,11); // class for HF corrections as a function of many variables
180 };
181
182 #endif