ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
IdDictParserNS::RegionFactory Class Reference
Inheritance diagram for IdDictParserNS::RegionFactory:
Collaboration diagram for IdDictParserNS::RegionFactory:

Public Member Functions

void idd_start (IdDictParser &parser, const XMLCoreNode &node)
 
void idd_end (IdDictParser &parser, const XMLCoreNode &node)
 
void do_start (XMLCoreParser &parser, const XMLCoreNode &node)
 
void do_end (XMLCoreParser &parser, const XMLCoreNode &node)
 
void start (XMLCoreParser &parser, const XMLCoreNode &node)
 
void end (XMLCoreParser &parser, const XMLCoreNode &node)
 
void comment (XMLCoreParser &parser, const std::string &comment)
 
virtual void do_comment (XMLCoreParser &parser, const std::string &comment)
 
std::string get_name (const XMLCoreNode &node)
 
int sibling_number (const XMLCoreNode &node)
 

Static Public Member Functions

static std::string get_name (const XMLCoreNode &node, int index)
 
static int attribute_number (const XMLCoreNode &node)
 
static bool has_attribute (const XMLCoreNode &node, const std::string &name)
 
static int get_int (const XMLCoreNode &node, const std::string &name)
 
static double get_double (const XMLCoreNode &node, const std::string &name)
 
static bool get_boolean (const XMLCoreNode &node, const std::string &name)
 
static std::string get_ID (const XMLCoreNode &node, const std::string &name)
 
static std::string get_value (const XMLCoreNode &node, const std::string &name)
 
static std::string get_token (const XMLCoreNode &node, const std::string &name)
 
static bool check_int (const int n, const XMLCoreNode &node, const std::string &name)
 
static bool check_double (const int n, const XMLCoreNode &node, const std::string &name)
 

Protected Attributes

std::string m_xmlelementname
 

Detailed Description

Definition at line 70 of file IdDictParser.cxx.

Member Function Documentation

◆ attribute_number()

int XMLCoreFactory::attribute_number ( const XMLCoreNode node)
staticinherited

Definition at line 111 of file XMLCoreParser.cxx.

111  {
112  const CoreParser::DOMNamedNodeMap& attrs = node.get_node ().get_attributes();
113  return (attrs.size ());
114 }

◆ check_double()

bool XMLCoreFactory::check_double ( const int  n,
const XMLCoreNode node,
const std::string &  name 
)
staticinherited

Definition at line 243 of file XMLCoreParser.cxx.

243  {
244  std::string checkstring = get_value (node, name);
245  int counter = 0;
246  //
247  // concatenate two times same string to
248  // check the last number of the string
249  // explicitly!
250  //
251  std::string t = checkstring + " " + checkstring;
252  std::istringstream tmpstr (t.c_str());
253  while (tmpstr.good ()) {
254  double ii{};
255  counter++;
256  tmpstr >> ii;
257  }
258  if (counter/2 != n) {
259  std::cerr << "XMLCoreFactory::check_double error: (" << counter << ") no " << n
260  << " doubles in \"" << checkstring << "\" for attribute " <<
261  name << ". exit." << std::endl;
262  std::string name1 = get_value (node, "name");
263  std::string volume = get_value (node, "volume");
264  if (name1 != "" ) std::cerr << "for name=" << name << std::endl;
265  if (volume != "" ) std::cerr << "for volume=" << volume << std::endl;
266  std::abort();
267  }
268  return true;
269 }

◆ check_int()

bool XMLCoreFactory::check_int ( const int  n,
const XMLCoreNode node,
const std::string &  name 
)
staticinherited

Definition at line 211 of file XMLCoreParser.cxx.

211  {
212  std::string checkstring = get_value (node, name);
213  int counter = 0;
214  //
215  // concatenate two times same string to
216  // check the last number of the string
217  // explicitly!
218  //
219  std::string t = checkstring + " " + checkstring;
220  std::istringstream tmpstr (t.c_str());
221  while (tmpstr.good ()) {
222  int ii;
223  counter++;
224  tmpstr >> ii;
225  }
226  if (counter/2 != n) {
227  std::cerr << "XMLCoreFactory::check_int error: no " << n
228  << " ints in \"" << checkstring << "\" for attribute " <<
229  name << ". exit." << std::endl;
230 
231  std::string nodename = get_value (node, "name");
232  std::string volume = get_value (node, "volume");
233 
234  if (nodename != "" ) std::cerr << "for name=" << nodename << std::endl;
235  if (volume != "" ) std::cerr << "for volume=" << volume << std::endl;
236 
237  std::abort();
238  }
239  return true;
240 }

◆ comment()

void XMLCoreFactory::comment ( XMLCoreParser parser,
const std::string &  comment 
)
inherited

Definition at line 82 of file XMLCoreParser.cxx.

82  {
84  std::cout << "XMLCoreFactory::comment>" << std::endl;
85  }
87 }

◆ do_comment()

void XMLCoreFactory::do_comment ( XMLCoreParser parser,
const std::string &  comment 
)
virtualinherited

Definition at line 104 of file XMLCoreParser.cxx.

104  {
106  std::cout << "XMLCoreFactory::do_comment>" << std::endl;
107  }
108 }

◆ do_end()

void IdDictBaseFactory::do_end ( XMLCoreParser parser,
const XMLCoreNode node 
)
virtualinherited

Reimplemented from XMLCoreFactory.

Definition at line 152 of file IdDictParser.cxx.

152  {
154  parser.down ();
155 }

◆ do_start()

void IdDictBaseFactory::do_start ( XMLCoreParser parser,
const XMLCoreNode node 
)
virtualinherited

Reimplemented from XMLCoreFactory.

Definition at line 145 of file IdDictParser.cxx.

146  {
147  parser.up ();
149 }

◆ end()

void XMLCoreFactory::end ( XMLCoreParser parser,
const XMLCoreNode node 
)
inherited

Definition at line 74 of file XMLCoreParser.cxx.

74  {
76  std::cout << "XMLCoreFactory::end>" << std::endl;
77  }
78  do_end (parser, node);
79 }

◆ get_boolean()

bool XMLCoreFactory::get_boolean ( const XMLCoreNode node,
const std::string &  name 
)
staticinherited

Definition at line 141 of file XMLCoreParser.cxx.

141  {
142  bool result = false;
143  std::string s = get_token (node, name);
144  if (s == "TRUE") result = true;
145  return (result);
146 }

◆ get_double()

double XMLCoreFactory::get_double ( const XMLCoreNode node,
const std::string &  name 
)
staticinherited

Definition at line 133 of file XMLCoreParser.cxx.

133  {
134  double result = 0;
135  std::string s = get_value (node, name);
136  sscanf (s.c_str (), "%80lg", &result);
137  return (result);
138 }

◆ get_ID()

std::string XMLCoreFactory::get_ID ( const XMLCoreNode node,
const std::string &  name 
)
staticinherited

Definition at line 148 of file XMLCoreParser.cxx.

148  {
149  std::string result = get_value (node, name);
150  return (result);
151 }

◆ get_int()

int XMLCoreFactory::get_int ( const XMLCoreNode node,
const std::string &  name 
)
staticinherited

Definition at line 125 of file XMLCoreParser.cxx.

125  {
126  int result = 0;
127  std::string s = get_value (node, name);
128  sscanf (s.c_str (), "%80d", &result);
129  return (result);
130 }

◆ get_name() [1/2]

std::string XMLCoreFactory::get_name ( const XMLCoreNode node)
inherited

Definition at line 169 of file XMLCoreParser.cxx.

169  {
170  return node.get_node().get_name ();
171 }

◆ get_name() [2/2]

std::string XMLCoreFactory::get_name ( const XMLCoreNode node,
int  index 
)
staticinherited

Definition at line 179 of file XMLCoreParser.cxx.

179  {
180  const CoreParser::DOMNamedNodeMap& attrs = node.get_node ().get_attributes();
181  CoreParser::DOMNamedNodeMap::const_iterator it;
182  for (it = attrs.begin (); (index > 0) && (it != attrs.end ()); ++it){
183  --index;
184  }
185  if (it == attrs.end ()) return ("");
186  return it->first;
187 }

◆ get_token()

std::string XMLCoreFactory::get_token ( const XMLCoreNode node,
const std::string &  name 
)
staticinherited

Definition at line 190 of file XMLCoreParser.cxx.

190  {
191  std::string result = get_value (node, name);
192  // trim the value
193  while ((result.length () > 0) &&
194  (result.at(0) == ' ')) result.erase (0, 1);
195 
196  while ((result.length () > 0) &&
197  (result.at(result.length () - 1) == ' ')) result.erase (result.length () - 1, 1);
198  // Convert to upper case
199  for (std::string::size_type i = 0; i < result.length (); ++i){
200  static const std::string uc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
201  static const std::string lc = "abcdefghijklmnopqrstuvwxyz";
202  char c = result[i];
203  std::string::size_type p = lc.find (c);
204  if (p != std::string::npos) result[i] = lc[p];
205  }
206  return (result);
207 }

◆ get_value()

std::string XMLCoreFactory::get_value ( const XMLCoreNode node,
const std::string &  name 
)
staticinherited

Definition at line 154 of file XMLCoreParser.cxx.

154  {
156  std::cout << "XMLCoreFactory::get_value> name=" << name << std::endl;
157  }
158  const CoreParser::DOMNamedNodeMap& attrs = node.get_node ().get_attributes();
159  CoreParser::DOMNamedNodeMap::const_iterator it = attrs.find (name);
160  if (it == attrs.end ()) return ("");
161  std::string result = (*it).second;
163  std::cout << "XMLCoreFactory::get_value>2 value=" << result << std::endl;
164  }
165  return (result);
166 }

◆ has_attribute()

bool XMLCoreFactory::has_attribute ( const XMLCoreNode node,
const std::string &  name 
)
staticinherited

Definition at line 117 of file XMLCoreParser.cxx.

117  {
118  const CoreParser::DOMNamedNodeMap& attrs = node.get_node ().get_attributes();
119  CoreParser::DOMNamedNodeMap::const_iterator it = attrs.find (name);
120  if (it == attrs.end ()) return (false);
121  return (true);
122 }

◆ idd_end()

void RegionFactory::idd_end ( IdDictParser parser,
const XMLCoreNode node 
)
virtual

Reimplemented from IdDictParserNS::IdDictBaseFactory.

Definition at line 468 of file IdDictParser.cxx.

468  {
469  if (Debugger::debug ()){
470  Debugger::tab (parser.level());
471  std::cout << "RegionFactory::idd_end>" << std::endl;
472  }
473  if (parser.m_region != 0){
474  if (parser.m_altregions != 0) {
475  parser.m_altregions->m_regions[parser.m_region->m_tag] = parser.m_region;
476  if (parser.m_dictionary != 0) parser.m_dictionary->m_all_regions.push_back (parser.m_region);
477  // Check whether region is empty, i.e. no region entries have
478  // been found and added
479  if (parser.m_region->m_entries.size() == 0) {
480  parser.m_region->m_is_empty = true;
481  }
482  } else if (parser.m_dictionary != 0) {
483  parser.m_dictionary->add_dictentry (parser.m_region);
484  parser.m_dictionary->m_all_regions.push_back (parser.m_region);
485  // Check whether region is empty, i.e. no region entries have
486  // been found and added
487  if (parser.m_region->m_entries.size() == 0) {
488  parser.m_region->m_is_empty = true;
489  }
490  } else {
491  delete parser.m_region;
492  }
493  parser.m_region = 0;
494  }
495 }

◆ idd_start()

void RegionFactory::idd_start ( IdDictParser parser,
const XMLCoreNode node 
)
virtual

Reimplemented from IdDictParserNS::IdDictBaseFactory.

Definition at line 310 of file IdDictParser.cxx.

310  {
311  if (Debugger::debug ()) {
312  Debugger::tab (parser.level());
313  std::cout << "RegionFactory::idd_start>" << std::endl;
314  }
315 
316  parser.m_region = new IdDictRegion;
317  if (has_attribute (node, "name")){
318  parser.m_region->m_name = get_value (node, "name");
319  }
320 
321  // check for tag
322  if (has_attribute (node, "tag")){
323  parser.m_region->m_tag = get_value (node, "tag");
324  }
325 
326  // check for group name
327  if (has_attribute (node, "group")){
328  parser.m_region->m_group = get_value (node, "group");
329  }
330 
331  // check for next region in absolute eta
332  if (has_attribute (node, "next_abs_eta")) {
333  parser.m_region->m_next_abs_eta_name = get_value (node, "next_abs_eta");
334  }
335 
336  // Look for regions in the previous sampling
337  if (has_attribute (node, "prev_samp")) {
338  std::string names = get_value (node, "prev_samp");
339  std::string::size_type pos = 0;
340  for (;;) {
341  std::string::size_type next;
342  next = names.find_first_not_of (" ", pos);
343  if (next == std::string::npos) break;
344  pos = next;
345  next = names.find_first_of (" ", pos);
346  std::string name;
347  name = names.substr (pos, next - pos);
348  parser.m_region->m_prev_samp_names.push_back (name);
349  if (next == std::string::npos) {
350  break;
351  } else {
352  pos = next;
353  }
354  }
355  }
356  // Look for regions in the next sampling
357  if (has_attribute (node, "next_samp")) {
358  std::string names = get_value (node, "next_samp");
359  std::string::size_type pos = 0;
360  for (;;) {
361  std::string::size_type next;
362 
363  next = names.find_first_not_of (" ", pos);
364  if (next == std::string::npos) break;
365  pos = next;
366  next = names.find_first_of (" ", pos);
367 
368  std::string name;
369  name = names.substr (pos, next - pos);
370  parser.m_region->m_next_samp_names.push_back (name);
371 
372  if (next == std::string::npos) {
373  break;
374  } else {
375  pos = next;
376  }
377  }
378  }
379  // Look for regions in the prev subdet
380  if (has_attribute (node, "prev_subdet")) {
381  std::string names = get_value (node, "prev_subdet");
382  std::string::size_type pos = 0;
383  for (;;) {
384  std::string::size_type prev;
385  prev = names.find_first_not_of (" ", pos);
386  if (prev == std::string::npos) break;
387  pos = prev;
388  prev = names.find_first_of (" ", pos);
389  std::string name;
390  name = names.substr (pos, prev - pos);
391  parser.m_region->m_prev_subdet_names.push_back (name);
392  if (prev == std::string::npos) {
393  break;
394  } else {
395  pos = prev;
396  }
397  }
398  }
399  // Look for regions in the next subdet
400  if (has_attribute (node, "next_subdet")) {
401  std::string names = get_value (node, "next_subdet");
402  std::string::size_type pos = 0;
403  for (;;) {
404  std::string::size_type next;
405  next = names.find_first_not_of (" ", pos);
406  if (next == std::string::npos) break;
407  pos = next;
408  next = names.find_first_of (" ", pos);
409  std::string name;
410  name = names.substr (pos, next - pos);
411  parser.m_region->m_next_subdet_names.push_back (name);
412  if (next == std::string::npos) {
413  break;
414  } else {
415  pos = next;
416  }
417  }
418  }
419 
420  // check for eta 0
421  if (has_attribute (node, "eta0")){
422  parser.m_region->m_eta0 = get_double (node, "eta0");
423  }
424 
425  // check for deta
426  if (has_attribute (node, "deta")){
427  parser.m_region->m_deta = get_double (node, "deta");
428  }
429 
430  // check for phi 0
431  if (has_attribute (node, "phi0")){
432  parser.m_region->m_phi0 = get_double (node, "phi0");
433  }
434 
435  // check for dphi
436  if (has_attribute (node, "dphi")) {
437  parser.m_region->m_dphi = get_double (node, "dphi");
438  }
439 
440  if (Debugger::debug ()) {
441  Debugger::tab (parser.level());
442  std::cout << "RegionFactory::idd_start> name, group, tag, next eta, prev/next samp, prev/next subdet "
443  << parser.m_region->m_name << " "
444  << parser.m_region->m_group << " "
445  << parser.m_region->m_tag << " "
446  << parser.m_region->m_next_abs_eta << " ";
447  for (unsigned int i = 0; i < parser.m_region->m_prev_samp_names.size(); ++i) {
448  std::cout << parser.m_region->m_prev_samp_names[i] << " ";
449  }
450  for (unsigned int i = 0; i < parser.m_region->m_next_samp_names.size(); ++i) {
451  std::cout << parser.m_region->m_next_samp_names[i] << " ";
452  }
453  for (unsigned int i = 0; i < parser.m_region->m_prev_subdet_names.size(); ++i) {
454  std::cout << parser.m_region->m_prev_subdet_names[i] << " ";
455  }
456  for (unsigned int i = 0; i < parser.m_region->m_next_subdet_names.size(); ++i) {
457  std::cout << parser.m_region->m_next_subdet_names[i] << " ";
458  }
459  std::cout << parser.m_region->m_eta0 << " "
460  << parser.m_region->m_deta << " "
461  << parser.m_region->m_phi0 << " "
462  << parser.m_region->m_dphi << " "
463  << std::endl;
464  }
465 }

◆ sibling_number()

int XMLCoreFactory::sibling_number ( const XMLCoreNode node)
inherited

Definition at line 174 of file XMLCoreParser.cxx.

174  {
175  return node.get_node ().sibling_number ();
176 }

◆ start()

void XMLCoreFactory::start ( XMLCoreParser parser,
const XMLCoreNode node 
)
inherited

Definition at line 66 of file XMLCoreParser.cxx.

66  {
68  std::cout << "XMLCoreFactory::start> factory=" << this << std::endl;
69  }
70  do_start (parser, node);
71 }

Member Data Documentation

◆ m_xmlelementname

std::string XMLCoreFactory::m_xmlelementname
protectedinherited

Definition at line 94 of file XMLCoreParser.h.


The documentation for this class was generated from the following file:
XMLCoreFactory::do_comment
virtual void do_comment(XMLCoreParser &parser, const std::string &comment)
Definition: XMLCoreParser.cxx:104
python.CaloScaleNoiseConfig.parser
parser
Definition: CaloScaleNoiseConfig.py:75
python.PoolAttributeHelper.attrs
list attrs
Definition: PoolAttributeHelper.py:89
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
ReadCellNoiseFromCool.name1
name1
Definition: ReadCellNoiseFromCool.py:233
get_generator_info.result
result
Definition: get_generator_info.py:21
index
Definition: index.py:1
IdDictParserNS::IdDictBaseFactory::idd_start
virtual void idd_start(IdDictParser &parser, const XMLCoreNode &node)
Definition: IdDictParser.cxx:157
XMLCoreFactory::has_attribute
static bool has_attribute(const XMLCoreNode &node, const std::string &name)
Definition: XMLCoreParser.cxx:117
CoreParser::DOMNamedNodeMap
std::map< std::string, std::string > DOMNamedNodeMap
Definition: DOMNode.h:15
skel.it
it
Definition: skel.GENtoEVGEN.py:396
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
python.LumiCalcHtml.lc
lc
Definition: LumiCalcHtml.py:579
IdDictParserNS::Debugger::tab
static void tab(int n)
Definition: IdDictParser.cxx:27
IdDictRegion
Definition: IdDictDefs.h:433
IdDictParserNS::IdDictBaseFactory::idd_end
virtual void idd_end(IdDictParser &parser, const XMLCoreNode &node)
Definition: IdDictParser.cxx:161
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
python.subdetectors.mmg.names
names
Definition: mmg.py:8
XMLCoreFactory::get_value
static std::string get_value(const XMLCoreNode &node, const std::string &name)
Definition: XMLCoreParser.cxx:154
XMLCoreFactory::do_start
virtual void do_start(XMLCoreParser &parser, const XMLCoreNode &node)
Definition: XMLCoreParser.cxx:90
IdDictParser
Definition: IdDictParser.h:12
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
DeMoScan.index
string index
Definition: DeMoScan.py:364
XMLCoreFactory::get_token
static std::string get_token(const XMLCoreNode &node, const std::string &name)
Definition: XMLCoreParser.cxx:190
test_pyathena.counter
counter
Definition: test_pyathena.py:15
XMLCoreFactory::comment
void comment(XMLCoreParser &parser, const std::string &comment)
Definition: XMLCoreParser.cxx:82
XMLCoreFactory::get_double
static double get_double(const XMLCoreNode &node, const std::string &name)
Definition: XMLCoreParser.cxx:133
python.compressB64.c
def c
Definition: compressB64.py:93
node
Definition: memory_hooks-stdcmalloc.h:74
IdDictParserNS::Debugger::debug
static bool debug()
Definition: IdDictParser.cxx:22
XMLCoreFactory::do_end
virtual void do_end(XMLCoreParser &parser, const XMLCoreNode &node)
Definition: XMLCoreParser.cxx:97