Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
+82 -64
View File
@@ -27,7 +27,7 @@
/// \brief Main program of the biasing/B01 example
//
//
// $Id$
// $Id: exampleB01.cc 77475 2013-11-25 09:38:51Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -44,25 +44,41 @@
// detector construction class for simplicity.
// Pairs of G4GeometryCell and importance values are stored in
// the importance store.
// The G4Scorer is used for the scoring. This is a top level
// class using the frame work provided for scoring.
// Scoring is carried out by the multifunctional detector (MFD) and
// sensitive detectors
//
// Alex Howard (alexander.howard@cern.ch):
// 22/11/13: Migrated to the new MT compliant design which moves the
// biasing process to the physicslist constructor - here
// via the modular physicslists
//
// --------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include <iostream>
#include "G4VPhysicalVolume.hh"
#include <stdlib.h>
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#else
#include "G4RunManager.hh"
#endif
#include "G4VPhysicalVolume.hh"
#include "G4UImanager.hh"
#include "G4GeometryManager.hh"
// user classes
#include "B01DetectorConstruction.hh"
#include "B01PhysicsList.hh"
#include "B01PrimaryGeneratorAction.hh"
#include "B01RunAction.hh"
#include "B01ScoreTable.hh"
#include "FTFP_BERT.hh"
#include "G4ImportanceBiasing.hh"
#include "G4WeightWindowBiasing.hh"
#include "B01ActionInitialization.hh"
// #include "B01PrimaryGeneratorAction.hh"
// #include "B01RunAction.hh"
// Files specific for biasing and scoring
#include "G4GeometrySampler.hh"
@@ -70,6 +86,7 @@
#include "G4VWeightWindowStore.hh"
#include "G4WeightWindowAlgorithm.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc, char **argv)
{
@@ -78,74 +95,73 @@ int main(int argc, char **argv)
G4int numberOfEvents = 100;
G4long myseed = 345354;
CLHEP::HepRandom::setTheSeed(myseed);
G4RunManager *runManager = new G4RunManager;
#ifdef G4MULTITHREADED
G4MTRunManager * runManager = new G4MTRunManager;
G4cout << " Number of cores: " << G4Threading::G4GetNumberOfCores() << G4endl;
G4cout << " and using 2 of them! " << G4endl;
runManager->SetNumberOfThreads(2);
// runManager->SetNumberOfThreads(G4Threading::G4GetNumberOfCores());
#else
G4RunManager * runManager = new G4RunManager;
#endif
G4Random::setTheSeed(myseed);
G4VWeightWindowAlgorithm *wwAlg = 0; // pointer for WeightWindow (mode>0)
// create the detector ---------------------------
B01DetectorConstruction *detector = new B01DetectorConstruction();
B01DetectorConstruction* detector = new B01DetectorConstruction();
runManager->SetUserInitialization(detector);
// ---------------------------------------------------
runManager->SetUserInitialization(new B01PhysicsList);
runManager->SetUserAction(new B01PrimaryGeneratorAction);
runManager->SetUserAction(new B01RunAction);
G4GeometrySampler mgs(detector->GetWorldVolume(),"neutron");
G4VModularPhysicsList* physicsList = new FTFP_BERT;
if(mode == 0)
{
physicsList->RegisterPhysics(new G4ImportanceBiasing(&mgs));
}
else
{
wwAlg = new G4WeightWindowAlgorithm(1, // upper limit factor
1, // survival factor
100); // max. number of splitting
physicsList->RegisterPhysics(new G4WeightWindowBiasing
(&mgs, wwAlg, onBoundary));
// place of action
}
runManager->SetUserInitialization(physicsList);
// Set user action classes through Worker Initialization
//
B01ActionInitialization* actions = new B01ActionInitialization;
runManager->SetUserInitialization(actions);
runManager->Initialize();
// pointers for importance store, weight-window store
// and weight-window algorithm
//
G4VIStore *aIstore = 0;
G4VWeightWindowStore *aWWstore = 0;
G4VWeightWindowAlgorithm *wwAlg = 0;
if (mode == 0)
{
detector->CreateImportanceStore();
}
else
{
detector->CreateWeightWindowStore();
}
// create sampler for biasing and scoring in the mass geometry
//
G4GeometrySampler mgs(detector->GetWorldVolume(),"neutron");
mgs.SetParallel(false);
// runManager->BeamOn(numberOfEvents);
if (mode == 0)
{
// prepare for importance sampling
//
aIstore = detector->CreateImportanceStore();
mgs.PrepareImportanceSampling(aIstore, 0);
}
else
{
// prepare for weight window technique
// in this case the algoritm is initialized such that
// the weight window tehcnique does exactly the same as
// the importance sampling technique, therefore
// the place of action ( the locations where
// splitting and Russian roulette are to be applied)
// is chosen to be on the boundary between cells.
//
aWWstore = detector->CreateWeightWindowStore();
wwAlg = new G4WeightWindowAlgorithm(1, // upper limit factor
1, // survival factor
100); // max. number of splitting
mgs.PrepareWeightWindow(aWWstore, wwAlg, onBoundary); // place of action
}
mgs.Configure();
runManager->BeamOn(numberOfEvents);
// print a table of the scores
//
B01ScoreTable sp(aIstore); //ASO
//temporary fix before runManager->BeamOn works...
G4UImanager* UImanager = G4UImanager::GetUIpointer();
G4String command1 = "/control/cout/setCoutFile threadOut";
UImanager->ApplyCommand(command1);
G4String command2 = "/run/beamOn " +
G4UIcommand::ConvertToString(numberOfEvents);;
UImanager->ApplyCommand(command2);
// open geometry for clean biasing stores clean-up
//
G4GeometryManager::GetInstance()->OpenGeometry();
if (aIstore) {
delete aIstore;
}
if (aWWstore) {
delete aWWstore;
}
if (wwAlg) {
delete wwAlg;
}
@@ -156,3 +172,5 @@ int main(int argc, char **argv)
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......