ATLAS Offline Software
gvxysxHandler.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 #include "AGDDModel/AGDDGvxy.h"
11 #include <iostream>
12 
13 using namespace xercesc;
14 
15 gvxysxHandler::gvxysxHandler(const std::string& s,
17  : XMLHandler(s, c)
18 {
19 // std::cout<<"Creating handler for gvxysx"<<std::endl;
20 }
21 
23  xercesc::DOMNode *t)
24 {
25  bool res;
26  std::string name=getAttributeAsString(c, t, "name");
27  std::string material=getAttributeAsString(c, t, "material");
28  double dZ=getAttributeAsDouble(c, t, "dZ");
29 
30  AGDDGvxy *vol=new AGDDGvxy(name, c.GetVolumeStore(), c.GetSectionStore());
31  vol->SetMaterial(material);
32  vol->SetDz(dZ);
33 
34  std::vector<double> xvalues=getAttributeAsVector(c, t, "X",res);
35 
36  if (res)
37  {
38  std::vector<double> yvalues=getAttributeAsVector(c, t, "Y");
39 
40  // check we have a consistent set of points
41  if(xvalues.size() != yvalues.size()) std::abort();
42  int nPoints=xvalues.size();
43 
44  TwoPoint* v=new TwoPoint[2*nPoints];
45  for (int i=0;i<nPoints;i++)
46  {
47  v[i].x(xvalues[i]);
48  v[i].y(yvalues[i]);
49  v[2*nPoints-i-1].x(-xvalues[i]);
50  v[2*nPoints-i-1].y(yvalues[i]);
51  }
52 
53  for (int i=0;i<2*nPoints;i++)
54  {
55  vol->SetPoint(v[i]);
56  }
57  delete[] v;
58  }
59  else
60  {
61  std::vector<TwoPoint> points;
62  StopLoop(true);
63 
64  gvxy_pointHandler* pointHand = dynamic_cast<gvxy_pointHandler*>
65  (c.GetHandlerStore().GetHandler("gvxy_point"));
66  if (!pointHand) std::abort();
67 
68  IAGDDParser& parser = *c.GetParser();
69  DOMNode *child;
70  for (child=t->getFirstChild();child!=0;child=child->getNextSibling())
71  {
72  if (child->getNodeType()==DOMNode::ELEMENT_NODE) {
73  parser.elementLoop(c, child);
74  TwoPoint p = pointHand->CurrentTwoPoint();
75  points.push_back(p);
76  }
77  }
78 
79  int nPoints=points.size();
80 
81  TwoPoint* v=new TwoPoint[2*nPoints];
82  for (int i=0;i<nPoints;i++)
83  {
84  v[i].x(points[i].x());
85  v[i].y(points[i].y());
86  v[2*nPoints-i-1].x(-points[i].x());
87  v[2*nPoints-i-1].y(points[i].y());
88  }
89 
90  for (int i=0;i<2*nPoints;i++)
91  {
92  vol->SetPoint(v[i]);
93  }
94  delete [] v;
95  }
96 
97  std::string col=getAttributeAsString(c, t, "color",res);
98  if (res)
99  vol->SetColor(col);
100 }
AGDDController.h
gvxy_pointHandler
Definition: gvxy_pointHandler.h:12
python.CaloScaleNoiseConfig.parser
parser
Definition: CaloScaleNoiseConfig.py:75
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
XercesParser.h
gvxy_pointHandler.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
x
#define x
TwoPoint
Definition: TwoPoint.h:8
gvxysxHandler::ElementHandle
virtual void ElementHandle(AGDDController &c, xercesc::DOMNode *t) override
Definition: gvxysxHandler.cxx:22
AGDDController
Definition: AGDDController.h:30
gvxysxHandler.h
gvxysxHandler::gvxysxHandler
gvxysxHandler(const std::string &, AGDDController &c)
Definition: gvxysxHandler.cxx:15
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AGDDVolume::SetMaterial
void SetMaterial(const std::string &n)
Definition: AGDDVolume.h:24
AGDDGvxy
Definition: AGDDGvxy.h:14
lumiFormat.i
int i
Definition: lumiFormat.py:85
XMLHandlerStore.h
XMLHandler::getAttributeAsVector
std::vector< double > getAttributeAsVector(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:100
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
AGDDGvxy.h
XMLHandler::getAttributeAsString
std::string getAttributeAsString(AGDDController &c, const xercesc::DOMNode *t, const std::string &) const
Definition: XMLHandler.cxx:69
AGDDGvxy::SetDz
void SetDz(double v)
Definition: AGDDGvxy.h:20
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
gvxy_pointHandler::CurrentTwoPoint
TwoPoint CurrentTwoPoint()
Definition: gvxy_pointHandler.h:18
python.PyAthena.v
v
Definition: PyAthena.py:154
y
#define y
AGDDGvxy::SetPoint
void SetPoint(TwoPoint p)
Definition: AGDDGvxy.h:24
AGDDVolume::SetColor
void SetColor(const std::string &c)
Definition: AGDDVolume.h:36
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