6 #ifndef H_RATEHISTOGRAMMER
7 #define H_RATEHISTOGRAMMER
26 template <
class Selector>
45 const std::string &name,
46 uint64_t divider=60*100000000ULL, uint64_t low=0, uint64_t high=30ULL*24ULL*60ULL,
47 uint64_t binCount=30UL*24UL*60ULL )
48 : _ctxh(
ContextBase::getActive().createHandle( fmt::format(
"RateHistogrammer_{}", name ) ) ),
52 _h = createHistogram1D( results, name.c_str(), low, high, binCount );
68 const std::string &name,
69 uint64_t divider=60*100000000ULL, uint64_t low=0,
70 uint64_t binCount=30UL*24UL*60ULL )
71 : _ctxh(
ContextBase::getActive().createHandle( fmt::format(
"RateHistogrammer_{}", name ) ) ),
75 _h = createHistogram1D( results, name.c_str(), low, low+binCount, binCount );
84 virtual void process( std::vector<DetectorEvent> &data ) noexcept {
85 auto proci = _ctxh->processInstance();
87 for(
auto &event : data ) {
88 if( _selector(event) ) {
89 fill( _h, event.time / _divider );
97 const Selector &
getSelector() const noexcept {
return _selector; }
Handle to context used by specific class.
Definition: ContextBase.hpp:188
Simple 1D histogram.
Definition: Histogram1D.hpp:26
Class holding tree of histograms and subtrees.
Definition: ObjectTree.hpp:44
Rate histogramming stage.
Definition: RateHistogrammer.hpp:27
virtual void process(std::vector< DetectorEvent > &data) noexcept
Fills rate histograms with filtered detector events.
Definition: RateHistogrammer.hpp:84
Selector & getSelector() noexcept
Returns the constant selector instance.
Definition: RateHistogrammer.hpp:104
const Selector & getSelector() const noexcept
Returns the constant selector instance.
Definition: RateHistogrammer.hpp:97
RateHistogrammer(_result_tree_type results, Selector selector, const std::string &name, uint64_t divider=60 *100000000ULL, uint64_t low=0, uint64_t high=30ULL *24ULL *60ULL, uint64_t binCount=30UL *24UL *60ULL)
Constructs the rate histogrammer.
Definition: RateHistogrammer.hpp:44
RateHistogrammer(_result_tree_type results, Selector selector, const std::string &name, uint64_t divider=60 *100000000ULL, uint64_t low=0, uint64_t binCount=30UL *24UL *60ULL)
Constructs the rate histogrammer.
Definition: RateHistogrammer.hpp:67
Abstract baseclass for all stages which uses or modifies detector events.
Definition: StageDetectorEvent.hpp:20
Definition: mainpage.dox:6
Default context for printing and collecting statistics.
Definition: ContextBase.hpp:41