Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-16 09:03:55

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2017-2018 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Geometry/GeometryContext.hpp"
0012 #include "Acts/Plugins/TGeo/TGeoDetectorElement.hpp"
0013 
0014 #include <map>
0015 #include <memory>
0016 #include <string>
0017 
0018 #include "DD4hep/DetElement.h"
0019 #include "DD4hep/Segmentations.h"
0020 
0021 namespace Acts {
0022 
0023 /// Forward declaration of Digitization module is enough
0024 class DigitizationModule;
0025 class ISurfaceMaterial;
0026 
0027 /// @class DD4hepDetectorElement
0028 ///
0029 /// @brief DetectorElement class implementation for DD4hep geometry
0030 ///
0031 /// DetectorElement plugin for DD4hep detector elements. DD4hep is based on
0032 /// TGeo shapes, therefore the DD4hepDetectorElement inherits from
0033 /// TGeoDetectorElement in order to perform the conversion.
0034 ///
0035 /// The full geometrical information is provided by the TGeoDetectorElement.
0036 /// The DD4hepDetectorElement extends the TGeoDetectorElement by containing a
0037 /// segmentation for the readout.
0038 ///
0039 class DD4hepDetectorElement : public TGeoDetectorElement {
0040  public:
0041   // Define the context type
0042   using DD4hepVolumeID = dd4hep::DDSegmentation::VolumeID;
0043 
0044   /// Broadcast the context type
0045   using ContextType = GeometryContext;
0046 
0047   /// Define a string based story
0048   using Store = std::map<std::string,
0049                          std::vector<std::shared_ptr<DD4hepDetectorElement>>>;
0050 
0051   /// Constructor
0052   /// @param detElement The DD4hep DetElement which should be associated to
0053   /// an ACTS surface
0054   ///
0055   /// @param axes is the axis orientation with respect to the tracking frame
0056   ///        it is a string of the three characters x, y and z (standing for
0057   ///        the three axes) There is a distinction between
0058   /// capital and lower case
0059   /// characters :
0060   ///   - capital      -> positive orientation of the axis
0061   ///       - lower case   -> negative orientation of the axis
0062   ///
0063   ///
0064   /// Example options are:
0065   ///   - "XYZ" -> identical frame definition (default value)
0066   ///   - "YZX" -> node y axis is tracking x axis, etc.
0067   ///       - "XzY" -> negative node z axis is tracking y axis, etc.
0068   /// @param scalor is the scale factor for unit conversion if needed
0069   /// @param isDisc in case the sensitive detector module should be translated
0070   ///        as disc (e.g. for endcaps) this flag should be set to true
0071   /// @note In the translation from a 3D geometry (TGeo) which only knows
0072   ///       tubes to a 2D geometry (Tracking geometry) a distinction if the
0073   ///       module should be described as a cylinder or a disc surface needs to
0074   ///       be done. Since this information can not be taken just from the
0075   ///       geometry description (both can be described as TGeoTubeSeg), one
0076   ///       needs to set the flag 'isDisc' in case a volume with shape \c
0077   ///       TGeoTubeSeg should be translated to a disc surface. Per default it
0078   ///       will be translated into a cylindrical surface.
0079   /// @param material Optional material of detector element
0080   DD4hepDetectorElement(
0081       const dd4hep::DetElement detElement, const std::string& axes = "XYZ",
0082       double scalor = 1., bool isDisc = false,
0083       std::shared_ptr<const ISurfaceMaterial> material = nullptr);
0084 
0085   ~DD4hepDetectorElement() override = default;
0086 
0087   // Give access to the DD4hep detector element
0088   const dd4hep::DetElement& sourceElement() const { return m_detElement; }
0089 
0090  private:
0091   /// DD4hep detector element
0092   dd4hep::DetElement m_detElement;
0093   /// DD4hep segmentation
0094   dd4hep::Segmentation m_segmentation;
0095 };
0096 }  // namespace Acts