Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ ScannerBit/CMakeLists.txt
*/include/gambit/*/*_rollcall.hpp
Backends/include/gambit/Backends/backend_functor_types.hpp
Elements/include/gambit/Elements/module_functor_types.hpp
Elements/include/gambit/Elements/elements_extras.hpp
Models/src/particle_database.cpp
ColliderBit/include/gambit/ColliderBit/colliders/Pythia8/Py8Collider_typedefs.hpp

Expand Down
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,6 @@ set(MODULE_HARVESTER_FILES ${MODULE_HARVESTER_FILES} ${BACKEND_HARVESTER_FILES})
remove_build_files(models_harvested backends_harvested modules_harvested printers_harvested colliders_harvested)
if(EXISTS "${PROJECT_SOURCE_DIR}/Elements/")
add_gambit_custom(module_harvest modules_harvested MODULE_HARVESTER MODULE_HARVESTER_FILES ${itch_with_commas})
# Add the elements_extras target
add_elements_extras(elements_extras)
endif()
if(EXISTS "${PROJECT_SOURCE_DIR}/Backends/")
add_gambit_custom(backend_harvest backends_harvested BACKEND_HARVESTER BACKEND_HARVESTER_FILES ${itch_with_commas})
Expand Down Expand Up @@ -661,7 +659,7 @@ add_subdirectory_if_present(Printers)

# Lists of different GAMBIT object files to link
set(GAMBIT_BASIC_COMMON_OBJECTS "${GAMBIT_BASIC_COMMON_OBJECTS}" $<TARGET_OBJECTS:Logs> $<TARGET_OBJECTS:Utils>)
set(GAMBIT_ALL_COMMON_OBJECTS "${GAMBIT_BASIC_COMMON_OBJECTS}" $<TARGET_OBJECTS:Models> $<TARGET_OBJECTS:Backends> $<TARGET_OBJECTS:Elements>)
set(GAMBIT_ALL_COMMON_OBJECTS "${GAMBIT_BASIC_COMMON_OBJECTS}" $<TARGET_OBJECTS:Models> $<TARGET_OBJECTS:Backends> $<TARGET_OBJECTS:Elements> $<TARGET_OBJECTS:Printers>)

# Set compilation targets for GAMBIT modules
foreach(bit ${GAMBIT_BITS})
Expand Down
5 changes: 5 additions & 0 deletions ColliderBit/examples/solo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ int main(int argc, char* argv[])
logger().set_log_debug_messages(debug);
initialise_standalone_logs("CBS_logs/");
logger()<<"Running CBS"<<LogTags::info<<EOM;

// Initialise settings for printer (required)
YAML::Node printerNode = get_standalone_printer("cout", "CBS_logs/", "");
Printers::PrinterManager printerManager(printerNode, false);
set_global_printer_manager(&printerManager);

// Initialise the random number generator, using a hardware seed if no seed is given in the input file.
int seed = settings.getValueOrDef<int>(-1, "seed");
Expand Down
5 changes: 5 additions & 0 deletions DarkBit/examples/DarkBit_standalone_MSSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ int main(int argc, char* argv[])
initialise_standalone_logs("runs/DarkBit_standalone_MSSM/logs/");
logger()<<"Running DarkBit standalone example"<<LogTags::info<<EOM;
model_warning().set_fatal(true);

// Initialise settings for printer (required)
YAML::Node printerNode = get_standalone_printer("cout", "runs/DarkBit_standalone_MSSM/logs/","");
Printers::PrinterManager printerManager(printerNode, false);
set_global_printer_manager(&printerManager);

// ---- Check which backends are present ----
if (not Backends::backendInfo().works["gamLike1.0.1"]) backend_error().raise(LOCAL_INFO, "gamLike 1.0.1 is missing!");
Expand Down
5 changes: 5 additions & 0 deletions DarkBit/examples/DarkBit_standalone_ScalarSingletDM_Z2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ int main()
initialise_standalone_logs("runs/DarkBit_standalone_ScalarSingletDM_Z2/logs/");
logger()<<"Running DarkBit standalone example"<<LogTags::info<<EOM;
model_warning().set_fatal(true);

// Initialise settings for printer (required)
YAML::Node printerNode = get_standalone_printer("cout", "runs/DarkBit_standalone_ScalarSingletDM_Z2/logs/","");
Printers::PrinterManager printerManager(printerNode, false);
set_global_printer_manager(&printerManager);


// ---- Check that required backends are present ----
Expand Down
5 changes: 5 additions & 0 deletions DarkBit/examples/DarkBit_standalone_WIMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,11 @@ int main(int argc, char* argv[])
initialise_standalone_logs("runs/DarkBit_standalone_WIMP/logs/");
logger()<<"Running DarkBit standalone example"<<LogTags::info<<EOM;
model_warning().set_fatal(true);

// Initialise settings for printer (required)
YAML::Node printerNode = get_standalone_printer("cout", "runs/DarkBit_standalone_WIMP/logs/","");
Printers::PrinterManager printerManager(printerNode, false);
set_global_printer_manager(&printerManager);


// ---- Check that required backends are present ----
Expand Down
5 changes: 5 additions & 0 deletions DecayBit/examples/3bithit.cpp
Comment thread
tegonzalo marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ int main()
std::map<std::string, std::string> loggerinfo;
loggerinfo["Default"] = "3bithit.log";
logger().initialise(loggerinfo);

// Initialise settings for printer (required)
YAML::Node printerNode = get_standalone_printer("cout", "runs/3bithit/logs/","");
Printers::PrinterManager printerManager(printerNode, false);
set_global_printer_manager(&printerManager);

// Initialise the random number generator.
Random::create_rng_engine("default");
Expand Down
68 changes: 68 additions & 0 deletions Elements/include/gambit/Elements/elements_extras.hpp
Comment thread
tegonzalo marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// GAMBIT: Global and Modular BSM Inference Tool
// *********************************************
/// \file
///
/// Functions that require printing capabilities
/// that can be run from within module functions.
/// TODO: Perhaps move postprocessor retrieve back
/// into DarkBit, and change this file to be
/// purely for suspicious points
///
/// Classes added:
/// - Suspicious point exception class.
///
/// Authors:
///
/// \author Chris Chang
/// \date Dec 2023
///
/// *********************************************

#ifndef __elements_extras_hpp__
#define __elements_extras_hpp__

#include <map>
#include <set>
#include <string>
#include <exception>
#include <vector>
#include <utility>

#include "gambit/Utils/util_macros.hpp"
#include "gambit/Logs/log_tags.hpp"
#include "gambit/Printers/baseprinter.hpp"
#include "gambit/Printers/printermanager.hpp"

namespace Gambit
{

/// Gambit suspicious point exception class.
class Suspicious_point_exception
Comment thread
tegonzalo marked this conversation as resolved.
Outdated
{

public:

/// Constructor
Suspicious_point_exception() {}

/// Raise the suspicious point exception. Print it with a message and a code. The default code is 1.
void raise(const std::string &msg, int code=1, bool debug=false)
{
// get the printer pointer
Printers::BasePrinter& printer = *(get_global_printer_manager()->printerptr);
printer.print(code, "Suspicious Point Code", Printers::get_main_param_id("Suspicious Point Code"), printer.getRank(), Printers::get_point_id());

if (debug) std::cout << "Point Suspicious (" << code << "): " << msg << std::endl;
}

};

/// Postprocessor reader retrieve function
Comment thread
tegonzalo marked this conversation as resolved.
Outdated
template<typename T>
bool pp_reader_retrieve(T& result, str dataset)
{
return get_pp_reader().retrieve(result, dataset);
}
}

#endif
3 changes: 0 additions & 3 deletions Elements/include/gambit/Elements/standalone_module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,5 @@ using namespace Gambit;
using std::cout;
using std::endl;

/// This function fixes an issue for linking to suspicious points. It is not intented to be called anywhere.
void Suspicious() {Suspicious_point_exception().raise(".");}

#endif //__standalone_hpp__

188 changes: 0 additions & 188 deletions Elements/scripts/elements_extras.py

This file was deleted.

12 changes: 12 additions & 0 deletions ExampleBit_A/examples/ExampleBit_A_standalone_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ int main()
//Initialise logging (just comment out if you want no logfiles)
initialise_standalone_logs("runs/ExampleBit_A_standalone/logs/");

// Initialise settings for printer (required)
YAML::Node printerNode = get_standalone_printer("hdf5", "runs/ExampleBit_A_standalone/samples/", "ExampleBit_A_standalone.hdf5");
Printers::PrinterManager printerManager(printerNode, false);
set_global_printer_manager(&printerManager);
(printerManager.printerptr)->addToPrintList("Suspicious Point Code");
(printerManager.printerptr)->set_output_metadata(false);

// Change the fatality of different errors and warnings from the defaults, if desired.
model_warning().set_fatal(true);
ExampleBit_A::ExampleBit_A_error().set_fatal(true);
Expand Down Expand Up @@ -131,6 +138,10 @@ int main()
std::cout << "Starting model scan..." << std::endl << std::endl;
for (int i = 0; i<5; i++)
{
// Print out some basic info for each point.
Gambit::Printers::get_point_id() = i;
(printerManager.printerptr)->print(0, "MPIrank", Printers::get_main_param_id("MPIrank"), (printerManager.printerptr)->getRank(), Printers::get_point_id());
(printerManager.printerptr)->print(Printers::get_point_id(), "pointID", Printers::get_main_param_id("pointID"), (printerManager.printerptr)->getRank(), Printers::get_point_id());
Comment thread
tegonzalo marked this conversation as resolved.

try
{
Expand Down Expand Up @@ -169,6 +180,7 @@ int main()

}

(printerManager.printerptr)->finalise(false);
std::cout << "ExampleBit_A standalone example has finished successfully." << std::endl << std::endl;

}
Expand Down
5 changes: 5 additions & 0 deletions FlavBit/examples/FlavBit_standalone_example.cpp
Comment thread
tegonzalo marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ int main(int argc, char** argv)
// Define where the logs will end up
std::string prefix("runs/FlavBit_standalone/logs/");

// Initialise settings for printer (required)
YAML::Node printerNode = get_standalone_printer("cout", "runs/FlavBit_standalone/logs/","");
Printers::PrinterManager printerManager(printerNode, false);
set_global_printer_manager(&printerManager);

// Ensure that the above directory exists
Utils::ensure_path_exists(prefix);

Expand Down
Loading