Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JROOT::JBinsMapHelper< TH1D > Struct Reference

Auxiliary class for retrieving 1D histograms corresponding to a given histogram name. More...

#include <JBinsMap.hh>

Public Member Functions

 JBinsMapHelper (const JBinsMap &binsMap)
 Constructor.
 
std::unique_ptr< TH1D > operator() (const std::string &name) const
 Get 1D histogram with binning corresponding to a given histogram name.
 

Private Attributes

const JBinsMapbinsMap
 Bins map.
 

Detailed Description

Auxiliary class for retrieving 1D histograms corresponding to a given histogram name.

Definition at line 176 of file JBinsMap.hh.

Constructor & Destructor Documentation

◆ JBinsMapHelper()

JROOT::JBinsMapHelper< TH1D >::JBinsMapHelper ( const JBinsMap & binsMap)
inline

Constructor.

Parameters
binsMapbins map

Definition at line 183 of file JBinsMap.hh.

183 :
185 {}
const JBinsMap & binsMap
Bins map.
Definition JBinsMap.hh:222

Member Function Documentation

◆ operator()()

std::unique_ptr< TH1D > JROOT::JBinsMapHelper< TH1D >::operator() ( const std::string & name) const
inline

Get 1D histogram with binning corresponding to a given histogram name.

Parameters
namehistogram name
Returns
pointer to 1D histogram

Definition at line 194 of file JBinsMap.hh.

195 {
196 using namespace std;
197 using namespace JPP;
198
199 typename JBinsMap::const_iterator i = binsMap.find(name);
200
201 if (i == binsMap.cend()) {
202 THROW(JNoValue, "JBinsMapHelper<TH1D>::operator(): No bin configuration found for " << name);
203 }
204
205 const typename JBinsMap::mapped_type& bins = i->second;
206
207 typename JBinsMap::mapped_type::const_iterator p = bins.find('x');
208
209 if (p != bins.cend()) {
210
211 const vector<double>& Xbins = p->second;
212
213 return std::make_unique<TH1D>(name.c_str(), "",
214 Xbins.size()-1, Xbins.data());
215 }
216
217 THROW(JNoValue, "JBinsMapHelper<TH1D>::operator(): Missing x-axis binning for " << name);
218 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Exception for missing value.
map_type::const_iterator const_iterator
Definition JBinsMap.hh:53
map_type::mapped_type mapped_type
Definition JBinsMap.hh:47
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).

Member Data Documentation

◆ binsMap

const JBinsMap& JROOT::JBinsMapHelper< TH1D >::binsMap
private

Bins map.

Definition at line 222 of file JBinsMap.hh.


The documentation for this struct was generated from the following file: