GEARS
Geant4 Example Application with Rich features and Small footprints
Classes | Functions
gears.cc File Reference
#include <vector>
#include <G4SteppingManager.hh>
#include <G4SteppingVerbose.hh>
#include <G4AnalysisManager.hh>
#include <G4NavigationHistory.hh>
#include <G4OpticalSurface.hh>
#include <G4tgrLineProcessor.hh>
#include <G4NistManager.hh>
#include <G4UImessenger.hh>
#include <G4tgbMaterialMgr.hh>
#include <G4tgrUtils.hh>
#include <G4tgbDetectorBuilder.hh>
#include <G4tgbVolumeMgr.hh>
#include <G4tgrFileReader.hh>
#include <G4tgrVolumeMgr.hh>
#include <G4LogicalBorderSurface.hh>
#include <G4UIcmdWith3VectorAndUnit.hh>
#include <G4UIcmdWithAString.hh>
#include <G4UIdirectory.hh>
#include <G4VUserDetectorConstruction.hh>
#include <G4FieldManager.hh>
#include <G4LogicalVolumeStore.hh>
#include <G4TransportationManager.hh>
#include <G4UniformMagField.hh>
#include <G4UserLimits.hh>
#include "G4Box.hh"
#include "G4PVPlacement.hh"
#include <G4GeneralParticleSource.hh>
#include <G4VUserPrimaryGeneratorAction.hh>
#include <G4Run.hh>
#include <G4RunManagerFactory.hh>
#include <G4UserRunAction.hh>
#include <G4UserEventAction.hh>
#include <G4UIcmdWithADoubleAndUnit.hh>
#include <G4UserStackingAction.hh>
#include <G4VUserActionInitialization.hh>
#include <G4PhysListFactory.hh>
#include <G4ScoringManager.hh>
#include <G4StepLimiterPhysics.hh>
#include <G4UIExecutive.hh>
#include <G4UImanager.hh>
#include <G4VisExecutive.hh>
Include dependency graph for gears.cc:

Go to the source code of this file.

Classes

class  Output
 Dump simulation results to screen or a file. More...
 
struct  BorderSurface
 A link list of G4LogicalBorderSurface. More...
 
class  LineProcessor
 Extension to default text geometry file line processor. More...
 
class  TextDetectorBuilder
 Construct detector based on text geometry description. More...
 
class  Detector
 Construct detector geometry. More...
 
class  Generator
 Call Geant4 General Particle Source to generate particles. More...
 
class  RunAction
 Book keeping before and after a run. More...
 
class  EventAction
 Book keeping before and after an event. More...
 
class  StackingAction
 Split a radioactive decay chain to different events based on a time window. More...
 
class  Action
 

Functions

void SaveAndResetEvent ()
 save and then reset an event More...
 
int main (int argc, char **argv)
 The main function that calls individual components. More...
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

The main function that calls individual components.

Definition at line 762 of file gears.cc.

762  {
763  // inherit G4SteppingVerbose instead of G4UserSteppingAction to record data
764  G4VSteppingVerbose::SetInstance(new Output); // must be before run manager
765  auto run =
766  G4RunManagerFactory::CreateRunManager(G4RunManagerType::SerialOnly);
767  G4PhysListFactory factory;
768  auto physics = factory.ReferencePhysList();
769  physics->RegisterPhysics(new G4StepLimiterPhysics());
770  run->SetUserInitialization(physics); // initialize physics
771  run->SetUserInitialization(new Detector); // initialize detector
772  run->SetUserInitialization(new Action); // initialize user actions
773  G4ScoringManager::GetScoringManager(); // enable built-in scoring cmds
774  G4UIExecutive *ui = nullptr; // assume batch mode
775  if (argc == 1) {
776  ui = new G4UIExecutive(argc, argv);
777  } // interactive mode
778  auto vis = new G4VisExecutive("quiet"); // visualization
779  vis->Initialize(); // do this after ui mode is decided
780  if (ui) { // interactive mode
781  ui->SessionStart(); // do this after vis
782  delete ui;
783  } else { // batch mode
784  G4String cmd = "/control/execute ";
785  G4UImanager::GetUIpointer()->ApplyCommand(cmd + argv[1]);
786  }
787  delete vis;
788  delete run;
789  return 0;
790 }
Definition: gears.cc:743
Construct detector geometry.
Definition: gears.cc:506
Dump simulation results to screen or a file.
Definition: gears.cc:12

◆ SaveAndResetEvent()

void SaveAndResetEvent ( )

save and then reset an event

Definition at line 673 of file gears.cc.