Import Geant4 9.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:16:48 +02:00
parent 75c7fd177d
commit a8e9364cea
6592 changed files with 84274 additions and 69292 deletions
+35
View File
@@ -0,0 +1,35 @@
# $Id: GNUmakefile,v 1.2 2007/05/30 17:58:37 ahoward Exp $
# ------------------------------------------------------------
# GNUmakefile for biasing process library.
# ------------------------------------------------------------
name := G4biasing
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/navigation/include \
-I$(G4BASE)/geometry/magneticfield/include \
-I$(G4BASE)/geometry/biasing/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/processes/cuts/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/digits_hits/detector/include \
-I$(G4BASE)/digits_hits/hits/include \
-I$(G4BASE)/processes/transportation/include
include $(G4INSTALL)/config/common.gmk
+60
View File
@@ -0,0 +1,60 @@
$Id: History,v 1.15 2007/06/25 06:59:17 ahoward Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the CVS log-message one should put at every
committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
June 22nd, 2007 Alex Howard (procbiasing-V08-03-08)
- Added missing member function to G4VSampler base class
June 12th, 2007 Alex Howard (procbiasing-V08-03-05)
- Added CoupledTransportation name to G4ProcessPlacer
June 1st, 2007 Alex Howard (procbiasing-V08-03-04)
- Added missing source file G4VProcessPlacer.cc previously resident in
processes/transportation
- Removed scoring inheritance in G4VSampler
- HEAD maintains inheritance for backward comparisons/testing
June 1st, 2007 Alex Howard (procbiasing-V08-03-03)
- Renamed New classes back to normal classes, simultaneously
processes/transportation old biasing classes renamed with
suffix 8 to avoid clashes.
- includes modified G4GeometrySampler (without scoring)
- HEAD contains un-modifier G4GeometrySampler and depends on old scoring scheme
in geometry/biasing.
May 31st, 2007 Alex Howard (procbiasing-V08-03-02)
- removed dependency on old biasing within transportation and on old scoring
within geometry
- G4GeometrySampler is modified to remove scoring dependency
- HEAD of G4GeometrySampler is the old file
- HEAD contains a different version of G4GeometrySampler that includes the old
biasing scoring for the purpose of testing
May 30th, 2007 Alex Howard (procbiasing-V08-03-01)
- added missing includes to GNUmakefile
May 30th, 2007 Alex Howard (procbiasing-V08-03-00)
- migrated classes and tests from processes/scoring
May 25th, 2007 Jane Tinslay
- Add tests for physics biasing under test/physics_biasing
March 21st, 2007 G.Cosmo
- Module and history file created.
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GCellFinder.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4ParallelGCellFinder
//
// Class description:
//
// Finds a G4GeometryCell in the mass geometry.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4GCellFinder_hh
#define G4GCellFinder_hh G4GCellFinder_hh
class G4Navigator;
class G4TransportationManager;
class G4PathFinder;
class G4VTouchable;
class G4VPhysicalVolume;
#include "G4Types.hh"
#include "G4VGCellFinder.hh"
class G4GCellFinder : public G4VGCellFinder
{
public: // with description
// G4GCellFinder(G4VPhysicalVolume &worldvolume);
G4GCellFinder();
virtual ~G4GCellFinder();
virtual G4GeometryCell
GetPreGeometryCell(const G4Step &aStep) const;
virtual G4GeometryCell
GetPostGeometryCell(const G4Step &aStep) const;
private:
// G4Navigator* fGhostNavigator;
// G4TouchableHandle fGhostTouchable;
};
#endif
@@ -0,0 +1,107 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GeometrySampler.hh,v 1.9 2007/06/01 09:52:23 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4GeometrySampler
//
// Class description:
// This class inherits from G4VSampler. It is used for scoring and
// importance sampling in the tracking (mass) geometry.
// See also the description in G4VSampler.hh.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4GeometrySampler_hh
#define G4GeometrySampler_hh G4GeometrySampler_hh
#include "G4Types.hh"
#include "G4String.hh"
#include "G4VSampler.hh"
#include "G4VSamplerConfigurator.hh"
class G4ImportanceConfigurator;
class G4WeightWindowConfigurator;
//class G4ScoreConfigurator;
class G4WeightCutOffConfigurator;
class G4VGCellFinder;
class G4GeometrySampler : public G4VSampler
{
public: // with description
explicit G4GeometrySampler(G4VPhysicalVolume *worldvolume, const G4String &particlename);
virtual ~G4GeometrySampler();
// virtual void PrepareScoring(G4VScorer *Scorer);
virtual void PrepareImportanceSampling(G4VIStore *istore,
const G4VImportanceAlgorithm
*ialg);
virtual void PrepareWeightRoulett(G4double wsurvive,
G4double wlimit,
G4double isource);
virtual void PrepareWeightWindow(G4VWeightWindowStore *wwstore,
G4VWeightWindowAlgorithm *wwAlg,
G4PlaceOfAction placeOfAction);
virtual void Configure();
virtual void ClearSampling();
virtual G4bool IsConfigured() const;
void SetParallel(G4bool paraflag);
void SetParticle(const G4String &particlename);
private:
G4GeometrySampler(const G4GeometrySampler &);
G4GeometrySampler &
operator=(const G4GeometrySampler &);
private:
G4String fParticleName;
G4VPhysicalVolume* fWorld;
G4ImportanceConfigurator *fImportanceConfigurator;
// G4ScoreConfigurator *fScoreConfigurator;
G4VGCellFinder *fGCellFinder;
G4WeightCutOffConfigurator *fWeightCutOffConfigurator;
G4VIStore *fIStore;
G4WeightWindowConfigurator *fWeightWindowConfigurator;
G4VWeightWindowStore *fWWStore;
G4bool fIsConfigured;
G4Configurators fConfigurators;
G4bool paraflag;
};
#endif
@@ -0,0 +1,87 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ImportanceConfigurator.hh,v 1.3 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4ImportanceConfigurator
//
// Class description:
// This class builds and places the G4ImportanceProcess.
// If the object is deleted the process is removed from the
// process list.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4ImportanceConfigurator_hh
#define G4ImportanceConfigurator_hh G4ImportanceConfigurator_hh
#include "G4Types.hh"
#include "G4ProcessPlacer.hh"
#include "G4VSamplerConfigurator.hh"
class G4ImportanceProcess;
class G4VImportanceAlgorithm;
class G4VIStore;
class G4VPhysicalVolume;
class G4ImportanceConfigurator : public G4VSamplerConfigurator
{
public: // with description
G4ImportanceConfigurator(G4VPhysicalVolume* worldvolume,
const G4String &particlename,
G4VIStore &istore,
const G4VImportanceAlgorithm *ialg,
G4bool paraflag);
virtual ~G4ImportanceConfigurator();
virtual void Configure(G4VSamplerConfigurator *preConf);
virtual const G4VTrackTerminator *GetTrackTerminator() const;
private:
G4ImportanceConfigurator(const G4ImportanceConfigurator &);
G4ImportanceConfigurator &
operator=(const G4ImportanceConfigurator &);
G4VPhysicalVolume* fWorld;
G4ProcessPlacer fPlacer;
G4VIStore &fIStore;
G4bool fDeleteIalg;
const G4VImportanceAlgorithm *fIalgorithm;
G4ImportanceProcess *fImportanceProcess;
G4bool paraflag;
};
#endif
@@ -0,0 +1,164 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ImportanceProcess.hh,v 1.3 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4ImportanceProcess
//
// Class description:
//
// Used internally by importance sampling in the "mass" geometry.
// This process is a forced post step process. I will apply
// importance sampling if the particle crosses a boundary in the
// "mass" geometry.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4ImportanceProcess_hh
#define G4ImportanceProcess_hh G4ImportanceProcess_hh
#include "G4VProcess.hh"
#include "G4VTrackTerminator.hh"
class G4SamplingPostStepAction;
class G4VImportanceAlgorithm;
class G4VIStore;
class G4Step;
class G4Navigator;
class G4TransportationManager;
class G4PathFinder;
class G4VTouchable;
#include "G4FieldTrack.hh"
#include "G4TouchableHandle.hh"
class G4ImportanceProcess : public G4VProcess, public G4VTrackTerminator
{
public: // with description
G4ImportanceProcess(const G4VImportanceAlgorithm &aImportanceAlgorithm,
const G4VIStore &aIstore,
const G4VTrackTerminator *TrackTerminator,
const G4String &aName = "ImportanceProcess", G4bool para = false);
// creates a G4ParticleChange
virtual ~G4ImportanceProcess();
// delete the G4ParticleChange
//--------------------------------------------------------------
// Set Paralle World
//--------------------------------------------------------------
void SetParallelWorld(G4String parallelWorldName);
void SetParallelWorld(G4VPhysicalVolume* parallelWorld);
//--------------------------------------------------------------
// Process interface
//--------------------------------------------------------------
void StartTracking(G4Track*);
virtual G4double
PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition);
// make process beeing forced
virtual G4VParticleChange *PostStepDoIt(const G4Track&, const G4Step&);
// manage the importance sampling in the "mass" geometry
virtual void KillTrack() const;
// used in case no scoring process follows that does the killing
virtual const G4String &GetName() const;
public: // without description
// no operation in AtRestDoIt and AlongStepDoIt
virtual G4double
AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*);
virtual G4double
AtRestGetPhysicalInteractionLength(const G4Track& ,
G4ForceCondition*);
virtual G4VParticleChange*
AtRestDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange*
AlongStepDoIt(const G4Track&, const G4Step&);
private:
G4ImportanceProcess(const G4ImportanceProcess &);
G4ImportanceProcess &operator=(const G4ImportanceProcess &);
private:
void CopyStep(const G4Step & step);
G4Step * fGhostStep;
G4StepPoint * fGhostPreStepPoint;
G4StepPoint * fGhostPostStepPoint;
G4ParticleChange *fParticleChange;
const G4VImportanceAlgorithm &fImportanceAlgorithm;
const G4VIStore &fIStore;
G4SamplingPostStepAction *fPostStepAction;
G4TransportationManager* fTransportationManager;
G4PathFinder* fPathFinder;
// -------------------------------
// Navigation in the Ghost World:
// -------------------------------
G4String fGhostWorldName;
G4VPhysicalVolume* fGhostWorld;
G4Navigator* fGhostNavigator;
G4int fNavigatorID;
G4TouchableHandle fOldGhostTouchable;
G4TouchableHandle fNewGhostTouchable;
G4FieldTrack fFieldTrack;
G4double fGhostSafety;
G4bool fOnBoundary;
G4bool paraflag;
};
#endif
@@ -0,0 +1,49 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4PlaceOfAction.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4PlaceOfAction
//
// Class description:
// This is an enum to specify when weight window sampling shoul be
// applied: onBoundary, onCollision, onBoundaryAndCollision.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4PlaceOfAction_hh
#define G4PlaceOfAction_hh G4PlaceOfAction_hh
enum G4PlaceOfAction
{
onBoundary = 1,
onCollision = 2,
onBoundaryAndCollision = 3
};
#endif
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ProcessPlacer.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4ProcessPlacer
//
// Class description:
//
// Used internally by importance sampling and scoring.
// See G4VProcessPlacer.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4ProcessPlacer_hh
#define G4ProcessPlacer_hh G4ProcessPlacer_hh
#include "G4Types.hh"
#include "G4String.hh"
#include "G4VProcessPlacer.hh"
class G4ProcessManager;
class G4ProcessVector;
class G4ProcessPlacer : public G4VProcessPlacer
{
public: // with description
explicit G4ProcessPlacer(const G4String &particlename);
// create a process placer for a particle type
virtual ~G4ProcessPlacer();
virtual void AddProcessAsLastDoIt(G4VProcess *process);
// place a post step do it process such that the
// PostStepDoIt function is called last
// THE ORDER CHANGES BY SUBSEQUENT CALLS
virtual void AddProcessAsSecondDoIt(G4VProcess *process);
// place a post step do it process such that the
// PostStepDoIt function is called second
// THE ORDER CHANGES BY SUBSEQUENT CALLS
virtual void RemoveProcess(G4VProcess *process);
// removes a given process
enum SecondOrLast
{
eSecond = 1,
eLast = 0
};
private:
G4ProcessManager *GetProcessManager();
void AddProcessAs(G4VProcess *process, SecondOrLast);
void PrintProcVec(G4ProcessVector* processVec);
void PrintPostStepGPILVec();
void PrintPostStepDoItVec();
private:
G4String fParticleName;
};
#endif
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4SamplingPostStepAction.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4SamplingPostStepAction
//
// Class description:
//
// Used internally by importance and weight window sampling.
// Creates cloned tracks or kills tracks.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4SamplingPostStepAction_hh
#define G4SamplingPostStepAction_hh G4SamplingPostStepAction_hh
class G4VImportanceSplitExaminer;
class G4ParticleChange;
class G4Track;
class G4Step;
class G4Nsplit_Weight;
class G4VTrackTerminator;
class G4SamplingPostStepAction
{
public: // with description
explicit G4SamplingPostStepAction(const G4VTrackTerminator &TrackTerminator);
// Constructor
~G4SamplingPostStepAction();
// Destructor
void DoIt(const G4Track& aTrack,
G4ParticleChange *aParticleChange,
const G4Nsplit_Weight &nw);
// Do the PostStepDoIt part common to importance and weight window
// sampling in the
// "mass" and "parallel" geometry.
private:
void Split(const G4Track &aTrack,
const G4Nsplit_Weight &nw,
G4ParticleChange *aParticleChange);
const G4VTrackTerminator &fTrackTerminator;
};
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4TrackTerminator.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4TrackTerminator
//
// Class description:
//
// This is an interface for an object which can be called to kill a track.
// The type it provides is needed in case importance biasing and scoring
// is done at the same time.
// For navigation in the parallel geometry which is done by the importance
// biasing process (it derives from G4ParallelTransport), importance
// biasing has to be done before scoring (to score the correct volume).
// But since scoring would not be called if the importance biasing kills
// a track, it only tells a G4TrackTerminator to kill the track.
// The scoring process implements the interface G4TrackTerminator
// and is now able to kill the track after it has performed the scoring.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4TrackTerminator_hh
#define G4TrackTerminator_hh G4TrackTerminator_hh
#include "G4Types.hh"
class G4TrackTerminator
{
public: // without description
G4TrackTerminator()
: fKillTrack(false) {}
~G4TrackTerminator();
void SetKillTrack(){fKillTrack = true;}
G4bool GetKillTrack() const {return fKillTrack;}
private:
G4bool fKillTrack;
};
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VProcessPlacer.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4VProcessPlacer
//
// Class description:
//
// Used internally by importance sampling and scoring to place
// processes as second or last PostStepDoIt processes.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4VProcessPlacer_hh
#define G4VProcessPlacer_hh G4VProcessPlacer_hh
#include "G4Types.hh"
class G4VProcess;
class G4VProcessPlacer
{
public: // with description
G4VProcessPlacer();
virtual ~G4VProcessPlacer();
virtual void AddProcessAsLastDoIt(G4VProcess *process) = 0;
// place a post step do it process such that the
// PostStepDoIt function is called last
// THE ORDER CHANGES BY SUBSEQUENT CALLS
virtual void AddProcessAsSecondDoIt(G4VProcess *process) = 0;
// place a post step do it process such that the
// PostStepDoIt function is called second
// THE ORDER CHANGES BY SUBSEQUENT CALLS
virtual void RemoveProcess(G4VProcess *process) = 0;
// removes a given process
};
#endif
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VSampler.hh,v 1.8 2007/06/25 06:57:22 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4VSampler
//
// Class description:
//
// This interface describes a configurable sampler.
// It applies to a given particle type.
// Concrete classes with this interface may be used for
// scoring, importance sampling and weight cutoff (weight roulette).
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4VSampler_hh
#define G4VSampler_hh G4VSampler_hh
#include "G4Types.hh"
#include "G4PlaceOfAction.hh"
class G4VPhysicalVolume;
class G4VImportanceAlgorithm;
class G4VIStore;
class G4VWeightWindowAlgorithm;
class G4VWeightWindowStore;
//class G4VScorer;
class G4VSampler
{
public: // with description
G4VSampler();
virtual ~G4VSampler();
// virtual void PrepareScoring(G4VScorer *Scorer) = 0;
// virtual void PrepareScoring() = 0;
virtual void PrepareImportanceSampling(G4VIStore *istore,
const G4VImportanceAlgorithm
*ialg = 0) = 0;
virtual void PrepareWeightRoulett(G4double wsurvive = 0.5,
G4double wlimit = 0.25,
G4double isource = 1) = 0;
virtual void PrepareWeightWindow(G4VWeightWindowStore *wwstore,
G4VWeightWindowAlgorithm *wwAlg = 0,
G4PlaceOfAction placeOfAction =
onBoundary) = 0;
virtual void Configure() = 0;
virtual void ClearSampling() = 0;
// clear the sampler and remove the processes
virtual G4bool IsConfigured() const = 0;
// check if some initialization hase already been done
virtual void SetParallel(G4bool paraflag) = 0;
};
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VSamplerConfigurator.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4VSamplerConfigurator
//
// Class description:
//
// This is an interface for configurators setting up processes
// needed for importance sampling and scoring.
// The Configurator may be given a pointer to another Configurator.
// If a configurator will be given a pointer to another configurator
// it may obtain a G4VTrackTerminator from the given Configurator.
// This way it is possible to delegate the killing of a track.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4VSamplerConfigurator_hh
#define G4VSamplerConfigurator_hh G4VSamplerConfigurator_hh
#include "G4Types.hh"
#include <vector>
class G4VTrackTerminator;
class G4VSamplerConfigurator
{
public: // with description
G4VSamplerConfigurator();
virtual ~G4VSamplerConfigurator();
virtual void Configure(G4VSamplerConfigurator *preConf) = 0;
// Do the configuration, if preConf is given a
// G4VTrackTerminator may be obtained from it.
virtual const G4VTrackTerminator *GetTrackTerminator() const = 0;
// Return a G4VTrackTerminator or 0.
};
typedef std::vector<G4VSamplerConfigurator *> G4Configurators;
#endif
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4WeightCutOffConfigurator.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4WeightCutOffConfigurator
//
// Class description:
// This class builds and places the G4WeightCutOffProcess.
// If the object is deleted the process is removed from the
// process list.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4WeightCutOffConfigurator_hh
#define G4WeightCutOffConfigurator_hh G4WeightCutOffConfigurator_hh
#include "G4Types.hh"
#include "G4VSamplerConfigurator.hh"
#include "G4ProcessPlacer.hh"
class G4WeightCutOffProcess;
class G4VGCellFinder;
class G4VIStore;
class G4VPhysicalVolume;
class G4WeightCutOffConfigurator : public G4VSamplerConfigurator
{
public: // with description
G4WeightCutOffConfigurator(G4VPhysicalVolume* worldvolume,
const G4String &particlename,
G4double wsurvival,
G4double wlimit,
G4double isource,
G4VIStore *istore,
const G4VGCellFinder &aGCellFinder,G4bool paraflag);
virtual ~G4WeightCutOffConfigurator();
virtual void Configure(G4VSamplerConfigurator *preConf);
virtual const G4VTrackTerminator *GetTrackTerminator() const ;
private:
G4WeightCutOffConfigurator(const G4WeightCutOffConfigurator&);
G4WeightCutOffConfigurator &
operator=(const G4WeightCutOffConfigurator&);
G4VPhysicalVolume* fWorld;
G4ProcessPlacer fPlacer;
G4WeightCutOffProcess *fWeightCutOffProcess;
G4bool fPlaced;
G4bool paraflag;
};
#endif
@@ -0,0 +1,159 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4WeightCutOffProcess.hh,v 1.2 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4WeightCutOffProcess
//
// Class description:
//
// Process for biasing particle-change cutoff.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4WeightCutOffProcess_hh
#define G4WeightCutOffProcess_hh G4WeightCutOffProcess_hh
#include "G4VProcess.hh"
#include "G4VTrackTerminator.hh"
#include "G4GeometryCell.hh"
class G4VGCellFinder;
class G4VIStore;
class G4Step;
class G4Navigator;
class G4TransportationManager;
class G4PathFinder;
class G4VTouchable;
#include "G4FieldTrack.hh"
#include "G4TouchableHandle.hh"
class G4WeightCutOffProcess : public G4VProcess
{
public: // with description
G4WeightCutOffProcess(G4double wsurvival,
G4double wlimit,
G4double isource,
G4VIStore *istore,
const G4VGCellFinder &aGCellFinder,
const G4String &aName = "WeightCutOffProcess", G4bool para = false);
// create a G4ParticleChange
virtual ~G4WeightCutOffProcess();
// delete the G4ParticleChange
//--------------------------------------------------------------
// Set Paralle World
//--------------------------------------------------------------
void SetParallelWorld(G4String parallelWorldName);
void SetParallelWorld(G4VPhysicalVolume* parallelWorld);
//--------------------------------------------------------------
// Process interface
//--------------------------------------------------------------
void StartTracking(G4Track*);
virtual G4double
PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition);
// make the process beeing forced
virtual G4VParticleChange * PostStepDoIt(const G4Track&,
const G4Step&);
const G4String &GetName() const;
public: // without description
// no operation in AtRestDoIt and AlongStepDoIt
virtual G4double
AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*);
virtual G4double
AtRestGetPhysicalInteractionLength(const G4Track& ,
G4ForceCondition*);
virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
private:
void CopyStep(const G4Step & step);
G4Step * fGhostStep;
G4StepPoint * fGhostPreStepPoint;
G4StepPoint * fGhostPostStepPoint;
G4WeightCutOffProcess(const G4WeightCutOffProcess &);
G4WeightCutOffProcess &operator=(const G4WeightCutOffProcess &);
G4ParticleChange *fParticleChange;
G4double fWeightSurvival;
G4double fWeightLimit;
G4double fSourceImportance;
G4VIStore *fIStore;
const G4VGCellFinder &fGCellFinder;
G4TransportationManager* fTransportationManager;
G4PathFinder* fPathFinder;
// -------------------------------
// Navigation in the Ghost World:
// -------------------------------
G4String fGhostWorldName;
G4VPhysicalVolume* fGhostWorld;
G4Navigator* fGhostNavigator;
G4int fNavigatorID;
G4TouchableHandle fOldGhostTouchable;
G4TouchableHandle fNewGhostTouchable;
G4FieldTrack fFieldTrack;
G4double fGhostSafety;
G4bool fOnBoundary;
G4bool paraflag;
};
#endif
@@ -0,0 +1,87 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4WeightWindowConfigurator.hh,v 1.3 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4WeightWindowConfigurator
//
// Class description:
// Configuration of weight window processes.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4WeightWindowConfigurator_hh
#define G4WeightWindowConfigurator_hh G4WeightWindowConfigurator_hh
#include "G4Types.hh"
#include "G4ProcessPlacer.hh"
#include "G4VSamplerConfigurator.hh"
#include "G4PlaceOfAction.hh"
class G4VWeightWindowStore;
class G4VWeightWindowAlgorithm;
class G4WeightWindowProcess;
class G4VPhysicalVolume;
class G4WeightWindowConfigurator : public G4VSamplerConfigurator
{
public: // with description
G4WeightWindowConfigurator(G4VPhysicalVolume* worldvolume,
const G4String &particlename,
G4VWeightWindowStore &wwstore,
const G4VWeightWindowAlgorithm *wwAlg,
G4PlaceOfAction placeOfAction,
G4bool paraflag);
virtual ~G4WeightWindowConfigurator();
virtual void Configure(G4VSamplerConfigurator *preConf);
virtual const G4VTrackTerminator *GetTrackTerminator() const;
private:
G4WeightWindowConfigurator(const G4WeightWindowConfigurator &);
G4WeightWindowConfigurator &
operator=(const G4WeightWindowConfigurator &);
G4VPhysicalVolume* fWorld;
G4ProcessPlacer fPlacer;
G4VWeightWindowStore &fWeightWindowStore;
G4bool fDeleteWWalg;
const G4VWeightWindowAlgorithm *fWWalgorithm;
G4WeightWindowProcess *fWeightWindowProcess;
G4PlaceOfAction fPlaceOfAction;
G4bool paraflag;
};
#endif
@@ -0,0 +1,170 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4WeightWindowProcess.hh,v 1.3 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4MassWeioghtWindowProcess
//
// Class description:
//
// Used internally by weight window technique in the "mass" geometry.
// This process is a forced post step process. It will apply
// weight window biasing on boundaries, collisions
// or both according to the G4PlaceOfAction argument.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4MassWeioghtWindowProcess_hh
#define G4MassWeioghtWindowProcess_hh G4MassWeioghtWindowProcess_hh
#include "G4VProcess.hh"
#include "G4VTrackTerminator.hh"
#include "G4PlaceOfAction.hh"
class G4SamplingPostStepAction;
class G4VWeightWindowAlgorithm;
class G4VWeightWindowStore;
class G4Step;
class G4Navigator;
class G4TransportationManager;
class G4PathFinder;
class G4VTouchable;
#include "G4FieldTrack.hh"
#include "G4TouchableHandle.hh"
class G4WeightWindowProcess : public G4VProcess, public G4VTrackTerminator
{
public: // with description
G4WeightWindowProcess(const G4VWeightWindowAlgorithm &
aWeightWindowAlgorithm,
const G4VWeightWindowStore &aWWStore,
const G4VTrackTerminator *TrackTerminator,
G4PlaceOfAction placeOfAction,
const G4String &aName =
"WeightWindowProcess", G4bool para = false);
// creates a G4ParticleChange
virtual ~G4WeightWindowProcess();
// delete the G4ParticleChange
//--------------------------------------------------------------
// Set Paralle World
//--------------------------------------------------------------
void SetParallelWorld(G4String parallelWorldName);
void SetParallelWorld(G4VPhysicalVolume* parallelWorld);
//--------------------------------------------------------------
// Process interface
//--------------------------------------------------------------
void StartTracking(G4Track*);
virtual G4double
PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition);
// make process beeing forced
virtual G4VParticleChange *PostStepDoIt(const G4Track&, const G4Step&);
// aply weight window sampling
virtual void KillTrack() const;
// used in case no scoring process follows that does the killing
virtual const G4String &GetName() const;
public: // without description
// no operation in AtRestDoIt and AlongStepDoIt
virtual G4double
AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*);
virtual G4double
AtRestGetPhysicalInteractionLength(const G4Track& ,
G4ForceCondition*);
virtual G4VParticleChange*
AtRestDoIt(const G4Track&, const G4Step&);
virtual G4VParticleChange*
AlongStepDoIt(const G4Track&, const G4Step&);
private:
G4WeightWindowProcess(const G4WeightWindowProcess &);
G4WeightWindowProcess &operator=(const G4WeightWindowProcess &);
private:
void CopyStep(const G4Step & step);
G4Step * fGhostStep;
G4StepPoint * fGhostPreStepPoint;
G4StepPoint * fGhostPostStepPoint;
G4ParticleChange *fParticleChange;
const G4VWeightWindowAlgorithm &fWeightWindowAlgorithm;
const G4VWeightWindowStore &fWeightWindowStore;
G4SamplingPostStepAction *fPostStepAction;
G4PlaceOfAction fPlaceOfAction;
G4TransportationManager* fTransportationManager;
G4PathFinder* fPathFinder;
// -------------------------------
// Navigation in the Ghost World:
// -------------------------------
G4String fGhostWorldName;
G4VPhysicalVolume* fGhostWorld;
G4Navigator* fGhostNavigator;
G4int fNavigatorID;
G4TouchableHandle fOldGhostTouchable;
G4TouchableHandle fNewGhostTouchable;
G4FieldTrack fFieldTrack;
G4double fGhostSafety;
G4bool fOnBoundary;
G4bool paraflag;
};
#endif
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GCellFinder.cc,v 1.2 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4GCellFinder.cc
//
// ----------------------------------------------------------------------
#include "G4GCellFinder.hh"
#include "G4TouchableHandle.hh"
#include "G4Step.hh"
G4GCellFinder::G4GCellFinder()
{
}
G4GCellFinder::~G4GCellFinder()
{
}
G4GeometryCell
G4GCellFinder::GetPreGeometryCell(const G4Step &aStep) const
{
const G4TouchableHandle& th =
aStep.GetPreStepPoint()->GetTouchableHandle();
G4GeometryCell g(*th->GetVolume(), th->GetReplicaNumber());
return g;
}
G4GeometryCell
G4GCellFinder::GetPostGeometryCell(const G4Step &aStep) const
{
const G4TouchableHandle& th =
aStep.GetPostStepPoint()->GetTouchableHandle();
G4GeometryCell g(*th->GetVolume(), th->GetReplicaNumber());
return g;
}
@@ -0,0 +1,263 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4GeometrySampler.cc,v 1.8 2007/06/01 09:52:23 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4GeometrySampler.cc
//
// ----------------------------------------------------------------------
#include "G4GeometrySampler.hh"
#include "G4VIStore.hh"
#include "G4WeightWindowStore.hh"
//#include "G4VScorer.hh"
#include "G4VPhysicalVolume.hh"
//#include "G4ScoreConfigurator.hh"
#include "G4ImportanceConfigurator.hh"
#include "G4WeightWindowConfigurator.hh"
#include "G4WeightCutOffConfigurator.hh"
#include "G4GCellFinder.hh"
G4GeometrySampler::
G4GeometrySampler(G4VPhysicalVolume *parallelworld, const G4String &particlename)
: fParticleName(particlename),
fWorld(parallelworld),
fImportanceConfigurator(0),
// fScoreConfigurator(0),
fGCellFinder(0),
fWeightCutOffConfigurator(0),
fIStore(0),
fWeightWindowConfigurator(0),
fWWStore(0),
fIsConfigured(false)
{
paraflag = false;
}
G4GeometrySampler::~G4GeometrySampler()
{
ClearSampling();
}
void G4GeometrySampler::ClearSampling()
{
if (fImportanceConfigurator)
{
delete fImportanceConfigurator;
fImportanceConfigurator = 0;
}
if (fWeightWindowConfigurator)
{
delete fWeightWindowConfigurator;
fWeightWindowConfigurator = 0;
}
// if (fScoreConfigurator)
// {
// delete fScoreConfigurator;
// fScoreConfigurator = 0;
// }
if (fWeightCutOffConfigurator)
{
delete fWeightCutOffConfigurator;
fWeightCutOffConfigurator = 0;
}
if (fGCellFinder)
{
delete fGCellFinder;
fGCellFinder = 0;
}
fIStore = 0;
fConfigurators.clear();
fIsConfigured = false;
}
G4bool G4GeometrySampler::IsConfigured() const
{
G4bool isconf = false;
if (fIsConfigured)
{
G4cout << "WARNING - G4GeometrySampler::IsConfigured()"
<< " Some initalization exists, use ClearSampling()"
<< " before a new initialization !" << G4endl;
isconf = true;
}
return isconf;
}
// void G4GeometrySampler::PrepareScoring(G4VScorer *scorer)
// {
// G4cout << " preparing scoring configurator " << G4endl;
// G4cout << G4endl;
// G4cout << G4endl;
// G4cout << G4endl;
// G4cout << " new fWorld Name: " << fWorld->GetName() << G4endl;
// G4cout << G4endl;
// G4cout << G4endl;
// G4cout << G4endl;
// fScoreConfigurator = new G4ScoreConfigurator(fWorld, fParticleName, *scorer, paraflag);
// G4cout << " configured scoring " << G4endl;
// if (!fScoreConfigurator)
// {
// G4Exception("G4GeometrySampler::PrepareScoring()",
// "FatalError", FatalException,
// "Failed allocation of G4ScoreConfigurator !");
// }
// }
void
G4GeometrySampler::PrepareImportanceSampling(G4VIStore *istore,
const G4VImportanceAlgorithm *ialg)
{
G4cout << " preparing importance sampling " << G4endl;
fIStore = istore;
G4cout << " creating istore " << G4endl;
fImportanceConfigurator =
new G4ImportanceConfigurator(fWorld, fParticleName, *fIStore, ialg, paraflag);
G4cout << " creating importance configurator " << G4endl;
if (!fImportanceConfigurator)
{
G4Exception("G4GeometrySampler::PrepareImportanceSampling()",
"FatalError", FatalException,
"Failed allocation of G4ImportanceConfigurator !");
}
}
void
G4GeometrySampler::PrepareWeightRoulett(G4double wsurvive,
G4double wlimit,
G4double isource)
{
// fGCellFinder = new G4GCellFinder(fWorld);
G4cout << " preparing weight roulette" << G4endl;
fGCellFinder = new G4GCellFinder();
if (!fGCellFinder)
{
G4Exception("G4GeometrySampler::PrepareWeightRoulett()",
"FatalError", FatalException,
"Failed allocation of G4GCellFinder !");
}
fWeightCutOffConfigurator =
new G4WeightCutOffConfigurator(fWorld, fParticleName,
wsurvive,
wlimit,
isource,
fIStore,
*fGCellFinder, paraflag);
if (!fWeightCutOffConfigurator)
{
G4Exception("G4GeometrySampler::PrepareWeightRoulett()",
"FatalError", FatalException,
"Failed allocation of G4WeightCutOffConfigurator !");
}
}
void
G4GeometrySampler::PrepareWeightWindow(G4VWeightWindowStore *wwstore,
G4VWeightWindowAlgorithm *wwAlg,
G4PlaceOfAction placeOfAction)
{
G4cout << " preparing weight window" << G4endl;
fWWStore = wwstore;
fWeightWindowConfigurator =
new G4WeightWindowConfigurator(fWorld, fParticleName,
*fWWStore,
wwAlg,
placeOfAction, paraflag);
}
void G4GeometrySampler::Configure()
{
G4cout << " entering configure " << G4endl;
if (!IsConfigured())
{
fIsConfigured = true;
// if (fScoreConfigurator)
// {
// G4cout << " score configurator push_back " << G4endl;
// fConfigurators.push_back(fScoreConfigurator);
// G4cout << " pushed " << G4endl;
// }
if (fImportanceConfigurator)
{
G4cout << " importance configurator push_back " << G4endl;
fConfigurators.push_back(fImportanceConfigurator);
G4cout << " pushed " << G4endl;
}
if (fWeightWindowConfigurator)
{
G4cout << " weight window configurator push_back " << G4endl;
fConfigurators.push_back(fWeightWindowConfigurator);
G4cout << " pushed " << G4endl;
}
G4cout << " vsampler configurator loop " << G4endl;
G4VSamplerConfigurator *preConf = 0;
G4int i = 0;
for (G4Configurators::iterator it = fConfigurators.begin();
it != fConfigurators.end(); it++)
{
i++;
G4cout << " looping " << i << G4endl;
G4VSamplerConfigurator *currConf =*it;
G4cout << " sampler configurator " << G4endl;
currConf->Configure(preConf);
G4cout << " configure preconf " << G4endl;
preConf = *it;
}
if (fWeightCutOffConfigurator)
{
G4cout << " NEW weight window configure " << G4endl;
fWeightCutOffConfigurator->Configure(0);
G4cout << " configured " << G4endl;
}
}
return;
}
void G4GeometrySampler::SetParallel(G4bool para)
{
paraflag = para;
}
void G4GeometrySampler::SetParticle(const G4String &particlename)
{
fParticleName = particlename;
}
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ImportanceConfigurator.cc,v 1.3 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4ImportanceConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#include "G4ImportanceConfigurator.hh"
#include "G4ImportanceProcess.hh"
#include "G4ProcessPlacer.hh"
#include "G4ImportanceAlgorithm.hh"
G4ImportanceConfigurator::
G4ImportanceConfigurator(G4VPhysicalVolume* worldvolume,
const G4String &particlename,
G4VIStore &istore,
const G4VImportanceAlgorithm *ialg, G4bool para)
: fWorld(worldvolume),
fPlacer(particlename),
fIStore(istore),
fDeleteIalg( ( ! ialg) ),
fIalgorithm(( (fDeleteIalg) ?
new G4ImportanceAlgorithm : ialg)),
fImportanceProcess(0),
paraflag(para)
{
}
G4ImportanceConfigurator::~G4ImportanceConfigurator()
{
if (fImportanceProcess)
{
fPlacer.RemoveProcess(fImportanceProcess);
delete fImportanceProcess;
}
if (fDeleteIalg)
{
delete fIalgorithm;
}
}
void
G4ImportanceConfigurator::Configure(G4VSamplerConfigurator *preConf)
{
G4cout << " entering importance configure, paraflag " << paraflag << G4endl;
const G4VTrackTerminator *terminator = 0;
if (preConf)
{
terminator = preConf->GetTrackTerminator();
};
G4cout << " creating importance process, paraflag is: " << paraflag << G4endl;
fImportanceProcess =
new G4ImportanceProcess(*fIalgorithm,
fIStore,
terminator,"ImportanceProcess",paraflag);
if (!fImportanceProcess)
{
G4Exception("G4ImportanceConfigurator::Configure()",
"FatalError", FatalException,
"Failed allocation of G4ImportanceProcess !");
}
if(paraflag) fImportanceProcess->SetParallelWorld(fWorld);
fPlacer.AddProcessAsSecondDoIt(fImportanceProcess);
}
const G4VTrackTerminator *G4ImportanceConfigurator::
GetTrackTerminator() const
{
return fImportanceProcess;
}
@@ -0,0 +1,471 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ImportanceProcess.cc,v 1.3 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ImportanceProcess.cc
//
// ----------------------------------------------------------------------
#include "G4ImportanceProcess.hh"
#include "G4VImportanceAlgorithm.hh"
#include "G4GeometryCell.hh"
#include "G4SamplingPostStepAction.hh"
#include "G4VTrackTerminator.hh"
#include "G4VIStore.hh"
#include "G4Step.hh"
#include "G4Navigator.hh"
#include "G4VTouchable.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ParticleChange.hh"
#include "G4PathFinder.hh"
#include "G4TransportationManager.hh"
#include "G4StepPoint.hh"
#include "G4FieldTrackUpdator.hh"
G4ImportanceProcess::
G4ImportanceProcess(const G4VImportanceAlgorithm &aImportanceAlgorithm,
const G4VIStore &aIstore,
const G4VTrackTerminator *TrackTerminator,
const G4String &aName, G4bool para)
: G4VProcess(aName),
fParticleChange(new G4ParticleChange),
fImportanceAlgorithm(aImportanceAlgorithm),
fIStore(aIstore),
fPostStepAction(0),
fGhostNavigator(0), fNavigatorID(-1), fFieldTrack('0'),
paraflag(para)
{
if (TrackTerminator)
{
fPostStepAction = new G4SamplingPostStepAction(*TrackTerminator);
}
else
{
fPostStepAction = new G4SamplingPostStepAction(*this);
}
if (!fParticleChange)
{
G4Exception("G4ImportanceProcess::G4ImportanceProcess()",
"FatalError", FatalException,
"Failed allocation of G4ParticleChange !");
}
G4VProcess::pParticleChange = fParticleChange;
fGhostStep = new G4Step();
fGhostPreStepPoint = fGhostStep->GetPreStepPoint();
fGhostPostStepPoint = fGhostStep->GetPostStepPoint();
fTransportationManager = G4TransportationManager::GetTransportationManager();
fPathFinder = G4PathFinder::GetInstance();
if (verboseLevel>0)
{
G4cout << GetProcessName() << " is created " << G4endl;
}
G4cout << " importance process paraflag is: " << paraflag << G4endl;
}
G4ImportanceProcess::~G4ImportanceProcess()
{
delete fPostStepAction;
delete fParticleChange;
delete fGhostStep;
}
//------------------------------------------------------
//
// SetParallelWorld
//
//------------------------------------------------------
void G4ImportanceProcess::
SetParallelWorld(G4String parallelWorldName)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Get pointers of the parallel world and its navigator
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fGhostWorldName = parallelWorldName;
fGhostWorld = fTransportationManager->GetParallelWorld(fGhostWorldName);
fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
void G4ImportanceProcess::
SetParallelWorld(G4VPhysicalVolume* parallelWorld)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Get pointer of navigator
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fGhostWorldName = parallelWorld->GetName();
fGhostWorld = parallelWorld;
fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
//------------------------------------------------------
//
// StartTracking
//
//------------------------------------------------------
void G4ImportanceProcess::StartTracking(G4Track* trk)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Activate navigator and get the navigator ID
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// G4cout << " G4ParallelWorldScoringProcess::StartTracking" << G4endl;
if(paraflag) {
if(fGhostNavigator)
{ fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator); }
else
{
G4Exception("G4ImportanceProcess::StartTracking",
"ProcParaWorld000",FatalException,
"G4ImportanceProcess is used for tracking without having a parallel world assigned");
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// G4cout << "G4ParallelWorldScoringProcess::StartTracking <<<<<<<<<<<<<<<<<< " << G4endl;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Let PathFinder initialize
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fPathFinder->PrepareNewTrack(trk->GetPosition(),trk->GetMomentumDirection());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Setup initial touchables for the first step
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fOldGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
fNewGhostTouchable = fOldGhostTouchable;
fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
// Initialize
fGhostSafety = -1.;
fOnBoundary = false;
}
}
G4double G4ImportanceProcess::
PostStepGetPhysicalInteractionLength(const G4Track& ,
G4double ,
G4ForceCondition* condition)
{
// *condition = Forced;
// return kInfinity;
// *condition = StronglyForced;
*condition = Forced;
return DBL_MAX;
}
G4VParticleChange *
G4ImportanceProcess::PostStepDoIt(const G4Track &aTrack,
const G4Step &aStep)
{
fParticleChange->Initialize(aTrack);
if(paraflag) {
fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
//xbug? fOnBoundary = false;
CopyStep(aStep);
if(fOnBoundary)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Locate the point and get new touchable
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//?? fPathFinder->Locate(step.GetPostStepPoint()->GetPosition(),
//?? step.GetPostStepPoint()->GetMomentumDirection());
fNewGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
//AH G4cout << " on boundary " << G4endl;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
else
{
// Do I need this ??????????????????????????????????????????????????????????
// fGhostNavigator->LocateGlobalPointWithinVolume(track.GetPosition());
// ?????????????????????????????????????????????????????????????????????????
// fPathFinder->ReLocate(track.GetPosition());
// reuse the touchable
fNewGhostTouchable = fOldGhostTouchable;
//AH G4cout << " NOT on boundary " << G4endl;
}
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
// if ( (aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary)
// && (aStep.GetStepLength() > kCarTolerance) )
// {
// if (aTrack.GetTrackStatus()==fStopAndKill)
// {
// G4cout << "WARNING - G4ImportanceProcess::PostStepDoIt()"
// << " StopAndKill track." << G4endl;
// }
// G4StepPoint *prepoint = aStep.GetPreStepPoint();
// G4StepPoint *postpoint = aStep.GetPostStepPoint();
// G4GeometryCell prekey(*(prepoint->GetPhysicalVolume()),
// prepoint->GetTouchable()->GetReplicaNumber());
// G4GeometryCell postkey(*(postpoint->GetPhysicalVolume()),
// postpoint->GetTouchable()->GetReplicaNumber());
if ( (fGhostPostStepPoint->GetStepStatus() == fGeomBoundary)
&& (aStep.GetStepLength() > kCarTolerance) )
{
if (aTrack.GetTrackStatus()==fStopAndKill)
{
G4cout << "WARNING - G4ImportanceProcess::PostStepDoIt()"
<< " StopAndKill track. on boundary" << G4endl;
}
G4GeometryCell prekey(*(fGhostPreStepPoint->GetPhysicalVolume()),
fGhostPreStepPoint->GetTouchable()->GetReplicaNumber());
G4GeometryCell postkey(*(fGhostPostStepPoint->GetPhysicalVolume()),
fGhostPostStepPoint->GetTouchable()->GetReplicaNumber());
//AH
/*
G4cout << G4endl;
G4cout << G4endl;
G4cout << " inside parallel importance process " << aTrack.GetCurrentStepNumber() << G4endl;
G4cout << G4endl;
G4cout << G4endl;
G4cout << " prekey: " << fGhostPreStepPoint->GetPhysicalVolume()->GetName() << " replica:"
<< fGhostPreStepPoint->GetTouchable()->GetReplicaNumber() << G4endl;
G4cout << " prekey ISTORE: " << fIStore.GetImportance(prekey) << G4endl;
G4cout << " postkey: " << G4endl;
G4cout << " postkey ISTORE: " << fIStore.GetImportance(postkey) << G4endl;
*/
//AH
G4Nsplit_Weight nw = fImportanceAlgorithm.
Calculate(fIStore.GetImportance(prekey),
fIStore.GetImportance(postkey),
aTrack.GetWeight());
//AH
/*
G4cout << " prekey weight: " << fIStore.GetImportance(prekey)
<< " postkey weight: " << fIStore.GetImportance(postkey)
<< " split weight: " << nw << G4endl;
G4cout << " before poststepaction " << G4endl;
*/
//AH
fPostStepAction->DoIt(aTrack, fParticleChange, nw);
//AH G4cout << " after post step do it " << G4endl;
}
} else {
if ( (aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary)
&& (aStep.GetStepLength() > kCarTolerance) )
{
//AH G4cout << " inside non-parallel importance process " << G4endl;
if (aTrack.GetTrackStatus()==fStopAndKill)
{
G4cout << "WARNING - G4ImportanceProcess::PostStepDoIt()"
<< " StopAndKill track. on boundary non-parallel" << G4endl;
}
G4StepPoint *prepoint = aStep.GetPreStepPoint();
G4StepPoint *postpoint = aStep.GetPostStepPoint();
G4GeometryCell prekey(*(prepoint->GetPhysicalVolume()),
prepoint->GetTouchable()->GetReplicaNumber());
G4GeometryCell postkey(*(postpoint->GetPhysicalVolume()),
postpoint->GetTouchable()->GetReplicaNumber());
G4Nsplit_Weight nw = fImportanceAlgorithm.
Calculate(fIStore.GetImportance(prekey),
fIStore.GetImportance(postkey),
aTrack.GetWeight());
//AH
/*
G4cout << " prekey weight: " << fIStore.GetImportance(prekey)
<< " postkey weight: " << fIStore.GetImportance(postkey)
<< " split weight: " << nw << G4endl;
G4cout << " before poststepaction 2 " << G4endl;
*/
//AH
fPostStepAction->DoIt(aTrack, fParticleChange, nw);
//AH G4cout << " after poststepaction 2 " << G4endl;
}
}
return fParticleChange;
}
void G4ImportanceProcess::KillTrack() const
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
}
const G4String &G4ImportanceProcess::GetName() const
{
return theProcessName;
}
G4double G4ImportanceProcess::
AlongStepGetPhysicalInteractionLength(
const G4Track& track, G4double previousStepSize, G4double currentMinimumStep,
G4double& proposedSafety, G4GPILSelection* selection)
{
//AH G4cout << " along step physical interaction length " << G4endl;
if(paraflag) {
static G4FieldTrack endTrack('0');
static ELimited eLimited;
*selection = NotCandidateForSelection;
G4double returnedStep = DBL_MAX;
if (previousStepSize > 0.)
{ fGhostSafety -= previousStepSize; }
// else
// { fGhostSafety = -1.; }
if (fGhostSafety < 0.) fGhostSafety = 0.0;
// ------------------------------------------
// Determination of the proposed STEP LENGTH:
// ------------------------------------------
if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
{
// I have no chance to limit
returnedStep = currentMinimumStep;
fOnBoundary = false;
proposedSafety = fGhostSafety - currentMinimumStep;
//AH G4cout << " step not limited, why? " << G4endl;
}
else // (currentMinimumStep > fGhostSafety: I may limit the Step)
{
G4FieldTrackUpdator::Update(&fFieldTrack,&track);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ComputeStep
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
returnedStep
= fPathFinder->ComputeStep(fFieldTrack,currentMinimumStep,fNavigatorID,
track.GetCurrentStepNumber(),fGhostSafety,eLimited,
endTrack,track.GetVolume());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(eLimited == kDoNot)
{
//AH G4cout << " computestep came back with not-boundary " << G4endl;
// Track is not on the boundary
fOnBoundary = false;
fGhostSafety = fGhostNavigator->ComputeSafety(endTrack.GetPosition());
}
else
{
// Track is on the boundary
//AH G4cout << " FOUND A BOUNDARY ! " << track.GetCurrentStepNumber() << G4endl;
fOnBoundary = true;
// proposedSafety = fGhostSafety;
}
proposedSafety = fGhostSafety;
if(eLimited == kUnique || eLimited == kSharedOther) {
*selection = CandidateForSelection;
}else if (eLimited == kSharedTransport) {
returnedStep *= (1.0 + 1.0e-9);
// Expand to disable its selection in Step Manager comparison
}
}
// ----------------------------------------------
// Returns the fGhostSafety as the proposedSafety
// The SteppingManager will take care of keeping
// the smallest one.
// ----------------------------------------------
return returnedStep;
} else {
return DBL_MAX;
}
}
G4double G4ImportanceProcess::
AtRestGetPhysicalInteractionLength(const G4Track& ,
G4ForceCondition*)
{
return -1.0;
}
G4VParticleChange* G4ImportanceProcess::
AtRestDoIt(const G4Track&, const G4Step&)
{
return 0;
}
G4VParticleChange* G4ImportanceProcess::
AlongStepDoIt(const G4Track& aTrack, const G4Step& )
{
// Dummy ParticleChange ie: does nothing
// Expecting G4Transportation to move the track
//AH G4cout << " along step do it " << G4endl;
pParticleChange->Initialize(aTrack);
return pParticleChange;
// return 0;
}
void G4ImportanceProcess::CopyStep(const G4Step & step)
{
fGhostStep->SetTrack(step.GetTrack());
fGhostStep->SetStepLength(step.GetStepLength());
fGhostStep->SetTotalEnergyDeposit(step.GetTotalEnergyDeposit());
fGhostStep->SetControlFlag(step.GetControlFlag());
*fGhostPreStepPoint = *(step.GetPreStepPoint());
*fGhostPostStepPoint = *(step.GetPostStepPoint());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Set StepStatus for ghost world
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(fOnBoundary)
{ fGhostPostStepPoint->SetStepStatus(fGeomBoundary); }
else if(fGhostPostStepPoint->GetStepStatus()==fGeomBoundary)
{ fGhostPostStepPoint->SetStepStatus(fPostStepDoItProc); }
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
@@ -0,0 +1,207 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ProcessPlacer.cc,v 1.3 2007/06/12 17:24:39 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ProcessPlacer.cc
//
// ----------------------------------------------------------------------
#include "G4ProcessPlacer.hh"
#include "G4ProcessManager.hh"
#include "G4VProcess.hh"
#include "G4ParticleTable.hh"
G4ProcessPlacer::G4ProcessPlacer(const G4String &particlename)
: fParticleName(particlename)
{
}
G4ProcessPlacer::~G4ProcessPlacer()
{
}
void G4ProcessPlacer::RemoveProcess(G4VProcess *process)
{
G4cout << "=== G4ProcessPlacer::RemoveProcess: for: " << fParticleName
<< G4endl;
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();
G4cout << "================================================" << G4endl;
}
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" && transportation->GetProcessName() != "Transportation8" && transportation->GetProcessName() != "CoupledTransportation")
{
// G4cout << " GOT HERE CoupledTransportation" << G4endl;
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);
// xx test
// if(process->GetProcessName() == "ImportanceProcess")
GetProcessManager()->SetProcessOrdering(process,
idxAlongStep, 1);
// 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: for: "
<< fParticleName << G4endl;
AddProcessAs(process, eSecond);
}
void G4ProcessPlacer::AddProcessAsLastDoIt(G4VProcess *process)
{
G4cout << "=== G4ProcessPlacer::AddProcessAsLastDoIt: for: "
<< fParticleName << G4endl;
AddProcessAs(process, eLast);
}
G4ProcessManager *G4ProcessPlacer::GetProcessManager()
{
// get particle iterator to add processes ---------------------
G4ParticleTable* theParticleTable = 0;
G4ParticleTable::G4PTblDicIterator* theParticleIterator = 0;
theParticleTable = G4ParticleTable::GetParticleTable();
theParticleIterator = theParticleTable->GetIterator();
// -------------------------------------------------------
G4ProcessManager *processmanager = 0;
// find process manager ---------------------------
theParticleIterator->reset();
while( (*theParticleIterator)() )
{
G4ParticleDefinition* particle = theParticleIterator->value();
if (particle->GetParticleName() == fParticleName)
{
processmanager = particle->GetProcessManager();
break;
}
}
// ---------------------------------------------------------
if (!processmanager)
{
G4Exception("G4ProcessPlacer::GetProcessManager()", "InvalidSetup",
FatalException, "NULL pointer to Process Manager ! Sampler.Configure() must be after PhysicsList instantiation");
}
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()", "InvalidArgument",
FatalException, "NULL pointer to process-vector !");
}
G4int len = processVec->length();
if (len==0)
{
G4Exception("G4ProcessPlacer::G4ProcessPlacer()", "InvalidSetup",
FatalException, "Length of process-vector is zero !");
}
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;
}
}
}
@@ -0,0 +1,111 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4SamplingPostStepAction.cc,v 1.2 2007/06/01 09:16:33 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4SamplingPostStepAction.cc
//
// ----------------------------------------------------------------------
#include "G4SamplingPostStepAction.hh"
#include "G4Track.hh"
#include "G4ParticleChange.hh"
#include "G4VImportanceSplitExaminer.hh"
#include "G4Nsplit_Weight.hh"
#include "G4VTrackTerminator.hh"
#include <sstream>
G4SamplingPostStepAction::
G4SamplingPostStepAction(const G4VTrackTerminator &TrackTerminator)
: fTrackTerminator(TrackTerminator)
{
}
G4SamplingPostStepAction::~G4SamplingPostStepAction()
{
}
void G4SamplingPostStepAction::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->ProposeWeight(nw.fW);
}
else if (nw.fN==0)
{
// kill track
fTrackTerminator.KillTrack();
}
else
{
// wrong answer
std::ostringstream os;
os << "Sampler returned nw = "
<< nw
<< "\n";
G4String m = os.str();
G4Exception("G4SamplingPostStepAction::DoIt()",
"InvalidCondition", FatalException, m);
}
}
void G4SamplingPostStepAction::Split(const G4Track &aTrack,
const G4Nsplit_Weight &nw,
G4ParticleChange *aParticleChange)
{
aParticleChange->ProposeWeight(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("G4SamplingPostStepAction::Split()", "InvalidCondition",
FatalException, "Track with same momentum !");
}
aParticleChange->AddSecondary(ptrack);
}
return;
}
@@ -0,0 +1,42 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VProcessPlacer.cc,v 1.1 2007/06/01 14:57:03 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4VProcessPlacer.cc
//
// ----------------------------------------------------------------------
#include "G4VProcessPlacer.hh"
G4VProcessPlacer::G4VProcessPlacer()
{}
G4VProcessPlacer::~G4VProcessPlacer()
{}
@@ -0,0 +1,43 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VSampler.cc,v 1.2 2007/06/01 09:16:34 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4VSampler.cc
//
// ----------------------------------------------------------------------
#include "G4VSampler.hh"
G4VSampler::G4VSampler()
{}
G4VSampler::~G4VSampler()
{}
@@ -0,0 +1,45 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VSamplerConfigurator.cc,v 1.2 2007/06/01 09:16:34 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4VSamplerConfigurator.cc
//
// ----------------------------------------------------------------------
#include "G4VSamplerConfigurator.hh"
G4VSamplerConfigurator::G4VSamplerConfigurator()
{}
G4VSamplerConfigurator::~G4VSamplerConfigurator()
{}
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4WeightCutOffConfigurator.cc,v 1.2 2007/06/01 09:16:34 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4WeightCutOffConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#include "G4WeightCutOffConfigurator.hh"
#include "G4WeightCutOffProcess.hh"
G4WeightCutOffConfigurator::
G4WeightCutOffConfigurator(G4VPhysicalVolume* worldvolume,
const G4String &particlename,
G4double wsurvival,
G4double wlimit,
G4double isource,
G4VIStore *istore,
const G4VGCellFinder &aGCellfinder, G4bool para)
: fWorld(worldvolume),
fPlacer(particlename),
fPlaced(false),
paraflag(para)
{
fWeightCutOffProcess =
new G4WeightCutOffProcess(wsurvival,wlimit,isource,istore,aGCellfinder,"WeightCutOffProcess",paraflag);
if (!fWeightCutOffProcess)
{
G4Exception("G4WeightCutOffConfigurator::G4WeightCutOffConfigurator()",
"FatalError", FatalException,
"Failed to allocate G4WeightCutOffProcess !");
}
}
G4WeightCutOffConfigurator::~G4WeightCutOffConfigurator()
{
if (fPlaced)
{
fPlacer.RemoveProcess(fWeightCutOffProcess);
delete fWeightCutOffProcess;
}
}
void G4WeightCutOffConfigurator::Configure(G4VSamplerConfigurator *)
{
G4cout << " entering new weight window configure " << G4endl;
if(paraflag) fWeightCutOffProcess->SetParallelWorld(fWorld);
fPlacer.AddProcessAsLastDoIt(fWeightCutOffProcess);
fPlaced = true;
}
const G4VTrackTerminator
*G4WeightCutOffConfigurator::GetTrackTerminator() const
{
return 0;
}
@@ -0,0 +1,378 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4WeightCutOffProcess.cc,v 1.2 2007/06/01 09:16:34 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4WeightCutOffProcess.cc
//
// ----------------------------------------------------------------------
#include "G4WeightCutOffProcess.hh"
//#include "G4VScorer.hh"
#include "G4GeometryCellStep.hh"
#include "G4GCellFinder.hh"
#include "G4TouchableHandle.hh"
#include "G4VIStore.hh"
#include "G4Step.hh"
#include "G4Navigator.hh"
#include "G4VTouchable.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ParticleChange.hh"
#include "G4PathFinder.hh"
#include "G4TransportationManager.hh"
#include "G4StepPoint.hh"
#include "G4FieldTrackUpdator.hh"
G4WeightCutOffProcess::
G4WeightCutOffProcess(G4double wsurvival,
G4double wlimit,
G4double isource,
G4VIStore *istore,
const G4VGCellFinder &aGCellFinder,
const G4String &aName, G4bool para)
: G4VProcess(aName),
fParticleChange(new G4ParticleChange),
fWeightSurvival(wsurvival),
fWeightLimit(wlimit),
fSourceImportance(isource),
fIStore(istore),
fGCellFinder(aGCellFinder),
fGhostNavigator(0), fNavigatorID(-1), fFieldTrack('0')
{
if (!fParticleChange)
{
G4Exception("G4WeightCutOffProcess::G4WeightCutOffProcess()",
"FatalError", FatalException,
"Failed to allocate G4ParticleChange !");
}
G4VProcess::pParticleChange = fParticleChange;
fGhostStep = new G4Step();
fGhostPreStepPoint = fGhostStep->GetPreStepPoint();
fGhostPostStepPoint = fGhostStep->GetPostStepPoint();
fTransportationManager = G4TransportationManager::GetTransportationManager();
fPathFinder = G4PathFinder::GetInstance();
if (verboseLevel>0)
{
G4cout << GetProcessName() << " is created " << G4endl;
}
paraflag = para;
}
G4WeightCutOffProcess::~G4WeightCutOffProcess()
{
delete fParticleChange;
delete fGhostStep;
}
//------------------------------------------------------
//
// SetParallelWorld
//
//------------------------------------------------------
void G4WeightCutOffProcess::
SetParallelWorld(G4String parallelWorldName)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Get pointers of the parallel world and its navigator
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fGhostWorldName = parallelWorldName;
fGhostWorld = fTransportationManager->GetParallelWorld(fGhostWorldName);
fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
void G4WeightCutOffProcess::
SetParallelWorld(G4VPhysicalVolume* parallelWorld)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Get pointer of navigator
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fGhostWorldName = parallelWorld->GetName();
fGhostWorld = parallelWorld;
fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
//------------------------------------------------------
//
// StartTracking
//
//------------------------------------------------------
void G4WeightCutOffProcess::StartTracking(G4Track* trk)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Activate navigator and get the navigator ID
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// G4cout << " G4ParallelWorldScoringProcess::StartTracking" << G4endl;
if(paraflag) {
if(fGhostNavigator)
{ fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator); }
else
{
G4Exception("G4WeightCutOffProcess::StartTracking",
"ProcParaWorld000",FatalException,
"G4WeightCutOffProcess is used for tracking without having a parallel world assigned");
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// G4cout << "G4ParallelWorldScoringProcess::StartTracking <<<<<<<<<<<<<<<<<< " << G4endl;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Let PathFinder initialize
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fPathFinder->PrepareNewTrack(trk->GetPosition(),trk->GetMomentumDirection());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Setup initial touchables for the first step
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fOldGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
fNewGhostTouchable = fOldGhostTouchable;
fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
// Initialize
fGhostSafety = -1.;
fOnBoundary = false;
}
}
G4double G4WeightCutOffProcess::
PostStepGetPhysicalInteractionLength(const G4Track &,
G4double, G4ForceCondition* condition)
{
// *condition = Forced;
// return kInfinity;
// *condition = StronglyForced;
*condition = Forced;
return DBL_MAX;
}
G4VParticleChange *
G4WeightCutOffProcess::PostStepDoIt(const G4Track& aTrack,
const G4Step &aStep)
{
fParticleChange->Initialize(aTrack);
if(paraflag) {
fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
//xbug? fOnBoundary = false;
CopyStep(aStep);
if(fOnBoundary)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Locate the point and get new touchable
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//?? fPathFinder->Locate(step.GetPostStepPoint()->GetPosition(),
//?? step.GetPostStepPoint()->GetMomentumDirection());
fNewGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
else
{
// Do I need this ??????????????????????????????????????????????????????????
// fGhostNavigator->LocateGlobalPointWithinVolume(track.GetPosition());
// ?????????????????????????????????????????????????????????????????????????
// fPathFinder->ReLocate(track.GetPosition());
// reuse the touchable
fNewGhostTouchable = fOldGhostTouchable;
}
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
}
G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(aStep);
// G4GeometryCell postCell = fGCellFinder.GetPostGeometryCell(fGhostStep);
G4double R = fSourceImportance;
if (fIStore)
{
G4double i = fIStore->GetImportance(postCell);
if (i>0)
{
R/=i;
}
}
G4double w = aTrack.GetWeight();
if (w<R*fWeightLimit)
{
G4double ws = fWeightSurvival*R;
G4double p = w/(ws);
if (G4UniformRand()<p)
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
}
else
{
fParticleChange->ProposeWeight(ws);
}
}
return fParticleChange;
}
const G4String &G4WeightCutOffProcess::GetName() const
{
return theProcessName;
}
G4double G4WeightCutOffProcess::
AlongStepGetPhysicalInteractionLength(
const G4Track& track, G4double previousStepSize, G4double currentMinimumStep,
G4double& proposedSafety, G4GPILSelection* selection)
{
if(paraflag) {
static G4FieldTrack endTrack('0');
static ELimited eLimited;
*selection = NotCandidateForSelection;
G4double returnedStep = DBL_MAX;
if (previousStepSize > 0.)
{ fGhostSafety -= previousStepSize; }
// else
// { fGhostSafety = -1.; }
if (fGhostSafety < 0.) fGhostSafety = 0.0;
// ------------------------------------------
// Determination of the proposed STEP LENGTH:
// ------------------------------------------
if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
{
// I have no chance to limit
returnedStep = currentMinimumStep;
fOnBoundary = false;
proposedSafety = fGhostSafety - currentMinimumStep;
}
else // (currentMinimumStep > fGhostSafety: I may limit the Step)
{
G4FieldTrackUpdator::Update(&fFieldTrack,&track);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ComputeStep
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
returnedStep
= fPathFinder->ComputeStep(fFieldTrack,currentMinimumStep,fNavigatorID,
track.GetCurrentStepNumber(),fGhostSafety,eLimited,
endTrack,track.GetVolume());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(eLimited == kDoNot)
{
// Track is not on the boundary
fOnBoundary = false;
fGhostSafety = fGhostNavigator->ComputeSafety(endTrack.GetPosition());
}
else
{
// Track is on the boundary
fOnBoundary = true;
proposedSafety = fGhostSafety;
}
//xbug? proposedSafety = fGhostSafety;
if(eLimited == kUnique || eLimited == kSharedOther) {
*selection = CandidateForSelection;
}else if (eLimited == kSharedTransport) {
returnedStep *= (1.0 + 1.0e-9);
// Expand to disable its selection in Step Manager comparison
}
}
// ----------------------------------------------
// Returns the fGhostSafety as the proposedSafety
// The SteppingManager will take care of keeping
// the smallest one.
// ----------------------------------------------
return returnedStep;
} else {
return DBL_MAX;
//not sensible! return -1.0;
}
}
G4double G4WeightCutOffProcess::
AtRestGetPhysicalInteractionLength(const G4Track& ,
G4ForceCondition*)
{
return -1.0;
}
G4VParticleChange*
G4WeightCutOffProcess::AtRestDoIt(const G4Track&, const G4Step&)
{
return 0;
}
G4VParticleChange*
G4WeightCutOffProcess::AlongStepDoIt(const G4Track& track, const G4Step&)
{
// Dummy ParticleChange ie: does nothing
// Expecting G4Transportation to move the track
pParticleChange->Initialize(track);
return pParticleChange;
// return 0;
}
void G4WeightCutOffProcess::CopyStep(const G4Step & step)
{
fGhostStep->SetTrack(step.GetTrack());
fGhostStep->SetStepLength(step.GetStepLength());
fGhostStep->SetTotalEnergyDeposit(step.GetTotalEnergyDeposit());
fGhostStep->SetControlFlag(step.GetControlFlag());
*fGhostPreStepPoint = *(step.GetPreStepPoint());
*fGhostPostStepPoint = *(step.GetPostStepPoint());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Set StepStatus for ghost world
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(fOnBoundary)
{ fGhostPostStepPoint->SetStepStatus(fGeomBoundary); }
else if(fGhostPostStepPoint->GetStepStatus()==fGeomBoundary)
{ fGhostPostStepPoint->SetStepStatus(fPostStepDoItProc); }
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
@@ -0,0 +1,97 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4WeightWindowConfigurator.cc,v 1.3 2007/06/01 09:16:34 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// Class G4WeightWindowConfigurator
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#include "G4WeightWindowConfigurator.hh"
#include "G4WeightWindowAlgorithm.hh"
#include "G4WeightWindowProcess.hh"
G4WeightWindowConfigurator::
G4WeightWindowConfigurator(G4VPhysicalVolume* worldvolume,
const G4String &particlename,
G4VWeightWindowStore &wwstore,
const G4VWeightWindowAlgorithm *wwAlg,
G4PlaceOfAction placeOfAction, G4bool para)
: fWorld(worldvolume),
fPlacer(particlename),
fWeightWindowStore(wwstore),
fDeleteWWalg( ( ! wwAlg) ),
fWWalgorithm(( (fDeleteWWalg) ?
new G4WeightWindowAlgorithm(5,3,5) : wwAlg)),
fWeightWindowProcess(0),
fPlaceOfAction(placeOfAction)
{
paraflag = para;
}
G4WeightWindowConfigurator::~G4WeightWindowConfigurator()
{
if (fWeightWindowProcess)
{
fPlacer.RemoveProcess(fWeightWindowProcess);
delete fWeightWindowProcess;
}
if (fDeleteWWalg)
{
delete fWWalgorithm;
}
}
void
G4WeightWindowConfigurator::Configure(G4VSamplerConfigurator *preConf)
{
G4cout << " entering weight window configure " << G4endl;
const G4VTrackTerminator *terminator = 0;
if (preConf)
{
terminator = preConf->GetTrackTerminator();
};
fWeightWindowProcess =
new G4WeightWindowProcess(*fWWalgorithm,
fWeightWindowStore,
terminator,
fPlaceOfAction,"WeightWindowProcess",paraflag);
if(paraflag) fWeightWindowProcess->SetParallelWorld(fWorld);
fPlacer.AddProcessAsSecondDoIt(fWeightWindowProcess);
}
const G4VTrackTerminator *
G4WeightWindowConfigurator::GetTrackTerminator() const
{
return fWeightWindowProcess;
}
@@ -0,0 +1,417 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4WeightWindowProcess.cc,v 1.3 2007/06/01 09:16:34 ahoward Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4WeightWindowProcess.cc
//
// ----------------------------------------------------------------------
#include "G4WeightWindowProcess.hh"
#include "G4VWeightWindowAlgorithm.hh"
#include "G4GeometryCell.hh"
#include "G4SamplingPostStepAction.hh"
#include "G4VTrackTerminator.hh"
#include "G4PlaceOfAction.hh"
#include "G4VWeightWindowStore.hh"
#include "G4Step.hh"
#include "G4Navigator.hh"
#include "G4VTouchable.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ParticleChange.hh"
#include "G4PathFinder.hh"
#include "G4TransportationManager.hh"
#include "G4StepPoint.hh"
#include "G4FieldTrackUpdator.hh"
G4WeightWindowProcess::G4WeightWindowProcess(
const G4VWeightWindowAlgorithm &aWeightWindowAlgorithm,
const G4VWeightWindowStore &aWWStore,
const G4VTrackTerminator *TrackTerminator,
G4PlaceOfAction placeOfAction,
const G4String &aName, G4bool para)
: G4VProcess(aName),
fParticleChange(new G4ParticleChange),
fWeightWindowAlgorithm(aWeightWindowAlgorithm),
fWeightWindowStore(aWWStore),
fPostStepAction(0),
fPlaceOfAction(placeOfAction),
fGhostNavigator(0), fNavigatorID(-1), fFieldTrack('0')
{
if (TrackTerminator)
{
fPostStepAction = new G4SamplingPostStepAction(*TrackTerminator);
}
else
{
fPostStepAction = new G4SamplingPostStepAction(*this);
}
if (!fParticleChange)
{
G4Exception("G4WeightWindowProcess::G4WeightWindowProcess()",
"FatalError", FatalException,
"Failed allocation of G4ParticleChange !");
}
G4VProcess::pParticleChange = fParticleChange;
fGhostStep = new G4Step();
fGhostPreStepPoint = fGhostStep->GetPreStepPoint();
fGhostPostStepPoint = fGhostStep->GetPostStepPoint();
fTransportationManager = G4TransportationManager::GetTransportationManager();
fPathFinder = G4PathFinder::GetInstance();
if (verboseLevel>0)
{
G4cout << GetProcessName() << " is created " << G4endl;
}
paraflag = para;
}
G4WeightWindowProcess::~G4WeightWindowProcess()
{
delete fPostStepAction;
delete fParticleChange;
delete fGhostStep;
}
//------------------------------------------------------
//
// SetParallelWorld
//
//------------------------------------------------------
void G4WeightWindowProcess::
SetParallelWorld(G4String parallelWorldName)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Get pointers of the parallel world and its navigator
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fGhostWorldName = parallelWorldName;
fGhostWorld = fTransportationManager->GetParallelWorld(fGhostWorldName);
fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
void G4WeightWindowProcess::
SetParallelWorld(G4VPhysicalVolume* parallelWorld)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Get pointer of navigator
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fGhostWorldName = parallelWorld->GetName();
fGhostWorld = parallelWorld;
fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
//------------------------------------------------------
//
// StartTracking
//
//------------------------------------------------------
void G4WeightWindowProcess::StartTracking(G4Track* trk)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Activate navigator and get the navigator ID
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// G4cout << " G4ParallelWorldScoringProcess::StartTracking" << G4endl;
if(paraflag) {
if(fGhostNavigator)
{ fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator); }
else
{
G4Exception("G4WeightWindowProcess::StartTracking",
"ProcParaWorld000",FatalException,
"G4WeightWindowProcess is used for tracking without having a parallel world assigned");
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// G4cout << "G4ParallelWorldScoringProcess::StartTracking <<<<<<<<<<<<<<<<<< " << G4endl;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Let PathFinder initialize
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fPathFinder->PrepareNewTrack(trk->GetPosition(),trk->GetMomentumDirection());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Setup initial touchables for the first step
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fOldGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
fNewGhostTouchable = fOldGhostTouchable;
fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
// Initialize
fGhostSafety = -1.;
fOnBoundary = false;
}
}
G4double G4WeightWindowProcess::
PostStepGetPhysicalInteractionLength(const G4Track& ,
G4double ,
G4ForceCondition* condition)
{
// *condition = Forced;
// return kInfinity;
// *condition = StronglyForced;
*condition = Forced;
return DBL_MAX;
}
G4VParticleChange *
G4WeightWindowProcess::PostStepDoIt(const G4Track &aTrack,
const G4Step &aStep)
{
fParticleChange->Initialize(aTrack);
if(paraflag) {
fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
//xbug? fOnBoundary = false;
CopyStep(aStep);
if(fOnBoundary)
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Locate the point and get new touchable
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//?? fPathFinder->Locate(step.GetPostStepPoint()->GetPosition(),
//?? step.GetPostStepPoint()->GetMomentumDirection());
fNewGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
else
{
// Do I need this ??????????????????????????????????????????????????????????
// fGhostNavigator->LocateGlobalPointWithinVolume(track.GetPosition());
// ?????????????????????????????????????????????????????????????????????????
// fPathFinder->ReLocate(track.GetPosition());
// reuse the touchable
fNewGhostTouchable = fOldGhostTouchable;
}
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
}
if (aStep.GetStepLength() > kCarTolerance)
{
// if ( ( fPlaceOfAction == onBoundaryAndCollision)
// || ( (fPlaceOfAction == onBoundary) &&
// (aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary) )
// || ( (fPlaceOfAction == onCollision) &&
// (aStep.GetPostStepPoint()->GetStepStatus() != fGeomBoundary) ) )
if(paraflag) {
if ( ( fPlaceOfAction == onBoundaryAndCollision)
|| ( (fPlaceOfAction == onBoundary) &&
(fGhostPostStepPoint->GetStepStatus() == fGeomBoundary) )
|| ( (fPlaceOfAction == onCollision) &&
(fGhostPostStepPoint->GetStepStatus() != fGeomBoundary) ) )
{
// G4StepPoint *postpoint = aStep.GetPostStepPoint();
// G4GeometryCell postCell(*(postpoint->GetPhysicalVolume()),
// postpoint->GetTouchable()->GetReplicaNumber());
G4GeometryCell postCell(*(fGhostPostStepPoint->GetPhysicalVolume()),
fGhostPostStepPoint->GetTouchable()->GetReplicaNumber());
G4Nsplit_Weight nw =
fWeightWindowAlgorithm.Calculate(aTrack.GetWeight(),
fWeightWindowStore.GetLowerWeitgh(postCell,
aTrack.GetKineticEnergy()));
fPostStepAction->DoIt(aTrack, fParticleChange, nw);
}
} else {
if ( ( fPlaceOfAction == onBoundaryAndCollision)
|| ( (fPlaceOfAction == onBoundary) &&
(aStep.GetPostStepPoint()->GetStepStatus() == fGeomBoundary) )
|| ( (fPlaceOfAction == onCollision) &&
(aStep.GetPostStepPoint()->GetStepStatus() != fGeomBoundary) ) )
{
G4StepPoint *postpoint = aStep.GetPostStepPoint();
G4GeometryCell postCell(*(postpoint->GetPhysicalVolume()),
postpoint->GetTouchable()->GetReplicaNumber());
G4Nsplit_Weight nw =
fWeightWindowAlgorithm.Calculate(aTrack.GetWeight(),
fWeightWindowStore.GetLowerWeitgh(postCell,
aTrack.GetKineticEnergy()));
fPostStepAction->DoIt(aTrack, fParticleChange, nw);
}
}
}
return fParticleChange;
}
void G4WeightWindowProcess::KillTrack() const
{
fParticleChange->ProposeTrackStatus(fStopAndKill);
}
const G4String &G4WeightWindowProcess::GetName() const
{
return G4VProcess::GetProcessName();
}
G4double G4WeightWindowProcess::
AlongStepGetPhysicalInteractionLength(
const G4Track& track, G4double previousStepSize, G4double currentMinimumStep,
G4double& proposedSafety, G4GPILSelection* selection)
{
if(paraflag) {
static G4FieldTrack endTrack('0');
static ELimited eLimited;
*selection = NotCandidateForSelection;
G4double returnedStep = DBL_MAX;
if (previousStepSize > 0.)
{ fGhostSafety -= previousStepSize; }
// else
// { fGhostSafety = -1.; }
if (fGhostSafety < 0.) fGhostSafety = 0.0;
// ------------------------------------------
// Determination of the proposed STEP LENGTH:
// ------------------------------------------
if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
{
// I have no chance to limit
returnedStep = currentMinimumStep;
fOnBoundary = false;
proposedSafety = fGhostSafety - currentMinimumStep;
}
else // (currentMinimumStep > fGhostSafety: I may limit the Step)
{
G4FieldTrackUpdator::Update(&fFieldTrack,&track);
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ComputeStep
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
returnedStep
= fPathFinder->ComputeStep(fFieldTrack,currentMinimumStep,fNavigatorID,
track.GetCurrentStepNumber(),fGhostSafety,eLimited,
endTrack,track.GetVolume());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(eLimited == kDoNot)
{
// Track is not on the boundary
fOnBoundary = false;
fGhostSafety = fGhostNavigator->ComputeSafety(endTrack.GetPosition());
}
else
{
// Track is on the boundary
fOnBoundary = true;
proposedSafety = fGhostSafety;
}
//xbug? proposedSafety = fGhostSafety;
if(eLimited == kUnique || eLimited == kSharedOther) {
*selection = CandidateForSelection;
}else if (eLimited == kSharedTransport) {
returnedStep *= (1.0 + 1.0e-9);
// Expand to disable its selection in Step Manager comparison
}
}
// ----------------------------------------------
// Returns the fGhostSafety as the proposedSafety
// The SteppingManager will take care of keeping
// the smallest one.
// ----------------------------------------------
return returnedStep;
} else {
return DBL_MAX;
// not sensible - time goes backwards! return -1.0;
}
}
G4double G4WeightWindowProcess::
AtRestGetPhysicalInteractionLength(const G4Track& ,
G4ForceCondition*)
{
return -1.0;
}
G4VParticleChange* G4WeightWindowProcess::
AtRestDoIt(const G4Track&, const G4Step&)
{
return 0;
}
G4VParticleChange* G4WeightWindowProcess::
AlongStepDoIt(const G4Track& track, const G4Step&)
{
// Dummy ParticleChange ie: does nothing
// Expecting G4Transportation to move the track
pParticleChange->Initialize(track);
return pParticleChange;
// return 0;
}
void G4WeightWindowProcess::CopyStep(const G4Step & step)
{
fGhostStep->SetTrack(step.GetTrack());
fGhostStep->SetStepLength(step.GetStepLength());
fGhostStep->SetTotalEnergyDeposit(step.GetTotalEnergyDeposit());
fGhostStep->SetControlFlag(step.GetControlFlag());
*fGhostPreStepPoint = *(step.GetPreStepPoint());
*fGhostPostStepPoint = *(step.GetPostStepPoint());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Set StepStatus for ghost world
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(fOnBoundary)
{ fGhostPostStepPoint->SetStepStatus(fGeomBoundary); }
else if(fGhostPostStepPoint->GetStepStatus()==fGeomBoundary)
{ fGhostPostStepPoint->SetStepStatus(fPostStepDoItProc); }
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}