From a7744defe4c0f9fd49c42e5f7c570a1267059866 Mon Sep 17 00:00:00 2001 From: Markus Frank Date: Thu, 16 May 2024 12:43:45 +0200 Subject: [PATCH] Move some object initalization to class definition --- DDG4/include/DDG4/Geant4Action.h | 26 ++++++++--------- DDG4/include/DDG4/Geant4ActionContainer.h | 28 +++++++++---------- DDG4/include/DDG4/Geant4ActionPhase.h | 8 +++--- DDG4/include/DDG4/Geant4AssemblyVolume.h | 4 +-- DDG4/include/DDG4/Geant4Context.h | 6 ++-- DDG4/include/DDG4/Geant4Converter.h | 4 +-- DDG4/include/DDG4/Geant4Data.h | 20 ++++++------- .../include/DDG4/Geant4DetectorConstruction.h | 10 +++---- DDG4/include/DDG4/Geant4EventAction.h | 4 +-- DDG4/include/DDG4/Geant4FastSimHandler.h | 2 +- DDG4/include/DDG4/Geant4FastSimSpot.h | 4 +-- DDG4/include/DDG4/Geant4Field.h | 6 ++-- DDG4/include/DDG4/Geant4GDMLDetector.h | 2 +- DDG4/include/DDG4/Geant4GeneratorAction.h | 2 +- DDG4/include/DDG4/Geant4GeneratorActionInit.h | 8 +++--- DDG4/include/DDG4/Geant4GeneratorWrapper.h | 6 ++-- DDG4/include/DDG4/Geant4Handle.h | 4 +-- DDG4/include/DDG4/Geant4InputAction.h | 14 +++++----- DDG4/include/DDG4/Geant4InputHandling.h | 2 +- DDG4/include/DDG4/Geant4Kernel.h | 18 ++++++------ DDG4/include/DDG4/Geant4OutputAction.h | 8 +++--- DDG4/include/DDG4/Geant4PhysicsList.h | 6 ++-- DDG4/src/Geant4Action.cpp | 3 +- DDG4/src/Geant4ActionContainer.cpp | 6 +--- DDG4/src/Geant4AssemblyVolume.cpp | 8 +++--- DDG4/src/Geant4Converter.cpp | 3 +- DDG4/src/Geant4Data.cpp | 16 ++++------- DDG4/src/Geant4GDMLDetector.cpp | 2 +- DDG4/src/Geant4GeneratorActionInit.cpp | 16 +++++------ DDG4/src/Geant4GeneratorWrapper.cpp | 2 +- DDG4/src/Geant4InputAction.cpp | 3 +- DDG4/src/Geant4Kernel.cpp | 12 ++++---- DDG4/src/Geant4OutputAction.cpp | 2 +- DDG4/src/Geant4PhysicsList.cpp | 3 +- 34 files changed, 127 insertions(+), 141 deletions(-) diff --git a/DDG4/include/DDG4/Geant4Action.h b/DDG4/include/DDG4/Geant4Action.h index 7e8f74f49..4bdecdd1c 100644 --- a/DDG4/include/DDG4/Geant4Action.h +++ b/DDG4/include/DDG4/Geant4Action.h @@ -15,10 +15,10 @@ #define DDG4_GEANT4ACTION_H // Framework include files -#include "DD4hep/Printout.h" -#include "DD4hep/ComponentProperties.h" -#include "DDG4/Geant4Context.h" -#include "DDG4/Geant4Callback.h" +#include +#include +#include +#include // Geant4 forward declarations class G4Run; @@ -113,20 +113,20 @@ namespace dd4hep { class Geant4Action { protected: /// Reference to the Geant4 context - Geant4Context* m_context {nullptr}; + Geant4Context* m_context { nullptr }; /// Control directory of this action - Geant4UIMessenger* m_control {nullptr}; + Geant4UIMessenger* m_control { nullptr }; /// Default property: Output level - int m_outputLevel {3}; + int m_outputLevel { 3 }; /// Default property: Flag to create control instance - bool m_needsControl {false}; + bool m_needsControl { false }; /// Action name - std::string m_name; + std::string m_name { }; /// Property pool - PropertyManager m_properties; + PropertyManager m_properties { }; /// Reference count. Initial value: 1 - long m_refCount {1}; + long m_refCount { 1 }; public: /// Functor to update the context of a Geant4Action object @@ -137,8 +137,8 @@ namespace dd4hep { */ class ContextSwap { /// reference to the context; - Geant4Context* context {nullptr}; - Geant4Action* action {nullptr}; + Geant4Context* context { nullptr }; + Geant4Action* action { nullptr }; public: /// Constructor ContextSwap(Geant4Action* a,Geant4Context* c) : action(a) { diff --git a/DDG4/include/DDG4/Geant4ActionContainer.h b/DDG4/include/DDG4/Geant4ActionContainer.h index 8a694dd65..90178fdc3 100644 --- a/DDG4/include/DDG4/Geant4ActionContainer.h +++ b/DDG4/include/DDG4/Geant4ActionContainer.h @@ -14,9 +14,9 @@ #define DDG4_GEANT4ACTIONCONTAINER_H // Framework include files -#include "DD4hep/Printout.h" -#include "DDG4/Geant4Primitives.h" -#include "DDG4/Geant4Action.h" +#include +#include +#include // C/C++ include files #include @@ -61,29 +61,29 @@ namespace dd4hep { protected: /// Geant4 worker context (thread specific) - Geant4Context* m_context; + Geant4Context* m_context { nullptr }; /// Reference to the Geant4 primary generator action - Geant4GeneratorActionSequence* m_generatorAction; + Geant4GeneratorActionSequence* m_generatorAction { nullptr }; /// Reference to the Geant4 run action - Geant4RunActionSequence* m_runAction; + Geant4RunActionSequence* m_runAction { nullptr }; /// Reference to the Geant4 event action - Geant4EventActionSequence* m_eventAction; + Geant4EventActionSequence* m_eventAction { nullptr }; /// Reference to the Geant4 track action - Geant4TrackingActionSequence* m_trackingAction; + Geant4TrackingActionSequence* m_trackingAction { nullptr }; /// Reference to the Geant4 step action - Geant4SteppingActionSequence* m_steppingAction; + Geant4SteppingActionSequence* m_steppingAction { nullptr }; /// Reference to the Geant4 stacking action - Geant4StackingActionSequence* m_stackingAction; + Geant4StackingActionSequence* m_stackingAction { nullptr }; /// Reference to the Geant4 detector construction sequence - Geant4DetectorConstructionSequence* m_constructionAction; + Geant4DetectorConstructionSequence* m_constructionAction { nullptr }; /// Reference to the Geant4 sensitive action sequences - Geant4SensDetSequences* m_sensDetActions; + Geant4SensDetSequences* m_sensDetActions { nullptr }; /// Reference to the Geant4 physics list - Geant4PhysicsListActionSequence* m_physicsList; + Geant4PhysicsListActionSequence* m_physicsList { nullptr }; /// Reference to the user initialization object - Geant4UserInitializationSequence* m_userInit; + Geant4UserInitializationSequence* m_userInit { nullptr }; /// Helper to register an action sequence template bool registerSequence(C*& seq, const std::string& name); diff --git a/DDG4/include/DDG4/Geant4ActionPhase.h b/DDG4/include/DDG4/Geant4ActionPhase.h index 548df73f8..9a8f0275b 100644 --- a/DDG4/include/DDG4/Geant4ActionPhase.h +++ b/DDG4/include/DDG4/Geant4ActionPhase.h @@ -14,8 +14,8 @@ #define DDG4_GEANT4ACTIONPHASE_H // Framework include files -#include "DD4hep/Exceptions.h" -#include "DDG4/Geant4Action.h" +#include +#include // C/C++ include files #include @@ -70,9 +70,9 @@ namespace dd4hep { typedef std::vector > Members; protected: /// Phase members (actions) being called for a particular phase - Members m_members; + Members m_members { }; /// Type information of the argument type of the callback - const std::type_info* m_argTypes[3]; + const std::type_info* m_argTypes[3] = { nullptr, nullptr, nullptr }; public: /// Standard constructor diff --git a/DDG4/include/DDG4/Geant4AssemblyVolume.h b/DDG4/include/DDG4/Geant4AssemblyVolume.h index 40141f71c..3865e8a96 100644 --- a/DDG4/include/DDG4/Geant4AssemblyVolume.h +++ b/DDG4/include/DDG4/Geant4AssemblyVolume.h @@ -43,9 +43,9 @@ namespace dd4hep { public: typedef std::vector Chain; - std::vector m_entries; + std::vector m_entries; std::vector m_places; - G4AssemblyVolume* m_assembly; + G4AssemblyVolume* m_assembly { nullptr }; public: /// Default constructor with initialization diff --git a/DDG4/include/DDG4/Geant4Context.h b/DDG4/include/DDG4/Geant4Context.h index 3abf31f4f..b801641b0 100644 --- a/DDG4/include/DDG4/Geant4Context.h +++ b/DDG4/include/DDG4/Geant4Context.h @@ -68,7 +68,7 @@ namespace dd4hep { */ class Geant4Run : public ObjectExtensions { /// Reference to the original Geant4 run object - const G4Run* m_run; + const G4Run* m_run { nullptr }; protected: public: @@ -120,9 +120,9 @@ namespace dd4hep { */ class Geant4Event : public ObjectExtensions { /// Reference to the original Geant4 event object - const G4Event* m_event; + const G4Event* m_event { nullptr }; /// Reference to the main random number generator - Geant4Random* m_random; + Geant4Random* m_random { nullptr }; public: /// Intializing constructor diff --git a/DDG4/include/DDG4/Geant4Converter.h b/DDG4/include/DDG4/Geant4Converter.h index 2abf2721a..c27b698d3 100644 --- a/DDG4/include/DDG4/Geant4Converter.h +++ b/DDG4/include/DDG4/Geant4Converter.h @@ -56,9 +56,9 @@ namespace dd4hep { bool printSensitives = false; /// Property: Check geometrical overlaps for volume placements and G4 imprints - bool checkOverlaps; + bool checkOverlaps = true; /// Property: Output level for debug printing - PrintLevel outputLevel; + PrintLevel outputLevel = INFO; /// Initializing Constructor Geant4Converter(const Detector& description); diff --git a/DDG4/include/DDG4/Geant4Data.h b/DDG4/include/DDG4/Geant4Data.h index 38757cf12..99e54309d 100644 --- a/DDG4/include/DDG4/Geant4Data.h +++ b/DDG4/include/DDG4/Geant4Data.h @@ -50,9 +50,9 @@ namespace dd4hep { class SimpleRun { public: /// Run identifiers - int runID; + int runID { -1 }; /// Number of events in this run - int numEvents; + int numEvents { 0 }; /// Default constructor SimpleRun(); /// Default destructor @@ -71,11 +71,11 @@ namespace dd4hep { public: typedef std::vector Seeds; /// Run identifiers - int runID; + int runID { -1 }; /// Event identifier - int eventID; + int eventID { -1 }; /// Random number generator seeds - Seeds seeds; + Seeds seeds { }; /// Default constructor SimpleEvent(); /// Default destructor @@ -269,9 +269,9 @@ namespace dd4hep { /// Hit direction Direction momentum; /// Length of the track segment contributing to this hit - double length; + double length { 0e0 }; /// Energy deposit in the tracker hit - double energyDeposit; + double energyDeposit { 0e0 }; /// Monte Carlo / Geant4 information Contribution truth; public: @@ -325,11 +325,11 @@ namespace dd4hep { typedef Geant4HitData base_t; /// Hit position - Position position; + Position position { }; /// Hit contributions by individual particles - Contributions truth; + Contributions truth { }; /// Total energy deposit - double energyDeposit; + double energyDeposit { 0e0 }; public: /// Default constructor (for ROOT) Hit(); diff --git a/DDG4/include/DDG4/Geant4DetectorConstruction.h b/DDG4/include/DDG4/Geant4DetectorConstruction.h index 6fe7826a6..f63b7f937 100644 --- a/DDG4/include/DDG4/Geant4DetectorConstruction.h +++ b/DDG4/include/DDG4/Geant4DetectorConstruction.h @@ -15,8 +15,8 @@ #define DDG4_GEANT4DETECTORCONSTRUCTION_H // Framework include files -#include "DD4hep/DetElement.h" -#include "DDG4/Geant4Action.h" +#include +#include // Forward declarations class G4VUserDetectorConstruction; @@ -67,11 +67,11 @@ namespace dd4hep { Detector& description; #endif /// Reference to the world after construction - G4VPhysicalVolume* world; + G4VPhysicalVolume* world { nullptr }; /// The cached geometry information - Geant4GeometryInfo* geometry; + Geant4GeometryInfo* geometry { nullptr }; /// G4 User detector initializer - G4VUserDetectorConstruction* detector; + G4VUserDetectorConstruction* detector { nullptr }; /// Initializing Constructor Geant4DetectorConstructionContext(Detector& l,G4VUserDetectorConstruction* d) : description(l), world(0), geometry(0), detector(d) { } diff --git a/DDG4/include/DDG4/Geant4EventAction.h b/DDG4/include/DDG4/Geant4EventAction.h index 248ed9036..b31b68e55 100644 --- a/DDG4/include/DDG4/Geant4EventAction.h +++ b/DDG4/include/DDG4/Geant4EventAction.h @@ -15,7 +15,7 @@ #define DDG4_GEANT4EVENTACTION_H // Framework include files -#include "DDG4/Geant4Action.h" +#include // Forward declarations class G4Event; @@ -85,7 +85,7 @@ namespace dd4hep { class Geant4SharedEventAction : public Geant4EventAction { protected: /// Reference to the shared action - Geant4EventAction* m_action = 0; + Geant4EventAction* m_action { nullptr }; protected: /// Define standard assignments and constructors diff --git a/DDG4/include/DDG4/Geant4FastSimHandler.h b/DDG4/include/DDG4/Geant4FastSimHandler.h index d140a778c..36529066b 100644 --- a/DDG4/include/DDG4/Geant4FastSimHandler.h +++ b/DDG4/include/DDG4/Geant4FastSimHandler.h @@ -42,7 +42,7 @@ namespace dd4hep { */ class Geant4FastSimHandler : public Geant4HitHandler { public: - const Geant4FastSimSpot* spot; + const Geant4FastSimSpot* spot { nullptr }; /// Inhibit default constructor Geant4FastSimHandler() = delete; diff --git a/DDG4/include/DDG4/Geant4FastSimSpot.h b/DDG4/include/DDG4/Geant4FastSimSpot.h index 5d827f0aa..9d663cecf 100644 --- a/DDG4/include/DDG4/Geant4FastSimSpot.h +++ b/DDG4/include/DDG4/Geant4FastSimSpot.h @@ -17,11 +17,11 @@ #include // Geant4 include files -#include "G4Version.hh" +#include #if G4VERSION_NUMBER < 1070 -#include "G4ThreeVector.hh" +#include class G4FastHit { diff --git a/DDG4/include/DDG4/Geant4Field.h b/DDG4/include/DDG4/Geant4Field.h index 4c94122a3..1a7ab7288 100644 --- a/DDG4/include/DDG4/Geant4Field.h +++ b/DDG4/include/DDG4/Geant4Field.h @@ -15,11 +15,11 @@ #define DDG4_GEANT4FIELD_H // Framework include files -#include "DD4hep/Detector.h" +#include // Geant 4 include files -#include "G4ElectroMagneticField.hh" -#include "G4MagneticField.hh" +#include +#include /// Namespace for the AIDA detector description toolkit namespace dd4hep { diff --git a/DDG4/include/DDG4/Geant4GDMLDetector.h b/DDG4/include/DDG4/Geant4GDMLDetector.h index 0876fad39..b7bb5405d 100644 --- a/DDG4/include/DDG4/Geant4GDMLDetector.h +++ b/DDG4/include/DDG4/Geant4GDMLDetector.h @@ -40,7 +40,7 @@ namespace dd4hep { G4VPhysicalVolume* Construct(); private: std::string m_fileName; - G4VPhysicalVolume* m_world; + G4VPhysicalVolume* m_world { nullptr }; }; } } diff --git a/DDG4/include/DDG4/Geant4GeneratorAction.h b/DDG4/include/DDG4/Geant4GeneratorAction.h index 96b9f230d..a444f5a42 100644 --- a/DDG4/include/DDG4/Geant4GeneratorAction.h +++ b/DDG4/include/DDG4/Geant4GeneratorAction.h @@ -14,7 +14,7 @@ #define DDG4_GEANT4GENERATORACTION_H // Framework include files -#include "DDG4/Geant4Action.h" +#include // Forward declaration class G4Event; diff --git a/DDG4/include/DDG4/Geant4GeneratorActionInit.h b/DDG4/include/DDG4/Geant4GeneratorActionInit.h index dfde1081d..74da2e892 100644 --- a/DDG4/include/DDG4/Geant4GeneratorActionInit.h +++ b/DDG4/include/DDG4/Geant4GeneratorActionInit.h @@ -15,7 +15,7 @@ #define DDG4_GEANT4GENERATORACTIONINIT_H // Framework include files -#include "DDG4/Geant4GeneratorAction.h" +#include // Forward declarations class G4Event; @@ -54,11 +54,11 @@ namespace dd4hep { class Geant4GeneratorActionInit : public Geant4GeneratorAction { protected: /// Current run identifier - int m_run; + int m_run { 0 }; /// Counter for total number of events - int m_evtTotal; + int m_evtTotal { 0 }; /// Counter for total number of events in current run - int m_evtRun; + int m_evtRun { 0 }; public: /// Standard constructor Geant4GeneratorActionInit(Geant4Context* context, const std::string& nam); diff --git a/DDG4/include/DDG4/Geant4GeneratorWrapper.h b/DDG4/include/DDG4/Geant4GeneratorWrapper.h index 256ba934c..28bed9bb6 100644 --- a/DDG4/include/DDG4/Geant4GeneratorWrapper.h +++ b/DDG4/include/DDG4/Geant4GeneratorWrapper.h @@ -25,7 +25,7 @@ #define DDG4_GEANT4GENERATORWRAPPER_H // Framework include files -#include "DDG4/Geant4GeneratorAction.h" +#include // Forward declarations class G4VPrimaryGenerator; @@ -49,10 +49,10 @@ namespace dd4hep { /// Property: Type name of the implementation instance. name: "Uses" std::string m_generatorType; /// Property: interaction identifier mask. name: "Mask" - int m_mask; + int m_mask { 1 }; /// Reference to the implementation instance - G4VPrimaryGenerator* m_generator; + G4VPrimaryGenerator* m_generator { nullptr }; public: /// Standard constructor diff --git a/DDG4/include/DDG4/Geant4Handle.h b/DDG4/include/DDG4/Geant4Handle.h index 1fb061774..8431d505c 100644 --- a/DDG4/include/DDG4/Geant4Handle.h +++ b/DDG4/include/DDG4/Geant4Handle.h @@ -15,8 +15,8 @@ #define DDG4_GEANT4HANDLE_H /// Framework include files -#include "DD4hep/ComponentProperties.h" -#include "DD4hep/Detector.h" +#include +#include /// C/C++ include files #include diff --git a/DDG4/include/DDG4/Geant4InputAction.h b/DDG4/include/DDG4/Geant4InputAction.h index 8da8ad550..5b7202882 100644 --- a/DDG4/include/DDG4/Geant4InputAction.h +++ b/DDG4/include/DDG4/Geant4InputAction.h @@ -25,10 +25,10 @@ #define DDG4_GEANT4INPUTACTION_H // Framework include files -#include "DDG4/Geant4Vertex.h" -#include "DDG4/Geant4Particle.h" -#include "DDG4/Geant4GeneratorAction.h" -#include "Parsers/Parsers.h" +#include +#include +#include +#include // C/C++ include files #include @@ -78,11 +78,11 @@ namespace dd4hep { /// File name to be opened and read std::string m_name; /// Flag if direct event access is supported. To be explicitly set by subclass constructors - bool m_directAccess; + bool m_directAccess { false }; /// Current event number - int m_currEvent; + int m_currEvent { 0 }; /// The input action context - Geant4InputAction *m_inputAction; + Geant4InputAction *m_inputAction { nullptr }; /// transform the string parameter value into the type of parameter /** diff --git a/DDG4/include/DDG4/Geant4InputHandling.h b/DDG4/include/DDG4/Geant4InputHandling.h index 2498b541e..d2d5437d3 100644 --- a/DDG4/include/DDG4/Geant4InputHandling.h +++ b/DDG4/include/DDG4/Geant4InputHandling.h @@ -15,7 +15,7 @@ #define DDG4_GEANT4INPUTHANDLING_H // Framework include files -#include "DDG4/Geant4Primary.h" +#include // Forward declarations class G4Event; diff --git a/DDG4/include/DDG4/Geant4Kernel.h b/DDG4/include/DDG4/Geant4Kernel.h index 385174646..5a055c4d0 100644 --- a/DDG4/include/DDG4/Geant4Kernel.h +++ b/DDG4/include/DDG4/Geant4Kernel.h @@ -14,7 +14,7 @@ #define DDG4_GEANT4KERNEL_H // Framework include files -#include "DDG4/Geant4ActionContainer.h" +#include // C/C++ include files #include @@ -74,19 +74,19 @@ namespace dd4hep { UserFramework m_userFramework { }; /// Action phases - Phases m_phases; + Phases m_phases { }; /// Worker threads - Workers m_workers; + Workers m_workers { }; /// Globally registered actions - GlobalActions m_globalActions; + GlobalActions m_globalActions { }; /// Globally registered filters of sensitive detectors - GlobalActions m_globalFilters; + GlobalActions m_globalFilters { }; /// Property: Client output levels - ClientOutputLevels m_clientLevels; + ClientOutputLevels m_clientLevels { }; /// Property: Name of the G4UI command tree - std::string m_controlName; + std::string m_controlName { }; /// Property: Name of the UI action. Must be member of the global actions - std::string m_uiName; + std::string m_uiName { }; /// Property: Name of the G4 run manager factory to be used. Default: Geant4RunManager std::string m_runManagerType; /// Property: Name of the default factory to create G4VSensitiveDetector instances @@ -96,7 +96,7 @@ namespace dd4hep { /// Property: Number of events to be executed in batch mode long m_numEvent = 10; /// Property: Output level - int m_outputLevel; + int m_outputLevel = 0; /// Master property: Number of execution threads in multi threaded mode. int m_numThreads = 0; diff --git a/DDG4/include/DDG4/Geant4OutputAction.h b/DDG4/include/DDG4/Geant4OutputAction.h index 633cd9d9d..e820b5a1c 100644 --- a/DDG4/include/DDG4/Geant4OutputAction.h +++ b/DDG4/include/DDG4/Geant4OutputAction.h @@ -14,7 +14,7 @@ #define DDG4_GEANT4OUTPUTACTION_H // Framework include files -#include "DDG4/Geant4EventAction.h" +#include // Forward declarations class G4Run; @@ -53,11 +53,11 @@ namespace dd4hep { }; /// Property: "Output" output destination - std::string m_output; + std::string m_output { }; /// Property: "HandleErrorsAsFatal" Handle errors as fatal and rethrow eventual exceptions - bool m_errorFatal; + bool m_errorFatal { true }; /// Reference to MC truth object - Geant4ParticleMap* m_truth; + Geant4ParticleMap* m_truth { nullptr }; public: /// Inhibit default constructor Geant4OutputAction() = delete; diff --git a/DDG4/include/DDG4/Geant4PhysicsList.h b/DDG4/include/DDG4/Geant4PhysicsList.h index 04c8c912e..32ea6d885 100644 --- a/DDG4/include/DDG4/Geant4PhysicsList.h +++ b/DDG4/include/DDG4/Geant4PhysicsList.h @@ -15,7 +15,7 @@ #define DDG4_GEANT4PHYSICSLIST_H // Framework include files -#include "DDG4/Geant4Action.h" +#include // C/C++ include files #include @@ -237,9 +237,9 @@ namespace dd4hep { virtual void constructDecays(G4VUserPhysicsList* physics); public: /// Flag if particle transportation is to be added - bool m_transportation; + bool m_transportation { false }; /// Flag if particle decays are to be added - bool m_decays; + bool m_decays { false }; /// Property: Store name of basic predefined Geant4 physics list std::string m_extends; /// global range cut for secondary productions diff --git a/DDG4/src/Geant4Action.cpp b/DDG4/src/Geant4Action.cpp index c8dbd2327..f0f053ad2 100644 --- a/DDG4/src/Geant4Action.cpp +++ b/DDG4/src/Geant4Action.cpp @@ -52,8 +52,7 @@ void Geant4Action::ContextUpdate::operator()(Geant4Action* action) const { #endif /// Standard constructor Geant4Action::Geant4Action(Geant4Context* ctxt, const std::string& nam) - : m_context(ctxt), m_control(0), m_outputLevel(INFO), m_needsControl(false), m_name(nam), - m_refCount(1) + : m_context(ctxt), m_outputLevel(INFO), m_name(nam) { InstanceCount::increment(this); m_outputLevel = ctxt ? ctxt->kernel().getOutputLevel(nam) : (printLevel()-1); diff --git a/DDG4/src/Geant4ActionContainer.cpp b/DDG4/src/Geant4ActionContainer.cpp index 7fae8020d..e02eed669 100644 --- a/DDG4/src/Geant4ActionContainer.cpp +++ b/DDG4/src/Geant4ActionContainer.cpp @@ -35,11 +35,7 @@ using namespace dd4hep::sim; /// Standard constructor -Geant4ActionContainer::Geant4ActionContainer(Geant4Context* ctxt) - : m_context(ctxt), - m_generatorAction(0), m_runAction(0), m_eventAction(0), m_trackingAction(0), - m_steppingAction(0), m_stackingAction(0), m_constructionAction(0), - m_sensDetActions(0), m_physicsList(0), m_userInit(0) +Geant4ActionContainer::Geant4ActionContainer(Geant4Context* ctxt) : m_context(ctxt) { m_sensDetActions = new Geant4SensDetSequences(); InstanceCount::increment(this); diff --git a/DDG4/src/Geant4AssemblyVolume.cpp b/DDG4/src/Geant4AssemblyVolume.cpp index 6517b7e03..342fdb761 100644 --- a/DDG4/src/Geant4AssemblyVolume.cpp +++ b/DDG4/src/Geant4AssemblyVolume.cpp @@ -42,8 +42,8 @@ Geant4AssemblyVolume::~Geant4AssemblyVolume() { /// Place logical daughter volume into the assembly long Geant4AssemblyVolume::placeVolume(const TGeoNode* n, - G4LogicalVolume* pPlacedVolume, - G4Transform3D& transformation) + G4LogicalVolume* pPlacedVolume, + G4Transform3D& transformation) { size_t id = m_assembly->TotalTriplets(); m_entries.emplace_back(n); @@ -54,8 +54,8 @@ long Geant4AssemblyVolume::placeVolume(const TGeoNode* n, /// Place daughter assembly into the assembly long Geant4AssemblyVolume::placeAssembly(const TGeoNode* n, - Geant4AssemblyVolume* pPlacedVolume, - G4Transform3D& transformation) + Geant4AssemblyVolume* pPlacedVolume, + G4Transform3D& transformation) { size_t id = m_assembly->TotalTriplets(); m_entries.emplace_back(n); diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index 9e5ff305a..183858365 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -294,10 +294,9 @@ Geant4Converter::Geant4Converter(const Detector& description_ref) /// Initializing Constructor Geant4Converter::Geant4Converter(const Detector& description_ref, PrintLevel level) - : Geant4Mapping(description_ref), checkOverlaps(true) { + : Geant4Mapping(description_ref), outputLevel(level) { this->Geant4Mapping::init(); m_propagateRegions = true; - outputLevel = level; } /// Standard destructor diff --git a/DDG4/src/Geant4Data.cpp b/DDG4/src/Geant4Data.cpp index e4c7efd06..e9b69aee4 100644 --- a/DDG4/src/Geant4Data.cpp +++ b/DDG4/src/Geant4Data.cpp @@ -27,8 +27,7 @@ using namespace dd4hep::sim; /// Default constructor -SimpleRun::SimpleRun() - : runID(-1), numEvents(0) { +SimpleRun::SimpleRun() { InstanceCount::increment(this); } @@ -38,8 +37,7 @@ SimpleRun::~SimpleRun() { } /// Default constructor -SimpleEvent::SimpleEvent() - : runID(-1), eventID(-1) { +SimpleEvent::SimpleEvent() { InstanceCount::increment(this); } @@ -103,9 +101,7 @@ Geant4HitData::Contribution Geant4HitData::extractContribution(const Geant4FastS } /// Default constructor -Geant4Tracker::Hit::Hit() -: Geant4HitData(), position(), momentum(), length(0.0), energyDeposit(0.0), truth() -{ +Geant4Tracker::Hit::Hit() { InstanceCount::increment(this); } @@ -199,14 +195,12 @@ Geant4Tracker::Hit& Geant4Tracker::Hit::storePoint(const Geant4FastSimSpot* spot } /// Default constructor (for ROOT) -Geant4Calorimeter::Hit::Hit() -: Geant4HitData(), position(), truth(), energyDeposit(0) { +Geant4Calorimeter::Hit::Hit() { InstanceCount::increment(this); } /// Standard constructor -Geant4Calorimeter::Hit::Hit(const Position& pos) -: Geant4HitData(), position(pos), truth(), energyDeposit(0) { +Geant4Calorimeter::Hit::Hit(const Position& pos) : position(pos) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4GDMLDetector.cpp b/DDG4/src/Geant4GDMLDetector.cpp index b7634f2cf..3ac3ebbf3 100644 --- a/DDG4/src/Geant4GDMLDetector.cpp +++ b/DDG4/src/Geant4GDMLDetector.cpp @@ -24,7 +24,7 @@ #endif dd4hep::sim::Geant4GDMLDetector::Geant4GDMLDetector(const std::string& gdmlFile) - : m_fileName(gdmlFile), m_world(0) { + : m_fileName(gdmlFile) { } G4VPhysicalVolume* dd4hep::sim::Geant4GDMLDetector::Construct() { diff --git a/DDG4/src/Geant4GeneratorActionInit.cpp b/DDG4/src/Geant4GeneratorActionInit.cpp index 108e827d4..de616060c 100644 --- a/DDG4/src/Geant4GeneratorActionInit.cpp +++ b/DDG4/src/Geant4GeneratorActionInit.cpp @@ -12,20 +12,20 @@ //========================================================================== // Framework include files -#include "DD4hep/Printout.h" -#include "DD4hep/InstanceCount.h" -#include "DDG4/Geant4Kernel.h" -#include "DDG4/Geant4RunAction.h" -#include "DDG4/Geant4GeneratorActionInit.h" -#include "DDG4/Geant4InputHandling.h" +#include +#include +#include +#include +#include +#include -#include "G4Run.hh" +#include using namespace dd4hep::sim; /// Standard constructor Geant4GeneratorActionInit::Geant4GeneratorActionInit(Geant4Context* ctxt, const std::string& nam) - : Geant4GeneratorAction(ctxt,nam), m_run(0), m_evtTotal(0), m_evtRun(0) + : Geant4GeneratorAction(ctxt,nam) { InstanceCount::increment(this); context()->kernel().runAction().callAtEnd(this,&Geant4GeneratorActionInit::end); diff --git a/DDG4/src/Geant4GeneratorWrapper.cpp b/DDG4/src/Geant4GeneratorWrapper.cpp index a7ab068e0..1e6938264 100644 --- a/DDG4/src/Geant4GeneratorWrapper.cpp +++ b/DDG4/src/Geant4GeneratorWrapper.cpp @@ -35,7 +35,7 @@ using namespace dd4hep::sim; /// Standard constructor Geant4GeneratorWrapper::Geant4GeneratorWrapper(Geant4Context* ctxt, const std::string& nam) - : Geant4GeneratorAction(ctxt,nam), m_generator(0) + : Geant4GeneratorAction(ctxt,nam) { declareProperty("Uses", m_generatorType); declareProperty("Mask", m_mask = 1); diff --git a/DDG4/src/Geant4InputAction.cpp b/DDG4/src/Geant4InputAction.cpp index 07ed4e0a9..785f4267b 100644 --- a/DDG4/src/Geant4InputAction.cpp +++ b/DDG4/src/Geant4InputAction.cpp @@ -29,8 +29,7 @@ using PropertyMask = dd4hep::detail::ReferenceBitMask; /// Initializing constructor -Geant4EventReader::Geant4EventReader(const std::string& nam) - : m_name(nam), m_directAccess(false), m_currEvent(0), m_inputAction(0) +Geant4EventReader::Geant4EventReader(const std::string& nam) : m_name(nam) { } diff --git a/DDG4/src/Geant4Kernel.cpp b/DDG4/src/Geant4Kernel.cpp index f8c5596f1..00b871b92 100644 --- a/DDG4/src/Geant4Kernel.cpp +++ b/DDG4/src/Geant4Kernel.cpp @@ -85,12 +85,11 @@ Geant4ActionPhase& Geant4Kernel::PhaseSelector::operator[](const std::string& na /// Standard constructor Geant4Kernel::Geant4Kernel(Detector& description_ref) - : Geant4ActionContainer(), m_runManager(0), m_control(0), m_trackMgr(0), m_detDesc(&description_ref), - m_numThreads(0), m_id(Geant4Kernel::thread_self()), m_master(this), m_shared(0), - m_threadContext(0), phase(this) + : Geant4ActionContainer(), m_detDesc(&description_ref), + m_id(Geant4Kernel::thread_self()), m_master(this), phase(this) { m_ident = -1; - declareProperty("UI", m_uiName); + declareProperty("UI", m_uiName); declareProperty("OutputLevel", m_outputLevel = DEBUG); declareProperty("NumEvents", m_numEvent = 10); declareProperty("OutputLevels", m_clientLevels); @@ -109,11 +108,10 @@ Geant4Kernel::Geant4Kernel(Detector& description_ref) /// Standard constructor Geant4Kernel::Geant4Kernel(Geant4Kernel* krnl, unsigned long ident) - : Geant4ActionContainer(), m_runManager(0), m_control(0), m_trackMgr(0), m_detDesc(0), - m_numThreads(1), m_id(ident), m_master(krnl), m_shared(0), - m_threadContext(0), phase(this) + : Geant4ActionContainer(), m_id(ident), m_master(krnl), phase(this) { char text[64]; + m_numThreads = 1; // Slave instance for one single thread m_detDesc = m_master->m_detDesc; m_world = m_master->m_world; m_ident = m_master->m_workers.size(); diff --git a/DDG4/src/Geant4OutputAction.cpp b/DDG4/src/Geant4OutputAction.cpp index 12c433a3f..ffcbc01db 100644 --- a/DDG4/src/Geant4OutputAction.cpp +++ b/DDG4/src/Geant4OutputAction.cpp @@ -26,7 +26,7 @@ using namespace dd4hep::sim; /// Standard constructor Geant4OutputAction::Geant4OutputAction(Geant4Context* ctxt, const std::string& nam) - : Geant4EventAction(ctxt, nam), m_truth(0) + : Geant4EventAction(ctxt, nam) { InstanceCount::increment(this); declareProperty("Output", m_output); diff --git a/DDG4/src/Geant4PhysicsList.cpp b/DDG4/src/Geant4PhysicsList.cpp index cbe2c48a5..eade54531 100644 --- a/DDG4/src/Geant4PhysicsList.cpp +++ b/DDG4/src/Geant4PhysicsList.cpp @@ -313,7 +313,8 @@ void Geant4PhysicsList::enable(G4VUserPhysicsList* /* physics */) { /// Standard constructor Geant4PhysicsListActionSequence::Geant4PhysicsListActionSequence(Geant4Context* ctxt, const std::string& nam) - : Geant4Action(ctxt, nam), m_transportation(false), m_decays(false), m_rangecut(0.7*CLHEP::mm) { + : Geant4Action(ctxt, nam), m_rangecut(0.7*CLHEP::mm) +{ declareProperty("transportation", m_transportation); declareProperty("extends", m_extends); declareProperty("decays", m_decays);