14 #ifndef DD4HEP_DETECTOR_H
15 #define DD4HEP_DETECTOR_H
38 class DetElementObject;
39 class SensitiveDetectorObject;
63 void*
i_addExtension(
void*
ptr,
const std::type_info& info,
void (*destruct)(
void*));
66 void*
i_extension(
const std::type_info& info)
const;
92 std::string
type()
const;
140 template <
typename IFACE,
typename CONCRETE> IFACE*
addExtension(CONCRETE* c) {
141 return (IFACE*)
i_addExtension(dynamic_cast<IFACE*>(c),
typeid(IFACE), _delete<IFACE>);
202 typedef std::map<std::string, DetElement>
Children;
220 void check(
bool condition,
const std::string& msg)
const;
225 template <
typename T>
static void _delete(
void* ptr) {
230 return new T(*(dynamic_cast<const T*>((
T*) ptr)), elt);
236 void*
i_extension(
const std::type_info& info)
const;
274 return object<Object>();
297 template <
typename IFACE,
typename CONCRETE> IFACE*
addExtension(CONCRETE* c)
const {
299 return (IFACE*)
i_addExtension(dynamic_cast<IFACE*>(c),
typeid(IFACE), _copy<CONCRETE>, _delete<IFACE>);
306 template <
typename Q,
typename T>
308 void (
T::*pmf)(
unsigned long typ,
DetElement& det,
void* opt_par))
const
326 std::string
type()
const;
337 unsigned int key()
const;
341 const std::string&
path()
const;
347 const std::string& vis);
SensitiveDetector & setVerbose(bool value)
Set flag to handle hits collection.
Handle class to hold the information of a sensitive detector.
bool hasAlignments() const
Check if this DetElement has time dependent Alignments attached.
void(* destruct_t)(void *)
Extensions destructor type.
SensitiveDetector & setHitsCollection(const std::string &spec)
Assign the name of the hits collection.
DetElement(Object *object_ptr)
Constructor to hold handled object.
SensitiveDetector & operator=(const SensitiveDetector &sd)=default
Assignment operator.
Handle class holding a placed volume (also called physical volume)
virtual ~Processor()
Default destructor.
DetElement world() const
Access to the world object. Only possible once the geometry is closed.
bool operator<(const DetElement e) const
Operator less to insert into a map.
SensitiveDetectorObject Object
Internal object type.
Volume volume() const
Access to the logical volume of the detector element's placement.
bool hasConditions() const
Check if this DetElement has time dependent Conditions attached.
Handle< SensitiveDetectorObject > RefObject
Definition of the base handle type.
const char * name() const
Access the object name (or "" if not supported by the object)
DetElement & setLimitSet(const LCDD &lcdd, const std::string &name, const Volume &volume)
Set the limits to the detector element.
Alignment nominal() const
Access to the constant ideal (nominal) alignment information.
Data class with properties of sensitive detectors.
const std::string & hitsCollection() const
Access the hits collection name.
void(* destruct_t)(void *)
Extensions destructor type.
Q * data() const
Access to an unrelated object type.
SensitiveDetector(Object *obj_pointer)
Constructor to copy handled object.
SensitiveDetector & setRegion(Region reg)
Set the regional attributes to the sensitive detector.
IFACE * addExtension(CONCRETE *c) const
Extend the detector element with an arbitrary structure accessible by the type.
DetElement & setType(const std::string &typ)
Set detector type (structure, tracker, calorimeter, etc.).
LimitSet limits() const
Access to the limit set of the sensitive detector (not mandatory).
DetElement(const Handle< Q > &e)
Templated constructor for handle conversions.
bool operator==(const DetElement e) const
Equality operator.
virtual int processElement(DetElement detector)=0
Container callback for object processing.
bool combineHits() const
Getter: Combine hits attribute.
void * i_extension(const std::type_info &info) const
Access an existing extension object from the detector element.
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.
Main handle class to hold an alignment object.
int level() const
Access the hierarchical level of the detector element (Only valid once geometry is closed!) ...
DetElement & setVisAttributes(const LCDD &lcdd, const std::string &name, const Volume &volume)
Set Visualization attributes to the detector element.
void *(* copy_t)(const void *, DetElement)
Extensions copy constructor type.
SensitiveDetector()
Default constructor.
const Children & children() const
Access to the list of children.
bool parentToLocal(const Position &parent, Position &local) const
Transformation from world coordinates of the local placed volume coordinates.
std::string type() const
Access detector type (structure, tracker, calorimeter, etc.).
SensitiveDetector & setType(const std::string &typ)
Set detector type (structure, tracker, calorimeter, etc.).
SensitiveDetector & setCombineHits(bool value)
Set flag to handle hits collection.
std::map< const std::type_info *, void * > Extensions
DetElement & setRegion(const LCDD &lcdd, const std::string &name, const Volume &volume)
Set the regional attributes to the detector element.
Handle to the implementation of the readout structure of a subdetector.
T * ptr() const
Access to the held object.
unsigned int typeFlag() const
Handle class holding a placed volume (also called physical volume)
Abstract base for processing callbacks to DetElement objects.
void removeAtUpdate(unsigned int type, void *pointer) const
Remove callback from object.
DetElement & add(DetElement sub_element)
Add new child to the detector structure.
DetElement & setTypeFlag(unsigned int types)
Set the flag word encoding detector types ( ideally use DD4hep::DetType for encoding ) ...
DetElement child(const std::string &name) const
Access to individual children by name.
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...
static void checkTypes(const std::type_info &typ1, const std::type_info &typ2, void *test)
Check the compatibility of two typed objects. The test is the result of a dynamic_cast.
SensitiveDetector(const Handle< Q > &e)
Templated constructor for handle conversions.
VolumeID volumeID() const
The cached VolumeID of this subdetector element.
DetElement()
Default constructor.
DetElementObject Object
Internal object type.
Handle< DetElementObject > RefObject
Definition of the base handle type.
DetElement & setPlacement(const PlacedVolume &volume)
Set the physical volumes of the detector element.
Definition of the generic callback structure for member functions.
DetElement & setCombineHits(bool value, SensitiveDetector &sens)
Setter: Combine hits attribute.
DetElement clone(const std::string &new_name) const
Clone (Deep copy) the DetElement structure with a new name.
void * i_addExtension(void *ptr, const std::type_info &info, copy_t ctor, destruct_t dtor) const
Add an extension object to the detector element.
SensitiveDetector & setLimitSet(LimitSet limits)
Set the limits to the sensitive detector.
Processor()
Default constructor.
ROOT::Math::XYZVector Position
Alignments::Alignment Alignment
void check(bool condition, const std::string &msg) const
Internal assert function to check conditions.
bool verbose() const
Access flag to combine hist.
const std::string & path() const
Path of the detector element (not necessarily identical to placement path!)
PlacedVolume placement() const
Access to the physical volume of this detector element.
static void _delete(void *ptr)
Templated destructor function.
int id() const
Get the detector identifier.
DetElement parent() const
Access to the detector elements's parent.
Handle< NamedObject > Ref_t
Default Ref_t definition describing named objects.
Handle class describing a detector element.
Readout readout() const
Access readout structure of the sensitive detector.
Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects...
IFACE * extension() const
Access extension element by the type.
IFACE * extension() const
Access extension element by the type.
bool localToParent(const Position &local, Position &parent) const
Transformation from local coordinates of the placed volume to the parent system.
Handle class describing a set of limits as they are used for simulation.
Object & _data() const
Additional data accessor.
Handle class describing a region as used in simulation.
static void _delete(void *ptr)
Templated destructor function.
The main interface to the DD4hep detector description package.
bool localToWorld(const Position &local, Position &global) const
Create cached matrix to transform to reference coordinates.
IFACE * addExtension(CONCRETE *c)
Extend the sensitive detector element with an arbitrary structure accessible by the type...
DetElement & setAttributes(const LCDD &lcdd, const Volume &volume, const std::string ®ion, const std::string &limits, const std::string &vis)
Set all attributes in one go.
bool worldToLocal(const Position &global, Position &local) const
Transformation from local coordinates of the placed volume to arbitrary parent system set as referenc...
std::map< std::string, DetElement > Children
Data class with properties of a detector element.
unsigned int key() const
Access hash key of this detector element (Only valid once geometry is closed!)
const TGeoHMatrix & parentTransformation() const
Create cached matrix to transform to parent coordinates.
bool combineHits() const
Access flag to combine hist.
std::string type() const
Access the type of the sensitive detector.
Region region() const
Access to the region setting of the sensitive detector (not mandatory)
SensitiveDetector(const RefObject &sd)
Copy from named handle.
static void * _copy(const void *ptr, DetElement elt)
Templated copy constructor.
SensitiveDetector & setReadout(Readout readout)
Assign the IDDescriptor reference.
DetElement & operator=(const DetElement &e)=default
Assignment operator.
const TGeoHMatrix & worldTransformation() const
Set detector element for reference transformations. Will delete existing reference trafo...
SensitiveDetector & setEnergyCutoff(double value)
Set energy cut off.
void * i_extension(const std::type_info &info) const
Access an existing extension object from the detector element.
const std::string & placementPath() const
Access to the full path to the placed object.
void * i_addExtension(void *ptr, const std::type_info &info, void(*destruct)(void *))
Add an extension object to the detector element.
Alignment survey() const
Access to the constant survey alignment information.
double energyCutoff() const
Access energy cut off.