DD4hep  1.36.0
Detector Description Toolkit for High Energy Physics
Objects.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 // Framework include files
15 #include <DD4hep/Detector.h>
16 #include <DD4hep/Printout.h>
17 #include <DD4hep/IDDescriptor.h>
18 #include <DD4hep/InstanceCount.h>
20 
21 #include <TMap.h>
22 #include <TROOT.h>
23 #include <TColor.h>
24 #include <TGeoMatrix.h>
25 #include <TGeoManager.h>
26 #include <TGeoElement.h>
27 #include <TGeoMaterial.h>
28 
29 // C/C++ include files
30 #include <cmath>
31 #include <sstream>
32 
33 using namespace dd4hep;
34 
36 Author::Author(Detector& /* description */) {
37  m_element = new NamedObject("", "author");
38 }
39 
41 std::string Author::authorName() const {
42  return m_element->GetName();
43 }
44 
46 void Author::setAuthorName(const std::string& nam) {
47  m_element->SetName(nam.c_str());
48 }
49 
51 std::string Author::authorEmail() const {
52  return m_element->GetTitle();
53 }
54 
56 void Author::setAuthorEmail(const std::string& addr) {
57  m_element->SetTitle(addr.c_str());
58 }
59 
61 Header::Header(const std::string& author_name, const std::string& descr_url) {
62  Object* obj_ptr = new Object();
63  assign(obj_ptr, author_name, descr_url);
64 }
65 
67 const std::string Header::name() const {
68  return m_element->GetName();
69 }
70 
72 void Header::setName(const std::string& new_name) {
73  m_element->SetName(new_name.c_str());
74 }
75 
77 const std::string Header::title() const {
78  return m_element->GetTitle();
79 }
80 
82 void Header::setTitle(const std::string& new_title) {
83  m_element->SetTitle(new_title.c_str());
84 }
85 
87 const std::string& Header::url() const {
88  return data<Object>()->url;
89 }
90 
92 void Header::setUrl(const std::string& new_url) {
93  data<Object>()->url = new_url;
94 }
95 
97 const std::string& Header::author() const {
98  return data<Object>()->author;
99 }
100 
102 void Header::setAuthor(const std::string& new_author) {
103  data<Object>()->author = new_author;
104 }
105 
107 const std::string& Header::status() const {
108  return data<Object>()->status;
109 }
110 
112 void Header::setStatus(const std::string& new_status) {
113  data<Object>()->status = new_status;
114 }
115 
117 const std::string& Header::version() const {
118  return data<Object>()->version;
119 }
120 
122 void Header::setVersion(const std::string& new_version) {
123  data<Object>()->version = new_version;
124 }
125 
127 const std::string& Header::comment() const {
128  return data<Object>()->comment;
129 }
130 
132 void Header::setComment(const std::string& new_comment) {
133  data<Object>()->comment = new_comment;
134 }
135 
137 Constant::Constant(const std::string& nam, const std::string& val, const std::string& typ) {
138  m_element = new Object(nam, val, typ);
139 }
140 
142 Constant::Constant(const std::string& nam) {
143  m_element = new Object(nam.c_str(), "", "number");
144 }
145 
147 std::string Constant::dataType() const {
148  if ( isValid() ) {
149  return m_element->dataType;
150  }
151  throw std::runtime_error("dd4hep: Attempt to access internals from invalid Constant handle!");
152 }
153 
155 std::string Constant::toString() const {
156  std::stringstream os;
157  os << m_element->GetName() << " \"" << m_element->GetTitle() << "\" ";
158  if ( m_element->dataType == "string" ) os << "Value:" << m_element->GetTitle();
159  else os << "Value:" << _toDouble(m_element->GetTitle());
160  return os.str();
161 }
162 
164 Atom::Atom(const std::string& nam, const std::string& formula, int Z, int N, double density) {
165  TGeoElementTable* t = TGeoElement::GetElementTable();
166  TGeoElement* e = t->FindElement(nam.c_str());
167  if (!e) {
168  t->AddElement(nam.c_str(), formula.c_str(), Z, N, density);
169  e = t->FindElement(nam.c_str());
170  }
171  m_element = e;
172 }
173 
175 double Material::Z() const {
176  Handle < TGeoMedium > val(*this);
177  if (val.isValid()) {
178  TGeoMaterial* mat = val->GetMaterial();
179  if ( mat )
180  return mat->GetZ();
181  throw std::runtime_error("dd4hep: The medium " + std::string(val->GetName()) + " has an invalid material reference!");
182  }
183  throw std::runtime_error("dd4hep: Attempt to access proton number from invalid material handle!");
184 }
185 
187 double Material::A() const {
188  if ( isValid() ) {
189  TGeoMaterial* mat = ptr()->GetMaterial();
190  if ( mat )
191  return mat->GetA();
192  throw std::runtime_error("dd4hep: The medium " + std::string(ptr()->GetName()) + " has an invalid material reference!");
193  }
194  throw std::runtime_error("dd4hep: Attempt to access atomic number from invalid material handle!");
195 }
196 
198 double Material::density() const {
199  if ( isValid() ) {
200  TGeoMaterial* mat = ptr()->GetMaterial();
201  if ( mat )
202  return mat->GetDensity();
203  throw std::runtime_error("dd4hep: The medium " + std::string(ptr()->GetName()) + " has an invalid material reference!");
204  }
205  throw std::runtime_error("dd4hep: Attempt to access density from invalid material handle!");
206 }
207 
209 double Material::radLength() const {
210  if ( isValid() ) {
211  TGeoMaterial* mat = ptr()->GetMaterial();
212  if ( mat )
213  return mat->GetRadLen();
214  throw std::runtime_error("dd4hep: The medium " + std::string(ptr()->GetName()) + " has an invalid material reference!");
215  }
216  throw std::runtime_error("dd4hep: Attempt to access radiation length from invalid material handle!");
217 }
218 
220 double Material::intLength() const {
221  if ( isValid() ) {
222  TGeoMaterial* mat = ptr()->GetMaterial();
223  if ( mat )
224  return mat->GetIntLen();
225  throw std::runtime_error("The medium " + std::string(ptr()->GetName()) + " has an invalid material reference!");
226  }
227  throw std::runtime_error("Attempt to access interaction length from invalid material handle!");
228 }
229 
231 double Material::fraction(Atom atom) const {
232  double frac = 0e0, tot = 0e0;
233  TGeoElement* elt = atom.access();
234  TGeoMaterial* mat = access()->GetMaterial();
235  for ( int i=0, n=mat->GetNelements(); i<n; ++i ) {
236  TGeoElement* e = mat->GetElement(i);
237  if ( mat->IsMixture() ) {
238  TGeoMixture* mix = (TGeoMixture*)mat;
239  tot += mix->GetWmixt()[i];
240  }
241  else {
242  tot = 1e0;
243  }
244  if ( e == elt ) {
245  if ( mat->IsMixture() ) {
246  TGeoMixture* mix = (TGeoMixture*)mat;
247  frac += mix->GetWmixt()[i];
248  }
249  else {
250  frac = 1e0;
251  }
252  }
253  }
254  return tot>1e-20 ? frac/tot : 0.0;
255 }
256 
258 std::size_t Material::numProperties() const {
259  return access()->GetMaterial()->GetNproperties();
260 }
261 
263 Material::Property Material::property(std::size_t index) const {
264  return access()->GetMaterial()->GetProperty(index);
265 }
266 
268 Material::Property Material::property(const char* nam) const {
269  return access()->GetMaterial()->GetProperty(nam);
270 }
271 
273 Material::Property Material::property(const std::string& nam) const {
274  return access()->GetMaterial()->GetProperty(nam.c_str());
275 }
276 
278 std::string Material::propertyRef(const std::string& name, const std::string& default_value) {
279  auto* o = access()->GetMaterial();
280  const char* p = o->GetPropertyRef(name.c_str());
281  if ( p ) return p;
282  return default_value;
283 }
284 
286 std::size_t Material::numConstProperties() const {
287  return access()->GetMaterial()->GetNconstProperties();
288 }
289 
291 double Material::constProperty(std::size_t index) const {
292  Bool_t err = kFALSE;
293  const auto* mat = access()->GetMaterial();
294  double value = mat->GetConstProperty(index, &err);
295  if ( err != kTRUE ) return value;
296  throw std::runtime_error("Attempt to access non existing material const property with index: "+std::to_string(index));
297 }
298 
300 double Material::constProperty(const std::string& nam) const {
301  Bool_t err = kFALSE;
302  auto* mat = access()->GetMaterial();
303  double value = mat->GetConstProperty(nam.c_str(), &err);
304  if ( err != kTRUE ) return value;
305  throw std::runtime_error("Attempt to access non existing material const property: "+nam);
306 }
307 
309 std::string Material::constPropertyRef(const std::string& name, const std::string& default_value) {
310  auto* o = access()->GetMaterial();
311  const char* p = o->GetConstPropertyRef(name.c_str());
312  if ( p ) return p;
313  return default_value;
314 }
315 
317 std::string Material::toString() const {
318  if ( isValid() ) {
319  TGeoMedium* val = ptr();
320  std::stringstream out;
321  out << val->GetName() << " " << val->GetTitle()
322  << " id:" << std::hex << val->GetId()
323  << " Pointer:" << val->GetPointerName();
324  return out.str();
325  }
326  throw std::runtime_error("Attempt to convert invalid material handle to string!");
327 }
328 
330 VisAttr::VisAttr(const std::string& nam) {
331  Object* obj = new Object();
332  assign(obj, nam, "vis");
333  obj->color = gROOT->GetColor(kWhite);
334  obj->alpha = 0.9f;
337  setShowDaughters(true);
338  setColor(1e0, 1e0, 1e0, 1e0);
339 }
340 
342 VisAttr::VisAttr(const char* nam) {
343  Object* obj = new Object();
344  assign(obj, nam, "vis");
345  obj->color = gROOT->GetColor(kWhite);
346  obj->alpha = 0.9f;
349  setShowDaughters(true);
350  setColor(1e0, 1e0, 1e0, 1e0);
351 }
352 
355  return object<Object>().showDaughters;
356 }
357 
359 void VisAttr::setShowDaughters(bool value) {
360  object<Object>().showDaughters = value;
361 }
362 
364 bool VisAttr::visible() const {
365  return object<Object>().visible;
366 }
367 
369 void VisAttr::setVisible(bool value) {
370  object<Object>().visible = value;
371 }
372 
374 int VisAttr::lineStyle() const {
375  return object<Object>().lineStyle;
376 }
377 
379 void VisAttr::setLineStyle(int value) {
380  object<Object>().lineStyle = value;
381 }
382 
385  return object<Object>().drawingStyle;
386 }
387 
389 void VisAttr::setDrawingStyle(int value) {
390  object<Object>().drawingStyle = value;
391 }
392 
394 float VisAttr::alpha() const {
395  return object<Object>().alpha;
396 }
397 
399 int VisAttr::color() const {
400  return object<Object>().color->GetNumber();
401 }
402 
404 void VisAttr::setColor(float alpha, float red, float green, float blue) {
405  Object& o = object<Object>();
406  const auto num_before = gROOT->GetListOfColors()->GetLast();
407  // Set tolerance high enough to always lookup from existing palette. This
408  // helps to preserve colors when saving TGeo to .root files.
409  TColor::SetColorThreshold(1.0f/31.0f);
410  Int_t col = TColor::GetColor(red, green, blue);
411  const auto num_after = gROOT->GetListOfColors()->GetLast();
412  if (num_before != num_after) {
413  printout(INFO,"VisAttr","+++ %s Allocated a Color: r:%02X g:%02X b:%02X, this will not save to a ROOT file",
414  this->name(), int(red*255.), int(green*255.), int(blue*255));
415  }
416  o.alpha = alpha;
417  o.color = gROOT->GetColor(col);
418  if ( !o.color ) {
419  except("VisAttr","+++ %s Failed to allocate Color: r:%02X g:%02X b:%02X",
420  this->name(), int(red*255.), int(green*255.), int(blue*255));
421  }
422  o.colortr = new TColor(gROOT->GetListOfColors()->GetLast()+1,
423  o.color->GetRed(), o.color->GetGreen(), o.color->GetBlue());
424  o.colortr->SetAlpha(alpha);
425 }
426 
428 bool VisAttr::rgb(float& red, float& green, float& blue) const {
429  Object& o = object<Object>();
430  if ( o.color ) {
431  o.color->GetRGB(red, green, blue);
432  return true;
433  }
434  return false;
435 }
436 
438 bool VisAttr::argb(float& alpha, float& red, float& green, float& blue) const {
439  Object& o = object<Object>();
440  if ( o.color ) {
441  alpha = o.alpha;
442  o.color->GetRGB(red, green, blue);
443  return true;
444  }
445  return false;
446 }
447 
449 std::string VisAttr::toString() const {
450  const VisAttr::Object* obj = &object<Object>();
451  TColor* c = obj->color;
452  char text[256];
453  std::snprintf(text, sizeof(text), "%-20s RGB:%-8s [%d] %7.2f Style:%d %d ShowDaughters:%3s Visible:%3s", ptr()->GetName(),
454  c->AsHexString(), c->GetNumber(), c->GetAlpha(), int(obj->drawingStyle), int(obj->lineStyle),
455  yes_no(obj->showDaughters), yes_no(obj->visible));
456  return text;
457 }
458 
460 bool Limit::operator==(const Limit& c) const {
461  return value == c.value && name == c.name && particles == c.particles;
462 }
463 
465 bool Limit::operator<(const Limit& c) const {
466  if (name < c.name)
467  return true;
468  if (value < c.value)
469  return true;
470  if (particles < c.particles)
471  return true;
472  return false;
473 }
474 
476 std::string Limit::toString() const {
477  std::string res = name + " = " + content;
478  if (!unit.empty())
479  res += unit + " ";
480  res += " (" + particles + ")";
481  return res;
482 }
483 
485 LimitSet::LimitSet(const std::string& nam) {
486  assign(new Object(), nam, "limitset");
487 }
488 
490 bool LimitSet::addLimit(const Limit& limit) {
491  std::pair<Object::iterator, bool> ret = data<Object>()->limits.insert(limit);
492  return ret.second;
493 }
494 
496 const std::set<Limit>& LimitSet::limits() const {
497  const Object* o = data<Object>();
498  return o->limits;
499 }
500 
502 bool LimitSet::addCut(const Limit& cut_obj) {
503  std::pair<Object::iterator, bool> ret = data<Object>()->cuts.insert(cut_obj);
504  return ret.second;
505 }
506 
508 const std::set<Limit>& LimitSet::cuts() const {
509  return data<Object>()->cuts;
510 }
511 
513 Region::Region(const std::string& nam) {
514  Object* p = new Object();
515  assign(p, nam, "region");
516  p->magic = magic_word();
517  p->store_secondaries = false;
518  p->threshold = 10.0;
519  p->cut = 10.0;
520  p->use_default_cut = true;
521  p->was_threshold_set = false;
522 }
523 
525  object<Object>().store_secondaries = value;
526  return *this;
527 }
528 
529 Region& Region::setThreshold(double value) {
530  object<Object>().threshold = value;
531  object<Object>().was_threshold_set = true;
532  return *this;
533 }
534 
535 Region& Region::setCut(double value) {
536  object<Object>().cut = value;
537  object<Object>().use_default_cut = false;
538  return *this;
539 }
540 
542 std::vector<std::string>& Region::limits() const {
543  return object<Object>().user_limits;
544 }
545 
547 double Region::cut() const {
548  return object<Object>().cut;
549 }
550 
552 double Region::threshold() const {
553  return object<Object>().threshold;
554 }
555 
558  return object<Object>().store_secondaries;
559 }
560 
561 bool Region::useDefaultCut() const {
562  return object<Object>().use_default_cut;
563 }
564 
566  return object<Object>().was_threshold_set;
567 }
568 
569 #undef setAttr
570 
571 #if 0
572 
578 struct IDSpec : public Ref_t {
580  template <typename Q>
581  IDSpec(const Handle<Q>& e) : Ref_t(e) {}
583  IDSpec(Detector& doc, const std::string& name, const IDDescriptor& dsc);
584  void addField(const std::string& name, const std::pair<int,int>& field);
585 };
586 
587 IDSpec::IDSpec(Detector& description, const std::string& name, const IDDescriptor& dsc)
588  : RefElement(doc,Tag_idspec,name)
589 {
590  const IDDescriptor::FieldIDs& f = dsc.ids();
591  const IDDescriptor::FieldMap& m = dsc.fields();
592  object<Object>().Attr_length = dsc.maxBit();
593  for(const auto& i : f ) {
594  const std::string& nam = i.second;
595  const pair<int,int>& fld = m.find(nam)->second;
596  addField(nam,fld);
597  }
598 }
599 
600 void IDSpec::addField(const std::string& name, const pair<int,int>& field) {
601  addField(Strng_t(name),field);
602 }
603 
604 void IDSpec::addField(const std::string& name, const pair<int,int>& field) {
605  Element e(document(),Tag_idfield);
606  e.object<Object>().Attr_signed = field.second<0;
607  e.object<Object>().Attr_label = name;
608  e.object<Object>().Attr_start = field.first;
609  e.object<Object>().Attr_length = abs(field.second);
610  m_element.append(e);
611 }
612 #endif
dd4hep::Header::setAuthor
void setAuthor(const std::string &new_author)
Accessor: set object author.
Definition: Objects.cpp:102
dd4hep::Author::setAuthorEmail
void setAuthorEmail(const std::string &addr)
Set the author's email address.
Definition: Objects.cpp:56
dd4hep::RegionObject::was_threshold_set
bool was_threshold_set
Definition: ObjectsInterna.h:118
dd4hep::Limit::operator==
bool operator==(const Limit &c) const
Equality operator.
Definition: Objects.cpp:460
dd4hep::VisAttr::color
int color() const
Get object color.
Definition: Objects.cpp:399
dd4hep::Header::comment
const std::string & comment() const
Accessor to object comment.
Definition: Objects.cpp:127
dd4hep::LimitSet::cuts
const std::set< Limit > & cuts() const
Accessor to limits container.
Definition: Objects.cpp:508
dd4hep::Atom
Handle class describing an element in the periodic table.
Definition: Objects.h:241
dd4hep::Material::toString
std::string toString() const
String representation of this object.
Definition: Objects.cpp:317
dd4hep::VisAttr::argb
bool argb(float &alpha, float &red, float &green, float &blue) const
Get alpha and RGB values of the color (if valid)
Definition: Objects.cpp:438
dd4hep::VisAttrObject::colortr
TColor * colortr
Definition: ObjectsInterna.h:92
dd4hep::HeaderObject
Concrete object implementation for the Header handle.
Definition: ObjectsInterna.h:39
dd4hep::Header::setStatus
void setStatus(const std::string &new_status)
Accessor: set object status.
Definition: Objects.cpp:112
dd4hep::Region::wasThresholdSet
bool wasThresholdSet() const
Access was_threshold_set flag.
Definition: Objects.cpp:565
dd4hep::IDDescriptor::FieldMap
std::vector< std::pair< std::string, const Field * > > FieldMap
Definition: IDDescriptor.h:39
dd4hep::Handle< HeaderObject >::Object
HeaderObject Object
Extern accessible definition of the contained element type.
Definition: Handle.h:86
dd4hep::Header::title
const std::string title() const
Accessor to object title.
Definition: Objects.cpp:77
Detector.h
dd4hep::Limit::particles
std::string particles
Particle the limit should be applied to.
Definition: Objects.h:399
dd4hep::RegionObject::use_default_cut
bool use_default_cut
Definition: ObjectsInterna.h:117
dd4hep::Author::Author
Author()=default
Default constructor.
dd4hep::Material::Property
const TGDMLMatrix * Property
Definition: Objects.h:273
dd4hep::VisAttr::toString
std::string toString() const
String representation of this object.
Definition: Objects.cpp:449
dd4hep::Region::setStoreSecondaries
Region & setStoreSecondaries(bool value)
Set flag to store secondaries.
Definition: Objects.cpp:524
dd4hep::Region::storeSecondaries
bool storeSecondaries() const
Access secondaries flag.
Definition: Objects.cpp:557
dd4hep::IDDescriptor::maxBit
unsigned maxBit() const
The total number of encoding bits for this descriptor.
Definition: IDDescriptor.cpp:73
dd4hep::Region::setCut
Region & setCut(double value)
Set default production cut.
Definition: Objects.cpp:535
dd4hep::NamedObject::GetName
const char * GetName() const
Access name.
Definition: NamedObject.h:58
dd4hep::Region::Region
Region()=default
Default constructor.
dd4hep::LimitSet::limits
const std::set< Limit > & limits() const
Accessor to limits container.
Definition: Objects.cpp:496
dd4hep::Material::property
Property property(std::size_t index) const
Access to tabular properties of the material by index.
Definition: Objects.cpp:263
dd4hep::Header::setComment
void setComment(const std::string &new_comment)
Accessor: set object comment.
Definition: Objects.cpp:132
dd4hep::Limit
Small object describing a limit structure acting on a particle type.
Definition: Objects.h:396
dd4hep::IDDescriptor
Class implementing the ID encoding of the detector response.
Definition: IDDescriptor.h:36
dd4hep::Limit::toString
std::string toString() const
Conversion to a string representation.
Definition: Objects.cpp:476
dd4hep::RegionObject::cut
double cut
Definition: ObjectsInterna.h:115
dd4hep::VisAttr::setShowDaughters
void setShowDaughters(bool value)
Set Flag to show/hide daughter elements.
Definition: Objects.cpp:359
dd4hep::Material::constPropertyRef
std::string constPropertyRef(const std::string &name, const std::string &default_value="")
Access string property value from the material table.
Definition: Objects.cpp:309
dd4hep::Handle< ConstantObject >::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:126
dd4hep::Handle< TGeoMedium >
dd4hep::magic_word
unsigned long long int magic_word()
Access to the magic word, which is protecting some objects against memory corruptions.
Definition: Handle.h:51
dd4hep::VisAttr::setLineStyle
void setLineStyle(int style)
Set line style.
Definition: Objects.cpp:379
dd4hep::Material::propertyRef
std::string propertyRef(const std::string &name, const std::string &default_value="")
Access string property value from the material table.
Definition: Objects.cpp:278
dd4hep::Header::url
const std::string & url() const
Accessor to object url.
Definition: Objects.cpp:87
dd4hep::Handle< TGeoMedium >::name
const char * name() const
Access the object name (or "" if not supported by the object)
dd4hep::Header::setUrl
void setUrl(const std::string &new_url)
Accessor: set object url.
Definition: Objects.cpp:92
dd4hep::Region::limits
std::vector< std::string > & limits() const
Access references to user limits.
Definition: Objects.cpp:542
dd4hep::Material::intLength
double intLength() const
Access the interaction length of the underlying material.
Definition: Objects.cpp:220
dd4hep::Material::A
double A() const
atomic number of the underlying material
Definition: Objects.cpp:187
dd4hep::Material::fraction
double fraction(Atom atom) const
Access the fraction of an element within the material.
Definition: Objects.cpp:231
dd4hep::NamedObject::SetName
void SetName(const char *nam)
Set name (used by Handle)
Definition: NamedObject.h:62
dd4hep::VisAttr::alpha
float alpha() const
Get alpha value.
Definition: Objects.cpp:394
dd4hep::RegionObject::store_secondaries
bool store_secondaries
Definition: ObjectsInterna.h:116
dd4hep::Material::density
double density() const
density of the underlying material
Definition: Objects.cpp:198
dd4hep::Constant::dataType
std::string dataType() const
Access the constant.
Definition: Objects.cpp:147
dd4hep::Header::name
const std::string name() const
Accessor to object name.
Definition: Objects.cpp:67
dd4hep::VisAttr::lineStyle
int lineStyle() const
Get line style.
Definition: Objects.cpp:374
dd4hep::VisAttr::drawingStyle
int drawingStyle() const
Get drawing style.
Definition: Objects.cpp:384
dd4hep::VisAttr::showDaughters
bool showDaughters() const
Get Flag to show/hide daughter elements.
Definition: Objects.cpp:354
dd4hep::VisAttr::setDrawingStyle
void setDrawingStyle(int style)
Set drawing style.
Definition: Objects.cpp:389
dd4hep::Region::threshold
double threshold() const
Access production threshold.
Definition: Objects.cpp:552
dd4hep::Material::constProperty
double constProperty(std::size_t index) const
Access to const properties of the material by index.
Definition: Objects.cpp:291
dd4hep::Utilities::GetName
const char * GetName(T *p)
Definition: Utilities.h:45
dd4hep::VisAttrObject::showDaughters
unsigned char showDaughters
Definition: ObjectsInterna.h:96
dd4hep::VisAttrObject::lineStyle
unsigned char lineStyle
Definition: ObjectsInterna.h:95
dd4hep::Handle< HeaderObject >::assign
void assign(Object *n, const std::string &nam, const std::string &title)
Assign a new named object. Note: object references must be managed by the user.
mix
#define mix(a, b, c)
Definition: Geant4EventSeed.h:103
dd4hep::Header::setTitle
void setTitle(const std::string &new_title)
Accessor: set object title.
Definition: Objects.cpp:82
dd4hep::VisAttr::setVisible
void setVisible(bool value)
Set visibility flag.
Definition: Objects.cpp:369
dd4hep::Limit::name
std::string name
Limit name.
Definition: Objects.h:401
dd4hep::Author::setAuthorName
void setAuthorName(const std::string &nam)
Set the author's name.
Definition: Objects.cpp:46
dd4hep::RegionObject
Concrete object implementation of the Region Handle.
Definition: ObjectsInterna.h:111
dd4hep::Material::Z
double Z() const
proton number of the underlying material
Definition: Objects.cpp:175
dd4hep::IDDescriptor::FieldIDs
std::vector< std::pair< size_t, std::string > > FieldIDs
Definition: IDDescriptor.h:40
dd4hep::VisAttrObject::color
TColor * color
Definition: ObjectsInterna.h:91
dd4hep::VisAttrObject::drawingStyle
unsigned char drawingStyle
Definition: ObjectsInterna.h:94
dd4hep::NamedObject::SetTitle
void SetTitle(const char *tit)
Set Title (used by Handle)
Definition: NamedObject.h:66
dd4hep::ConstantObject::dataType
std::string dataType
Constant type.
Definition: ObjectsInterna.h:67
dd4hep::Header::author
const std::string & author() const
Accessor to object author.
Definition: Objects.cpp:97
dd4hep::Region
Handle class describing a region as used in simulation.
Definition: Objects.h:469
dd4hep::VisAttr::rgb
bool rgb(float &red, float &green, float &blue) const
Get RGB values of the color (if valid)
Definition: Objects.cpp:428
dd4hep::Header::setName
void setName(const std::string &new_name)
Accessor: set object name.
Definition: Objects.cpp:72
dd4hep::Handle::m_element
T * m_element
Single and only data member: Reference to the actual element.
Definition: Handle.h:91
dd4hep::Limit::content
std::string content
Content.
Definition: Objects.h:405
dd4hep::Limit::unit
std::string unit
Units.
Definition: Objects.h:403
dd4hep::Author::authorName
std::string authorName() const
Access the author's name.
Definition: Objects.cpp:41
dd4hep::Limit::value
double value
Double value.
Definition: Objects.h:407
dd4hep::Atom::Atom
Atom()=default
Default constructor.
dd4hep::NamedObject::GetTitle
const char * GetTitle() const
Get name (used by Handle)
Definition: NamedObject.h:70
dd4hep::Region::cut
double cut() const
Access cut value.
Definition: Objects.cpp:547
dd4hep::LimitSet::addCut
bool addCut(const Limit &limit)
Add new limit. Returns true if the new limit was added, false if it already existed.
Definition: Objects.cpp:502
dd4hep::Constant::toString
std::string toString() const
String representation of this object.
Definition: Objects.cpp:155
dd4hep::IDDescriptor::fields
const FieldMap & fields() const
Access the fieldmap container.
Definition: IDDescriptor.cpp:87
dd4hep::_toDouble
double _toDouble(const std::string &value)
String conversions: string to double value.
Definition: Handle.cpp:116
dd4hep::VisAttr::visible
bool visible() const
Get visibility flag.
Definition: Objects.cpp:364
dd4hep::Header::Header
Header()=default
Default constructor.
IDDescriptor.h
dd4hep::Handle::access
T * access() const
Checked object access. Throws invalid handle runtime exception if invalid handle.
dd4hep::Limit::operator<
bool operator<(const Limit &c) const
operator less
Definition: Objects.cpp:465
dd4hep::Material::numProperties
std::size_t numProperties() const
Access the number of properties attached to the material (if any)
Definition: Objects.cpp:258
dd4hep::VisAttr::SOLID
@ SOLID
Definition: Objects.h:334
dd4hep::Handle< TGeoMedium >::ptr
TGeoMedium * ptr() const
Access to the held object.
Definition: Handle.h:151
ObjectsInterna.h
dd4hep::RegionObject::threshold
double threshold
Definition: ObjectsInterna.h:114
dd4hep::Region::useDefaultCut
bool useDefaultCut() const
Access use_default_cut flag.
Definition: Objects.cpp:561
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::NamedObject
Implementation of a named object.
Definition: NamedObject.h:30
dd4hep::Material::numConstProperties
std::size_t numConstProperties() const
Access the number of const properties attached to the material (if any)
Definition: Objects.cpp:286
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:89
dd4hep::LimitSetObject
Concrete object implementation of the LimitSet Handle.
Definition: ObjectsInterna.h:134
dd4hep::Material::radLength
double radLength() const
Access the radiation length of the underlying material.
Definition: Objects.cpp:209
dd4hep::LimitSetObject::limits
std::set< Limit > limits
Particle specific limits.
Definition: ObjectsInterna.h:141
dd4hep::Header::status
const std::string & status() const
Accessor to object status.
Definition: Objects.cpp:107
InstanceCount.h
dd4hep::VisAttr::setColor
void setColor(float alpha, float red, float green, float blue)
Set object color.
Definition: Objects.cpp:404
dd4hep::Constant::Constant
Constant()=default
Default constructor.
dd4hep::RegionObject::magic
unsigned long magic
Definition: ObjectsInterna.h:113
dd4hep::VisAttrObject::alpha
float alpha
Definition: ObjectsInterna.h:93
dd4hep::LimitSet::addLimit
bool addLimit(const Limit &limit)
Add new limit. Returns true if the new limit was added, false if it already existed.
Definition: Objects.cpp:490
dd4hep::Header::setVersion
void setVersion(const std::string &new_version)
Accessor: set object version.
Definition: Objects.cpp:122
Printout.h
dd4hep::VisAttr::VisAttr
VisAttr()=default
Default constructor.
dd4hep::Header::version
const std::string & version() const
Accessor to object version.
Definition: Objects.cpp:117
dd4hep::Author::authorEmail
std::string authorEmail() const
Access the author's email address.
Definition: Objects.cpp:51
dd4hep::VisAttrObject::visible
unsigned char visible
Definition: ObjectsInterna.h:97
dd4hep::IDDescriptor::ids
const FieldIDs & ids() const
Access the field-id container.
Definition: IDDescriptor.cpp:78
dd4hep::VisAttrObject
Concrete object implementation of the VisAttr Handle.
Definition: ObjectsInterna.h:88
dd4hep::LimitSet::LimitSet
LimitSet()=default
Constructor to be used when reading the already parsed DOM tree.
dd4hep::Region::setThreshold
Region & setThreshold(double value)
Set threshold in MeV.
Definition: Objects.cpp:529