gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
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  #pragma omp critical
32  {
34  // Decrement event counter
35  _current_event_count_it->second--;
36  }
37  }
38 
41  {
42  #pragma omp critical
43  {
44  end_of_event_file = true;
45  // Decrement event counter
46  _current_event_count_it->second--;
47  }
48  }
49 
52  {
53  end_of_event_file = false;
54  event_generation_began = false;
56  }
57 
60  {
61  // Save the current collider
62  _current_collider = col;
63 
64  // Save an iterator to the current maxFailedEvents
65  auto it = maxFailedEvents.find(_current_collider);
66  if (it == maxFailedEvents.end())
67  {
68  str msg = "Current collider \"" + _current_collider + "\" not found in MCLoopInfo::maxFailedEvents map.";
69  utils_error().raise(LOCAL_INFO, msg);
70  }
72 
73  // Save an iterator to the number of events generated for the current collider
74  it = event_count.find(_current_collider);
75  if (it == event_count.end())
76  {
77  str msg = "Current collider \"" + _current_collider + "\" not found in MCLoopInfo::event_count map.";
78  utils_error().raise(LOCAL_INFO, msg);
79  }
81 
82  // Save an iterator to the the list of analyses for the current collider
83  auto jt = convergence_options.find(_current_collider);
84  if (jt == convergence_options.end())
85  {
86  str msg = "Current collider \"" + _current_collider + "\" not found in MCLoopInfo::convergence_options map.";
87  utils_error().raise(LOCAL_INFO, msg);
88  }
90 
91  // Save an iterator to the the list of analyses for the current collider
92  auto kt = analyses.find(_current_collider);
93  if (kt == analyses.end())
94  {
95  str msg = "Current collider \"" + _current_collider + "\" not found in MCLoopInfo::analyses map.";
96  utils_error().raise(LOCAL_INFO, msg);
97  }
99 
100  // Save an iterator to the the list of analyses for the current collider, sorted by detector
101  auto lt = detector_analyses.find(_current_collider);
102  if (lt == detector_analyses.end())
103  {
104  str msg = "Current collider \"" + _current_collider + "\" not found in MCLoopInfo::detector_analyses map.";
105  utils_error().raise(LOCAL_INFO, msg);
106  }
108 
109  // Save an iterator to the current invalidate_failed_points
111  if (mt == invalidate_failed_points.end())
112  {
113  str msg = "Current collider \"" + _current_collider + "\" not found in MCLoopInfo::invalidate_failed_points map.";
114  utils_error().raise(LOCAL_INFO, msg);
115  }
117 
118  }
119 
120  bool MCLoopInfo::current_analyses_exist_for(const str& detname) const
121  {
122  auto current_analyses_by_detector = _current_detector_analyses_it->second;
123  auto it = current_analyses_by_detector.find(detname);
124  return not (it == current_analyses_by_detector.end());
125  }
126 
128 
131 
134 
135  const int& MCLoopInfo::current_event_count() const { return _current_event_count_it->second; }
137 
140 
141  const std::vector<str>& MCLoopInfo::current_analyses() const { return _current_analyses_it->second; }
142  std::vector<str>& MCLoopInfo::current_analyses() { return _current_analyses_it->second; }
143 
144  const std::vector<str>& MCLoopInfo::current_analyses_for(const str& detname) const
145  {
146  if (not current_analyses_exist_for(detname)) utils_error().raise(LOCAL_INFO, "Detector "+detname);
147  return _current_detector_analyses_it->second.at(detname);
148  }
149  std::vector<str>& MCLoopInfo::current_analyses_for(const str& detname)
150  {
151  if (not current_analyses_exist_for(detname)) utils_error().raise(LOCAL_INFO, "Detector "+detname);
152  return _current_detector_analyses_it->second.at(detname);
153  }
154 
155  }
156 
157 }
std::map< str, int > event_count
Number of events generated for each collider.
Definition: MCLoopInfo.hpp:52
std::map< str, int >::iterator _current_event_count_it
Iterator to the current event count.
Definition: MCLoopInfo.hpp:123
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:132
void report_exceeded_maxFailedEvents() const
Set exceeded_maxFailedEvents = true and decrement event counter by 1.
Definition: MCLoopInfo.cpp:29
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:129
const int & current_maxFailedEvents() const
Get maximum allowable number of failed events before MC loop is terminated for the current collider...
Definition: MCLoopInfo.cpp:129
bool end_of_event_file
Maximum allowed number of failed events has been reached and MC loop terminated.
Definition: MCLoopInfo.hpp:40
#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:135
const double mt
Definition: topness.h:39
bool exceeded_maxFailedEvents
Maximum allowed number of failed events has been reached.
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:144
std::map< str, convergence_settings > convergence_options
Convergence options for each collider.
Definition: MCLoopInfo.hpp:55
str _current_collider
The name of the current collider.
Definition: MCLoopInfo.hpp:114
std::map< str, bool > invalidate_failed_points
Invalidate points where number of failed events > maxFailedEvents? One bool for each collider...
Definition: MCLoopInfo.hpp:49
bool current_analyses_exist_for(const str &) const
Query whether any analyses exist for a given detector for the current collider.
Definition: MCLoopInfo.cpp:120
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:51
std::map< str, int > maxFailedEvents
Maximum allowable number of failed events before MC loop is terminated for each collider.
Definition: MCLoopInfo.hpp:46
const str & current_collider() const
Get the current collider.
Definition: MCLoopInfo.cpp:127
std::map< str, bool >::iterator _current_invalidate_failed_points_it
Iterator to the current invalidate_failed_points.
Definition: MCLoopInfo.hpp:120
std::map< str, std::map< str, std::vector< str > > > detector_analyses
Analysis list for each detector of each collider.
Definition: MCLoopInfo.hpp:61
void set_current_collider(str &)
Set the current collider.
Definition: MCLoopInfo.cpp:59
const bool & current_invalidate_failed_points() const
Get invalidate_failed_points bool for the current collider.
Definition: MCLoopInfo.cpp:132
std::map< str, convergence_settings >::iterator _current_convergence_options_it
Iterator to the current set of convergence options.
Definition: MCLoopInfo.hpp:126
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
void report_end_of_event_file() const
Set end_of_event_file = true and decrement event counter by 1.
Definition: MCLoopInfo.cpp:40
std::map< str, int >::iterator _current_maxFailedEvents_it
Iterator to the current maxFailedEvents.
Definition: MCLoopInfo.hpp:117
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:141
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:138
std::map< str, std::vector< str > > analyses
Analysis list for each collider.
Definition: MCLoopInfo.hpp:58