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