22 #include "TGeoVolume.h"
23 #include "TGeoMatrix.h"
24 #include "TGeoManager.h"
28 using namespace DD4hep;
29 using namespace DD4hep::Geometry;
38 SensitiveDetectorObject::SensitiveDetectorObject()
40 verbose(0), combineHits(0), ecut(0.0), readout(), region(), limits(), hitsCollection() {
41 printout(
VERBOSE,
"SensitiveDetectorObject",
"+++ Created new anonymous SensitiveDetectorObject()");
48 verbose(0), combineHits(0), ecut(0.0), readout(), region(), limits(), hitsCollection() {
50 printout(
VERBOSE,
"SensitiveDetectorObject",
"+++ Created new SensitiveDetectorObject('%s')",nam.c_str());
66 flag(0), id(0), combineHits(0), typeFlag(0), level(-1), key(0), path(),
placementPath(),
67 idealPlace(), placement(), volumeID(0), parent(), reference(), children(),
68 nominal(), survey(), alignments(), conditions(),
69 worldTrafo(), parentTrafo(), referenceTrafo(0) {
70 printout(
VERBOSE,
"DetElementObject",
"+++ Created new anonymous DetElementObject()");
77 flag(0), id(ident), combineHits(0), typeFlag(0), level(-1), key(0), path(),
placementPath(),
78 idealPlace(), placement(), volumeID(0), parent(), reference(), children(),
79 nominal(), survey(), alignments(), conditions(),
80 worldTrafo(), parentTrafo(), referenceTrafo(0) {
82 printout(
VERBOSE,
"DetElementObject",
"+++ Created new DetElementObject('%s', %d)",nam.c_str(),
id);
123 obj->ObjectExtensions::clear();
124 obj->ObjectExtensions::copyFrom(
extensions, obj);
127 for (DetElement::Children::const_iterator i =
children.begin(); i !=
children.end(); ++i) {
131 pair<Children::iterator, bool> r = obj->
children.insert(make_pair(child.name(), child));
133 child._data().parent = obj;
136 throw runtime_error(
"DD4hep: DetElement::copy: Element " +
string(child.name()) +
137 " is already present [Double-Insert]");
183 if ( ref.
ptr() ==
self.ptr() ) {
197 throw runtime_error(
"DD4hep: referenceTransformation: No path from " +
string(
self.
name()) +
198 " to reference element " +
string(ref.
name()) +
" present!");
217 throw runtime_error(
"DD4hep: DetElement: The placement " + place +
" is not part of the hierarchy.");
221 "DetElement",
"+++ Invalidate chache of %s -> %s Placement:%p --> %p %s",
227 if ( have_trafo && print )
worldTrafo.Print();
234 if ( parent_world_trafo ) {
240 else if ( have_trafo ) {
252 for(Children::const_iterator i =
children.begin(); i!=
children.end(); ++i) {
261 if ( (typ&((*i).second)) == typ && (*i).first.par == pointer ) {
271 const void* args[3] = { (
void*)((
unsigned long)tags),
this, param };
274 printout(
INFO,
"DetElement",
"+++ Need to update chaches and child caches of %s",
277 TGeoHMatrix* parent_world_trafo = 0;
279 parent_world_trafo = &par->worldTrafo;
284 if ( (tags&((*i).second)) ) {
285 (*i).first.execute(args);
300 conditionsLoader(0), conditionsManager(0), alignmentsLoader(0), alignmentsManager(0)
Alignment nominal
Basic ideal/nominal detector element alignment entry.
PlacedVolume idealPlace
The subdetector placement corresponding to the ideal detector element's volume.
void destroyHandle(T &h)
Helper to delete objects from heap and reset the handle.
Handle class holding a placed volume (also called physical volume)
const char * name() const
Access the object name (or "" if not supported by the object)
void deletePtr(T *&p)
Helper to delete objects from heap and reset the pointer. Saves many many lines of code...
unsigned int typeFlag
Flag to encode detector types.
bool isValid() const
Check the validity of the object held by the handle.
Data class with properties of sensitive detectors.
DetectorTools::PlacementPath PlacementPath
Handle< T > & clear()
Release the object held by the handle.
The data class behind a conditions container handle.
void update(unsigned int tags, void *param)
Trigger update callbacks.
Extensions extensions
The extensions object.
PlacedVolume placement
The subdetector placement corresponding to the actual detector element's volume.
static void decrement(T *)
Decrement count according to type information.
Handle class to hold the information of the top DetElement object 'world'.
void removeAtUpdate(unsigned int type, void *pointer)
Remove callback from object.
int combineHits
Flag to process hits.
void SetName(const char *nam)
Set name (used by Handle)
DetElementObject()
Default constructor.
Container class for condition handles aggregated by a detector element.
const TGeoHMatrix & worldTransformation()
Create cached matrix to transform to world coordinates.
TGeoHMatrix parentTrafo
Intermediate buffer to store the transformation to the parent detector element.
PrintLevel printLevel()
Access the current printer level.
T * ptr() const
Access to the held object.
DetElement reference
Reference element for stored transformations.
DD4hep::Geometry::DetElement DetElement
const char * GetTitle() const
Get name (used by Handle)
Implementation of a named object.
const TGeoHMatrix & referenceTransformation()
Create cached matrix to transform to reference coordinates.
unsigned int key
Access hash key of this detector element (Only valid once geometry is closed!)
int id
Unique integer identifier of the detector instance.
UpdateCallbacks updateCalls
Placeholder for structure with update callbacks.
Alignments::Container AlignmentsContainer
ConditionsContainer assign_conditions()
std::string name
The object name.
void revalidate(TGeoHMatrix *parent_world_trafo)
Revalidate the caches.
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.
ConditionsContainer conditions
The detector elements conditions access.
DetElement parent
Reference to the parent element.
const std::string & path() const
Path of the detector element (not necessarily identical to placement path!)
World world()
Access to the world object. Only possible once the geometry is closed.
Conditions::Container ConditionsContainer
int level
Hierarchical level within the detector description.
void clear(bool destroy=true)
Clear all extensions.
TGeoHMatrix * referenceTrafo
Intermediate buffer for the transformation to an arbitrary DetElement.
DetElement parent() const
Access to the detector elements's parent.
static void increment(T *)
Increment count according to type information.
std::string placementPath
The path to the placement of the detector element (if placed)
WorldObject()
Default constructor.
Handle class describing a detector element.
void destroyHandles(M &m)
Functional created of map destruction functors.
const TGeoHMatrix & parentTransformation()
Create cached matrix to transform to parent coordinates.
SensitiveDetectorObject()
Default constructor.
unsigned int flag
Flag to remember internally calculated quatities.
virtual ~SensitiveDetectorObject()
Internal object destructor: release extension object(s)
The main interface to the DD4hep detector description package.
DetectorTools::ElementPath ElementPath
World i_access_world()
Resolve the world object. Internal use ONLY.
virtual ~WorldObject()
Internal object destructor: release extension object(s)
Data class with properties of a detector element.
Data class with properties of a detector element.
const char * GetName() const
Access name.
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
World privateWorld
Reference to the parent element.
Implementation of an object supporting arbitrary user extensions.
Children children
The array of children.
virtual ~DetElementObject()
Internal object destructor: release extension object(s)
TGeoHMatrix worldTrafo
Intermediate buffer to store the transformation to the world coordination system. ...
DD4HEP_INSTANTIATE_HANDLE_NAMED(WorldObject)
std::ostream & print(const T &object, std::ostream &os=std::cout, const std::string &indent="")
AlignmentsContainer alignments
The detector elements alignments access.
unsigned long long int magic_word()
Access to the magic word, which is protecting some objects against memory corruptions.
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.
Alignments::Alignment Alignment