6 #ifndef H_POTTU_RAWHISTOGRAMMER
7 #define H_POTTU_RAWHISTOGRAMMER
25 template <
class EventOp = EventOpEnergy>
54 void createAndSetHistogramsChannelInterval( _result_tree_type tree,
const std::string &prefix,
55 uint16_t chFirst, uint16_t chLast,
56 double low,
double high,
unsigned int binc ) {
57 for( uint16_t ch = chFirst; ch < chLast; ++ch ) {
58 std::string name = fmt::format(
"{}{:04d}", prefix, ch );
59 auto h1 = createHistogram1D( tree, name.c_str(), low, high, binc );
73 template <
class DAQCH>
74 void setGroup( DetectorEvent::group_type group,
double low,
double high,
unsigned int binc,
77 auto &g = daqchannels.getGroup( group );
79 std::string hname = fmt::format(
"Raw histogram of group {}", g.getName() );
81 auto h1 = createHistogram1D( tree, hname.c_str(), low, high, binc );
83 const auto &chs = g.getChannels();
84 for(
const auto &ch : chs )
87 _ctxh->logInfo( fmt::format(
"Assigned {} channels to raw group histogram for group \'{}\'.",
88 chs.size(), g.getName() ) );
92 virtual void process( std::vector<DetectorEvent> &data ) noexcept {
97 auto proci = _ctxh->processInstance();
99 for(
const auto &event : data ) {
100 if( _histos[event.ch] ) {
101 fill( _histos[event.ch], _eventOp(event) );
110 std::vector<_histogram_1d_type *> _histos;
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
Definition: RawHistogrammer.hpp:26
void setHistogram(uint16_t ch, _histogram_1d_type *h)
Sets individual histogram to a channel.
Definition: RawHistogrammer.hpp:44
virtual void process(std::vector< DetectorEvent > &data) noexcept
Uses or modifies detector events in a container.
Definition: RawHistogrammer.hpp:92
void setGroup(DetectorEvent::group_type group, double low, double high, unsigned int binc, const DAQCH &daqchannels, _result_tree_type tree)
Definition: RawHistogrammer.hpp:74
Abstract baseclass for all stages which uses or modifies detector events.
Definition: StageDetectorEvent.hpp:20
Definition: mainpage.dox:6
static ContextBase & getActive() noexcept
Returns active Context.
Definition: ContextBase.hpp:80