11 using std::istringstream;
32 using MMap = std::multimap<Index,T>;
33 const string myname =
"readFclIndexMap: ";
34 Index lpre = pre.size();
37 if ( logLevel >= 3 ) cout << myname << sdesc <<
" fcl entry count: " << chnams.size() <<
endl;
38 for (
Name chnam : chnams ) {
39 if ( logLevel >= 3 ) cout << myname << sdesc <<
" fetching for " << chnam <<
endl;
41 string::size_type ipos = lpre;
42 string::size_type jpos = chnam.size() - 1;
43 Name msg =
"ERROR: " + sdesc +
" invalid index specifier: ";
44 if ( chnam.substr(0,ipos) == pre ) {
46 while ( chnam[ipos] ==
'0' && ipos+1 < chnam.size() ) ++ipos;
47 while ( jpos > ipos && chnam[jpos] ==
'x' ) --jpos;
49 string scha = chnam.substr(ipos, jpos+1-ipos);
51 istringstream sscha(scha);
53 if ( dat.count(icha) ) {
54 cout << myname <<
"WARNING: " + sdesc +
" replacing data for index " << icha <<
endl;
57 dat.insert(
typename MMap::value_type(icha, val));
62 if ( badnam ) cout << myname << msg << chnam <<
endl;
72 : m_LogLevel(ps.
get<
int>(
"LogLevel")),
74 const string myname =
"FclStickyCodeFlagger::ctor: ";
77 cout << myname <<
"Configuration: " <<
endl;
82 if ( m_StickyCode < AdcStuck || m_StickyCode >=
AdcMitigated ) {
83 cout << myname <<
"WARNING: Flag for sticky code has an unexpected value: " 90 for (
const IndexVectorMultiMap::value_type& imma : mvmap ) {
91 Index icha = imma.first;
94 codes.insert(codes.end(), newcodes.begin(), newcodes.end());
98 for ( IndexVectorMap::value_type& ient :
m_stickyCodes ) ncod += ient.second.size();
99 cout << myname <<
"Found " << ncod <<
" sticky code" << (ncod == 1 ?
"" :
"s") <<
" for " 100 << ncha <<
" channel" << (ncha == 1 ?
"" :
"s") <<
"." <<
endl;
102 cout << myname <<
"WARNING: Found " << nerr <<
" error" << (nerr == 1 ?
"" :
"s")
103 <<
" while parsing the sticky code map." << endl;
110 for ( IndexPairMap::value_type& ient :
m_stickyRanges ) chset.insert(ient.first);
112 cout << myname <<
"Found " << nran <<
" sticky range" << (nran == 1 ?
"" :
"s") <<
" for " 113 << ncha <<
" channel" << (ncha == 1 ?
"" :
"s") <<
"." <<
endl;
115 cout << myname <<
"WARNING: Found " << nerr <<
" error" << (nerr == 1 ?
"" :
"s")
116 <<
" while parsing the sticky range map." << endl;
123 const string myname =
"FclStickyCodeFlagger::view: ";
126 if ( acd.
flags.size() < acd.
raw.size() ) {
127 cout << myname <<
"WARNING: Increasing size of the flags vector for channel " << acd.
channel() <<
endl;
135 for (
Index isam=0; isam<acd.
raw.size(); ++isam ) {
136 if ( std::find(codes.begin(), codes.end(), acd.
raw[isam]) != codes.end() ) samplesToFlag.insert(isam);
140 using IndexPairRange = std::pair<IndexPairMap::const_iterator, IndexPairMap::const_iterator>;
144 for (
Index isam=0; isam<acd.
raw.size(); ++isam ) {
146 if ( adc >= ran.first && adc <= ran.second ) samplesToFlag.insert(isam);
153 ret.
setInt(
"stickyCodeCount", samplesToFlag.size());
DataMap update(AdcChannelData &acds) const override
void msg(const char *fmt,...)
FclStickyCodeFlagger(fhicl::ParameterSet const &ps)
ChannelGroupService::Name Name
IndexVectorMap m_stickyCodes
T get(std::string const &key) const
void setInt(Name name, int val)
static constexpr double ps
const AdcFlag AdcMitigated
std::vector< std::string > get_names() const
std::vector< Index > IndexVector
IndexPairMap m_stickyRanges
std::pair< Index, Index > IndexPair
auto const & get(AssnsNode< L, R, D > const &r)
std::multimap< Index, IndexPair > IndexPairMap
QTextStream & endl(QTextStream &s)