diff --git a/DDG4/include/DDG4/Geant4Config.h b/DDG4/include/DDG4/Geant4Config.h index c315cae1f373b64032a8c6355a5041896bb63dab..5d3d84cc0e5648aa4a4c450f193a12c0282a5c6a 100644 --- a/DDG4/include/DDG4/Geant4Config.h +++ b/DDG4/include/DDG4/Geant4Config.h @@ -85,28 +85,35 @@ namespace dd4hep { typedef Geant4Handle<Geant4PhysicsListActionSequence> PhysicsActionSeq; typedef Geant4Handle<Geant4UserInitializationSequence> InitializationSeq; typedef Geant4Handle<Geant4DetectorConstructionSequence> DetectorConstructionSeq; + inline bool is_aclick() { +#if defined(G__DICTIONARY) || defined(__CLING__) || defined(__CINT__) || defined(__MAKECINT__) + return true; +#else + return false; +#endif + } } } // End namespace sim } // End namespace dd4hep -#include "DDG4/Geant4Particle.h" -#include "DDG4/Geant4Handle.h" -#include "DDG4/Geant4Kernel.h" -#include "DDG4/Geant4PhysicsList.h" -#include "DDG4/Geant4GeneratorAction.h" -#include "DDG4/Geant4RunAction.h" -#include "DDG4/Geant4EventAction.h" -#include "DDG4/Geant4TrackingAction.h" -#include "DDG4/Geant4SteppingAction.h" -#include "DDG4/Geant4StackingAction.h" -#include "DDG4/Geant4DetectorConstruction.h" -#include "DDG4/Geant4ActionPhase.h" -#include "DDG4/Geant4SensDetAction.h" -#include "DDG4/Geant4ParticleHandler.h" -#include "DDG4/Geant4UserInitialization.h" -#include "DDG4/Geant4UserParticleHandler.h" -#include "DDG4/ComponentUtils.h" -#include "DD4hep/Detector.h" +#include <DDG4/Geant4Particle.h> +#include <DDG4/Geant4Handle.h> +#include <DDG4/Geant4Kernel.h> +#include <DDG4/Geant4PhysicsList.h> +#include <DDG4/Geant4GeneratorAction.h> +#include <DDG4/Geant4RunAction.h> +#include <DDG4/Geant4EventAction.h> +#include <DDG4/Geant4TrackingAction.h> +#include <DDG4/Geant4SteppingAction.h> +#include <DDG4/Geant4StackingAction.h> +#include <DDG4/Geant4DetectorConstruction.h> +#include <DDG4/Geant4ActionPhase.h> +#include <DDG4/Geant4SensDetAction.h> +#include <DDG4/Geant4ParticleHandler.h> +#include <DDG4/Geant4UserInitialization.h> +#include <DDG4/Geant4UserParticleHandler.h> +#include <DDG4/ComponentUtils.h> +#include <DD4hep/Detector.h> #endif // DDG4_GEANT4CONFIG_H diff --git a/examples/CLICSiD/scripts/CLICSiDAClick.C b/examples/CLICSiD/scripts/CLICSiDAClick.C index 1bc18b25931546bb2a1a0efc879360715066f748..740e230b0f4f8236a9c7d08f6211078e97bfbb40 100644 --- a/examples/CLICSiD/scripts/CLICSiDAClick.C +++ b/examples/CLICSiD/scripts/CLICSiDAClick.C @@ -25,11 +25,12 @@ // //========================================================================== -#include "DDG4/Geant4Config.h" -#include "DDG4/Geant4TestActions.h" -#include "CLHEP/Units/SystemOfUnits.h" -#include "TSystem.h" +#include <DDG4/Geant4Config.h> +#include <DDG4/Geant4TestActions.h> +#include <CLHEP/Units/SystemOfUnits.h> +#include <TSystem.h> #include <iostream> +#include <ctime> using namespace std; using namespace dd4hep; @@ -67,9 +68,13 @@ int setupG4_CINT(bool interactive) { kernel.registerGlobalAction(ui); } else { - kernel.property("NumEvents") = 3; + kernel.property("NumEvents") = 4; } + Action rndm(kernel, "Geant4Random/Random"); + rndm["Seed"] = ::time(0); + kernel.registerGlobalAction(rndm); + GenAction gun(kernel,"Geant4ParticleGun/Gun"); gun["energy"] = 10*CLHEP::GeV; gun["particle"] = "e-"; @@ -96,10 +101,15 @@ int setupG4_CINT(bool interactive) { p = kernel.addPhase<const G4Run*>("EndRun"); p->add(evt_1.get(),&Geant4TestEventAction::endRun); kernel.runAction().callAtEnd(p.get(),&Geant4ActionPhase::call<const G4Run*>); + p = nullptr; EventAction evt_2(kernel,"Geant4TestEventAction/UserEvent_2"); kernel.eventAction().adopt(evt_2); + EventAction out(kernel,"Geant4Output2ROOT/RootOutput"); + out["Output"] = is_aclick() ? "CLICSiD.aclick.root" : "CLICSiD.exe.root"; + kernel.eventAction().adopt(out); + setupDetector(kernel,"SiVertexBarrel"); setupDetector(kernel,"SiVertexEndcap"); setupDetector(kernel,"SiTrackerBarrel"); @@ -124,11 +134,13 @@ int setupG4_CINT(bool interactive) { return 0; } -#if defined(G__DICTIONARY) || defined(__CLING__) || defined(__CINT__) || defined(__MAKECINT__) // CINT script -int CLICSiDAClick() -#else -int main(int, char**) // Main program if linked standalone -#endif -{ +int CLICSiDAClick() { return setupG4_CINT(false); } + +#if not(defined(G__DICTIONARY) || defined(__CLING__) || defined(__CINT__) || defined(__MAKECINT__)) +int main(int, char**) { // Main program if linked standalone + std::cout << "Running CLICSiDAClick as standalone executable...." << std::endl; + return CLICSiDAClick(); +} +#endif diff --git a/examples/CLICSiD/scripts/CLICSiDXML.C b/examples/CLICSiD/scripts/CLICSiDXML.C index 6952e2c27680fe3e346c9891a9cae399255ccc7a..696ec5881a7fa3b2992b83b8b69ba679e6dcc2f7 100644 --- a/examples/CLICSiD/scripts/CLICSiDXML.C +++ b/examples/CLICSiD/scripts/CLICSiDXML.C @@ -25,8 +25,9 @@ // Author : M.Frank // //=====================================================------=============== -#include "DDG4/Geant4Config.h" +#include <DDG4/Geant4Config.h> #include <iostream> +#include <ctime> using namespace std; using namespace dd4hep::sim::Setup; @@ -44,8 +45,16 @@ int setupG4_XML(bool interactive) { kernel.property("UI") = "UI"; } else { - kernel.property("NumEvents") = 3; + kernel.property("NumEvents") = 4; } + Action rndm(kernel, "Geant4Random/Random"); + rndm["Seed"] = ::time(0); + kernel.registerGlobalAction(rndm); + + EventAction out(kernel,"Geant4Output2ROOT/RootOutput"); + out["Output"] = is_aclick() ? "CLICSiD.xml_aclick.root" : "CLICSiD.xml_exe.root"; + kernel.eventAction().adopt(out); + kernel.configure(); kernel.initialize(); kernel.run(); @@ -55,11 +64,16 @@ int setupG4_XML(bool interactive) { return 0; } -#if defined(G__DICTIONARY) || defined(__CLING__) || defined(__CINT__) || defined(__MAKECINT__) // CINT script -int CLICSiDXML() -#else +int CLICSiDXML() { + return setupG4_XML(false); +} + +#if not(defined(G__DICTIONARY) || defined(__CLING__) || defined(__CINT__) || defined(__MAKECINT__)) int main(int, char**) // Main program if linked standalone -#endif { - return setupG4_XML(false); + std::cout << "Running CLICSiDXML as standalone executable...." << std::endl; + return CLICSiDXML(); } +#endif + + diff --git a/examples/CLICSiD/sim/sequences.xml b/examples/CLICSiD/sim/sequences.xml index b43871b461b54e32b33b79748b4f2b1e7f22a3e9..389ad2a3efe08eafd68dc606c71eeb49aa612a97 100644 --- a/examples/CLICSiD/sim/sequences.xml +++ b/examples/CLICSiD/sim/sequences.xml @@ -127,9 +127,13 @@ <properties Control="true" Output="simple_lcio"/> </action> --> +<!-- We need some simulation files to deal with DDDigi. + Hence this part is in the AClick.... + <action name="Geant4Output2ROOT/RootOutput"> - <properties Control="true" Output="simple.root"/> + <properties Control="true" Output="CLICSiD.xml.root"/> </action> +--> </sequence> <sequence name="Geant4GeneratorActionSequence/GeneratorAction"> <action name="Geant4ParticleGun/Gun">