![]() |
|
|||
File indexing completed on 2025-07-15 08:14:28
0001 //========================================================================== 0002 // AIDA Detector description implementation 0003 //-------------------------------------------------------------------------- 0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) 0005 // All rights reserved. 0006 // 0007 // For the licensing terms see $DD4hepINSTALL/LICENSE. 0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. 0009 // 0010 // Author : M.Frank 0011 // 0012 //========================================================================== 0013 0014 #ifndef XML_UTILITIES_H 0015 #define XML_UTILITIES_H 0016 0017 // Framework include files 0018 #include <XML/Conversions.h> 0019 #include <XML/XMLElements.h> 0020 #include <XML/VolumeBuilder.h> 0021 #include <DD4hep/Detector.h> 0022 0023 // C/C++ include files 0024 0025 /// Namespace for the AIDA detector description toolkit 0026 namespace dd4hep { 0027 0028 /// Namespace for the AIDA detector description toolkit supporting XML utilities 0029 namespace xml { 0030 0031 /// Create layered transformation from xml information 0032 /** The xml content of the information supposedly looks like this: 0033 * <transformation> 0034 * <position/> 0035 * <rotation x="-90*degree"/> 0036 * <position/> 0037 * <rotation y="-90*degree"/> 0038 * <position x="CutX" 0039 * y=" 0.5*YokeHorHeight" 0040 * z="-0.5*(YokeHorD1+YokeHorA1)"/> 0041 * <rotation x="-HoleAngle"/> 0042 * <position/> 0043 * <rotation z="CutTrapTheta"/> 0044 * </transformation> 0045 * 0046 * Every pair position, rotation will be combined to a Transform3D 0047 * and combined to the resulting transformation. 0048 */ 0049 Transform3D createTransformation(xml::Element element); 0050 0051 /// Create a simple volume using the shape plugin mechanism from the attributes of the XML element 0052 Volume createStdVolume(Detector& description, xml::Element element); 0053 0054 /// Create a volume using the plugin mechanism from the attributes of the XML element 0055 Volume createVolume(Detector& description, const std::string& type, xml::Element element); 0056 0057 0058 /// Create a solid shape using the plugin mechanism from the attributes of the XML element 0059 Solid createShape(Detector& description, const std::string& shape_type, xml::Element element); 0060 0061 0062 /** Create an envelope volume that is placed into the world volume (the parent volume of sdet) from an xml 0063 * element \<envelope/\> with child nodes \<shape/\> and optionally \<position/\> and \<rotation/\>. For special cases 0064 * no volume but an assembly can be created with \<shape type="Assembly"/\>. 0065 * Example: <br> 0066 @verbatim 0067 <envelope vis="ILD_ECALVis"> 0068 <shape type="PolyhedraRegular" numsides="8" rmin="TPC_outer_radius+Ecal_Tpc_gap" rmax="Ecal_outer_radius" 0069 dz="2.*TPC_Ecal_Hcal_barrel_halfZ" material = "Air" /> 0070 <rotation x="0*deg" y="0*deg" z="90*deg-180*deg/8"/> 0071 </envelope> 0072 @endverbatim 0073 * @author S.Lu DESY, F. Gaede CERN/DESY 0074 */ 0075 Volume createPlacedEnvelope( dd4hep::Detector& description, dd4hep::xml::Handle_t e , 0076 dd4hep::DetElement sdet ) ; 0077 0078 /** Sets the type flag specified in the \<type_flags\> element for the given DetElement, example: <br> 0079 @verbatim 0080 <type_flags type=" DetType_TRACKER + DetType_PIXEL + DetType_VERTEX "/> 0081 @endverbatim 0082 * @author F.Gaede, DESY 0083 */ 0084 void setDetectorTypeFlag( dd4hep::xml::Handle_t e, dd4hep::DetElement sdet ) ; 0085 0086 /// Configure volume properties from XML element 0087 /** 0088 * Example: 0089 * <volume> 0090 * <regionref name="world_region"/> 0091 * <limitsetref name="world_limits"/> 0092 * <visref name="world_vis"/> 0093 * </volume> 0094 * 0095 * with 0096 * dd4hep::Detector& detector: Handle to dd4hep Detector instance 0097 * dd4hep::xml::Handle_t element: XML element <volume> 0098 * dd4hep::Volume volume: the volume to be configured. 0099 * bool propagate: apply setting also to all children 0100 * bool ignore_unknown_attr: Ignore unknown attrs 0101 * 0102 * \return Number of properties changed 0103 * 0104 * \author M.Frank 0105 * \version 1.0 0106 * \date 03.03.23 0107 */ 0108 std::size_t configVolume( dd4hep::Detector& detector, 0109 dd4hep::xml::Handle_t element, 0110 dd4hep::Volume volume, 0111 bool propagate, 0112 bool ignore_unknown_attr = false); 0113 0114 /// Configure sensitive detector from XML element 0115 /** 0116 * Example: 0117 * <some-xml-tag debug="true"> 0118 * <combine_hits value="true"/> 0119 * <verbose value="true"/> 0120 * <type value="tracker"/> 0121 * <ecut value="5*keV"/> 0122 * <hits_collection value="hits_collection_5"/> 0123 * </some-xml-tag> 0124 * 0125 * - The debug flag is optional. 0126 * - Not all child nodes are mandatory. 0127 * If not present, the attribute stays unchanged. 0128 * 0129 * \return Number of properties changed 0130 * 0131 * \author M.Frank 0132 * \version 1.0 0133 * \date 03.03.23 0134 */ 0135 std::size_t configSensitiveDetector( dd4hep::Detector& detector, 0136 dd4hep::SensitiveDetector sensitive, 0137 dd4hep::xml::Handle_t element); 0138 0139 } /* End namespace xml */ 0140 } /* End namespace dd4hep */ 0141 #endif // XML_UTILITIES_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |