diff --git a/DDCore/include/DD4hep/Detector.h b/DDCore/include/DD4hep/Detector.h index d3fc671a9bd9973c5451cb310960319c5f050b41..215def9a754db7bbaf23be055efb0465836655c1 100644 --- a/DDCore/include/DD4hep/Detector.h +++ b/DDCore/include/DD4hep/Detector.h @@ -194,22 +194,41 @@ namespace DD4hep { COPY_NONE = 0, COPY_PLACEMENT = 1 << 0, COPY_PARENT = 1 << 1, COPY_ALIGNMENT = 1 << 2, LAST }; struct Object: public TNamed { + /// Magic number to ensure data integrity unsigned int magic; + /// Unique integer identifier of the detector instance int id; /// Full path to this detector element. May be invalid std::string path; + /// Flag to process hits int combineHits; + + /// The subdetector placement corresponding to the detector element's volume + PlacedVolume placement; + /** The cached VolumeID of this subdetector element + * Please note: + * These values are set when populating the volume manager. + * There are restrictions: e.g. only sensitive subdetectors are present. + */ + VolumeID volumeID; + /// Reference to the parent element + Parent parent; + /// Reference element for stored transformations + Parent reference; + /// The array of children + Children children; + /// User extensions + Extensions extensions; + + /**@info: Additional information set externally to facilitate the processing of event data */ /// Basic detector element alignment entry Alignment alignment; /// Alignment entries for lower level volumes, which are NOT attached to daughter DetElements std::vector<Alignment> volume_alignments; /// The detector elements condition entry Conditions conditions; - PlacedVolume placement; - Parent parent; - Parent reference; - Children children; - Extensions extensions; + + /**@info: Cached information of the detector element */ /// Intermediate buffer to store the transformation to the world coordination system TGeoMatrix* worldTrafo; /// Intermediate buffer to store the transformation to the parent detector element @@ -219,6 +238,7 @@ namespace DD4hep { /// The path to the placement of the detector element (if placed) std::string placementPath; + /**@info: Public methods to ease the usage of the data. */ /// Default constructor Object(); /// Internal object destructor: release extension object(s) @@ -396,6 +416,8 @@ namespace DD4hep { PlacedVolume placement() const; /// Set the physical volumes of the detector element DetElement& setPlacement(const PlacedVolume& volume); + /// The cached VolumeID of this subdetector element + VolumeID volumeID() const; /// Add new child to the detector structure DetElement& add(DetElement sub_element); diff --git a/DDCore/include/DD4hep/Handle.h b/DDCore/include/DD4hep/Handle.h index 275284c200876a600157da5cb510925abc044b13..b289cc0dd9d0f3d4432fd2fdbdfef376b2dea1f6 100644 --- a/DDCore/include/DD4hep/Handle.h +++ b/DDCore/include/DD4hep/Handle.h @@ -43,6 +43,10 @@ namespace DD4hep { /// Access to the CXX abi name std::string typeName(const std::type_info& type); + /// Throw exception when handles are check for validity + void invalidHandleError(const std::type_info& type); + /// Throw exception when handles are badly assigned + void invalidHandleAssignmentError(const std::type_info& from, const std::type_info& to); /* * Geometry sub-namespace declaration @@ -182,6 +186,8 @@ namespace DD4hep { template <typename Q> Q& object() const { return *(Q*) m_element; } + /// Checked object access. Throws invalid handle runtime exception + T* access() const; void verifyObject() const; const char* name() const; static void bad_assignment(const std::type_info& from, const std::type_info& to); diff --git a/DDCore/include/DD4hep/Handle.inl b/DDCore/include/DD4hep/Handle.inl new file mode 100644 index 0000000000000000000000000000000000000000..692be8d8500f5bac8fc8c590f1c0e7ea99cb7df6 --- /dev/null +++ b/DDCore/include/DD4hep/Handle.inl @@ -0,0 +1,83 @@ +// $Id: Handle.h 1059 2014-04-04 20:24:53Z markus.frank@cern.ch $ +//==================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------- +// +// Author : M.Frank +// +//==================================================================== + +// Framework include files +#include "DD4hep/Handle.h" + +/* + * DD4hep namespace declaration + */ +namespace DD4hep { + + /* + * Geometry sub-namespace declaration + */ + namespace Geometry { + + template <typename T> void Handle<T>::bad_assignment(const std::type_info& from, const std::type_info& to) { + invalidHandleAssignmentError(from,to); + } + template <typename T> void Handle<T>::assign(T* n, const std::string& nam, const std::string& tit) { + this->m_element = n; + if (!nam.empty()) + n->SetName(nam.c_str()); + if (!tit.empty()) + n->SetTitle(tit.c_str()); + } + + template <typename T> const char* Handle<T>::name() const { + return this->m_element ? this->m_element->GetName() : ""; + } + + /// Checked object access. Throws invalid handle runtime exception + template <typename T> T* Handle<T>::access() const { + if ( this->m_element ) return this->m_element; + invalidHandleError(typeid(T)); + return 0; // We have thrown an exception before - does not harm! + } + + } /* End namespace Geometry */ +} /* End namespace DD4hep */ + +#define DD4HEP_INSTANTIATE_HANDLE(X) \ + namespace DD4hep { namespace Geometry { \ + template <> void Handle<X>::verifyObject() const { \ + increment_object_validations(); \ + if (m_element && dynamic_cast<X*>((TObject*)m_element) == 0) { \ + bad_assignment(typeid(*m_element), typeid(X)); \ + } \ + }}} \ + template struct DD4hep::Geometry::Handle<X> + +#define DD4HEP_INSTANTIATE_HANDLE_NAMED(X) \ + namespace DD4hep { namespace Geometry { \ + template <> const char* Handle<X>::name() const \ + { return this->m_element ? this->m_element->name.c_str() : ""; } \ + template <> void \ + Handle<X>::assign(X* p, const std::string& n, const std::string& t) { \ + this->m_element = p; \ + p->name = n; \ + p->type = t; \ + } \ + template <> void Handle<X>::verifyObject() const { \ + increment_object_validations(); \ + if (m_element && dynamic_cast<X*>((TObject*)m_element) == 0) { \ + bad_assignment(typeid(*m_element), typeid(X)); \ + } \ + }}} \ + template struct DD4hep::Geometry::Handle<X> + +#define DD4HEP_INSTANTIATE_HANDLE_UNNAMED(X) \ + namespace DD4hep { namespace Geometry { \ + template <> void \ + Handle<X>::assign(X* n, const std::string&, const std::string&) \ + { this->m_element = n;} \ + template <> const char* Handle<X>::name() const { return ""; } \ + }} \ + DD4HEP_INSTANTIATE_HANDLE(X) diff --git a/DDCore/include/DD4hep/Primitives.h b/DDCore/include/DD4hep/Primitives.h index 4837e79d196ab49afabe10365722db607c138ba2..130ecc99b14c85080356e2d9b6d18e60d865fd07 100644 --- a/DDCore/include/DD4hep/Primitives.h +++ b/DDCore/include/DD4hep/Primitives.h @@ -23,6 +23,15 @@ namespace DD4hep { typedef DDSegmentation::CellID CellID; typedef DDSegmentation::VolumeID VolumeID; + /// Helper to copy objects. + template <typename T> inline void copyObject(void* target,const void* source) { + const T* s = (const T*)source; + ::new(target) T(*s); + } + /// Helper to destruct objects. Note: The memory is NOT released! + template <typename T> inline void destructObject(T* p) { + p->~T(); + } /// Helper to delete objects from heap and reset the pointer. Saves many many lines of code template <typename T> inline void deletePtr(T*& p) { if (0 != p) diff --git a/DDCore/include/DD4hep/Readout.h b/DDCore/include/DD4hep/Readout.h index 992ead8043368576b6dc756ce2403a72a3c294a0..6c09e9025803093ed8682797484494aea7255f67 100644 --- a/DDCore/include/DD4hep/Readout.h +++ b/DDCore/include/DD4hep/Readout.h @@ -103,5 +103,5 @@ namespace DD4hep { }; } /* End namespace Geometry */ -} /* End namespace DD4hep */ -#endif /* DD4hep_GEOMETRY_READOUT_H */ +} /* End namespace DD4hep */ +#endif /* DD4hep_GEOMETRY_READOUT_H */ diff --git a/DDCore/src/Detector.cpp b/DDCore/src/Detector.cpp index f678d663f6a2f6ad5ded3aeb0348e06c01549f76..800fd47c78910487ca7ac5fff4a331143fe8ce69 100644 --- a/DDCore/src/Detector.cpp +++ b/DDCore/src/Detector.cpp @@ -41,8 +41,10 @@ namespace { /// Default constructor DetElement::Object::Object() - : TNamed(), magic(magic_word()), id(0), combineHits(0), // readout(), - alignment(), volume_alignments(), conditions(), placement(), parent(), children(), worldTrafo(0), parentTrafo(0), referenceTrafo(0) { + : TNamed(), magic(magic_word()), id(0), combineHits(0), + placement(), volumeID(0), parent(), reference(), children(), extensions(), + alignment(), volume_alignments(), conditions(), + worldTrafo(0), parentTrafo(0), referenceTrafo(0) { InstanceCount::increment(this); } @@ -365,6 +367,14 @@ DetElement& DetElement::setPlacement(const PlacedVolume& placement) { throw runtime_error("DD4hep: DetElement::setPlacement: Self is not defined [Invalid Handle]"); } +/// The cached VolumeID of this subdetector element +DD4hep::VolumeID DetElement::volumeID() const { + if (isValid()) { + return object<Object>().volumeID; + } + return 0; +} + /// Access to the logical volume of the placements (all daughters have the same!) Volume DetElement::volume() const { if (isValid()) { diff --git a/DDCore/src/Handle.cpp b/DDCore/src/Handle.cpp index 897c4c50bcadac0b8bc921c52c745253978ff300..c46aa80caca9b122bdfcb7bf70935ab28bc227e7 100644 --- a/DDCore/src/Handle.cpp +++ b/DDCore/src/Handle.cpp @@ -8,7 +8,7 @@ //==================================================================== #include "DD4hep/InstanceCount.h" -#include "DD4hep/Handle.h" +#include "DD4hep/Handle.inl" #include "XML/Evaluator.h" #include <iostream> #include <cstring> @@ -156,35 +156,6 @@ namespace DD4hep { void increment_object_validations() { ++s_numVerifies; } - - template <typename T> void Handle<T>::bad_assignment(const type_info& from, const type_info& to) { - string msg = "Wrong assingment from "; - msg += from.name(); - msg += " to "; - msg += to.name(); - msg += " not possible!!"; - throw runtime_error(msg); - } - template <typename T> void Handle<T>::assign(T* n, const string& nam, const string& tit) { - this->m_element = n; - if (!nam.empty()) - n->SetName(nam.c_str()); - if (!tit.empty()) - n->SetTitle(tit.c_str()); - } - - template <typename T> const char* Handle<T>::name() const { - return this->m_element ? this->m_element->GetName() : ""; - } - - template <> void Handle<TObject>::bad_assignment(const type_info& from, const type_info& to) { - string msg = "Wrong assingment from "; - msg += from.name(); - msg += " to "; - msg += to.name(); - msg += " not possible!!"; - throw runtime_error(msg); - } } } @@ -310,6 +281,19 @@ string DD4hep::typeName(const type_info& typ) { return __typeinfoName(typ); } +void DD4hep::invalidHandleError(const type_info& type) { + throw runtime_error("Attempt to access invalid object of type "+typeName(type)+" [Invalid Handle]"); +} + +void DD4hep::invalidHandleAssignmentError(const type_info& from, const type_info& to) { + string msg = "Wrong assingment from "; + msg += typeName(from); + msg += " to "; + msg += typeName(to); + msg += " not possible!!"; + throw runtime_error(msg); +} + #include "DDSegmentation/Segmentation.h" typedef DDSegmentation::Segmentation _Segmentation; //INSTANTIATE_UNNAMED(_Segmentation); @@ -330,49 +314,28 @@ namespace DD4hep { #include "TMap.h" #include "TColor.h" -#define INSTANTIATE(X) namespace DD4hep { namespace Geometry { \ - template <> void Handle<X>::verifyObject() const { \ - increment_object_validations(); \ - if (m_element && dynamic_cast<X*>((TObject*)m_element) == 0) { \ - bad_assignment(typeid(*m_element), typeid(X)); \ - } \ - }}} \ - template struct DD4hep::Geometry::Handle<X> - -#define INSTANTIATE_UNNAMED(X) namespace DD4hep { namespace Geometry { \ - template <> void Handle<X>::assign(X* n, const string&, const string&) { this->m_element = n;} \ - template <> const char* Handle<X>::name() const { return ""; } \ - template <> void Handle<X>::verifyObject() const { \ - increment_object_validations(); \ - if (m_element && dynamic_cast<X*>((TObject*)m_element) == 0) { \ - bad_assignment(typeid(*m_element), typeid(X)); \ - } \ - } \ -}} \ -template struct DD4hep::Geometry::Handle<X> - -INSTANTIATE_UNNAMED(TObject); -INSTANTIATE(TNamed); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TObject); +DD4HEP_INSTANTIATE_HANDLE(TNamed); #include "TGeoMedium.h" #include "TGeoMaterial.h" #include "TGeoElement.h" -INSTANTIATE(TGeoElement); -INSTANTIATE(TGeoMaterial); -INSTANTIATE(TGeoMedium); +DD4HEP_INSTANTIATE_HANDLE(TGeoElement); +DD4HEP_INSTANTIATE_HANDLE(TGeoMaterial); +DD4HEP_INSTANTIATE_HANDLE(TGeoMedium); #include "TGeoMatrix.h" -INSTANTIATE(TGeoMatrix); -INSTANTIATE(TGeoRotation); -INSTANTIATE(TGeoTranslation); -INSTANTIATE(TGeoIdentity); -INSTANTIATE(TGeoCombiTrans); -INSTANTIATE(TGeoGenTrans); +DD4HEP_INSTANTIATE_HANDLE(TGeoMatrix); +DD4HEP_INSTANTIATE_HANDLE(TGeoRotation); +DD4HEP_INSTANTIATE_HANDLE(TGeoTranslation); +DD4HEP_INSTANTIATE_HANDLE(TGeoIdentity); +DD4HEP_INSTANTIATE_HANDLE(TGeoCombiTrans); +DD4HEP_INSTANTIATE_HANDLE(TGeoGenTrans); #include "TGeoNode.h" -INSTANTIATE(TGeoNode); -INSTANTIATE(TGeoNodeMatrix); -INSTANTIATE(TGeoNodeOffset); +DD4HEP_INSTANTIATE_HANDLE(TGeoNode); +DD4HEP_INSTANTIATE_HANDLE(TGeoNodeMatrix); +DD4HEP_INSTANTIATE_HANDLE(TGeoNodeOffset); // Shapes (needed by "Shapes.cpp") #include "TGeoBBox.h" @@ -388,41 +351,41 @@ INSTANTIATE(TGeoNodeOffset); #include "TGeoBoolNode.h" #include "TGeoVolume.h" #include "TGeoCompositeShape.h" -INSTANTIATE(TGeoVolume); -INSTANTIATE(TGeoBBox); -INSTANTIATE(TGeoCone); -INSTANTIATE(TGeoArb8); -INSTANTIATE(TGeoConeSeg); -INSTANTIATE(MyConeSeg); -INSTANTIATE(TGeoParaboloid); -INSTANTIATE(TGeoPcon); -INSTANTIATE(TGeoPgon); -INSTANTIATE(TGeoTube); -INSTANTIATE(TGeoTubeSeg); -INSTANTIATE(TGeoTrap); -INSTANTIATE(TGeoTrd2); -INSTANTIATE(TGeoSphere); -INSTANTIATE(TGeoTorus); -INSTANTIATE(TGeoShape); -INSTANTIATE(TGeoCompositeShape); +DD4HEP_INSTANTIATE_HANDLE(TGeoVolume); +DD4HEP_INSTANTIATE_HANDLE(TGeoBBox); +DD4HEP_INSTANTIATE_HANDLE(TGeoCone); +DD4HEP_INSTANTIATE_HANDLE(TGeoArb8); +DD4HEP_INSTANTIATE_HANDLE(TGeoConeSeg); +DD4HEP_INSTANTIATE_HANDLE(MyConeSeg); +DD4HEP_INSTANTIATE_HANDLE(TGeoParaboloid); +DD4HEP_INSTANTIATE_HANDLE(TGeoPcon); +DD4HEP_INSTANTIATE_HANDLE(TGeoPgon); +DD4HEP_INSTANTIATE_HANDLE(TGeoTube); +DD4HEP_INSTANTIATE_HANDLE(TGeoTubeSeg); +DD4HEP_INSTANTIATE_HANDLE(TGeoTrap); +DD4HEP_INSTANTIATE_HANDLE(TGeoTrd2); +DD4HEP_INSTANTIATE_HANDLE(TGeoSphere); +DD4HEP_INSTANTIATE_HANDLE(TGeoTorus); +DD4HEP_INSTANTIATE_HANDLE(TGeoShape); +DD4HEP_INSTANTIATE_HANDLE(TGeoCompositeShape); // Volume Placements (needed by "Volumes.cpp") #include "TGeoPhysicalNode.h" -INSTANTIATE(TGeoPhysicalNode); +DD4HEP_INSTANTIATE_HANDLE(TGeoPhysicalNode); // Replicated Volumes (needed by "Volumes.cpp") #include "TGeoPatternFinder.h" -INSTANTIATE_UNNAMED(TGeoPatternFinder); -INSTANTIATE_UNNAMED(TGeoPatternX); -INSTANTIATE_UNNAMED(TGeoPatternY); -INSTANTIATE_UNNAMED(TGeoPatternZ); -INSTANTIATE_UNNAMED(TGeoPatternParaX); -INSTANTIATE_UNNAMED(TGeoPatternParaY); -INSTANTIATE_UNNAMED(TGeoPatternParaZ); -INSTANTIATE_UNNAMED(TGeoPatternTrapZ); -INSTANTIATE_UNNAMED(TGeoPatternCylR); -INSTANTIATE_UNNAMED(TGeoPatternCylPhi); -INSTANTIATE_UNNAMED(TGeoPatternSphR); -INSTANTIATE_UNNAMED(TGeoPatternSphTheta); -INSTANTIATE_UNNAMED(TGeoPatternSphPhi); -INSTANTIATE_UNNAMED(TGeoPatternHoneycomb); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternFinder); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternX); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternY); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternZ); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternParaX); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternParaY); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternParaZ); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternTrapZ); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternCylR); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternCylPhi); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternSphR); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternSphTheta); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternSphPhi); +DD4HEP_INSTANTIATE_HANDLE_UNNAMED(TGeoPatternHoneycomb); diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp index 7a564373f5784e17e1332a3aa8a6b5ead5cf082e..dbc39921959cb9fcffb261e820a792c82a3d8cea 100644 --- a/DDCore/src/VolumeManager.cpp +++ b/DDCore/src/VolumeManager.cpp @@ -84,10 +84,12 @@ namespace { chain.push_back(node); PlacedVolume::VolIDs pv_ids = pv.volIDs(); ids.PlacedVolume::VolIDs::Base::insert(ids.end(), pv_ids.begin(), pv_ids.end()); + bool got_readout = false; if (vol.isSensitive()) { sd = vol.sensitiveDetector(); Readout ro = sd.readout(); if (ro.isValid()) { + got_readout = true; add_entry(sd, parent, e, node, ids, chain); ++count; } @@ -119,6 +121,20 @@ namespace { throw runtime_error("Invalid not instrumented placement:"+string(daughter->GetName())+" [Internal error -- bad detector constructor]"); } } + if ( sd.isValid() ) { + // We recuperate volumes from lower levels by reusing the subdetector + // This only works if there is exactly one sensitive detector per subdetector! + // I hate this, but I could not talk Frank out of this! M.F. + Readout ro = sd.readout(); + if (ro.isValid()) { + IDDescriptor iddesc = ro.idSpec(); + pair<VolumeID, VolumeID> det_encoding = encoding(iddesc,ids); + printout(DEBUG,"VolumeManager","++++ %-11s SD:%s VolID=%p Mask=%p",e.path().c_str(), + got_readout ? "RECUPERATED" : "REGULAR", sd.name(), + (void*)det_encoding.first, (void*)det_encoding.second); + e.object<DetElement::Object>().volumeID = det_encoding.first; + } + } chain.pop_back(); } return count; diff --git a/DDCore/src/XML/XMLElements.cpp b/DDCore/src/XML/XMLElements.cpp index 270bb3305bc623b27bdab74d6f3b06a32c5f899d..80f792464e5dfd1033b1a643c633007fec6a7132 100644 --- a/DDCore/src/XML/XMLElements.cpp +++ b/DDCore/src/XML/XMLElements.cpp @@ -132,7 +132,7 @@ namespace { } XmlElement* node_first(XmlElement* e, const XmlChar* t) { if ( e ) { - size_t cnt = 0; + //size_t cnt = 0; string tag = _toString(t); xercesc::DOMElement* ee = Xml(e).e; if ( ee ) { @@ -689,13 +689,16 @@ void Handle_t::removeAttrs() const { } /// Set attributes as in argument handle +#ifdef DD4HEP_USE_TINYXML void Handle_t::setAttrs(Handle_t elt) const { removeAttrs(); -#ifdef DD4HEP_USE_TINYXML TiXmlElement* e = Xml(elt).e; for(TiXmlAttribute* a=e->FirstAttribute(); a; a=a->Next()) e->SetAttribute(a->Name(),a->Value()); +} #else +void Handle_t::setAttrs(Handle_t /* elt */) const { + removeAttrs(); xercesc::DOMElement* e = _E(m_node); xercesc::DOMNamedNodeMap* l = e->getAttributes(); for (XmlSize_t i = 0, len = l->getLength(); i < len; ++i) { @@ -705,8 +708,8 @@ void Handle_t::setAttrs(Handle_t elt) const { e->setAttribute(a->getName(), a->getValue()); } } -#endif } +#endif /// Access attribute pointer by the attribute's unicode name (throws exception if not present) Attribute Handle_t::attr_ptr(const XmlChar* t) const { @@ -822,7 +825,7 @@ Handle_t Handle_t::setRef(const XmlChar* tag, const string& ref_name) { } /// Checksum (sub-)tree of a xml document/tree -static unsigned int adler32(unsigned int adler, const char* buf, size_t len) { +static unsigned int adler32(unsigned int adler, const XmlChar* xml_buff, size_t len) { #define DO1(buf,i) {s1 +=(unsigned char)buf[i]; s2 += s1;} #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); @@ -834,6 +837,7 @@ static unsigned int adler32(unsigned int adler, const char* buf, size_t len) { static const unsigned int NMAX = 5550; unsigned int s1 = adler & 0xffff; unsigned int s2 = (adler >> 16) & 0xffff; + const char* buf = (const char*)xml_buff; int k; if (buf == NULL) @@ -860,7 +864,8 @@ static unsigned int adler32(unsigned int adler, const char* buf, size_t len) { } /// Checksum (sub-)tree of a xml document/tree -unsigned int Handle_t::checksum(unsigned int param, unsigned int (fcn)(unsigned int, const XmlChar*, size_t)) const { +typedef unsigned int (fcn_t)(unsigned int, const XmlChar*, size_t); +unsigned int Handle_t::checksum(unsigned int param, fcn_t fcn) const { typedef std::map<std::string, std::string> StringMap; #ifdef DD4HEP_USE_TINYXML TiXmlNode* n = Xml(m_node).n; @@ -893,7 +898,9 @@ unsigned int Handle_t::checksum(unsigned int param, unsigned int (fcn)(unsigned param = Handle_t((XmlElement*)c->ToElement()).checksum(param,fcn); } #else - + if ( 0 == fcn ) fcn = adler32; + if ( 0 == fcn ) { + } #endif return param; } diff --git a/DDCore/src/plugins/StandardPlugins.cpp b/DDCore/src/plugins/StandardPlugins.cpp index 7f67fa50b5d3f47bd5b167a1d0817a83529bccab..3d8e9a2f21891ecafcc6cd700a004a63edfdf079 100644 --- a/DDCore/src/plugins/StandardPlugins.cpp +++ b/DDCore/src/plugins/StandardPlugins.cpp @@ -147,35 +147,41 @@ static long dump_geometry(PlacedVolume pv,int level) { } return 1; } -static long dump_geometry(DetElement de,int level) { + +static long dump_geometry(DetElement de,int level, bool sensitive_only) { const DetElement::Children& c = de.children(); char fmt[64]; - for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) { - ::sprintf(fmt,"%03d %%-%ds %%s",level+1,2*level+1); - printout(INFO,"+++",fmt,"",(*i).second.placementPath().c_str()); - dump_geometry((*i).second,level+1); + if ( !sensitive_only || 0 != de.volumeID() ) { + ::sprintf(fmt,"%03d %%-%ds %%s #Dau:%%d VolID:%%p",level+1,2*level+1); + printout(INFO,"+++",fmt,"",de.placementPath().c_str(),int(c.size()),(void*)de.volumeID()); } + for (DetElement::Children::const_iterator i = c.begin(); i != c.end(); ++i) + dump_geometry((*i).second,level+1,sensitive_only); return 1; } -/** Basic entry point to print otu the detector element hierarchy +/** Basic entry point to print out the detector element hierarchy * * @author M.Frank * @version 1.0 * @date 01/04/2014 */ -static long dump_detelement_tree(LCDD& lcdd, int, char**) { - return dump_geometry(lcdd.world(),0); +static long dump_detelement_tree(LCDD& lcdd, int argc, char** argv) { + bool sensitive_only = false; + for(int i=0; i<argc; ++i) { + if ( ::strcmp(argv[i],"--sensitive")==0 ) { sensitive_only = true; } + } + return dump_geometry(lcdd.world(),0,sensitive_only); } DECLARE_APPLY(DD4hepDetectorDump,dump_detelement_tree) -/** Basic entry point to print otu the volume hierarchy +/** Basic entry point to print out the volume hierarchy * * @author M.Frank * @version 1.0 * @date 01/04/2014 */ -static long dump_volume_tree(LCDD& lcdd, int, char**) { +static long dump_volume_tree(LCDD& lcdd, int , char** ) { return dump_geometry(lcdd.world().placement(),0); } DECLARE_APPLY(DD4hepVolumeDump,dump_volume_tree)