diff --git a/DDG4/include/DDG4/Geant4GeneratorAction.h b/DDG4/include/DDG4/Geant4GeneratorAction.h index f1f5749dc7b64ff4cdf3e28b3bfbadd75a79d025..1da6ea2687b2d3d6e8a6886c76fefb30806d22da 100644 --- a/DDG4/include/DDG4/Geant4GeneratorAction.h +++ b/DDG4/include/DDG4/Geant4GeneratorAction.h @@ -51,8 +51,8 @@ namespace DD4hep { protected: Callback m_calls; public: - /// Inhibit default constructor - Geant4GeneratorAction() = delete; + /// Default constructor + Geant4GeneratorAction() = default; /// Standard constructor Geant4GeneratorAction(Geant4Context* context, const std::string& name); /// Default destructor @@ -78,10 +78,10 @@ namespace DD4hep { class Geant4SharedGeneratorAction : public Geant4GeneratorAction { protected: /// Reference to the shared action - Geant4GeneratorAction* m_action; + Geant4GeneratorAction* m_action = 0; public: - /// Inhibit default constructor - Geant4SharedGeneratorAction() = delete; + /// Default constructor + Geant4SharedGeneratorAction() = default; /// Standard constructor Geant4SharedGeneratorAction(Geant4Context* context, const std::string& nam); /// Default destructor @@ -118,8 +118,8 @@ namespace DD4hep { /// The list of action objects to be called Actors<Geant4GeneratorAction> m_actors; public: - /// Inhibit default constructor - Geant4GeneratorActionSequence() = delete; + /// Default constructor + Geant4GeneratorActionSequence() = default; /// Standard constructor Geant4GeneratorActionSequence(Geant4Context* context, const std::string& name); /// Default destructor diff --git a/DDG4/include/DDG4/Geant4SteppingAction.h b/DDG4/include/DDG4/Geant4SteppingAction.h index d4e7ecf1d9ae97f12ddc4a4ab9ab30f8e00dd920..1da17bd593d4a6fa6742ad97fdb5b3c3967a4f0a 100644 --- a/DDG4/include/DDG4/Geant4SteppingAction.h +++ b/DDG4/include/DDG4/Geant4SteppingAction.h @@ -41,8 +41,10 @@ namespace DD4hep { public: typedef Geant4SharedSteppingAction shared_type; public: + /// Default constructor + Geant4SteppingAction() = default; /// Inhibit copy constructor - Geant4SteppingAction(const Geant4SteppingAction& copy) = delete; + Geant4SteppingAction(const Geant4SteppingAction& copy) = default; /// Standard constructor Geant4SteppingAction(Geant4Context* context, const std::string& name); /// Default destructor @@ -67,8 +69,10 @@ namespace DD4hep { class Geant4SharedSteppingAction : public Geant4SteppingAction { protected: /// Reference to the shared action - Geant4SteppingAction* m_action; + Geant4SteppingAction* m_action = 0; public: + /// Default constructor + Geant4SharedSteppingAction() = default; /// Inhibit copy constructor Geant4SharedSteppingAction(const Geant4SteppingAction& copy) = delete; /// Standard constructor diff --git a/DDG4/include/DDG4/Geant4TrackingAction.h b/DDG4/include/DDG4/Geant4TrackingAction.h index e6f2da7ef55e78a2ad1f11dab54d08d161f5f72d..26fba8875e2e64d1b1cd9fc13e26c75ac253b3ef 100644 --- a/DDG4/include/DDG4/Geant4TrackingAction.h +++ b/DDG4/include/DDG4/Geant4TrackingAction.h @@ -43,8 +43,8 @@ namespace DD4hep { public: typedef Geant4SharedTrackingAction shared_type; public: - /// Inhibit default constructor - Geant4TrackingAction() = delete; + /// Default constructor + Geant4TrackingAction() = default; /// Inhibit copy constructor Geant4TrackingAction(const Geant4TrackingAction& copy) = delete; /// Standard constructor @@ -79,10 +79,11 @@ namespace DD4hep { class Geant4SharedTrackingAction : public Geant4TrackingAction { protected: /// Reference to the shared action - Geant4TrackingAction* m_action; + Geant4TrackingAction* m_action = 0; + public: - /// Inhibit default constructor - Geant4SharedTrackingAction() = delete; + /// Default constructor + Geant4SharedTrackingAction() = default; /// Inhibit copy constructor Geant4SharedTrackingAction(const Geant4TrackingAction& copy) = delete; /// Standard constructor @@ -127,8 +128,8 @@ namespace DD4hep { /// The list of action objects to be called Actors<Geant4TrackingAction> m_actors; public: - /// Inhibit default constructor - Geant4TrackingActionSequence() = delete; + /// Default constructor + Geant4TrackingActionSequence() = default; /// Inhibit copy constructor Geant4TrackingActionSequence(const Geant4TrackingActionSequence& copy) = delete; /// Standard constructor diff --git a/DDG4/src/Geant4ParticlePrint.cpp b/DDG4/src/Geant4ParticlePrint.cpp index 73a5d6ece191e7c3d94fb7bc39b4a4c690b37aa2..04e7d71161af431d100db9eca3bd331898b8d6ac 100644 --- a/DDG4/src/Geant4ParticlePrint.cpp +++ b/DDG4/src/Geant4ParticlePrint.cpp @@ -149,7 +149,7 @@ void Geant4ParticlePrint::printParticle(const std::string& prefix, const G4Event } else { print("+++ Hit unknown hit collection type: %s --> %s", - c->GetName(),typeName(typeid(*c)).c_str()); + c->GetName().c_str(),typeName(typeid(*c)).c_str()); } } } diff --git a/UtilityApps/src/dumpdetector.cpp b/UtilityApps/src/dumpdetector.cpp index de5e1785b686698218ddcf138f175d3fdfc76347..4ed85de761d52ad72065cf5be44af21eac49bbcf 100644 --- a/UtilityApps/src/dumpdetector.cpp +++ b/UtilityApps/src/dumpdetector.cpp @@ -76,7 +76,7 @@ void printDetectorSets( std::string name, unsigned int includeFlag, unsigned in //============================================================================= -int main(int argc, char** argv ){ +int run_main(int argc, char** argv ){ if( argc < 2 ) { std::cout << " usage: dumpdetector compact.xml [-s]" @@ -231,7 +231,17 @@ int main(int argc, char** argv ){ } - - +int main(int argc, char** argv ){ + try { + return run_main(argc,argv); + } + catch(const std::exception& e) { + std::cout << "Got uncaught exception: " << e.what() << std::endl; + } + catch (...) { + std::cout << "Got UNKNOWN uncaught exception." << std::endl; + } + return EINVAL; +} //============================================================================= diff --git a/UtilityApps/src/run_plugin.h b/UtilityApps/src/run_plugin.h index 50684eacfbef5758d673009a6b5a44a938f466bc..cfe5ddea8f43a9dafde07481344dedfdf0a493de 100644 --- a/UtilityApps/src/run_plugin.h +++ b/UtilityApps/src/run_plugin.h @@ -247,7 +247,7 @@ namespace { } //______________________________________________________________________________ - int main_default(const char* name, int argc,char** argv) { + int main_wrapper(const char* name, int argc, char** argv) { Args args; for(int i=1; i<argc;++i) { if ( argv[i][0]=='-' ) { @@ -290,4 +290,18 @@ namespace { if ( args.destroy ) delete &lcdd; return 0; } + + //______________________________________________________________________________ + int main_default(const char* name, int argc, char** argv) { + try { + return main_wrapper(name,argc,argv); + } + catch(const std::exception& e) { + std::cout << "Got uncaught exception: " << e.what() << std::endl; + } + catch (...) { + std::cout << "Got UNKNOWN uncaught exception." << std::endl; + } + return EINVAL; + } }