Belle II Software development
CDCBadWires Class Reference

Database object for bad wires. More...

#include <CDCBadWires.h>

Inheritance diagram for CDCBadWires:

Public Member Functions

 CDCBadWires ()
 Default constructor.
 
void setWire (const WireID &wid, double eff=0)
 Set the wire in the list.
 
void setWire (unsigned short iCLayer, unsigned short iWire, double eff=0)
 Set the wire in the list.
 
unsigned short getEntries () const
 Get the no.
 
std::map< unsigned short, float > getWires () const
 Get the whole list.
 
bool isBadWire (const WireID &wid) const
 Check if the wire is totally-dead (eff=0); to be replaced by isDeadWire() in future...
 
bool isDeadWire (const WireID &wid, double &eff) const
 Check if dead wire.
 
bool isHotWire (const WireID &wid) const
 Check if the wire is hot/noisy.
 
void dump () const
 Print out contents.
 
void outputToFile (std::string fileName) const
 Output the contents in text file format.
 

Private Member Functions

 ClassDef (CDCBadWires, 2)
 ClassDef.
 

Private Attributes

std::map< unsigned short, float > m_wires
 badwire list
 

Detailed Description

Database object for bad wires.

Definition at line 27 of file CDCBadWires.h.

Constructor & Destructor Documentation

◆ CDCBadWires()

CDCBadWires ( )
inline

Default constructor.

Definition at line 33 of file CDCBadWires.h.

33{}

Member Function Documentation

◆ dump()

void dump ( ) const
inline

Print out contents.

Definition at line 122 of file CDCBadWires.h.

123 {
124 std::cout << " " << std::endl;
125 std::cout << "Bad wire list" << std::endl;
126 std::cout << "#entries= " << m_wires.size() << std::endl;
127 std::cout << "in order of ICLayer and IWire and EWire" << std::endl;
128
129 for (auto const ent : m_wires) {
130 std::cout << WireID(ent.first).getICLayer() << " " << WireID(ent.first).getIWire() << " " << ent.second << std::endl;
131 }
132 }
std::map< unsigned short, float > m_wires
badwire list
Definition: CDCBadWires.h:153

◆ getEntries()

unsigned short getEntries ( ) const
inline

Get the no.

of entries in the list

Definition at line 59 of file CDCBadWires.h.

60 {
61 return m_wires.size();
62 }

◆ getWires()

std::map< unsigned short, float > getWires ( ) const
inline

Get the whole list.

Definition at line 67 of file CDCBadWires.h.

68 {
69 return m_wires;
70 }

◆ isBadWire()

bool isBadWire ( const WireID wid) const
inline

Check if the wire is totally-dead (eff=0); to be replaced by isDeadWire() in future...

Parameters
widwire id to be checked
Returns
true if dead wire; false if not

Definition at line 77 of file CDCBadWires.h.

78 {
79 std::map<unsigned short, float>::const_iterator it = m_wires.find(wid.getEWire());
80 if (it != m_wires.end() && it->second == 0.) {
81 return true;
82 } else {
83 return false;
84 }
85 }

◆ isDeadWire()

bool isDeadWire ( const WireID wid,
double &  eff 
) const
inline

Check if dead wire.

Parameters
widwire id to be checked
effefficiency of the wirte
Returns
true if dead wire; false if not

Definition at line 93 of file CDCBadWires.h.

94 {
95 std::map<unsigned short, float>::const_iterator it = m_wires.find(wid.getEWire());
96 if (it != m_wires.end() && 0. <= it->second && it->second < 1.) {
97 eff = it->second;
98 return true;
99 } else {
100 return false;
101 }
102 }

◆ isHotWire()

bool isHotWire ( const WireID wid) const
inline

Check if the wire is hot/noisy.

Parameters
widwire id to be checked
Returns
true if hot wire; false if not

Definition at line 109 of file CDCBadWires.h.

110 {
111 std::map<unsigned short, float>::const_iterator it = m_wires.find(wid.getEWire());
112 if (it != m_wires.end() && it->second > 1.) {
113 return true;
114 } else {
115 return false;
116 }
117 }

◆ outputToFile()

void outputToFile ( std::string  fileName) const
inline

Output the contents in text file format.

Definition at line 137 of file CDCBadWires.h.

138 {
139 std::ofstream fout(fileName);
140
141 if (fout.bad()) {
142 B2ERROR("Specified output file could not be opened!");
143 } else {
144 for (auto const ent : m_wires) {
145 fout << std::setw(2) << std::right << WireID(ent.first).getICLayer() << " " << std::setw(3) << WireID(
146 ent.first).getIWire() << " " << ent.second << std::endl;
147 }
148 fout.close();
149 }
150 }

◆ setWire() [1/2]

void setWire ( const WireID wid,
double  eff = 0 
)
inline

Set the wire in the list.

Parameters
widwire-id to be registered
effwire efficiency; specify 0 <= eff < 1 for dead wire; eff > 1 for hot/noisy wire

Definition at line 40 of file CDCBadWires.h.

41 {
42 m_wires.insert(std::pair(wid.getEWire(), eff));
43 }

◆ setWire() [2/2]

void setWire ( unsigned short  iCLayer,
unsigned short  iWire,
double  eff = 0 
)
inline

Set the wire in the list.

Parameters
iCLayer(continuous) layer-id of badwire
iWirewire-id of badwire
effwire efficiency; specify 0 <= eff < 1 for dead wire; eff > 1 for hot/noisy wire

Definition at line 51 of file CDCBadWires.h.

52 {
53 m_wires.insert(std::pair(WireID(iCLayer, iWire).getEWire(), eff));
54 }

Member Data Documentation

◆ m_wires

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

badwire list

Definition at line 153 of file CDCBadWires.h.


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