Import Geant4 4.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:39:52 +02:00
parent 921d3b1cda
commit 330b82b769
4524 changed files with 178689 additions and 43575 deletions
+22
View File
@@ -0,0 +1,22 @@
# $Id: GNUmakefile,v 1.1 2002/03/25 17:09:16 gcosmo Exp $
# --------------------------------------------------------------------
# GNUmakefile for geometry/biasing library. Gabriele Cosmo, 25/03/02.
# --------------------------------------------------------------------
name := G4geombias
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/management/include
include $(G4INSTALL)/config/common.gmk
+46
View File
@@ -0,0 +1,46 @@
$Id: History,v 1.9 2002/05/31 09:56:09 dressel 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 *
----------------------------------------------------------
May, 31th, 2002 M.Dressel - geombias-V04-00-04
- change name ImportanceSampler to ImportanceSplitExaminer
May, 30th, 2002 M.Dressel
- change comments in WeightWindowAlgorithm
May, 24th, 2002 M.Dressel - internal-1-geombias-V04-00-02
- Added classes for weight window biasing.
April 10th, 2002 M.Dressel - geombias-V04-00-03
- Added comments to header files for Software Reference Manual.
April 9th, 2002 G.Cosmo
- Added liability disclaimer to all files and minor cosmetics.
April 8th, 2002 M.Dressel - geombias-V04-00-02
- Resolved compilation problems on HP-aCC.
April 4th, 2002 M.Dressel - geombias-V04-00-01
- Resolved compilation problems on SUN-CC and Linux-egcs.
March 28th, 2002 M.Dressel - geombias-V04-00-00
- First implementation of importance biasing and scoring.
March 25th, 2002 G.Cosmo
- Created.
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4IStore.hh,v 1.3 2002/04/10 13:13:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4IStore
//
// Class description:
//
// An implementation of a "importance store" with the interface
// G4VIStore. See description in G4VIStore.
// This implementation uses G4PtkImportance as the container
// to store the "cells" together with the importance values.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4IStore_hh
#define G4IStore_hh G4IStore_hh
#include "G4VIStore.hh"
#include "G4PtkImportance.hh"
class G4IStore : public G4VIStore
{
public: // with description
G4IStore(G4VPhysicalVolume &worldvolume);
// initialise the importance store for the given geometry
~G4IStore();
// destruct
void AddImportanceRegion(G4double importance,
const G4VPhysicalVolume &,
G4int aRepNum = 0);
// Add a "cell" together with a importance value to the store.
void ChangeImportance(G4double importance,
const G4VPhysicalVolume &,
G4int aRepNum = 0);
// Change a importance value of a "cell".
G4double GetImportance(const G4VPhysicalVolume &,
G4int aRepNum = 0) const ;
// derive the importance value of a "cell" from the store.
G4double GetImportance(const G4PTouchableKey &ptk) const;
// derive a importance value of a "cell" addresed by a G4PTouchableKey
// from the store.
G4VPhysicalVolume &GetWorldVolume();
// return a reference to the wolrd volume of the
// "importance" geometry
private:
G4bool IsInWorld(const G4VPhysicalVolume &) const;
void SetInternalIterator(const G4VPhysicalVolume &,
G4int aRepNum) const;
void Error(const G4String &m) const;
private:
G4VPhysicalVolume &fWorldVolume;
G4PtkImportance fPtki;
mutable G4PtkImportance::const_iterator fCurrentIterator;
};
#endif
@@ -0,0 +1,68 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ImportanceAlgorithm.hh,v 1.3 2002/04/10 13:13:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4ImportanceAlgorithm
//
// Class description:
//
// An implementation of a G4VImportanceAlgorithm (see description in
// G4VImportanceAlgorithm.hh).
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4ImportanceAlgorithm_hh
#define G4ImportanceAlgorithm_hh G4ImportanceAlgorithm_hh
#include "G4VImportanceAlgorithm.hh"
class G4ImportanceAlgorithm : public G4VImportanceAlgorithm
{
public: // with description
G4ImportanceAlgorithm();
// simple construction
~G4ImportanceAlgorithm();
// repeate warning if triggered
G4Nsplit_Weight Calculate(G4double ipre_over_ipost,
G4double init_w) const;
// calculate the number of tracks and their weight according
// to the ratio of pre over post importance and the weight of
// the mother track.
private:
void Error(const G4String &m) const;
void Warning(const G4String &m) const;
private:
mutable G4bool fWorned;
};
#endif
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ImportanceFinder.hh,v 1.3 2002/04/10 13:13:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4ImportanceFinder
//
// Class description:
//
// This class is used internally by importance sampling in a parallel
// geometry. It derives the ratio of importances of the pre over the post
// G4PTouchableKey.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4ImportanceFinder_hh
#define G4ImportanceFinder_hh G4ImportanceFinder_hh
#include "globals.hh"
class G4VParallelStepper;
class G4VIStore;
class G4PTouchableKey;
class G4ImportanceFinder
{
public: // with description
G4ImportanceFinder(const G4VIStore &aIStore);
// initialise fIStore
~G4ImportanceFinder();
// destruction
G4double GetIPre_over_IPost(const G4PTouchableKey &prekey,
const G4PTouchableKey &postkey) const;
// get the ratio of importances of the pre over the
// post G4PTouchableKey importances.
private:
void Error(const G4String &m) const;
private:
const G4VIStore &fIStore;
};
#endif
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ImportanceSplitExaminer.hh,v 1.2 2002/05/31 09:56:09 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4ImportanceSplitExaminer
//
// Class description:
//
// This class is used internally by importance sampling.
// Implementation of a importance split examiner
// (see G4VImportanceSplitExaminer).
// This implementation is used for sampling in a "parallel"
// geometry.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4ImportanceSplitExaminer_hh
#define G4ImportanceSplitExaminer_hh G4ImportanceSplitExaminer_hh
#include "G4VImportanceSplitExaminer.hh"
class G4VImportanceAlgorithm;
class G4VParallelStepper;
class G4ImportanceFinder;
class G4VIStore;
class G4ImportanceSplitExaminer: public G4VImportanceSplitExaminer
{
public: // with description
G4ImportanceSplitExaminer(const G4VImportanceAlgorithm &aIalg,
const G4VParallelStepper &astepper,
const G4VIStore &istore);
// initialisation and construct G4ImportanceFinder
~G4ImportanceSplitExaminer();
// delete G4ImportanceFinder
G4Nsplit_Weight Examine(G4double w) const;
// Get G4Nsplit_Weight for a given mother track weight.
private:
G4ImportanceSplitExaminer(const G4ImportanceSplitExaminer &);
G4ImportanceSplitExaminer &operator=(const G4ImportanceSplitExaminer &);
private:
const G4VImportanceAlgorithm &fIalgorithm;
const G4VParallelStepper &fPStepper;
const G4ImportanceFinder &fIfinder;
};
#endif
@@ -0,0 +1,68 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Nsplit_Weight.hh,v 1.5 2002/04/10 13:13:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4Nsplit_Weight
//
// Class description:
//
// A struct used by importance sampling. It contains the number of tracks
// a mother track should be split into and their weight.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4Nsplit_Weight_hh
#define G4Nsplit_Weight_hh G4Nsplit_Weight_hh
#include "globals.hh"
struct G4Nsplit_Weight
{
G4Nsplit_Weight(G4int an, G4double aw): fN(an), fW(aw){}
// initialise members
G4int fN;
// number of tracks a mother track should be split into
// including the mother track
G4double fW;
// the weight to be given to the tracks
};
G4std::ostream& operator<<(G4std::ostream &out,
const G4Nsplit_Weight &nw);
#endif
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PMapPtkTallys.hh,v 1.8 2002/04/10 13:13:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4PMapNameTally and G4PMapPtkTallys
//
// Class description:
//
// Used by G4PScorer and G4PIScorer as containers for tallies.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4PMapPtkTallys_hh
#define G4PMapPtkTallys_hh G4PMapPtkTallys_hh
#include "g4std/map"
#include "globals.hh"
#include "g4std/iostream"
#include "G4PTouchableKey.hh"
#include "G4Sigma.hh"
typedef G4std::map<const char *, G4Sigma> G4PMapNameTally;
// container for a G4Sigma to each tally
typedef G4std::map<G4PTouchableKey, G4PMapNameTally, G4PTkComp> G4PMapPtkTallys;
// container for a G4PMapNameTally to each "cell" addressed by a
// G4PTouchableKey
G4std::ostream& operator<<(G4std::ostream &out, const G4PMapNameTally &tally);
G4std::ostream& operator<<(G4std::ostream &out, const G4PMapPtkTallys &ptktally);
#endif
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PStep.hh,v 1.3 2002/04/10 13:13:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4PStep
//
// Class description:
//
// This class serves to address the "cell" a track previously
// touched and a "cell" a track is currently in. It is used
// for scoring and importance sampling in the "mass" geometry as well
// as in a "parallel" geometry.
// The "cell" information is available with the fPreTouchableKey and the
// fPostTouchableKey.
// The fCrossBoundary member is set true in case the step
// crosses a boundary in the geometry it this G4PStep
// refers to.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4PStep_hh
#define G4PStep_hh G4PStep_hh
#include "G4PTouchableKey.hh"
class G4PStep
{
public: // with description
G4PStep(const G4PTouchableKey &preKey, const G4PTouchableKey &postKey)
: fPreTouchableKey(preKey), fPostTouchableKey(postKey),
fCrossBoundary(false) {}
// initialise pre and post G4PTouchableKey
~G4PStep(){}
public: // without description
G4PTouchableKey fPreTouchableKey;
// addressing the "cell" the track previously touched
G4PTouchableKey fPostTouchableKey;
// addressing the current "cell"
G4bool fCrossBoundary;
// true if step crosses boundary of the geometry it refers to
};
#endif
@@ -0,0 +1,45 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PStepStream.hh,v 1.5 2002/04/10 13:13:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Declarations
//
// Declaration description:
//
// declarations of streams for G4PTouchableKey and G4PStep
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4PStepStream_hh
#define G4PStepStream_hh G4PStepStream_hh
#include "G4PTouchableKey.hh"
#include "G4PStep.hh"
G4std::ostream& operator<<(G4std::ostream &out, const G4PTouchableKey &tk);
G4std::ostream& operator<<(G4std::ostream &out, const G4PStep &ps);
#endif
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PTouchableKey.hh,v 1.3 2002/04/10 13:13:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4PTouchableKey
//
// Class description:
//
// This class is usde by scoring and importance sampling.
// It serves to address a "cell". A "cell" is somewhat
// related to a touchable in Geant4. It is identified by a reference
// to a G4VPhysicalVolume and a number (replica number).
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4PTouchableKey_hh
#define G4PTouchableKey_hh G4PTouchableKey_hh
#include "globals.hh"
class G4VPhysicalVolume;
class G4PTouchableKey
{
public: // with description
G4PTouchableKey(const G4VPhysicalVolume &aVolume, G4int RepNum);
// initialise volume and replica number
~G4PTouchableKey();
// simple destruction
const G4VPhysicalVolume *fVPhysiclaVolume;
// pinter to the G4VPhysicalVolume of the "cell"
G4int fRepNum;
// replica number of the "cell"
};
// -----------------------------------------------------------------------
class G4PTkComp
{
public: // without description
G4bool operator() (const G4PTouchableKey &k1,
const G4PTouchableKey &k2) const;
};
// -----------------------------------------------------------------------
G4bool operator==(const G4PTouchableKey &k1, const G4PTouchableKey &k2);
G4bool operator!=(const G4PTouchableKey &k1, const G4PTouchableKey &k2);
#endif
@@ -0,0 +1,125 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ParallelNavigator.hh,v 1.3 2002/04/10 13:13:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4ParallelNavigator
//
// Class description:
//
// Used internaly for importance sampling and scoring in a "parallel"
// geometry.
// It implements the interface G4VPGeoDriver (see G4VPGeoDriver.hh).
// It uses a G4Navigator.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4ParallelNavigator_hh
#define G4ParallelNavigator_hh G4ParallelNavigator_hh
#include "G4VPGeoDriver.hh"
#include "geomdefs.hh"
class G4VTouchable;
class G4Navigator;
class G4PTouchableKey ;
class G4VPhysicalVolume;
class G4ParallelNavigator : public G4VPGeoDriver
{
public: // with description
G4ParallelNavigator(G4VPhysicalVolume &aWorldVolume);
// initialise and create G4Navigator and a TouchableHistory
~G4ParallelNavigator();
// delete Touchable and Navigator
G4PTouchableKey LocateOnBoundary(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection);
// The location of a track according to it's position
// and direction in case the track crosses a boundary
// of a "parallel" geometry.
// Must be called in the PostDOIT of the ParallelTransportation.
// (The track crosses the boundary if PostDOIT gets called.)
G4PTouchableKey GetCurrentTouchableKey() const;
// get the current G4PTouchableKey of the "parallel" geometry
G4double ComputeStepLengthInit(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection);
// compute step length for a starting track.
G4double ComputeStepLengthCrossBoundary(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection);
// compute the step length after a track crossed a boundary
// in a "parallel" geometry
G4double ComputeStepLengthInVolume(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection);
// compute step length when track moves inside a volume.
private:
G4ParallelNavigator(const G4ParallelNavigator &);
G4ParallelNavigator &operator=(const G4ParallelNavigator &);
G4double ComputeStepLengthShifted(const G4String &m,
const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection);
void Locate(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection,
G4bool histsearch);
void Error(const G4String &m,
const G4ThreeVector &pos,
const G4ThreeVector &dir);
G4double Shift(G4double d);
private:
G4Navigator &fNavigator;
G4VTouchable *fCurrentTouchable;
G4int fNlocated;
};
#endif
@@ -0,0 +1,83 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ParallelStepper.hh,v 1.3 2002/04/10 13:13:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4ParallelStepper
//
// Class description:
//
// Used internally by importance sampling and scoring in a "parallel"
// geometry. (See G4VParallelStepper.hh)
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4ParallelStepper_hh
#define G4ParallelStepper_hh G4ParallelStepper_hh
#include "G4VParallelStepper.hh"
#include "G4PStep.hh"
class G4ParallelStepper : public G4VParallelStepper
{
public: // with description
G4ParallelStepper();
// imitilisation
~G4ParallelStepper();
// delete G4Pstep if created
G4ParallelStepper(const G4ParallelStepper &);
// create new G4PStep
G4ParallelStepper &operator=(const G4ParallelStepper &);
// create new G4PStep
G4PStep GetPStep() const {return *fPStep;}
// get the current G4PStep
void Init(const G4PTouchableKey &aptk);
// initialise the parallel stepper and the G4PStep
// pre and post G4PTouchableKey of the step are set equal
void Update(const G4PTouchableKey &aptk);
// to be called when crossing a boundary of the
// "parallel" geometry to update the G4PStep
void UnSetCrossBoundary();
// to be called to unset the fCrossBoundary member of the G4PStep
private:
void Error(const G4String &m);
private:
G4PStep *fPStep;
};
#endif
@@ -0,0 +1,82 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ParallelWorld.hh,v 1.3 2002/04/10 13:13:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4ParallelWorld
//
// Class description:
//
// Used internally by importance samplin and scoring in a "parallel"
// geometry.
// The class relates the world volume (G4VPhysicalVolume),
// G4VGeoDriver and G4VParallelStepper for one "parallel"
// geometry.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4ParallelWorld_hh
#define G4ParallelWorld_hh G4ParallelWorld_hh
#include "globals.hh"
class G4VPhysicalVolume;
class G4VParallelStepper;
class G4VPGeoDriver;
class G4ParallelWorld
{
public: // with description
G4ParallelWorld(G4VPhysicalVolume &worldvolume);
// initialisation and create G4ParallelStepper and a G4VPGeoDriver
~G4ParallelWorld();
// delete G4ParallelStepper and a G4VPGeoDriver
G4ParallelWorld(const G4ParallelWorld &rhs);
// create G4ParallelStepper and a G4VPGeoDriver
G4ParallelWorld &operator=(const G4ParallelWorld &rhs);
// create G4ParallelStepper and a G4VPGeoDriver
G4VPhysicalVolume *GetWorldVolume() const;
// get the world volume
G4VParallelStepper &GetParallelStepper();
// get the parallel stepper
G4VPGeoDriver &GetGeoDriver();
// get the G4VPGeoDriver
private:
G4VPhysicalVolume *fWorldVolume;
G4VParallelStepper *fPstepper;
G4VPGeoDriver *fPdriver;
};
#endif
@@ -0,0 +1,52 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Pstring.hh,v 1.3 2002/04/10 13:13:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Declaration
//
// Declaration description:
//
// This fucntions convert some non character objects into
// G4Strings
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4Pstring_hh
#define G4Pstring_hh G4Pstring_hh
#include "globals.hh"
#include "G4ThreeVector.hh"
G4String str(const int &i);
// convert an integer into a G4String
G4String str(const double &d);
// convert a double into a G4String
G4String str(const G4ThreeVector &v);
// convert a G4ThreeVector into a G4String
#endif
@@ -0,0 +1,49 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PtkImportance.hh,v 1.5 2002/04/10 13:13:07 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4PtkImportance
//
// Class description:
//
// Used internally by importance sampling.
// It is acontainer for "cell" importance value pairs.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4PtkImportance_hh
#define G4PtkImportance_hh G4PtkImportance_hh
#include "g4std/map"
#include "globals.hh"
#include "G4PTouchableKey.hh"
typedef G4std::map<G4PTouchableKey, G4double, G4PTkComp> G4PtkImportance;
// implement container G4PtkImportance as map
G4std::ostream& operator<<(G4std::ostream &out, const G4PtkImportance &ptki);
#endif
+106
View File
@@ -0,0 +1,106 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Sigma.hh,v 1.6 2002/04/10 13:13:07 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4Sigma
//
// Class description:
//
// A class for simple Gaussian statistics taking into account
// weights.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4Sigma_hh
#define G4Sigma_hh G4Sigma_hh
#include "g4std/iostream"
#include "globals.hh"
class G4Sigma
{
public: // with description
G4Sigma();
// call Init()
~G4Sigma();
// simple deonstruction
void Init();
// initialisation
G4int Xin(G4double x, G4double w = 1.);
// enter a value [with a weight]
G4int GetEntries() const;
// get the number of entries
G4double GetMean() const;
// get the weighted mean value: Sum(w*x)/Sum(w)
G4double GetSigma() const;
// get the weighted sigma: sqrt(Sum(w*x*x)/Sum(w)-mean^2)
G4double GetXsum() const;
// get sum over x: Sum(x)
G4double GetXXsum() const;
// get sum over squared x: Sum(x*x)
G4double GetSumOfWeights() const;
// get sum over weights: Sum(w)
G4double GetWeightedXsum() const;
// get weighted sum over x*w: Sum(w*x)
G4double GetWeightedXXsum() const;
// get weighted sum over squarted x: Sum(W*x*x)
private:
G4int GetCalc() const;
G4int Calculate() const;
void Error(const G4String &m);
private:
G4int fEntries;
mutable G4double fMean;
mutable G4double fSigma;
G4double fXsum;
G4double fXXsum;
G4double fWsum;
G4double fWXsum;
G4double fWXXsum;
mutable G4int fcalc;
};
G4std::ostream& operator<<(G4std::ostream &out, const G4Sigma &s);
#endif
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4VIStore.hh,v 1.3 2002/04/10 13:13:07 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4VIStore
//
// Class description:
//
// An interface of an "importance store" used by importance sampling.
// It defines how a importance value together with a "cell"
// (a G4VPhysicalVolume and a replica number) has to be added
// to the "importance store" and how a importance value can be derived
// from the "importance store".
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4VIStore_hh
#define G4VIStore_hh G4VIStore_hh
#include "globals.hh"
class G4PTouchableKey;
class G4VPhysicalVolume;
class G4VIStore
{
public: // with description
G4VIStore(G4VPhysicalVolume &worldVolume){}
virtual ~G4VIStore(){}
virtual void AddImportanceRegion(G4double importance,
const G4VPhysicalVolume &,
G4int aRepNum = 0) = 0;
// Add a "cell" together with a importance value to the store.
virtual void ChangeImportance(G4double importance,
const G4VPhysicalVolume &,
G4int aRepNum = 0) = 0;
// Change a importance value of a "cell".
virtual G4double GetImportance(const G4VPhysicalVolume &,
G4int aRepNum = 0) const = 0;
// derive the importance value of a "cell" from the store.
virtual G4double GetImportance(const G4PTouchableKey &ptk) const = 0;
// derive a importance value of a "cell" addresed by a G4PTouchableKey
// from the store.
virtual G4VPhysicalVolume &GetWorldVolume() = 0;
};
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4VImportanceAlgorithm.hh,v 1.3 2002/04/10 13:13:07 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4VImportanceAlgorithm
//
// Class description:
//
// This is an interface used by importance sampling to get the
// number of copies and weight a mother particle should be split
// into when crossing a boundary of "importance cells".
// The interface defines the input to be the ratio of the pre over
// the post importance and the weight of the mother track.
// It returns a struct containing the number of copies (including
// the mother track) to be produced and the weight of each track.
// A user defined algorithm deriving from this interface may be used
// by the importance sampling.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4VImportanceAlgorithm_hh
#define G4VImportanceAlgorithm_hh G4VImportanceAlgorithm_hh
#include "G4Nsplit_Weight.hh"
class G4VImportanceAlgorithm
{
public: // with description
virtual ~G4VImportanceAlgorithm(){}
virtual G4Nsplit_Weight Calculate(G4double ipre_over_ipost,
G4double init_w) const = 0;
// calculate the number of tracks and their weight according
// to the ratio of pre over post importance and the weight of
// the mother track.
};
#endif
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4VImportanceSplitExaminer.hh,v 1.1 2002/05/31 08:07:47 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4VImportanceSplitExaminer
//
// Class description:
//
// This interface is used internally by importance sampling.
// It delivers G4Nsplit_Weight according to a track weight.
// An implementation of the interface decides how to obtain
// remaining necessary information about the ratio of importances
// in the pre and post "cell".
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4VImportanceSplitExaminer_hh
#define G4VImportanceSplitExaminer_hh G4VImportanceSplitExaminer_hh
#include "globals.hh"
#include "G4Nsplit_Weight.hh"
class G4VImportanceSplitExaminer
{
public: // with description
virtual ~G4VImportanceSplitExaminer(){}
virtual G4Nsplit_Weight Examine(G4double w) const = 0;
// Get G4Nsplit_Weight for a given mother track weight.
};
#endif
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4VPGeoDriver.hh,v 1.3 2002/04/10 13:13:07 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4VPGeoDriver
//
// Class description:
//
// Used internally by importance sampling and scoring in a "parallel"
// geometry.
// It defines an interface to "drive" or "move" a particle in a
// "parallel" geometry.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4VPGeoDriver_hh
#define G4VPGeoDriver_hh G4VPGeoDriver_hh
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4PTouchableKey.hh"
class G4VPGeoDriver
{
public: // with description
virtual ~G4VPGeoDriver(){}
virtual G4PTouchableKey LocateOnBoundary(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection) = 0;
// The location of a track according to it's position
// and direction in case the track crosses a boundary
// of a "parallel" geometry.
// Must be called in the PostDOIT of the ParallelTransportation.
// (The track crosses the boundary if PostDOIT gets called.)
virtual G4PTouchableKey GetCurrentTouchableKey() const = 0;
// get the current G4PTouchableKey of the "parallel" geometry
virtual G4double ComputeStepLengthInit(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection) = 0;
// compute step length for a starting track.
virtual G4double ComputeStepLengthCrossBoundary(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection) = 0;
// compute the step length after a track crossed a boundary
// in a "parallel" geometry
virtual G4double ComputeStepLengthInVolume(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection) = 0;
// compute step length when track moves inside a volume.
};
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4VPScorer.hh,v 1.3 2002/04/10 13:13:07 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4VPScorer
//
// Class description:
//
// This interface is known by scoring. Implementation of
// scorers should inherit from it.
// A scorer is applicable to a particle type.
// The scorer (inheriting from this interface) is informed
// about every step of a particle of a the applicable type.
// The information consists of the G4Step and the G4PStep
// (see G4PStep.hh).
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4VPScorer_hh
#define G4VPScorer_hh G4VPScorer_hh
class G4Step;
class G4PStep;
class G4VPScorer
{
public: // with description
virtual ~G4VPScorer() {}
virtual void Score(const G4Step &step, const G4PStep &pstep) = 0;
// perform scoring for the G4Step and G4PStep
};
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4VParallelStepper.hh,v 1.3 2002/04/10 13:13:07 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4VParallelStepper
//
// Class description:
//
// This interface is used internally by importance sampling and scoring
// in a "parallel" geometry.
// It abstracts a parallel stepper which servs to comunicate
// information about a G4PStep between the "transportation"
// (done by G4ParallelTransport) of a track in a "parallel" geometry
// and a scorer for that geometry.
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4VParallelStepper_hh
#define G4VParallelStepper_hh G4VParallelStepper_hh
#include "G4PStep.hh"
class G4VParallelStepper
{
public: // with description
virtual ~G4VParallelStepper(){}
virtual G4PStep GetPStep() const = 0;
// get the current G4PStep
virtual void Init(const G4PTouchableKey &aptk) = 0;
// initialise the parallel stepper and the G4PStep
// pre and post G4PTouchableKey of the step are set equal
virtual void Update(const G4PTouchableKey &aptk) = 0;
// to be called when crossing a boundary of the
// "parallel" geometry to update the G4PStep
virtual void UnSetCrossBoundary() = 0;
// to be called to unset the fCrossBoundary member of the G4PStep
};
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4VWeightWindowAlgorithm.hh,v 1.2 2002/05/30 16:00:55 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4VWeightWindowAlgorithm
//
// Class description:
//
// This is a base class for an algorithm used for
// weight window importance sampling. It calculates
// the new weight of particles and the number of copies
// it should be split into according to the initial weight
// of the track and the importance of the cell. The window
// is defined by the values of Upper and Lower.
//
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4VWeightWindowAlgorithm_hh
#define G4VWeightWindowAlgorithm_hh G4VWeightWindowAlgorithm_hh
#include "G4Nsplit_Weight.hh"
class G4VWeightWindowAlgorithm
{
public: // with description
virtual ~G4VWeightWindowAlgorithm(){}
virtual void SetUpperLimit(G4double Upper) = 0;
// set upper limiting factor for window
virtual void SetLowerLimit(G4double Lower) = 0;
// set lower limiting facotr for window
virtual G4Nsplit_Weight Calculate(G4double init_w,
G4double importance) const = 0;
// calculate the number of tracks and their weight according
// to the upper and lower limmiting factors of the window
// and the initial weight
};
#endif
@@ -0,0 +1,76 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4WeightWindowAlgorithm.hh,v 1.2 2002/05/30 16:00:55 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// Class G4WeightWindowAlgorithm
//
// Class description:
// see also G4VWeightWindowAlgorithm.
//
// Author: Michael Dressel (Michael.Dressel@cern.ch)
// ----------------------------------------------------------------------
#ifndef G4WeightWindowAlgorithm_hh
#define G4WeightWindowAlgorithm_hh G4WeightWindowAlgorithm_hh
#include "G4Nsplit_Weight.hh"
#include "G4VWeightWindowAlgorithm.hh"
class G4WeightWindowAlgorithm : public G4VWeightWindowAlgorithm
{
public: // with description
G4WeightWindowAlgorithm();
~G4WeightWindowAlgorithm(){}
void SetUpperLimit(G4double Upper);
// set upper limiting factor for window
// - Upper is the maximum factor by which the weight of a particle may
// be higher than it should be according to the importance
void SetLowerLimit(G4double Lower);
// set lower limiting facotr for window
// - Lower is the minimal factor by which the wight may be
// lower than it should be according to the importance
G4Nsplit_Weight Calculate(G4double init_w,
G4double importance) const;
// calculate the number of tracks and their weight according
// to the upper and lower limmiting factors of the window
// and the initial weight
// - init_w is the initial weight of the particle
// - importance is the importance of the cell
private:
G4double fUpper;
G4double fLower;
};
#endif
+129
View File
@@ -0,0 +1,129 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4IStore.cc,v 1.3 2002/04/09 16:23:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4IStore.cc
//
// ----------------------------------------------------------------------
#include "G4IStore.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PTouchableKey.hh"
#include "G4PStepStream.hh"
G4IStore::G4IStore(G4VPhysicalVolume &worldvolume) :
G4VIStore(worldvolume),
fWorldVolume(worldvolume)
{}
G4IStore::~G4IStore()
{}
G4VPhysicalVolume &G4IStore::GetWorldVolume()
{
return fWorldVolume;
}
void G4IStore::SetInternalIterator(const G4VPhysicalVolume &aVolume,
G4int aRepNum) const
{
if (!IsInWorld(aVolume)) {
Error("SetInternalIterator: physical volume not in this World");
}
fCurrentIterator = fPtki.find(G4PTouchableKey(aVolume, aRepNum));
}
void G4IStore::AddImportanceRegion(G4double importance,
const G4VPhysicalVolume &aVolume,
G4int aRepNum)
{
if (importance <=0 ) {
Error("AddImportanceRegion: invalid importance value given");
}
SetInternalIterator(aVolume, aRepNum);
if (fCurrentIterator!=fPtki.end()) {
Error("AddImportanceRegion: Region allready exists");
}
fPtki[G4PTouchableKey(aVolume, aRepNum)] = importance;
}
void G4IStore::ChangeImportance(G4double importance,
const G4VPhysicalVolume &aVolume,
G4int aRepNum)
{
if (importance <=0 ) {
Error("ChangeImportance: Invalid importance value given");
}
SetInternalIterator(aVolume, aRepNum);
if (fCurrentIterator==fPtki.end()) {
Error("ChangeImportance: Region does not exist");
}
fPtki[G4PTouchableKey(aVolume, aRepNum)] = importance;
}
G4double G4IStore::GetImportance(const G4VPhysicalVolume &aVolume,
G4int aRepNum) const
{
SetInternalIterator(aVolume, aRepNum);
if (fCurrentIterator==fPtki.end()) {
Error("GetImportance: Region does not exist");
}
return (*fCurrentIterator).second;
}
G4double G4IStore::GetImportance(const G4PTouchableKey &ptk) const
{
fCurrentIterator = fPtki.find(ptk);
if (fCurrentIterator==fPtki.end()) {
G4cout << "PTouchableKey ptk: " << ptk << G4endl;
G4cout << "Not found in: " << G4endl;
G4cout << fPtki << G4endl;
Error("GetImportance(ptk): Region does not exist");
}
return (*fCurrentIterator).second;
}
G4bool G4IStore::IsInWorld(const G4VPhysicalVolume &aVolume) const
{
return true;
/*
if (!aVolume) return false;
if (*aVolume==G4ParallelWorld::GetWorldVolume()) {
return true;
}
return IsInWorld(aVolume->GetMother());
*/
}
void G4IStore::Error(const G4String &m) const
{
G4cout << "ERROR - G4IStore::" << m << G4endl;
G4Exception("Program aborted.");
}
@@ -0,0 +1,117 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ImportanceAlgorithm.cc,v 1.4 2002/04/09 16:23:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ImportanceAlgorithm.cc
//
// ----------------------------------------------------------------------
#include "g4std/strstream"
#include "Randomize.hh"
#include "G4ImportanceAlgorithm.hh"
G4ImportanceAlgorithm::G4ImportanceAlgorithm(): fWorned(false)
{}
G4ImportanceAlgorithm::~G4ImportanceAlgorithm()
{
if(fWorned) {
G4cout << G4endl;
Warning("~G4ImportanceAlgorithm: ipre_over_ipost ! in [0.25, 4] seen");
G4cout << G4endl;
}
}
G4Nsplit_Weight
G4ImportanceAlgorithm::Calculate(G4double ipre_over_ipost,
G4double init_w) const
{
if ((ipre_over_ipost<0.25 || ipre_over_ipost> 4) && !fWorned) {
G4std::ostrstream os;
os << "Calculate: ipre_over_ipost ! in [0.25, 4]: ipre_over_ipost = "
<< ipre_over_ipost << '\0' << G4endl;
Warning(os.str());
fWorned = true;
if (ipre_over_ipost<=0) {
Error("Calculate: ipre_over_ipost<=0");
}
}
if (init_w<=0.) {
Error("Calculate: iniitweight<= 0. found");
}
// default geometrical splitting
// in integer mode
// for ipre_over_ipost <= 1
G4double inv = 1./ipre_over_ipost;
G4Nsplit_Weight nw( (int)inv, init_w * ipre_over_ipost);
// geometrical splitting for double mode
if (ipre_over_ipost<1) {
if ( G4double(nw.fN) != inv) {
// double mode
// probability p for splitting into n+1 tracks
G4double p = inv - nw.fN;
// get a random number out of [0,1)
G4double r = G4UniformRand();
if (r<p) {
nw.fN++;
}
}
}
// ipre_over_ipost > 1
// russian roulett
else {
// probabiity for killing track
G4double p = 1-inv;
// get a random number out of [0,1)
G4double r = G4UniformRand();
if (r<p) {
// kill track
nw.fN = 0;
nw.fW = 0;
}
else {
nw.fN = 1;
}
}
return nw;
}
void G4ImportanceAlgorithm::Error(const G4String &m) const
{
G4cout << "ERROR - G4ImportanceAlgorithm::" << m << G4endl;
G4Exception("Program aborted.");
}
void G4ImportanceAlgorithm::Warning(const G4String &m) const
{
G4cout << "WARNING - G4ImportanceAlgorithm::" << m << G4endl;
}
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ImportanceFinder.cc,v 1.3 2002/04/09 16:23:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ImportanceFinder.cc
//
// ----------------------------------------------------------------------
#include "g4std/strstream"
#include "G4VParallelStepper.hh"
#include "G4ImportanceFinder.hh"
#include "G4VIStore.hh"
#include "G4PStepStream.hh"
G4ImportanceFinder::G4ImportanceFinder(const G4VIStore &aIStore)
: fIStore(aIStore)
{}
G4ImportanceFinder::~G4ImportanceFinder()
{}
G4double
G4ImportanceFinder::GetIPre_over_IPost(const G4PTouchableKey &prekey,
const G4PTouchableKey &postkey) const
{
G4double ipre = fIStore.GetImportance(prekey);
G4double ipost = fIStore.GetImportance(postkey);
if (ipre <= 0 || ipost <=0 ) {
G4std::ostrstream os;
os << "ipre <= 0 || ipost <=0, preTouchableKey = " << prekey
<< ", postTouchableKey = " << postkey << '\0';
Error(os.str());
}
return ipre/ipost;
}
void G4ImportanceFinder::Error(const G4String &m) const
{
G4cout << "ERROR - G4ImportanceFinder::" << m << G4endl;
G4Exception("Program aborted.");
}
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ImportanceSplitExaminer.cc,v 1.1 2002/05/31 08:07:47 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ImportanceSplitExaminer.cc
//
// ----------------------------------------------------------------------
#include "G4ImportanceSplitExaminer.hh"
#include "G4ImportanceFinder.hh"
#include "G4VParallelStepper.hh"
#include "G4VImportanceAlgorithm.hh"
G4ImportanceSplitExaminer::
G4ImportanceSplitExaminer(const G4VImportanceAlgorithm &aIalg,
const G4VParallelStepper &astepper,
const G4VIStore &istore)
: fIalgorithm(aIalg),
fPStepper(astepper),
fIfinder(*(new G4ImportanceFinder(istore)))
{}
G4ImportanceSplitExaminer::~G4ImportanceSplitExaminer()
{
delete &fIfinder;
}
G4Nsplit_Weight G4ImportanceSplitExaminer::Examine(G4double w) const
{
G4PStep pstep = fPStepper.GetPStep();
return fIalgorithm.
Calculate(fIfinder.GetIPre_over_IPost(pstep.fPreTouchableKey,
pstep.fPostTouchableKey),
w);
}
@@ -0,0 +1,40 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Nsplit_Weight.cc,v 1.3 2002/04/09 16:23:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4Nsplit_Weight.cc
//
// ----------------------------------------------------------------------
#include "G4Nsplit_Weight.hh"
G4std::ostream& operator<<(G4std::ostream &out, const G4Nsplit_Weight &nw)
{
out << "nw.fN = " << nw.fN << ", nw.fW = " << nw.fW;
return out;
}
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PMapPtkTallys.cc,v 1.4 2002/04/09 16:23:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4PMapPtkTallys.cc
//
// ----------------------------------------------------------------------
#include "G4PMapPtkTallys.hh"
#include "G4PStepStream.hh"
#include "G4Sigma.hh"
G4std::ostream& operator << (G4std::ostream &out, const G4PMapNameTally &tallys)
{
for (G4PMapNameTally::const_iterator it = tallys.begin();
it != tallys.end(); it++) {
out << (*it).first << "\n";
out << (*it).second;
}
return out;
}
G4std::ostream& operator << (G4std::ostream &out,
const G4PMapPtkTallys &tallystore)
{
for (G4PMapPtkTallys::const_iterator it = tallystore.begin();
it != tallystore.end(); it++) {
out << (*it).first << "\n";
out << (*it).second;
}
return out;
}
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PStepStream.cc,v 1.3 2002/04/09 16:23:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4PStepStream.cc
//
// ----------------------------------------------------------------------
#include "G4PStepStream.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PStep.hh"
G4std::ostream& operator<<(G4std::ostream &out, const G4PTouchableKey &tk)
{
out << "Volume name = " << tk.fVPhysiclaVolume->GetName() << ", ";
out << "Replica number = " << tk.fRepNum;
return out;
}
G4std::ostream& operator<<(G4std::ostream &out, const G4PStep &ps)
{
out << "PreTouchableKey : " << ps.fPreTouchableKey << " ";
out << "PostTouchableKey: " << ps.fPostTouchableKey << " ";
out << "CrossBoundary : " << ps.fCrossBoundary << "\n";
return out;
}
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PTouchableKey.cc,v 1.2 2002/04/09 16:23:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4PTouchableKey.cc
//
// ----------------------------------------------------------------------
#include "G4PTouchableKey.hh"
G4PTouchableKey::G4PTouchableKey(const G4VPhysicalVolume &aVolume,
G4int RepNum)
: fVPhysiclaVolume(&aVolume),
fRepNum(RepNum)
{}
G4PTouchableKey::~G4PTouchableKey()
{}
G4bool G4PTkComp::operator() (const G4PTouchableKey &k1,
const G4PTouchableKey &k2) const
{
if (k1.fVPhysiclaVolume != k2.fVPhysiclaVolume) {
return k1.fVPhysiclaVolume < k2.fVPhysiclaVolume;
} else {
return k1.fRepNum < k2.fRepNum;
}
}
G4bool operator==(const G4PTouchableKey &k1, const G4PTouchableKey &k2)
{
if (k1.fVPhysiclaVolume != k2.fVPhysiclaVolume) return false;
if (k1.fRepNum != k2.fRepNum) return false;
return true;
}
G4bool operator!=(const G4PTouchableKey &k1, const G4PTouchableKey &k2)
{
if (k1.fVPhysiclaVolume != k2.fVPhysiclaVolume) return true;
if (k1.fRepNum != k2.fRepNum) return true;
return false;
}
@@ -0,0 +1,204 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ParallelNavigator.cc,v 1.5 2002/05/31 08:07:06 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ParallelNavigator.cc
//
// ----------------------------------------------------------------------
#include "g4std/strstream"
#include "G4ParallelNavigator.hh"
#include "G4VTouchable.hh"
#include "G4Navigator.hh"
#include "G4PTouchableKey.hh"
#include "G4VParallelStepper.hh"
G4ParallelNavigator::G4ParallelNavigator(G4VPhysicalVolume &aWorldVolume)
: fNavigator(*(new G4Navigator)), fNlocated(0)
{
fNavigator.SetWorldVolume(&aWorldVolume);
fCurrentTouchable = fNavigator.CreateTouchableHistory();
}
G4ParallelNavigator::~G4ParallelNavigator()
{
delete fCurrentTouchable;
delete &fNavigator;
}
// public functions
G4PTouchableKey G4ParallelNavigator::
LocateOnBoundary(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection)
{
Locate(aPosition, aDirection, true);
// since the track crosses a boundary ipdate stepper
return GetCurrentTouchableKey();
}
G4double G4ParallelNavigator::
ComputeStepLengthInit(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection)
{
G4double newSafety;
G4double stepLength;
// initialization
fNlocated = 0;
// first try
Locate(aPosition, aDirection, false);
stepLength = fNavigator.ComputeStep( aPosition, aDirection,
kInfinity, newSafety);
if (stepLength<=0.0) {
// second try with schifted position
stepLength = ComputeStepLengthShifted("ComputeStepLengthInit",
aPosition, aDirection);
}
return stepLength;
}
G4double G4ParallelNavigator::
ComputeStepLengthCrossBoundary(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection)
{
if (fNlocated == 0 ) {
Error("ComputeStepLengthCrossBoundary: no location done before call",
aPosition, aDirection);
}
// if the track is on boundary the location was done
// in the DOIT of the ImportanceSplitExaminer
G4double newSafety;
G4double stepLength = fNavigator.ComputeStep( aPosition, aDirection,
kInfinity, newSafety);
if (stepLength<=0.) {
// second try with schifted position
G4cout << "Warning: G4ParallelNavigator::ComputeStepLengthCrossBoundary: "
<< G4endl;
G4cout << "stepLength<=0." << ", pos = " << aPosition
<< ", dir = " << aDirection << G4endl;
G4cout << "try ComputeStepLengthShifted" << G4endl;
stepLength = ComputeStepLengthShifted("ComputeStepLengthCrossBoundary",
aPosition, aDirection);
}
return stepLength;
}
G4double G4ParallelNavigator::
ComputeStepLengthInVolume(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection)
{
if (fNlocated == 0 ) {
Error("ComputeStepLengthInVolume, no location done before call",
aPosition, aDirection);
}
// if the track is not on the boundary and it's
// not the first step, the location must be inside the
// volume
fNavigator.LocateGlobalPointWithinVolume(aPosition);
G4double newSafety;
G4double stepLength = fNavigator.ComputeStep( aPosition, aDirection,
kInfinity, newSafety);
if (stepLength<=0.) {
// second try with schifted position
G4cout << "Warning: G4ParallelNavigator::ComputeStepLengthInVolume: "
<< G4endl;
G4cout << "stepLength<=0." << ", pos = " << aPosition
<< ", dir = " << aDirection << G4endl;
G4cout << "try ComputeStepLengthShifted" << G4endl;
stepLength = ComputeStepLengthShifted("ComputeStepLengthInVolume",
aPosition, aDirection);
}
return stepLength;
}
// private functions
void G4ParallelNavigator::Locate(const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection,
G4bool histsearch)
{
fNavigator.SetGeometricallyLimitedStep();
fNavigator.
LocateGlobalPointAndUpdateTouchable( aPosition, aDirection,
fCurrentTouchable, histsearch);
fNlocated++;
return;
}
G4double
G4ParallelNavigator::ComputeStepLengthShifted(const G4String &m,
const G4ThreeVector &aPosition,
const G4ThreeVector &aDirection)
{
G4ThreeVector shift_pos(aPosition);
shift_pos+=G4ThreeVector(Shift(aDirection.x()),
Shift(aDirection.y()),
Shift(aDirection.z()));
Locate(shift_pos, aDirection, false);
G4double newSafety;
G4double stepLength = fNavigator.ComputeStep( shift_pos, aDirection,
kInfinity, newSafety);
if (stepLength<=0.0) {
G4std::ostrstream os;
os << "ComputeStepLengthShifted: called by " << m << "\n";
os << "shifted positio in second try: " << shift_pos << '\0' << G4endl;
Error(os.str() , aPosition, aDirection);
}
return stepLength;
}
G4PTouchableKey G4ParallelNavigator::GetCurrentTouchableKey() const
{
return G4PTouchableKey(*fCurrentTouchable->GetVolume(),
fCurrentTouchable->GetReplicaNumber());
}
void G4ParallelNavigator::Error(const G4String &m,
const G4ThreeVector &pos,
const G4ThreeVector &dir)
{
G4cout << "ERROR - G4ParallelNavigator::" << m << G4endl;
G4cout << "aPosition: " << pos << G4endl;
G4cout << "dir: " << dir << G4endl;
G4Exception("Program aborted.");
}
G4double G4ParallelNavigator::Shift(G4double d)
{
if (d>0) return 2 * kCarTolerance;
if (d<0) return -2 * kCarTolerance;
return 0.;
}
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ParallelStepper.cc,v 1.3 2002/04/10 13:13:07 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ParallelStepper.cc
//
// ----------------------------------------------------------------------
#include "G4ParallelStepper.hh"
#include "G4VPhysicalVolume.hh"
G4ParallelStepper::G4ParallelStepper()
: fPStep(0)
{}
G4ParallelStepper::~G4ParallelStepper()
{
if (fPStep) delete fPStep;
}
G4ParallelStepper::G4ParallelStepper(const G4ParallelStepper &rhs)
{
fPStep = new G4PStep(rhs.GetPStep());
}
G4ParallelStepper &G4ParallelStepper::operator=(const G4ParallelStepper &rhs)
{
if (this != &rhs) {
fPStep = new G4PStep(rhs.GetPStep());
}
return *this;
}
void G4ParallelStepper::Init(const G4PTouchableKey &aptk)
{
if (!fPStep) {
fPStep = new G4PStep(aptk, aptk);
}
else {
fPStep->fPreTouchableKey = aptk;
fPStep->fPostTouchableKey = aptk;
}
UnSetCrossBoundary();
}
void G4ParallelStepper::Update(const G4PTouchableKey &aptk)
{
if (!fPStep) {
Error("fPStep == 0, Init not called?");
}
fPStep->fPreTouchableKey = fPStep->fPostTouchableKey;
fPStep->fPostTouchableKey = aptk;
fPStep->fCrossBoundary = true;
}
void G4ParallelStepper::UnSetCrossBoundary()
{
if (!fPStep) {
Error("fPStep == 0, Init not called?");
}
fPStep->fCrossBoundary = false;
}
void G4ParallelStepper::Error(const G4String &m)
{
G4cout << "ERROR: in G4ParallelStepper::" << m << G4endl;
G4Exception("Program aborted.");
}
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ParallelWorld.cc,v 1.2 2002/04/09 16:23:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ParallelWorld.cc
//
// ----------------------------------------------------------------------
#include "G4ParallelWorld.hh"
#include "G4ParallelStepper.hh"
#include "G4ParallelNavigator.hh"
#include "G4VPhysicalVolume.hh"
G4ParallelWorld::G4ParallelWorld(G4VPhysicalVolume &worldvolume)
: fWorldVolume(&worldvolume),
fPstepper(new G4ParallelStepper),
fPdriver(new G4ParallelNavigator(*fWorldVolume))
{}
G4ParallelWorld::~G4ParallelWorld()
{
delete fPdriver;
delete fPstepper;
}
G4ParallelWorld::G4ParallelWorld(const G4ParallelWorld &rhs)
: fWorldVolume(rhs.GetWorldVolume())
{
fPstepper = new G4ParallelStepper;
fPdriver = new G4ParallelNavigator(*fWorldVolume);
}
G4ParallelWorld &G4ParallelWorld::operator=(const G4ParallelWorld &rhs)
{
if (this!=&rhs) {
fWorldVolume = rhs.GetWorldVolume();
fPstepper = new G4ParallelStepper;
fPdriver = new G4ParallelNavigator(*fWorldVolume);
}
return *this;
}
G4VPhysicalVolume *G4ParallelWorld::GetWorldVolume() const
{
return fWorldVolume;
}
G4VParallelStepper &G4ParallelWorld::GetParallelStepper()
{
return *fPstepper;
}
G4VPGeoDriver &G4ParallelWorld::GetGeoDriver()
{
return *fPdriver;
}
+62
View File
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Pstring.cc,v 1.2 2002/04/09 16:23:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4Pstring.cc
//
// ----------------------------------------------------------------------
#include "G4Pstring.hh"
G4String str(const int &i)
{
char s[200];
sprintf(s,"%d",i);
return s;
}
G4String str(const double &d)
{
char s[200];
sprintf(s,"%f",d);
return s;
}
G4String str(const G4ThreeVector &v)
{
G4String out = "(";
out += str(v.x());
out += ", ";
out += str(v.y());
out += ", ";
out += str(v.z());
out += ")";
return out;
}
@@ -0,0 +1,45 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4PtkImportance.cc,v 1.4 2002/04/09 16:23:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4PtkImportance.cc
//
// ----------------------------------------------------------------------
#include "G4PtkImportance.hh"
#include "G4PStepStream.hh"
G4std::ostream& operator<<(G4std::ostream &out, const G4PtkImportance &ptki)
{
for (G4PtkImportance::const_iterator it = ptki.begin();
it != ptki.end(); it++) {
out << (*it).first << ", importance = ";
out << (*it).second << "\n";
}
return out;
}
+134
View File
@@ -0,0 +1,134 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Sigma.cc,v 1.4 2002/04/09 16:23:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4Sigma.cc
//
// ----------------------------------------------------------------------
#include "G4Sigma.hh"
#include "globals.hh"
#include <cstdio>
#include <cmath>
G4Sigma::G4Sigma()
{
Init();
}
G4Sigma::~G4Sigma()
{}
void G4Sigma::Init()
{
fEntries = 0;
fMean = 0.;
fSigma = -1.;
fXsum = 0;
fXXsum = 0;
fWsum = 0;
fWXsum = 0;
fWXXsum = 0;
fcalc = 0;
}
G4int G4Sigma::Xin(G4double x, G4double w)
{
if (w<0.) Error("Xin: w < 0");
fEntries++;
fXsum+=x;
fXXsum+=x*x;
fWsum += w;
fWXsum += w*x;
fWXXsum += w*x*x;
fcalc = 0;
return fEntries;
}
G4int G4Sigma::GetCalc() const
{
return fcalc;
}
G4int G4Sigma::Calculate() const
{
if (fcalc==0) {
if(fWsum>0) {
fMean=fWXsum/fWsum;
fSigma = sqrt( fWXXsum / fWsum - fMean * fMean);
fcalc = 1;
} else {
fcalc = -1;
}
}
return fcalc;
}
G4int G4Sigma::GetEntries() const
{
return fEntries;
}
G4double G4Sigma::GetMean() const
{
if (fcalc==0) Calculate();
return fMean;
}
G4double G4Sigma::GetSigma() const
{
if (fcalc==0) Calculate();
return fSigma;
}
G4double G4Sigma::GetXsum() const {return fXsum;}
G4double G4Sigma::GetXXsum() const {return fXXsum;}
G4double G4Sigma::GetSumOfWeights() const {return fWsum;}
G4double G4Sigma::GetWeightedXsum() const {return fWXsum;}
G4double G4Sigma::GetWeightedXXsum() const {return fWXXsum;}
void G4Sigma::Error(const G4String &m)
{
G4cout << "ERROR: G4Sigma::" << m << G4endl;
}
G4std::ostream& operator<<(G4std::ostream &out, const G4Sigma &s)
{
out << "entries : " << s.GetEntries() << "\n";
out << "Sum(w) : " << s.GetSumOfWeights()<<"\n";
out << "Sum(w*x) : " << s.GetWeightedXsum() << "\n";
out << "Sum(w*x*x) : " << s.GetWeightedXXsum() << "\n";
out << "mean=Sum(w*x) / Sum(w) : " << s.GetMean() << "\n";
out << "sigma=sqrt(Sum(w*x*x)/Sum(w)-mean^2): " << s.GetSigma() << "\n";
out << "Sum(x) : " << s.GetXsum() << "\n";
out << "Sum(x^2) : " << s.GetXXsum() << "\n";
return out;
}
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4WeightWindowAlgorithm.cc,v 1.2 2002/05/31 09:56:09 dressel Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4WeightWindowAlgorithm.cc
//
// ----------------------------------------------------------------------
#include "G4WeightWindowAlgorithm.hh"
#include "Randomize.hh"
G4WeightWindowAlgorithm::G4WeightWindowAlgorithm() :
fUpper(1),
fLower(1)
{}
void G4WeightWindowAlgorithm::SetUpperLimit(G4double Upper){
fUpper = Upper;
}
void G4WeightWindowAlgorithm::SetLowerLimit(G4double Lower){
fLower = Lower;
}
G4Nsplit_Weight
G4WeightWindowAlgorithm::Calculate(G4double init_w,
G4double importance) const {
G4Nsplit_Weight nw(1, init_w);
G4double iw = importance * init_w;
if (iw>fUpper) {
// f is the factor by which the weight is greater
// than allowed by fUpper
// it is almost the number of coppies to be produced
G4double f = iw / fUpper;
// calculate new weight
nw.fW/=f;
// calculate the number of coppies
nw.fN = int(f);
// correct the number of coppies in case f is not an integer
if (G4double(nw.fN) != f) {
// probabillity p for splitting into nw.fN+1 particles
G4double p = f - nw.fN;
// get a random number out of [0,1)
G4double r = G4UniformRand();
if (r<p) {
nw.fN++;
}
}
}
else if (iw < fLower) {
// play russian roulett
G4double p = iw / fLower; // survival prob.
G4double r = G4UniformRand();
if (r>=p) {
// kill track
nw.fN = 0;
nw.fW = 0;
}
else {
nw.fW*=1/p; // to be consistant with the survival prob.
}
}
return nw;
}