AliPhysics  32e057f (32e057f)
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 <map>
25 #include <set>
26 #include <string>
27 
28 #include "Rtypes.h"
29 
30 #include "AliParticleContainer.h"
31 #include "AliMCParticleContainer.h"
32 #include "AliTrackContainer.h"
33 #include "AliClusterContainer.h"
34 
35 #include "AliAnalysisTaskSE.h"
70  public:
71 
76  enum EDataType_t {
80  };
81 
86  enum EBeamType_t {
87  kNA = -1,
88  kpp = 0,
89  kAA = 1,
90  kpA = 2
91  };
92 
101  };
102 
104  AliAnalysisTaskEmcalLight(const char *name, Bool_t histo=kFALSE);
105  virtual ~AliAnalysisTaskEmcalLight();
106 
107  // Containers
108  AliParticleContainer *AddParticleContainer(std::string branchName, std::string contName="");
109  AliClusterContainer *AddClusterContainer(std::string branchName, std::string contName="");
110  void AdoptParticleContainer(AliParticleContainer* cont) { fParticleCollArray[cont->GetName()] = cont; }
111  void AdoptClusterContainer(AliClusterContainer* cont) { fClusterCollArray[cont->GetName()] = cont; }
112  AliParticleContainer *GetParticleContainer(std::string name) const;
113  AliClusterContainer *GetClusterContainer(std::string name) const;
114  AliMCParticleContainer *GetMCParticleContainer(std::string name) const { return dynamic_cast<AliMCParticleContainer*>(GetParticleContainer(name)); }
115  AliTrackContainer *GetTrackContainer(std::string name) const { return dynamic_cast<AliTrackContainer*>(GetParticleContainer(name)) ; }
116  void RemoveParticleContainer(std::string name) { fParticleCollArray.erase(name) ; }
117  void RemoveClusterContainer(std::string name) { fClusterCollArray.erase(name) ; }
118 
119  // Other input data
120  void SetCaloCellsName(const char *n) { fCaloCellsName = n ; }
122  void SetCaloTriggersName(const char *n) { fCaloTriggersName = n ; }
123  void SetCentralityEstimator(const char *c) { fCentEst = c ; }
124  void SetIsPythia(Bool_t i) { fIsPythia = i ; }
126 
127  // Task configuration
131  void SetCentBins(const std::vector<double>& bins) { fCentBins = std::vector<double>(bins) ; }
132  Int_t GetNCentBins() const { return fCentBins.size() > 1 ? fCentBins.size() - 1 : 1; }
134 
135  // Event selection
137  void SetCentRange(Double_t min, Double_t max) { fMinCent = min ; fMaxCent = max ; }
138  void SetVzRange(Double_t min, Double_t max) { fMinVz = min ; fMaxVz = max ; }
140  void SetMinNVertCont(Int_t cut) { fMinNVertCont = cut ; }
141  void SetPtHardRange(Double_t min, Double_t max) { fMinPtHard = min ; fMaxPtHard = max ; }
143  void AddAcceptedTriggerClass(const char* trigClass) { fAcceptedTriggerClasses.insert(trigClass) ; }
144  void AddRejectedTriggerClass(const char* trigClass) { fRejectedTriggerClasses.insert(trigClass) ; }
147  void SetMCFilter() { fMCRejectFilter = kTRUE ; }
148  void ResetMCFilter() { fMCRejectFilter = kFALSE ; }
157 
158  protected:
159  void SetRejectionReasonLabels(TAxis* axis);
160  void AddObjectToEvent(TObject *obj, Bool_t attempt = kFALSE);
161  TClonesArray *GetArrayFromEvent(const char *name, const char *clname=0);
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;
166 
167  // Overloaded AliAnalysisTaskSE methods
169  void UserExec(Option_t *option);
170  Bool_t UserNotify();
171 
172  // Virtual functions, to be overloaded in derived classes
173  virtual void ExecOnce();
174  virtual Bool_t FillGeneralHistograms(Bool_t eventSelected);
175  virtual Bool_t IsEventSelected();
176  virtual Bool_t RetrieveEventObjects();
182  virtual Bool_t FillHistograms() { return kTRUE ; }
190  virtual Bool_t Run() { return kTRUE ; }
191 
192  // Static utilities
193  static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff);
194  static Byte_t GetTrackType(const AliVTrack *t);
195  static Byte_t GetTrackType(const AliAODTrack *aodTrack, UInt_t filterBit1, UInt_t filterBit2);
196  static Double_t DeltaPhi(Double_t phia, Double_t phib, Double_t rMin = -TMath::Pi()/2, Double_t rMax = 3*TMath::Pi()/2);
198  static void GenerateFixedBinArray(Int_t n, Double_t min, Double_t max, Double_t* array);
199  static Double_t GetParallelFraction(AliVParticle* part1, AliVParticle* part2);
200  static Double_t GetParallelFraction(const TVector3& vect1, AliVParticle* part2);
201  static EBeamType_t BeamTypeFromRunNumber(Int_t runnumber);
202 
204 
205  // Task configuration
210  std::vector<double> fCentBins;
212 
213  // Input data
219 
220  std::map<std::string,
222  std::map<std::string,
224 
225  // Event selection
236  std::set<std::string> fAcceptedTriggerClasses;
237  std::set<std::string> fRejectedTriggerClasses;
245 
246  // Service fields
249  AliEMCALGeometry *fGeom;
250  AliVCaloCells *fCaloCells;
251  AliVCaloTrigger *fCaloTriggers;
252  TClonesArray *fTriggerPatchInfo;
263  std::vector<std::string> fFiredTriggerClasses;
265  AliGenPythiaEventHeader *fPythiaHeader;
271 
272  // Output
292  TProfile *fHistXsection;
293 
294  private:
295  AliAnalysisTaskEmcalLight(const AliAnalysisTaskEmcalLight&); // not implemented
297 
299  ClassDef(AliAnalysisTaskEmcalLight, 4);
301 };
302 
312 {
313  Double_t dphi = -999;
314  const Double_t tpi = TMath::TwoPi();
315 
316  if (phia < 0) phia += tpi;
317  else if (phia > tpi) phia -= tpi;
318  if (phib < 0) phib += tpi;
319  else if (phib > tpi) phib -= tpi;
320  dphi = phib - phia;
321  if (dphi < rangeMin) dphi += tpi;
322  else if (dphi > rangeMax) dphi -= tpi;
323 
324  return dphi;
325 }
326 
337 {
338  Double_t binWidth = (max-min)/n;
339  array[0] = min;
340  for (Int_t i = 1; i <= n; i++) {
341  array[i] = array[i-1]+binWidth;
342  }
343 }
344 
355 {
356  Double_t *array = new Double_t[n+1];
357  GenerateFixedBinArray(n, min, max, array);
358  return array;
359 }
360 
361 #endif
Bool_t fSwitchOffLHC15oFaultyBranches
Switch off faulty tree branches in LHC15o AOD trees.
AliClusterContainer * AddClusterContainer(std::string branchName, std::string contName="")
Float_t fPtHardAndJetPtFactor
Factor between ptHard and jet pT to reject/accept event.
Double_t fVertexSPD[3]
!event Svertex
TString fCaloTriggersName
name of calo triggers collection
AliEMCALGeometry * fGeom
!emcal geometry
EBeamType_t fBeamType
!event beam type
double Double_t
Definition: External.C:58
TClonesArray * GetArrayFromEvent(const char *name, const char *clname=0)
EDataType_t
Switch for the data type.
Float_t fXsection
!x-section from pythia header
Double_t fEPV0A
!event plane V0A
TString fSelectGeneratorName
Selects only events produced by a generator that has a name containing a string.
TH1 * fHistZVertexNoSel
!z vertex position (no event selection)
Double_t fEPV0
!event plane V0
TH1 * fHistEventCount
!incoming and selected events
TProfile * fHistXsectionVsPtHardNoSel
!x section from pythia header (no event selection)
Container with name, TClonesArray and cuts for particles.
Bool_t fMCRejectFilter
enable the filtering of events by tail rejection
TString fCaloTriggerPatchInfoName
trigger patch info array name
Double_t fMinVz
min vertex for event selection
New centrality estimation (AliMultSelection, see https://twiki.cern.ch/twiki/bin/viewauth/ALICE/AliMu...
void AddRejectedTriggerClass(const char *trigClass)
TCanvas * c
Definition: TestFitELoss.C:172
TString fCentEst
name of the centrality estimator
TH1 * fHistTrialsVsPtHardNoSel
!total number of trials per pt hard bin after selection (no event selection)
UInt_t fTriggerSelectionBitMap
trigger selection bit map
TH1 * fHistCentrality
!event centrality distribution
std::vector< double > fCentBins
how many centrality bins
Bool_t fEventSelectionAfterRun
If kTRUE, the event selection is performed after Run() but before FillHistograms() ...
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
std::set< std::string > fRejectedTriggerClasses
list of accepted trigger classes
void SetCentRange(Double_t min, Double_t max)
Double_t fMaxMinimumBiasPtHard
maximum pt hard for the minimum bias pt hard bin (MC)
Container for particles within the EMCAL framework.
void SetPtHardRange(Double_t min, Double_t max)
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
std::vector< std::string > fFiredTriggerClasses
!trigger classes fired by the current event
Bool_t fCreateHisto
whether or not create histograms
TH1 * fHistTrialsVsPtHard
!total number of trials per pt hard bin after selection
TH1 * fHistEventRejection
!book keep reasons for rejecting event
int Int_t
Definition: External.C:63
TH1 * fHistTrials
!trials from pyxsec.root
void AddAcceptedTriggerClass(const char *trigClass)
Double_t fMinPtHard
select minimum pt hard (MC)
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
void RemoveParticleContainer(std::string name)
Base task in the EMCAL framework (lighter version of AliAnalysisTaskEmcal)
TH1 * fHistEventsVsPtHard
!total number of events per pt hard bin after selection
TH1 * fHistTriggerClassesNoSel
!number of events in each trigger class (no event selection)
Float_t fPtHardAndClusterPtFactor
Factor between ptHard and cluster pT to reject/accept event.
Double_t fMaxVzDiff
upper limit for distance between primary and SPD vertex
Double_t fVertex[3]
!event vertex
static Double_t * GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
ECentralityEstimation_t fCentralityEstimation
Centrality estimation.
TH1 * fHistCentralityNoSel
!event centrality distribution (no event selection)
AliClusterContainer * GetClusterContainer(std::string name) const
void AdoptClusterContainer(AliClusterContainer *cont)
void SetCentralityEstimation(ECentralityEstimation_t b)
Bool_t fIsPythia
if it is a PYTHIA production
TProfile * fHistXsection
!x section from pyxsec.root
Int_t fCentBin
!event centrality bin
unsigned long ULong_t
Definition: External.C:38
Double_t fMaxCent
max centrality for event selection
ULong_t fFiredTriggerBitMap
!bit map of fired triggers
Double_t fMinNVertCont
minumum number of vertex contributors
Int_t fNVertSPDCont
!event SPD vertex number of contributors
std::set< std::string > fAcceptedTriggerClasses
list of accepted trigger classes
static Double_t DeltaPhi(Double_t phia, Double_t phib, Double_t rMin=-TMath::Pi()/2, Double_t rMax=3 *TMath::Pi()/2)
TH1 * fHistEventPlaneNoSel
!event plane distribution (no event selection)
void SetCentralityEstimator(const char *c)
ECentralityEstimation_t
Switch for the centrality estimation.
Bool_t PythiaInfoFromFile(const char *currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard)
Bool_t fLocalInitialized
!whether or not the task has been already initialized
void SetCentBins(const std::vector< double > &bins)
static EBeamType_t BeamTypeFromRunNumber(Int_t runnumber)
void SetCaloTriggerPatchInfoName(const char *n)
AliParticleContainer * AddParticleContainer(std::string branchName, std::string contName="")
void RemoveClusterContainer(std::string name)
std::map< std::string, AliParticleContainer * > fParticleCollArray
particle/track collection array
void SetVzRange(Double_t min, Double_t max)
TH1 * fHistEventsVsPtHardNoSel
!total number of events per pt hard bin after selection (no event selection)
Int_t fNVertCont
!event vertex number of contributors
Bool_t fGeneralHistograms
whether or not it should fill some general histograms
AliGenPythiaEventHeader * fPythiaHeader
!event Pythia header
const char Option_t
Definition: External.C:48
Float_t fPtHardAndTrackPtFactor
Factor between ptHard and track pT to reject/accept event.
AliParticleContainer * GetParticleContainer(std::string name) const
bool Bool_t
Definition: External.C:53
AliMCParticleContainer * GetMCParticleContainer(std::string name) const
TH1 * fHistEventPlane
!event plane distribution
std::map< std::string, AliClusterContainer * > fClusterCollArray
cluster collection array
EBeamType_t
Switch for the beam type.
AliVCaloTrigger * fCaloTriggers
!calo triggers
TProfile * fHistXsectionVsPtHard
!x section from pythia header
AliTrackContainer * GetTrackContainer(std::string name) const
Container structure for EMCAL clusters.
Container for MC-true particles within the EMCAL framework.
TString fGeneratorName
!name of the MC generator used to produce the current event (only AOD)
TH1 * fHistZVertex
!z vertex position
AliAnalysisTaskEmcalLight & operator=(const AliAnalysisTaskEmcalLight &)
void AdoptParticleContainer(AliParticleContainer *cont)
virtual Bool_t FillGeneralHistograms(Bool_t eventSelected)
Double_t fMaxVz
max vertex for event selection
Double_t fCent
!event centrality
Double_t fEPV0C
!event plane V0C
Definition: External.C:196
TClonesArray * fTriggerPatchInfo
!trigger patch info array
Double_t fMaxPtHard
select maximum pt hard (MC)
Old centrality estimation (AliCentrality, works only on Run-1 PbPb and pPb)
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)