gdynamicDigitization
Loading...
Searching...
No Matches
greadoutSpecs.h
Go to the documentation of this file.
1#pragma once
2
16#include <gemc/glogging/glogger.h>
17
18#include <cmath>
19#include <type_traits>
20
33{
34private:
36 double timeWindow;
37
39 double gridStartTime;
40
42 double maxStep;
43
44public:
55 GReadoutSpecs(const double tw,
56 const double gst,
57 const double ms,
58 const std::shared_ptr<GLogger>& log) :
59 timeWindow(tw),
60 gridStartTime(gst),
61 maxStep(ms) {
62 log->info(1, "GReadoutSpecs: timeWindow=", timeWindow, ", gridStartTime=", gridStartTime);
63 }
64
65 [[nodiscard]] inline double getMaxStep() const { return maxStep; }
66
82 [[nodiscard]] inline int timeCellIndex(double time) const {
83 return static_cast<int>(std::floor(( time - gridStartTime ) / timeWindow) + 1);
84 }
85};
86
87// At compile time, make sure GReadoutSpecs has trivial destructors.
88static_assert(std::is_trivially_destructible_v<GReadoutSpecs>);
Immutable readout timing specification.
int timeCellIndex(double time) const
Computes the 1-based electronics time-cell index for a given time.
double getMaxStep() const
GReadoutSpecs(const double tw, const double gst, const double ms, const std::shared_ptr< GLogger > &log)
Constructs a GReadoutSpecs object.