Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-03-13 08:19:43

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 // Framework include files
0015 #include <DD4hep/detail/SegmentationsInterna.h>
0016 #include <DD4hep/InstanceCount.h>
0017 
0018 #include <DDSegmentation/Segmentation.h>
0019 
0020 using namespace dd4hep;
0021 
0022 /// Standard constructor
0023 SegmentationObject::SegmentationObject(DDSegmentation::Segmentation* s)
0024   : magic(magic_word()), useForHitPosition(0),
0025     detector(0), sensitive(0), segmentation(s)
0026 {
0027   InstanceCount::increment(this);
0028 }
0029 
0030 /// Default destructor
0031 SegmentationObject::~SegmentationObject() {
0032   InstanceCount::decrement(this);
0033   if (segmentation) {
0034     delete segmentation;
0035   }
0036 }
0037 
0038 /// Access the encoding string
0039 std::string SegmentationObject::fieldDescription() const {
0040   return segmentation->fieldDescription();
0041 }
0042 
0043 /// Access the segmentation name
0044 const std::string& SegmentationObject::name() const {
0045   return segmentation->name();
0046 }
0047 /// Set the segmentation name
0048 void SegmentationObject::setName(const std::string& value) {
0049   segmentation->setName(value);
0050 }
0051 
0052 /// Access the segmentation type
0053 const std::string& SegmentationObject::type() const {
0054   return segmentation->type();
0055 }
0056 
0057 /// Access the description of the segmentation
0058 const std::string& SegmentationObject::description() const {
0059   return segmentation->description();
0060 }
0061 
0062 /// Access the underlying decoder
0063 const BitFieldCoder* SegmentationObject::decoder() const {
0064   return segmentation->decoder();
0065 }
0066 
0067 /// Set the underlying decoder
0068 void SegmentationObject::setDecoder(const BitFieldCoder* ptr_decoder) const {
0069   segmentation->setDecoder(ptr_decoder);
0070 }
0071 
0072 /// Access to parameter by name
0073 DDSegmentation::Parameter SegmentationObject::parameter(const std::string& parameterName) const {
0074   return segmentation->parameter(parameterName);
0075 }
0076 
0077 /// Access to all parameters
0078 DDSegmentation::Parameters SegmentationObject::parameters() const {
0079   return segmentation->parameters();
0080 }
0081 
0082 /// Set all parameters from an existing set of parameters
0083 void SegmentationObject::setParameters(const DDSegmentation::Parameters& params) {
0084   segmentation->setParameters(params);
0085 }
0086 
0087 /// Determine the local position based on the cell ID
0088 Position SegmentationObject::position(const CellID& cell) const  {
0089   return Position(segmentation->position(cell));
0090 }
0091 
0092 /// Determine the cell ID based on the position
0093 CellID SegmentationObject::cellID(const Position& local,
0094                                   const Position& global,
0095                                   const VolumeID& volID) const  {
0096   return segmentation->cellID(local, global, volID);
0097 }
0098 
0099 /// Determine the volume ID from the full cell ID by removing all local fields
0100 VolumeID SegmentationObject::volumeID(const CellID& cell) const   {
0101   return segmentation->volumeID(cell);
0102 }