Import Geant4 4.1.0 source tree
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ImportancePostStepDoIt.cc,v 1.5 2002/05/31 08:06:34 dressel Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4ImportancePostStepDoIt.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "g4std/strstream"
|
||||
|
||||
#include "G4ImportancePostStepDoIt.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4VImportanceSplitExaminer.hh"
|
||||
#include "G4Nsplit_Weight.hh"
|
||||
|
||||
G4ImportancePostStepDoIt::G4ImportancePostStepDoIt(){}
|
||||
G4ImportancePostStepDoIt::~G4ImportancePostStepDoIt(){}
|
||||
|
||||
void G4ImportancePostStepDoIt::DoIt(const G4Track& aTrack,
|
||||
G4ParticleChange *aParticleChange,
|
||||
const G4Nsplit_Weight nw)
|
||||
{
|
||||
// evaluate results from sampler
|
||||
if (nw.fN>1) {
|
||||
// split track
|
||||
Split(aTrack, nw, aParticleChange);
|
||||
}
|
||||
else if (nw.fN==1) {
|
||||
// don't split, but weight may be changed !
|
||||
aParticleChange->SetWeightChange(nw.fW);
|
||||
}
|
||||
else if (nw.fN==0) {
|
||||
// kill track
|
||||
aParticleChange->SetStatusChange(fStopAndKill);
|
||||
}
|
||||
else {
|
||||
// wrong answer
|
||||
G4std::ostrstream os;
|
||||
os << "G4ImportancePostStepDoIt::DoIt: sampler returned nw = "
|
||||
<< nw << '\0' << G4endl;
|
||||
G4Exception(os.str());
|
||||
}
|
||||
}
|
||||
|
||||
void G4ImportancePostStepDoIt::Split(const G4Track &aTrack,
|
||||
const G4Nsplit_Weight &nw,
|
||||
G4ParticleChange *aParticleChange)
|
||||
{
|
||||
aParticleChange->SetWeightChange(nw.fW);
|
||||
aParticleChange->SetNumberOfSecondaries(nw.fN-1);
|
||||
|
||||
for (G4int i=1;i<nw.fN;i++) {
|
||||
G4Track *ptrack = new G4Track(aTrack);
|
||||
|
||||
// ptrack->SetCreatorProcess(aTrack.GetCreatorProcess());
|
||||
ptrack->SetWeight(nw.fW);
|
||||
|
||||
if (ptrack->GetMomentumDirection() != aTrack.GetMomentumDirection()) {
|
||||
G4Exception("ERROR - G4ImportancePostStepDoIt::Split: (ptrack->GetMomentumDirection() != aTrack.GetMomentumDirection()");
|
||||
}
|
||||
|
||||
aParticleChange->AddSecondary(ptrack);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4MScoreProcess.cc,v 1.3 2002/04/09 17:40:15 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4MScoreProcess.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4MScoreProcess.hh"
|
||||
#include "G4VPScorer.hh"
|
||||
#include "G4PStep.hh"
|
||||
#include "G4VParallelStepper.hh"
|
||||
|
||||
G4MScoreProcess::G4MScoreProcess(G4VPScorer &aScorer,
|
||||
const G4String &aName)
|
||||
: G4VProcess(aName),
|
||||
fScorer(aScorer)
|
||||
{
|
||||
G4VProcess::pParticleChange = new G4ParticleChange;
|
||||
}
|
||||
|
||||
G4MScoreProcess::~G4MScoreProcess()
|
||||
{
|
||||
delete pParticleChange;
|
||||
}
|
||||
|
||||
G4double G4MScoreProcess::
|
||||
PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
*condition = Forced;
|
||||
return kInfinity;
|
||||
}
|
||||
|
||||
G4VParticleChange *
|
||||
G4MScoreProcess::PostStepDoIt(const G4Track& aTrack, const G4Step &aStep)
|
||||
{
|
||||
pParticleChange->Initialize(aTrack);
|
||||
|
||||
if (aStep.GetStepLength() > kCarTolerance) {
|
||||
G4StepPoint *prepoint = aStep.GetPreStepPoint();
|
||||
G4StepPoint *postpoint = aStep.GetPostStepPoint();
|
||||
|
||||
|
||||
G4PTouchableKey prekey(*(prepoint->GetPhysicalVolume()),
|
||||
prepoint->GetTouchable()->GetReplicaNumber());
|
||||
G4PTouchableKey postkey(*(postpoint->GetPhysicalVolume()),
|
||||
postpoint->GetTouchable()->GetReplicaNumber());
|
||||
|
||||
G4PStep pstep(prekey, postkey);
|
||||
pstep.fCrossBoundary = false;
|
||||
|
||||
if (prekey != postkey) pstep.fCrossBoundary = true;
|
||||
|
||||
fScorer.Score(aStep, pstep);
|
||||
}
|
||||
return G4VProcess::pParticleChange;
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4MassImportanceProcess.cc,v 1.3 2002/04/09 17:40:15 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4MassImportanceProcess.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4MassImportanceProcess.hh"
|
||||
#include "G4VImportanceAlgorithm.hh"
|
||||
#include "G4ImportanceFinder.hh"
|
||||
#include "G4PTouchableKey.hh"
|
||||
|
||||
G4MassImportanceProcess::
|
||||
G4MassImportanceProcess(const G4VImportanceAlgorithm &aImportanceAlgorithm,
|
||||
const G4VIStore &aIstore,
|
||||
const G4String &aName)
|
||||
: G4VProcess(aName),
|
||||
fImportanceAlgorithm(aImportanceAlgorithm),
|
||||
fImportanceFinder(new G4ImportanceFinder(aIstore))
|
||||
{
|
||||
fParticleChange = new G4ParticleChange;
|
||||
G4VProcess::pParticleChange = fParticleChange;
|
||||
}
|
||||
|
||||
G4MassImportanceProcess::~G4MassImportanceProcess()
|
||||
{
|
||||
delete fImportanceFinder;
|
||||
delete fParticleChange;
|
||||
}
|
||||
|
||||
G4double G4MassImportanceProcess::
|
||||
PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
*condition = Forced;
|
||||
return kInfinity;
|
||||
}
|
||||
|
||||
G4VParticleChange *
|
||||
G4MassImportanceProcess::PostStepDoIt(const G4Track &aTrack,
|
||||
const G4Step &aStep)
|
||||
{
|
||||
fParticleChange->Initialize(aTrack);
|
||||
if (aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary
|
||||
&& aStep.GetStepLength() > kCarTolerance) {
|
||||
if (aTrack.GetTrackStatus()==fStopAndKill) {
|
||||
G4cout << "G4MassImportanceProcess::PostStepDoIt StopAndKill" << G4endl;
|
||||
}
|
||||
|
||||
G4StepPoint *prepoint = aStep.GetPreStepPoint();
|
||||
G4StepPoint *postpoint = aStep.GetPostStepPoint();
|
||||
|
||||
|
||||
G4PTouchableKey prekey(*(prepoint->GetPhysicalVolume()),
|
||||
prepoint->GetTouchable()->GetReplicaNumber());
|
||||
G4PTouchableKey postkey(*(postpoint->GetPhysicalVolume()),
|
||||
postpoint->GetTouchable()->GetReplicaNumber());
|
||||
|
||||
G4Nsplit_Weight nw = fImportanceAlgorithm.
|
||||
Calculate(fImportanceFinder->
|
||||
GetIPre_over_IPost(prekey, postkey),
|
||||
aTrack.GetWeight());
|
||||
fImportancePostStepDoIt.DoIt(aTrack, fParticleChange, nw);
|
||||
}
|
||||
return fParticleChange;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4MassImportanceSampler.cc,v 1.1 2002/05/31 10:16:02 dressel Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4MassImportanceSampler.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4MassImportanceSampler.hh"
|
||||
#include "G4MassImportanceProcess.hh"
|
||||
#include "G4ProcessPlacer.hh"
|
||||
#include "G4ImportanceAlgorithm.hh"
|
||||
|
||||
|
||||
G4MassImportanceSampler::
|
||||
G4MassImportanceSampler(G4VIStore &aIstore,
|
||||
const G4String &particlename,
|
||||
const G4VImportanceAlgorithm *algorithm)
|
||||
: fIStore(aIstore),
|
||||
fParticleName(particlename),
|
||||
fMassImportanceProcess(0),
|
||||
fCreatedAlgorithm( ( ! algorithm) ),
|
||||
fAlgorithm(( (fCreatedAlgorithm) ?
|
||||
new G4ImportanceAlgorithm : algorithm))
|
||||
{}
|
||||
|
||||
G4MassImportanceSampler::~G4MassImportanceSampler()
|
||||
{
|
||||
if (fMassImportanceProcess) {
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.RemoveProcess(fMassImportanceProcess);
|
||||
delete fMassImportanceProcess;
|
||||
}
|
||||
if (fCreatedAlgorithm) delete fAlgorithm;
|
||||
}
|
||||
|
||||
|
||||
G4MassImportanceProcess *G4MassImportanceSampler::CreateMassImportanceProcess()
|
||||
{
|
||||
if (!fMassImportanceProcess) {
|
||||
fMassImportanceProcess =
|
||||
new G4MassImportanceProcess(*fAlgorithm, fIStore);
|
||||
}
|
||||
return fMassImportanceProcess;
|
||||
}
|
||||
|
||||
void G4MassImportanceSampler::Initialize()
|
||||
{
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.AddProcessAsSecondDoIt(CreateMassImportanceProcess());
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4MassImportanceScoreSampler.cc,v 1.1 2002/05/31 10:16:02 dressel Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4MassImportanceScoreSampler.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4MassImportanceScoreSampler.hh"
|
||||
#include "G4MassImportanceSampler.hh"
|
||||
#include "G4MassScoreSampler.hh"
|
||||
|
||||
|
||||
G4MassImportanceScoreSampler::
|
||||
G4MassImportanceScoreSampler(G4VIStore &aIstore,
|
||||
G4VPScorer &ascorer,
|
||||
const G4String &particlename,
|
||||
const G4VImportanceAlgorithm *algorithm)
|
||||
: fMassImportanceSampler(new G4MassImportanceSampler(aIstore,
|
||||
particlename,
|
||||
algorithm)),
|
||||
fMassScoreSampler(new G4MassScoreSampler(ascorer, particlename))
|
||||
{}
|
||||
|
||||
G4MassImportanceScoreSampler::~G4MassImportanceScoreSampler()
|
||||
{
|
||||
delete fMassScoreSampler;
|
||||
delete fMassImportanceSampler;
|
||||
}
|
||||
|
||||
void G4MassImportanceScoreSampler::Initialize()
|
||||
{
|
||||
fMassScoreSampler->Initialize();
|
||||
fMassImportanceSampler->Initialize();
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4MassScoreSampler.cc,v 1.1 2002/05/31 10:16:02 dressel Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4MassScoreSampler.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4MassScoreSampler.hh"
|
||||
#include "G4MScoreProcess.hh"
|
||||
#include "G4ProcessPlacer.hh"
|
||||
|
||||
|
||||
G4MassScoreSampler::G4MassScoreSampler(G4VPScorer &ascorer,
|
||||
const G4String &particlename)
|
||||
: fScorer(ascorer),
|
||||
fParticleName(particlename),
|
||||
fMScoreProcess(0)
|
||||
{}
|
||||
|
||||
G4MassScoreSampler::~G4MassScoreSampler()
|
||||
{
|
||||
if (fMScoreProcess) {
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.RemoveProcess(fMScoreProcess);
|
||||
delete fMScoreProcess;
|
||||
}
|
||||
}
|
||||
|
||||
G4MScoreProcess *G4MassScoreSampler::CreateMassScoreProcess()
|
||||
{
|
||||
if (!fMScoreProcess) {
|
||||
fMScoreProcess = new G4MScoreProcess(fScorer);
|
||||
}
|
||||
return fMScoreProcess;
|
||||
}
|
||||
|
||||
void G4MassScoreSampler::Initialize()
|
||||
{
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.AddProcessAsSecondDoIt(CreateMassScoreProcess());
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4PIScorer.cc,v 1.4 2002/04/09 17:40:15 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4PIScorer.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4PIScorer.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4PStep.hh"
|
||||
#include "G4Sigma.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4VIStore.hh"
|
||||
#include "G4PStepStream.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
|
||||
G4PIScorer::G4PIScorer(const G4VIStore &IStore)
|
||||
: fIStore(IStore), fNerr(0),fCorrectWeight(true)
|
||||
{}
|
||||
|
||||
G4PIScorer::~G4PIScorer()
|
||||
{}
|
||||
|
||||
void G4PIScorer::Score(const G4Step &aStep, const G4PStep &aPstep)
|
||||
{
|
||||
G4Track *track = aStep.GetTrack();
|
||||
|
||||
if (track->GetTrackStatus()==fStopAndKill) {
|
||||
G4cout << " track status is StopAndKill -> do nothing" << G4endl;
|
||||
}
|
||||
// do the scoring
|
||||
else {
|
||||
G4double weight = track->GetWeight();
|
||||
G4double import = fIStore.GetImportance(aPstep.fPostTouchableKey);
|
||||
G4double i_w =import * weight;
|
||||
if (i_w != 1.) {
|
||||
fNerr++;
|
||||
G4StepPoint* prepoint = aStep.GetPreStepPoint();
|
||||
G4StepPoint* postpoint = aStep.GetPostStepPoint();
|
||||
|
||||
G4cout << "G4PIScorer::Score:" << G4endl;
|
||||
G4cout << " Stepnumber = " << aStep.GetTrack()->GetCurrentStepNumber()
|
||||
<< G4endl;
|
||||
G4cout << " TrackID = " << aStep.GetTrack()->GetTrackID() << G4endl;
|
||||
G4cout << " ParentID = " << aStep.GetTrack()->GetParentID() << G4endl;
|
||||
G4cout << " Track wieght = " << weight << G4endl;
|
||||
G4cout << " Importance = " << import << G4endl;
|
||||
G4cout << " i_w = " << i_w << G4endl;
|
||||
G4cout << " aPstep: " << aPstep << G4endl;
|
||||
G4cout << " steplength = " << aStep.GetStepLength() << G4endl;
|
||||
G4cout << " pre_pos = " << prepoint->GetPosition()
|
||||
<< ", pre_dir = " << prepoint->GetMomentumDirection() << G4endl;
|
||||
G4cout << " post_pos = " << postpoint->GetPosition()
|
||||
<< ", post_dir = " << postpoint->GetMomentumDirection() << G4endl;
|
||||
G4cout << " vxt mom: " << track->GetVertexMomentumDirection() << G4endl;
|
||||
fCorrectWeight = false;
|
||||
}
|
||||
fPScorer.Score(aStep, aPstep);
|
||||
}
|
||||
}
|
||||
|
||||
G4std::ostream& operator<<(G4std::ostream &out, const G4PIScorer &ps)
|
||||
{
|
||||
out << ps.GetMapPtkTallys();
|
||||
return out;
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4PImportanceWWindowScoreSampler.cc,v 1.1 2002/05/31 10:16:02 dressel Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4PImportanceWWindowScoreSampler.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4ParallelWorld.hh"
|
||||
#include "G4PImportanceWWindowScoreSampler.hh"
|
||||
#include "G4ParallelImportanceSampler.hh"
|
||||
#include "G4ParallelWorld.hh"
|
||||
#include "G4ProcessPlacer.hh"
|
||||
#include "G4VIStore.hh"
|
||||
#include "G4VPScorer.hh"
|
||||
#include "G4PScoreProcess.hh"
|
||||
#include "G4ParallelWeightWindowProcess.hh"
|
||||
#include "G4WeightWindowAlgorithm.hh"
|
||||
|
||||
G4PImportanceWWindowScoreSampler::
|
||||
G4PImportanceWWindowScoreSampler(G4VIStore &is,
|
||||
G4VPScorer &ascorer,
|
||||
const G4String &particlename,
|
||||
G4VWeightWindowAlgorithm &wwalg,
|
||||
const G4VImportanceAlgorithm *ialg) :
|
||||
fParticleName(particlename),
|
||||
fParallelWorld(*(new G4ParallelWorld(is.GetWorldVolume()))),
|
||||
fParallelImportanceSampler(*(new
|
||||
G4ParallelImportanceSampler(is,
|
||||
fParticleName,
|
||||
fParallelWorld,
|
||||
ialg))),
|
||||
fPScorer(ascorer),
|
||||
fIstore(is),
|
||||
fPScoreProcess(0),
|
||||
fPWeightWindowProcess(0),
|
||||
fWWAlgorithm(wwalg)
|
||||
{}
|
||||
|
||||
G4PImportanceWWindowScoreSampler::~G4PImportanceWWindowScoreSampler()
|
||||
{
|
||||
if (fPScoreProcess) {
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.RemoveProcess(fPScoreProcess);
|
||||
delete fPScoreProcess;
|
||||
}
|
||||
if (fPWeightWindowProcess) {
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.RemoveProcess(fPWeightWindowProcess);
|
||||
delete fPWeightWindowProcess;
|
||||
}
|
||||
delete &fParallelImportanceSampler;
|
||||
delete &fParallelWorld;
|
||||
}
|
||||
|
||||
G4PScoreProcess *
|
||||
G4PImportanceWWindowScoreSampler::CreateParallelScoreProcess()
|
||||
{
|
||||
if (!fPScoreProcess) {
|
||||
fPScoreProcess =
|
||||
new G4PScoreProcess(fParallelWorld.GetParallelStepper(),
|
||||
fPScorer);
|
||||
}
|
||||
return fPScoreProcess;
|
||||
}
|
||||
|
||||
G4VProcess *
|
||||
G4PImportanceWWindowScoreSampler::CreateWeightWindowProcess()
|
||||
{
|
||||
if (!fPWeightWindowProcess) {
|
||||
fPWeightWindowProcess =
|
||||
new G4ParallelWeightWindowProcess(fIstore,
|
||||
fParallelWorld.
|
||||
GetParallelStepper(),
|
||||
fWWAlgorithm);
|
||||
}
|
||||
return fPWeightWindowProcess;
|
||||
}
|
||||
|
||||
void G4PImportanceWWindowScoreSampler::Initialize()
|
||||
{
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.AddProcessAsSecondDoIt(CreateParallelScoreProcess());
|
||||
fParallelImportanceSampler.Initialize();
|
||||
placer.AddProcessAsSecondDoIt(CreateWeightWindowProcess());
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4PScoreProcess.cc,v 1.2 2002/04/09 17:40:15 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4PIScoreProcess.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4PScoreProcess.hh"
|
||||
#include "G4VPScorer.hh"
|
||||
#include "G4PStep.hh"
|
||||
#include "G4VParallelStepper.hh"
|
||||
|
||||
G4PScoreProcess::G4PScoreProcess(G4VParallelStepper &astepper,
|
||||
G4VPScorer &aScorer,
|
||||
const G4String &aName)
|
||||
: G4VProcess(aName),
|
||||
fPstepper(astepper),
|
||||
fScorer(aScorer)
|
||||
{
|
||||
G4VProcess::pParticleChange = new G4ParticleChange;
|
||||
}
|
||||
|
||||
G4PScoreProcess::~G4PScoreProcess()
|
||||
{
|
||||
delete pParticleChange;
|
||||
}
|
||||
|
||||
G4double G4PScoreProcess::
|
||||
PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
*condition = Forced;
|
||||
return kInfinity;
|
||||
}
|
||||
|
||||
G4VParticleChange *
|
||||
G4PScoreProcess::PostStepDoIt(const G4Track& aTrack, const G4Step &aStep)
|
||||
{
|
||||
pParticleChange->Initialize(aTrack);
|
||||
fScorer.Score(aStep, fPstepper.GetPStep());
|
||||
|
||||
return G4VProcess::pParticleChange;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4PScorer.cc,v 1.7 2002/04/09 17:40:15 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4PScorer.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4PScorer.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4PStep.hh"
|
||||
#include "G4Sigma.hh"
|
||||
#include "G4StateManager.hh"
|
||||
|
||||
G4PScorer::G4PScorer(){}
|
||||
G4PScorer::~G4PScorer(){}
|
||||
|
||||
void G4PScorer::Score(const G4Step &aStep, const G4PStep &aPstep)
|
||||
{
|
||||
G4Track *track = aStep.GetTrack();
|
||||
|
||||
if (track->GetTrackStatus()==fStopAndKill) {
|
||||
G4cout << " track status is StopAndKill -> do nothing" << G4endl;
|
||||
}
|
||||
// do the scoring
|
||||
else {
|
||||
G4double weight = track->GetWeight();
|
||||
// the map fPtkTallys, the map nametallys and the "G4Sigma" will
|
||||
// be setup the first time they are accesed.
|
||||
G4PTouchableKey post_ptk(aPstep.fPostTouchableKey);
|
||||
if (aPstep.fCrossBoundary) {
|
||||
// Pstep crosses boundary
|
||||
fPtkTallys[post_ptk]["WeighteOfHistorysEntering"].Xin(weight);
|
||||
fPtkTallys[post_ptk]["HistorysEnteringWeighted"].Xin(1,weight);
|
||||
fPtkTallys[post_ptk]["EnergyEnteringHistoryWeighted"].
|
||||
Xin(track->GetKineticEnergy(), weight);
|
||||
}
|
||||
else {
|
||||
// Pstep with both points in the same I volume
|
||||
if (aStep.GetPostStepPoint()->GetStepStatus() != fGeomBoundary) {
|
||||
fPtkTallys[post_ptk]["WeighteOfCollisions"].Xin(weight);
|
||||
fPtkTallys[post_ptk]["CollisionsWeighted"].Xin(1,weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4std::ostream& operator<<(G4std::ostream &out, const G4PScorer &ps)
|
||||
{
|
||||
out << ps.GetMapPtkTallys();
|
||||
return out;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ParallelImportanceProcess.cc,v 1.3 2002/05/31 08:06:34 dressel Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4ParallelImportanceProcess.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4ParallelImportanceProcess.hh"
|
||||
#include "G4VImportanceSplitExaminer.hh"
|
||||
#include "g4std/strstream"
|
||||
|
||||
G4ParallelImportanceProcess::
|
||||
G4ParallelImportanceProcess(const G4VImportanceSplitExaminer &aImportanceSplitExaminer,
|
||||
G4VPGeoDriver &pgeodriver,
|
||||
G4VParallelStepper &aStepper,
|
||||
const G4String &aName)
|
||||
: G4ParallelTransport(pgeodriver, aStepper, aName),
|
||||
fParticleChange(G4ParallelTransport::fParticleChange),
|
||||
fImportanceSplitExaminer(aImportanceSplitExaminer)
|
||||
{}
|
||||
|
||||
|
||||
G4VParticleChange *G4ParallelImportanceProcess::
|
||||
PostStepDoIt(const G4Track& aTrack, const G4Step &aStep)
|
||||
{
|
||||
if (aTrack.GetTrackStatus()==fStopAndKill) {
|
||||
G4cout << "G4ParallelImportanceProcess::PostStepDoIt StopAndKill" << G4endl;
|
||||
}
|
||||
G4ParallelTransport::PostStepDoIt(aTrack, aStep);
|
||||
|
||||
// get new weight and number of clones
|
||||
G4Nsplit_Weight nw(fImportanceSplitExaminer.Examine(aTrack.GetWeight()));
|
||||
|
||||
fImportancePostStepDoIt.DoIt(aTrack, fParticleChange, nw);
|
||||
return fParticleChange;
|
||||
}
|
||||
|
||||
void G4ParallelImportanceProcess::Error(const G4String &m)
|
||||
{
|
||||
G4cout << "ERROR - G4ImportanceProcess::" << m << G4endl;
|
||||
G4Exception("Program aborted.");
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ParallelImportanceSampler.cc,v 1.1 2002/05/31 10:16:02 dressel Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4ParallelImportanceSampler.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4ParallelImportanceSampler.hh"
|
||||
#include "G4ParallelWorld.hh"
|
||||
#include "G4ParallelWorld.hh"
|
||||
#include "G4IStore.hh"
|
||||
#include "G4ImportanceSplitExaminer.hh"
|
||||
#include "G4ParallelImportanceProcess.hh"
|
||||
#include "G4ProcessPlacer.hh"
|
||||
#include "G4ImportanceAlgorithm.hh"
|
||||
|
||||
G4ParallelImportanceSampler::
|
||||
G4ParallelImportanceSampler(G4VIStore &is,
|
||||
const G4String &particlename,
|
||||
const G4VImportanceAlgorithm *ialg)
|
||||
:fParticleName(particlename),
|
||||
fParallelWorld(*(new G4ParallelWorld(is.GetWorldVolume()))),
|
||||
fCreatedPW(true),
|
||||
fDeleteAlg( ( ! ialg) ),
|
||||
fIalgorithm(( (fDeleteAlg) ?
|
||||
new G4ImportanceAlgorithm : ialg)),
|
||||
fExaminer(new G4ImportanceSplitExaminer(*fIalgorithm,
|
||||
fParallelWorld.
|
||||
GetParallelStepper(),
|
||||
is)),
|
||||
fParallelImportanceProcess(0)
|
||||
{}
|
||||
|
||||
G4ParallelImportanceSampler::
|
||||
G4ParallelImportanceSampler(G4VIStore &is,
|
||||
const G4String &pname,
|
||||
G4ParallelWorld &pworld,
|
||||
const G4VImportanceAlgorithm *ialg) :
|
||||
fParticleName(pname),
|
||||
fParallelWorld(pworld),
|
||||
fCreatedPW(false),
|
||||
fDeleteAlg( ( ! ialg) ),
|
||||
fIalgorithm(( (fDeleteAlg) ?
|
||||
new G4ImportanceAlgorithm : ialg)),
|
||||
fExaminer(new G4ImportanceSplitExaminer(*fIalgorithm,
|
||||
fParallelWorld.
|
||||
GetParallelStepper(),
|
||||
is)),
|
||||
fParallelImportanceProcess(0)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
G4ParallelImportanceProcess *
|
||||
G4ParallelImportanceSampler::CreateParallelImportanceProcess()
|
||||
{
|
||||
if (!fParallelImportanceProcess) {
|
||||
fParallelImportanceProcess =
|
||||
new G4ParallelImportanceProcess(*fExaminer,
|
||||
fParallelWorld.
|
||||
GetGeoDriver(),
|
||||
fParallelWorld.
|
||||
GetParallelStepper());
|
||||
}
|
||||
return fParallelImportanceProcess;
|
||||
}
|
||||
|
||||
void G4ParallelImportanceSampler::Initialize()
|
||||
{
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.AddProcessAsSecondDoIt(CreateParallelImportanceProcess());
|
||||
}
|
||||
|
||||
G4ParallelImportanceSampler::~G4ParallelImportanceSampler()
|
||||
{
|
||||
if (fParallelImportanceProcess) {
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.RemoveProcess(fParallelImportanceProcess);
|
||||
delete fParallelImportanceProcess;
|
||||
}
|
||||
if (fCreatedPW) delete &fParallelWorld;
|
||||
if (fDeleteAlg) delete fIalgorithm;
|
||||
delete fExaminer;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ParallelImportanceScoreSampler.cc,v 1.1 2002/05/31 10:16:02 dressel Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4ParallelImportanceScoreSampler.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4ParallelWorld.hh"
|
||||
#include "G4ParallelImportanceScoreSampler.hh"
|
||||
#include "G4ParallelImportanceSampler.hh"
|
||||
#include "G4ParallelWorld.hh"
|
||||
#include "G4ProcessPlacer.hh"
|
||||
#include "G4VIStore.hh"
|
||||
#include "G4VPScorer.hh"
|
||||
#include "G4PScoreProcess.hh"
|
||||
|
||||
G4ParallelImportanceScoreSampler::
|
||||
G4ParallelImportanceScoreSampler(G4VIStore &is,
|
||||
G4VPScorer &ascorer,
|
||||
const G4String &particlename,
|
||||
const G4VImportanceAlgorithm *ialg) :
|
||||
fParticleName(particlename),
|
||||
fParallelWorld(*(new G4ParallelWorld(is.GetWorldVolume()))),
|
||||
fParallelImportanceSampler(*(new
|
||||
G4ParallelImportanceSampler(is,
|
||||
fParticleName,
|
||||
fParallelWorld,
|
||||
ialg))),
|
||||
fPScorer(ascorer),
|
||||
fPScoreProcess(0)
|
||||
{}
|
||||
|
||||
G4ParallelImportanceScoreSampler::~G4ParallelImportanceScoreSampler()
|
||||
{
|
||||
if (fPScoreProcess) {
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.RemoveProcess(fPScoreProcess);
|
||||
delete fPScoreProcess;
|
||||
}
|
||||
delete &fParallelImportanceSampler;
|
||||
delete &fParallelWorld;
|
||||
}
|
||||
|
||||
G4PScoreProcess *
|
||||
G4ParallelImportanceScoreSampler::CreateParallelScoreProcess()
|
||||
{
|
||||
if (!fPScoreProcess) {
|
||||
fPScoreProcess =
|
||||
new G4PScoreProcess(fParallelWorld.
|
||||
GetParallelStepper(), fPScorer);
|
||||
}
|
||||
return fPScoreProcess;
|
||||
}
|
||||
|
||||
void G4ParallelImportanceScoreSampler::Initialize()
|
||||
{
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.AddProcessAsSecondDoIt(CreateParallelScoreProcess());
|
||||
fParallelImportanceSampler.Initialize();
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ParallelScoreSampler.cc,v 1.2 2002/05/31 13:49:46 dressel Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4ParallelScoreSampler.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4ParallelScoreSampler.hh"
|
||||
#include "G4PScoreProcess.hh"
|
||||
#include "G4ProcessPlacer.hh"
|
||||
#include "G4ParallelWorld.hh"
|
||||
#include "G4ParallelTransport.hh"
|
||||
|
||||
G4ParallelScoreSampler::
|
||||
G4ParallelScoreSampler(G4VPhysicalVolume &worldvolume,
|
||||
const G4String &particlename,
|
||||
G4VPScorer &scorer) :
|
||||
fParticleName(particlename),
|
||||
fParallelWorld(*(new G4ParallelWorld(worldvolume))),
|
||||
fPScorer(scorer),
|
||||
fPScorerProcess(0),
|
||||
fParallelTransport(0)
|
||||
{}
|
||||
|
||||
G4ParallelScoreSampler::~G4ParallelScoreSampler()
|
||||
{
|
||||
if (fPScorerProcess) {
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.RemoveProcess(fPScorerProcess);
|
||||
delete fPScorerProcess;
|
||||
}
|
||||
delete &fParallelWorld;
|
||||
}
|
||||
|
||||
|
||||
G4PScoreProcess *G4ParallelScoreSampler::CreateParallelScoreProcess()
|
||||
{
|
||||
if (!fPScorerProcess) {
|
||||
fPScorerProcess =
|
||||
new G4PScoreProcess(fParallelWorld.GetParallelStepper(),
|
||||
fPScorer);
|
||||
}
|
||||
return fPScorerProcess;
|
||||
}
|
||||
|
||||
G4ParallelTransport *G4ParallelScoreSampler::CreateParallelTransport()
|
||||
{
|
||||
if (!fParallelTransport) {
|
||||
fParallelTransport = new G4ParallelTransport(fParallelWorld.
|
||||
GetGeoDriver(),
|
||||
fParallelWorld.
|
||||
GetParallelStepper());
|
||||
}
|
||||
return fParallelTransport;
|
||||
}
|
||||
|
||||
void G4ParallelScoreSampler::Initialize()
|
||||
{
|
||||
G4ProcessPlacer placer(fParticleName);
|
||||
placer.AddProcessAsSecondDoIt(CreateParallelScoreProcess());
|
||||
placer.AddProcessAsSecondDoIt(CreateParallelTransport());
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ParallelTransport.cc,v 1.4 2002/05/31 13:49:47 dressel Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4ParallelTransport.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4ParallelTransport.hh"
|
||||
#include "G4VPGeoDriver.hh"
|
||||
#include "G4VParallelStepper.hh"
|
||||
#include "G4Pstring.hh"
|
||||
|
||||
G4ParallelTransport::G4ParallelTransport(G4VPGeoDriver &pgeodriver,
|
||||
G4VParallelStepper &aStepper,
|
||||
const G4String &aName)
|
||||
: G4VProcess(aName),
|
||||
fPgeodriver(pgeodriver),
|
||||
fPStepper(aStepper),
|
||||
fCrossBoundary(false),
|
||||
fInitStep(false)
|
||||
{
|
||||
fParticleChange = new G4ParticleChange;
|
||||
G4VProcess::pParticleChange = fParticleChange;
|
||||
}
|
||||
|
||||
G4ParallelTransport::~G4ParallelTransport()
|
||||
{
|
||||
delete fParticleChange;
|
||||
}
|
||||
|
||||
|
||||
void G4ParallelTransport::StartTracking(){
|
||||
fInitStep = true;
|
||||
}
|
||||
void G4ParallelTransport::EndTracking(){}
|
||||
|
||||
G4double
|
||||
G4ParallelTransport::
|
||||
PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
G4double stepLength;
|
||||
|
||||
// if this function is called on a new track let the navigator
|
||||
// know about it
|
||||
// G4bool initStep = (aTrack.GetCurrentStepNumber() == 1);
|
||||
|
||||
if (fInitStep) {
|
||||
fInitStep = false;
|
||||
stepLength = fPgeodriver.
|
||||
ComputeStepLengthInit(aTrack.GetPosition(),
|
||||
aTrack.GetMomentumDirection());
|
||||
fPStepper.Init(fPgeodriver.GetCurrentTouchableKey());
|
||||
fCrossBoundary = false;
|
||||
}
|
||||
else if (fCrossBoundary) {
|
||||
stepLength = fPgeodriver.
|
||||
ComputeStepLengthCrossBoundary(aTrack.GetPosition(),
|
||||
aTrack.GetMomentumDirection());
|
||||
fPStepper.UnSetCrossBoundary();
|
||||
fCrossBoundary = false;
|
||||
}
|
||||
else {
|
||||
stepLength = fPgeodriver.
|
||||
ComputeStepLengthInVolume(aTrack.GetPosition(),
|
||||
aTrack.GetMomentumDirection());
|
||||
}
|
||||
|
||||
*condition = NotForced;
|
||||
return stepLength;
|
||||
}
|
||||
|
||||
G4VParticleChange *
|
||||
G4ParallelTransport::PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep)
|
||||
{
|
||||
if (aStep.GetStepLength() == 0.) {
|
||||
G4String m = "G4PArallelTransport::PostStepDoIt: StepLength() == 0.\n";
|
||||
m += "pos: " + str(aTrack.GetPosition()) + ", "
|
||||
+ "dir: " + str(aTrack.GetMomentumDirection()) + "\n";
|
||||
Warning(m);
|
||||
}
|
||||
|
||||
fParticleChange->Initialize(aTrack);
|
||||
|
||||
fCrossBoundary = true;
|
||||
fPgeodriver.LocateOnBoundary(aTrack.GetPosition(),
|
||||
aTrack.GetMomentumDirection());
|
||||
fPStepper.Update(fPgeodriver.GetCurrentTouchableKey());
|
||||
|
||||
return fParticleChange;
|
||||
}
|
||||
|
||||
void G4ParallelTransport::Error(const G4String &m)
|
||||
{
|
||||
G4cout << "ERROR - G4ParallelTransport::" << m << G4endl;
|
||||
G4Exception("Program aborted.");
|
||||
}
|
||||
|
||||
void G4ParallelTransport::Warning(const G4String &m)
|
||||
{
|
||||
G4cout << "WARNING - G4ParallelTransport: " << G4endl;
|
||||
G4cout << m << G4endl;
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ParallelWeightWindowProcess.cc,v 1.3 2002/05/31 14:50:38 dressel Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4ParallelWeightWindowProcess.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4ParallelWeightWindowProcess.hh"
|
||||
#include "G4VIStore.hh"
|
||||
#include "G4VParallelStepper.hh"
|
||||
#include "G4VWeightWindowAlgorithm.hh"
|
||||
|
||||
#include "G4Pstring.hh"
|
||||
|
||||
G4ParallelWeightWindowProcess::G4ParallelWeightWindowProcess(G4VIStore &aIstore,
|
||||
G4VParallelStepper &aStepper,
|
||||
G4VWeightWindowAlgorithm &aWWAlgorithm,
|
||||
const G4String &aName)
|
||||
: G4VProcess(aName),
|
||||
fIStore(aIstore),
|
||||
fPStepper(aStepper),
|
||||
fWWAlgorithm(aWWAlgorithm),
|
||||
fNsplit_Weight(G4Nsplit_Weight(0,0)),
|
||||
fInitStep(false)
|
||||
{
|
||||
fParticleChange = new G4ParticleChange;
|
||||
G4VProcess::pParticleChange = fParticleChange;
|
||||
}
|
||||
|
||||
G4ParallelWeightWindowProcess::~G4ParallelWeightWindowProcess()
|
||||
{
|
||||
delete fParticleChange;
|
||||
}
|
||||
|
||||
void G4ParallelWeightWindowProcess::StartTracking(){
|
||||
fInitStep = true;
|
||||
}
|
||||
void G4ParallelWeightWindowProcess::EndTracking(){}
|
||||
|
||||
G4double
|
||||
G4ParallelWeightWindowProcess::
|
||||
PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
*condition = NotForced;
|
||||
G4double stepLength = kInfinity;
|
||||
|
||||
if (aTrack.GetCurrentStepNumber() == 1
|
||||
&& aTrack.GetTrackStatus() != fStopAndKill) {
|
||||
fInitStep = false;
|
||||
G4double importance = fIStore.GetImportance(fPStepper.GetPStep().fPostTouchableKey);
|
||||
G4double weight = aTrack.GetWeight();
|
||||
|
||||
fNsplit_Weight = fWWAlgorithm.Calculate(weight, importance);
|
||||
|
||||
if (aTrack.GetWeight() != fNsplit_Weight.fW ||
|
||||
fNsplit_Weight.fN != 1) {
|
||||
stepLength = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
return stepLength;
|
||||
}
|
||||
|
||||
G4VParticleChange *
|
||||
G4ParallelWeightWindowProcess::PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step& aStep)
|
||||
{
|
||||
fParticleChange->Initialize(aTrack);
|
||||
|
||||
fImportancePostStepDoIt.DoIt(aTrack, fParticleChange, fNsplit_Weight);
|
||||
|
||||
return fParticleChange;
|
||||
}
|
||||
|
||||
void G4ParallelWeightWindowProcess::Error(const G4String &m)
|
||||
{
|
||||
G4cout << "ERROR - G4ParallelWeightWindowProcess::" << m << G4endl;
|
||||
G4Exception("Program aborted.");
|
||||
}
|
||||
|
||||
void G4ParallelWeightWindowProcess::Warning(const G4String &m)
|
||||
{
|
||||
G4cout << "WARNING - G4ParallelWeightWindowProcess: " << G4endl;
|
||||
G4cout << m << G4endl;
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ProcessPlacer.cc,v 1.6 2002/05/31 10:16:02 dressel Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
//
|
||||
// G4ProcessPlacer.cc
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4ProcessPlacer.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
|
||||
G4ProcessPlacer::G4ProcessPlacer(const G4String &particlename)
|
||||
: G4VProcessPlacer(particlename),
|
||||
fParticleName(particlename)
|
||||
{
|
||||
G4cout << "+++ G4ProcessPlacer::G4ProcessPlacer: for: " << particlename
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
void G4ProcessPlacer::RemoveProcess(G4VProcess *process){
|
||||
G4cout << " ProcessName: " << process->GetProcessName()
|
||||
<< ", will be removed!" << G4endl;
|
||||
|
||||
G4cout << "The initial Vectors: " << G4endl;
|
||||
PrintPostStepGPILVec();
|
||||
PrintPostStepDoItVec();
|
||||
|
||||
GetProcessManager().RemoveProcess(process);
|
||||
|
||||
G4cout << "The final Vectors: " << G4endl;
|
||||
PrintPostStepGPILVec();
|
||||
PrintPostStepDoItVec();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void G4ProcessPlacer::AddProcessAs(G4VProcess *process, SecondOrLast sol)
|
||||
{
|
||||
G4cout << " ProcessName: " << process->GetProcessName() << G4endl;
|
||||
|
||||
G4cout << "The initial Vectors: " << G4endl;
|
||||
PrintPostStepGPILVec();
|
||||
PrintPostStepDoItVec();
|
||||
|
||||
|
||||
if (sol == eLast) {
|
||||
GetProcessManager().AddProcess(process,
|
||||
ordInActive,
|
||||
ordInActive,
|
||||
ordLast);
|
||||
}
|
||||
else if (sol == eSecond) {
|
||||
// get transportation process
|
||||
G4VProcess *transportation =
|
||||
(* (GetProcessManager().GetProcessList()))[0];
|
||||
|
||||
if (!transportation) {
|
||||
G4Exception(" G4ProcessPlacer:: could not get process id=0");
|
||||
}
|
||||
if (transportation->GetProcessName() != "Transportation") {
|
||||
G4cout << transportation->GetProcessName() << G4endl;
|
||||
G4Exception(" G4ProcessPlacer:: process id=0 is not Transportation");
|
||||
}
|
||||
|
||||
// place the given proces as first for the moment
|
||||
GetProcessManager().AddProcess(process);
|
||||
GetProcessManager().SetProcessOrderingToFirst(process,
|
||||
idxPostStep);
|
||||
// place transportation first again
|
||||
GetProcessManager().SetProcessOrderingToFirst(transportation,
|
||||
idxPostStep);
|
||||
}
|
||||
|
||||
// for verification inly
|
||||
G4cout << "The final Vectors: " << G4endl;
|
||||
PrintPostStepGPILVec();
|
||||
PrintPostStepDoItVec();
|
||||
|
||||
G4cout << "================================================" << G4endl;
|
||||
|
||||
}
|
||||
|
||||
void G4ProcessPlacer::AddProcessAsSecondDoIt(G4VProcess *process)
|
||||
{
|
||||
G4cout << "=== G4ProcessPlacer::AddProcessAsSecondDoIt ===" << G4endl;
|
||||
AddProcessAs(process, eSecond);
|
||||
}
|
||||
|
||||
void G4ProcessPlacer::AddProcessAsLastDoIt(G4VProcess *process)
|
||||
{
|
||||
G4cout << "=== G4ProcessPlacer::AddProcessAsLastDoIt ===" << G4endl;
|
||||
AddProcessAs(process, eLast);
|
||||
}
|
||||
|
||||
G4ProcessManager &G4ProcessPlacer::GetProcessManager()
|
||||
{
|
||||
// get particle iterator to add processes ---------------------
|
||||
G4ParticleTable* theParticleTable;
|
||||
G4ParticleTable::G4PTblDicIterator* theParticleIterator;
|
||||
theParticleTable = G4ParticleTable::GetParticleTable();
|
||||
theParticleIterator = theParticleTable->GetIterator();
|
||||
// -------------------------------------------------------
|
||||
G4ProcessManager *processmanager = 0;
|
||||
// add parallel transport processe ---------------------------
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
if (particle->GetParticleName() == fParticleName) {
|
||||
processmanager = particle->GetProcessManager();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ---------------------------------------------------------
|
||||
if (!processmanager) G4Exception(" G4ProcessPlacer::GetProcessManager: no ProcessSampler");
|
||||
return *processmanager;
|
||||
}
|
||||
|
||||
|
||||
void G4ProcessPlacer::PrintPostStepGPILVec(){
|
||||
G4cout << "GPIL Vector: " << G4endl;
|
||||
G4ProcessVector* processGPILVec =
|
||||
GetProcessManager().GetPostStepProcessVector(typeGPIL);
|
||||
PrintProcVec(processGPILVec);
|
||||
}
|
||||
|
||||
void G4ProcessPlacer::PrintPostStepDoItVec(){
|
||||
G4cout << "DoIt Vector: " << G4endl;
|
||||
G4ProcessVector* processDoItVec =
|
||||
GetProcessManager().GetPostStepProcessVector(typeDoIt);
|
||||
PrintProcVec(processDoItVec);
|
||||
}
|
||||
|
||||
|
||||
void G4ProcessPlacer::PrintProcVec(G4ProcessVector* processVec)
|
||||
{
|
||||
if (!processVec) G4Exception("G4ProcessPlacer::G4ProcessPlacer: no processVec");
|
||||
G4int len = processVec->length();
|
||||
if (len==0) G4Exception("G4ProcessPlacer::G4ProcessPlacer:processVec len = 0");
|
||||
for (int pi=0; pi<len; pi++) {
|
||||
G4VProcess *p = (*processVec)[pi];
|
||||
if (p) {
|
||||
G4cout << " " << p->GetProcessName() << G4endl;
|
||||
}
|
||||
else {
|
||||
G4cout << " " << "no process found for position: " << pi
|
||||
<< ", in vector of length: " << len << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Transportation.cc,v 1.27 2001/12/08 15:20:30 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// $Id: G4Transportation.cc,v 1.29 2002/05/17 07:10:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 include file implementation
|
||||
@@ -497,8 +497,7 @@ G4VParticleChange* G4Transportation::PostStepDoIt( const G4Track& track,
|
||||
}
|
||||
else
|
||||
{ // fGeometryLimitedStep is false
|
||||
//#ifdef G4DEBUG
|
||||
#ifdef G4VERBOSE
|
||||
#ifdef G4DEBUG_POSTSTEP_TRANSPORT
|
||||
// Although the location is changed, we know that the physical
|
||||
// volume remains constant.
|
||||
// In order to help in checking the user geometry
|
||||
@@ -574,7 +573,7 @@ G4VParticleChange* G4Transportation::PostStepDoIt( const G4Track& track,
|
||||
|
||||
fLinearNavigator->LocateGlobalPointWithinVolume( track.GetPosition()) ;
|
||||
#else
|
||||
// ie #ifndef G4DEBUG does a quick relocation
|
||||
// ie #ifndef G4DEBUG_POSTSTEP_TRANSPORT does a quick relocation
|
||||
|
||||
// The serves only to move the Navigator's location
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UserSpecialCuts.cc,v 1.4 2001/07/11 10:08:31 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// History
|
||||
|
||||
Reference in New Issue
Block a user