diff --git a/DDDigi/README.md b/DDDigi/README.md index 5e56337032d88ec2b8cc66873fa5742e61956878..140ed76e5485fd4fef960170ffc2a6fd6c709440 100644 --- a/DDDigi/README.md +++ b/DDDigi/README.md @@ -63,8 +63,8 @@ DigiDDG4ROOT - Reader for ROOT files produced with DDG4. <br/> Properties: <br/> - |**Property**|**Data type**|**Description**| - |:--- |:--- |:--- | + |**Property** |**Data type** |**Description** | + |:--- |:--- |:--- | |`.input` | vector<string> | List of input files to be processed | |`.tree` | string | Name of the main data tree. default: `EVENT` | |`.containers` | vector<string> | List of containers to be loaded to DDDigi. | @@ -155,10 +155,8 @@ DigiAttenuatorSequence |`.signal_decay` | string | Decay function. default: `exponential` | |`.t0` | double | Time constant for exponential signal decay. | - DigiDepositSmearPositionTrack ----------------------------- - - Smear energy deposit positions by an ellipse of the track passing in the x-y plane. diff --git a/DDDigi/io/DigiEdm4hepInput.cpp b/DDDigi/io/DigiEdm4hepInput.cpp index 4e39c45c3e1aa7863fcaab3694c3c6194935339b..977fc3acf3871d3556b8412a730c10f9513a58cd 100644 --- a/DDDigi/io/DigiEdm4hepInput.cpp +++ b/DDDigi/io/DigiEdm4hepInput.cpp @@ -32,7 +32,7 @@ namespace dd4hep { using namespace std::placeholders; - class DigiEdm4hepROOT : public DigiROOTInput { + class DigiEdm4hepInput : public DigiROOTInput { public: static constexpr double epsilon = std::numeric_limits<double>::epsilon(); @@ -58,7 +58,7 @@ namespace dd4hep { public: /// Initializing constructor - DigiEdm4hepROOT(const DigiKernel& krnl, const std::string& nam) + DigiEdm4hepInput(const DigiKernel& krnl, const std::string& nam) : DigiROOTInput(krnl, nam) { declareProperty("keep_raw", m_keep_raw); @@ -123,4 +123,4 @@ namespace dd4hep { }; } // End namespace digi } // End namespace dd4hep -DECLARE_DIGIACTION_NS(dd4hep::digi,DigiEdm4hepROOT) +DECLARE_DIGIACTION_NS(dd4hep::digi,DigiEdm4hepInput) diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt index 49f544d495e19ad401a9cd450a6a36c66e05f27e..77c521b3efc82a1394a693f4636285c370f8eb27 100644 --- a/examples/ClientTests/CMakeLists.txt +++ b/examples/ClientTests/CMakeLists.txt @@ -485,4 +485,16 @@ if (DD4HEP_USE_GEANT4) REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" ) endforeach(script) # + # + # Test EDM4HEP output module + if (DD4HEP_USE_EDM4HEP) + # Test EDM4HEP write (needs to be expanded) + dd4hep_add_test_reg(ClientTests_sim_MinitTel_edm4hep_write + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh" + EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTelEdm4hepWrite.py + -batch -events 5 + REGEX_PASS "\\+\\+\\+ Finished run 0 after 5 events \\(5 events in total\\)" + REGEX_FAIL "Error;ERROR;Exception" + ) + endif() endif(DD4HEP_USE_GEANT4) diff --git a/examples/ClientTests/scripts/MiniTelEdm4hepWrite.py b/examples/ClientTests/scripts/MiniTelEdm4hepWrite.py new file mode 100644 index 0000000000000000000000000000000000000000..80329c684b55449e1f7539026bfd54af814a2137 --- /dev/null +++ b/examples/ClientTests/scripts/MiniTelEdm4hepWrite.py @@ -0,0 +1,63 @@ +# ========================================================================== +# 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. +# +# ========================================================================== +from __future__ import absolute_import, unicode_literals +import DDG4 +# +""" + + dd4hep example setup using the python configuration + + \author M.Frank + \version 1.0 + +""" + + +def run(): + from g4units import GeV + from MiniTelSetup import Setup + args = DDG4.CommandLine() + m = Setup(geometry='/examples/ClientTests/compact/MiniTelGenerate.xml') + kernel = m.kernel + if args.batch: + run = '/run/beamOn ' + str(args.events) + DDG4.setPrintLevel(DDG4.OutputLevel.WARNING) + m.ui.Commands = [run, '/ddg4/UI/terminate'] + m.configure() + wr = m.geant4.setupEDM4hepOutput('edm4hep', 'MiniTel_ddg4_edm4hep.root') + gen = DDG4.GeneratorAction(kernel, 'Geant4GeneratorActionInit/GenerationInit') + kernel.generatorAction().adopt(gen) + + gun = DDG4.GeneratorAction(kernel, 'Geant4IsotropeGenerator/IsotropPi+1') + gun.Mask = 1 << 0 + gun.Particle = 'pi+' + gun.Energy = 100 * GeV + gun.Multiplicity = 1 + gun.Distribution = 'cos(theta)' + kernel.generatorAction().adopt(gun) + gun = None + + gen = DDG4.GeneratorAction(kernel, 'Geant4InteractionMerger/InteractionMerger') + gen.enableUI() + kernel.generatorAction().adopt(gen) + + gen = DDG4.GeneratorAction(kernel, 'Geant4PrimaryHandler/PrimaryHandler') + gen.enableUI() + kernel.generatorAction().adopt(gen) + gen = None + + m.setupGenerator() + m.setupPhysics() + m.run() + + +if __name__ == '__main__': + run() diff --git a/examples/ClientTests/scripts/MiniTel_hepmc.py b/examples/ClientTests/scripts/MiniTel_hepmc.py index 708f7a3b13b9da79772e497dcfe4c48ee6acb741..26787af63a789ef9a1d7f8afe906a4503284a345 100644 --- a/examples/ClientTests/scripts/MiniTel_hepmc.py +++ b/examples/ClientTests/scripts/MiniTel_hepmc.py @@ -33,12 +33,12 @@ def run(): m.configure() m.defineOutput() fname = os.environ['DD4hepExamplesINSTALL'] + '/examples/DDG4/data/Muons10GeV.HEPEvt' - m.setupInput("Geant4EventReaderHepEvtShort|" + fname) + m.setupInput('Geant4EventReaderHepEvtShort|' + fname) m.setupGenerator() m.setupPhysics(model='FTFP_BERT') m.phys.decays = True m.run(num_events=1) -if __name__ == "__main__": +if __name__ == '__main__': run() diff --git a/examples/DDDigi/CMakeLists.txt b/examples/DDDigi/CMakeLists.txt index 392d557afb2b31928105581c961875114bf8f8fc..6aeda661ae42e87e2daa31dbe6a3b8013350d149 100644 --- a/examples/DDDigi/CMakeLists.txt +++ b/examples/DDDigi/CMakeLists.txt @@ -216,8 +216,9 @@ if (DD4HEP_USE_GEANT4) REGEX_FAIL "Error;ERROR;Exception" ) # + # Test EDM4HEP output module if (DD4HEP_USE_EDM4HEP) - # Test edm4hep write (needs to be expanded) + # Test EDM4HEP write (needs to be expanded) dd4hep_add_test_reg(DDDigi_test_edm4hep_write COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh" EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestWriteEdm4hep.py diff --git a/examples/DDDigi/scripts/DigiTest.py b/examples/DDDigi/scripts/DigiTest.py index ed359782c6c47a035b130fe74fbf6ae8c6f8043c..5ca235d4fb59a7b02c941a8150e3e9f43dd44658 100644 --- a/examples/DDDigi/scripts/DigiTest.py +++ b/examples/DDDigi/scripts/DigiTest.py @@ -59,7 +59,7 @@ class Test(dddigi.Digitize): return obj def load_geo(self, volume_manager=None): - fname = "file:" + os.environ['DD4hepExamplesINSTALL'] + "/examples/ClientTests/compact/MiniTelGenerate.xml" + fname = 'file:' + os.environ['DD4hepExamplesINSTALL'] + '/examples/ClientTests/compact/MiniTelGenerate.xml' self.kernel().loadGeometry(str(fname)) self.printDetectors() if volume_manager: @@ -110,7 +110,7 @@ class Test(dddigi.Digitize): return next_source def run_checked(self, num_events=5, num_threads=5, parallel=3): - result = "FAILED" + result = 'FAILED' if self.num_events: num_events = int(self.num_events) if self.num_threads: @@ -119,7 +119,7 @@ class Test(dddigi.Digitize): parallel = int(self.events_parallel) evt_done = self.run(num_events=num_events, num_threads=num_threads, parallel=parallel) if evt_done == num_events: - result = "PASSED" + result = 'PASSED' self.always('%s Test finished after processing %d events. [%d parallel threads, %d parallel events]' % (result, evt_done, num_threads, parallel, )) self.always('Test done. Exiting') diff --git a/examples/DDDigi/scripts/TestEdm4hepInput.py b/examples/DDDigi/scripts/TestEdm4hepInput.py new file mode 100644 index 0000000000000000000000000000000000000000..1e775a5eff2dc12c6d1833c109a19e3394075111 --- /dev/null +++ b/examples/DDDigi/scripts/TestEdm4hepInput.py @@ -0,0 +1,24 @@ +# ========================================================================== +# 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. +# +# ========================================================================== +from __future__ import absolute_import + + +def run(): + import DigiTest + digi = DigiTest.Test(geometry=None) + read = digi.input_action('DigiEdm4hepInput/SignalReader', mask=0x0, input=['../ClientTests/MiniTel_ddg4_edm4hep.root']) + dump = digi.event_action('DigiStoreDump/StoreDump', parallel=False) + digi.check_creation([read, dump]) + digi.run_checked(num_events=5, num_threads=5, parallel=3) + + +if __name__ == '__main__': + run() diff --git a/examples/DDG4/CMakeLists.txt b/examples/DDG4/CMakeLists.txt index 8ca826955779edcc01d7bd5b16835b030202295b..ca4290a5cea60b9bea1239a10c2fbea9b555b98f 100644 --- a/examples/DDG4/CMakeLists.txt +++ b/examples/DDG4/CMakeLists.txt @@ -103,4 +103,5 @@ if (DD4HEP_USE_GEANT4) REGEX_PASS " Parameter value at call 13 is 'terminate-command-2'" REGEX_FAIL " ERROR ;EXCEPTION;Exception" ) + # endif()