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