AliPhysics  b555aef (b555aef)
AliEmcalCorrectionTask.h
Go to the documentation of this file.
1 #ifndef ALIEMCALCORRECTIONTASK_H
2 #define ALIEMCALCORRECTIONTASK_H
3 
6 class AliEMCALGeometry;
7 class AliVEvent;
8 
9 #include <AliAnalysisTaskSE.h>
10 #include <AliVCluster.h>
11 
12 #include "AliYAMLConfiguration.h"
13 #include "AliEmcalContainerUtils.h"
14 #include "AliParticleContainer.h"
15 #include "AliMCParticleContainer.h"
16 #include "AliTrackContainer.h"
17 #include "AliClusterContainer.h"
18 #include "AliEmcalTrackSelection.h"
19 
44  public:
49  enum BeamType {
50  kNA = -1,
51  kpp = 0,
52  kAA = 1,
53  kpA = 2
54  };
55 
57  static const std::map <std::string, AliVCluster::VCluUserDefEnergy_t> fgkClusterEnergyTypeMap;
58 
60  static const std::map <std::string, AliEmcalTrackSelection::ETrackFilterType_t> fgkTrackFilterTypeMap;
61 
63  AliEmcalCorrectionTask(const char * name);
64  // Implemented using copy-and-swap mechanism
67  friend void swap(AliEmcalCorrectionTask & first, AliEmcalCorrectionTask & second);
69  virtual ~AliEmcalCorrectionTask();
70 
79  void Initialize(bool removeDummyTask = false);
80 
84  void SetUserConfigurationFilename(std::string name) { fUserConfigurationFilename = name; }
88  // Print the actual configuration string
89  std::ostream & PrintConfiguration(std::ostream & in, bool userConfig = false) const;
90  // Write configuration to file
91  bool WriteConfigurationFile(std::string filename, bool userConfig = false) const;
92  // Compare configurations
93  bool CompareToStoredConfiguration(std::string filename, bool userConfig = false);
98  // Options
99  // Printing
100  friend std::ostream & operator<<(std::ostream &in, const AliEmcalCorrectionTask &myTask);
101  void Print(Option_t* opt = "") const;
102  std::ostream & Print(std::ostream &in) const;
103  std::string toString(bool includeYAMLConfigurationInfo = false) const;
104  // Set
107  // Centrality options
109  void SetCentralityEstimator(const char * c) { fCentEst = c ; }
110  virtual void SetNCentBins(Int_t n) { fNcentBins = n ; }
111  void SetCentRange(Double_t min, Double_t max) { fMinCent = min ; fMaxCent = max ; }
112 
120  const std::vector<AliEmcalCorrectionComponent *> & CorrectionComponents() { return fCorrectionComponents; }
121  AliEmcalCorrectionComponent * GetCorrectionComponent(const std::string & name) const;
122 
123  // Containers and cells
124  AliParticleContainer *AddParticleContainer(const char *n) { return AliEmcalContainerUtils::AddContainer<AliParticleContainer>(n, fParticleCollArray); }
125  AliTrackContainer *AddTrackContainer(const char *n) { return AliEmcalContainerUtils::AddContainer<AliTrackContainer>(n, fParticleCollArray); }
126  AliMCParticleContainer *AddMCParticleContainer(const char *n) { return AliEmcalContainerUtils::AddContainer<AliMCParticleContainer>(n, fParticleCollArray); }
127  AliClusterContainer *AddClusterContainer(const char *n) { return AliEmcalContainerUtils::AddContainer<AliClusterContainer>(n, fClusterCollArray); }
132  AliParticleContainer *GetParticleContainer(Int_t i=0) const { return AliEmcalContainerUtils::GetContainer<AliParticleContainer>(i, fParticleCollArray); }
133  AliParticleContainer *GetParticleContainer(const char* name) const { return AliEmcalContainerUtils::GetContainer<AliParticleContainer>(name, fParticleCollArray); }
134  AliClusterContainer *GetClusterContainer(Int_t i=0) const { return AliEmcalContainerUtils::GetContainer<AliClusterContainer>(i, fClusterCollArray); }
135  AliClusterContainer *GetClusterContainer(const char* name) const { return AliEmcalContainerUtils::GetContainer<AliClusterContainer>(name, fClusterCollArray); }
137  AliMCParticleContainer *GetMCParticleContainer(const char* name) const { return dynamic_cast<AliMCParticleContainer*>(GetParticleContainer(name)); }
139  AliTrackContainer *GetTrackContainer(const char* name) const { return dynamic_cast<AliTrackContainer*>(GetParticleContainer(name)) ; }
141  void RemoveClusterContainer(Int_t i=0) { fClusterCollArray.RemoveAt(i) ; }
142  // Cells
143  AliEmcalCorrectionCellContainer *GetCellContainer(const std::string & cellsContainerName) const;
144 
145  // Methods from AliAnalysisTaskSE
147  void UserExec(Option_t * option);
148  Bool_t UserNotify();
149 
150  // Aditional steering functions
151  virtual void ExecOnce();
152  virtual Bool_t Run();
153 
176 
177  private:
178  // Utility functions
179  // Cell utilities
181  // Container utilities
182  void CheckForContainerArray(AliEmcalContainer * cont, AliEmcalContainerUtils::InputObject_t objectType);
183  // YAML configuration utilities
185  bool CheckPossibleNamesForComponentName(std::string & name, std::set <std::string> & possibleComponents);
186  // General utilities
187  BeamType GetBeamType() const;
188  void PrintRequestedContainersInformation(AliEmcalContainerUtils::InputObject_t inputObjectType, std::ostream & stream) const;
189  // LEGO Train utilities
190  void RemoveDummyTask() const;
191 
192  // Retrieve objects in event
194 
195  // Execute component functions
197  void ExecOnceComponents();
198 
199  // Initialization functions
201  void DetermineComponentsToExecute(std::vector <std::string> & componentsToExecute);
203  void InitializeComponents();
204 
205  // Input objects (Cells, Clusters, Tracks) functions
207  void AddContainersToComponent(AliEmcalCorrectionComponent * component, AliEmcalContainerUtils::InputObject_t inputObjectType, bool checkObjectExists = false);
208 
209  // Hidden from CINT since it cannot handle YAML objects well
210  // Input objects
211  void SetupContainersFromInputNodes(AliEmcalContainerUtils::InputObject_t inputObjectType, std::set <std::string> & requestedContainers);
212  // Cells
213  void SetupCellsInfo(std::string containerName);
214  // Containers
215  void SetupContainer(const AliEmcalContainerUtils::InputObject_t inputObjectType, const std::string containerName);
216  AliEmcalContainer * AddContainer(const AliEmcalContainerUtils::InputObject_t contType, const std::string containerName);
217 
218  // Utilities
219  // YAML node dependent initialization utlitiles
220  void GetPropertyNamesFromNode(const std::string configurationName, const std::string componentName, std::set <std::string> & propertyNames, const bool nodeRequired);
221 
223 
224  std::string fSuffix;
225 
228 
229  std::vector <std::string> fOrderedComponentsToExecute;
230  std::vector <AliEmcalCorrectionComponent *> fCorrectionComponents;
232 
233  bool fIsEsd;
247  AliEMCALGeometry *fGeom;
248 
251  std::vector <AliEmcalCorrectionCellContainer *> fCellCollArray;
252 
254 
256  ClassDef(AliEmcalCorrectionTask, 4); // EMCal correction task
258 };
259 
279  public:
281  fBranchName(""),
282  fName(""),
283  fIsEmbedding(""),
284  fCells(0)
285  {}
286  AliEmcalCorrectionCellContainer(std::string branchName, std::string name, std::string branchToCopyName, bool isEmbedded):
287  fBranchName(branchName),
288  fName(name),
289  fIsEmbedding(isEmbedded),
290  fCells(0)
291  {}
293 
295  std::string GetBranchName() const { return fBranchName; }
297  std::string GetName() const { return fName; }
299  bool GetIsEmbedding() const { return fIsEmbedding; }
301  AliVCaloCells * GetCells() const { return fCells; }
302 
304  void SetBranchName(std::string branchName) { fBranchName = branchName; }
306  void SetName(std::string name ) { fName = name; }
308  void SetIsEmbedding(bool isEmbedded) { fIsEmbedding = isEmbedded; }
310  void SetCells(AliVCaloCells * cells) { fCells = cells; }
311 
312  protected:
313  std::string fBranchName;
314  std::string fName;
316  AliVCaloCells *fCells;
317 
319  ClassDef(AliEmcalCorrectionCellContainer, 1); // EMCal correction cell container
321 };
322 
323 #endif /* ALIEMCALCORRECTIONTASK_H */
Int_t fNcentBins
how many centrality bins
void SetBranchName(std::string branchName)
Set the name of the cells branch (NOT the same as the name!)
std::string fSuffix
Suffix of the Correction Task (used to select specialized components)
void PrintRequestedContainersInformation(AliEmcalContainerUtils::InputObject_t inputObjectType, std::ostream &stream) const
Steering task for the EMCal correction framework.
bool fIsEmbedding
Whether the cells should be taken from an external file (embedded)
AliEMCALGeometry * fGeom
! Emcal geometry
const char * filename
Definition: TestFCM.C:1
static const std::map< std::string, AliVCluster::VCluUserDefEnergy_t > fgkClusterEnergyTypeMap
Relates string to the cluster energy enumeration for YAML configuration.
static AliEmcalCorrectionTask * ConfigureEmcalCorrectionTaskOnLEGOTrain(TString suffix)
std::string GetName() const
Get the name of the cells object (NOT the same as the branch!)
double Double_t
Definition: External.C:58
virtual void SetNCentBins(Int_t n)
AliTrackContainer * GetTrackContainer(const char *name) const
void SetCentralityEstimator(const char *c)
void SetupContainer(const AliEmcalContainerUtils::InputObject_t inputObjectType, const std::string containerName)
AliVCaloCells * fCells
! The actual cells object associated with this infomration
std::vector< std::string > fOrderedComponentsToExecute
Ordered set of components to execute.
bool WriteConfigurationFile(std::string filename, bool userConfig=false) const
bool CheckPossibleNamesForComponentName(std::string &name, std::set< std::string > &possibleComponents)
std::vector< AliEmcalCorrectionComponent * > fCorrectionComponents
Contains the correction components.
Container with name, TClonesArray and cuts for particles.
std::string GetInputFieldNameFromInputObjectType(AliEmcalContainerUtils::InputObject_t inputObjectType)
void AdoptClusterContainer(AliClusterContainer *cont)
void UserExec(Option_t *option)
AliEmcalCorrectionTask & operator=(AliEmcalCorrectionTask other)
void SetDefaultConfigurationFilename(std::string name)
Set the path to the default configuration filename (Expert use only! The user should set the user con...
Double_t fMaxCent
max centrality for event selection
Double_t fVertex[3]
! Event vertex
AliEmcalContainer * AddContainer(const AliEmcalContainerUtils::InputObject_t contType, const std::string containerName)
TCanvas * c
Definition: TestFitELoss.C:172
void DetermineComponentsToExecute(std::vector< std::string > &componentsToExecute)
TList * fOutput
! Output for histograms
bool CompareToStoredConfiguration(std::string filename, bool userConfig=false)
Wrapper around cells objects for the EMCal Correction Task.
bool fConfigurationInitialized
True if the YAML configuration files are initialized.
void RemoveClusterContainer(Int_t i=0)
void CheckForContainerArray(AliEmcalContainer *cont, AliEmcalContainerUtils::InputObject_t objectType)
AliParticleContainer * GetParticleContainer(Int_t i=0) const
friend void swap(AliEmcalCorrectionTask &first, AliEmcalCorrectionTask &second)
Container for particles within the EMCAL framework.
void SetUserConfigurationFilename(std::string name)
Set the path to the user configuration filename.
AliTrackContainer * GetTrackContainer(Int_t i=0) const
void SetupCellsInfo(std::string containerName)
PWG::Tools::AliYAMLConfiguration fYAMLConfig
Handles configuration from YAML.
AliMCParticleContainer * GetMCParticleContainer(const char *name) const
AliVCaloCells * GetCells() const
Pointer to the actual CaloCells object.
bool fEventInitialized
If the event is initialized properly.
TString fCentEst
name of V0 centrality estimator
AliTrackContainer * AddTrackContainer(const char *n)
int Int_t
Definition: External.C:63
std::string fUserConfigurationFilename
! User YAML configruation filename
void GetPropertyNamesFromNode(const std::string configurationName, const std::string componentName, std::set< std::string > &propertyNames, const bool nodeRequired)
InputObject_t
Type of input object to be created
std::string fBranchName
Name of the cells branch.
AliClusterContainer * GetClusterContainer(Int_t i=0) const
const std::vector< AliEmcalCorrectionComponent * > & CorrectionComponents()
AliClusterContainer * GetClusterContainer(const char *name) const
static AliEmcalCorrectionTask * AddTaskEmcalCorrectionTask(TString suffix="")
void SetCells(AliVCaloCells *cells)
Sets the Pointer to the actual CaloCells object.
Double_t fCent
! Event centrality
void CreateInputObjects(AliEmcalContainerUtils::InputObject_t inputObjectType)
Base class for correction components in the EMCal correction framework.
void SetUseNewCentralityEstimation(Bool_t b)
BeamType
Switch for the beam type.
AliEmcalCorrectionCellContainer(std::string branchName, std::string name, std::string branchToCopyName, bool isEmbedded)
friend std::ostream & operator<<(std::ostream &in, const AliEmcalCorrectionTask &myTask)
Bool_t fNeedEmcalGeom
whether or not the task needs the emcal geometry
static const std::map< std::string, AliEmcalTrackSelection::ETrackFilterType_t > fgkTrackFilterTypeMap
Relates string to the track filter enumeration for YAML configuration.
std::string GetBranchName() const
Get the name of the cells branch (NOT the same as the name!)
PWG::Tools::AliYAMLConfiguration & GetYAMLConfiguration()
Retrieve the YAML configurations for direct access.
void SetCellsObjectInCellContainerBasedOnProperties(AliEmcalCorrectionCellContainer *cellContainer)
Bool_t fUseNewCentralityEstimation
Use new centrality estimation (for 2015 data)
bool GetIsEmbedding() const
True if the cells are located in the event that is being embedded.
AliEmcalCorrectionCellContainer * GetCellContainer(const std::string &cellsContainerName) const
std::string fDefaultConfigurationFilename
! Default YAML configuration filename
TObjArray fParticleCollArray
Particle/track collection array.
TObjArray fClusterCollArray
Cluster collection array.
AliClusterContainer * AddClusterContainer(const char *n)
AliMCParticleContainer * GetMCParticleContainer(Int_t i=0) const
void SetCentRange(Double_t min, Double_t max)
void AdoptTrackContainer(AliTrackContainer *cont)
YAML configuration class for AliPhysics.
void AdoptParticleContainer(AliParticleContainer *cont)
AliParticleContainer * AddParticleContainer(const char *n)
std::string fName
Name of the cells object.
AliEmcalCorrectionComponent * GetCorrectionComponent(const std::string &name) const
void SetIsEmbedding(bool isEmbedded)
Set to true if the cells are located in the event that is being embedded.
BeamType fBeamType
! Event beam type
std::string toString(bool includeYAMLConfigurationInfo=false) const
std::ostream & PrintConfiguration(std::ostream &in, bool userConfig=false) const
const char Option_t
Definition: External.C:48
void Print(Option_t *opt="") const
Int_t fNVertCont
! Event vertex number of contributors
void RemoveParticleContainer(Int_t i=0)
void SetName(std::string name)
Set the name of the cells object (NOT the same as the branch!)
bool Bool_t
Definition: External.C:53
Int_t fCentBin
! Event centrality bin
void AdoptMCParticleContainer(AliMCParticleContainer *cont)
void SetupContainersFromInputNodes(AliEmcalContainerUtils::InputObject_t inputObjectType, std::set< std::string > &requestedContainers)
Double_t fMinCent
min centrality for event selection
std::vector< AliEmcalCorrectionCellContainer * > fCellCollArray
Cells collection array.
Container structure for EMCAL clusters.
Container for MC-true particles within the EMCAL framework.
void AddContainersToComponent(AliEmcalCorrectionComponent *component, AliEmcalContainerUtils::InputObject_t inputObjectType, bool checkObjectExists=false)
void Initialize(bool removeDummyTask=false)
AliParticleContainer * GetParticleContainer(const char *name) const
AliMCParticleContainer * AddMCParticleContainer(const char *n)
BeamType fForceBeamType
forced beam type