21 #include "messagefacility/MessageLogger/MessageLogger.h"
33 template <std::
size_t KeyNo = 0U>
36 template <
typename TupleA,
typename TupleB>
38 {
return less(A, B); }
40 template <
typename Tuple>
41 static decltype(
auto)
key(
Tuple const& t) {
return std::get<KeyNo>(t); }
43 template <
typename TupleA,
typename TupleB>
44 static bool less(TupleA
const&
A, TupleB
const& B)
45 {
using std::less;
return less{}(
key(A),
key(B)); }
51 int main(
int argc,
char** argv) {
67 std::cerr <<
"FHiCL configuration file path required as first argument!"
75 { Env.ServiceParameters(
"IICARUSChannelMap") };
79 std::array<unsigned int, 24U> FragmentIDs;
80 std::iota(FragmentIDs.begin(), FragmentIDs.end(), 0x2000);
82 mf::LogVerbatim(
"PMTchannelMappingDumper") <<
"Fragment IDs:";
83 for (
auto const [ iFragment, fragmentID]:
util::enumerate(FragmentIDs)) {
84 unsigned int const effFragmentID = fragmentID & 0xFF;
86 if (!channelMapping.hasPMTDigitizerID(effFragmentID)) {
87 mf::LogVerbatim(
"PMTchannelMappingDumper")
88 <<
"[" << iFragment <<
"] " << std::hex << fragmentID << std::dec
89 <<
" not found in the database (as "
90 << std::hex << effFragmentID << std::dec <<
")";
101 mf::LogVerbatim log(
"PMTchannelMappingDumper");
103 <<
"[" << iFragment <<
"] " << std::hex << fragmentID << std::dec
104 <<
" includes " << digitizerChannels.size()
105 <<
" LArSoft channels between " << digitizerChannels.front().second
106 <<
" and " << digitizerChannels.back().second
107 <<
" [board channel index in brackets]:";
108 constexpr
unsigned int Cols = 8U;
110 for(
auto const [ digitizerChannel, channelID ]: digitizerChannels) {
111 if (n-- == 0) { log <<
"\n "; n = Cols - 1U; }
112 log <<
" " << std::setw(3) << channelID
113 <<
" [" << std::setw(3) << digitizerChannel <<
"]";
BEGIN_PROLOG or simple_flux see Environment
std::vector< DigitizerChannelChannelIDPair > DigitizerChannelChannelIDPairVec
static decltype(auto) key(Tuple const &t)
BEGIN_PROLOG could also be cerr
Definition of util::enumerate().
Class holding a configuration for a test environment.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
bool operator()(TupleA const &A, TupleB const &B) const
const DigitizerChannelChannelIDPairVec & getChannelIDPairVec(const unsigned int) const override
A test environment with some support for service providers.
void SetConfigurationPath(std::string path)
Sets the path to the configuration file.
static bool less(TupleA const &A, TupleB const &B)
int main(int argc, char **argv)
Base class for unit tests using FHiCL configuration.