BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
Data Structures | Public Types | Public Member Functions | Data Fields
HistSparse1D< T > Class Template Reference

Sparse 1D histogram based on a map. More...

#include <HistSparse1D.hh>

Inheritance diagram for HistSparse1D< T >:
Inheritance graph
Collaboration diagram for HistSparse1D< T >:
Collaboration graph

Data Structures

struct  Bin
 
struct  BinWorking
 

Public Types

typedef std::map< T, BinWorking >::iterator iterator
 Iterator mechanics.
 
typedef std::map< T, BinWorking >::const_iterator const_iterator
 

Public Member Functions

 HistSparse1D ()
 Public constructor only for compatibility with ROOT - not intended for use.
 
 HistSparse1D (const std::string &nameIn)
 Use this constructor.
 
void Fill (T x, double weight=1.0)
 
long long int Entries () const
 
size_t size () const
 
std::map< T, BinResult () const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
bool empty () const
 
BinWorkingoperator[] (const long long int key)
 
const BinWorkingoperator[] (const long long int key) const
 
bool HasAbscissa (T value) const
 
 ClassDef (HistSparse1D, 1)
 

Data Fields

std::string name
 
std::map< T, BinWorkingdata
 
long long int entries
 

Detailed Description

template<class T>
class HistSparse1D< T >

Sparse 1D histogram based on a map.

Simple implementation for what we need. ROOT's THnSparse is really complicated and couldn't get to work - overly complex for what we need. Boost histograms are better but we don't have a dependency on that yet, so for now a super simple one of our own.

This doesn't have any limits and just accumulates for each unique key forming a set of keys.

Author
L. Nevay

Definition at line 44 of file HistSparse1D.hh.

Member Typedef Documentation

◆ const_iterator

template<class T >
typedef std::map<T,BinWorking>::const_iterator HistSparse1D< T >::const_iterator

Definition at line 106 of file HistSparse1D.hh.

◆ iterator

template<class T >
typedef std::map<T,BinWorking>::iterator HistSparse1D< T >::iterator

Iterator mechanics.

Definition at line 105 of file HistSparse1D.hh.

Constructor & Destructor Documentation

◆ HistSparse1D()

template<class T >
HistSparse1D< T >::HistSparse1D ( const std::string &  nameIn)
inlineexplicit

Use this constructor.

Definition at line 51 of file HistSparse1D.hh.

◆ ~HistSparse1D()

template<class T >
HistSparse1D< T >::~HistSparse1D
virtual

Definition at line 30 of file HistSparse1D.cc.

Member Function Documentation

◆ begin() [1/2]

template<class T >
iterator HistSparse1D< T >::begin ( )
inline

Definition at line 107 of file HistSparse1D.hh.

◆ begin() [2/2]

template<class T >
const_iterator HistSparse1D< T >::begin ( ) const
inline

Definition at line 109 of file HistSparse1D.hh.

◆ empty()

template<class T >
bool HistSparse1D< T >::empty ( ) const
inline

Definition at line 111 of file HistSparse1D.hh.

◆ end() [1/2]

template<class T >
iterator HistSparse1D< T >::end ( )
inline

Definition at line 108 of file HistSparse1D.hh.

◆ end() [2/2]

template<class T >
const_iterator HistSparse1D< T >::end ( ) const
inline

Definition at line 110 of file HistSparse1D.hh.

◆ Entries()

template<class T >
long long int HistSparse1D< T >::Entries ( ) const
inline

Definition at line 89 of file HistSparse1D.hh.

◆ Fill()

template<class T >
void HistSparse1D< T >::Fill ( x,
double  weight = 1.0 
)
inline

Definition at line 82 of file HistSparse1D.hh.

◆ HasAbscissa()

template<class T >
bool HistSparse1D< T >::HasAbscissa ( value) const
inline

Definition at line 116 of file HistSparse1D.hh.

◆ operator[]() [1/2]

template<class T >
BinWorking & HistSparse1D< T >::operator[] ( const long long int  key)
inline

Definition at line 113 of file HistSparse1D.hh.

◆ operator[]() [2/2]

template<class T >
const BinWorking & HistSparse1D< T >::operator[] ( const long long int  key) const
inline

Definition at line 114 of file HistSparse1D.hh.

◆ Result()

template<class T >
std::map< T, Bin > HistSparse1D< T >::Result ( ) const
inline

Definition at line 91 of file HistSparse1D.hh.

◆ size()

template<class T >
size_t HistSparse1D< T >::size ( ) const
inline

Definition at line 90 of file HistSparse1D.hh.

Field Documentation

◆ data

template<class T >
std::map<T, BinWorking> HistSparse1D< T >::data

Definition at line 119 of file HistSparse1D.hh.

◆ entries

template<class T >
long long int HistSparse1D< T >::entries

Definition at line 120 of file HistSparse1D.hh.

◆ name

template<class T >
std::string HistSparse1D< T >::name

Definition at line 118 of file HistSparse1D.hh.


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