BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Calibration/calibUtil/include/calibUtil/StripSrv.h
Go to the documentation of this file.
1// $Header: /bes/bes/BossCvs/Calibration/calibUtil/calibUtil/StripSrv.h,v 1.1.1.1 2005/10/17
2// 06:12:26 maqm Exp $
3#ifndef CALIBUTIL_STRIPSRV_H
4#define CALIBUTIL_STRIPSRV_H
5
6#include <iostream>
7#include <string>
8#include <vector>
9#include <xercesc/dom/DOMElement.hpp>
10
11namespace calibUtil {
12
13 class GenericSrv;
14
15 /** Visitor callbacks can indicate whether traversal should continue
16 or not.
17 CONT normal return: continue processing
18 USER_DONE client has all information desired; no more traversal
19 ERROR client has serious error; abort
20 DONE not used by client. Will be returned by
21 BadStrips::traverse in case processing was normal.
22 */
24
25 typedef std::vector<unsigned short int> StripCol;
26
27 /** Visitor class interface definition, required for invoking
28 StripSrv::traverse
29 */
31 public:
32 /** Handle bad tower
33 @param row zero-based row of tower
34 @param col zero-based column of tower
35 @param badness bit mask including 3 least sig. bits
36 These bits are defined in ChannelStatusDef.h
37
38 */
39 virtual eVisitorRet badTower( unsigned int row, unsigned int col, int badness ) = 0;
40
41 /** Handle bad uniplane with some or all bad strips
42 @param row zero-based row of tower
43 @param col zero-based column of tower
44 @param badness bit mask including 3 least sig. bits:
45 These bits are defined in ChannelStatusDef.h (same as for tower)
46 @param allBad if true all strips are bad. @arg strips should
47 be ignored
48 @param strips vector of strips of badness @arg badness. If
49 empty, entire plane is bad.
50 */
51 virtual eVisitorRet badPlane( unsigned int row, unsigned int col, unsigned int tray,
52 bool top, int badness, bool allBad,
53 const StripCol& strips ) = 0;
54
55 }; // end pure virtual visitor class definition
56
57 class StripSrv {
58
59 public:
61 /// Clients should use as return values for readData
62
63 typedef struct stowerRC {
64 unsigned short int row;
65 unsigned short int col;
67 typedef std::vector<unsigned short int> StripCol;
68
69 /// constructor. Initializes strip service by creating a DOM structure
70 /// out of the XML file and filling in the internal data structures
71 StripSrv( std::string xmlFileName );
72
73 /// Constructor to be used when creating new calibrations
74 StripSrv( eBadType badType, const GenericSrv& gen );
75
76 /// destructor. Deallocates memory
77 ~StripSrv();
78
79 /// returns the status (Hot or Dead) of the strip
80 eBadType getBadType() const;
81
82 /// lists all towers with bad strips
83 void getBadTowers( std::vector<towerRC>& towerIds ) const;
84
85 /// methods giving access to generic data
86
87 /// Get instrument name
88 std::string getInst() const;
89
90 /// Get timestamp
91 std::string getTimestamp() const;
92
93 /// Get calibration type
94 std::string getCalType() const;
95
96 /// Get format Version
97 std::string getFmtVer() const;
98
99 /// call back method for client to access large data
100 // maqm fix
101 // eVisitorRet StripSrv::traverseInfo(ClientObject *client) const;
102 eVisitorRet traverseInfo( ClientObject* client ) const;
103
104 eVisitorRet writeXml( std::ostream* out );
105
106 private:
107 // A tower just has a collection of uniplanes,
108 // each identified by tray number, top or bottom, and badness
109 //
110
111 typedef struct sUniplane {
112 bool m_allBad; // if true, StripCol may be ignored
113 int m_howBad;
114 int m_tray;
115 bool m_top;
116 StripCol m_strips;
117 } Uniplane;
118
119 typedef struct sTower {
120 // towerRC id;
121 unsigned short m_row;
122 unsigned short m_col;
123 bool m_allBad; // if true, uniplanes may be ignored
124 int m_howBad;
125 std::vector<Uniplane> m_uniplanes;
126 } Tower;
127
128 std::vector<Tower> m_towers;
129 eBadType m_badType;
130
131 enum eState {
132 FROM_PERS, // read in from persistent form; read-only
133 BUILDING, // in process of building the list
134 WRITTEN
135 }; // built and written to persistent form (read-only)
136
137 eState m_state;
138
139 // object to store generic data
140 GenericSrv* m_genSrv;
141
142 /// this function takes in a stripList in string format and
143 /// fills a vector with corresponding strip numbers
144 void strToNum( std::string strips, std::vector<unsigned short int>& v );
145
146 /// Handles all the messy of details of extracting information
147 /// about a single unilayer from the XML representation
148 // void fillUni(const DOM_Element& uniElt, Unilayer* uni);
149 void fillUni( const XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* uniElt, Uniplane* uni );
150
151 void fillStrips( const XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* badElt, StripCol& list );
152
153 /// Internal utility, used when this object must be mutable (e.g. addBad)
154 Tower* findTower( towerRC& towerId );
155 /// const version of findTower, used by const public methods
156 const Tower* findTower( const towerRC& towerId ) const;
157 };
158
159} // end of namespace calibUtil
160
161#endif
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition KarLud.h:35
virtual eVisitorRet badTower(unsigned int row, unsigned int col, int badness)=0
virtual eVisitorRet badPlane(unsigned int row, unsigned int col, unsigned int tray, bool top, int badness, bool allBad, const StripCol &strips)=0
eVisitorRet writeXml(std::ostream *out)
Definition StripSrv.cxx:303
eBadType getBadType() const
returns the status (Hot or Dead) of the strip
Definition StripSrv.cxx:114
StripSrv(std::string xmlFileName)
Definition StripSrv.cxx:31
std::string getInst() const
methods giving access to generic data
Definition StripSrv.cxx:134
std::string getCalType() const
Get calibration type.
Definition StripSrv.cxx:140
eVisitorRet traverseInfo(ClientObject *client) const
call back method for client to access large data
Definition StripSrv.cxx:146
std::string getTimestamp() const
Get timestamp.
Definition StripSrv.cxx:137
~StripSrv()
destructor. Deallocates memory
Definition StripSrv.cxx:111
void getBadTowers(std::vector< towerRC > &towerIds) const
lists all towers with bad strips
Definition StripSrv.cxx:117
struct calibUtil::StripSrv::stowerRC towerRC
Clients should use as return values for readData.
std::string getFmtVer() const
Get format Version.
Definition StripSrv.cxx:143
Module implements methods for clients to get generic services.
std::vector< unsigned short int > StripCol
Clients should use as return values for readData.