14 using std::ostringstream;
26 T divide(
double sum,
Index nval) {
27 cout <<
"AdcDataDumper::divide: Invalid type." <<
endl;
59 for (
Index isam1=first; isam1<vin.size(); isam1+=
rebin ) {
60 typename V::value_type binval = vin[isam1];
64 if ( isam2 > vin.size() )
break;
65 for (
Index isam=isam1; isam<isam2; ++isam ) {
68 binval = divide<typename V::value_type>(binsum,
rebin);
70 vout.push_back(binval);
71 if ( vout.size() >= maxn )
break;
78 char charThresh(
double val,
double thresh) {
79 if ( val > thresh )
return '+';
80 if ( val < -thresh )
return '-';
93 m_NewFile(ps.
get<
bool>(
"NewFile")),
94 m_ShowChannelCount(ps.
get<
bool>(
"ShowChannelCount")),
95 m_ShowTickCounts(ps.
get<
bool>(
"ShowTickCounts")),
96 m_ShowRaw(ps.
get<
bool>(
"ShowRaw")),
97 m_ShowPrepared(ps.
get<
bool>(
"ShowPrepared")),
98 m_ShowFirst(ps.
get<unsigned
int>(
"ShowFirst")),
99 m_ShowRebin(ps.
get<unsigned
int>(
"ShowRebin")),
100 m_ShowMax(ps.
get<unsigned
int>(
"ShowMax")),
101 m_ShowThreshold(ps.
get<
float>(
"ShowThreshold")),
102 m_ShowOpt(ps.
get<unsigned
int>(
"ShowOpt")),
122 bool newfile = pout ==
nullptr;
127 string::size_type npos = string::npos;
128 string::size_type ipos = fname.find(
"%PAT%");
129 ipos = fname.find(
"%CHAN1%");
130 if ( ipos != npos ) {
131 string srep =
"NOCHAN";
134 ssrep << acds.begin()->first;
137 while ( ipos != npos ) {
138 fname.replace(ipos, 7, srep);
139 ipos = fname.find(
"%CHAN1%", ipos+7);
142 ipos = fname.find(
"%CHAN2%");
143 if ( ipos != npos ) {
144 string srep =
"NOCHAN";
147 ssrep << acds.rbegin()->first;
148 string srep = ssrep.str();
149 while ( ipos != npos ) {
150 fname.replace(ipos, 7, srep);
151 ipos = fname.find(
"%CHAN2%", ipos+7);
155 pout =
new ofstream(fname.c_str());
157 if ( pout ==
nullptr )
return ret.
setStatus(2);
158 ostream& out = *pout;
164 out << pre <<
" Values are displayed starting at tick " <<
m_ShowFirst;
166 else out <<
" without rebinning";
169 for (
const AdcChannelDataMap::value_type& iacd : acds ) {
171 ostringstream sschanpre;
172 sschanpre << pre <<
setw(wcha) << acd.
channel() <<
":";
173 string chanpre = sschanpre.str();
175 sschanpre << pre <<
setw(wcha+1) <<
" ";
176 string nochanpre = sschanpre.str();
179 out <<
" nraw=" <<
setw(wcou) << acd.
raw.size();
180 out <<
" nsam=" <<
setw(wcou) << acd.
samples.size();
181 out <<
" nflg=" <<
setw(wcou) << acd.
flags.size();
182 out <<
" nsig=" <<
setw(wcou) << acd.
signal.size();
183 out <<
" nroi=" <<
setw(wcou) << acd.
rois.size();
189 out << chanpre <<
" Raw:";
202 out << chanpre <<
" Prp:";
214 if ( newfile )
delete pout;
AdcDataDumper(fhicl::ParameterSet const &ps)
DataMap & setStatus(int stat)
static constexpr double ps
Q_EXPORT QTSManip setw(int w)
~AdcDataDumper() override
std::map< AdcChannel, AdcChannelData > AdcChannelDataMap
auto const & get(AssnsNode< L, R, D > const &r)
QTextStream & endl(QTextStream &s)
DataMap viewMap(const AdcChannelDataMap &acds) const override