Jpp 21.0.1
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 JBinsMap & binsMap
 Bins map.
 

Detailed Description

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

Definition at line 170 of file JBinsMap.hh.

Constructor & Destructor Documentation

◆ JBinsMapHelper()

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

Constructor.

Parameters
binsMapbins map

Definition at line 177 of file JBinsMap.hh.

177 :
179 {}
const JBinsMap & binsMap
Bins map.
Definition JBinsMap.hh:216

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 188 of file JBinsMap.hh.

189 {
190 using namespace std;
191 using namespace JPP;
192
193 typename JBinsMap::const_iterator i = binsMap.find(name);
194
195 if (i == binsMap.cend()) {
196 THROW(JNoValue, "JBinsMapHelper<TH1D>::operator(): No bin configuration found for " << name);
197 }
198
199 const typename JBinsMap::mapped_type& bins = i->second;
200
201 typename JBinsMap::mapped_type::const_iterator p = bins.find('x');
202
203 if (p != bins.cend()) {
204
205 const vector<double>& Xbins = p->second;
206
207 return std::make_unique<TH1D>(name.c_str(), "",
208 Xbins.size()-1, Xbins.data());
209 }
210
211 THROW(JNoValue, "JBinsMapHelper<TH1D>::operator(): Missing x-axis binning for " << name);
212 }
#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:51
map_type::mapped_type mapped_type
Definition JBinsMap.hh:45
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
name
Definition setup.py:24

Member Data Documentation

◆ binsMap

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

Bins map.

Definition at line 216 of file JBinsMap.hh.


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