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