|
||||
File indexing completed on 2025-01-18 09:13:39
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 #include <set> 0025 #include <map> 0026 0027 /// Namespace for the AIDA detector description toolkit 0028 namespace dd4hep { 0029 0030 /// Namespace for the AIDA detector description toolkit supporting XML utilities 0031 namespace xml { 0032 0033 /// Create layered transformation from xml information 0034 /** The xml content of the information supposedly looks like this: 0035 * <transformation> 0036 * <position/> 0037 * <rotation x="-90*degree"/> 0038 * <position/> 0039 * <rotation y="-90*degree"/> 0040 * <position x="CutX" 0041 * y=" 0.5*YokeHorHeight" 0042 * z="-0.5*(YokeHorD1+YokeHorA1)"/> 0043 * <rotation x="-HoleAngle"/> 0044 * <position/> 0045 * <rotation z="CutTrapTheta"/> 0046 * </transformation> 0047 * 0048 * Every pair position, rotation will be combined to a Transform3D 0049 * and combined to the resulting transformation. 0050 */ 0051 Transform3D createTransformation(xml::Element element); 0052 0053 /// Create a simple volume using the shape plugin mechanism from the attributes of the XML element 0054 Volume createStdVolume(Detector& description, xml::Element element); 0055 0056 /// Create a volume using the plugin mechanism from the attributes of the XML element 0057 Volume createVolume(Detector& description, const std::string& type, xml::Element element); 0058 0059 0060 /// Create a solid shape using the plugin mechanism from the attributes of the XML element 0061 Solid createShape(Detector& description, const std::string& shape_type, xml::Element element); 0062 0063 0064 /** Create an envelope volume that is placed into the world volume (the parent volume of sdet) from an xml 0065 * element \<envelope/\> with child nodes \<shape/\> and optionally \<position/\> and \<rotation/\>. For special cases 0066 * no volume but an assembly can be created with \<shape type="Assembly"/\>. 0067 * Example: <br> 0068 @verbatim 0069 <envelope vis="ILD_ECALVis"> 0070 <shape type="PolyhedraRegular" numsides="8" rmin="TPC_outer_radius+Ecal_Tpc_gap" rmax="Ecal_outer_radius" 0071 dz="2.*TPC_Ecal_Hcal_barrel_halfZ" material = "Air" /> 0072 <rotation x="0*deg" y="0*deg" z="90*deg-180*deg/8"/> 0073 </envelope> 0074 @endverbatim 0075 * @author S.Lu DESY, F. Gaede CERN/DESY 0076 */ 0077 Volume createPlacedEnvelope( dd4hep::Detector& description, dd4hep::xml::Handle_t e , 0078 dd4hep::DetElement sdet ) ; 0079 0080 /** Sets the type flag specified in the \<type_flags\> element for the given DetElement, example: <br> 0081 @verbatim 0082 <type_flags type=" DetType_TRACKER + DetType_PIXEL + DetType_VERTEX "/> 0083 @endverbatim 0084 * @author F.Gaede, DESY 0085 */ 0086 void setDetectorTypeFlag( dd4hep::xml::Handle_t e, dd4hep::DetElement sdet ) ; 0087 0088 /// Configure volume properties from XML element 0089 /** 0090 * Example: 0091 * <volume> 0092 * <regionref name="world_region"/> 0093 * <limitsetref name="world_limits"/> 0094 * <visref name="world_vis"/> 0095 * </volume> 0096 * 0097 * with 0098 * dd4hep::Detector& detector: Handle to dd4hep Detector instance 0099 * dd4hep::xml::Handle_t element: XML element <volume> 0100 * dd4hep::Volume volume: the volume to be configured. 0101 * bool propagate: apply setting also to all children 0102 * bool ignore_unknown_attr: Ignore unknown attrs 0103 * 0104 * \return Number of properties changed 0105 * 0106 * \author M.Frank 0107 * \version 1.0 0108 * \date 03.03.23 0109 */ 0110 std::size_t configVolume( dd4hep::Detector& detector, 0111 dd4hep::xml::Handle_t element, 0112 dd4hep::Volume volume, 0113 bool propagate, 0114 bool ignore_unknown_attr = false); 0115 0116 /// Configure sensitive detector from XML element 0117 /** 0118 * Example: 0119 * <some-xml-tag debug="true"> 0120 * <combine_hits value="true"/> 0121 * <verbose value="true"/> 0122 * <type value="tracker"/> 0123 * <ecut value="5*keV"/> 0124 * <hits_collection value="hits_collection_5"/> 0125 * </some-xml-tag> 0126 * 0127 * - The debug flag is optional. 0128 * - Not all child nodes are mandatory. 0129 * If not present, the attribute stays unchanged. 0130 * 0131 * \return Number of properties changed 0132 * 0133 * \author M.Frank 0134 * \version 1.0 0135 * \date 03.03.23 0136 */ 0137 std::size_t configSensitiveDetector( dd4hep::Detector& detector, 0138 dd4hep::SensitiveDetector sensitive, 0139 dd4hep::xml::Handle_t element); 0140 0141 } /* End namespace xml */ 0142 } /* End namespace dd4hep */ 0143 #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 |