]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliAnalysisTaskHFE.h
Update
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliAnalysisTaskHFE.h
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
7 * Permission to use, copy, modify and distribute this software and its   *
8 * documentation strictly for non-commercial purposes is hereby granted   *
9 * without fee, provided that the above copyright notice appears in all   *
10 * copies and that both the copyright notice and this permission notice   *
11 * appear in the supporting documentation. The authors make no claims     *
12 * about the suitability of this software for any purpose. It is          *
13 * provided "as is" without express or implied warranty.                  *
14 **************************************************************************/
15 //
16 // Task for Heavy Flavour Electron Analysis
17 // Fills a single-inclusive electron pt-spectrum
18 // For further information see implementation file
19 //
20 #ifndef ALIANALYSISTASKHFE_H
21 #define ALIANALYSISTASKHFE_H
22
23 #ifndef ALIANALYSISTASKSE_H
24 #include "AliAnalysisTaskSE.h"
25 #endif
26
27 #ifndef ROOT_TString
28 #include <TString.h>
29 #endif
30
31 class AliHFEcontainer;
32 class AliHFEcollection;
33 class AliHFEcuts;
34 class AliHFEextraCuts;
35 class AliHFEelecbackground;
36 class AliHFEmcQA;
37 class AliHFEpid;
38 class AliHFEpidQAmanager;
39 class AliHFEsecVtx;
40 class AliHFEsignalCuts;
41 class AliHFEvarManager;
42 class AliHFEtaggedTrackAnalysis;
43 class AliCFManager;
44 class AliMCEvent;
45 class AliOADBContainer;
46 class AliAODMCHeader;
47 class AliVEvent;
48 class AliVParticle;
49 class AliTriggerAnalysis;
50 class TH1I; 
51 class TList;
52 class TClonesArray;
53
54 class AliAnalysisTaskHFE : public AliAnalysisTaskSE{
55   public:
56     enum{
57       kPIDqa = 0,
58       kMCqa =1 
59     };
60     enum{
61       kPriVtx = 0,
62       kSecVtx = 1,
63       kIsElecBackGround = 2,
64       kPostProcess = 3,
65       kDEstep = 4,
66       kTaggedTrackAnalysis = 5
67     };
68     enum CreationProcess_t{
69       kSignalCharm = 0,
70       kSignalBeauty = 1,
71       kGammaConv = 2,
72       kOther = 3
73     };
74     enum{
75       kBgPtBins = 44,
76       kElecBgSpecies = 6,
77       kCentBins = 11,
78       kBgLevels = 3
79     };
80
81     AliAnalysisTaskHFE();
82     AliAnalysisTaskHFE(const char * name);
83     AliAnalysisTaskHFE(const AliAnalysisTaskHFE &ref);
84     AliAnalysisTaskHFE& operator=(const AliAnalysisTaskHFE &ref);
85     virtual void Copy(TObject &o) const;
86     virtual ~AliAnalysisTaskHFE();
87
88     virtual void UserCreateOutputObjects();
89     virtual void UserExec(Option_t *);
90     virtual void Terminate(Option_t *);
91
92     virtual Bool_t IsEventInBinZero();
93
94     Bool_t IsQAOn(Int_t qaLevel) const { return TESTBIT(fQAlevel, qaLevel); };
95     Bool_t IsAODanalysis() const { return TestBit(kAODanalysis); };
96     Bool_t IsESDanalysis() const { return !TestBit(kAODanalysis); };
97     Bool_t HasMCData() const { return TestBit(kHasMCdata); }
98     Bool_t IsPbPb() const { return TestBit(kBeamType); }
99     Bool_t GetPlugin(Int_t plug) const { return TESTBIT(fPlugins, plug); };
100
101     // Get Components for configuration
102     AliHFEvarManager *GetVarManager() const { return fVarManager; }
103     AliHFEpidQAmanager *GetPIDQAManager() const { return fPIDqa; }
104     AliHFEpid *GetPID() const { return fPID; }
105
106     void SetHFECuts(AliHFEcuts * const cuts) { fCuts = cuts; };
107     void SetTaggedTrackCuts(AliHFEcuts * const cuts) { fTaggedTrackCuts = cuts; }
108     void SetCleanTaggedTrack(Bool_t clean) { fCleanTaggedTrack = clean; };
109     void SetVariablesTRDTaggedTrack(Bool_t variablesTRD) { fVariablesTRDTaggedTrack = variablesTRD; };
110     void SetHFECutsPreselect(AliHFEcuts * const cuts) { fCutspreselect = cuts; };
111     void SetHFEElecBackGround(AliHFEelecbackground * const elecBackGround) { fElecBackGround = elecBackGround; };
112     void SetQAOn(Int_t qaLevel) { SETBIT(fQAlevel, qaLevel); };
113     void SwitchOnPlugin(Int_t plug);
114     void SetHasMCData(Bool_t hasMC = kTRUE) { SetBit(kHasMCdata, hasMC); };
115     void SetFillSignalOnly(Bool_t signalOnly) { fFillSignalOnly = signalOnly; }
116    
117     void SetFillNoCuts(Bool_t fillNoCuts) { fFillNoCuts = fillNoCuts; }
118     void SetUseFilterAOD(Bool_t useFilterAOD) { fUseFilterAOD = useFilterAOD; }
119     void SetApplyCutAOD(Bool_t applyCutAOD)   { fApplyCutAOD = applyCutAOD; }
120     void SetFilter(UInt_t filter)             { fFilter = filter; }
121     void SetRemovePileUp(Bool_t removePileUp) { fRemovePileUp = removePileUp; }
122     void SetPIDPreselect(AliHFEpid * const cuts) { fPIDpreselect = cuts; };
123     void SetAODAnalysis() { SetBit(kAODanalysis, kTRUE); };
124     void SetESDAnalysis() { SetBit(kAODanalysis, kFALSE); };
125     void SetPbPbAnalysis(Bool_t isPbPb = kFALSE) { SetBit(kBeamType, isPbPb); };
126     void SetPbPbUserCentralityLimit(Bool_t isPbPbUserBinning = kFALSE){fPbPbUserCentralityBinning = isPbPbUserBinning; };
127     void SetPbPbUserCentralityArray(Int_t icentr, Float_t valuecentr) {fCentralityLimits[icentr] = valuecentr;};
128     void SetPPMultiBinAnalysis(Bool_t isppMultiBin) { fisppMultiBin = isppMultiBin; };
129     void SetNonHFEsystematics(Bool_t isSystematics) {fisNonHFEsystematics = isSystematics; };
130     void SetRejectKinkMother(Bool_t rejectKinkMother = kFALSE) { fRejectKinkMother = rejectKinkMother; };
131     void SetBackGroundFactorsFunction(const TF1 * const backGroundFactorsFunction, Int_t centralitybin=0){  
132       fkBackGroundFactorArray[centralitybin]=backGroundFactorsFunction;
133       fBackGroundFactorApply=kTRUE;
134       SetBit(kBackgroundInitialized);
135     };
136     void SetBackgroundFactorsFromOADB(AliOADBContainer *cont) { fHadronBackgroundOADB = cont; fBackGroundFactorApply = kTRUE; }
137     void SetElecBackGroundFactors(Int_t iPt, Int_t iType, Int_t iCent, Int_t iError, Double_t elecBackGroundFactor) {fElecBackgroundFactor[iError][iCent][iType][iPt] = elecBackGroundFactor; };
138     void SetBinLimits(Int_t iPt, Double_t momentum){fBinLimit[iPt] = momentum;};
139     void PrintStatus() const;
140     Bool_t ReadCentrality();
141     void RejectionPileUpVertexRangeEventCut();  
142     void SelectSpecialTrigger(const Char_t *trgclust, Int_t runMin = 0, Int_t runMax = 999999999); 
143     void SetDebugStreaming() {SetBit(kTreeStream);};
144     
145   private:
146     enum{
147       kHasMCdata = BIT(19),
148       kAODanalysis = BIT(20),
149       kBeamType = BIT(21),
150       kBackgroundInitialized = BIT(22),
151       kTreeStream = BIT(23)
152     };
153
154     Bool_t FillProductionVertex(const AliVParticle * const track) const;
155     void MakeParticleContainer();
156     void MakeEventContainer();
157     void InitPIDperformanceQA();
158     void InitContaminationQA();
159     void InitHistoITScluster();
160     Bool_t InitializeHadronBackground(Int_t run);
161     const Char_t *GetSpecialTrigger(Int_t run);
162     void ProcessMC();
163     void ProcessESD();
164     void ProcessAOD();
165     Int_t GetITSMultiplicity(AliVEvent *ev);
166     Bool_t PreSelectTrack(AliESDtrack *track) const;
167     Bool_t ProcessMCtrack(AliVParticle *track);
168     Bool_t ProcessCutStep(Int_t cutStep, AliVParticle *track);
169     AliAODMCHeader *fAODMCHeader;         // ! MC info AOD
170     TClonesArray *fAODArrayMCInfo;        // ! MC info particle AOD
171     ULong_t fQAlevel;                     // QA level
172     UShort_t fPlugins;                    // Enabled Plugins
173     Bool_t fFillSignalOnly;               // Fill container only with MC Signal Tracks
174     Bool_t fFillNoCuts;                   // Fill container before any cut
175     Bool_t fUseFilterAOD;                   // Use the preselected AOD track
176     Bool_t fApplyCutAOD;                  // Apply the analysis cut for AOD tracks
177     UInt_t fFilter;                       // filter AOD status  
178     Bool_t fBackGroundFactorApply;        // Apply Background Function Subtraction,   MF: To be removed when transition to OADB container is finished
179     Bool_t fRemovePileUp;                 // Remove Pile Up
180     Bool_t fIdentifiedAsPileUp;           // Identified as pile-up
181     Bool_t fIdentifiedAsOutInz;           // Out Of Range in z
182     Bool_t fPassTheEventCut;              // Pass The Event Cut
183     Bool_t fRejectKinkMother;             // Reject Kink Mother
184     Bool_t fisppMultiBin;                 // pp Multiplicity Bin analysis
185     Bool_t fPbPbUserCentralityBinning;    // PbPb user centrality binning
186     Bool_t fisNonHFEsystematics;          // Non-HFE background systematics analysis
187     AliOADBContainer *fSpecialTrigger;    // Special trigger selection
188     Int_t   fCentralityF;                 // Centrality bin
189     Float_t fCentralityPercent;           // Centrality percentile
190     Float_t fContributors;                // Contributors
191     Double_t fWeightBackGround;            // weight background function
192     Double_t fVz;                         // z position of the primary vertex
193     AliOADBContainer *fHadronBackgroundOADB;  // OADB Container for hadron contamination
194     const TF1  *fkBackGroundFactorArray[12];   // Array of BackGround factors for each centrality bin, bin0 = min bias
195     Double_t fElecBackgroundFactor[kBgLevels][kCentBins][kElecBgSpecies][kBgPtBins];     // Electron background factors
196     Double_t fBinLimit[kBgPtBins+1];      // Electron pt bin edges
197     Float_t fCentralityLimits[12];        // Limits for centrality bins
198     AliHFEcontainer *fContainer;          //! The HFE container
199     AliHFEvarManager *fVarManager;        // The var manager as the backbone of the analysis
200     AliHFEsignalCuts *fSignalCuts;        //! MC true signal (electron coming from certain source) 
201     AliCFManager *fCFM;                   //! Correction Framework Manager
202     AliTriggerAnalysis *fTriggerAnalysis; //! Trigger Analysis for Normalisation
203     AliHFEpid *fPID;                      // PID
204     AliHFEpidQAmanager *fPIDqa;           // PID QA
205     AliHFEpid *fPIDpreselect;             // PID oject for pre-selected tracks (without QA)
206     AliHFEcuts *fCuts;                    // Cut Collection
207     AliHFEcuts *fTaggedTrackCuts;         // Cut Collection for V0 tagged tracks
208     Bool_t fCleanTaggedTrack;             // Loose cleaning of the V0 tagged tracks electron
209     Bool_t fVariablesTRDTaggedTrack;      // Take the variables at the TRD for the V0 tagged tracks electron
210     AliHFEcuts *fCutspreselect;           // Cut Collection for pre-selected tracks
211     AliHFEsecVtx *fSecVtx;                //! Secondary Vertex Analysis
212     AliHFEelecbackground *fElecBackGround;//! Background analysis
213     AliHFEmcQA *fMCQA;                    //! MC QA
214     AliHFEtaggedTrackAnalysis *fTaggedTrackAnalysis;     //!Analyse V0-tagged tracks
215     AliHFEextraCuts *fExtraCuts;          //! temporary implementation for IP QA
216
217     //-----------QA and output---------------
218     TList *fQA;                           //! QA histos for the cuts
219     TList *fOutput;                       //! Container for Task Output
220     TList *fHistMCQA;                     //! Output container for MC QA histograms 
221     TList *fHistSECVTX;                   //! Output container for sec. vertexing results
222     TList *fHistELECBACKGROUND;           //! Output container for electron background analysis
223     AliHFEcollection *fQACollection;      //! Tasks own QA collection
224     AliHFEcollection *fQAAODCollection;   //! Task own QA AOD collection
225     //---------------------------------------
226
227     ClassDef(AliAnalysisTaskHFE, 2)       // The electron Analysis Task
228 };
229 #endif
230