Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
@@ -0,0 +1,173 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4MassGeometrySampler.cc,v 1.7 2002/11/04 10:47:56 dressel Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4MassGeometrySampler.cc
//
// ----------------------------------------------------------------------
#include "G4MassGeometrySampler.hh"
#include "G4VIStore.hh"
#include "G4VScorer.hh"
#include "G4MScoreConfigurator.hh"
#include "G4MImportanceConfigurator.hh"
#include "G4WeightCutOffConfigurator.hh"
#include "G4MassGCellFinder.hh"
G4MassGeometrySampler::
G4MassGeometrySampler(const G4String &particlename)
:
fParticleName(particlename),
fMImportanceConfigurator(0),
fMScoreConfigurator(0),
fGCellFinder(0),
fWeightCutOffConfigurator(0),
fIStore(0),
fIsConfigured(false)
{}
G4MassGeometrySampler::~G4MassGeometrySampler(){
ClearSampling();
};
void G4MassGeometrySampler::ClearSampling() {
if (fMImportanceConfigurator) {
delete fMImportanceConfigurator;
fMImportanceConfigurator = 0;
}
if (fMScoreConfigurator) {
delete fMScoreConfigurator;
fMScoreConfigurator = 0;
}
if (fWeightCutOffConfigurator) {
delete fWeightCutOffConfigurator;
fWeightCutOffConfigurator = 0;
}
if (fGCellFinder) {
delete fGCellFinder;
fGCellFinder = 0;
}
fIStore = 0;
fConfigurators.clear();
fIsConfigured = false;
};
G4bool G4MassGeometrySampler::IsConfigured() const{
G4bool isconf = false;
if (fIsConfigured) {
G4cout << "G4MassGeometrySampler::CheckIfInit some initalization exists, use ClearSampling() before a new initialization" << G4endl;
isconf = true;
}
return isconf;
}
void G4MassGeometrySampler::
PrepareScoring(G4VScorer *scorer){
fMScoreConfigurator =
new G4MScoreConfigurator(fParticleName, *scorer);
if (!fMScoreConfigurator) {
G4Exception("ERROR:G4MassGeometrySampler::PrepareScoring: new failed to ccreate G4MScoreConfigurator!");
}
}
void G4MassGeometrySampler::
PrepareImportanceSampling(G4VIStore *istore,
const G4VImportanceAlgorithm
*ialg) {
fIStore = istore;
fMImportanceConfigurator =
new G4MImportanceConfigurator(fParticleName,
*fIStore,
ialg);
if (!fMImportanceConfigurator) {
G4Exception("ERROR:G4MassGeometrySampler::PrepareImportanceSampling: new failed to ccreate G4MImportanceConfigurator!");
}
}
void G4MassGeometrySampler::
PrepareWeightRoulett(G4double wsurvive,
G4double wlimit,
G4double isource) {
fGCellFinder = new G4MassGCellFinder;
if (!fGCellFinder) {
G4Exception("ERROR:G4MassGeometrySampler::PrepareWeightRoulett: new failed to create G4MassGCellFinder!");
}
fWeightCutOffConfigurator =
new G4WeightCutOffConfigurator(fParticleName,
wsurvive,
wlimit,
isource,
fIStore,
*fGCellFinder);
if (!fWeightCutOffConfigurator) {
G4Exception("ERROR:G4MassGeometrySampler::PrepareWeightRoulett: new failed to ccreate G4WeightCutOffConfigurator!");
}
}
void G4MassGeometrySampler::Configure(){
if (!IsConfigured()) {
fIsConfigured = true;
if (fMScoreConfigurator) {
fConfigurators.push_back(fMScoreConfigurator);
}
if (fMImportanceConfigurator) {
fConfigurators.push_back(fMImportanceConfigurator);
}
G4VSamplerConfigurator *preConf = 0;
for (G4Configurators::iterator it = fConfigurators.begin();
it != fConfigurators.end(); it++) {
G4VSamplerConfigurator *currConf =*it;
currConf->Configure(preConf);
preConf = *it;
}
if (fWeightCutOffConfigurator) {
fWeightCutOffConfigurator->Configure(0);
}
}
return;
}