DD4hep  1.31.0
Detector Description Toolkit for High Energy Physics
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 TypePreserve {
67  DetectorBuildType& m_t;
68  TypePreserve(DetectorBuildType& t)
69  : m_t(t) {
70  }
71  ~TypePreserve() {
72  m_t = BUILD_NONE;
73  }
74  };
75 
76  struct Instances {
77  std::recursive_mutex lock;
78  std::map<std::string, Detector*> detectors;
79  Instances() = default;
80  ~Instances() {
81  }
82  Detector* get(const std::string& name) {
83  auto i = detectors.find(name);
84  return i == detectors.end() ? 0 : (*i).second;
85  }
86  void insert(const std::string& name, Detector* detector) {
87  auto i = detectors.find(name);
88  if ( i == detectors.end() ) {
89  detectors.emplace(name,detector);
90  return;
91  }
92  except("DD4hep","Cannot insert detector instance %s [Already present]",name.c_str());
93  }
94  Detector* remove(const std::string& name) {
95  auto i = detectors.find(name);
96  if ( i != detectors.end() ) {
97  Detector* det = (*i).second;
98  detectors.erase(i);
99  return det;
100  }
101  return 0;
102  }
103  };
104 
105  class DetectorGuard final {
106  protected:
107  static std::pair<std::recursive_mutex, std::map<DetectorImp*, TGeoManager*> >& detector_lock() {
108  static std::pair<std::recursive_mutex, std::map<DetectorImp*, TGeoManager*> > s_inst;
109  return s_inst;
110  }
111  DetectorImp* detector {nullptr};
112  public:
113  DetectorGuard(DetectorImp* imp) : detector(imp) {}
114  ~DetectorGuard() = default;
115  void lock(TGeoManager* mgr) const {
116  auto& lock = detector_lock();
117  lock.first.lock();
118  lock.second[detector] = mgr;
119  }
120  TGeoManager* unlock() const {
121  TGeoManager* mgr = nullptr;
122  auto& lock = detector_lock();
123  auto i = lock.second.find(detector);
124  if ( i != lock.second.end() ) {
125  mgr = (*i).second;
126  lock.second.erase(i);
127  }
128  lock.first.unlock();
129  return mgr;
130  }
131  };
132 
133  Instances& detector_instances() {
134  static Instances s_inst;
135  return s_inst;
136  }
137 }
138 
139 std::string dd4hep::versionString(){
140  char vsn[32];
141  std::snprintf(vsn, sizeof(vsn), "v%2.2d-%2.2d", DD4HEP_MAJOR_VERSION, DD4HEP_MINOR_VERSION);
142  return { vsn };
143 }
144 
145 std::unique_ptr<Detector> Detector::make_unique(const std::string& name) {
146  Detector* description = new DetectorImp(name);
147  return std::unique_ptr<Detector>(description);
148 }
149 
150 Detector& Detector::getInstance(const std::string& name) {
151  std::lock_guard<std::recursive_mutex> lock(detector_instances().lock);
152  Detector* description = detector_instances().get(name);
153  if ( 0 == description ) {
154  gGeoManager = 0;
155  description = new DetectorImp(name);
156  detector_instances().insert(name,description);
157  }
158  return *description;
159 }
160 
162 void Detector::destroyInstance(const std::string& name) {
163  std::lock_guard<std::recursive_mutex> lock(detector_instances().lock);
164  Detector* description = detector_instances().remove(name);
165  if (description)
166  delete description;
167 }
168 
171  : TNamed(), DetectorData(), DetectorLoad(this), m_buildType(BUILD_NONE)
172 {
175  m_std_conditions.pressure = Pressure_NTP;
176  m_std_conditions.temperature = Temperature_NTP;
177 }
178 
180 DetectorImp::DetectorImp(const std::string& name)
181  : TNamed(), DetectorData(), DetectorLoad(this), m_buildType(BUILD_NONE)
182 {
183 #if defined(DD4HEP_USE_GEANT4_UNITS)
184  printout(INFO,"DD4hep","++ Using globally Geant4 unit system (mm,ns,MeV)");
185  if ( TGeoManager::GetDefaultUnits() != TGeoManager::kG4Units ) {
186  TGeoManager::LockDefaultUnits(kFALSE);
187  TGeoManager::SetDefaultUnits(TGeoManager::kG4Units);
188  TGeoManager::LockDefaultUnits(kTRUE);
189  }
190 #else
191  if ( TGeoManager::GetDefaultUnits() != TGeoManager::kRootUnits ) {
192  TGeoManager::LockDefaultUnits(kFALSE);
193  TGeoManager::SetDefaultUnits(TGeoManager::kRootUnits);
194  TGeoManager::LockDefaultUnits(kTRUE);
195  }
196 #endif
197 
198  SetName(name.c_str());
199  SetTitle("DD4hep detector description object");
200  //DetectorGuard(this).lock(gGeoManager);
201  gGeoManager = nullptr;
203  m_manager = new TGeoManager(name.c_str(), "Detector Geometry");
204  {
205  m_manager->AddNavigator();
206  m_manager->SetCurrentNavigator(0);
207  gGeoManager = m_manager;
208 #if 1 //FIXME: eventually this should be set to 1 - needs fixes in examples ...
209  TGeoElementTable* table = m_manager->GetElementTable();
210  table->TGeoElementTable::~TGeoElementTable();
211  new(table) TGeoElementTable();
212  // This will initialize the table without filling:
213  table->AddElement("VACUUM","VACUUM", 1, 1, 1e-15);
214 #endif
215  }
216  if ( 0 == gGeoIdentity )
217  {
218  gGeoIdentity = new TGeoIdentity();
219  }
222  m_std_conditions.pressure = Pressure_NTP;
223  m_std_conditions.temperature = Temperature_NTP;
224 
225  VisAttr attr("invisible");
226  attr.setColor(1.0, 0.5, 0.5, 0.5);
229  attr.setVisible(false);
230  attr.setShowDaughters(true);
231  addVisAttribute(attr);
232  m_invisibleVis = attr;
233 }
234 
237  DetectorGuard(this).lock(gGeoManager);
238  if ( m_manager ) {
239  std::lock_guard<std::recursive_mutex> lock(detector_instances().lock);
240  if ( m_manager == gGeoManager ) gGeoManager = 0;
241  Detector* description = detector_instances().get(GetName());
242  if ( 0 != description ) {
243  detector_instances().remove(m_manager->GetName());
244  }
245  }
246  if ( m_surfaceManager ) {
247  delete m_surfaceManager;
248  m_surfaceManager = nullptr;
249  }
250  destroyData(false);
252  m_detectorTypes.clear();
254  DetectorGuard(this).unlock();
255 }
256 
258 Int_t DetectorImp::saveObject(const char *name, Int_t option, Int_t bufsize) const {
259  Int_t nbytes = 0;
260  try {
261  DetectorData::patchRootStreamer(TGeoVolume::Class());
262  DetectorData::patchRootStreamer(TGeoNode::Class());
263  nbytes = TNamed::Write(name, option, bufsize);
264  DetectorData::unpatchRootStreamer(TGeoVolume::Class());
265  DetectorData::unpatchRootStreamer(TGeoNode::Class());
266  return nbytes;
267  }
268  catch (const std::exception& e) {
269  DetectorData::unpatchRootStreamer(TGeoVolume::Class());
270  DetectorData::unpatchRootStreamer(TGeoNode::Class());
271  except("Detector","Exception %s while saving dd4hep::Detector object", e.what());
272  }
273  catch (...) {
274  DetectorData::unpatchRootStreamer(TGeoVolume::Class());
275  DetectorData::unpatchRootStreamer(TGeoNode::Class());
276  except("Detector","UNKNOWN exception while saving dd4hep::Detector object.");
277  }
278  return nbytes;
279 }
280 
281 // Load volume manager
285 }
286 
288 void* DetectorImp::addUserExtension(unsigned long long int key, ExtensionEntry* entry) {
289  return m_extensions.addExtension(key,entry);
290 }
291 
293 void* DetectorImp::removeUserExtension(unsigned long long int key, bool destroy) {
294  return m_extensions.removeExtension(key,destroy);
295 }
296 
298 void* DetectorImp::userExtension(unsigned long long int key, bool alert) const {
299  return m_extensions.extension(key,alert);
300 }
301 
304  std::lock_guard<std::recursive_mutex> lock(s_detector_apply_lock);
306  return temp;
307 }
308 
310 void DetectorImp::declareParent(const std::string& detector_name, const DetElement& parent) {
311  if ( !detector_name.empty() ) {
312  if ( parent.isValid() ) {
313  auto i = m_detectorParents.find(detector_name);
314  if (i == m_detectorParents.end()) {
315  Volume parent_volume = parent.placement().volume();
316  if ( parent_volume.isValid() ) {
317  m_detectorParents.emplace(detector_name,parent);
318  return;
319  }
320  except("DD4hep","+++ Failed to access valid parent volume of %s from %s",
321  detector_name.c_str(), parent.name());
322  }
323  except("DD4hep",
324  "+++ A parent to the detector %s was already registered.",
325  detector_name.c_str());
326  }
327  except("DD4hep",
328  "+++ Attempt to register invalid parent for detector: %s [Invalid-Handle].",
329  detector_name.c_str());
330  }
331  except("DD4hep",
332  "+++ Attempt to register parent to invalid detector [Invalid-detector-name].");
333 }
334 
337  if ( de.isValid() ) {
338  std::string de_name = de.name();
339  auto i = m_detectorParents.find(de_name);
340  if (i == m_detectorParents.end()) {
341  if ( m_worldVol.isValid() ) {
342  return m_worldVol;
343  }
344  except("DD4hep",
345  "+++ The world volume is not (yet) valid. "
346  "Are you correctly building detector %s?",
347  de.name());
348  }
349  if ( (*i).second.isValid() ) {
350  Volume vol = (*i).second.volume();
351  if ( vol.isValid() ) {
352  return vol;
353  }
354  }
355  except("DD4hep",
356  "+++ The mother volume of %s is not valid. "
357  "Are you correctly building detectors?",
358  de.name());
359  }
360  except("DD4hep","Detector: Attempt access mother volume of invalid detector [Invalid-handle]");
361  return 0;
362 }
363 
368  {
369  printout(WARNING,"DD4hep","++ STD conditions NOT defined by client. NTP defaults taken.");
371  }
372  return m_std_conditions;
373 }
375 void DetectorImp::setStdConditions(double temp, double pressure) {
377  m_std_conditions.pressure = pressure;
379  if ( std::abs(temp-Temperature_NTP) < 1e-10 && std::abs(pressure-Pressure_NTP) < 1e-10 )
381  else if ( std::abs(temp-Temperature_STP) < 1e-10 && std::abs(pressure-Pressure_STP) < 1e-10 )
383  else
385 }
386 
388 void DetectorImp::setStdConditions(const std::string& type) {
389  if ( type == "STP" ) {
390  m_std_conditions.temperature = Temperature_STP;
391  m_std_conditions.pressure = Pressure_STP;
393  }
394  else if ( type == "NTP" ) {
395  m_std_conditions.temperature = Temperature_NTP;
396  m_std_conditions.pressure = Pressure_NTP;
398  }
399  else {
400  except("DD4hep",
401  "++ Attempt to set standard conditions to "
402  "unknown conventions (Only STP and NTP allowed).");
403  }
404 }
405 
407 DetElement DetectorImp::detector(const std::string& name) const {
408  HandleMap::const_iterator i = m_detectors.find(name);
409  if (i != m_detectors.end()) {
410  return (*i).second;
411  }
412  DetElement de = detail::tools::findElement(*this,name);
413  return de;
414 }
415 
417  DetElement det_element(ref_det);
418  DetectorHelper helper(this);
419  DetElement existing_det = helper.detectorByID(det_element.id());
420 
421  if ( existing_det.isValid() ) {
422  SensitiveDetector sd = helper.sensitiveDetector(existing_det);
423  if ( sd.isValid() ) {
424  std::stringstream str;
425  str << "Detector: The sensitive sub-detectors " << det_element.name() << " and "
426  << existing_det.name() << " have the identical ID:" << det_element.id() << ".";
427  except("DD4hep",str.str());
428  }
429  }
430  m_detectors.append(ref_det);
431  det_element->flag |= DetElement::Object::IS_TOP_LEVEL_DETECTOR;
432  PlacedVolume pv = det_element.placement();
433  if ( !pv.isValid() ) {
434  std::stringstream str;
435  str << "Detector: Adding subdetectors with no valid placement is not allowed: "
436  << det_element.name() << " ID:" << det_element.id() << ".";
437  except("DD4hep",str.str());
438  }
439  Volume volume = pv->GetMotherVolume();
440  if ( volume == m_worldVol ) {
441  printout(DEBUG,"DD4hep","+++ Detector: Added detector %s to the world instance.",
442  det_element.name());
443  m_world.add(det_element);
444  return *this;
445  }
447  auto ipar = m_detectorParents.find(det_element.name());
448  if (ipar != m_detectorParents.end()) {
449  DetElement parent = (*ipar).second;
450  parent.add(det_element);
451  printout(DEBUG,"DD4hep","+++ Detector: Added detector %s to parent %s.",
452  det_element.name(), parent.name());
453  return *this;
454  }
455 
456  // The detector's placement must be one of the existing detectors
457  for(HandleMap::iterator idet = m_detectors.begin(); idet != m_detectors.end(); ++idet) {
458  DetElement parent((*idet).second);
459  Volume vol = parent.placement().volume();
460  if ( vol == volume ) {
461  printout(INFO,"DD4hep","+++ Detector: Added detector %s to the parent:%s.",
462  det_element.name(),parent.name());
463  parent.add(det_element);
464  return *this;
465  }
466  }
467  except("DD4hep","+++ Detector: The detector %s has no known parent.", det_element.name());
468  throw std::runtime_error("Detector-Error"); // Never called....
469 }
470 
473  if ( strcmp(x.name(),"Detector_InhibitConstants") == 0 ) {
474  const char* title = x->GetTitle();
475  char c = ::toupper(title[0]);
476  m_inhibitConstants = (c=='Y' || c=='T' || c=='1');
477  }
478  m_define.append(x, false);
479  return *this;
480 }
481 
483 Constant DetectorImp::constant(const std::string& name) const {
484  if ( !m_inhibitConstants ) {
485  return getRefChild(m_define, name);
486  }
487  throw std::runtime_error("Detector:constant("+name+"): Access to global constants is inhibited.");
488 }
489 
491 std::string DetectorImp::constantAsString(const std::string& name) const {
492  if ( !m_inhibitConstants ) {
493  Handle<NamedObject> c = constant(name);
494  if (c.isValid())
495  return c->GetTitle();
496  throw std::runtime_error("Detector:constantAsString: The constant " + name + " is not known to the system.");
497  }
498  throw std::runtime_error("Detector:constantAsString("+name+"):: Access to global constants is inhibited.");
499 }
500 
502 long DetectorImp::constantAsLong(const std::string& name) const {
503  if ( !m_inhibitConstants ) {
504  return _toLong(constantAsString(name));
505  }
506  throw std::runtime_error("Detector:constantAsLong("+name+"): Access to global constants is inhibited.");
507 }
508 
510 double DetectorImp::constantAsDouble(const std::string& name) const {
511  if ( !m_inhibitConstants ) {
512  return _toDouble(constantAsString(name));
513  }
514  throw std::runtime_error("Detector:constantAsDouble("+name+"): Access to global constants is inhibited.");
515 }
516 
519  m_field.add(x);
520  m_fields.append(x);
521  return *this;
522 }
523 
525 Material DetectorImp::material(const std::string& name) const {
526  TGeoMedium* mat = m_manager->GetMedium(name.c_str());
527  if (mat) {
528  return Material(mat);
529  }
530  throw std::runtime_error("Cannot find a material referenced by name:" + name);
531 }
532 
535  m_detectorTypes[""] = {};
536  for( const auto& i : m_detectors ) {
537  DetElement det(i.second);
538  if ( det.parent().isValid() ) { // Exclude 'world'
539  HandleMap::const_iterator j=m_sensitive.find(det.name());
540  if ( j != m_sensitive.end() ) {
541  SensitiveDetector sd((*j).second);
542  m_detectorTypes[sd.type()].emplace_back(det);
543  }
544  else if ( det.type() == "compound" ) {
545  m_detectorTypes[det.type()].emplace_back(det);
546  }
547  else {
548  m_detectorTypes["passive"].emplace_back(det);
549  }
550  }
551  }
552 }
553 
555 std::vector<std::string> DetectorImp::detectorTypes() const {
556  if ( m_manager->IsClosed() ) {
557  std::vector<std::string> v;
558  v.reserve(m_detectorTypes.size());
559  for(const auto& t : m_detectorTypes )
560  v.emplace_back(t.first);
561  return v;
562  }
563  throw std::runtime_error("detectorTypes: Call only available once the geometry is closed!");
564 }
565 
567 const std::vector<DetElement>& DetectorImp::detectors(const std::string& type, bool throw_exc) const {
568  if ( m_manager->IsClosed() ) {
569  DetectorTypeMap::const_iterator i=m_detectorTypes.find(type);
570  if ( i != m_detectorTypes.end() ) return (*i).second;
571  if ( throw_exc ) {
572  throw std::runtime_error("detectors("+type+"): Detectors of this type do not exist in the current setup!");
573  }
574  // return empty vector instead of exception
575  return m_detectorTypes.at("") ;
576  }
577  throw std::runtime_error("detectors("+type+"): Detectors can only selected by type once the geometry is closed!");
578 }
579 
580 std::vector<DetElement> DetectorImp::detectors(unsigned int includeFlag, unsigned int excludeFlag ) const {
581  if( ! m_manager->IsClosed() ) {
582  throw std::runtime_error("detectors(typeFlag): Detectors can only selected by typeFlag once the geometry is closed!");
583  }
584  std::vector<DetElement> dets ;
585  dets.reserve( m_detectors.size() ) ;
586 
587  for(HandleMap::const_iterator i=m_detectors.begin(); i!=m_detectors.end(); ++i) {
588  DetElement det((*i).second);
589  if ( det.parent().isValid() ) { // Exclude 'world'
590 
591  //fixme: what to do with compounds - add their daughters ?
592  // ...
593 
594  if( ( det.typeFlag() & includeFlag ) == includeFlag &&
595  ( det.typeFlag() & excludeFlag ) == 0 )
596  dets.emplace_back( det ) ;
597  }
598  }
599  return dets ;
600 }
601 
603 std::vector<DetElement> DetectorImp::detectors(const std::string& type1,
604  const std::string& type2,
605  const std::string& type3,
606  const std::string& type4,
607  const std::string& type5 ) {
608  if ( m_manager->IsClosed() ) {
609  std::vector<DetElement> v;
610  DetectorTypeMap::const_iterator i, end=m_detectorTypes.end();
611  if ( !type1.empty() && (i=m_detectorTypes.find(type1)) != end )
612  v.insert(v.end(),(*i).second.begin(),(*i).second.end());
613  if ( !type2.empty() && (i=m_detectorTypes.find(type2)) != end )
614  v.insert(v.end(),(*i).second.begin(),(*i).second.end());
615  if ( !type3.empty() && (i=m_detectorTypes.find(type3)) != end )
616  v.insert(v.end(),(*i).second.begin(),(*i).second.end());
617  if ( !type4.empty() && (i=m_detectorTypes.find(type4)) != end )
618  v.insert(v.end(),(*i).second.begin(),(*i).second.end());
619  if ( !type5.empty() && (i=m_detectorTypes.find(type5)) != end )
620  v.insert(v.end(),(*i).second.begin(),(*i).second.end());
621  return v;
622  }
623  throw std::runtime_error("detectors("+type1+","+type2+",...): Detectors can only selected by type once the geometry is closed!");
624 }
625 
626 Handle<NamedObject> DetectorImp::getRefChild(const HandleMap& e, const std::string& name, bool do_throw) const {
627  HandleMap::const_iterator it = e.find(name);
628  if (it != e.end()) {
629  return it->second;
630  }
631  if (do_throw) {
632  union ptr {
633  const ObjectHandleMap* omap;
634  const char* c;
635  const void* other;
636  ptr(const void* p) { other = p; }
637  };
638  std::string nam = "";
639  ptr mptr(&e), ref(this);
640  if ( ref.c > mptr.c && mptr.c < ref.c+sizeof(*this) ) {
641  nam = mptr.omap->name;
642  }
643  std::stringstream err;
644  err << "getRefChild: Failed to find child with name: " << name
645  << " Map " << nam << " contains " << e.size() << " elements: {";
646  for (it = e.begin(); it != e.end(); ++it) {
647  if (it != e.begin()) {
648  err << ", ";
649  }
650  err << it->first;
651  }
652  err << "}";
653  throw std::runtime_error(err.str());
654  }
655  return 0;
656 }
657 
658 namespace {
659  struct ShapePatcher: public detail::GeoScan {
660  VolumeManager m_volManager;
661  DetElement m_world;
662  ShapePatcher(VolumeManager m, DetElement e)
663  : detail::GeoScan(e), m_volManager(m), m_world(e) {
664  }
665  void patchShapes() {
666  auto& data = *m_data;
667  char text[32];
668  std::string nam;
669  printout(INFO,"Detector","+++ Patching names of anonymous shapes....");
670  for (auto i = data.rbegin(); i != data.rend(); ++i) {
671  for( const TGeoNode* n : (*i).second ) {
672  TGeoVolume* vol = n->GetVolume();
673  TGeoShape* s = vol->GetShape();
674  const char* sn = s->GetName();
675  ::snprintf(text,sizeof(text),"_shape_%p",(void*)s);
676  if (0 == sn || 0 == ::strlen(sn)) {
677  nam = vol->GetName();
678  nam += text;
679  s->SetName(nam.c_str());
680  }
681  else if (0 == ::strcmp(sn, s->IsA()->GetName())) {
682  nam = vol->GetName();
683  nam += text;
684  s->SetName(nam.c_str());
685  }
686  else {
687  nam = sn;
688  if (nam.find("_shape") == std::string::npos)
689  nam += text;
690  s->SetName(nam.c_str());
691  }
692  if (s->IsA() == TGeoCompositeShape::Class()) {
693  TGeoCompositeShape* c = (TGeoCompositeShape*) s;
694  const TGeoBoolNode* boolean = c->GetBoolNode();
695  s = boolean->GetLeftShape();
696  sn = s->GetName();
697  if (0 == sn || 0 == ::strlen(sn)) {
698  s->SetName((nam + "_left").c_str());
699  }
700  else if (0 == ::strcmp(sn, s->IsA()->GetName())) {
701  s->SetName((nam + "_left").c_str());
702  }
703  s = boolean->GetRightShape();
704  sn = s->GetName();
705  if (0 == sn || 0 == ::strlen(sn)) {
706  s->SetName((nam + "_right").c_str());
707  }
708  else if (0 == ::strcmp(s->GetName(), s->IsA()->GetName())) {
709  s->SetName((nam + "_right").c_str());
710  }
711  }
712  }
713  }
714  }
715  };
716 }
717 
719 void DetectorImp::endDocument(bool close_geometry) {
720  TGeoManager* mgr = m_manager;
721  std::lock_guard<std::recursive_mutex> lock(s_detector_apply_lock);
722  if ( close_geometry && !mgr->IsClosed() ) {
723 #if 0
724  Region trackingRegion("TrackingRegion");
725  trackingRegion.setThreshold(1);
726  trackingRegion.setStoreSecondaries(true);
727  add(trackingRegion);
728  m_trackingVol.setRegion(trackingRegion);
729  // Set the tracking volume to invisible.
730  VisAttr trackingVis("TrackingVis");
731  trackingVis.setVisible(false);
732  m_trackingVol.setVisAttributes(trackingVis);
733  add(trackingVis);
734 #endif
735  m_worldVol.solid()->ComputeBBox();
736  // Propagating reflections: This is useless now and unused!!!!
737  // Since we allow now for anonymous shapes,
738  // we will rename them to use the name of the volume they are assigned to
739  mgr->CloseGeometry();
740  PlacedVolume pv = mgr->GetTopNode();
741  auto* extension = pv->GetUserExtension();
742  if ( nullptr == extension ) {
744  pv->SetUserExtension(extension);
745  }
746  m_world.setPlacement(pv);
747  }
748  // Patching shape names of anaonymous shapes
749  ShapePatcher patcher(m_volManager, m_world);
750  patcher.patchShapes();
752  m_state = READY;
753  //DetectorGuard(this).unlock();
754 }
755 
758  if (!m_world.isValid()) {
759  TGeoManager* mgr = m_manager;
760  std::lock_guard<std::recursive_mutex> lock(s_detector_apply_lock);
761  Constant air_const = getRefChild(m_define, "Air", false);
762  Constant vac_const = getRefChild(m_define, "Vacuum", false);
763  Box worldSolid;
764 
765  m_materialVacuum = material(vac_const.isValid() ? vac_const->GetTitle() : "Vacuum");
766 
767  m_worldVol = m_manager->GetTopVolume();
768  if ( m_worldVol.isValid() ) {
769  worldSolid = m_worldVol.solid();
771  printout(INFO,"Detector", "*********** Use Top Node from manager as "
772  "world volume [%s]. Material: %s BBox: %4.0f %4.0f %4.0f",
773  worldSolid->IsA()->GetName(), m_materialAir.name(),
774  worldSolid->GetDX(), worldSolid->GetDY(), worldSolid->GetDZ());
775  }
776  else {
778  Solid parallelWorldSolid = Box("world_x", "world_y", "world_z");
779  worldSolid = Box("world_x", "world_y", "world_z");
780  m_materialAir = material(air_const.isValid() ? air_const->GetTitle() : "Air");
781  m_worldVol = Volume("world_volume", worldSolid, m_materialAir);
782  parallelWorldSolid->SetName("parallel_world_solid");
783  printout(INFO,"Detector","*********** Created World volume with size: %4.0f %4.0f %4.0f",
784  worldSolid->GetDX(), worldSolid->GetDY(), worldSolid->GetDZ());
785  }
786  m_world = DetElement(new WorldObject(*this,"world"));
788  VisAttr worldVis = visAttributes("WorldVis");
789  if ( !worldVis.isValid() ) {
790  worldVis = VisAttr("WorldVis");
791  worldVis.setVisible(false);
792  worldVis.setShowDaughters(true);
793  worldVis.setColor(1., 1., 1., 1.);
794  worldVis.setLineStyle(VisAttr::SOLID);
796  //m_worldVol.setVisAttributes(worldVis);
797  m_worldVol->SetVisibility(kFALSE);
798  m_worldVol->SetVisDaughters(kTRUE);
799  m_worldVol->SetVisContainers(kTRUE);
800  add(worldVis);
801  }
802  m_worldVol.setVisAttributes(worldVis);
803  m_manager->SetTopVolume(m_worldVol.ptr());
804 
807  m_world.setPlacement(mgr->GetTopNode());
808 
810  m_parallelWorldVol = Volume("parallel_world_volume", worldSolid, m_materialAir);
811 
813  m_field = OverlayedField("global");
814  m_state = LOADING;
815  }
816 }
817 
819 void DetectorImp::fromXML(const std::string& xmlfile, DetectorBuildType build_type) {
820  std::lock_guard<std::recursive_mutex> lock(s_detector_apply_lock);
821  m_buildType = build_type;
822  processXML(xmlfile, 0);
823 }
824 
826 void DetectorImp::fromXML(const std::string& fname, xml::UriReader* entity_resolver, DetectorBuildType build_type) {
827  std::lock_guard<std::recursive_mutex> lock(s_detector_apply_lock);
828  m_buildType = build_type;
829  processXML(fname, entity_resolver);
830 }
831 
832 void DetectorImp::dump() const {
833  TGeoManager* mgr = m_manager;
834  mgr->SetVisLevel(4);
835  mgr->SetVisOption(1);
836  m_worldVol->Draw("ogl");
837 }
838 
840 long DetectorImp::apply(const char* factory_type, int argc, char** argv) const {
841  std::lock_guard<std::recursive_mutex> lock(s_detector_apply_lock);
842  std::string fac = factory_type;
843  try {
844  Detector* thisPtr = const_cast<DetectorImp*>(this);
845  long result = PluginService::Create<long>(fac, thisPtr, argc, argv);
846  if (0 == result) {
847  PluginDebug dbg;
848  result = PluginService::Create<long>(fac, thisPtr, argc, argv);
849  if ( 0 == result ) {
850  throw std::runtime_error("dd4hep: apply-plugin: Failed to locate plugin " +
851  fac + ". " + dbg.missingFactory(fac));
852  }
853  }
854  result = *(long*) result;
855  if (result != 1) {
856  throw std::runtime_error("dd4hep: apply-plugin: Failed to execute plugin " + fac);
857  }
858  return result;
859  }
860  catch (const xml::XmlException& e) {
861  throw std::runtime_error(xml::_toString(e.msg) + "\ndd4hep: XML-DOM Exception with plugin:" + fac);
862  }
863  catch (const std::exception& e) {
864  throw std::runtime_error(std::string(e.what()) + "\ndd4hep: with plugin:" + fac);
865  }
866  catch (...) {
867  throw std::runtime_error("UNKNOWN exception from plugin:" + fac);
868  }
869  return EINVAL;
870 }
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:170
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:757
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:303
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:491
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:472
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:518
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:139
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:416
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:407
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:502
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:310
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:150
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:236
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:832
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:483
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:840
dd4hep::Detector::destroyInstance
static void destroyInstance(const std::string &name="default")
Destroy the singleton instance.
Definition: DetectorImp.cpp:162
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:293
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:258
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:719
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:525
dd4hep::Detector::make_unique
static std::unique_ptr< Detector > make_unique(const std::string &name)
Unique creation without internal registration.
Definition: DetectorImp.cpp:145
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:365
dd4hep::DetectorImp::pickMotherVolume
virtual Volume pickMotherVolume(const DetElement &sd) const override
Access mother volume by detector element.
Definition: DetectorImp.cpp:336
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:298
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:288
dd4hep::DetectorImp::constantAsString
virtual std::string constantAsString(const std::string &name) const override
Typed access to constants: access string values.
Definition: DetectorImp.cpp:491
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:819
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:375
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:534
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 availible detector types.
Definition: DetectorImp.cpp:555
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:626
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:282
dd4hep::DetectorImp::constantAsDouble
virtual double constantAsDouble(const std::string &name) const override
Typed access to constants: double values.
Definition: DetectorImp.cpp:510
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:496