All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | Static Protected Member Functions | List of all members
ana::SystRegistry Class Reference

#include <SystRegistry.h>

Static Public Member Functions

static void Register (const ISyst *s)
 
static void UnRegister (const ISyst *s)
 
static const ISystShortNameToSyst (const std::string &s, bool allowFail=false)
 
static void Print ()
 

Static Protected Member Functions

static std::map< std::string,
const ISyst * > & 
Map ()
 

Detailed Description

Definition at line 10 of file SystRegistry.h.

Member Function Documentation

std::map< std::string, const ISyst * > & ana::SystRegistry::Map ( )
staticprotected

Definition at line 10 of file SystRegistry.cxx.

11  {
12  // https://isocpp.org/wiki/faq/ctors#static-init-order
13  static auto m = new std::map<std::string, const ISyst*>;
14  return *m;
15  }
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
void ana::SystRegistry::Print ( )
static

Definition at line 80 of file SystRegistry.cxx.

81  {
82  std::cout << Map().size() << " ISysts:" << std::endl;
83  for(auto it: Map()){
84  std::cout << it.first << " :\t";
85 
86  if(it.second){
87  std::cout << abi::__cxa_demangle(typeid(*it.second).name(), 0, 0, 0)
88  << " at " << it.second << std::endl;
89  }
90  else{
91  std::cout << "MULTIPLY REGISTERED!" << std::endl;
92  }
93  }
94  }
static std::map< std::string, const ISyst * > & Map()
BEGIN_PROLOG could also be cout
void ana::SystRegistry::Register ( const ISyst s)
static

Definition at line 18 of file SystRegistry.cxx.

19  {
20  const std::string name = s->ShortName();
21 
22  if(Map().count(name)){
23  std::cout << "SystRegistry: Warning: systematic '" << name
24  << "' registered multiple times." << std::endl
25  << "Check you declared it with 'extern' in the .h and "
26  << "instantiated it in the .cxx and check for other ISysts "
27  << "that happen to have the same name." << std::endl;
28  // Store an entry there, so we can detect further duplicates, but make it
29  // invalid.
30  Map()[name] = 0;
31  return;
32  }
33 
34  Map()[name] = s;
35  }
static std::map< std::string, const ISyst * > & Map()
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
then echo fcl name
std::size_t count(Cont const &cont)
BEGIN_PROLOG could also be cout
const ISyst * ana::SystRegistry::ShortNameToSyst ( const std::string &  s,
bool  allowFail = false 
)
static

Definition at line 54 of file SystRegistry.cxx.

56  {
57  auto it = Map().find(s);
58  if(it == Map().end()){
59  if(allowFail) return 0;
60  std::cout << "SystRegistry: Error: Syst '" << s << "' not found. "
61  << "Pass allowFail=true to return NULL in this case."
62  << std::endl;
63  abort();
64  }
65 
66  const ISyst* ret = it->second;
67 
68  if(!ret){
69  std::cout << "SystRegistry: Error: Syst '" << s
70  << "' was registered multiple times. Refusing to return a"
71  << " random instance. Go fix the syst registration."
72  << std::endl;
73  abort();
74  }
75 
76  return ret;
77  }
static std::map< std::string, const ISyst * > & Map()
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
BEGIN_PROLOG could also be cout
void ana::SystRegistry::UnRegister ( const ISyst s)
static

Definition at line 38 of file SystRegistry.cxx.

39  {
40  auto it = Map().find(s->ShortName());
41 
42  if(it == Map().end()){
43  std::cout << "SystRegistry: Error: unregistering ISyst '"
44  << s->ShortName() << "' that was never registered!"
45  << std::endl;
46  return;
47  }
48 
49  // If was multiply registered, leave that signal
50  if(it->second) Map().erase(it);
51  }
static std::map< std::string, const ISyst * > & Map()
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
BEGIN_PROLOG could also be cout

The documentation for this class was generated from the following files: