HighLAND
CorrectionManager.hxx
1 #ifndef CorrectionManager_h
2 #define CorrectionManager_h
3 
4 #include "CorrectionBase.hxx"
5 #include "HLClonesArray.hxx"
6 
7 /// The maximum number of corrections that is supported.
8 const UInt_t NMAXCORRECTIONS = 20;
9 
10 
11 /// Manager for Corrections. An Correction modifies a particular aspect
12 /// of the Input data. This is used for calculating systematics and applying
13 /// corrections.
14 ///
15 /// This manager handles the registration, enabling and disabling of the
16 /// corrections.
18 
19 public:
20 
22  virtual ~CorrectionManager();
23 
24  /// Apply all corrections
25  void ApplyCorrections(AnaSpillC& spill);
26 
27  /// Get the input correction registered with the given index
28  CorrectionBase* GetCorrection(Int_t index);
29 
30  /// Enable the correction registered with the given index for the
31  /// specified configuration. (if conf=="" for all configs)
32  void EnableCorrection(Int_t index);
33 
34  /// Disable the correction registered with the given index for the
35  /// specified configuration.
36  void DisableCorrection(Int_t index);
37 
38  /// Check if a particular correction is enabled in a given configuration.
39  bool IsEnabled(Int_t index);
40 
41 
42  /// Get the input correction registered with the given name.
43  CorrectionBase* GetCorrection(const std::string& name);
44 
45  /// Enable the correction registered with the given name for the
46  /// specified configuration. (if conf=="" for all configs)
47  void EnableCorrection(const std::string& corr);
48 
49  /// Disable the correction registered with the given name for the
50  /// specified configuration.
51  void DisableCorrection(const std::string& corr);
52 
53  /// Check if a particular correction is enabled in a given configuration.
54  bool IsEnabled(const std::string& corr);
55 
56 
57  /// Disable all corrections in a given configuration (if conf=="" for all confs)
58  void DisableAllCorrections();
59 
60  /// Register an Correction as a correction. These will only be applied
61  /// once per spill.
62  void AddCorrection(Int_t index, const std::string& name, CorrectionBase* corr);
63 
64  /// This is for bwd compatibility and will be removed when approved
65  void AddCorrection(const std::string& name, CorrectionBase* corr){
66  AddCorrection(-1, name, corr);
67  }
68 
69  /// If set to true corrections applied in the input file are applied again
70  void SetForceApplyCorrections(bool force) {_forceApplyCorrections=force;}
71 
72  /// Readthe corrections from a file
73  void ReadCorrections(const std::string& file, bool input=false);
74 
75  /// Dump all corrections
76  void DumpCorrections();
77 
78  protected:
79 
80 
81  /// Reset the corrections data
82  void Reset();
83 
84  /// The registered corrections, and the names they were registered with.
85  std::vector<CorrectionBase*> _corrections;
86 
87  // std::vector<CorrectionBase*> _corrections_write;
88 
89  // By default corrections applied in the input file are not applied again
90  bool _forceApplyCorrections;
91 };
92 
93 #endif
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 DisableCorrection(Int_t index)
std::vector< CorrectionBase * > _corrections
The registered corrections, and the names they were registered with.
void AddCorrection(const std::string &name, CorrectionBase *corr)
This is for bwd compatibility and will be removed when approved.
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 EnableCorrection(Int_t index)
void ApplyCorrections(AnaSpillC &spill)
Apply all corrections.
void SetForceApplyCorrections(bool force)
If set to true corrections applied in the input file are applied again.
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.