Import Geant4 4.1.0 source tree
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
# $Id: GNUmakefile,v 1.3 2001/10/17 12:59:48 gcosmo Exp $
|
||||
# $Id: GNUmakefile,v 1.4 2002/03/25 17:09:16 gcosmo Exp $
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for geometry. Gabriele Cosmo, 16/11/96.
|
||||
# --------------------------------------------------------------
|
||||
|
||||
name := G4geometry
|
||||
|
||||
SUBDIRS = management volumes magneticfield verification
|
||||
SUBDIRS = management volumes magneticfield verification biasing
|
||||
SUBDIRS += solids/CSG solids/specific solids/Boolean solids/BREPS solids/STEP solids/STEPinterface
|
||||
SUBLIBS = G4geometrymng G4volumes G4magneticfield G4geomver
|
||||
SUBLIBS = G4geometrymng G4volumes G4magneticfield G4geomver G4geombias
|
||||
SUBLIBS += G4csg G4specsolids G4geomBoolean G4brep G4step G4stepinterface
|
||||
|
||||
ifndef G4INSTALL
|
||||
|
||||
+26
-1
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.21 2001/10/22 16:40:30 gcosmo Exp $
|
||||
$Id: History,v 1.27 2002/04/19 08:31:18 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,31 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
Apr 19, 2002 Gabriele Cosmo geometry-V04-00-03
|
||||
-----------------------------
|
||||
- Groups the following tags (see related History files for details):
|
||||
geom-bool-V04-00-04, geom-csg-V04-00-03, geommng-V04-00-03,
|
||||
geomvol-V04-00-06, geomver-V04-00-00, breps-V04-00-05.
|
||||
|
||||
Apr 10, 2002 Gabriele Cosmo geometry-V04-00-02
|
||||
-----------------------------
|
||||
- Fixed compilation problems for porting on supported and non-ISO platforms
|
||||
on 'biasing' module. Includes "geomvol-V04-00-05" and "geombias-V04-00-03"
|
||||
on top of previous global geometry tag.
|
||||
|
||||
Mar 25, 2002 Gabriele Cosmo geometry-V04-00-01
|
||||
-----------------------------
|
||||
- Added 'biasing' module. Updated global GNUmakefile.
|
||||
- Includes "biasing" module on top of 'geant4-04-00-ref-03'.
|
||||
|
||||
Jan 11, 2002 Gabriele Cosmo geometry-V04-00-00
|
||||
-----------------------------
|
||||
- Updated unit tests and benchmarks.
|
||||
- This tag includes also the following tags on top of "geant4-04-00-ref-00":
|
||||
geomvol-V04-00-01, geommng-V04-00-00, geom-solids-csg-V04-00-00,
|
||||
field-V04-00-00, geom-solid-bool-V04-00-00, geom-solids-specific-V04-00-00.
|
||||
See related History files for details.
|
||||
|
||||
Oct 22, 2001 Gabriele Cosmo geometry-V03-02-01
|
||||
-----------------------------
|
||||
- Introduced new module "verification" for geometry debugging.
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile,v 1.2 1999/02/17 16:57:35 japost Exp $
|
||||
# $Id: GNUmakefile,v 1.3 2002/01/10 15:52:07 gcosmo Exp $
|
||||
# --------------------------------------------------------------------
|
||||
# GNUmakefile for geometry/magneticfield library. G.Cosmo, 22/01/97.
|
||||
|
||||
@@ -13,6 +13,10 @@ include $(G4INSTALL)/config/architecture.gmk
|
||||
CPPFLAGS += \
|
||||
-I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPRandom/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include
|
||||
|
||||
ifdef G4DEBUG_FIELD
|
||||
CPPFLAGS += -DG4DEBUG_FIELD
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.48 2001/12/04 17:42:29 gcosmo Exp $
|
||||
$Id: History,v 1.60 2002/06/07 18:30:29 japost Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -16,6 +16,77 @@ committal in the CVS repository !
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
Jun 7th, 2002 J. Apostolakis - field-V04-00-04
|
||||
--------------------------------
|
||||
- G4Mag_SpinEqRhs.cc
|
||||
o Fix to momentum component of Rhs.
|
||||
|
||||
May 31st, 2002 J. Apostolakis - field-V04-00-03
|
||||
--------------------------------
|
||||
- G4MagHelicalStepper.icc
|
||||
o Fix to LinearStep (correcting previous fix/cosmetic)
|
||||
- G4ChordFinder.cc
|
||||
o Corrective behaviour for very small or large changes of 'new step'
|
||||
[observed in complex 3-d fields (purging magnet), or
|
||||
approximate equations of motion ]
|
||||
- G4MagIntegratorDriver
|
||||
o More information in debug printing (tangent cosine, norm)
|
||||
|
||||
|
||||
May 7th, 2002 J. Apostolakis - field-V04-00-02
|
||||
--------------------------------
|
||||
Tag including only two changes below:
|
||||
- Putting aside the other fixes/changes (as the one above) to
|
||||
G4MagIntegratorDriver, tagging only the fix to update the field track
|
||||
for steps smaller than the chord finder's minstep.
|
||||
|
||||
May 7th, 2002 J. Apostolakis
|
||||
--------------------------------
|
||||
- G4MagIntegratorDriver - ** branch ** on 1.20 **
|
||||
* Fix to update the field track for steps smaller than the chord finder's
|
||||
minstep.
|
||||
|
||||
May 7th, 2002 J. Apostolakis
|
||||
--------------------------------
|
||||
- G4MagIntegratorStepper
|
||||
* Changed RightHandSide from a virtual method to an inline (non-virtual)
|
||||
method -- it is not and should not be changed by derived classes.
|
||||
|
||||
Mar 28th, 2002 J. Apostolakis - field-V04-00-01
|
||||
-----------------------
|
||||
- Fixed LinearStep in G4MagHelicalStepper (expected unit direction),
|
||||
that had not been updated for new integration variable (momentum).
|
||||
--> found in testing helical steppers in BaBar setup,
|
||||
in region of negligible field.
|
||||
|
||||
- Changed maximum number of steps in driver,
|
||||
halving from 500/order to 250/order.
|
||||
|
||||
Mar 28th, 2002 J. Apostolakis
|
||||
-----------------------
|
||||
- Committed directory "OtherField" with examples of fields,
|
||||
Delphi, Quadropole etc.
|
||||
|
||||
- Updated outputs of testPropagateMagField for new version of source,
|
||||
that has 3rd test case.
|
||||
|
||||
- Added new runs and outputs for testProElectroMagField, with
|
||||
several steppers, and modified test script test.sh accordingly.
|
||||
|
||||
|
||||
Feb 2nd, 2002 V. Grichine
|
||||
------------------------
|
||||
Update of test/field02 to utilise new features
|
||||
- for Electric Field, to signal that a field modifies the energy;
|
||||
- updating of time by integration, for time dependent fields.
|
||||
|
||||
Jan 10th, 2002 G. Cosmo - field-V04-00-00
|
||||
------------------------
|
||||
- Activated G4DEBUG_FIELD in GNUmakefile.
|
||||
|
||||
Jan 7th, 2002 J. Apostolakis
|
||||
-----------------------------
|
||||
- G4MagHelicalStepper.cc: renamed local variables "*Momentum*" to "*Velocity*".
|
||||
|
||||
Dec 4th, 2001 G. Cosmo - field-V03-02-08
|
||||
-----------------------
|
||||
@@ -240,6 +311,12 @@ Jun 2nd, 2000 J. Apostolakis
|
||||
o Added DeltaIntersection and DeltaOneStep to FieldManager: added
|
||||
Get/Set methods and SetAccuraciesWithDeltaOneStep().
|
||||
|
||||
May 31st, 2000 J. Apostolakis - field-V01-01-03
|
||||
|
||||
include/G4FieldManager.hh,icc
|
||||
o Moved Delta Intersection and Delta One Step to FieldManager
|
||||
(from Propagator in Field), to allow them to differ over the detector.
|
||||
|
||||
May 11th, 2000 J. Apostolakis - field-V01-01-02
|
||||
|
||||
- G4ChordFinder[.hh.cc]
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4CashKarpRKF45.hh,v 1.7 2001/07/11 09:59:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4CashKarpRKF45
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ChordFinder.hh,v 1.8 2001/08/16 23:54:15 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4ChordFinder
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ChordFinder.icc,v 1.4 2001/08/16 23:54:51 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// G4ChordFinder inline implementations
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ClassicalRK4.hh,v 1.5 2001/07/11 09:59:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4ClassicalRK4
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ElectroMagneticField.hh,v 1.6 2001/11/08 17:31:06 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4ElectroMagneticField
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4EqMagElectricField.hh,v 1.6 2001/07/11 09:59:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4EqMagElectricField
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4EquationOfMotion.hh,v 1.5 2001/07/11 09:59:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4EquationOfMotion
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4EquationOfMotion.icc,v 1.5 2001/07/11 09:59:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// Inline implementation
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ExplicitEuler.hh,v 1.5 2001/07/11 09:59:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4ExplicitEuler
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Field.hh,v 1.6 2001/11/08 17:31:07 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4Field
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldManager.hh,v 1.7 2001/11/28 18:44:43 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4FieldManager
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldManager.icc,v 1.5 2001/11/28 18:44:43 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// G4FieldManager inline implementation
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldTrack.hh,v 1.8 2001/10/25 17:02:16 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4FieldTrack
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldTrack.icc,v 1.9 2001/10/25 17:02:16 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
#include "PhysicalConstants.h"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixExplicitEuler.hh,v 1.6 2001/07/11 09:59:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4HelixExplicitEuler
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixHeum.hh,v 1.6 2001/07/11 09:59:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4HelixHeum
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixImplicitEuler.hh,v 1.6 2001/07/11 09:59:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4HelixImplicitEuler
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixSimpleRunge.hh,v 1.5 2001/07/11 09:59:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// W. Wander <wwc@mit.edu> 03/12/98
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ImplicitEuler.hh,v 1.4 2001/07/11 09:59:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// W. Wander <wwc@mit.edu> 12/09/97
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4LineSection.hh,v 1.7 2001/12/05 16:40:18 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4LineSection
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagErrorStepper.hh,v 1.8 2001/07/11 09:59:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagErrorStepper
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagErrorStepper.icc,v 1.8 2001/07/11 09:59:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
|
||||
inline
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.hh,v 1.7 2001/07/11 09:59:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagHelicalStepper
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.icc,v 1.5 2001/07/11 09:59:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// $Id: G4MagHelicalStepper.icc,v 1.7 2002/05/31 16:22:54 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
|
||||
// linear Step in regions of no field
|
||||
@@ -32,8 +32,15 @@ G4MagHelicalStepper::LinearStep( const G4double yIn[],
|
||||
G4double h,
|
||||
G4double yLinear[])
|
||||
{
|
||||
G4double momentum_val = sqrt(yIn[3]*yIn[3] + yIn[4]*yIn[4] + yIn[5]*yIn[5]) ;
|
||||
G4double inv_momentum = 1.0 / momentum_val ;
|
||||
G4double yDir[3];
|
||||
// G4double h_div_momentum = 1.0 / momentum_val ;
|
||||
|
||||
for( G4int i = 0; i < 3; i++ ) {
|
||||
yLinear[i] = yIn[i] + h * yIn[i+3];
|
||||
yDir[i] = inv_momentum * yIn[i+3];
|
||||
yLinear[i] = yIn[i] + h * yDir[i];
|
||||
// yLinear[i] = yIn[i] + h_div_momentum * yIn[i+3];
|
||||
yLinear[i+3] = yIn[i+3];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MagIntegratorDriver.hh,v 1.10 2001/11/09 19:17:20 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// $Id: G4MagIntegratorDriver.hh,v 1.11 2002/04/19 17:31:41 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagInt_Driver
|
||||
@@ -165,7 +165,9 @@ class G4MagInt_Driver
|
||||
void PrintStat_Aux( const G4FieldTrack& aFieldTrack,
|
||||
G4double requestStep,
|
||||
G4double actualStep,
|
||||
G4int subStepNo);
|
||||
G4int subStepNo,
|
||||
G4double subStepSize,
|
||||
G4double dotVelocities);
|
||||
// Verbose output for debugging
|
||||
|
||||
#ifdef QUICK_ADV_TWO
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagIntegratorDriver.icc,v 1.7 2001/10/25 09:11:09 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
|
||||
inline
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MagIntegratorStepper.hh,v 1.7 2001/07/11 09:59:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// $Id: G4MagIntegratorStepper.hh,v 1.8 2002/05/07 16:11:59 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagIntegratorStepper
|
||||
@@ -66,7 +66,7 @@ class G4MagIntegratorStepper
|
||||
inline void NormaliseTangentVector( G4double vec[6] );
|
||||
// Simple utility function to (re)normalise 'unit velocity' vector.
|
||||
|
||||
virtual void RightHandSide( const double y[], double dydx[] );
|
||||
inline void RightHandSide( const double y[], double dydx[] );
|
||||
// Utility method to supply the standard Evaluation of the
|
||||
// Right Hand side of the associated equation.
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MagIntegratorStepper.icc,v 1.5 2001/07/11 09:59:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// $Id: G4MagIntegratorStepper.icc,v 1.6 2002/05/07 16:11:59 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
|
||||
inline
|
||||
@@ -43,6 +43,12 @@ void G4MagIntegratorStepper::SetNumberOfVariables(G4int newNo)
|
||||
fNumberOfVariables = newNo;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4MagIntegratorStepper::RightHandSide( const double y[], double dydx[] )
|
||||
{
|
||||
fEquation_Rhs-> RightHandSide(y, dydx);
|
||||
}
|
||||
|
||||
inline
|
||||
void G4MagIntegratorStepper::NormaliseTangentVector( G4double vec[6] )
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Mag_EqRhs.hh,v 1.6 2001/07/11 09:59:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4Mag_EqRhs
|
||||
|
||||
@@ -21,17 +21,18 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Mag_SpinEqRhs.hh,v 1.7 2001/07/17 02:13:43 gum Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// $Id: G4Mag_SpinEqRhs.hh,v 1.8 2002/06/07 18:25:09 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4Mag_SpinEqRhs
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// This is the standard right-hand side for equation of motion.
|
||||
// This version of the right-hand side includes the three components
|
||||
// of the particle's spin.
|
||||
// This is the equation of motion for a particle with spin in a pure
|
||||
// magnetic field.
|
||||
// The three components of the particle's spin are treated
|
||||
// utilising BMT equation.
|
||||
|
||||
// History:
|
||||
// - Created: J.Apostolakis, P.Gumplinger - February 8th, 1999.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Mag_UsualEqRhs.hh,v 1.4 2001/07/11 09:59:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4Mag_UsualEqRhs
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagneticField.hh,v 1.10 2001/12/04 17:47:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4MagneticField
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RKG3_Stepper.hh,v 1.8 2001/07/11 09:59:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4RKG3_Stepper
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SimpleHeum.hh,v 1.5 2001/07/11 09:59:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4SimpleHeum
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SimpleRunge.hh,v 1.5 2001/07/11 09:59:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4SimpleRunge
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UniformElectricField.hh,v 1.6 2001/12/04 17:35:52 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4UniformElectricField
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UniformMagField.hh,v 1.7 2001/12/04 17:35:52 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// class G4UniformMagField
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4CashKarpRKF45.cc,v 1.10 2001/11/21 17:56:18 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
|
||||
// order method (giving fifth-order accuracy) for the solution
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ChordFinder.cc,v 1.24 2001/11/30 17:36:18 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// $Id: G4ChordFinder.cc,v 1.27 2002/06/01 02:37:14 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// 25.02.97 John Apostolakis, design and implimentation
|
||||
@@ -184,7 +184,10 @@ G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
|
||||
stepForChord = NewStep(stepTrial, dChordStep, fLastStepEstimate_Unconstrained );
|
||||
|
||||
if( ! validEndPoint ) {
|
||||
stepTrial = stepForChord;
|
||||
if( stepForChord <= oldStepTrial )
|
||||
stepTrial = stepForChord;
|
||||
else
|
||||
stepTrial *= 0.1;
|
||||
#if 0
|
||||
// Possible complementary approach:
|
||||
// Get the driver to calculate the new step size, if it is needed
|
||||
@@ -250,14 +253,27 @@ G4double G4ChordFinder::NewStep(G4double stepTrialOld,
|
||||
static G4double lastStepTrial = 1., lastDchordStep= 1.;
|
||||
|
||||
#if 1
|
||||
const G4double threshold = 1.21, multiplier = 0.9; // 0.9 < 1 / sqrt(1.21)
|
||||
|
||||
// const G4double threshold = 1.21, multiplier = 0.9; // 0.9 < 1 / sqrt(1.21)
|
||||
|
||||
stepEstimate_Unconstrained = stepTrialOld * sqrt( fDeltaChord / dChordStep );
|
||||
stepTrial = 0.98 * stepEstimate_Unconstrained;
|
||||
|
||||
if ( dChordStep < threshold * fDeltaChord ){
|
||||
stepTrial= stepTrialOld * multiplier;
|
||||
// if ( dChordStep < threshold * fDeltaChord ){
|
||||
// stepTrial= stepTrialOld * multiplier;
|
||||
// }
|
||||
if( (stepTrial < 0.001 * stepTrialOld)
|
||||
|| (stepTrial > 1000.0 * stepTrialOld)
|
||||
){
|
||||
if ( dChordStep > 1000.0 * fDeltaChord ){
|
||||
stepTrial= stepTrialOld * 0.03;
|
||||
}else{
|
||||
if ( dChordStep > 100. * fDeltaChord ){
|
||||
stepTrial= stepTrialOld * 0.1;
|
||||
}else{
|
||||
// Try halving the length until dChordStep OK
|
||||
stepTrial= stepTrialOld * 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lastStepTrial = stepTrialOld;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ClassicalRK4.cc,v 1.4 2001/07/11 09:59:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
#include "G4ClassicalRK4.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4EquationOfMotion.cc,v 1.5 2001/11/09 20:39:07 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
#include "G4EquationOfMotion.hh"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ExplicitEuler.cc,v 1.4 2001/07/11 09:59:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// Explicit Euler: x_1 = x_0 + h * dx_0
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldManager.cc,v 1.6 2001/11/28 18:44:43 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
#include "G4FieldManager.hh"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FieldTrack.cc,v 1.4 2001/07/11 09:59:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
#include "G4FieldTrack.hh"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixExplicitEuler.cc,v 1.4 2001/07/11 09:59:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
#include "G4HelixExplicitEuler.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixHeum.cc,v 1.4 2001/07/11 09:59:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
#include "G4HelixHeum.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixImplicitEuler.cc,v 1.4 2001/07/11 09:59:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
#include "G4HelixImplicitEuler.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HelixSimpleRunge.cc,v 1.5 2001/07/11 09:59:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
#include "G4HelixSimpleRunge.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ImplicitEuler.cc,v 1.4 2001/07/11 09:59:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// Implicit Euler:
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4LineSection.cc,v 1.6 2001/12/04 15:10:01 grichine Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// typedef double G4double;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4MagErrorStepper.cc,v 1.9 2001/07/11 09:59:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
#include "G4MagErrorStepper.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MagHelicalStepper.cc,v 1.8 2001/07/11 09:59:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// $Id: G4MagHelicalStepper.cc,v 1.11 2002/01/17 08:12:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
#include "G4MagHelicalStepper.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
@@ -67,13 +67,13 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
|
||||
G4double Bmag = Bfld.mag();
|
||||
const G4double *pIn = yIn+3;
|
||||
G4ThreeVector initMomentum= G4ThreeVector( pIn[0], pIn[1], pIn[2]);
|
||||
G4double momentumVal = initMomentum.mag();
|
||||
G4ThreeVector initTangent = (1.0/momentumVal) * initMomentum; // .unit();
|
||||
G4ThreeVector initVelocity= G4ThreeVector( pIn[0], pIn[1], pIn[2]);
|
||||
G4double velocityVal = initVelocity.mag();
|
||||
G4ThreeVector initTangent = (1.0/velocityVal) * initVelocity; // .unit();
|
||||
|
||||
// fCof = fUnitConstant*particleCharge/MomentumXc;
|
||||
G4double particleCharge = fPtrMagEqOfMot->FCof() / (eplus*c_light);
|
||||
G4double fCoefficient = (fUnitConstant / momentumVal) * particleCharge;
|
||||
G4double fCoefficient = (fUnitConstant / velocityVal) * particleCharge;
|
||||
|
||||
// for too small magnetic fields there is no curvature
|
||||
// (include momentum here) FIXME
|
||||
@@ -140,9 +140,9 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
|
||||
yHelix[1] = yIn[1] + positionMove.y();
|
||||
yHelix[2] = yIn[2] + positionMove.z();
|
||||
|
||||
yHelix[3] = momentumVal * endTangent.x();
|
||||
yHelix[4] = momentumVal * endTangent.y();
|
||||
yHelix[5] = momentumVal * endTangent.z();
|
||||
yHelix[3] = velocityVal * endTangent.x();
|
||||
yHelix[4] = velocityVal * endTangent.y();
|
||||
yHelix[5] = velocityVal * endTangent.z();
|
||||
|
||||
// Store and/or calculate parameters for chord distance.
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MagIntegratorDriver.cc,v 1.20 2001/11/21 16:43:16 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// $Id: G4MagIntegratorDriver.cc,v 1.25 2002/05/07 17:18:49 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -30,16 +30,17 @@
|
||||
// Tracking in space dependent magnetic field
|
||||
//
|
||||
// History of major changes:
|
||||
// 7 Oct 96 V. Grichine First version
|
||||
// 28 Jan 98 W. Wander: Added ability for low order integrators
|
||||
// 30 Jan 98 J. Apostolakis: Made method parameters into instance variables
|
||||
// 8 Nov 01 J. Apostolakis: Respect minimum step in AccurateAdvance
|
||||
// 27 Jul 99 J. Apostolakis: Ensured that AccurateAdvance does not loop
|
||||
// due to very small eps & step size (precision)
|
||||
// 28 Jan 98 W. Wander: Added ability for low order integrators
|
||||
// 7 Oct 96 V. Grichine First version
|
||||
#include <math.h>
|
||||
#include "G4ios.hh"
|
||||
#include "G4MagIntegratorDriver.hh"
|
||||
#include "G4FieldTrack.hh"
|
||||
#include "geomdefs.hh" // for kCarTolerance
|
||||
#include "g4std/iomanip"
|
||||
|
||||
// Stepsize can increase by no more than 5.0
|
||||
// and decrease by no more than 1/10. = 0.1
|
||||
@@ -49,7 +50,7 @@ const G4double G4MagInt_Driver::max_stepping_decrease = 0.1;
|
||||
|
||||
// The (default) maximum number of steps is Base divided by the order of Stepper
|
||||
//
|
||||
const G4int G4MagInt_Driver::fMaxStepBase = 500; // Was 5000
|
||||
const G4int G4MagInt_Driver::fMaxStepBase = 250; // Was 5000
|
||||
|
||||
// Constructor
|
||||
//
|
||||
@@ -62,6 +63,9 @@ G4MagInt_Driver::G4MagInt_Driver( G4double hminimum,
|
||||
RenewStepperAndAdjust( pItsStepper );
|
||||
hminimum_val= hminimum;
|
||||
fMaxNoSteps = fMaxStepBase / pIntStepper->IntegratorOrder();
|
||||
#ifdef G4DEBUG_FIELD
|
||||
fVerboseLevel=2;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Destructor
|
||||
@@ -92,9 +96,9 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
|
||||
G4int no_warnings=0;
|
||||
#ifdef G4DEBUG_FIELD
|
||||
static G4int dbg=0;
|
||||
dbg=1;
|
||||
fVerboseLevel=2;
|
||||
static G4int dbg=1;
|
||||
G4double ySubStepStart[G4FieldTrack::ncompSVEC];
|
||||
G4FieldTrack yFldTrkStart(y_current);
|
||||
#endif
|
||||
|
||||
// G4double yscal[ncompSVEC];
|
||||
@@ -129,19 +133,24 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
|
||||
do{
|
||||
G4ThreeVector StartPos( y[0], y[1], y[2] );
|
||||
# ifdef G4DEBUG_FIELD
|
||||
for(i=0;i<nvar;i++) ySubStepStart[i] = y[i] ;
|
||||
yFldTrkStart.LoadFromArray(y);
|
||||
yFldTrkStart.SetCurveLength(x);
|
||||
# endif
|
||||
|
||||
pIntStepper->RightHandSide( y, dydx );
|
||||
|
||||
if( x+h > x2 ) {
|
||||
h = x2 - x ; // When stepsize overshoots, decrease it!
|
||||
}
|
||||
if( h < eps * hstep) {
|
||||
lastStep = true; // Ensure that this must be the last step
|
||||
// because otherwise numerical (im)precision
|
||||
// could otherwise force lots of small last steps.
|
||||
h = x2 - x ; // When stepsize overshoots, decrease it!
|
||||
if( h < eps * hstep) {
|
||||
lastStep = true; // Ensure that this must be the last step
|
||||
// - since otherwise numerical (im)precision
|
||||
// could force lots of small last steps
|
||||
}
|
||||
}
|
||||
|
||||
// static G4int nStpPr=50; // For debug printing of integrations with many steps
|
||||
static G4int nStpPr=50; // For debug printing of integrations with many steps
|
||||
|
||||
// Perform the Integration
|
||||
//
|
||||
@@ -150,41 +159,44 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
OneGoodStep(y,dydx,x,h,eps,hdid,hnext) ;
|
||||
//--------------------------------------
|
||||
lastStepSucceeded= (hdid == h);
|
||||
# ifdef G4DEBUG_FIELD
|
||||
if(dbg>2) PrintStatus( ySubStepStart, x1, y, x, h, nstp); // Only
|
||||
# endif
|
||||
}else{
|
||||
#if 0
|
||||
OneGoodStep(y,dydx,x,h,2*eps,hdid,hnext) ;
|
||||
//--------------------------------------
|
||||
lastStepSucceeded= (hdid == h);
|
||||
#else
|
||||
G4FieldTrack yFldTrk( G4ThreeVector(0,0,0),
|
||||
G4ThreeVector(0,0,0), 0., 0., 0., 0. );
|
||||
G4double dchord_step, dyerr, dyerr_len; // Must figure what to do with these
|
||||
yFldTrk.LoadFromArray(y);
|
||||
yFldTrk.SetCurveLength( x );
|
||||
// G4double s_start = yFldTrk.GetCurveLength();
|
||||
|
||||
QuickAdvance( yFldTrk, dydx, h, dchord_step, dyerr_len );
|
||||
//-----------------------------------------------------
|
||||
|
||||
# ifdef G4DEBUG_FIELD
|
||||
if(dbg>1) OneGoodStep(y,dydx,x,h,2*eps,hdid,hnext) ;
|
||||
if(dbg>1) PrintStatus( ystart, x1, y, x, h, -nstp);
|
||||
// if(dbg>1) OneGoodStep(y,dydx,x,h,2*eps,hdid,hnext) ;
|
||||
// if(dbg>1) PrintStatus( ystart, x1, y, x, h, -nstp);
|
||||
# endif
|
||||
yFldTrk.DumpToArray(y);
|
||||
if(dbg>1) PrintStatus( ystart, x1, y, x, h, nstp); // Only this
|
||||
# ifdef G4DEBUG_FIELD
|
||||
if(dbg>1) PrintStatus( ySubStepStart, x1, y, x, h, nstp); // Only this
|
||||
# endif
|
||||
dyerr = dyerr_len / hstep;
|
||||
dyerr = dyerr_len / h; // was dyerr_len / hstep;
|
||||
hdid= h;
|
||||
x += hdid;
|
||||
// Compute suggested new step
|
||||
hnext= ComputeNewStepSize( dyerr/eps, h);
|
||||
// .. hnext= ComputeNewStepSize_WithinLimits( dyerr/eps, h);
|
||||
lastStepSucceeded= (dyerr<= eps);
|
||||
#endif
|
||||
}
|
||||
// #ifdef G4DEBUG_FIELD
|
||||
|
||||
if(lastStepSucceeded) noFullIntegr++ ; else noSmallIntegr++ ;
|
||||
G4ThreeVector EndPos( y[0], y[1], y[2] );
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if(nstp>nStpPr) {
|
||||
G4cout << "hdid=" << hdid << "hnext =" << hnext << " " << endl;
|
||||
PrintStatus( ystart, x1, y, x, h, nstp==nStpPr ? -nstp: nstp);
|
||||
G4cout << "hdid=" << G4std::setw(12) << hdid << " "
|
||||
<< "hnext=" << G4std::setw(12) << hnext << " " << endl;
|
||||
PrintStatus( ystart, x1, y, x, h, (nstp==nStpPr) ? -nstp: nstp);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -199,7 +211,7 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
WarnEndPointTooFar ( endPointDist, hdid, eps, dbg );
|
||||
G4cerr << " Total steps: bad" << noBadSteps << " good " << noGoodSteps << endl;
|
||||
// G4cerr << "Mid:EndPtFar> ";
|
||||
PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
|
||||
if(dbg>1) PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
|
||||
// Potentially add as arguments: <dydx> - as Initial Force
|
||||
#endif
|
||||
no_warnings++;
|
||||
@@ -221,7 +233,7 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
// Issue WARNING
|
||||
WarnSmallStepSize( hnext, hstep, h, x-x1, nstp );
|
||||
// G4cerr << "Mid:SmallStep> ";
|
||||
PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
|
||||
if(dbg>1) PrintStatus( ystart, x1, y, x, hstep, no_warnings?nstp:-nstp);
|
||||
no_warnings++;
|
||||
}
|
||||
#endif
|
||||
@@ -255,7 +267,7 @@ G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
|
||||
succeeded = false;
|
||||
#ifdef G4DEBUG_FIELD
|
||||
WarnTooManyStep( x1, x2, x ); // Issue WARNING
|
||||
PrintStatus( yEnd, x1, y, x, hstep, -nstp);
|
||||
if( dbg>1) PrintStatus( yEnd, x1, y, x, hstep, -nstp);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -596,7 +608,7 @@ void G4MagInt_Driver::PrintStatus( const G4double* StartArr,
|
||||
PrintStatus(StartFT, CurrentFT, requestStep, subStepNo );
|
||||
}
|
||||
|
||||
#include "g4std/iomanip"
|
||||
|
||||
|
||||
void G4MagInt_Driver::PrintStatus(
|
||||
const G4FieldTrack& StartFT,
|
||||
@@ -615,9 +627,12 @@ void G4MagInt_Driver::PrintStatus(
|
||||
const G4ThreeVector CurrentPosition= CurrentFT.GetPosition();
|
||||
const G4ThreeVector CurrentUnitVelocity= CurrentFT.GetMomentumDir();
|
||||
|
||||
G4double DotStartCurrentVeloc= StartUnitVelocity.dot(CurrentUnitVelocity);
|
||||
|
||||
G4double step_len= CurrentFT.GetCurveLength()
|
||||
- StartFT.GetCurveLength();
|
||||
|
||||
G4double subStepSize = step_len;
|
||||
|
||||
if( (subStepNo <= 0) && (verboseLevel <= 3) )
|
||||
{
|
||||
subStepNo = - subStepNo; // To allow printing banner
|
||||
@@ -630,22 +645,28 @@ void G4MagInt_Driver::PrintStatus(
|
||||
<< G4std::setw( 9) << "X(mm)" << " "
|
||||
<< G4std::setw( 9) << "Y(mm)" << " "
|
||||
<< G4std::setw( 9) << "Z(mm)" << " "
|
||||
<< G4std::setw( 7) << " N_x " << " "
|
||||
<< G4std::setw( 7) << " N_y " << " "
|
||||
<< G4std::setw( 7) << " N_z " << " "
|
||||
<< G4std::setw( 8) << " N_x " << " "
|
||||
<< G4std::setw( 8) << " N_y " << " "
|
||||
<< G4std::setw( 8) << " N_z " << " "
|
||||
<< G4std::setw( 7) << " N^2-1 " << " "
|
||||
<< G4std::setw(10) << " N(0).N " << " "
|
||||
<< G4std::setw( 7) << "KinEner " << " "
|
||||
<< G4std::setw( 9) << "StepLen" << " " // Add the Sub-step ??
|
||||
<< G4std::setw(12) << "Track-l" << " " // Add the Sub-step ??
|
||||
<< G4std::setw(12) << "Step-len" << " "
|
||||
<< G4std::setw(12) << "Step-len" << " "
|
||||
<< G4std::setw( 9) << "ReqStep" << " "
|
||||
<< G4endl;
|
||||
|
||||
PrintStat_Aux( StartFT, requestStep, 0., 0);
|
||||
PrintStat_Aux( StartFT, requestStep, 0.,
|
||||
0, 0.0, 1.0);
|
||||
//*************
|
||||
}
|
||||
|
||||
if( verboseLevel <= 3 )
|
||||
{
|
||||
G4cout.precision(noPrecision);
|
||||
PrintStat_Aux( CurrentFT, requestStep, step_len, subStepNo);
|
||||
PrintStat_Aux( CurrentFT, requestStep, step_len,
|
||||
subStepNo, subStepSize, DotStartCurrentVeloc );
|
||||
//*************
|
||||
}
|
||||
|
||||
@@ -669,7 +690,9 @@ void G4MagInt_Driver::PrintStat_Aux(
|
||||
const G4FieldTrack& aFieldTrack,
|
||||
G4double requestStep,
|
||||
G4double step_len,
|
||||
G4int subStepNo)
|
||||
G4int subStepNo,
|
||||
G4double subStepSize,
|
||||
G4double dotVeloc_StartCurr)
|
||||
{
|
||||
const G4ThreeVector Position= aFieldTrack.GetPosition();
|
||||
const G4ThreeVector UnitVelocity= aFieldTrack.GetMomentumDir();
|
||||
@@ -678,15 +701,37 @@ void G4MagInt_Driver::PrintStat_Aux(
|
||||
G4cout << G4std::setw( 5) << subStepNo << " ";
|
||||
else
|
||||
G4cout << G4std::setw( 5) << "Start" << " ";
|
||||
G4cout << G4std::setw( 7) << aFieldTrack.GetCurveLength();
|
||||
G4double curveLen= aFieldTrack.GetCurveLength();
|
||||
G4cout << G4std::setw( 7) << curveLen;
|
||||
G4cout << G4std::setw( 9) << Position.x() << " "
|
||||
<< G4std::setw( 9) << Position.y() << " "
|
||||
<< G4std::setw( 9) << Position.z() << " "
|
||||
<< G4std::setw( 7) << UnitVelocity.x() << " "
|
||||
<< G4std::setw( 7) << UnitVelocity.y() << " "
|
||||
<< G4std::setw( 7) << UnitVelocity.z() << " ";
|
||||
<< G4std::setw( 8) << UnitVelocity.x() << " "
|
||||
<< G4std::setw( 8) << UnitVelocity.y() << " "
|
||||
<< G4std::setw( 8) << UnitVelocity.z() << " ";
|
||||
G4int oldprec= G4cout.precision(3);
|
||||
G4cout << G4std::setw( 7) << UnitVelocity.mag2()-1.0 << " ";
|
||||
G4cout.precision(6);
|
||||
G4cout << G4std::setw(10) << dotVeloc_StartCurr << " ";
|
||||
G4cout.precision(oldprec);
|
||||
G4cout << G4std::setw( 7) << aFieldTrack.GetKineticEnergy();
|
||||
G4cout << G4std::setw( 9) << step_len << " ";
|
||||
G4cout << G4std::setw(12) << step_len << " ";
|
||||
|
||||
static G4double oldCurveLength= 0.0;
|
||||
static G4double oldSubStepLength= 0.0;
|
||||
static int oldSubStepNo= -1;
|
||||
|
||||
G4double subStep_len=0.0;
|
||||
if( curveLen > oldCurveLength )
|
||||
subStep_len= curveLen - oldCurveLength;
|
||||
else if (subStepNo == oldSubStepNo)
|
||||
subStep_len= oldSubStepLength;
|
||||
// else subStepLen_NotAvail;
|
||||
oldCurveLength= curveLen;
|
||||
oldSubStepLength= subStep_len;
|
||||
|
||||
G4cout << G4std::setw(12) << subStep_len << " ";
|
||||
G4cout << G4std::setw(12) << subStepSize << " ";
|
||||
if( requestStep != -1.0 )
|
||||
G4cout << G4std::setw( 9) << requestStep << " ";
|
||||
else
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MagIntegratorStepper.cc,v 1.6 2001/07/11 09:59:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// $Id: G4MagIntegratorStepper.cc,v 1.7 2002/05/07 16:11:59 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
#include "G4MagIntegratorStepper.hh"
|
||||
|
||||
@@ -40,7 +40,3 @@ G4MagIntegratorStepper::~G4MagIntegratorStepper()
|
||||
{
|
||||
}
|
||||
|
||||
void G4MagIntegratorStepper::RightHandSide( const double y[], double dydx[] )
|
||||
{
|
||||
fEquation_Rhs-> RightHandSide(y, dydx);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Mag_EqRhs.cc,v 1.7 2001/07/11 09:59:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// This is the standard right-hand side for equation of motion
|
||||
// in a pure Magnetic Field .
|
||||
|
||||
@@ -57,20 +57,19 @@ G4Mag_SpinEqRhs::EvaluateRhsGivenB( const G4double y[],
|
||||
const G4double B[3],
|
||||
G4double dydx[] ) const
|
||||
{
|
||||
G4double velocity_mag_square = sqr(y[3]) + sqr(y[4]) + sqr(y[5]);
|
||||
G4double inv_velocity_magnitude = 1.0 / sqrt( velocity_mag_square );
|
||||
G4double momentum_mag_square = sqr(y[3]) + sqr(y[4]) + sqr(y[5]);
|
||||
G4double inv_momentum_magnitude = 1.0 / sqrt( momentum_mag_square );
|
||||
G4double cof = FCof()*inv_momentum_magnitude;
|
||||
|
||||
dydx[0] = y[3] * inv_velocity_magnitude; // (d/ds)x = Vx/V
|
||||
dydx[1] = y[4] * inv_velocity_magnitude; // (d/ds)y = Vy/V
|
||||
dydx[2] = y[5] * inv_velocity_magnitude; // (d/ds)z = Vz/V
|
||||
dydx[3] = FCof()*(y[4]*B[2] - y[5]*B[1]) ; // Ax = a*(Vy*Bz - Vz*By)
|
||||
dydx[4] = FCof()*(y[5]*B[0] - y[3]*B[2]) ; // Ay = a*(Vz*Bx - Vx*Bz)
|
||||
dydx[5] = FCof()*(y[3]*B[1] - y[4]*B[0]) ; // Az = a*(Vx*By - Vy*Bx)
|
||||
dydx[0] = y[3] * inv_momentum_magnitude; // (d/ds)x = Vx/V
|
||||
dydx[1] = y[4] * inv_momentum_magnitude; // (d/ds)y = Vy/V
|
||||
dydx[2] = y[5] * inv_momentum_magnitude; // (d/ds)z = Vz/V
|
||||
dydx[3] = cof*(y[4]*B[2] - y[5]*B[1]) ; // Ax = a*(Vy*Bz - Vz*By)
|
||||
dydx[4] = cof*(y[5]*B[0] - y[3]*B[2]) ; // Ay = a*(Vz*Bx - Vx*Bz)
|
||||
dydx[5] = cof*(y[3]*B[1] - y[4]*B[0]) ; // Az = a*(Vx*By - Vy*Bx)
|
||||
|
||||
G4ThreeVector u;
|
||||
u.setX(inv_velocity_magnitude*y[3]);
|
||||
u.setY(inv_velocity_magnitude*y[4]);
|
||||
u.setZ(inv_velocity_magnitude*y[5]);
|
||||
G4ThreeVector u(y[3], y[4], y[5]);
|
||||
u *= inv_momentum_magnitude;
|
||||
|
||||
G4ThreeVector BField(B[0],B[1],B[2]);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user