Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Hammer::Histos Class Reference

Hammer histogram manager class. More...

#include <Histos.hh>

+ Inheritance diagram for Hammer::Histos:
+ Collaboration diagram for Hammer::Histos:

Public Member Functions

 Histos (DictionaryManager *dict=nullptr)
 
 Histos (const Histos &other)=delete
 
Histosoperator= (const Histos &other)=delete
 
 Histos (Histos &&other)=delete
 
Histosoperator= (Histos &&other)=delete
 
 ~Histos () noexcept
 
void addHistogramDefinition (const std::string &histogramName, const IndexList &binSizes, bool hasUnderOverFlow=true, const MD::BinRangeList &ranges={}, bool shouldCompress=false, bool withErrors=false)
 
void addHistogramDefinition (const std::string &histogramName, const MD::BinEdgeList &binEdges, bool hasUnderOverFlow=true, bool shouldCompress=false, bool withErrors=false)
 
void createProjectedHistogram (const std::string &oldName, const std::string &newName, const std::set< uint16_t > &collapsedIndexPositions)
 
void setHistogramCompression (const std::string &histogramName, bool value=true)
 
void setHistogramKeepErrors (const std::string &histogramName, bool value=true)
 
void addHistogramFixedData (const std::string &histogramName, MD::SharedTensorData data)
 
void resetHistogramFixedData (const std::string &histogramName)
 
void removeHistogram (const std::string &histogramName)
 
void init ()
 
void setEventId (EventUID eventId)
 
void clear ()
 
IndexList getBinIndices (const std::string &histogramName, const MD::BinValue &value) const
 
EventUIDGroup getHistogramEventIds (const std::string &name, const std::string &scheme) const
 
MD::BinEdgeList getHistogramEdges (const std::string &histogramName) const
 
IndexList getHistogramShape (const std::string &histogramName) const
 
bool getUnderOverFlows (const std::string &histogramName) const
 
size_t size () const
 
bool canFill (const std::string &name, const std::vector< double > &values)
 Checks values can be binned. More...
 
void checkExists (const std::string &name)
 Checks histogram exists. More...
 
IOHistogram getHistogram (const std::string &histogramName, const std::string &schemeName) const
 
EventIdGroupDict< IOHistogramgetHistograms (const std::string &histogramName, const std::string &schemeName) const
 
bool isValidHistogram (const std::string &histogramName, size_t dim) const
 
std::vector< std::string > getHistogramNames () const
 
void fillHisto (const std::string &histogramName, const std::string &schemeName, const IndexList &binPosition, Tensor &value, double extraWeight=1.0)
 
bool writeDefinition (flatbuffers::FlatBufferBuilder *msgwriter, const std::string &histogramName) const
 
bool writeHistogram (flatbuffers::FlatBufferBuilder *msgwriter, const std::string &histogramName, const std::string &schemeName, const EventUID &eventIDs) const
 
std::string readDefinition (const Serial::FBHistoDefinition *msgreader, bool merge)
 
HistoInfo readHistogram (const Serial::FBHistogram *msgreader, bool merge)
 
std::vector< EventUIDgetEventIDRepsForHisto (const std::string &name, const std::string &scheme) const
 
- Public Member Functions inherited from Hammer::SettingsConsumer
virtual void setSettingsHandler (SettingsHandler &sh)
 set link to settings repository handler. More...
 
void setSettingsHandler (const SettingsConsumer &other)
 
SettingsHandlergetSettingsHandler () const
 provide the pointer to the repository handler More...
 
WTerm setWeightTerm (WTerm group)
 
virtual void addRefs () const
 
 SettingsConsumer ()
 base constructor More...
 
 SettingsConsumer (const SettingsConsumer &)=default
 default copy constructor More...
 
SettingsConsumeroperator= (const SettingsConsumer &)=default
 
virtual ~SettingsConsumer ()
 virtual destructor More...
 

Protected Member Functions

LoggetLog () const
 logging facility More...
 
void defineSettings ()
 purely virtual function for a class to define new settings More...
 
- Protected Member Functions inherited from Hammer::SettingsConsumer
LoggetLog () const
 logging facility More...
 
void initSettings ()
 
void setPath (const std::string &path)
 provide the basic path for the settings defined by this class, as in "<path>:<setting>" More...
 
template<typename T >
void addSetting (const std::string &name, const T &defaultValue)
 template method to add a new setting More...
 
void removeSetting (const std::string &name)
 
template<typename T >
T * getSetting (const std::string &name) const
 template method to return a setting defined by this class More...
 
template<typename T >
T * getSetting (const std::string &otherPath, const std::string &name) const
 template method to return a setting defined by this class More...
 
bool isOn (const std::string &name) const
 method to check a boolean setting defined by this class More...
 
bool isOn (const std::string &otherPath, const std::string &name) const
 method to check a boolean setting by its name and path More...
 
template<typename T >
void updateVectorOfSettings (const std::vector< T > &values, const std::vector< std::string > &names, const std::string &path="", WTerm group=WTerm::COMMON)
 
template<typename T >
void updateVectorOfSettings (const std::map< std::string, T > &values, const std::string &path="", WTerm group=WTerm::COMMON)
 

Private Member Functions

const HistogramSetgetEntry (const std::string &histogramName, const std::string &schemeName) const
 
HistogramSetgetEntry (const std::string &histogramName, const std::string &schemeName)
 
std::vector< TensorgetExternalData (const std::string &schemeName, std::vector< LabelsList > labels) const
 

Private Attributes

EventUID _currentEventId
 
HistoNameDict
< HistogramDefinition
_histogramDefs
 
HistoNameDict< SchemeDict
< HistogramSet > > 
_histograms
 
DictionaryManager_dictionaries
 
bool _initialized
 

Additional Inherited Members

- Protected Attributes inherited from Hammer::SettingsConsumer
SettingsHandler_settingHandler
 pointer to the settings repository handler. More...
 
std::string _settingPath
 path of the settings defined by this class More...
 
WTerm _group
 
std::set< std::string > _ownedSettings
 

Detailed Description

Hammer histogram manager class.

Stores Hammer histograms, ...

Definition at line 43 of file Histos.hh.

Constructor & Destructor Documentation

Hammer::Histos::Histos ( DictionaryManager dict = nullptr)

Definition at line 35 of file Histos.cc.

Hammer::Histos::Histos ( const Histos other)
delete
Hammer::Histos::Histos ( Histos &&  other)
delete
Hammer::Histos::~Histos ( )
noexcept

Definition at line 38 of file Histos.cc.

Member Function Documentation

void Hammer::Histos::addHistogramDefinition ( const std::string &  histogramName,
const IndexList binSizes,
bool  hasUnderOverFlow = true,
const MD::BinRangeList ranges = {},
bool  shouldCompress = false,
bool  withErrors = false 
)
Parameters
[in]histogramName
[in]binSizes
[in]hasUnderOverFlow
[in]ranges
[in]shouldCompress
[in]withErrors

Definition at line 43 of file Histos.cc.

void Hammer::Histos::addHistogramDefinition ( const std::string &  histogramName,
const MD::BinEdgeList binEdges,
bool  hasUnderOverFlow = true,
bool  shouldCompress = false,
bool  withErrors = false 
)

Definition at line 74 of file Histos.cc.

void Hammer::Histos::addHistogramFixedData ( const std::string &  histogramName,
MD::SharedTensorData  data 
)

Definition at line 162 of file Histos.cc.

bool Hammer::Histos::canFill ( const std::string &  name,
const std::vector< double > &  values 
)

Checks values can be binned.

Parameters
[in]name
[in]values
Returns

Definition at line 220 of file Histos.cc.

void Hammer::Histos::checkExists ( const std::string &  name)

Checks histogram exists.

Parameters
[in]name
Returns

Definition at line 229 of file Histos.cc.

void Hammer::Histos::clear ( )

Definition at line 201 of file Histos.cc.

void Hammer::Histos::createProjectedHistogram ( const std::string &  oldName,
const std::string &  newName,
const std::set< uint16_t > &  collapsedIndexPositions 
)

Definition at line 96 of file Histos.cc.

void Hammer::Histos::defineSettings ( )
protectedvirtual

purely virtual function for a class to define new settings

Implements Hammer::SettingsConsumer.

Definition at line 842 of file Histos.cc.

void Hammer::Histos::fillHisto ( const std::string &  histogramName,
const std::string &  schemeName,
const IndexList binPosition,
Tensor value,
double  extraWeight = 1.0 
)
Parameters
[in]histogramName
[in]schemeName
[in]binPosition
[in]value
[in]extraWeight

Definition at line 792 of file Histos.cc.

IndexList Hammer::Histos::getBinIndices ( const std::string &  histogramName,
const MD::BinValue value 
) const
Parameters
[in]histogramName
[in]value
Returns

Definition at line 208 of file Histos.cc.

const HistogramSet * Hammer::Histos::getEntry ( const std::string &  histogramName,
const std::string &  schemeName 
) const
private

Definition at line 236 of file Histos.cc.

HistogramSet * Hammer::Histos::getEntry ( const std::string &  histogramName,
const std::string &  schemeName 
)
private

Definition at line 250 of file Histos.cc.

vector< EventUID > Hammer::Histos::getEventIDRepsForHisto ( const std::string &  name,
const std::string &  scheme 
) const

Definition at line 343 of file Histos.cc.

vector< Tensor > Hammer::Histos::getExternalData ( const std::string &  schemeName,
std::vector< LabelsList labels 
) const
private

Definition at line 307 of file Histos.cc.

IOHistogram Hammer::Histos::getHistogram ( const std::string &  histogramName,
const std::string &  schemeName 
) const
Parameters
[in]histogramName
[in]schemeName
Returns

Definition at line 327 of file Histos.cc.

MD::BinEdgeList Hammer::Histos::getHistogramEdges ( const std::string &  histogramName) const

Definition at line 275 of file Histos.cc.

EventUIDGroup Hammer::Histos::getHistogramEventIds ( const std::string &  name,
const std::string &  scheme 
) const

Definition at line 264 of file Histos.cc.

vector< string > Hammer::Histos::getHistogramNames ( ) const

Definition at line 337 of file Histos.cc.

EventIdGroupDict< IOHistogram > Hammer::Histos::getHistograms ( const std::string &  histogramName,
const std::string &  schemeName 
) const
Parameters
[in]histogramName
[in]schemeName
Returns

Definition at line 317 of file Histos.cc.

IndexList Hammer::Histos::getHistogramShape ( const std::string &  histogramName) const

Definition at line 286 of file Histos.cc.

Log & Hammer::Histos::getLog ( ) const
protected

logging facility

Returns
stream to be used for logging

Definition at line 838 of file Histos.cc.

bool Hammer::Histos::getUnderOverFlows ( const std::string &  histogramName) const

Definition at line 297 of file Histos.cc.

void Hammer::Histos::init ( )

Definition at line 180 of file Histos.cc.

bool Hammer::Histos::isValidHistogram ( const std::string &  histogramName,
size_t  dim 
) const

Definition at line 373 of file Histos.cc.

Histos& Hammer::Histos::operator= ( const Histos other)
delete
Histos& Hammer::Histos::operator= ( Histos &&  other)
delete
string Hammer::Histos::readDefinition ( const Serial::FBHistoDefinition *  msgreader,
bool  merge 
)
Parameters
[in]msgreader
[in]merge

Definition at line 874 of file Histos.cc.

HistoInfo Hammer::Histos::readHistogram ( const Serial::FBHistogram *  msgreader,
bool  merge 
)
Parameters
[in]msgreader
[in]merge

Definition at line 899 of file Histos.cc.

void Hammer::Histos::removeHistogram ( const std::string &  histogramName)

Definition at line 133 of file Histos.cc.

void Hammer::Histos::resetHistogramFixedData ( const std::string &  histogramName)

Definition at line 171 of file Histos.cc.

void Hammer::Histos::setEventId ( EventUID  eventId)
Parameters
[in]eventId

Definition at line 197 of file Histos.cc.

void Hammer::Histos::setHistogramCompression ( const std::string &  histogramName,
bool  value = true 
)

Definition at line 144 of file Histos.cc.

void Hammer::Histos::setHistogramKeepErrors ( const std::string &  histogramName,
bool  value = true 
)

Definition at line 153 of file Histos.cc.

size_t Hammer::Histos::size ( ) const
Returns

Definition at line 216 of file Histos.cc.

bool Hammer::Histos::writeDefinition ( flatbuffers::FlatBufferBuilder *  msgwriter,
const std::string &  histogramName 
) const
Parameters
[out]msgwriter
[in]histogramName

Definition at line 847 of file Histos.cc.

bool Hammer::Histos::writeHistogram ( flatbuffers::FlatBufferBuilder *  msgwriter,
const std::string &  histogramName,
const std::string &  schemeName,
const EventUID eventIDs 
) const
Parameters
[out]msgwriter
[in]histogramName
[in]schemeName
[in]eventIDs

Definition at line 857 of file Histos.cc.

Member Data Documentation

EventUID Hammer::Histos::_currentEventId
private

Definition at line 275 of file Histos.hh.

DictionaryManager* Hammer::Histos::_dictionaries
private

Definition at line 280 of file Histos.hh.

HistoNameDict<HistogramDefinition> Hammer::Histos::_histogramDefs
private

Definition at line 277 of file Histos.hh.

HistoNameDict<SchemeDict<HistogramSet> > Hammer::Histos::_histograms
private

Definition at line 278 of file Histos.hh.

bool Hammer::Histos::_initialized
private

Definition at line 282 of file Histos.hh.


The documentation for this class was generated from the following files: