Belle II Software development
CDCEDepToADCConversions Class Reference

Database object for energy-deposit to ADC-count conversion. More...

#include <CDCEDepToADCConversions.h>

Inheritance diagram for CDCEDepToADCConversions:

Public Member Functions

 CDCEDepToADCConversions ()
 Default constructor.
 
void setParamMode (unsigned short mode)
 Set conversion parameterization mode.
 
void setGroupID (unsigned short mode)
 Set group id (parameterized per group) id=0: superLayerID; =1: layerID; =2: wireID.
 
void setParams (unsigned short id, const std::vector< float > &params)
 Set the conv.
 
unsigned short getParamMode () const
 Get mode of conversion parameterization.
 
unsigned short getGroupID () const
 Get group id.
 
unsigned short getEntries () const
 Get the no.
 
const std::map< unsigned short, std::vector< float > > & getParams () const
 Get the whole list.
 
const std::vector< float > & getParams (unsigned short id) const
 Get the conv.
 
void dump () const
 Print all contents.
 
void outputToFile (std::string fileName) const
 Output the contents in text file format.
 

Private Member Functions

 ClassDef (CDCEDepToADCConversions, 3)
 ClassDef.
 

Private Attributes

unsigned short m_paramMode = 0
 Mode for parameterization.
 
unsigned short m_groupID = 0
 Group id (parameterized per group)
 
std::map< unsigned short, std::vector< float > > m_cvs
 cv list
 

Detailed Description

Database object for energy-deposit to ADC-count conversion.

Definition at line 25 of file CDCEDepToADCConversions.h.

Constructor & Destructor Documentation

◆ CDCEDepToADCConversions()

Default constructor.

Definition at line 31 of file CDCEDepToADCConversions.h.

31{}

Member Function Documentation

◆ dump()

void dump ( ) const
inline

Print all contents.

Definition at line 110 of file CDCEDepToADCConversions.h.

111 {
112 std::cout << " " << std::endl;
113 std::cout << "Edep-to-ADC conversion list" << std::endl;
114 std::cout << "#entries= " << m_cvs.size() << std::endl;
115 std::cout << m_paramMode << std::endl;
116 std::cout << "in order of id and parameters" << std::endl;
117
118 for (auto const& ent : m_cvs) {
119 std::cout << ent.first;
120 unsigned short np = (ent.second).size();
121 for (unsigned short i = 0; i < np; ++i) {
122 std::cout << " " << (ent.second)[i];
123 }
124 std::cout << std::endl;
125 }
126 }

◆ getEntries()

unsigned short getEntries ( ) const
inline

Get the no.

of entries in the list

Definition at line 79 of file CDCEDepToADCConversions.h.

80 {
81 return m_cvs.size();
82 }

◆ getGroupID()

unsigned short getGroupID ( ) const
inline

Get group id.

Definition at line 71 of file CDCEDepToADCConversions.h.

72 {
73 return m_groupID;
74 }

◆ getParamMode()

unsigned short getParamMode ( ) const
inline

Get mode of conversion parameterization.

Definition at line 63 of file CDCEDepToADCConversions.h.

64 {
65 return m_paramMode;
66 }

◆ getParams() [1/2]

const std::map< unsigned short, std::vector< float > > & getParams ( ) const
inline

Get the whole list.

Definition at line 87 of file CDCEDepToADCConversions.h.

88 {
89 return m_cvs;
90 }

◆ getParams() [2/2]

const std::vector< float > & getParams ( unsigned short id) const
inline

Get the conv.

parameters for the id

Parameters
idlayerID or wireID
Returns
conversion paramseters for the id

Definition at line 97 of file CDCEDepToADCConversions.h.

98 {
99 std::map<unsigned short, std::vector<float>>::const_iterator it = m_cvs.find(id);
100 if (it != m_cvs.end()) {
101 return it->second;
102 } else {
103 B2FATAL("Specified id not found in getParams !");
104 }
105 }

◆ outputToFile()

void outputToFile ( std::string fileName) const
inline

Output the contents in text file format.

Definition at line 132 of file CDCEDepToADCConversions.h.

133 {
134 std::ofstream fout(fileName);
135
136 if (fout.bad()) {
137 B2ERROR("Specified output file could not be opened!");
138 } else {
139 std::map<unsigned short, std::vector<float>>::const_iterator it = m_cvs.find(0);
140 int nParams = (it->second).size();
141 fout << m_paramMode << " " << nParams << std::endl;
142 fout << m_groupID << std::endl;
143 for (auto const& ent : m_cvs) {
144 fout << std::setw(3) << std::right << ent.first;
145 for (unsigned short i = 0; i < nParams; ++i) {
146 fout << " " << std::setw(15) << std::scientific << std::setprecision(8) << (ent.second)[i];
147 }
148 fout << std::endl;
149 }
150 fout.close();
151 }
152 }

◆ setGroupID()

void setGroupID ( unsigned short mode)
inline

Set group id (parameterized per group) id=0: superLayerID; =1: layerID; =2: wireID.

Definition at line 45 of file CDCEDepToADCConversions.h.

46 {
47 m_groupID = mode;
48 }

◆ setParamMode()

void setParamMode ( unsigned short mode)
inline

Set conversion parameterization mode.

Definition at line 36 of file CDCEDepToADCConversions.h.

37 {
38 m_paramMode = mode;
39 }

◆ setParams()

void setParams ( unsigned short id,
const std::vector< float > & params )
inline

Set the conv.

paramseters in the list

Parameters
idsuperLayerid(0-8), laerID(0-55) or wireID
paramsparameters for conversion

Definition at line 55 of file CDCEDepToADCConversions.h.

56 {
57 m_cvs.insert(std::pair<unsigned short, std::vector<float>>(id, params));
58 }

Member Data Documentation

◆ m_cvs

std::map<unsigned short, std::vector<float> > m_cvs
private

cv list

Definition at line 157 of file CDCEDepToADCConversions.h.

◆ m_groupID

unsigned short m_groupID = 0
private

Group id (parameterized per group)

Definition at line 156 of file CDCEDepToADCConversions.h.

◆ m_paramMode

unsigned short m_paramMode = 0
private

Mode for parameterization.

Definition at line 155 of file CDCEDepToADCConversions.h.


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