fixed errors
This commit is contained in:
@@ -17,6 +17,14 @@ DetectorActionInitialization::DetectorActionInitialization(EmitterPrimary *emitt
|
||||
{}
|
||||
|
||||
DetectorActionInitialization::~DetectorActionInitialization() {}
|
||||
|
||||
class DetectorSteppingActionWrapper : public G4UserSteppingAction {
|
||||
public:
|
||||
DetectorSteppingActionWrapper(DetectorSteppingAction *real) : m_Real(real) {}
|
||||
virtual void UserSteppingAction(const G4Step* step) override { m_Real->UserSteppingAction(step); }
|
||||
private:
|
||||
DetectorSteppingAction *m_Real;
|
||||
};
|
||||
|
||||
void DetectorActionInitialization::BuildForMaster() const {}
|
||||
|
||||
@@ -34,8 +42,10 @@ void DetectorActionInitialization::Build() const {
|
||||
if (m_Output) {
|
||||
DetectorSteppingAction *sa = new DetectorSteppingAction(m_Output, m_Planes);
|
||||
sa->SetVerbosity(m_Verbosity);
|
||||
SetUserAction(static_cast<G4UserSteppingAction*>(sa));
|
||||
// EventManager will delete sa via the Event slot
|
||||
SetUserAction(static_cast<G4UserEventAction*>(sa));
|
||||
// EventManager will delete the wrapper, leaving sa alive for the other deletion.
|
||||
SetUserAction(new DetectorSteppingActionWrapper(sa));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user