SEvent/StationTriggerData.h
Go to the documentation of this file.
1 #ifndef _sevt_StationTriggerData_h_
2 #define _sevt_StationTriggerData_h_
3 
4 #include <utl/ShadowPtr_fwd.h>
5 #include <string>
6 #include <cstdint>
7 
8 namespace sevt {
9 
19 
20  public:
21  enum Algorithm {
22  // force explicit mapping for string array index, see StationTrigger.cc
23  eNone = 0,
29  eRandom = 6,
30  eMuon = 7, // muons are here just for backward compatibility
31  eSilent = 8,
33  };
34 
35  enum PLDTrigger {
36  ePLDNone = 0x00000000,
37  // Latch triggers
38  ePLDLatchThreshold = 0x00000001, // T1 and T2 threshold
39  ePLDLatchTOTA = 0x00000002, // TOT
40  ePLDLatchTOTB = 0x00000004, // TOTd
41  ePLDLatchTOTC = 0x00000008, // MOPS
42  ePLDLatchRandom = 0x00000010, // Random trigger
43  ePLDLatchRD = 0x00100000, // RD trigger
44  // Post-latch triggers
45  ePLDThreshold = 0x00000100, // T1 and T2 threshold
46  ePLDTOTA = 0x00000200, // TOT
47  ePLDTOTB = 0x00000400, // TOTd
48  ePLDTOTC = 0x00000800, // MOPS
49  ePLDRandom = 0x00001000, // Random trigger
50  ePLDRD = 0x10000000, // RD trigger
51  // (DV) Muon: this is not a PLD bit. It is set only explicitly via
52  // SetAlgorithm(). This feature is maintained on behalf of some
53  // modules (TankSimulator).
54  ePLDMuon = 0x80000000
55  };
56 
57  enum ErrorCode {
58  eNoError = 0,
66  };
67 
68  int GetOffsetMicroSecond() const { return fOffsetMicroSecond; }
69  int GetWindowMicroSecond() const { return fWindowMicroSecond; }
70  int GetErrorCode() const { return fErrorCode; }
71 
72  typedef std::uint32_t PLDType;
73  PLDType GetPLDTrigger() const { return fPLDTrigger; }
74 
76  bool IsTimeOverThreshold() const
77  { return fPLDTrigger & ePLDTotalTOT; }
78 
81  { return fPLDTrigger & ePLDTotalTOTD; }
82 
83  // Multiplicity of positive steps
85  { return fPLDTrigger & ePLDTotalMOPS; }
86 
90 
91  bool IsRDThreshold() const
92  { return fPLDTrigger & ePLDTotalRD; }
93 
95  bool
96  IsT1()
97  const
98  {
99  return fWindowMicroSecond && (
103  IsRDThreshold()
104  );
105  }
106 
108  bool
109  IsT2()
110  const
111  {
112  return IsT2Threshold() ||
116  IsRDThreshold();
117  }
118 
120  bool
121  IsT2TimeOverThresholdLike()
122  const
123  {
124  // no T2Threshold
125  return IsTimeOverThreshold() ||
128  IsRDThreshold();
129  }
130 
132  bool IsT1Threshold() const
133  { return IsThresholdBit() && fWindowMicroSecond; }
134 
136  bool IsT2Threshold() const
137  { return IsThresholdBit() && !fWindowMicroSecond; }
138 
139  bool IsRandom() const { return fPLDTrigger & ePLDTotalRandom; }
140 
141  bool IsMuon() const
142  { return fWindowMicroSecond && (fPLDTrigger & ePLDMuon); }
143 
144  bool IsSilent() const
145  { return fWindowMicroSecond && fErrorCode == eT3NotFound; }
146 
147  Algorithm GetAlgorithm() const;
148  const std::string& GetAlgorithmName() const { return fgAlgorithmLookup[GetAlgorithm()]; }
149 
150  int GetPLDTimeOffset() const { return fPLDTimeOffset; }
151  std::string GetPLDVersion() const { return fPLDVersion; }
152 
153  void SetOffsetMicroSecond(const int offset) { fOffsetMicroSecond = offset; }
154  void SetWindowMicroSecond(const int window) { fWindowMicroSecond = window; }
155  void SetErrorCode(const int errorCode) { fErrorCode = errorCode; }
156  void SetPLDTrigger(const PLDType trigger) { fPLDTrigger = trigger; }
157  void SetAlgorithm(const Algorithm algo);
158  void SetPLDTimeOffset(const int offset) { fPLDTimeOffset = offset; }
159  void SetPLDVersion(const std::string version) { fPLDVersion = version; }
160 
161  private:
162  StationTriggerData() = default;
163 
164  bool IsThresholdBit() const { return fPLDTrigger & ePLDTotalThreshold; }
165 
167  // combined (see SD Calibration report by X. Bertou and PLD trigger guide)
169  ePLDTotalTOT = (ePLDLatchTOTA | ePLDTOTA), // according to IoSdData
175  };
176 
179  int fErrorCode = -1;
181  int fPLDTimeOffset = 0;
182  std::string fPLDVersion = "Unknown";
183 
184  static const std::string fgAlgorithmLookup[];
185 
186  friend class Station;
187  friend class StationSimData;
189 
190  };
191 
192 }
193 
194 
195 #endif
pointer with built-in initialization, deletion, deep copying
Definition: ShadowPtr.h:163
bool IsTimeOverThresholdDeconvoluted() const
Time Over Threshold deconvoluted.
Station Level Simulated Data
void SetOffsetMicroSecond(const int offset)
static const std::string fgAlgorithmLookup[]
const std::string & GetAlgorithmName() const
class to hold data at Station level
bool IsT1Threshold() const
T1 threshold.
void SetPLDTrigger(const PLDType trigger)
void SetPLDVersion(const std::string version)
bool IsT2Threshold() const
T2 threshold.
bool IsThresholdOrTimeOverThreshold() const
Any of the PLD triggers (threshold or TOT)
bool IsTimeOverThreshold() const
T1 TOT is always promoted to T2 TOT.
Algorithm GetAlgorithm() const
Station Trigger Data description
void SetWindowMicroSecond(const int window)
void SetAlgorithm(const Algorithm algo)
void SetErrorCode(const int errorCode)
void SetPLDTimeOffset(const int offset)

, generated on Tue Sep 26 2023.