The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
Gaudi::Histograming::Sink::BinAccessor Struct Reference

#include </builds/gaudi/Gaudi/GaudiKernel/include/Gaudi/Histograming/Sink/Utils.h>

Public Member Functions

 BinAccessor (std::string_view type, const nlohmann::json &j)
auto operator[] (const unsigned int n) const

Public Attributes

std::function< double(unsigned int)> m_get

Detailed Description

Definition at line 831 of file Utils.h.

Constructor & Destructor Documentation

◆ BinAccessor()

Gaudi::Histograming::Sink::BinAccessor::BinAccessor ( std::string_view type,
const nlohmann::json & j )
inline

Definition at line 833 of file Utils.h.

833 {
834 auto subtype = std::string_view( type ).substr( 10 ); // remove "histogram:" in front
835 if ( subtype.substr( 0, 15 ) == "WeightedProfile" || subtype.substr( 0, 7 ) == "Profile" ) {
836 m_get = [bins = j.at( "bins" ).get<std::vector<std::tuple<std::tuple<unsigned int, double>, double>>>()](
837 unsigned int nx ) {
838 auto [c, sumWeight2] = bins[nx];
839 auto [n, sumWeight] = c;
840 return sumWeight;
841 };
842 } else {
843 m_get = [bins = j.at( "bins" ).get<std::vector<double>>()]( unsigned int nx ) { return bins[nx]; };
844 }
845 }
std::function< double(unsigned int)> m_get
Definition Utils.h:832

Member Function Documentation

◆ operator[]()

auto Gaudi::Histograming::Sink::BinAccessor::operator[] ( const unsigned int n) const
inline

Definition at line 846 of file Utils.h.

846 {
847 using std::abs;
848 return abs( m_get( n ) );
849 }
Gaudi::ParticleID abs(const Gaudi::ParticleID &p)
Return the absolute value for a PID.
Definition ParticleID.h:191

Member Data Documentation

◆ m_get

std::function<double( unsigned int )> Gaudi::Histograming::Sink::BinAccessor::m_get

Definition at line 832 of file Utils.h.


The documentation for this struct was generated from the following file:
  • GaudiKernel/include/Gaudi/Histograming/Sink/Utils.h