143 const Name myname =
"AdcMultiChannelPlotter::viewMap: ";
145 if ( acds.size() == 0 )
return ret;
152 Index npadOnPage = 0;
156 npadOnPage = npadx*npady;
159 cout << myname <<
"Per page pad count is " << npadOnPage <<
" (" << npady <<
" x " << npadx <<
")" <<
endl;
168 for ( AdcChannelDataMap::value_type iacd : acds ) {
174 Name scha = sscha.str();
175 while ( scha.size() < 6 ) scha =
"0" + scha;
176 scha =
"chan" + scha;
177 localPads.emplace_back(scha);
178 Pad& pad = localPads.back();
179 pad.crnames.push_back(scha);
184 Index npad = pads.size();
185 if (
getLogLevel() >= 4 ) cout << myname <<
"Pad count is " << npad <<
endl;
188 Index ipadOnPage = 0;
189 for (
Index ipad=0; ipad<npad; ++ipad ) {
190 const Pad& pad = pads[ipad];
191 Name cgn = pad.cgname;
193 cout << myname <<
" Processing pad " << ipad <<
" for channel group " << cgn <<
endl;
195 Index ncr = pad.crnames.size();
196 for (
Index icr=0; icr<ncr; ++icr ) {
197 Name crn = pad.crnames[icr];
200 cout <<
"ERROR: Range " << crn <<
" in pad group " << cgn <<
" is invalid. Aborting." <<
endl;
204 cout << myname <<
" Processing range " << ran <<
endl;
207 if ( iacd1 == acds.end() ) {
208 if (
getLogLevel() >= 5 ) cout << myname <<
" Skipping range above data." << endl;
212 if ( iacd2 == iacd1 ) {
213 if (
getLogLevel() >= 5 ) cout << myname <<
" Skipping range below data." << endl;
220 Index icha = iacd->first;
222 cout << myname <<
"WARNING: View " <<
getDataView() <<
" is missing for channel " 223 << icha <<
"." <<
endl;
226 for (
Index idve=0; idve<ndve; ++idve ) {
232 Index nacd = acdvec.size();
233 cout << myname <<
" Processing channel range " << crn <<
" with " << nacd
234 <<
" entr" << (nacd == 1 ?
"y" :
"ies" ) <<
" in " << ncha <<
" channel" 235 << (ncha == 1 ?
"" :
"s") <<
"." <<
endl;
239 acdTmp.
setEventInfo(acds.begin()->second.getEventInfoPtr());
240 if ( pmantop ==
nullptr ) {
243 if ( npadOnPage > 1 ) pmantop->
split(npadx, npady);
246 if ( cgrn.size() == 0 ) {
251 if ( plotName.size() == 0 && acdvec.size() ) {
255 sman.replace(
"%CGNAME%", cgn);
256 sman.replace(
"%CRNAME%", crn);
257 sman.replace(
"%CGRNAME%", cgrn);
259 plotName = sman.str();
261 if ( plotName.size() ) cout << myname <<
" Created pad with plot name " << plotName << endl;
262 else cout << myname <<
" Created pad with no plot name." <<
endl;
265 cout << myname <<
" Run " << acdFirst.
run() <<
", event " << acdFirst.
event()
266 <<
" group/range " << cgrn <<
" ==> plot name " << plotName <<
endl;
271 if ( ppadPage ==
nullptr ) {
272 cout << myname <<
"ERROR: View pad " << ipadOnPage <<
" not found for pad " << ipad
273 <<
", channel range " << crn <<
"." <<
endl;
281 bool lastpad = (npadOnPage == 0) || (ipadOnPage == npadOnPage) || (ipad+1 == npad);
282 if ( lastpad && pmantop !=
nullptr ) {
283 if ( plotName.size() ) {
284 if (
getLogLevel() >= 3 ) cout << myname <<
" Printing canvas to " << plotName << endl;
285 pmantop->
print(plotName);
287 if (
getLogLevel() >= 3 ) cout << myname <<
" Not printing canvas for channel group/range " 288 << cgrn <<
"." <<
endl;
299 ret.
setInt(
"multiChannelNChannel", ncha);
300 ret.
setInt(
"multiChannelNPlot", nplt);
Index getLogLevel() const
BaseState & getBaseState() const
ChannelGroupService::Name Name
int setCanvasSize(int wx, int wy)
int split(Index nx, Index ny)
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
bool haveChannelRanges() const
bool haveChannelGroups() const
void setEventInfo(EventInfoPtr pevi)
void setInt(Name name, int val)
TPadManipulator * man(unsigned int ipad=0)
bool overlayGroups() const
std::vector< Pad > PadVector
virtual int viewMapChannels(Name crn, const AcdVector &acds, TPadManipulator &man, Index ncr, Index icr) const =0
const AdcChannelData * viewEntry(Name vpnam, AdcIndex ient) const
bool hasView(Name vnam) const
const AdcChannelStringTool * m_adcStringBuilder
int print(std::string fname, std::string spat="{,}")
QTextStream & endl(QTextStream &s)