LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
channeling.cc File Reference
#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4ScoringManager.hh"
#include "G4UImanager.hh"
#include "PrimaryGeneratorAction.hh"
#include "StackingAction.hh"
#include "EventAction.hh"
#include "RunAction.hh"
#include "DetectorConstruction.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "FTFP_BERT.hh"
#include "G4EmStandardPhysics_option4_channeling.hh"
#include "G4ChannelingPhysics.hh"
#include "G4GenericBiasingPhysics.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 62 of file channeling.cc.

63 {
64  // Detect interactive mode (if no arguments) and define UI session
65  //
66  G4UIExecutive* ui = 0;
67  if ( argc == 1 ) {
68  ui = new G4UIExecutive(argc, argv);
69  }
70 
71  // Construct the default run manager
72 #ifdef G4MULTITHREADED
73  G4MTRunManager* runManager = new G4MTRunManager;
74  runManager->SetNumberOfThreads(G4Threading::G4GetNumberOfCores() - 2);
75 #else
76  G4RunManager* runManager = new G4RunManager;
77 #endif
78 
79  // Activate UI-command base scorer
80  G4ScoringManager * scManager = G4ScoringManager::GetScoringManager();
81  scManager->SetVerboseLevel(0);
82 
83  // Set mandatory initialization classes
84  G4VModularPhysicsList* physlist= new FTFP_BERT();
85  G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics();
86  physlist->RegisterPhysics(new G4ChannelingPhysics());
87  physlist->ReplacePhysics(new G4EmStandardPhysics_option4_channeling());
88  //physlist->ReplacePhysics(new G4EmStandardPhysicsSS_channeling());
89  biasingPhysics->PhysicsBiasAllCharged();
90  physlist->RegisterPhysics(biasingPhysics);
91  runManager->SetUserInitialization(physlist);
92 
93 #ifndef G4MULTITHREADED
94  // Set user action classes
95  runManager->SetUserAction(new PrimaryGeneratorAction());
96  runManager->SetUserAction(new EventAction());
97  runManager->SetUserAction(new StackingAction());
98  runManager->SetUserAction(new RunAction());
99 #else
100  runManager->SetUserInitialization(new UserActionInitialization());
101 #endif
102 
103  runManager->SetUserInitialization(new DetectorConstruction());
104 
105  // Initialize visualization
106  //
107  G4VisManager* visManager = new G4VisExecutive;
108  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
109  // G4VisManager* visManager = new G4VisExecutive("Quiet");
110  visManager->Initialize();
111 
112  // Get the pointer to the User Interface manager
113  G4UImanager* UImanager = G4UImanager::GetUIpointer();
114 
115  // Process macro or start UI session
116  //
117  if ( ! ui ) {
118  // batch mode
119  G4String command = "/control/execute ";
120  G4String fileName = argv[1];
121  UImanager->ApplyCommand(command+fileName);
122  }
123  else {
124  // interactive mode
125  UImanager->ApplyCommand("/control/execute init_vis.mac");
126  ui->SessionStart();
127  delete ui;
128  }
129 
130 
131  // Job termination
132  // Free the store: user actions, physics_list and detector_description are
133  // owned and deleted by the run manager, so they should not be deleted
134  // in the main() program !
135 
136  delete visManager;
137  delete runManager;
138 
139  return 0;
140 }