AliPhysics  eff0747 (eff0747)
 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 /* 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 TList;
9 class AliEmcalParticle;
10 class AliMCParticle;
11 class AliVCluster;
12 class AliVTrack;
13 class AliVParticle;
14 class AliVCaloCells;
15 class TH1;
16 class TProfile;
17 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 "AliParticleContainer.h"
28 #include "AliMCParticleContainer.h"
29 #include "AliTrackContainer.h"
30 #include "AliClusterContainer.h"
31 
32 #include "AliAnalysisTaskSE.h"
33 
41 class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
42  public:
43 
48  enum BeamType {
49  kNA = -1,
50  kpp = 0,
51  kAA = 1,
52  kpA = 2
53  };
54 
59  enum TriggerType {
60  kND = -1,
61  kJ1 = 0,
62  kJ2 = 1,
63  kG1 = 2,
64  kG2 = 3,
65  kL0 = 4
66  };
67 
78  };
79 
87  };
88 
90  AliAnalysisTaskEmcal(const char *name, Bool_t histo=kFALSE);
91  virtual ~AliAnalysisTaskEmcal();
92 
94  AliTrackContainer *AddTrackContainer(const char *n);
100  AliParticleContainer *GetParticleContainer(const char* name) const;
101  AliClusterContainer *GetClusterContainer(Int_t i=0) const;
102  AliClusterContainer *GetClusterContainer(const char* name) const;
104  AliMCParticleContainer *GetMCParticleContainer(const char* name) const { return dynamic_cast<AliMCParticleContainer*>(GetParticleContainer(name)); }
105  AliTrackContainer *GetTrackContainer(Int_t i=0) const { return dynamic_cast<AliTrackContainer*>(GetParticleContainer(i)) ; }
106  AliTrackContainer *GetTrackContainer(const char* name) const { return dynamic_cast<AliTrackContainer*>(GetParticleContainer(name)) ; }
107  void RemoveParticleContainer(Int_t i=0) { fParticleCollArray.RemoveAt(i) ; }
108  void RemoveClusterContainer(Int_t i=0) { fClusterCollArray.RemoveAt(i) ; }
109  void SetCaloCellsName(const char *n) { fCaloCellsName = n ; }
111  void SetCaloTriggersName(const char *n) { fCaloTriggersName = n ; }
112  void SetCentRange(Double_t min, Double_t max) { fMinCent = min ; fMaxCent = max ; }
113  void SetCentralityEstimator(const char *c) { fCentEst = c ; }
114  void SetClusName(const char *n) { AddClusterContainer(n) ; }
115  void SetClusPtCut(Double_t cut, Int_t c=0);
116  void SetClusTimeCut(Double_t min, Double_t max, Int_t c=0);
117  void SetEventPlaneVsEmcal(Double_t ep) { fEventPlaneVsEmcal = ep ; }
119  void SetHistoBins(Int_t nbins, Double_t min, Double_t max) { fNbins = nbins; fMinBinPt = min; fMaxBinPt = max ; }
120  void SetIsEmbedded(Bool_t i) { fIsEmbedded = i ; }
121  void SetIsPythia(Bool_t i) { fIsPythia = i ; }
123  void SetMCLabelShift(Int_t s) { fMCLabelShift = s ; }
124  void SetMinMCLabel(Int_t s) { fMinMCLabel = s ; }
125  void SetMinNTrack(Int_t min) { fMinNTrack = min ; }
126  void SetMinPtTrackInEmcal(Double_t min) { fMinPtTrackInEmcal = min ; }
127  virtual void SetNCentBins(Int_t n) { fNcentBins = n ; }
128  void SetNeedEmcalGeom(Bool_t n) { fNeedEmcalGeom = n ; }
129  void SetOffTrigger(UInt_t t) { fOffTrigger = t ; }
130  void SetTrackEtaLimits(Double_t min, Double_t max, Int_t c=0);
131  void SetTrackPhiLimits(Double_t min, Double_t max, Int_t c=0);
132  void SetTrackPtCut(Double_t cut, Int_t c=0);
133  void SetTracksName(const char *n) { AddParticleContainer(n) ; }
134  void SetTrigClass(const char *n) { fTrigClass = n ; }
136  void SetUseAliAnaUtils(Bool_t b, Bool_t bRejPilup = kTRUE) { fUseAliAnaUtils = b ; fRejectPileup = bRejPilup ; }
137  void SetVzRange(Double_t min, Double_t max) { fMinVz = min ; fMaxVz = max ; }
142  void SetPythiaInfoName(const char *n) { fPythiaInfoName = n ; }
143  const TString& GetPythiaInfoName() const { return fPythiaInfoName ; }
144  const AliEmcalPythiaInfo *GetPythiaInfo() const { return fPythiaInfo ; }
145 
146  protected:
147  void LoadPythiaInfo(AliVEvent *event);
148  void SetRejectionReasonLabels(TAxis* axis);
149  Bool_t AcceptCluster(AliVCluster *clus, Int_t c = 0) const;
150  Bool_t AcceptTrack(AliVParticle *track, Int_t c = 0) const;
151  void AddObjectToEvent(TObject *obj, Bool_t attempt = kFALSE);
152  AliVParticle *GetAcceptParticleFromArray(Int_t p, Int_t c=0) const;
153  AliVCluster *GetAcceptClusterFromArray(Int_t cl, Int_t c=0) const;
154  TClonesArray *GetArrayFromEvent(const char *name, const char *clname=0);
156  TClonesArray *GetParticleArray(Int_t i=0) const;
157  TClonesArray *GetClusterArray(Int_t i=0) const;
158  Int_t GetNParticles(Int_t i=0) const;
159  Int_t GetNClusters(Int_t i=0) const;
160  AliEMCALTriggerPatchInfo *GetMainTriggerPatch(TriggerCategory triggersel = kTriggerLevel1Jet, Bool_t doOfflinSimple = kFALSE);
161  Bool_t HasTriggerType(TriggerType triggersel);
162  ULong_t GetTriggerList();
163  Bool_t PythiaInfoFromFile(const char* currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard);
164  Bool_t IsTrackInEmcalAcceptance(AliVParticle* part, Double_t edges=0.9) const;
165 
166  void GeneratePythiaInfoObject(AliMCEvent* mcEvent);
167 
168  // Overloaded AliAnalysisTaskSE methods
170  void UserExec(Option_t *option);
171  Bool_t UserNotify();
172 
173  // Virtual functions, to be overloaded in derived classes
174  virtual void ExecOnce();
175  virtual Bool_t FillGeneralHistograms();
176  virtual Bool_t IsEventSelected();
177  virtual Bool_t RetrieveEventObjects();
178  virtual Bool_t FillHistograms() { return kTRUE ; }
179  virtual Bool_t Run() { return kTRUE ; }
180 
181  // Static utilities
182  static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff);
183  static Byte_t GetTrackType(const AliVTrack *t);
184  static Byte_t GetTrackType(const AliAODTrack *aodTrack, UInt_t filterBit1, UInt_t filterBit2);
185  static Double_t DeltaPhi(Double_t phia, Double_t phib, Double_t rMin = -TMath::Pi()/2, Double_t rMax = 3*TMath::Pi()/2);
186  static Double_t* GenerateFixedBinArray(Int_t n, Double_t min, Double_t max);
187  static void GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array);
188  static Double_t GetParallelFraction(AliVParticle* part1, AliVParticle* part2);
189  static Double_t GetParallelFraction(const TVector3& vect1, AliVParticle* part2);
190 
191  static Double_t fgkEMCalDCalPhiDivide;
192 
193  // Task configuration
194  TString fPythiaInfoName;
197  Bool_t fInitialized;
198  Bool_t fCreateHisto;
199  TString fCaloCellsName;
202  Double_t fMinCent;
203  Double_t fMaxCent;
204  Double_t fMinVz;
205  Double_t fMaxVz;
206  Double_t fTrackPtCut;
207  Int_t fMinNTrack;
209  Bool_t fRejectPileup;
211  UInt_t fOffTrigger;
212  TString fTrigClass;
214  Int_t fNbins;
215  Double_t fMinBinPt;
216  Double_t fMaxBinPt;
219  Double_t fMinEventPlane;
220  Double_t fMaxEventPlane;
221  TString fCentEst;
222  Bool_t fIsEmbedded;
223  Bool_t fIsPythia;
225  Int_t fMinMCLabel;
227  Int_t fNcentBins;
228  Bool_t fNeedEmcalGeom;
229  TObjArray fParticleCollArray;
230  TObjArray fClusterCollArray;
231  ULong_t fTriggers;
235 
236  // Service fields
237  AliAnalysisUtils *fAliAnalysisUtils;
238  Bool_t fIsEsd;
239  AliEMCALGeometry *fGeom;
240  TClonesArray *fTracks;
241  TClonesArray *fCaloClusters;
242  AliVCaloCells *fCaloCells;
243  AliVCaloTrigger *fCaloTriggers;
244  TClonesArray *fTriggerPatchInfo;
245  Double_t fCent;
246  Int_t fCentBin;
247  Double_t fEPV0;
248  Double_t fEPV0A;
249  Double_t fEPV0C;
250  Double_t fVertex[3];
251  Int_t fNVertCont;
253  AliGenPythiaEventHeader *fPythiaHeader;
254  Double_t fPtHard;
255  Int_t fPtHardBin;
256  Int_t fNTrials;
257  Float_t fXsection;
259 
260  // Output
261  TList *fOutput;
266  TH1 *fHistTrials;
267  TH1 *fHistEvents;
268  TProfile *fHistXsection;
269  TH1 *fHistPtHard;
275 
276  private:
277  AliAnalysisTaskEmcal(const AliAnalysisTaskEmcal&); // not implemented
278  AliAnalysisTaskEmcal &operator=(const AliAnalysisTaskEmcal&); // not implemented
279 
281  ClassDef(AliAnalysisTaskEmcal, 14) // EMCAL base analysis task
283 };
284 
293 inline Double_t AliAnalysisTaskEmcal::DeltaPhi(Double_t phia, Double_t phib, Double_t rangeMin, Double_t rangeMax)
294 {
295  Double_t dphi = -999;
296  const Double_t tpi = TMath::TwoPi();
297 
298  if (phia < 0) phia += tpi;
299  else if (phia > tpi) phia -= tpi;
300  if (phib < 0) phib += tpi;
301  else if (phib > tpi) phib -= tpi;
302  dphi = phib - phia;
303  if (dphi < rangeMin) dphi += tpi;
304  else if (dphi > rangeMax) dphi -= tpi;
305 
306  return dphi;
307 }
308 
318 inline void AliAnalysisTaskEmcal::GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array)
319 {
320  Double_t binWidth = (max-min)/n;
321  array[0] = min;
322  for (Int_t i = 1; i <= n; i++) {
323  array[i] = array[i-1]+binWidth;
324  }
325 }
326 
336 inline Double_t* AliAnalysisTaskEmcal::GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
337 {
338  Double_t *array = new Double_t[n+1];
339  GenerateFixedBinArray(n, min, max, array);
340  return array;
341 }
342 
343 #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)
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
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
No special treatment for EMCal triggers.
Recalculated jet trigger patch; does not need to be above trigger threshold.
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
TriggerType
Switch for EMCAL trigger types.
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
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
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)
EMCAL Level0 trigger.
EMCAL Level1 jet trigger, high threshold.
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
EMCalTriggerMode_t
Handling of the EMCAL trigger thresholds.
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
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
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)
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
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