/** \file \author Javier Gonzalez \version $Id$ \date 26 Jul 2012 */ #ifndef _tls_Geant4Customization_h_ #define _tls_Geant4Customization_h_ static const char CVSId_tls_Geant4Customization[] = "$Id$"; #include #include #include #include #include #include #include #include #include #include namespace tls { /** \class Geant4Customization \brief Data structure to hold the different Geant4 global objects required to run a single module. This class contains a G4VUserPhysicsList, a G4VUserDetectorConstruction, a G4VUserPrimaryGeneratorAction, and optionally the usual user actions. Users can provide a G4VPhysicsListCustomization as physics list, in which case the manager will call the custom methods when needed. \author Martin Maur \author Javier Gonzalez \date 04 May 2012 \ingroup geant4 */ class Geant4Customization { public: Geant4Customization(){} Geant4Customization(std::string name, G4VUserDetectorConstruction* construction = 0, G4VUserPhysicsList* physicsList = 0, G4VUserPrimaryGeneratorAction* primaryGenerator = 0): fName(name), fDetectorConstruction(construction), fPhysicsList(physicsList), fPrimaryGenerator(primaryGenerator) {} virtual ~Geant4Customization() { } std::string GetName() const { return fName; } void SetPhysicsList(G4VUserPhysicsList* physicsList) { fPhysicsList = physicsList; } void SetDetectorConstruction(G4VUserDetectorConstruction* construction) { fDetectorConstruction = construction; } void SetStackingAction(G4UserStackingAction* action) { fStackingAction.reset(action); } void SetTrackingAction(G4UserTrackingAction* action) { fTrackingAction.reset(action); } void SetSteppingAction(G4UserSteppingAction* action) { fSteppingAction.reset(action); } void SetEventAction(G4UserEventAction* action) { fEventAction.reset(action); } void SetRunAction(G4UserRunAction* action) { fRunAction.reset(action); } void SetPrimaryGenerator(G4VUserPrimaryGeneratorAction* action) { fPrimaryGenerator.reset(action); } G4VUserDetectorConstruction* GetDetectorConstruction() { return fDetectorConstruction; } G4VUserPhysicsList* GetPhysicsList() { return fPhysicsList; } G4VPhysicsListCustomization* GetPhysicsListCustomization() { return dynamic_cast(fPhysicsList); } G4UserStackingAction* GetStackingAction() { return fStackingAction.get(); } G4UserTrackingAction* GetTrackingAction() { return fTrackingAction.get(); } G4UserSteppingAction* GetSteppingAction() { return fSteppingAction.get(); } G4UserEventAction* GetEventAction() { return fEventAction.get(); } G4UserRunAction* GetRunAction() { return fRunAction.get(); } G4VUserPrimaryGeneratorAction* GetPrimaryGenerator() { return fPrimaryGenerator.get(); } void SetRunManager(boost::shared_ptr action) { fG4RunManager = action; } private: std::string fName; // Can't delete construction neither before nor after run manager // Run manager destructor only seems to call the destructor for // the current construction and they never get deleted as result. G4VUserDetectorConstruction* fDetectorConstruction; // Physics list is owned by the global physics list. G4VUserPhysicsList* fPhysicsList; boost::shared_ptr fPrimaryGenerator; boost::shared_ptr fStackingAction; boost::shared_ptr fTrackingAction; boost::shared_ptr fSteppingAction; boost::shared_ptr fEventAction; boost::shared_ptr fRunAction; boost::shared_ptr fG4RunManager; }; } // tls #endif // _tls_Geant4Customization_h_ // Configure (x)emacs for this file ... // Local Variables: // mode:c++ // compile-command: "make -C .. -k" // End: