ATLAS Offline Software
Loading...
Searching...
No Matches
pgonHandler.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
11#include <iostream>
12
13using namespace xercesc;
14
15pgonHandler::pgonHandler(const std::string& s,
17 : XMLHandler(s, c)
18{
19// std::cout<<"Creating handler for pgon"<<std::endl;
20}
21
23 xercesc::DOMNode *t)
24{
25// std::cout<<"handling for pgon";
26 bool res;
27 std::string name=getAttributeAsString(c, t, "name",res);
28 std::string material=getAttributeAsString(c, t, "material",res);
29 int nbPhi=getAttributeAsInt(c, t, "nbPhi",res);
30
31 AGDDPgon *vol=new AGDDPgon(name, c.GetVolumeStore(), c.GetSectionStore());
32 vol->SetMaterial(material);
33 vol->SetNbPhi(nbPhi);
34
35 std::string col=getAttributeAsString(c, t, "color",res);
36 if (res)
37 vol->SetColor(col);
38
39 std::vector<double> vvv=getAttributeAsVector(c, t, "profile",res);
40 if (res)
41 vol->SetProfile(vvv[0],vvv[1]);
42 else
43 vol->SetProfile(0.,360.);
44
45 StopLoop(true);
46
47 DOMNode* child;
48
49 polyplaneHandler* pplaneHand = dynamic_cast<polyplaneHandler*>
50 (c.GetHandlerStore().GetHandler("polyplane"));
51 if (!pplaneHand) std::abort();
52
53 IAGDDParser& parser = *c.GetParser();
54 for (child=t->getFirstChild();child!=0;child=child->getNextSibling())
55 {
56 if (child->getNodeType()==DOMNode::ELEMENT_NODE) {
57 parser.elementLoop(c, child);
58 Polyplane p = pplaneHand->CurrentPolyplane();
59 vol->SetPlane(p.rin(),p.rou(),p.z());
60 }
61 }
62
63}
std::pair< std::vector< unsigned int >, bool > res
void SetNbPhi(int i)
Definition AGDDPgon.h:26
void SetPlane(double ri, double ro, double z)
Definition AGDDPgon.h:19
void SetProfile(double phi0, double dphi)
Definition AGDDPgon.h:25
void SetMaterial(const std::string &n)
Definition AGDDVolume.h:24
void SetColor(const std::string &c)
Definition AGDDVolume.h:36
void StopLoop(bool)
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
XMLHandler(const std::string &n, AGDDController &c)
std::string getAttributeAsString(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
virtual void ElementHandle(AGDDController &c, xercesc::DOMNode *t) override
pgonHandler(const std::string &, AGDDController &c)
const Polyplane & CurrentPolyplane()