diff --git a/DDCore/include/DD4hep/CartesianGridXY.h b/DDCore/include/DD4hep/CartesianGridXY.h index 5ef9062ad..639cc7f5c 100644 --- a/DDCore/include/DD4hep/CartesianGridXY.h +++ b/DDCore/include/DD4hep/CartesianGridXY.h @@ -55,11 +55,11 @@ namespace dd4hep { /// Copy constructor CartesianGridXY(const CartesianGridXY& e) = default; /// Copy Constructor from segmentation base object - CartesianGridXY(const Segmentation& e) : Handle(e) { } + CartesianGridXY(const Segmentation& e) : Handle(e) { } /// Copy constructor from handle - CartesianGridXY(const Handle& e) : Handle(e) { } + CartesianGridXY(const Handle& e) : Handle(e) { } /// Copy constructor from other equivalent handle - template CartesianGridXY(const Handle& e) : Handle(e) { } + template CartesianGridXY(const Handle& e) : Handle(e) { } /// Assignment operator CartesianGridXY& operator=(const CartesianGridXY& seg) = default; /// Equality operator diff --git a/DDCore/include/DD4hep/Volumes.h b/DDCore/include/DD4hep/Volumes.h index e100e9323..3468201d4 100644 --- a/DDCore/include/DD4hep/Volumes.h +++ b/DDCore/include/DD4hep/Volumes.h @@ -136,19 +136,9 @@ namespace dd4hep { /// Default destructor virtual ~PlacedVolumeExtension(); /// Move assignment - PlacedVolumeExtension& operator=(PlacedVolumeExtension&& copy) { - magic = std::move(copy.magic); - params = std::move(copy.params); - volIDs = std::move(copy.volIDs); - return *this; - } + PlacedVolumeExtension& operator=(PlacedVolumeExtension&& copy); /// Assignment operator - PlacedVolumeExtension& operator=(const PlacedVolumeExtension& copy) { - magic = copy.magic; - params = copy.params; - volIDs = copy.volIDs; - return *this; - } + PlacedVolumeExtension& operator=(const PlacedVolumeExtension& copy); /// TGeoExtension overload: Method called whenever requiring a pointer to the extension virtual TGeoExtension *Grab() override; /// TGeoExtension overload: Method called always when the pointer to the extension is not needed anymore @@ -329,6 +319,8 @@ namespace dd4hep { Handle reflected; /// Reference to properties TList* properties { nullptr }; + /// Geant4 optimization flag: Smartless + unsigned char smartLess = 0xFF; // MUST match Volume::NO_SMARTLESS_OPTIMIZATION /// Default destructor virtual ~VolumeExtension(); @@ -393,9 +385,11 @@ namespace dd4hep { Y_axis = 1UL << 9, Z_axis = 1UL << 10, Rho_axis = 1UL << 11, - Phi_axis = 1UL << 12 + Phi_axis = 1UL << 12, + }; + enum g4_optimizations { + NO_SMARTLESS_OPTIMIZATION = 0xFF, }; - public: /// Default constructor Volume() = default; @@ -650,6 +644,11 @@ namespace dd4hep { /// Test if this volume is an assembly structure bool isAssembly() const; + /// Set the smartless option for G4 voxelization. Returns previous value + unsigned char setSmartlessValue(unsigned char value); + /// access the smartless option for G4 voxelization + unsigned char smartlessValue() const; + /// Set the volume's option value const Volume& setOption(const std::string& opt) const; /// Access the volume's option value diff --git a/DDCore/include/Parsers/detail/Dimension.h b/DDCore/include/Parsers/detail/Dimension.h index adef386af..660ae7707 100644 --- a/DDCore/include/Parsers/detail/Dimension.h +++ b/DDCore/include/Parsers/detail/Dimension.h @@ -665,11 +665,15 @@ namespace dd4hep { double eunit() const; /// Access min/max parameters: eunit double eunit(double default_value) const; + /// Access layers attribute + int layers() const; + /// Access layers attribute + int layers(int default_value) const; /// Access min/max parameters: lunit double lunit() const; /// Access min/max parameters: lunit double lunit(double default_value) const; - + /// Access constants: temperature double temperature() const; /// Access constants: temperature diff --git a/DDCore/include/Parsers/detail/Dimension.imp b/DDCore/include/Parsers/detail/Dimension.imp index 48f6aea42..1f7e2f5f8 100644 --- a/DDCore/include/Parsers/detail/Dimension.imp +++ b/DDCore/include/Parsers/detail/Dimension.imp @@ -183,6 +183,7 @@ XML_ATTR_ACCESSOR(int, nsides) XML_ATTR_ACCESSOR(int, nsides_inner) XML_ATTR_ACCESSOR(int, nsides_outer) XML_ATTR_ACCESSOR(int, number) +XML_ATTR_ACCESSOR(int, layers) XML_ATTR_ACCESSOR(int, repeat) XML_ATTR_ACCESSOR(bool, reflect) XML_ATTR_ACCESSOR_BOOL(reflect) diff --git a/DDCore/src/ObjectExtensions.cpp b/DDCore/src/ObjectExtensions.cpp index 66ae32708..89c135b75 100644 --- a/DDCore/src/ObjectExtensions.cpp +++ b/DDCore/src/ObjectExtensions.cpp @@ -19,6 +19,8 @@ using namespace dd4hep; +#define EXTENSION_DEBUG 0 + namespace { std::string obj_type(void* ptr) { ObjectExtensions* o = (ObjectExtensions*)ptr; @@ -67,6 +69,12 @@ void* ObjectExtensions::addExtension(unsigned long long int key, ExtensionEntry* if ( e->object() ) { auto j = extensions.find(key); if (j == extensions.end()) { +#if EXTENSION_DEBUG + auto* p = e->object(); + ExtensionEntry* ptr = (ExtensionEntry*)e; + printout(ALWAYS,"addExtension","+++ Add extension with key: %016llX --> %p [%s]", + key, p, typeName(typeid(*ptr)).c_str()); +#endif extensions[key] = e; return e->object(); } @@ -97,6 +105,9 @@ void* ObjectExtensions::removeExtension(unsigned long long int key, bool destroy /// Access an existing extension object from the detector element void* ObjectExtensions::extension(unsigned long long int key) const { const auto j = extensions.find(key); +#if EXTENSION_DEBUG + printout(ALWAYS,"extension","+++ Get extension with key: %016llX", key); +#endif if (j != extensions.end()) { return (*j).second->object(); } @@ -107,6 +118,9 @@ void* ObjectExtensions::extension(unsigned long long int key) const { /// Access an existing extension object from the detector element void* ObjectExtensions::extension(unsigned long long int key, bool alert) const { const auto j = extensions.find(key); +#if EXTENSION_DEBUG + printout(ALWAYS,"extension","+++ Get extension with key: %016llX", key); +#endif if (j != extensions.end()) { return (*j).second->object(); } diff --git a/DDCore/src/Volumes.cpp b/DDCore/src/Volumes.cpp index 20b5bbf34..93b099a2f 100644 --- a/DDCore/src/Volumes.cpp +++ b/DDCore/src/Volumes.cpp @@ -87,7 +87,8 @@ namespace { PlacedVolume::Object* _data(const PlacedVolume& v) { PlacedVolume::Object* o = _userExtension(v); if (o) return o; - throw std::runtime_error("dd4hep: Attempt to access invalid handle of type: PlacedVolume"); + except("PlacedVolume::_data", "+++ Attempt to access invalid handle of type: PlacedVolume"); + return nullptr; } /// Accessor to the data part of the Volume Volume::Object* _data(const Volume& v, bool throw_exception = true) { @@ -97,7 +98,8 @@ namespace { return o; else if (!throw_exception) return nullptr; - throw std::runtime_error("dd4hep: Attempt to access invalid handle of type: PlacedVolume"); + except("Volume::_data", "+++ Attempt to access invalid handle of type: Volume"); + return nullptr; } class VolumeImport { @@ -297,7 +299,6 @@ namespace { } - /// Perform scan void ReflectionBuilder::execute() const { TGeoIterator next(detector.manager().GetTopVolume()); @@ -376,6 +377,21 @@ PlacedVolumeExtension::~PlacedVolumeExtension() { DECREMENT_COUNTER; } +/// Move assignment +PlacedVolumeExtension& PlacedVolumeExtension::operator=(PlacedVolumeExtension&& copy) { + magic = std::move(copy.magic); + params = std::move(copy.params); + volIDs = std::move(copy.volIDs); + return *this; +} +/// Assignment operator +PlacedVolumeExtension& PlacedVolumeExtension::operator=(const PlacedVolumeExtension& copy) { + magic = copy.magic; + params = copy.params; + volIDs = copy.volIDs; + return *this; +} + /// TGeoExtension overload: Method called whenever requiring a pointer to the extension TGeoExtension* PlacedVolumeExtension::Grab() { ++this->refCount; @@ -708,6 +724,19 @@ bool Volume::isAssembly() const { return m_element ? m_element->IsAssembly() : false; } +/// Set the smartless option for G4 voxelization. Returns previous value +unsigned char Volume::setSmartlessValue(unsigned char new_value) { + Object* obj = _data(*this); + unsigned char tmp = obj->smartLess; + obj->smartLess = new_value; + return tmp; +} + +/// access the smartless option for G4 voxelization +unsigned char Volume::smartlessValue() const { + return _data(*this)->smartLess; +} + /// Divide volume into subsections (See the ROOT manuloa for details) Volume Volume::divide(const std::string& divname, int iaxis, int ndiv, double start, double step, int numed, const char* option) { diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp index 9378952e6..5928e15c6 100644 --- a/DDCore/src/plugins/Compact2Objects.cpp +++ b/DDCore/src/plugins/Compact2Objects.cpp @@ -1607,7 +1607,7 @@ template <> void Converter::operator()(xml_h element) cons vol.name(), anchor.path().c_str(), vis.name()); } -/// Read material entries from a seperate file in one of the include sections of the geometry +/// Process include statements in various sub-tags of compact template <> void Converter::operator()(xml_h element) const { std::string type = element.hasAttr(_U(type)) ? element.attr(_U(type)) : std::string("xml"); if ( type == "xml" ) { @@ -1626,8 +1626,12 @@ template <> void Converter::operator()(xml_h element) const { Converter(this->description)(node); else if ( tag == "define" ) xml_coll_t(node, _U(constant)).for_each(Converter(this->description)); + else if ( tag == "readout" ) + Converter(this->description)(node); else if ( tag == "readouts" ) xml_coll_t(node, _U(readout)).for_each(Converter(this->description)); + else if ( tag == "region" ) + Converter(this->description)(node); else if ( tag == "regions" ) xml_coll_t(node, _U(region)).for_each(Converter(this->description)); else if ( tag == "limits" || tag == "limitsets" ) @@ -1656,6 +1660,7 @@ template <> void Converter::operator()(xml_h element) const { } } +/// Main compact conversion entry point template <> void Converter::operator()(xml_h element) const { static int num_calls = 0; char text[32]; @@ -1720,8 +1725,8 @@ template <> void Converter::operator()(xml_h element) const { if (element.hasChild(_U(info))) (Converter
(description))(xml_h(compact.child(_U(info)))); - xml_coll_t(compact, _U(properties)).for_each(_U(attributes), Converter(description)); /// These two must be parsed early, because they are needed by the detector constructors + xml_coll_t(compact, _U(properties)).for_each(_U(attributes), Converter(description)); xml_coll_t(compact, _U(properties)).for_each(_U(constant), Converter(description)); xml_coll_t(compact, _U(properties)).for_each(_U(matrix), Converter(description)); xml_coll_t(compact, _U(properties)).for_each(_U(plugin), Converter (description)); @@ -1730,13 +1735,15 @@ template <> void Converter::operator()(xml_h element) const { xml_coll_t(compact, _U(materials)).for_each(_U(element), Converter(description)); xml_coll_t(compact, _U(materials)).for_each(_U(material), Converter(description)); xml_coll_t(compact, _U(materials)).for_each(_U(plugin), Converter (description)); - + printout(DEBUG, "Compact", "++ Converting visualization attributes..."); xml_coll_t(compact, _U(display)).for_each(_U(include), Converter(description)); xml_coll_t(compact, _U(display)).for_each(_U(vis), Converter(description)); + printout(DEBUG, "Compact", "++ Converting limitset structures..."); xml_coll_t(compact, _U(limits)).for_each(_U(include), Converter(description)); xml_coll_t(compact, _U(limits)).for_each(_U(limitset), Converter(description)); + printout(DEBUG, "Compact", "++ Converting region structures..."); xml_coll_t(compact, _U(regions)).for_each(_U(include), Converter(description)); xml_coll_t(compact, _U(regions)).for_each(_U(region), Converter(description)); @@ -1746,7 +1753,9 @@ template <> void Converter::operator()(xml_h element) const { } if ( open_geometry ) description.init(); printout(DEBUG, "Compact", "++ Converting readout structures..."); + xml_coll_t(compact, _U(readouts)).for_each(_U(include), Converter(description)); xml_coll_t(compact, _U(readouts)).for_each(_U(readout), Converter(description)); + printout(DEBUG, "Compact", "++ Converting included files with subdetector structures..."); xml_coll_t(compact, _U(detectors)).for_each(_U(include), Converter(description)); printout(DEBUG, "Compact", "++ Converting detector structures..."); @@ -1767,6 +1776,7 @@ template <> void Converter::operator()(xml_h element) const { ReflectionBuilder rb(description); rb.execute(); } + /// Load plugin and process them as indicated xml_coll_t(compact, _U(plugins)).for_each(_U(plugin), Converter (description)); xml_coll_t(compact, _U(plugins)).for_each(_U(include), Converter (description)); xml_coll_t(compact, _U(plugins)).for_each(_U(xml), Converter (description)); diff --git a/DDCore/src/segmentations/CartesianGrid.cpp b/DDCore/src/segmentations/CartesianGrid.cpp index 7d53c2050..268a59942 100644 --- a/DDCore/src/segmentations/CartesianGrid.cpp +++ b/DDCore/src/segmentations/CartesianGrid.cpp @@ -7,17 +7,16 @@ // For the licensing terms see $DD4hepINSTALL/LICENSE. // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // +// Created: Jun 28, 2013 +// Author: Christian Grefe, CERN +// //========================================================================== -/* - * CartesianGrid.cpp - * - * Created on: Jun 28, 2013 - * Author: Christian Grefe, CERN - */ +/// Framework include files #include namespace dd4hep { + namespace DDSegmentation { /// Default constructor used by derived classes passing the encoding string diff --git a/DDCore/src/segmentations/CartesianGridXY.cpp b/DDCore/src/segmentations/CartesianGridXY.cpp index 81d929be5..2752bdf6a 100644 --- a/DDCore/src/segmentations/CartesianGridXY.cpp +++ b/DDCore/src/segmentations/CartesianGridXY.cpp @@ -7,18 +7,17 @@ // For the licensing terms see $DD4hepINSTALL/LICENSE. // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // +// Created: Jun 28, 2013 +// Author: Christian Grefe, CERN +// //========================================================================== -/* - * CartesianGridXY.cpp - * - * Created on: Jun 28, 2013 - * Author: Christian Grefe, CERN - */ +/// Framework include files #include namespace dd4hep { -namespace DDSegmentation { + + namespace DDSegmentation { /// default constructor using an encoding string CartesianGridXY::CartesianGridXY(const std::string& cellEncoding) : diff --git a/DDCore/src/segmentations/CartesianGridXYStaggered.cpp b/DDCore/src/segmentations/CartesianGridXYStaggered.cpp index 038e5ef8d..961a56503 100644 --- a/DDCore/src/segmentations/CartesianGridXYStaggered.cpp +++ b/DDCore/src/segmentations/CartesianGridXYStaggered.cpp @@ -7,18 +7,17 @@ // For the licensing terms see $DD4hepINSTALL/LICENSE. // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // +// Created: Sept 15, 2023 +// Author: Sebouh J. Paul, UCR +// //========================================================================== -/* - * CartesianGridXYStaggered.cpp - * - * Created on: Sept 15, 2023 - * Author: Sebouh J. Paul, UCR - */ +/// Framework include files #include namespace dd4hep { -namespace DDSegmentation { + + namespace DDSegmentation { /// default constructor using an encoding string CartesianGridXYStaggered::CartesianGridXYStaggered(const std::string& cellEncoding) diff --git a/DDCore/src/segmentations/CartesianGridXYZ.cpp b/DDCore/src/segmentations/CartesianGridXYZ.cpp index 73333c853..0e3c9c36b 100644 --- a/DDCore/src/segmentations/CartesianGridXYZ.cpp +++ b/DDCore/src/segmentations/CartesianGridXYZ.cpp @@ -7,14 +7,12 @@ // For the licensing terms see $DD4hepINSTALL/LICENSE. // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // +// Created: Jun 28, 2013 +// Author: Christian Grefe, CERN +// //========================================================================== -/* - * CartesianGridXYZ.cpp - * - * Created on: Jun 28, 2013 - * Author: Christian Grefe, CERN - */ +/// Framework include files #include namespace dd4hep { diff --git a/DDCore/src/segmentations/CartesianGridXZ.cpp b/DDCore/src/segmentations/CartesianGridXZ.cpp index b7327e9e7..86ca06fca 100644 --- a/DDCore/src/segmentations/CartesianGridXZ.cpp +++ b/DDCore/src/segmentations/CartesianGridXZ.cpp @@ -7,14 +7,12 @@ // For the licensing terms see $DD4hepINSTALL/LICENSE. // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // +// Created: Jun 28, 2013 +// Author: Christian Grefe, CERN +// //========================================================================== -/* - * CartesianGridXZ.cpp - * - * Created on: Jun 28, 2013 - * Author: Christian Grefe, CERN - */ +/// Framework include files #include namespace dd4hep { diff --git a/DDCore/src/segmentations/CartesianGridYZ.cpp b/DDCore/src/segmentations/CartesianGridYZ.cpp index 9069f406f..606e9c886 100644 --- a/DDCore/src/segmentations/CartesianGridYZ.cpp +++ b/DDCore/src/segmentations/CartesianGridYZ.cpp @@ -7,15 +7,12 @@ // For the licensing terms see $DD4hepINSTALL/LICENSE. // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // +// Created: Sep 03, 2014 +// Author: F.Gaede CERN/Desy +// //========================================================================== -/* CartesianGridYZ.cpp - * - * @date: Sep 03, 2014 - * @author: F.Gaede CERN/Desy - * @version: 1.0 - * direkt copy of CartesianGridXY - * by Christian Grefe, CERN - */ + +/// Framework include files #include namespace dd4hep { diff --git a/DDCore/src/segmentations/CartesianStrip.cpp b/DDCore/src/segmentations/CartesianStrip.cpp index cc2b145ec..53dffe747 100644 --- a/DDCore/src/segmentations/CartesianStrip.cpp +++ b/DDCore/src/segmentations/CartesianStrip.cpp @@ -7,15 +7,13 @@ // For the licensing terms see $DD4hepINSTALL/LICENSE. // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // +// Created: Jun 28, 2013 +// Author: Christian Grefe, CERN +// David Blyth, ANL +// //========================================================================== -/* - * CartesianStrip.cpp - * - * Created on: Jun 28, 2013 - * Author: Christian Grefe, CERN - * David Blyth, ANL - */ +/// Framework include files #include namespace dd4hep { diff --git a/DDCore/src/segmentations/CartesianStripX.cpp b/DDCore/src/segmentations/CartesianStripX.cpp index c43065972..486b73521 100644 --- a/DDCore/src/segmentations/CartesianStripX.cpp +++ b/DDCore/src/segmentations/CartesianStripX.cpp @@ -7,15 +7,13 @@ // For the licensing terms see $DD4hepINSTALL/LICENSE. // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // +// Created: Jun 28, 2013 +// Author: Christian Grefe, CERN +// David Blyth, ANL +// //========================================================================== -/* - * CartesianStripX.cpp - * - * Created on: Jun 28, 2013 - * Author: Christian Grefe, CERN - * David Blyth, ANL - */ +/// Framework include files #include namespace dd4hep { diff --git a/DDCore/src/segmentations/MultiSegmentation.cpp b/DDCore/src/segmentations/MultiSegmentation.cpp index 2b61cbbc9..99945437a 100644 --- a/DDCore/src/segmentations/MultiSegmentation.cpp +++ b/DDCore/src/segmentations/MultiSegmentation.cpp @@ -7,17 +7,16 @@ // For the licensing terms see $DD4hepINSTALL/LICENSE. // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. // +// Created: Jun 28, 2013 +// Author: Christian Grefe, CERN +// //========================================================================== -/* - * MultiSegmentation.cpp - * - * Created on: Jun 28, 2013 - * Author: Christian Grefe, CERN - */ +/// Framework include files #include #include +/// C/C++ include files #include #include @@ -33,7 +32,7 @@ namespace dd4hep { _type = "MultiSegmentation"; _description = "Multi-segmenation wrapper segmentation"; //registerParameter("debug", "Debug flag", m_debug, 0); - registerParameter("key", "Diskriminating field", m_discriminatorId, ""); + registerParameter("key", "Diskriminating field", m_discriminatorId, ""); } /// Default constructor used by derived classes passing an existing decoder @@ -44,7 +43,7 @@ namespace dd4hep { _type = "MultiSegmentation"; _description = "Multi-segmenation wrapper segmentation"; //registerParameter("debug", "Debug flag", m_debug, 0); - registerParameter("key", "Diskriminating field", m_discriminatorId, ""); + registerParameter("key", "Diskriminating field", m_discriminatorId, ""); } /// destructor @@ -55,7 +54,7 @@ namespace dd4hep { } /// Add subsegmentation. Call only valid for Multi-segmentations. Default implementation throws an exception - void MultiSegmentation::addSubsegmentation(long key_min, long key_max, Segmentation* entry) { + void MultiSegmentation::addSubsegmentation(long key_min, long key_max, Segmentation* entry) { Entry e; e.key_min = key_min; e.key_max = key_max; @@ -77,14 +76,14 @@ namespace dd4hep { long seg_id = m_discriminator->value(cID); for(Segmentations::const_iterator i=m_segmentations.begin(); i != m_segmentations.end(); ++i) { const Entry& e = *i; - if ( e.key_min<= seg_id && e.key_max >= seg_id ) { + if ( e.key_min<= seg_id && e.key_max >= seg_id ) { Segmentation* s = e.segmentation; - if ( m_debug > 0 ) { + if ( m_debug > 0 ) { printout(ALWAYS,"MultiSegmentation","Id: %04X %s", seg_id, s->name().c_str()); const Parameters& pars = s->parameters(); - for( const auto* p : pars ) { + for( const auto* p : pars ) { printout(ALWAYS,"MultiSegmentation"," Param %s = %s", - p->name().c_str(), p->value().c_str()); + p->name().c_str(), p->value().c_str()); } } return *s; diff --git a/DDEve/src/CaloLego.cpp b/DDEve/src/CaloLego.cpp index 0a8910075..06902fa9f 100644 --- a/DDEve/src/CaloLego.cpp +++ b/DDEve/src/CaloLego.cpp @@ -68,12 +68,12 @@ void CaloLego::ConfigureGeometry(const DisplayConfiguration::ViewConfig& config) DisplayConfiguration::Calodata& cd = calo.config.data.calodata; if ( calo.config.use.empty() ) { for(int isl = 0; islGetNSlices(); ++isl) { - int nslice = ctx.eveHist->GetNSlices(); - TH2F* h = new TH2F(*calo.eveHist->GetHist(isl)); - ctx.eveHist->AddHistogram(h); - ctx.eveHist->RefSliceInfo(nslice).Setup(n,cd.threshold,cd.color,101); - Annotation* a = new Annotation(viewer(),n,Annotation::DefaultMargin(),legend_y,cd.color); - legend_y += a->GetTextSize(); + int nslice = ctx.eveHist->GetNSlices(); + TH2F* h = new TH2F(*calo.eveHist->GetHist(isl)); + ctx.eveHist->AddHistogram(h); + ctx.eveHist->RefSliceInfo(nslice).Setup(n,cd.threshold,cd.color,101); + Annotation* a = new Annotation(viewer(),n,Annotation::DefaultMargin(),legend_y,cd.color); + legend_y += a->GetTextSize(); } } } @@ -113,10 +113,10 @@ void CaloLego::ConfigureEvent(const DisplayConfiguration::ViewConfig& config) { const Display::CalodataContext& ctx = m_eve->GetCaloHistogram(n); if ( ctx.config.use.empty() ) { for(int isl = 0; islGetNSlices(); ++isl) { - TH2F* global = ctx.eveHist->GetHist(isl); - TH2F* local = m_data.eveHist->GetHist(ihist); - *local = *global; - ihist++; + TH2F* global = ctx.eveHist->GetHist(isl); + TH2F* local = m_data.eveHist->GetHist(ihist); + *local = *global; + ihist++; } } } diff --git a/DDG4/examples/SiDSim.py b/DDG4/examples/SiDSim.py index 724259a7b..5a481a3a6 100644 --- a/DDG4/examples/SiDSim.py +++ b/DDG4/examples/SiDSim.py @@ -53,6 +53,9 @@ def run(): description = kernel.detectorDescription() install_dir = os.environ['DD4hepINSTALL'] kernel.loadGeometry(str("file:" + install_dir + "/DDDetectors/compact/SiD.xml")) + + if args.smartless: + description.worldVolume().setSmartlessValue(int(args.smartless)) DDG4.importConstants(description) geant4 = DDG4.Geant4(kernel, tracker='Geant4TrackerCombineAction') @@ -60,9 +63,24 @@ def run(): logger.info("# Configure UI") ui = geant4.setupCshUI(macro=args.macro, vis=args.vis) kernel.UI = 'UI' + + import pdb + pdb.set_trace() + + cmds = [] + if args.verbose: + cmds.append('/run/verbose ' + str(args.verbose)) + if args.batch: + if not args.events: + args.events = '5' + cmds.append('/run/beamOn ' + str(args.events)) + + # Terminate sequence if args.batch: - ui.Commands = ['/run/beamOn ' + str(args.events), '/ddg4/UI/terminate'] + cmds.append('/ddg4/UI/terminate') + ui.Commands = cmds + logger.info("# Configure G4 magnetic field tracking") geant4.setupTrackingField() diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index fd4686802..8f4752e4b 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -796,7 +796,12 @@ void* Geant4Converter::handleVolume(const std::string& name, const TGeoVolume* v else { g4vol = new G4LogicalVolume(g4solid, g4medium, vnam, nullptr, nullptr, nullptr); } - + /// Set smartless optimization + unsigned char smart_less_value = _v.smartlessValue(); + if ( smart_less_value != Volume::NO_SMARTLESS_OPTIMIZATION ) { + g4vol->SetSmartless(smart_less_value); + } + /// Assign limits if necessary if ( g4limits ) { g4vol->SetUserLimits(g4limits); } diff --git a/examples/CLICSiD/eve/DDEve.xml b/examples/CLICSiD/eve/DDEve.xml index 4a6795dbf..1a6a43ab6 100644 --- a/examples/CLICSiD/eve/DDEve.xml +++ b/examples/CLICSiD/eve/DDEve.xml @@ -80,11 +80,11 @@ - - - - - + + + + + @@ -120,24 +120,25 @@ - - + + - + diff --git a/examples/CLICSiD/eve/DDEve7.xml b/examples/CLICSiD/eve/DDEve7.xml new file mode 100644 index 000000000..6da6512e3 --- /dev/null +++ b/examples/CLICSiD/eve/DDEve7.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/ClientTests/compact/DriftChamber.xml b/examples/ClientTests/compact/DriftChamber.xml new file mode 100644 index 000000000..1373af4eb --- /dev/null +++ b/examples/ClientTests/compact/DriftChamber.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A barrel hadronic calorimeter inspired on the ATLAS Tile hadronic calorimeter + + + + + + + + system:8,layer:16,phi:16 + + + + + + + + diff --git a/examples/ClientTests/compact/FCC_HcalBarrel.xml b/examples/ClientTests/compact/FCC_HcalBarrel.xml index d8ce0e2ad..7d56a13ee 100644 --- a/examples/ClientTests/compact/FCC_HcalBarrel.xml +++ b/examples/ClientTests/compact/FCC_HcalBarrel.xml @@ -62,7 +62,7 @@ - + Containment shell to measure calorimeter escapes diff --git a/examples/ClientTests/compact/Segmentation_Check.xml b/examples/ClientTests/compact/Segmentation_Check.xml new file mode 100644 index 000000000..e5d1eed46 --- /dev/null +++ b/examples/ClientTests/compact/Segmentation_Check.xml @@ -0,0 +1,75 @@ + + + + + + Shape to test segmentations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/ClientTests/compact/Segmentation_Check_CartesianGridXY.xml b/examples/ClientTests/compact/Segmentation_Check_CartesianGridXY.xml new file mode 100644 index 000000000..203a883d0 --- /dev/null +++ b/examples/ClientTests/compact/Segmentation_Check_CartesianGridXY.xml @@ -0,0 +1,16 @@ + + + + + system:8,x:24:-12,y:-12 + diff --git a/examples/ClientTests/scripts/BoxOfStraws.py b/examples/ClientTests/scripts/BoxOfStraws.py index 00cc33d03..9d4faa9dd 100644 --- a/examples/ClientTests/scripts/BoxOfStraws.py +++ b/examples/ClientTests/scripts/BoxOfStraws.py @@ -47,8 +47,15 @@ def run(): ui = geant4.setupCshUI(macro=args.macro) else: ui = geant4.setupCshUI() + + if args.verbose: + ui.Commands.append('/run/verbose ' + str(args.verbose)) + if args.batch: + ui.Commands.append('/run/beamOn ' + str(args.events)) + + # Terminate sequence if args.batch: - ui.Commands = ['/run/beamOn ' + str(args.events), '/ddg4/UI/terminate'] + ui.Commands.append('/ddg4/UI/terminate') # # Configure field geant4.setupTrackingField(prt=True) diff --git a/examples/ClientTests/src/DriftChamber_geo.cpp b/examples/ClientTests/src/DriftChamber_geo.cpp new file mode 100644 index 000000000..46acce19e --- /dev/null +++ b/examples/ClientTests/src/DriftChamber_geo.cpp @@ -0,0 +1,84 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// Author : M.Frank +// +//========================================================================== +// +#include +#include + + +#include + +using namespace std; +using namespace dd4hep; +using namespace dd4hep::detail; + +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { + constexpr double tol = 1e-4; + xml_det_t x_det = e; + + // for volume tags in detector + int det_id = x_det.id(); + string det_name = x_det.nameStr(); + DetElement sdet(det_name, det_id); + + // pointer to finding dimensins text in xml file + // look in DDCore/include/Parsers/detail/Dimension.h for arguments + xml_comp_t x_dim = x_det.dimensions(); + double cyl_rmin = x_dim.rmin(); + double cyl_rmax = x_dim.rmax(); + double cyl_dz = x_dim.dz(); + double layer_cnt = x_dim.layers(); + xml_comp_t x_wire = x_det.child(_Unicode(wire)); + size_t wire_cnt = x_wire.count(); + double wire_thick = x_wire.thickness(); + + double layer_thickness = (cyl_rmax - cyl_rmin)/double(layer_cnt+1); + double delta_phi = 2.0 * M_PI / double(wire_cnt); + double phi_start = 0e0; + + Solid sdet_cyl = Tube(cyl_rmin-tol,cyl_rmax+tol,cyl_dz+tol); + Volume sdet_vol(det_name+"_vol", sdet_cyl, description.air()); + + Material wire_mat(description.material(x_wire.materialStr())); + Tube wire_cyl(0e0, wire_thick, cyl_dz-1.0*dd4hep::cm); + Volume wire_vol("Wire_vol", wire_cyl, wire_mat); + PlacedVolume pv; + + sdet_vol.setSmartlessValue(2); + sdet_vol.setAttributes(description, x_det.regionStr(), x_det.limitsStr(), x_det.visStr()); + + wire_vol.setSmartlessValue(2); + wire_vol.setVisAttributes(description.visAttributes(x_det.visStr())); + + for( std::size_t l=0; l +#include + +using namespace dd4hep; + +static int print_segmentation(Detector& detector, int argc, char** argv) { + std::string placement_path; + printout(ALWAYS, "PrintSegments", "+++ ------------------------------------------------------------------"); + for( int i=0; i +#include + +#include + +/// Plugin function: Test ROOT URI object +/** + * + * \author M.Frank + * \version 1.0 + * \date 20/06/2024 + */ +static int Test_TUri (dd4hep::Detector& , int argc, char** argv) { + std::string name; + for( int i=0; i -name " + << std::endl << std::flush; + ::exit(EINVAL); + } + TUri uri(name.c_str()); + std::cout << "--> relative part: " << uri.GetRelativePart() << std::endl; + uri.Print(); + return 0; +} + +DECLARE_APPLY(DD4hep_Test_TUri,Test_TUri) diff --git a/examples/DDCAD/compact/DD4hep_Issue_1134_resolved_test.xml b/examples/DDCAD/compact/DD4hep_Issue_1134_resolved_test.xml new file mode 100644 index 000000000..7af74e9e1 --- /dev/null +++ b/examples/DDCAD/compact/DD4hep_Issue_1134_resolved_test.xml @@ -0,0 +1,88 @@ + + + + + CAD Shape tester + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/DDDigi/src/DigiTestAction.cpp b/examples/DDDigi/src/DigiTestAction.cpp index d35cae8d5..2c8444f05 100644 --- a/examples/DDDigi/src/DigiTestAction.cpp +++ b/examples/DDDigi/src/DigiTestAction.cpp @@ -76,6 +76,7 @@ namespace dd4hep { //#include "DDDigi/DigiTestAction.h" // C/C++ include files +#include #ifdef __APPLE__ static void noop(int) {}