gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
Gambit::ColliderBit::AnalysisContainer Class Reference

A class for managing collections of Analysis instances. More...

#include <AnalysisContainer.hpp>

Collaboration diagram for Gambit::ColliderBit::AnalysisContainer:

Public Member Functions

 AnalysisContainer ()
 Constructor. More...
 
 ~AnalysisContainer ()
 Destructor. More...
 
void register_thread (str)
 Add container to instances map. More...
 
void clear ()
 Delete and clear the analyses contained within this instance. More...
 
void set_current_collider (str)
 Set name of current collider. More...
 
str get_current_collider () const
 Get name of current collider. More...
 
bool has_analyses (str) const
 Does this instance contain analyses for the given collider. More...
 
bool has_analyses () const
 Does this instance contain analyses for the current collider. More...
 
void init (const std::vector< str > &, str)
 Initialize analyses (by names) for a specified collider. More...
 
void init (const std::vector< str > &)
 Initialize analyses (by names) for the current collider. More...
 
void reset (str, str)
 Reset specific analysis. More...
 
void reset (str)
 Reset all analyses for given collider. More...
 
void reset ()
 Reset all analyses for the current collider. More...
 
void reset_all ()
 Reset all analyses for all colliders. More...
 
const Analysisget_analysis_pointer (str, str) const
 Get pointer to specific analysis. More...
 
const std::map< str, Analysis * > & get_collider_analyses_map (str) const
 Get analyses map for a specific collider. More...
 
const std::map< str, Analysis * > & get_current_analyses_map () const
 Get analyses map for the current collider. More...
 
const std::map< str, std::map< str, Analysis * > > & get_full_analyses_map () const
 Get the full analyses map. More...
 
void analyze (const HEPUtils::Event &, str, str) const
 Pass event through specific analysis. More...
 
void analyze (const HEPUtils::Event &, str) const
 Pass event through all analysis for a specific collider. More...
 
void analyze (const HEPUtils::Event &) const
 Pass event through all analysis for the current collider. More...
 
void collect_and_add_signal (str, str)
 Collect signal predictions from other threads and add to this one, for specific analysis. More...
 
void collect_and_add_signal (str)
 Collect signal predictions from other threads and add to this one, for all analyses for given collider. More...
 
void collect_and_add_signal ()
 Collect signal predictions from other threads and add to this one, for all analyses for the current collider. More...
 
void scale (str, str, double)
 Scale results for specific analysis. More...
 
void scale (str, double)
 Scale results for all analyses for given collider. More...
 
void scale (double)
 Scale results for all analyses for the current collider. More...
 
void scale_all (double)
 Scale results for all analyses across all colliders. More...
 

Private Attributes

std::map< str, std::map< str, Analysis * > > analyses_map
 A map of maps of pointer-to-Analysis. More...
 
str current_collider
 String identifying the currently active collider. More...
 
bool is_registered
 Has this instance been registered in the instances_map? More...
 
int n_threads
 OpenMP info. More...
 
str base_key
 Key for the instances_map. More...
 

Static Private Attributes

static std::map< str, std::map< int, AnalysisContainer * > > instances_map
 A map with pointers to all instances of this class. More...
 

Detailed Description

A class for managing collections of Analysis instances.

Definition at line 56 of file AnalysisContainer.hpp.

Constructor & Destructor Documentation

◆ AnalysisContainer()

Gambit::ColliderBit::AnalysisContainer::AnalysisContainer ( )

Constructor.

Definition at line 195 of file AnalysisContainer.cpp.

195  : current_collider(""),
196  is_registered(false),
197  n_threads(omp_get_max_threads()),
198  base_key("")
199  {
200  #ifdef ANALYSISCONTAINER_DEBUG
201  std::cout << "DEBUG: thread " << omp_get_thread_num() << ": AnalysisContainer::ctor: created at " << this << std::endl;
202  #endif
203  }
str current_collider
String identifying the currently active collider.
str base_key
Key for the instances_map.
bool is_registered
Has this instance been registered in the instances_map?

◆ ~AnalysisContainer()

Gambit::ColliderBit::AnalysisContainer::~AnalysisContainer ( )

Destructor.

Definition at line 207 of file AnalysisContainer.cpp.

References clear().

208  {
209  clear();
210  }
void clear()
Delete and clear the analyses contained within this instance.
Here is the call graph for this function:

Member Function Documentation

◆ analyze() [1/3]

void Gambit::ColliderBit::AnalysisContainer::analyze ( const HEPUtils::Event &  event,
str  collider_name,
str  analysis_name 
) const

Pass event through specific analysis.

Definition at line 382 of file AnalysisContainer.cpp.

References analyses_map.

Referenced by analyze(), and Gambit::ColliderBit::runAnalyses().

383  {
384  analyses_map.at(collider_name).at(analysis_name)->analyze(event);
385  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.
Here is the caller graph for this function:

◆ analyze() [2/3]

void Gambit::ColliderBit::AnalysisContainer::analyze ( const HEPUtils::Event &  event,
str  collider_name 
) const

Pass event through all analysis for a specific collider.

Pass event through all analyses for a specific collider.

Definition at line 388 of file AnalysisContainer.cpp.

References analyses_map.

389  {
390  for (auto& analysis_pointer_pair : analyses_map.at(collider_name))
391  {
392  analysis_pointer_pair.second->analyze(event);
393  }
394  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.

◆ analyze() [3/3]

void Gambit::ColliderBit::AnalysisContainer::analyze ( const HEPUtils::Event &  event) const

Pass event through all analysis for the current collider.

Definition at line 397 of file AnalysisContainer.cpp.

References analyze(), and current_collider.

398  {
399  analyze(event, current_collider);
400  }
str current_collider
String identifying the currently active collider.
void analyze(const HEPUtils::Event &, str, str) const
Pass event through specific analysis.
Here is the call graph for this function:

◆ clear()

void Gambit::ColliderBit::AnalysisContainer::clear ( )

Delete and clear the analyses contained within this instance.

Definition at line 248 of file AnalysisContainer.cpp.

References analyses_map.

Referenced by ~AnalysisContainer().

249  {
251  // Loop through double map and delete the analysis pointers
252  for(auto& collider_map_pair : analyses_map)
253  {
254  for(auto& analysis_pointer_pair : collider_map_pair.second)
255  {
256  delete analysis_pointer_pair.second;
257  analysis_pointer_pair.second = nullptr;
258  }
259  }
260 
261  // Clear the double map
262  analyses_map.clear();
263  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.
Here is the caller graph for this function:

◆ collect_and_add_signal() [1/3]

void Gambit::ColliderBit::AnalysisContainer::collect_and_add_signal ( str  collider_name,
str  analysis_name 
)

Collect signal predictions from other threads and add to this one, for specific analysis.

Note: Analysis::add will not add analyses to themselves.

Definition at line 404 of file AnalysisContainer.cpp.

References analyses_map, base_key, and instances_map.

Referenced by Gambit::ColliderBit::getAnalysisContainer().

405  {
406  for (auto& thread_container_pair : instances_map.at(base_key))
407  {
408  AnalysisContainer* other_container = thread_container_pair.second;
409  Analysis* other_analysis = other_container->analyses_map.at(collider_name).at(analysis_name);
410  analyses_map.at(collider_name).at(analysis_name)->add(other_analysis);
411  }
412  }
static std::map< str, std::map< int, AnalysisContainer * > > instances_map
A map with pointers to all instances of this class.
str base_key
Key for the instances_map.
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.
Here is the caller graph for this function:

◆ collect_and_add_signal() [2/3]

void Gambit::ColliderBit::AnalysisContainer::collect_and_add_signal ( str  collider_name)

Collect signal predictions from other threads and add to this one, for all analyses for given collider.

Definition at line 416 of file AnalysisContainer.cpp.

References analyses_map, and collect_and_add_signal().

417  {
418  for (auto& analysis_pointer_pair : analyses_map[collider_name])
419  {
420  str analysis_name = analysis_pointer_pair.first;
421  collect_and_add_signal(collider_name, analysis_name);
422  }
423  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.
void collect_and_add_signal()
Collect signal predictions from other threads and add to this one, for all analyses for the current c...
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
Here is the call graph for this function:

◆ collect_and_add_signal() [3/3]

void Gambit::ColliderBit::AnalysisContainer::collect_and_add_signal ( )

Collect signal predictions from other threads and add to this one, for all analyses for the current collider.

Definition at line 427 of file AnalysisContainer.cpp.

References current_collider.

Referenced by collect_and_add_signal().

428  {
430  }
str current_collider
String identifying the currently active collider.
void collect_and_add_signal()
Collect signal predictions from other threads and add to this one, for all analyses for the current c...
Here is the caller graph for this function:

◆ get_analysis_pointer()

const Analysis * Gambit::ColliderBit::AnalysisContainer::get_analysis_pointer ( str  collider_name,
str  analysis_name 
) const

Get pointer to specific analysis.

Definition at line 358 of file AnalysisContainer.cpp.

References analyses_map.

359  {
360  return analyses_map.at(collider_name).at(analysis_name);
361  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.

◆ get_collider_analyses_map()

const std::map< str, Analysis * > & Gambit::ColliderBit::AnalysisContainer::get_collider_analyses_map ( str  collider_name) const

Get analyses map for a specific collider.

Definition at line 364 of file AnalysisContainer.cpp.

References analyses_map.

365  {
366  return analyses_map.at(collider_name);
367  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.

◆ get_current_analyses_map()

const std::map< str, Analysis * > & Gambit::ColliderBit::AnalysisContainer::get_current_analyses_map ( ) const

Get analyses map for the current collider.

Definition at line 370 of file AnalysisContainer.cpp.

References analyses_map, and current_collider.

Referenced by Gambit::ColliderBit::MC_convergence_checker::achieved(), Gambit::ColliderBit::runAnalyses(), and Gambit::ColliderBit::MC_convergence_checker::update().

371  {
372  return analyses_map.at(current_collider);
373  }
str current_collider
String identifying the currently active collider.
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.
Here is the caller graph for this function:

◆ get_current_collider()

str Gambit::ColliderBit::AnalysisContainer::get_current_collider ( ) const

Get name of current collider.

Get the name of the current collider.

Definition at line 274 of file AnalysisContainer.cpp.

References current_collider.

275  {
276  return current_collider;
277  }
str current_collider
String identifying the currently active collider.

◆ get_full_analyses_map()

const std::map< str, std::map< str, Analysis * > > & Gambit::ColliderBit::AnalysisContainer::get_full_analyses_map ( ) const

Get the full analyses map.

Definition at line 376 of file AnalysisContainer.cpp.

References analyses_map.

377  {
378  return analyses_map;
379  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.

◆ has_analyses() [1/2]

bool Gambit::ColliderBit::AnalysisContainer::has_analyses ( str  collider_name) const

Does this instance contain analyses for the given collider.

Definition at line 281 of file AnalysisContainer.cpp.

References analyses_map.

Referenced by Gambit::ColliderBit::getAnalysisContainer(), and Gambit::ColliderBit::runAnalyses().

282  {
283  bool result = false;
284 
285  if (analyses_map.count(collider_name) > 0)
286  {
287  if (analyses_map.at(collider_name).size() > 0)
288  {
289  result = true;
290  }
291  }
292 
293  return result;
294  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.
Here is the caller graph for this function:

◆ has_analyses() [2/2]

bool Gambit::ColliderBit::AnalysisContainer::has_analyses ( ) const

Does this instance contain analyses for the current collider.

Definition at line 297 of file AnalysisContainer.cpp.

References current_collider.

298  {
300  }
str current_collider
String identifying the currently active collider.
bool has_analyses() const
Does this instance contain analyses for the current collider.

◆ init() [1/2]

void Gambit::ColliderBit::AnalysisContainer::init ( const std::vector< str > &  analysis_names,
str  collider_name 
)

Initialize analyses (by names) for a specified collider.

Definition at line 304 of file AnalysisContainer.cpp.

References analyses_map, and Gambit::ColliderBit::mkAnalysis().

Referenced by Gambit::ColliderBit::getAnalysisContainer(), and init().

305  {
306  // If a map of analyses already exist for this collider, clear it
307  if (analyses_map.count(collider_name) > 0)
308  {
309  analyses_map[collider_name].clear();
310  }
311 
312  // Create analysis pointers and add to the map
313  for (auto& aname : analysis_names)
314  {
315  analyses_map[collider_name][aname] = mkAnalysis(aname);
316  }
317  }
Analysis * mkAnalysis(const str &name)
Create a new analysis based on a name string.
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init() [2/2]

void Gambit::ColliderBit::AnalysisContainer::init ( const std::vector< str > &  analysis_names)

Initialize analyses (by names) for the current collider.

Definition at line 320 of file AnalysisContainer.cpp.

References current_collider, and init().

321  {
322  init(analysis_names, current_collider);
323  }
str current_collider
String identifying the currently active collider.
void init(const std::vector< str > &, str)
Initialize analyses (by names) for a specified collider.
Here is the call graph for this function:

◆ register_thread()

void Gambit::ColliderBit::AnalysisContainer::register_thread ( str  base_key_in)

Add container to instances map.

Definition at line 214 of file AnalysisContainer.cpp.

References base_key, instances_map, is_registered, LOCAL_INFO, and Gambit::utils_error().

Referenced by Gambit::ColliderBit::getAnalysisContainer().

215  {
216  base_key = base_key_in;
217 
218  #pragma omp critical
219  {
220  if (instances_map.count(base_key) == 0 || instances_map[base_key].count(omp_get_thread_num()) == 0)
221  {
222  // Add this instance to the instances map
223  instances_map[base_key][omp_get_thread_num()] = this;
224  is_registered = true;
225 
226  #ifdef ANALYSISCONTAINER_DEBUG
227  std::cout << "DEBUG: thread " << omp_get_thread_num() << ": AnalysisContainer::register_thread: added " << this << " to instances_map with key " << base_key << "-" << omp_get_thread_num() << std::endl;
228  #endif
229  }
230  else
231  {
232  if (not is_registered)
233  {
234  utils_error().raise(LOCAL_INFO, "There is already an entry with this key in instances_map, but it's not this one! Something has gone wrong...");
235  }
236  else
237  {
238  #ifdef ANALYSISCONTAINER_DEBUG
239  std::cout << "DEBUG: thread " << omp_get_thread_num() << ": AnalysisContainer::register_thread: this instance is already in instances_map" << std::endl;
240  #endif
241  }
242  }
243  }
244  }
EXPORT_SYMBOLS error & utils_error()
Utility errors.
static std::map< str, std::map< int, AnalysisContainer * > > instances_map
A map with pointers to all instances of this class.
#define LOCAL_INFO
Definition: local_info.hpp:34
str base_key
Key for the instances_map.
bool is_registered
Has this instance been registered in the instances_map?
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset() [1/3]

void Gambit::ColliderBit::AnalysisContainer::reset ( str  collider_name,
str  analysis_name 
)

Reset specific analysis.

Definition at line 327 of file AnalysisContainer.cpp.

References analyses_map.

Referenced by Gambit::ColliderBit::getAnalysisContainer().

328  {
329  analyses_map[collider_name][analysis_name]->reset();
330  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.
Here is the caller graph for this function:

◆ reset() [2/3]

void Gambit::ColliderBit::AnalysisContainer::reset ( str  collider_name)

Reset all analyses for given collider.

Definition at line 333 of file AnalysisContainer.cpp.

References analyses_map.

334  {
335  for (auto& analysis_pointer_pair : analyses_map[collider_name])
336  {
337  analysis_pointer_pair.second->reset();
338  }
339  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.

◆ reset() [3/3]

void Gambit::ColliderBit::AnalysisContainer::reset ( )

Reset all analyses for the current collider.

Definition at line 342 of file AnalysisContainer.cpp.

References current_collider.

Referenced by reset_all().

343  {
345  }
str current_collider
String identifying the currently active collider.
void reset()
Reset all analyses for the current collider.
Here is the caller graph for this function:

◆ reset_all()

void Gambit::ColliderBit::AnalysisContainer::reset_all ( )

Reset all analyses for all colliders.

Definition at line 348 of file AnalysisContainer.cpp.

References analyses_map, and reset().

349  {
350  for(auto& collider_map_pair : analyses_map)
351  {
352  reset(collider_map_pair.first);
353  }
354  }
void reset()
Reset all analyses for the current collider.
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.
Here is the call graph for this function:

◆ scale() [1/3]

void Gambit::ColliderBit::AnalysisContainer::scale ( str  collider_name,
str  analysis_name,
double  xsec_per_event 
)

Scale results for specific analysis.

Definition at line 433 of file AnalysisContainer.cpp.

References analyses_map.

Referenced by Gambit::ColliderBit::getAnalysisContainer(), scale(), and scale_all().

434  {
435  analyses_map[collider_name][analysis_name]->scale(xsec_per_event);
436  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.
Here is the caller graph for this function:

◆ scale() [2/3]

void Gambit::ColliderBit::AnalysisContainer::scale ( str  collider_name,
double  xsec_per_event 
)

Scale results for all analyses for given collider.

Definition at line 439 of file AnalysisContainer.cpp.

References analyses_map, and scale().

440  {
441  for (auto& analysis_pointer_pair : analyses_map[collider_name])
442  {
443  str analysis_name = analysis_pointer_pair.first;
444  scale(collider_name, analysis_name, xsec_per_event);
445  }
446  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
void scale(str, str, double)
Scale results for specific analysis.
Here is the call graph for this function:

◆ scale() [3/3]

void Gambit::ColliderBit::AnalysisContainer::scale ( double  xsec_per_event)

Scale results for all analyses for the current collider.

Definition at line 449 of file AnalysisContainer.cpp.

References current_collider, and scale().

450  {
451  scale(current_collider, xsec_per_event);
452  }
str current_collider
String identifying the currently active collider.
void scale(str, str, double)
Scale results for specific analysis.
Here is the call graph for this function:

◆ scale_all()

void Gambit::ColliderBit::AnalysisContainer::scale_all ( double  xsec_per_event)

Scale results for all analyses across all colliders.

Definition at line 455 of file AnalysisContainer.cpp.

References analyses_map, and scale().

456  {
457  for (auto& collider_map_pair : analyses_map)
458  {
459  str collider_name = collider_map_pair.first;
460  scale(collider_name, xsec_per_event);
461  }
462  }
std::map< str, std::map< str, Analysis * > > analyses_map
A map of maps of pointer-to-Analysis.
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
void scale(str, str, double)
Scale results for specific analysis.
Here is the call graph for this function:

◆ set_current_collider()

void Gambit::ColliderBit::AnalysisContainer::set_current_collider ( str  collider_name)

Set name of current collider.

Set name of the current collider.

Definition at line 267 of file AnalysisContainer.cpp.

References current_collider.

Referenced by Gambit::ColliderBit::getAnalysisContainer().

268  {
269  current_collider = collider_name;
270  }
str current_collider
String identifying the currently active collider.
Here is the caller graph for this function:

Member Data Documentation

◆ analyses_map

std::map<str,std::map<str,Analysis*> > Gambit::ColliderBit::AnalysisContainer::analyses_map
private

A map of maps of pointer-to-Analysis.

First key is the collider name, second key is the analysis name.

Definition at line 63 of file AnalysisContainer.hpp.

Referenced by analyze(), clear(), collect_and_add_signal(), get_analysis_pointer(), get_collider_analyses_map(), get_current_analyses_map(), get_full_analyses_map(), has_analyses(), init(), reset(), reset_all(), scale(), and scale_all().

◆ base_key

str Gambit::ColliderBit::AnalysisContainer::base_key
private

Key for the instances_map.

Definition at line 75 of file AnalysisContainer.hpp.

Referenced by collect_and_add_signal(), and register_thread().

◆ current_collider

str Gambit::ColliderBit::AnalysisContainer::current_collider
private

String identifying the currently active collider.

Definition at line 66 of file AnalysisContainer.hpp.

Referenced by analyze(), collect_and_add_signal(), get_current_analyses_map(), get_current_collider(), has_analyses(), init(), reset(), scale(), and set_current_collider().

◆ instances_map

std::map< str, std::map< int, AnalysisContainer * > > Gambit::ColliderBit::AnalysisContainer::instances_map
staticprivate

A map with pointers to all instances of this class.

A map with pointers to all instances of this class. The key is the thread number.

The key is the OMP thread number. (There should only be one instance of this class per OMP thread.)

Definition at line 79 of file AnalysisContainer.hpp.

Referenced by collect_and_add_signal(), Gambit::ColliderBit::getDetector(), and register_thread().

◆ is_registered

bool Gambit::ColliderBit::AnalysisContainer::is_registered
private

Has this instance been registered in the instances_map?

Definition at line 69 of file AnalysisContainer.hpp.

Referenced by register_thread().

◆ n_threads

int Gambit::ColliderBit::AnalysisContainer::n_threads
private

OpenMP info.

Definition at line 72 of file AnalysisContainer.hpp.


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