23 fhicl::ParameterSet
const& container,
24 std::string
const& configListKey,
25 std::initializer_list<std::regex const> components
28 fhicl::ParameterSet
const sourceConfig
29 = container.get<fhicl::ParameterSet>(configListKey);
31 fhicl::ParameterSet configDocs;
32 for (
auto const& key: sourceConfig.get_names()) {
33 if (!sourceConfig.is_key_to_atom(key))
continue;
35 if (!
matchKey(key, components.begin(), components.end()))
continue;
37 std::string
const psetStr = sourceConfig.get<std::string>(key);
39 fhicl::ParameterSet pset;
41 pset = fhicl::ParameterSet::make(psetStr);
43 catch (cet::exception&
e) {
44 throw cet::exception{
"convertConfigurationDocuments",
"", e }
45 <<
"Error parsing the content of key '" << configListKey <<
"." << key
46 <<
"'; content was:\n" << psetStr <<
"\n";
49 configDocs.put(key, pset);
61 std::vector<std::regex>
const
63 { std::regex{
"icarustrigger.*" } }
68 (fhicl::ParameterSet
const& pset, std::string
const& key)
70 return matchKey(key, ConfigurationNames.begin(), ConfigurationNames.end());
76 ( std::string prescaleString, std::size_t
source )
const
87 using namespace std::string_literals;
95 throw std::runtime_error(
" icarus::TriggerConfigurationExtractor::parsePrescaleString triggerSource{"s
105 if (bitStr ==
bitName(bit))
return bitValue;
107 throw cet::exception{
"TriggerConfigurationExtractor" }
108 <<
"Trigger window mode '" << bitStr <<
"' is not known.\n";
114 (fhicl::ParameterSet
const& pset)
const
117 std::optional<icarus::TriggerConfiguration> config;
119 for (std::string
const& key: pset.get_names()) {
121 std::optional<fhicl::ParameterSet> triggerConfigPset
122 = readTriggerConfig(pset, key);
124 if (!triggerConfigPset)
continue;
126 std::optional triggerConfig
127 = extractTriggerConfiguration(*triggerConfigPset);
130 throw cet::exception{
"TriggerConfigurationExtractor" }
131 <<
"Found multiple configurations for the trigger:"
132 <<
"\n" << std::string(80,
'-') <<
"\n"
134 <<
"\n" << std::string(80,
'-') <<
"\n"
136 <<
"\n" << std::string(80,
'-') <<
"\n"
138 <<
"\n" << std::string(80,
'-') <<
"\n"
142 config = std::move(triggerConfig);
146 throw cet::exception{
"TriggerConfigurationExtractor" }
147 <<
"No trigger configuration found (fragment type: '"
148 << fExpectedFragmentType <<
"').\n";
157 (fhicl::ParameterSet
const& pset )
const
161 auto const& triggerParams
162 = pset.get<fhicl::ParameterSet>(
"daq.fragment_receiver");
164 auto const& fpgaParams
165 = pset.get<fhicl::ParameterSet>(
"daq.fragment_receiver.fpga_init_params");
167 auto const& spexiParams
168 = pset.get<fhicl::ParameterSet>(
"daq.fragment_receiver.spexi_init_params");
174 = triggerParams.get<
bool>(
"use_wr_time");
176 = triggerParams.get<
unsigned int>(
"wr_time_offset_ns");
179 = fpgaParams.get<
unsigned int>(
"Veto.value");
182 = fpgaParams.get<
unsigned int>(
"MajLevelBeamCryo1.value");
184 = fpgaParams.get<
unsigned int>(
"MajLevelEnableCryo1.value");
186 = parseWindowMode( fpgaParams.get<std::string>(
"SlidingWindowCryo1.value") );
188 = fpgaParams.get<
unsigned int>(
"MajLevelBeamCryo2.value");
190 = fpgaParams.get<
unsigned int>(
"MajLevelEnableCryo2.value");
192 = parseWindowMode( fpgaParams.get<std::string>(
"SlidingWindowCryo2.value") );
193 rc.majorityTriggerType
194 = fpgaParams.get<std::string>(
"MajorityTriggerType.value");
196 = fpgaParams.get<std::string>(
"RunType.value");
199 = spexiParams.get<
unsigned int>(
"TPCTriggerDelay.value");
202 (std::stoul( spexiParams.get<std::string>(
"GateSelection.value"),
nullptr, 16));
205 auto prescaleMinBiasBeam =
206 spexiParams.get<std::string>(
"PreScaleBNBNuMI.value");
207 auto prescaleMinBiasOffBeam =
208 spexiParams.get<std::string>(
"PreScaleOffBeam.value");
209 auto offBeamGateRate =
210 spexiParams.get<std::string>(
"OffBeamGateRate.value");
211 auto prescaleMinBiasCalibration =
212 spexiParams.get<std::string>(
"PrescaleZeroBias.value");
224 = spexiParams.get<
unsigned int>(
"BNBBeamWidth.value");
226 = spexiParams.get<
unsigned int>(
"BNBEnableWidth.value");
230 = spexiParams.get<
unsigned int>(
"BNBBESOffset.value");
232 = spexiParams.get<
unsigned int>(
"BNB1DOffset.value");
244 = spexiParams.get<
unsigned int>(
"OffBeamBNBBeamWidth.value");
246 = spexiParams.get<
unsigned int>(
"OffBeamBNBEnableWidth.value");
262 = spexiParams.get<
unsigned int>(
"NuMIBeamWidth.value");
264 = spexiParams.get<
unsigned int>(
"NuMIEnableWidth.value");
268 = spexiParams.get<
unsigned int>(
"NuMIMIBSOffset.value");
270 = spexiParams.get<
unsigned int>(
"NuMIADOffset.value");
282 = spexiParams.get<
unsigned int>(
"OffBeamNuMIBeamWidth.value");
284 = spexiParams.get<
unsigned int>(
"OffBeamNuMIEnableWidth.value");
300 = spexiParams.get<
unsigned int>(
"ZeroBiasWidth.value");
302 = spexiParams.get<
unsigned int>(
"ZeroBiasEnableWidth.value");
306 = spexiParams.get<
unsigned int>(
"ZeroBiasFreq.value");
314 std::optional<fhicl::ParameterSet>
316 (fhicl::ParameterSet
const& pset, std::string
const& key)
const
318 std::optional<fhicl::ParameterSet> config;
323 if (!pset.has_key(key) || !pset.is_key_to_table(key))
break;
325 auto boardPSet = pset.get<fhicl::ParameterSet>(key);
328 std::string fragmentType;
329 if (!boardPSet.get_if_present(
"daq.fragment_receiver.generator", fragmentType))
331 if (fragmentType != fExpectedFragmentType)
break;
333 config.emplace(std::move(boardPSet));
350 std::unique_ptr<TFile>{ TFile::Open(srcFileName.c_str(),
"READ") }
Number of bits currently supported.
static constexpr std::size_t kOffBeamNuMI
static constexpr std::size_t kWest
Enabke MinBias triggers for the Offbeam BNB stream.
Enable MinBias triggers for the Calibration stream.
constexpr bool hasBitSet(mask_t< EnumType > bitMask, EnumType bit)
Returns whether the specified bit is set in bitMask.
Enable Offbeam drift gate NuMI (for light out-of-time in offbeam gates)
gateSelection
Enabled gates in the trigger configuration. See register 0X00050008 in docdb SBN-doc-23778-v1.
triggerWindowMode
Trigger window mode.
std::map< fhicl::ParameterSetID, fhicl::ParameterSet > readConfigurationFromArtFile(TFile &file)
Reads and returns the art configuration stored in sourceDir.
static constexpr std::size_t kBNB
Enable NuMI early warning signal (MIBS$74) to open NuMI gates.
std::string bitName(triggerSource bit)
Returns a mnemonic short name of the beam type.
Enable light out-of-time for MinBias triggers in NuMI stream.
Enable light out-of-time for MinBias triggers in BNB stream.
Enable light out-of-time for MinBias triggers in Offbeam NuMI stream.
static constexpr std::size_t kCalibration
icarus::TriggerConfiguration extractTriggerReadoutConfigurationImpl(ConfigMap const &configMap, icarus::TriggerConfigurationExtractor extractor)
Enable MinBias triggers for the Offbeam NuMI stream.
icarus::TriggerConfiguration extractTriggerReadoutConfiguration(std::string const &srcFileName, icarus::TriggerConfigurationExtractor extractor)
Enable Offbeam gate for BNB.
static constexpr std::size_t kNuMI
Enable Offbeam drift gate BNB (for light out-of-time in offbeam gates)
std::string to_string(WindowPattern const &pattern)
then echo File list $list not found else cat $list while read file do echo $file sed s
Enable MinBias triggers for the BNB stream.
Enable Calibration drift gate (for light out-of-time in calibration gates)
static constexpr std::size_t kOffBeamBNB
Enable Offbeam gate for NuMI.
Enable BNB early-early warning signal ($1D) for light out-of-time in BNB gates.
Enable receiving NuMI early-early warning signal ($AD) for light out-of-time in NuMI gates...
Enable MinBias triggers for the NuMI stream.
static constexpr std::size_t kEast
Enable receiving BNB early warning signal (gatedBES) to open BNB gates.
Enable light out-of-time for MinBias triggers in Calibration stream.
Enable light out-of-time for MinBias triggers in Offbeam BNB stream.