24 using namespace DD4hep::Geometry;
28 static string s_empty_string;
36 DetElement::Processor::~Processor() {
43 this->
assign(det_data, det_name, det_type);
62 det_parent.
add(*
this);
72 return access()->extension(info);
77 access()->updateCalls.push_back(make_pair(callback,callback_type));
82 access()->removeAtUpdate(typ,pointer);
94 return s_empty_string;
163 if ( !o->
path.empty() )
168 return s_empty_string;
176 return access()->combineHits != 0;
180 access()->combineHits = value;
208 return access()->children;
215 Children::const_iterator i = c.find(child_name);
216 return i == c.end() ?
DetElement() : (*i).second;
224 return (o) ? o->
parent : 0;
230 return (o) ? o->
world() : 0;
251 throw runtime_error(
"DD4hep: " + msg);
257 pair<Children::iterator, bool> r = object<Object>().
children.insert(make_pair(sdet.
name(), sdet));
259 sdet.
access()->parent = *
this;
262 throw runtime_error(
"DD4hep: DetElement::add: Element " +
string(sdet.
name()) +
263 " is already present in path " +
path() +
" [Double-Insert]");
265 throw runtime_error(
"DD4hep: DetElement::add: Self is not defined [Invalid Handle]");
281 Object& o = object<Object>();
299 throw runtime_error(
"DD4hep: DetElement::setPlacement: Placement is not defined [Invalid Handle]");
312 return access()->placement.volume();
341 Object& o = object<Object>();
342 if (o.referenceTrafo) {
344 o.referenceTrafo = 0;
346 object<Object>().reference = reference;
351 const TGeoHMatrix& DetElement::referenceTransformation()
const {
352 return access()->referenceTransformation();
356 bool DetElement::localToReference(
const Position& local,
Position& global)
const {
358 Double_t master_point[3] = { 0, 0, 0 }, local_point[3] = { local.X(), local.Y(), local.Z() };
359 referenceTransformation().LocalToMaster(local_point, master_point);
360 global.SetCoordinates(master_point);
365 bool DetElement::referenceToLocal(
const Position& global,
Position& local)
const {
367 Double_t master_point[3] = { global.X(), global.Y(), global.Z() }, local_point[3] = { 0, 0, 0 };
368 referenceTransformation().MasterToLocal(master_point, local_point);
369 local.SetCoordinates(local_point);
376 return access()->worldTransformation();
381 return access()->parentTransformation();
386 Double_t master_point[3] = { 0, 0, 0 }, local_point[3] = { local.X(), local.Y(), local.Z() };
389 global.SetCoordinates(master_point);
396 Double_t master_point[3] = { 0, 0, 0 }, local_point[3] = { local.X(), local.Y(), local.Z() };
398 global.SetCoordinates(master_point);
405 Double_t master_point[3] = { global.X(), global.Y(), global.Z() }, local_point[3] = { 0, 0, 0 };
407 local.SetCoordinates(local_point);
414 Double_t master_point[3] = { global.X(), global.Y(), global.Z() }, local_point[3] = { 0, 0, 0 };
416 local.SetCoordinates(local_point);
429 object<Object>().ecut = 0e0;
435 access()->SetTitle(typ.c_str());
468 access()->hitsCollection = collection;
474 return access()->hitsCollection;
479 int v = value ? 1 : 0;
486 return access()->verbose == 1;
491 int v = value ? 1 : 0;
498 return access()->combineHits == 1;
525 return access()->addExtension(ext_ptr, info, dtor);
530 return access()->extension(info);
Alignment nominal
Basic ideal/nominal detector element alignment entry.
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.
SensitiveDetector & setHitsCollection(const std::string &spec)
Assign the name of the hits collection.
const Volume & setLimitSet(const LCDD &lcdd, const std::string &name) const
Set the limits to the volume. Note: If the name string is empty, the action is ignored.
PlacedVolume idealPlace
The subdetector placement corresponding to the ideal detector element's volume.
Handle class holding a placed volume (also called physical volume)
DetElement world() const
Access to the world object. Only possible once the geometry is closed.
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.
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.
unsigned int typeFlag
Flag to encode detector types.
bool isValid() const
Check the validity of the object held by the handle.
const std::string & hitsCollection() const
Access the hits collection name.
SensitiveDetector & setRegion(Region reg)
Set the regional attributes to the sensitive detector.
PlacedVolume placement
The subdetector placement corresponding to the actual detector element's volume.
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).
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.
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.
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.
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
DD4hep::Geometry::DetElement DetElement
const char * GetTitle() const
Get name (used by Handle)
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.
const Keys & keys() const
Known keys of conditions in this container.
const Volume & setVisAttributes(const VisAttr &obj) const
Set Visualization attributes to the volume.
const Keys & keys() const
Known keys of conditions in this container.
DetElement & add(DetElement sub_element)
Add new child to the detector structure.
virtual LimitSet limitSet(const std::string &name) const =0
Retrieve a limitset by it's name from the detector description.
unsigned int key
Access hash key of this detector element (Only valid once geometry is closed!)
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...
int id
Unique integer identifier of the detector instance.
VolumeID volumeID() const
The cached VolumeID of this subdetector element.
DetElement()
Default constructor.
std::string name
The object name.
DetElementObject Object
Internal object type.
DetElement & setPlacement(const PlacedVolume &volume)
Set the physical volumes of the detector element.
void assign(Implementation *n, const std::string &nam, const std::string &title)
Assign a new named object. Note: object references must be managed by the user.
Alignment survey
Basic detector element alignment entry containing the survey data.
Definition of the generic callback structure for member functions.
ConditionsContainer conditions
The detector elements conditions access.
DetElement & setCombineHits(bool value, SensitiveDetector &sens)
Setter: Combine hits attribute.
T * access() const
Checked object access. Throws invalid handle runtime exception.
DetElement clone(const std::string &new_name) const
Clone (Deep copy) the DetElement structure with a new name.
DetElement parent
Reference to the parent element.
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.
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.
World world()
Access to the world object. Only possible once the geometry is closed.
int level
Hierarchical level within the detector description.
void SetTitle(const char *tit)
Set Title (used by Handle)
int id() const
Get the detector identifier.
void *(* copy_t)(const void *, void *arg)
Extensions copy constructor type.
TGeoHMatrix * referenceTrafo
Intermediate buffer for the transformation to an arbitrary DetElement.
DetElement parent() const
Access to the detector elements's parent.
std::string placementPath
The path to the placement of the detector element (if placed)
virtual Region region(const std::string &name) const =0
Retrieve a region object by it's name from the detector description.
unsigned int hash32(const char *key)
We need it so often: one-at-time 32 bit hash function.
Handle class describing a detector element.
Readout readout() const
Access readout structure of the sensitive detector.
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.
Handle class describing a region as used in simulation.
const Volume & setRegion(const LCDD &lcdd, const std::string &name) const
Set the regional attributes to the volume. Note: If the name string is empty, the action is ignored...
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.
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
T * m_element
Single and only data member: Reference to the actual element.
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)
AlignmentsContainer alignments
The detector elements alignments access.
SensitiveDetector & setReadout(Readout readout)
Assign the IDDescriptor reference.
const TGeoHMatrix & worldTransformation() const
Set detector element for reference transformations. Will delete existing reference trafo...
SensitiveDetector & setEnergyCutoff(double value)
Set energy cut off.
std::string path
Full path to this detector element. May be invalid.
void * i_extension(const std::type_info &info) const
Access an existing extension object from the detector element.
virtual DetElementObject * clone(int new_id, int flag) const
Deep object copy to replicate DetElement trees e.g. for reflection.
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.