DD4hep  1.31.0
Detector Description Toolkit for High Energy Physics
DetElementCreator.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 // Specialized generic detector constructor
15 //
16 //==========================================================================
17 #ifndef DD4HEP_DETELEMENTCREATOR_H
18 #define DD4HEP_DETELEMENTCREATOR_H
19 
20 // Framework include files
21 #include <DD4hep/VolumeProcessor.h>
22 #include <DD4hep/Printout.h>
23 
24 namespace dd4hep {
25 
27  /* Heuristically assign DetElement structures to the sensitive volume pathes.
28  *
29  * \author M.Frank
30  * \version 1.0
31  * \ingroup DD4HEP_CORE
32  */
34  struct Data {
37  bool sensitive = false;
38  bool has_sensitive = false;
39  int level = 0;
40  int vol_count = 0;
41  int daughter_count = 0;
42  int sensitive_count = 0;
43 
44  Data() = default;
46  Data(const Data& d) = default;
47  Data& operator=(const Data& d) = default;
48  };
49  struct Count {
50  int elements = 0;
51  int volumes = 0;
52  int sensitives = 0;
53  Count() = default;
54  Count(const Count&) = default;
55  Count& operator=(const Count&) = default;
56  };
57  typedef std::vector<Data> VolumeStack;
58  typedef std::map<std::string,DetElement> Detectors;
59  typedef std::map<DetElement,Count> Counters;
60  typedef std::map<std::pair<DetElement,int>, std::pair<int,int> > LeafCount;
61  typedef std::map<PlacedVolume, std::pair<int,int> > AllPlacements;
69  std::string detector;
71  std::string sensitive_type;
72  std::string detector_volume_match;
73  std::string detector_volume_veto;
75  int max_volume_level = 9999;
76  PrintLevel printLevel = INFO;
79 
81  DetElement addSubdetector(const std::string& nam, PlacedVolume pv, bool volid);
83  DetElement createElement(const char* debug_tag, PlacedVolume pv, int id);
87  std::string detElementName(PlacedVolume pv) const;
88  public:
91  const std::string& detector,
92  const std::string& sd_type,
93  const std::string& sd_match,
94  const std::string& sd_veto,
95  const std::string& sd_mat,
96  int sd_lvl,
97  PrintLevel p);
99  virtual ~DetElementCreator() noexcept(false);
101  virtual int operator()(PlacedVolume pv, int level);
103  virtual int process(PlacedVolume pv, int level, bool recursive);
104  };
105 }
106 #endif /* DD4HEP_DETELEMENTCREATOR_H */
107 
108 // Framework include files
110 #include <DD4hep/DetFactoryHelper.h>
111 #include <DD4hep/DetectorHelper.h>
112 #include <DD4hep/Printout.h>
113 
114 // C/C++ include files
115 #include <sstream>
116 
117 using namespace std;
118 using namespace dd4hep;
119 
122  const std::string& det,
123  const string& sd_match,
124  const string& sd_veto,
125  const string& sd_type,
126  const string& sd_mat, int sd_lvl,
127  PrintLevel p)
128  : description(desc), detector(det), sensitive_material_name(sd_mat),
129  sensitive_type(sd_type), detector_volume_match(sd_match),
130  detector_volume_veto(sd_veto), max_volume_level(sd_lvl), printLevel(p)
131 {
132  DetectorHelper helper(description);
134  if ( !sensitive_material.isValid() ) {
135  except("DetElementCreator",
136  "++ Failed to extract MATERIAL from the element table.");
137  }
138  stack.reserve(32);
140 }
141 
144  Count total;
145  stringstream str, id_str;
146  const char* pref = detector_volume_match.c_str();
147  printout(INFO,pref,"DetElementCreator: +++++++++++++++ Summary of sensitve elements ++++++++++++++++++++++++");
148  for ( const auto& c : counters ) {
149  printout(INFO,pref,"DetElementCreator: ++ Summary: SD: %-24s %7d DetElements %7d sensitives out of %7d volumes",
150  (c.first.name()+string(":")).c_str(), c.second.elements, c.second.sensitives, c.second.volumes);
151  total.elements += c.second.elements;
152  total.sensitives += c.second.sensitives;
153  total.volumes += c.second.volumes;
154  }
155  printout(INFO,pref,"DetElementCreator: ++ Summary: %-24s %7d DetElements %7d sensitives out of %7d volumes",
156  "Grand Total:",total.elements,total.sensitives,total.volumes);
157  printout(INFO,pref,"DetElementCreator: +++++++++++++++ Summary of geometry depth analysis ++++++++++++++++++");
158  int total_cnt = 0, total_depth = 0;
159  map<DetElement, vector<pair<int,int> > > fields;
160  for ( const auto& l : leafCount ) {
161  DetElement de = l.first.first;
162  printout(INFO,pref,"DetElementCreator: ++ Summary: SD: %-24s system:%04X Lvl:%3d Sensitives: %6d [Max: %6d].",
163  (de.name()+string(":")).c_str(), de.id(),
164  l.first.second, l.second.second, l.second.first);
165  fields[de].emplace_back(l.first.second,l.second.first);
166  total_depth += l.second.second;
167  ++total_cnt;
168  }
169  if ( 0 == total_depth ) { }
170  printout(INFO, pref, "DetElementCreator: ++ Summary: %-24s %d.","Total DetElements:", total_cnt);
171  printout(INFO, pref, "DetElementCreator: +++++++++++++++ Readout structure generation ++++++++++++++++++++++++");
172  str << endl;
173  for( const auto& f : fields ) {
174  string ro_name = f.first.name() + string("Hits");
175  int num_bits = 8;
176  id_str.str("");
177  id_str << "system:" << num_bits;
178  for( const auto& q : f.second ) {
179  int bits = 0;
180  if ( q.second < 1<<0 ) bits = 1;
181  else if ( q.second < 1<<1 ) bits = 1;
182  else if ( q.second < 1<<2 ) bits = 2;
183  else if ( q.second < 1<<3 ) bits = 3;
184  else if ( q.second < 1<<4 ) bits = 4;
185  else if ( q.second < 1<<5 ) bits = 5;
186  else if ( q.second < 1<<6 ) bits = 6;
187  else if ( q.second < 1<<7 ) bits = 7;
188  else if ( q.second < 1<<8 ) bits = 8;
189  else if ( q.second < 1<<9 ) bits = 9;
190  else if ( q.second < 1<<10 ) bits = 10;
191  else if ( q.second < 1<<11 ) bits = 11;
192  else if ( q.second < 1<<12 ) bits = 12;
193  else if ( q.second < 1<<13 ) bits = 13;
194  else if ( q.second < 1<<14 ) bits = 14;
195  else if ( q.second < 1<<15 ) bits = 15;
196  bits += 1;
197  id_str << ",Lv" << q.first << ":" << bits;
198  num_bits += bits;
199  }
200  string idspec = id_str.str();
201  str << "<readout name=\"" << ro_name << "\">" << endl
202  << "\t<id>"
203  << idspec
204  << "</id> <!-- Number of bits: " << num_bits << " -->" << endl
205  << "</readout>" << endl;
206 
208  try {
209  IDDescriptor dsc(ro_name,idspec);
211  Readout ro(ro_name);
212  ro.setIDDescriptor(dsc);
214  SensitiveDetector sd = description.sensitiveDetector(f.first.name());
215  sd.setHitsCollection(ro.name());
216  sd.setReadout(ro);
217  printout(INFO,pref,"DetElementCreator: ++ Setting up readout for subdetector:%-24s id:%04X",
218  f.first.name(), f.first.id());
219  }
220  catch(std::exception& e) {
221  printout(ERROR,pref,"DetElementCreator: ++ FAILED to setup readout for subdetector:%-24s id:%04X [%s]",
222  f.first.name(), f.first.id(), e.what());
223  }
224  }
225  printout(INFO,pref,"DetElementCreator: "
226  "+++++++++++++++ ID Descriptor generation ++++++++++++++++++++++++++++");
227  printout(INFO,"",str.str().c_str());
228  char volid[32];
229  for(auto& p : all_placements ) {
230  try {
231  PlacedVolume place = p.first;
232  Volume vol = place.volume();
233  ::snprintf(volid,sizeof(volid),"Lv%d", p.second.first);
234  printout(DEBUG,pref, "DetElementCreator: ++ Set volid (%-24s): %-6s = %3d -> %s (%p)",
235  vol.isSensitive() ? vol.sensitiveDetector().name() : "Not Sensitive",
236  volid, p.second.second, place.name(), place.ptr());
237  place.addPhysVolID(volid, p.second.second);
238  }
239  catch(const exception& e) {
240  except(pref, "DetElementCreator: Exception on destruction: %s", e.what());
241  }
242  catch(...) {
243  except(pref, "DetElementCreator: UNKNOWN Exception on destruction.");
244  }
245  }
246  printout(ALWAYS, pref, "DetElementCreator: ++ Instrumented %ld subdetectors with %d "
247  "DetElements %d sensitives out of %d volumes and %ld sensitive placements.",
248  fields.size(),total.elements,total.sensitives,total.volumes,all_placements.size());
249 }
250 
253  if ( pv.isValid() ) {
254  string nam = pv.name();
255  size_t idx = string::npos; // nam.rfind('_');
256  string nnam = nam.substr(0, idx);
257  return nnam;
258  }
259  except("DetElementCreator","++ Cannot deduce name from invalid PlacedVolume handle!");
260  return string();
261 }
262 
264 DetElement DetElementCreator::createElement(const char* /* debug_tag */, PlacedVolume pv, int id) {
265  string name = detElementName(pv);
266  DetElement det(name, id);
267  det.setPlacement(pv);
268  /*
269  printout(INFO,"DetElementCreator","++ Created detector element [%s]: %s (%s) %p",
270  debug_tag, det.name(), name.c_str(), det.ptr());
271  */
272  return det;
273 }
274 
277  auto& data = stack.back();
278  data.element = current_detector = addSubdetector(detElementName(pv), pv, true);
279 }
280 
282 DetElement DetElementCreator::addSubdetector(const std::string& nam, PlacedVolume pv, bool volid) {
283  Detectors::iterator idet = subdetectors.find(nam);
284  if ( idet == subdetectors.end() ) {
285  DetElement det(nam, description.detectors().size()+1);
286  det.setPlacement(pv);
287  if ( volid ) {
288  det.placement().addPhysVolID("system",det.id());
289  }
290  idet = subdetectors.emplace(nam,det).first;
292  printout(printLevel,"DetElementCreator","++ Added sub-detector element: %s",det.path().c_str());
293  }
294  return idet->second;
295 }
296 
299  if ( detector_volume_level > 0 ) {
300  Material mat = pv.volume().material();
301  if ( mat == sensitive_material ) {
302  Data& data = stack.back();
303  data.sensitive = true;
304  data.has_sensitive = true;
305  ++data.vol_count;
306  int idx = pv->GetMotherVolume()->GetIndex(pv.ptr())+1;
307  auto& cnt = leafCount[make_pair(current_detector,vol_level)];
308  cnt.first = std::max(cnt.first,idx);
309  ++cnt.second;
310  all_placements[pv] = make_pair(vol_level,idx);
311  return 1;
312  }
313  }
314  return 0;
315 }
316 
318 int DetElementCreator::process(PlacedVolume pv, int lvl, bool recursive) {
319  int ret = 1;
320  string pv_nam = pv.name();
321  if ( detector_volume_level > 0 ||
322  ( (!detector_volume_match.empty() &&
323  pv_nam.find(detector_volume_match) != string::npos) &&
324  (detector_volume_veto.empty() ||
325  pv_nam.find(detector_volume_veto) == string::npos) ) )
326  {
327  stack.emplace_back(Data(pv));
328  if ( 0 == detector_volume_level ) {
329  detector_volume_level = stack.size();
331  }
332  ret = PlacedVolumeProcessor::process(pv,lvl,recursive);
334  if ( stack.size() > detector_volume_level ) {
335  // Note: short-cuts to entries in the stack MUST be local and
336  // initialized AFTER the call to "process"! The vector may be resized!
337  auto& data = stack.back();
338  auto& parent = stack[stack.size()-2];
339  auto& counts = counters[current_detector];
340  if ( data.sensitive ) {
342  if ( !current_sensitive.isValid() ) {
344  if ( !sd.isValid() ) {
347  description.add(sd);
348 
349  }
350  current_sensitive = sd;
351  }
353  ++counts.sensitives;
354  }
355  ++counts.volumes;
356  bool added = false;
357  if ( data.vol_count > 0 ) {
358  parent.daughter_count += data.vol_count;
359  parent.daughter_count += data.daughter_count;
360  data.has_sensitive = true;
361  }
362  else {
363  parent.daughter_count += data.daughter_count;
364  data.has_sensitive = (data.daughter_count>0);
365  }
366 
367  if ( data.has_sensitive ) {
368  // If we have sensitive elements at this level or below,
369  // we must complete the DetElement hierarchy
370  if ( data.pv.volIDs().empty() ) {
371  char text[32];
372  ::snprintf(text, sizeof(text), "Lv%d", lvl);
373  data.pv.addPhysVolID(text, data.pv->GetMotherVolume()->GetIndex(data.pv.ptr())+1);
374  }
375  else {
376  AllPlacements::const_iterator e = all_placements.find(data.pv);
377  if ( e != all_placements.end() && (*e).second.first != lvl) {
378  printout(ERROR,"DetElementCreator","PLacement VOLID error: %d <> %d",lvl,(*e).second.first);
379  }
380  }
381 
382  for( size_t i=1; i<stack.size(); ++i ) {
383  auto& d = stack[i];
384  auto& p = stack[i-1];
385  if ( !d.element.isValid() ) {
386  d.element = createElement("Element", d.pv, current_detector.id());
387  (i==1 ? current_detector : p.element).add(d.element);
388  ++counts.elements;
389  }
390  p.has_sensitive = true;
391  }
392  printout(printLevel,"DetElementCreator",
393  "++ Assign detector element: %s (%p, %ld children) to %s (%p) with %ld vols",
394  data.element.name(), data.element.ptr(), data.element.children().size(),
395  parent.element.name(), parent.element.ptr(), data.vol_count);
396  added = true;
397  // It is simpler to collect the volumes and later assign the volids
398  // rather than checking if the volid already exists.
399  int vol_level = lvl;
400  int idx = data.pv->GetMotherVolume()->GetIndex(data.pv.ptr())+1;
401  all_placements[data.pv] = make_pair(vol_level,idx); // 1...n
402  // Update counters
403  auto& cnt_det = leafCount[make_pair(current_detector,vol_level)];
404  cnt_det.first = std::max(cnt_det.first,idx);
405  cnt_det.second += 1;
406  printout(printLevel,"DetElementCreator","++ [%ld] Added element: %s",
407  stack.size(), data.element.path().c_str());
408  }
409  if ( !added && data.element.isValid() ) {
410  printout(WARNING,"MEMORY-LEAK","Level:%3d Orpahaned DetElement:%s Daugthers:%d Parent:%s",
411  int(stack.size()), data.element.name(), data.vol_count, parent.pv.name());
412  }
413  }
415  if ( stack.size() == detector_volume_level ) {
419  ret = 0;
420  }
421  stack.pop_back();
422  }
423  else if ( lvl < max_volume_level ) {
424  //printout(printLevel, "", "+++ Skip volume %s", pv_nam.c_str());
425  ret = PlacedVolumeProcessor::process(pv,lvl,recursive);
426  }
427  return ret;
428 }
429 
430 static void* create_object(Detector& description, int argc, char** argv) {
431  PrintLevel prt = DEBUG;
432  size_t sd_level = 99999;
433  string sd_mat, sd_match, sd_veto, sd_type, detector;
434  for(int i = 0; i < argc && argv[i]; ++i) {
435  if ( 0 == ::strncmp("-material",argv[i],5) )
436  sd_mat = argv[++i];
437  else if ( 0 == ::strncmp("-match",argv[i],5) )
438  sd_match = argv[++i];
439  else if ( 0 == ::strncmp("-detector",argv[i],5) )
440  detector = argv[++i];
441  else if ( 0 == ::strncmp("-veto",argv[i],5) )
442  sd_veto = argv[++i];
443  else if ( 0 == ::strncmp("-type",argv[i],5) )
444  sd_type = argv[++i];
445  else if ( 0 == ::strncmp("-level",argv[i],5) )
446  sd_level = ::atol(argv[++i]);
447  else if ( 0 == ::strncmp("-print",argv[i],5) )
448  prt = decodePrintLevel(argv[++i]);
449  else
450  break;
451  }
452  if ( sd_mat.empty() || sd_match.empty() || sd_type.empty() ) {
453  cout <<
454  "Usage: -plugin <name> -arg [-arg] \n"
455  " name: factory name DD4hep_ROOTGDMLParse \n"
456  " -material <string> Sensitive material name (identifier) \n"
457  " -match <string> Matching string for subdetector identification \n"
458  "\tArguments given: " << arguments(argc,argv) << endl << flush;
459  ::exit(EINVAL);
460  }
461  PlacedVolumeProcessor* proc = new DetElementCreator(description, detector, sd_match, sd_veto, sd_type, sd_mat, sd_level, prt);
462  return (void*)proc;
463 }
464 
465 // first argument is the type from the xml file
466 DECLARE_DD4HEP_CONSTRUCTOR(DD4hep_DetElementCreator,create_object)
467 
dd4hep::PlacedVolumeProcessor
Generic PlacedVolume processor.
Definition: VolumeProcessor.h:37
dd4hep::DetElementCreator::DetElementCreator
DetElementCreator(Detector &desc, const std::string &detector, const std::string &sd_type, const std::string &sd_match, const std::string &sd_veto, const std::string &sd_mat, int sd_lvl, PrintLevel p)
Initializing constructor.
Definition: DetElementCreator.cpp:121
dd4hep::DetElementCreator::Counters
std::map< DetElement, Count > Counters
Definition: DetElementCreator.cpp:59
dd4hep::DetElementCreator::detector_volume_veto
std::string detector_volume_veto
Definition: DetElementCreator.cpp:73
dd4hep::DetElementCreator::~DetElementCreator
virtual ~DetElementCreator() noexcept(false)
Default destructor.
Definition: DetElementCreator.cpp:143
dd4hep::DetElementCreator::Count::elements
int elements
Definition: DetElementCreator.cpp:50
dd4hep::DetElementCreator::leafCount
LeafCount leafCount
Definition: DetElementCreator.cpp:65
dd4hep::Detector::addIDSpecification
virtual Detector & addIDSpecification(const Handle< NamedObject > &element)=0
Add a new id descriptor by named reference to the detector description.
v
View * v
Definition: MultiView.cpp:28
dd4hep::DetElementCreator
DD4hep DetElement creator for the CMS geometry.
Definition: DetElementCreator.cpp:33
dd4hep::DetElementCreator::Count::sensitives
int sensitives
Definition: DetElementCreator.cpp:52
dd4hep::SensitiveDetector
Handle class to hold the information of a sensitive detector.
Definition: DetElement.h:44
dd4hep::DetElementCreator::description
Detector & description
Definition: DetElementCreator.cpp:62
dd4hep::exception
void exception(const std::string &src, const std::string &msg)
Definition: RootDictionary.h:69
dd4hep::DetElementCreator::max_volume_level
int max_volume_level
Definition: DetElementCreator.cpp:75
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:163
dd4hep::DetElementCreator::current_sensitive
SensitiveDetector current_sensitive
Definition: DetElementCreator.cpp:77
dd4hep::Detector::detectors
virtual const HandleMap & detectors() const =0
Accessor to the map of sub-detectors.
dd4hep::SensitiveDetector::setHitsCollection
SensitiveDetector & setHitsCollection(const std::string &spec)
Assign the name of the hits collection.
Definition: DetElement.cpp:441
dd4hep::DetElementCreator::Data::operator=
Data & operator=(const Data &d)=default
dd4hep::PlacedVolume::addPhysVolID
PlacedVolume & addPhysVolID(const std::string &name, int value)
Add identifier.
Definition: Volumes.cpp:501
dd4hep::DetElementCreator::counters
Counters counters
Definition: DetElementCreator.cpp:64
dd4hep::DetElementCreator::subdetectors
Detectors subdetectors
Definition: DetElementCreator.cpp:67
dd4hep::DetElementCreator::Data::level
int level
Definition: DetElementCreator.cpp:39
dd4hep::DetElementCreator::Data::pv
PlacedVolume pv
Definition: DetElementCreator.cpp:35
dd4hep::IDDescriptor
Class implementing the ID encoding of the detector response.
Definition: IDDescriptor.h:37
dd4hep::DetElementCreator::Data::daughter_count
int daughter_count
Definition: DetElementCreator.cpp:41
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
DetectorInterna.h
dd4hep::DetElementCreator::Count::volumes
int volumes
Definition: DetElementCreator.cpp:51
dd4hep::Volume::isSensitive
bool isSensitive() const
Accessor if volume is sensitive (ie. is attached to a sensitive detector)
Definition: Volumes.cpp:1322
DetectorHelper.h
dd4hep::Handle::name
const char * name() const
Access the object name (or "" if not supported by the object)
dd4hep::DetElementCreator::LeafCount
std::map< std::pair< DetElement, int >, std::pair< int, int > > LeafCount
Definition: DetElementCreator.cpp:60
dd4hep::DetElementCreator::Data::vol_count
int vol_count
Definition: DetElementCreator.cpp:40
dd4hep::DetElementCreator::current_detector
DetElement current_detector
Definition: DetElementCreator.cpp:68
dd4hep::Volume::material
Material material() const
Access to the Volume material.
Definition: Volumes.cpp:1151
dd4hep::DetElementCreator::Data::sensitive
bool sensitive
Definition: DetElementCreator.cpp:37
dd4hep::DetElementCreator::sensitive_material_name
std::string sensitive_material_name
Definition: DetElementCreator.cpp:70
dd4hep::Material
Handle class describing a material.
Definition: Objects.h:272
dd4hep::Detector::material
virtual Material material(const std::string &name) const =0
Retrieve a matrial by its name from the detector description.
dd4hep::PlacedVolumeProcessor::process
virtual int process(PlacedVolume pv, int level, bool recursive)
Callback to output PlacedVolume information of an entire Placement.
Definition: VolumeProcessor.cpp:25
dd4hep::DetElementCreator::printLevel
PrintLevel printLevel
Definition: DetElementCreator.cpp:76
dd4hep::DetElementCreator::sensitive_material
Material sensitive_material
Definition: DetElementCreator.cpp:63
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:370
dd4hep::Volume::setSensitiveDetector
const Volume & setSensitiveDetector(const SensitiveDetector &obj) const
Assign the sensitive detector structure.
Definition: Volumes.cpp:1309
dd4hep::DetElementCreator::Data::Data
Data(const Data &d)=default
VolumeProcessor.h
dd4hep::Detector::sensitiveDetector
virtual SensitiveDetector sensitiveDetector(const std::string &name) const =0
Retrieve a sensitive detector by its name from the detector description.
dd4hep::DetElementCreator::process
virtual int process(PlacedVolume pv, int level, bool recursive)
Callback to output PlacedVolume information of an entire Placement.
Definition: DetElementCreator.cpp:318
dd4hep::DetElementCreator::Count::Count
Count()=default
dd4hep::DetElementCreator::Data::sensitive_count
int sensitive_count
Definition: DetElementCreator.cpp:42
dd4hep::DetElementCreator::Data::element
DetElement element
Definition: DetElementCreator.cpp:36
DECLARE_DD4HEP_CONSTRUCTOR
#define DECLARE_DD4HEP_CONSTRUCTOR(name, func)
Definition: Factories.h:291
dd4hep::DetElementCreator::Data::Data
Data(PlacedVolume v)
Definition: DetElementCreator.cpp:45
dd4hep::DetElementCreator::createTopLevelDetectors
void createTopLevelDetectors(PlacedVolume pv)
Create the top level detectors.
Definition: DetElementCreator.cpp:276
dd4hep::DetectorHelper
DetectorHelper: class to shortcut certain questions to the dd4hep detector description interface.
Definition: DetectorHelper.h:32
dd4hep::DetElementCreator::detector_volume_level
size_t detector_volume_level
Definition: DetElementCreator.cpp:74
dd4hep::SensitiveDetector::setReadout
SensitiveDetector & setReadout(Readout readout)
Assign the IDDescriptor reference.
Definition: DetElement.cpp:414
dd4hep::DetElementCreator::sensitive_type
std::string sensitive_type
Definition: DetElementCreator.cpp:71
dd4hep::DetElementCreator::detector
std::string detector
Definition: DetElementCreator.cpp:69
dd4hep::DetElementCreator::detElementName
std::string detElementName(PlacedVolume pv) const
Generate the name of the DetElement object from the placed volume.
Definition: DetElementCreator.cpp:252
dd4hep::DetElementCreator::Detectors
std::map< std::string, DetElement > Detectors
Definition: DetElementCreator.cpp:58
dd4hep::Detector::add
virtual Detector & add(Constant constant)=0
Add a new constant to the detector description.
dd4hep::DetElementCreator::createElement
DetElement createElement(const char *debug_tag, PlacedVolume pv, int id)
Create a new detector element.
Definition: DetElementCreator.cpp:264
dd4hep::DetElementCreator::detector_volume_match
std::string detector_volume_match
Definition: DetElementCreator.cpp:72
DetFactoryHelper.h
dd4hep::Readout::setIDDescriptor
void setIDDescriptor(const Ref_t &spec) const
Assign IDDescription to readout structure.
Definition: Readout.cpp:95
std
Definition: Plugins.h:30
dd4hep::Handle::ptr
T * ptr() const
Access to the held object.
Definition: Handle.h:153
dd4hep::DetElementCreator::Count::Count
Count(const Count &)=default
dd4hep::DetElementCreator::all_placements
AllPlacements all_placements
Definition: DetElementCreator.cpp:78
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
det
DetElement::Object * det
Definition: AlignmentsCalculator.cpp:66
dd4hep::DetElementCreator::AllPlacements
std::map< PlacedVolume, std::pair< int, int > > AllPlacements
Definition: DetElementCreator.cpp:61
dd4hep::PlacedVolume::volume
Volume volume() const
Logical volume of this placement.
Definition: Volumes.cpp:468
dd4hep::DetElementCreator::operator()
virtual int operator()(PlacedVolume pv, int level)
Callback to output PlacedVolume information of an single Placement.
Definition: DetElementCreator.cpp:298
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::DetElement::id
int id() const
Get the detector identifier.
Definition: DetElement.cpp:169
dd4hep::DetElementCreator::VolumeStack
std::vector< Data > VolumeStack
Definition: DetElementCreator.cpp:57
dd4hep::DetElementObject::HAVE_SENSITIVE_DETECTOR
@ HAVE_SENSITIVE_DETECTOR
Definition: DetectorInterna.h:92
dd4hep::Detector::addReadout
virtual Detector & addReadout(const Handle< NamedObject > &readout)=0
Add a new detector readout by named reference to the detector description.
dd4hep::DetElementCreator::Data
Definition: DetElementCreator.cpp:34
dd4hep::DetElementCreator::Data::has_sensitive
bool has_sensitive
Definition: DetElementCreator.cpp:38
dd4hep::DetElementCreator::Count::operator=
Count & operator=(const Count &)=default
dd4hep::DetElementCreator::Data::Data
Data()=default
Printout.h
dd4hep::DetElementCreator::addSubdetector
DetElement addSubdetector(const std::string &nam, PlacedVolume pv, bool volid)
Add new subdetector to the detector description.
Definition: DetElementCreator.cpp:282
dd4hep::DetElementCreator::stack
VolumeStack stack
Definition: DetElementCreator.cpp:66
dd4hep::DetElementCreator::Count
Definition: DetElementCreator.cpp:49
dd4hep::Volume::sensitiveDetector
Handle< NamedObject > sensitiveDetector() const
Access to the handle to the sensitive detector.
Definition: Volumes.cpp:1316