]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/hfe/AliAnalysisTaskHFE.h
Update of the HFE package
[u/mrichter/AliRoot.git] / PWG3 / 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_THnSparse
28 #include <THnSparse.h>
29 #endif
30
31 class AliHFEpid;
32 class AliHFEcuts;
33 class AliHFEmcQA;
34 class AliHFEsecVtx;
35 class AliHFEelecbackground;
36 class AliHFEcollection;
37 class AliCFManager;
38 class AliVEvent;
39 class AliMCEvent;
40 class AliVParticle;
41 class TH1I; 
42 class TList;
43 class TH3D;
44 class TF1;
45
46 class AliAnalysisTaskHFE : public AliAnalysisTaskSE{
47   public:
48     enum{
49       kPIDqa = 0,
50       kMCqa =1 
51     };
52     enum{
53       kPriVtx = 0,
54       kSecVtx = 1,
55       kIsElecBackGround = 2,
56       kPostProcess = 3
57     };
58     enum CreationProcess_t{
59       kSignalCharm = 0,
60       kSignalBeauty = 1,
61       kGammaConv = 2,
62       kOther = 3
63     };
64     AliAnalysisTaskHFE();
65     AliAnalysisTaskHFE(const char * name);
66     AliAnalysisTaskHFE(const AliAnalysisTaskHFE &ref);
67     AliAnalysisTaskHFE& operator=(const AliAnalysisTaskHFE &ref);
68     virtual void Copy(TObject &o) const;
69     virtual ~AliAnalysisTaskHFE();
70
71     virtual void UserCreateOutputObjects();
72     virtual void UserExec(Option_t *);
73     virtual void Terminate(Option_t *);
74
75     virtual Bool_t IsEventInBinZero();
76
77     Bool_t IsQAOn(Int_t qaLevel) const { return TESTBIT(fQAlevel, qaLevel); };
78     Bool_t IsAODanalysis() const { return TestBit(kAODanalysis); };
79     Bool_t IsESDanalysis() const { return !TestBit(kAODanalysis); };
80     Bool_t HasMCData() const { return TestBit(kHasMCdata); }
81     Bool_t GetPlugin(Int_t plug) const { return TESTBIT(fPlugins, plug); };
82     void SetHFECuts(AliHFEcuts * const cuts) { fCuts = cuts; };
83     void SetHFEElecBackGround(AliHFEelecbackground * const elecBackGround) { fElecBackGround = elecBackGround; };
84     void SetQAOn(Int_t qaLevel) { SETBIT(fQAlevel, qaLevel); };
85     void SwitchOnPlugin(Int_t plug);
86     void SetHasMCData(Bool_t hasMC = kTRUE) { SetBit(kHasMCdata, hasMC); };
87     void SetPIDdetectors(Char_t * const detectors){ fPIDdetectors = detectors; }
88     void SetPIDStrategy(UInt_t strategy) { fPIDstrategy = strategy; }
89     void AddPIDdetector(TString detector);
90     void SetAODAnalysis() { SetBit(kAODanalysis, kTRUE); };
91     void SetESDAnalysis() { SetBit(kAODanalysis, kFALSE); };
92     void SetWeightFactors(TH3D * const weightFactors);
93     void SetWeightFactorsFunction(TF1 * const weightFactorsFunction);
94     void PrintStatus() const;
95  
96   private:
97     enum{
98       kHasMCdata = BIT(19),
99       kAODanalysis = BIT(20)
100     };
101     class LabelContainer{
102       public:
103         LabelContainer(Int_t capacity);
104         ~LabelContainer() {delete[] fContainer; };
105
106         Bool_t Append(Int_t label);
107         Bool_t Find(Int_t Label) const;
108         Int_t Next();
109         void ResetIterator(){ fCurrent = fBegin; }
110
111       private:
112         LabelContainer(const LabelContainer &);
113         LabelContainer &operator=(const LabelContainer &);
114         Int_t *fContainer;    // the Container for the labels
115         Int_t *fBegin;        // Pointer to the first entry
116         Int_t *fEnd;          // Pointer to the end of the container
117         Int_t *fLast;         // Pointer to the last entry
118         Int_t *fCurrent;      // Current entry to mimic an iterator
119     };
120
121     Bool_t IsGammaElectron(const AliVParticle * const track) const;
122     Int_t  IsSignalElectron(const AliVParticle * const track) const;
123     Bool_t FillProductionVertex(const AliVParticle * const track) const;
124     Double_t FindWeight(Double_t pt, Double_t eta, Double_t phi) const;
125     void MakeParticleContainer();
126     void MakeEventContainer();
127     void ProcessMC();
128     void ProcessESD();
129     void ProcessAOD();
130     Bool_t ProcessMCtrack(AliVParticle *track);
131     Bool_t ProcessCutStep(Int_t cutStep, AliVParticle *track, Double_t *container, Bool_t signal, Bool_t alreadyseen,Double_t weight);
132     
133     ULong_t fQAlevel;                     // QA level
134     TString fPIDdetectors;                // Detectors for Particle Identification
135     UInt_t fPIDstrategy;                  // PID Strategy
136     Double_t fTPCBetheBlochParameters[5]; // TPC Bethe-Bloch Parameters
137     UShort_t fPlugins;                    // Enabled Plugins
138     Bool_t  fWeighting;                   // Weighting or not for the efficiency maps
139     TH3D *fWeightFactors;                 // Weight factors
140     TF1  *fWeightFactorsFunction;         // Weight factors
141     AliCFManager *fCFM;                   //! Correction Framework Manager
142     AliCFContainer * fHadronicBackground; //! Container for hadronic Background
143     TList *fCorrelation;                  //! response matrix for unfolding  
144     THnSparseF *fPIDperformance;          //! info on contamination and yield of electron spectra
145     THnSparseF *fSignalToBackgroundMC;    //! Signal To Background Studies on pure MC information
146     AliHFEpid *fPID;                      //! PID
147     AliHFEcuts *fCuts;                    // Cut Collection
148     AliHFEsecVtx *fSecVtx;                //! Secondary Vertex Analysis
149     AliHFEelecbackground *fElecBackGround;//! Background analysis
150     AliHFEmcQA *fMCQA;                    //! MC QA
151     TH1I *fNEvents;                       //! counter for the number of Events
152     TH1I *fNElectronTracksEvent;          //! Number of Electron candidates after PID decision per Event
153     TList *fQA;                           //! QA histos for the cuts
154     TList *fOutput;                       //! Container for Task Output
155     TList *fHistMCQA;                     //! Output container for MC QA histograms 
156     TList *fHistSECVTX;                   //! Output container for sec. vertexing results
157     TList *fHistELECBACKGROUND;           //! Output container for electron background analysis
158 //    AliHFEcollection *fQAcoll;            //! collection class for basic QA histograms
159
160     ClassDef(AliAnalysisTaskHFE, 2)       // The electron Analysis Task
161 };
162 #endif
163