1 #include "gearxml/RectangularPadRowLayoutXML.h"
3 #include "gearxml/XMLHandler.h"
5 #include "gearxml/tinyxml.h"
6 #include "gearimpl/RectangularPadRowLayout.h"
7 #include "gear/GearMgr.h"
18 if (rectangularPadLayout==NULL) {
20 throw ParseException(
"RectangularPadRowLayoutXML::toXML wrong type !");
26 padRowLayout2DXML.
SetAttribute(
"type",
"RectangularPadRowLayout");
34 if( repeatRowCount > 1 )
38 const std::vector<unsigned>& rowNumbers = rectangularPadLayout->
equalRowNumbers() ;
41 int rowNum = rowNumbers.size() ;
43 if( repeatRowCount > 1 )
44 rowNum /= repeatRowCount ;
48 for(
int i=0 ; i< rowNum ; ++i){
54 int nRow = rowNumbers[i] ;
72 return padRowLayout2DXML ;
97 double padWidth = atof(
getXMLAttribute( row ,
"padWidth" ) .c_str() ) ;
98 double padHeight = atof(
getXMLAttribute( row ,
"padHeight" ) .c_str() ) ;
104 padRowLayout->
addRow( nRow, nPad, padWidth, padHeight, rowHeight, leftOffset, rightOffset ) ;
111 return padRowLayout ;
int getRepeatRowCount() const
Returns the number number for which a given row pattern has been repaeted.
virtual PadRowLayout2D * fromXML(const TiXmlElement *xmlElement) const
Creates the appropriate PadRowLayout2D subclass from the given XML element (node) ...
const std::vector< Row > & rows() const
Helper method with all row data.
Abstract description of a planar subdetector with pads (cells) that are positioned in rows (circular ...
std::string getOptionalXMLAttribute(const TiXmlNode *node, const std::string &name, const std::string &defaultValue)
Helper method used for parsing XML.
virtual TiXmlElement toXML(const PadRowLayout2D *layout) const
Creates an XML node for the given PadRowLayout2D.
const std::vector< unsigned > & equalRowNumbers() const
Helper method to identify equal row numbers in this layout (as they have been added).
The parent class for everything in the Document Object Model.
virtual void addRow(int nRow, int nPad, double padWidth, double padHeight, double rowHeight=0.0, double leftOffset=0.0, double rightOffset=0.0)
Add nRow rows with the given parameters.
ParseException used for parse errors, e.g.
std::string getXMLAttribute(const TiXmlNode *node, const std::string &name)
Helper method used for parsing XML.
The element is a container class.
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Add a new node related to this.
void SetDoubleAttribute(const char *name, double value)
Sets an attribute of name to a given value.
virtual const std::vector< double > & getPlaneExtent() const
Extent of the sensitive plane - [xmin,xmax,ymin,ymax] CARTESIAN or [rmin,rmax,phimin,phimax] POLAR.
virtual void repeatRows(unsigned count)
Repeat the current rows 'count' times - this allows to easily repeat a pattern of several rows...
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
An alternate way to walk the children of a node.
void SetAttribute(const char *name, const char *value)
Sets an attribute of name to a given value.
Implementation of PadRowLayout2D for a rectangular row based layout where all pads in a given row are...
Internal helper class for RectangularPadRowLayout.