16 using std::ostringstream;
25 std::ostream& operator<<(std::ostream& lhs, const std::vector<T>& vals) {
27 for (
const T&
val : vals ) {
28 if ( first ) first =
false;
38 : m_LogLevel(ps.
get<
int>(
"LogLevel")),
41 m_AdcUnderflowDefault(ps.
get<unsigned
int>(
"AdcUnderflowDefault")),
42 m_AdcOverflowDefault(ps.
get<unsigned
int>(
"AdcOverflowDefault")),
47 const string myname =
"FloatArrayGainCalibration::ctor: ";
50 cout << myname <<
"INFO: No gain array tool. Default gain will be used." <<
endl;
51 }
else if ( pdtm ==
nullptr ) {
52 cout << myname <<
"ERROR: Unable to retrieve tool manager." <<
endl;
56 cout << myname <<
"ERROR: Unable to retrieve gains tool " <<
m_GainTool <<
endl;
61 string stnam =
"runDataTool";
64 cout << myname <<
"ERROR: RunDataTool " << stnam
65 <<
" not found. Formulas will not be evaluated." <<
endl;
67 cout << myname <<
"RunDataTool retrieved." <<
endl;
77 cout << myname <<
" No GainTool." <<
endl;
97 const string myname =
"FloatArrayGainCalibration::update: ";
102 cout << myname <<
"Data does not have a channel ID." <<
endl;
108 cout << myname <<
"Gain not found for channel " << icha <<
endl;
113 if ( ! rdat.
isValid() ) cout << myname <<
"WARNING: RunData not found." <<
endl;
128 float gain =
m_pgains ==
nullptr ? gdef :
142 if (
m_LogLevel >= 3 ) cout << myname <<
"Processing " << nsam <<
" samples for channel " << icha <<
endl;
143 for (
Index isam=0; isam<nsam; ++isam ) {
145 if ( adcin <= adcudr ) {
148 }
else if ( adcin >= adcovr ) {
152 if ( isam ==0 || adcin < adcmin ) adcmin = adcin;
153 if ( isam ==0 || adcin > adcmax ) adcmax = adcin;
154 float sigout = gain*(adcin - acd.
pedestal);
159 res.
setInt(
"calibSampleCount", nsam);
160 res.
setInt(
"calibUnderflowCount", nunder);
161 res.
setInt(
"calibOverflowCount", nover);
162 res.
setInt(
"calibAdcMin", adcmin);
163 res.
setInt(
"calibAdcMax", adcmax);
const RunDataTool * m_prdtool
DataMap update(AdcChannelData &acd) const override
DataMap view(const AdcChannelData &acd) const override
void setFloat(Name name, float val)
DataMap & setStatus(int stat)
const AdcFlag AdcUnderflow
AdcIndex m_AdcOverflowDefault
const AdcFlag AdcOverflow
void setInt(Name name, int val)
static constexpr double ps
Q_EXPORT QTSManip setw(int w)
AdcIndex m_AdcUnderflowDefault
ParFormula * m_GainDefault
FloatArrayGainCalibration(fhicl::ParameterSet const &ps)
static Index badChannel()
auto const & get(AssnsNode< L, R, D > const &r)
SetStat setFormulaPars(TFormula *form)
ParFormula * m_ScaleFactor
QTextStream & endl(QTextStream &s)