Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:10:41

0001 #pragma once
0002 
0003 #include <memory>
0004 #include <string>
0005 
0006 // DD4hep
0007 #include "Acts/Digitization/CartesianSegmentation.hpp"
0008 #include "Acts/Digitization/DigitizationModule.hpp"
0009 
0010 #include "DD4hep/DetFactoryHelper.h"
0011 #include "DD4hep/Detector.h"
0012 #include "DD4hep/Objects.h"
0013 #include "DD4hep/Segmentations.h"
0014 #include "DDSegmentation/BitField64.h"
0015 #include "DDSegmentation/CartesianGridXY.h"
0016 #include "DDSegmentation/CartesianGridXYZ.h"
0017 #include "DDSegmentation/PolarGridRPhi.h"
0018 #include "XML/XMLDetector.h"
0019 #include "XML/XMLElements.h"
0020 
0021 namespace Acts {
0022 class DigitizationModule;
0023 }  // namespace Acts
0024 
0025 /** Given a xml element with several daughters with the same name, e.g.
0026  <detector> <layer name="1" /> <layer name="2"> </detector>
0027  this method returns the first daughter of type nodeName whose attribute has a
0028  given value
0029  e.g. returns <layer name="2"/> when called with (detector, "layer", "name",
0030  "1") */
0031 namespace det::utils {
0032 
0033 /// Global method to build an Acts::DigitizationModule with rectangular
0034 /// segmentation.
0035 /// @note This function should be used in order to create the input
0036 /// needed for construction with
0037 /// Acts::ActsExtension(std::shared_ptr<const DigitizationModule>)
0038 /// @param halflengthX The half length in x of the detector module
0039 /// @param halflengthZ The half length in z of the detector module
0040 /// @param thickness The thickness of the detector module
0041 /// @param segmentation the DD4hep segmentation
0042 std::shared_ptr<const Acts::DigitizationModule> rectangleDigiModuleXZ(
0043     double halflengthX, double halflengthZ, double thickness,
0044     const dd4hep::Segmentation& segmentation);
0045 
0046 /// Global method to build an Acts::DigitizationModule with rectangular
0047 /// segmentation.
0048 /// @note This function should be used in order to create the input
0049 /// needed for construction with
0050 /// Acts::ActsExtension(std::shared_ptr<const DigitizationModule>)
0051 /// @param halflengthX The half length in x of the detector module
0052 /// @param halflengthZ The half length in z of the detector module
0053 /// @param thickness The thickness of the detector module
0054 /// @param gridSizeX The grid size in x
0055 /// @param gridSizeY The grid size in y
0056 std::shared_ptr<const Acts::DigitizationModule> rectangleDigiModuleXZ(
0057     double halflengthX, double halflengthZ, double thickness, double gridSizeX,
0058     double gridSizeZ);
0059 
0060 /// Global method to build an Acts::DigitizationModule with trapezoidal
0061 /// segmentation.
0062 /// @note This function should be used in order to create the input
0063 /// needed for construction with
0064 /// Acts::ActsExtension(std::shared_ptr<const DigitizationModule>)
0065 /// @param minHalflengthX The half length in x of the detector module on the
0066 /// negative side of z
0067 /// @param maxHalflengthX The half length in x of the detector module on the
0068 /// positive side of z
0069 /// @param halflengthZ The half length in z of the detector module
0070 /// @param thickness The thickness of the detector module
0071 /// @param segmentation the DD4hep segmentation
0072 std::shared_ptr<const Acts::DigitizationModule> trapezoidalDigiModuleXZ(
0073     double minHalflengthX, double maxHalflengthX, double halflengthZ,
0074     double thickness, const dd4hep::Segmentation& segmentation);
0075 
0076 /// Global method to build an Acts::DigitizationModule with trapezoidal
0077 /// segmentation.
0078 /// @note This function should be used in order to create the input
0079 /// needed for construction with
0080 /// Acts::ActsExtension(std::shared_ptr<const DigitizationModule>)
0081 /// @param minHalflengthX The half length in x of the detector module on the
0082 /// negative side of z
0083 /// @param maxHalflengthX The half length in x of the detector module on the
0084 /// positive side of z
0085 /// @param halflengthZ The half length in z of the detector module
0086 /// @param thickness The thickness of the detector module
0087 /// @param gridSizeX The grid size in x
0088 /// @param gridSizeY The grid size in y
0089 std::shared_ptr<const Acts::DigitizationModule> trapezoidalDigiModuleXZ(
0090     double minHalflengthX, double maxHalflengthX, double halflengthZ,
0091     double thickness, double gridSizeX, double gridSizeZ);
0092 
0093 /// @brief Retrieves the node component from a mother by the string names
0094 /// @param mother The Handle to the mother volume
0095 /// @param nodeName The name of the note
0096 /// @param attrName The name of the Attribute
0097 /// @param attrValue The attribute value
0098 dd4hep::xml::Component getNodeByStrAttr(const dd4hep::xml::Handle_t& mother,
0099                                         const std::string& nodeName,
0100                                         const std::string& attrName,
0101                                         const std::string& attrValue);
0102 
0103 /// try to get attribute with double value, return defaultValue if attribute
0104 /// not found
0105 double getAttrValueWithFallback(const dd4hep::xml::Component& node,
0106                                 const std::string& attrName,
0107                                 const double& defaultValue);
0108 }  // namespace det::utils