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
46 // the corresponding logical volume will its user limits to
47 // G4UserLimits(maxStep, maxStep));
48 double maxStep;
49
50public:
62 GReadoutSpecs(const double tw,
63 const double gst,
64 const HitBitSet hbs,
65 const double ms,
66 const std::shared_ptr<GLogger>& log) :
67 timeWindow(tw),
68 gridStartTime(gst),
69 hitBitSet(hbs),
70 maxStep(ms) {
71 log->info(1, "GReadoutSpecs: timeWindow=", timeWindow, ", gridStartTime=", gridStartTime, ", hitBitSet=",
72 hitBitSet);
73 }
74
80 [[nodiscard]] inline HitBitSet getHitBitSet() const { return hitBitSet; }
81
82 [[nodiscard]] inline double getMaxStep() const { return maxStep; }
83
99 [[nodiscard]] inline int timeCellIndex(double time) const {
100 return static_cast<int>(std::floor(( time - gridStartTime ) / timeWindow) + 1);
101 }
102};
103
104// At compile time, make sure GReadoutSpecs has trivial destructors.
105static_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 double ms, const std::shared_ptr< GLogger > &log)
Constructs a GReadoutSpecs object.
double getMaxStep() const
HitBitSet getHitBitSet() const
Returns the configured hit bitset.
std::bitset< NHITBITS > HitBitSet