1 #include "CorrectionManager.hxx" 5 CorrectionManager::CorrectionManager():
HLClonesArray(
"config",
"CORR",
"CorrectionBase", NMAXCORRECTIONS) {
9 _forceApplyCorrections =
false;
17 CorrectionManager::~CorrectionManager() {
19 for (std::vector<CorrectionBase*>::iterator it = _corrections.begin(); it != _corrections.end(); it++) {
32 for (std::vector<CorrectionBase*>::iterator it = _corrections.begin(); it != _corrections.end(); it++) {
34 if ((*it)->IsEnabled()){
45 for (std::vector<CorrectionBase*>::iterator it = _corrections.begin(); it != _corrections.end(); it++) {
68 #pragma message("CorrectionManager::AddCorrection Name usage should be removed once approved!!!") 72 corr2 = GetCorrection(name);
74 if (corr2 && !_forceApplyCorrections){
83 _corrections.push_back(corr);
93 for (std::vector<CorrectionBase*>::iterator it = _corrections.begin(); it != _corrections.end(); it++) {
95 if ((*it)->Name() == name)
return *it;
132 if (index < 0 || (UInt_t)index > NMAXCORRECTIONS - 1)
return NULL;
133 return _corrections[index];
168 _corrections.clear();
169 ReadClonesArray(file);
172 for (
int i = 0; i < _NObjects; i++){
174 assert(_corrections.size() < NMAXCORRECTIONS);
175 _corrections.push_back(corr);
193 _corrections.clear();
195 _corrections.resize(NMAXCORRECTIONS);
196 _corrections.assign(_corrections.size(),NULL);
204 std::cout <<
" -------- List of Corrections -----------------------------------" << std::endl;
206 sprintf(out,
"%3s: %-3s %-25s %-15s %-20s",
"#",
"index",
"name",
"enabled",
"applied in input");
207 std::cout << out <<
"\n" << std::endl;
209 for (
int i = 0; i < _NObjects; i++){
213 std::cout << out << std::endl;
215 std::cout <<
" -----------------------------------------------------------------" << std::endl;
void DisableAllCorrections()
Disable all corrections in a given configuration (if conf=="" for all confs)
void Enable()
Enable the correction.
void SetName(const std::string &name)
Set the name of this correction.
void AddCorrection(Int_t index, const std::string &name, CorrectionBase *corr)
const std::string & Name() const
Return the name of this correction.
void DisableCorrection(Int_t index)
void Reset()
Reset the corrections data.
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.
void SetAppliedInInput(bool ap)
Set the correction as applied in the input file.
Int_t GetIndex() const
Return the index of this correction.
void EnableCorrection(Int_t index)
bool IsEnabled() const
Is the correction enabled.
void ApplyCorrections(AnaSpillC &spill)
Apply all corrections.
bool IsAppliedInInput() const
Is the correction already applied in the input file ?
bool IsEnabled(Int_t index)
Check if a particular correction is enabled in a given configuration.
void DumpCorrections()
Dump all corrections.
void ReadCorrections(const std::string &file, bool input=false)
Readthe corrections from a file.