add option for tasks that do not need the EMCal geometry object loaded
[u/mrichter/AliRoot.git] / PWG / EMCAL / AliAnalysisTaskEmcal.h
CommitLineData
2da09763 1#ifndef ALIANALYSISTASKEMCAL_H
2#define ALIANALYSISTASKEMCAL_H
3
9239b066 4// $Id: AliAnalysisTaskEmcalDev.h 64518 2013-10-14 12:44:52Z loizides $
2da09763 5
6class TClonesArray;
7class TString;
8class TList;
09ca054b 9class AliEmcalParticle;
2da09763 10class AliMCParticle;
2da09763 11class AliVCluster;
09ca054b 12class AliVTrack;
8afc7c8d 13class AliVParticle;
f660c2d6 14class AliVCaloCells;
ed0243d8 15class TH1;
16class TProfile;
159802e2 17class AliEMCALGeometry;
9239b066 18class AliParticleContainer;
19class AliClusterContainer;
ed0243d8 20class AliGenPythiaEventHeader;
00c77045 21class AliVCaloTrigger;
9239b066 22class AliAnalysisUtils;
37a63fdf 23class AliEmcalTriggerPatchInfo;
9239b066 24
25#include "Rtypes.h"
2da09763 26
27#include "AliAnalysisTaskSE.h"
28
29class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
30 public:
2da09763 31
32 enum BeamType {
33 kNA = -1,
34 kpp = 0,
35 kAA = 1,
36 kpA = 2
37 };
38
8e49a788 39 enum TriggerType {
40 kND = -1, //not defined
41 kJ1 = 0,
42 kJ2 = 1
43 };
44
2da09763 45 AliAnalysisTaskEmcal();
f5c26534 46 AliAnalysisTaskEmcal(const char *name, Bool_t histo=kFALSE);
2da09763 47 virtual ~AliAnalysisTaskEmcal();
48
b8aeed95 49 AliParticleContainer *AddParticleContainer(const char *n);
50 AliClusterContainer *AddClusterContainer(const char *n);
51 AliParticleContainer *GetParticleContainer(Int_t i=0) const;
52 AliClusterContainer *GetClusterContainer(Int_t i=0) const;
53 AliParticleContainer *GetParticleContainer(const char* name) const;
54 AliClusterContainer *GetClusterContainer(const char* name) const;
55 void RemoveParticleContainer(Int_t i=0) { fParticleCollArray.RemoveAt(i) ; }
56 void RemoveClusterContainer(Int_t i=0) { fClusterCollArray.RemoveAt(i) ; }
9239b066 57 void SetCaloCellsName(const char *n) { fCaloCellsName = n ; }
37a63fdf 58 void SetCaloTriggerPatchInfoName(const char *n) { fCaloTriggerPatchInfoName = n ; }
b8aeed95 59 void SetCaloTriggersName(const char *n) { fCaloTriggersName = n ; }
60 void SetCentRange(Double_t min, Double_t max) { fMinCent = min ; fMaxCent = max ; }
61 void SetCentralityEstimator(const char *c) { fCentEst = c ; }
9239b066 62 void SetClusName(const char *n) { AddClusterContainer(n) ; }
9239b066 63 void SetClusPtCut(Double_t cut, Int_t c=0);
64 void SetClusTimeCut(Double_t min, Double_t max, Int_t c=0);
b8aeed95 65 void SetEventPlaneVsEmcal(Double_t ep) { fEventPlaneVsEmcal = ep ; }
66 void SetForceBeamType(BeamType f) { fForceBeamType = f ; }
67 void SetHistoBins(Int_t nbins, Double_t min, Double_t max) { fNbins = nbins; fMinBinPt = min; fMaxBinPt = max ; }
68 void SetIsEmbedded(Bool_t i) { fIsEmbedded = i ; }
69 void SetIsPythia(Bool_t i) { fIsPythia = i ; }
70 void SetMCLabelShift(Int_t s) { fMCLabelShift = s ; }
b8aeed95 71 void SetMinMCLabel(Int_t s) { fMinMCLabel = s ; }
72 void SetMinNTrack(Int_t min) { fMinNTrack = min ; }
73 void SetMinPtTrackInEmcal(Double_t min) { fMinPtTrackInEmcal = min ; }
78a69392 74 void SetNCentBins(Int_t n) { fNcentBins = n ; }
75 void SetNeedEmcalGeom(Bool_t n) { fNeedEmcalGeom = n ; }
b8aeed95 76 void SetOffTrigger(UInt_t t) { fOffTrigger = t ; }
9239b066 77 void SetTrackEtaLimits(Double_t min, Double_t max, Int_t c=0);
78 void SetTrackPhiLimits(Double_t min, Double_t max, Int_t c=0);
b8aeed95 79 void SetTrackPtCut(Double_t cut, Int_t c=0);
80 void SetTracksName(const char *n) { AddParticleContainer(n) ; }
81 void SetTrigClass(const char *n) { fTrigClass = n ; }
82 void SetTriggerTypeSel(TriggerType t) { fTriggerTypeSel = t ; }
83 void SetUseAliAnaUtils(Bool_t b) { fUseAliAnaUtils = b ; }
84 void SetVzRange(Double_t min, Double_t max) { fMinVz = min ; fMaxVz = max ; }
37a63fdf 85
2da09763 86 protected:
545659ac 87 void SetMakeGeneralHistograms(Bool_t g) { fGeneralHistograms = g ; }
b8aeed95 88 Bool_t AcceptCluster(AliVCluster *clus, Int_t c = 0) const;
89 Bool_t AcceptTrack(AliVParticle *track, Int_t c = 0) const;
90 void AddObjectToEvent(TObject *obj);
9239b066 91 AliVParticle *GetAcceptParticleFromArray(Int_t p, Int_t c=0) const;
92 AliVCluster *GetAcceptClusterFromArray(Int_t cl, Int_t c=0) const;
b8aeed95 93 TClonesArray *GetArrayFromEvent(const char *name, const char *clname=0);
94 BeamType GetBeamType();
95 TClonesArray *GetParticleArray(Int_t i=0) const;
96 TClonesArray *GetClusterArray(Int_t i=0) const;
9239b066 97 Int_t GetNParticles(Int_t i=0) const;
98 Int_t GetNClusters(Int_t i=0) const;
b8aeed95 99 AliEmcalTriggerPatchInfo *GetMainTriggerPatch();
100 TriggerType GetTriggerType();
101 Bool_t PythiaInfoFromFile(const char* currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard);
102 void UserCreateOutputObjects();
103 void UserExec(Option_t *option);
104 Bool_t UserNotify();
9239b066 105
106 // Virtual functions, to be overloaded in derived classes
107 virtual void ExecOnce();
108 virtual Bool_t FillGeneralHistograms();
d29ed625 109 virtual Bool_t IsEventSelected();
2da09763 110 virtual Bool_t RetrieveEventObjects();
9239b066 111 virtual Bool_t FillHistograms() { return kTRUE ; }
8a28ded1 112 virtual Bool_t Run() { return kTRUE ; }
2da09763 113
159802e2 114 BeamType fForceBeamType; // forced beam type
115 Bool_t fGeneralHistograms; // whether or not it should fill some general histograms
2da09763 116 Bool_t fInitialized; // whether or not the task has been already initialized
117 Bool_t fCreateHisto; // whether or not create histograms
f660c2d6 118 TString fCaloCellsName; // name of calo cell collection
00c77045 119 TString fCaloTriggersName; // name of calo triggers collection
37a63fdf 120 TString fCaloTriggerPatchInfoName; // trigger patch info array name
2ac8ca4f 121 Double_t fMinCent; // min centrality for event selection
122 Double_t fMaxCent; // max centrality for event selection
123 Double_t fMinVz; // min vertex for event selection
124 Double_t fMaxVz; // max vertex for event selection
9239b066 125 Double_t fTrackPtCut; // cut on track pt in event selection
126 Int_t fMinNTrack; // minimum nr of tracks in event with pT>fTrackPtCut
127 Bool_t fUseAliAnaUtils; // used for LHC13* data
128 AliAnalysisUtils *fAliAnalysisUtils; //! vertex selection (optional)
2ac8ca4f 129 UInt_t fOffTrigger; // offline trigger for event selection
b4339010 130 TString fTrigClass; // trigger class name for event selection
8e49a788 131 TriggerType fTriggerTypeSel; // trigger type to select based on trigger patches
2da09763 132 Int_t fNbins; // no. of pt bins
2ac8ca4f 133 Double_t fMinBinPt; // min pt in histograms
134 Double_t fMaxBinPt; // max pt in histograms
6c41fc8c 135 Double_t fMinPtTrackInEmcal; // min pt track in emcal
6f6dc2ba 136 Double_t fEventPlaneVsEmcal; // select events which have a certain event plane wrt the emcal
137 Double_t fMinEventPlane; // minimum event plane value
138 Double_t fMaxEventPlane; // maximum event plane value
a52de945 139 TString fCentEst; // name of V0 centrality estimator
8c0d179d 140 Bool_t fIsEmbedded; // trigger, embedded signal
ed0243d8 141 Bool_t fIsPythia; // trigger, if it is a PYTHIA production
142 Int_t fSelectPtHardBin; // select one pt hard bin for analysis
143 Int_t fMinMCLabel; // minimum MC label value for the tracks/clusters being considered MC particles
144 Int_t fMCLabelShift; // if MC label > fMCLabelShift, MC label -= fMCLabelShift
6cb302d0 145 Int_t fNcentBins; // how many centrality bins
78a69392 146 Bool_t fNeedEmcalGeom; // whether or not the task need the emcal geometry
159802e2 147 AliEMCALGeometry *fGeom; //!emcal geometry
2da09763 148 TClonesArray *fTracks; //!tracks
149 TClonesArray *fCaloClusters; //!clusters
f660c2d6 150 AliVCaloCells *fCaloCells; //!cells
00c77045 151 AliVCaloTrigger *fCaloTriggers; //!calo triggers
37a63fdf 152 TClonesArray *fTriggerPatchInfo; //!trigger patch info array
2ac8ca4f 153 Double_t fCent; //!event centrality
2da09763 154 Int_t fCentBin; //!event centrality bin
2ac8ca4f 155 Double_t fEPV0; //!event plane V0
156 Double_t fEPV0A; //!event plane V0A
157 Double_t fEPV0C; //!event plane V0C
2da09763 158 Double_t fVertex[3]; //!event vertex
b4339010 159 Int_t fNVertCont; //!event vertex number of contributors
1f6fff78 160 BeamType fBeamType; //!event beam type
ed0243d8 161 AliGenPythiaEventHeader *fPythiaHeader; //!event Pythia header
162 Double_t fPtHard; //!event pt hard
163 Int_t fPtHardBin; //!event pt hard bin
164 Int_t fNTrials; //!event trials
8c34a1cc 165 Float_t fXsection; //!x-section from pythia header
9239b066 166 TObjArray fParticleCollArray; // particle/track collection array
167 TObjArray fClusterCollArray; // cluster collection array
37a63fdf 168 AliEmcalTriggerPatchInfo *fMainTriggerPatch; // main trigger patch, will be cached after calling GetMainTriggerPatch() first time
8e49a788 169 TriggerType fTriggerType; // trigger type J1 or J2
6da81bde 170
2da09763 171 TList *fOutput; //!output list
ed0243d8 172 TH1 *fHistTrialsAfterSel; //!total number of trials per pt hard bin after selection
173 TH1 *fHistEventsAfterSel; //!total number of events per pt hard bin after selection
6da81bde 174 TProfile *fHistXsectionAfterSel; //!x section from pythia header
ed0243d8 175 TH1 *fHistTrials; //!trials from pyxsec.root
ed0243d8 176 TH1 *fHistEvents; //!total number of events per pt hard bin
6da81bde 177 TProfile *fHistXsection; //!x section from pyxsec.root
ed0243d8 178 TH1 *fHistPtHard; //!pt hard distribution
9239b066 179 TH1 *fHistCentrality; //!event centrality distribution
180 TH1 *fHistZVertex; //!z vertex position
181 TH1 *fHistEventPlane; //!event plane distribution
8e49a788 182 TH1 *fHistEventRejection; //!book keep reasons for rejecting event
159802e2 183
2da09763 184 private:
185 AliAnalysisTaskEmcal(const AliAnalysisTaskEmcal&); // not implemented
186 AliAnalysisTaskEmcal &operator=(const AliAnalysisTaskEmcal&); // not implemented
187
8c34a1cc 188 ClassDef(AliAnalysisTaskEmcal, 8) // EMCAL base analysis task
2da09763 189};
190#endif