1 #include "EventVariationManager.hxx" 2 #include "MultiThread.hxx" 6 EventVariationManager::EventVariationManager(){
9 _nEventVariationsEnabled = 0;
18 EventVariationManager::~EventVariationManager() {
27 void EventVariationManager::Initialize(Int_t nevents) {
60 if (!selec->IsEnabled())
continue;
71 std::vector<EventVariationBase*> systematics;
72 for (UInt_t i=0;i<indices.size();i++)
82 if (index<0 || (UInt_t)index> NMAXEVENTVARIATIONS-1)
return NULL;
118 for (
int j = 0; j < _nEventVariationsEnabled; ++j){
146 if (syst->
Type() == EventVariationBase::kVariation){
148 _nEventVariationsEnabled++;
160 if (syst->
Type() == EventVariationBase::kVariation){
161 for (Int_t it = 0; it < _nEventVariationsEnabled;it++){
163 for(
int j = it; j < _nEventVariationsEnabled - 1; ++j){
166 _nEventVariationsEnabled--;
177 for (std::vector<Int_t>::const_iterator it=indices.begin();it!=indices.end();it++){
186 for (std::vector<Int_t>::const_iterator it=indices.begin();it!=indices.end();it++){
195 _nEventVariationsEnabled = 0;
199 _nEventVariationsEnabled++;
210 _nEventVariationsEnabled = 0;
226 std::cout <<
"EventVariationManager::AddEventVariation(). '" << index <<
"' already added !!!" <<std::endl;
250 std::cout <<
"EventVariationManager::ReplaceEventVariation(). '" << index <<
"' does not exist !!!" <<std::endl;
261 std::cout <<
" -------- List of EventVariations ---------------" << std::endl;
263 sprintf(out,
"%3s: %-25s %-15s %-4s",
"#",
"name",
"pdf",
"NPar");
264 std::cout << out <<
"\n" << std::endl;
270 std::cout << out << std::endl;
274 std::cout <<
" --------------------------------------------------" << std::endl;
void SetEnabled(bool ena)
Set the enable bit.
TypeEnum Type() const
Return the type of this systematic.
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.
std::vector< SelectionBase * > & GetSelections()
Return the map of selections.
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 SetName(const std::string &name)
Set the name of this systematic.
void InitializeEvent(SelectionManager &sel, AnaEventC &event)
Fill the SystBox for the enabled EventVariations.
void EnableAllEventVariations()
Enable all EventVariation eventVariations.
bool UndoEventVariations(AnaEventC &event)
Undo the event variation (Undo the variation, that is, go back to the previous values of modified obs...
void SetIndex(Int_t index)
Set the index of this systematic.
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.