12 using std::ostringstream;
13 using std::istringstream;
23 : m_LogLevel(ps.
get<
Index>(
"LogLevel")),
25 m_ExtraRanges(ps.
get<
Name>(
"ExtraRanges")) {
26 const Name myname =
"HalfApaChannelRanges::ctor: ";
35 Index nchax = 2*nchaz;
36 Index nchai = nchau + nchav;
38 insertLen(
"all", 0, ntps*nchaApa,
"All",
"");
39 for (
Index itps=0; itps<ntps; ++itps ) {
46 string labTps =
"TPC set " + sitps;
47 string labApa =
"APA " + siapa;
49 Index ch0 = itps*nchaApa;
50 string stps =
"tps" + sitps;
51 string sapa =
"apa" + siapa;
52 insertLen( stps, ch0, nchaApa, labTps, labApa);
54 string stpp =
"tpp" + sitps;
56 Index chv0 = chu0 + nchau;
57 Index chx10 = chv0 + nchav;
58 Index chx20 = chx10 + nchaz;
60 bool beamRight = 2*(itps/2) == itps;
61 Index chz0 = beamRight ? chx20 : chx10;
62 Index chc0 = beamRight ? chx10 : chx20;
63 insertLen(stpp +
"u", chu0, nchau,
"TPC plane " + sitps +
"u", labApa);
64 insertLen(sapa +
"u", chu0, nchau,
"APA plane " + siapa +
"u");
65 insertLen(stpp +
"v", chv0, nchav,
"TPC plane " + sitps +
"v", labApa);
66 insertLen(sapa +
"v", chv0, nchav,
"APA plane " + siapa +
"v");
67 insertLen(stpp +
"z1", chc0, nchaz,
"TPC plane " + sitps +
"z1", labApa);
68 insertLen(sapa +
"z1", chc0, nchaz,
"APA plane " + siapa +
"z1");
69 insertLen(stpp +
"z2", chz0, nchaz,
"TPC plane " + sitps +
"z2", labApa);
70 insertLen(sapa +
"z2", chz0, nchaz,
"APA plane " + siapa +
"z2");
71 insertLen(stpp +
"i", chu0, nchai,
"TPC planes " + sitps +
"i", labApa);
72 insertLen(sapa +
"i", chu0, nchai,
"APA planes " + siapa +
"i");
73 insertLen(stpp +
"x", chx0, nchax,
"TPC planes " + sitps +
"x", labApa);
74 insertLen(sapa +
"x", chx0, nchax,
"APA planes " + siapa +
"x");
75 insertLen(stpp +
"z", chx0, nchax,
"collection planes " + sitps, labApa);
76 insertLen(sapa +
"z", chx0, nchax,
"collection planes " + siapa);
84 for (
Index ifmbOff=0; ifmbOff<20; ++ifmbOff ) {
86 ssnamu << siapa <<
setfill(
'0') <<
setw(2) << ifmbu <<
"u";
87 string namu = ssnamu.str();
88 insertLen(
"femb" + namu, fchu0, nfchau,
"FEMB block " + namu);
90 ssnamv << siapa <<
setfill(
'0') <<
setw(2) << ifmbv <<
"v";
91 string namv = ssnamv.str();
92 insertLen(
"femb" + namv, fchv0, nfchav,
"FEMB block " + namv);
94 ssnamx << siapa <<
setfill(
'0') <<
setw(2) << ifmbx <<
"x";
95 string namx = ssnamx.str();
96 insertLen(
"femb" + namx, fchx0, nfchax,
"FEMB block " + namx);
101 if ( ifmbu > 10 ) ifmbu = 1;
103 if ( ifmbv == 0 ) ifmbv = 10;
104 if ( ifmbOff < 4 ) ifmbx -= 1;
105 else if ( ifmbOff == 4 ) ifmbx = 1;
114 cout << myname <<
"WARNING: Extra range tool not found: " <<
m_ExtraRanges <<
endl;
126 const Name myname =
"HalfApaChannelRanges::runData: ";
129 if ( rout.
isValid() )
return rout;
133 if ( nam.size() == 10 && nam.substr(0,4) ==
"femb" ) {
142 }
else if ( cpla ==
'v' ) {
144 }
else if ( cpla ==
'x' || cpla ==
'w') {
146 istringstream ssapa(nam.substr(4,1));
149 istringstream ssfmb(nam.substr(5,2));
152 bool beamL = ifmb >= 1 && ifmb <= 10;
153 bool beamR = ifmb >= 11 && ifmb <= 20;
154 if ( beamL ) dirSame =
false;
155 else if ( beamR ) dirSame =
true;
158 if ( ifchmax != fbran.
size() ) {
159 cout << myname <<
"WARNING: FEMB block has unexpected size: " 160 << ifchmax <<
" != " << fbran.
size() <<
endl;
163 string sch = nam.substr(8,2);
164 istringstream ssfch(sch);
167 if ( ifch > 0 && ifch <= ifchmax ) {
168 if ( dirSame ) --ifch;
169 else ifch = ifchmax - ifch;
void insertLen(Name nam, Index begin, Index len, Name lab, Name lab1="", Name lab2="")
ChannelGroupService::Name Name
HalfApaChannelRanges(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)
const IndexRangeTool * m_pExtraRanges
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)
QTextStream & endl(QTextStream &s)