HighLAND
SystematicBase.hxx
1 #ifndef SystematicBase_h
2 #define SystematicBase_h
3 
4 #include "CoreDataClasses.hxx"
5 #include "ToyVariations.hxx"
6 #include "SelectionBase.hxx"
7 //#include "SystId.hxx"
8 #include "SystBoxB.hxx"
9 #include "CoreUtils.hxx"
10 
11 
12 /// This is the base class that all systematics should inherit from.
13 /// - Variation: modify some aspect of the input data. The selection needs to be redone
14 /// in general. This is what we call Toy Experiments
15 /// - Weight: A weight for the event is calculated, which depends on the event properties, but no variation on the event is
16 /// performed. Selection does not have to be redone
17 ///
18 
19 class SystematicBase: public TObject{
20 
21 public:
22 
23  /// Enumerator describing the values that _type member can take.
24  enum TypeEnum {
25  kVariation = 0,
26  kWeight,
27  kFlux,
28  kUnknown
29  }; //!
30 
31  /// Enumerator describing the values that _PDF member can take.
32 
33  enum PDFEnum {
34  kGaussian = 0,
35  kUniform,
36  kBinomial,
37  kMultinomial,
38  kUnknownPDF
39  }; //!
40 
41  /// Create the systematic, with one parameter
43 
44  /// Create the systematic, specifying the number of systematic parameters
45  SystematicBase(UInt_t npar);
46 
47  /// Everyone should have a destructor.
48  virtual ~SystematicBase() {}
49 
50  /// Returns the number of systematic parameters associated to this systematic
51  UInt_t GetNParameters() const {return _nParameters;}
52 
53  /// Set the number of systematic parameters associated to this systematic
54  void SetNParameters(int N){_nParameters=N;}
55 
56  /// Return the name of this systematic. This overrides the TObject::GetName() interface.
57  virtual const char* GetName() const {return _name.c_str();}
58 
59  /// Return the name of this systematic.
60  const std::string& Name() const {return _name;}
61 
62  /// Set the name of this systematic.
63  void SetName(const std::string& name) {_name = name;}
64 
65  /// Return the index of this systematic.
66  Int_t GetIndex() const {return _index;}
67 
68  /// Set the index of this systematic.
69  void SetIndex(Int_t index) {_index = index;}
70 
71  /// Return the type of this systematic.
72  TypeEnum Type() const {return _type;}
73 
74  /// Return the type of this systematic.
75  std::string ConvertType();
76 
77  /// Set the type of this systematic.
78  void SetType(TypeEnum type) {_type = type;}
79 
80  /// Return the PDF of this systematic.
81  PDFEnum PDF() const {return _PDF;}
82 
83  /// Return the PDF of this systematic.
84  std::string ConvertPDF();
85 
86  /// Set the PDF of this systematic.
87  void SetPDF(PDFEnum PDF) {_PDF = PDF;}
88 
89  /// Set the enable bit
90  void SetEnabled(bool ena) {_enabled = ena;}
91 
92  /// Returns the enable bit
93  bool IsEnabled() const {return _enabled;}
94 
95  /// Delete the SystBox for this event
96  virtual void FinalizeEvent(const AnaEventC& event);
97 
98  /// Get the SystBox corresponding to a selection, branch and event
99  SystBoxB* GetSystBox(const AnaEventC& event, Int_t isel=0, Int_t ibranch=0) const;
100 
101  /// Create the array of SystBox
102  virtual void Initialize(Int_t nsel, Int_t isel, Int_t nbranch, Int_t nevents);
103 
104  ClassDef(SystematicBase, 2);
105 
106 protected:
107 
108  /// The name of this systematic.
109  std::string _name;
110 
111  /// The index of this systematic (needed by SystematicsManager);
112  Int_t _index;
113 
114  /// The type of this systematic (variation, weight or flux)
116 
117  /// Is this systematic enabled ?
118  bool _enabled;
119 
120  /// The PDF use for the systematic parameter scan
122 
123  /// the number of systematic parameters
124  UInt_t _nParameters;
125 
126 protected:
127 
128  ///---------- Relevant objects for this systematic ------------------
129 
130  /// The triple array of SystBox (selection:branch:event)
132 
133  // Keep the size of the previous array. TODO: Need a better way of doing this
134  Int_t _systBoxesNSel; //!
135  Int_t _systBoxesNBranches[NMAXSELECTIONS]; //!
136  Int_t _systBoxesNEvents[NMAXSELECTIONS][NMAXBRANCHES]; //!
137 
138 };
139 
140 #endif
void SetEnabled(bool ena)
Set the enable bit.
Int_t _index
The index of this systematic (needed by SystematicsManager);.
UInt_t _nParameters
the number of systematic parameters
Int_t GetIndex() const
Return the index of this systematic.
TypeEnum Type() const
Return the type of this systematic.
SystBoxB * GetSystBox(const AnaEventC &event, Int_t isel=0, Int_t ibranch=0) const
Get the SystBox corresponding to a selection, branch and event.
void SetNParameters(int N)
Set the number of systematic parameters associated to this systematic.
virtual void Initialize(Int_t nsel, Int_t isel, Int_t nbranch, Int_t nevents)
Create the array of SystBox.
PDFEnum _PDF
The PDF use for the systematic parameter scan.
PDFEnum PDF() const
Return the PDF of this systematic.
TypeEnum
Enumerator describing the values that _type member can take.
virtual void FinalizeEvent(const AnaEventC &event)
Delete the SystBox for this event.
PDFEnum
Enumerator describing the values that _PDF member can take.
void SetName(const std::string &name)
Set the name of this systematic.
virtual ~SystematicBase()
Everyone should have a destructor.
bool IsEnabled() const
Returns the enable bit.
TypeEnum _type
The type of this systematic (variation, weight or flux)
void SetType(TypeEnum type)
Set the type of this systematic.
void SetIndex(Int_t index)
Set the index of this systematic.
const std::string & Name() const
Return the name of this systematic.
bool _enabled
Is this systematic enabled ?
std::string ConvertType()
Return the type of this systematic.
std::string _name
The name of this systematic.
SystBoxB **** _systBoxes
----—— Relevant objects for this systematic ------------——
UInt_t GetNParameters() const
Returns the number of systematic parameters associated to this systematic.
void SetPDF(PDFEnum PDF)
Set the PDF of this systematic.
virtual const char * GetName() const
Return the name of this systematic. This overrides the TObject::GetName() interface.
SystematicBase()
Create the systematic, with one parameter.
std::string ConvertPDF()
Return the PDF of this systematic.