ATLAS Offline Software
snakeHandler.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 #include "AGDDModel/AGDDSnake.h"
11 
12 #include <iostream>
13 #include <vector>
14 
15 using namespace xercesc;
16 
17 snakeHandler::snakeHandler(const std::string& s,
19  : XMLHandler(s, c)
20 {
21 }
22 
24  xercesc::DOMNode *t)
25 {
26  bool res=false;
27  std::string name=getAttributeAsString(c, t, "name",res);
28  std::string material=getAttributeAsString(c, t, "material",res);
29  double radius=getAttributeAsDouble(c, t, "radius",res);
30 
31  std::vector<GeoTrf::Vector3D> points;
32 
33  AGDDSnake *vol=new AGDDSnake(name, c.GetVolumeStore(), c.GetSectionStore());
34  vol->SetMaterial(material);
35  vol->Radius(radius);
36 
37  StopLoop(true);
38  DOMNode* child;
39 
40  snake_pointHandler* pointHand = dynamic_cast<snake_pointHandler*>
41  (c.GetHandlerStore().GetHandler("snake_point"));
42  if (!pointHand) std::abort();
43 
44  IAGDDParser& parser = *c.GetParser();
45  for (child=t->getFirstChild();child!=0;child=child->getNextSibling())
46  {
47  if (child->getNodeType()==DOMNode::ELEMENT_NODE) {
48  parser.elementLoop(c, child);
49  points.push_back (pointHand->CurrentPoint());
50  }
51  }
52 
53  int nPoints=points.size();
54  for (int i=0;i<nPoints;i++)
55  vol->SetPoint(points[i]);
56 
57  std::string col=getAttributeAsString(c, t,"color",res);
58  if (res)
59  vol->SetColor(col);
60 
61 }
AGDDController.h
python.CaloScaleNoiseConfig.parser
parser
Definition: CaloScaleNoiseConfig.py:75
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
XercesParser.h
IAGDDParser
Definition: IAGDDParser.h:15
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
XMLHandler::getAttributeAsDouble
double getAttributeAsDouble(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:78
snake_pointHandler.h
AGDDController
Definition: AGDDController.h:30
snakeHandler::snakeHandler
snakeHandler(const std::string &, AGDDController &c)
Definition: snakeHandler.cxx:17
snakeHandler::ElementHandle
virtual void ElementHandle(AGDDController &c, xercesc::DOMNode *t) override
Definition: snakeHandler.cxx:23
AGDDVolume::SetMaterial
void SetMaterial(const std::string &n)
Definition: AGDDVolume.h:24
AGDDSnake::SetPoint
void SetPoint(const GeoTrf::Vector3D &p)
Definition: AGDDSnake.h:20
AGDDSnake::Radius
double Radius() const
Definition: AGDDSnake.h:25
lumiFormat.i
int i
Definition: lumiFormat.py:85
AGDDSnake.h
XMLHandlerStore.h
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
snake_pointHandler::CurrentPoint
GeoTrf::Vector3D CurrentPoint()
Definition: snake_pointHandler.h:20
XMLHandler::getAttributeAsString
std::string getAttributeAsString(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:69
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
XMLHandler
Definition: XMLHandler.h:15
query_example.col
col
Definition: query_example.py:7
ParticleGun_SamplingFraction.radius
radius
Definition: ParticleGun_SamplingFraction.py:96
snake_pointHandler
Definition: snake_pointHandler.h:14
AGDDVolume::SetColor
void SetColor(const std::string &c)
Definition: AGDDVolume.h:36
snakeHandler.h
AGDDSnake
Definition: AGDDSnake.h:14
python.compressB64.c
def c
Definition: compressB64.py:93
XMLHandler::StopLoop
void StopLoop(bool)
Definition: XMLHandler.cxx:28
jobOptions.points
points
Definition: jobOptions.GenevaPy8_Zmumu.py:97