BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
calibUtil::StripSrv Class Reference

#include <StripSrv.h>

Classes

struct  stowerRC
 Clients should use as return values for readData. More...
 

Public Types

enum  eBadType {
  UNKNOWN_BADTYPE , DEAD , HOT , UNKNOWN_BADTYPE ,
  DEAD , HOT
}
 
enum  eBadType {
  UNKNOWN_BADTYPE , DEAD , HOT , UNKNOWN_BADTYPE ,
  DEAD , HOT
}
 
typedef struct calibUtil::StripSrv::stowerRC towerRC
 Clients should use as return values for readData.
 
typedef std::vector< unsigned short int > StripCol
 
typedef struct calibUtil::StripSrv::stowerRC towerRC
 Clients should use as return values for readData.
 
typedef std::vector< unsigned short int > StripCol
 

Public Member Functions

 StripSrv (std::string xmlFileName)
 
 StripSrv (eBadType badType, const GenericSrv &gen)
 Constructor to be used when creating new calibrations.
 
 ~StripSrv ()
 destructor. Deallocates memory
 
eBadType getBadType () const
 returns the status (Hot or Dead) of the strip
 
void getBadTowers (std::vector< towerRC > &towerIds) const
 lists all towers with bad strips
 
std::string getInst () const
 methods giving access to generic data
 
std::string getTimestamp () const
 Get timestamp.
 
std::string getCalType () const
 Get calibration type.
 
std::string getFmtVer () const
 Get format Version.
 
eVisitorRet traverseInfo (ClientObject *client) const
 call back method for client to access large data
 
eVisitorRet writeXml (std::ostream *out)
 
 StripSrv (std::string xmlFileName)
 
 StripSrv (eBadType badType, const GenericSrv &gen)
 Constructor to be used when creating new calibrations.
 
 ~StripSrv ()
 destructor. Deallocates memory
 
eBadType getBadType () const
 returns the status (Hot or Dead) of the strip
 
void getBadTowers (std::vector< towerRC > &towerIds) const
 lists all towers with bad strips
 
std::string getInst () const
 methods giving access to generic data
 
std::string getTimestamp () const
 Get timestamp.
 
std::string getCalType () const
 Get calibration type.
 
std::string getFmtVer () const
 Get format Version.
 
eVisitorRet traverseInfo (ClientObject *client) const
 call back method for client to access large data
 
eVisitorRet writeXml (std::ostream *out)
 

Detailed Description

Member Typedef Documentation

◆ StripCol [1/2]

typedef std::vector<unsigned short int> calibUtil::StripSrv::StripCol

◆ StripCol [2/2]

typedef std::vector<unsigned short int> calibUtil::StripSrv::StripCol

◆ towerRC [1/2]

Clients should use as return values for readData.

◆ towerRC [2/2]

Clients should use as return values for readData.

Member Enumeration Documentation

◆ eBadType [1/2]

◆ eBadType [2/2]

Enumerator
UNKNOWN_BADTYPE 
DEAD 
HOT 
UNKNOWN_BADTYPE 
DEAD 
HOT 

Definition at line 64 of file InstallArea/include/calibUtil/calibUtil/StripSrv.h.

Constructor & Destructor Documentation

◆ StripSrv() [1/4]

calibUtil::StripSrv::StripSrv ( std::string  xmlFileName)

constructor. Initializes strip service by creating a DOM structure out of the XML file and filling in the internal data structures

Definition at line 30 of file StripSrv.cxx.

30 : m_badType(UNKNOWN_BADTYPE),
31 m_state(FROM_PERS),
32 m_genSrv(0)
33 {
34 using xmlBase::Dom;
35 using XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument;
36
38 DOMDocument* doc = parser->parse(xmlFileName.c_str());
39
40 if (doc == 0) {
41 std::cerr << "Error parsing document" << xmlFileName << std::endl;
42 return;
43 }
44
45 DOMElement* docElt = doc->getDocumentElement();
46 m_genSrv = new GenericSrv(docElt);
47
48 std::vector<DOMElement *> towers;
49
50 Dom::getDescendantsByTagName(docElt, "tower", towers);
51 unsigned nTower = towers.size();
52
53 m_towers.reserve(nTower);
54
55 std::string bString = Dom::getAttribute(docElt,"badType");
56 if (!bString.compare("hot")) m_badType = HOT;
57 else if (!bString.compare("dead")) m_badType = DEAD;
58 else m_badType = UNKNOWN_BADTYPE;
59
60
61 for (unsigned int iTower = 0; iTower < nTower; iTower++) {
62 Tower tower;
63 tower.m_uniplanes.clear();
64 try {
65 tower.m_row = Dom::getIntAttribute(towers[iTower], "row");
66 tower.m_col = Dom::getIntAttribute(towers[iTower], "col");
67 }
68 catch (xmlBase::DomException ex) {
69 std::cerr << "From calibUtil::StripSrv::StripSrv" << std::endl
70 << ex.getMsg() << std::endl;
71 throw ex;
72 }
73
74 tower.m_howBad = 0;
75 tower.m_allBad = 0;
76
77 std::string attValue = Dom::getAttribute(towers[iTower], "nOnbdCalib");
78 if (attValue.compare("true") == 0) {
79 tower.m_howBad |= vCALIBUTIL_nOnbdCalib;
80 }
81 attValue = Dom::getAttribute(towers[iTower], "nOnbdTrig");
82 if (attValue.compare("true") == 0) {
83 tower.m_howBad |= vCALIBUTIL_nOnbdTrig;
84 }
85 attValue = Dom::getAttribute(towers[iTower], "nOnbdData");
86 if (attValue.compare("true") == 0) {
87 tower.m_howBad |= vCALIBUTIL_nOnbdData;
88 }
89 if (tower.m_howBad) {
90 tower.m_allBad = 1;
91 goto NEXT;
92 } // otherwise have to process individual uniplane elements
93
94 {
95 DOMElement* uniElt = Dom::getFirstChildElement(towers[iTower]);
96
97 while (uniElt != 0) {
98 Uniplane uni;
99 uni.m_howBad = 0;
100 fillUni(uniElt, &uni);
101 // if bad status, complain and return
102
103 tower.m_uniplanes.push_back(uni);
104 uniElt = Dom::getSiblingElement(uniElt);
105 }
106 }
107 NEXT:
108 m_towers.push_back(tower);
109 // towerElt = Dom::getSiblingElement(towerElt);
110 }
111 }
DOMDocument * parse(const char *const filename, const std::string &docType=std::string(""))
Parse an xml file, returning document node if successful.
Definition: XmlParser.cxx:108

◆ StripSrv() [2/4]

calibUtil::StripSrv::StripSrv ( eBadType  badType,
const GenericSrv gen 
)

Constructor to be used when creating new calibrations.

Definition at line 24 of file StripSrv.cxx.

25 : m_badType(badType), m_state(BUILDING) {
26 m_genSrv = new GenericSrv(gen);
27 }

◆ ~StripSrv() [1/2]

calibUtil::StripSrv::~StripSrv ( )

destructor. Deallocates memory

destructor used to deallocate memory

Definition at line 114 of file StripSrv.cxx.

114 {
115 delete m_genSrv;
116 }

◆ StripSrv() [3/4]

calibUtil::StripSrv::StripSrv ( std::string  xmlFileName)

constructor. Initializes strip service by creating a DOM structure out of the XML file and filling in the internal data structures

◆ StripSrv() [4/4]

calibUtil::StripSrv::StripSrv ( eBadType  badType,
const GenericSrv gen 
)

Constructor to be used when creating new calibrations.

◆ ~StripSrv() [2/2]

calibUtil::StripSrv::~StripSrv ( )

destructor. Deallocates memory

Member Function Documentation

◆ getBadTowers() [1/2]

void calibUtil::StripSrv::getBadTowers ( std::vector< towerRC > &  towerIds) const

lists all towers with bad strips

Lists all towers with bad strips.

Definition at line 124 of file StripSrv.cxx.

125 {
126 std::vector<Tower>::const_iterator it = m_towers.begin();
127 while(it != m_towers.end() ) {
128
129 towerRC trc;
130 towerRCs.reserve(m_towers.size());
131 trc.row = it->m_row;
132 trc.col = it->m_col;
133 towerRCs.push_back(trc);
134 it++;
135 }
136 }
struct calibUtil::StripSrv::stowerRC towerRC
Clients should use as return values for readData.

◆ getBadTowers() [2/2]

void calibUtil::StripSrv::getBadTowers ( std::vector< towerRC > &  towerIds) const

lists all towers with bad strips

◆ getBadType() [1/2]

StripSrv::eBadType calibUtil::StripSrv::getBadType ( ) const

returns the status (Hot or Dead) of the strip

returns the status (Hot or Dead) of the strips

Definition at line 119 of file StripSrv.cxx.

119 {
120 return m_badType;
121 }

◆ getBadType() [2/2]

eBadType calibUtil::StripSrv::getBadType ( ) const

returns the status (Hot or Dead) of the strip

◆ getCalType() [1/2]

std::string calibUtil::StripSrv::getCalType ( ) const

Get calibration type.

Definition at line 151 of file StripSrv.cxx.

151 {
152 return m_genSrv->getCalType();
153 }

◆ getCalType() [2/2]

std::string calibUtil::StripSrv::getCalType ( ) const

Get calibration type.

◆ getFmtVer() [1/2]

std::string calibUtil::StripSrv::getFmtVer ( ) const

Get format Version.

Definition at line 156 of file StripSrv.cxx.

156 {
157 return m_genSrv->getFmtVer();
158 }

◆ getFmtVer() [2/2]

std::string calibUtil::StripSrv::getFmtVer ( ) const

Get format Version.

◆ getInst() [1/2]

std::string calibUtil::StripSrv::getInst ( ) const

methods giving access to generic data

Get instrument name

Definition at line 141 of file StripSrv.cxx.

141 {
142 return m_genSrv->getInst();
143 }

◆ getInst() [2/2]

std::string calibUtil::StripSrv::getInst ( ) const

methods giving access to generic data

Get instrument name

◆ getTimestamp() [1/2]

std::string calibUtil::StripSrv::getTimestamp ( ) const

Get timestamp.

Definition at line 146 of file StripSrv.cxx.

146 {
147 return m_genSrv->getTimestamp();
148 }

◆ getTimestamp() [2/2]

std::string calibUtil::StripSrv::getTimestamp ( ) const

Get timestamp.

◆ traverseInfo() [1/2]

eVisitorRet calibUtil::StripSrv::traverseInfo ( ClientObject client) const

call back method for client to access large data

Definition at line 162 of file StripSrv.cxx.

162 {
163
164 /* NOTE: could also check for empty badLists and only
165 call back client if nonempty.
166 */
167 std::vector<Tower>::const_iterator iTower = m_towers.begin();
168
169 eVisitorRet ret = DONE;
170 while (iTower != m_towers.end() ) {
171 if (iTower->m_allBad) {
172 ret = client->badTower(iTower->m_row, iTower->m_col, iTower->m_howBad);
173 if (ret != CONT) return ret;
174 }
175 // If tower not all bad, loop over planes within towers
176 else {
177 std::vector<Uniplane>::const_iterator iUni =
178 (iTower->m_uniplanes).begin();
179 while (iUni != (iTower->m_uniplanes).end() ) {
180 ret = client->badPlane(iTower->m_row, iTower->m_col,
181 iUni->m_tray, iUni->m_top,
182 iUni->m_howBad, iUni->m_allBad,
183 (iUni->m_strips));
184 if (ret != CONT) return ret;
185 iUni++;
186 }
187 }
188 ++iTower;
189 }
190 // If got to here, traversed the entire data structure without
191 // a murmur from client
192 return DONE;
193 }

◆ traverseInfo() [2/2]

eVisitorRet calibUtil::StripSrv::traverseInfo ( ClientObject client) const

call back method for client to access large data

◆ writeXml() [1/2]

eVisitorRet calibUtil::StripSrv::writeXml ( std::ostream *  out)

Definition at line 320 of file StripSrv.cxx.

320 {
321 return DONE;
322 }

◆ writeXml() [2/2]

eVisitorRet calibUtil::StripSrv::writeXml ( std::ostream *  out)

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