AliPhysics  e59a9ba (e59a9ba)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalLight.h
Go to the documentation of this file.
1 #ifndef ALIANALYSISTASKEMCALLIGHT_H
2 #define ALIANALYSISTASKEMCALLIGHT_H
3 /* Copyright(c) 1998-2016, 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 
24 #include "Rtypes.h"
25 
26 #include "AliParticleContainer.h"
27 #include "AliMCParticleContainer.h"
28 #include "AliTrackContainer.h"
29 #include "AliClusterContainer.h"
30 
31 #include "AliAnalysisTaskSE.h"
65 class AliAnalysisTaskEmcalLight : public AliAnalysisTaskSE {
66  public:
67 
72  enum EBeamType_t {
73  kNA = -1,
74  kpp = 0,
75  kAA = 1,
76  kpA = 2
77  };
78 
83  enum EDataType_t {
84  kAOD = 0,
85  kESD = 1
86  };
87 
89  AliAnalysisTaskEmcalLight(const char *name, Bool_t histo=kFALSE);
91 
92  // Containers
94  AliTrackContainer *AddTrackContainer(const char *n);
101  AliParticleContainer *GetParticleContainer(Int_t i=0) const;
102  AliParticleContainer *GetParticleContainer(const char* name) const;
103  AliClusterContainer *GetClusterContainer(Int_t i=0) const;
104  AliClusterContainer *GetClusterContainer(const char* name) const;
106  AliMCParticleContainer *GetMCParticleContainer(const char* name) const { return dynamic_cast<AliMCParticleContainer*>(GetParticleContainer(name)); }
107  AliTrackContainer *GetTrackContainer(Int_t i=0) const { return dynamic_cast<AliTrackContainer*>(GetParticleContainer(i)) ; }
108  AliTrackContainer *GetTrackContainer(const char* name) const { return dynamic_cast<AliTrackContainer*>(GetParticleContainer(name)) ; }
109  void RemoveParticleContainer(Int_t i=0) { fParticleCollArray.RemoveAt(i) ; }
110  void RemoveClusterContainer(Int_t i=0) { fClusterCollArray.RemoveAt(i) ; }
111 
112  // Other input data
113  void SetCaloCellsName(const char *n) { fCaloCellsName = n ; }
115  void SetCaloTriggersName(const char *n) { fCaloTriggersName = n ; }
116  void SetCentralityEstimator(const char *c) { fCentEst = c ; }
117  void SetIsPythia(Bool_t i) { fIsPythia = i ; }
119 
120  // Task configuration
123  void SetNeedEmcalGeom(Bool_t n) { fNeedEmcalGeom = n ; }
124  void SetNCentBins(Int_t n) { fNcentBins = n ; }
125 
126  // Event selection
128  void SetCentRange(Double_t min, Double_t max) { fMinCent = min ; fMaxCent = max ; }
129  void SetVzRange(Double_t min, Double_t max) { fMinVz = min ; fMaxVz = max ; }
130  void SetZvertexDiffValue(Double_t cut) { fZvertexDiff = cut ; }
131  void SetMinPtTrack(Double_t min) { fMinPtTrack = min ; }
132  void SetMinNTrack(Int_t min) { fMinNTrack = min ; }
133  void SetMinPtTrackInEmcal(Double_t min) { fMinPtTrackInEmcal = min ; }
134  void SetPtHardBin(Int_t pt) { fSelectPtHardBin = pt ; }
135  void AddAcceptedTriggerClass(const char* trigClass) { fAcceptedTriggerClasses.Add(new TObjString(trigClass)); }
136  void AddRejectedTriggerClass(const char* trigClass) { fRejectedTriggerClasses.Add(new TObjString(trigClass)); }
139 
140  protected:
141  void SetRejectionReasonLabels(TAxis* axis);
142  void AddObjectToEvent(TObject *obj, Bool_t attempt = kFALSE);
143  TClonesArray *GetArrayFromEvent(const char *name, const char *clname=0);
145  Bool_t PythiaInfoFromFile(const char* currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard);
146  Bool_t IsTrackInEmcalAcceptance(AliVParticle* part, Double_t edges=0.9) const;
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();
163  virtual Bool_t FillHistograms() { return kTRUE ; }
171  virtual Bool_t Run() { return kTRUE ; }
172 
173  // Static utilities
174  static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff);
175  static Byte_t GetTrackType(const AliVTrack *t);
176  static Byte_t GetTrackType(const AliAODTrack *aodTrack, UInt_t filterBit1, UInt_t filterBit2);
177  static Double_t DeltaPhi(Double_t phia, Double_t phib, Double_t rMin = -TMath::Pi()/2, Double_t rMax = 3*TMath::Pi()/2);
178  static Double_t* GenerateFixedBinArray(Int_t n, Double_t min, Double_t max);
179  static void GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array);
180  static Double_t GetParallelFraction(AliVParticle* part1, AliVParticle* part2);
181  static Double_t GetParallelFraction(const TVector3& vect1, AliVParticle* part2);
182 
183  static Double_t fgkEMCalDCalPhiDivide;
184 
185  // Task configuration
188  Bool_t fCreateHisto;
189  Bool_t fNeedEmcalGeom;
190  Int_t fNcentBins;
192 
193  // Input data
194  Bool_t fIsPythia;
195  TString fCaloCellsName;
198  TString fCentEst;
199 
200  TObjArray fParticleCollArray;
201  TObjArray fClusterCollArray;
202 
203  // Event selection
205  Double_t fMinCent;
206  Double_t fMaxCent;
207  Double_t fMinVz;
208  Double_t fMaxVz;
209  Double_t fZvertexDiff;
210  Double_t fMinPtTrack;
211  Int_t fMinNTrack;
216 
217  // Service fields
218  Bool_t fInitialized;
220  AliEMCALGeometry *fGeom;
221  AliVCaloCells *fCaloCells;
222  AliVCaloTrigger *fCaloTriggers;
223  TClonesArray *fTriggerPatchInfo;
224  Double_t fCent;
225  Int_t fCentBin;
226  Double_t fEPV0;
227  Double_t fEPV0A;
228  Double_t fEPV0C;
229  Double_t fVertex[3];
230  Double_t fVertexSPD[3];
231  Int_t fNVertCont;
236  AliGenPythiaEventHeader *fPythiaHeader;
237  Double_t fPtHard;
238  Int_t fPtHardBin;
239  Int_t fNTrials;
240  Float_t fXsection;
241 
242  // Output
243  TList *fOutput;
248  TH1 *fHistTrials;
249  TH1 *fHistEvents;
250  TProfile *fHistXsection;
251  TH1 *fHistPtHard;
257 
258  private:
259  AliAnalysisTaskEmcalLight(const AliAnalysisTaskEmcalLight&); // not implemented
261 
263  ClassDef(AliAnalysisTaskEmcalLight, 1);
265 };
266 
275 inline Double_t AliAnalysisTaskEmcalLight::DeltaPhi(Double_t phia, Double_t phib, Double_t rangeMin, Double_t rangeMax)
276 {
277  Double_t dphi = -999;
278  const Double_t tpi = TMath::TwoPi();
279 
280  if (phia < 0) phia += tpi;
281  else if (phia > tpi) phia -= tpi;
282  if (phib < 0) phib += tpi;
283  else if (phib > tpi) phib -= tpi;
284  dphi = phib - phia;
285  if (dphi < rangeMin) dphi += tpi;
286  else if (dphi > rangeMax) dphi -= tpi;
287 
288  return dphi;
289 }
290 
300 inline void AliAnalysisTaskEmcalLight::GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array)
301 {
302  Double_t binWidth = (max-min)/n;
303  array[0] = min;
304  for (Int_t i = 1; i <= n; i++) {
305  array[i] = array[i-1]+binWidth;
306  }
307 }
308 
318 inline Double_t* AliAnalysisTaskEmcalLight::GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
319 {
320  Double_t *array = new Double_t[n+1];
321  GenerateFixedBinArray(n, min, max, array);
322  return array;
323 }
324 
325 #endif
Double_t fVertexSPD[3]
!event Svertex
TString fCaloTriggersName
name of calo triggers collection
TObjArray fAcceptedTriggerClasses
list of accepted trigger classes
Int_t fNcentBins
how many centrality bins
AliEMCALGeometry * fGeom
!emcal geometry
EBeamType_t fBeamType
!event beam type
TClonesArray * GetArrayFromEvent(const char *name, const char *clname=0)
EDataType_t
Switch for the data type.
TObjArray fClusterCollArray
cluster collection array
AliMCParticleContainer * GetMCParticleContainer(Int_t i=0) const
Float_t fXsection
!x-section from pythia header
Double_t fEPV0A
!event plane V0A
Double_t fEPV0
!event plane V0
TH1 * fHistEventCount
!incoming and selected events
TObjArray fRejectedTriggerClasses
list of accepted trigger classes
AliTrackContainer * GetTrackContainer(Int_t i=0) const
TObjArray fParticleCollArray
particle/track collection array
Container with name, TClonesArray and cuts for particles.
Double_t fZvertexDiff
upper limit for distance between primary and SPD vertex
AliTrackContainer * AddTrackContainer(const char *n)
TString fCaloTriggerPatchInfoName
trigger patch info array name
Double_t fMinVz
min vertex for event selection
TProfile * fHistXsectionAfterSel
!x section from pythia header
void AddRejectedTriggerClass(const char *trigClass)
TString fCentEst
name of the centrality estimator
UInt_t fTriggerSelectionBitMap
trigger selection bit map
TH1 * fHistCentrality
!event centrality distribution
AliTrackContainer * GetTrackContainer(const char *name) const
static Byte_t GetTrackType(const AliVTrack *t)
TH1 * fHistTriggerClasses
!number of events in each trigger class
TString fCaloCellsName
name of calo cell collection
TH1 * fHistEvents
!total number of events per pt hard bin
Bool_t IsTrackInEmcalAcceptance(AliVParticle *part, Double_t edges=0.9) const
Double_t fMinCent
min centrality for event selection
Double_t fMinPtTrack
cut on track pt in event selection
void SetCentRange(Double_t min, Double_t max)
Container for particles within the EMCAL framework.
static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
void AddObjectToEvent(TObject *obj, Bool_t attempt=kFALSE)
static Double_t fgkEMCalDCalPhiDivide
phi value used to distinguish between DCal and EMCal
EBeamType_t fForceBeamType
forced beam type
AliClusterContainer * AddClusterContainer(const char *n)
Bool_t fCreateHisto
whether or not create histograms
TH1 * fHistEventRejection
!book keep reasons for rejecting event
TH1 * fHistTrials
!trials from pyxsec.root
void AddAcceptedTriggerClass(const char *trigClass)
TString fFiredTriggerClasses
!trigger classes fired by the current event
Base task in the EMCAL framework (lighter version of AliAnalysisTaskEmcal)
Double_t fVertex[3]
!event vertex
static Double_t * GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Int_t fPtHardBin
!event pt hard bin
void AdoptClusterContainer(AliClusterContainer *cont)
Bool_t fIsPythia
if it is a PYTHIA production
Bool_t fInitialized
!whether or not the task has been already initialized
TProfile * fHistXsection
!x section from pyxsec.root
Int_t fCentBin
!event centrality bin
Int_t fSelectPtHardBin
select one pt hard bin for analysis
TH1 * fHistEventsAfterSel
!total number of events per pt hard bin after selection
Double_t fMaxCent
max centrality for event selection
ULong_t fFiredTriggerBitMap
!bit map of fired triggers
AliMCParticleContainer * GetMCParticleContainer(const char *name) const
Int_t fNVertSPDCont
!event SPD vertex number of contributors
static Double_t DeltaPhi(Double_t phia, Double_t phib, Double_t rMin=-TMath::Pi()/2, Double_t rMax=3 *TMath::Pi()/2)
void SetCentralityEstimator(const char *c)
Double_t fMinPtTrackInEmcal
min pt track in emcal
Bool_t PythiaInfoFromFile(const char *currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard)
Int_t fMinNTrack
minimum nr of tracks in event with pT>fTrackPtCut
void SetCaloTriggerPatchInfoName(const char *n)
void AdoptTrackContainer(AliTrackContainer *cont)
AliParticleContainer * GetParticleContainer(Int_t i=0) const
void SetVzRange(Double_t min, Double_t max)
Int_t fNVertCont
!event vertex number of contributors
AliMCParticleContainer * AddMCParticleContainer(const char *n)
Bool_t fGeneralHistograms
whether or not it should fill some general histograms
AliGenPythiaEventHeader * fPythiaHeader
!event Pythia header
TH1 * fHistPtHard
!pt hard distribution
TH1 * fHistTrialsAfterSel
!total number of trials per pt hard bin after selection
TH1 * fHistEventPlane
!event plane distribution
EBeamType_t
Switch for the beam type.
AliVCaloTrigger * fCaloTriggers
!calo triggers
Container structure for EMCAL clusters.
Container for MC-true particles within the EMCAL framework.
TH1 * fHistZVertex
!z vertex position
AliParticleContainer * AddParticleContainer(const char *n)
AliAnalysisTaskEmcalLight & operator=(const AliAnalysisTaskEmcalLight &)
void AdoptParticleContainer(AliParticleContainer *cont)
Double_t fMaxVz
max vertex for event selection
Double_t fCent
!event centrality
Double_t fEPV0C
!event plane V0C
Bool_t fUseNewCentralityEstimation
Use new centrality estimation (for 2015 data)
TClonesArray * fTriggerPatchInfo
!trigger patch info array
void AdoptMCParticleContainer(AliMCParticleContainer *cont)
Bool_t fNeedEmcalGeom
whether or not the task needs the emcal geometry
static Double_t GetParallelFraction(AliVParticle *part1, AliVParticle *part2)
EDataType_t fDataType
!data type (ESD or AOD)