Database object for time-walk.
More...
#include <CDCTimeWalks.h>
|
| CDCTimeWalks () |
| Default constructor.
|
|
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*FADCsum).
|
|
void | setTimeWalkParams (unsigned short boardID, const std::vector< float > ¶ms) |
| Set the time-walk coefficients in the list.
|
|
void | addTimeWalks (unsigned short boardID, const std::vector< float > &deltas) |
| Update the time-walk coefficients in the list.
|
|
unsigned short | getTwParamMode () const |
| Get tw parameterization mode.
|
|
unsigned short | getEntries () const |
| Get the no.
|
|
std::map< unsigned short, std::vector< float > > | getTimeWalkParams () const |
| Get the whole list.
|
|
const std::vector< float > & | getTimeWalkParams (unsigned short boardID) const |
| Get the time-walk coefficients for the board.
|
|
void | dump () const |
| Print all contents.
|
|
void | outputToFile (std::string fileName) const |
| Output the contents in text file format.
|
|
double | getGlobalParam (unsigned short element, unsigned short i) const |
| Get global parameter.
|
|
void | setGlobalParam (double value, unsigned short element, unsigned short i) |
| Set global parameter.
|
|
std::vector< std::pair< unsigned short, unsigned short > > | listGlobalParams () const |
| list stored global parameters
|
|
|
unsigned short | m_twParamMode |
| Mode for tw parameterization; the initial value should be the one for classdef=1; do not modify it.
|
|
unsigned short | m_nTwParams |
| No.
|
|
std::map< unsigned short, std::vector< float > > | m_tws |
| tw list
|
|
Database object for time-walk.
Definition at line 25 of file CDCTimeWalks.h.
◆ CDCTimeWalks()
◆ addTimeWalks()
void addTimeWalks |
( |
unsigned short |
boardID, |
|
|
const std::vector< float > & |
deltas |
|
) |
| |
|
inline |
Update the time-walk coefficients in the list.
- Parameters
-
boardID | front-end board id. |
deltas | delta-coefficients |
Definition at line 59 of file CDCTimeWalks.h.
60 {
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];
65 }
66 } else {
67 B2FATAL("Specified tw params not found in addTimeWalks !");
68 }
69 }
unsigned short m_nTwParams
No.
std::map< unsigned short, std::vector< float > > m_tws
tw list
◆ dump()
Print all contents.
Definition at line 114 of file CDCTimeWalks.h.
115 {
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;
121
122 for (
auto const& ent :
m_tws) {
123 std::cout << ent.first;
125 std::cout << " " << (ent.second)[i];
126 }
127 std::cout << std::endl;
128 }
129 }
unsigned short m_twParamMode
Mode for tw parameterization; the initial value should be the one for classdef=1; do not modify it.
◆ getEntries()
unsigned short getEntries |
( |
| ) |
const |
|
inline |
Get the no.
of entries in the list
Definition at line 83 of file CDCTimeWalks.h.
◆ getGlobalParam()
double getGlobalParam |
( |
unsigned short |
element, |
|
|
unsigned short |
i |
|
) |
| const |
|
inline |
Get global parameter.
Definition at line 157 of file CDCTimeWalks.h.
158 {
160 }
std::map< unsigned short, std::vector< float > > getTimeWalkParams() const
Get the whole list.
◆ getGlobalUniqueID()
static unsigned short getGlobalUniqueID |
( |
| ) |
|
|
inlinestatic |
◆ getTimeWalkParams() [1/2]
std::map< unsigned short, std::vector< float > > getTimeWalkParams |
( |
| ) |
const |
|
inline |
◆ getTimeWalkParams() [2/2]
const std::vector< float > & getTimeWalkParams |
( |
unsigned short |
boardID | ) |
const |
|
inline |
Get the time-walk coefficients for the board.
- Parameters
-
boardID | front-end board id. |
- Returns
- time-walk coefficients for the board id.
Definition at line 101 of file CDCTimeWalks.h.
102 {
103 std::map<unsigned short, std::vector<float>>::const_iterator it =
m_tws.find(boardID);
104 if (it !=
m_tws.end()) {
105 return it->second;
106 } else {
107 B2FATAL("Specified tw params not found in getTimeWalks !");
108 }
109 }
◆ getTwParamMode()
unsigned short getTwParamMode |
( |
| ) |
const |
|
inline |
◆ listGlobalParams()
std::vector< std::pair< unsigned short, unsigned short > > listGlobalParams |
( |
| ) |
const |
|
inline |
list stored global parameters
Definition at line 172 of file CDCTimeWalks.h.
173 {
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});
178 }
179 return result;
180 }
◆ outputToFile()
void outputToFile |
( |
std::string |
fileName | ) |
const |
|
inline |
Output the contents in text file format.
Definition at line 134 of file CDCTimeWalks.h.
135 {
136 std::ofstream fout(fileName);
137
138 if (fout.bad()) {
139 B2ERROR("Specified output file could not be opened!");
140 } else {
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];
146 }
147 fout << std::endl;
148 }
149 fout.close();
150 }
151 }
◆ setGlobalParam()
void setGlobalParam |
( |
double |
value, |
|
|
unsigned short |
element, |
|
|
unsigned short |
i |
|
) |
| |
|
inline |
Set global parameter.
Definition at line 162 of file CDCTimeWalks.h.
163 {
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);
167 } else {
168 m_tws.insert(std::pair<
unsigned short, std::vector<float>>(element, {
static_cast<float>(value), 0.}));
169 }
170 }
◆ setTimeWalkParams()
void setTimeWalkParams |
( |
unsigned short |
boardID, |
|
|
const std::vector< float > & |
params |
|
) |
| |
|
inline |
Set the time-walk coefficients in the list.
- Parameters
-
boardID | front-end board id. |
params | coefficients for the time-walk corr. term |
Definition at line 48 of file CDCTimeWalks.h.
49 {
51 m_tws.insert(std::pair<
unsigned short, std::vector<float>>(boardID, params));
52 }
◆ setTwParamMode()
void setTwParamMode |
( |
unsigned short |
mode | ) |
|
|
inline |
Set tw parameterization mode mode=0: tw (in ns) = p0/sqrt(FADCsum); mode=1: tw( in ns) = p0*exp(-p1*FADCsum).
Definition at line 38 of file CDCTimeWalks.h.
◆ m_nTwParams
unsigned short m_nTwParams |
|
private |
Initial value:
No.
of tw parameters; the initial value should be the one for classdef=1; do not modify it.
Definition at line 186 of file CDCTimeWalks.h.
◆ m_twParamMode
unsigned short m_twParamMode |
|
private |
Initial value:
Mode for tw parameterization; the initial value should be the one for classdef=1; do not modify it.
Definition at line 184 of file CDCTimeWalks.h.
◆ m_tws
std::map<unsigned short, std::vector<float> > m_tws |
|
private |
The documentation for this class was generated from the following file: