10 #ifndef ICARUSCODE_DECODE_DATAPRODUCT_TRIGGERCONFIGURATION_H
11 #define ICARUSCODE_DECODE_DATAPRODUCT_TRIGGERCONFIGURATION_H
23 struct TriggerConfiguration;
44 #if __cplusplus < 202004L
52 # error "With C++20 support, enable the default comparison operators"
95 #if __cplusplus < 202004L
103 # error "With C++20 support, enable the default comparison operators"
122 unsigned int vetoDelay = 0;
125 std::array<CryoConfig, icarus::trigger::kNTriggerLocation> cryoConfig;
128 std::string majorityTriggerType;
134 unsigned int tpcTriggerDelay = 0;
137 std::array<GateConfig, icarus::trigger::kNTriggerSource> gateConfig;
139 // --- END ---- Data members -------------------------------------------------
141 // --- BEGIN -- Derived quantities -------------------------------------------
148 float getGateWidth( std::size_t source ) const {
150 // We really want the vetoDelay to be shorter than the gateWidth
151 assert(!gateConfig[source].hasGate || (gateConfig[source].gateWidth >= vetoDelay));
153 return gateConfig[source].hasGate ?
154 static_cast<float>( gateConfig[source].gateWidth - vetoDelay )/1000. : 0.;
164 float getDriftGateWidth( std::size_t source ) const {
166 return gateConfig[source].hasDriftGate ?
167 static_cast<float>( gateConfig[source].driftGateWidth )/1000. : 0U;
177 unsigned int getOffBeamRate( std::size_t source ) const {
179 return gateConfig[source].hasGate ? gateConfig[source].offBeamGateRate : 0U;
189 unsigned int getMinBiasPrescale( std::size_t source ) const {
191 return gateConfig[source].hasGate ? gateConfig[source].prescaleMinBias : 0U;
196 // --- END ---- Derived quantities -------------------------------------------
198 #if __cplusplus < 202004L
201 bool operator== (TriggerConfiguration const& other) const noexcept;
202 bool operator!= (TriggerConfiguration const& other) const noexcept
203 { return ! this->operator== (other); }
206 # error "With C++20 support, enable the default comparison operators"
207 // probably the compiler will be generating these anyway, so don't bother
240 void dump(std::ostream& out,
241 std::string
const& indent, std::string
const& firstIndent,
254 void dump(std::ostream& out, std::string
const& indent =
"")
const
255 {
dump(out, indent, indent); }
269 std::string
const& indent
273 unsigned int verbosity,
274 std::string
const& indent =
""
276 {
dump(out, indent, indent, verbosity); }
288 inline bool icarus::TriggerConfiguration::operator==
292 if ( useWrTime != other.useWrTime )
return false;
293 if ( wrTimeOffset != other.wrTimeOffset )
return false;
294 if ( vetoDelay != other.vetoDelay )
return false;
295 if ( majorityTriggerType != other.majorityTriggerType )
return false;
296 if (
runType != other.runType )
return false;
297 if ( tpcTriggerDelay != other.tpcTriggerDelay )
return false;
306 inline bool icarus::TriggerConfiguration::CryoConfig::operator==
309 if ( majLevelInTime != other.majLevelInTime )
return false;
310 if ( majLevelDrift != other.majLevelDrift )
return false;
311 if ( slidingWindow != other.slidingWindow )
return false;
319 inline bool icarus::TriggerConfiguration::GateConfig::operator==
322 if( hasGate != other.hasGate )
return false;
323 if( hasDriftGate != other.hasDriftGate )
return false;
324 if( hasMinBiasGate != other.hasMinBiasGate )
return false;
325 if( gateWidth != other.gateWidth )
return false;
326 if( driftGateWidth != other.driftGateWidth )
return false;
327 if( prescaleMinBias != other.prescaleMinBias )
return false;
328 if( offBeamGateRate != other.offBeamGateRate )
return false;
329 if( earlyWarningOffset != other.earlyWarningOffset )
return false;
330 if( earlyEarlyWarningOffset != other.earlyEarlyWarningOffset )
return false;
331 if( period != other.period )
return false;
340 { config.
dump(out);
return out; }
346 #endif // ICARUSCODE_DECODE_DATAPRODUCT_TRIGGERCONFIGURATION_H
Definitions of the trigger bits for SBN.
bool hasDriftGate
Return drift gate activation status (for out-of-time light)
unsigned int majLevelDrift
Majority Level for out-of-time activity.
stream1 can override from command line with o or output services user runType
bool operator!=(GateConfig const &other) const noexcept
bool hasGate
Return gate activation.
bool operator!=(CryoConfig const &other) const noexcept
void dumpGateConfig(std::ostream &out, icarus::TriggerConfiguration::GateConfig const &gateConfig, std::string const &indent) const
Dumps the content of the gate configuration into out stream.
std::ostream & operator<<(std::ostream &out, IntegerRanges< T, CheckGrowing > const &ranges)
unsigned int majLevelInTime
Majority Level for in-time activity.
bool operator==(GateConfig const &other) const noexcept
Comparison: all fields need to have the same values.
unsigned int period
Period of two consecutive pulses from the internal pulse generator (valid for calibration gate) in ns...
void dump(std::ostream &out, std::string const &indent="") const
Dumps the content of the configuration into out stream.
unsigned int wrTimeOffset
Add an offset between the npt and tai time as used in the wr reference (normally it is 1 or 2 leap se...
bool operator==(CryoConfig const &other) const noexcept
Comparison: all fields need to have the same values.
bool hasMinBiasGate
Return MinBias triggers activation status.
void dump(std::ostream &out, unsigned int verbosity, std::string const &indent="") const
std::array< GateConfig, icarus::trigger::kNTriggerSource > gateConfig
Gate Configuration.
unsigned long prescaleMinBias
Prescale for the MinBias triggers (calculated with respect to the number of gates opened) ...
void dump(std::ostream &out, std::string const &indent, std::string const &firstIndent, unsigned int verbosity=MaxDumpVerbosity) const
Dumps the content of the configuration into out stream.
bool useWrTime
Use the WR time reference.
unsigned int slidingWindow
Window selection "Fixed" (0) or "Overlapping" (1)
bool hasMinBiasDriftGate
Return MinBias drift gate activation status (for out-of-time light)
unsigned int gateWidth
Duration of the gate for the in-time activity in ns.
static constexpr unsigned int MaxDumpVerbosity
Maximum supported verbosity level supported by dump().
static constexpr unsigned int DefaultDumpVerbosity
Default verbosity level for dump().
unsigned long earlyEarlyWarningOffset
Early Early warning offset for the BNB (NuMI) $1D ($AE) in ns; used for the drift gate...
unsigned long offBeamGateRate
Rate of gates opened outside the extraction (calculated with respect to the number of gates opened) ...
unsigned long earlyWarningOffset
Early warning offset for the BNB (NuMI) GatedBES ($MIBS74) in ns; used for the beam gate...
unsigned int driftGateWidth
Duration of the drift gate for the out-of-time activity in ns.