ATLAS Offline Software
Loading...
Searching...
No Matches
sTGC_readoutHandler Class Reference

#include <sTGC_readoutHandler.h>

Inheritance diagram for sTGC_readoutHandler:
Collaboration diagram for sTGC_readoutHandler:

Public Member Functions

 sTGC_readoutHandler (const std::string &, AGDDController &c)
virtual void ElementHandle (AGDDController &c, xercesc::DOMNode *t) override
const std::string & GetName () const
virtual void Handle (AGDDController &c, xercesc::DOMNode *t)
void StopLoop (bool)
bool IsLoopToBeStopped () const

Protected Member Functions

bool isAttribute (const xercesc::DOMNode *t, const std::string &) const
std::string getAttribute (const xercesc::DOMNode *t, const std::string &, bool &) const
std::string getAttributeAsString (AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
std::string getAttributeAsString (AGDDController &c, const xercesc::DOMNode *t, const std::string &, bool &) const
std::string getAttributeAsString (AGDDController &c, const xercesc::DOMNode *t, const std::string &, const std::string &) const
double getAttributeAsDouble (AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
double getAttributeAsDouble (AGDDController &c, const xercesc::DOMNode *t, const std::string &, bool &) const
double getAttributeAsDouble (AGDDController &c, const xercesc::DOMNode *t, const std::string &, const double) const
int getAttributeAsInt (AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
int getAttributeAsInt (AGDDController &c, const xercesc::DOMNode *t, const std::string &, bool &) const
int getAttributeAsInt (AGDDController &c, const xercesc::DOMNode *t, const std::string &, const int) const
std::vector< double > getAttributeAsVector (AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
std::vector< double > getAttributeAsVector (AGDDController &c, const xercesc::DOMNode *t, const std::string &, bool &) const
std::vector< double > getAttributeAsVector (AGDDController &c, const xercesc::DOMNode *t, const std::string &, const std::vector< double > &) const
std::vector< int > getAttributeAsIntVector (AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
std::vector< int > getAttributeAsIntVector (AGDDController &c, const xercesc::DOMNode *t, const std::string &, bool &) const
std::vector< int > getAttributeAsIntVector (AGDDController &c, const xercesc::DOMNode *t, const std::string &, const std::vector< int > &) const

Protected Attributes

std::string m_name
bool m_stopLoop

Private Member Functions

void RegisterToStore (AGDDController &c)

Detailed Description

Definition at line 11 of file sTGC_readoutHandler.h.

Constructor & Destructor Documentation

◆ sTGC_readoutHandler()

sTGC_readoutHandler::sTGC_readoutHandler ( const std::string & s,
AGDDController & c )

Definition at line 14 of file sTGC_readoutHandler.cxx.

16 : XMLHandler(s, c)
17{
18}
XMLHandler(const std::string &n, AGDDController &c)

Member Function Documentation

◆ ElementHandle()

void sTGC_readoutHandler::ElementHandle ( AGDDController & c,
xercesc::DOMNode * t )
overridevirtual

Implements XMLHandler.

Definition at line 20 of file sTGC_readoutHandler.cxx.

22{
23 sTGCHandler* sTGCHand = dynamic_cast<sTGCHandler*>
24 (c.GetHandlerStore().GetHandler("sTGC"));
25 if (!sTGCHand) std::abort();
26
27 sTGCDetectorDescription* sTGC = sTGCHand->GetsTGCCurrent();
28 // std::cout<<" this is sTGC_readoutHandler::Handle"<<sTGC->GetName()<<std::endl;
29
30 bool ret=true;
31 sTGC->roParameters.sPadWidth = getAttributeAsDouble (c, t, "sPadWidth", ret);
32 if (! ret) std::cout << "WARNING: sPadWidth is missing" << std::endl;
33
34 sTGC->roParameters.lPadWidth = getAttributeAsDouble (c, t, "lPadWidth", ret);
35 if (! ret) std::cout << "WARNING: lPadWidth is missing" << std::endl;
36
37 sTGC->roParameters.sStripWidth = getAttributeAsDouble (c, t, "sStripWidth", ret);
38 if (! ret) std::cout << "WARNING: sStripWidth is missing" << std::endl;
39
40 sTGC->roParameters.lStripWidth = getAttributeAsDouble (c, t, "lStripWidth", ret);
41 if (! ret) std::cout << "WARNING: lStripWidth is missing" << std::endl;
42
43 sTGC->roParameters.padH = getAttributeAsVector (c, t, "padH", ret);
44 if (! ret) std::cout << "WARNING: padH is missing" << std::endl;
45
46 sTGC->roParameters.nPadPhi = getAttributeAsIntVector (c, t, "nPadPhi", ret);
47 if (! ret) { // Check for backwards compatibility
48 std::cout << "INFO: nPadPhi is missing trying older format nPadX" << std::endl;
49 sTGC->roParameters.nPadPhi = getAttributeAsIntVector (c, t, "nPadX", ret);
50 if (! ret) std::cout << "WARNING: nPadX is missing" << std::endl;
51 }
52
53 sTGC->roParameters.anglePadPhi = getAttributeAsDouble (c, t, "anglePadPhi", ret);
54 if (! ret){
55 std::cout << "INFO: anglePadPhi is missing trying older format anglePadX" << std::endl;
56 sTGC->roParameters.anglePadPhi = getAttributeAsDouble (c, t, "anglePadX", ret);
57 if (! ret) std::cout << "WARNING: anglePadX is missing" << std::endl;
58 }
59
60 sTGC->roParameters.firstPadPhiDivision_A = getAttributeAsVector (c, t, "firstPadPhiDivision_A", ret);
61 sTGC->roParameters.firstPadPhiDivision_C = getAttributeAsVector (c, t, "firstPadPhiDivision_C", ret);
62 if (! ret){
63 std::cout << "INFO: firstPadPhiDivision_C/A is missing trying older format firstPadPhi" << std::endl;
64 sTGC->roParameters.firstPadPhiDivision_A = getAttributeAsVector (c, t, "firstPadPhi", ret);
65 sTGC->roParameters.firstPadPhiDivision_C = getAttributeAsVector (c, t, "firstPadPhi", ret);
66 if (! ret) std::cout << "WARNING: firstPadPhi is missing" << std::endl;
67 }
68
69
70
71 sTGC->roParameters.PadPhiShift_A = getAttributeAsVector (c, t, "PadPhiShift_A", ret);
72 sTGC->roParameters.PadPhiShift_C = getAttributeAsVector (c, t, "PadPhiShift_C", ret);
73 if (! ret){
74 std::cout << "INFO: PadPhiShift_C/A is missing trying older format firstPadPhi" << std::endl;
75 sTGC->roParameters.PadPhiShift_A = getAttributeAsVector (c, t, "firstPadPhi", ret);
76 sTGC->roParameters.PadPhiShift_C = getAttributeAsVector (c, t, "firstPadPhi", ret);
77 if (! ret) std::cout << "WARNING: firstPadPhi is missing" << std::endl;
78 }
79
80 sTGC->roParameters.nPadH = getAttributeAsVector (c, t, "nPadH", ret);
81 if (! ret) std::cout << "WARNING: nPadH is missing" << std::endl;
82
83 sTGC->roParameters.firstPadH = getAttributeAsVector (c, t, "firstPadH", ret);
84 if (! ret) std::cout << "WARNING: firstPadH is missing" << std::endl;
85
86 sTGC->roParameters.firstPadRow = getAttributeAsIntVector (c, t, "firstPadRow", ret);
87 if (! ret) std::cout << "WARNING: firstPadRow is missing" << std::endl;
88
89 sTGC->roParameters.nWires = getAttributeAsIntVector (c, t, "nWires", ret);
90 if (! ret) std::cout << "WARNING: nWires is missing" << std::endl;
91
92 sTGC->roParameters.wireCutout = getAttributeAsVector (c, t, "wireCutout", ret);
93 if (! ret) std::cout << "WARNING: wireCutout is missing" << std::endl;
94
95 sTGC->roParameters.firstWire = getAttributeAsVector (c, t, "firstWire", ret);
96 if (! ret) std::cout << "WARNING: firstWire is missing" << std::endl;
97
98 sTGC->roParameters.wireGroupWidth = getAttributeAsDouble (c, t, "wireGroupWidth", ret);
99 if (! ret) std::cout << "WARNING: wireGroupWidth is missing" << std::endl;
100
101 sTGC->roParameters.nStrips = getAttributeAsInt (c, t, "nStrips", ret);
102 if (! ret) std::cout << "WARNING: nStrips is missing" << std::endl;
103
104 sTGC->roParameters.firstTriggerBand = getAttributeAsIntVector (c, t, "firstTriggerBand", ret);
105 if (! ret) std::cout << "WARNING: firstTriggerBand is missing" << std::endl;
106
107 sTGC->roParameters.nTriggerBands = getAttributeAsIntVector (c, t, "nTriggerBands", ret);
108 if (! ret) std::cout << "WARNING: nTriggerBands is missing" << std::endl;
109
110 sTGC->roParameters.firstStripInTrigger = getAttributeAsIntVector (c, t, "firstStripInTrigger", ret);
111 if (! ret) std::cout << "WARNING: firstStripInTrigger is missing" << std::endl;
112
113 sTGC->roParameters.firstStripWidth = getAttributeAsVector (c, t, "firstStripWidth", ret);
114 if (! ret) std::cout << "WARNING: firstStripWidth is missing" << std::endl;
115
116 sTGC->roParameters.StripsInBandsLayer1 = getAttributeAsIntVector (c, t, "StripsInBandsLayer1", ret);
117 if (! ret) std::cout << "WARNING: StripsInBandsLayer1 is missing" << std::endl;
118
119 sTGC->roParameters.StripsInBandsLayer2 = getAttributeAsIntVector (c, t, "StripsInBandsLayer2", ret);
120 if (! ret) std::cout << "WARNING: StripsInBandsLayer2 is missing" << std::endl;
121
122 sTGC->roParameters.StripsInBandsLayer3 = getAttributeAsIntVector (c, t, "StripsInBandsLayer3", ret);
123 if (! ret) std::cout << "WARNING: StripsInBandsLayer3 is missing" << std::endl;
124
125 sTGC->roParameters.StripsInBandsLayer4 = getAttributeAsIntVector (c, t, "StripsInBandsLayer4", ret);
126 if (! ret) std::cout << "WARNING: StripsInBandsLayer4 is missing" << std::endl;
127
128 sTGC->roParameters.nWireGroups = getAttributeAsIntVector (c, t, "nWireGroups", ret);
129 if (! ret) std::cout << "WARNING: nWireGroups is missing" << std::endl;
130
131 sTGC->roParameters.firstWireGroup = getAttributeAsIntVector (c, t, "firstWireGroup", ret);
132 if (! ret) std::cout << "WARNING: firstWireGroup is missing" << std::endl;
133}
int getAttributeAsInt(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
std::vector< double > getAttributeAsVector(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
std::vector< int > getAttributeAsIntVector(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
double getAttributeAsDouble(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
sTGCReadoutParameters roParameters
sTGCDetectorDescription * GetsTGCCurrent()
std::vector< int > firstWireGroup
std::vector< int > StripsInBandsLayer1
std::vector< double > firstPadPhiDivision_A
std::vector< int > firstStripInTrigger
std::vector< double > firstPadPhiDivision_C
std::vector< double > firstStripWidth
std::vector< int > StripsInBandsLayer4
std::vector< double > firstPadH
std::vector< int > StripsInBandsLayer3
std::vector< double > firstWire
std::vector< double > PadPhiShift_C
std::vector< int > StripsInBandsLayer2
std::vector< double > padH
std::vector< double > wireCutout
std::vector< int > firstTriggerBand
std::vector< double > PadPhiShift_A
std::vector< double > nPadH
std::vector< int > nTriggerBands

◆ getAttribute()

std::string XMLHandler::getAttribute ( const xercesc::DOMNode * t,
const std::string & name,
bool & isPresent ) const
protectedinherited

Definition at line 43 of file XMLHandler.cxx.

45{
46 std::string retValue="";
47 isPresent=false;
48 if (t->hasAttributes()) {
49 DOMNamedNodeMap *pAttributes = t->getAttributes();
50 auto deleter = [&](XMLCh buf[]) { XMLString::release(&buf); };
51 std::unique_ptr<XMLCh[], decltype(deleter)> ptr(XMLString::transcode(name.c_str()), deleter);
52 DOMAttr *pAttributeNode = (DOMAttr*) pAttributes->getNamedItem(ptr.get());
53 if (pAttributeNode) {
54
55 char* val=XMLString::transcode(pAttributeNode->getValue());
56 if (val) {
57
58 isPresent=true;
59 retValue=val;
60 XMLString::release(&val);
61 return retValue;
62 }
63 }
64 else return retValue;
65
66 }
67 return retValue;
68}
std::map< std::string, std::string > DOMNamedNodeMap
Definition DOMNode.h:16
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ getAttributeAsDouble() [1/3]

double XMLHandler::getAttributeAsDouble ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name ) const
protectedinherited

Definition at line 78 of file XMLHandler.cxx.

81{
82 double res=0.;
83 bool isPresent;
84 std::string temp=getAttribute(t, name,isPresent);
85 if (!isPresent) std::abort();
86 res=c.Evaluator().Eval(temp.c_str());
87 return res;
88}
std::pair< std::vector< unsigned int >, bool > res
std::string getAttribute(const xercesc::DOMNode *t, const std::string &, bool &) const

◆ getAttributeAsDouble() [2/3]

double XMLHandler::getAttributeAsDouble ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name,
bool & isPresent ) const
protectedinherited

Definition at line 139 of file XMLHandler.cxx.

142{
143 double res=0.;
144 std::string temp=getAttribute(t, name,isPresent);
145 if (isPresent)
146 {
147 res=c.Evaluator().Eval(temp.c_str());
148 }
149 return res;
150}

◆ getAttributeAsDouble() [3/3]

double XMLHandler::getAttributeAsDouble ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name,
const double def ) const
protectedinherited

Definition at line 206 of file XMLHandler.cxx.

209{
210 bool isPresent;
211 double res=0.;
212 std::string temp=getAttribute(t, name,isPresent);
213 if (isPresent)
214 {
215 res=c.Evaluator().Eval(temp.c_str());
216 return res;
217 }
218 return def;
219}

◆ getAttributeAsInt() [1/3]

int XMLHandler::getAttributeAsInt ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name ) const
protectedinherited

Definition at line 89 of file XMLHandler.cxx.

92{
93 int res=0;
94 bool isPresent;
95 std::string temp=getAttribute(t, name,isPresent);
96 if (!isPresent) std::abort();
97 res=c.Evaluator().Eval(temp.c_str());
98 return res;
99}

◆ getAttributeAsInt() [2/3]

int XMLHandler::getAttributeAsInt ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name,
bool & isPresent ) const
protectedinherited

Definition at line 151 of file XMLHandler.cxx.

154{
155 int res=0;
156 std::string temp=getAttribute(t, name,isPresent);
157 if (isPresent)
158 {
159 res=c.Evaluator().Eval(temp.c_str());
160 }
161 return res;
162}

◆ getAttributeAsInt() [3/3]

int XMLHandler::getAttributeAsInt ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name,
const int def ) const
protectedinherited

Definition at line 220 of file XMLHandler.cxx.

223{
224 bool isPresent;
225 int res=0;
226 std::string temp=getAttribute(t, name,isPresent);
227 if (isPresent)
228 {
229 res=c.Evaluator().Eval(temp.c_str());
230 return res;
231 }
232 return def;
233}

◆ getAttributeAsIntVector() [1/3]

std::vector< int > XMLHandler::getAttributeAsIntVector ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name ) const
protectedinherited

Definition at line 116 of file XMLHandler.cxx.

119{
120 bool isPresent;
121 std::vector<int> vect;
122 std::string temp=getAttribute(t, name,isPresent);
123 if (!isPresent) std::abort();
124 std::vector<std::string> v=c.Evaluator().tokenize(";",temp);
125 for (unsigned int i=0;i<v.size();i++)
126 {
127 vect.push_back(c.Evaluator().Eval(v[i].c_str()));
128 }
129 return vect;
130}

◆ getAttributeAsIntVector() [2/3]

std::vector< int > XMLHandler::getAttributeAsIntVector ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name,
bool & isPresent ) const
protectedinherited

Definition at line 180 of file XMLHandler.cxx.

183{
184 std::vector<int> vect;
185 std::string temp=getAttribute(t, name,isPresent);
186 if (isPresent)
187 {
188 std::vector<std::string> v=c.Evaluator().tokenize(";",temp);
189 for (unsigned int i=0;i<v.size();i++)
190 {
191 vect.push_back(c.Evaluator().Eval(v[i].c_str()));
192 }
193 }
194 return vect;
195}

◆ getAttributeAsIntVector() [3/3]

std::vector< int > XMLHandler::getAttributeAsIntVector ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name,
const std::vector< int > & def ) const
protectedinherited

Definition at line 253 of file XMLHandler.cxx.

256{
257 bool isPresent;
258 std::vector<int> vect;
259 std::string temp=getAttribute(t, name,isPresent);
260 if (isPresent)
261 {
262 std::vector<std::string> v=c.Evaluator().tokenize(";",temp);
263 for (unsigned int i=0;i<v.size();i++)
264 {
265 vect.push_back(c.Evaluator().Eval(v[i].c_str()));
266 }
267 return vect;
268 }
269 return def;
270}

◆ getAttributeAsString() [1/3]

std::string XMLHandler::getAttributeAsString ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name ) const
protectedinherited

Definition at line 69 of file XMLHandler.cxx.

72{
73 bool isPresent;
74 std::string temp=getAttribute(t, name,isPresent);
75 if (!isPresent) std::abort();
76 return temp;
77}

◆ getAttributeAsString() [2/3]

std::string XMLHandler::getAttributeAsString ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name,
bool & isPresent ) const
protectedinherited

Definition at line 132 of file XMLHandler.cxx.

135{
136 std::string temp=getAttribute(t, name,isPresent);
137 return temp;
138}

◆ getAttributeAsString() [3/3]

std::string XMLHandler::getAttributeAsString ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name,
const std::string & def ) const
protectedinherited

Definition at line 197 of file XMLHandler.cxx.

200{
201 bool isPresent;
202 std::string temp=getAttribute(t, name,isPresent);
203 if (isPresent) return temp;
204 else return def;
205}

◆ getAttributeAsVector() [1/3]

std::vector< double > XMLHandler::getAttributeAsVector ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name ) const
protectedinherited

Definition at line 100 of file XMLHandler.cxx.

103{
104 bool isPresent;
105 std::vector<double> vect;
106 std::string temp=getAttribute(t, name,isPresent);
107 if (!isPresent) std::abort();
108 std::vector<std::string> v=c.Evaluator().tokenize(";",temp);
109 for (unsigned int i=0;i<v.size();i++)
110 {
111 vect.push_back(c.Evaluator().Eval(v[i].c_str()));
112 }
113 return vect;
114}

◆ getAttributeAsVector() [2/3]

std::vector< double > XMLHandler::getAttributeAsVector ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name,
bool & isPresent ) const
protectedinherited

Definition at line 163 of file XMLHandler.cxx.

166{
167 std::vector<double> vect;
168 std::string temp=getAttribute(t, name,isPresent);
169 if (isPresent)
170 {
171 std::vector<std::string> v=c.Evaluator().tokenize(";",temp);
172 for (unsigned int i=0;i<v.size();i++)
173 {
174 vect.push_back(c.Evaluator().Eval(v[i].c_str()));
175 }
176 }
177 return vect;
178}

◆ getAttributeAsVector() [3/3]

std::vector< double > XMLHandler::getAttributeAsVector ( AGDDController & c,
const xercesc::DOMNode * t,
const std::string & name,
const std::vector< double > & def ) const
protectedinherited

Definition at line 234 of file XMLHandler.cxx.

237{
238 bool isPresent;
239 std::vector<double> vect;
240 std::string temp=getAttribute(t, name,isPresent);
241 if (isPresent)
242 {
243 std::vector<std::string> v=c.Evaluator().tokenize(";",temp);
244 for (unsigned int i=0;i<v.size();i++)
245 {
246 vect.push_back(c.Evaluator().Eval(v[i].c_str()));
247 }
248 return vect;
249 }
250 return def;
251}

◆ GetName()

const std::string & XMLHandler::GetName ( ) const
inlineinherited

Definition at line 19 of file XMLHandler.h.

19{return m_name;}
std::string m_name
Definition XMLHandler.h:30

◆ Handle()

virtual void XMLHandler::Handle ( AGDDController & c,
xercesc::DOMNode * t )
inlinevirtualinherited

Definition at line 22 of file XMLHandler.h.

24 {
25 ElementHandle(c, t);
26 }
virtual void ElementHandle(AGDDController &c, xercesc::DOMNode *t)=0

◆ isAttribute()

bool XMLHandler::isAttribute ( const xercesc::DOMNode * t,
const std::string & name ) const
protectedinherited

Definition at line 36 of file XMLHandler.cxx.

38{
39 bool res;
40 std::string temp=getAttribute(t, name,res);
41 return res;
42}

◆ IsLoopToBeStopped()

bool XMLHandler::IsLoopToBeStopped ( ) const
inherited

Definition at line 32 of file XMLHandler.cxx.

33{
34 return m_stopLoop;
35}
bool m_stopLoop
Definition XMLHandler.h:31

◆ RegisterToStore()

void XMLHandler::RegisterToStore ( AGDDController & c)
privateinherited

Definition at line 23 of file XMLHandler.cxx.

24{
25 c.GetHandlerStore().RegisterHandler(this);
26}

◆ StopLoop()

void XMLHandler::StopLoop ( bool v)
inherited

Definition at line 28 of file XMLHandler.cxx.

29{
31}

Member Data Documentation

◆ m_name

std::string XMLHandler::m_name
protectedinherited

Definition at line 30 of file XMLHandler.h.

◆ m_stopLoop

bool XMLHandler::m_stopLoop
protectedinherited

Definition at line 31 of file XMLHandler.h.


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