 |
DD4hep
1.35.0
Detector Description Toolkit for High Energy Physics
|
Go to the documentation of this file.
15 #include <DD4hep/detail/Handle.inl>
23 #include <TGeoVolume.h>
24 #include <TGeoMatrix.h>
25 #include <TGeoManager.h>
39 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()
51 printout(VERBOSE,
"SensitiveDetectorObject",
"+++ Created new SensitiveDetectorObject('%s')",nam.c_str());
67 flag(0), id(0), combineHits(0), typeFlag(0), level(-1),
key(0), path(),
placementPath(),
68 idealPlace(), placement(), volumeID(0), parent(), children(),
71 printout(VERBOSE,
"DetElementObject",
"+++ Created new anonymous DetElementObject()");
78 flag(0), id(ident), combineHits(0), typeFlag(0), level(-1),
key(0), path(),
placementPath(),
79 idealPlace(), placement(), volumeID(0), parent(), children(),
83 printout(VERBOSE,
"DetElementObject",
"+++ Created new DetElementObject('%s', %d)",nam.c_str(),
id);
117 obj->ObjectExtensions::clear();
118 obj->ObjectExtensions::copyFrom(
extensions, obj);
133 "+++ DetElement::copy: Element %s is already present [Double-Insert]", c.
name());
141 std::map<TGeoNode*,TGeoNode*> nodes;
144 printout(DEBUG,
"DetElement",
"reflect: Match %s %p ",de_det.
name(), de_det.
placement().
ptr());
145 if ( k == nodes.end() ) {
146 except(
"DetElement",
"reflect: Something went wrong when reflecting the source volume!");
149 const auto& childrens_det = de_det.
children();
150 const auto& childrens_ref = de_ref.
children();
151 for(
auto i=childrens_det.begin(), j=childrens_ref.begin(); i!=childrens_det.end(); ++i, ++j )
152 match((*i).second, (*j).second);
154 void map(TGeoNode* n1, TGeoNode* n2) {
155 if ( nodes.find(n1) == nodes.end() ) {
156 TGeoVolume* v1 = n1->GetVolume();
157 TGeoVolume* v2 = n2->GetVolume();
158 nodes.insert(std::make_pair(n1,n2));
159 printout(DEBUG,
"DetElement",
"reflect: Map %p --- %p ",n1,n2);
160 for( Int_t i=0; i<v1->GetNdaughters(); ++i )
161 map(v1->GetNode(i), v2->GetNode(i));
168 TGeoVolume* vol_det = vol.
ptr();
169 TGeoVolume* vol_ref = vol.
reflect(sd);
170 const auto& childrens_det =
det.children();
171 const auto& childrens_ref = det_ref.
children();
173 for( Int_t i=0; i<vol_det->GetNdaughters(); ++i )
174 mapper.map(vol_det->GetNode(i), vol_ref->GetNode(i));
175 for(
auto i=childrens_det.begin(), j=childrens_ref.begin(); i != childrens_det.end(); ++i, ++j )
176 mapper.match((*i).second, (*j).second);
177 return std::make_pair(det_ref,vol_ref);
199 std::string place =
det.placementPath();
204 except(
"DetElement",
"The placement %s is not part of the hierarchy.",place.c_str());
207 "DetElement",
"+++ Revalidate DetElement chache of %s -> %s Placement:%p --> %p %s",
212 node->SetUserExtension(ext);
216 if ( node_vol.
ptr() != plac_vol.
ptr() && 0 == node_vol->GetUserExtension() ) {
217 auto ext = plac_vol->GetUserExtension();
218 node_vol->SetUserExtension(ext);
226 i.second->revalidate(recurse_down);
236 det->revalidate(
false);
244 if ( (typ&(i->second)) == typ && i->first.par == pointer ) {
254 const void* args[3] = { (
void*)((
unsigned long)tags),
this, param };
257 printout(INFO,
"DetElement",
258 "++ Need to update local and child caches of %s",
264 if ( (tags&i.second) )
265 i.first.execute(args);
Handle class to hold the information of the top DetElement object 'world'.
const Children & children() const
Access to the list of children.
virtual ~SensitiveDetectorObject()
Internal object destructor: release extension object(s)
DetElement::Children children
The array of children.
void destroyHandle(T &handle)
Helper to delete objects from heap and reset the handle.
Data class with properties of a detector element.
Handle class to hold the information of a sensitive detector.
Implementation of an object supporting arbitrary user extensions.
unsigned int typeFlag
Flag to encode detector types.
Main handle class to hold an alignment conditions object.
Handle class holding a placed volume (also called physical volume)
const char * GetName() const
Access name.
PlacedVolume placement() const
Access to the physical volume of this detector element.
PlacedVolume idealPlace
The subdetector placement corresponding to the ideal detector element's volume.
bool isValid() const
Check the validity of the object held by the handle.
static void increment(T *)
Increment count according to type information.
unsigned long long int magic_word()
Access to the magic word, which is protecting some objects against memory corruptions.
void removeAtUpdate(unsigned int type, void *pointer)
Remove callback from object.
const char * name() const
Access the object name (or "" if not supported by the object)
Data class with properties of a detector element.
void SetName(const char *nam)
Set name (used by Handle)
AlignmentCondition survey
Basic detector element alignment entry containing the survey data.
Handle< T > & clear()
Release the object held by the handle.
DD4HEP_INSTANTIATE_HANDLE_NAMED(DetElementObject)
DetElement parent
Reference to the parent element.
World privateWorld
Reference to the parent element.
Handle class describing a detector element.
std::map< unsigned long long int, ExtensionEntry * > extensions
The extensions object.
Handle class holding a placed volume (also called physical volume)
World i_access_world()
Resolve the world object. Internal use ONLY.
unsigned int flag
Flag to remember internally calculated quatities.
Object & _data() const
Additional data accessor.
static void decrement(T *)
Decrement count according to type information.
void destroyHandles(M &arg)
Functional created of map destruction functors.
int level
Hierarchical level within the detector description.
WorldObject()
Not persistent in ROOT.
virtual ~WorldObject()
Internal object destructor: release extension object(s)
PlacedVolume placement
The subdetector placement corresponding to the actual detector element's volume.
std::size_t verbose(const std::string &src, const std::string &msg)
detail::tools::ElementPath ElementPath
DetElement & setPlacement(const PlacedVolume &volume)
Set the physical volumes of the detector element.
const char * GetTitle() const
Get name (used by Handle)
int id
Unique integer identifier of the detector instance.
std::pair< DetElement, Volume > reflect(const std::string &new_name, int new_id, SensitiveDetector sd)
Reflect all volumes in a DetElement sub-tree and re-attach the placements.
void revalidate(bool recurse_down=true)
Revalidate the caches.
UpdateCallbacks updateCalls
Placeholder for structure with update callbacks.
World world()
Access to the world object. Only possible once the geometry is closed.
virtual ~DetElementObject()
Internal object destructor: release extension object(s)
T * ptr() const
Access to the held object.
void clear(bool destroy=true)
Clear all extensions.
void revalidate_parents()
Revalidate the parent caches.
Data class with properties of sensitive detectors.
Namespace for the AIDA detector description toolkit.
Implementation of a named object.
std::string placementPath
The path to the placement of the detector element (if placed)
Volume volume() const
Logical volume of this placement.
int combineHits
Flag to process hits.
The main interface to the dd4hep detector description package.
Volume reflect() const
Create a reflected volume tree. The reflected volume has left-handed coordinates.
DetElementObject()
Default constructor.
SensitiveDetectorObject()
Default constructor.
AlignmentCondition nominal
Not ROOT persistent.
virtual DetElementObject * clone(int new_id, int flag) const
Deep object copy to replicate DetElement trees e.g. for reflection.
detail::tools::PlacementPath PlacementPath
void update(unsigned int tags, void *param)
Trigger update callbacks.
unsigned int key
Access hash key of this detector element (Only valid once geometry is closed!)