AliPhysics  a0db429 (a0db429)
 All Classes Namespaces Files Functions Variables Typedefs 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 class AliAODTrack;
23 
24 #include "Rtypes.h"
25 
26 #include "AliAnalysisTaskSE.h"
27 
28 class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
29  public:
30 
31  enum BeamType {
32  kNA = -1,
33  kpp = 0,
34  kAA = 1,
35  kpA = 2
36  };
37 
38  enum TriggerType {
39  kND = -1,
40  kJ1 = 0,
41  kJ2 = 1,
42  kG1 = 2,
43  kG2 = 3,
44  kL0 = 4
45  };
46 
47  enum TriggerCategory { // Online trigger categories
51  kTriggerRecalcJet = 3, // Recalculated max trigger patch; does not need to be above trigger threshold
53  };
54 
56  kNoSpecialTreatment, // No special treatment for EMCal triggers
57  kOverlapWithLowThreshold // The overlap between low and high threshold trigger is assigned to the lower threshold only
58  };
59 
61  AliAnalysisTaskEmcal(const char *name, Bool_t histo=kFALSE);
62  virtual ~AliAnalysisTaskEmcal();
63 
67  AliClusterContainer *GetClusterContainer(Int_t i=0) const;
68  AliParticleContainer *GetParticleContainer(const char* name) const;
69  AliClusterContainer *GetClusterContainer(const char* name) const;
70  void RemoveParticleContainer(Int_t i=0) { fParticleCollArray.RemoveAt(i) ; }
71  void RemoveClusterContainer(Int_t i=0) { fClusterCollArray.RemoveAt(i) ; }
72  void SetCaloCellsName(const char *n) { fCaloCellsName = n ; }
74  void SetCaloTriggersName(const char *n) { fCaloTriggersName = n ; }
75  void SetCentRange(Double_t min, Double_t max) { fMinCent = min ; fMaxCent = max ; }
76  void SetCentralityEstimator(const char *c) { fCentEst = c ; }
77  void SetClusName(const char *n) { AddClusterContainer(n) ; }
78  void SetClusPtCut(Double_t cut, Int_t c=0);
79  void SetClusTimeCut(Double_t min, Double_t max, Int_t c=0);
80  void SetEventPlaneVsEmcal(Double_t ep) { fEventPlaneVsEmcal = ep ; }
82  void SetHistoBins(Int_t nbins, Double_t min, Double_t max) { fNbins = nbins; fMinBinPt = min; fMaxBinPt = max ; }
83  void SetIsEmbedded(Bool_t i) { fIsEmbedded = i ; }
84  void SetIsPythia(Bool_t i) { fIsPythia = i ; }
86  void SetMCLabelShift(Int_t s) { fMCLabelShift = s ; }
87  void SetMinMCLabel(Int_t s) { fMinMCLabel = s ; }
88  void SetMinNTrack(Int_t min) { fMinNTrack = min ; }
89  void SetMinPtTrackInEmcal(Double_t min) { fMinPtTrackInEmcal = min ; }
90  virtual void SetNCentBins(Int_t n) { fNcentBins = n ; }
91  void SetNeedEmcalGeom(Bool_t n) { fNeedEmcalGeom = n ; }
92  void SetOffTrigger(UInt_t t) { fOffTrigger = t ; }
93  void SetTrackEtaLimits(Double_t min, Double_t max, Int_t c=0);
94  void SetTrackPhiLimits(Double_t min, Double_t max, Int_t c=0);
95  void SetTrackPtCut(Double_t cut, Int_t c=0);
96  void SetTracksName(const char *n) { AddParticleContainer(n) ; }
97  void SetTrigClass(const char *n) { fTrigClass = n ; }
99  void SetUseAliAnaUtils(Bool_t b, Bool_t bRejPilup = kTRUE) { fUseAliAnaUtils = b ; fRejectPileup = bRejPilup ; }
100  void SetVzRange(Double_t min, Double_t max) { fMinVz = min ; fMaxVz = max ; }
104 
105  protected:
106  void SetRejectionReasonLabels(TAxis* axis);
107  Bool_t AcceptCluster(AliVCluster *clus, Int_t c = 0) const;
108  Bool_t AcceptTrack(AliVParticle *track, Int_t c = 0) const;
109  void AddObjectToEvent(TObject *obj, Bool_t attempt = kFALSE);
110  AliVParticle *GetAcceptParticleFromArray(Int_t p, Int_t c=0) const;
111  AliVCluster *GetAcceptClusterFromArray(Int_t cl, Int_t c=0) const;
112  TClonesArray *GetArrayFromEvent(const char *name, const char *clname=0);
114  TClonesArray *GetParticleArray(Int_t i=0) const;
115  TClonesArray *GetClusterArray(Int_t i=0) const;
116  Int_t GetNParticles(Int_t i=0) const;
117  Int_t GetNClusters(Int_t i=0) const;
118  AliEmcalTriggerPatchInfo *GetMainTriggerPatch(TriggerCategory triggersel = kTriggerLevel1Jet, Bool_t doOfflinSimple = kFALSE);
119  Bool_t HasTriggerType(TriggerType triggersel);
120  ULong_t GetTriggerList();
121  Bool_t PythiaInfoFromFile(const char* currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard);
122  Bool_t IsTrackInEmcalAcceptance(AliVParticle* part, Double_t edges=0.9) const;
123 
124  // Overloaded AliAnalysisTaskSE methods
126  void UserExec(Option_t *option);
127  Bool_t UserNotify();
128 
129  // Virtual functions, to be overloaded in derived classes
130  virtual void ExecOnce();
131  virtual Bool_t FillGeneralHistograms();
132  virtual Bool_t IsEventSelected();
133  virtual Bool_t RetrieveEventObjects();
134  virtual Bool_t FillHistograms() { return kTRUE ; }
135  virtual Bool_t Run() { return kTRUE ; }
136 
137  // Static utilities
138  static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff);
139  static Byte_t GetTrackType(const AliVTrack *t);
140  static Byte_t GetTrackType(const AliAODTrack *aodTrack, UInt_t filterBit1, UInt_t filterBit2);
141  static Double_t DeltaPhi(Double_t phia, Double_t phib, Double_t rMin = -TMath::Pi()/2, Double_t rMax = 3*TMath::Pi()/2);
142  static Double_t* GenerateFixedBinArray(Int_t n, Double_t min, Double_t max);
143  static void GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array);
144  static Double_t GetParallelFraction(AliVParticle* part1, AliVParticle* part2);
145  static Double_t GetParallelFraction(const TVector3& vect1, AliVParticle* part2);
146 
147  static Double_t fgkEMCalDCalPhiDivide; // phi value used to distinguish between DCal and EMCal
148 
149  // Task configuration
150  BeamType fForceBeamType; // forced beam type
151  Bool_t fGeneralHistograms; // whether or not it should fill some general histograms
152  Bool_t fInitialized; // whether or not the task has been already initialized
153  Bool_t fCreateHisto; // whether or not create histograms
154  TString fCaloCellsName; // name of calo cell collection
155  TString fCaloTriggersName; // name of calo triggers collection
156  TString fCaloTriggerPatchInfoName; // trigger patch info array name
157  Double_t fMinCent; // min centrality for event selection
158  Double_t fMaxCent; // max centrality for event selection
159  Double_t fMinVz; // min vertex for event selection
160  Double_t fMaxVz; // max vertex for event selection
161  Double_t fTrackPtCut; // cut on track pt in event selection
162  Int_t fMinNTrack; // minimum nr of tracks in event with pT>fTrackPtCut
163  Bool_t fUseAliAnaUtils; // used for LHC13* data: z-vtx, Ncontributors, z-vtx resolution cuts
164  Bool_t fRejectPileup; // Reject pilup using function AliAnalysisUtils::IsPileUpEvent()
165  Bool_t fTklVsClusSPDCut; // Apply tracklet-vs-cluster SPD cut to reject background events in pp
166  UInt_t fOffTrigger; // offline trigger for event selection
167  TString fTrigClass; // trigger class name for event selection
168  TriggerType fTriggerTypeSel; // trigger type to select based on trigger patches
169  Int_t fNbins; // no. of pt bins
170  Double_t fMinBinPt; // min pt in histograms
171  Double_t fMaxBinPt; // max pt in histograms
172  Double_t fMinPtTrackInEmcal; // min pt track in emcal
173  Double_t fEventPlaneVsEmcal; // select events which have a certain event plane wrt the emcal
174  Double_t fMinEventPlane; // minimum event plane value
175  Double_t fMaxEventPlane; // maximum event plane value
176  TString fCentEst; // name of V0 centrality estimator
177  Bool_t fIsEmbedded; // trigger, embedded signal
178  Bool_t fIsPythia; // trigger, if it is a PYTHIA production
179  Int_t fSelectPtHardBin; // select one pt hard bin for analysis
180  Int_t fMinMCLabel; // minimum MC label value for the tracks/clusters being considered MC particles
181  Int_t fMCLabelShift; // if MC label > fMCLabelShift, MC label -= fMCLabelShift
182  Int_t fNcentBins; // how many centrality bins
183  Bool_t fNeedEmcalGeom; // whether or not the task needs the emcal geometry
184  TObjArray fParticleCollArray; // particle/track collection array
185  TObjArray fClusterCollArray; // cluster collection array
186  ULong_t fTriggers; // list of fired triggers
187  EMCalTriggerMode_t fEMCalTriggerMode; // EMCal trigger selection mode
188  Bool_t fUseNewCentralityEstimation; // Use new centrality estimation (for 2015 data)
189 
190  // Service fields
191  AliAnalysisUtils *fAliAnalysisUtils;
192  Bool_t fIsEsd;
193  AliEMCALGeometry *fGeom;
194  TClonesArray *fTracks;
195  TClonesArray *fCaloClusters;
196  AliVCaloCells *fCaloCells;
197  AliVCaloTrigger *fCaloTriggers;
198  TClonesArray *fTriggerPatchInfo;
199  Double_t fCent;
200  Int_t fCentBin;
201  Double_t fEPV0;
202  Double_t fEPV0A;
203  Double_t fEPV0C;
204  Double_t fVertex[3];
205  Int_t fNVertCont;
207  AliGenPythiaEventHeader *fPythiaHeader;
208  Double_t fPtHard;
209  Int_t fPtHardBin;
210  Int_t fNTrials;
211  Float_t fXsection;
212 
213  // Output
214  TList *fOutput;
219  TH1 *fHistTrials;
220  TH1 *fHistEvents;
221  TProfile *fHistXsection;
222  TH1 *fHistPtHard;
228 
229  private:
230  AliAnalysisTaskEmcal(const AliAnalysisTaskEmcal&); // not implemented
231  AliAnalysisTaskEmcal &operator=(const AliAnalysisTaskEmcal&); // not implemented
232 
233  ClassDef(AliAnalysisTaskEmcal, 12) // EMCAL base analysis task
234 };
235 
236 //________________________________________________________________________
237 inline Double_t AliAnalysisTaskEmcal::DeltaPhi(Double_t phia, Double_t phib, Double_t rangeMin, Double_t rangeMax)
238 {
239  // Calculate Delta Phi.
240 
241  Double_t dphi = -999;
242  const Double_t tpi = TMath::TwoPi();
243 
244  if (phia < 0) phia += tpi;
245  else if (phia > tpi) phia -= tpi;
246  if (phib < 0) phib += tpi;
247  else if (phib > tpi) phib -= tpi;
248  dphi = phib - phia;
249  if (dphi < rangeMin) dphi += tpi;
250  else if (dphi > rangeMax) dphi -= tpi;
251 
252  return dphi;
253 }
254 
255 //________________________________________________________________________
256 inline void AliAnalysisTaskEmcal::GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array)
257 {
258  Double_t binWidth = (max-min)/n;
259  array[0] = min;
260  for (Int_t i = 1; i <= n; i++) {
261  array[i] = array[i-1]+binWidth;
262  }
263 }
264 
265 //________________________________________________________________________
266 inline Double_t* AliAnalysisTaskEmcal::GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
267 {
268  Double_t *array = new Double_t[n+1];
269  GenerateFixedBinArray(n, min, max, array);
270  return array;
271 }
272 
273 #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)
static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
Double_t fEPV0
event centrality bin
void SetUseNewCentralityEstimation(Bool_t b)
Bool_t AcceptCluster(AliVCluster *clus, Int_t c=0) const
AliAnalysisTaskEmcal & operator=(const AliAnalysisTaskEmcal &)
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
void SetEMCalTriggerMode(EMCalTriggerMode_t m)
TProfile * fHistXsectionAfterSel
total number of events per pt hard bin after selection
EMCalTriggerMode_t fEMCalTriggerMode
virtual Bool_t FillHistograms()
void SetForceBeamType(BeamType f)
Int_t GetNParticles(Int_t i=0) const
TClonesArray * fCaloClusters
tracks
Bool_t IsTrackInEmcalAcceptance(AliVParticle *part, Double_t edges=0.9) const
TH1 * fHistTriggerClasses
book keep reasons for rejecting event
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)
virtual void SetNCentBins(Int_t n)
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)
void AddObjectToEvent(TObject *obj, Bool_t attempt=kFALSE)
AliVCaloTrigger * fCaloTriggers
cells
void SetRejectionReasonLabels(TAxis *axis)
TH1 * fHistZVertex
event centrality distribution
static Byte_t GetTrackType(const AliVTrack *t)
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)
static Double_t fgkEMCalDCalPhiDivide