musr.cc

Go to the documentation of this file.
00001 #include "alc01DetectorConstruction.hh"
00002 #include "alc01PhysicsList.hh"
00003 #include "alc01PrimaryGeneratorAction.hh"
00004 #include "alc01RunAction.hh"
00005 #include "alc01EventAction.hh"
00006 #include "alc01SteppingAction.hh"
00007 #include "alc01SteppingVerbose.hh"
00008 
00009 #include "G4RunManager.hh"
00010 #include "G4UImanager.hh"
00011 #include "G4UIterminal.hh"
00012 #include "G4UItcsh.hh"
00013 
00014 #include "Randomize.hh"
00015 
00016 #ifdef G4VIS_USE
00017 #include "alc01VisManager.hh"
00018 #endif
00019 
00020 
00021 int main(int argc,char** argv) {
00022 
00023   // choose the Random engine
00024   HepRandom::setTheEngine(new RanecuEngine);
00025 
00026   //my Verbose output class
00027   G4VSteppingVerbose::SetInstance(new alc01SteppingVerbose);
00028   
00029   // Run manager
00030   G4RunManager * runManager = new G4RunManager;
00031 
00032   // UserInitialization classes (mandatory)
00033   alc01DetectorConstruction* alc01detector = new alc01DetectorConstruction;
00034   runManager->SetUserInitialization(alc01detector);
00035   runManager->SetUserInitialization(new alc01PhysicsList);
00036   
00037 #ifdef G4VIS_USE
00038   // Visualization, if you choose to have it!
00039   G4VisManager* visManager = new alc01VisManager;
00040   visManager->Initialize();
00041 #endif
00042    
00043   // UserAction classes
00044   runManager->SetUserAction(new alc01PrimaryGeneratorAction(alc01detector));
00045   runManager->SetUserAction(new alc01RunAction);  
00046   runManager->SetUserAction(new alc01EventAction);
00047   runManager->SetUserAction(new alc01SteppingAction);
00048 
00049   //Initialize G4 kernel
00050   runManager->Initialize();
00051       
00052   //get the pointer to the User Interface manager 
00053   G4UImanager * UI = G4UImanager::GetUIpointer();  
00054 
00055   if(argc==1)
00056   // Define (G)UI terminal for interactive mode  
00057   { 
00058     // G4UIterminal is a (dumb) terminal.
00059     G4UIsession * session = 0;
00060 #ifdef G4UI_USE_TCSH
00061       session = new G4UIterminal(new G4UItcsh);      
00062 #else
00063       session = new G4UIterminal();
00064 #endif    
00065 
00066     UI->ApplyCommand("/control/execute vis.mac");    
00067     session->SessionStart();
00068     delete session;
00069   }
00070   else
00071   // Batch mode
00072   { 
00073     G4String command = "/control/execute ";
00074     G4String fileName = argv[1];
00075     UI->ApplyCommand(command+fileName);
00076   }
00077 
00078 #ifdef G4VIS_USE
00079   delete visManager;
00080 #endif
00081   delete runManager;
00082 
00083   return 0;
00084 }
00085 
00086 
00087 

Generated on Mon Mar 27 12:19:54 2006 for MUSR by  doxygen 1.4.6