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