From b3f10d15f9a0f2f1d1befc85dab4c126a290db07 Mon Sep 17 00:00:00 2001 From: Markus Frank <markus.frank@cern.ch> Date: Mon, 17 Nov 2014 21:22:53 +0000 Subject: [PATCH] Fix to properly propagate region and limits setting to daughter volumes --- DDCore/include/DD4hep/GeoHandler.h | 7 +- DDCore/src/GeoHandler.cpp | 42 +++- DDCore/src/LCDDImp.cpp | 2 +- DDCore/src/plugins/Compact2Objects.cpp | 7 +- DDG4/examples/CLICSidSimuMarkus.py | 1 - DDG4/include/DDG4/Geant4AssemblyVolume.h | 2 +- DDG4/src/Geant4Converter.cpp | 16 +- examples/ClientTests/compact/Assemblies.xml | 186 +++++++++++------- .../ClientTests/compact/Geant4Assemblies.py | 44 +---- .../ClientTests/src/Assemblies_VXD_geo.cpp | 9 +- 10 files changed, 175 insertions(+), 141 deletions(-) diff --git a/DDCore/include/DD4hep/GeoHandler.h b/DDCore/include/DD4hep/GeoHandler.h index 5af622f18..db870c0f4 100644 --- a/DDCore/include/DD4hep/GeoHandler.h +++ b/DDCore/include/DD4hep/GeoHandler.h @@ -98,10 +98,11 @@ namespace DD4hep { class GeoHandler: public GeoHandlerTypes { protected: + bool m_propagateRegions; Data* m_data; /// Internal helper to collect geometry information from traversal - GeoHandler& i_collect(const TGeoNode* node, int level); + GeoHandler& i_collect(const TGeoNode* node, int level, Region rg, LimitSet ls); private: /// Never call Copy constructor @@ -119,6 +120,8 @@ namespace DD4hep { GeoHandler(Data* ptr); /// Default destructor virtual ~GeoHandler(); + /// Propagate regions. Returns the previous value + bool setPropagateRegions(bool value); /// Collect geometry information from traversal GeoHandler& collect(DetElement top); /// Collect geometry information from traversal with aggregated information @@ -140,6 +143,8 @@ namespace DD4hep { public: /// Initializing constructor GeoScan(DetElement e); + /// Initializing constructor + GeoScan(DetElement e, bool propagateRegions); /// Default destructor virtual ~GeoScan(); /// Work callback diff --git a/DDCore/src/GeoHandler.cpp b/DDCore/src/GeoHandler.cpp index 83c7527e2..684d98efb 100644 --- a/DDCore/src/GeoHandler.cpp +++ b/DDCore/src/GeoHandler.cpp @@ -42,13 +42,13 @@ namespace { } /// Default constructor -GeoHandler::GeoHandler() { +GeoHandler::GeoHandler() : m_propagateRegions(false) { m_data = new Data(); } /// Initializing constructor GeoHandler::GeoHandler(Data* ptr) - : m_data(ptr) { + : m_propagateRegions(false), m_data(ptr) { } /// Default destructor @@ -64,14 +64,21 @@ GeoHandler::Data* GeoHandler::release() { return d; } +/// Propagate regions. Returns the previous value +bool GeoHandler::setPropagateRegions(bool value) { + bool old = m_propagateRegions; + m_propagateRegions = value; + return old; +} + GeoHandler& GeoHandler::collect(DetElement element) { m_data->clear(); - return i_collect(element.placement().ptr(), 0); + return i_collect(element.placement().ptr(), 0, Region(), LimitSet()); } GeoHandler& GeoHandler::collect(DetElement element, GeometryInfo& info) { m_data->clear(); - i_collect(element.placement().ptr(), 0); + i_collect(element.placement().ptr(), 0, Region(), LimitSet()); for (Data::const_reverse_iterator i = m_data->rbegin(); i != m_data->rend(); ++i) { const Data::mapped_type& v = (*i).second; for (Data::mapped_type::const_iterator j = v.begin(); j != v.end(); ++j) { @@ -106,16 +113,30 @@ GeoHandler& GeoHandler::collect(DetElement element, GeometryInfo& info) { return *this; } -GeoHandler& GeoHandler::i_collect(const TGeoNode* current, int level) { +GeoHandler& GeoHandler::i_collect(const TGeoNode* current, int level, Region rg, LimitSet ls) { TGeoVolume* volume = current->GetVolume(); TObjArray* nodes = volume->GetNodes(); int num_children = nodes ? nodes->GetEntriesFast() : 0; - + Volume vol(volume); + Region region = vol.region(); + LimitSet limits = vol.limitSet(); + + if ( m_propagateRegions ) { + if ( !region.isValid() && rg.isValid() ) { + region = rg; + vol.setRegion(region); + } + if ( !limits.isValid() && ls.isValid() ) { + limits = ls; + vol.setLimitSet(limits); + } + } (*m_data)[level].insert(current); + //printf("GeoHandler: collect level:%d %s\n",level,current->GetName()); if (num_children > 0) { for (int i = 0; i < num_children; ++i) { TGeoNode* node = (TGeoNode*) nodes->At(i); - i_collect(node, level + 1); + i_collect(node, level + 1, region, limits); } } return *this; @@ -126,6 +147,13 @@ GeoScan::GeoScan(DetElement e) { m_data = GeoHandler().collect(e).release(); } +/// Initializing constructor +GeoScan::GeoScan(DetElement e, bool propagate) { + GeoHandler h; + h.setPropagateRegions(propagate); + m_data = h.collect(e).release(); +} + /// Default destructor GeoScan::~GeoScan() { if (m_data) diff --git a/DDCore/src/LCDDImp.cpp b/DDCore/src/LCDDImp.cpp index f8cfbb2a7..392abeebf 100644 --- a/DDCore/src/LCDDImp.cpp +++ b/DDCore/src/LCDDImp.cpp @@ -225,7 +225,7 @@ namespace { VolumeManager m_volManager; DetElement m_world; ShapePatcher(VolumeManager m, DetElement e) - : GeoScan(e), m_volManager(m), m_world(e) { + : GeoScan(e,true), m_volManager(m), m_world(e) { } void patchShapes() { GeoHandler::Data& data = *m_data; diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp index f0823565d..573d5cc8f 100644 --- a/DDCore/src/plugins/Compact2Objects.cpp +++ b/DDCore/src/plugins/Compact2Objects.cpp @@ -827,7 +827,10 @@ template <> void Converter<DetElementInclude>::operator()(xml_h element) const { } template <> void Converter<Compact>::operator()(xml_h element) const { + static int num_calls = 0; char text[32]; + + ++num_calls; xml_elt_t compact(element); xml_coll_t(compact, _U(includes)).for_each(_U(gdmlFile), Converter < GdmlFile > (lcdd)); @@ -860,7 +863,9 @@ template <> void Converter<Compact>::operator()(xml_h element) const { xml_coll_t(compact, _U(sensitive_detectors)).for_each(_U(sd), Converter < SensitiveDetector > (lcdd)); ::snprintf(text, sizeof(text), "%u", xml_h(element).checksum(0)); lcdd.addConstant(Constant("compact_checksum", text)); - lcdd.endDocument(); + if ( --num_calls == 0 ) { + lcdd.endDocument(); + } } #ifdef _WIN32 diff --git a/DDG4/examples/CLICSidSimuMarkus.py b/DDG4/examples/CLICSidSimuMarkus.py index e8cfcc140..f89ef4ee7 100644 --- a/DDG4/examples/CLICSidSimuMarkus.py +++ b/DDG4/examples/CLICSidSimuMarkus.py @@ -21,7 +21,6 @@ def run(): kernel.loadGeometry("file:"+install_dir+"/DDDetectors/compact/SiD.xml") kernel.loadXML("file:"+example_dir+"/DDG4_field.xml") DDG4.importConstants(lcdd) - simple = DDG4.Simple(kernel,tracker='Geant4TrackerCombineAction') simple.printDetectors() # Configure UI diff --git a/DDG4/include/DDG4/Geant4AssemblyVolume.h b/DDG4/include/DDG4/Geant4AssemblyVolume.h index dc267d7f0..5a90e0718 100644 --- a/DDG4/include/DDG4/Geant4AssemblyVolume.h +++ b/DDG4/include/DDG4/Geant4AssemblyVolume.h @@ -18,7 +18,7 @@ namespace DD4hep { public: std::vector<const TGeoNode*> m_entries; typedef std::vector<const TGeoNode*> Chain; - /// Default constructor + /// Default constructor with initialization Geant4AssemblyVolume() { } /// Default destructor diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index 51430a98f..7bc0d1e60 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -538,7 +538,7 @@ void* Geant4Converter::handleVolume(const string& name, const TGeoVolume* volume region = info.g4Regions[reg]; if (!region) { throw runtime_error("G4Cnv::volume[" + name + "]: + FATAL Failed to " - "access Geant4 region."); + "access Geant4 region."); } } PrintLevel lvl = m_outputLevel; //string(det.name())=="SiTrackerBarrel" ? WARNING : m_outputLevel; @@ -570,7 +570,7 @@ void* Geant4Converter::handleVolume(const string& name, const TGeoVolume* volume } if (sd) { printout(m_outputLevel, "Geant4Converter", "++ Volume: + %s <> %s Solid:%s Mat:%s SD:%s", name.c_str(), vol->GetName().c_str(), - solid->GetName().c_str(), medium->GetName().c_str(), sd->GetName().c_str()); + solid->GetName().c_str(), medium->GetName().c_str(), sd->GetName().c_str()); } info.g4Volumes[v] = vol; printout(m_outputLevel, "Geant4Converter", "++ Volume + %s converted: %p ---> G4: %p", n.c_str(), v, vol); @@ -598,17 +598,17 @@ void* Geant4Converter::collectVolume(const string& /* name */, const TGeoVolume* /// Dump volume placement in GDML format to output stream void* Geant4Converter::handleAssembly(const std::string& name, const TGeoNode* node) const { - TGeoVolume* vol = node->GetVolume(); - if ( vol->IsA() != TGeoVolumeAssembly::Class() ) { + TGeoVolume* mot_vol = node->GetVolume(); + if ( mot_vol->IsA() != TGeoVolumeAssembly::Class() ) { return 0; } Geant4GeometryInfo& info = data(); Geant4AssemblyVolume* g4 = info.g4AssemblyVolumes[node]; + if ( !g4 ) { g4 = new Geant4AssemblyVolume(); - TGeoVolume* mot_vol = node->GetVolume(); - for(Int_t i=0; i < vol->GetNdaughters(); ++i) { - TGeoNode* d = vol->GetNode(i); + for(Int_t i=0; i < mot_vol->GetNdaughters(); ++i) { + TGeoNode* d = mot_vol->GetNode(i); TGeoVolume* dau_vol = d->GetVolume(); TGeoMatrix* tr = d->GetMatrix(); MyTransform3D transform(tr->GetTranslation(),tr->IsRotation() ? tr->GetRotationMatrix() : s_identity_rot); @@ -988,7 +988,6 @@ Geant4Converter& Geant4Converter::create(DetElement top) { m_data->clear(); collect(top, geo); m_checkOverlaps = false; - // We do not have to handle defines etc. // All positions and the like are not really named. // Hence, start creating the G4 objects for materials, solids and log volumes. @@ -997,6 +996,7 @@ Geant4Converter& Geant4Converter::create(DetElement top) { mat = m_lcdd.material("Silicon"); handleMaterial(mat.name(), mat); + //m_outputLevel = WARNING; //setPrintLevel(VERBOSE); handle(this, geo.volumes, &Geant4Converter::collectVolume); diff --git a/examples/ClientTests/compact/Assemblies.xml b/examples/ClientTests/compact/Assemblies.xml index 3d286f39f..f55de5bfd 100644 --- a/examples/ClientTests/compact/Assemblies.xml +++ b/examples/ClientTests/compact/Assemblies.xml @@ -1,90 +1,126 @@ <lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd"> + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd"> - <info name="Assemblies_v01" + <info name="Assemblies_v01" title="Assembly Detector Toy model" author="M.Frank" url="http://ilcsoft.desy.de" status="development" version="$Id: ILDEx.xml 676 2013-08-06 11:12:53Z gaede $"> - <comment>The compact format for the ILD Detector - toy model </comment> - </info> + <comment>The compact format for the ILD Detector - toy model </comment> + </info> - <includes> - <gdmlFile ref="elements.xml"/> - <gdmlFile ref="materials.xml"/> - </includes> + <includes> + <gdmlFile ref="elements.xml"/> + <gdmlFile ref="materials.xml"/> + </includes> - <define> - <constant name="world_side" value="10*m"/> - <constant name="world_x" value="world_side/2"/> - <constant name="world_y" value="world_side/2"/> - <constant name="world_z" value="world_side/2"/> - <constant name="CrossingAngle" value="0.014*rad"/> - - <constant name="VXD_inner_radius" value="15*mm"/> - <constant name="VXD_outer_radius" value="80*mm"/> - <constant name="VXD_zhalf" value="130*mm"/> - <constant name="TPC_zhalf" value="2500*mm"/> - <constant name="Hcal_outer_radius" value="3395.46*mm"/> - <constant name="SolenoidCoilOuterZ" value="TPC_zhalf + 0.3*m"/> - <constant name="SolenoidalFieldRadius" value="Hcal_outer_radius + 10.0*mm"/> - </define> + <define> + <constant name="world_side" value="10*m"/> + <constant name="world_x" value="world_side/2"/> + <constant name="world_y" value="world_side/2"/> + <constant name="world_z" value="world_side/2"/> + <constant name="CrossingAngle" value="0.014*rad"/> + + <constant name="VXD_inner_radius" value="15*mm"/> + <constant name="VXD_outer_radius" value="80*mm"/> + <constant name="VXD_zhalf" value="130*mm"/> + <constant name="TPC_zhalf" value="2500*mm"/> + <constant name="Hcal_outer_radius" value="3395.46*mm"/> + <constant name="SolenoidCoilOuterZ" value="TPC_zhalf + 0.3*m"/> + <constant name="SolenoidalFieldRadius" value="Hcal_outer_radius + 10.0*mm"/> + </define> - <limits> - <limitset name="Tracker_limits"> - <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> - </limitset> - </limits> + <limits> + <limitset name="Tracker_limits"> + <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> + </limitset> + <limitset name="VXD_RegionLimitSet"> + <limit name="step_length_max" particles="*" value="5.0" unit="mm" /> + <limit name="track_length_max" particles="*" value="5.0" unit="mm" /> + <limit name="time_max" particles="*" value="5.0" unit="ns" /> + <limit name="ekin_min" particles="*" value="0.01" unit="MeV" /> + <limit name="range_min" particles="*" value="5.0" unit="mm" /> + </limitset> + </limits> + <regions> + <region name="VXD_Region" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001"> + <limitsetref name="VXD_RegionLimitSet"/> + </region> + <region name="VXD_LAYER_0_Region" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001"> + <limitsetref name="VXD_RegionLimitSet"/> + </region> + <region name="VXD_LADDER_0_Region" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001"> + <limitsetref name="VXD_RegionLimitSet"/> + </region> + <region name="VXD_SUPPORT_0_Region" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001"> + <limitsetref name="VXD_RegionLimitSet"/> + </region> + <region name="VXD_Layer_1_Region" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001"> + <limitsetref name="VXD_RegionLimitSet"/> + </region> + <region name="VXD_Layer_2_Region" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001"> + <limitsetref name="VXD_RegionLimitSet"/> + </region> + <region name="VXD_Layer_3_Region" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001"> + <limitsetref name="VXD_RegionLimitSet"/> + </region> + <region name="VXD_Layer_4_Region" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001"> + <limitsetref name="VXD_RegionLimitSet"/> + </region> + <region name="VXD_Layer_5_Region" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001"> + <limitsetref name="VXD_RegionLimitSet"/> + </region> + </regions> - <display> - <vis name="VXDVis" alpha="1.0" r="0.9" g=".1" b=".1" showDaughters="true" visible="true"/> - <vis name="VXDLayerVis" alpha="1.0" r="0" g="1" b="0" showDaughters="true" visible="true"/> - <vis name="VXDSupportVis" alpha="1" r="0" g="1" b="0" showDaughters="true" visible="true"/> - </display> + <display> + <vis name="VXDVis" alpha="1.0" r="0.9" g=".1" b=".1" showDaughters="true" visible="true"/> + <vis name="VXDLayerVis" alpha="1.0" r="0" g="1" b="0" showDaughters="true" visible="true"/> + <vis name="VXDSupportVis" alpha="1" r="0" g="1" b="0" showDaughters="true" visible="true"/> + </display> - <detectors> - <comment>Trackers</comment> + <detectors> + <comment>Trackers</comment> - <detector name="VXD" type="VXD_Assembly" vis="VXDVis" id="1" limits="Tracker_limits" readout="VXDCollection" insideTrackingVolume="true"> - <tubs rmin="VXD_inner_radius" rmax="VXD_outer_radius" zhalf="VXD_zhalf"/> - <layer id="0" vis="VXDLayerVis" phi0="-1.570796327e+00"> - <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> - <ladder zhalf="65*mm" radius="1.595000000e+01*mm" width="1.100000000e+01*mm" offset="-1.874869853e+00*mm" thickness="0.05*mm" material="Silicon" number="10"/> - </layer> - <layer id="1" vis="VXDLayerVis" phi0="-1.570796327e+00"> - <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> - <ladder zhalf="65*mm" radius="18*mm" width="1.100000000e+01*mm" offset="-1.874869853e+00*mm" thickness="0.05*mm" material="Silicon" number="10"/> - </layer> - <layer id="2" vis="VXDLayerVis" phi0="-1.570796327e+00"> - <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> - <ladder zhalf="125*mm" radius="3.695000000e+01*mm" width="2.200000000e+01*mm" offset="-1.837940563e+00*mm" thickness="0.05*mm" material="Silicon" number="11"/> - </layer> - <layer id="3" vis="VXDLayerVis" phi0="-1.570796327e+00"> - <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> - <ladder zhalf="125*mm" radius="39*mm" width="2.200000000e+01*mm" offset="-1.837940563e+00*mm" thickness="0.05*mm" material="Silicon" number="11"/> - </layer> - <layer id="4" vis="VXDLayerVis" phi0="-1.570796327e+00"> - <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> - <ladder zhalf="125*mm" radius="5.795000000e+01*mm" width="2.200000000e+01*mm" offset="-2.636744400e+00*mm" thickness="0.05*mm" material="Silicon" number="17"/> - </layer> - <layer id="5" vis="VXDLayerVis" phi0="-1.570796327e+00"> - <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> - <ladder zhalf="125*mm" radius="60*mm" width="2.200000000e+01*mm" offset="-2.636744400e+00*mm" thickness="0.05*mm" material="Silicon" number="17"/> - </layer> - </detector> - </detectors> + <detector name="VXD" type="VXD_Assembly" vis="VXDVis" id="1" readout="VXDCollection" insideTrackingVolume="true" region="VXD_Region" limits="VXD_RegionLimitSet"> + <tubs rmin="VXD_inner_radius" rmax="VXD_outer_radius" zhalf="VXD_zhalf"/> + <layer id="0" vis="VXDLayerVis" phi0="-1.570796327e+00" region="VXD_LAYER_0_Region"> + <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis" region="VXD_SUPPORT_0_Region"/> + <ladder zhalf="65*mm" radius="1.595000000e+01*mm" width="1.100000000e+01*mm" offset="-1.874869853e+00*mm" thickness="0.05*mm" material="Silicon" number="10" region="VXD_LADDER_0_Region"/> + </layer> + <layer id="1" vis="VXDLayerVis" phi0="-1.570796327e+00" region="VXD_Layer_1_Region"> + <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> + <ladder zhalf="65*mm" radius="18*mm" width="1.100000000e+01*mm" offset="-1.874869853e+00*mm" thickness="0.05*mm" material="Silicon" number="10"/> + </layer> + <layer id="2" vis="VXDLayerVis" phi0="-1.570796327e+00" region="VXD_Layer_2_Region"> + <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> + <ladder zhalf="125*mm" radius="3.695000000e+01*mm" width="2.200000000e+01*mm" offset="-1.837940563e+00*mm" thickness="0.05*mm" material="Silicon" number="11"/> + </layer> + <layer id="3" vis="VXDLayerVis" phi0="-1.570796327e+00" region="VXD_Layer_3_Region"> + <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> + <ladder zhalf="125*mm" radius="39*mm" width="2.200000000e+01*mm" offset="-1.837940563e+00*mm" thickness="0.05*mm" material="Silicon" number="11"/> + </layer> + <layer id="4" vis="VXDLayerVis" phi0="-1.570796327e+00" region="VXD_Layer_4_Region"> + <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> + <ladder zhalf="125*mm" radius="5.795000000e+01*mm" width="2.200000000e+01*mm" offset="-2.636744400e+00*mm" thickness="0.05*mm" material="Silicon" number="17"/> + </layer> + <layer id="5" vis="VXDLayerVis" phi0="-1.570796327e+00" region="VXD_Layer_5_Region"> + <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> + <ladder zhalf="125*mm" radius="60*mm" width="2.200000000e+01*mm" offset="-2.636744400e+00*mm" thickness="0.05*mm" material="Silicon" number="17"/> + </layer> + </detector> + </detectors> - <readouts> - <readout name="VXDCollection"> - <id>system:5,layer:10,module:10,sensor:3,side:2</id> - </readout> - </readouts> - <fields> - <field type="solenoid" name="GlobalSolenoid" inner_field="3.5*tesla" - outer_field="-1.5*tesla" zmax="SolenoidCoilOuterZ" - inner_radius="SolenoidalFieldRadius" - outer_radius="world_side" /> - </fields> + <readouts> + <readout name="VXDCollection"> + <id>system:5,layer:10,module:10,sensor:3,side:2</id> + </readout> + </readouts> + <fields> + <field type="solenoid" name="GlobalSolenoid" inner_field="3.5*tesla" + outer_field="-1.5*tesla" zmax="SolenoidCoilOuterZ" + inner_radius="SolenoidalFieldRadius" + outer_radius="world_side" /> + </fields> </lccdd> diff --git a/examples/ClientTests/compact/Geant4Assemblies.py b/examples/ClientTests/compact/Geant4Assemblies.py index 7cb31c6b3..a17c45182 100644 --- a/examples/ClientTests/compact/Geant4Assemblies.py +++ b/examples/ClientTests/compact/Geant4Assemblies.py @@ -34,25 +34,6 @@ def run(): ui.HaveUI = True ui.SessionType = 'csh' kernel.registerGlobalAction(ui) - - - # Configure Run actions - run1 = DDG4.RunAction(kernel,'Geant4TestRunAction/RunInit') - run1.Property_int = 12345 - run1.Property_double = -5e15*keV - run1.Property_string = 'Startrun: Hello_2' - print run1.Property_string, run1.Property_double, run1.Property_int - run1.enableUI() - kernel.registerGlobalAction(run1) - kernel.runAction().add(run1) - - evt1 = DDG4.EventAction(kernel,'Geant4TestEventAction/UserEvent_1') - evt1.Property_int=01234 - evt1.Property_double=1e11 - evt1.Property_string='Hello_1' - evt1.enableUI() - - kernel.eventAction().add(evt1) # Configure I/O evt_root = DDG4.EventAction(kernel,'Geant4Output2ROOT/RootOutput') @@ -70,39 +51,18 @@ def run(): gun.enableUI() kernel.generatorAction().add(gun) - # Setup global filters fur use in sensntive detectors - f1 = DDG4.Filter(kernel,'GeantinoRejectFilter/GeantinoRejector') - f4 = DDG4.Filter(kernel,'EnergyDepositMinimumCut') - f4.Cut = 0.1*MeV - f4.enableUI() - kernel.registerGlobalFilter(f1) - kernel.registerGlobalFilter(f4) - # First the tracking detectors seq = DDG4.SensitiveSequence(kernel,'Geant4SensDetActionSequence/VXD') act = DDG4.SensitiveAction(kernel,'Geant4SimpleTrackerAction/VXDHandler','VXD') - seq.add(act) - seq.add(f1) - seq.add(f4) - act.add(f1) # Now build the physics list: phys = kernel.physicsList() - phys.extends = 'FTFP_BERT' - #phys.transportation = True - phys.decays = True + phys.extends = 'QGSP_BERT' phys.enableUI() - ph = DDG4.PhysicsList(kernel,'Geant4PhysicsList/Myphysics') - ph.addParticleConstructor('G4BosonConstructor') - ph.addParticleConstructor('G4LeptonConstructor') - ph.addParticleProcess('e[+-]','G4eMultipleScattering',-1,1,1) - ph.addPhysicsConstructor('G4OpticalPhysics') - ph.enableUI() - phys.add(ph) - phys.dump() + DDG4.setPrintLevel(DDG4.OutputLevel.DEBUG) kernel.configure() kernel.initialize() kernel.run() diff --git a/examples/ClientTests/src/Assemblies_VXD_geo.cpp b/examples/ClientTests/src/Assemblies_VXD_geo.cpp index ec7803774..bd0c58751 100644 --- a/examples/ClientTests/src/Assemblies_VXD_geo.cpp +++ b/examples/ClientTests/src/Assemblies_VXD_geo.cpp @@ -19,6 +19,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { DetElement vxd(name, x_det.typeStr(), x_det.id()); PlacedVolume pv; + assembly.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); for(xml_coll_t c(e,_U(layer)); c; ++c) { xml_comp_t x_layer (c); xml_comp_t x_support (x_layer.child(_U(support))); @@ -58,15 +59,15 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { sens.setType("tracker"); - layer_assembly.setVisAttributes(lcdd.invisible()); + layer_assembly.setAttributes(lcdd,x_layer.regionStr(),x_layer.limitsStr(),"invisible"); pv = assembly.placeVolume(layer_assembly).addPhysVolID("layer",layer_id); layerDE.setPlacement( pv ) ; - laddervol.setVisAttributes(lcdd.invisible()); - suppvol.setVisAttributes(x_support.visStr()); + laddervol.setAttributes(lcdd,x_ladder.regionStr(),x_ladder.limitsStr(),"invisible"); + suppvol.setAttributes(lcdd,x_support.regionStr(),x_support.limitsStr(),x_support.visStr()); sensvol.setSensitiveDetector(sens); - sensvol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_layer.visStr()); + sensvol.setAttributes(lcdd,x_ladder.regionStr(),x_ladder.limitsStr(),x_layer.visStr()); laddervol.placeVolume(sensvol,senspos); laddervol.placeVolume(suppvol,supppos); -- GitLab