Functions
g4lbnf.cc File Reference
#include <getopt.h>
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4DecayTable.hh"
#include "G4KL3DecayChannel.hh"
#include "G4StepLimiter.hh"
#include "G4ParticleTable.hh"
#include "G4ProcessManager.hh"
#include "G4VEnergyLossProcess.hh"
#include "LBNEDetectorConstruction.hh"
#include "G4PhysListFactory.hh"
#include "LBNEPrimaryGeneratorAction.hh"
#include "LBNEEventAction.hh"
#include "LBNEStackingAction.hh"
#include "LBNESteppingAction.hh"
#include "LBNETrackingAction.hh"
#include "LBNERunAction.hh"
#include "LBNERunManager.hh"
#include "LBNESurveyor.hh"
#include "LBNEVolumePlacements.hh"
#include "LBNEPlacementMessenger.hh"
#include "VersionAndContext.hh"

Go to the source code of this file.

Functions

void DisplayHelp ()
 
int main (int argc, char **argv)
 

Function Documentation

void DisplayHelp ( )

Definition at line 48 of file g4lbnf.cc.

49 {
50  // Helpful help message goes here
51  G4cout << "" << G4endl;
52  G4cout << "-------------------------------------------------" << G4endl;
53  G4cout << "G4LBNF Help" << G4endl;
54  G4cout << "Usage:" << G4endl;
55  G4cout << " /path/to/g4lbne --input /path/to/inputfile ";
56  G4cout << "--physicslist physlistname /path/to/macrofile" << G4endl;
57  G4cout << "ALTERNATELY: " << G4endl;
58  G4cout << " /path/to/g4lbne -i /path/to/inputfile -p physlistname ";
59  G4cout << "/path/to/macrofile " << G4endl;
60  G4cout << "The default physics list is QGSP_BERT" << G4endl;
61  G4cout << "The options --help or -h display this message " << G4endl;
62  G4cout << "-------------------------------------------------" << G4endl;
63  G4cout << "" << G4endl;
64 }
int main ( int  argc,
char **  argv 
)

Definition at line 66 of file g4lbnf.cc.

67 {
68 
69  G4String macroFileName = "";
70  G4String inputFileName = "";
71  G4String physListName = "QGSP_BERT"; // default
72 
74 
75  // Parse Arguments
76  int c;
77  while(1){
78  int option_index = 0;
79  static struct option long_options[] = {
80  {"help", 0, 0, 0},
81  {"input", required_argument, 0, 0},
82  {"physicslist", required_argument, 0, 0},
83  {0,0,0,0}
84  };
85  c = getopt_long(argc, argv, "hi:p:", long_options, &option_index);
86  if(c == -1) break;
87  switch (c) {
88  case 0:
89  switch(option_index){
90  case 0: // --help
91  DisplayHelp();
92  exit(0);
93  case 1: // --input
94  inputFileName = optarg;
95  break;
96  case 2: // --physicslist
97  physListName = optarg;
98  break;
99  }
100  break;
101  case 'h':
102  DisplayHelp();
103  exit(0);
104  break;
105  case 'i':
106  inputFileName = optarg;
107  break;
108  case 'p':
109  physListName = optarg;
110  break;
111  }
112  }
113  if(optind < argc){
114  G4cout << "Setting macroFile to " << argv[argc-1] << G4endl;
115  macroFileName = argv[argc-1];
116  }
117  std::string aNameTmp(macroFileName);
118  versionContext->SetMacroFileName(aNameTmp);
119  std::string aNameTmp2(physListName);
120  versionContext->SetPhysicsList(aNameTmp2);
121 
122  // Invoke both the Surveoyr class and the Volume placement
123  // such the internal variable are define and the messenger are set
124  // prior to declare a run
125 
127 // std::cerr << " LBNESurveyor created " << std::endl;
128 
131 
132 // The class that sets up the geometry..
133 
135 
136  // get the pointer to the UI manager and set verbosities
137  G4UImanager* UI = G4UImanager::GetUIpointer();
138 
139  // Construct the default run manager
140  LBNERunManager* runManager = new LBNERunManager();
141 
142  runManager->SetPhysicsListName(physListName);
143 
144  runManager->SetUserInitialization(theDetector);
145  // set user action classes
146 
147 #ifdef G4VIS_USE
148  // Visualization, if you choose to have it!
149  G4VisManager* visManager = new LBNEVisManager;
150  visManager->Initialize();
151 #endif
152 
153  if(argc==1)
154  // Define (G)UI terminal for interactive mode
155  {
156  /*
157  G4UIsession * session = 0;
158 
159  // G4UIterminal is a (dumb) terminal.
160 #ifdef G4UI_USE_TCSH
161  session = new G4UIterminal(new G4UItcsh);
162 #else
163  session = new G4UIterminal();
164 #endif
165 
166  session->SessionStart();
167  delete session;
168  */
169  // G4UIExecutive* ui = new G4UIExecutive(argc,argv,"tcsh");
170  G4UIExecutive* ui = new G4UIExecutive(argc,argv);
171  ui->SessionStart();
172  delete ui;
173 
174  }
175  else // Batch mode
176  {
177  G4String command = "/control/execute ";
178  G4cout << "Executing " << command+macroFileName << G4endl;
179  UI->ApplyCommand(command+macroFileName);
180  }
181 
182 # // job termination
183  G4cout<<"Delete RunManager"<<G4endl;
184  delete runManager;
185  return 0;
186 }
void SetPhysicsList(std::string &val)
std::string string
Definition: nybbler.cc:12
static LBNEVolumePlacements * Instance()
int command
static VersionAndContext * Instance()
static LBNESurveyor * Instance()
void DisplayHelp()
Definition: g4lbnf.cc:48
void SetPhysicsListName(G4String &t)
void SetMacroFileName(std::string &val)
static LBNEPlacementMessenger * Instance()