20 : m_LogLevel(ps.
get<
int>(
"LogLevel")) {
21 const string myname =
"Roi2dToAdc::ctor: ";
35 const string myname =
"Roi2dToAdc::updateTpcData: ";
37 const float zero = 0.0;
45 if (
m_LogLevel >= 4 ) cout << myname <<
" Skipping null map." <<
endl;
48 if (
m_LogLevel >= 4 ) cout << myname <<
" Processing map with channel count " 49 << pacm->size() <<
endl;
50 for (
auto& iacd : *(pacm) ) {
54 <<
" with sample count " << nsam <<
endl;
71 if (
m_LogLevel >= 4 ) cout << myname <<
" Processing ROI " << iroi <<
" with " 72 << roi.channelSize() <<
" channels and " 73 << roi.sampleSize() <<
" samples." <<
endl;
74 Index nsamRoi = roi.sampleSize();
77 Index& kcha = idxs[0];
78 Index& ksamRoi = idxs[1];
79 for ( kcha=0; kcha<roi.channelSize(); ++kcha ) {
80 Index icha = kcha + roi.channelOffset();
81 Index foundChannel = 0;
83 if ( pacm && pacm->count(icha) ) {
84 ++foundChannel =
true;
88 <<
" from ROI sample count " << nsamRoi
89 <<
" to ADC sample count " << nsamAdc <<
endl;
91 bool agr = ioffAdc > ioffRoi;
92 Index isamAdc = agr ? 0 :
Index(ioffRoi - ioffAdc);
93 ksamRoi = agr ?
Index(ioffAdc - ioffRoi) : 0;
94 while ( ksamRoi < nsamRoi && isamAdc < nsamAdc ) {
95 acd.
samples[isamAdc] = roi.data().value(idxs);
96 acd.
signal[isamAdc] =
true;
103 if ( foundChannel ) ++nchaFilled;
109 if ( ! pacm )
continue;
110 for (
auto& iacd : *(pacm) ) {
118 ret.
setInt(
"r2a_nchaZeroed", nchaZeroed);
119 ret.
setInt(
"r2a_nsamZeroed", nsamZeroed);
120 ret.
setInt(
"r2a_nchaFilled", nchaFilled);
121 ret.
setInt(
"r2a_nsamFilled", nsamFilled);
DataMap & setStatus(int stat)
Roi2dToAdc(fhicl::ParameterSet const &ps)
std::shared_ptr< AdcChannelDataMap > AdcDataPtr
DftData::IndexArray IndexArray
AdcDataVector & getAdcData()
DataArray::IndexArray IndexArray
unsigned long int LongIndex
AdcLongIndex tickOffset() const
void setInt(Name name, int val)
AdcSignalVector dftphases
static constexpr double ps
DataMap updateTpcData(TpcData &tpd) const override
auto const & get(AssnsNode< L, R, D > const &r)
Tpc2dRoiVector & get2dRois()
QTextStream & endl(QTextStream &s)