ATLAS Offline Software
Public Member Functions | Private Types | Private Attributes | List of all members
Monitored::HistogramFillerRebinableAxis< BASE, AXIS > Class Template Reference

Mixin class for rebinning of histogram axis. More...

#include <HistogramFillerRebinable.h>

Inheritance diagram for Monitored::HistogramFillerRebinableAxis< BASE, AXIS >:
Collaboration diagram for Monitored::HistogramFillerRebinableAxis< BASE, AXIS >:

Public Member Functions

 HistogramFillerRebinableAxis (const HistogramDef &definition, std::shared_ptr< IHistogramProvider > provider)
 
virtual unsigned fill (const HistogramFiller::VariablesPack &vars) const override
 

Private Types

enum  RebinMode { RebinMode::AddBins, RebinMode::ExtendAxes }
 

Private Attributes

RebinMode m_rebinMode
 

Detailed Description

template<typename BASE, Monitored::Axis AXIS>
class Monitored::HistogramFillerRebinableAxis< BASE, AXIS >

Mixin class for rebinning of histogram axis.

Template Parameters
BASEHistogramFiller base class
AXISHistogram axis that should be made rebinable

Definition at line 24 of file HistogramFillerRebinable.h.

Member Enumeration Documentation

◆ RebinMode

template<typename BASE , Monitored::Axis AXIS>
enum Monitored::HistogramFillerRebinableAxis::RebinMode
strongprivate
Enumerator
AddBins 
ExtendAxes 

Definition at line 67 of file HistogramFillerRebinable.h.

67 { AddBins, ExtendAxes };

Constructor & Destructor Documentation

◆ HistogramFillerRebinableAxis()

template<typename BASE , Monitored::Axis AXIS>
Monitored::HistogramFillerRebinableAxis< BASE, AXIS >::HistogramFillerRebinableAxis ( const HistogramDef definition,
std::shared_ptr< IHistogramProvider provider 
)
inline

Definition at line 27 of file HistogramFillerRebinable.h.

28  : BASE(definition, provider) {
29  if (definition.kAddBinsDynamically) {
31  } else {
33  }
34  }

Member Function Documentation

◆ fill()

template<typename BASE , Monitored::Axis AXIS>
virtual unsigned Monitored::HistogramFillerRebinableAxis< BASE, AXIS >::fill ( const HistogramFiller::VariablesPack vars) const
inlineoverridevirtual

Definition at line 36 of file HistogramFillerRebinable.h.

36  {
37  if (AXIS >= vars.size() ) { return 0; }
38  if (vars.var[AXIS]->size()==0) { return 0; }
39 
42  const IMonitoredVariable& var = *vars.var[AXIS];
43  for (size_t i = 0; i < var.size(); i++) {
44  const double v = var.get(i);
45  if (v < min) min = v;
46  if (v > max) max = v;
47  }
48 
49  TH1* hist = this->template histogram<TH1>();
50  TAxis* axis = detail::getAxis<AXIS>(hist);
53  Monitored::detail::rebinHistogram<AXIS>(hist, max);
54  }
55  } else {
56  hist->SetCanExtend(detail::axis_bit[AXIS]);
57  // ExtendAxis is an extremely expensive operation; only call if necessary
58  // Rebinning requires a lock on the global ROOT directory state
59  std::scoped_lock<std::mutex> dirLock(HistogramFactory::globalROOTMutex());
60  if (max >= axis->GetXmax()) hist->ExtendAxis(max, axis);
61  if (min < axis->GetXmin()) hist->ExtendAxis(min, axis);
62  }
63  return BASE::fill( vars );
64  }

Member Data Documentation

◆ m_rebinMode

template<typename BASE , Monitored::Axis AXIS>
RebinMode Monitored::HistogramFillerRebinableAxis< BASE, AXIS >::m_rebinMode
private

Definition at line 68 of file HistogramFillerRebinable.h.


The documentation for this class was generated from the following file:
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
plotmaker.hist
hist
Definition: plotmaker.py:148
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
Monitored::HistogramFillerRebinableAxis::RebinMode::AddBins
@ AddBins
yodamerge_tmp.axis
list axis
Definition: yodamerge_tmp.py:241
Monitored::HistogramFillerRebinableAxis::RebinMode::ExtendAxes
@ ExtendAxes
lumiFormat.i
int i
Definition: lumiFormat.py:85
fill
void fill(H5::Group &out_file, size_t iterations)
Definition: test-hdf5-writer.cxx:95
Monitored::HistogramFactory::globalROOTMutex
static std::mutex & globalROOTMutex()
Definition: HistogramFactory.h:68
python.PyAthena.v
v
Definition: PyAthena.py:154
Monitored::HistogramFillerRebinableAxis::m_rebinMode
RebinMode m_rebinMode
Definition: HistogramFillerRebinable.h:68
EL::Detail::ManagerOrder::BASE
@ BASE
the most basic operations, common for all tasks
Monitored::detail::axis_bit
constexpr std::array axis_bit
Definition: HistogramFillerUtils.h:33
Monitored::detail::shouldRebinHistogram
bool shouldRebinHistogram(const TAxis *axis, const double value)
Method checks if histogram should be rebinned.
Definition: HistogramFillerUtils.h:70