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 10.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/FissionFragment/FissionFragment.cc (Version 11.3.0) and /examples/extended/hadronic/FissionFragment/FissionFragment.cc (Version 11.2)


  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 // -------------------------------------------     26 // -------------------------------------------------------------
 27 //      GEANT4 FF_Neutron_HP                       27 //      GEANT4 FF_Neutron_HP
 28 //                                                 28 //
 29 //  Command line options:                          29 //  Command line options:
 30 //      -i ARG      : run in batch mode from s     30 //      -i ARG      : run in batch mode from script file ARG
 31 //      -o ARG      : write output to file ARG     31 //      -o ARG      : write output to file ARG
 32 //                    (defaults to FF_Neutron_     32 //                    (defaults to FF_Neutron_HP.out)
 33 //      -n ARG      : multithreading with ARG      33 //      -n ARG      : multithreading with ARG number of threads
 34 //                    (only works if Geant4 wa     34 //                    (only works if Geant4 was compiled with
 35 //                    multithreading enables)      35 //                    multithreading enables)
 36 //                                                 36 //
 37 //  =============== Begin Documentation Commen     37 //  =============== Begin Documentation Comments ===============
 38 //!                                                38 //!
 39 //! \file       FissionFragment.cc                 39 //! \file       FissionFragment.cc
 40 //! \author     B. Wendt (brycen.linn.wendt@ce     40 //! \author     B. Wendt (brycen.linn.wendt@cern.ch)
 41 //! \date       June 06, 2014                      41 //! \date       June 06, 2014
 42 //!                                                42 //!
 43 //! \brief      Main program of the FissionFra     43 //! \brief      Main program of the FissionFragment example
 44 //!                                                44 //!
 45 //! \details    Application demonstrating the      45 //! \details    Application demonstrating the Fission Fragment model as used
 46 //!                 within the neutron_hp mode     46 //!                 within the neutron_hp model. It demostrates the capability
 47 //!                 for fission product contai     47 //!                 for fission product containment by the cladding in a water
 48 //!                 moderated sub-critical ass     48 //!                 moderated sub-critical assembly.
 49 //!             It could also be further exten     49 //!             It could also be further extended to calculate the effective
 50 //!                 multiplication factor of t     50 //!                 multiplication factor of the subcritical assembly for
 51 //!                 various loading schemes.       51 //!                 various loading schemes.
 52 //!                                                52 //!
 53 //  ================ End Documentation Comment     53 //  ================ End Documentation Comments ================
 54 //                                                 54 //
 55 //  Modified:                                      55 //  Modified:
 56 //                                                 56 //
 57 //  05-08-20                                       57 //  05-08-20                                              ARibon
 58 //  Replaced deprecated HP environmental varia     58 //  Replaced deprecated HP environmental variables with UI commands
 59 //  23-06-14                                       59 //  23-06-14                                              BWendt
 60 //  Added check for NeutronHP fission generato     60 //  Added check for NeutronHP fission generator environment variable
 61 //                                                 61 //
 62 // -------------------------------------------     62 // -------------------------------------------------------------
 63                                                    63 
 64 #include "FFActionInitialization.hh"           <<  64 #include "globals.hh"
 65 #include "FFDetectorConstruction.hh"           << 
 66 #include "QGSP_BIC_HP.hh"                      << 
 67                                                    65 
 68 #include "G4ParticleHPManager.hh"              << 
 69 #include "G4RunManagerFactory.hh"                  66 #include "G4RunManagerFactory.hh"
 70 #include "G4UIExecutive.hh"                    <<  67 
 71 #include "G4UImanager.hh"                          68 #include "G4UImanager.hh"
 72 #include "G4VisExecutive.hh"                   <<  69 #include "QGSP_BIC_HP.hh"
 73 #include "Randomize.hh"                            70 #include "Randomize.hh"
 74 #include "globals.hh"                          <<  71 
                                                   >>  72 #include "FFDetectorConstruction.hh"
                                                   >>  73 #include "FFActionInitialization.hh"
                                                   >>  74 
                                                   >>  75 #include "G4VisExecutive.hh"
                                                   >>  76 #include "G4UIExecutive.hh"
                                                   >>  77 
                                                   >>  78 #include "G4ParticleHPManager.hh"
 75                                                    79 
 76 // Entry point                                     80 // Entry point
 77 //....oooOO0OOooo........oooOO0OOooo........oo     81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 78 int main(int argc, char* argv[])                   82 int main(int argc, char* argv[])
 79 {                                                  83 {
 80   int result;                                  <<  84     int result;
 81   unsigned int numberOfThreads = 1;            <<  85     unsigned int numberOfThreads = 1;
 82                                                << 
 83   G4String scriptFileName = "";                << 
 84   G4String outputFileName = "FF_Neutron_HP.out << 
 85   G4UImanager* UIManager = NULL;               << 
 86                                                << 
 87   // Activate production of fission fragments  << 
 88   G4ParticleHPManager::GetInstance()->SetProdu << 
 89                                                << 
 90   char Force[] = "G4FORCENUMBEROFTHREADS";     << 
 91   if (std::getenv(Force) != NULL) {            << 
 92     char doNotForce[] = "G4FORCENUMBEROFTHREAD << 
 93     putenv(doNotForce);                        << 
 94   }                                            << 
 95                                                << 
 96   // Indicate the example is starting          << 
 97   G4cout << "####   Starting: " << argv[0] <<  << 
 98                                                << 
 99   //  Parse the command line arguments, if any << 
100   for (int i = 1; i < argc; i += 2) {          << 
101     // Ensure that this is actually a command  << 
102     if (argv[i][0] != '-') {                   << 
103       G4cerr << G4endl << "!!!!" << G4endl;    << 
104       G4cerr << "!!!! Error in argument " << i << 
105       G4cerr << "!!!! A command-line option wa << 
106              << G4endl;                        << 
107       G4cerr << "!!!! " << argv[0] << " will n << 
108       G4cerr << "!!!!" << G4endl << G4endl;    << 
109                                                    86 
110       return EXIT_FAILURE;                     <<  87     G4String scriptFileName = "";
                                                   >>  88     G4String outputFileName = "FF_Neutron_HP.out";
                                                   >>  89     G4UImanager* UIManager = NULL;
                                                   >>  90 
                                                   >>  91     // Activate production of fission fragments in neutronHP
                                                   >>  92     G4ParticleHPManager::GetInstance()->SetProduceFissionFragments( true );
                                                   >>  93 
                                                   >>  94     char Force[] = "G4FORCENUMBEROFTHREADS";
                                                   >>  95     if(std::getenv(Force) != NULL) {
                                                   >>  96        char doNotForce[]="G4FORCENUMBEROFTHREADS=1";
                                                   >>  97        putenv(doNotForce);
111     }                                              98     }
112                                                    99 
113     // Ensure that the command-line option has << 100     // Indicate the example is starting
114     if (!(i + 1 < argc)) {                     << 101     G4cout << "####   Starting: " << argv[0] << "    ####" << G4endl;
115       G4cerr << G4endl << "!!!!" << G4endl;    << 
116       G4cerr << "!!!! Error in argument " << i << 
117       G4cerr << "!!!! An argument was expected << 
118       G4cerr << "!!!! Ensure that a space is u << 
119                 "option and argument"          << 
120              << G4endl;                        << 
121       G4cerr << "!!!! " << argv[0] << " will n << 
122       G4cerr << "!!!!" << G4endl << G4endl;    << 
123                                                   102 
124       return EXIT_FAILURE;                     << 103     //  Parse the command line arguments, if any
125     }                                          << 104     for(int i = 1;
                                                   >> 105         i < argc;
                                                   >> 106         i += 2)
                                                   >> 107     {
                                                   >> 108         // Ensure that this is actually a command
                                                   >> 109         if(argv[i][0] != '-')
                                                   >> 110         {
                                                   >> 111             G4cerr << G4endl << "!!!!" << G4endl;
                                                   >> 112             G4cerr << "!!!! Error in argument " << i + 1 << G4endl;
                                                   >> 113             G4cerr << "!!!! A command-line option was expected, but \""
                                                   >> 114                    << argv[i] << "\" was found" << G4endl;
                                                   >> 115             G4cerr << "!!!! " << argv[0] << " will now terminate" << G4endl;
                                                   >> 116             G4cerr << "!!!!" << G4endl << G4endl;
                                                   >> 117 
                                                   >> 118             return EXIT_FAILURE;
                                                   >> 119         }
126                                                   120 
127     switch (argv[i][1]) {                      << 121         // Ensure that the command-line option has an associated argument
128       case 'i':                                << 122         if(!(i + 1 < argc))
129         scriptFileName = "/control/execute ";  << 123         {
130         scriptFileName.append(argv[i + 1]);    << 124             G4cerr << G4endl << "!!!!" << G4endl;
131         break;                                 << 125             G4cerr << "!!!! Error in argument " << i + 2 << G4endl;
132                                                << 126             G4cerr << "!!!! An argument was expected, but \"" << argv[i + 1]
133       case 'o':                                << 127                    << "\" was found" << G4endl;
134         outputFileName = argv[i + 1];          << 128             G4cerr << "!!!! Ensure that a space is used to separate the "
135         break;                                 << 129                       "option and argument" << G4endl;
136                                                << 130             G4cerr << "!!!! " << argv[0] << " will now terminate" << G4endl;
137       case 'n':                                << 131             G4cerr << "!!!!" << G4endl << G4endl;
138         result = sscanf(argv[i + 1], "%u", &nu << 
139         if (result != 1) {                     << 
140           G4cerr << G4endl << "!!!!" << G4endl << 
141           G4cerr << "!!!! Error in argument "  << 
142           G4cerr << "!!!! An positive number w << 
143                  << G4endl;                    << 
144           G4cerr << "!!!! " << argv[0] << " wi << 
145           G4cerr << "!!!!" << G4endl << G4endl << 
146                                                   132 
147           return EXIT_FAILURE;                 << 133             return EXIT_FAILURE;
148         }                                         134         }
149         break;                                 << 
150                                                   135 
151       default:                                 << 136         switch(argv[i][1])
152         G4cout << G4endl << "!!!!" << G4endl;  << 137         {
153         G4cout << "!!!! Warning for command "  << 138         case 'i':
154         G4cout << "!!!! \"" << argv[i] << "\"  << 139             scriptFileName = "/control/execute ";
155         G4cout << "!!!! " << argv[0] << " will << 140             scriptFileName.append(argv[i + 1]);
156                << "\"" << G4endl;              << 141             break;
157         G4cout << "!!!!" << G4endl << G4endl;  << 142 
                                                   >> 143         case 'o':
                                                   >> 144             outputFileName = argv[i + 1];
                                                   >> 145             break;
                                                   >> 146 
                                                   >> 147         case 'n':
                                                   >> 148             result = sscanf(argv[i + 1],
                                                   >> 149                             "%u",
                                                   >> 150                             &numberOfThreads);
                                                   >> 151             if(result != 1)
                                                   >> 152             {
                                                   >> 153                 G4cerr << G4endl << "!!!!" << G4endl;
                                                   >> 154                 G4cerr << "!!!! Error in argument " << i + 2 << G4endl;
                                                   >> 155                 G4cerr << "!!!! An positive number was expected, but \""
                                                   >> 156                        << argv[i + 1] << "\" was found" << G4endl;
                                                   >> 157                 G4cerr << "!!!! " << argv[0] << " will now terminate"
                                                   >> 158                        << G4endl;
                                                   >> 159                 G4cerr << "!!!!" << G4endl << G4endl;
                                                   >> 160 
                                                   >> 161                 return EXIT_FAILURE;
                                                   >> 162             }
                                                   >> 163             break;
                                                   >> 164 
                                                   >> 165         default:
                                                   >> 166             G4cout << G4endl << "!!!!" << G4endl;
                                                   >> 167             G4cout << "!!!! Warning for command " << i + 1 << G4endl;
                                                   >> 168             G4cout << "!!!! \"" << argv[i] << "\" is not a valid command"
                                                   >> 169                    << G4endl;
                                                   >> 170             G4cout << "!!!! " << argv[0] << " will ignore \"" << argv[i]
                                                   >> 171                    << "\" and \"" << argv[i + 1] << "\"" << G4endl;
                                                   >> 172             G4cout << "!!!!" << G4endl << G4endl;
                                                   >> 173         }
                                                   >> 174     }
                                                   >> 175 
                                                   >> 176     // Instantiate G4UIExecutive if interactive mode
                                                   >> 177     G4UIExecutive* ui = nullptr;
                                                   >> 178     if (scriptFileName.length() == 0) {
                                                   >> 179       ui = new G4UIExecutive(argc, argv);
158     }                                             180     }
159   }                                            << 
160                                                   181 
161   // Instantiate G4UIExecutive if interactive  << 182     // Set the Random engine
162   G4UIExecutive* ui = nullptr;                 << 183     // A seed of 62737819 produced a maximum number of 67 events on the
163   if (scriptFileName.length() == 0) {          << 184     // author's system before timing out the nightly test
164     ui = new G4UIExecutive(argc, argv);        << 185     const G4long seed = 62737819;
165   }                                            << 
166                                                << 
167   // Set the Random engine                     << 
168   // A seed of 62737819 produced a maximum num << 
169   // author's system before timing out the nig << 
170   const G4long seed = 62737819;                << 
171 #ifndef NDEBUG                                    186 #ifndef NDEBUG
172   G4cout << "MT RNG Seed: " << seed << G4endl; << 187     G4cout << "MT RNG Seed: " << seed << G4endl;
173 #endif  // NDEBUG                              << 188 #endif // NDEBUG
174   G4Random::setTheEngine(new CLHEP::MTwistEngi << 189     G4Random::setTheEngine(new CLHEP::MTwistEngine(seed));
175                                                << 190 
176   // Initialize the multithreaded run manager  << 191     // Initialize the multithreaded run manager
177   auto* runManager = G4RunManagerFactory::Crea << 192     auto* runManager = G4RunManagerFactory::CreateRunManager();
178   runManager->SetNumberOfThreads(numberOfThrea << 193     runManager->SetNumberOfThreads(numberOfThreads);
179   G4cout << "    Threads requested:    " << nu << 194     G4cout << "    Threads requested:    " << numberOfThreads << G4endl;
180   G4cout << "    Threads started:      " << ru << 195     G4cout << "    Threads started:      " << runManager->GetNumberOfThreads() << G4endl;
181                                                << 196 
182   // Set mandatory initialization classes      << 197     // Set mandatory initialization classes
183   runManager->SetUserInitialization(new FFDete << 198     runManager->SetUserInitialization(new FFDetectorConstruction());
184   runManager->SetUserInitialization(new QGSP_B << 199     runManager->SetUserInitialization(new QGSP_BIC_HP());
185   runManager->SetUserInitialization(new FFActi << 200     runManager->SetUserInitialization(new FFActionInitialization());
186                                                << 201 
187   // Initialize the Geant4 kernel              << 202     // Initialize the Geant4 kernel
188   runManager->Initialize();                    << 203     runManager->Initialize();
189                                                << 204 
190   // Initialize visualization                  << 205     // Initialize visualization
191   G4VisManager* visManager = new G4VisExecutiv << 206     G4VisManager* visManager = new G4VisExecutive();
192   visManager->Initialize();                    << 207     visManager->Initialize();
193                                                << 208 
194   // Get the pointer to the User Interface man << 209     // Get the pointer to the User Interface manager
195   UIManager = G4UImanager::GetUIpointer();     << 210     UIManager = G4UImanager::GetUIpointer();
196                                                << 211 
197   if (!ui) {                                   << 212     if(!ui)
198     // Batch mode                              << 213     {
199     UIManager->ApplyCommand(scriptFileName);   << 214         // Batch mode
200   }                                            << 215         UIManager->ApplyCommand(scriptFileName);
201   else {                                       << 216     } else
202     // Interactive mode                        << 217     {
203     ui->SessionStart();                        << 218         // Interactive mode
204     delete ui;                                 << 219         ui->SessionStart();
205   }                                            << 220         delete ui;
206                                                << 221     }
207   // Job termination                           << 
208   // Free the store: user actions, physics_lis << 
209   // owned and deleted by the run manager, so  << 
210   // in the main() program !                   << 
211   delete visManager;                           << 
212   delete runManager;                           << 
213                                                   222 
214   return 0;                                    << 223     // Job termination
                                                   >> 224     // Free the store: user actions, physics_list and detector_description are
                                                   >> 225     // owned and deleted by the run manager, so they should not be deleted
                                                   >> 226     // in the main() program !
                                                   >> 227     delete visManager;
                                                   >> 228     delete runManager;
                                                   >> 229 
                                                   >> 230     return 0;
215 }                                                 231 }
                                                   >> 232 
                                                   >> 233 
216                                                   234