Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2354 from civanch/ForGeant4_10.0
Geant4.10 -- For geant4 10.0 UserActions
- Loading branch information
Showing
18 changed files
with
562 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#ifndef SimG4Core_ActionInitialization_h | ||
#define SimG4Core_ActionInitialization_h 1 | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "SimG4Core/Generators/interface/Generator.h" | ||
|
||
#include "G4VUserActionInitialization.hh" | ||
|
||
// Action initialization class. | ||
// | ||
|
||
class RunManager; | ||
class CMSRunInterface; | ||
|
||
class ActionInitialization : public G4VUserActionInitialization | ||
{ | ||
public: | ||
|
||
ActionInitialization(const edm::ParameterSet & ps, | ||
RunManager* runm); | ||
|
||
virtual ~ActionInitialization(); | ||
|
||
virtual void BuildForMaster() const; | ||
virtual void Build() const; | ||
|
||
private: | ||
|
||
RunManager* m_runManager; | ||
|
||
edm::ParameterSet m_pGenerator; | ||
edm::ParameterSet m_pVertexGenerator; | ||
edm::ParameterSet m_pPhysics; | ||
edm::ParameterSet m_pRunAction; | ||
edm::ParameterSet m_pEventAction; | ||
edm::ParameterSet m_pStackingAction; | ||
edm::ParameterSet m_pTrackingAction; | ||
edm::ParameterSet m_pSteppingAction; | ||
|
||
}; | ||
|
||
#endif | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#ifndef SimG4Core_SimRunInterface_h | ||
#define SimG4Core_SimRunInterface_h 1 | ||
|
||
// This class is needed to provide an interface | ||
// between Geant4 user actions and CMS SIM | ||
// infrastructure both for sequentional and MT runs | ||
|
||
|
||
class RunManager; | ||
class SimTrackManager; | ||
class RunAction; | ||
class EventAction; | ||
class TrackingAction; | ||
class SteppingAction; | ||
class G4SimEvent; | ||
|
||
class SimRunInterface | ||
{ | ||
public: | ||
|
||
SimRunInterface(RunManager* run, bool master); | ||
|
||
~SimRunInterface(); | ||
|
||
void Connect(RunAction*); | ||
|
||
void Connect(EventAction*); | ||
|
||
void Connect(TrackingAction*); | ||
|
||
void Connect(SteppingAction*); | ||
|
||
SimTrackManager* GetSimTrackManager(); | ||
|
||
void abortEvent(); | ||
|
||
void abortRun(bool softAbort); | ||
|
||
G4SimEvent* simEvent(); | ||
|
||
private: | ||
|
||
RunManager* m_runManager; | ||
|
||
SimTrackManager* m_SimTrackManager; | ||
|
||
bool m_isMaster; | ||
}; | ||
|
||
#endif | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#include "SimG4Core/Generators/interface/Generator.h" | ||
#include "SimG4Core/Application/interface/RunManager.h" | ||
#include "SimG4Core/Application/interface/SimRunInterface.h" | ||
#include "SimG4Core/Application/interface/ActionInitialization.h" | ||
#include "SimG4Core/Application/interface/RunAction.h" | ||
#include "SimG4Core/Application/interface/EventAction.h" | ||
#include "SimG4Core/Application/interface/TrackingAction.h" | ||
#include "SimG4Core/Application/interface/SteppingAction.h" | ||
#include "SimG4Core/Application/interface/StackingAction.h" | ||
#include "SimG4Core/Application/interface/SimTrackManager.h" | ||
|
||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... | ||
|
||
ActionInitialization::ActionInitialization(const edm::ParameterSet & p, | ||
RunManager* runm) | ||
: G4VUserActionInitialization(), | ||
m_runManager(runm), | ||
m_pGenerator(p.getParameter<edm::ParameterSet>("Generator")), | ||
m_pPhysics(p.getParameter<edm::ParameterSet>("Physics")), | ||
m_pRunAction(p.getParameter<edm::ParameterSet>("RunAction")), | ||
m_pEventAction(p.getParameter<edm::ParameterSet>("EventAction")), | ||
m_pStackingAction(p.getParameter<edm::ParameterSet>("StackingAction")), | ||
m_pTrackingAction(p.getParameter<edm::ParameterSet>("TrackingAction")), | ||
m_pSteppingAction(p.getParameter<edm::ParameterSet>("SteppingAction")) | ||
{} | ||
|
||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... | ||
|
||
ActionInitialization::~ActionInitialization() | ||
{} | ||
|
||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... | ||
|
||
void ActionInitialization::BuildForMaster() const | ||
{ | ||
SimRunInterface* interface = new SimRunInterface(m_runManager, true); | ||
|
||
RunAction* runAction = new RunAction(m_pRunAction, interface); | ||
SetUserAction(runAction); | ||
interface->Connect(runAction); | ||
} | ||
|
||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... | ||
|
||
#include "G4AutoLock.hh" | ||
namespace { G4Mutex ActionInitializationMutex = G4MUTEX_INITIALIZER; } | ||
|
||
void ActionInitialization::Build() const | ||
{ | ||
G4AutoLock l(&ActionInitializationMutex); | ||
|
||
SimRunInterface* interface = new SimRunInterface(m_runManager, false); | ||
|
||
//Generator* gen = new Generator(m_pGenerator); | ||
//SetUserAction(gen); | ||
|
||
RunAction* runAction = new RunAction(m_pRunAction, interface); | ||
SetUserAction(runAction); | ||
interface->Connect(runAction); | ||
|
||
EventAction* eventAction = new EventAction(m_pEventAction, interface, | ||
interface->GetSimTrackManager()); | ||
SetUserAction(eventAction); | ||
interface->Connect(eventAction); | ||
|
||
TrackingAction* trackAction = | ||
new TrackingAction(eventAction, m_pTrackingAction); | ||
SetUserAction(trackAction); | ||
interface->Connect(trackAction); | ||
|
||
SteppingAction* stepAction = | ||
new SteppingAction(eventAction, m_pSteppingAction); | ||
SetUserAction(stepAction); | ||
interface->Connect(stepAction); | ||
|
||
SetUserAction(new StackingAction(m_pStackingAction)); | ||
} | ||
|
||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
Oops, something went wrong.