HighLAND
CorrectionBase.hxx
1 #ifndef CorrectionBase_h
2 #define CorrectionBase_h
3 
4 #include <TObject.h>
5 #include "CoreDataClasses.hxx"
6 
7 /// This is the base class that all corrections should inherit.
8 /// They change information contained in the current AnaSpill.
9 ///
10 /// A correction fixes some aspect of the AnaSpill that is deemed incorrect.
11 /// The correction is only applied once per spill. The correction should
12 /// work on the input().GetCorrectedSpill() version of the spill.
13 
14 /// All corrections should be registered with the CorrectionManager.
15 class CorrectionBase: public TObject{
16 
17 public:
18 
20 
21  /// Copy constructor
22  CorrectionBase(const CorrectionBase& corr);
23 
24  /// Everyone should have a destructor.
25  virtual ~CorrectionBase() {}
26 
27  //----------------------------------------------------------------
28  /// This is the function that applies the correction to the input data.
29  /// This MUST be overridden in the derived class.
30  virtual void Apply(AnaSpillC& spill){(void)spill;}
31  //----------------------------------------------------------------
32 
33  /// Return the name of this correction. This overrides the TObject::GetName() interface.
34  virtual const char* GetName() const {return _name.c_str();}
35 
36  /// Return the name of this correction.
37  const std::string& Name() const {return _name;}
38 
39  /// Set the name of this correction.
40  void SetName(const std::string& name) {_name = name;}
41 
42  /// Enable the correction
43  void Enable(){_enabled=true;}
44 
45  /// Disable the correction
46  void Disable(){_enabled=false;}
47 
48  /// Is the correction enabled
49  bool IsEnabled() const {return _enabled;}
50 
51  /// Set the correction as applied in the input file
52  void SetAppliedInInput(bool ap) {_appliedInInput=ap;}
53 
54  /// Is the correction already applied in the input file ?
55  bool IsAppliedInInput() const {return _appliedInInput;}
56 
57  /// Return the index of this correction
58  Int_t GetIndex() const {return _index;}
59 
60  /// Set the index of this correction
61  void SetIndex(Int_t index) {_index = index;}
62 
63 
64  ClassDef(CorrectionBase, 2);
65 
66 protected:
67 
68  /// The name of this correction.
69  std::string _name;
70 
71  /// Is the correction enabled?
72  bool _enabled;
73 
74  /// Is the correction already applied in the input file ?
76 
77  /// The index of the correction
78  Int_t _index;
79 };
80 
81 #endif
bool _appliedInInput
Is the correction already applied in the input file ?
Int_t _index
The index of the correction.
void Enable()
Enable the correction.
void SetName(const std::string &name)
Set the name of this correction.
virtual const char * GetName() const
Return the name of this correction. This overrides the TObject::GetName() interface.
const std::string & Name() const
Return the name of this correction.
All corrections should be registered with the CorrectionManager.
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.
bool IsEnabled() const
Is the correction enabled.
virtual void Apply(AnaSpillC &spill)
std::string _name
The name of this correction.
bool _enabled
Is the correction enabled?
bool IsAppliedInInput() const
Is the correction already applied in the input file ?
virtual ~CorrectionBase()
Everyone should have a destructor.