Commit in projects/lcdd/branches/v05-00-00-dev on MAIN | |||
examples/segmentation/CartesianGridXY.lcdd | +1 | -1 | 3253 -> 3254 |
/CartesianGridXYZ.lcdd | +137 | added 3254 | |
/CartesianGridXZ.lcdd | +128 | added 3254 | |
include/lcdd/detectors/SensitiveDetectorFactory.hh | +6 | 3253 -> 3254 | |
include/lcdd/schema/CartesianGridXYZType.hh | +44 | added 3254 | |
/CartesianGridXZType.hh | +63 | added 3254 | |
/cartesian_grid_xyz.hh | +45 | added 3254 | |
/cartesian_grid_xz.hh | +45 | added 3254 | |
/projective_cylinder.hh | +3 | -3 | 3253 -> 3254 |
schemas/lcdd/2.0/lcdd_sensitive_detectors.xsd | +26 | -2 | 3253 -> 3254 |
src/lcdd/core/LCDDLibLoad.cc | +2 | 3253 -> 3254 | |
src/lcdd/detectors/DDSegmentationCalorimeterHitProcessor.cc | +3 | 3253 -> 3254 | |
/SensitiveDetectorFactory.cc | +77 | -7 | 3253 -> 3254 |
src/lcdd/processes/cartesian_grid_xyzProcess.cc | +84 | added 3254 | |
/cartesian_grid_xzProcess.cc | +81 | added 3254 | |
/projective_cylinderProcess.cc | -68 | 3253 removed | |
src/lcdd/segmentation/SegmentationFactory.cc | +1 | -1 | 3253 -> 3254 |
+746 | -82 |
Add LCDD binding for CartesianGridXYZ and Cartesian XZ from DD4hep.
--- projects/lcdd/branches/v05-00-00-dev/examples/segmentation/CartesianGridXY.lcdd 2014-08-11 22:58:56 UTC (rev 3253) +++ projects/lcdd/branches/v05-00-00-dev/examples/segmentation/CartesianGridXY.lcdd 2014-08-12 21:16:43 UTC (rev 3254) @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <lcdd xmlns:lcdd="http://www.lcsim.org/schemas/lcdd/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcdd/2.0/lcdd.xsd"> <header>
- <detector name="CartesianGridXy" />
+ <detector name="CartesianGridXY" />
</header> <iddict> <idspec name="CalHits" length="64">
--- projects/lcdd/branches/v05-00-00-dev/examples/segmentation/CartesianGridXYZ.lcdd (rev 0) +++ projects/lcdd/branches/v05-00-00-dev/examples/segmentation/CartesianGridXYZ.lcdd 2014-08-12 21:16:43 UTC (rev 3254) @@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?> +<lcdd xmlns:lcdd="http://www.lcsim.org/schemas/lcdd/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcdd/2.0/lcdd.xsd"> + <header> + <detector name="CartesianGridXYZ" /> + </header> + <iddict> + <idspec name="CalHits" length="64"> + <!-- + <idfield signed="false" label="system" length="3" start="0" /> + <idfield signed="false" label="layer" length="7" start="3" /> + <idfield signed="false" label="slice" length="2" start="10" /> + --> + <idfield signed="true" label="x" length="16" start="0" /> + <idfield signed="true" label="y" length="16" start="16" /> + <idfield signed="true" label="z" length="32" start="32" /> + </idspec> + </iddict> + <sensitive_detectors> + <calorimeter name="Cal" hits_collection="CalHits"> + <idspecref ref="CalHits" /> + <hit_processor type="DDSegmentationCalorimeterHitProcessor" /> +<!-- + <cartesian_grid_xy grid_size_x="1.0" grid_size_y="1.5" offset_x="0.1" offset_y="0.2" /> +--> + <cartesian_grid_xyz grid_size_x="1.0" grid_size_y="1.0" grid_size_z="1.0" offset_x="0.0" offset_y="0.0" offset_z="0.0" /> + </calorimeter> + </sensitive_detectors> + <limits /> + <regions> + <region name="TrackingRegion" store_secondaries="true" cut="10.0" lunit="mm" threshold="1.0" eunit="MeV" /> + </regions> + <display /> + <gdml> + <define> + <rotation name="identity_rot" x="0.0" y="0.0" z="0.0" unit="radian" /> + <position name="identity_pos" x="0.0" y="0.0" z="0.0" unit="mm" /> + <constant name="tracking_region_radius" value="0.5*m" /> + <constant name="tracking_region_zmax" value="1.0*m" /> + <constant name="world_x" value="5.0*m" /> + <constant name="world_y" value="5.0*m" /> + <constant name="world_z" value="5.0*m" /> + <constant name="box_x" value="1.0*m" /> + <constant name="box_y" value="1.0*m" /> + <constant name="box_z" value="1.0*m" /> + <position name="TestBeamCalorimeterTest_position" x="0.0" y="0.0" z="10.0" unit="mm" /> + <position name="TestBeamCalorimeterTest_layerType0_slice0_position" x="0.0" y="0.0" z="0.0" unit="mm" /> + <position name="TestBeamCalorimeterTest_layer0_position" x="0.0" y="0.0" z="0.0" unit="mm" /> + </define> + <materials> + <element name="N" formula="N" Z="7.0"> + <atom type="A" unit="g/mol" value="14.00674" /> + </element> + <element name="O" formula="O" Z="8.0"> + <atom type="A" unit="g/mol" value="15.9994" /> + </element> + <element name="Ar" formula="Ar" Z="18.0"> + <atom type="A" unit="g/mol" value="39.948" /> + </element> + <material name="Air"> + <D type="density" unit="g/cm3" value="0.0012" /> + <fraction n="0.754" ref="N" /> + <fraction n="0.234" ref="O" /> + <fraction n="0.012" ref="Ar" /> + </material> + <element name="Fe" formula="Fe" Z="26.0"> + <atom type="A" unit="g/mol" value="55.845" /> + </element> + <element name="C" formula="C" Z="6.0"> + <atom type="A" unit="g/mol" value="12.0107" /> + </element> + <material name="Steel235"> + <D value="7.85" unit="g/cm3" /> + <fraction n="0.998" ref="Fe" /> + <fraction n=".002" ref="C" /> + </material> + </materials> + <solids> + <box name="world_box" x="world_x" y="world_y" z="world_z" /> + <tube name="tracking_cylinder" deltaphi="6.283185307179586" rmin="0.0" rmax="tracking_region_radius" z="tracking_region_zmax" /> + <box name="TestBeamCalorimeterTest_box" x="box_x" y="box_y" z="box_z" /> + <box name="TestBeamCalorimeterTest_layerType0_box" x="box_x" y="box_y" z="box_z" /> + <box name="TestBeamCalorimeterTest_layerType0_slice0_box" x="box_x" y="box_y" z="box_z" /> + </solids> + <structure> + <volume name="TestBeamCalorimeterTest_layerType0_slice0"> + <materialref ref="Steel235" /> + <solidref ref="TestBeamCalorimeterTest_layerType0_slice0_box" /> + <sdref ref="Cal" /> + </volume> + <volume name="TestBeamCalorimeterTest_layerType0"> + <materialref ref="Air" /> + <solidref ref="TestBeamCalorimeterTest_layerType0_box" /> + <physvol> + <volumeref ref="TestBeamCalorimeterTest_layerType0_slice0" /> + <positionref ref="TestBeamCalorimeterTest_layerType0_slice0_position" /> + <rotationref ref="identity_rot" /> + <physvolid field_name="slice" value="1" /> + </physvol> + </volume> + <volume name="TestBeamCalorimeterTest_envelope"> + <materialref ref="Air" /> + <solidref ref="TestBeamCalorimeterTest_box" /> + <physvol> + <volumeref ref="TestBeamCalorimeterTest_layerType0" /> + <positionref ref="TestBeamCalorimeterTest_layer0_position" /> + <rotationref ref="identity_rot" /> + <physvolid field_name="layer" value="2" /> + </physvol> + </volume> + <volume name="tracking_volume"> + <materialref ref="Air" /> + <solidref ref="tracking_cylinder" /> + <physvol> + <volumeref ref="TestBeamCalorimeterTest_envelope" /> + <positionref ref="TestBeamCalorimeterTest_position" /> + <rotationref ref="identity_rot" /> + <physvolid field_name="system" value="3" /> + </physvol> + <regionref ref="TrackingRegion" /> + </volume> + <volume name="world_volume"> + <materialref ref="Air" /> + <solidref ref="world_box" /> + <physvol> + <volumeref ref="tracking_volume" /> + <positionref ref="identity_pos" /> + <rotationref ref="identity_rot" /> + </physvol> + </volume> + </structure> + <setup name="Default" version="1.0"> + <world ref="world_volume" /> + </setup> + </gdml> + <fields /> +</lcdd> +
--- projects/lcdd/branches/v05-00-00-dev/examples/segmentation/CartesianGridXZ.lcdd (rev 0) +++ projects/lcdd/branches/v05-00-00-dev/examples/segmentation/CartesianGridXZ.lcdd 2014-08-12 21:16:43 UTC (rev 3254) @@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?> +<lcdd xmlns:lcdd="http://www.lcsim.org/schemas/lcdd/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcdd/2.0/lcdd.xsd"> + <header> + <detector name="CartesianGridXZ" /> + </header> + <iddict> + <idspec name="CalHits" length="64"> + <idfield signed="true" label="x" length="32" start="0" /> + <idfield signed="true" label="z" length="32" start="32" /> + </idspec> + </iddict> + <sensitive_detectors> + <calorimeter name="Cal" hits_collection="CalHits"> + <idspecref ref="CalHits" /> + <hit_processor type="DDSegmentationCalorimeterHitProcessor" /> + <cartesian_grid_xz grid_size_x="1.0" grid_size_z="1.0" offset_x="0.0" offset_z="0.0" /> + </calorimeter> + </sensitive_detectors> + <limits /> + <regions> + <region name="TrackingRegion" store_secondaries="true" cut="10.0" lunit="mm" threshold="1.0" eunit="MeV" /> + </regions> + <display /> + <gdml> + <define> + <rotation name="identity_rot" x="0.0" y="0.0" z="0.0" unit="radian" /> + <position name="identity_pos" x="0.0" y="0.0" z="0.0" unit="mm" /> + <constant name="tracking_region_radius" value="0.5*m" /> + <constant name="tracking_region_zmax" value="1.0*m" /> + <constant name="world_x" value="5.0*m" /> + <constant name="world_y" value="5.0*m" /> + <constant name="world_z" value="5.0*m" /> + <constant name="box_x" value="1.0*m" /> + <constant name="box_y" value="1.0*m" /> + <constant name="box_z" value="1.0*m" /> + <position name="TestBeamCalorimeterTest_position" x="0.0" y="0.0" z="10.0" unit="mm" /> + <position name="TestBeamCalorimeterTest_layerType0_slice0_position" x="0.0" y="0.0" z="0.0" unit="mm" /> + <position name="TestBeamCalorimeterTest_layer0_position" x="0.0" y="0.0" z="0.0" unit="mm" /> + </define> + <materials> + <element name="N" formula="N" Z="7.0"> + <atom type="A" unit="g/mol" value="14.00674" /> + </element> + <element name="O" formula="O" Z="8.0"> + <atom type="A" unit="g/mol" value="15.9994" /> + </element> + <element name="Ar" formula="Ar" Z="18.0"> + <atom type="A" unit="g/mol" value="39.948" /> + </element> + <material name="Air"> + <D type="density" unit="g/cm3" value="0.0012" /> + <fraction n="0.754" ref="N" /> + <fraction n="0.234" ref="O" /> + <fraction n="0.012" ref="Ar" /> + </material> + <element name="Fe" formula="Fe" Z="26.0"> + <atom type="A" unit="g/mol" value="55.845" /> + </element> + <element name="C" formula="C" Z="6.0"> + <atom type="A" unit="g/mol" value="12.0107" /> + </element> + <material name="Steel235"> + <D value="7.85" unit="g/cm3" /> + <fraction n="0.998" ref="Fe" /> + <fraction n=".002" ref="C" /> + </material> + </materials> + <solids> + <box name="world_box" x="world_x" y="world_y" z="world_z" /> + <tube name="tracking_cylinder" deltaphi="6.283185307179586" rmin="0.0" rmax="tracking_region_radius" z="tracking_region_zmax" /> + <box name="TestBeamCalorimeterTest_box" x="box_x" y="box_y" z="box_z" /> + <box name="TestBeamCalorimeterTest_layerType0_box" x="box_x" y="box_y" z="box_z" /> + <box name="TestBeamCalorimeterTest_layerType0_slice0_box" x="box_x" y="box_y" z="box_z" /> + </solids> + <structure> + <volume name="TestBeamCalorimeterTest_layerType0_slice0"> + <materialref ref="Steel235" /> + <solidref ref="TestBeamCalorimeterTest_layerType0_slice0_box" /> + <sdref ref="Cal" /> + </volume> + <volume name="TestBeamCalorimeterTest_layerType0"> + <materialref ref="Air" /> + <solidref ref="TestBeamCalorimeterTest_layerType0_box" /> + <physvol> + <volumeref ref="TestBeamCalorimeterTest_layerType0_slice0" /> + <positionref ref="TestBeamCalorimeterTest_layerType0_slice0_position" /> + <rotationref ref="identity_rot" /> + <physvolid field_name="slice" value="1" /> + </physvol> + </volume> + <volume name="TestBeamCalorimeterTest_envelope"> + <materialref ref="Air" /> + <solidref ref="TestBeamCalorimeterTest_box" /> + <physvol> + <volumeref ref="TestBeamCalorimeterTest_layerType0" /> + <positionref ref="TestBeamCalorimeterTest_layer0_position" /> + <rotationref ref="identity_rot" /> + <physvolid field_name="layer" value="2" /> + </physvol> + </volume> + <volume name="tracking_volume"> + <materialref ref="Air" /> + <solidref ref="tracking_cylinder" /> + <physvol> + <volumeref ref="TestBeamCalorimeterTest_envelope" /> + <positionref ref="TestBeamCalorimeterTest_position" /> + <rotationref ref="identity_rot" /> + <physvolid field_name="system" value="3" /> + </physvol> + <regionref ref="TrackingRegion" /> + </volume> + <volume name="world_volume"> + <materialref ref="Air" /> + <solidref ref="world_box" /> + <physvol> + <volumeref ref="tracking_volume" /> + <positionref ref="identity_pos" /> + <rotationref ref="identity_rot" /> + </physvol> + </volume> + </structure> + <setup name="Default" version="1.0"> + <world ref="world_volume" /> + </setup> + </gdml> + <fields /> +</lcdd> +
--- projects/lcdd/branches/v05-00-00-dev/include/lcdd/detectors/SensitiveDetectorFactory.hh 2014-08-11 22:58:56 UTC (rev 3253) +++ projects/lcdd/branches/v05-00-00-dev/include/lcdd/detectors/SensitiveDetectorFactory.hh 2014-08-12 21:16:43 UTC (rev 3254) @@ -86,6 +86,12 @@
*/ static bool isSegmentationTag(const std::string& s);
+ /** + * Create a DDSegmentation Segmentation object, if found in the XML content, + * and register it with the CalorimeterSD. + * @param[in] calorimeter The CalorimeterSD which will use the Segmentation. + * @param[in] seq The XML content of the calorimeter element. + */
static void createDDSegmentation(CalorimeterSD* calorimeter, ContentSequence* seq); };
--- projects/lcdd/branches/v05-00-00-dev/include/lcdd/schema/CartesianGridXYZType.hh (rev 0) +++ projects/lcdd/branches/v05-00-00-dev/include/lcdd/schema/CartesianGridXYZType.hh 2014-08-12 21:16:43 UTC (rev 3254) @@ -0,0 +1,44 @@
+/* + * CartesianXYZType.hh + * + * Created on: Aug 11, 2014 + * Author: jeremym + */ +#ifndef LCDD_SCHEMA_CARTESIANXYZTYPE_HH_ +#define LCDD_SCHEMA_CARTESIANXYZTYPE_HH_ 1 + +#include "lcdd/schema/CartesianGridXYType.hh" + +class CartesianGridXYZType : public CartesianGridXYType { + +public: + + CartesianGridXYZType() { + } + + virtual ~CartesianGridXYZType() { + } + + void set_grid_size_z(const std::string grid_size_z) { + _grid_size_z = grid_size_z; + } + + const std::string& get_grid_size_z() { + return _grid_size_z; + } + + void set_offset_z(const std::string offset_z) { + _offset_z = offset_z; + } + + const std::string& get_offset_z() { + return _offset_z; + } + +private: + + std::string _grid_size_z; + std::string _offset_z; +}; + +#endif /* LCDD_SCHEMA_CARTESIANXYZTYPE_HH_ */
--- projects/lcdd/branches/v05-00-00-dev/include/lcdd/schema/CartesianGridXZType.hh (rev 0) +++ projects/lcdd/branches/v05-00-00-dev/include/lcdd/schema/CartesianGridXZType.hh 2014-08-12 21:16:43 UTC (rev 3254) @@ -0,0 +1,63 @@
+/* + * CartesianGridXYType.hh + * + * Created on: Aug 7, 2014 + * Author: jeremym + */ +#ifndef LCDD_SCHEMA_CARTESIANGRIDXZTYPE_HH_ +#define LCDD_SCHEMA_CARTESIANGRIDXZTYPE_HH_ 1 + +// LCDD +#include "SegmentationType.hh" + +class CartesianGridXZType: public SegmentationType { + +public: + + CartesianGridXZType() { + } + + virtual ~CartesianGridXZType() { + } + + void set_grid_size_x(const std::string grid_size_x) { + _grid_size_x = grid_size_x; + } + + const std::string& get_grid_size_x() { + return _grid_size_x; + } + + void set_grid_size_z(const std::string grid_size_z) { + _grid_size_z = grid_size_z; + } + + const std::string& get_grid_size_z() { + return _grid_size_z; + } + + void set_offset_x(const std::string offset_x) { + _offset_x = offset_x; + } + + const std::string& get_offset_x() { + return _offset_x; + } + + void set_offset_z(const std::string offset_z) { + _offset_z = offset_z; + } + + const std::string& get_offset_z() { + return _offset_z; + } + +private: + + std::string _grid_size_x; + std::string _grid_size_z; + std::string _offset_x; + std::string _offset_z; +}; + +#endif /* LCDD_SCHEMA_CARTESIANGRIDXZTYPE_HH_ */
--- projects/lcdd/branches/v05-00-00-dev/include/lcdd/schema/cartesian_grid_xyz.hh (rev 0) +++ projects/lcdd/branches/v05-00-00-dev/include/lcdd/schema/cartesian_grid_xyz.hh 2014-08-12 21:16:43 UTC (rev 3254) @@ -0,0 +1,45 @@
+/* + * cartesian_grid_xy.hh + * + * Created on: Aug 7, 2014 + * Author: jeremym + */ + +#ifndef LCDD_SCHEMA_CARTESIAN_GRID_XYZ_HH_ +#define LCDD_SCHEMA_CARTESIAN_GRID_XYZ_HH_ 1 + +// LCDD +#include "lcdd/schema/CartesianGridXYZType.hh" + +// GDML +#include "Saxana/SAXObject.h" + +/** + * @brief cartesian_grid_xy element from the schema. + */ +class cartesian_grid_xyz: public SAXObject, public CartesianGridXYZType { + +public: + + /** + * Class constructor. + */ + cartesian_grid_xyz() { + } + + /** + * Class destructor. + */ + virtual ~cartesian_grid_xyz() { + } + + /** + * Get the type of this SAXObject. + * @return The type of this SAXObject. + */ + virtual SAXObject::Type type() { + return SAXObject::element; + } +}; + +#endif /* LCDD_SCHEMA_CARTESIAN_GRID_XYZ_HH_ */
--- projects/lcdd/branches/v05-00-00-dev/include/lcdd/schema/cartesian_grid_xz.hh (rev 0) +++ projects/lcdd/branches/v05-00-00-dev/include/lcdd/schema/cartesian_grid_xz.hh 2014-08-12 21:16:43 UTC (rev 3254) @@ -0,0 +1,45 @@
+/* + * cartesian_grid_xy.hh + * + * Created on: Aug 7, 2014 + * Author: jeremym + */ + +#ifndef LCDD_SCHEMA_CARTESIAN_GRID_XZ_HH_ +#define LCDD_SCHEMA_CARTESIAN_GRID_XZ_HH_ 1 + +// LCDD +#include "lcdd/schema/CartesianGridXZType.hh" + +// GDML +#include "Saxana/SAXObject.h" + +/** + * @brief cartesian_grid_xy element from the schema. + */ +class cartesian_grid_xz: public SAXObject, public CartesianGridXZType { + +public: + + /** + * Class constructor. + */ + cartesian_grid_xz() { + } + + /** + * Class destructor. + */ + virtual ~cartesian_grid_xz() { + } + + /** + * Get the type of this SAXObject. + * @return The type of this SAXObject. + */ + virtual SAXObject::Type type() { + return SAXObject::element; + } +}; + +#endif /* LCDD_SCHEMA_CARTESIAN_GRID_XZ_HH_ */
--- projects/lcdd/branches/v05-00-00-dev/include/lcdd/schema/projective_cylinder.hh 2014-08-11 22:58:56 UTC (rev 3253) +++ projects/lcdd/branches/v05-00-00-dev/include/lcdd/schema/projective_cylinder.hh 2014-08-12 21:16:43 UTC (rev 3254) @@ -10,20 +10,20 @@
/** * @brief The projective_cylinder element from the schema. */
-class projective_cylinder: public SAXObject, public ProjectiveCylinderSegmentationType {
+class projective_cylinder_old: public SAXObject, public ProjectiveCylinderSegmentationType {
public: /** * Class constructor. */
- projective_cylinder() {
+ projective_cylinder_old() {
} /** * Class destructor. */
- virtual ~projective_cylinder() {
+ virtual ~projective_cylinder_old() {
} /**
--- projects/lcdd/branches/v05-00-00-dev/schemas/lcdd/2.0/lcdd_sensitive_detectors.xsd 2014-08-11 22:58:56 UTC (rev 3253) +++ projects/lcdd/branches/v05-00-00-dev/schemas/lcdd/2.0/lcdd_sensitive_detectors.xsd 2014-08-12 21:16:43 UTC (rev 3254) @@ -197,7 +197,7 @@
</xs:extension> </xs:complexContent> </xs:complexType>
- <xs:element name="projective_cylinder" substitutionGroup="segmentation" type="ProjectiveCylinderSegmentationType">
+ <xs:element name="projective_cylinder_old" substitutionGroup="segmentation" type="ProjectiveCylinderSegmentationType">
<xs:annotation> <xs:documentation> Projective segmentation element
@@ -223,9 +223,10 @@
Projective ZPlane segmentation element </xs:documentation> </xs:annotation>
- </xs:element>
+ </xs:element>
<!-- Definitions for DDSegmentation types. -->
+
<xs:complexType name="CartesianGridXYType"> <xs:complexContent> <xs:extension base="SegmentationType">
@@ -237,4 +238,27 @@
</xs:complexContent> </xs:complexType> <xs:element name="cartesian_grid_xy" substitutionGroup="segmentation" type="CartesianGridXYType"/>
+ + <xs:complexType name="CartesianGridXYZType"> + <xs:complexContent> + <xs:extension base="CartesianGridXYType"> + <xs:attribute name="grid_size_z" type="xs:double" use="required"/> + <xs:attribute name="offset_z" type="xs:double" default="0.0"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:element name="cartesian_grid_xyz" substitutionGroup="segmentation" type="CartesianGridXYZType"/> + + <xs:complexType name="CartesianGridXZType"> + <xs:complexContent> + <xs:extension base="SegmentationType"> + <xs:attribute name="grid_size_x" type="xs:double" use="required"/> + <xs:attribute name="grid_size_z" type="xs:double" use="required"/> + <xs:attribute name="offset_x" type="xs:double" default="0.0"/> + <xs:attribute name="offset_z" type="xs:double" default="0.0"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:element name="cartesian_grid_xz" substitutionGroup="segmentation" type="CartesianGridXZType"/> +
</xs:schema>
\ No newline at end of file
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/core/LCDDLibLoad.cc 2014-08-11 22:58:56 UTC (rev 3253) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/core/LCDDLibLoad.cc 2014-08-12 21:16:43 UTC (rev 3254) @@ -37,6 +37,8 @@
// DDSegmentation LOAD_COMPONENT (cartesian_grid_xyProcess);
+ LOAD_COMPONENT (cartesian_grid_xzProcess); + LOAD_COMPONENT (cartesian_grid_xyzProcess);
// Ids LOAD_COMPONENT (idspecProcess);
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/DDSegmentationCalorimeterHitProcessor.cc 2014-08-11 22:58:56 UTC (rev 3253) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/DDSegmentationCalorimeterHitProcessor.cc 2014-08-12 21:16:43 UTC (rev 3254) @@ -50,6 +50,9 @@
// Get the Segmentation object. DD4hep::DDSegmentation::Segmentation* segmentation = _calorimeter->getDDSegmentation();
+ if (segmentation == NULL) + G4Exception("", "", FatalException, "A DDSegmentation object was not set on the calorimeter!"); +
// Compute the global midpoint of the step using the pre and post step points. G4ThreeVector globalMidVec = (0.5 * (step->GetPreStepPoint()->GetPosition() + step->GetPostStepPoint()->GetPosition()));
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/SensitiveDetectorFactory.cc 2014-08-11 22:58:56 UTC (rev 3253) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/SensitiveDetectorFactory.cc 2014-08-12 21:16:43 UTC (rev 3254) @@ -9,15 +9,21 @@
#include "lcdd/detectors/BasicTrackerHitProcessor.hh" #include "lcdd/detectors/ScoringTrackerHitProcessor.hh" #include "lcdd/schema/hit_processor.hh"
+#include "lcdd/schema/cartesian_grid_xy.hh" +#include "lcdd/schema/cartesian_grid_xz.hh" +#include "lcdd/schema/cartesian_grid_xyz.hh"
// GDML #include "G4Evaluator/GDMLExpressionEvaluator.h"
-#include "lcdd/schema/cartesian_grid_xy.hh" -
// DD4hep #include "DDSegmentation/CartesianGridXY.h"
+#include "DDSegmentation/CartesianGridXZ.h" +#include "DDSegmentation/CartesianGridXYZ.h" +
using DD4hep::DDSegmentation::CartesianGridXY;
+using DD4hep::DDSegmentation::CartesianGridXZ; +using DD4hep::DDSegmentation::CartesianGridXYZ;
#include <algorithm> #include <exception>
@@ -151,18 +157,21 @@
return sensitiveDetector; }
+// FIXME: The grid size calculations should apply a length unit.
void SensitiveDetectorFactory::createDDSegmentation(CalorimeterSD* calorimeter, ContentSequence* seq) {
+ + GDMLExpressionEvaluator* calc = GDMLProcessor::GetInstance()->GetEvaluator(); +
size_t count = seq->size(); for (size_t i = 0; i < count; i++) { std::string childTag = seq->content(i).tag; const ContentGroup::ContentItem& segitem = seq->content(i);
+ DD4hep::DDSegmentation::Segmentation* segmentation = NULL;
if (childTag == "cartesian_grid_xy") { cartesian_grid_xy* element = dynamic_cast<cartesian_grid_xy*>(segitem.object); CartesianGridXY* cartesianGridXY = new CartesianGridXY(calorimeter->getIdSpec()->getFieldDescription());
- GDMLExpressionEvaluator* calc = GDMLProcessor::GetInstance()->GetEvaluator();
- // FIXME: These calculations should apply a length unit, too.
double gridSizeX, gridSizeY, offsetX, offsetY; gridSizeX = gridSizeY = offsetX = offsetY = 0; std::string rawValue = element->get_grid_size_x();
@@ -180,10 +189,72 @@
cartesianGridXY->setGridSizeX(gridSizeX); cartesianGridXY->setGridSizeY(gridSizeY); cartesianGridXY->setOffsetX(offsetX);
- cartesianGridXY->setOffsetX(offsetY);
+ cartesianGridXY->setOffsetY(offsetY);
- calorimeter->setDDSegmentation(cartesianGridXY);
+ segmentation = cartesianGridXY; + + } else if (childTag == "cartesian_grid_xyz") { + cartesian_grid_xyz* element = dynamic_cast<cartesian_grid_xyz*>(segitem.object); + CartesianGridXYZ* cartesianGridXYZ = new CartesianGridXYZ(calorimeter->getIdSpec()->getFieldDescription()); + + double gridSizeX, gridSizeY, gridSizeZ, offsetX, offsetY, offsetZ; + gridSizeX = gridSizeY = gridSizeZ = offsetX = offsetY = offsetZ = 0; + + std::string rawValue = element->get_grid_size_x(); + gridSizeX = calc->Eval(rawValue); + + rawValue = element->get_grid_size_y(); + gridSizeY = calc->Eval(rawValue); + + rawValue = element->get_grid_size_z(); + gridSizeZ = calc->Eval(rawValue); + + rawValue = element->get_offset_x(); + offsetX = calc->Eval(rawValue); + + rawValue = element->get_offset_y(); + offsetY = calc->Eval(rawValue); + + rawValue = element->get_offset_z(); + offsetZ = calc->Eval(rawValue); + + cartesianGridXYZ->setGridSizeX(gridSizeX); + cartesianGridXYZ->setGridSizeY(gridSizeY); + cartesianGridXYZ->setGridSizeZ(gridSizeZ); + cartesianGridXYZ->setOffsetX(offsetX); + cartesianGridXYZ->setOffsetY(offsetY); + cartesianGridXYZ->setOffsetZ(offsetZ); + + segmentation = cartesianGridXYZ; + } else if (childTag == "cartesian_grid_xz") { + cartesian_grid_xz* element = dynamic_cast<cartesian_grid_xz*>(segitem.object); + CartesianGridXZ* cartesianGridXZ = new CartesianGridXZ(calorimeter->getIdSpec()->getFieldDescription()); + + double gridSizeX, gridSizeZ, offsetX, offsetZ; + gridSizeX = gridSizeZ = offsetX = offsetZ = 0; + + std::string rawValue = element->get_grid_size_x(); + gridSizeX = calc->Eval(rawValue); + + rawValue = element->get_grid_size_z(); + gridSizeZ = calc->Eval(rawValue); + + rawValue = element->get_offset_x(); + offsetX = calc->Eval(rawValue); + + rawValue = element->get_offset_z(); + offsetZ = calc->Eval(rawValue); + + cartesianGridXZ->setGridSizeX(gridSizeX); + cartesianGridXZ->setGridSizeZ(gridSizeZ); + cartesianGridXZ->setOffsetX(offsetX); + cartesianGridXZ->setOffsetZ(offsetZ); + + segmentation = cartesianGridXZ;
}
+ + if (segmentation != NULL) + calorimeter->setDDSegmentation(segmentation);
} }
@@ -241,5 +312,4 @@
// Can they be read from the schema? // http://xerces-c.sourcearchive.com/documentation/3.1.1-1/SchemaGrammar_8hpp_source.html return (s == "projective_cylinder" || s == "grid_xyz" || s == "global_grid_xy" || s == "projective_zplane" || s == "cell_readout_2d");
- //|| s == "cartesian_grid_xy");
}
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/processes/cartesian_grid_xyzProcess.cc (rev 0) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/processes/cartesian_grid_xyzProcess.cc 2014-08-12 21:16:43 UTC (rev 3254) @@ -0,0 +1,84 @@
+/* + * cartesian_grid_xyzProcess.cc + * + * Created on: Aug 11, 2014 + * Author: jeremym + */ + +// GDML +#include "Saxana/ProcessingConfigurator.h" +#include "Saxana/ProcessingContext.h" +#include "Saxana/SAXProcessor.h" +#include "Saxana/StateStack.h" +#include "Saxana/SAXProcessingState.h" +#include "Saxana/SAXStateProcess.h" +#include "Saxana/SAXComponentFactory.h" + +#include "lcdd/schema/cartesian_grid_xyz.hh" + +// STL +#include <iostream> + +/** + * @brief The SAX process for cartesian_grid_xyz elements. + */ +class cartesian_grid_xyzProcess: public SAXStateProcess { + +public: + + cartesian_grid_xyzProcess(const ProcessingContext* context = 0) : + SAXStateProcess(context), m_obj(0) { + } + + virtual ~cartesian_grid_xyzProcess() { + } + + virtual const SAXComponentObject* Build() const { + return this; + } + + virtual void StartElement(const std::string& name, const ASCIIAttributeList& attrs) { + std::cout << "cartesian_grid_xyzProcess::StartElement: " << name << std::endl; + + SAXObject** obj = Context()->GetTopObject(); + + cartesian_grid_xyz* element = new cartesian_grid_xyz; + + element->set_grid_size_x(attrs.getValue("grid_size_x")); + element->set_grid_size_y(attrs.getValue("grid_size_y")); + element->set_grid_size_z(attrs.getValue("grid_size_z")); + element->set_offset_x(attrs.getValue("offset_x")); + element->set_offset_y(attrs.getValue("offset_y")); + element->set_offset_z(attrs.getValue("offset_z")); + + std::cout << "grid_size_x: " << element->get_grid_size_x() << std::endl; + std::cout << "grid_size_y: " << element->get_grid_size_y() << std::endl; + std::cout << "grid_size_z: " << element->get_grid_size_z() << std::endl; + std::cout << "offset_x: " << element->get_offset_x() << std::endl; + std::cout << "offset_y: " << element->get_offset_y() << std::endl; + std::cout << "offset_z: " << element->get_offset_y() << std::endl; + + m_obj = element; + *obj = element; + } + + virtual void EndElement(const std::string&) { + } + + virtual void Characters(const std::string&) { + } + + virtual void StackPopNotify(const std::string&) { + } + + virtual const std::string& State() const { + static std::string tag = "cartesian_grid_xyz"; + return tag; + } + +private: + + SAXObject* m_obj; +}; + +DECLARE_PROCESS_FACTORY(cartesian_grid_xyzProcess)
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/processes/cartesian_grid_xzProcess.cc (rev 0) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/processes/cartesian_grid_xzProcess.cc 2014-08-12 21:16:43 UTC (rev 3254) @@ -0,0 +1,81 @@
+/* + * cartesian_grid_xzProcess.cc + * + * Created on: Aug 12, 2014 + * Author: jeremym + */ + +// GDML +#include "Saxana/ProcessingConfigurator.h" +#include "Saxana/ProcessingContext.h" +#include "Saxana/SAXProcessor.h" +#include "Saxana/StateStack.h" +#include "Saxana/SAXProcessingState.h" +#include "Saxana/SAXStateProcess.h" +#include "Saxana/SAXComponentFactory.h" + +// LCDD +#include "lcdd/schema/cartesian_grid_xz.hh" + +// STL +#include <iostream> + +/** + * @brief The SAX process for cell_readout_2d elements. + */ +class cartesian_grid_xzProcess: public SAXStateProcess { + +public: + + cartesian_grid_xzProcess(const ProcessingContext* context = 0) : + SAXStateProcess(context), m_obj(0) { + } + + virtual ~cartesian_grid_xzProcess() { + } + + virtual const SAXComponentObject* Build() const { + return this; + } + + virtual void StartElement(const std::string& name, const ASCIIAttributeList& attrs) { + std::cout << "cartesian_grid_xyProcess::StartElement: " << name << std::endl; + + SAXObject** obj = Context()->GetTopObject(); + + cartesian_grid_xz* element = new cartesian_grid_xz; + + element->set_grid_size_x(attrs.getValue("grid_size_x")); + element->set_grid_size_z(attrs.getValue("grid_size_z")); + element->set_offset_x(attrs.getValue("offset_x")); + element->set_offset_z(attrs.getValue("offset_z")); + + std::cout << "grid_size_x: " << element->get_grid_size_x() << std::endl; + std::cout << "grid_size_y: " << element->get_grid_size_z() << std::endl; + std::cout << "offset_x: " << element->get_offset_x() << std::endl; + std::cout << "offset_y: " << element->get_offset_z() << std::endl; + + m_obj = element; + *obj = element; + } + + virtual void EndElement(const std::string&) { + } + + virtual void Characters(const std::string&) { + } + + virtual void StackPopNotify(const std::string&) { + } + + virtual const std::string& State() const { + static std::string tag = "cartesian_grid_xz"; + return tag; + } + +private: + + SAXObject* m_obj; +}; + +DECLARE_PROCESS_FACTORY(cartesian_grid_xzProcess)
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/processes/projective_cylinderProcess.cc 2014-08-11 22:58:56 UTC (rev 3253) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/processes/projective_cylinderProcess.cc 2014-08-12 21:16:43 UTC (rev 3254) @@ -1,68 +0,0 @@
-// LCDD -#include "lcdd/schema/projective_cylinder.hh" - -// GDML -#include "Saxana/ProcessingConfigurator.h" -#include "Saxana/ProcessingContext.h" -#include "Saxana/SAXProcessor.h" -#include "Saxana/StateStack.h" -#include "Saxana/SAXProcessingState.h" -#include "Saxana/SAXStateProcess.h" -#include "Saxana/SAXComponentFactory.h" - -// STL -#include <iostream> - -/** - * @brief SAX process for projective_cylinder element. - */ -class projective_cylinderProcess: public SAXStateProcess { - -public: - - projective_cylinderProcess(const ProcessingContext* context = 0) : - SAXStateProcess(context), m_obj(0) { - } - - virtual ~projective_cylinderProcess() { - } - - virtual const SAXComponentObject* Build() const { - return this; - } - - virtual void StartElement(const std::string&, const ASCIIAttributeList& attrs) { - //std::cout << "projective_cylinderProcess::StartElement: " << name << std::endl; - - SAXObject** obj = Context()->GetTopObject(); - - projective_cylinder* prj = new projective_cylinder; - - prj->set_ntheta(attrs.getValue("ntheta")); - prj->set_nphi(attrs.getValue("nphi")); - - m_obj = prj; - *obj = prj; - } - - virtual void EndElement(const std::string&) { - } - - virtual void Characters(const std::string&) { - } - - virtual void StackPopNotify(const std::string&) { - } - - virtual const std::string& State() const { - static std::string tag = "projective_cylinder"; - return tag; - } - -private: - - SAXObject* m_obj; -}; - -DECLARE_PROCESS_FACTORY(projective_cylinderProcess) -
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/segmentation/SegmentationFactory.cc 2014-08-11 22:58:56 UTC (rev 3253) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/segmentation/SegmentationFactory.cc 2014-08-12 21:16:43 UTC (rev 3254) @@ -29,7 +29,7 @@
GDMLExpressionEvaluator* calc = GDMLProcessor::GetInstance()->GetEvaluator(); if (tag == "projective_cylinder") {
- projective_cylinder* prj = dynamic_cast<projective_cylinder*>(obj);
+ projective_cylinder_old* prj = dynamic_cast<projective_cylinder_old*>(obj);
if (prj) { int ntheta, nphi; std::string sval = prj->get_ntheta();
Use REPLY-ALL to reply to list
To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1