51 m_tws.insert(std::pair<
unsigned short, std::vector<float>>(boardID, params));
59 void addTimeWalks(
unsigned short boardID,
const std::vector<float>& deltas)
61 std::map<unsigned short, std::vector<float>>::iterator it =
m_tws.find(boardID);
62 if (it !=
m_tws.end()) {
64 (it->second)[i] += deltas[i];
67 B2FATAL(
"Specified tw params not found in addTimeWalks !");
103 std::map<unsigned short, std::vector<float>>::const_iterator it =
m_tws.find(boardID);
104 if (it !=
m_tws.end()) {
107 B2FATAL(
"Specified tw params not found in getTimeWalks !");
116 std::cout <<
" " << std::endl;
117 std::cout <<
"Time walk coefficient list" << std::endl;
118 std::cout <<
"#entries= " <<
m_tws.size() << std::endl;
120 std::cout <<
"in order of board# and coefficients" << std::endl;
122 for (
auto const& ent :
m_tws) {
123 std::cout << ent.first;
125 std::cout <<
" " << (ent.second)[i];
127 std::cout << std::endl;
136 std::ofstream fout(fileName);
139 B2ERROR(
"Specified output file could not be opened!");
142 for (
auto const& ent :
m_tws) {
143 fout << std::setw(3) << std::right << ent.first;
145 fout <<
" " << std::setw(15) << std::scientific << std::setprecision(8) << ent.second[i];
164 std::map<unsigned short, std::vector<float>>::iterator it =
m_tws.find(element);
165 if (it !=
m_tws.end()) {
166 (it->second)[i] =
static_cast<float>(value);
168 m_tws.insert(std::pair<
unsigned short, std::vector<float>>(element, {
static_cast<float>(value), 0.}));
174 std::vector<std::pair<unsigned short, unsigned short>> result;
175 for (
auto id_timewalk :
m_tws) {
176 result.push_back({id_timewalk.first, 0});
177 result.push_back({id_timewalk.first, 1});
188 std::map<unsigned short, std::vector<float>>
m_tws;
Database object for time-walk.
double getGlobalParam(unsigned short element, unsigned short i) const
Get global parameter.
CDCTimeWalks()
Default constructor.
static unsigned short getGlobalUniqueID()
Get global unique id.
void outputToFile(std::string fileName) const
Output the contents in text file format.
void addTimeWalks(unsigned short boardID, const std::vector< float > &deltas)
Update the time-walk coefficients in the list.
unsigned short m_twParamMode
Mode for tw parameterization; the initial value should be the one for classdef=1; do not modify it.
unsigned short getTwParamMode() const
Get tw parameterization mode.
std::vector< std::pair< unsigned short, unsigned short > > listGlobalParams() const
list stored global parameters
void setTwParamMode(unsigned short mode)
Set tw parameterization mode mode=0: tw (in ns) = p0/sqrt(FADCsum); mode=1: tw( in ns) = p0*exp(-p1*F...
unsigned short getEntries() const
Get the no.
void setGlobalParam(double value, unsigned short element, unsigned short i)
Set global parameter.
unsigned short m_nTwParams
No.
void setTimeWalkParams(unsigned short boardID, const std::vector< float > ¶ms)
Set the time-walk coefficients in the list.
const std::vector< float > & getTimeWalkParams(unsigned short boardID) const
Get the time-walk coefficients for the board.
std::map< unsigned short, std::vector< float > > m_tws
tw list
std::map< unsigned short, std::vector< float > > getTimeWalkParams() const
Get the whole list.
ClassDef(CDCTimeWalks, 2)
ClassDef.
void dump() const
Print all contents.
Abstract base class for different kinds of events.