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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 10.4.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 // -------------------------------------------     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                                   << 
 58 //  Replaced deprecated HP environmental varia << 
 59 //  23-06-14                                       57 //  23-06-14                                              BWendt
 60 //  Added check for NeutronHP fission generato     58 //  Added check for NeutronHP fission generator environment variable
 61 //                                                 59 //
 62 // -------------------------------------------     60 // -------------------------------------------------------------
 63                                                    61 
 64 #include "FFActionInitialization.hh"           <<  62 #include "globals.hh"
 65 #include "FFDetectorConstruction.hh"           <<  63 
 66 #include "QGSP_BIC_HP.hh"                      <<  64 #ifdef G4MULTITHREADED
                                                   >>  65 #include "G4MTRunManager.hh"
                                                   >>  66 #else
                                                   >>  67 #include "G4RunManager.hh"
                                                   >>  68 #endif // G4MULTITHREADED
 67                                                    69 
 68 #include "G4ParticleHPManager.hh"              << 
 69 #include "G4RunManagerFactory.hh"              << 
 70 #include "G4UIExecutive.hh"                    << 
 71 #include "G4UImanager.hh"                          70 #include "G4UImanager.hh"
 72 #include "G4VisExecutive.hh"                   <<  71 #include "QGSP_BIC_HP.hh"
 73 #include "Randomize.hh"                            72 #include "Randomize.hh"
 74 #include "globals.hh"                          <<  73 
                                                   >>  74 #include "FFDetectorConstruction.hh"
                                                   >>  75 #include "FFActionInitialization.hh"
                                                   >>  76 
                                                   >>  77 #ifdef G4VIS_USE
                                                   >>  78 #include "G4VisExecutive.hh"
                                                   >>  79 #endif
                                                   >>  80 
                                                   >>  81 #ifdef G4UI_USE
                                                   >>  82 #include "G4UIExecutive.hh"
                                                   >>  83 #endif
                                                   >>  84 
 75                                                    85 
 76 // Entry point                                     86 // Entry point
 77 //....oooOO0OOooo........oooOO0OOooo........oo     87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 78 int main(int argc, char* argv[])                   88 int main(int argc, char* argv[])
 79 {                                                  89 {
 80   int result;                                  <<  90     int result;
 81   unsigned int numberOfThreads = 1;            <<  91     unsigned int numberOfThreads = 1;
 82                                                <<  92     
 83   G4String scriptFileName = "";                <<  93     G4String scriptFileName = "";
 84   G4String outputFileName = "FF_Neutron_HP.out <<  94     G4String outputFileName = "FF_Neutron_HP.out";
 85   G4UImanager* UIManager = NULL;               <<  95     G4UImanager* UIManager = NULL;
 86                                                <<  96     
 87   // Activate production of fission fragments  <<  97     char makeFissionFragments[] = "G4NEUTRONHP_PRODUCE_FISSION_FRAGMENTS";
 88   G4ParticleHPManager::GetInstance()->SetProdu <<  98     char useWendtFission[] = "G4NEUTRON_HP_USE_WENDT_FISSION_MODEL";
 89                                                <<  99 
 90   char Force[] = "G4FORCENUMBEROFTHREADS";     << 100     char Force[] = "G4FORCENUMBEROFTHREADS";
 91   if (std::getenv(Force) != NULL) {            << 101     if(getenv(Force) != NULL) {
 92     char doNotForce[] = "G4FORCENUMBEROFTHREAD << 102        char doNotForce[]="G4FORCENUMBEROFTHREADS=1";
 93     putenv(doNotForce);                        << 103        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                                                << 
110       return EXIT_FAILURE;                     << 
111     }                                             104     }
112                                                << 105     
113     // Ensure that the command-line option has << 106     // Indicate the example is starting
114     if (!(i + 1 < argc)) {                     << 107     G4cout << "####   Starting: " << argv[0] << "    ####" << G4endl;
115       G4cerr << G4endl << "!!!!" << G4endl;    << 108     
116       G4cerr << "!!!! Error in argument " << i << 109     // Verify that NeutronHP is going to create fission fragments
117       G4cerr << "!!!! An argument was expected << 110     // Throw and error if it isn't.
118       G4cerr << "!!!! Ensure that a space is u << 111     if(getenv(makeFissionFragments) == NULL)
119                 "option and argument"          << 112     {
120              << G4endl;                        << 113         G4cerr << G4endl << "!!!!" << G4endl;
121       G4cerr << "!!!! " << argv[0] << " will n << 114         G4cerr << "!!!! Error in example" << argv[0] << G4endl;
122       G4cerr << "!!!!" << G4endl << G4endl;    << 115         G4cerr << "!!!! The \"" << makeFissionFragments << "\" "
123                                                << 116                   "environment variable is not set!" << G4endl;
124       return EXIT_FAILURE;                     << 117         G4cerr << "!!!! Please set it in order to use this example." << G4endl;
                                                   >> 118         G4cerr << "!!!!" << G4endl << G4endl;
                                                   >> 119         
                                                   >> 120         return EXIT_FAILURE;
125     }                                             121     }
126                                                << 122     
127     switch (argv[i][1]) {                      << 123     // We are trying to use the Wendt fission model in Neutron_HP
128       case 'i':                                << 124     // Warn the user if the appropriate environment variable is not set up
129         scriptFileName = "/control/execute ";  << 125     if(getenv(useWendtFission) == NULL)
130         scriptFileName.append(argv[i + 1]);    << 126     {
131         break;                                 << 
132                                                << 
133       case 'o':                                << 
134         outputFileName = argv[i + 1];          << 
135         break;                                 << 
136                                                << 
137       case 'n':                                << 
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                                                << 
147           return EXIT_FAILURE;                 << 
148         }                                      << 
149         break;                                 << 
150                                                << 
151       default:                                 << 
152         G4cout << G4endl << "!!!!" << G4endl;     127         G4cout << G4endl << "!!!!" << G4endl;
153         G4cout << "!!!! Warning for command "  << 128         G4cout << "!!!! Warning in example" << argv[0] << G4endl;
154         G4cout << "!!!! \"" << argv[i] << "\"  << 129         G4cout << "!!!! The \"" << useWendtFission << "\" "
155         G4cout << "!!!! " << argv[0] << " will << 130                   "environment variable is not set!" << G4endl;
156                << "\"" << G4endl;              << 131         G4cout << "!!!! Please set it if you wish to use this fission model, "
                                                   >> 132                   "otherwise the default fission model will be used" << G4endl;
157         G4cout << "!!!!" << G4endl << G4endl;     133         G4cout << "!!!!" << G4endl << G4endl;
158     }                                             134     }
159   }                                            << 135     
160                                                << 136     //  Parse the command line arguments, if any
161   // Instantiate G4UIExecutive if interactive  << 137     for(int i = 1;
162   G4UIExecutive* ui = nullptr;                 << 138         i < argc;
163   if (scriptFileName.length() == 0) {          << 139         i += 2)
164     ui = new G4UIExecutive(argc, argv);        << 140     {
165   }                                            << 141         // Ensure that this is actually a command
166                                                << 142         if(argv[i][0] != '-')
167   // Set the Random engine                     << 143         {
168   // A seed of 62737819 produced a maximum num << 144             G4cerr << G4endl << "!!!!" << G4endl;
169   // author's system before timing out the nig << 145             G4cerr << "!!!! Error in argument " << i + 1 << G4endl;
170   const G4long seed = 62737819;                << 146             G4cerr << "!!!! A command-line option was expected, but \""
                                                   >> 147                    << argv[i] << "\" was found" << G4endl;
                                                   >> 148             G4cerr << "!!!! " << argv[0] << " will now terminate" << G4endl;
                                                   >> 149             G4cerr << "!!!!" << G4endl << G4endl;
                                                   >> 150             
                                                   >> 151             return EXIT_FAILURE;
                                                   >> 152         }
                                                   >> 153         
                                                   >> 154         // Ensure that the command-line option has an associated argument
                                                   >> 155         if(!(i + 1 < argc))
                                                   >> 156         {
                                                   >> 157             G4cerr << G4endl << "!!!!" << G4endl;
                                                   >> 158             G4cerr << "!!!! Error in argument " << i + 2 << G4endl;
                                                   >> 159             G4cerr << "!!!! An argument was expected, but \"" << argv[i + 1]
                                                   >> 160                    << "\" was found" << G4endl;
                                                   >> 161             G4cerr << "!!!! Ensure that a space is used to separate the "
                                                   >> 162                       "option and argument" << G4endl;
                                                   >> 163             G4cerr << "!!!! " << argv[0] << " will now terminate" << G4endl;
                                                   >> 164             G4cerr << "!!!!" << G4endl << G4endl;
                                                   >> 165             
                                                   >> 166             return EXIT_FAILURE;
                                                   >> 167         }
                                                   >> 168         
                                                   >> 169         switch(argv[i][1])
                                                   >> 170         {
                                                   >> 171         case 'i':
                                                   >> 172             scriptFileName = "/control/execute ";
                                                   >> 173             scriptFileName.append(argv[i + 1]);
                                                   >> 174             break;
                                                   >> 175 
                                                   >> 176         case 'o':
                                                   >> 177             outputFileName = argv[i + 1];
                                                   >> 178             break;
                                                   >> 179             
                                                   >> 180         case 'n':
                                                   >> 181             result = sscanf(argv[i + 1],
                                                   >> 182                             "%u",
                                                   >> 183                             &numberOfThreads);
                                                   >> 184             if(result != 1)
                                                   >> 185             {
                                                   >> 186                 G4cerr << G4endl << "!!!!" << G4endl;
                                                   >> 187                 G4cerr << "!!!! Error in argument " << i + 2 << G4endl;
                                                   >> 188                 G4cerr << "!!!! An positive number was expected, but \""
                                                   >> 189                        << argv[i + 1] << "\" was found" << G4endl;
                                                   >> 190                 G4cerr << "!!!! " << argv[0] << " will now terminate"
                                                   >> 191                        << G4endl;
                                                   >> 192                 G4cerr << "!!!!" << G4endl << G4endl;
                                                   >> 193                 
                                                   >> 194                 return EXIT_FAILURE;
                                                   >> 195             }
                                                   >> 196             break;
                                                   >> 197         
                                                   >> 198         default:
                                                   >> 199             G4cout << G4endl << "!!!!" << G4endl;
                                                   >> 200             G4cout << "!!!! Warning for command " << i + 1 << G4endl;
                                                   >> 201             G4cout << "!!!! \"" << argv[i] << "\" is not a valid command"
                                                   >> 202                    << G4endl;
                                                   >> 203             G4cout << "!!!! " << argv[0] << " will ignore \"" << argv[i]
                                                   >> 204                    << "\" and \"" << argv[i + 1] << "\"" << G4endl;
                                                   >> 205             G4cout << "!!!!" << G4endl << G4endl;
                                                   >> 206         }
                                                   >> 207     }
                                                   >> 208     
                                                   >> 209     // Set the Random engine
                                                   >> 210     // A seed of 62737819 produced a maximum number of 67 events on the
                                                   >> 211     // author's system before timing out the nightly test
                                                   >> 212     const G4long seed = 62737819;
171 #ifndef NDEBUG                                    213 #ifndef NDEBUG
172   G4cout << "MT RNG Seed: " << seed << G4endl; << 214     G4cout << "MT RNG Seed: " << seed << G4endl;
173 #endif  // NDEBUG                              << 215 #endif // NDEBUG
174   G4Random::setTheEngine(new CLHEP::MTwistEngi << 216     G4Random::setTheEngine(new CLHEP::MTwistEngine(seed));
175                                                << 217 
176   // Initialize the multithreaded run manager  << 218 // The 'runManger' type must be declared here at initialization to provide for
177   auto* runManager = G4RunManagerFactory::Crea << 219 // 'SetNumberOfThreads()' method required for multithreading
178   runManager->SetNumberOfThreads(numberOfThrea << 220 #ifdef G4MULTITHREADED
179   G4cout << "    Threads requested:    " << nu << 221     // Initialize the multithreaded run manager
180   G4cout << "    Threads started:      " << ru << 222     G4MTRunManager* const runManager = new G4MTRunManager();
181                                                << 223     runManager->SetNumberOfThreads(numberOfThreads);
182   // Set mandatory initialization classes      << 224     
183   runManager->SetUserInitialization(new FFDete << 225     G4cout << "Multithreading enabled" << G4endl;
184   runManager->SetUserInitialization(new QGSP_B << 226     G4cout << "    Threads requested:    " << numberOfThreads << G4endl;
185   runManager->SetUserInitialization(new FFActi << 227     G4cout << "    Threads started:      " << runManager->GetNumberOfThreads()
186                                                << 228            << G4endl;
187   // Initialize the Geant4 kernel              << 229 #else
188   runManager->Initialize();                    << 230     // Multithreading not available
189                                                << 231     G4RunManager* const runManager = new G4RunManager();
190   // Initialize visualization                  << 232 #endif // G4MULTITHREADED
191   G4VisManager* visManager = new G4VisExecutiv << 233 
192   visManager->Initialize();                    << 234     // Set mandatory initialization classes
193                                                << 235     runManager->SetUserInitialization(new FFDetectorConstruction());
194   // Get the pointer to the User Interface man << 236     runManager->SetUserInitialization(new QGSP_BIC_HP());
195   UIManager = G4UImanager::GetUIpointer();     << 237     runManager->SetUserInitialization(new FFActionInitialization());
196                                                << 238     
197   if (!ui) {                                   << 239     // Initialize the Geant4 kernel
198     // Batch mode                              << 240     runManager->Initialize();
199     UIManager->ApplyCommand(scriptFileName);   << 241 
200   }                                            << 242 #ifdef G4VIS_USE
201   else {                                       << 243     // Initialize visualization
202     // Interactive mode                        << 244     G4VisManager* visManager = new G4VisExecutive();
203     ui->SessionStart();                        << 245     visManager->Initialize();
204     delete ui;                                 << 246 #endif
205   }                                            << 247     
206                                                << 248     // Get the pointer to the User Interface manager
207   // Job termination                           << 249     UIManager = G4UImanager::GetUIpointer();
208   // Free the store: user actions, physics_lis << 250     
209   // owned and deleted by the run manager, so  << 251     if(scriptFileName.length() != 0)
210   // in the main() program !                   << 252     {
211   delete visManager;                           << 253         // Batch mode
212   delete runManager;                           << 254         UIManager->ApplyCommand(scriptFileName);
                                                   >> 255     } else
                                                   >> 256     {
                                                   >> 257         // Interactive mode
                                                   >> 258 #ifdef G4UI_USE
                                                   >> 259         G4UIExecutive* ui = new G4UIExecutive(argc, argv);
                                                   >> 260         ui->SessionStart();
                                                   >> 261         delete ui;
                                                   >> 262 #endif
                                                   >> 263     }
213                                                   264 
214   return 0;                                    << 265     // Job termination
                                                   >> 266     // Free the store: user actions, physics_list and detector_description are
                                                   >> 267     // owned and deleted by the run manager, so they should not be deleted 
                                                   >> 268     // in the main() program !
                                                   >> 269 #ifdef G4VIS_USE
                                                   >> 270     delete visManager;
                                                   >> 271 #endif
                                                   >> 272     delete runManager;
                                                   >> 273     
                                                   >> 274     return 0;
215 }                                                 275 }
                                                   >> 276 
                                                   >> 277 
216                                                   278