All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
icarus::PMTconfigurationExtractor Class Reference

Class to extract PMT readout board configuration. More...

#include <PMTconfigurationExtractor.h>

Inheritance diagram for icarus::PMTconfigurationExtractor:
icarus::PMTconfigurationExtractorBase

Public Member Functions

 PMTconfigurationExtractor ()=default
 Constructor: no channel mapping, channel IDs won't be finalize()'d. More...
 
 PMTconfigurationExtractor (icarusDB::IICARUSChannelMap const &channelMappingService)
 Constructor: use channel mapping to finalize() channel IDs. More...
 
- Public Member Functions inherited from icarus::PMTconfigurationExtractorBase
ConfigurationData_t extract (fhicl::ParameterSet const &config) const
 Extracts all supported PMT configuration from config. More...
 
ConfigurationData_t finalize (ConfigurationData_t config) const
 Finalizes the content of config and returns it. More...
 

Private Member Functions

sbn::V1730Configuration extractV1730configuration (fhicl::ParameterSet const &pset, std::string const &boardName) const
 Extracts PMT readout board configuration from pset. More...
 
sbn::V1730channelConfiguration extractChannelConfiguration (fhicl::ParameterSet const &boardPSet, unsigned short int channelNo) const
 Returns the specified V1730 readout channel configuration. More...
 
std::optional
< fhicl::ParameterSet > 
readBoardConfig (fhicl::ParameterSet const &pset, std::string const &key) const
 Returns the specified PMT readout board configuration. More...
 

Static Private Member Functions

static unsigned int readoutBoardDBfragmentID (sbn::V1730Configuration const &boardConfig)
 Returns the fragment ID of the specified board as known by the database. More...
 

Private Attributes

icarusDB::IICARUSChannelMap const * fChannelMap = nullptr
 Hardware PMT channel mapping to LArSoft's. More...
 

Static Private Attributes

static std::vector< std::regex >
const 
ConfigurationNames { std::regex{ "icaruspmt.*" } }
 Regular expressions matching all names of supported PMT configurations. More...
 

Interface

sbn::PMTconfiguration extract (fhicl::ParameterSet const &config) const
 Extracts all supported PMT configuration from config. More...
 
sbn::PMTconfiguration finalize (sbn::PMTconfiguration config) const
 Assigns unique channel IDs to the channel information. More...
 
static bool mayHaveConfiguration (fhicl::ParameterSet const &pset)
 Returns whether pset may contain the needed configuration. More...
 
static bool isGoodConfiguration (fhicl::ParameterSet const &pset, std::string const &key)
 Returns whether the specified key of pset is a good configuration. More...
 

Additional Inherited Members

- Public Types inherited from icarus::PMTconfigurationExtractorBase
using ConfigurationData_t = sbn::PMTconfiguration
 
- Static Public Member Functions inherited from icarus::PMTconfigurationExtractorBase
static fhicl::ParameterSet convertConfigurationDocuments (fhicl::ParameterSet const &container, std::string const &configListKey, std::initializer_list< std::regex const > components)
 Returns a parameter set with the content of configuration_documents key from container. More...
 
template<typename RBegin , typename REnd >
static bool matchKey (std::string const &key, RBegin rbegin, REnd rend)
 
static bool mayHaveConfiguration (fhicl::ParameterSet const &pset)
 Returns whether pset may contain the needed configuration. More...
 

Detailed Description

Class to extract PMT readout board configuration.

This is an example of PMT readout board configuration taken from ICARUS run 4774 (destinations and metrics have been omitted):

icaruspmteetop01: {
daq: {
fragment_receiver: {
BaselineCh1: 14768
BaselineCh10: 14843
BaselineCh11: 14846
BaselineCh12: 14840
BaselineCh13: 14981
BaselineCh14: 14896
BaselineCh15: 14966
BaselineCh16: 14800
BaselineCh2: 14836
BaselineCh3: 14806
BaselineCh4: 14954
BaselineCh5: 14766
BaselineCh6: 14835
BaselineCh7: 14861
BaselineCh8: 14857
BaselineCh9: 14949
BoardChainNumber: 0
CalibrateOnConfig: true
ChargePedstalBitCh1: 14400
CircularBufferSize: 5e8
CombineReadoutWindows: false
GetNextFragmentBunchSize: 20
GetNextSleep: 100
InterruptEventNumber: 1
InterruptLevel: 0
InterruptStatusID: 0
LVDSLogicValueG1: 3
LVDSLogicValueG2: 3
LVDSLogicValueG3: 3
LVDSLogicValueG4: 3
LVDSLogicValueG5: 3
LVDSLogicValueG6: 3
LVDSLogicValueG7: 3
LVDSLogicValueG8: 3
LVDSOutWidthC1: 20
LVDSOutWidthC10: 20
LVDSOutWidthC11: 20
LVDSOutWidthC12: 20
LVDSOutWidthC13: 20
LVDSOutWidthC14: 20
LVDSOutWidthC15: 20
LVDSOutWidthC16: 20
LVDSOutWidthC2: 20
LVDSOutWidthC3: 20
LVDSOutWidthC4: 20
LVDSOutWidthC5: 20
LVDSOutWidthC6: 20
LVDSOutWidthC7: 20
LVDSOutWidthC8: 20
LVDSOutWidthC9: 20
LockTempCalibration: false
MajorityCoincidenceWindow: 1
MajorityLevel: 0
MajorityTimeWindow: 4
ModeLVDS: 1
SWTrigger: false
SelfTrigBit: 16
SelfTriggerMask: 255
SelfTriggerMode: 0
TimeOffsetNanoSec: 0
UseTimeTagForTimeStamp: false
Verbosity: 1
acqMode: 0
allowTriggerOverlap: false
analogMode: 1
boardId: 0
board_id: 18
channelEnable0: true
channelEnable1: true
channelEnable10: true
channelEnable11: true
channelEnable12: true
channelEnable13: true
channelEnable14: true
channelEnable15: true
channelEnable2: true
channelEnable3: true
channelEnable4: true
channelEnable5: true
channelEnable6: true
channelEnable7: true
channelEnable8: true
channelEnable9: true
channelPedestal0: 6554
channelPedestal1: 6554
channelPedestal10: 6554
channelPedestal11: 6554
channelPedestal12: 6554
channelPedestal13: 6554
channelPedestal14: 6554
channelPedestal15: 6554
channelPedestal2: 6554
channelPedestal3: 6554
channelPedestal4: 6554
channelPedestal5: 6554
channelPedestal6: 6554
channelPedestal7: 6554
channelPedestal8: 6554
channelPedestal9: 6554
dacValue: 32768
data_buffer_depth_fragments: 10000
data_buffer_depth_mb: 2000
debugLevel: 7
destinations: {} # ...
dynamicRange: 0
enableReadout: 1
eventCounterWarning: 1
eventsPerInterrupt: 1
extTrgMode: 3
fragment_id: 18
fragment_type: "CAENV1730"
generator: "CAENV1730Readout"
ioLevel: 1
irqWaitTime: 1
link: 2
maxEventsPerTransfer: 1
max_fragment_size_bytes: 1e7
memoryAlmostFull: 2
multicast_interface_ip: "192.168.191.0"
nChannels: 16
outputSignalMode: 0
postPercent: 70
readoutMode: 0
receive_requests: true
recordLength: 25000
request_address: "227.128.1.129"
request_mode: "sequence"
request_port: 3502
routing_table_config: { use_routing_master: false }
runSyncMode: 0
separate_data_thread: true
swTrgMode: 0
testPattern: 0
triggerPolarity: 0
triggerPulseWidth: 20
triggerThreshold0: 14368
triggerThreshold1: 14436
triggerThreshold10: 14446
triggerThreshold11: 14440
triggerThreshold12: 14581
triggerThreshold13: 14596
triggerThreshold14: 14566
triggerThreshold15: 14400
triggerThreshold2: 14406
triggerThreshold3: 14554
triggerThreshold4: 14366
triggerThreshold5: 14435
triggerThreshold6: 14461
triggerThreshold7: 14457
triggerThreshold8: 14549
triggerThreshold9: 14443
usePedestals: false
}
metrics: {} # ...
}
}

Definition at line 312 of file PMTconfigurationExtractor.h.

Constructor & Destructor Documentation

icarus::PMTconfigurationExtractor::PMTconfigurationExtractor ( )
default

Constructor: no channel mapping, channel IDs won't be finalize()'d.

icarus::PMTconfigurationExtractor::PMTconfigurationExtractor ( icarusDB::IICARUSChannelMap const &  channelMappingService)

Constructor: use channel mapping to finalize() channel IDs.

Definition at line 406 of file PMTconfigurationExtractor.h.

407  : fChannelMap(&channelMappingService)
408  {}
icarusDB::IICARUSChannelMap const * fChannelMap
Hardware PMT channel mapping to LArSoft&#39;s.

Member Function Documentation

sbn::PMTconfiguration icarus::PMTconfigurationExtractor::extract ( fhicl::ParameterSet const &  config) const

Extracts all supported PMT configuration from config.

Parameters
configa FHiCL parameter set with component configuration
Returns
an object with the supported PMT configuration

All PMT-related configuration that is known to this code is extracted and returned.

Definition at line 77 of file PMTconfigurationExtractor.cxx.

78 {
79 
80  sbn::PMTconfiguration config;
81 
82  for (std::string const& key: pset.get_names()) {
83 
84  std::optional<fhicl::ParameterSet> boardConfig
85  = readBoardConfig(pset, key);
86 
87  if (!boardConfig) continue;
88 
89  config.boards.push_back(extractV1730configuration(*boardConfig, key));
90 
91  } // for
92 
93  return config;
94 } // icarus::PMTconfigurationExtractor::extract()
sbn::V1730Configuration extractV1730configuration(fhicl::ParameterSet const &pset, std::string const &boardName) const
Extracts PMT readout board configuration from pset.
std::optional< fhicl::ParameterSet > readBoardConfig(fhicl::ParameterSet const &pset, std::string const &key) const
Returns the specified PMT readout board configuration.
Class containing configuration for PMT readout.
std::vector< sbn::V1730Configuration > boards
Configuration of all PMT readout boards.
sbn::V1730channelConfiguration icarus::PMTconfigurationExtractor::extractChannelConfiguration ( fhicl::ParameterSet const &  boardPSet,
unsigned short int  channelNo 
) const
private

Returns the specified V1730 readout channel configuration.

Parameters
boardPSetreadout board configuration
channelNonumber of channel on board (0-15)
Returns
the configuration of the specified channel

Definition at line 129 of file PMTconfigurationExtractor.cxx.

130 {
131  std::string const ChannelStr = std::to_string(channelNo);
132 
134 
135  channel.channelNo = channelNo;
136 
137  channel.baseline = boardPSet.get<short signed int>
138  ("BaselineCh" + std::to_string(channelNo + 1));
139  channel.threshold = boardPSet.get<short signed int>
140  ("triggerThreshold" + ChannelStr);
141  channel.enabled = boardPSet.get<bool>("channelEnable" + ChannelStr);
142 
143  return channel;
144 } // icarus::PMTconfigurationExtractor::extractChannelConfiguration()
short signed int threshold
Threshold (triggerThreshold&lt;N&gt;).
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&lt;N+1&gt;).
bool enabled
Channel is enabled (enable).
Class containing configuration for a V1730 channel.
auto icarus::PMTconfigurationExtractor::extractV1730configuration ( fhicl::ParameterSet const &  pset,
std::string const &  boardName 
) const
private

Extracts PMT readout board configuration from pset.

Parameters
psetinformation source (FHiCL configuration)
boardNamename of the board we are given the configuration of
Returns
the requested configuration

Definition at line 99 of file PMTconfigurationExtractor.cxx.

101 {
102 
103  auto const& boardParams
104  = pset.get<fhicl::ParameterSet>("daq.fragment_receiver");
105 
106  sbn::V1730Configuration rc; // readout config, for friends
107  rc.boardName = boardName;
108 
109  rc.boardID = boardParams.get<unsigned int>("board_id");
110  rc.fragmentID = boardParams.get<unsigned int>("fragment_id");
111 
112  rc.bufferLength = boardParams.get<int>("recordLength");
113  rc.postTriggerFrac = boardParams.get<float>("postPercent") / 100.0f;
114 
115  rc.nChannels = boardParams.get<unsigned int>("nChannels");
116 
117  rc.useTimeTagForTimeStamp = boardParams.get("UseTimeTagForTimeStamp", false);
118 
119  for (unsigned short int channelNo = 0; channelNo < 16; ++channelNo)
120  rc.channels.push_back(extractChannelConfiguration(boardParams, channelNo));
121 
122  return rc;
123 } // icarus::PMTconfigurationExtractor::extractV1730configuration()
sbn::V1730channelConfiguration extractChannelConfiguration(fhicl::ParameterSet const &boardPSet, unsigned short int channelNo) const
Returns the specified V1730 readout channel configuration.
Class containing configuration for a V1730 board.
sbn::PMTconfiguration icarus::PMTconfigurationExtractor::finalize ( sbn::PMTconfiguration  config) const

Assigns unique channel IDs to the channel information.

Definition at line 149 of file PMTconfigurationExtractor.cxx.

150 {
151 
152  for (sbn::V1730Configuration& readoutBoardConfig: config.boards) {
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
159  << ")\n";
160  continue;
161  }
162 
163  icarusDB::DigitizerChannelChannelIDPairVec const& digitizerChannelVec
164  = fChannelMap->getChannelIDPairVec(fragmentID);
165 
166  // finds the channel ID matching the specified channel number of this board
167  auto const toChannelID = [&channelIDs=digitizerChannelVec]
168  (short unsigned int channelNo)
169  {
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())
173  ? it->second
175  ;
176  };
177 
178  for (auto& channelInfo: readoutBoardConfig.channels)
179  channelInfo.channelID = toChannelID(channelInfo.channelNo);
180 
181  } // for boards
182 
183  return config;
184 } // icarus::PMTconfigurationExtractor::finalize()
std::string boardName
Name (mnemonic) of the board.
std::vector< DigitizerChannelChannelIDPair > DigitizerChannelChannelIDPairVec
static unsigned int readoutBoardDBfragmentID(sbn::V1730Configuration const &boardConfig)
Returns the fragment ID of the specified board as known by the database.
pdgs p
Definition: selectors.fcl:22
virtual const DigitizerChannelChannelIDPairVec & getChannelIDPairVec(const unsigned int) const =0
icarusDB::IICARUSChannelMap const * fChannelMap
Hardware PMT channel mapping to LArSoft&#39;s.
unsigned int fragmentID
DAQ fragment ID.
static constexpr auto NoChannelID
Special value for unassigned channel ID.
virtual bool hasPMTDigitizerID(const unsigned int) const =0
std::vector< sbn::V1730channelConfiguration > channels
Configuration of each channel.
std::vector< sbn::V1730Configuration > boards
Configuration of all PMT readout boards.
Class containing configuration for a V1730 board.
bool icarus::PMTconfigurationExtractor::isGoodConfiguration ( fhicl::ParameterSet const &  pset,
std::string const &  key 
)
static

Returns whether the specified key of pset is a good configuration.

Definition at line 69 of file PMTconfigurationExtractor.cxx.

70 {
71  return matchKey(key, ConfigurationNames.begin(), ConfigurationNames.end());
72 } // icarus::PMTconfigurationExtractor::isGoodConfiguration()
static std::vector< std::regex > const ConfigurationNames
Regular expressions matching all names of supported PMT configurations.
static bool matchKey(std::string const &key, RBegin rbegin, REnd rend)
static bool icarus::PMTconfigurationExtractor::mayHaveConfiguration ( fhicl::ParameterSet const &  pset)
inlinestatic

Returns whether pset may contain the needed configuration.

Definition at line 331 of file PMTconfigurationExtractor.h.

332  { return pset.has_key("configuration_documents"); }
std::optional< fhicl::ParameterSet > icarus::PMTconfigurationExtractor::readBoardConfig ( fhicl::ParameterSet const &  pset,
std::string const &  key 
) const
private

Returns the specified PMT readout board configuration.

Parameters
psetparameter set including key
keykey of the PMT readout configuration candidate
Returns
the configuration, or an empty object if key does not represent one

Definition at line 190 of file PMTconfigurationExtractor.cxx.

191 {
192  static std::string const ExpectedFragmentType = "CAENV1730";
193 
194  std::optional<fhicl::ParameterSet> config;
195 
196  do { // fake loop for fast exit
197 
198  // it must be a parameter set
199  if (!pset.has_key(key) || !pset.is_key_to_table(key)) break;
200 
201  auto boardPSet = pset.get<fhicl::ParameterSet>(key);
202 
203  // its "fragment_type" must be the expected one
204  std::string fragmentType;
205  if (!boardPSet.get_if_present("daq.fragment_receiver.fragment_type", fragmentType))
206  break;
207  if (fragmentType != ExpectedFragmentType) break;
208 
209  config.emplace(std::move(boardPSet)); // success
210  } while (false);
211  return config;
212 } // icarus::PMTconfigurationExtractor::readBoardConfig()
unsigned int icarus::PMTconfigurationExtractor::readoutBoardDBfragmentID ( sbn::V1730Configuration const &  boardConfig)
staticprivate

Returns the fragment ID of the specified board as known by the database.

Definition at line 246 of file PMTconfigurationExtractor.cxx.

247 {
248  return boardConfig.fragmentID & 0xFF; // secret recipe
249 } // icarus::PMTconfigurationExtractor::readoutBoardDBfragmentID()

Member Data Documentation

std::vector< std::regex > const icarus::PMTconfigurationExtractor::ConfigurationNames { std::regex{ "icaruspmt.*" } }
staticprivate

Regular expressions matching all names of supported PMT configurations.

Definition at line 359 of file PMTconfigurationExtractor.h.

icarusDB::IICARUSChannelMap const* icarus::PMTconfigurationExtractor::fChannelMap = nullptr
private

Hardware PMT channel mapping to LArSoft's.

Definition at line 362 of file PMTconfigurationExtractor.h.


The documentation for this class was generated from the following files: