18 #include "cetlib_except/exception.h" 51 const std::string& config)
const 56 <<
"EvtTimeShiftFactory::GetEvtTimeShift rwh name --->" 57 << name <<
"<--- \n config -->" << config <<
"<---" << std::endl;
60 std::string nameLocal = name;
61 std::string configLocal =
"";
62 if( nameLocal.find_first_not_of(
" \t\n") != 0 )
63 nameLocal.erase( 0, nameLocal.find_first_not_of(
" \t\n") );
66 size_t iws = nameLocal.find_first_of(
" \t\n");
67 if ( iws != std::string::npos ) {
68 configLocal = nameLocal.substr(iws,std::string::npos);
70 nameLocal.erase(iws,std::string::npos);
72 configLocal += config;
75 <<
"EvtTimeShiftFactory::GetEvtTimeShift rwh name --->" 76 << nameLocal <<
"<--- \n config -->" << configLocal <<
"<---" << std::endl;
85 p = (*foo)(configLocal);
89 <<
"### EvtTimeShiftFactory WARNING: " 90 <<
"EvtTimeShiftI class \"" << nameLocal <<
"\" is not known" << std::endl;
93 <<
"EvtTimeShiftI class \"" << nameLocal <<
"\" is not known" << std::endl;
108 const std::vector<std::string>&
125 std::ostringstream msg;
126 msg <<
"EvtTimeShiftFactory list of known EvtTimeShiftI classes: \n";
129 for (
size_t i=0; i < known.size(); ++i) {
130 msg <<
" [" << std::setw(2) << i <<
"] " << known[i] << std::endl;
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
static EvtTimeShiftFactory * fgTheInstance
bool IsKnownEvtTimeShift(const std::string &)
const std::vector< std::string > & AvailableEvtTimeShift() const
interface for event time distribution
virtual ~EvtTimeShiftFactory()
std::map< std::string, EvtTimeShiftICtorFuncPtr_t > fFunctionMap
bool RegisterCreator(std::string name, EvtTimeShiftICtorFuncPtr_t ctorptr, bool *ptr)
std::map< std::string, bool * > fBoolPtrMap
std::vector< std::string > listnames
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
A class for generating concrete EvtTimeShiftI derived classes based on the factory pattern...
static EvtTimeShiftFactory & Instance()
evgb::EvtTimeShiftI *(* EvtTimeShiftICtorFuncPtr_t)(const std::string &)
Physics generators for neutrinos, cosmic rays, and others.
cet::coded_exception< error, detail::translate > exception
evgb::EvtTimeShiftI * GetEvtTimeShift(const std::string &name, const std::string &config="") const