24 fhicl::ParameterSet
const& container,
25 std::string
const& configListKey,
26 std::initializer_list<std::regex const> components
29 fhicl::ParameterSet
const sourceConfig
30 = container.get<fhicl::ParameterSet>(configListKey);
32 fhicl::ParameterSet configDocs;
33 for (
auto const& key: sourceConfig.get_names()) {
34 if (!sourceConfig.is_key_to_atom(key))
continue;
36 if (!
matchKey(key, components.begin(), components.end()))
continue;
38 std::string
const psetStr = sourceConfig.get<std::string>(key);
40 fhicl::ParameterSet pset;
42 pset = fhicl::ParameterSet::make(psetStr);
44 catch (cet::exception&
e) {
45 throw cet::exception{
"convertConfigurationDocuments",
"", e }
46 <<
"Error parsing the content of key '" << configListKey <<
"." << key
47 <<
"'; content was:\n" << psetStr <<
"\n";
50 configDocs.put(key, pset);
62 std::vector<std::regex>
const
64 { std::regex{
"icaruspmt.*" } }
69 (fhicl::ParameterSet
const& pset, std::string
const& key)
71 return matchKey(key, ConfigurationNames.begin(), ConfigurationNames.end());
77 (fhicl::ParameterSet
const& pset)
const
82 for (std::string
const& key: pset.get_names()) {
84 std::optional<fhicl::ParameterSet> boardConfig
85 = readBoardConfig(pset, key);
87 if (!boardConfig)
continue;
89 config.
boards.push_back(extractV1730configuration(*boardConfig, key));
99 (fhicl::ParameterSet
const& pset, std::string
const& boardName)
const
103 auto const& boardParams
104 = pset.get<fhicl::ParameterSet>(
"daq.fragment_receiver");
107 rc.boardName = boardName;
109 rc.boardID = boardParams.get<
unsigned int>(
"board_id");
110 rc.fragmentID = boardParams.get<
unsigned int>(
"fragment_id");
112 rc.bufferLength = boardParams.get<
int>(
"recordLength");
113 rc.postTriggerFrac = boardParams.get<
float>(
"postPercent") / 100.0f;
115 rc.nChannels = boardParams.get<
unsigned int>(
"nChannels");
117 rc.useTimeTagForTimeStamp = boardParams.get(
"UseTimeTagForTimeStamp",
false);
119 for (
unsigned short int channelNo = 0; channelNo < 16; ++channelNo)
120 rc.channels.push_back(extractChannelConfiguration(boardParams, channelNo));
129 (fhicl::ParameterSet
const& boardPSet,
unsigned short int channelNo)
const
137 channel.
baseline = boardPSet.get<
short signed int>
139 channel.
threshold = boardPSet.get<
short signed int>
140 (
"triggerThreshold" + ChannelStr);
141 channel.
enabled = boardPSet.get<
bool>(
"channelEnable" + ChannelStr);
153 auto const fragmentID = readoutBoardDBfragmentID(readoutBoardConfig);
154 if (!fChannelMap->hasPMTDigitizerID(fragmentID)) {
155 mf::LogWarning(
"PMTconfigurationExtractor")
156 <<
"No entry found in PMT channel mapping database for board '"
157 << readoutBoardConfig.
boardName <<
"' (fragment ID: "
158 << readoutBoardConfig.
fragmentID <<
" => " << std::hex << fragmentID
164 = fChannelMap->getChannelIDPairVec(fragmentID);
167 auto const toChannelID = [&channelIDs=digitizerChannelVec]
168 (
short unsigned int channelNo)
170 auto const it = std::find_if(channelIDs.begin(), channelIDs.end(),
171 [channelNo](
auto const&
p){
return p.first == channelNo; });
172 return (it != channelIDs.end())
178 for (
auto& channelInfo: readoutBoardConfig.
channels)
179 channelInfo.channelID = toChannelID(channelInfo.channelNo);
188 std::optional<fhicl::ParameterSet>
190 (fhicl::ParameterSet
const& pset, std::string
const& key)
const
192 static std::string
const ExpectedFragmentType =
"CAENV1730";
194 std::optional<fhicl::ParameterSet> config;
199 if (!pset.has_key(key) || !pset.is_key_to_table(key))
break;
201 auto boardPSet = pset.get<fhicl::ParameterSet>(key);
204 std::string fragmentType;
205 if (!boardPSet.get_if_present(
"daq.fragment_receiver.fragment_type", fragmentType))
207 if (fragmentType != ExpectedFragmentType)
break;
209 config.emplace(std::move(boardPSet));
226 std::unique_ptr<TFile>{ TFile::Open(srcFileName.c_str(),
"READ") }
std::string boardName
Name (mnemonic) of the board.
std::vector< DigitizerChannelChannelIDPair > DigitizerChannelChannelIDPairVec
short signed int threshold
Threshold (triggerThreshold<N>).
sbn::PMTconfiguration extractPMTreadoutConfiguration(std::string const &srcFileName, icarus::PMTconfigurationExtractor extractor)
std::map< fhicl::ParameterSetID, fhicl::ParameterSet > readConfigurationFromArtFile(TFile &file)
Reads and returns the art configuration stored in sourceDir.
unsigned int fragmentID
DAQ fragment ID.
short unsigned int channelNo
Number of the channel on the board (0-15).
std::string to_string(WindowPattern const &pattern)
short signed int baseline
Baseline (BaselineCh<N+1>).
bool enabled
Channel is enabled (enable).
static constexpr auto NoChannelID
Special value for unassigned channel ID.
std::vector< sbn::V1730channelConfiguration > channels
Configuration of each channel.
Class containing configuration for a V1730 channel.
Class containing configuration for PMT readout.
sbn::PMTconfiguration extractPMTreadoutConfigurationImpl(ConfigMap const &configMap, icarus::PMTconfigurationExtractor extractor)
std::vector< sbn::V1730Configuration > boards
Configuration of all PMT readout boards.
Class containing configuration for a V1730 board.