HighLAND
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CorrectionManager Class Reference

#include <CorrectionManager.hxx>

Inheritance diagram for CorrectionManager:
HLClonesArray

Public Member Functions

void ApplyCorrections (AnaSpillC &spill)
 Apply all corrections.
 
CorrectionBaseGetCorrection (Int_t index)
 Get the input correction registered with the given index.
 
void EnableCorrection (Int_t index)
 
void DisableCorrection (Int_t index)
 
bool IsEnabled (Int_t index)
 Check if a particular correction is enabled in a given configuration.
 
CorrectionBaseGetCorrection (const std::string &name)
 Get the input correction registered with the given name.
 
void EnableCorrection (const std::string &corr)
 
void DisableCorrection (const std::string &corr)
 
bool IsEnabled (const std::string &corr)
 Check if a particular correction is enabled in a given configuration.
 
void DisableAllCorrections ()
 Disable all corrections in a given configuration (if conf=="" for all confs)
 
void AddCorrection (Int_t index, const std::string &name, CorrectionBase *corr)
 
void AddCorrection (const std::string &name, CorrectionBase *corr)
 This is for bwd compatibility and will be removed when approved.
 
void SetForceApplyCorrections (bool force)
 If set to true corrections applied in the input file are applied again.
 
void ReadCorrections (const std::string &file, bool input=false)
 Readthe corrections from a file.
 
void DumpCorrections ()
 Dump all corrections.
 
- Public Member Functions inherited from HLClonesArray
 HLClonesArray (const std::string &tree_name, const std::string &tcarray_name, const std::string &class_name, const UInt_t size)
 
void ReadClonesArray (const std::string &file)
 
void WriteClonesArray (TTree &tree)
 
Int_t & GetNObjects ()
 Return the number of steps that have been added.
 
TClonesArray * GetClonesArray ()
 
const std::string & GetClonesArrayName () const
 Return the name of the TClonesArray.
 
const std::string & GetTreeName () const
 Return the name of the tree.
 

Protected Member Functions

void Reset ()
 Reset the corrections data.
 

Protected Attributes

std::vector< CorrectionBase * > _corrections
 The registered corrections, and the names they were registered with.
 
bool _forceApplyCorrections
 
- Protected Attributes inherited from HLClonesArray
TChain * _chain
 TChain used to read the "config" tree from the output file.
 
Int_t _NObjects
 The number of steps that were added.
 
TClonesArray * _objects
 
std::string _tcArrayName
 Name of the TClonesArray in the tree.
 
std::string _treeName
 Name of the Tree.
 
std::string _fileName
 Name of the last file read.
 

Detailed Description

Manager for Corrections. An Correction modifies a particular aspect of the Input data. This is used for calculating systematics and applying corrections.

This manager handles the registration, enabling and disabling of the corrections.

Definition at line 17 of file CorrectionManager.hxx.

Member Function Documentation

§ AddCorrection()

void CorrectionManager::AddCorrection ( Int_t  index,
const std::string &  name,
CorrectionBase corr 
)

Register an Correction as a correction. These will only be applied once per spill.

Definition at line 53 of file CorrectionManager.cxx.

53  {
54  //***********************************************************
55 
56  // When running over a FlatTree corrections may already exist in it.
57  // It that case the correction is already present in the manager
58  // (corrections are first read from the input file) and it has to be set as
59  // "appliedInInput" and "disabled", such that it is not applied twice.
60  // Some corrections may exit in the input file but as disabled. This case
61  // is also taken into account: the correction is not added again but it is stored
62  // with the proper settings
63  corr->SetName(name);
64  corr->SetIndex(index);
65  CorrectionBase* corr2 = NULL;
66  //CorrectionBase* corr2 = GetCorrection(index);
67 
68 #pragma message("CorrectionManager::AddCorrection Name usage should be removed once approved!!!")
69 
70  // TMP: try name for bwd compatibility
71  if (!corr2)
72  corr2 = GetCorrection(name);
73 
74  if (corr2 && !_forceApplyCorrections){
75  if(corr2->IsAppliedInInput())
76  corr2->Disable();
77  else{
78  if (corr->IsEnabled()) corr2->Enable();
79  else corr2->Disable();
80  }
81  }
82  else{
83  _corrections.push_back(corr);
84  CorrectionBase* corr2 = new((*_objects)[_NObjects++]) CorrectionBase(*corr);
85  (void)corr2;
86  }
87 }
void Enable()
Enable the correction.
void SetName(const std::string &name)
Set the name of this correction.
std::vector< CorrectionBase * > _corrections
The registered corrections, and the names they were registered with.
All corrections should be registered with the CorrectionManager.
CorrectionBase * GetCorrection(Int_t index)
Get the input correction registered with the given index.
void Disable()
Disable the correction.
void SetIndex(Int_t index)
Set the index of this correction.
bool IsEnabled() const
Is the correction enabled.
Int_t _NObjects
The number of steps that were added.
bool IsAppliedInInput() const
Is the correction already applied in the input file ?

§ DisableCorrection() [1/2]

void CorrectionManager::DisableCorrection ( Int_t  index)

Disable the correction registered with the given index for the specified configuration.

Definition at line 155 of file CorrectionManager.cxx.

155  {
156  //***********************************************************
157 
158  CorrectionBase* corr = GetCorrection(index);
159  if (corr) corr->Disable();
160 }
All corrections should be registered with the CorrectionManager.
CorrectionBase * GetCorrection(Int_t index)
Get the input correction registered with the given index.
void Disable()
Disable the correction.

§ DisableCorrection() [2/2]

void CorrectionManager::DisableCorrection ( const std::string &  corr)

Disable the correction registered with the given name for the specified configuration.

Definition at line 120 of file CorrectionManager.cxx.

120  {
121  //***********************************************************
122 
123  CorrectionBase* corr = GetCorrection(name);
124  if (corr) corr->Disable();
125 }
All corrections should be registered with the CorrectionManager.
CorrectionBase * GetCorrection(Int_t index)
Get the input correction registered with the given index.
void Disable()
Disable the correction.

§ EnableCorrection() [1/2]

void CorrectionManager::EnableCorrection ( Int_t  index)

Enable the correction registered with the given index for the specified configuration. (if conf=="" for all configs)

Definition at line 147 of file CorrectionManager.cxx.

147  {
148  //***********************************************************
149 
150  CorrectionBase* corr = GetCorrection(index);
151  if (corr) corr->Enable();
152 }
void Enable()
Enable the correction.
All corrections should be registered with the CorrectionManager.
CorrectionBase * GetCorrection(Int_t index)
Get the input correction registered with the given index.

§ EnableCorrection() [2/2]

void CorrectionManager::EnableCorrection ( const std::string &  corr)

Enable the correction registered with the given name for the specified configuration. (if conf=="" for all configs)

Definition at line 112 of file CorrectionManager.cxx.

112  {
113  //***********************************************************
114 
115  CorrectionBase* corr = GetCorrection(name);
116  if (corr) corr->Enable();
117 }
void Enable()
Enable the correction.
All corrections should be registered with the CorrectionManager.
CorrectionBase * GetCorrection(Int_t index)
Get the input correction registered with the given index.

The documentation for this class was generated from the following files: