DD4hep  1.30.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  printout(INFO,pref,"DetElementCreator: ++ Summary: %-24s %d.","Total DetElements:",total_cnt);
170  printout(INFO,pref,"DetElementCreator: +++++++++++++++ Readout structure generation ++++++++++++++++++++++++");
171  str << endl;
172  for( const auto& f : fields ) {
173  string ro_name = f.first.name() + string("Hits");
174  int num_bits = 8;
175  id_str.str("");
176  id_str << "system:" << num_bits;
177  for( const auto& q : f.second ) {
178  int bits = 0;
179  if ( q.second < 1<<0 ) bits = 1;
180  else if ( q.second < 1<<1 ) bits = 1;
181  else if ( q.second < 1<<2 ) bits = 2;
182  else if ( q.second < 1<<3 ) bits = 3;
183  else if ( q.second < 1<<4 ) bits = 4;
184  else if ( q.second < 1<<5 ) bits = 5;
185  else if ( q.second < 1<<6 ) bits = 6;
186  else if ( q.second < 1<<7 ) bits = 7;
187  else if ( q.second < 1<<8 ) bits = 8;
188  else if ( q.second < 1<<9 ) bits = 9;
189  else if ( q.second < 1<<10 ) bits = 10;
190  else if ( q.second < 1<<11 ) bits = 11;
191  else if ( q.second < 1<<12 ) bits = 12;
192  else if ( q.second < 1<<13 ) bits = 13;
193  else if ( q.second < 1<<14 ) bits = 14;
194  else if ( q.second < 1<<15 ) bits = 15;
195  bits += 1;
196  id_str << ",Lv" << q.first << ":" << bits;
197  num_bits += bits;
198  }
199  string idspec = id_str.str();
200  str << "<readout name=\"" << ro_name << "\">" << endl
201  << "\t<id>"
202  << idspec
203  << "</id> <!-- Number of bits: " << num_bits << " -->" << endl
204  << "</readout>" << endl;
205 
207  try {
208  IDDescriptor dsc(ro_name,idspec);
210  Readout ro(ro_name);
211  ro.setIDDescriptor(dsc);
213  SensitiveDetector sd = description.sensitiveDetector(f.first.name());
214  sd.setHitsCollection(ro.name());
215  sd.setReadout(ro);
216  printout(INFO,pref,"DetElementCreator: ++ Setting up readout for subdetector:%-24s id:%04X",
217  f.first.name(), f.first.id());
218  }
219  catch(std::exception& e) {
220  printout(ERROR,pref,"DetElementCreator: ++ FAILED to setup readout for subdetector:%-24s id:%04X [%s]",
221  f.first.name(), f.first.id(), e.what());
222  }
223  }
224  printout(INFO,pref,"DetElementCreator: "
225  "+++++++++++++++ ID Descriptor generation ++++++++++++++++++++++++++++");
226  printout(INFO,"",str.str().c_str());
227  char volid[32];
228  for(auto& p : all_placements ) {
229  try {
230  PlacedVolume place = p.first;
231  Volume vol = place.volume();
232  ::snprintf(volid,sizeof(volid),"Lv%d", p.second.first);
233  printout(DEBUG,pref, "DetElementCreator: ++ Set volid (%-24s): %-6s = %3d -> %s (%p)",
234  vol.isSensitive() ? vol.sensitiveDetector().name() : "Not Sensitive",
235  volid, p.second.second, place.name(), place.ptr());
236  place.addPhysVolID(volid, p.second.second);
237  }
238  catch(const exception& e) {
239  except(pref, "DetElementCreator: Exception on destruction: %s", e.what());
240  }
241  catch(...) {
242  except(pref, "DetElementCreator: UNKNOWN Exception on destruction.");
243  }
244  }
245  printout(ALWAYS, pref, "DetElementCreator: ++ Instrumented %ld subdetectors with %d "
246  "DetElements %d sensitives out of %d volumes and %ld sensitive placements.",
247  fields.size(),total.elements,total.sensitives,total.volumes,all_placements.size());
248 }
249 
252  if ( pv.isValid() ) {
253  string nam = pv.name();
254  size_t idx = string::npos; // nam.rfind('_');
255  string nnam = nam.substr(0, idx);
256  return nnam;
257  }
258  except("DetElementCreator","++ Cannot deduce name from invalid PlacedVolume handle!");
259  return string();
260 }
261 
263 DetElement DetElementCreator::createElement(const char* /* debug_tag */, PlacedVolume pv, int id) {
264  string name = detElementName(pv);
265  DetElement det(name, id);
266  det.setPlacement(pv);
267  /*
268  printout(INFO,"DetElementCreator","++ Created detector element [%s]: %s (%s) %p",
269  debug_tag, det.name(), name.c_str(), det.ptr());
270  */
271  return det;
272 }
273 
276  auto& data = stack.back();
277  data.element = current_detector = addSubdetector(detElementName(pv), pv, true);
278 }
279 
281 DetElement DetElementCreator::addSubdetector(const std::string& nam, PlacedVolume pv, bool volid) {
282  Detectors::iterator idet = subdetectors.find(nam);
283  if ( idet == subdetectors.end() ) {
284  DetElement det(nam, description.detectors().size()+1);
285  det.setPlacement(pv);
286  if ( volid ) {
287  det.placement().addPhysVolID("system",det.id());
288  }
289  idet = subdetectors.emplace(nam,det).first;
291  printout(printLevel,"DetElementCreator","++ Added sub-detector element: %s",det.path().c_str());
292  }
293  return idet->second;
294 }
295 
298  if ( detector_volume_level > 0 ) {
299  Material mat = pv.volume().material();
300  if ( mat == sensitive_material ) {
301  Data& data = stack.back();
302  data.sensitive = true;
303  data.has_sensitive = true;
304  ++data.vol_count;
305  int idx = pv->GetMotherVolume()->GetIndex(pv.ptr())+1;
306  auto& cnt = leafCount[make_pair(current_detector,vol_level)];
307  cnt.first = std::max(cnt.first,idx);
308  ++cnt.second;
309  all_placements[pv] = make_pair(vol_level,idx);
310  return 1;
311  }
312  }
313  return 0;
314 }
315 
317 int DetElementCreator::process(PlacedVolume pv, int lvl, bool recursive) {
318  int ret = 1;
319  string pv_nam = pv.name();
320  if ( detector_volume_level > 0 ||
321  ( (!detector_volume_match.empty() &&
322  pv_nam.find(detector_volume_match) != string::npos) &&
323  (detector_volume_veto.empty() ||
324  pv_nam.find(detector_volume_veto) == string::npos) ) )
325  {
326  stack.emplace_back(Data(pv));
327  if ( 0 == detector_volume_level ) {
328  detector_volume_level = stack.size();
330  }
331  ret = PlacedVolumeProcessor::process(pv,lvl,recursive);
333  if ( stack.size() > detector_volume_level ) {
334  // Note: short-cuts to entries in the stack MUST be local and
335  // initialized AFTER the call to "process"! The vector may be resized!
336  auto& data = stack.back();
337  auto& parent = stack[stack.size()-2];
338  auto& counts = counters[current_detector];
339  if ( data.sensitive ) {
341  if ( !current_sensitive.isValid() ) {
343  if ( !sd.isValid() ) {
346  description.add(sd);
347 
348  }
349  current_sensitive = sd;
350  }
352  ++counts.sensitives;
353  }
354  ++counts.volumes;
355  bool added = false;
356  if ( data.vol_count > 0 ) {
357  parent.daughter_count += data.vol_count;
358  parent.daughter_count += data.daughter_count;
359  data.has_sensitive = true;
360  }
361  else {
362  parent.daughter_count += data.daughter_count;
363  data.has_sensitive = (data.daughter_count>0);
364  }
365 
366  if ( data.has_sensitive ) {
367  // If we have sensitive elements at this level or below,
368  // we must complete the DetElement hierarchy
369  if ( data.pv.volIDs().empty() ) {
370  char text[32];
371  ::snprintf(text, sizeof(text), "Lv%d", lvl);
372  data.pv.addPhysVolID(text, data.pv->GetMotherVolume()->GetIndex(data.pv.ptr())+1);
373  }
374  else {
375  AllPlacements::const_iterator e = all_placements.find(data.pv);
376  if ( e != all_placements.end() && (*e).second.first != lvl) {
377  printout(ERROR,"DetElementCreator","PLacement VOLID error: %d <> %d",lvl,(*e).second.first);
378  }
379  }
380 
381  for(size_t i=1; i<stack.size(); ++i) {
382  auto& d = stack[i];
383  auto& p = stack[i-1];
384  if ( !d.element.isValid() ) {
385  d.element = createElement("Element", d.pv, current_detector.id());
386  (i==1 ? current_detector : p.element).add(d.element);
387  ++counts.elements;
388  }
389  p.has_sensitive = true;
390  }
391  printout(printLevel,"DetElementCreator",
392  "++ Assign detector element: %s (%p, %ld children) to %s (%p) with %ld vols",
393  data.element.name(), data.element.ptr(), data.element.children().size(),
394  parent.element.name(), parent.element.ptr(), data.vol_count);
395  added = true;
396  // It is simpler to collect the volumes and later assign the volids
397  // rather than checking if the volid already exists.
398  int vol_level = lvl;
399  int idx = data.pv->GetMotherVolume()->GetIndex(data.pv.ptr())+1;
400  all_placements[data.pv] = make_pair(vol_level,idx); // 1...n
401  // Update counters
402  auto& cnt_det = leafCount[make_pair(current_detector,vol_level)];
403  cnt_det.first = std::max(cnt_det.first,idx);
404  cnt_det.second += 1;
405  printout(printLevel,"DetElementCreator","++ [%ld] Added element: %s",
406  stack.size(), data.element.path().c_str());
407  }
408  if ( !added && data.element.isValid() ) {
409  printout(WARNING,"MEMORY-LEAK","Level:%3d Orpahaned DetElement:%s Daugthers:%d Parent:%s",
410  int(stack.size()), data.element.name(), data.vol_count, parent.pv.name());
411  }
412  }
414  if ( stack.size() == detector_volume_level ) {
418  ret = 0;
419  }
420  stack.pop_back();
421  }
422  else if ( lvl < max_volume_level ) {
423  //printout(printLevel, "", "+++ Skip volume %s", pv_nam.c_str());
424  ret = PlacedVolumeProcessor::process(pv,lvl,recursive);
425  }
426  return ret;
427 }
428 
429 static void* create_object(Detector& description, int argc, char** argv) {
430  PrintLevel prt = DEBUG;
431  size_t sd_level = 99999;
432  string sd_mat, sd_match, sd_veto, sd_type, detector;
433  for(int i = 0; i < argc && argv[i]; ++i) {
434  if ( 0 == ::strncmp("-material",argv[i],5) )
435  sd_mat = argv[++i];
436  else if ( 0 == ::strncmp("-match",argv[i],5) )
437  sd_match = argv[++i];
438  else if ( 0 == ::strncmp("-detector",argv[i],5) )
439  detector = argv[++i];
440  else if ( 0 == ::strncmp("-veto",argv[i],5) )
441  sd_veto = argv[++i];
442  else if ( 0 == ::strncmp("-type",argv[i],5) )
443  sd_type = argv[++i];
444  else if ( 0 == ::strncmp("-level",argv[i],5) )
445  sd_level = ::atol(argv[++i]);
446  else if ( 0 == ::strncmp("-print",argv[i],5) )
447  prt = decodePrintLevel(argv[++i]);
448  else
449  break;
450  }
451  if ( sd_mat.empty() || sd_match.empty() || sd_type.empty() ) {
452  cout <<
453  "Usage: -plugin <name> -arg [-arg] \n"
454  " name: factory name DD4hep_ROOTGDMLParse \n"
455  " -material <string> Sensitive material name (identifier) \n"
456  " -match <string> Matching string for subdetector identification \n"
457  "\tArguments given: " << arguments(argc,argv) << endl << flush;
458  ::exit(EINVAL);
459  }
460  PlacedVolumeProcessor* proc = new DetElementCreator(description, detector, sd_match, sd_veto, sd_type, sd_mat, sd_level, prt);
461  return (void*)proc;
462 }
463 
464 // first argument is the type from the xml file
465 DECLARE_DD4HEP_CONSTRUCTOR(DD4hep_DetElementCreator,create_object)
466 
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:317
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:275
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:251
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:263
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:297
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:281
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