AliPhysics  29d4213 (29d4213)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliAnalysisTaskEmcal.h
Go to the documentation of this file.
1 #ifndef ALIANALYSISTASKEMCAL_H
2 #define ALIANALYSISTASKEMCAL_H
3 
4 class TClonesArray;
5 class TString;
6 class TList;
7 class AliEmcalParticle;
8 class AliMCParticle;
9 class AliVCluster;
10 class AliVTrack;
11 class AliVParticle;
12 class AliVCaloCells;
13 class TH1;
14 class TProfile;
15 class AliEMCALGeometry;
18 class AliGenPythiaEventHeader;
19 class AliVCaloTrigger;
20 class AliAnalysisUtils;
21 class AliEmcalTriggerPatchInfo;
22 
23 #include "Rtypes.h"
24 
25 #include "AliAnalysisTaskSE.h"
26 
27 class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
28  public:
29 
30  enum BeamType {
31  kNA = -1,
32  kpp = 0,
33  kAA = 1,
34  kpA = 2
35  };
36 
37  enum TriggerType {
38  kND = -1,
39  kJ1 = 0,
40  kJ2 = 1,
41  kG1 = 2,
42  kG2 = 3,
43  kL0 = 4
44  };
45 
46  enum TriggerCategory { // Online trigger categories
50  kTriggerRecalcJet = 3, // Recalculated max trigger patch; does not need to be above trigger threshold
52  };
53 
55  AliAnalysisTaskEmcal(const char *name, Bool_t histo=kFALSE);
56  virtual ~AliAnalysisTaskEmcal();
57 
61  AliClusterContainer *GetClusterContainer(Int_t i=0) const;
62  AliParticleContainer *GetParticleContainer(const char* name) const;
63  AliClusterContainer *GetClusterContainer(const char* name) const;
64  void RemoveParticleContainer(Int_t i=0) { fParticleCollArray.RemoveAt(i) ; }
65  void RemoveClusterContainer(Int_t i=0) { fClusterCollArray.RemoveAt(i) ; }
66  void SetCaloCellsName(const char *n) { fCaloCellsName = n ; }
68  void SetCaloTriggersName(const char *n) { fCaloTriggersName = n ; }
69  void SetCentRange(Double_t min, Double_t max) { fMinCent = min ; fMaxCent = max ; }
70  void SetCentralityEstimator(const char *c) { fCentEst = c ; }
71  void SetClusName(const char *n) { AddClusterContainer(n) ; }
72  void SetClusPtCut(Double_t cut, Int_t c=0);
73  void SetClusTimeCut(Double_t min, Double_t max, Int_t c=0);
74  void SetEventPlaneVsEmcal(Double_t ep) { fEventPlaneVsEmcal = ep ; }
76  void SetHistoBins(Int_t nbins, Double_t min, Double_t max) { fNbins = nbins; fMinBinPt = min; fMaxBinPt = max ; }
77  void SetIsEmbedded(Bool_t i) { fIsEmbedded = i ; }
78  void SetIsPythia(Bool_t i) { fIsPythia = i ; }
80  void SetMCLabelShift(Int_t s) { fMCLabelShift = s ; }
81  void SetMinMCLabel(Int_t s) { fMinMCLabel = s ; }
82  void SetMinNTrack(Int_t min) { fMinNTrack = min ; }
83  void SetMinPtTrackInEmcal(Double_t min) { fMinPtTrackInEmcal = min ; }
84  void SetNCentBins(Int_t n) { fNcentBins = n ; }
85  void SetNeedEmcalGeom(Bool_t n) { fNeedEmcalGeom = n ; }
86  void SetOffTrigger(UInt_t t) { fOffTrigger = t ; }
87  void SetTrackEtaLimits(Double_t min, Double_t max, Int_t c=0);
88  void SetTrackPhiLimits(Double_t min, Double_t max, Int_t c=0);
89  void SetTrackPtCut(Double_t cut, Int_t c=0);
90  void SetTracksName(const char *n) { AddParticleContainer(n) ; }
91  void SetTrigClass(const char *n) { fTrigClass = n ; }
93  void SetUseAliAnaUtils(Bool_t b, Bool_t bRejPilup = kTRUE) { fUseAliAnaUtils = b ; fRejectPileup = bRejPilup ; }
94  void SetVzRange(Double_t min, Double_t max) { fMinVz = min ; fMaxVz = max ; }
96 
97  protected:
98  void SetRejectionReasonLabels(TAxis* axis);
99  Bool_t AcceptCluster(AliVCluster *clus, Int_t c = 0) const;
100  Bool_t AcceptTrack(AliVParticle *track, Int_t c = 0) const;
101  void AddObjectToEvent(TObject *obj);
102  AliVParticle *GetAcceptParticleFromArray(Int_t p, Int_t c=0) const;
103  AliVCluster *GetAcceptClusterFromArray(Int_t cl, Int_t c=0) const;
104  TClonesArray *GetArrayFromEvent(const char *name, const char *clname=0);
106  TClonesArray *GetParticleArray(Int_t i=0) const;
107  TClonesArray *GetClusterArray(Int_t i=0) const;
108  Int_t GetNParticles(Int_t i=0) const;
109  Int_t GetNClusters(Int_t i=0) const;
110  AliEmcalTriggerPatchInfo *GetMainTriggerPatch(TriggerCategory triggersel = kTriggerLevel1Jet, Bool_t doOfflinSimple = kFALSE);
111  Bool_t HasTriggerType(TriggerType triggersel);
112  ULong_t GetTriggerList();
113  Bool_t PythiaInfoFromFile(const char* currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard);
114 
115  // Overloaded AliAnalysisTaskSE methods
117  void UserExec(Option_t *option);
118  Bool_t UserNotify();
119 
120  // Virtual functions, to be overloaded in derived classes
121  virtual void ExecOnce();
122  virtual Bool_t FillGeneralHistograms();
123  virtual Bool_t IsEventSelected();
124  virtual Bool_t RetrieveEventObjects();
125  virtual Bool_t FillHistograms() { return kTRUE ; }
126  virtual Bool_t Run() { return kTRUE ; }
127 
128  // Static utilities
129  static Double_t DeltaPhi(Double_t phia, Double_t phib, Double_t rMin = -TMath::Pi()/2, Double_t rMax = 3*TMath::Pi()/2);
130  static Double_t* GenerateFixedBinArray(Int_t n, Double_t min, Double_t max);
131  static void GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array);
132  static Double_t GetParallelFraction(AliVParticle* part1, AliVParticle* part2);
133  static Double_t GetParallelFraction(const TVector3& vect1, AliVParticle* part2);
134 
135  // Task configuration
136  BeamType fForceBeamType; // forced beam type
137  Bool_t fGeneralHistograms; // whether or not it should fill some general histograms
138  Bool_t fInitialized; // whether or not the task has been already initialized
139  Bool_t fCreateHisto; // whether or not create histograms
140  TString fCaloCellsName; // name of calo cell collection
141  TString fCaloTriggersName; // name of calo triggers collection
142  TString fCaloTriggerPatchInfoName; // trigger patch info array name
143  Double_t fMinCent; // min centrality for event selection
144  Double_t fMaxCent; // max centrality for event selection
145  Double_t fMinVz; // min vertex for event selection
146  Double_t fMaxVz; // max vertex for event selection
147  Double_t fTrackPtCut; // cut on track pt in event selection
148  Int_t fMinNTrack; // minimum nr of tracks in event with pT>fTrackPtCut
149  Bool_t fUseAliAnaUtils; // used for LHC13* data: z-vtx, Ncontributors, z-vtx resolution cuts
150  Bool_t fRejectPileup; // Reject pilup using function AliAnalysisUtils::IsPileUpEvent()
151  Bool_t fTklVsClusSPDCut; // Apply tracklet-vs-cluster SPD cut to reject background events in pp
152  UInt_t fOffTrigger; // offline trigger for event selection
153  TString fTrigClass; // trigger class name for event selection
154  TriggerType fTriggerTypeSel; // trigger type to select based on trigger patches
155  Int_t fNbins; // no. of pt bins
156  Double_t fMinBinPt; // min pt in histograms
157  Double_t fMaxBinPt; // max pt in histograms
158  Double_t fMinPtTrackInEmcal; // min pt track in emcal
159  Double_t fEventPlaneVsEmcal; // select events which have a certain event plane wrt the emcal
160  Double_t fMinEventPlane; // minimum event plane value
161  Double_t fMaxEventPlane; // maximum event plane value
162  TString fCentEst; // name of V0 centrality estimator
163  Bool_t fIsEmbedded; // trigger, embedded signal
164  Bool_t fIsPythia; // trigger, if it is a PYTHIA production
165  Int_t fSelectPtHardBin; // select one pt hard bin for analysis
166  Int_t fMinMCLabel; // minimum MC label value for the tracks/clusters being considered MC particles
167  Int_t fMCLabelShift; // if MC label > fMCLabelShift, MC label -= fMCLabelShift
168  Int_t fNcentBins; // how many centrality bins
169  Bool_t fNeedEmcalGeom; // whether or not the task needs the emcal geometry
170  TObjArray fParticleCollArray; // particle/track collection array
171  TObjArray fClusterCollArray; // cluster collection array
172  ULong_t fTriggers; // list of fired triggers
173 
174  // Service fields
175  AliAnalysisUtils *fAliAnalysisUtils;
176  Bool_t fIsEsd;
177  AliEMCALGeometry *fGeom;
178  TClonesArray *fTracks;
179  TClonesArray *fCaloClusters;
180  AliVCaloCells *fCaloCells;
181  AliVCaloTrigger *fCaloTriggers;
182  TClonesArray *fTriggerPatchInfo;
183  Double_t fCent;
184  Int_t fCentBin;
185  Double_t fEPV0;
186  Double_t fEPV0A;
187  Double_t fEPV0C;
188  Double_t fVertex[3];
189  Int_t fNVertCont;
191  AliGenPythiaEventHeader *fPythiaHeader;
192  Double_t fPtHard;
193  Int_t fPtHardBin;
194  Int_t fNTrials;
195  Float_t fXsection;
196  TList *fOutput;
201  TH1 *fHistTrials;
202  TH1 *fHistEvents;
203  TProfile *fHistXsection;
204  TH1 *fHistPtHard;
209 
210  private:
211  AliAnalysisTaskEmcal(const AliAnalysisTaskEmcal&); // not implemented
212  AliAnalysisTaskEmcal &operator=(const AliAnalysisTaskEmcal&); // not implemented
213 
214  ClassDef(AliAnalysisTaskEmcal, 12) // EMCAL base analysis task
215 };
216 
217 //________________________________________________________________________
218 inline Double_t AliAnalysisTaskEmcal::DeltaPhi(Double_t phia, Double_t phib, Double_t rangeMin, Double_t rangeMax)
219 {
220  // Calculate Delta Phi.
221 
222  Double_t dphi = -999;
223  const Double_t tpi = TMath::TwoPi();
224 
225  if (phia < 0) phia += tpi;
226  else if (phia > tpi) phia -= tpi;
227  if (phib < 0) phib += tpi;
228  else if (phib > tpi) phib -= tpi;
229  dphi = phib - phia;
230  if (dphi < rangeMin) dphi += tpi;
231  else if (dphi > rangeMax) dphi -= tpi;
232 
233  return dphi;
234 }
235 
236 //________________________________________________________________________
237 inline void AliAnalysisTaskEmcal::GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array)
238 {
239  Double_t binWidth = (max-min)/n;
240  array[0] = min;
241  for (Int_t i = 1; i <= n; i++) {
242  array[i] = array[i-1]+binWidth;
243  }
244 }
245 
246 //________________________________________________________________________
247 inline Double_t* AliAnalysisTaskEmcal::GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
248 {
249  Double_t *array = new Double_t[n+1];
250  GenerateFixedBinArray(n, min, max, array);
251  return array;
252 }
253 
254 #endif
void SetCentRange(Double_t min, Double_t max)
TH1 * fHistTrials
x section from pythia header
static Double_t DeltaPhi(Double_t phia, Double_t phib, Double_t rMin=-TMath::Pi()/2, Double_t rMax=3 *TMath::Pi()/2)
Bool_t AcceptTrack(AliVParticle *track, Int_t c=0) const
Bool_t HasTriggerType(TriggerType triggersel)
Int_t fNTrials
event pt hard bin
void SetMinNTrack(Int_t min)
void SetUseAliAnaUtils(Bool_t b, Bool_t bRejPilup=kTRUE)
AliEmcalTriggerPatchInfo * GetMainTriggerPatch(TriggerCategory triggersel=kTriggerLevel1Jet, Bool_t doOfflinSimple=kFALSE)
void SetUseSPDTrackletVsClusterBG(Bool_t b)
Double_t fPtHard
event Pythia header
void SetTrackPtCut(Double_t cut, Int_t c=0)
Double_t fEPV0
event centrality bin
Bool_t AcceptCluster(AliVCluster *clus, Int_t c=0) const
AliAnalysisTaskEmcal & operator=(const AliAnalysisTaskEmcal &)
void AddObjectToEvent(TObject *obj)
Int_t fCentBin
event centrality
TH1 * fHistEventsAfterSel
total number of trials per pt hard bin after selection
void SetTriggerTypeSel(TriggerType t)
void SetVzRange(Double_t min, Double_t max)
TH1 * fHistEventPlane
z vertex position
TList * fOutput
x-section from pythia header
void SetTracksName(const char *n)
TH1 * fHistEvents
trials from pyxsec.root
void SetClusPtCut(Double_t cut, Int_t c=0)
AliClusterContainer * AddClusterContainer(const char *n)
Double_t fEPV0C
event plane V0A
TH1 * fHistCentrality
pt hard distribution
void SetCaloTriggerPatchInfoName(const char *n)
void SetTrackEtaLimits(Double_t min, Double_t max, Int_t c=0)
AliParticleContainer * GetParticleContainer(Int_t i=0) const
TProfile * fHistXsectionAfterSel
total number of events per pt hard bin after selection
virtual Bool_t FillHistograms()
void SetForceBeamType(BeamType f)
Int_t GetNParticles(Int_t i=0) const
TClonesArray * fCaloClusters
tracks
AliEMCALGeometry * fGeom
whether it's an ESD analysis
AliGenPythiaEventHeader * fPythiaHeader
event beam type
void SetTrackPhiLimits(Double_t min, Double_t max, Int_t c=0)
AliParticleContainer * AddParticleContainer(const char *n)
AliAnalysisUtils * fAliAnalysisUtils
AliClusterContainer * GetClusterContainer(Int_t i=0) const
virtual Bool_t FillGeneralHistograms()
TClonesArray * GetParticleArray(Int_t i=0) const
BeamType fBeamType
event vertex number of contributors
Double_t fCent
trigger patch info array
Int_t GetNClusters(Int_t i=0) const
Int_t fNVertCont
event vertex
void SetClusName(const char *n)
void RemoveClusterContainer(Int_t i=0)
static Double_t GetParallelFraction(AliVParticle *part1, AliVParticle *part2)
virtual Bool_t RetrieveEventObjects()
void RemoveParticleContainer(Int_t i=0)
TProfile * fHistXsection
total number of events per pt hard bin
Bool_t PythiaInfoFromFile(const char *currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard)
void UserExec(Option_t *option)
AliVCaloCells * fCaloCells
clusters
void SetTrigClass(const char *n)
void SetIsEmbedded(Bool_t i)
TClonesArray * GetArrayFromEvent(const char *name, const char *clname=0)
virtual Bool_t IsEventSelected()
TH1 * fHistPtHard
x section from pyxsec.root
static Double_t * GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
Int_t fPtHardBin
event pt hard
void SetHistoBins(Int_t nbins, Double_t min, Double_t max)
TClonesArray * fTracks
emcal geometry
TH1 * fHistTrialsAfterSel
incoming and selected events
Bool_t fIsEsd
vertex selection (optional)
Double_t fVertex[3]
event plane V0C
TH1 * fHistEventRejection
event plane distribution
void SetMakeGeneralHistograms(Bool_t g)
TClonesArray * fTriggerPatchInfo
calo triggers
TClonesArray * GetClusterArray(Int_t i=0) const
void SetNeedEmcalGeom(Bool_t n)
Double_t fEPV0A
event plane V0
void SetEventPlaneVsEmcal(Double_t ep)
void SetCaloTriggersName(const char *n)
AliVCaloTrigger * fCaloTriggers
cells
void SetRejectionReasonLabels(TAxis *axis)
TH1 * fHistZVertex
event centrality distribution
const Int_t nbins
void SetClusTimeCut(Double_t min, Double_t max, Int_t c=0)
Float_t fXsection
event trials
void SetCaloCellsName(const char *n)
void SetCentralityEstimator(const char *c)
TH1 * fHistEventCount
output list
void SetMinPtTrackInEmcal(Double_t min)
AliVParticle * GetAcceptParticleFromArray(Int_t p, Int_t c=0) const
AliVCluster * GetAcceptClusterFromArray(Int_t cl, Int_t c=0) const
void SetOffTrigger(UInt_t t)