Warning, file /geant4/examples/advanced/HGCal_testbeam/hgcal_testbeam.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #include "DetectorConstruction.hh"
0028 #include "ActionInitialization.hh"
0029
0030 #include "G4RunManagerFactory.hh"
0031
0032 #include "G4UImanager.hh"
0033 #include "FTFP_BERT.hh"
0034 #include "FTFPCMS_BERT_EMM.hh"
0035 #include "G4PhysListFactory.hh"
0036
0037 #include "G4VisExecutive.hh"
0038 #include "G4UIExecutive.hh"
0039
0040 #include "Randomize.hh"
0041
0042
0043
0044 int main(int argc,char** argv)
0045 {
0046
0047
0048 G4UIExecutive* ui = 0;
0049 if ( argc == 1 ) {
0050 ui = new G4UIExecutive(argc, argv);
0051 }
0052
0053
0054 auto* runManager =
0055 G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
0056
0057
0058
0059
0060 runManager->SetUserInitialization(new DetectorConstruction());
0061
0062
0063
0064 G4VModularPhysicsList* physicsList = nullptr;
0065 G4String physName = "";
0066 char* PLenv = std::getenv("PHYSLIST");
0067 if (PLenv)
0068 physName = G4String(PLenv);
0069 if ("FTFP_BERT_EMM" == physName || "FTFPCMS_BERT_EMM" == physName)
0070 physicsList = new FTFPCMS_BERT_EMM;
0071 else if ("" == physName)
0072 {
0073 physName = "FTFP_BERT";
0074 physicsList = new FTFP_BERT;
0075 }
0076 if (!physicsList)
0077 {
0078 G4PhysListFactory factory;
0079 physicsList = factory.GetReferencePhysList(physName);
0080 }
0081 if (!physicsList)
0082 {
0083 G4ExceptionDescription msg;
0084 msg << "Unknown physics list defined in environment variable PHYSLIST: " << PLenv << "\n";
0085 msg<< "Consider extension of main to take it into account.\n";
0086 G4Exception("HGCal_testbeam::main()", "UnknownPhysicsList", FatalException, msg);
0087 }
0088 physicsList->SetVerboseLevel(1);
0089 runManager->SetUserInitialization(physicsList);
0090
0091
0092 runManager->SetUserInitialization(new ActionInitialization());
0093
0094
0095
0096 G4UImanager* UImanager = G4UImanager::GetUIpointer();
0097
0098
0099
0100 if ( ! ui ) {
0101
0102 G4String command = "/control/execute ";
0103 G4String fileName = argv[1];
0104 UImanager->ApplyCommand(command+fileName);
0105 }
0106 else {
0107
0108 G4VisManager *visManager = new G4VisExecutive;
0109
0110
0111 visManager->Initialize();
0112
0113
0114 UImanager->ApplyCommand("/control/execute init_vis.mac");
0115 ui->SessionStart();
0116 delete ui;
0117 delete visManager;
0118 }
0119
0120
0121
0122
0123
0124
0125 delete runManager;
0126 }
0127
0128