/* This file is part of MAUS: http://micewww.pp.rl.ac.uk/projects/maus * * MAUS is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * MAUS is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MAUS. If not, see . */ #ifndef _SRC_COMMON_CPP_DATASTRUCTURE_CUTS_ #define _SRC_COMMON_CPP_DATASTRUCTURE_CUTS_ #include #include #include #include #include "src/common_cpp/Utils/VersionNumber.hh" namespace MAUS { class Cuts { public: /** Default constructor */ Cuts(); /** Copy constructor - Makes copy of member data (md) to object Cuts. */ Cuts(const Cuts &_cuts_data); /** Copy assignment operator */ Cuts& operator=(const Cuts& _cuts_data); /** Destructor */ virtual ~Cuts(); /** Returns cut vector */ std::vector GetCutStore() const; /** Indexes the cut variable to be returned - returns True if the event has passed the cut (outside acceptance) * and False if failed (within acceptance). */ bool GetWillCut(int cut_variable); /** Names the cut variable to be returned - returns True if the event has passed the cut (outside acceptance) * and False if failed (within acceptance). */ bool GetWillCut(std::string cut_variable); /** User sets (somewhere in main) all cut values and stores in a vector. */ void SetCutStore(std::vector cut_store); /** Names the cut variable to be returned - will_cut sets the value of the cut. */ void SetWillCut(std::string cut_variable, bool will_cut); /** Indexes the cut variable to be returned - will_cut sets the value of the cut. */ void SetWillCut(int cut_variable, bool will_cut); /** return_name_func returns readable string for a given integer cut variable. */ static std::string VariableName(int cut_variable); /** return_index_func returns the index to the user for a given cut name variable. */ static int VariableIndex(std::string cut_variable); /** Mapper functions */ static std::map Init_map_to_int(); static std::map Init_map_to_name(); private: /** Vector that stores the cut values as booleans. */ std::vector _cut_store; /** Mappers that map to a name/int to an int/name respectively. */ static std::map map_to_int; static std::map map_to_name; /** Raises exception if cut_variable is an invalid name or has an invalid index. */ static bool errorindex(std::map , int); static bool errorname(std::map , std::string); MAUS_VERSIONED_CLASS_DEF(Cuts) }; } // ~ namespace MAUS #endif // _SRC_COMMON_CPP_DATASTRUCTURE_CUTS_