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