file backend_types/Contur.cpp
[No description available] More…
Namespaces
| Name |
|---|
| Gambit TODO: see if we can use this one: |
Detailed Description
Author: Tomasz Procter (t.procter.1@research.gla.ac.uk)
Date:
- 2021 October
- 2023 May
implementation of the Contur_output class (and helpers) that converts the python dictionary output from the contur API main into a simple class.
Authors (add name and date if you modify):
Source code
// GAMBIT: Global and Modular BSM Inference Tool
// *********************************************
/// \file
///
/// implementation of the Contur_output class (and helpers)
/// that converts the python dictionary output from
/// the contur API main into a simple class.
///
/// *********************************************
///
/// Authors (add name and date if you modify):
///
/// \author Tomasz Procter
/// (t.procter.1@research.gla.ac.uk)
/// \date 2021 October
/// \date 2023 May
///
/// *********************************************
#include "gambit/Backends/backend_types/Contur.hpp"
namespace Gambit
{
#ifdef HAVE_PYBIND11
void Contur_subOutput::print_Contur_subOutput_debug(std::ostream&outstream) const
{
outstream << "\n\tContur subOutput Object.\n\t\tLLR is: " <<
LLR << "\n\t\tPool LLR's:";
for (auto pool : pool_LLR)
{
outstream << "\n\t\t\t" << pool.first << ": " << pool.second;
}
outstream << "\n\t\tPool Histotags:";
for (auto pool : pool_tags)
{
outstream << "\n\t\t\t" << pool.first << ": " << pool.second;
}
outstream << std::endl;
}
void Contur_output::print_Contur_output_debug(std::ostream&outstream) const
{
outstream << "\nContur Output Object.\n";
for (const str & bkg : _bkg_types){
outstream << "\t" << bkg << ":";
outputs.at(bkg).print_Contur_subOutput_debug(outstream);
}
}
Contur_subOutput merge_contur_subOutputs(const Contur_subOutput& output1, const Contur_subOutput& output2)
{
map_str_str new_pool_tags {};
map_str_dbl new_pool_LLR {};
//Concatenate the maps
//TODO I presume there's something better than this syntax
for(auto const& pool : output1.pool_LLR)
{
new_pool_LLR[pool.first] = pool.second;
}
for(auto const& pool : output1.pool_tags)
{
new_pool_tags[pool.first] = pool.second;
}
for(auto const& pool : output2.pool_LLR)
{
new_pool_LLR[pool.first] = pool.second;
}
for(auto const& pool : output2.pool_tags)
{
new_pool_tags[pool.first] = pool.second;
}
//Return the object
return Contur_subOutput(output1.LLR + output2.LLR, new_pool_LLR, new_pool_tags);
}
Contur_output merge_contur_outputs(const Contur_output& output1, const Contur_output& output2){
Contur_output out;
for (const str & bkg : output1._bkg_types){
out.outputs[bkg] = merge_contur_subOutputs(output1.outputs.at(bkg), output2.outputs.at(bkg));
}
return out;
}
//This assumes that the same contur instances belong in each run. If this isn't the case, something very bad has gone wrong!
Multi_Contur_output merge_multi_contur_outputs(const Multi_Contur_output& output1, const Multi_Contur_output& output2)
{
Multi_Contur_output final_output = {};
for(const auto &output_object_1 : output1)
{
final_output[output_object_1.first] = merge_contur_outputs(output_object_1.second, output2.at(output_object_1.first));
}
return final_output;
}
void print_Multi_Contur_output_debug(const Multi_Contur_output& multi_contur_out, std::ostream& outstream)
{
for (auto contur_instance : multi_contur_out)
{
outstream << contur_instance.first << ":\n";
contur_instance.second.print_Contur_output_debug(outstream);
}
}
#endif
}
Updated on 2026-11-03 at 14:50:49 +0000