Skip to content

Commit

Permalink
Move some object initalization to class definition
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusFrankATcernch committed May 16, 2024
1 parent e049609 commit a7744de
Show file tree
Hide file tree
Showing 34 changed files with 127 additions and 141 deletions.
26 changes: 13 additions & 13 deletions DDG4/include/DDG4/Geant4Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <DD4hep/Printout.h>
#include <DD4hep/ComponentProperties.h>
#include <DDG4/Geant4Context.h>
#include <DDG4/Geant4Callback.h>

// Geant4 forward declarations
class G4Run;
Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand Down
28 changes: 14 additions & 14 deletions DDG4/include/DDG4/Geant4ActionContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#define DDG4_GEANT4ACTIONCONTAINER_H

// Framework include files
#include "DD4hep/Printout.h"
#include "DDG4/Geant4Primitives.h"
#include "DDG4/Geant4Action.h"
#include <DD4hep/Printout.h>
#include <DDG4/Geant4Action.h>
#include <DDG4/Geant4Primitives.h>

// C/C++ include files
#include <map>
Expand Down Expand Up @@ -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 <typename C> bool registerSequence(C*& seq, const std::string& name);
Expand Down
8 changes: 4 additions & 4 deletions DDG4/include/DDG4/Geant4ActionPhase.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#define DDG4_GEANT4ACTIONPHASE_H

// Framework include files
#include "DD4hep/Exceptions.h"
#include "DDG4/Geant4Action.h"
#include <DD4hep/Exceptions.h>
#include <DDG4/Geant4Action.h>

// C/C++ include files
#include <vector>
Expand Down Expand Up @@ -70,9 +70,9 @@ namespace dd4hep {
typedef std::vector<std::pair<Geant4Action*, Callback> > 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
Expand Down
4 changes: 2 additions & 2 deletions DDG4/include/DDG4/Geant4AssemblyVolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ namespace dd4hep {
public:

typedef std::vector<const TGeoNode*> Chain;
std::vector<const TGeoNode*> m_entries;
std::vector<const TGeoNode*> m_entries;
std::vector<Geant4AssemblyVolume*> m_places;
G4AssemblyVolume* m_assembly;
G4AssemblyVolume* m_assembly { nullptr };

public:
/// Default constructor with initialization
Expand Down
6 changes: 3 additions & 3 deletions DDG4/include/DDG4/Geant4Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions DDG4/include/DDG4/Geant4Converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 10 additions & 10 deletions DDG4/include/DDG4/Geant4Data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -71,11 +71,11 @@ namespace dd4hep {
public:
typedef std::vector<long> 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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions DDG4/include/DDG4/Geant4DetectorConstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#define DDG4_GEANT4DETECTORCONSTRUCTION_H

// Framework include files
#include "DD4hep/DetElement.h"
#include "DDG4/Geant4Action.h"
#include <DD4hep/DetElement.h>
#include <DDG4/Geant4Action.h>

// Forward declarations
class G4VUserDetectorConstruction;
Expand Down Expand Up @@ -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) { }
Expand Down
4 changes: 2 additions & 2 deletions DDG4/include/DDG4/Geant4EventAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define DDG4_GEANT4EVENTACTION_H

// Framework include files
#include "DDG4/Geant4Action.h"
#include <DDG4/Geant4Action.h>

// Forward declarations
class G4Event;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion DDG4/include/DDG4/Geant4FastSimHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace dd4hep {
*/
class Geant4FastSimHandler : public Geant4HitHandler {
public:
const Geant4FastSimSpot* spot;
const Geant4FastSimSpot* spot { nullptr };

/// Inhibit default constructor
Geant4FastSimHandler() = delete;
Expand Down
4 changes: 2 additions & 2 deletions DDG4/include/DDG4/Geant4FastSimSpot.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
#include <DDG4/Defs.h>

// Geant4 include files
#include "G4Version.hh"
#include <G4Version.hh>

#if G4VERSION_NUMBER < 1070

#include "G4ThreeVector.hh"
#include <G4ThreeVector.hh>

class G4FastHit
{
Expand Down
6 changes: 3 additions & 3 deletions DDG4/include/DDG4/Geant4Field.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
#define DDG4_GEANT4FIELD_H

// Framework include files
#include "DD4hep/Detector.h"
#include <DD4hep/Detector.h>

// Geant 4 include files
#include "G4ElectroMagneticField.hh"
#include "G4MagneticField.hh"
#include <G4ElectroMagneticField.hh>
#include <G4MagneticField.hh>

/// Namespace for the AIDA detector description toolkit
namespace dd4hep {
Expand Down
2 changes: 1 addition & 1 deletion DDG4/include/DDG4/Geant4GDMLDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace dd4hep {
G4VPhysicalVolume* Construct();
private:
std::string m_fileName;
G4VPhysicalVolume* m_world;
G4VPhysicalVolume* m_world { nullptr };
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion DDG4/include/DDG4/Geant4GeneratorAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define DDG4_GEANT4GENERATORACTION_H

// Framework include files
#include "DDG4/Geant4Action.h"
#include <DDG4/Geant4Action.h>

// Forward declaration
class G4Event;
Expand Down
8 changes: 4 additions & 4 deletions DDG4/include/DDG4/Geant4GeneratorActionInit.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define DDG4_GEANT4GENERATORACTIONINIT_H

// Framework include files
#include "DDG4/Geant4GeneratorAction.h"
#include <DDG4/Geant4GeneratorAction.h>

// Forward declarations
class G4Event;
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions DDG4/include/DDG4/Geant4GeneratorWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define DDG4_GEANT4GENERATORWRAPPER_H

// Framework include files
#include "DDG4/Geant4GeneratorAction.h"
#include <DDG4/Geant4GeneratorAction.h>

// Forward declarations
class G4VPrimaryGenerator;
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions DDG4/include/DDG4/Geant4Handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#define DDG4_GEANT4HANDLE_H

/// Framework include files
#include "DD4hep/ComponentProperties.h"
#include "DD4hep/Detector.h"
#include <DD4hep/ComponentProperties.h>
#include <DD4hep/Detector.h>

/// C/C++ include files
#include <string>
Expand Down
Loading

0 comments on commit a7744de

Please sign in to comment.