AliPhysics  9fe175b (9fe175b)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcal.h
Go to the documentation of this file.
1 #ifndef ALIANALYSISTASKEMCAL_H
2 #define ALIANALYSISTASKEMCAL_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice */
5 
6 class TClonesArray;
7 class TString;
8 class AliEmcalParticle;
9 class AliMCParticle;
10 class AliVCluster;
11 class AliVTrack;
12 class AliVParticle;
13 class AliVCaloCells;
14 class TH1;
15 class TProfile;
16 class AliEMCALGeometry;
17 class AliGenPythiaEventHeader;
18 class AliVCaloTrigger;
19 class AliAnalysisUtils;
20 class AliEMCALTriggerPatchInfo;
21 class AliAODTrack;
22 class AliEmcalPythiaInfo;
23 
24 #include "Rtypes.h"
25 
26 #include "AliParticleContainer.h"
27 #include "AliMCParticleContainer.h"
28 #include "AliTrackContainer.h"
29 #include "AliClusterContainer.h"
30 #include "AliEmcalList.h"
31 
32 #include "AliAnalysisTaskSE.h"
66 class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
67  public:
68 
73  enum BeamType {
74  kNA = -1,
75  kpp = 0,
76  kAA = 1,
77  kpA = 2
78  };
79 
84  enum TriggerType {
85  kND = -1,
86  kJ1 = 0,
87  kJ2 = 1,
88  kG1 = 2,
89  kG2 = 3,
90  kL0 = 4
91  };
92 
103  };
104 
112  };
113 
115  AliAnalysisTaskEmcal(const char *name, Bool_t histo=kFALSE);
116  virtual ~AliAnalysisTaskEmcal();
117 
119  AliTrackContainer *AddTrackContainer(const char *n);
126  AliParticleContainer *GetParticleContainer(Int_t i=0) const;
127  AliParticleContainer *GetParticleContainer(const char* name) const;
128  AliClusterContainer *GetClusterContainer(Int_t i=0) const;
129  AliClusterContainer *GetClusterContainer(const char* name) const;
131  AliMCParticleContainer *GetMCParticleContainer(const char* name) const { return dynamic_cast<AliMCParticleContainer*>(GetParticleContainer(name)); }
132  AliTrackContainer *GetTrackContainer(Int_t i=0) const { return dynamic_cast<AliTrackContainer*>(GetParticleContainer(i)) ; }
133  AliTrackContainer *GetTrackContainer(const char* name) const { return dynamic_cast<AliTrackContainer*>(GetParticleContainer(name)) ; }
134  void RemoveParticleContainer(Int_t i=0) { fParticleCollArray.RemoveAt(i) ; }
135  void RemoveClusterContainer(Int_t i=0) { fClusterCollArray.RemoveAt(i) ; }
136  void SetCaloCellsName(const char *n) { fCaloCellsName = n ; }
138  void SetCaloTriggersName(const char *n) { fCaloTriggersName = n ; }
139  void SetCentRange(Double_t min, Double_t max) { fMinCent = min ; fMaxCent = max ; }
140  void SetCentralityEstimator(const char *c) { fCentEst = c ; }
141  void SetClusPtCut(Double_t cut, Int_t c=0);
142  void SetClusTimeCut(Double_t min, Double_t max, Int_t c=0);
143  void SetEventPlaneVsEmcal(Double_t ep) { fEventPlaneVsEmcal = ep ; }
145  void SetHistoBins(Int_t nbins, Double_t min, Double_t max) { fNbins = nbins; fMinBinPt = min; fMaxBinPt = max ; }
146  void SetIsEmbedded(Bool_t i) { fIsEmbedded = i ; }
147  void SetIsPythia(Bool_t i) { fIsPythia = i ; }
149  void SetMCLabelShift(Int_t s) { fMCLabelShift = s ; }
150  void SetMinMCLabel(Int_t s) { fMinMCLabel = s ; }
151  void SetMinNTrack(Int_t min) { fMinNTrack = min ; }
152  void SetZvertexDiffValue(Double_t cut) { fZvertexDiff = cut ; }
153  void SetMinPtTrackInEmcal(Double_t min) { fMinPtTrackInEmcal = min ; }
154  virtual void SetNCentBins(Int_t n) { fNcentBins = n ; }
155  void SetNeedEmcalGeom(Bool_t n) { fNeedEmcalGeom = n ; }
156  void SetOffTrigger(UInt_t t) { fOffTrigger = t ; }
157  void SetTrackEtaLimits(Double_t min, Double_t max, Int_t c=0);
158  void SetTrackPhiLimits(Double_t min, Double_t max, Int_t c=0);
159  void SetTrackPtCut(Double_t cut, Int_t c=0);
160  void SetTrigClass(const char *n) { fTrigClass = n ; }
162  void SetUseAliAnaUtils(Bool_t b, Bool_t bRejPilup = kTRUE) { fUseAliAnaUtils = b ; fRejectPileup = bRejPilup ; }
163  void SetVzRange(Double_t min, Double_t max) { fMinVz = min ; fMaxVz = max ; }
168  void SetPythiaInfoName(const char *n) { fPythiaInfoName = n ; }
169  const TString& GetPythiaInfoName() const { return fPythiaInfoName ; }
170  const AliEmcalPythiaInfo *GetPythiaInfo() const { return fPythiaInfo ; }
172  void SetMCFilter() { fMCRejectFilter = kTRUE ; }
173  void ResetMCFilter() { fMCRejectFilter = kFALSE ; }
174  void SetJetPtFactor(Float_t f) { fPtHardAndJetPtFactor = f ; }
175  Float_t JetPtFactor() { return fPtHardAndJetPtFactor ; }
178  void SetTrackPtFactor(Float_t f) { fPtHardAndTrackPtFactor = f ; }
179  Float_t TrackPtFactor() { return fPtHardAndTrackPtFactor ; }
180 
181  protected:
182  void LoadPythiaInfo(AliVEvent *event);
183  void SetRejectionReasonLabels(TAxis* axis);
184  Bool_t AcceptCluster(AliVCluster *clus, Int_t c = 0) const;
185  Bool_t AcceptTrack(AliVParticle *track, Int_t c = 0) const;
186  void AddObjectToEvent(TObject *obj, Bool_t attempt = kFALSE);
187  AliVParticle *GetAcceptParticleFromArray(Int_t p, Int_t c=0) const;
188  AliVCluster *GetAcceptClusterFromArray(Int_t cl, Int_t c=0) const;
189  TClonesArray *GetArrayFromEvent(const char *name, const char *clname=0);
191  TClonesArray *GetParticleArray(Int_t i=0) const;
192  TClonesArray *GetClusterArray(Int_t i=0) const;
193  Int_t GetNParticles(Int_t i=0) const;
194  Int_t GetNClusters(Int_t i=0) const;
195  AliEMCALTriggerPatchInfo *GetMainTriggerPatch(TriggerCategory triggersel = kTriggerLevel1Jet, Bool_t doOfflinSimple = kFALSE);
196  Bool_t HasTriggerType(TriggerType triggersel);
197  ULong_t GetTriggerList();
198  Bool_t PythiaInfoFromFile(const char* currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard);
199  Bool_t IsTrackInEmcalAcceptance(AliVParticle* part, Double_t edges=0.9) const;
200 
201  void GeneratePythiaInfoObject(AliMCEvent* mcEvent);
202  Bool_t CheckMCOutliers();
203 
204  // Overloaded AliAnalysisTaskSE methods
206  void UserExec(Option_t *option);
207  Bool_t UserNotify();
208 
209  // Virtual functions, to be overloaded in derived classes
210  virtual void ExecOnce();
211  virtual Bool_t FillGeneralHistograms();
212  virtual Bool_t IsEventSelected();
213  virtual Bool_t RetrieveEventObjects();
219  virtual void RunChanged() {}
220 
226  virtual Bool_t FillHistograms() { return kTRUE ; }
234  virtual Bool_t Run() { return kTRUE ; }
235 
236  // Static utilities
237  static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff);
238  static Byte_t GetTrackType(const AliVTrack *t);
239  static Byte_t GetTrackType(const AliAODTrack *aodTrack, UInt_t filterBit1, UInt_t filterBit2);
240  static Double_t DeltaPhi(Double_t phia, Double_t phib, Double_t rMin = -TMath::Pi()/2, Double_t rMax = 3*TMath::Pi()/2);
241  static Double_t* GenerateFixedBinArray(Int_t n, Double_t min, Double_t max);
242  static void GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array);
243  static Double_t GetParallelFraction(AliVParticle* part1, AliVParticle* part2);
244  static Double_t GetParallelFraction(const TVector3& vect1, AliVParticle* part2);
245 
246  static Double_t fgkEMCalDCalPhiDivide;
247 
248  // Task configuration
249  TString fPythiaInfoName;
252  Bool_t fInitialized;
253  Bool_t fCreateHisto;
254  TString fCaloCellsName;
257  Double_t fMinCent;
258  Double_t fMaxCent;
259  Double_t fMinVz;
260  Double_t fMaxVz;
261  Double_t fTrackPtCut;
262  Int_t fMinNTrack;
263  Double_t fZvertexDiff;
265  Bool_t fRejectPileup;
267  UInt_t fOffTrigger;
268  TString fTrigClass;
270  Int_t fNbins;
271  Double_t fMinBinPt;
272  Double_t fMaxBinPt;
275  Double_t fMinEventPlane;
276  Double_t fMaxEventPlane;
277  TString fCentEst;
278  Bool_t fIsEmbedded;
279  Bool_t fIsPythia;
281  Int_t fMinMCLabel;
283  Int_t fNcentBins;
284  Bool_t fNeedEmcalGeom;
285  TObjArray fParticleCollArray;
286  TObjArray fClusterCollArray;
287  ULong_t fTriggers;
296 
297  // Service fields
298  Int_t fRunNumber;
299  AliAnalysisUtils *fAliAnalysisUtils;
300  Bool_t fIsEsd;
301  AliEMCALGeometry *fGeom;
302  TClonesArray *fTracks;
303  TClonesArray *fCaloClusters;
304  AliVCaloCells *fCaloCells;
305  AliVCaloTrigger *fCaloTriggers;
306  TClonesArray *fTriggerPatchInfo;
307  Double_t fCent;
308  Int_t fCentBin;
309  Double_t fEPV0;
310  Double_t fEPV0A;
311  Double_t fEPV0C;
312  Double_t fVertex[3];
313  Double_t fVertexSPD[3];
314  Int_t fNVertCont;
317  AliGenPythiaEventHeader *fPythiaHeader;
318  Double_t fPtHard;
319  Int_t fPtHardBin;
320  Int_t fNTrials;
321  Float_t fXsection;
323 
324  // Output
330  TH1 *fHistTrials;
331  TH1 *fHistEvents;
332  TProfile *fHistXsection;
333  TH1 *fHistPtHard;
339 
340  private:
341  AliAnalysisTaskEmcal(const AliAnalysisTaskEmcal&); // not implemented
342  AliAnalysisTaskEmcal &operator=(const AliAnalysisTaskEmcal&); // not implemented
343 
345  ClassDef(AliAnalysisTaskEmcal, 15) // EMCAL base analysis task
347 };
348 
357 inline Double_t AliAnalysisTaskEmcal::DeltaPhi(Double_t phia, Double_t phib, Double_t rangeMin, Double_t rangeMax)
358 {
359  Double_t dphi = -999;
360  const Double_t tpi = TMath::TwoPi();
361 
362  if (phia < 0) phia += tpi;
363  else if (phia > tpi) phia -= tpi;
364  if (phib < 0) phib += tpi;
365  else if (phib > tpi) phib -= tpi;
366  dphi = phib - phia;
367  if (dphi < rangeMin) dphi += tpi;
368  else if (dphi > rangeMax) dphi -= tpi;
369 
370  return dphi;
371 }
372 
382 inline void AliAnalysisTaskEmcal::GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array)
383 {
384  Double_t binWidth = (max-min)/n;
385  array[0] = min;
386  for (Int_t i = 1; i <= n; i++) {
387  array[i] = array[i-1]+binWidth;
388  }
389 }
390 
400 inline Double_t* AliAnalysisTaskEmcal::GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
401 {
402  Double_t *array = new Double_t[n+1];
403  GenerateFixedBinArray(n, min, max, array);
404  return array;
405 }
406 
407 #endif
void SetJetPtFactor(Float_t f)
void SetCentRange(Double_t min, Double_t max)
void SetPythiaInfoName(const char *n)
void SetTrackPtFactor(Float_t f)
Bool_t fGeneratePythiaInfoObject
Generate Pythia info object.
TObjArray fClusterCollArray
cluster collection array
Int_t fNVertSPDCont
!event SPD vertex number of contributors
AliMCParticleContainer * GetMCParticleContainer(const char *name) const
Bool_t fIsPythia
trigger, if it is a PYTHIA production
TH1 * fHistTrials
!trials from pyxsec.root
static Double_t DeltaPhi(Double_t phia, Double_t phib, Double_t rMin=-TMath::Pi()/2, Double_t rMax=3 *TMath::Pi()/2)
EMCAL Level1 gamma trigger, low threshold.
AliEmcalPythiaInfo * fPythiaInfo
!event parton info
Bool_t AcceptTrack(AliVParticle *track, Int_t c=0) const
EMCAL Level1 jet trigger, low threshold.
Bool_t HasTriggerType(TriggerType triggersel)
Int_t fNTrials
!event trials
void SetMinNTrack(Int_t min)
UInt_t fOffTrigger
offline trigger for event selection
void AdoptParticleContainer(AliParticleContainer *cont)
Double_t fVertexSPD[3]
!event Svertex
Double_t fMinCent
min centrality for event selection
Double_t fTrackPtCut
cut on track pt in event selection
No special treatment for EMCal triggers.
Recalculated jet trigger patch; does not need to be above trigger threshold.
Base task in the EMCAL framework.
Bool_t fUsePtHardBinScaling
Use pt hard bin scaling in merging.
Container with name, TClonesArray and cuts for particles.
void SetUseAliAnaUtils(Bool_t b, Bool_t bRejPilup=kTRUE)
void SetUseSPDTrackletVsClusterBG(Bool_t b)
Double_t fPtHard
!event pt hard
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 fMinBinPt
min pt in histograms
Double_t fEPV0
!event plane V0
void SetUseNewCentralityEstimation(Bool_t b)
Bool_t fGeneralHistograms
whether or not it should fill some general histograms
Bool_t AcceptCluster(AliVCluster *clus, Int_t c=0) const
AliAnalysisTaskEmcal & operator=(const AliAnalysisTaskEmcal &)
Int_t fCentBin
!event centrality bin
TH1 * fHistEventsAfterSel
!total number of events per pt hard bin after selection
void SetTriggerTypeSel(TriggerType t)
Float_t fPtHardAndClusterPtFactor
Factor between ptHard and cluster pT to reject/accept event.
Double_t fMinPtTrackInEmcal
min pt track in emcal
void SetVzRange(Double_t min, Double_t max)
TH1 * fHistEventPlane
!event plane distribution
AliTrackContainer * GetTrackContainer(const char *name) const
TH1 * fHistEvents
!total number of events per pt hard bin
void SetClusPtCut(Double_t cut, Int_t c=0)
AliClusterContainer * AddClusterContainer(const char *n)
Double_t fEPV0C
!event plane V0C
TH1 * fHistCentrality
!event centrality distribution
void SetCaloTriggerPatchInfoName(const char *n)
Container for particles within the EMCAL framework.
Bool_t fIsEmbedded
trigger, embedded signal
void AdoptClusterContainer(AliClusterContainer *cont)
TObjArray fParticleCollArray
particle/track collection array
BeamType
Switch for the beam type.
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
!x section from pythia header
TriggerType
Switch for EMCAL trigger types.
EMCalTriggerMode_t fEMCalTriggerMode
EMCal trigger selection mode.
virtual Bool_t FillHistograms()
void SetForceBeamType(BeamType f)
Int_t GetNParticles(Int_t i=0) const
TClonesArray * fCaloClusters
!clusters
Bool_t fUseNewCentralityEstimation
Use new centrality estimation (for 2015 data)
Bool_t IsTrackInEmcalAcceptance(AliVParticle *part, Double_t edges=0.9) const
TH1 * fHistTriggerClasses
!number of events in each trigger class
Double_t fMaxVz
max vertex for event selection
void GeneratePythiaInfoObject(AliMCEvent *mcEvent)
AliEMCALGeometry * fGeom
!emcal geometry
The overlap between low and high threshold trigger is assigned to the lower threshold only...
kRecalculated gamma trigger patch; does not need to be above trigger threshold
TString fCaloTriggerPatchInfoName
trigger patch info array name
TString fCaloTriggersName
name of calo triggers collection
AliGenPythiaEventHeader * fPythiaHeader
!event Pythia header
void SetTrackPhiLimits(Double_t min, Double_t max, Int_t c=0)
AliParticleContainer * AddParticleContainer(const char *n)
AliAnalysisUtils * fAliAnalysisUtils
!vertex selection (optional)
BeamType fForceBeamType
forced beam type
Int_t fNcentBins
how many centrality bins
AliClusterContainer * GetClusterContainer(Int_t i=0) const
TriggerType fTriggerTypeSel
trigger type to select based on trigger patches
virtual Bool_t FillGeneralHistograms()
TString fTrigClass
trigger class name for event selection
Float_t fPtHardAndJetPtFactor
Factor between ptHard and jet pT to reject/accept event.
TClonesArray * GetParticleArray(Int_t i=0) const
void SetUsePtHardBinScaling(Bool_t b)
Double_t fMinVz
min vertex for event selection
BeamType fBeamType
!event beam type
Float_t fPtHardAndTrackPtFactor
Factor between ptHard and track pT to reject/accept event.
Double_t fCent
!event centrality
Double_t fMinEventPlane
minimum event plane value
TString fCaloCellsName
name of calo cell collection
Int_t fMCLabelShift
if MC label > fMCLabelShift, MC label -= fMCLabelShift
Int_t GetNClusters(Int_t i=0) const
Int_t fNVertCont
!event vertex number of contributors
Bool_t fMCRejectFilter
enable the filtering of events by tail rejection
void RemoveClusterContainer(Int_t i=0)
Double_t fZvertexDiff
upper limit for distance between primary and SPD vertex
EMCAL Level0 trigger.
EMCAL Level1 jet trigger, high threshold.
void AdoptMCParticleContainer(AliMCParticleContainer *cont)
Int_t fSelectPtHardBin
select one pt hard bin for analysis
AliMCParticleContainer * AddMCParticleContainer(const char *n)
static Double_t GetParallelFraction(AliVParticle *part1, AliVParticle *part2)
virtual Bool_t RetrieveEventObjects()
Bool_t fRejectPileup
Reject pilup using function AliAnalysisUtils::IsPileUpEvent()
void RemoveParticleContainer(Int_t i=0)
TProfile * fHistXsection
!x section from pyxsec.root
Bool_t PythiaInfoFromFile(const char *currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard)
void UserExec(Option_t *option)
Int_t fMinMCLabel
minimum MC label value for the tracks/clusters being considered MC particles
virtual void SetNCentBins(Int_t n)
AliVCaloCells * fCaloCells
!cells
void SetTrigClass(const char *n)
TClonesArray * GetArrayFromEvent(const char *name, const char *clname=0)
Enhanced TList-derived class that implements correct merging for pt_hard binned production.
Definition: AliEmcalList.h:23
Double_t fEventPlaneVsEmcal
select events which have a certain event plane wrt the emcal
virtual Bool_t IsEventSelected()
TH1 * fHistPtHard
!pt hard distribution
static Double_t * GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
AliEmcalList * fOutput
!output list
void SetZvertexDiffValue(Double_t cut)
Double_t fMaxBinPt
max pt in histograms
Int_t fPtHardBin
!event pt hard bin
void SetHistoBins(Int_t nbins, Double_t min, Double_t max)
AliMCParticleContainer * GetMCParticleContainer(Int_t i=0) const
TClonesArray * fTracks
!tracks
TH1 * fHistTrialsAfterSel
!total number of trials per pt hard bin after selection
void LoadPythiaInfo(AliVEvent *event)
Bool_t fIsEsd
!whether it's an ESD analysis
Double_t fVertex[3]
!event vertex
AliTrackContainer * AddTrackContainer(const char *n)
AliTrackContainer * GetTrackContainer(Int_t i=0) const
EMCalTriggerMode_t
Handling of the EMCAL trigger thresholds.
Bool_t fCreateHisto
whether or not create histograms
Store some informaion about a Pythia eventThis class is used to store some information about a Pythia...
TH1 * fHistEventRejection
!book keep reasons for rejecting event
void SetMakeGeneralHistograms(Bool_t g)
TClonesArray * fTriggerPatchInfo
!trigger patch info array
TClonesArray * GetClusterArray(Int_t i=0) const
void SetNeedEmcalGeom(Bool_t n)
Double_t fEPV0A
!event plane V0A
void SetEventPlaneVsEmcal(Double_t ep)
void SetCaloTriggersName(const char *n)
const AliEmcalPythiaInfo * GetPythiaInfo() const
TString fCentEst
name of V0 centrality estimator
TString fPythiaInfoName
name of pythia info object
Int_t fRunNumber
!run number (triggering RunChanged()
EMCAL Level1 gamma trigger, high threshold.
void AddObjectToEvent(TObject *obj, Bool_t attempt=kFALSE)
AliVCaloTrigger * fCaloTriggers
!calo triggers
void SetRejectionReasonLabels(TAxis *axis)
TH1 * fHistZVertex
!z vertex position
Int_t fMinNTrack
minimum nr of tracks in event with pT>fTrackPtCut
static Byte_t GetTrackType(const AliVTrack *t)
void SetGeneratePythiaInfoObject(Bool_t b)
const Int_t nbins
Bool_t fUseAliAnaUtils
used for LHC13* data: z-vtx, Ncontributors, z-vtx resolution cuts
void SetClusTimeCut(Double_t min, Double_t max, Int_t c=0)
ULong_t fTriggers
list of fired triggers
Double_t fMaxEventPlane
maximum event plane value
Float_t fXsection
!x-section from pythia header
void SetCaloCellsName(const char *n)
Bool_t fInitialized
whether or not the task has been already initialized
void SetCentralityEstimator(const char *c)
TH1 * fHistEventCount
!incoming and selected events
Double_t fMaxCent
max centrality for event selection
void SetMinPtTrackInEmcal(Double_t min)
TriggerCategory
Online trigger categories.
AliVParticle * GetAcceptParticleFromArray(Int_t p, Int_t c=0) const
Container structure for EMCAL clusters.
Container for MC-true particles within the EMCAL framework.
Bool_t fNeedEmcalGeom
whether or not the task needs the emcal geometry
AliVCluster * GetAcceptClusterFromArray(Int_t cl, Int_t c=0) const
void SetClusterPtFactor(Float_t f)
const TString & GetPythiaInfoName() const
void AdoptTrackContainer(AliTrackContainer *cont)
Int_t fNbins
no. of pt bins
Bool_t fTklVsClusSPDCut
Apply tracklet-vs-cluster SPD cut to reject background events in pp.
AliEMCALTriggerPatchInfo * GetMainTriggerPatch(TriggerCategory triggersel=kTriggerLevel1Jet, Bool_t doOfflinSimple=kFALSE)
static Double_t fgkEMCalDCalPhiDivide
phi value used to distinguish between DCal and EMCal