diff --git a/DDG4/include/DDG4/Geant4Action.h b/DDG4/include/DDG4/Geant4Action.h index eb5e9cbfe20335baf21d2ad0cb3a77ed52eddaaf..ba6aacd1b43387d9894a2681bd70ec6a70117d0e 100644 --- a/DDG4/include/DDG4/Geant4Action.h +++ b/DDG4/include/DDG4/Geant4Action.h @@ -89,20 +89,20 @@ namespace DD4hep { class Geant4Action { protected: /// Reference to the Geant4 context - Geant4Context* m_context; + Geant4Context* m_context = 0; /// Control directory of this action - Geant4UIMessenger* m_control; + Geant4UIMessenger* m_control = 0; /// Default property: Output level - int m_outputLevel; + int m_outputLevel = 3; /// Default property: Flag to create control instance - bool m_needsControl; + bool m_needsControl = false; /// Action name std::string m_name; /// Property pool PropertyManager m_properties; /// Reference count. Initial value: 1 - long m_refCount; + long m_refCount = 1; public: /// Functor to update the context of a Geant4Action object @@ -237,8 +237,9 @@ namespace DD4hep { } }; + protected: /// Inhibit default constructor - Geant4Action() = delete; + Geant4Action() = default; /// Inhibit copy constructor Geant4Action(const Geant4Action& copy) = delete; /// Inhibit assignment operator diff --git a/DDG4/include/DDG4/Geant4SensDetAction.h b/DDG4/include/DDG4/Geant4SensDetAction.h index 6bbcd9e7ee05d13e7d518b4465f6715d7e0ff035..6ef79e33538e1299afb31abbf8e72f59a60d7f91 100644 --- a/DDG4/include/DDG4/Geant4SensDetAction.h +++ b/DDG4/include/DDG4/Geant4SensDetAction.h @@ -92,9 +92,17 @@ namespace DD4hep { * \ingroup DD4HEP_SIMULATION */ class Geant4Filter: public Geant4Action { - public: + protected: + /// Inhibit copy constructor + Geant4Filter() = default; + /// Inhibit copy constructor Geant4Filter(const Geant4Filter& copy) = delete; + + /// Inhibit assignment operator + Geant4Filter& operator=(const Geant4Filter& copy) = delete; + + public: /// Standard constructor Geant4Filter(Geant4Context* context, const std::string& name); /// Standard destructor @@ -129,13 +137,13 @@ namespace DD4hep { private: /// Reference to G4 sensitive detector - Geant4ActionSD* m_sensitiveDetector; + Geant4ActionSD* m_sensitiveDetector = 0; /// Reference to the containing action sequence - Geant4SensDetActionSequence* m_sequence; + Geant4SensDetActionSequence* m_sequence = 0; protected: /// Property: Hit creation mode. Maybe one of the enum HitCreationFlags - int m_hitCreationMode; + int m_hitCreationMode = 0; /// Reference to the detector description object LCDD& m_lcdd; /// Reference to the detector element describing this sensitive element @@ -149,10 +157,16 @@ namespace DD4hep { /// The list of sensitive detector filter objects Actors<Geant4Filter> m_filters; - public: + /// Protect the default constructor + Geant4Sensitive() = default; + /// Inhibit copy constructor Geant4Sensitive(const Geant4Sensitive& copy) = delete; + /// Inhibit assignment operator + Geant4Sensitive& operator=(const Geant4Sensitive& copy) = delete; + + public: /// Constructor. The sensitive detector element is identified by the detector name Geant4Sensitive(Geant4Context* context, const std::string& name, DetElement det, LCDD& lcdd); @@ -294,7 +308,7 @@ namespace DD4hep { protected: /// Geant4 hit collection context - G4HCofThisEvent* m_hce; + G4HCofThisEvent* m_hce = 0; /// Callback sequence for event initialization action CallbackSequence m_begin; /// Callback sequence for event finalization action @@ -322,6 +336,10 @@ namespace DD4hep { return new Geant4HitCollection(det, coll, sd, (TYPE*) 0); } + protected: + /// Protect the default constructor + Geant4SensDetActionSequence() = default; + public: /// Inhibit copy constructor Geant4SensDetActionSequence(const Geant4SensDetActionSequence& copy) = delete; @@ -332,6 +350,9 @@ namespace DD4hep { /// Default destructor virtual ~Geant4SensDetActionSequence(); + /// Inhibit assignment operator + Geant4SensDetActionSequence& operator=(const Geant4SensDetActionSequence& copy) = delete; + /// Access to the sensitive type of the detector virtual const std::string& sensitiveType() const { return m_sensitiveType; @@ -437,9 +458,10 @@ namespace DD4hep { Members m_sequences; /// Insert sequence member void insert(const std::string& name, Geant4SensDetActionSequence* seq); + public: /// Default constructor - Geant4SensDetSequences(); + Geant4SensDetSequences() = default; /// Default destructor virtual ~Geant4SensDetSequences(); /// Access sequence member by name @@ -484,16 +506,21 @@ namespace DD4hep { /// Property: collection name. If not set default is readout name! std::string m_collectionName; /// Collection identifier - size_t m_collectionID; + size_t m_collectionID = -1; /// User data block UserData m_userData; + protected: + /// Protect the default constructor + Geant4SensitiveAction() = default; + public: /// Standard , initializing constructor Geant4SensitiveAction(Geant4Context* context, const std::string& name, Geometry::DetElement det, Geometry::LCDD& lcdd); + /// Default destructor virtual ~Geant4SensitiveAction(); diff --git a/DDG4/src/Geant4SensDetAction.cpp b/DDG4/src/Geant4SensDetAction.cpp index 4bcb41bf371412577907e8d42b3d38bca5684cf1..7488ed7d048a6529f2468804622f8985959d79ee 100644 --- a/DDG4/src/Geant4SensDetAction.cpp +++ b/DDG4/src/Geant4SensDetAction.cpp @@ -1,4 +1,3 @@ -// $Id: $ //========================================================================== // AIDA Detector description implementation for LCD //-------------------------------------------------------------------------- @@ -396,10 +395,6 @@ void Geant4SensDetActionSequence::clear() { m_actors(&Geant4Sensitive::clear, m_hce); } -/// Default constructor -Geant4SensDetSequences::Geant4SensDetSequences() { -} - /// Default destructor Geant4SensDetSequences::~Geant4SensDetSequences() { releaseObjects(m_sequences);