12 using std::ostringstream;
13 using std::istringstream;
23 : m_LogLevel(ps.
get<
Index>(
"LogLevel")),
24 m_ExtraRanges(ps.
get<
Name>(
"ExtraRanges")) {
25 const Name myname =
"ProtoDuneChannelRanges::ctor: ";
34 Index nchax = 2*nchaz;
35 Index nchai = nchau + nchav;
36 Index apaIdx[ntps] = {3, 5, 2, 6, 1, 4};
37 string slocs[ntps] = {
"US-RaS",
"US-DaS",
"MS-RaS",
"MS-DaS",
"DS-RaS",
"DS-DaS"};
38 insertLen(
"all", 0, ntps*nchaApa,
"All",
"",
"");
39 for (
Index itps=0; itps<ntps; ++itps ) {
42 string labTps =
"TPC set " + sitps;
43 string labApa =
"APA " + siapa;
44 string sloc = slocs[itps];
45 Index ch0 = itps*nchaApa;
46 string stps =
"tps" + sitps;
47 string sapa =
"apa" + siapa;
48 insertLen( stps, ch0, nchaApa, labTps, sloc, labApa);
49 insertLen( sapa, ch0, nchaApa, labApa, sloc);
50 string stpp =
"tpp" + sitps;
52 Index chv0 = chu0 + nchau;
53 Index chx10 = chv0 + nchav;
54 Index chx20 = chx10 + nchaz;
56 bool beamRight = 2*(itps/2) == itps;
57 Index chz0 = beamRight ? chx20 : chx10;
58 Index chc0 = beamRight ? chx10 : chx20;
59 insertLen(stpp +
"u", chu0, nchau,
"TPC plane " + sitps +
"u", sloc, labApa);
60 insertLen(sapa +
"u", chu0, nchau,
"APA plane " + siapa +
"u", sloc);
61 insertLen(stpp +
"v", chv0, nchav,
"TPC plane " + sitps +
"v", sloc, labApa);
62 insertLen(sapa +
"v", chv0, nchav,
"APA plane " + siapa +
"v", sloc);
63 insertLen(stpp +
"c", chc0, nchaz,
"TPC plane " + sitps +
"c", sloc, labApa);
64 insertLen(sapa +
"c", chc0, nchaz,
"APA plane " + siapa +
"c", sloc);
65 insertLen(stpp +
"z", chz0, nchaz,
"TPC plane " + sitps +
"z", sloc, labApa);
66 insertLen(sapa +
"z", chz0, nchaz,
"APA plane " + siapa +
"z", sloc);
67 insertLen(stpp +
"i", chu0, nchai,
"TPC plane " + sitps +
"i", sloc, labApa);
68 insertLen(sapa +
"i", chu0, nchai,
"APA plane " + siapa +
"i", sloc);
69 insertLen(stpp +
"x", chx0, nchax,
"TPC plane " + sitps +
"x", sloc, labApa);
70 insertLen(sapa +
"x", chx0, nchax,
"APA plane " + siapa +
"x", sloc);
78 for (
Index ifmbOff=0; ifmbOff<20; ++ifmbOff ) {
80 ssnamu << siapa <<
setfill(
'0') <<
setw(2) << ifmbu <<
"u";
81 string namu = ssnamu.str();
82 insertLen(
"femb" + namu, fchu0, nfchau,
"FEMB block " + namu, sloc);
84 ssnamv << siapa <<
setfill(
'0') <<
setw(2) << ifmbv <<
"v";
85 string namv = ssnamv.str();
86 insertLen(
"femb" + namv, fchv0, nfchav,
"FEMB block " + namv, sloc);
88 ssnamx << siapa <<
setfill(
'0') <<
setw(2) << ifmbx <<
"x";
89 string namx = ssnamx.str();
90 insertLen(
"femb" + namx, fchx0, nfchax,
"FEMB block " + namx, sloc);
95 if ( ifmbu > 20 ) ifmbu = 1;
97 if ( ifmbv == 0 ) ifmbv = 20;
98 if ( ifmbOff < 9 ) ifmbx -= 1;
99 else if ( ifmbOff == 9 ) ifmbx = 1;
108 cout << myname <<
"WARNING: Extra range tool not found: " <<
m_ExtraRanges <<
endl;
120 const Name myname =
"ProtoDuneChannelRanges::runData: ";
123 if ( rout.
isValid() )
return rout;
127 if ( nam.size() == 10 && nam.substr(0,4) ==
"femb" ) {
136 }
else if ( cpla ==
'v' ) {
138 }
else if ( cpla ==
'x' || cpla ==
'w') {
140 istringstream ssapa(nam.substr(4,1));
143 istringstream ssfmb(nam.substr(5,2));
146 bool beamL = ifmb >= 1 && ifmb <= 10;
147 bool beamR = ifmb >= 11 && ifmb <= 20;
148 if ( beamL ) dirSame =
false;
149 else if ( beamR ) dirSame =
true;
152 if ( ifchmax != fbran.
size() ) {
153 cout << myname <<
"WARNING: FEMB block has unexpected size: " 154 << ifchmax <<
" != " << fbran.
size() <<
endl;
157 string sch = nam.substr(8,2);
158 istringstream ssfch(sch);
161 if ( ifch > 0 && ifch <= ifchmax ) {
162 if ( dirSame ) --ifch;
163 else ifch = ifchmax - ifch;
const IndexRangeTool * m_pExtraRanges
IndexRange get(Name nam) const override
ChannelGroupService::Name Name
void insertLen(Name nam, Index begin, Index len, Name lab, Name lab1="", Name lab2="")
static constexpr double ps
Name label(Index ilab=0) const
Q_EXPORT QTSManip setw(int w)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
auto const & get(AssnsNode< L, R, D > const &r)
ProtoDuneChannelRanges(fhicl::ParameterSet const &ps)
Q_EXPORT QTSManip setfill(int f)
std::string to_string(ModuleType const mt)
QTextStream & endl(QTextStream &s)