gdynamicDigitization
Loading...
Searching...
No Matches
greadoutSpecs.h
Go to the documentation of this file.
1#pragma once
2
17#include "ghitConventions.h" // HitBitSet
18#include "glogger.h"
19
20#include <cmath>
21#include <type_traits>
22
35{
36private:
38 double timeWindow;
39
41 double gridStartTime;
42
44 HitBitSet hitBitSet;
45
46public:
57 GReadoutSpecs(const double tw, const double gst, const HitBitSet hbs, const std::shared_ptr<GLogger>& log) :
58 timeWindow(tw),
59 gridStartTime(gst),
60 hitBitSet(hbs) {
61 log->info(1, "GReadoutSpecs: timeWindow=", timeWindow, ", gridStartTime=", gridStartTime, ", hitBitSet=",
62 hitBitSet);
63 }
64
70 [[nodiscard]] inline HitBitSet getHitBitSet() const { return hitBitSet; }
71
87 [[nodiscard]] inline int timeCellIndex(double time) const {
88 return static_cast<int>(std::floor((time - gridStartTime) / timeWindow) + 1);
89 }
90};
91
92// At compile time, make sure GReadoutSpecs has trivial destructors.
93static_assert(std::is_trivially_destructible_v<GReadoutSpecs>);
Immutable readout timing and storage specification.
int timeCellIndex(double time) const
Computes the 1-based electronics time-cell index for a given time.
GReadoutSpecs(const double tw, const double gst, const HitBitSet hbs, const std::shared_ptr< GLogger > &log)
Constructs a GReadoutSpecs object.
HitBitSet getHitBitSet() const
Returns the configured hit bitset.
std::bitset< NHITBITS > HitBitSet