Database object for timing offset (t0).
More...
#include <CDCTimeZeros.h>
|
| CDCTimeZeros () |
| Default constructor.
|
|
void | setT0 (unsigned short iCLayer, unsigned short iWire, float t0) |
| Set t0 in the list.
|
|
void | setT0 (const WireID &wid, float t0) |
| Set t0 in the list.
|
|
void | addT0 (unsigned short iCLayer, unsigned short iWire, float delta) |
| Update t0 in the list.
|
|
void | addT0 (const WireID &wid, float delta) |
| Update t0 in the list.
|
|
unsigned short | getEntries () const |
| Get the no.
|
|
std::map< unsigned short, float > | getT0s () const |
| Get the whole list.
|
|
float | getT0 (const WireID &wid) const |
| Get t0 for the specified wire.
|
|
void | dump () const |
| Print out all contents.
|
|
void | outputToFile (std::string fileName) const |
| Output the contents in text file format.
|
|
double | getGlobalParam (unsigned short element, unsigned short) |
| Get global parameter.
|
|
void | setGlobalParam (double value, unsigned short element, unsigned short) |
| Set global parameter.
|
|
std::vector< std::pair< unsigned short, unsigned short > > | listGlobalParams () |
| list stored global parameters
|
|
|
std::map< unsigned short, float > | m_t0s |
| t0 list
|
|
Database object for timing offset (t0).
Definition at line 26 of file CDCTimeZeros.h.
◆ CDCTimeZeros()
◆ addT0() [1/2]
void addT0 |
( |
const WireID & |
wid, |
|
|
float |
delta |
|
) |
| |
|
inline |
Update t0 in the list.
- Parameters
-
wid | wire id. |
delta | delta-offset |
Definition at line 73 of file CDCTimeZeros.h.
74 {
75 std::map<unsigned short, float>::iterator it =
m_t0s.find(wid.getEWire());
76 it->second += delta;
77 }
std::map< unsigned short, float > m_t0s
t0 list
◆ addT0() [2/2]
void addT0 |
( |
unsigned short |
iCLayer, |
|
|
unsigned short |
iWire, |
|
|
float |
delta |
|
) |
| |
|
inline |
Update t0 in the list.
- Parameters
-
iCLayer | (continuous) layer id. |
iWire | wire id. in the layer |
delta | delta-offset |
Definition at line 61 of file CDCTimeZeros.h.
62 {
63 WireID wid(iCLayer, iWire);
64 std::map<unsigned short, float>::iterator it =
m_t0s.find(wid.getEWire());
65 it->second += delta;
66 }
◆ dump()
Print out all contents.
Definition at line 109 of file CDCTimeZeros.h.
110 {
111 std::cout << " " << std::endl;
112 std::cout << "t0 list" << std::endl;
113 std::cout <<
"# of entries= " <<
m_t0s.size() << std::endl;
114 std::cout << "in order of clayer#, wire#, t0" << std::endl;
115 for (
auto const& ent :
m_t0s) {
116 std::cout << WireID(ent.first).getICLayer() << " " << WireID(ent.first).getIWire() << " " << ent.second << std::endl;
117 }
118 }
◆ getEntries()
unsigned short getEntries |
( |
| ) |
const |
|
inline |
Get the no.
of entries in the list
Definition at line 82 of file CDCTimeZeros.h.
◆ getGlobalParam()
double getGlobalParam |
( |
unsigned short |
element, |
|
|
unsigned short |
|
|
) |
| |
|
inline |
Get global parameter.
Definition at line 142 of file CDCTimeZeros.h.
143 {
144 return getT0(WireID(element));
145 }
float getT0(const WireID &wid) const
Get t0 for the specified wire.
◆ getGlobalUniqueID()
static unsigned short getGlobalUniqueID |
( |
| ) |
|
|
inlinestatic |
◆ getT0()
float getT0 |
( |
const WireID & |
wid | ) |
const |
|
inline |
Get t0 for the specified wire.
- Parameters
-
- Returns
- t0 for the wire
Definition at line 100 of file CDCTimeZeros.h.
101 {
102 std::map<unsigned short, float>::const_iterator it =
m_t0s.find(wid.getEWire());
103 return it->second;
104 }
◆ getT0s()
std::map< unsigned short, float > getT0s |
( |
| ) |
const |
|
inline |
◆ listGlobalParams()
std::vector< std::pair< unsigned short, unsigned short > > listGlobalParams |
( |
| ) |
|
|
inline |
list stored global parameters
Definition at line 155 of file CDCTimeZeros.h.
156 {
157 std::vector<std::pair<unsigned short, unsigned short>> result;
158 for (
auto id_t0 :
getT0s()) {
159 result.push_back({id_t0.first, 0});
160 }
161 return result;
162 }
std::map< unsigned short, float > getT0s() const
Get the whole list.
◆ outputToFile()
void outputToFile |
( |
std::string |
fileName | ) |
const |
|
inline |
Output the contents in text file format.
Definition at line 123 of file CDCTimeZeros.h.
124 {
125 std::ofstream fout(fileName);
126
127 if (fout.bad()) {
128 B2ERROR("Specified output file could not be opened!");
129 } else {
130 for (
auto const& ent :
m_t0s) {
131 fout << std::setw(2) << std::right << WireID(ent.first).getICLayer() << " " << std::setw(3) << WireID(
132 ent.first).getIWire() << " " << std::setw(15) << std::scientific << std::setprecision(8) << ent.second << std::endl;
133 }
134 fout.close();
135 }
136 }
◆ setGlobalParam()
void setGlobalParam |
( |
double |
value, |
|
|
unsigned short |
element, |
|
|
unsigned short |
|
|
) |
| |
|
inline |
Set global parameter.
Definition at line 147 of file CDCTimeZeros.h.
148 {
149 WireID wire(element);
150
151
152 m_t0s[wire.getEWire()] = value;
153 }
◆ setT0() [1/2]
void setT0 |
( |
const WireID & |
wid, |
|
|
float |
t0 |
|
) |
| |
|
inline |
Set t0 in the list.
- Parameters
-
Definition at line 50 of file CDCTimeZeros.h.
51 {
52 m_t0s.insert(std::pair<unsigned short, float>(wid.getEWire(), t0));
53 }
◆ setT0() [2/2]
void setT0 |
( |
unsigned short |
iCLayer, |
|
|
unsigned short |
iWire, |
|
|
float |
t0 |
|
) |
| |
|
inline |
Set t0 in the list.
- Parameters
-
iCLayer | (continuous) layer id. |
iWire | wire id. in the layer |
t0 | offset |
Definition at line 40 of file CDCTimeZeros.h.
41 {
42 m_t0s.insert(std::pair<unsigned short, float>(WireID(iCLayer, iWire).getEWire(), t0));
43 }
◆ m_t0s
std::map<unsigned short, float> m_t0s |
|
private |
The documentation for this class was generated from the following file: