|
||||
File indexing completed on 2025-01-18 10:06:01
0001 #ifndef PARSERS_DETAIL_DETECTOR_H 0002 #define PARSERS_DETAIL_DETECTOR_H 0003 0004 //========================================================================== 0005 // AIDA Detector description implementation 0006 //-------------------------------------------------------------------------- 0007 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) 0008 // All rights reserved. 0009 // 0010 // For the licensing terms see $DD4hepINSTALL/LICENSE. 0011 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. 0012 // 0013 // Author : M.Frank 0014 // 0015 //========================================================================== 0016 0017 /** 0018 * Note: Do NEVER include this file directly! 0019 * 0020 * Also NO header guards! 0021 * Include XML/XMLDetector.h or JSON/Detector.h ! 0022 */ 0023 0024 class TObject; 0025 0026 /// Namespace for the AIDA detector description toolkit 0027 namespace dd4hep { 0028 0029 // Forward declarations 0030 class NamedObject; 0031 0032 /// Namespace for the AIDA detector description toolkit supporting JSON utilities 0033 namespace DD4HEP_DIMENSION_NS { 0034 0035 /// Generic Handle_t class extending the generic handle Dimension 0036 /** 0037 * Helper class to access any field in a xml tag. 0038 * Specialized for attributes of a detector sub-element. 0039 * 0040 * \author M.Frank 0041 * \version 1.0 0042 * \ingroup DD4HEP_XML 0043 */ 0044 struct Component: public Dimension { 0045 /// Constructor from Handle_t 0046 Component(Handle_t e) 0047 : Dimension(e) { 0048 } 0049 /// Constructor from Element 0050 Component(const Element& e) 0051 : Dimension(e) { 0052 } 0053 /// Access material attribute as STL string 0054 std::string materialStr() const; 0055 /// Check if component is sensitive 0056 bool isSensitive() const; 0057 0058 /// Check if component is a radiator (absorber) 0059 bool isRadiator() const; 0060 0061 /// Create a shape using the plugin mechanism from an XML element 0062 TObject* createShape() const; 0063 0064 /// Run a TObject constructor 0065 TObject* runConstructor(const std::string& ctor_typ) const; 0066 }; 0067 0068 /// XML Handle_t class extending the XML handle Dimension 0069 /** 0070 * Helper class to access any field in a xml tag. 0071 * Specialized for some of the attributes of a detector element. 0072 * 0073 * \author M.Frank 0074 * \version 1.0 0075 * \ingroup DD4HEP_XML 0076 */ 0077 struct DetElement: public Dimension { 0078 /// Constructor from Handle_t 0079 DetElement(Handle_t e) 0080 : Dimension(e) { 0081 } 0082 /// Access underlying XML handle object 0083 Handle_t handle() const { 0084 return m_element; 0085 } 0086 0087 /// Access parameters: id 0088 int id() const; 0089 /// Access material attribute as STL string. If not present empty return empty string 0090 std::string materialStr() const; 0091 /// Check if xml detector element is sensitive 0092 bool isSensitive() const; 0093 /// Check if element describes a tracking detector 0094 bool isTracker() const; 0095 /// Check if element describes a calorimetric detector 0096 bool isCalorimeter() const; 0097 /// Check if element is inside the tracking volume 0098 bool isInsideTrackingVolume() const; 0099 /// Helper to check a condition (for debugging) 0100 void check(bool condition, const std::string& msg) const; 0101 /// Access attribute by type 0102 template <typename T> T attr(const XmlChar* tag_value) const { 0103 return m_element.attr < T > (tag_value); 0104 } 0105 }; 0106 0107 } /* End namespace DD4HEP_DIMENSION_NS */ 0108 } /* End namespace dd4hep */ 0109 0110 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |