Belle II Software development
CDCTimeZeros Class Reference

Database object for timing offset (t0). More...

#include <CDCTimeZeros.h>

Inheritance diagram for CDCTimeZeros:

Public Member Functions

 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
 

Static Public Member Functions

static unsigned short getGlobalUniqueID ()
 Get global unique id.
 

Private Member Functions

 ClassDef (CDCTimeZeros, 2)
 ClassDef.
 

Private Attributes

std::map< unsigned short, float > m_t0s
 t0 list
 

Detailed Description

Database object for timing offset (t0).

Definition at line 26 of file CDCTimeZeros.h.

Constructor & Destructor Documentation

◆ CDCTimeZeros()

CDCTimeZeros ( )
inline

Default constructor.

Definition at line 32 of file CDCTimeZeros.h.

32{}

Member Function Documentation

◆ addT0() [1/2]

void addT0 ( const WireID wid,
float  delta 
)
inline

Update t0 in the list.

Parameters
widwire id.
deltadelta-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
Definition: CDCTimeZeros.h:166

◆ addT0() [2/2]

void addT0 ( unsigned short  iCLayer,
unsigned short  iWire,
float  delta 
)
inline

Update t0 in the list.

Parameters
iCLayer(continuous) layer id.
iWirewire id. in the layer
deltadelta-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()

void dump ( ) const
inline

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.

83 {
84 return m_t0s.size();
85 }

◆ 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.
Definition: CDCTimeZeros.h:100

◆ getGlobalUniqueID()

static unsigned short getGlobalUniqueID ( )
inlinestatic

Get global unique id.

Definition at line 140 of file CDCTimeZeros.h.

140{return 25;}

◆ getT0()

float getT0 ( const WireID wid) const
inline

Get t0 for the specified wire.

Parameters
widWire id.
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

Get the whole list.

Definition at line 90 of file CDCTimeZeros.h.

91 {
92 return m_t0s;
93 }

◆ 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.
Definition: CDCTimeZeros.h:90

◆ 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 //This does not work, tries to insert, but we need an update
151 //setT0(wire.getICLayer(), wire.getIWire(), value);
152 m_t0s[wire.getEWire()] = value;
153 }

◆ setT0() [1/2]

void setT0 ( const WireID wid,
float  t0 
)
inline

Set t0 in the list.

Parameters
widwire id.
t0offset

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.
iWirewire id. in the layer
t0offset

Definition at line 40 of file CDCTimeZeros.h.

41 {
42 m_t0s.insert(std::pair<unsigned short, float>(WireID(iCLayer, iWire).getEWire(), t0));
43 }

Member Data Documentation

◆ m_t0s

std::map<unsigned short, float> m_t0s
private

t0 list

Definition at line 166 of file CDCTimeZeros.h.


The documentation for this class was generated from the following file: