Message: Which classes will be deleted automatically when G4RunManager is deleted? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Which classes will be deleted automatically when G4RunManager is deleted? 

Forum: Run Management
Date: 29 Nov, 2013
From: gdss <gdss>

The Geant4 User's Guide for Application Developers tells us in pager 2 the follows:

   When G4RunManager is created, the other major manager classes are also created. They are deleted automatically when G4RunManager is deleted.

I have a question here: who are "the other major manager classes"?. Namely, which classes will be deleted when G4RunManager is deleted?

For example:

     G4RunManager *runManager = new G4RunManager;

     AnalysisManager *analysis = new AnalysisManager();

     DetectorConstruction *det = new DetectorConstruction;
     runManager->SetUserInitialization(det);

     physicsList *physics = new physicsList;
     runManager->SetUserInitialization(physics);

     PrimaryGeneratorAction *primarygun = new PrimaryGeneratorAction(analysis);
     runManager->SEtUseAction(primarygun);

     RunAction *runact = new RunAction(analysis);
     runManager->SetUserAction(runact);

     EventAction *eventact = new EvetnAction(analysis);
     runManager->SetUserAction(analysis);

     SteppingAction *stepact = new SteppingAction(det,eventact);
     runManager->SetUserAction(stepact);

     runManager->Initialize()

     ....................

AnalysisManager is a class to record information I wanted generated by simulation.

In my opinion, det, physics, primarygun, runact, eventact and stepact will be deleted when runManager is deleted, and I have to delete analysis manually. But program will echo "***Break*** segmentaion violation" if

     delete analysis;
     delete runManager;

and if I commented "delete analysis", that error disappeared.

Why is that? Do all the class created before "runManager->Initialize()" will be deleted automatically when runManager is deleted?

Any help will be appreciated!

 Add Message Add Message
to: "Which classes will be deleted automatically when G4RunManager is deleted?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]