DD4hep  1.32.1
Detector Description Toolkit for High Energy Physics
DetectorImp.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 #define DD4HEP_MUST_USE_DETECTORIMP_H 1
15 
16 // Framework include files
17 #include <DD4hep/Plugins.h>
18 #include <DD4hep/Printout.h>
19 #include <DD4hep/GeoHandler.h>
20 #include <DD4hep/DetectorHelper.h>
21 #include <DD4hep/DetectorTools.h>
22 
23 #include <DD4hep/InstanceCount.h>
28 #include <DD4hep/DetectorImp.h>
29 #include <DD4hep/DD4hepUnits.h>
30 
31 // C/C++ include files
32 #include <iostream>
33 #include <stdexcept>
34 #include <cerrno>
35 #include <mutex>
36 
37 // ROOT inlcude files
38 #include <TGeoSystemOfUnits.h>
39 #include <TGeoCompositeShape.h>
40 #include <TGeoBoolNode.h>
41 #include <TGeoManager.h>
42 #include <TGeoMatrix.h>
43 #include <TGeoVolume.h>
44 #include <TGeoShape.h>
45 #include <TClass.h>
46 
47 #include <XML/DocumentHandler.h>
48 
49 #ifndef __TIXML__
50 #include <xercesc/dom/DOMException.hpp>
51 namespace dd4hep {
52  namespace xml {
53  typedef xercesc::DOMException XmlException;
54  }
55 }
56 #endif
57 
58 using namespace dd4hep;
59 
61 
62 namespace {
63 
64  std::recursive_mutex s_detector_apply_lock;
65 
66  struct Instances {
67  std::recursive_mutex lock;
68  std::map<std::string, Detector*> detectors;
69  Detector* get(const std::string& name) {
70  const auto i = detectors.find(name);
71  return i == detectors.end() ? nullptr : (*i).second;
72  }
73  void insert(const std::string& name, Detector* detector) {
74  const auto [_, emplaced] = detectors.emplace(name,detector);
75  if ( !emplaced ) {
76  except("DD4hep","Cannot insert detector instance %s [Already present]",name.c_str());
77  }
78  }
79  Detector* remove(const std::string& name) {
80  const auto it = detectors.find(name);
81  if ( it == detectors.end() )
82  return nullptr;
83  Detector* det = it->second;
84  detectors.erase(it);
85  return det;
86  }
87  };
88 
89  class DetectorGuard final {
90  protected:
91  static std::pair<std::recursive_mutex, std::map<DetectorImp*, TGeoManager*> >& detector_lock() {
92  static std::pair<std::recursive_mutex, std::map<DetectorImp*, TGeoManager*> > s_inst;
93  return s_inst;
94  }
95  DetectorImp* detector {nullptr};
96  public:
97  DetectorGuard(DetectorImp* imp) : detector(imp) {}
98  void lock(TGeoManager* mgr) const {
99  auto& lock = detector_lock();
100  lock.first.lock();
101  lock.second[detector] = mgr;
102  }
103  TGeoManager* unlock() const {
104  TGeoManager* mgr = nullptr;
105  auto& lock = detector_lock();
106  auto i = lock.second.find(detector);
107  if ( i != lock.second.end() ) {
108  mgr = (*i).second;
109  lock.second.erase(i);
110  }
111  lock.first.unlock();
112  return mgr;
113  }
114  };
115 
116  Instances& detector_instances() {
117  static Instances s_inst;
118  return s_inst;
119  }
120 }
121 
122 std::string dd4hep::versionString(){
123  char vsn[32];
124  std::snprintf(vsn, sizeof(vsn), "v%2.2d-%2.2d", DD4HEP_MAJOR_VERSION, DD4HEP_MINOR_VERSION);
125  return { vsn };
126 }
127 
128 std::unique_ptr<Detector> Detector::make_unique(const std::string& name) {
129  return std::unique_ptr<Detector>(new DetectorImp(name));
130 }
131 
132 Detector& Detector::getInstance(const std::string& name) {
133  std::lock_guard<std::recursive_mutex> lock(detector_instances().lock);
134  Detector* description = detector_instances().get(name);
135  if ( !description ) {
136  gGeoManager = nullptr;
137  description = new DetectorImp(name);
138  detector_instances().insert(name,description);
139  }
140  return *description;
141 }
142 
144 void Detector::destroyInstance(const std::string& name) {
145  std::lock_guard<std::recursive_mutex> lock(detector_instances().lock);
146  Detector* description = detector_instances().remove(name);
147  delete description;
148 }
149 
152  : TNamed(), DetectorData(), DetectorLoad(this), m_buildType(BUILD_NONE)
153 {
156  m_std_conditions.pressure = Pressure_NTP;
157  m_std_conditions.temperature = Temperature_NTP;
158 }
159 
161 DetectorImp::DetectorImp(const std::string& name)
162  : TNamed(), DetectorData(), DetectorLoad(this), m_buildType(BUILD_NONE)
163 {
164 #if defined(DD4HEP_USE_GEANT4_UNITS)
165  printout(INFO,"DD4hep","++ Using globally Geant4 unit system (mm,ns,MeV)");
166  if ( TGeoManager::GetDefaultUnits() != TGeoManager::kG4Units ) {
167  TGeoManager::LockDefaultUnits(kFALSE);
168  TGeoManager::SetDefaultUnits(TGeoManager::kG4Units);
169  TGeoManager::LockDefaultUnits(kTRUE);
170  }
171 #else
172  if ( TGeoManager::GetDefaultUnits() != TGeoManager::kRootUnits ) {
173  TGeoManager::LockDefaultUnits(kFALSE);
174  TGeoManager::SetDefaultUnits(TGeoManager::kRootUnits);
175  TGeoManager::LockDefaultUnits(kTRUE);
176  }
177 #endif
178 
179  SetName(name.c_str());
180  SetTitle("DD4hep detector description object");
181  //DetectorGuard(this).lock(gGeoManager);
182  gGeoManager = nullptr;
184  m_manager = new TGeoManager(name.c_str(), "Detector Geometry");
185  {
186  m_manager->AddNavigator();
187  m_manager->SetCurrentNavigator(0);
188  gGeoManager = m_manager;
189 #if 1 //FIXME: eventually this should be set to 1 - needs fixes in examples ...
190  TGeoElementTable* table = m_manager->GetElementTable();
191  table->TGeoElementTable::~TGeoElementTable();
192  new(table) TGeoElementTable();
193  // This will initialize the table without filling:
194  table->AddElement("VACUUM","VACUUM", 1, 1, 1e-15);
195 #endif
196  }
197  if ( !gGeoIdentity )
198  {
199  gGeoIdentity = new TGeoIdentity();
200  }
203  m_std_conditions.pressure = Pressure_NTP;
204  m_std_conditions.temperature = Temperature_NTP;
205 
206  VisAttr attr("invisible");
207  attr.setColor(1.0, 0.5, 0.5, 0.5);
210  attr.setVisible(false);
211  attr.setShowDaughters(true);
212  addVisAttribute(attr);
213  m_invisibleVis = attr;
214 }
215 
218  DetectorGuard(this).lock(gGeoManager);
219  if ( m_manager ) {
220  std::lock_guard<std::recursive_mutex> lock(detector_instances().lock);
221  if ( m_manager == gGeoManager ) gGeoManager = nullptr;
222  Detector* description = detector_instances().get(GetName());
223  if ( description ) {
224  detector_instances().remove(m_manager->GetName());
225  }
226  }
227  delete m_surfaceManager;
228  m_surfaceManager = nullptr;
229  destroyData(false);
231  m_detectorTypes.clear();
233  DetectorGuard(this).unlock();
234 }
235 
237 Int_t DetectorImp::saveObject(const char *name, Int_t option, Int_t bufsize) const {
238  Int_t nbytes = 0;
239  try {
240  DetectorData::patchRootStreamer(TGeoVolume::Class());
241  DetectorData::patchRootStreamer(TGeoNode::Class());
242  nbytes = TNamed::Write(name, option, bufsize);
243  DetectorData::unpatchRootStreamer(TGeoVolume::Class());
244  DetectorData::unpatchRootStreamer(TGeoNode::Class());
245  return nbytes;
246  }
247  catch (const std::exception& e) {
248  DetectorData::unpatchRootStreamer(TGeoVolume::Class());
249  DetectorData::unpatchRootStreamer(TGeoNode::Class());
250  except("Detector","Exception %s while saving dd4hep::Detector object", e.what());
251  }
252  catch (...) {
253  DetectorData::unpatchRootStreamer(TGeoVolume::Class());
254  DetectorData::unpatchRootStreamer(TGeoNode::Class());
255  except("Detector","UNKNOWN exception while saving dd4hep::Detector object.");
256  }
257  return nbytes;
258 }
259 
260 // Load volume manager
264 }
265 
267 void* DetectorImp::addUserExtension(unsigned long long int key, ExtensionEntry* entry) {
268  return m_extensions.addExtension(key,entry);
269 }
270 
272 void* DetectorImp::removeUserExtension(unsigned long long int key, bool destroy) {
273  return m_extensions.removeExtension(key,destroy);
274 }
275 
277 void* DetectorImp::userExtension(unsigned long long int key, bool alert) const {
278  return m_extensions.extension(key,alert);
279 }
280 
283  std::lock_guard<std::recursive_mutex> lock(s_detector_apply_lock);
285  return temp;
286 }
287 
289 void DetectorImp::declareParent(const std::string& detector_name, const DetElement& parent) {
290  if ( !detector_name.empty() ) {
291  if ( parent.isValid() ) {
292  auto i = m_detectorParents.find(detector_name);
293  if (i == m_detectorParents.end()) {
294  Volume parent_volume = parent.placement().volume();
295  if ( parent_volume.isValid() ) {
296  m_detectorParents.emplace(detector_name,parent);
297  return;
298  }
299  except("DD4hep","+++ Failed to access valid parent volume of %s from %s",
300  detector_name.c_str(), parent.name());
301  }
302  except("DD4hep",
303  "+++ A parent to the detector %s was already registered.",
304  detector_name.c_str());
305  }
306  except("DD4hep",
307  "+++ Attempt to register invalid parent for detector: %s [Invalid-Handle].",
308  detector_name.c_str());
309  }
310  except("DD4hep",
311  "+++ Attempt to register parent to invalid detector [Invalid-detector-name].");
312 }
313 
316  if ( !de.isValid() ) {
317  except("DD4hep","Detector: Attempt to access mother volume of invalid detector [Invalid-handle]");
318  return nullptr;
319  }
320  std::string de_name = de.name();
321  auto i = m_detectorParents.find(de_name);
322  if (i == m_detectorParents.end()) {
323  if ( m_worldVol.isValid() ) {
324  return m_worldVol;
325  }
326  except("DD4hep",
327  "+++ The world volume is not (yet) valid. "
328  "Are you correctly building the detector %s?",
329  de.name());
330  }
331  if ( (*i).second.isValid() ) {
332  Volume vol = (*i).second.volume();
333  if ( vol.isValid() ) {
334  return vol;
335  }
336  }
337  except("DD4hep",
338  "+++ The mother volume of %s is not valid. "
339  "Are you correctly building detectors?",
340  de.name());
341  return nullptr;
342 }
343 
348  {
349  printout(WARNING,"DD4hep","++ STD conditions NOT defined by client. NTP defaults taken.");
351  }
352  return m_std_conditions;
353 }
355 void DetectorImp::setStdConditions(double temp, double pressure) {
357  m_std_conditions.pressure = pressure;
359  if ( std::abs(temp-Temperature_NTP) < 1e-10 && std::abs(pressure-Pressure_NTP) < 1e-10 )
361  else if ( std::abs(temp-Temperature_STP) < 1e-10 && std::abs(pressure-Pressure_STP) < 1e-10 )
363  else
365 }
366 
368 void DetectorImp::setStdConditions(const std::string& type) {
369  if ( type == "STP" ) {
370  m_std_conditions.temperature = Temperature_STP;
371  m_std_conditions.pressure = Pressure_STP;
373  }
374  else if ( type == "NTP" ) {
375  m_std_conditions.temperature = Temperature_NTP;
376  m_std_conditions.pressure = Pressure_NTP;
378  }
379  else {
380  except("DD4hep",
381  "++ Attempt to set standard conditions to "
382  "unknown conventions (Only STP and NTP allowed).");
383  }
384 }
385 
387 DetElement DetectorImp::detector(const std::string& name) const {
388  HandleMap::const_iterator i = m_detectors.find(name);
389  if (i != m_detectors.end()) {
390  return (*i).second;
391  }
392  DetElement de = detail::tools::findElement(*this,name);
393  return de;
394 }
395 
397  DetElement det_element(ref_det);
398  DetectorHelper helper(this);
399  DetElement existing_det = helper.detectorByID(det_element.id());
400 
401  if ( existing_det.isValid() ) {
402  SensitiveDetector sd = helper.sensitiveDetector(existing_det);
403  if ( sd.isValid() ) {
404  std::stringstream str;
405  str << "Detector: The sensitive sub-detectors " << det_element.name() << " and "
406  << existing_det.name() << " have the identical ID:" << det_element.id() << ".";
407  except("DD4hep",str.str());
408  }
409  }
410  m_detectors.append(ref_det);
411  det_element->flag |= DetElement::Object::IS_TOP_LEVEL_DETECTOR;
412  PlacedVolume pv = det_element.placement();
413  if ( !pv.isValid() ) {
414  std::stringstream str;
415  str << "Detector: Adding subdetectors with no valid placement is not allowed: "
416  << det_element.name() << " ID:" << det_element.id() << ".";
417  except("DD4hep",str.str());
418  }
419  Volume volume = pv->GetMotherVolume();
420  if ( volume == m_worldVol ) {
421  printout(DEBUG,"DD4hep","+++ Detector: Added detector %s to the world instance.",
422  det_element.name());
423  m_world.add(det_element);
424  return *this;
425  }
427  auto ipar = m_detectorParents.find(det_element.name());
428  if (ipar != m_detectorParents.end()) {
429  DetElement parent = (*ipar).second;
430  parent.add(det_element);
431  printout(DEBUG,"DD4hep","+++ Detector: Added detector %s to parent %s.",
432  det_element.name(), parent.name());
433  return *this;
434  }
435 
436  // The detector's placement must be one of the existing detectors
437  for(HandleMap::iterator idet = m_detectors.begin(); idet != m_detectors.end(); ++idet) {
438  DetElement parent((*idet).second);
439  Volume vol = parent.placement().volume();
440  if ( vol == volume ) {
441  printout(INFO,"DD4hep","+++ Detector: Added detector %s to the parent:%s.",
442  det_element.name(),parent.name());
443  parent.add(det_element);
444  return *this;
445  }
446  }
447  except("DD4hep","+++ Detector: The detector %s has no known parent.", det_element.name());
448  throw std::runtime_error("Detector-Error"); // Never called....
449 }
450 
453  if ( strcmp(x.name(),"Detector_InhibitConstants") == 0 ) {
454  const char* title = x->GetTitle();
455  char c = ::toupper(title[0]);
456  m_inhibitConstants = (c=='Y' || c=='T' || c=='1');
457  }
458  m_define.append(x, false);
459  return *this;
460 }
461 
463 Constant DetectorImp::constant(const std::string& name) const {
464  if ( !m_inhibitConstants ) {
465  return getRefChild(m_define, name);
466  }
467  throw std::runtime_error("Detector:constant("+name+"): Access to global constants is inhibited.");
468 }
469 
471 std::string DetectorImp::constantAsString(const std::string& name) const {
472  if ( !m_inhibitConstants ) {
473  Handle<NamedObject> c = constant(name);
474  if (c.isValid())
475  return c->GetTitle();
476  throw std::runtime_error("Detector:constantAsString: The constant " + name + " is not known to the system.");
477  }
478  throw std::runtime_error("Detector:constantAsString("+name+"):: Access to global constants is inhibited.");
479 }
480 
482 long DetectorImp::constantAsLong(const std::string& name) const {
483  if ( !m_inhibitConstants ) {
484  return _toLong(constantAsString(name));
485  }
486  throw std::runtime_error("Detector:constantAsLong("+name+"): Access to global constants is inhibited.");
487 }
488 
490 double DetectorImp::constantAsDouble(const std::string& name) const {
491  if ( !m_inhibitConstants ) {
492  return _toDouble(constantAsString(name));
493  }
494  throw std::runtime_error("Detector:constantAsDouble("+name+"): Access to global constants is inhibited.");
495 }
496 
499  m_field.add(x);
500  m_fields.append(x);
501  return *this;
502 }
503 
505 Material DetectorImp::material(const std::string& name) const {
506  TGeoMedium* mat = m_manager->GetMedium(name.c_str());
507  if (mat) {
508  return Material(mat);
509  }
510  throw std::runtime_error("Cannot find a material referenced by name:" + name);
511 }
512 
515  m_detectorTypes[""] = {};
516  for( const auto& i : m_detectors ) {
517  DetElement det(i.second);
518  if ( det.parent().isValid() ) { // Exclude 'world'
519  HandleMap::const_iterator j=m_sensitive.find(det.name());
520  if ( j != m_sensitive.end() ) {
521  SensitiveDetector sd((*j).second);
522  m_detectorTypes[sd.type()].emplace_back(det);
523  }
524  else if ( det.type() == "compound" ) {
525  m_detectorTypes[det.type()].emplace_back(det);
526  }
527  else {
528  m_detectorTypes["passive"].emplace_back(det);
529  }
530  }
531  }
532 }
533 
535 std::vector<std::string> DetectorImp::detectorTypes() const {
536  if ( m_manager->IsClosed() ) {
537  std::vector<std::string> v;
538  v.reserve(m_detectorTypes.size());
539  for(const auto& t : m_detectorTypes )
540  v.emplace_back(t.first);
541  return v;
542  }
543  throw std::runtime_error("detectorTypes: Call only available once the geometry is closed!");
544 }
545 
547 const std::vector<DetElement>& DetectorImp::detectors(const std::string& type, bool throw_exc) const {
548  if ( m_manager->IsClosed() ) {
549  DetectorTypeMap::const_iterator i=m_detectorTypes.find(type);
550  if ( i != m_detectorTypes.end() ) return (*i).second;
551  if ( throw_exc ) {
552  throw std::runtime_error("detectors("+type+"): Detectors of this type do not exist in the current setup!");
553  }
554  // return empty vector instead of exception
555  return m_detectorTypes.at("") ;
556  }
557  throw std::runtime_error("detectors("+type+"): Detectors can only selected by type once the geometry is closed!");
558 }
559 
560 std::vector<DetElement> DetectorImp::detectors(unsigned int includeFlag, unsigned int excludeFlag ) const {
561  if( ! m_manager->IsClosed() ) {
562  throw std::runtime_error("detectors(typeFlag): Detectors can only selected by typeFlag once the geometry is closed!");
563  }
564  std::vector<DetElement> dets ;
565  dets.reserve( m_detectors.size() ) ;
566 
567  for(HandleMap::const_iterator i=m_detectors.begin(); i!=m_detectors.end(); ++i) {
568  DetElement det((*i).second);
569  if ( det.parent().isValid() ) { // Exclude 'world'
570 
571  //fixme: what to do with compounds - add their daughters ?
572  // ...
573 
574  if( ( det.typeFlag() & includeFlag ) == includeFlag &&
575  ( det.typeFlag() & excludeFlag ) == 0 )
576  dets.emplace_back( det ) ;
577  }
578  }
579  return dets ;
580 }
581 
583 std::vector<DetElement> DetectorImp::detectors(const std::string& type1,
584  const std::string& type2,
585  const std::string& type3,
586  const std::string& type4,
587  const std::string& type5 ) {
588  if ( m_manager->IsClosed() ) {
589  std::vector<DetElement> v;
590  DetectorTypeMap::const_iterator i, end=m_detectorTypes.end();
591  if ( !type1.empty() && (i=m_detectorTypes.find(type1)) != end )
592  v.insert(v.end(),(*i).second.begin(),(*i).second.end());
593  if ( !type2.empty() && (i=m_detectorTypes.find(type2)) != end )
594  v.insert(v.end(),(*i).second.begin(),(*i).second.end());
595  if ( !type3.empty() && (i=m_detectorTypes.find(type3)) != end )
596  v.insert(v.end(),(*i).second.begin(),(*i).second.end());
597  if ( !type4.empty() && (i=m_detectorTypes.find(type4)) != end )
598  v.insert(v.end(),(*i).second.begin(),(*i).second.end());
599  if ( !type5.empty() && (i=m_detectorTypes.find(type5)) != end )
600  v.insert(v.end(),(*i).second.begin(),(*i).second.end());
601  return v;
602  }
603  throw std::runtime_error("detectors("+type1+","+type2+",...): Detectors can only selected by type once the geometry is closed!");
604 }
605 
606 Handle<NamedObject> DetectorImp::getRefChild(const HandleMap& e, const std::string& name, bool do_throw) const {
607  HandleMap::const_iterator it = e.find(name);
608  if (it != e.end()) {
609  return it->second;
610  }
611  if (do_throw) {
612  union ptr {
613  const ObjectHandleMap* omap;
614  const char* c;
615  const void* other;
616  ptr(const void* p) { other = p; }
617  };
618  std::string nam = "";
619  ptr mptr(&e), ref(this);
620  if ( ref.c > mptr.c && mptr.c < ref.c+sizeof(*this) ) {
621  nam = mptr.omap->name;
622  }
623  std::stringstream err;
624  err << "getRefChild: Failed to find child with name: " << name
625  << " Map " << nam << " contains " << e.size() << " elements: {";
626  for (it = e.begin(); it != e.end(); ++it) {
627  if (it != e.begin()) {
628  err << ", ";
629  }
630  err << it->first;
631  }
632  err << "}";
633  throw std::runtime_error(err.str());
634  }
635  return nullptr;
636 }
637 
638 namespace {
639  struct ShapePatcher: public detail::GeoScan {
640  VolumeManager m_volManager;
641  DetElement m_world;
642  ShapePatcher(VolumeManager m, DetElement e)
643  : detail::GeoScan(e), m_volManager(m), m_world(e) {
644  }
645  void patchShapes() {
646  auto& data = *m_data;
647  char text[32];
648  std::string nam;
649  printout(INFO,"Detector","+++ Patching names of anonymous shapes....");
650  for (auto i = data.rbegin(); i != data.rend(); ++i) {
651  for( const TGeoNode* n : (*i).second ) {
652  TGeoVolume* vol = n->GetVolume();
653  TGeoShape* s = vol->GetShape();
654  const char* sn = s->GetName();
655  ::snprintf(text,sizeof(text),"_shape_%p",(void*)s);
656  if ( !sn || 0 == ::strlen(sn)) {
657  nam = vol->GetName();
658  nam += text;
659  s->SetName(nam.c_str());
660  }
661  else if (0 == ::strcmp(sn, s->IsA()->GetName())) {
662  nam = vol->GetName();
663  nam += text;
664  s->SetName(nam.c_str());
665  }
666  else {
667  nam = sn;
668  if (nam.find("_shape") == std::string::npos)
669  nam += text;
670  s->SetName(nam.c_str());
671  }
672  if (s->IsA() == TGeoCompositeShape::Class()) {
673  TGeoCompositeShape* c = (TGeoCompositeShape*) s;
674  const TGeoBoolNode* boolean = c->GetBoolNode();
675  s = boolean->GetLeftShape();
676  sn = s->GetName();
677  if ( !sn || 0 == ::strlen(sn)) {
678  s->SetName((nam + "_left").c_str());
679  }
680  else if (0 == ::strcmp(sn, s->IsA()->GetName())) {
681  s->SetName((nam + "_left").c_str());
682  }
683  s = boolean->GetRightShape();
684  sn = s->GetName();
685  if ( !sn || 0 == ::strlen(sn)) {
686  s->SetName((nam + "_right").c_str());
687  }
688  else if (0 == ::strcmp(s->GetName(), s->IsA()->GetName())) {
689  s->SetName((nam + "_right").c_str());
690  }
691  }
692  }
693  }
694  }
695  };
696 }
697 
699 void DetectorImp::endDocument(bool close_geometry) {
700  TGeoManager* mgr = m_manager;
701  std::lock_guard<std::recursive_mutex> lock(s_detector_apply_lock);
702  if ( close_geometry && !mgr->IsClosed() ) {
703 #if 0
704  Region trackingRegion("TrackingRegion");
705  trackingRegion.setThreshold(1);
706  trackingRegion.setStoreSecondaries(true);
707  add(trackingRegion);
708  m_trackingVol.setRegion(trackingRegion);
709  // Set the tracking volume to invisible.
710  VisAttr trackingVis("TrackingVis");
711  trackingVis.setVisible(false);
712  m_trackingVol.setVisAttributes(trackingVis);
713  add(trackingVis);
714 #endif
715  m_worldVol.solid()->ComputeBBox();
716  // Propagating reflections: This is useless now and unused!!!!
717  // Since we allow now for anonymous shapes,
718  // we will rename them to use the name of the volume they are assigned to
719  mgr->CloseGeometry();
720  PlacedVolume pv = mgr->GetTopNode();
721  auto* extension = pv->GetUserExtension();
722  if ( nullptr == extension ) {
724  pv->SetUserExtension(extension);
725  }
726  m_world.setPlacement(pv);
727  }
728  // Patching shape names of anonymous shapes
729  ShapePatcher patcher(m_volManager, m_world);
730  patcher.patchShapes();
732  m_state = READY;
733  //DetectorGuard(this).unlock();
734 }
735 
738  if (!m_world.isValid()) {
739  TGeoManager* mgr = m_manager;
740  std::lock_guard<std::recursive_mutex> lock(s_detector_apply_lock);
741  Constant air_const = getRefChild(m_define, "Air", false);
742  Constant vac_const = getRefChild(m_define, "Vacuum", false);
743  Box worldSolid;
744 
745  m_materialVacuum = material(vac_const.isValid() ? vac_const->GetTitle() : "Vacuum");
746 
747  m_worldVol = m_manager->GetTopVolume();
748  if ( m_worldVol.isValid() ) {
749  worldSolid = m_worldVol.solid();
751  printout(INFO,"Detector", "*********** Use Top Node from manager as "
752  "world volume [%s]. Material: %s BBox: %4.0f %4.0f %4.0f",
753  worldSolid->IsA()->GetName(), m_materialAir.name(),
754  worldSolid->GetDX(), worldSolid->GetDY(), worldSolid->GetDZ());
755  }
756  else {
758  Solid parallelWorldSolid = Box("world_x", "world_y", "world_z");
759  worldSolid = Box("world_x", "world_y", "world_z");
760  m_materialAir = material(air_const.isValid() ? air_const->GetTitle() : "Air");
761  m_worldVol = Volume("world_volume", worldSolid, m_materialAir);
762  parallelWorldSolid->SetName("parallel_world_solid");
763  printout(INFO,"Detector","*********** Created World volume with size: %4.0f %4.0f %4.0f",
764  worldSolid->GetDX(), worldSolid->GetDY(), worldSolid->GetDZ());
765  }
766  m_world = DetElement(new WorldObject(*this,"world"));
768  VisAttr worldVis = visAttributes("WorldVis");
769  if ( !worldVis.isValid() ) {
770  worldVis = VisAttr("WorldVis");
771  worldVis.setVisible(false);
772  worldVis.setShowDaughters(true);
773  worldVis.setColor(1., 1., 1., 1.);
774  worldVis.setLineStyle(VisAttr::SOLID);
776  //m_worldVol.setVisAttributes(worldVis);
777  m_worldVol->SetVisibility(kFALSE);
778  m_worldVol->SetVisDaughters(kTRUE);
779  m_worldVol->SetVisContainers(kTRUE);
780  add(worldVis);
781  }
782  m_worldVol.setVisAttributes(worldVis);
783  m_manager->SetTopVolume(m_worldVol.ptr());
784 
787  m_world.setPlacement(mgr->GetTopNode());
788 
790  m_parallelWorldVol = Volume("parallel_world_volume", worldSolid, m_materialAir);
791 
793  m_field = OverlayedField("global");
794  m_state = LOADING;
795  }
796 }
797 
799 void DetectorImp::fromXML(const std::string& xmlfile, DetectorBuildType build_type) {
800  std::lock_guard<std::recursive_mutex> lock(s_detector_apply_lock);
801  m_buildType = build_type;
802  processXML(xmlfile, nullptr);
803 }
804 
806 void DetectorImp::fromXML(const std::string& fname, xml::UriReader* entity_resolver, DetectorBuildType build_type) {
807  std::lock_guard<std::recursive_mutex> lock(s_detector_apply_lock);
808  m_buildType = build_type;
809  processXML(fname, entity_resolver);
810 }
811 
812 void DetectorImp::dump() const {
813  TGeoManager* mgr = m_manager;
814  mgr->SetVisLevel(4);
815  mgr->SetVisOption(1);
816  m_worldVol->Draw("ogl");
817 }
818 
820 long DetectorImp::apply(const char* factory_type, int argc, char** argv) const {
821  std::lock_guard<std::recursive_mutex> lock(s_detector_apply_lock);
822  std::string fac = factory_type;
823  try {
824  Detector* thisPtr = const_cast<DetectorImp*>(this);
825  long result = PluginService::Create<long>(fac, thisPtr, argc, argv);
826  if (0 == result) {
827  PluginDebug dbg;
828  result = PluginService::Create<long>(fac, thisPtr, argc, argv);
829  if ( 0 == result ) {
830  throw std::runtime_error("dd4hep: apply-plugin: Failed to locate plugin " +
831  fac + ". " + dbg.missingFactory(fac));
832  }
833  }
834  result = *(long*) result;
835  if (result != 1) {
836  throw std::runtime_error("dd4hep: apply-plugin: Failed to execute plugin " + fac);
837  }
838  return result;
839  }
840  catch (const xml::XmlException& e) {
841  throw std::runtime_error(xml::_toString(e.msg) + "\ndd4hep: XML-DOM Exception with plugin:" + fac);
842  }
843  catch (const std::exception& e) {
844  throw std::runtime_error(std::string(e.what()) + "\ndd4hep: with plugin:" + fac);
845  }
846  catch (...) {
847  throw std::runtime_error("UNKNOWN exception from plugin:" + fac);
848  }
849  return EINVAL;
850 }
dd4hep::DetectorImp::detectors
virtual const HandleMap & detectors() const override
Accessor to the map of sub-detectors.
Definition: DetectorImp.h:296
dd4hep::DetectorImp::DetectorImp
DetectorImp()
Default constructor used by ROOT I/O.
Definition: DetectorImp.cpp:151
dd4hep::Detector::LOADING
@ LOADING
The geometry is being created and loaded. (parsing ongoing)
Definition: Detector.h:102
dd4hep::DetectorImp::add
virtual Detector & add(Constant x) override
Add a new constant to the detector description.
Definition: DetectorImp.h:342
dd4hep::detail::OpticalSurfaceManagerObject
This structure describes the internal data of the volume manager object.
Definition: OpticalSurfaceManagerInterna.h:43
dd4hep::DetectorData::m_sensitive
ObjectHandleMap m_sensitive
The map of top level sub-detector sensitive detector objects indexed by the detector name.
Definition: DetectorData.h:110
dd4hep::ExtensionEntry
Definition of the extension entry interface class.
Definition: ExtensionEntry.h:37
dd4hep::DetectorImp::init
virtual void init() override
Open the geometry at startup.
Definition: DetectorImp.cpp:737
dd4hep::DetectorData::m_detectorParents
std::map< std::string, DetElement > m_detectorParents
Definition: DetectorData.h:120
dd4hep::DetectorImp::buildType
virtual DetectorBuildType buildType() const override
Access flag to steer the detail of building of the geometry/detector description.
Definition: DetectorImp.cpp:282
dd4hep::DetectorImp::m_buildType
DetectorBuildType m_buildType
VolumeManager m_volManager;.
Definition: DetectorImp.h:71
dd4hep::xml::XmlException
xercesc::DOMException XmlException
Definition: DetectorImp.cpp:53
dd4hep::detail::destroyHandle
void destroyHandle(T &handle)
Helper to delete objects from heap and reset the handle.
Definition: Handle.h:183
v
View * v
Definition: MultiView.cpp:28
dd4hep::WorldObject
Data class with properties of a detector element.
Definition: DetectorInterna.h:185
dd4hep::SensitiveDetector
Handle class to hold the information of a sensitive detector.
Definition: DetElement.h:43
DetectorImp.h
dd4hep::DetectorData::ObjectHandleMap::append
void append(const Handle< NamedObject > &e, bool throw_on_doubles=true)
Append entry to map.
Definition: DetectorData.h:69
dd4hep::DetectorData::m_trackingVol
Volume m_trackingVol
Definition: DetectorData.h:126
dd4hep::exception
void exception(const std::string &src, const std::string &msg)
Definition: RootDictionary.h:69
dd4hep::Region::setStoreSecondaries
Region & setStoreSecondaries(bool value)
Set flag to store secondaries.
Definition: Objects.cpp:500
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:164
dd4hep::VisAttr
Handle class describing visualization attributes.
Definition: Objects.h:323
dd4hep::DetectorImp::addConstant
virtual Detector & addConstant(const Handle< NamedObject > &x) override
Add a new constant by named reference to the detector description.
Definition: DetectorImp.cpp:452
dd4hep::STD_Conditions::USER
@ USER
Definition: Detector.h:63
dd4hep::DetElement::placement
PlacedVolume placement() const
Access to the physical volume of this detector element.
Definition: DetElement.cpp:321
VolumeManagerInterna.h
dd4hep::DetectorImp::addField
virtual Detector & addField(const Handle< NamedObject > &x) override
Add a field component by named reference to the detector description.
Definition: DetectorImp.cpp:498
dd4hep::DetectorData::m_world
DetElement m_world
Definition: DetectorData.h:122
dd4hep::ObjectExtensions::removeExtension
void * removeExtension(unsigned long long int key, bool destroy)
Remove an existing extension object from the instance.
Definition: ObjectExtensions.cpp:90
dd4hep::VisAttr::setShowDaughters
void setShowDaughters(bool value)
Set Flag to show/hide daughter elements.
Definition: Objects.cpp:335
dd4hep::versionString
std::string versionString()
return a string with the current dd4hep version in the form vXX-YY.
Definition: DetectorImp.cpp:122
dd4hep::Volume::solid
Solid solid() const
Access to Solid (Shape)
Definition: Volumes.cpp:1252
dd4hep::DetectorImp::m_std_conditions
STD_Conditions m_std_conditions
Standard conditions.
Definition: DetectorImp.h:65
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:126
dd4hep::Handle< NamedObject >
DetectorInterna.h
dd4hep::Volume::setRegion
const Volume & setRegion(const Detector &description, const std::string &name) const
Set the regional attributes to the volume. Note: If the name string is empty, the action is ignored.
Definition: Volumes.cpp:1271
dd4hep::PlacedVolume::Object
PlacedVolumeExtension Object
Definition: Volumes.h:166
dd4hep::STD_Conditions::USER_SET
@ USER_SET
Definition: Detector.h:64
dd4hep::OverlayedField::add
void add(CartesianField field)
Add a new field component.
Definition: Fields.cpp:110
dd4hep::InstanceCount::increment
static void increment(T *)
Increment count according to type information.
Definition: InstanceCount.h:98
dd4hep::DetectorImp::addDetector
virtual Detector & addDetector(const Handle< NamedObject > &x) override
Add a new subdetector by named reference to the detector description.
Definition: DetectorImp.cpp:396
dd4hep::VisAttr::setLineStyle
void setLineStyle(int style)
Set line style.
Definition: Objects.cpp:355
dd4hep::Solid_type< TGeoShape >
dd4hep::DetElement::add
DetElement & add(DetElement sub_element)
Add new child to the detector structure.
Definition: DetElement.cpp:258
dd4hep::DetectorImp::detector
virtual DetElement detector(const std::string &name) const override
Retrieve a subdetector element by its name from the detector description.
Definition: DetectorImp.cpp:387
DetectorHelper.h
dd4hep::DetectorData::m_field
OverlayedField m_field
Definition: DetectorData.h:131
dd4hep::Handle::name
const char * name() const
Access the object name (or "" if not supported by the object)
dd4hep::DetectorData::patchRootStreamer
static void patchRootStreamer(TClass *cl)
Assignment operator.
Definition: DetectorData.cpp:187
dd4hep::DetectorImp::world
virtual DetElement world() const override
Return reference to the top-most (world) detector element.
Definition: DetectorImp.h:175
dd4hep::DetectorData::m_inhibitConstants
bool m_inhibitConstants
Flag to inhibit the access to global constants. Value set by constants section 'Detector_InhibitConst...
Definition: DetectorData.h:145
dd4hep::_toLong
long _toLong(const std::string &value)
String conversions: string to long integer value.
Definition: Handle.cpp:98
dd4hep::DetectorData::m_worldVol
Volume m_worldVol
Definition: DetectorData.h:124
dd4hep::detail::GeoScan
Geometry scanner (handle object)
Definition: GeoHandler.h:137
dd4hep::OverlayedField
Class describing a field overlay with several sources.
Definition: Fields.h:138
dd4hep::DetectorData::m_define
ObjectHandleMap m_define
Definition: DetectorData.h:118
dd4hep::Volume::material
Material material() const
Access to the Volume material.
Definition: Volumes.cpp:1151
dd4hep::DetectorImp::constantAsLong
virtual long constantAsLong(const std::string &name) const override
Typed access to constants: long values.
Definition: DetectorImp.cpp:482
dd4hep::detail::tools::findElement
DetElement findElement(const Detector &description, const std::string &path)
Find DetElement as child of the top level volume by its absolute path.
Definition: DetectorTools.cpp:215
DocumentHandler.h
dd4hep::Material
Handle class describing a material.
Definition: Objects.h:271
dd4hep::DetectorImp::declareParent
virtual void declareParent(const std::string &detector_name, const DetElement &parent) override
Register new mother volume using the detector name.
Definition: DetectorImp.cpp:289
dd4hep::DetectorImp::m_detectorTypes
DetectorTypeMap m_detectorTypes
Inventory of detector types.
Definition: DetectorImp.h:68
dd4hep::DetectorHelper::detectorByID
DetElement detectorByID(int id) const
Find a detector element by its system ID.
Definition: DetectorHelper.cpp:48
dd4hep::VisAttr::setDrawingStyle
void setDrawingStyle(int style)
Set drawing style.
Definition: Objects.cpp:365
dd4hep::STD_Conditions::temperature
double temperature
Definition: Detector.h:69
dd4hep::BUILD_NONE
@ BUILD_NONE
Definition: BuildType.h:35
dd4hep::Detector::getInstance
static Detector & getInstance(const std::string &name="default")
—Factory method----—
Definition: DetectorImp.cpp:132
dd4hep::STD_Conditions
Helper class to access default temperature and pressure.
Definition: Detector.h:58
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:187
dd4hep::Utilities::GetName
const char * GetName(T *p)
Definition: Utilities.h:45
dd4hep::Constant
Handle class describing a constant (define) object in description.
Definition: Objects.h:208
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:371
dd4hep::VolumeManager
Class to support the retrieval of detector elements and volumes given a valid identifier.
Definition: VolumeManager.h:135
dd4hep::DetectorImp::~DetectorImp
virtual ~DetectorImp()
Standard destructor.
Definition: DetectorImp.cpp:217
dd4hep::DetectorData::m_state
Detector::State m_state
Detector description state.
Definition: DetectorData.h:142
dd4hep::DetectorData::m_volManager
VolumeManager m_volManager
Volume manager reference.
Definition: DetectorData.h:139
dd4hep::VisAttr::setVisible
void setVisible(bool value)
Set visibility flag.
Definition: Objects.cpp:345
dd4hep::DetectorImp::dump
virtual void dump() const override
Stupid legacy method.
Definition: DetectorImp.cpp:812
dd4hep::DetectorImp::visAttributes
virtual const HandleMap & visAttributes() const override
Accessor to the map of visualisation attributes.
Definition: DetectorImp.h:280
DetectorTools.h
dd4hep::DetectorData::m_detectors
ObjectHandleMap m_detectors
The map of top level sub-detector objects indexed by name.
Definition: DetectorData.h:112
dd4hep::DetectorImp::constant
virtual Constant constant(const std::string &name) const override
Retrieve a constant by its name from the detector description.
Definition: DetectorImp.cpp:463
dd4hep::InstanceCount::decrement
static void decrement(T *)
Decrement count according to type information.
Definition: InstanceCount.h:102
dd4hep::xml
Namespace for the AIDA detector description toolkit supporting XML utilities.
Definition: ConditionsTags.h:27
dd4hep::DetectorImp::apply
virtual long apply(const char *factory, int argc, char **argv) const override
Manipulate geometry using facroy converter.
Definition: DetectorImp.cpp:820
dd4hep::Detector::destroyInstance
static void destroyInstance(const std::string &name="default")
Destroy the singleton instance.
Definition: DetectorImp.cpp:144
dd4hep::DetectorImp::removeUserExtension
virtual void * removeUserExtension(unsigned long long int key, bool destroy=true) override
Remove an existing extension object from the Detector instance. If not destroyed, the instance is ret...
Definition: DetectorImp.cpp:272
TNamed
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:37
dd4hep::DetectorImp::saveObject
Int_t saveObject(const char *name=0, Int_t option=0, Int_t bufsize=0) const
ROOT I/O call.
Definition: DetectorImp.cpp:237
Plugins.h
dd4hep::Region
Handle class describing a region as used in simulation.
Definition: Objects.h:461
dd4hep::PluginDebug
Helper to debug plugin manager calls.
Definition: Plugins.h:73
dd4hep::DetectorHelper
DetectorHelper: class to shortcut certain questions to the dd4hep detector description interface.
Definition: DetectorHelper.h:32
dd4hep::DetectorData::m_materialAir
Material m_materialAir
Definition: DetectorData.h:128
dd4hep::DetectorData::destroyData
void destroyData(bool destroy_mgr=true)
Clear data content: releases all allocated resources.
Definition: DetectorData.cpp:209
dd4hep::xml::_toString
std::string _toString(const Attribute attr)
Convert xml attribute to STL string.
Definition: XMLElements.cpp:237
dd4hep::DetectorImp::endDocument
virtual void endDocument(bool close_geometry) override
Close the geometry.
Definition: DetectorImp.cpp:699
dd4hep::DetectorImp::material
virtual Material material(const std::string &name) const override
Retrieve a matrial by its name from the detector description.
Definition: DetectorImp.cpp:505
dd4hep::Detector::make_unique
static std::unique_ptr< Detector > make_unique(const std::string &name)
Unique creation without internal registration.
Definition: DetectorImp.cpp:128
dd4hep::DetectorLoad
Data implementation class of the Detector interface.
Definition: DetectorLoad.h:43
dd4hep::PluginDebug::missingFactory
std::string missingFactory(const std::string &name) const
Helper to check factory existence.
Definition: Plugins.cpp:147
dd4hep::DetectorData::m_fields
ObjectHandleMap m_fields
The map of electro magnet field components for the global overlay field.
Definition: DetectorData.h:116
dd4hep::DetectorImp::stdConditions
virtual const STD_Conditions & stdConditions() const override
Access default conditions (temperature and pressure.
Definition: DetectorImp.cpp:345
dd4hep::DetectorImp::pickMotherVolume
virtual Volume pickMotherVolume(const DetElement &sd) const override
Access mother volume by detector element.
Definition: DetectorImp.cpp:315
dd4hep::DetElement::setPlacement
DetElement & setPlacement(const PlacedVolume &volume)
Set the physical volumes of the detector element.
Definition: DetElement.cpp:330
dd4hep::NamedObject::GetTitle
const char * GetTitle() const
Get name (used by Handle)
Definition: NamedObject.h:70
detectors
DetectorMap detectors
Definition: AlignmentsCalculator.cpp:79
dd4hep::xml::UriReader
Class supporting to read data given a URI.
Definition: UriReader.h:35
dd4hep::SensitiveDetector::type
std::string type() const
Access the type of the sensitive detector.
Definition: DetElement.cpp:409
dd4hep::Detector::HandleMap
std::map< std::string, Handle< NamedObject > > HandleMap
Type definition of a map of named handles.
Definition: Detector.h:93
dd4hep::DetectorData::ObjectHandleMap
Implementation of a map of named dd4hep Handles.
Definition: DetectorData.h:59
dd4hep::DetectorImp::m_surfaceManager
detail::OpticalSurfaceManagerObject * m_surfaceManager
Optical surface manager.
Definition: DetectorImp.h:74
dd4hep::DetectorHelper::sensitiveDetector
SensitiveDetector sensitiveDetector(const std::string &detector) const
Access the sensitive detector of a given subdetector (if the sub-detector is sensitive!...
Definition: DetectorHelper.cpp:23
dd4hep::VolumeManager::TREE
@ TREE
Definition: VolumeManager.h:140
dd4hep::DetectorImp::userExtension
virtual void * userExtension(unsigned long long int key, bool alert=true) const override
Access an existing extension object from the Detector instance.
Definition: DetectorImp.cpp:277
dd4hep::STD_Conditions::USER_NOTIFIED
@ USER_NOTIFIED
Definition: Detector.h:65
dd4hep::_toDouble
double _toDouble(const std::string &value)
String conversions: string to double value.
Definition: Handle.cpp:116
key
unsigned char key
Definition: AlignmentsCalculator.cpp:69
dd4hep::DetectorImp::addUserExtension
virtual void * addUserExtension(unsigned long long int key, ExtensionEntry *entry) override
Add an extension object to the Detector instance.
Definition: DetectorImp.cpp:267
dd4hep::DetectorImp::constantAsString
virtual std::string constantAsString(const std::string &name) const override
Typed access to constants: access string values.
Definition: DetectorImp.cpp:471
dd4hep::Box
Class describing a box shape.
Definition: Shapes.h:295
dd4hep::DetectorImp::addVisAttribute
virtual Detector & addVisAttribute(const Handle< NamedObject > &x) override
Add a new visualisation attribute by named reference to the detector description.
Definition: DetectorImp.h:402
dd4hep::DetectorImp::fromXML
virtual void fromXML(const std::string &fname, DetectorBuildType type=BUILD_DEFAULT) override
Read any XML file.
Definition: DetectorImp.cpp:799
dd4hep::DetectorData::m_parallelWorldVol
Volume m_parallelWorldVol
Definition: DetectorData.h:125
dd4hep::VisAttr::SOLID
@ SOLID
Definition: Objects.h:326
dd4hep::Handle::ptr
T * ptr() const
Access to the held object.
Definition: Handle.h:151
dd4hep::DetectorData::m_materialVacuum
Material m_materialVacuum
Definition: DetectorData.h:129
ObjectsInterna.h
dd4hep::DetectorData::m_extensions
ObjectExtensions m_extensions
Definition of the extension type.
Definition: DetectorData.h:137
dd4hep::ObjectExtensions::clear
void clear(bool destroy=true)
Clear all extensions.
Definition: ObjectExtensions.cpp:49
dd4hep::DetectorImp::setStdConditions
virtual void setStdConditions(double temp, double pressure) override
Set the STD temperature and pressure.
Definition: DetectorImp.cpp:355
dd4hep::STD_Conditions::convention
long convention
Definition: Detector.h:70
OpticalSurfaceManagerInterna.h
dd4hep::Volume::setVisAttributes
const Volume & setVisAttributes(const VisAttr &obj) const
Set Visualization attributes to the volume.
Definition: Volumes.cpp:1156
dd4hep::Detector::extension
IFACE * extension(bool alert=true) const
Access extension element by the type.
Definition: Detector.h:342
dd4hep::DetectorBuildType
DetectorBuildType
Detector description build types.
Definition: BuildType.h:34
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::VisAttr::WIREFRAME
@ WIREFRAME
Definition: Objects.h:326
det
DetElement::Object * det
Definition: AlignmentsCalculator.cpp:66
dd4hep::DetectorData
Data implementation class of the Detector interface.
Definition: DetectorData.h:38
dd4hep::PlacedVolume::volume
Volume volume() const
Logical volume of this placement.
Definition: Volumes.cpp:468
dd4hep::STD_Conditions::pressure
double pressure
Definition: Detector.h:68
dd4hep::DetectorImp::mapDetectorTypes
void mapDetectorTypes()
Internal helper to map detector types once the geometry is closed.
Definition: DetectorImp.cpp:514
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::Readout
Handle to the implementation of the readout structure of a subdetector.
Definition: Readout.h:38
dd4hep::DetectorData::m_manager
TGeoManager * m_manager
Reference to the geometry manager object from ROOT.
Definition: DetectorData.h:100
dd4hep::DetectorImp::detectorTypes
virtual std::vector< std::string > detectorTypes() const override
Access the available detector types.
Definition: DetectorImp.cpp:535
dd4hep::DetElement::id
int id() const
Get the detector identifier.
Definition: DetElement.cpp:169
dd4hep::DetectorImp::getRefChild
virtual Handle< NamedObject > getRefChild(const HandleMap &e, const std::string &name, bool throw_if_not=true) const
Definition: DetectorImp.cpp:606
dd4hep::STD_Conditions::STP
@ STP
Definition: Detector.h:61
dd4hep::DetectorData::m_invisibleVis
VisAttr m_invisibleVis
Definition: DetectorData.h:130
InstanceCount.h
dd4hep::VisAttr::setColor
void setColor(float alpha, float red, float green, float blue)
Set object color.
Definition: Objects.cpp:380
ClassImp
ClassImp(DetectorImp) namespace
Definition: DetectorImp.cpp:60
dd4hep::DetElementObject::IS_TOP_LEVEL_DETECTOR
@ IS_TOP_LEVEL_DETECTOR
Definition: DetectorInterna.h:93
DD4hepUnits.h
Printout.h
dd4hep::DetectorImp::imp_loadVolumeManager
void imp_loadVolumeManager()
Local method (no interface): Load volume manager.
Definition: DetectorImp.cpp:261
dd4hep::DetectorImp::constantAsDouble
virtual double constantAsDouble(const std::string &name) const override
Typed access to constants: double values.
Definition: DetectorImp.cpp:490
dd4hep::DetectorData::unpatchRootStreamer
static void unpatchRootStreamer(TClass *cl)
UNPatch the ROOT streamers to adapt for DD4hep (set fUserExtension transient)
Definition: DetectorData.cpp:198
dd4hep::DetectorImp
Concrete implementation class of the Detector interface.
Definition: DetectorImp.h:59
dd4hep::ObjectExtensions::addExtension
void * addExtension(unsigned long long int key, ExtensionEntry *entry)
Add an extension object to the detector element.
Definition: ObjectExtensions.cpp:67
dd4hep::DetectorLoad::processXML
virtual void processXML(const std::string &fname, xml::UriReader *entity_resolver=0)
Process XML unit and adopt all data from source structure.
Definition: DetectorLoad.cpp:49
dd4hep::ObjectExtensions::extension
void * extension(unsigned long long int key, bool alert) const
Access an existing extension object from the detector element.
Definition: ObjectExtensions.cpp:119
dd4hep::Detector::READY
@ READY
The geometry is loaded.
Definition: Detector.h:104
dd4hep::STD_Conditions::NTP
@ NTP
Definition: Detector.h:62
GeoHandler.h
dd4hep::Region::setThreshold
Region & setThreshold(double value)
Set threshold in MeV.
Definition: Objects.cpp:505