gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
MCLoopInfo.cpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
16 
17 
20 
21 
22 namespace Gambit
23 {
24 
25  namespace ColliderBit
26  {
27 
30  {
31  event_generation_began = false;
33  }
34 
37  {
38  // Save the current collider
39  _current_collider = col;
40 
41  // Save an iterator to the current maxFailedEvents
42  auto it = maxFailedEvents.find(_current_collider);
43  if (it == maxFailedEvents.end())
44  {
45  str msg = "Current collider \"" + _current_collider + "\" not found in MCLoopInfo::maxFailedEvents map.";
46  utils_error().raise(LOCAL_INFO, msg);
47  }
49 
50  // Save an iterator to the number of events generated for the current collider
51  it = event_count.find(_current_collider);
52  if (it == event_count.end())
53  {
54  str msg = "Current collider \"" + _current_collider + "\" not found in MCLoopInfo::event_count map.";
55  utils_error().raise(LOCAL_INFO, msg);
56  }
58 
59  // Save an iterator to the the list of analyses for the current collider
60  auto jt = convergence_options.find(_current_collider);
61  if (jt == convergence_options.end())
62  {
63  str msg = "Current collider \"" + _current_collider + "\" not found in MCLoopInfo::convergence_options map.";
64  utils_error().raise(LOCAL_INFO, msg);
65  }
67 
68  // Save an iterator to the the list of analyses for the current collider
69  auto kt = analyses.find(_current_collider);
70  if (kt == analyses.end())
71  {
72  str msg = "Current collider \"" + _current_collider + "\" not found in MCLoopInfo::analyses map.";
73  utils_error().raise(LOCAL_INFO, msg);
74  }
76 
77  // Save an iterator to the the list of analyses for the current collider, sorted by detector
78  auto lt = detector_analyses.find(_current_collider);
79  if (lt == detector_analyses.end())
80  {
81  str msg = "Current collider \"" + _current_collider + "\" not found in MCLoopInfo::detector_analyses map.";
82  utils_error().raise(LOCAL_INFO, msg);
83  }
85 
86  }
87 
88  bool MCLoopInfo::current_analyses_exist_for(const str& detname) const
89  {
90  auto current_analyses_by_detector = _current_detector_analyses_it->second;
91  auto it = current_analyses_by_detector.find(detname);
92  return not (it == current_analyses_by_detector.end());
93  }
94 
96 
99 
100  const int& MCLoopInfo::current_event_count() const { return _current_event_count_it->second; }
102 
105 
106  const std::vector<str>& MCLoopInfo::current_analyses() const { return _current_analyses_it->second; }
107  std::vector<str>& MCLoopInfo::current_analyses() { return _current_analyses_it->second; }
108 
109  const std::vector<str>& MCLoopInfo::current_analyses_for(const str& detname) const
110  {
111  if (not current_analyses_exist_for(detname)) utils_error().raise(LOCAL_INFO, "Detector "+detname);
112  return _current_detector_analyses_it->second.at(detname);
113  }
114  std::vector<str>& MCLoopInfo::current_analyses_for(const str& detname)
115  {
116  if (not current_analyses_exist_for(detname)) utils_error().raise(LOCAL_INFO, "Detector "+detname);
117  return _current_detector_analyses_it->second.at(detname);
118  }
119 
120  }
121 
122 }
std::map< str, int > event_count
Number of events generated for each collider.
Definition: MCLoopInfo.hpp:46
std::map< str, int >::iterator _current_event_count_it
Iterator to the current event count.
Definition: MCLoopInfo.hpp:103
std::map< str, std::map< str, std::vector< str > > >::iterator _current_detector_analyses_it
Iterator to the current set of analyses sorted by detector.
Definition: MCLoopInfo.hpp:112
EXPORT_SYMBOLS error & utils_error()
Utility errors.
std::map< str, std::vector< str > >::iterator _current_analyses_it
Iterator to the current set of analyses.
Definition: MCLoopInfo.hpp:109
const int & current_maxFailedEvents() const
Get maximum allowable number of failed events before MC loop is terminated for the current collider...
Definition: MCLoopInfo.cpp:97
#define LOCAL_INFO
Definition: local_info.hpp:34
const int & current_event_count() const
Get the number of events generated for the current collider.
Definition: MCLoopInfo.cpp:100
bool exceeded_maxFailedEvents
Maximum allowed number of failed events has been reached and MC loop terminated.
Definition: MCLoopInfo.hpp:37
const std::vector< str > & current_analyses_for(const str &) const
Get the set of analyses for the current collider and a given detector.
Definition: MCLoopInfo.cpp:109
std::map< str, convergence_settings > convergence_options
Convergence options for each collider.
Definition: MCLoopInfo.hpp:49
str _current_collider
The name of the current collider.
Definition: MCLoopInfo.hpp:97
bool current_analyses_exist_for(const str &) const
Query whether any analyses exist for a given detector for the current collider.
Definition: MCLoopInfo.cpp:88
bool event_generation_began
Event generation has started.
Definition: MCLoopInfo.hpp:34
Type for holding event loop information.
void reset_flags()
Reset flags.
Definition: MCLoopInfo.cpp:29
std::map< str, int > maxFailedEvents
Maximum allowable number of failed events before MC loop is terminated for each collider.
Definition: MCLoopInfo.hpp:43
const str & current_collider() const
Get the current collider.
Definition: MCLoopInfo.cpp:95
std::map< str, std::map< str, std::vector< str > > > detector_analyses
Analysis list for each detector of each collider.
Definition: MCLoopInfo.hpp:55
void set_current_collider(str &)
Set the current collider.
Definition: MCLoopInfo.cpp:36
std::map< str, convergence_settings >::iterator _current_convergence_options_it
Iterator to the current set of convergence options.
Definition: MCLoopInfo.hpp:106
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
std::map< str, int >::iterator _current_maxFailedEvents_it
Iterator to the current maxFailedEvents.
Definition: MCLoopInfo.hpp:100
Type for holding Monte Carlo convergence settings.
Exception objects required for standalone compilation.
const std::vector< str > & current_analyses() const
Get the set of analyses for the current collider.
Definition: MCLoopInfo.cpp:106
TODO: see if we can use this one:
Definition: Analysis.hpp:33
const convergence_settings & current_convergence_options() const
Get the set of convergence options for the current collider.
Definition: MCLoopInfo.cpp:103
std::map< str, std::vector< str > > analyses
Analysis list for each collider.
Definition: MCLoopInfo.hpp:52