1 #include "gearxml/SiPlanesParametersXML.h"
3 #include "gearxml/XMLHandlerMgr.h"
4 #include "gearxml/GearParametersXML.h"
6 #include "gearxml/tinyxml.h"
7 #include "gearimpl/SiPlanesParametersImpl.h"
9 #include "gear/GearMgr.h"
34 throw Exception(
"SiPlanesParametersXML::toXML given parameters not of correct type. "
35 "needs to be gear::SiPlanesParameters." ) ;
49 case ( SiPlanesParameters::TelescopeWithDUT ) :
50 strType =
"TelescopeWithDUT" ;
52 case ( SiPlanesParameters::TelescopeWithoutDUT ) :
53 strType =
"TelescopeWithoutDUT" ;
71 if (strType ==
"TelescopeWithDUT"){
113 for(
int i=0 ; i < siplanesLayers.
getNLayers() ; i++ ) {
181 if( strType ==
"TelescopeWithDUT" ) {
183 intType = SiPlanesParameters::TelescopeWithDUT ;
185 }
else if( strType ==
"TelescopeWithoutDUT" ) {
187 intType = SiPlanesParameters::TelescopeWithoutDUT ;
190 throw Exception(
"SiPlanesParametersXML::fromXML type of SiPlanes not known."
191 "Needs to be 'TelescopeWithDUT' or 'TelescopeWithoutDUT'." ) ;
197 int nplanes = atoi(
getXMLAttribute( siplanesNumber ,
"number" ).c_str() ) ;
203 if (intType == SiPlanesParameters::TelescopeWithDUT) {
209 double ldutPosX = atof(
getXMLAttribute( xmlDUTLad ,
"positionX" ).c_str() ) ;
210 double ldutPosY = atof(
getXMLAttribute( xmlDUTLad ,
"positionY" ).c_str() ) ;
211 double ldutPosZ = atof(
getXMLAttribute( xmlDUTLad ,
"positionZ" ).c_str() ) ;
212 double ldutSizX = atof(
getXMLAttribute( xmlDUTLad ,
"sizeX" ).c_str() ) ;
213 double ldutSizY = atof(
getXMLAttribute( xmlDUTLad ,
"sizeY" ).c_str() ) ;
214 double ldutThick = atof(
getXMLAttribute( xmlDUTLad ,
"thickness" ).c_str() ) ;
215 double ldutRadLen = atof(
getXMLAttribute( xmlDUTLad ,
"radLength" ).c_str() ) ;
218 double sdutPosX = atof(
getXMLAttribute( xmlDUTSen ,
"positionX" ).c_str() ) ;
219 double sdutPosY = atof(
getXMLAttribute( xmlDUTSen ,
"positionY" ).c_str() ) ;
220 double sdutPosZ = atof(
getXMLAttribute( xmlDUTSen ,
"positionZ" ).c_str() ) ;
221 double sdutSizX = atof(
getXMLAttribute( xmlDUTSen ,
"sizeX" ).c_str() ) ;
222 double sdutSizY = atof(
getXMLAttribute( xmlDUTSen ,
"sizeY" ).c_str() ) ;
223 double sdutThick = atof(
getXMLAttribute( xmlDUTSen ,
"thickness" ).c_str() ) ;
224 int sdutNPixX = atoi(
getXMLAttribute( xmlDUTSen ,
"npixelX" ).c_str() ) ;
225 int sdutNPixY = atoi(
getXMLAttribute( xmlDUTSen ,
"npixelY" ).c_str() ) ;
226 double sdutPitX = atof(
getXMLAttribute( xmlDUTSen ,
"pitchX" ).c_str() ) ;
227 double sdutPitY = atof(
getXMLAttribute( xmlDUTSen ,
"pitchY" ).c_str() ) ;
228 double sdutResol = atof(
getXMLAttribute( xmlDUTSen ,
"resolution" ).c_str() ) ;
233 double sdutRadLen = atof(
getXMLAttribute( xmlDUTSen ,
"radLength" ).c_str() ) ;
235 siplanesParam->
addDUT(ldutID, ldutPosX, ldutPosY, ldutPosZ, ldutSizX, ldutSizY, ldutThick, ldutRadLen, sdutID, sdutPosX, sdutPosY, sdutPosZ, sdutSizX, sdutSizY, sdutThick, sdutNPixX, sdutNPixY, sdutPitX, sdutPitY, sdutResol, sdutRotat1, sdutRotat2,sdutRotat3,sdutRotat4, sdutRadLen) ;
242 while( ( xmlLayer = xmlLayers->
IterateChildren(
"layer" , xmlLayer ) ) != 0 ) {
248 double lPosX = atof(
getXMLAttribute( xmlLad ,
"positionX" ).c_str() ) ;
249 double lPosY = atof(
getXMLAttribute( xmlLad ,
"positionY" ).c_str() ) ;
250 double lPosZ = atof(
getXMLAttribute( xmlLad ,
"positionZ" ).c_str() ) ;
256 double lThick = atof(
getXMLAttribute( xmlLad ,
"thickness" ).c_str() ) ;
257 double lRadLen = atof(
getXMLAttribute( xmlLad ,
"radLength" ).c_str() ) ;
260 double sPosX = atof(
getXMLAttribute( xmlSen ,
"positionX" ).c_str() ) ;
261 double sPosY = atof(
getXMLAttribute( xmlSen ,
"positionY" ).c_str() ) ;
262 double sPosZ = atof(
getXMLAttribute( xmlSen ,
"positionZ" ).c_str() ) ;
268 double sThick = atof(
getXMLAttribute( xmlSen ,
"thickness" ).c_str() ) ;
273 double sResol = atof(
getXMLAttribute( xmlSen ,
"resolution" ).c_str() ) ;
276 if( sResolX < 0 ) sResolX = sResol;
277 if( sResolY < 0 ) sResolY = sResol;
282 double sRadLen = atof(
getXMLAttribute( xmlSen ,
"radLength" ).c_str() ) ;
284 siplanesParam->
addLayer(lID, lPosX, lPosY, lPosZ, lRotXY, lRotZX, lRotZY, lSizX, lSizY, lThick, lRadLen,
285 sID, sPosX, sPosY, sPosZ, sRotXY, sRotZX, sRotZY, sSizX, sSizY, sThick, sNPixX, sNPixY, sPitX, sPitY, sResol, sResolX, sResolY, sRotat1, sRotat2, sRotat3, sRotat4, sRadLen) ;
301 return siplanesParam ;
virtual double getSensitiveRadLength(int layerIndex) const =0
The radiation length of sensitive volume of layer layerIndex - layer indexing starts at 0 for the lay...
virtual int getSiPlanesType() const =0
The type of SiPlanes detector: SiPlanesParameters.TelescopeWithDUT, SiPlanesParameters.TelescopeWithoutDUT.
virtual double getDUTSensitiveRotation3() const =0
Third element (sin(theta)) of rotation matrix of sensitive volume of the DUT.
virtual double getSensitiveRotation1(int layerIndex) const =0
First element (cos(theta)) of rotation matrix of sensitive volume of layer layerIndex - layer indexin...
virtual int getSensitiveNpixelX(int layerIndex) const =0
Number of pixels in x direction in sensitive volume of layer layerIndex - layer indexing starts at 0 ...
virtual double getLayerRotationZX(int layerIndex) const =0
rotation angles according to Euler implmentation scheme (in ZX plane -> around axis Y: beta ) ...
virtual int getNLayers() const =0
The total number of layers.
virtual double getLayerRotationXY(int layerIndex) const =0
rotation angles according to Euler implementation scheme (in XY plane -> around axis Z: gamma ) ...
virtual double getDUTThickness() const =0
Thickness of nonsensitive layer of the DUT.
virtual double getDUTSensitivePitchY() const =0
Pitch size in y direction of sensitive volume of the DUT.
virtual GearParameters * fromXML(const TiXmlElement *xmlElement, GearMgr *gearMgr=0) const
Creates the appropriate GearParameters subclass from the given XML element (node) ...
virtual double getSensitiveSizeX(int layerIndex) const =0
Size in x direction of sensitive volume of layer layerIndex - layer indexing starts at 0 for the laye...
virtual double getDUTSensitiveRotation4() const =0
Fourth element (cos(theta)) of rotation matrix of sensitive volume of the DUT.
virtual int getSensitiveNpixelY(int layerIndex) const =0
Number of pixels in y direction in sensitive volume of layer layerIndex - layer indexing starts at 0 ...
std::string getOptionalXMLAttribute(const TiXmlNode *node, const std::string &name, const std::string &defaultValue)
Helper method used for parsing XML.
virtual double getSensitiveRotation2(int layerIndex) const =0
Second element (-sin(theta)) of rotation matrix of sensitive volume of layer layerIndex - layer index...
virtual double getDUTSensitiveThickness() const =0
Thickness of sensitive volume of the DUT.
virtual int getSiPlanesNumber() const =0
Number of telescope planes of SiPlanes detector.
Base exception class for GEAR - all other exceptions extend this.
virtual int getDUTID() const =0
ID of nonsensitive volume of the DUT.
virtual double getLayerSizeX(int layerIndex) const =0
Size in x direction of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for the l...
virtual const SiPlanesLayerLayout & getSiPlanesLayerLayout() const =0
The layer layout of pixel beam telescope.
virtual double getSensitivePositionY(int layerIndex) const =0
y position of the center of sensitive volume of layer layerIndex - layer indexing starts at 0 for the...
virtual double getDUTSensitiveRotation1() const =0
First element (cos(theta)) of rotation matrix of sensitive volume of the DUT.
virtual double getDUTSensitivePositionX() const =0
x position of the center of sensitive volume of the DUT.
virtual void setSiPlanesParameters(SiPlanesParameters *siplanesParameters)=0
Set the SiPlanesParameters.
virtual double getDUTPositionZ() const =0
z position of the center of nonsensitive volume of the DUT.
static void setParametersFromXML(const TiXmlElement *xmlElement, GearParametersImpl *gearParams)
Static helper function that can be used by other subclass handlers to read parameters.
virtual double getLayerRotationZY(int layerIndex) const =0
rotation angles according to Euler implmentation scheme (in ZY plane -> around axis X: alfa ) ...
virtual double getLayerThickness(int layerIndex) const =0
Thickness of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for the layer close...
virtual int getSensitiveID(int layerIndex) const =0
ID of sensitive volume of layer layerIndex - layer indexing starts at 0 for the layer closest to the ...
Abstract interface for a set of parameters that can be used to describe the geometrical properties of...
virtual double getLayerPositionX(int layerIndex) const =0
x position of the center of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for ...
virtual int getSiPlanesID() const =0
ID of telescope setup.
virtual double getSensitiveSizeY(int layerIndex) const =0
Size in y direction of sensitive volume of layer layerIndex - layer indexing starts at 0 for the laye...
virtual double getLayerPositionY(int layerIndex) const =0
y position of the center of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for ...
virtual void addDUT(int dutID, double dutPositionX, double dutPositionY, double dutPositionZ, double dutSizeX, double dutSizeY, double dutThickness, double dutRadLength, int dutsensitiveID, double dutsensitivePositionX, double dutsensitivePositionY, double dutsensitivePositionZ, double dutsensitiveSizeX, double dutsensitiveSizeY, double dutsensitiveThickness, int dutsensitiveNpixelX, int dutsensitiveNpixelY, double dutsensitivePitchX, double dutsensitivePitchY, double dutsensitiveResolution, double dutsensitiveRotation1, double dutsensitiveRotation2, double dutsensitiveRotation3, double dutsensitiveRotation4, double dutsensitiveRadLength)
Adding DUT to the SiPlanes detector.
static void getXMLForParameters(TiXmlElement *xmlElement, const GearParameters *gearParams)
Static helper function that can be used by other subclass handlers to create XML for parameters...
Abstract description of layers in a pixel beam telescope.
virtual double getSensitivePitchX(int layerIndex) const =0
Pitch size in x direction in sensitive volume of layer layerIndex - layer indexing starts at 0 for th...
The parent class for everything in the Document Object Model.
virtual double getLayerPositionZ(int layerIndex) const =0
z position of the center of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for ...
virtual double getDUTSensitiveRadLength() const =0
The radiation length of sensitive volume of the DUT.
virtual int getDUTSensitiveNpixelY() const =0
Number of pixels in y direction of sensitive volume of the DUT.
virtual double getSensitivePositionX(int layerIndex) const =0
x position of the center of sensitive volume of layer layerIndex - layer indexing starts at 0 for the...
std::string getXMLAttribute(const TiXmlNode *node, const std::string &name)
Helper method used for parsing XML.
virtual double getSensitivePitchY(int layerIndex) const =0
Pitch size in y direction in sensitive volume of layer layerIndex - layer indexing starts at 0 for th...
virtual double getDUTPositionY() const =0
y position of the center of nonsensitive volume of the DUT.
virtual TiXmlElement toXML(const GearParameters ¶meters) const
Creates an XML node for the given parameters.
virtual int getDUTSensitiveNpixelX() const =0
Number of pixels in x direction of sensitive volume of the DUT.
virtual double getDUTSensitiveSizeX() const =0
Size in x direction of sensitive volume of the DUT.
virtual double getDUTPositionX() const =0
x position of the center of nonsensitive volume of the DUT.
virtual double getLayerRadLength(int layerIndex) const =0
The radiation length of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for the ...
virtual double getDUTSensitivePitchX() const =0
Pitch size in x direction of sensitive volume of the DUT.
The element is a container class.
virtual double getSensitiveRotation4(int layerIndex) const =0
Fourth element (cos(theta)) of rotation matrix of sensitive volume of layer layerIndex - layer indexi...
TiXmlNode * InsertEndChild(const TiXmlNode &addThis)
Add a new node related to this.
virtual double getSensitiveResolution(int layerIndex) const =0
Intrinsic resolution of layer layerIndex - layer indexing starts at 0 for the layer closest to the be...
virtual double getSensitiveThickness(int layerIndex) const =0
Thickness of sensitive volume of layer layerIndex - layer indexing starts at 0 for the layer closest ...
void SetDoubleAttribute(const char *name, double value)
Sets an attribute of name to a given value.
virtual double getDUTSensitiveRotation2() const =0
Second element (-sin(theta)) of rotation matrix of sensitive volume of the DUT.
virtual double getDUTSensitivePositionY() const =0
y position of the center of sensitive volume of the DUT.
virtual int getID(int layerIndex) const =0
Layer ID of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for the layer closes...
Abstract interface for a manager class that returns the Gear classes for the relevant subdetectors...
const TiXmlNode * IterateChildren(const TiXmlNode *previous) const
An alternate way to walk the children of a node.
virtual double getSensitivePositionZ(int layerIndex) const =0
z position of the center of sensitive volume of layer layerIndex - layer indexing starts at 0 for the...
void SetAttribute(const char *name, const char *value)
Sets an attribute of name to a given value.
Geometry properties of a pixel beam telescope needed for reconstruction code.
virtual double getSensitiveRotation3(int layerIndex) const =0
Third element (sin(theta)) of rotation matrix of sensitive volume of layer layerIndex - layer indexin...
virtual double getDUTSensitivePositionZ() const =0
z position of the center of sensitive volume of the DUT.
virtual double getDUTSensitiveResolution() const =0
Intrinsic resolution of the DUT, not relevant.
virtual double getLayerSizeY(int layerIndex) const =0
Size in y direction of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for the l...
virtual int getDUTSensitiveID() const =0
ID of sensitive volume of the DUT.
virtual double getDUTRadLength() const =0
The radiation length of nonsensitive volume of the DUT.
Abstract description of layers in pixel beam telescope with or without DUT.
const TiXmlElement * FirstChildElement() const
Convenience function to get through elements.
virtual double getDUTSizeX() const =0
Size in x direction of nonsensitive volume of the DUT.
virtual double getDUTSensitiveSizeY() const =0
Size in y direction of sensitive volume of the DUT.
virtual double getDUTSizeY() const =0
Size in y direction of nonsensitive volume of the DUT.
virtual void addLayer(int layerID, double layerPositionX, double layerPositionY, double layerPositionZ, double layerRotationXY, double layerRotationZX, double layerRotationZY, double layerSizeX, double layerSizeY, double layerThickness, double layerRadLength, int sensitiveID, double sensitivePositionX, double sensitivePositionY, double sensitivePositionZ, double sensitiveRotationXY, double sensitiveRotationZX, double sensitiveRotationZY, double sensitiveSizeX, double sensitiveSizeY, double sensitiveThickness, int sensitiveNpixelX, int sensitiveNpixelY, double sensitivePitchX, double sensitivePitchY, double sensitiveResolution, double sensitiveResolutionX, double sensitiveResolutionY, double sensitiveRotation1, double sensitiveRotation2, double sensitiveRotation3, double sensitiveRotation4, double sensitiveRadLength)
Adding a Layer to the SiPlanes detector.