Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:11:51

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 #ifndef DD4HEP_SEGMENTATIONS_H
0014 #define DD4HEP_SEGMENTATIONS_H
0015 
0016 // Framework include files
0017 #include <DD4hep/Handle.h>
0018 #include <DD4hep/Objects.h>
0019 #include <DD4hep/BitFieldCoder.h>
0020 #include <DDSegmentation/Segmentation.h>
0021 
0022 /// Namespace for the AIDA detector description toolkit
0023 namespace dd4hep {
0024 
0025   /// Forward declarations
0026   class DetElementObject;
0027   class SegmentationObject;
0028   class SensitiveDetectorObject;
0029   template <typename T> class SegmentationWrapper;
0030 
0031   /// Handle class supporting generic Segmentations of sensitive detectors
0032   /**
0033    *   This basic segmentation implementation supports "generic" access
0034    *   to specific segmentations exporting the common abstract interface.
0035    *   Mostly used in simulation.
0036    *
0037    *   \author  M.Frank
0038    *   \version 1.0
0039    *   \ingroup DD4HEP_CORE
0040    */
0041   class Segmentation : public Handle<SegmentationObject> {
0042   public:
0043     /// Initializing constructor creating a new object of the given DDSegmentation type
0044     Segmentation(const std::string& type, const std::string& name, const BitFieldCoder* decoder);
0045     /// Default constructor
0046     Segmentation() = default;
0047     /// Move Constructor
0048     Segmentation(Segmentation&& e) = default;
0049     /// Copy Constructor
0050     Segmentation(const Segmentation& e) = default;
0051 #ifndef __CINT__
0052     /// Move Constructor from handle
0053     Segmentation(Handle<Object>&& e) : Handle<Object>(e) { }
0054     /// Copy Constructor from handle
0055     Segmentation(const Handle<Object>& e) : Handle<Object>(e) { }
0056 #endif
0057     /// Constructor to be used when reading the already parsed object
0058     template <typename Q> Segmentation(const Handle<Q>& e) : Handle<Object>(e) { }
0059     /// Move Assignment operator
0060     Segmentation& operator=(Segmentation&& seg) = default;
0061     /// Copy Assignment operator
0062     Segmentation& operator=(const Segmentation& seg) = default;
0063     /// Access flag for hit positioning
0064     bool useForHitPosition() const;
0065     /// Accessor: Segmentation type
0066     const char* name() const;
0067     /// Accessor: Segmentation type
0068     std::string type() const;
0069     /// Access to the parameters
0070     DDSegmentation::Parameters parameters() const;
0071     /// Access to parameter by name
0072     DDSegmentation::Parameter  parameter(const std::string& parameterName) const;
0073     /// Access the main detector element using this segmentation object
0074     Handle<DetElementObject> detector() const;
0075     /// Access the sensitive detector using this segmentation object
0076     Handle<SensitiveDetectorObject> sensitive() const;
0077     /// Access the underlying decoder
0078     const BitFieldCoder* decoder() const;
0079     /// Set the underlying decoder
0080     void setDecoder(const BitFieldCoder* decoder) const;
0081     /// determine the local position based on the cell ID
0082     Position position(const CellID& cellID) const;
0083     /// determine the cell ID based on the local position
0084     CellID cellID(const Position& localPosition, const Position& globalPosition, const VolumeID& volumeID) const;
0085     /// Determine the volume ID from the full cell ID by removing all local fields
0086     VolumeID volumeID(const CellID& cellID) const;
0087     /// Calculates the neighbours of the given cell ID and adds them to the list of neighbours
0088     void neighbours(const CellID& cellID, std::set<CellID>& neighbours) const;
0089     /** \brief Returns a vector<double> of the cellDimensions of the given cell ID
0090      *  in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi
0091      *
0092      *   \param cellID cellID of the cell for which parameters are returned
0093      *   \return vector<double> in natural order of dimensions, e.g., dx/dy/dz, or dr/r*dPhi
0094      */
0095     std::vector<double> cellDimensions(const CellID& cellID) const;
0096     /// Return true if this segmentation can have cells that span multiple
0097     /// volumes.  That is, points from multiple distinct volumes may
0098     /// be assigned to the same cell.
0099     /// In that case, a working volumeID() implementation is required.
0100     bool cellsSpanVolumes() const;
0101       
0102     /// Access to the base DDSegmentation object. WARNING: Deprecated call!
0103     DDSegmentation::Segmentation* segmentation() const;
0104   };
0105 } /* End namespace dd4hep                */
0106 #endif // DD4HEP_SEGMENTATIONS_H