12 using std::ostringstream;
13 using std::istringstream;
23 : m_LogLevel(ps.
get<
Index>(
"LogLevel")),
26 m_ExtraRanges(ps.
get<
Name>(
"ExtraRanges")) {
27 const Name myname =
"ApaChannelRanges::ctor: ";
36 Index nchax = 2*nchaz;
37 Index nchai = nchau + nchav;
42 while ( slocs.size() < ntps ) slocs.push_back(
"");
43 insertLen(
"all", 0, ntps*nchaApa,
"All",
"",
"");
44 for (
Index itps=0; itps<ntps; ++itps ) {
47 string labTps =
"TPC set " + sitps;
48 string labApa =
"APA " + siapa;
49 string sloc = slocs[itps];
50 Index ch0 = itps*nchaApa;
51 string stps =
"tps" + sitps;
52 string sapa =
"apa" + siapa;
53 insertLen( stps, ch0, nchaApa, labTps, sloc, labApa);
54 insertLen( sapa, ch0, nchaApa, labApa, sloc);
55 string stpp =
"tpp" + sitps;
57 Index chv0 = chu0 + nchau;
58 Index chx10 = chv0 + nchav;
59 Index chx20 = chx10 + nchaz;
61 bool beamRight = 2*(itps/2) == itps;
62 Index chz0 = beamRight ? chx20 : chx10;
63 Index chc0 = beamRight ? chx10 : chx20;
64 insertLen(stpp +
"u", chu0, nchau,
"TPC plane " + sitps +
"u", sloc, labApa);
65 insertLen(sapa +
"u", chu0, nchau,
"APA plane " + siapa +
"u", sloc);
66 insertLen(stpp +
"v", chv0, nchav,
"TPC plane " + sitps +
"v", sloc, labApa);
67 insertLen(sapa +
"v", chv0, nchav,
"APA plane " + siapa +
"v", sloc);
68 insertLen(stpp +
"c", chc0, nchaz,
"TPC plane " + sitps +
"c", sloc, labApa);
69 insertLen(sapa +
"c", chc0, nchaz,
"APA plane " + siapa +
"c", sloc);
70 insertLen(stpp +
"z", chz0, nchaz,
"TPC plane " + sitps +
"z", sloc, labApa);
71 insertLen(sapa +
"z", chz0, nchaz,
"APA plane " + siapa +
"z", sloc);
72 insertLen(stpp +
"i", chu0, nchai,
"TPC plane " + sitps +
"i", sloc, labApa);
73 insertLen(sapa +
"i", chu0, nchai,
"APA plane " + siapa +
"i", sloc);
74 insertLen(stpp +
"x", chx0, nchax,
"TPC plane " + sitps +
"x", sloc, labApa);
75 insertLen(sapa +
"x", chx0, nchax,
"APA plane " + siapa +
"x", sloc);
83 for (
Index ifmbOff=0; ifmbOff<20; ++ifmbOff ) {
85 ssnamu << siapa <<
setfill(
'0') <<
setw(2) << ifmbu <<
"u";
86 string namu = ssnamu.str();
87 insertLen(
"femb" + namu, fchu0, nfchau,
"FEMB block " + namu, sloc);
89 ssnamv << siapa <<
setfill(
'0') <<
setw(2) << ifmbv <<
"v";
90 string namv = ssnamv.str();
91 insertLen(
"femb" + namv, fchv0, nfchav,
"FEMB block " + namv, sloc);
93 ssnamx << siapa <<
setfill(
'0') <<
setw(2) << ifmbx <<
"x";
94 string namx = ssnamx.str();
95 insertLen(
"femb" + namx, fchx0, nfchax,
"FEMB block " + namx, sloc);
100 if ( ifmbu > 20 ) ifmbu = 1;
102 if ( ifmbv == 0 ) ifmbv = 20;
103 if ( ifmbOff < 9 ) ifmbx -= 1;
104 else if ( ifmbOff == 9 ) ifmbx = 1;
113 cout << myname <<
"WARNING: Extra range tool not found: " <<
m_ExtraRanges <<
endl;
125 const Name myname =
"ApaChannelRanges::runData: ";
128 if ( rout.
isValid() )
return rout;
132 if ( nam.size() == 10 && nam.substr(0,4) ==
"femb" ) {
141 }
else if ( cpla ==
'v' ) {
143 }
else if ( cpla ==
'x' || cpla ==
'w') {
145 istringstream ssapa(nam.substr(4,1));
148 istringstream ssfmb(nam.substr(5,2));
151 bool beamL = ifmb >= 1 && ifmb <= 10;
152 bool beamR = ifmb >= 11 && ifmb <= 20;
153 if ( beamL ) dirSame =
false;
154 else if ( beamR ) dirSame =
true;
157 if ( ifchmax != fbran.
size() ) {
158 cout << myname <<
"WARNING: FEMB block has unexpected size: " 159 << ifchmax <<
" != " << fbran.
size() <<
endl;
162 string sch = nam.substr(8,2);
163 istringstream ssfch(sch);
166 if ( ifch > 0 && ifch <= ifchmax ) {
167 if ( dirSame ) --ifch;
168 else ifch = ifchmax - ifch;
const IndexRangeTool * m_pExtraRanges
ChannelGroupService::Name Name
NameVector m_ApaLocationNames
ApaChannelRanges(fhicl::ParameterSet const &ps)
IndexRange get(Name nam) const override
std::vector< Index > IndexVector
static constexpr double ps
Name label(Index ilab=0) const
Q_EXPORT QTSManip setw(int w)
std::vector< Name > NameVector
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
auto const & get(AssnsNode< L, R, D > const &r)
Q_EXPORT QTSManip setfill(int f)
std::string to_string(ModuleType const mt)
void insertLen(Name nam, Index begin, Index len, Name lab, Name lab1="", Name lab2="")
QTextStream & endl(QTextStream &s)