HighLAND
EventVariationManager.hxx
1 #ifndef EventVariationManager_h
2 #define EventVariationManager_h
3 
4 #include "EventVariationBase.hxx"
5 #include "SelectionManager.hxx"
6 #include "TString.h"
7 #include "ToyExperiment.hxx"
8 
9 /// The maximum number of EventVariations that is supported.
10 const UInt_t NMAXEVENTVARIATIONS=100;
11 
12 /// Manager for EventVariations
13 /// This manager handles the registration, enabling and disabling of the
14 /// EventVariations.
16 
17 public:
18 
20  virtual ~EventVariationManager();
21 
22  /// Apply all EventVariations
23  void ApplyEventVariations(const ToyExperiment& toy, AnaEventC& event);
24 
25  /// Undo the event variation (Undo the variation, that is, go back to the previous values of modified observables)
26  bool UndoEventVariations(AnaEventC& event);
27 
28  /// Get the EventVariation registered with the given name.
29  EventVariationBase* GetEventVariation(const std::string& name) const;
30 
31  /// Get the EventVariation registered with the given index.
32  EventVariationBase* GetEventVariation(Int_t index) const;
33 
34  /// Get the index of a EventVariation registered with the given name.
35  Int_t GetEventVariationIndex(const std::string& name);
36 
37  /// Get the vector of EventVariations
38  std::vector<EventVariationBase*>& GetEventVariations(){return _eventVariations;}
39 
40  /// Get the vector containing EventVariations with specific indices
41  std::vector<EventVariationBase*> GetEventVariations(const std::vector<Int_t>& indices) const;
42 
43  /// Enable the EventVariation registered with the given index
44  void EnableEventVariation(Int_t index);
45 
46  /// Disable the EventVariation registered with the given index
47  void DisableEventVariation(Int_t index);
48 
49  /// Enable the EventVariations registered with the given indices
50  void EnableEventVariations(const std::vector<Int_t>& systs);
51 
52  /// Disable the EventVariations registered with the given indices
53  void DisableEventVariations(const std::vector<Int_t>& systs);
54 
55  /// Disable all eventVariations
57 
58  /// Enable all EventVariation eventVariations
60 
61  /// Add a new Event Variation provided its index in the manager and a pointer to it
62  void AddEventVariation(Int_t index, EventVariationBase* sys);
63 
64  /// Add a new Event Variation provided its index in the manager, its name and a pointer to it
65  void AddEventVariation(Int_t index, const std::string& name, EventVariationBase* sys);
66 
67  /// Replace one of the existing EventVariationBase
68  void ReplaceEventVariation(Int_t index, EventVariationBase* sys);
69 
70  /// Fill the SystBox for the enabled EventVariations
71  void InitializeEvent(SelectionManager& sel, AnaEventC& event);
72 
73  /// Delete the SystBox for all EventVariations
74  void FinalizeEvent(AnaEventC& event);
75 
76  // Create the arrays of SystBox's
77  void Initialize(Int_t nevents);
78 
79  /// Is there any EventVariation added ?
80  bool HasEventVariations() const {return (_eventVariations.size()!=0);}
81 
82  /// Returns the number of EventVariations
83  UInt_t GetNEventVariations() const {return _eventVariations.size();}
84 
85  /// Returns the vector of indices for all enabled EventVariations
86  const Int_t* GetEnabledEventVariations(int& nSys){
87  nSys = _nEventVariationsEnabled;
89  }
90 
91  /// Returns the number of enabled EventVariations
92  UInt_t GetNEnabledEventVariations(){ return _nEventVariationsEnabled;}
93 
94  /// Dump all eventVariations
95  void DumpEventVariations();
96 
97  /// Check if an EventVariation with a given name already exists in the manager
98  bool HasEventVariation(const std::string& name);
99 
100 protected:
101 
102  /// The systematics that were registered as eventVariations.
103  std::vector<EventVariationBase*> _eventVariations;
104 
105  /// The systematics that were registered as eventVariations.
106  std::vector<EventVariationBase*> _eventVariationsWithNull;
107 
108  /// The variation systematics that are enabled
109  Int_t _eventVariationsEnabled[NMAXEVENTVARIATIONS];
110  int _nEventVariationsEnabled;
111 };
112 
113 #endif
bool HasEventVariations() const
Is there any EventVariation added ?
UInt_t GetNEventVariations() const
Returns the number of EventVariations.
std::vector< EventVariationBase * > & GetEventVariations()
Get the vector of EventVariations.
void DumpEventVariations()
Dump all eventVariations.
bool HasEventVariation(const std::string &name)
Check if an EventVariation with a given name already exists in the manager.
Int_t _eventVariationsEnabled[NMAXEVENTVARIATIONS]
The variation systematics that are enabled.
EventVariationBase * GetEventVariation(const std::string &name) const
Get the EventVariation registered with the given name.
UInt_t GetNEnabledEventVariations()
Returns the number of enabled EventVariations.
void DisableEventVariations(const std::vector< Int_t > &systs)
Disable the EventVariations registered with the given indices.
void DisableAllEventVariations()
Disable all eventVariations.
void ReplaceEventVariation(Int_t index, EventVariationBase *sys)
Replace one of the existing EventVariationBase.
void InitializeEvent(SelectionManager &sel, AnaEventC &event)
Fill the SystBox for the enabled EventVariations.
void EnableAllEventVariations()
Enable all EventVariation eventVariations.
const Int_t * GetEnabledEventVariations(int &nSys)
Returns the vector of indices for all enabled EventVariations.
bool UndoEventVariations(AnaEventC &event)
Undo the event variation (Undo the variation, that is, go back to the previous values of modified obs...
void AddEventVariation(Int_t index, EventVariationBase *sys)
Add a new Event Variation provided its index in the manager and a pointer to it.
std::vector< EventVariationBase * > _eventVariations
The systematics that were registered as eventVariations.
void ApplyEventVariations(const ToyExperiment &toy, AnaEventC &event)
Apply all EventVariations.
void FinalizeEvent(AnaEventC &event)
Delete the SystBox for all EventVariations.
void EnableEventVariations(const std::vector< Int_t > &systs)
Enable the EventVariations registered with the given indices.
std::vector< EventVariationBase * > _eventVariationsWithNull
The systematics that were registered as eventVariations.
void EnableEventVariation(Int_t index)
Enable the EventVariation registered with the given index.
void DisableEventVariation(Int_t index)
Disable the EventVariation registered with the given index.
Int_t GetEventVariationIndex(const std::string &name)
Get the index of a EventVariation registered with the given name.