AliPhysics  64a5cfc (64a5cfc)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalCorrectionTask.h
Go to the documentation of this file.
1 #ifndef ALIEMCALCORRECTIONTASK_H
2 #define ALIEMCALCORRECTIONTASK_H
3 
4 // CINT can't handle the yaml header!
5 #if !(defined(__CINT__) || defined(__MAKECINT__))
6 #include <yaml-cpp/yaml.h>
7 #endif
8 
11 class AliEMCALGeometry;
12 class AliVEvent;
13 
14 #include "AliAnalysisTaskSE.h"
15 #include "AliParticleContainer.h"
16 #include "AliMCParticleContainer.h"
17 #include "AliTrackContainer.h"
18 #include "AliClusterContainer.h"
19 #include "AliVCluster.h"
20 #include "AliEmcalTrackSelection.h"
21 
46  public:
51  enum BeamType {
52  kNA = -1,
53  kpp = 0,
54  kAA = 1,
55  kpA = 2
56  };
57 
64  kCaloCells = 0,
65  kCluster = 1,
66  kTrack = 2,
67  };
68 
69 #if !(defined(__CINT__) || defined(__MAKECINT__))
70  std::map <std::string, AliVCluster::VCluUserDefEnergy_t> clusterEnergyTypeMap = {
71  {"kNonLinCorr", AliVCluster::kNonLinCorr },
72  {"kHadCorr", AliVCluster::kHadCorr },
73  {"kUserDefEnergy1", AliVCluster::kUserDefEnergy1 },
74  {"kUserDefEnergy2", AliVCluster::kUserDefEnergy2 }
75  };
76 
77  std::map <std::string, AliEmcalTrackSelection::ETrackFilterType_t> trackFilterTypeMap = {
78  {"kNoTrackFilter", AliEmcalTrackSelection::kNoTrackFilter },
79  {"kCustomTrackFilter", AliEmcalTrackSelection::kCustomTrackFilter },
80  {"kHybridTracks", AliEmcalTrackSelection::kHybridTracks },
81  {"kTPCOnlyTracks", AliEmcalTrackSelection::kTPCOnlyTracks }
82  };
83 #endif
84 
86  AliEmcalCorrectionTask(const char * name);
87  virtual ~AliEmcalCorrectionTask();
88 
89  // Methods from AliAnalysisTaskSE
91  void UserExec(Option_t * option);
93 
94  // Functions that can be overloaded by users
98  virtual void ExecOnce();
102  virtual Bool_t Run();
103 
104  // Options
105  void SetUserConfigurationFilename(std::string name) { fUserConfigurationFilename = name; }
107 
108  void Initialize();
109 
110  // Containers and cells
112  AliTrackContainer *AddTrackContainer(const char *n);
120  AliParticleContainer *GetParticleContainer(const char* name) const;
122  AliClusterContainer *GetClusterContainer(const char* name) const;
124  AliMCParticleContainer *GetMCParticleContainer(const char* name) const { return dynamic_cast<AliMCParticleContainer*>(GetParticleContainer(name)); }
126  AliTrackContainer *GetTrackContainer(const char* name) const { return dynamic_cast<AliTrackContainer*>(GetParticleContainer(name)) ; }
127  void RemoveParticleContainer(Int_t i=0) { fParticleCollArray.RemoveAt(i) ; }
128  void RemoveClusterContainer(Int_t i=0) { fClusterCollArray.RemoveAt(i) ; }
129  AliEmcalCorrectionCellContainer *GetCellContainer(const std::string & cellsContainerName) const;
130 
132  void SetRunPeriod(const char* runPeriod) { fRunPeriod = runPeriod; fRunPeriod.ToLower(); }
133  const TString & GetRunPeriod() const { return fRunPeriod; }
134 
136 
137  const std::vector<AliEmcalCorrectionComponent *> & CorrectionComponents() { return fCorrectionComponents; }
138 
139  bool WriteConfigurationFile(std::string filename, bool userConfig = false);
140 
141  // Determine branch name using the "usedefault" pattern
142  static std::string DetermineUseDefaultName(InputObject_t contType, bool esdMode, bool returnObjectType = false);
143 
144  // Get the proper event based on whether embedding is enabled or not
145  static AliVEvent * GetEvent(AliVEvent * inputEvent, bool isEmbedding = false);
146 
147  private:
148  AliEmcalCorrectionTask(const AliEmcalCorrectionTask &); // Not implemented
149  AliEmcalCorrectionTask &operator=(const AliEmcalCorrectionTask &); // Not implemented
150 
151  static inline bool DoesFileExist(const std::string & filename);
152  void SetupConfigurationFilePath(std::string & filename, bool userFile = false);
153 
155  void RetrieveExecutionOrder(std::vector <std::string> & componentsToAdd);
156  void InitializeComponents();
157 
159  void CheckForContainerArray(AliEmcalContainer * cont, InputObject_t objectType);
160 
161  std::string GetInputFieldNameFromInputObjectType(InputObject_t inputObjectType);
162  void CreateInputObjects(InputObject_t inputObjectType);
163  void AddContainersToComponent(AliEmcalCorrectionComponent * component, InputObject_t inputObjectType);
164 #if !(defined(__CINT__) || defined(__MAKECINT__))
165  void SetupContainersFromInputNodes(InputObject_t inputObjectType, YAML::Node & userInputObjectNode, YAML::Node & defaultInputObjectNode, std::set <std::string> & requestedContainers);
166  void GetNodeForInputObjects(YAML::Node & inputNode, YAML::Node & nodeToRetrieveFrom, std::string & inputObjectName, bool requiredProperty);
167 
168  void SetupCellsInfo(std::string containerName, YAML::Node & userNode, YAML::Node & defaultNode);
169  void SetupContainer(InputObject_t inputObjectType, std::string containerName, YAML::Node & userNode, YAML::Node & defaultNode);
170 
171  AliEmcalContainer * AddContainer(InputObject_t contType, std::string & containerName, YAML::Node & userNode, YAML::Node & defaultNode);
172 #endif
173 
175  void ExecOnceComponents();
177 
179 
180 #if !(defined(__CINT__) || defined(__MAKECINT__))
181  YAML::Node fUserConfiguration;
183 #endif
184 
187 
190 
191  std::vector <AliEmcalCorrectionComponent *> fCorrectionComponents;
193 
194  bool fIsEsd;
209  AliEMCALGeometry *fGeom;
210 
213  std::vector <AliEmcalCorrectionCellContainer *> fCellCollArray;
214 
216 
218  ClassDef(AliEmcalCorrectionTask, 2); // EMCal correction task
220 };
221 
223  public:
225  fBranchName(""),
226  fName(""),
227  fIsEmbedding(""),
228  fCells(0)
229  {}
230  AliEmcalCorrectionCellContainer(std::string branchName, std::string name, std::string branchToCopyName, bool isEmbedded):
231  fBranchName(branchName),
232  fName(name),
233  fIsEmbedding(isEmbedded),
234  fCells(0)
235  {}
237 
238  std::string GetBranchName() const { return fBranchName; }
239  std::string GetName() const { return fName; }
240  bool GetIsEmbedding() const { return fIsEmbedding; }
241  AliVCaloCells * GetCells() const { return fCells; }
242 
243  void SetBranchName(std::string branchName) { fBranchName = branchName; }
244  void SetName(std::string name ) { fName = name; }
245  void SetIsEmbedding(bool isEmbedded) { fIsEmbedding = isEmbedded; }
246  void SetCells(AliVCaloCells * cells) { fCells = cells; }
247 
248  protected:
249  std::string fBranchName;
250  std::string fName;
252  AliVCaloCells *fCells;
253 
255  ClassDef(AliEmcalCorrectionCellContainer, 1); // EMCal correction cell container
257 };
258 
259 #endif /* ALIEMCALCORRECTIONTASK_H */
Int_t fNcentBins
how many centrality bins
void SetBranchName(std::string branchName)
Steering task for the EMCal correction frameworkThis class is the steering class for the cell and clu...
bool fIsEmbedding
Whether the cells should be taken from an external file (embedded)
AliEMCALGeometry * fGeom
!emcal geometry
const char * filename
Definition: TestFCM.C:1
std::map< std::string, AliVCluster::VCluUserDefEnergy_t > clusterEnergyTypeMap
static bool DoesFileExist(const std::string &filename)
double Double_t
Definition: External.C:58
AliTrackContainer * AddTrackContainer(const char *n)
AliTrackContainer * GetTrackContainer(const char *name) const
AliVCaloCells * fCells
! The actual cells object associated with this infomration
std::string GetInputFieldNameFromInputObjectType(InputObject_t inputObjectType)
AliClusterContainer * GetClusterContainer(Int_t i=0) const
std::vector< AliEmcalCorrectionComponent * > fCorrectionComponents
Contains the correction components.
Container with name, TClonesArray and cuts for particles.
void RetrieveExecutionOrder(std::vector< std::string > &componentsToAdd)
void AdoptClusterContainer(AliClusterContainer *cont)
void SetupConfigurationFilePath(std::string &filename, bool userFile=false)
void UserExec(Option_t *option)
void SetDefaultConfigurationFilename(std::string name)
Double_t fMaxCent
max centrality for event selection
Double_t fVertex[3]
!event vertex
AliEmcalCorrectionTask & operator=(const AliEmcalCorrectionTask &)
TList * fOutput
! Output for histograms
bool fConfigurationInitialized
True if the YAML files are initialized.
void RemoveClusterContainer(Int_t i=0)
Container for particles within the EMCAL framework.
void SetUserConfigurationFilename(std::string name)
AliEmcalContainer * AddContainer(InputObject_t contType, std::string &containerName, YAML::Node &userNode, YAML::Node &defaultNode)
AliTrackContainer * GetTrackContainer(Int_t i=0) const
void AddContainersToComponent(AliEmcalCorrectionComponent *component, InputObject_t inputObjectType)
AliMCParticleContainer * GetMCParticleContainer(const char *name) const
bool fEventInitialized
If the event is initialized properly.
TString fCentEst
name of V0 centrality estimator
int Int_t
Definition: External.C:63
std::string fUserConfigurationFilename
! User YAML configruation filename
std::string fBranchName
Name of the cells branch.
const std::vector< AliEmcalCorrectionComponent * > & CorrectionComponents()
std::string fDefaultConfigurationString
Store the default YAML configuration as a string so that it can be streamed.
TString fRunPeriod
Run period (passed by user)
void SetCells(AliVCaloCells *cells)
Double_t fCent
! Event centrality
Base class for correction components in the EMCal correction framework.
void SetUseNewCentralityEstimation(Bool_t b)
BeamType
Switch for the beam type.
AliMCParticleContainer * AddMCParticleContainer(const char *n)
AliEmcalCorrectionCellContainer(std::string branchName, std::string name, std::string branchToCopyName, bool isEmbedded)
std::map< std::string, AliEmcalTrackSelection::ETrackFilterType_t > trackFilterTypeMap
void SetupContainersFromInputNodes(InputObject_t inputObjectType, YAML::Node &userInputObjectNode, YAML::Node &defaultInputObjectNode, std::set< std::string > &requestedContainers)
static std::string DetermineUseDefaultName(InputObject_t contType, bool esdMode, bool returnObjectType=false)
void SetupContainer(InputObject_t inputObjectType, std::string containerName, YAML::Node &userNode, YAML::Node &defaultNode)
bool WriteConfigurationFile(std::string filename, bool userConfig=false)
Bool_t fNeedEmcalGeom
whether or not the task needs the emcal geometry
void SetCellsObjectInCellContainerBasedOnProperties(AliEmcalCorrectionCellContainer *cellContainer)
Bool_t fUseNewCentralityEstimation
Use new centrality estimation (for 2015 data)
void CheckForContainerArray(AliEmcalContainer *cont, InputObject_t objectType)
AliEmcalCorrectionCellContainer * GetCellContainer(const std::string &cellsContainerName) const
std::string fDefaultConfigurationFilename
! Default YAML configuration filename
void GetNodeForInputObjects(YAML::Node &inputNode, YAML::Node &nodeToRetrieveFrom, std::string &inputObjectName, bool requiredProperty)
TObjArray fParticleCollArray
particle/track collection array
TObjArray fClusterCollArray
cluster collection array
static AliVEvent * GetEvent(AliVEvent *inputEvent, bool isEmbedding=false)
AliMCParticleContainer * GetMCParticleContainer(Int_t i=0) const
const TString & GetRunPeriod() const
void AdoptTrackContainer(AliTrackContainer *cont)
AliParticleContainer * GetParticleContainer(Int_t i=0) const
void AdoptParticleContainer(AliParticleContainer *cont)
std::string fName
Name of the cells object.
BeamType fBeamType
!event beam type
const char Option_t
Definition: External.C:48
YAML::Node fDefaultConfiguration
User YAML Configuration.
void SetupCellsInfo(std::string containerName, YAML::Node &userNode, YAML::Node &defaultNode)
Int_t fNVertCont
!event vertex number of contributors
void RemoveParticleContainer(Int_t i=0)
bool Bool_t
Definition: External.C:53
Int_t fCentBin
! Event centrality bin
void AdoptMCParticleContainer(AliMCParticleContainer *cont)
Double_t fMinCent
min centrality for event selection
void SetRunPeriod(const char *runPeriod)
AliClusterContainer * AddClusterContainer(const char *n)
std::vector< AliEmcalCorrectionCellContainer * > fCellCollArray
Cells collection array.
AliParticleContainer * AddParticleContainer(const char *n)
Container structure for EMCAL clusters.
Container for MC-true particles within the EMCAL framework.
std::string fUserConfigurationString
Default YAML Configuration.
InputObject_t
Type of input object to be created.
BeamType fForceBeamType
forced beam type
void CreateInputObjects(InputObject_t inputObjectType)