Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exampleP02.cc File Reference

Main program of the persistency/P02 example. More...

Include dependency graph for exampleP02.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the persistency/P02 example.

Definition in file exampleP02.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 56 of file exampleP02.cc.

57 {
58 
59  if(argc==1)
60  {
61  G4cout << "Please give 'write' or 'read' as argument " << G4endl;
62  return 0;
63  }
64 
66 
67  if(std::string(argv[1]) == "read")
68  {
69  det = new ExP02DetConstrReader;
70  }
71  else if(std::string(argv[1]) == "write")
72  {
73  det = new ExP02DetectorConstruction;
74  }
75  else
76  {
77  G4cout << "Wrong argument!" << G4endl;
78  return 0;
79  }
80 
81  // Run manager
82  G4RunManager * runManager = new G4RunManager;
83 
84  // UserInitialization classes (mandatory)
85  runManager->SetUserInitialization(det);
86 
87  G4VModularPhysicsList* physicsList = new FTFP_BERT;
88  runManager->SetUserInitialization(physicsList);
89 
90 #ifdef G4VIS_USE
91  // Visualization, if you choose to have it!
92  G4VisManager* visManager = new G4VisExecutive;
93  visManager->Initialize();
94 #endif
95 
96  // UserAction classes
97  runManager->SetUserAction(new ExP02PrimaryGeneratorAction());
98 
99  //Initialize G4 kernel
100  runManager->Initialize();
101 
102  //get the pointer to the User Interface manager
103  G4UImanager * UImanager = G4UImanager::GetUIpointer();
104 
105 #ifdef G4UI_USE
106  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
107 #ifdef G4VIS_USE
108  UImanager->ApplyCommand("/control/execute vis.mac");
109 #endif
110  ui->SessionStart();
111  delete ui;
112 #endif
113 
114 #ifdef G4VIS_USE
115  delete visManager;
116 #endif
117  delete runManager;
118 
119  return 0;
120 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Detector construction reader using ROOT I/O.
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4GLOB_DLL std::ostream G4cout
void Initialize()
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
virtual void SetUserAction(G4UserRunAction *userAction)

Here is the call graph for this function: