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.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/hadronic/Hadr02/Hadr02.cc (Version 11.3.0) and /examples/extended/hadronic/Hadr02/Hadr02.cc (Version 10.3.p3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 /// \file hadronic/Hadr02/Hadr02.cc                26 /// \file hadronic/Hadr02/Hadr02.cc
 27 /// \brief Main program of the hadronic/Hadr02     27 /// \brief Main program of the hadronic/Hadr02 example
 28 //                                                 28 //
                                                   >>  29 // $Id: Hadr02.cc 77519 2013-11-25 10:54:57Z gcosmo $
 29 //                                                 30 //
 30 // -------------------------------------------     31 // -------------------------------------------------------------
 31 //      GEANT4 Hadr02                              32 //      GEANT4 Hadr02
 32 //                                                 33 //
 33 //  Application demonstrating Geant4 hadronic      34 //  Application demonstrating Geant4 hadronic cross sections
 34 //                                                 35 //
 35 //  Author: V.Ivanchenko 20 June 2008              36 //  Author: V.Ivanchenko 20 June 2008
 36 //                                                 37 //
 37 //  Modified:                                  <<  38 //  Modified: 
 38 //                                                 39 //
 39 // -------------------------------------------     40 // -------------------------------------------------------------
 40 //                                                 41 //
 41 //                                                 42 //
 42 #include "CRMC_FTFP_BERT.hh"                   <<  43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  45 
                                                   >>  46 #include "G4RunManager.hh"
                                                   >>  47 #include "G4UImanager.hh"
                                                   >>  48 #include "Randomize.hh"
                                                   >>  49 
 43 #include "DetectorConstruction.hh"                 50 #include "DetectorConstruction.hh"
 44 #include "EventAction.hh"                      <<  51 #include "G4PhysListFactory.hh"
 45 #include "HistoManager.hh"                     <<  52 #include "G4VModularPhysicsList.hh"
 46 #include "PrimaryGeneratorAction.hh"               53 #include "PrimaryGeneratorAction.hh"
                                                   >>  54 
 47 #include "RunAction.hh"                            55 #include "RunAction.hh"
                                                   >>  56 #include "EventAction.hh"
 48 #include "StackingAction.hh"                       57 #include "StackingAction.hh"
 49 #include "UrQMD.hh"                            <<  58 #include "HistoManager.hh"
 50                                                    59 
 51 #include "G4PhysListFactory.hh"                <<  60 #ifdef G4VIS_USE
 52 #include "G4RunManagerFactory.hh"              << 
 53 #include "G4UIExecutive.hh"                    << 
 54 #include "G4UImanager.hh"                      << 
 55 #include "G4VModularPhysicsList.hh"            << 
 56 #include "G4VisExecutive.hh"                       61 #include "G4VisExecutive.hh"
 57 #include "Randomize.hh"                        <<  62 #endif
                                                   >>  63 
                                                   >>  64 #ifdef G4UI_USE
                                                   >>  65 #include "G4UIExecutive.hh"
                                                   >>  66 #endif
                                                   >>  67 
                                                   >>  68 #include "UrQMD.hh"
                                                   >>  69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 58                                                    70 
 59 int main(int argc, char** argv)                <<  71 int main(int argc,char** argv) {
 60 {                                              << 
 61   // detect interactive mode (if no arguments) << 
 62   G4UIExecutive* ui = nullptr;                 << 
 63   if (argc == 1) ui = new G4UIExecutive(argc,  << 
 64                                                    72 
 65   // choose the Random engine                  <<  73   //choose the Random engine
 66   CLHEP::HepRandom::setTheEngine(new CLHEP::Ra     74   CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine());
 67                                                    75 
 68   // Construct a serial run manager            <<  76   //Construct the default run manager
 69   auto* runManager = G4RunManagerFactory::Crea <<  77   G4RunManager * runManager = new G4RunManager();
 70                                                    78 
 71   // set mandatory initialization classes      <<  79   //set mandatory initialization classes
 72   runManager->SetUserInitialization(new Detect     80   runManager->SetUserInitialization(new DetectorConstruction());
 73                                                    81 
 74   G4PhysListFactory factory;                       82   G4PhysListFactory factory;
 75   G4VModularPhysicsList* phys = 0;                 83   G4VModularPhysicsList* phys = 0;
 76                                                    84 
 77   // default Physics List for this example         85   // default Physics List for this example
 78   G4String physName = "QBBC";                      86   G4String physName = "QBBC";
 79                                                    87 
 80   // Physics List name defined via 2nd argumen     88   // Physics List name defined via 2nd argument
 81   if (argc == 3) {                             <<  89   if (argc==3) { physName = argv[2]; }
 82     physName = argv[2];                        << 
 83   }                                            << 
 84   else {                                       << 
 85     char* path = std::getenv("PHYSLIST");      << 
 86     if (path) {                                << 
 87       physName = G4String(path);               << 
 88     }                                          << 
 89   }                                            << 
 90   if (physName == "UrQMD") {                   << 
 91     phys = new UrQMD;                          << 
 92   }                                            << 
 93   else if (physName == "CRMC_FTFP_BERT") {     << 
 94     phys = new CRMC_FTFP_BERT;                 << 
 95   }                                            << 
 96   else {                                           90   else {
 97     phys = factory.GetReferencePhysList(physNa <<  91     char* path = getenv("PHYSLIST");
                                                   >>  92     if (path) { physName = G4String(path); }
 98   }                                                93   }
                                                   >>  94   if ( physName == "UrQMD" ) { phys = new UrQMD; }
                                                   >>  95   else { phys = factory.GetReferencePhysList(physName); }
 99                                                    96 
100   // Physics List is defined via environment v     97   // Physics List is defined via environment variable PHYSLIST
101   if (!phys) {                                 <<  98   if(!phys) {
102     G4cout << "Hadr02 FATAL ERROR: Physics Lis <<  99     G4cout << "Hadr02 FATAL ERROR: Physics List is not defined"
                                                   >> 100            << G4endl;
103     return 1;                                     101     return 1;
104   }                                               102   }
105   runManager->SetUserInitialization(phys);        103   runManager->SetUserInitialization(phys);
106   HistoManager::GetPointer()->SetPhysicsList(p    104   HistoManager::GetPointer()->SetPhysicsList(phys);
107                                                   105 
108   runManager->SetUserAction(new PrimaryGenerat    106   runManager->SetUserAction(new PrimaryGeneratorAction());
109                                                   107 
110   // set user action classes                   << 108   //set user action classes
111   runManager->SetUserAction(new RunAction());     109   runManager->SetUserAction(new RunAction());
112   runManager->SetUserAction(new EventAction())    110   runManager->SetUserAction(new EventAction());
113   runManager->SetUserAction(new StackingAction    111   runManager->SetUserAction(new StackingAction());
114                                                   112 
115   // initialize visualization                  << 113   //get the pointer to the User Interface manager
116   G4VisManager* visManager = new G4VisExecutiv << 
117   visManager->Initialize();                    << 
118                                                << 
119   // get the pointer to the User Interface man << 
120   G4UImanager* UImanager = G4UImanager::GetUIp    114   G4UImanager* UImanager = G4UImanager::GetUIpointer();
                                                   >> 115 #ifdef G4VIS_USE
                                                   >> 116    G4VisManager* visManager = 0;
                                                   >> 117 #endif
                                                   >> 118 
                                                   >> 119   if (argc==1)   // Define UI terminal for interactive mode
                                                   >> 120     {
                                                   >> 121 #ifdef G4VIS_USE
                                                   >> 122       //visualization manager
                                                   >> 123       visManager = new G4VisExecutive;
                                                   >> 124       visManager->Initialize();
                                                   >> 125 #endif
                                                   >> 126 #ifdef G4UI_USE
                                                   >> 127       G4UIExecutive* ui = new G4UIExecutive(argc, argv);
                                                   >> 128       ui->SessionStart();
                                                   >> 129       delete ui;
                                                   >> 130 #endif
                                                   >> 131     }
                                                   >> 132   else           // Batch mode
                                                   >> 133     {
                                                   >> 134      G4String command = "/control/execute ";
                                                   >> 135      G4String fileName = argv[1];
                                                   >> 136      UImanager->ApplyCommand(command+fileName);
                                                   >> 137     }
121                                                   138 
122   if (ui) {                                    << 139   //job termination
123     // interactive mode                        << 140 #ifdef G4VIS_USE
124     ui->SessionStart();                        << 141    delete visManager;
125     delete ui;                                 << 142 #endif
126   }                                            << 
127   else {                                       << 
128     // batch mode                              << 
129     G4String command = "/control/execute ";    << 
130     G4String fileName = argv[1];               << 
131     UImanager->ApplyCommand(command + fileName << 
132   }                                            << 
133                                                << 
134   // job termination                           << 
135   delete visManager;                           << 
136   delete runManager;                              143   delete runManager;
                                                   >> 144 
                                                   >> 145   return 0;
137 }                                                 146 }
                                                   >> 147 
                                                   >> 148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
138                                                   149