The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
Utils.h File Reference
#include <Gaudi/Accumulators/StaticHistogram.h>
#include <Gaudi/MonitoringHub.h>
#include <GaudiKernel/GaudiException.h>
#include <TDirectory.h>
#include <TFile.h>
#include <TH1.h>
#include <TH1D.h>
#include <TH2D.h>
#include <TH3D.h>
#include <TProfile.h>
#include <TProfile2D.h>
#include <TProfile3D.h>
#include <algorithm>
#include <cmath>
#include <functional>
#include <gsl/span>
#include <nlohmann/json.hpp>
#include <range/v3/numeric/accumulate.hpp>
#include <ranges>
#include <string>
#include <type_traits>
#include <vector>
#include <fmt/format.h>
Include dependency graph for Utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Gaudi::Histograming::Sink::detail::IntWithFixedWidth
 helper struct to print integers with fixed width More...
struct  fmt::formatter< Gaudi::Histograming::Sink::detail::IntWithFixedWidth >
 fmt dedicated formatter for IntWithFixedWidth More...
struct  Gaudi::Histograming::Sink::details::Axis
 Small helper struct representing the Axis of an Histogram. More...
struct  Gaudi::Histograming::Sink::details::TraitsBase< RootHisto, N >
 Common base for Traits dealing with Histogram conversions to Root Provides generic implementation for creating the histogram and filling meta data The filling (method fill) is not implemented. More...
struct  Gaudi::Histograming::Sink::details::ProfileWrapper< TP >
 helper Wrapper around TProfileX to be able to fill it More...
struct  Gaudi::Histograming::Sink::Traits< false, RootHisto, N >
 Specialization of Traits dealing with non profile Root Histograms. More...
struct  Gaudi::Histograming::Sink::Traits< true, RootHisto, N >
 Specialization of Traits dealing with profile Root Histograms. More...
struct  Gaudi::Histograming::Sink::details::BinAvValue< TYPE >
struct  Gaudi::Histograming::Sink::BinAccessor
struct  Gaudi::Histograming::Sink::ArthTypeAccessor

Namespaces

namespace  Gaudi
 This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from python with a format liks : ( nbins, min, max, title ) where title can be ommited.
namespace  Gaudi::Histograming
namespace  Gaudi::Histograming::Sink
namespace  Gaudi::Histograming::Sink::detail
namespace  Gaudi::Histograming::Sink::details
namespace  nlohmann

Functions

std::string Gaudi::Histograming::Sink::detail::formatTitle (std::string_view title, unsigned int width)
std::string Gaudi::Histograming::Sink::detail::formatName (std::string_view name, unsigned int width)
template<typename T>
T Gaudi::Histograming::Sink::detail::sqrt_or_zero (const T x)
 sqrt or zero
template<typename Traits>
std::tuple< typename Traits::Histo, std::string > Gaudi::Histograming::Sink::jsonToRootHistogram (std::string &dir, std::string &name, nlohmann::json const &j)
 generic function to convert json to a ROOT Histogram
template<typename Histo>
nlohmann::json Gaudi::Histograming::Sink::rootHistogramTojson (Histo const &)
 generic function to convert a ROOT Histogram to json
template<typename Traits>
void Gaudi::Histograming::Sink::saveRootHisto (TFile &file, std::string dir, std::string name, nlohmann::json const &j)
 generic method to save histograms to files, based on Traits
template<unsigned int N, bool isProfile, typename ROOTHisto>
void Gaudi::Histograming::Sink::saveRootHisto (TFile &file, std::string dir, std::string name, nlohmann::json const &j)
 generic method to save regular histograms to files
Axis Gaudi::Histograming::Sink::details::jsonToAxis (nlohmann::json &jAxis)
 extract an Axis from json data
void Gaudi::Histograming::Sink::details::fixNameAndDir (std::string &name, std::string &dir)
 handles cases where name includes '/' character(s) and move needed part of it to dir.
template<typename Traits, std::size_t... index>
std::tuple< typename Traits::Histo, std::string > Gaudi::Histograming::Sink::details::jsonToRootHistogramInternal (std::string &dir, std::string &name, nlohmann::json const &j, std::index_sequence< index... >)
 generic function to convert json to a ROOT Histogram - internal implementation
TDirectory * Gaudi::Histograming::Sink::details::changeDir (TFile &file, std::string_view dir)
 changes to the ROOT directory given in the current ROOT file and returns the current directory before the change
template<typename Histo>
nlohmann::json Gaudi::Histograming::Sink::details::allAxisTojson (Histo const &h)
template<typename Histo>
nlohmann::json Gaudi::Histograming::Sink::details::binsTojson (Histo const &h)
template<typename Histo>
nlohmann::json Gaudi::Histograming::Sink::details::rootHistogramToJson (Histo const &h)
 automatic translation of Root Histograms to json
template<Accumulators::atomicity Atomicity = Accumulators::atomicity::full, typename Arithmetic = double>
details::ProfileWrapper< TProfile > Gaudi::Histograming::Sink::profileHisto1DToRoot (std::string name, Monitoring::Hub::Entity const &ent)
 Direct conversion of 1D histograms from Gaudi to ROOT format.
template<Accumulators::atomicity Atomicity = Accumulators::atomicity::full, typename Arithmetic = double>
details::ProfileWrapper< TProfile2D > Gaudi::Histograming::Sink::profileHisto2DToRoot (std::string name, Monitoring::Hub::Entity const &ent)
 Direct conversion of 2D histograms from Gaudi to ROOT format.
template<Accumulators::atomicity Atomicity = Accumulators::atomicity::full, typename Arithmetic = double>
details::ProfileWrapper< TProfile3D > Gaudi::Histograming::Sink::profileHisto3DToRoot (std::string name, Monitoring::Hub::Entity const &ent)
 Direct conversion of 3D histograms from Gaudi to ROOT format.
template<unsigned int N, Accumulators::atomicity Atomicity = Accumulators::atomicity::full, typename Arithmetic = double>
void Gaudi::Histograming::Sink::saveProfileHisto (TFile &file, std::string dir, std::string name, Monitoring::Hub::Entity const &ent)
template<Gaudi::Accumulators::atomicity Atomicity = Gaudi::Accumulators::atomicity::full, typename Arithmetic = double>
std::string Gaudi::Histograming::Sink::printProfileHisto1D (std::string_view name, Gaudi::Monitoring::Hub::Entity const &ent, unsigned int stringsWidth=45)
template<Gaudi::Accumulators::atomicity Atomicity = Gaudi::Accumulators::atomicity::full, typename Arithmetic = double>
std::string Gaudi::Histograming::Sink::printProfileHisto2D (std::string_view name, Gaudi::Monitoring::Hub::Entity const &ent, unsigned int stringsWidth=45)
template<Gaudi::Accumulators::atomicity Atomicity = Gaudi::Accumulators::atomicity::full, typename Arithmetic = double>
std::string Gaudi::Histograming::Sink::printProfileHisto3D (std::string_view name, Gaudi::Monitoring::Hub::Entity const &ent, unsigned int stringsWidth=45)
std::string Gaudi::Histograming::Sink::printHistogram1D (std::string_view type, std::string_view name, std::string_view title, const nlohmann::json &j, unsigned int stringsWidth=45)
std::string Gaudi::Histograming::Sink::printHistogram2D (std::string_view type, std::string_view name, std::string_view title, const nlohmann::json &j, unsigned int stringsWidth=45)
std::string Gaudi::Histograming::Sink::printHistogram3D (std::string_view type, std::string_view name, std::string_view title, const nlohmann::json &j, unsigned int stringsWidth=45)
void nlohmann::to_json (nlohmann::json &j, TAxis const &axis)
 automatic translation of TAxis to json
void nlohmann::to_json (nlohmann::json &j, TH1D const &h)
 automatic translation of Root histograms to json
void nlohmann::to_json (nlohmann::json &j, TH2D const &h)
void nlohmann::to_json (nlohmann::json &j, TH3D const &h)
void nlohmann::to_json (nlohmann::json &j, TProfile const &h)
void nlohmann::to_json (nlohmann::json &j, TProfile2D const &h)

Variables

constexpr std::string_view Gaudi::Histograming::Sink::detail::histo1DFormatting
constexpr std::string_view Gaudi::Histograming::Sink::detail::histo2DFormatting
constexpr std::string_view Gaudi::Histograming::Sink::detail::histo3DFormatting