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::Histogram::Bin Class Reference

Bin class with Tensor contents. More...

#include <Histogram.hh>

+ Collaboration diagram for Hammer::Histogram::Bin:

Public Member Functions

 Bin (const Tensor &t, bool withErrors=false)
 constructor based on a tensor (for determining shape and labels) More...
 
 Bin (const Serial::FBTensor *w, const Serial::FBTensor *w2, size_t num)
 serialization constructor More...
 
 Bin (const Bin &other)=default
 
Binoperator= (const Bin &other)=default
 
 Bin (Bin &&other)=default
 
Binoperator= (Bin &&other)=default
 
 ~Bin ()=default
 
void clear ()
 clears the contents of the bin (including the shapes of the tensors) More...
 
void addWeight (const Tensor &t)
 add the values of a tensor to the current bin. More...
 
const TensorgetWeight () const
 the sum of tensor weights contained in the bin More...
 
const TensorgetSquaredWeight () const
 the sum of (outer) squared tensor weights contained in the bin, or an empty tensor if the errors are not tracked More...
 
size_t getNumEvents () const
 the number of entries in the bin (number of times addWeight has been called) More...
 
Binoperator+= (const Bin &other)
 

Private Attributes

Tensor _weight
 tensor sum of weights More...
 
Tensor _weight2
 tensor sum of squared weights (in the outer square sense) More...
 
size_t _NEvents
 number of entries More...
 
bool _withErrors
 

Detailed Description

Bin class with Tensor contents.

Contains an histogram bin, with value, error, etc.

Definition at line 47 of file Histogram.hh.

Constructor & Destructor Documentation

Hammer::Histogram::Bin::Bin ( const Tensor t,
bool  withErrors = false 
)

constructor based on a tensor (for determining shape and labels)

Parameters
[in]tthe model tensor
[in]withErrorswhether errors should also be initialized (squared tensor weights)

Definition at line 25 of file Histogram.cc.

Hammer::Histogram::Bin::Bin ( const Serial::FBTensor *  w,
const Serial::FBTensor *  w2,
size_t  num 
)

serialization constructor

Parameters
[in]wthe reader for the sum of tensor weights
[in]w2the reader for the sum of the squared tensor weights (if available)
[in]numthe number of entries

Definition at line 38 of file Histogram.cc.

Hammer::Histogram::Bin::Bin ( const Bin other)
default
Hammer::Histogram::Bin::Bin ( Bin &&  other)
default
Hammer::Histogram::Bin::~Bin ( )
default

Member Function Documentation

void Hammer::Histogram::Bin::addWeight ( const Tensor t)

add the values of a tensor to the current bin.

Throws if the shapes do not match

Parameters
[in]tthe tensor

Definition at line 55 of file Histogram.cc.

void Hammer::Histogram::Bin::clear ( )

clears the contents of the bin (including the shapes of the tensors)

Definition at line 49 of file Histogram.cc.

size_t Hammer::Histogram::Bin::getNumEvents ( ) const

the number of entries in the bin (number of times addWeight has been called)

Returns
the number of events

Definition at line 71 of file Histogram.cc.

const Tensor & Hammer::Histogram::Bin::getSquaredWeight ( ) const

the sum of (outer) squared tensor weights contained in the bin, or an empty tensor if the errors are not tracked

Returns
the squared weights

Definition at line 67 of file Histogram.cc.

const Tensor & Hammer::Histogram::Bin::getWeight ( ) const

the sum of tensor weights contained in the bin

Returns
the weights

Definition at line 63 of file Histogram.cc.

Histogram::Bin & Hammer::Histogram::Bin::operator+= ( const Bin other)
Parameters
[in]other
Returns

Definition at line 75 of file Histogram.cc.

Bin& Hammer::Histogram::Bin::operator= ( const Bin other)
default
Bin& Hammer::Histogram::Bin::operator= ( Bin &&  other)
default

Member Data Documentation

size_t Hammer::Histogram::Bin::_NEvents
private

number of entries

Definition at line 95 of file Histogram.hh.

Tensor Hammer::Histogram::Bin::_weight
private

tensor sum of weights

Definition at line 93 of file Histogram.hh.

Tensor Hammer::Histogram::Bin::_weight2
private

tensor sum of squared weights (in the outer square sense)

Definition at line 94 of file Histogram.hh.

bool Hammer::Histogram::Bin::_withErrors
private

Definition at line 96 of file Histogram.hh.


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