DD4hep  1.28.0
Detector Description Toolkit for High Energy Physics
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
dd4hep::DetElement Class Reference

Handle class describing a detector element. More...

#include <DetElement.h>

Inheritance diagram for dd4hep::DetElement:
dd4hep::Handle< DetElementObject > dd4hep::align::GlobalDetectorAlignment dd4hep::rec::DetectorSurfaces

Classes

class  DetElementExtension
 Wrapper class for detector element extension objects. More...
 
class  Processor
 Abstract base for processing callbacks to DetElement objects. More...
 

Public Types

enum  CopyParameters {
  COPY_NONE = 0, COPY_PLACEMENT = 1 << 0, COPY_PARENT = 1 << 1, COPY_ALIGNMENT = 1 << 2,
  PROPAGATE_PARENT_ID = 1 << 3, LAST
}
 
enum  UpdateParam {
  CONDITIONS_CHANGED = 1<<0, PLACEMENT_CHANGED = 1<<1, SOMETHING_CHANGED = 1<<2, PLACEMENT_ELEMENT = 1<<20,
  PLACEMENT_HIGHEST = 1<<21, PLACEMENT_DETECTOR = 1<<22, PLACEMENT_NONE
}
 
typedef std::map< std::string, DetElementChildren
 
- Public Types inherited from dd4hep::Handle< DetElementObject >
typedef DetElementObject Object
 Extern accessible definition of the contained element type. More...
 
typedef Handle< DetElementObjectBase
 Self type: used by sub-classes. More...
 

Public Member Functions

void check (bool condition, const std::string &msg) const
 Internal assert function to check conditions. More...
 
 DetElement ()=default
 Default constructor. More...
 
 DetElement (DetElement &&e)=default
 Constructor to move handle. More...
 
 DetElement (const DetElement &e)=default
 Constructor to copy handle. More...
 
 DetElement (Object *obj)
 Constructor to hold handled object. More...
 
 DetElement (Object *obj, const std::string &name, const std::string &type)
 Clone constructor. More...
 
template<typename Q >
 DetElement (const Handle< Q > &e)
 Templated constructor for handle conversions. More...
 
 DetElement (NamedObject *obj)
 Constructor to hold handled object. More...
 
 DetElement (const std::string &name, const std::string &type, int id)
 Constructor for a new subdetector element. More...
 
 DetElement (const std::string &name, int id)
 Constructor for a new subdetector element. More...
 
 DetElement (DetElement parent, const std::string &name, int id)
 Constructor for a new subdetector element. More...
 
DetElementoperator= (DetElement &&sd)=default
 Assignment move operator. More...
 
DetElementoperator= (const DetElement &e)=default
 Assignment copy operator. More...
 
Object_data () const
 Additional data accessor. More...
 
bool operator< (const DetElement e) const
 Operator less to insert into a map. More...
 
template<typename T >
bool operator== (const Handle< T > &e) const
 Equality operator. More...
 
template<typename T >
bool operator!= (const Handle< T > &e) const
 Non-Equality operator. More...
 
DetElement clone (int flag) const
 Clone (Deep copy) the DetElement structure. More...
 
DetElement clone (const std::string &new_name) const
 Clone (Deep copy) the DetElement structure with a new name. More...
 
DetElement clone (const std::string &new_name, int new_id) const
 Clone (Deep copy) the DetElement structure with a new name and new identifier. More...
 
std::pair< DetElement, Volumereflect (const std::string &new_name) const
 Reflect (Deep copy) the DetElement structure with a new name. More...
 
std::pair< DetElement, Volumereflect (const std::string &new_name, int new_id) const
 Reflect (Deep copy) the DetElement structure with a new name and new identifier. More...
 
std::pair< DetElement, Volumereflect (const std::string &new_name, int new_id, SensitiveDetector sd) const
 Reflect (Deep copy) the DetElement structure with a new name and new identifier and new sensitive detector. More...
 
void * addExtension (ExtensionEntry *entry) const
 Add an extension object to the detector element. More...
 
void * extension (unsigned long long int key, bool alert) const
 Access an existing extension object from the detector element. More...
 
template<typename IFACE , typename CONCRETE >
IFACE * addExtension (CONCRETE *c) const
 Extend the detector element with an arbitrary structure accessible by the type. More...
 
template<typename IFACE >
IFACE * extension () const
 Access extension element by the type. More...
 
template<typename IFACE >
IFACE * extension (bool alert) const
 Access extension element by the type. More...
 
template<typename Q , typename T >
void callAtUpdate (unsigned int typ, Q *pointer, void(T::*pmf)(unsigned long typ, DetElement &det, void *opt_par)) const
 Extend the detector element with an arbitrary callback. More...
 
void removeAtUpdate (unsigned int type, void *pointer) const
 Remove callback from object. More...
 
int id () const
 Get the detector identifier. More...
 
DetElementsetCombineHits (bool value, SensitiveDetector &sens)
 Setter: Combine hits attribute. More...
 
bool combineHits () const
 Getter: Combine hits attribute. More...
 
std::string type () const
 Access detector type (structure, tracker, calorimeter, etc.). More...
 
DetElementsetType (const std::string &typ)
 Set detector type (structure, tracker, calorimeter, etc.). More...
 
unsigned int typeFlag () const
 
DetElementsetTypeFlag (unsigned int types)
 Set the flag word encoding detector types ( ideally use dd4hep::DetType for encoding ) More...
 
unsigned int key () const
 Access hash key of this detector element (Only valid once geometry is closed!) More...
 
int level () const
 Access the hierarchical level of the detector element (Only valid once geometry is closed!) More...
 
const std::string & path () const
 Path of the detector element (not necessarily identical to placement path!) More...
 
const std::string & placementPath () const
 Access to the full path to the placed object. More...
 
DetElementsetAttributes (const Detector &description, const Volume &volume, const std::string &region, const std::string &limits, const std::string &vis)
 Set all attributes in one go. More...
 
DetElementsetVisAttributes (const Detector &description, const std::string &name, const Volume &volume)
 Set Visualization attributes to the detector element. More...
 
DetElementsetRegion (const Detector &description, const std::string &name, const Volume &volume)
 Set the regional attributes to the detector element. More...
 
DetElementsetLimitSet (const Detector &description, const std::string &name, const Volume &volume)
 Set the limits to the detector element. More...
 
Volume volume () const
 Access to the logical volume of the detector element's placement. More...
 
Solid solid () const
 Access to the shape of the detector element's placement. More...
 
PlacedVolume placement () const
 Access to the physical volume of this detector element. More...
 
PlacedVolume idealPlacement () const
 Access to the ideal physical volume of this detector element. More...
 
DetElementsetPlacement (const PlacedVolume &volume)
 Set the physical volumes of the detector element. More...
 
VolumeID volumeID () const
 The cached VolumeID of this subdetector element. More...
 
DetElementadd (DetElement sub_element)
 Add new child to the detector structure. More...
 
const Childrenchildren () const
 Access to the list of children. More...
 
DetElement child (const std::string &name) const
 Access to individual children by name. More...
 
DetElement child (const std::string &child_name, bool throw_if_not_found) const
 Access to individual children by name. Have option to not throw an exception. More...
 
DetElement parent () const
 Access to the detector elements's parent. More...
 
DetElement world () const
 Access to the world object. Only possible once the geometry is closed. More...
 
Alignment nominal () const
 Access to the constant ideal (nominal) alignment information. More...
 
Alignment survey () const
 Access to the constant survey alignment information. More...
 
- Public Member Functions inherited from dd4hep::Handle< DetElementObject >
 Handle ()=default
 Default constructor. More...
 
 Handle (Handle< DetElementObject > &&element)=default
 Copy constructor. More...
 
 Handle (const Handle< DetElementObject > &element)=default
 Copy constructor. More...
 
 Handle (DetElementObject *element)
 Initializing constructor from pointer. More...
 
 Handle (Q *element)
 Initializing constructor from unrelated pointer with type checking. More...
 
 Handle (const Handle< Q > &element)
 Initializing constructor from unrelated handle with type checking. More...
 
Handle< DetElementObject > & operator= (Handle< DetElementObject > &&element)=default
 Assignment move operator. More...
 
Handle< DetElementObject > & operator= (const Handle< DetElementObject > &element)=default
 Assignment copy operator. More...
 
bool operator== (const Handle< DetElementObject > &element) const
 Boolean operator == used for RB tree insertions. More...
 
bool operator< (const Handle< DetElementObject > &element) const
 Boolean operator < used for RB tree insertions. More...
 
bool operator> (const Handle< DetElementObject > &element) const
 Boolean operator > used for RB tree insertions. More...
 
bool isValid () const
 Check the validity of the object held by the handle. More...
 
bool operator! () const
 Check the validity of the object held by the handle. More...
 
Handle< DetElementObject > & clear ()
 Release the object held by the handle. More...
 
DetElementObjectoperator-> () const
 Access the held object using the -> operator. More...
 
 operator DetElementObject & () const
 Automatic type conversion to an object references. More...
 
DetElementObjectoperator* () const
 Access the held object using the * operator. More...
 
DetElementObjectptr () const
 Access to the held object. More...
 
Q * _ptr () const
 Access to an unrelated object type. More...
 
Q * data () const
 Access to an unrelated object type. More...
 
Q & object () const
 Access to an unrelated object type. More...
 
DetElementObjectaccess () const
 Checked object access. Throws invalid handle runtime exception if invalid handle. More...
 
const char * name () const
 Access the object name (or "" if not supported by the object) More...
 
const char * name () const
 
const char * name () const
 
void assign (Object *n, const std::string &nam, const std::string &title)
 Assign a new named object. Note: object references must be managed by the user. More...
 
void assign (_Segmentation *s, const std::string &n, const std::string &)
 
void assign (NamedObject *p, const std::string &n, const std::string &t)
 
void destroy ()
 Destroy the underlying object (be careful here: things are not reference counted)! More...
 

Protected Member Functions

void i_addUpdateCall (unsigned int callback_type, const Callback &callback) const
 Internal call to extend the detector element with an arbitrary structure accessible by the type. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from dd4hep::Handle< DetElementObject >
static void bad_assignment (const std::type_info &from, const std::type_info &to)
 Helper routine called when unrelated types are assigned. More...
 
- Public Attributes inherited from dd4hep::Handle< DetElementObject >
DetElementObjectm_element
 Single and only data member: Reference to the actual element. More...
 

Detailed Description

Handle class describing a detector element.

Detector elements (class DetElement are entities which represent subdetectors or sizable parts of a subdetector. A DetElement instance has the means to provide to clients information about

Reflection Note:

Author
M.Frank
Version
1.0

Definition at line 188 of file DetElement.h.

Member Typedef Documentation

◆ Children

typedef std::map<std::string, DetElement> dd4hep::DetElement::Children

Definition at line 206 of file DetElement.h.

Member Enumeration Documentation

◆ CopyParameters

Enumerator
COPY_NONE 
COPY_PLACEMENT 
COPY_PARENT 
COPY_ALIGNMENT 
PROPAGATE_PARENT_ID 
LAST 

Definition at line 208 of file DetElement.h.

◆ UpdateParam

Enumerator
CONDITIONS_CHANGED 
PLACEMENT_CHANGED 
SOMETHING_CHANGED 
PLACEMENT_ELEMENT 
PLACEMENT_HIGHEST 
PLACEMENT_DETECTOR 
PLACEMENT_NONE 

Definition at line 217 of file DetElement.h.

Constructor & Destructor Documentation

◆ DetElement() [1/10]

dd4hep::DetElement::DetElement ( )
default

Default constructor.

◆ DetElement() [2/10]

dd4hep::DetElement::DetElement ( DetElement &&  e)
default

Constructor to move handle.

◆ DetElement() [3/10]

dd4hep::DetElement::DetElement ( const DetElement e)
default

Constructor to copy handle.

◆ DetElement() [4/10]

dd4hep::DetElement::DetElement ( Object obj)
inline

Constructor to hold handled object.

Definition at line 287 of file DetElement.h.

◆ DetElement() [5/10]

DetElement::DetElement ( Object obj,
const std::string &  name,
const std::string &  type 
)

Clone constructor.

Definition at line 39 of file DetElement.cpp.

◆ DetElement() [6/10]

template<typename Q >
dd4hep::DetElement::DetElement ( const Handle< Q > &  e)
inline

Templated constructor for handle conversions.

Definition at line 293 of file DetElement.h.

◆ DetElement() [7/10]

dd4hep::DetElement::DetElement ( NamedObject obj)
inline

Constructor to hold handled object.

Definition at line 296 of file DetElement.h.

◆ DetElement() [8/10]

DetElement::DetElement ( const std::string &  name,
const std::string &  type,
int  id 
)

Constructor for a new subdetector element.

Definition at line 46 of file DetElement.cpp.

◆ DetElement() [9/10]

DetElement::DetElement ( const std::string &  name,
int  id 
)

Constructor for a new subdetector element.

Definition at line 52 of file DetElement.cpp.

◆ DetElement() [10/10]

DetElement::DetElement ( DetElement  parent,
const std::string &  name,
int  id 
)

Constructor for a new subdetector element.

Definition at line 58 of file DetElement.cpp.

Member Function Documentation

◆ _data()

Object& dd4hep::DetElement::_data ( ) const
inline

Additional data accessor.

Definition at line 317 of file DetElement.h.

◆ add()

DetElement & DetElement::add ( DetElement  sub_element)

Add new child to the detector structure.

Add a new child subdetector element.

Definition at line 257 of file DetElement.cpp.

◆ addExtension() [1/2]

template<typename IFACE , typename CONCRETE >
IFACE* dd4hep::DetElement::addExtension ( CONCRETE *  c) const
inline

Extend the detector element with an arbitrary structure accessible by the type.

Definition at line 358 of file DetElement.h.

◆ addExtension() [2/2]

void * DetElement::addExtension ( ExtensionEntry entry) const

Add an extension object to the detector element.

Definition at line 65 of file DetElement.cpp.

◆ callAtUpdate()

template<typename Q , typename T >
void dd4hep::DetElement::callAtUpdate ( unsigned int  typ,
Q *  pointer,
void(T::*)(unsigned long typ, DetElement &det, void *opt_par)  pmf 
) const
inline

Extend the detector element with an arbitrary callback.

Definition at line 372 of file DetElement.h.

◆ check()

void DetElement::check ( bool  condition,
const std::string &  msg 
) const

Internal assert function to check conditions.

Simple checking routine.

Definition at line 250 of file DetElement.cpp.

◆ child() [1/2]

DetElement DetElement::child ( const std::string &  child_name,
bool  throw_if_not_found 
) const

Access to individual children by name. Have option to not throw an exception.

Definition at line 222 of file DetElement.cpp.

◆ child() [2/2]

DetElement DetElement::child ( const std::string &  name) const

Access to individual children by name.

Definition at line 211 of file DetElement.cpp.

◆ children()

const DetElement::Children & DetElement::children ( ) const

Access to the list of children.

Definition at line 206 of file DetElement.cpp.

◆ clone() [1/3]

DetElement DetElement::clone ( const std::string &  new_name) const

Clone (Deep copy) the DetElement structure with a new name.

Definition at line 281 of file DetElement.cpp.

◆ clone() [2/3]

DetElement DetElement::clone ( const std::string &  new_name,
int  new_id 
) const

Clone (Deep copy) the DetElement structure with a new name and new identifier.

Definition at line 285 of file DetElement.cpp.

◆ clone() [3/3]

DetElement DetElement::clone ( int  flag) const

Clone (Deep copy) the DetElement structure.

Definition at line 273 of file DetElement.cpp.

◆ combineHits()

bool DetElement::combineHits ( ) const

Getter: Combine hits attribute.

Definition at line 172 of file DetElement.cpp.

◆ extension() [1/3]

template<typename IFACE >
IFACE* dd4hep::DetElement::extension ( ) const
inline

Access extension element by the type.

Definition at line 363 of file DetElement.h.

◆ extension() [2/3]

template<typename IFACE >
IFACE* dd4hep::DetElement::extension ( bool  alert) const
inline

Access extension element by the type.

Definition at line 367 of file DetElement.h.

◆ extension() [3/3]

void * DetElement::extension ( unsigned long long int  key,
bool  alert 
) const

Access an existing extension object from the detector element.

Definition at line 70 of file DetElement.cpp.

◆ i_addUpdateCall()

void DetElement::i_addUpdateCall ( unsigned int  callback_type,
const Callback callback 
) const
protected

Internal call to extend the detector element with an arbitrary structure accessible by the type.

Definition at line 75 of file DetElement.cpp.

◆ id()

int DetElement::id ( ) const

Get the detector identifier.

Definition at line 168 of file DetElement.cpp.

◆ idealPlacement()

PlacedVolume DetElement::idealPlacement ( ) const

Access to the ideal physical volume of this detector element.

This is the original placement set in the detector constructor. A possible global re-alignment make this value different from the regular placement() call.

Definition at line 311 of file DetElement.cpp.

◆ key()

unsigned int DetElement::key ( ) const

Access hash key of this detector element (Only valid once geometry is closed!)

Definition at line 133 of file DetElement.cpp.

◆ level()

int DetElement::level ( ) const

Access the hierarchical level of the detector element (Only valid once geometry is closed!)

Access the hierarchical level of the detector element.

Definition at line 145 of file DetElement.cpp.

◆ nominal()

Alignment DetElement::nominal ( ) const

Access to the constant ideal (nominal) alignment information.

Access to the alignment information.

Definition at line 184 of file DetElement.cpp.

◆ operator!=()

template<typename T >
bool dd4hep::DetElement::operator!= ( const Handle< T > &  e) const
inline

Non-Equality operator.

Definition at line 330 of file DetElement.h.

◆ operator<()

bool dd4hep::DetElement::operator< ( const DetElement  e) const
inline

Operator less to insert into a map.

Definition at line 322 of file DetElement.h.

◆ operator=() [1/2]

DetElement& dd4hep::DetElement::operator= ( const DetElement e)
default

Assignment copy operator.

◆ operator=() [2/2]

DetElement& dd4hep::DetElement::operator= ( DetElement &&  sd)
default

Assignment move operator.

◆ operator==()

template<typename T >
bool dd4hep::DetElement::operator== ( const Handle< T > &  e) const
inline

Equality operator.

Definition at line 326 of file DetElement.h.

◆ parent()

DetElement DetElement::parent ( ) const

Access to the detector elements's parent.

Definition at line 238 of file DetElement.cpp.

◆ path()

const std::string & DetElement::path ( ) const

Path of the detector element (not necessarily identical to placement path!)

Access the full path of the detector element.

Definition at line 157 of file DetElement.cpp.

◆ placement()

PlacedVolume DetElement::placement ( ) const

Access to the physical volume of this detector element.

This is the current placement value of the detector eleemnt. A possible global re-alignment may alter the value. Hence, it should hence not be cached.

Definition at line 320 of file DetElement.cpp.

◆ placementPath()

const std::string & DetElement::placementPath ( ) const

Access to the full path to the placed object.

Definition at line 85 of file DetElement.cpp.

◆ reflect() [1/3]

std::pair< DetElement, Volume > DetElement::reflect ( const std::string &  new_name) const

Reflect (Deep copy) the DetElement structure with a new name.

Definition at line 293 of file DetElement.cpp.

◆ reflect() [2/3]

std::pair< DetElement, Volume > DetElement::reflect ( const std::string &  new_name,
int  new_id 
) const

Reflect (Deep copy) the DetElement structure with a new name and new identifier.

Definition at line 297 of file DetElement.cpp.

◆ reflect() [3/3]

std::pair< DetElement, Volume > DetElement::reflect ( const std::string &  new_name,
int  new_id,
SensitiveDetector  sd 
) const

Reflect (Deep copy) the DetElement structure with a new name and new identifier and new sensitive detector.

Definition at line 301 of file DetElement.cpp.

◆ removeAtUpdate()

void DetElement::removeAtUpdate ( unsigned int  type,
void *  pointer 
) const

Remove callback from object.

Definition at line 80 of file DetElement.cpp.

◆ setAttributes()

DetElement & DetElement::setAttributes ( const Detector description,
const Volume volume,
const std::string &  region,
const std::string &  limits,
const std::string &  vis 
)

Set all attributes in one go.

Definition at line 379 of file DetElement.cpp.

◆ setCombineHits()

DetElement & DetElement::setCombineHits ( bool  value,
SensitiveDetector sens 
)

Setter: Combine hits attribute.

Definition at line 176 of file DetElement.cpp.

◆ setLimitSet()

DetElement & DetElement::setLimitSet ( const Detector description,
const std::string &  name,
const Volume volume 
)

Set the limits to the detector element.

Definition at line 372 of file DetElement.cpp.

◆ setPlacement()

DetElement & DetElement::setPlacement ( const PlacedVolume volume)

Set the physical volumes of the detector element.

Definition at line 329 of file DetElement.cpp.

◆ setRegion()

DetElement & DetElement::setRegion ( const Detector description,
const std::string &  name,
const Volume volume 
)

Set the regional attributes to the detector element.

Definition at line 365 of file DetElement.cpp.

◆ setType()

DetElement & DetElement::setType ( const std::string &  typ)

Set detector type (structure, tracker, calorimeter, etc.).

Set the type of the sensitive detector.

Definition at line 102 of file DetElement.cpp.

◆ setTypeFlag()

DetElement & DetElement::setTypeFlag ( unsigned int  types)

Set the flag word encoding detector types ( ideally use dd4hep::DetType for encoding )

Set the type of the sensitive detector.

Definition at line 112 of file DetElement.cpp.

◆ setVisAttributes()

DetElement & DetElement::setVisAttributes ( const Detector description,
const std::string &  name,
const Volume volume 
)

Set Visualization attributes to the detector element.

Definition at line 360 of file DetElement.cpp.

◆ solid()

Solid DetElement::solid ( ) const

Access to the shape of the detector element's placement.

Definition at line 356 of file DetElement.cpp.

◆ survey()

Alignment DetElement::survey ( ) const

Access to the constant survey alignment information.

Access to the survey alignment information.

Definition at line 197 of file DetElement.cpp.

◆ type()

std::string DetElement::type ( ) const

Access detector type (structure, tracker, calorimeter, etc.).

Access detector type (structure, tracker, calorimeter, etc.). Required for determination of G4 sensitive detector.

Definition at line 97 of file DetElement.cpp.

◆ typeFlag()

unsigned int DetElement::typeFlag ( ) const

Definition at line 107 of file DetElement.cpp.

◆ volume()

Volume DetElement::volume ( ) const

Access to the logical volume of the detector element's placement.

Access to the logical volume of the placements (all daughters have the same!)

Definition at line 351 of file DetElement.cpp.

◆ volumeID()

dd4hep::VolumeID DetElement::volumeID ( ) const

The cached VolumeID of this subdetector element.

Definition at line 343 of file DetElement.cpp.

◆ world()

DetElement DetElement::world ( ) const

Access to the world object. Only possible once the geometry is closed.

Definition at line 244 of file DetElement.cpp.


The documentation for this class was generated from the following files: