The Gaudi Framework  v38r1 (3af3a718)
Gaudi::Histograming::Sink Namespace Reference

Namespaces

 details
 

Classes

class  Base
 
struct  Root
 
struct  Traits
 templated Traits dealing with Root Histogram filling for standard histograms More...
 
struct  Traits< false, RootHisto, N >
 Specialization of Traits dealing with non profile Root Histograms. More...
 
struct  Traits< true, RootHisto, N >
 Specialization of Traits dealing with profile Root Histograms. More...
 

Functions

template<typename Traits >
std::tuple< typename Traits::Histo, std::stringjsonToRootHistogram (std::string &dir, std::string &name, nlohmann::json const &j)
 generic function to convert json to a ROOT Histogram More...
 
template<typename Histo >
nlohmann::json rootHistogramTojson (Histo const &)
 generic function to convert a ROOT Histogram to json More...
 
template<typename Traits >
void saveRootHisto (TFile &file, std::string dir, std::string name, nlohmann::json const &j)
 generic method to save histograms to files, based on Traits More...
 
template<unsigned int N, bool isProfile, typename ROOTHisto >
void saveRootHisto (TFile &file, std::string dir, std::string name, nlohmann::json const &j)
 generic method to save regular histograms to files More...
 

Function Documentation

◆ jsonToRootHistogram()

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

returns the Root histogram and the dir where to save it in the Root file This may be different from input dir in case name has slashes

Definition at line 380 of file Utils.h.

381  {
382  return details::jsonToRootHistogramInternal<Traits>( dir, name, j, std::make_index_sequence<Traits::Dimension>() );
383  }

◆ rootHistogramTojson()

template<typename Histo >
nlohmann::json Gaudi::Histograming::Sink::rootHistogramTojson ( Histo const &  )

generic function to convert a ROOT Histogram to json

essentially used for backward compatibility of old HistogramService with MonitoringHub

◆ saveRootHisto() [1/2]

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

Definition at line 386 of file Utils.h.

386  {
387  // get the Root histogram
388  auto [histo, newDir] = jsonToRootHistogram<Traits>( dir, name, j );
389  // Change to the proper directory in the ROOT file
390  auto previousDir = details::changeDir( file, newDir );
391  // write to file
392  histo.Write();
393  // switch back to the previous directory
394  previousDir->cd();
395  }

◆ saveRootHisto() [2/2]

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

Can be used in most cases as the handler function to register into Sink::Base contains all the boiler plate code and redirects specific code to the adapted Traits template

Definition at line 398 of file Utils.h.

398  {
399  saveRootHisto<Traits<isProfile, ROOTHisto, N>>( file, std::move( dir ), std::move( name ), j );
400  }
std::move
T move(T... args)
Gaudi::Histograming::Sink::details::changeDir
TDirectory * changeDir(TFile &file, std::string dir)
changes to the ROOT directory given in the current ROOT file and returns the current directory before...
Definition: Utils.h:256
ProduceConsume.j
j
Definition: ProduceConsume.py:101
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:76