Typedefs | Functions
FclStickyCodeFlagger_tool.cc File Reference
#include "FclStickyCodeFlagger.h"
#include <iostream>
#include <sstream>
#include <set>

Go to the source code of this file.

Typedefs

using Index = FclStickyCodeFlagger::Index
 
using IndexVector = FclStickyCodeFlagger::IndexVector
 
using IndexSet = std::set< Index >
 
using Name = FclStickyCodeFlagger::Name
 
using NameVector = std::vector< Name >
 
using IndexVectorMultiMap = std::multimap< Index, IndexVector >
 
using IndexPair = FclStickyCodeFlagger::IndexPair
 
using IndexPairMultiMap = FclStickyCodeFlagger::IndexPairMap
 

Functions

template<class T >
int readFclIndexMap (string pre, string sdesc, int logLevel, const fhicl::ParameterSet &pstab, std::multimap< Index, T > &dat)
 

Typedef Documentation

Definition at line 12 of file FclStickyCodeFlagger_tool.cc.

Definition at line 18 of file FclStickyCodeFlagger_tool.cc.

Definition at line 19 of file FclStickyCodeFlagger_tool.cc.

using IndexSet = std::set<Index>

Definition at line 14 of file FclStickyCodeFlagger_tool.cc.

Definition at line 13 of file FclStickyCodeFlagger_tool.cc.

using IndexVectorMultiMap = std::multimap<Index, IndexVector>

Definition at line 17 of file FclStickyCodeFlagger_tool.cc.

Definition at line 15 of file FclStickyCodeFlagger_tool.cc.

Definition at line 16 of file FclStickyCodeFlagger_tool.cc.

Function Documentation

template<class T >
int readFclIndexMap ( string  pre,
string  sdesc,
int  logLevel,
const fhicl::ParameterSet pstab,
std::multimap< Index, T > &  dat 
)

Definition at line 31 of file FclStickyCodeFlagger_tool.cc.

31  {
32  using MMap = std::multimap<Index,T>;
33  const string myname = "readFclIndexMap: ";
34  Index lpre = pre.size();
35  Index nerr = 0;
36  NameVector chnams = pstab.get_names();
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;
40  bool badnam = true;
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 ) {
45  // Remove leading zeroes to be extra careful. Not needed.
46  while ( chnam[ipos] == '0' && ipos+1 < chnam.size() ) ++ipos;
47  while ( jpos > ipos && chnam[jpos] == 'x' ) --jpos;
48  const Index badIndex = -1;
49  string scha = chnam.substr(ipos, jpos+1-ipos);
50  Index icha = badIndex;
51  istringstream sscha(scha);
52  sscha >> icha;
53  if ( dat.count(icha) ) {
54  cout << myname << "WARNING: " + sdesc + " replacing data for index " << icha << endl;
55  }
56  T val = pstab.get<T>(chnam);
57  dat.insert(typename MMap::value_type(icha, val));
58  badnam = false;
59  } else {
60  ++nerr;
61  }
62  if ( badnam ) cout << myname << msg << chnam << endl;
63  }
64  return nerr;
65 }
Index badIndex
void msg(const char *fmt,...)
Definition: message.cpp:107
ChannelGroupService::Name Name
unsigned int Index
T get(std::string const &key) const
Definition: ParameterSet.h:271
std::vector< string > NameVector
std::vector< std::string > get_names() const
QTextStream & endl(QTextStream &s)