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