DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
SegmentationsInterna.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DD4HEP_DETAIL_SEGMENTATIONSINTERNA_H
14 #define DD4HEP_DETAIL_SEGMENTATIONSINTERNA_H
15 
16 // Framework include files
17 #include <DD4hep/Handle.h>
18 #include <DD4hep/Objects.h>
19 #include <DD4hep/BitFieldCoder.h>
20 
21 // C/C++ include files
22 
24 namespace dd4hep {
25 
26  // Forward declarations
27  class DetElementObject;
28  class SegmentationObject;
29  class SensitiveDetectorObject;
30 
31  namespace DDSegmentation {
32  class Segmentation;
33  class SegmentationParameter;
35  typedef std::vector<Parameter> Parameters;
36  }
37 
39 
47  public:
51  virtual ~SegmentationObject();
53  std::string fieldDescription() const;
55  const std::string& name() const;
57  void setName(const std::string& value);
58 
60  const std::string& type() const;
62  const std::string& description() const;
64  const BitFieldCoder* decoder() const;
66  void setDecoder(const BitFieldCoder* decoder) const;
68  DDSegmentation::Parameter parameter(const std::string& parameterName) const;
73 
75  Position position(const CellID& cellID) const;
78  CellID cellID(const Position& localPosition,
79  const Position& globalPosition,
80  const VolumeID& volumeID) const;
82  VolumeID volumeID(const CellID& cellID) const;
84  void neighbours(const CellID& cellID, std::set<CellID>& neighbours) const;
85 
87  unsigned long magic;
90  unsigned char useForHitPosition;
97  };
98 
100 
105  template <typename IMP> class SegmentationWrapper : public SegmentationObject {
106  public:
109  public:
110 #if defined(G__ROOT) || defined(__CLANG__) || defined(__ROOTCLING__)
113 #endif
117  virtual ~SegmentationWrapper();
118  };
119 
121  template <typename IMP> inline
123  : SegmentationObject(implementation=new IMP(decode))
124  {
125  }
126 
128  template <typename IMP> inline SegmentationWrapper<IMP>::~SegmentationWrapper() {
129  }
130 
131  namespace {
132  template<typename T> SegmentationObject*
133  create_segmentation(const BitFieldCoder* decoder) {
134  return new SegmentationWrapper<T>(decoder);
135  }
136  }
137 
138 } /* End namespace dd4hep */
139 #endif // DD4HEP_DETAIL_SEGMENTATIONSINTERNA_H
dd4hep::SegmentationObject::volumeID
VolumeID volumeID(const CellID &cellID) const
Determine the volume ID from the full cell ID by removing all local fields.
Definition: SegmentationsInterna.cpp:100
dd4hep::SegmentationObject::parameters
DDSegmentation::Parameters parameters() const
Access to all parameters.
Definition: SegmentationsInterna.cpp:78
Objects.h
dd4hep::SegmentationObject::SegmentationObject
SegmentationObject(DDSegmentation::Segmentation *seg=0)
Standard constructor.
Definition: SegmentationsInterna.cpp:23
dd4hep::DDSegmentation::Parameter
SegmentationParameter * Parameter
Definition: SegmentationsInterna.h:33
dd4hep::SegmentationObject::segmentation
DDSegmentation::Segmentation * segmentation
Reference to base segmentation.
Definition: SegmentationsInterna.h:96
dd4hep::DDSegmentation::BitFieldCoder
Helper class for decoding and encoding a bit field of 64bits for convenient declaration.
Definition: BitFieldCoder.h:114
dd4hep::SegmentationObject::neighbours
void neighbours(const CellID &cellID, std::set< CellID > &neighbours) const
Calculates the neighbours of the given cell ID and adds them to the list of neighbours.
dd4hep::SegmentationObject::~SegmentationObject
virtual ~SegmentationObject()
Default destructor.
Definition: SegmentationsInterna.cpp:31
dd4hep::SegmentationObject::sensitive
Handle< SensitiveDetectorObject > sensitive
Reference to hosting top level sensitve detector structure.
Definition: SegmentationsInterna.h:94
Handle.h
dd4hep::Handle< DetElementObject >
dd4hep::SegmentationObject
Implementation class supporting generic Segmentation of sensitive detectors.
Definition: SegmentationsInterna.h:46
dd4hep::DDSegmentation::SegmentationParameter
Class to hold a segmentation parameter with its description.
Definition: SegmentationParameter.h:107
dd4hep::SegmentationWrapper::~SegmentationWrapper
virtual ~SegmentationWrapper()
Default destructor.
Definition: SegmentationsInterna.h:128
dd4hep::SegmentationObject::useForHitPosition
unsigned char useForHitPosition
Flag to use segmentation for hit positioning.
Definition: SegmentationsInterna.h:90
dd4hep::SegmentationWrapper
Concrete wrapper class for segmentation implementation based on DDSegmentation objects.
Definition: SegmentationsInterna.h:105
dd4hep::DDSegmentation::Parameters
std::vector< Parameter > Parameters
Definition: SegmentationsInterna.h:35
dd4hep::SegmentationObject::description
const std::string & description() const
Access the description of the segmentation.
Definition: SegmentationsInterna.cpp:58
dd4hep::SegmentationWrapper::implementation
IMP * implementation
DDSegmentation aggregate.
Definition: SegmentationsInterna.h:108
dd4hep::SegmentationWrapper::SegmentationWrapper
SegmentationWrapper(const BitFieldCoder *decoder)
Standard constructor.
Definition: SegmentationsInterna.h:122
dd4hep::SegmentationObject::detector
Handle< DetElementObject > detector
Reference to hosting top level DetElement structure.
Definition: SegmentationsInterna.h:92
dd4hep::SegmentationObject::type
const std::string & type() const
Access the segmentation type.
Definition: SegmentationsInterna.cpp:53
dd4hep::SegmentationObject::name
const std::string & name() const
Access the segmentation name.
Definition: SegmentationsInterna.cpp:44
dd4hep::Position
ROOT::Math::XYZVector Position
Definition: Objects.h:81
dd4hep::SegmentationObject::magic
unsigned long magic
Magic word to check object integrity.
Definition: SegmentationsInterna.h:88
VolumeID
dd4hep::DDSegmentation::VolumeID VolumeID
Definition: SegmentationDictionary.h:49
dd4hep::SegmentationObject::setParameters
void setParameters(const DDSegmentation::Parameters &parameters)
Set all parameters from an existing set of parameters.
Definition: SegmentationsInterna.cpp:83
dd4hep::SegmentationObject::cellID
CellID cellID(const Position &localPosition, const Position &globalPosition, const VolumeID &volumeID) const
Determine the cell ID based on the position.
Definition: SegmentationsInterna.cpp:93
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::SegmentationObject::position
Position position(const CellID &cellID) const
Determine the local position based on the cell ID.
Definition: SegmentationsInterna.cpp:88
dd4hep::SegmentationObject::decoder
const BitFieldCoder * decoder() const
Access the underlying decoder.
Definition: SegmentationsInterna.cpp:63
dd4hep::SegmentationObject::fieldDescription
std::string fieldDescription() const
Access the encoding string.
Definition: SegmentationsInterna.cpp:39
dd4hep::DDSegmentation::Segmentation
Base class for all segmentations.
Definition: Segmentation.h:75
BitFieldCoder.h
dd4hep::SegmentationObject::parameter
DDSegmentation::Parameter parameter(const std::string &parameterName) const
Access to parameter by name.
Definition: SegmentationsInterna.cpp:73
dd4hep::SegmentationObject::setDecoder
void setDecoder(const BitFieldCoder *decoder) const
Set the underlying decoder.
Definition: SegmentationsInterna.cpp:68
dd4hep::SegmentationObject::setName
void setName(const std::string &value)
Set the segmentation name.
Definition: SegmentationsInterna.cpp:48
CellID
dd4hep::DDSegmentation::CellID CellID
Definition: SegmentationDictionary.h:50