8 #ifndef ICARUSCODE_DECODE_DECODERTOOLS_DETAILS_PMTDECODERUTILS_H
9 #define ICARUSCODE_DECODE_DECODERTOOLS_DETAILS_PMTDECODERUTILS_H
33 namespace daq::details {
35 using namespace util::quantities::time_literals;
44 static constexpr std::size_t NBoardChannels = 16U;
47 static constexpr
unsigned int NoFragmentID
48 = std::numeric_limits<unsigned int>::max();
60 bool onGlobalOnly =
false;
62 std::uint16_t minSpan = 0;
71 bool mustSkip()
const {
return forcedSkip.value_or(
false); }
74 bool mustSave()
const {
return !forcedSkip.value_or(
true); }
82 && !forcedSkip && !onGlobalOnly && category.empty();
96 unsigned int fragmentID = NoFragmentID;
110 std::ostream&
operator<< (std::ostream&, BoardSetup_t::ChannelSetup_t
const&);
124 template <std::
size_t KeyIndex = 0U>
127 template <
typename Coll,
typename Key,
typename KeyExtractor>
129 (Coll
const& coll, Key
const& key, KeyExtractor&& extractKey);
133 template <std::
size_t KeyIndex = 0U,
typename Coll,
typename Key>
135 (Coll
const& coll, Key
const& key);
164 : fDatabase(sortDatabase(
std::move(database)))
174 BoardInfo_t
const* findBoardInfo(FragmentID_t fragmentID)
const;
179 auto const* pInfo = findBoardInfo(fragmentID);
180 return pInfo? pInfo->setup:
nullptr;
186 auto const* pInfo = findBoardInfo(fragmentID);
187 return pInfo? pInfo->config:
nullptr;
197 { std::sort(
db.begin(),
db.end());
return std::move(
db); }
209 return binarySearch(fDatabase, fragmentID, std::mem_fn(&BoardInfo_t::fragmentID));
216 template <
typename Coll,
typename Key,
typename KeyExtractor>
218 (Coll
const& coll, Key
const& key, KeyExtractor&& extractKey)
221 auto const b =
begin(coll);
222 auto const e =
end(coll);
223 auto it = std::lower_bound(
225 [&extractKey](
auto const&
a, Key
const& key){
return extractKey(
a) < key; }
227 return ((it !=
e) && (extractKey(*it) == key))? &*it:
nullptr;
232 template <std::size_t KeyIndex ,
typename Coll,
typename Key>
234 (Coll
const& coll, Key
const& key)
237 (coll, key, [](
auto const&
a){
return std::get<KeyIndex>(
a); });
244 #endif // ICARUSCODE_DECODE_DECODERTOOLS_DETAILS_PMTDECODERUTILS_H
AllChannelSetup_t channelSettings
Set of settings channel by channel.
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
then source grid fermiapp products dune setup_dune_fermiapp sh exit else echo No setup file found exit fi setup
std::optional< bool > forcedSkip
Whether the channel should be forcedly ignored or acquired.
bool isDefault() const
Returns whether this is the default configuration.
Utility class for fast lookup of board data by fragment ID.
Derivative information of a V1730 readout board.
bool mustSave() const
Whether this channel is requested to be saved.
std::array< ChannelSetup_t, NBoardChannels > AllChannelSetup_t
constexpr bool operator<(CryostatID const &a, CryostatID const &b)
Order cryostats with increasing ID.
bool mustSkip() const
Whether this channel is requested to be skipped.
unsigned int nBoardInfo() const
Returns the number of registered boards.
unsigned int FragmentID_t
std::vector< BoardInfo_t > Database_t
BoardInfo_t const * findBoardInfo(FragmentID_t fragmentID) const
Returns a pointer to the information for board with fragmentID.
std::ostream & operator<<(std::ostream &, BoardSetup_t::ChannelSetup_t const &)
BoardSetup_t const * findBoardSetup(FragmentID_t fragmentID) const
Returns a pointer to the setup information for board with fragmentID.
auto end(FixedBins< T, C > const &) noexcept
Special settings for one channel on the board.
Information from the configuration of PMT readout.
static bool isChannel(raw::Channel_t channel)
Returns if channel is a valid channel ID.
Coll::value_type const * binarySearch(Coll const &coll, Key const &key, KeyExtractor &&extractKey)
Information from the configuration of a V1730 PMT readout board.
Record of information about a readout board.
std::string name
Board name as specified in DAQ configuration.
nanoseconds_as<> nanoseconds
Type of time interval stored in nanoseconds, in double precision.
auto begin(FixedBins< T, C > const &) noexcept
sbn::V1730Configuration const * findBoardConfig(FragmentID_t fragmentID) const
Returns a pointer to the configuration of board with fragmentID.
Database_t const fDatabase
BoardInfoLookup(Database_t &&database)
std::string category
Category of this channel (will become instance name).
constexpr bool hasFragmentID() const
Returns whether this object contains a valid fragment ID.
Dimensioned variables representing space or time quantities.
nanoseconds preTriggerTime
How long from waveform start to PMT board trigger.
bool hasChannel() const
Returns if this channel is associated to a off-line channel number.
static constexpr auto NoChannelID
Special value for unassigned channel ID.
auto const & allBoardInfo() const
Returns an object that can be iterated for all available information.
height to which particles are projected pnfs larsoft persistent physics cosmics Fermilab CORSIKA standard He_showers_ * db
static Database_t sortDatabase(Database_t &&db)
Sorts the database structure in the argument and returns it.
Information of the setup of a V1730 readout board.
nanosecond nanoseconds
Alias for common language habits.
Class containing configuration for a V1730 board.