Import Geant4 2.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:42:07 +02:00
parent 103bda00c8
commit e7d7193284
3106 changed files with 171117 additions and 90550 deletions
+5 -3
View File
@@ -1,12 +1,14 @@
# $Id: GNUmakefile,v 1.1 1999/01/07 16:06:59 gunter Exp $
# $Id: GNUmakefile,v 1.2 2000/04/07 13:07:00 gcosmo Exp $
# --------------------------------------------------------------
# GNUmakefile for geometry. Gabriele Cosmo, 16/11/96.
# --------------------------------------------------------------
name := G4geometry
SUBDIRS = management volumes solids/CSG solids/Boolean solids/BREPS solids/STEP solids/STEPinterface magneticfield
SUBLIBS = G4geometrymng G4volumes G4csg G4geomBoolean G4brep G4step G4stepinterface G4magneticfield
SUBDIRS = management volumes magneticfield
SUBDIRS += solids/CSG solids/specific solids/Boolean solids/BREPS solids/STEP solids/STEPinterface
SUBLIBS = G4geometrymng G4volumes G4magneticfield
SUBLIBS += G4csg G4specsolids G4geomBoolean G4brep G4step G4stepinterface
ifndef G4INSTALL
G4INSTALL = ../..
+74 -4
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.9 2000/02/29 15:16:40 gcosmo Exp $
$Id: History,v 1.14 2000/05/12 15:12:36 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,13 +17,83 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Feb 29, 2000 Gabriele Cosmo geometry-V01-00-00a
May 12, 2000 Gabriele Cosmo geometry-V01-01-03
-----------------------------
- magneticfield (field-V01-01-03):
o fixes to G4MagErrorStepper (check on chord endpoint),
G4RKG3_Stepper (deleted error message from StepNoErr),
G4MagIntegratorDriver (modified debug information).
o minor fix to dummy implementation of assignment operator
in G4MagneticField.hh.
o modified method for finding new trial step in G4ChordFinder.
- volumes (geomvol-V01-01-00):
o introduced kCarTolerance for check over taken step length and
TruePathLength in G4PropagatorInField::ComputeStep().
- solids/CSG (geom-solids-csg-V01-01-02):
o fixes in DistanceToIn(p,v) for G4Box and G4Trd to return 0 distance
in case computed value is less than 0.5*kCarTolerance.
Apr 27, 2000 Gabriele Cosmo geometry-V01-01-02
-----------------------------
- management, solids/Boolean, magneticfield, volumes:
o reorganised comments for the Software Reference Manual
- solids/specific:
o minor fixes and removed dependency over solids/CSG module.
- solids/test
o updated SBT test suite.
Apr 11, 2000 John Allison geometry-V01-01-01
---------------------------
- management:
o made virtual G4VisExtent G4VSolid::GetExtent() non-pure and
implemented a default in terms of CalculateExtent.
- solids:
o removed implementations of GetExtent in most sub-classes of G4VSolid.
o all implementations of DescribeYourselfTo (G4VGraphicsScene& scene) const
now correctly written: scene.AddThis(*this).
- solids/Boolean:
o CreatePolyhedron implemented for BooleanSolids.
o G4DisplacedSolid: reversed implementation of GetFrameRotation and
GetObjectRotation, removing inappropriate invertion.
o G4DisplacedSolid::GetConstituentMovedSolid() made const.
Apr 05, 2000 Gabriele Cosmo geometry-V01-01-00
----------------------------
- This tag includes the following sub-category tags since geometry-V01-00-00a
(all of them collected by geomsolids-V01-01-00):
o geom-solids-csg-V01-01-01
+ fixes to G4PolyhedraSide.cc, G4Tubs.cc (see related History file)
+ added diagnostics to G4Cons, G4Sphere and G4Torus in function
DistanceToOut()
+ general directory restructuring: moved non 'CSG' shapes to new directory
'specific'
o breps-V01-00-02
+ implemented decoupling from NIST STEP Reader
+ several fixes for porting and memory leaks (see related History file)
o STEP-V01-00-01
+ upgrade to NIST SCL 3.2
+ porting and ISO-ANSI C++ fixes
o stepinterface-V01-00-01
+ upgrade to support the new NIST STEP Reader
+ improved overall diagnostics
+ several fixes for memory leaks and check of NULL pointers (see History)
o geom-solids-specific-V01-01-00
+ new directory containing the implementation of specific solids,
several classes moved from solids/CSG
+ new specific solid G4EllipticalTube, implementing a tube with
elliptical cross section (geant3 solid 'ELTU')
- Generic tests "SBT" and "Fred" have been moved from solids/CSG/test to
solids/test (new directory).
- Organised class description comments for the Software Reference Manual in
CSG and specific headers. Added CVS headers to files in specific.
Feb 29, 2000 Gabriele Cosmo geometry-V01-00-00a
----------------------------
- Minor fixes to unit tests (CSG) to make them up-to-date with recent
development versions.
Jan 19, 2000 Gabriele Cosmo geometry-V01-00-00
Jan 19, 2000 Gabriele Cosmo geometry-V01-00-00
----------------------------
- Sycronized file versions with HEAD after ISO-C++ migration.
Collecting subtags: field-V01-00-00, geomsolids-V01-00-00,
geommng-V01-00-00 and geomvol-V01-00-00.
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: BuildBoxWorld.hh,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef BUILDBOXWORLD_HH
#define BUILDBOXWORLD_HH
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: BuildCalorimeter.hh,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef BUILDCALORIMETER_HH
#define BUILDCALORIMETER_HH
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: Shoot.hh,v 1.3 2000/02/29 09:45:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef SHOOT_HH
#define SHOOT_HH
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: calorimeter.cc,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// calorimeter
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4Box.cc,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Implementation for G4Box class
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4Box.hh,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4Box
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4Box_fastfabs.cc,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Implementation for G4Box class
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4RotationMatrix.hh,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Rotation Matrix class, converted from CLHEP:
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4RotationMatrix.icc,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// Inline functions for class G4RotationMatrix
// Converted from CLHEP:
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ThreeVector.hh,v 1.3 1999/12/15 17:17:14 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ThreeVector class, converted from CLHEP:
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ThreeVector.icc,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Inline functions for class G4ThreeVector
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: boxtoincpp.cc,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4ios.hh"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: geomdefs.hh,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// Constants, typedefs, enums for Geometry Section
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: globals.hh,v 1.3 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// Global Constants and typedefs
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: replicaCal.cc,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: shooter.cc,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// shooter - perform test shots through simple box world.
//
+50 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.16 2000/01/20 10:51:11 gcosmo Exp $
$Id: History,v 1.21 2000/05/12 13:57:53 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,55 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
May 11th, 2000 J. Apostolakis - field-V01-01-02
- G4ChordFinder[.hh.cc]
o Modified method for finding new trial step.
New method assumes a quadratic relationship between step-length and d_chord:
d_chord proportional to step-lenght ^ 2
o Added two small refinement in order to avoid unneccesary extra step due to
small numerical inaccuracies in estimation:
FindNextChord
to first step use (1-0.001) * last-step-estimate
New Step:
to subsequent step use trial_step = 0.98 * estimate
May 10th, 2000 G. Cosmo
- G4MagneticField.hh: minor fix to dummy implementation of assignment
operator.
May 9th, 2000 J. Apostolakis - field-V01-01-01
- G4MagErrorStepper:
Modified DistChord to check whether the chord endpoint are the same point.
- G4RKG3_Stepper:
Deleted error message from StepNoErr, as it is used in Stepper.
- G4MagIntegratorDriver:
Changed the condition for the debug output (~cosmetic)
April 27th, 2000 G. Cosmo
- Reorganised comments for the Software Reference Manual.
- Moved inlined definition to .icc files, where needed.
Created: G4ChordFinder.icc and G4FieldManager.icc.
April 13th, 2000 J. Apostolakis - field-V01-01-00
- Modified signature to function DumbStepper() in classes:
G4HelixExplicitEuler, G4HelixHeum, G4HelixImplicitEuler,
G4HelixSimpleRunge and G4MagHelicalStepper.
- Modified signature and implementation of function MagFieldEvaluate()
in G4MagHelicalStepper, to use Field (as ThreeVector) in place of dydx.
- Made Richardson extrapolation optional (it is unclear if
it offers benefit) in G4MagHelicalStepper.
- Updated unit test testPropagateMagField and reference output.
- G4LineSection: fixes to prevent divisions by 0. and sqrt(<0)
(V.Grichine).
January 19th, 2000 G. Cosmo - field-V01-00-00
Syncronized versioning of files with HEAD after ISO-C++ migration
@@ -5,46 +5,61 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4CashKarpRKF45.hh,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4CashKarpRKF45.hh,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// J.Apostolakis, V.Grichine 30.1.97
// class G4CashKarpRKF45
//
// Class description:
//
// The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
// order method (giving fifth-order accuracy) for the solution of an ODE.
// Two different fourth order estimates are calculated; their difference
// gives an error estimate. [ref. Numerical Recipes in C, 2nd Edition]
// It is used to integrate the equations of the motion of a particle
// in a magnetic field.
// History:
// - Created. J.Apostolakis, V.Grichine - 30.1.97
#ifndef G4CashKARP_RKF45
#define G4CashKARP_RKF45
#include "G4MagIntegratorStepper.hh"
class G4CashKarpRKF45: public G4MagIntegratorStepper
{
public:
public: // with description
G4CashKarpRKF45(G4Mag_EqRhs *EqRhs, G4int numberOfVariables = 6) ;
~G4CashKarpRKF45() ;
void Stepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[],
G4double yerr[] ) ;
void Stepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[],
G4double yerr[] ) ;
void StepWithEst(const G4double yIn[],
const G4double dydx[],
const G4double Step,
G4double yOut[],
G4double& alpha2,
G4double& beta2,
const G4double B1[],
G4double B2[] ) ;
void StepWithEst( const G4double yIn[],
const G4double dydx[],
const G4double Step,
G4double yOut[],
G4double& alpha2,
G4double& beta2,
const G4double B1[],
G4double B2[] ) ;
public: // without description
G4double DistChord() const = 0 ; // This is not IMPLEMENTED yet.
// It must be done before it can work.
G4int IntegratorOrder() { return 4 ; };
private:
G4int fNumberOfVariables ;
private:
G4int fNumberOfVariables ;
G4double *ak2, *ak3, *ak4, *ak5, *ak6, *ak7, *yTemp, *yIn; // scratch space
};
@@ -5,28 +5,25 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ChordFinder.hh,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ChordFinder.hh,v 1.4 2000/05/11 14:47:00 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ------------------------------------------------------------------------
// GEANT 4 include file implementation
// class G4ChordFinder
//
// For information related to this code contact:
// CERN, IT Division (formely CN), ASD group
// ------------------------------------------------------------------------
// Class description:
//
// A class that provides RK integration of motion ODE (as does g4magtr)
// and also has a method that returns an Approximate point on the curve
// near to a (chord) point.
//
// 25.02.97 John Apostolakis, design and implementation
// 05.03.97 V. Grichine , makeup to G4 'standard'
// A class that provides RK integration of motion ODE (as does g4magtr)
// and also has a method that returns an Approximate point on the curve
// near to a (chord) point.
// History:
// - 25.02.97 John Apostolakis, design and implementation
// - 05.03.97 V. Grichine , makeup to G4 'standard'
#ifndef G4CHORDFINDER_HH
#define G4CHORDFINDER_HH
// #include "globals.hh"
#include "G4MagIntegratorDriver.hh"
#include "G4FieldTrack.hh"
#include "G4MagneticField.hh"
@@ -35,25 +32,24 @@
class G4ChordFinder
{
public: // Constructors
public: // with description
G4ChordFinder( G4MagInt_Driver* pIntegrationDriver );
// A constructor that creates defaults for all "children" classes
//
G4ChordFinder( G4MagneticField* itsMagField,
G4double stepMinimum = 1.0e-2 * mm,
G4MagIntegratorStepper* pItsStepper = 0 );
// A constructor that creates defaults for all "children" classes.
~G4ChordFinder();
// Uses ODE solver's driver to find the endpoint that satisfies
// the chord criterion: that d_chord < delta_chord
// -> Returns Length of Step taken
G4double AdvanceChordLimited( G4FieldTrack& yCurrent,
const G4double stepInitial,
const G4double epsStep );
const G4double epsStep_Relative );
// Uses ODE solver's driver to find the endpoint that satisfies
// the chord criterion: that d_chord < delta_chord
// -> Returns Length of Step taken.
G4FieldTrack ApproxCurvePointV(const G4FieldTrack& curveAPointVelocity,
const G4FieldTrack& curveBPointVelocity,
@@ -63,28 +59,22 @@ class G4ChordFinder
G4double GetDeltaChord();
void SetDeltaChord( G4double newval);
// Routine to inform integration driver of charge, speed
//
void SetChargeMomentumMass( const G4double pCharge, // in e+ units
const G4double pMomentum,
const G4double pMass );
// Function to inform integration driver of charge, speed.
void SetIntegrationDriver(G4MagInt_Driver* IntegrationDriver);
G4MagInt_Driver* GetIntegrationDriver();
// Access and set Driver.
// Access and set Driver
//
void SetIntegrationDriver( G4MagInt_Driver* IntegrationDriver)
{ fIntgrDriver=IntegrationDriver;}
G4MagInt_Driver* GetIntegrationDriver()
{ return fIntgrDriver;}
protected: // .........................................................
G4bool AcceptableMissDist(G4double dChordStep)
{
return (dChordStep <= fDeltaChord) ;
}
G4bool AcceptableMissDist(G4double dChordStep);
G4double NewStep( const G4double stepTrialOld,
const G4double dChordStep ) ; // Current dchord
const G4double dChordStep, // Current dchord estimate
G4double& stepEstimate_Unconstrained ) ;
G4double FindNextChord( const G4FieldTrack yStart,
const G4double stepMax,
@@ -96,7 +86,9 @@ class G4ChordFinder
// G4int nOK, nBAD;
G4MagInt_Driver* fIntgrDriver;
G4double fDeltaChord;
G4double fDeltaChord; // Maximum miss distance
G4double fLastStepEstimate_Unconstrained; // State information for efficiency
static const G4double fDefaultDeltaChord; // SET in G4ChordFinder.cc = 3 mm
@@ -106,30 +98,8 @@ class G4ChordFinder
G4MagIntegratorStepper* fDriversStepper;
};
// Inline function implementation:
inline
G4ChordFinder:: G4ChordFinder( G4MagInt_Driver* pIntegrationDriver )
: fDeltaChord( fDefaultDeltaChord )
{
fIntgrDriver= pIntegrationDriver ;
fAllocatedStepper= false ;
}
inline void
G4ChordFinder::SetChargeMomentumMass( const G4double pCharge, // in e+ units
const G4double pMomentum,
const G4double pMass )
{
fIntgrDriver-> SetChargeMomentumMass(pCharge, pMomentum, pMass);
}
inline G4double G4ChordFinder::GetDeltaChord()
{ return fDeltaChord; }
inline void G4ChordFinder::SetDeltaChord( G4double newval)
{ fDeltaChord=newval; }
#include "G4ChordFinder.icc"
#endif // G4CHORDFINDER_HH
@@ -0,0 +1,59 @@
// 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: G4ChordFinder.icc,v 1.1 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// G4ChordFinder inline implementations
//
// --------------------------------------------------------------------
inline
G4ChordFinder::G4ChordFinder(G4MagInt_Driver* pIntegrationDriver)
: fDeltaChord( fDefaultDeltaChord )
{
fIntgrDriver= pIntegrationDriver;
fAllocatedStepper= false;
}
inline
void G4ChordFinder::SetIntegrationDriver(G4MagInt_Driver* IntegrationDriver)
{
fIntgrDriver=IntegrationDriver;
}
inline
G4MagInt_Driver* G4ChordFinder::GetIntegrationDriver()
{
return fIntgrDriver;
}
inline
G4bool G4ChordFinder::AcceptableMissDist(G4double dChordStep)
{
return (dChordStep <= fDeltaChord) ;
}
inline
void G4ChordFinder::SetChargeMomentumMass(const G4double pCharge, // in e+ units
const G4double pMomentum,
const G4double pMass)
{
fIntgrDriver-> SetChargeMomentumMass(pCharge, pMomentum, pMass);
}
inline
G4double G4ChordFinder::GetDeltaChord()
{
return fDeltaChord;
}
inline
void G4ChordFinder::SetDeltaChord(G4double newval)
{
fDeltaChord=newval;
}
@@ -5,50 +5,65 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ClassicalRK4.hh,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ClassicalRK4.hh,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// J.Apostolakis, V.Grichine 30.1.97
// changed: W.Wander <wwc@mit.edu> 12/09/97: Moved into MagErrorStepper
// class G4ClassicalRK4
//
// Class description:
//
// Integrate the equations of the motion of a particle in a magnetic field
// using the classical 4th Runge-Kutta method.
// History:
// - Created: J.Apostolakis, V.Grichine - 30.1.97
// - Moved into G4MagErrorStepper: W.Wander <wwc@mit.edu> - 12/09/97
#include "G4MagErrorStepper.hh"
#include "G4ThreeVector.hh"
class G4ClassicalRK4 : public G4MagErrorStepper
{
public:
public: // with description
G4ClassicalRK4(G4Mag_EqRhs *EqRhs, G4int numberOfVariables = 6) ;
~G4ClassicalRK4() ;
~G4ClassicalRK4() ;
// A stepper that does not know about errors.
// It is used by the MagErrorStepper stepper.
void StepWithEst( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[],
G4double& alpha2,
G4double& beta2,
const G4double B1[],
G4double B2[] ) ;
void DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[]) ;
// Given values for the variables y[0,..,n-1] and their derivatives
// dydx[0,...,n-1] known at x, use the classical 4th Runge-Kutta
// method to advance the solution over an interval h and return the
// incremented variables as yout[0,...,n-1], which not be a distinct
// array from y. The user supplies the routine RightHandSide(x,y,dydx),
// which returns derivatives dydx at x. The source is routine rk4 from
// NRC p. 712-713 .
G4int IntegratorOrder() { return 4; };
public: // without description
// A stepper that does not know about errors.
// It is used by the MagErrorStepper stepper.
void DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[]) ;
void StepWithEst( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[],
G4double& alpha2,
G4double& beta2,
const G4double B1[],
G4double B2[] );
// Could make above G4SixPoint to keep tangents too ...?
// Could make above G4SixPoint to keep tangents too ...?
private:
G4int IntegratorOrder() { return 4; };
G4int fNumberOfVariables ; // is set default to 6 in constructor
private:
G4double *dydxm, *dydxt, *yt; // scratch space - not state
G4int fNumberOfVariables ; // is set default to 6 in constructor
G4double *dydxm, *dydxt, *yt; // scratch space - not state
};
@@ -5,17 +5,20 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ElectroMagneticField.hh,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ElectroMagneticField.hh,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// A full Electromagnetic field, containing both electric and magnetic fields.
// class G4ElectroMagneticField
//
// It is an abstract class, and a derived type of this field must be
// created by the user to describe his/her field configuration.
// Class description:
//
// Created: JA, November 12th, 1998
//
// A full Electromagnetic field, containing both electric and magnetic fields.
// It is an abstract class, and a derived type of this field must be
// created by the user to describe his/her field configuration.
// History:
// - Created: J.Apostolakis, November 12th, 1998
#ifndef G4ELECTROMAGNETIC_FIELD_DEF
#define G4ELECTROMAGNETIC_FIELD_DEF
@@ -24,28 +27,25 @@
class G4ElectroMagneticField : public G4MagneticField
{
public:
public: // with description
G4ElectroMagneticField();
virtual ~G4ElectroMagneticField();
G4ElectroMagneticField() {;}
virtual ~G4ElectroMagneticField() {;}
// Copy constructor & assignment operator
G4ElectroMagneticField(const G4ElectroMagneticField &p);
G4ElectroMagneticField(const G4ElectroMagneticField &p) {;}
G4ElectroMagneticField& operator = (const G4ElectroMagneticField &p);
// Copy constructor & assignment operators.
virtual void GetFieldValue( const double Point[3],
double *Bfield ) const = 0;
};
// Implementation
inline G4ElectroMagneticField::G4ElectroMagneticField() {}
inline G4ElectroMagneticField::~G4ElectroMagneticField() {}
inline G4ElectroMagneticField::G4ElectroMagneticField(const G4ElectroMagneticField &p) {}
// Not needed: { *this = p; }
// Inline implementations
inline G4ElectroMagneticField&
G4ElectroMagneticField::operator = (const G4ElectroMagneticField &p)
{ *this = p; return *this; }
{
*this = p; return *this;
}
#endif /* G4ELECTROMAGNETIC_FIELD_DEF */
@@ -5,14 +5,20 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4EqMagElectricField.hh,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4EqMagElectricField.hh,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// This is the right-hand side of equation of motion in a combined
// electric and magnetic field.
////
// 10.11.98 V.Grichine
//
// class G4EqMagElectricField
//
// Class description:
//
// This is the right-hand side of equation of motion in a combined
// electric and magnetic field.
// History:
// - Created. V.Grichine, 10.11.98
#ifndef G4EQMAGELECTRICFIELD_hh
#define G4EQMAGELECTRICFIELD_hh
@@ -21,26 +27,26 @@
class G4EqMagElectricField : public G4Mag_EqRhs
{
public:
G4EqMagElectricField( G4ElectroMagneticField *emField ) :
G4Mag_EqRhs( emField ) {};
public: // with description
~G4EqMagElectricField() {} ;
G4EqMagElectricField(G4ElectroMagneticField *emField )
: G4Mag_EqRhs( emField ) {;}
// Given the value of the electromagnetic field, this function
// calculates the value of the derivative dydx.
~G4EqMagElectricField() {;}
void SetChargeMomentumMass( const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double mass);
void SetChargeMomentumMass( const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double mass);
void EvaluateRhsGivenB( const G4double y[],
const G4double Field[],
G4double dydx[] ) const;
// Given the value of the electromagnetic field, this function
// calculates the value of the derivative dydx.
private:
private:
G4double fElectroMagCof ;
G4double fElectroMagCof;
};
#endif
@@ -5,73 +5,71 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4EquationOfMotion.hh,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4EquationOfMotion.hh,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// Abstract Base Class for:
//
// The right hand size of the equation of motion of a particle in a field.
// class G4EquationOfMotion
//
// Class description:
//
// Abstract Base Class for the right hand size of the equation of
// motion of a particle in a field.
// History:
// - Created. J.Apostolakis
#ifndef G4_EquationOfMotion_DEF
#define G4_EquationOfMotion_DEF
#include "globals.hh"
#include "G4Field.hh" // class G4Field; // should be enough
#include "globals.hh"
#include "G4Field.hh"
class G4EquationOfMotion
{
public:
public: // with description
G4EquationOfMotion( G4Field *Field );
virtual ~G4EquationOfMotion();
// Constructor and virtual destructor. No operations.
// Given the value of the field "B", this function
// calculates the value of the derivative dydx.
// --------------------------------------------------------
// This is the _only_ function a subclass must define.
// The other two functions use Rhs_givenB.
//
virtual void EvaluateRhsGivenB( const G4double y[],
const G4double B[3],
const G4double B[3],
G4double dydx[] ) const = 0;
// Given the value of the field "B", this function
// calculates the value of the derivative dydx.
// --------------------------------------------------------
// This is the _only_ function a subclass must define.
// The other two functions use Rhs_givenB.
// Set the charge, momentum and mass of the current particle
// --> used to set the equation's coefficients ...
virtual void SetChargeMomentumMass(
virtual void SetChargeMomentumMass(
const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double MassXc2) = 0;
// Set the charge, momentum and mass of the current particle
// --> used to set the equation's coefficients ...
// This calculates the value of the derivative dydx at y.
// It is the usual enquiry function.
// ---------------------------
// (It is not virtual, but calls the virtual function above.)
//
void RightHandSide( const G4double y[],
G4double dydx[] ) const;
G4double dydx[] ) const;
// This calculates the value of the derivative dydx at y.
// It is the usual enquiry function.
// ---------------------------
// (It is not virtual, but calls the virtual function above.)
// Same as RHS above, but also returns the value of B.
//
// Should be made the new default ? after putting dydx & B in a class
//
void EvaluateRhsReturnB( const G4double y[],
G4double dydx[],
G4double Field[] ) const;
// Same as RHS above, but also returns the value of B.
// Should be made the new default ? after putting dydx & B in a class.
// Obtain only the field - the stepper assumes it is pure Magnetic
// Not protected, because G4RKG3_Stepper uses it directly
void GetFieldValue( const G4double Point[3],
G4double Field[] ) const
{ itsField-> GetFieldValue( Point, Field ); }
G4double Field[] ) const;
// Obtain only the field - the stepper assumes it is pure Magnetic.
// Not protected, because G4RKG3_Stepper uses it directly.
G4Field* GetFieldObj();
void SetFieldObj(G4Field* pField);
//------------------------------------------------------------------------
//public:
// virtual void doNothing(); // To help compiler with their virtual tables.
private:
G4Field *itsField;
@@ -5,24 +5,37 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4EquationOfMotion.icc,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4EquationOfMotion.icc,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Inline implementation
//
inline G4Field* G4EquationOfMotion::GetFieldObj()
{
return itsField;
}
inline void G4EquationOfMotion::SetFieldObj(G4Field* pField)
{
itsField= pField;
}
inline G4EquationOfMotion::G4EquationOfMotion(G4Field* pField)
inline
G4EquationOfMotion::G4EquationOfMotion(G4Field* pField)
:itsField(pField)
{}
inline G4EquationOfMotion::~G4EquationOfMotion() {}
inline
G4EquationOfMotion::~G4EquationOfMotion()
{}
inline
G4Field* G4EquationOfMotion::GetFieldObj()
{
return itsField;
}
inline
void G4EquationOfMotion::SetFieldObj(G4Field* pField)
{
itsField= pField;
}
inline
void G4EquationOfMotion::GetFieldValue( const G4double Point[3],
G4double Field[] ) const
{
itsField-> GetFieldValue( Point, Field );
}
@@ -5,20 +5,31 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ExplicitEuler.hh,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ExplicitEuler.hh,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// W. Wander <wwc@mit.edu> 12/09/97
// class G4ExplicitEuler
//
// Class description:
//
// Explicit Euler: x_1 = x_0 + h * dx_0.
// The most simple approach for solving linear differential equations.
// Take the current derivative and add it to the current position.
// History:
// - Created. W.Wander <wwc@mit.edu>, 12/09/97
#ifndef G4EXPLICITEULER_HH
#define G4EXPLICITEULER_HH
#include "G4MagErrorStepper.hh"
class G4ExplicitEuler: public G4MagErrorStepper
class G4ExplicitEuler : public G4MagErrorStepper
{
public:
public: // with description
G4ExplicitEuler(G4Mag_EqRhs *EqRhs, G4int numberOfVariables = 6) ;
~G4ExplicitEuler();
@@ -27,9 +38,11 @@ class G4ExplicitEuler: public G4MagErrorStepper
const G4double h,
G4double yout[]);
public: // without description
G4int IntegratorOrder() { return 1; };
private:
private:
G4int fNumberOfVariables ;
};
@@ -5,32 +5,36 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Field.hh,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4Field.hh,v 1.3 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// G4Field:
// abstract class for any kind of Field,
// It allows any kind of field (vector, scalar, tensor and any set of them)
// to be defiend by implementing the inquiry function interface.
// class G4Field
//
// Created: John Apostolakis, 10.03.1997
// Modified:
// Class description:
//
// Abstract class for any kind of Field.
// It allows any kind of field (vector, scalar, tensor and any set of them)
// to be defined by implementing the inquiry function interface.
// History:
// - Created: John Apostolakis, 10.03.1997
#ifndef G4FIELD_HH
#define G4FIELD_HH
class G4Field
{
public:
public: // with description
virtual void GetFieldValue( const double Point[3],
double *Bfield ) const = 0;
G4Field(){};
virtual ~G4Field(){};
// A field signature function that can be used to insure
// A field signature function that can be used to insure
// that the Equation of motion object and the G4Field object
// have the same "field signature"?
// have the same "field signature"?
};
@@ -5,37 +5,40 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FieldManager.hh,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4FieldManager.hh,v 1.3 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//
// The G4FieldManager class exists to allow the user program to specify
// the electric, magnetic and/or other field(s) of the detector.
// (OR, in the future, of a part of it - planned to be a logical volume).
// It also stores a pointer to the ChordFinder object that can do the
// propagation in this field. All geometrical track "advancement"
// in the field is handled by this ChordFinder object.
// class G4FieldManager
//
// G4FieldManager allows the other classes/object (of the MagneticField
// & other class categories) to find out whether a detector field object
// exists and what that object is.
// Class description:
//
// The Chord Finder must be created either by calling
// CreateChordFinder for a Magnetic Field or by the user creating a
// a Chord Finder object "manually" and setting this pointer.
// A class to manage (Store) a pointer to the Field subclass that
// describes the field of a detector (magnetic, electric or other).
// Also stores a reference to the chord finder.
//
// A default FieldManager is created by the singleton
// class G4NavigatorForTracking and exists before main is called.
// However a new one can be created and given to G4NavigatorForTracking.
// The G4FieldManager class exists to allow the user program to specify
// the electric, magnetic and/or other field(s) of the detector.
// (OR, in the future, of a part of it - planned to be a logical volume).
// It also stores a pointer to the ChordFinder object that can do the
// propagation in this field. All geometrical track "advancement"
// in the field is handled by this ChordFinder object.
//
// Synopsis:
// A class to manage (Store) a pointer to the Field subclass that
// describes the field of a detector (magnetic, electric or other).
// Also stores a reference to the chord finder.
// G4FieldManager allows the other classes/object (of the MagneticField
// & other class categories) to find out whether a detector field object
// exists and what that object is.
//
// 10.03.97 John Apostolakis, design and implementation
// The Chord Finder must be created either by calling CreateChordFinder
// for a Magnetic Field or by the user creating a a Chord Finder object
// "manually" and setting this pointer.
//
// A default FieldManager is created by the singleton class
// G4NavigatorForTracking and exists before main is called.
// However a new one can be created and given to G4NavigatorForTracking.
// History:
// - 10.03.97 John Apostolakis, design and implementation.
#ifndef G4FIELDMANAGER_HH
#define G4FIELDMANAGER_HH 1
@@ -45,7 +48,8 @@
class G4FieldManager
{
public:
public: // with description
G4FieldManager();
G4FieldManager(G4MagneticField *detectorField);
~G4FieldManager();
@@ -59,6 +63,7 @@ class G4FieldManager
G4ChordFinder* GetChordFinder();
private:
G4Field* fDetectorField;
G4ChordFinder* fChordFinder;
@@ -66,43 +71,17 @@ class G4FieldManager
// create fChordFinder ?
};
// Our current design envisions that one Field manager is
// valid for a detector.
// (eg a detector with electric E and magnetic B field will now treat
// them as one field - and could treat any other field of importance
// as additional components of a single field.)
// Does it make sense to have several instead ?
// Is the lack of elegance of the design (of G4Field) made up
// for by the simplification it allows ?
// Our current design envisions that one Field manager is
// valid for a detector.
// (eg a detector with electric E and magnetic B field will now treat
// them as one field - and could treat any other field of importance
// as additional components of a single field.)
// Does it make sense to have several instead ?
// Is the lack of elegance of the design (of G4Field) made up
// for by the simplification it allows ?
// Implementation of inline functions
inline G4bool G4FieldManager::SetDetectorField(G4Field *detectorField)
{
fDetectorField= detectorField;
return 0;
}
inline G4Field* G4FieldManager::GetDetectorField()
{
// If pointer is null, should this raise an exception ??
return fDetectorField;
}
inline G4bool G4FieldManager::DoesFieldExist(){
return (fDetectorField != 0);
}
inline
void G4FieldManager::SetChordFinder(G4ChordFinder *aChordFinder)
{
fChordFinder= aChordFinder;
}
inline
G4ChordFinder* G4FieldManager::GetChordFinder()
{
return fChordFinder;
}
#include "G4FieldManager.icc"
#endif /* G4FIELDMANAGER_HH */
@@ -0,0 +1,45 @@
// 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: G4FieldManager.icc,v 1.1 2000/04/27 16:27:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// G4FieldManager inline implementation
//
inline
G4bool G4FieldManager::SetDetectorField(G4Field *detectorField)
{
fDetectorField= detectorField;
return 0;
}
inline
G4Field* G4FieldManager::GetDetectorField()
{
// If pointer is null, should this raise an exception ??
return fDetectorField;
}
inline
G4bool G4FieldManager::DoesFieldExist()
{
return (fDetectorField != 0);
}
inline
void G4FieldManager::SetChordFinder(G4ChordFinder *aChordFinder)
{
fChordFinder= aChordFinder;
}
inline
G4ChordFinder* G4FieldManager::GetChordFinder()
{
return fChordFinder;
}
@@ -5,30 +5,34 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FieldTrack.hh,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4FieldTrack.hh,v 1.3 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Data structure bringing together a magnetic track's state.
// (position, momentum direction & modulus, energy, spin, ... )
// Uses/abilities:
// - does not maintain any relationship between its data (eg energy/momentum)
// - for use in Runge-Kutta solver (in passing it the values right now).
//
// First version: Oct 14, 1996 John Apostolakis
// Modified: Oct 24, 1996 JA: Added dist_on_curve, deleted constructor
// Nov 5, 1998 JA: Added energy, momentum, TOF, spin
// & several constructor, access, set methods
//
//
// class G4FieldTrack
//
// Class description:
//
// Data structure bringing together a magnetic track's state.
// (position, momentum direction & modulus, energy, spin, ... )
// Uses/abilities:
// - does not maintain any relationship between its data (eg energy/momentum).
// - for use in Runge-Kutta solver (in passing it the values right now).
// History
// - First version: Oct 14, 1996 John Apostolakis
// - Modified: Oct 24, 1996 JA: Added dist_on_curve, deleted constructor
// Nov 5, 1998 JA: Added energy, momentum, TOF, spin &
// several constructor, access, set methods
#ifndef G4FieldTrack_HH
#define G4FieldTrack_HH
#include "G4ThreeVector.hh"
class G4FieldTrack{
public:
// Constructors
class G4FieldTrack
{
public: // with description
G4FieldTrack( const G4ThreeVector& pPosition,
const G4ThreeVector& pVelocity, // Or UnitVelocity
@@ -40,57 +44,69 @@ class G4FieldTrack{
G4FieldTrack( const G4FieldTrack& pFieldTrack );
// Destructor
~G4FieldTrack();
// Destructor
// Equality operator
G4FieldTrack& operator = ( const G4FieldTrack & rStVec );
// Equality operator
// Old multi-set method
inline G4FieldTrack& SetCurvePnt(
const G4ThreeVector& pPosition,
const G4ThreeVector& pVelocity,
const G4double s_curve );
// Access Methods: ("Const")
G4ThreeVector Position() const; // Renamed to GetPosition
G4ThreeVector GetVelocity() const;
G4double CurveS() const; // distance along curve of point
// Old methods above to be deleted.
G4ThreeVector GetPosition() const;
const G4ThreeVector& GetMomentumDir() const;
G4double GetCurveLength() const; // distance along curve of point
// G4double GetEnergy() const; // Wrong Energy --> FIXME
G4double GetCurveLength() const;
// Distance along curve of point.
G4double GetMomentumModulus() const;
G4ThreeVector GetSpin() const;
G4double GetLabTimeOfFlight() const;
G4double GetProperTimeOfFlight() const;
// Accessors.
// Modifiers
void SetPosition(G4ThreeVector nPos);
void SetVelocity(G4ThreeVector nMomDir); // does change mom-dir too
void SetMomentumDir(G4ThreeVector nMomDir); // does NOT change velocity
void SetCurveLength(G4double nCurve_s); // distance along curve
void SetEnergy(G4double nEnergy); // does not modify momentum
void SetMomentumModulus(G4double nMomentumMod); // does not modify energy
void SetVelocity(G4ThreeVector nMomDir);
// Does change mom-dir too.
void SetMomentumDir(G4ThreeVector nMomDir);
// Does NOT change velocity.
void SetCurveLength(G4double nCurve_s);
// Distance along curve.
void SetEnergy(G4double nEnergy);
// Does not modify momentum.
void SetMomentumModulus(G4double nMomentumMod);
// Does not modify energy.
void SetSpin(G4ThreeVector nSpin);
void SetLabTimeOfFlight(G4double nTOF);
void SetProperTimeOfFlight(G4double nTOF);
// older one:
// Modifiers
public: // without description
G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition,
const G4ThreeVector& pVelocity,
const G4double s_curve );
// Old multi-set method
G4ThreeVector Position() const;
// Renamed to GetPosition
G4double CurveS() const; // distance along curve of point
void SetCurveS(G4double new_curve_s);
// Old methods to be deleted.
// G4double GetEnergy() const; // Wrong Energy --> FIXME
// G4double* PosVelVec(); // [6] Needed for RK integrator
// This old method completely broke encapsulation ?
// This old method completely broke encapsulation ?
// Needed and should be used only for RK integration driver
// static const G4int ncompSVEC=15;
// Needed and should be used only for RK integration driver
enum { ncompSVEC = 16 };
void DumpToArray( G4double valArr[ncompSVEC] ) const;
void LoadFromArray( const G4double valArr[ncompSVEC] );
friend G4std::ostream& operator<<( G4std::ostream& os, G4FieldTrack& SixVec);
friend G4std::ostream&
operator<<( G4std::ostream& os, G4FieldTrack& SixVec);
private:
G4double SixVector[6];
G4double fDistanceAlongCurve; // distance along curve of point
G4double fEnergy;
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4FieldTrack.icc,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "PhysicalConstants.h"
@@ -5,33 +5,49 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixExplicitEuler.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4HelixExplicitEuler.hh,v 1.4 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// W. Wander <wwc@mit.edu> 12/09/97
// class G4HelixExplicitEuler
//
// Class description:
//
// Helix Explicit Euler: x_1 = x_0 + helix(h)
// with helix(h) being a helix piece of length h.
// A simple approach for solving linear differential equations.
// Take the current derivative and add it to the current position.
// History:
// - Created. W.Wander <wwc@mit.edu>, 12/09/97
#ifndef G4HELIXEXPLICITEULER_HH
#define G4HELIXEXPLICITEULER_HH
#include "G4MagHelicalStepper.hh"
class G4HelixExplicitEuler: public G4MagHelicalStepper
class G4HelixExplicitEuler : public G4MagHelicalStepper
{
public:
G4HelixExplicitEuler(G4Mag_EqRhs *EqRhs): G4MagHelicalStepper(EqRhs){};
~G4HelixExplicitEuler(){};
void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[]);
public:
// DELETED RightHandSide( ) !!!!
// Replace by MagFieldEvaluate( const G4double y[], G4double B[] )
// in G4HelicalStepper
G4HelixExplicitEuler(G4Mag_EqRhs *EqRhs)
: G4MagHelicalStepper(EqRhs) {;}
~G4HelixExplicitEuler() {;}
G4int IntegratorOrder() { return 1; };
void DumbStepper( const G4double y[],
G4ThreeVector Bfld,
G4double h,
G4double yout[]);
public: // without description
// DELETED RightHandSide( ) !!!!
// Replaced by MagFieldEvaluate( const G4double y[], G4double B[] )
// in G4HelicalStepper
G4int IntegratorOrder() { return 1; }
};
#endif /* G4EXPLICITEULER_HH */
@@ -5,29 +5,45 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixHeum.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4HelixHeum.hh,v 1.4 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// W. Wander <wwc@mit.edu> 03/11/98
// class G4HelixHeum
//
// Class description:
//
// Simple Heum:
// x_1 = x_0 +
// h * 1/4 * dx(t0,x0) +
// 3/4 * dx(t0+2/3*h, x0+2/3*h*(dx(t0+h/3,x0+h/3*dx(t0,x0))))
// History:
// - Created. W.Wander <wwc@mit.edu>, 03/11/98
#ifndef G4HELIXHEUM_HH
#define G4HELIXHEUM_HH
#include "G4MagHelicalStepper.hh"
class G4HelixHeum: public G4MagHelicalStepper
class G4HelixHeum : public G4MagHelicalStepper
{
public:
G4HelixHeum(G4Mag_EqRhs *EqRhs): G4MagHelicalStepper(EqRhs){};
~G4HelixHeum(){};
public: // with description
G4HelixHeum(G4Mag_EqRhs *EqRhs)
: G4MagHelicalStepper(EqRhs) {;}
~G4HelixHeum() {;}
void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[]);
void DumbStepper( const G4double y[],
G4ThreeVector Bfld,
G4double h,
G4double yout[]);
public: // without description
G4int IntegratorOrder() { return 2; };
G4int IntegratorOrder() { return 2; }
};
#endif /* G4HELIXHEUM_HH */
@@ -5,29 +5,44 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixImplicitEuler.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4HelixImplicitEuler.hh,v 1.4 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// W. Wander <wwc@mit.edu> 03/11/98
// class G4HelixImplicitEuler
//
// Class description:
//
// Helix Implicit Euler:
// x_1 = x_0 + 1/2 * ( helix(h,t_0,x_0)
// + helix(h,t_0+h,x_0+helix(h,t0,x0) ) )
// History:
// - Created. W.Wander <wwc@mit.edu>, 03/11/98
#ifndef G4HELIXIMPLICITEULER_HH
#define G4HELIXIMPLICITEULER_HH
#include "G4MagHelicalStepper.hh"
class G4HelixImplicitEuler: public G4MagHelicalStepper
class G4HelixImplicitEuler : public G4MagHelicalStepper
{
public:
G4HelixImplicitEuler(G4Mag_EqRhs *EqRhs): G4MagHelicalStepper(EqRhs){};
~G4HelixImplicitEuler(){};
public: // with description
G4HelixImplicitEuler(G4Mag_EqRhs *EqRhs)
: G4MagHelicalStepper(EqRhs) {;}
~G4HelixImplicitEuler() {;}
void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[]);
void DumbStepper( const G4double y[],
G4ThreeVector Bfld,
G4double h,
G4double yout[]);
G4int IntegratorOrder() { return 2; };
public: // without description
G4int IntegratorOrder() { return 2; }
};
#endif /* G4HELIXIMPLICITEULER_HH */
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixSimpleRunge.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4HelixSimpleRunge.hh,v 1.3 2000/04/12 18:28:51 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// W. Wander <wwc@mit.edu> 03/12/98
@@ -23,9 +23,9 @@ class G4HelixSimpleRunge: public G4MagHelicalStepper
~G4HelixSimpleRunge(){};
void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[]);
G4ThreeVector Bfld,
G4double h,
G4double yout[]);
G4int IntegratorOrder() { return 2; };
};
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ImplicitEuler.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// W. Wander <wwc@mit.edu> 12/09/97
@@ -5,35 +5,50 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LineSection.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4LineSection.hh,v 1.4 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// A utility class that calculates the distance of a point from a
// line section.
// class G4LineSection
//
//
// Class description:
//
// A utility class that calculates the distance of a point from a
// line section.
// History:
// - Created. J. Apostolakis.
// - Cosmetics against /0. and sqrt(<0.). V. Grichine, 25.02.00.
#ifndef G4LineSection_hh
#define G4LineSection_hh
#include "globals.hh"
#include "G4ThreeVector.hh"
typedef G4ThreeVector POINT;
typedef POINT Vector;
class G4LineSection
{
public: // with description
G4LineSection( const G4ThreeVector& PntA, const G4ThreeVector& PntB );
class G4LineSection {
public:
G4LineSection( const POINT& PntA, const POINT& PntB );
G4double Dist( G4ThreeVector OtherPnt ) const;
G4double InvsqDistAB() const;
G4double Dist( POINT OtherPnt ) const;
G4double InvsqDistAB() const { return inverse_square_distAB; }
//
static G4double Distline( const POINT& OtherPnt,
const POINT& LinePntA,
const POINT& LinePntB );
static G4double Distline( const G4ThreeVector& OtherPnt,
const G4ThreeVector& LinePntA,
const G4ThreeVector& LinePntB );
private:
POINT EndpointA;
Vector VecAtoB;
G4ThreeVector EndpointA;
G4ThreeVector VecAtoB;
G4double inverse_square_distAB;
};
inline
G4double G4LineSection::InvsqDistAB() const
{
return inverse_square_distAB;
}
#endif
@@ -5,23 +5,25 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagErrorStepper.hh,v 1.5 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MagErrorStepper.hh,v 1.6 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// Abstract base class (ie Interface)
// -------------------
// for integrator of particle's equation of motion,
// used in tracking in space dependent magnetic field
// -----------------------------------------------------
//
// class G4MagErrorStepper
//
// Class description:
//
// Abstract base class for integrator of particle's equation of motion,
// used in tracking in space dependent magnetic field.
// History:
// 09.12.97 W.Wander <wwc@mit.edu> Created G4MagErrorStepper
// 09.03.98 W.Wander <wwc@mit.edu> Added AdvanceHelix functionality
// 09.11.98 J.Apostolakis Moved AdvanceHelix to G4MagHelicalStepper
// $ Id: $
#ifndef G4MAGERRORSTEPPER_HH
#define G4MAGERRORSTEPPER_HH
#include "globals.hh"
#include "G4MagIntegratorStepper.hh"
#include "G4Mag_EqRhs.hh"
@@ -29,43 +31,42 @@
class G4MagErrorStepper : public G4MagIntegratorStepper
{
public:
public: // with description
G4MagErrorStepper(G4Mag_EqRhs *EqRhs,G4int numberOfVariables);
~G4MagErrorStepper();
G4MagErrorStepper(G4Mag_EqRhs *EqRhs,G4int numberOfVariables);
~G4MagErrorStepper();
// The stepper for the Runge Kutta integration. The stepsize
// is fixed, with the Step size given by h.
// Integrates ODE starting values y[0 to 6 ]
// Outputs yout[] and its estimated error yerr[].
void Stepper( const G4double y[],
void Stepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[],
G4double yerr[] );
// The stepper for the Runge Kutta integration. The stepsize
// is fixed, with the Step size given by h.
// Integrates ODE starting values y[0 to 6].
// Outputs yout[] and its estimated error yerr[].
// performs a 'dump' Step without error calculation.
virtual void DumbStepper( const G4double y[],
virtual void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[] ) = 0;
G4double DistChord() const;
// Performs a 'dump' Step without error calculation.
private:
// Data stored in order to find the chord
G4ThreeVector fInitialPoint, fMidPoint, fFinalPoint;
// G4int theNumberOfVariables ;
G4double DistChord() const;
// The following arrays are used only for temporary storage
// they are allocated at the class level only for efficiency -
// so that calls to new and delete are not made in Stepper()
G4double *yInitial, *yMiddle, *dydxMid, *yOneStep;
private:
G4ThreeVector fInitialPoint, fMidPoint, fFinalPoint;
// Data stored in order to find the chord
// G4int theNumberOfVariables ;
G4double *yInitial, *yMiddle, *dydxMid, *yOneStep;
// The following arrays are used only for temporary storage
// they are allocated at the class level only for efficiency -
// so that calls to new and delete are not made in Stepper().
};
#include "G4MagErrorStepper.icc"
#endif /* G4MAGERRORSTEPPER_HH */
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4MagErrorStepper.icc,v 1.6 2000/03/03 12:09:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
inline G4MagErrorStepper::G4MagErrorStepper(G4Mag_EqRhs *EqRhs,
@@ -5,21 +5,23 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagHelicalStepper.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// Started from G4MagErrorStepper.hh
// $Id: G4MagHelicalStepper.hh,v 1.4 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// Abstract base class (ie Interface)
// -------------------
// for integrator of particle's equation of motion,
// used in tracking in space dependent magnetic field
// -----------------------------------------------------
//
// class G4MagHelicalStepper
//
// Class description:
//
// Abstract base class for integrator of particle's equation of motion,
// used in tracking in space dependent magnetic field
// History:
// 05.11.98 J.Apostolakis Creation of new ABC
//
// - 05.11.98 J.Apostolakis Creation of new ABC
#ifndef G4MagHelicalStepper_hh
#define G4MagHelicalStepper_hh
#include "globals.hh"
#include "G4MagIntegratorStepper.hh"
#include "G4Mag_EqRhs.hh"
@@ -27,60 +29,59 @@
class G4MagHelicalStepper : public G4MagIntegratorStepper
{
public:
public: // with description
G4MagHelicalStepper(G4Mag_EqRhs *EqRhs);
~G4MagHelicalStepper(){} ;
// The stepper for the Runge Kutta integration. The stepsize
// is fixed, equal to h.
// Integrates ODE starting values y[0 to 6 ]
// Outputs yout[] and its estimated error yerr[].
G4MagHelicalStepper(G4Mag_EqRhs *EqRhs);
~G4MagHelicalStepper() {;}
void Stepper( const G4double y[],
void Stepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[],
G4double yerr[] );
// performs a 'dump' Step without error calculation.
// The stepper for the Runge Kutta integration.
// The stepsize is fixed, equal to h.
// Integrates ODE starting values y[0 to 6]
// Outputs yout[] and its estimated error yerr[].
virtual void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
virtual void DumbStepper( const G4double y[],
G4ThreeVector Bfld,
G4double h,
G4double yout[] ) = 0;
// Estimate maximum distance of curved solution and chord ...
// Performs a 'dump' Step without error calculation.
G4double DistChord() const;
G4double DistChord() const;
// Estimate maximum distance of curved solution and chord ...
// --- Methods used to implement all the derived classes -----
protected:
protected: // with description
// a linear Step in regions without magnetic field
// --- Methods used to implement all the derived classes -----
inline void LinearStep( const G4double yIn[],
const G4double h,
G4double yHelix[]);
void LinearStep( const G4double yIn[],
const G4double h,
G4double yHelix[]);
// A linear Step in regions without magnetic field.
void AdvanceHelix( const G4double yIn[],
G4ThreeVector Bfld,
G4double h,
G4double yHelix[]); // output
// A first order Step along a helix inside the field.
void MagFieldEvaluate( const G4double y[], G4ThreeVector& Bfield );
// Evaluate the field at a certain point.
protected: // without description
// void MagFieldEvaluate( const G4double y[], G4double B[] )
// { GetEquationOfMotion()-> GetFieldValue(y, B); }
private:
// a first order Step along a helix inside the field
G4ThreeVector yInitial, yMidPoint, yFinal;
// Data stored in order to find the chord.
void AdvanceHelix( const G4double yIn[],
const G4double B[],
const G4double h,
G4double yHelix[]);
// evaluate the field at a certain point
void MagFieldEvaluate( const G4double y[], G4double B[] )
{ GetEquationOfMotion()-> GetFieldValue(y, B); }
private:
// Data stored in order to find the chord
G4ThreeVector yInitial, yMidPoint, yFinal;
G4Mag_EqRhs* fPtrMagEqOfMot;
G4Mag_EqRhs* fPtrMagEqOfMot;
};
#include "G4MagHelicalStepper.icc"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagHelicalStepper.icc,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MagHelicalStepper.icc,v 1.3 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// linear Step in regions of no field
@@ -22,4 +22,11 @@ G4MagHelicalStepper::LinearStep( const G4double yIn[],
}
}
inline void
G4MagHelicalStepper::MagFieldEvaluate(const G4double y[],
G4ThreeVector& Bfield )
{
G4double B[3];
GetEquationOfMotion()-> GetFieldValue(y, B);
Bfield= G4ThreeVector( B[0], B[1], B[2] );
}
@@ -5,11 +5,19 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagIntegratorDriver.hh,v 1.5 1999/12/15 18:15:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MagIntegratorDriver.hh,v 1.6 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// Provides Driver that talks to Integrator Stepper, and insures that
// the error is within acceptable bounds.
//
// class G4MagInt_Driver
//
// Class description:
//
// Provides a driver that talks to the Integrator Stepper, and insures that
// the error is within acceptable bounds.
// History:
// - Created. J.Apostolakis.
#ifndef G4MagInt_Driver_Def
#define G4MagInt_Driver_Def
@@ -20,87 +28,66 @@
class G4MagInt_Driver
{
public:
G4bool AccurateAdvance( G4FieldTrack& y_current,
const G4double hstep,
const G4double eps); // Requested y_err/hstep
public: // with description
//
// Above drivers for integrator (Runge-Kutta) with stepsize control.
// Integrates ODE starting values y_current
// from current s (s=s0) to s=s0+h with accuracy eps.
// On output ystart is replaced by value at end of interval.
// The concept is similar to the odeint routine from NRC p.721-722 .
G4bool AccurateAdvance(G4FieldTrack& y_current,
const G4double hstep,
const G4double eps); // Requested y_err/hstep
// Above drivers for integrator (Runge-Kutta) with stepsize control.
// Integrates ODE starting values y_current
// from current s (s=s0) to s=s0+h with accuracy eps.
// On output ystart is replaced by value at end of interval.
// The concept is similar to the odeint routine from NRC p.721-722.
// QuickAdvance just tries one Step - it does not ensure accuracy
G4bool QuickAdvance( G4FieldTrack& y_val, // INOUT
const G4double dydx[],
G4double hstep, // IN
G4double& dchord_step,
G4double& dyerr ) ;
G4bool QuickAdvance(G4FieldTrack& y_val, // INOUT
const G4double dydx[],
G4double hstep, // IN
G4double& dchord_step,
G4double& dyerr ) ;
// QuickAdvance just tries one Step - it does not ensure accuracy.
// Constructor, destructor
//
G4MagInt_Driver( G4double hminimum,
G4MagIntegratorStepper *pItsStepper,
G4int numberOfComponents=6);
G4MagInt_Driver( G4double hminimum,
G4MagIntegratorStepper *pItsStepper,
G4int numberOfComponents=6);
~G4MagInt_Driver(){}
// Constructor, destructor.
// Access functions
// ----------------
//
G4double GetHmin(){ return hminimum_val;}
G4double Hmin() { return hminimum_val;} // Obsolete
G4double GetSafety(){ return safety; }
G4double GetPshrnk(){ return pshrnk;}
G4double GetPgrow(){ return pgrow;}
G4double GetErrcon(){ return errcon;}
G4double GetHmin();
G4double Hmin(); // Obsolete
G4double GetSafety();
G4double GetPshrnk();
G4double GetPgrow();
G4double GetErrcon();
void GetDerivatives( const G4FieldTrack y_curr, // const, INput
G4double dydx[] ); // OUTput
// Accessors.
// Set functions
// ----------------
//
G4double SetHmin(G4double newval){ return hminimum_val;}
//
// The following function sets a new stepper pItsStepper for
// this driver, and then calls ReSetParameters to reset its
// parameters accordingly.
//
void RenewStepperAndAdjust(G4MagIntegratorStepper *pItsStepper);
//
//
// ReSetParameters does the following:
// i) sets the exponents (pgrow & pshrnk),
// using the current Stepper's order,
// ii) sets the safety
// ii) calculates "errcon" according to the above values.
//
// Sets a new stepper pItsStepper for this driver. Then it calls
// ReSetParameters to reset its parameters accordingly.
void ReSetParameters(G4double new_safety= 0.9 );
//
// When setting safety or pgrow, errcon will be set to a
// compatible value
//
// i) sets the exponents (pgrow & pshrnk),
// using the current Stepper's order,
// ii) sets the safety
// ii) calculates "errcon" according to the above values.
void SetSafety(G4double valS);
void SetPshrnk(G4double valPs);
void SetPgrow( G4double valPg);
void SetErrcon(G4double valEc);
//
// When setting safety or pgrow, errcon will be set to a
// compatible value.
G4double ComputeAndSetErrcon();
void SetChargeMomentumMass( // Change them in Equation
const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double Mass );
void SetChargeMomentumMass( const G4double particleCharge,
const G4double MomentumXc,
const G4double Mass );
// Change them in Equation. particleCharge is in e+ units.
G4MagIntegratorStepper* GetStepper();
// This takes one Step that is as large as possible while
// satisfying the accuracy criterion of
// yerr < eps * |y_end-y_start|
//
void OneGoodStep( G4double ystart[], // Like old RKF45step()
const G4double dydx[],
G4double& x,
@@ -108,26 +95,34 @@ class G4MagInt_Driver
const G4double eps, // memb variables ?
G4double& hdid,
G4double& hnext ) ;
// This takes one Step that is as large as possible while
// satisfying the accuracy criterion of:
// yerr < eps * |y_end-y_start|
// Taking the last step's normalised error, calculate
// a step size for the next step.
// Do not limit the next step's size within a factor of the current one.
G4double ComputeNewStepSize(
G4double errMaxNorm, // normalised error
G4double hstepCurrent); // current step size
// Taking the last step's normalised error, calculate
// a step size for the next step.
// Limit the next step's size within a range around the current one.
// Taking the last step's normalised error, calculate
// a step size for the next step.
// Do not limit the next step's size within a factor of the
// current one.
G4double ComputeNewStepSize_WithinLimits(
G4double errMaxNorm, // normalised error
G4double hstepCurrent); // current step size
// Taking the last step's normalised error, calculate
// a step size for the next step.
// Limit the next step's size within a range around the current one.
G4int GetMaxNoSteps();
void SetMaxNoSteps( G4int val);
protected:
// Issue warnings for undesirable situations
public: // without description
G4double SetHmin(G4double newval);
protected:
void WarnSmallStepSize( G4double hnext, G4double hstep,
G4double h, G4double xDone,
G4int noSteps);
@@ -136,9 +131,12 @@ protected:
G4double hStepSize ,
G4double epsilonRelative,
G4int debugFlag);
// Issue warnings for undesirable situations
private:
G4double hminimum_val; // Minimum Step allowed in a Step
private:
G4double hminimum_val;
// Minimum Step allowed in a Step.
const G4int nvar;
@@ -146,14 +144,15 @@ private:
G4int fMaxNoSteps;
static const G4int fMaxStepBase;
// Parameters used to grow and shrink trial stepsize
G4double safety;
G4double pshrnk; // exponent for shrinking
G4double pgrow; // exponent for growth
G4double errcon;
// maximum stepsize increase/decrease factors
// Parameters used to grow and shrink trial stepsize.
static const G4double max_stepping_increase;
static const G4double max_stepping_decrease;
// Maximum stepsize increase/decrease factors.
};
#include "G4MagIntegratorDriver.icc"
@@ -5,9 +5,45 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagIntegratorDriver.icc,v 1.3 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MagIntegratorDriver.icc,v 1.4 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
inline G4double G4MagInt_Driver::GetHmin()
{
return hminimum_val;
}
inline G4double G4MagInt_Driver::Hmin()
{
return hminimum_val;
}
inline G4double G4MagInt_Driver::GetSafety()
{
return safety;
}
inline G4double G4MagInt_Driver::GetPshrnk()
{
return pshrnk;
}
inline G4double G4MagInt_Driver::GetPgrow()
{
return pgrow;
}
inline G4double G4MagInt_Driver::GetErrcon()
{
return errcon;
}
inline G4double G4MagInt_Driver::SetHmin(G4double newval)
{
return hminimum_val;
}
inline G4double G4MagInt_Driver::ComputeAndSetErrcon()
{
errcon = pow(max_stepping_increase/GetSafety(),1.0/GetPgrow());
@@ -5,81 +5,78 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagIntegratorStepper.hh,v 1.3 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MagIntegratorStepper.hh,v 1.4 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// Abstract base class (ie Interface)
// -------------------
// for integrator of particle's equation of motion,
// used in tracking in space dependent magnetic field
// -----------------------------------------------------
//
// class G4MagIntegratorStepper
//
// Class description:
//
// Abstract base class for integrator of particle's equation of motion,
// used in tracking in space dependent magnetic field
// History:
// 15.01.97 J.Apostolakis (J.Apostolakis@cern.ch)
// - 15.01.97 J.Apostolakis (J.Apostolakis@cern.ch)
#ifndef G4MAGIntegratorSTEPPER
#define G4MAGIntegratorSTEPPER
#include "globals.hh"
#include "G4Mag_EqRhs.hh"
class G4MagIntegratorStepper
{
public:
public: // with description
G4MagIntegratorStepper(G4Mag_EqRhs *EqRhs, G4int num_variables);
~G4MagIntegratorStepper(){} ;
// "Key" methods
// ---------------
// The stepper for the Runge Kutta integration. The stepsize
// is fixed, with the Step size given by h.
// Integrates ODE starting values y[0 to 6 ]
// Outputs yout[] and its estimated error yerr[].
~G4MagIntegratorStepper(){;}
// Constructor and destructor. No actions.
virtual void Stepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[],
G4double yerr[] ) = 0 ;
// Estimate the maximum distance of chord from true path over
// segment last integrated.
// The stepper for the Runge Kutta integration.
// The stepsize is fixed, with the Step size given by h.
// Integrates ODE starting values y[0 to 6].
// Outputs yout[] and its estimated error yerr[].
virtual G4double DistChord() const = 0;
// Estimate the maximum distance of a chord from the true path
// over the segment last integrated.
// Utility methods
// ---------------
// Simple function to (re)normalise 'unit velocity' vector
//
void NormaliseTangentVector( G4double vec[6] );
// Simple utility function to (re)normalise 'unit velocity' vector.
// Supply the standard Evaluation of the Right Hand side
// of the associated equation.
//
virtual void RightHandSide( const double y[], double dydx[] );
// FIXME : not virtual JA 10/2/99
// Utility method to supply the standard Evaluation of the
// Right Hand side of the associated equation.
// Get/Set the number of variables that the stepper will compile over
G4int GetNumberOfVariables();
void SetNumberOfVariables(G4int newNo);
// Get/Set the number of variables that the stepper will compile over.
virtual G4int IntegratorOrder() = 0;
// Returns the order of the integrator
// i.e. its error behaviour is of the order O(h^order).
G4EquationOfMotion *GetEquationOfMotion() const;
// As some steppers (eg RKG3) require other methods of Eq_Rhs
// this function allows for access to them.
public: // without description
#if 0
// Supply the standard Evaluation of the Right Hand side
// of the associated equation.
void
SetChargeAndMomentum( const G4double particleCharge, // in e+ units
const G4double MomentumXc)
{ theEquation_Rhs -> SetChargeAndMomentum(particleCharge, MomentumXc);}
// Supply the standard Evaluation of the Right Hand side
// of the associated equation.
{theEquation_Rhs -> SetChargeAndMomentum(particleCharge, MomentumXc);}
#endif
// returns the order of the integrator
// i.e. its error behaviour is of the order O(h^order)
virtual G4int IntegratorOrder() = 0;
// As some steppers (eg RKG3) require other methods of Eq_Rhs
// the next function allows for access to them.
G4EquationOfMotion *GetEquationOfMotion() const;
private:
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4MagIntegratorStepper.icc,v 1.3 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
inline G4EquationOfMotion* G4MagIntegratorStepper::GetEquationOfMotion() const
{ return fEquation_Rhs; }
@@ -5,59 +5,69 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Mag_EqRhs.hh,v 1.3 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4Mag_EqRhs.hh,v 1.4 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// The right hand size of the equation of motion of a particle
// in a magnetic field.
// class G4Mag_EqRhs
//
// (Possible use of alternative to "normal" version: rotating reference
// frame)
//
// JA, January 13th, 1996
// Class description:
//
// The "standard" right-hand side for the equation of motion of a particle
// in a pure magnetic field.
// Others that might be required are:
// i) when using a moving reference frame ... or
// ii) extending for other forces, eg an electric field.
// History:
// - Created. J.Apostolakis, January 13th 1996
#ifndef G4_MAG_EQRHS_DEF
#define G4_MAG_EQRHS_DEF
#include "globals.hh"
#include "G4EquationOfMotion.hh"
#include "globals.hh"
#include "G4EquationOfMotion.hh"
#include "G4MagneticField.hh" // class G4MagneticField; not enough ??
class G4Mag_EqRhs : public G4EquationOfMotion
{
public:
public: // with description
G4Mag_EqRhs( G4MagneticField *magField );
~G4Mag_EqRhs();
// Constructor and destructor. No actions.
// Given the value of the field "B", this function
// calculates the value of the derivative dydx.
// --------------------------------------------------------
// This is the _only_ function a subclass must define.
// The other two functions use Rhs_givenB.
//
virtual void EvaluateRhsGivenB( const G4double y[],
const G4double B[3],
G4double dydx[] ) const = 0;
// Given the value of the field "B", this function
// calculates the value of the derivative dydx.
// This is the _only_ function a subclass must define.
// The other two functions use Rhs_givenB.
G4double FCof() const { return fCof_val; }
G4double FCof() const;
virtual void SetChargeMomentumMass( const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double mass);
virtual void
SetChargeMomentumMass( const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double mass);
private:
G4double fCof_val;
// Coefficient in the Lorentz motion equation (Lorentz force), if the
// magnetic field B is in Tesla, the particle charge in units of the
// elementary (positron?) charge, the momentum P in MeV/c, and the
// space coordinates and path along the trajectory in mm .
//
static const G4double fUnitConstant; // Set in G4Mag_EqRhs.cc
// to 0.299792458
// Coefficient in the Lorentz motion equation (Lorentz force), if the
// magnetic field B is in Tesla, the particle charge in units of the
// elementary (positron?) charge, the momentum P in MeV/c, and the
// space coordinates and path along the trajectory in mm .
};
inline
G4double G4Mag_EqRhs::FCof() const
{
return fCof_val;
}
#endif /* G4_MAG_EQRHS_DEF */
@@ -1,36 +1,49 @@
// 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: G4Mag_SpinEqRhs.hh,v 1.3 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// 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.
// class G4Mag_SpinEqRhs
//
// J. Apostolakis, February 8th, 1999
// P. Gumplinger, February 8th, 1999
// 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.
// History:
// - Created: J.Apostolakis, P.Gumplinger - February 8th, 1999.
#ifndef G4MAG_SPIN_EQRHS
#define G4MAG_SPIN_EQRHS
#include "G4Mag_EqRhs.hh"
#include "G4MagneticField.hh"
class G4Mag_SpinEqRhs: public G4Mag_EqRhs{
class G4Mag_SpinEqRhs : public G4Mag_EqRhs{
public:
public: // with description
G4Mag_SpinEqRhs( G4MagneticField* MagField ) :
G4Mag_EqRhs( MagField ) {};
~G4Mag_SpinEqRhs() {} ;
G4Mag_SpinEqRhs( G4MagneticField* MagField )
: G4Mag_EqRhs( MagField ) {;}
~G4Mag_SpinEqRhs() {;}
// Constructor and destructor. No actions.
void SetChargeMomentumMass(const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double mass);
// Given the value of the magnetic field B, this function
// calculates the value of the derivative dydx.
//
void EvaluateRhsGivenB( const G4double y[],
const G4double B[3],
G4double dydx[] ) const;
// Given the value of the magnetic field B, this function
// calculates the value of the derivative dydx.
private:
@@ -5,36 +5,42 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Mag_UsualEqRhs.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4Mag_UsualEqRhs.hh,v 1.3 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// This is the standard right-hand side for equation of motion.
// class G4Mag_UsualEqRhs
//
// The only case another is required is when using a moving reference
// frame ... or extending the class to include additional Forces,
// eg an electric field
//
// J. Apostolakis, January 13th, 1997
// Class description:
//
// This is the standard right-hand side for equation of motion.
// The only case another is required is when using a moving reference
// frame ... or extending the class to include additional Forces,
// eg an electric field
// History:
// - Created: J. Apostolakis, January 13th 1997.
#ifndef G4MAG_USUAL_EQRHS
#define G4MAG_USUAL_EQRHS
#include "G4Mag_EqRhs.hh"
#include "G4MagneticField.hh"
class G4Mag_UsualEqRhs: public G4Mag_EqRhs{
public:
G4Mag_UsualEqRhs( G4MagneticField* MagField ) :
G4Mag_EqRhs( MagField ) {};
~G4Mag_UsualEqRhs() {} ;
class G4Mag_UsualEqRhs : public G4Mag_EqRhs
{
public: // with description
// Given the value of the magnetic field B, this function
// calculates the value of the derivative dydx.
//
void EvaluateRhsGivenB( const G4double y[],
const G4double B[3],
G4double dydx[] ) const;
G4Mag_UsualEqRhs( G4MagneticField* MagField )
: G4Mag_EqRhs( MagField ) {;}
~G4Mag_UsualEqRhs() {;}
// Constructor and destructor. No actions.
void EvaluateRhsGivenB( const G4double y[],
const G4double B[3],
G4double dydx[] ) const;
// Given the value of the magnetic field B, this function
// calculates the value of the derivative dydx.
};
#endif /* G4MAG_USUAL_EQRHS */
@@ -5,16 +5,20 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagneticField.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MagneticField.hh,v 1.4 2000/05/10 12:36:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Magnetic Field abstract class, implements inquiry function interface.
// class G4MagneticField
//
// JA, January 13th, 1996
// Class description:
//
// November 5th, 1997 - G.Cosmo, added default & copy constructors, virtual
// destructor and assignment operator.
// Magnetic Field abstract class, implements inquiry function interface.
// History:
// - Created. JA, January 13th, 1996.
// - Added default & copy constructors, virtual destructor and
// assignment operator. G.Cosmo, November 5th, 1997.
#ifndef G4MAGNETIC_FIELD_DEF
#define G4MAGNETIC_FIELD_DEF
@@ -23,19 +27,15 @@
class G4MagneticField : public G4Field
{
public:
public: // with description
G4MagneticField();
virtual ~G4MagneticField();
// Constructor and destructor. No actions.
// Copy constructor & assignment operator
G4MagneticField(const G4MagneticField &p);
G4MagneticField& operator = (const G4MagneticField &p);
// Old version of field evaluation function:
// to be replaced by following function (GetFieldValue)
// virtual void MagneticField( const double Point[3],
// double Bfield[3] ) = 0;
G4MagneticField(const G4MagneticField &);
G4MagneticField& operator = (const G4MagneticField &);
// Copy constructor & assignment operator.
virtual void GetFieldValue( const double Point[3],
double *Bfield ) const = 0;
@@ -45,9 +45,8 @@ class G4MagneticField : public G4Field
inline G4MagneticField::G4MagneticField() {}
inline G4MagneticField::~G4MagneticField() {}
inline G4MagneticField::G4MagneticField(const G4MagneticField &p) {}
// Not needed: { *this = p; }
inline G4MagneticField& G4MagneticField::operator = (const G4MagneticField &p)
{ *this = p; return *this; }
inline G4MagneticField::G4MagneticField(const G4MagneticField &) {}
inline G4MagneticField& G4MagneticField::operator = (const G4MagneticField &)
{ return *this; }
#endif /* G4MAGNETIC_FIELD_DEF */
@@ -5,66 +5,81 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RKG3_Stepper.hh,v 1.3 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4RKG3_Stepper.hh,v 1.4 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// J.Apostolakis, V.Grichine 30.01.97
// class G4RKG3_Stepper
//
// Class description:
//
// Integrator Runga-Kutta Stepper from Geant3.
// History:
// - Created. J.Apostolakis, V.Grichine - 30.01.97
#ifndef G4RKG3_Stepper_hh
#define G4RKG3_Stepper_hh
#include "G4MagIntegratorStepper.hh"
#include "G4ThreeVector.hh"
class G4RKG3_Stepper : public G4MagIntegratorStepper
{
public:
G4RKG3_Stepper(G4Mag_EqRhs *EqRhs): G4MagIntegratorStepper(EqRhs,6){};
// integrate over 6 variables only: position & velocity
~G4RKG3_Stepper(){};
public: // with description
// The method it must provide, even if less efficiently
void
Stepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[],
G4double yErr[] );
// G4double& beta2) const
G4RKG3_Stepper(G4Mag_EqRhs *EqRhs)
: G4MagIntegratorStepper(EqRhs,6){;}
// Integrate over 6 variables only: position & velocity.
G4double DistChord() const ;
~G4RKG3_Stepper(){;}
void Stepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[],
G4double yErr[] );
// The method which must be provided, even if less efficient.
G4double DistChord() const ;
// Additional "optimised" methods:
void StepNoErr( const G4double tIn[7],
const G4double dydx[7],
const G4double Step,
G4double tOut[7],
G4double B[3] );
// Integrator RK Stepper from G3 with only two field evaluation per
// Step. It is used in propagation initial Step by small substeps
// after solution error and delta geometry considerations.
// B[3] is magnetic field which is passed from substep to substep.
// Integrator RK Stepper from G3 with only two field evaluation per
// Step. It is used in propagation initial Step by small substeps
// after solution error and delta geometry considerations.
// B[3] is magnetic field which is passed from substep to substep.
void StepWithEst( const G4double tIn[7],
const G4double dydx[7],
const G4double Step,
G4double tOut[7],
G4double& alpha2, // to delete ?
G4double& beta2,
const G4double B1[3],
G4double B2[3] );
// Integrator for RK from G3 with evaluation of error in solution and delta
// geometry based on naive similarity with the case of uniform magnetic field.
// B1[3] is input and is the first magnetic field values
// B2[3] is output and is the final magnetic field values.
void StepNoErr( const G4double tIn[7],
const G4double dydx[7],
const G4double Step,
G4double tOut[7],
G4double B[3] );
public: // without description
void StepWithEst(const G4double tIn[7],
const G4double dydx[7],
const G4double Step,
G4double tOut[7],
// G4double tError[6],
G4double& alpha2, // to delete ?
G4double& beta2,
const G4double B1[3],
G4double B3[3] );
G4int IntegratorOrder() { return 4; };
G4int IntegratorOrder() { return 4; };
protected:
// void Field( const double Point[3],
// double Bfield[3] ) const
// { EqRhs-> GetFieldValue( Point, Bfield ) ; }
private:
G4ThreeVector fyInitial,
fyMidPoint,
fyFinal ;
protected:
// void Field( const double Point[3],
// double Bfield[3] ) const
// { EqRhs-> GetFieldValue( Point, Bfield ) ; }
private:
G4ThreeVector fyInitial,
fyMidPoint,
fyFinal ;
};
#endif
@@ -5,38 +5,56 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SimpleHeum.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4SimpleHeum.hh,v 1.3 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// W. Wander <wwc@mit.edu> 12/09/97
// class G4SimpleHeum
//
// Class description:
//
// Simple Heum:
// x_1 = x_0 +
// h * 1/4 * dx(t0,x0) +
// 3/4 * dx(t0+2/3*h, x0+2/3*h*(dx(t0+h/3,x0+h/3*dx(t0,x0))))
//
// third order solver.
// History:
// - Created. W. Wander <wwc@mit.edu>, 12/09/97
#ifndef G4SIMPLEHEUM_HH
#define G4SIMPLEHEUM_HH
#include "G4MagErrorStepper.hh"
class G4SimpleHeum: public G4MagErrorStepper
class G4SimpleHeum : public G4MagErrorStepper
{
public:
public: // with description
G4SimpleHeum(G4Mag_EqRhs *EqRhs, G4int num_variables=6);
~G4SimpleHeum();
// Constructor and destructor.
void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[]);
void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[]);
G4int IntegratorOrder() { return 3; };
public: // without description
G4int IntegratorOrder() { return 3; }
private:
private:
const G4int fNumberOfVariables;
// scratch space
G4double* dydxTemp ;
G4double* dydxTemp2 ;
G4double* yTemp ;
G4double* yTemp2 ;
G4double* dydxTemp ;
G4double* dydxTemp2 ;
G4double* yTemp ;
G4double* yTemp2 ;
// scratch space
};
#endif /* G4SIMPLEHEUM_HH */
@@ -5,38 +5,56 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SimpleRunge.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4SimpleRunge.hh,v 1.3 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// W. Wander <wwc@mit.edu> 12/09/97
// class G4SimpleRunge
//
// Class description:
//
// Simple Runge:
//
// x_1 = x_0 + h * ( dx( t_0+h/2, x_0 + h/2 * dx( t_0, x_0) ) )
//
// second order solver.
// Take the derivative at a position to be assumed at the middle of the
// Step and add it to the current position.
// History:
// - Created. W.Wander <wwc@mit.edu>, 12/09/97
#ifndef G4SIMPLERUNGE_HH
#define G4SIMPLERUNGE_HH
#include "G4MagErrorStepper.hh"
class G4SimpleRunge: public G4MagErrorStepper
class G4SimpleRunge : public G4MagErrorStepper
{
public:
public: // with description
G4SimpleRunge(G4Mag_EqRhs *EqRhs, G4int numberOfVariables = 6) ;
~G4SimpleRunge();
// Constructor and destructor.
void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[]);
void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[]);
G4int IntegratorOrder() { return 2; };
public: // without description
G4int IntegratorOrder() { return 2; }
private:
private:
G4int fNumberOfVariables ;
// scratch space
G4double* dydxTemp;
G4double* dydxTemp2;
G4double* yTemp;
// scratch space
};
#endif /* G4SIMPLERUNGE_HH */
@@ -5,17 +5,21 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UniformElectricField.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UniformElectricField.hh,v 1.3 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4UniformElectricField
//
// Class for creation of Uniform Magnetic Field
// Class description:
//
// 30.1.97 V.Grichine
// 1.8.97 J.Apostolakis, cleanup, new 3-vector constructor,
// and removal of helix-stepper (to separate file)
// 5.11.97 G.Cosmo, added copy constructor and assignment operator.
// Class for creation of Uniform electric Magnetic Field.
// History:
// - 30.01.97 V.Grichine, Created.
// - 01.08.97 J.Apostolakis, cleanup, new 3-vector constructor,
// and removal of helix-stepper (to separate file).
// - 05.11.97 G.Cosmo, added copy constructor and assignment operator.
#ifndef G4UNIFORMELECTRICFIELD_HH
#define G4UNIFORMELECTRICFIELD_HH
@@ -27,29 +31,26 @@
class G4UniformElectricField : public G4ElectroMagneticField
{
public:
// A field with value equal to FieldVector
//
G4UniformElectricField(const G4ThreeVector FieldVector );
public: // with description
G4UniformElectricField(G4double vField,
G4UniformElectricField(const G4ThreeVector FieldVector );
// A field with value equal to FieldVector.
G4UniformElectricField(G4double vField,
G4double vTheta,
G4double vPhi ) ;
~G4UniformElectricField() ;
~G4UniformElectricField() ;
// Copy constructor and assignment operator
//
G4UniformElectricField(const G4UniformElectricField &p);
G4UniformElectricField& operator = (const G4UniformElectricField &p);
G4UniformElectricField(const G4UniformElectricField &p);
G4UniformElectricField& operator = (const G4UniformElectricField &p);
// Copy constructor and assignment operator
void GetFieldValue(const G4double position[] ,
G4double B[] ) const ;
void GetFieldValue(const G4double position[] ,
G4double B[] ) const ;
protected:
private:
private:
G4double fFieldComponents[6] ;
} ;
};
#endif
@@ -5,17 +5,21 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UniformMagField.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UniformMagField.hh,v 1.3 2000/04/27 09:14:07 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4UniformMagField
//
// Class for creation of Uniform Magnetic Field
// Class description:
//
// 30.1.97 V.Grichine
// 1.8.97 J.Apostolakis, cleanup, new 3-vector constructor,
// and removal of helix-stepper (to separate file)
// 5.11.97 G.Cosmo, added copy constructor and assignment operator.
// Class for creation of Uniform Magnetic Field.
// History:
// - 30.01.97 V.Grichine, Created.
// - 01.08.97 J.Apostolakis, cleanup, new 3-vector constructor,
// and removal of helix-stepper (to separate file).
// - 05.11.97 G.Cosmo, added copy constructor and assignment operator.
#ifndef G4UNIFORMMAGFIELD_HH
#define G4UNIFORMMAGFIELD_HH
@@ -27,32 +31,31 @@
class G4UniformMagField : public G4MagneticField
{
public:
// A field with value equal to FieldVector
//
G4UniformMagField(const G4ThreeVector& FieldVector );
public: // with description
G4UniformMagField(const G4ThreeVector& FieldVector );
// A field with value equal to FieldVector.
G4UniformMagField(G4double vField,
G4double vTheta,
G4double vPhi ) ;
G4UniformMagField(G4double vField,
G4double vTheta,
G4double vPhi ) ;
~G4UniformMagField() ;
~G4UniformMagField() ;
// Copy constructor and assignment operator
//
G4UniformMagField(const G4UniformMagField &p);
G4UniformMagField& operator = (const G4UniformMagField &p);
G4UniformMagField(const G4UniformMagField &p);
G4UniformMagField& operator = (const G4UniformMagField &p);
// Copy constructor and assignment operator.
void GetFieldValue(const G4double yTrack[3] ,
G4double *MagField ) const ;
void GetFieldValue(const G4double yTrack[3] ,
G4double *MagField ) const ;
void SetFieldValue( const G4ThreeVector& newFieldValue );
void SetFieldValue( const G4ThreeVector& newFieldValue );
// Return the field value
G4ThreeVector GetConstantFieldValue() const;
G4ThreeVector GetConstantFieldValue() const;
// Return the field value
private:
private:
G4double fFieldComponents[3] ;
} ;
};
#endif
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4CashKarpRKF45.cc,v 1.4 1999/12/15 14:49:48 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
// order method (giving fifth-order accuracy) for the solution
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ChordFinder.cc,v 1.9 1999/12/15 14:49:48 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ChordFinder.cc,v 1.14 2000/05/11 17:34:32 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// 25.02.97 John Apostolakis, design and implimentation
@@ -19,6 +19,7 @@
// #include "G4Field.hh"
// #include "G4MagIntegratorStepper.hh"
#include "G4MagIntegratorDriver.hh"
#include "g4std/iomanip"
// For the moment fDeltaChord is a constant!
@@ -35,6 +36,7 @@ G4ChordFinder::G4ChordFinder( G4MagneticField* theMagField,
// by creating in inverse order the Driver, the Stepper and EqRhs ...
// G4Mag_EqRhs *
fEquation = new G4Mag_UsualEqRhs(theMagField); // Should move q, p to
fLastStepEstimate_Unconstrained = DBL_MAX;
//G4FieldTrack ??
// --->> Charge Q = 0
// --->> Momentum P = 1 NOMINAL VALUES !!!!!!!!!!!!!!!!!!
@@ -80,7 +82,7 @@ G4ChordFinder::AdvanceChordLimited( G4FieldTrack& yCurrent,
#ifdef G4VERBOSE
if( dbg )
G4cerr << "Entered FindNextChord Limited with:\n yCurrent: " << yCurrent
G4cerr << "Entered AdvanceChordLimited with:\n yCurrent: " << yCurrent
<< " and initial Step=stepMax=" << stepMax << " mm. " << G4endl;
#endif
@@ -114,6 +116,8 @@ G4ChordFinder::AdvanceChordLimited( G4FieldTrack& yCurrent,
return stepPossible;
}
// #define TEST_CHORD_PRINT 1
// ..............................................................................
G4double
@@ -127,7 +131,7 @@ G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
{
// G4int stepRKnumber=0;
G4FieldTrack yCurrent= yStart;
G4double stepTrial= stepMax;
G4double stepTrial;
G4double dydx[G4FieldTrack::ncompSVEC];
// 1.) Try to "leap" to end of interval
@@ -135,55 +139,115 @@ G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
// 2a.) If d_chord is not good enough, find one that is.
G4bool validEndPoint= false, dbg= false;
G4double dChordStep;
G4double dChordStep, oldStepTrial, stepOfLastGoodChord;
fIntgrDriver-> GetDerivatives( yCurrent, dydx ) ;
G4int noTrials=0;
stepTrial = G4std::min( stepMax,
(1-perThousand)*fLastStepEstimate_Unconstrained );
do
{
G4double stepForChord; // , stepForAccuracy;
yCurrent = yStart; // Always start from initial point
fIntgrDriver->QuickAdvance( yCurrent, dydx, stepTrial, dChordStep, dyErr);
#ifdef G4VERBOSE
if( dbg ) {
G4cerr << "Returned from QuickAdvance with: yCur=" << yCurrent << G4endl;
G4cerr << " dChordStep= "<< dChordStep <<" dyErr=" << dyErr << G4endl;
}
#endif
// First debug print
// We check whether the criterion is met here.
validEndPoint = AcceptableMissDist(dChordStep);
// && (dyErr < eps) ;
if( ! validEndPoint ) {
// This is needed to decide new step size until QuickAdvance does it
stepTrial = NewStep(stepTrial, dChordStep );
oldStepTrial = stepTrial;
// Get the driver to calculate the new step size, if it is needed
// stepTrial= fIntgrDriver->ComputeNewStepSize( dyErr/epsStep, stepTrial);
#ifdef G4VERBOSE
if( dbg )
G4cerr << "Dchord too big. Trying new hstep=" << stepTrial << G4endl;
// This method estimates to step size for a good chord.
stepForChord = NewStep(stepTrial, dChordStep, fLastStepEstimate_Unconstrained );
if( ! validEndPoint ) {
stepTrial = stepForChord;
#if 0
// Possible complementary approach:
// Get the driver to calculate the new step size, if it is needed
stepForAccuracy = fIntgrDriver->ComputeNewStepSize( dyErr/(epsStep*oldStepTrial),
stepTrial);
stepTrial = G4std::min(stepForChord, stepForAccuracy);
#endif
// if(dbg) G4cerr<<"Dchord too big. Try new hstep="<<stepTrial<<G4endl;
}
#ifdef TEST_CHORD_PRINT
G4cout.precision(5);
G4cout << " ChF/fnc: notrial " << G4std::setw( 3) << noTrials
<< " this_step= " << G4std::setw(10) << oldStepTrial;
if( fabs( (dChordStep / fDeltaChord) - 1.0 ) < 0.001 ){
G4cout.precision(8);
G4cout << " dChordStep= " << G4std::setw(12) << dChordStep;
}else{
G4cout.precision(6);
G4cout << " dChordStep= " << G4std::setw(12) << dChordStep;
}
if( dChordStep > fDeltaChord )
G4cout << " d+";
else
G4cout << " d-";
G4cout.precision(5);
G4cout << " new_step= " << G4std::setw(10) << fLastStepEstimate_Unconstrained
<< " new_step_constr= " << G4std::setw(10) << stepTrial << endl;
#endif
noTrials++;
}
while( ! validEndPoint ); // End of do-while RKD
stepOfLastGoodChord = stepTrial;
#ifdef TEST_CHORD_PRINT
G4cout << "ChordF/FindNextChord: NoTrials= " << noTrials
<< " StepForGoodChord=" << G4std::setw(10) << stepTrial << endl;
#endif
yEnd= yCurrent;
return stepTrial;
}
// ----------------------------------------------------------------------------
#if 0
// First debug print // older OPTIONAL code
// #ifdef G4VERBOSE
if( dbg ) {
G4cerr << "Returned from QuickAdvance with: yCur=" << yCurrent <<G4endl;
G4cerr << " dChordStep= "<< dChordStep <<" dyErr=" << dyErr << G4endl;
}
#endif
// ----------------------------------------------------------------------------
// ...........................................................................
G4double G4ChordFinder::NewStep(
const G4double stepTrialOld,
const G4double dChordStep ) // Current dchord achieved.
const G4double stepTrialOld,
const G4double dChordStep, // Current dchord achieved.
G4double& stepEstimate_Unconstrained )
{
G4double stepTrial;
static G4double lastStepTrial = 1., lastDchordStep= 1.;
#if 1
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;
}
lastStepTrial = stepTrialOld;
lastDchordStep= dChordStep;
#else
if ( dChordStep > 1000. * fDeltaChord ){
stepTrial= stepTrialOld * 0.03;
}else{
@@ -194,6 +258,7 @@ G4double G4ChordFinder::NewStep(
stepTrial= stepTrialOld * 0.5;
}
}
#endif
// A more sophisticated chord-finder could figure out a better
// stepTrial, from dChordStep and the required d_geometry
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ClassicalRK4.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4ClassicalRK4.hh"
#include "G4ThreeVector.hh"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4EquationOfMotion.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4EquationOfMotion.hh"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ExplicitEuler.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Explicit Euler: x_1 = x_0 + h * dx_0
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4FieldManager.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4FieldManager.hh"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4FieldTrack.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4FieldTrack.hh"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixExplicitEuler.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4HelixExplicitEuler.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4HelixExplicitEuler.hh"
#include "G4ThreeVector.hh"
@@ -25,11 +25,11 @@
void
G4HelixExplicitEuler::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[])
G4ThreeVector Bfld,
G4double h,
G4double yOut[])
{
AdvanceHelix(yIn, dydx, h, yOut);
AdvanceHelix(yIn, Bfld, h, yOut);
// NormaliseTangentVector( yOut ); // this could harm more than it helps
return ;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixHeum.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4HelixHeum.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4HelixHeum.hh"
#include "G4ThreeVector.hh"
@@ -25,31 +25,32 @@
void
G4HelixHeum::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[])
G4ThreeVector Bfld,
G4double h,
G4double yOut[])
{
const G4int nvar = 6 ;
G4double dydxTemp[6], dydxTemp2[6];
G4ThreeVector Bfield_Temp, Bfield_Temp2;
G4double yTemp[6], yAdd1[6], yAdd2[6] , yTemp2[6];
G4int i;
AdvanceHelix( yIn, dydx, h, yAdd1 );
AdvanceHelix( yIn, Bfld, h, yAdd1 );
AdvanceHelix( yIn, dydx, h/3.0, yTemp );
RightHandSide(yTemp,dydxTemp);
AdvanceHelix( yIn, Bfld, h/3.0, yTemp );
MagFieldEvaluate(yTemp,Bfield_Temp);
AdvanceHelix( yIn, dydxTemp, (2.0 / 3.0) * h, yTemp2 );
AdvanceHelix( yIn, Bfield_Temp, (2.0 / 3.0) * h, yTemp2 );
RightHandSide(yTemp2,dydxTemp2);
MagFieldEvaluate(yTemp2,Bfield_Temp2);
AdvanceHelix( yIn, dydxTemp2, h, yAdd2 );
AdvanceHelix( yIn, Bfield_Temp2, h, yAdd2 );
for( i = 0; i < nvar; i++ ) {
yOut[i] = ( 0.25 * yAdd1[i] + 0.75 * yAdd2[i]);
}
// NormaliseTangentVector( yOut );
return ;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixImplicitEuler.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4HelixImplicitEuler.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4HelixImplicitEuler.hh"
#include "G4ThreeVector.hh"
@@ -28,24 +28,24 @@
void
G4HelixImplicitEuler::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[])
G4ThreeVector Bfld,
G4double h,
G4double yOut[])
{
const G4int nvar = 6 ;
G4double dydxTemp[6];
G4double yTemp[6], yTemp2[6];
G4ThreeVector Bfld_endpoint;
G4int i;
// Step forward like in the explicit euler case
AdvanceHelix( yIn, dydx, h, yTemp);
AdvanceHelix( yIn, Bfld, h, yTemp);
// now obtain the new field value at the new point
RightHandSide(yTemp,dydxTemp);
MagFieldEvaluate(yTemp, Bfld_endpoint);
// and also advance along a helix for this field value
AdvanceHelix( yIn, dydxTemp, h, yTemp2);
AdvanceHelix( yIn, Bfld_endpoint, h, yTemp2);
// we take the average
for( i = 0; i < nvar; i++ )
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixSimpleRunge.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4HelixSimpleRunge.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4HelixSimpleRunge.hh"
#include "G4ThreeVector.hh"
@@ -26,19 +26,21 @@
void
G4HelixSimpleRunge::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[])
G4ThreeVector Bfld,
G4double h,
G4double yOut[])
{
const G4int nvar = 6 ;
G4double dydxTemp[nvar];
G4double yTemp[nvar]; // , yAdd[nvar];
G4ThreeVector Bfld_midpoint;
AdvanceHelix( yIn, dydx, 0.5 * h, yTemp);
AdvanceHelix( yIn, Bfld, 0.5 * h, yTemp);
RightHandSide(yTemp,dydxTemp);
// now obtain the new field value at the new point
MagFieldEvaluate(yTemp, Bfld_midpoint);
AdvanceHelix( yIn, dydxTemp, h, yOut);
AdvanceHelix( yIn, Bfld_midpoint, h, yOut);
// NormaliseTangentVector( yOut );
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4ImplicitEuler.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Implicit Euler:
@@ -5,10 +5,11 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LineSection.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4LineSection.cc,v 1.3 2000/02/25 16:57:15 grichine Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// typedef double G4double;
#include "G4LineSection.hh"
G4LineSection::G4LineSection( const G4ThreeVector& PntA,
@@ -16,8 +17,15 @@ G4LineSection::G4LineSection( const G4ThreeVector& PntA,
{
EndpointA= PntA;
VecAtoB=PntB-PntA;
inverse_square_distAB=1.0 / VecAtoB.mag2();
G4double distABsquared = VecAtoB.mag2() ;
if ( distABsquared == 0.0)
{
G4Exception("Equal points in G4LineSection::G4LineSection: line->point ?") ;
}
else
{
inverse_square_distAB=1.0 / distABsquared ;
}
}
G4double G4LineSection::Dist( G4ThreeVector OtherPnt ) const
@@ -36,23 +44,31 @@ G4double G4LineSection::Dist( G4ThreeVector OtherPnt ) const
unit_projection= inner_prod * InvsqDistAB();
if( (0. <= unit_projection ) && (unit_projection <= 1.0 ) )
dist_sq= sq_VecAZ - unit_projection * inner_prod;
else{
{
dist_sq= sq_VecAZ - unit_projection * inner_prod ;
}
else
{
// The perpendicular from the point to the line AB meets the line
// in a point outside the line segment!
//
if( unit_projection < 0. ) {
if( unit_projection < 0. )
{
// A is the closest point
dist_sq= sq_VecAZ;
}else{
}
else
{
// B is the closest point
G4ThreeVector EndpointB = EndpointA + VecAtoB;
G4ThreeVector VecBZ = OtherPnt - EndpointB;
dist_sq = VecBZ.mag2();
}
}
if( dist_sq < 0.0 ) dist_sq = 0.0 ;
return sqrt(dist_sq);
return sqrt(dist_sq) ;
}
G4double G4LineSection::Distline( const G4ThreeVector& OtherPnt,
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagErrorStepper.cc,v 1.6 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MagErrorStepper.cc,v 1.7 2000/05/09 11:41:00 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4MagErrorStepper.hh"
#include "G4ThreeVector.hh"
@@ -61,11 +61,26 @@ G4MagErrorStepper::Stepper( const G4double yInput[],
G4double
G4MagErrorStepper::DistChord() const
{
// Soon: must check whether h/R > 2 pi !!
// Method below is good only for < 2 pi
// Estimate the maximum distance from the curve to the chord
//
// We estimate this using the distance of the midpoint to
// chord (the line between
//
// Method below is good only for angle deviations < 2 pi,
// This restriction should not a problem for the Runge cutta methods,
// which generally cannot integrate accurately for large angle deviations.
G4double distLine, distChord;
return G4LineSection::Distline( fMidPoint, fInitialPoint, fFinalPoint );
// This is a class method that gives distance of Mid
// from the Chord between the Initial and Final points.
if (fInitialPoint != fFinalPoint) {
distLine= G4LineSection::Distline( fMidPoint, fInitialPoint, fFinalPoint );
// This is a class method that gives distance of Mid
// from the Chord between the Initial and Final points.
distChord = distLine;
}else{
distChord = (fMidPoint-fInitialPoint).mag();
}
return distChord;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagHelicalStepper.cc,v 1.3 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MagHelicalStepper.cc,v 1.4 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4MagHelicalStepper.hh"
#include "G4ThreeVector.hh"
@@ -27,14 +27,14 @@ G4MagHelicalStepper::G4MagHelicalStepper(G4Mag_EqRhs *EqRhs)
void
G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
const G4double Barr[],
const G4double h,
G4double yHelix[])
G4ThreeVector Bfld,
G4double h,
G4double yHelix[])
{
// const G4int nvar = 6;
const G4double approc_limit = 0.05;
G4ThreeVector Bfld, Bnorm, B_x_P, vperp, vpar;
G4ThreeVector Bnorm, B_x_P, vperp, vpar;
// G4double norm;
G4double B_d_P; // B_perp;
G4double Theta; // , Theta_1;
@@ -42,8 +42,7 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
G4double CosT2, SinT2, CosT, SinT;
G4ThreeVector positionMove, endTangent;
Bfld= G4ThreeVector( Barr[0], Barr[1], Barr[2]);
G4double Bmag = Bfld.mag();
G4double Bmag = Bfld.mag();
const G4double *pIn = yIn+3;
G4ThreeVector initTangent= G4ThreeVector( pIn[0], pIn[1], pIn[2]);
@@ -137,7 +136,8 @@ G4MagHelicalStepper::Stepper( const G4double yInput[],
// correction for Richardson Extrapolation.
G4double correction = 1. / ( (1 << IntegratorOrder()) -1 );
G4double yTemp[7], dydxTemp[6], yIn[7] ;
G4double yTemp[7], yIn[7] ;
G4ThreeVector Bfld_initial, Bfld_midpoint;
// Saving yInput because yInput and yOut can be aliases for same array
@@ -145,26 +145,35 @@ G4MagHelicalStepper::Stepper( const G4double yInput[],
G4double h = hstep * 0.5;
MagFieldEvaluate(yIn, Bfld_initial) ;
// Do two half steps
DumbStepper(yIn, Bfld_initial, h, yTemp);
MagFieldEvaluate(yTemp, Bfld_midpoint) ;
DumbStepper(yTemp, Bfld_midpoint, h, yOut);
DumbStepper(yIn,dydx,h,yTemp);
MagFieldEvaluate(yTemp,dydxTemp) ; // Was : RightHandSide(,)
DumbStepper(yTemp,dydxTemp,h,yOut);
// Store midpoint, chord calculation
// Store midpoint, to aid distance-from-chord calculation
yMidPoint = G4ThreeVector( yTemp[0], yTemp[1], yTemp[2]);
// Do a full Step
h = hstep ;
DumbStepper(yIn,dydx,h,yTemp);
DumbStepper(yIn, Bfld_initial, h, yTemp);
for(i=0;i<nvar;i++) {
yErr[i] = yOut[i] - yTemp[i] ;
yOut[i] += yErr[i]*correction ; // Provides by 1 increased
// order of accuracy
// Richardson Extrapolation
yErr[i] = yOut[i] - yTemp[i] ;
}
#if G4HELICAL_USE_RICHARDSON_EXTRAPOLATION
if( IntegratorOrder() > 1 ) {
// It is unclear whether it is possible to
// use the Richardson Extrapolation to increase accuracey by 1 order
for(i=0;i<nvar;i++) {
yOut[i] += yErr[i]*correction ;
}
}
#endif
yInitial = G4ThreeVector( yIn[0], yIn[1], yIn[2]);
yFinal = G4ThreeVector( yOut[0], yOut[1], yOut[2]);
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagIntegratorDriver.cc,v 1.10 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MagIntegratorDriver.cc,v 1.12 2000/05/09 11:51:47 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//
@@ -26,8 +26,6 @@
#include "geomdefs.hh"
// for kCarTolerance
#define G4DEBUG 1
// Stepsize can increase by no more than 5.0
// and decrease by no more than 1/10. = 0.1
//
@@ -52,16 +50,13 @@ G4MagInt_Driver::AccurateAdvance(
// RightHandSide is the right-hand side of ODE system.
// The source is similar to odeint routine from NRC p.721-722 .
// OLD:
// The value h1 should be set as a guessed first stepsize, Hmin is the
// minimum allowed stepsize. On output nOK and nBAD are the numbers of
// good and bad (but retried and fixed) steps taken.
{
// static const G4int maxstp = 5000;
G4int nstp, i;
static G4int dbg=1;
static G4int dbg=0;
G4double x, hnext, hdid, h ;
#ifdef G4DEBUG
dbg=1;
#endif
// G4double yscal[ncompSVEC];
G4double y[G4FieldTrack::ncompSVEC], dydx[G4FieldTrack::ncompSVEC];
@@ -111,20 +106,25 @@ G4MagInt_Driver::AccurateAdvance(
//--------------------------------------
lastStepSucceeded= (hdid == h);
#ifdef G4DEBUG
// #ifdef G4DEBUG
if(lastStepSucceeded) noFullIntegr++ ; else noSmallIntegr++ ;
G4ThreeVector EndPos( y[0], y[1], y[2] );
// Check the endpoint
G4double endPointDist= (EndPos-StartPos).mag();
if( endPointDist >= h*(1.+perMillion) ){
WarnEndPointTooFar ( endPointDist, h, eps, dbg );
// Issue a warning only for gross differences -
// we understand how small difference occur.
if( endPointDist >= h*(1.+perThousand) ){
WarnEndPointTooFar ( endPointDist, h, eps, dbg );
}
noBadSteps ++;
} else { // ie (!dbg)
noGoodSteps ++;
}
#endif
// #endif
// Check the proposed next stepsize
if(fabs(hnext) <= Hmin())
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4MagIntegratorStepper.cc,v 1.3 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4MagIntegratorStepper.hh"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4Mag_EqRhs.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// This is the standard right-hand side for equation of motion
// in a pure Magnetic Field .
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4Mag_UsualEqRhs.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// This is the standard right-hand side for equation of motion.
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RKG3_Stepper.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4RKG3_Stepper.cc,v 1.3 2000/05/09 11:54:23 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4RKG3_Stepper.hh"
#include "G4ThreeVector.hh"
@@ -93,7 +93,7 @@ void G4RKG3_Stepper::StepWithEst( const G4double tIn[7],
{
G4Exception(" G4ClassicalRK4::StepWithEst ERROR: this Method is no longer used.");
G4Exception(" G4RKG3_Stepper::StepWithEst ERROR: this Method is no longer used.");
#if 0
// const G4int nvar = 6 ;
@@ -180,10 +180,9 @@ void G4RKG3_Stepper::StepNoErr(const G4double tIn[7],
G4double tTemp[7], yderiv[6] ;
G4int i ;
G4Exception(" G4ClassicalRK4::StepNoErr ERROR: this Method should no longer be used.");
#if 0
#ifdef END_CODE_G3STEPPER
G4Exception(" G4RKG3_Stepper::StepNoErr ERROR: this Method should no longer be used.");
#else
// GetEquationOfMotion()->EvaluateRhsReturnB(tIn,dydx,B1) ;
for(i=0;i<3;i++)
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SimpleHeum.cc,v 1.3 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// Simple Heum:
// x_1 = x_0 + h *
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SimpleRunge.cc,v 1.2 1999/12/15 14:49:50 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
// Simple Runge:
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4UniformElectricField.cc,v 1.2 1999/12/15 14:49:50 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4UniformMagField.cc,v 1.2 1999/12/15 14:49:50 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//
+18 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.7 2000/01/19 19:07:04 gcosmo Exp $
$Id: History,v 1.10 2000/06/06 13:18:51 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,23 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
June 06, 2000 G.Cosmo geommng-V01-01-00
- G4DrawVoxels.hh: removed line '#define G4DrawVoxelsDebug' left in place
accidentally in the code...
April 20, 2000 G. Cosmo
- Reorganised comments for the Software Reference Manual.
- Moved inlined definition to .icc files, where needed.
Created: G4SmartVoxelHeader.icc, G4SmartVoxelNode.icc,
G4SmartVoxelProxy.icc, G4VoxelLimits.icc.
April 11, 2000 J. Allison
- Made virtual G4VisExtent G4VSolid::GetExtent() non-pure and implemented
a default in terms of CalculateExtent.
January 19, 00 G. Cosmo geommng-V01-00-00
Syncronized file versioning with HEAD (several CVS headers changed
@@ -5,11 +5,13 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4AffineTransform.hh,v 1.2 1999/12/15 14:49:50 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4AffineTransform.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4AffineTransform Header File
// class G4AffineTransform
//
// Class description:
//
// A class for geometric affine transformations [see, eg. Foley & Van Dam]
// Supports efficient arbitrary rotation & transformation of vectors and the
@@ -17,20 +19,19 @@
// maintained internally for greater computational efficiency for transforms
// that do not involve rotation.
//
// Interfaces to the GEANT4 modified CLHEP classes G4ThreeVector &
// G4RotationMatrix
// Interfaces to the CLHEP classes G4ThreeVector & G4RotationMatrix
//
// For member function descriptions, see comments by declarations. For
// additional clarification, also check the `const' declarations for
// functions & their parameters.
//
// Private Member data:
// Member data:
//
// G4double rxx,rxy,rxz;
// G4double ryx,ryy,ryz; A 3x3 rotation matrix - net rotation
// G4double rzx,rzy,rzz;
// G4double tx,ty,tz; Net translation
//
// History:
// Paul R C Kent 6 Aug 1996 - initial version
//
@@ -49,126 +50,103 @@
class G4AffineTransform
{
public:
G4AffineTransform();
// Translation only: Under t'form translate point at origin by tlate
G4AffineTransform();
G4AffineTransform(const G4ThreeVector &tlate);
// Rotation only: Under t'form rotate by rot
public: // with description
G4AffineTransform(const G4RotationMatrix &rot);
// Under t'form: Rotate by rot then translate by tlate
G4AffineTransform(const G4ThreeVector &tlate);
// Translation only: under t'form translate point at origin by tlate
G4AffineTransform(const G4RotationMatrix &rot,
const G4ThreeVector &tlate);
G4AffineTransform(const G4RotationMatrix &rot);
// Rotation only: under t'form rotate by rot
G4AffineTransform(const G4RotationMatrix &rot,
const G4ThreeVector &tlate);
// Under t'form: rotate by rot then translate by tlate
G4AffineTransform(const G4RotationMatrix *rot,
const G4ThreeVector &tlate);
// Optionally rotate by *rot then translate by tlate - rot may be null
// Optionally rotate by *rot then translate by tlate - rot may be null
G4AffineTransform operator * (const G4AffineTransform &tf) const;
// Compound Transforms:
// tf2=tf2*tf1 equivalent to tf2*=tf1
// Returns compound transformation of self*tf
G4AffineTransform(const G4RotationMatrix *rot,
const G4ThreeVector &tlate);
// NOTE: Compound Transforms
//
// tf2=tf2*tf1 equivalent to tf2*=tf1
//
// Returns compound transformation of self*tf
G4AffineTransform& operator *= (const G4AffineTransform &tf);
// (Modifying) Multiplies self by tf; Returns self reference
// ie. A=AB for a*=b
G4AffineTransform operator * (const G4AffineTransform &tf) const;
G4AffineTransform& Product(const G4AffineTransform &tf1,
const G4AffineTransform &tf2);
// 'Products' for avoiding (potential) temporaries:
// c.Product(a,b) equivalent to c=a*b
// c.InverseProduct(a*b,b ) equivalent to c=a
// (Modifying) Sets self=tf1*tf2; Returns self reference
G4AffineTransform& InverseProduct(const G4AffineTransform &tf1,
const G4AffineTransform &tf2);
// (Modifying) Sets self=tf1*(tf2^-1); Returns self reference
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const;
// Transform the specified point: returns vec*rot+tlate
G4ThreeVector TransformAxis(const G4ThreeVector &axis) const;
// Transform the specified axis: returns
// (Modifying) Multiplies self by tf; Returns self reference
// ie. A=AB for a*=b
G4AffineTransform& operator *= (const G4AffineTransform &tf);
void ApplyPointTransform(G4ThreeVector &vec) const;
// Transform the specified point (in place): sets vec=vec*rot+tlate
void ApplyAxisTransform(G4ThreeVector &axis) const;
// Transform the specified axis (in place): sets axis=axis*rot;
// 'Products' for avoiding (potential) temporaries
//
// c.Product(a,b) equivalent to c=a*b
//
// c.InverseProduct(a*b,b ) equivalent to c=a
//
// (Modifying) Sets self=tf1*tf2; Returns self reference
G4AffineTransform Inverse() const;
// Return inverse of current transform
G4AffineTransform& Product(const G4AffineTransform &tf1,
const G4AffineTransform &tf2);
// (Modifying) Sets self=tf1*(tf2^-1); Returns self reference
G4AffineTransform& Invert();
// (Modifying) Sets self=inverse of self; Returns self reference
G4AffineTransform& InverseProduct(const G4AffineTransform &tf1,
const G4AffineTransform &tf2);
// Transform the specified point: returns vec*rot+tlate
G4AffineTransform& operator +=(const G4ThreeVector &tlate);
G4AffineTransform& operator -=(const G4ThreeVector &tlate);
// (Modifying) Adjust net translation by given vector;
// Returns self reference
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const;
// Transform the specified axis: returns
G4bool operator == (const G4AffineTransform &tf) const;
G4bool operator != (const G4AffineTransform &tf) const;
G4ThreeVector TransformAxis(const G4ThreeVector &axis) const;
// Transform the specified point (in place): sets vec=vec*rot+tlate
G4double operator [] (const G4int n) const;
void ApplyPointTransform(G4ThreeVector &vec) const;
// Transform the specified axis (in place): sets axis=axis*rot;
G4bool IsRotated() const;
// True if transform includes rotation
void ApplyAxisTransform(G4ThreeVector &axis) const;
G4bool IsTranslated() const;
// True if transform includes translation
// Return inverse of current transform
G4RotationMatrix NetRotation() const;
G4AffineTransform Inverse() const;
G4ThreeVector NetTranslation() const;
// (Modifying) Sets self=inverse of self; Returns self reference
void SetNetRotation(const G4RotationMatrix &rot);
G4AffineTransform& Invert();
// (Modifying) Adjust net translation by given vector; Returns self reference
G4AffineTransform& operator +=(const G4ThreeVector &tlate);
G4AffineTransform& operator -=(const G4ThreeVector &tlate);
G4bool operator == (const G4AffineTransform &tf) const;
G4bool operator != (const G4AffineTransform &tf) const;
G4double operator [] (const G4int n) const;
// True if transform includes rotation
G4bool IsRotated() const;
// Ture if transform includes translation
G4bool IsTranslated() const;
G4RotationMatrix NetRotation() const;
G4ThreeVector NetTranslation() const;
void SetNetRotation(const G4RotationMatrix &rot);
void SetNetTranslation(const G4ThreeVector &tlate);
void SetNetTranslation(const G4ThreeVector &tlate);
private:
G4AffineTransform( const G4double prxx,const G4double prxy,const G4double prxz,
const G4double pryx,const G4double pryy,const G4double pryz,
const G4double przx,const G4double przy,const G4double przz,
const G4double ptx,const G4double pty,const G4double ptz ) ;
G4double rxx,rxy,rxz;
G4double ryx,ryy,ryz;
G4double rzx,rzy,rzz;
G4double tx,ty,tz;
G4AffineTransform(const G4double prxx,const G4double prxy,const G4double prxz,
const G4double pryx,const G4double pryy,const G4double pryz,
const G4double przx,const G4double przy,const G4double przz,
const G4double ptx, const G4double pty, const G4double ptz );
G4double rxx,rxy,rxz;
G4double ryx,ryy,ryz;
G4double rzx,rzy,rzz;
G4double tx,ty,tz;
};
#include "G4AffineTransform.icc"
#endif
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4AffineTransform.icc,v 1.3 1999/12/15 14:49:50 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// G4AffineTransformation Inline implementation
@@ -5,32 +5,33 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DrawVoxels.hh,v 1.7 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4DrawVoxels.hh,v 1.9 2000/06/06 13:18:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4DrawVoxels
//
// Implementation
// Class description:
//
// Define G4DrawVoxelsDebug for debugging information on G4cout
//
// History:
// 03/08/1999 The G4VisAttributes have been made member data for lifetime reasons / visualisation L.G (see John Allison for further explanation)
// 29.07.99 first comitted version L.G.
// Utility class for the visualization of voxels in the detector geometry.
// Define G4DrawVoxelsDebug in the environment at compilation for debugging
// information printed to G4cout.
// History:
// 03/08/1999 The G4VisAttributes have been made member data for lifetime
// reasons / visualisation - L.G (ask John Allison for further
// explanation).
// 29/07/1999 First comitted version - L.G.
#ifndef G4DrawVoxels_HH
#define G4DrawVoxels_HH
//***********what I need to use (include and forward declarations) FOR DRAWING VOXELS****************
// *********** what I need to use (include and forward declarations)
// FOR DRAWING VOXELS ****************
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4PlacedPolyhedron.hh" //#include "G4Polyhedron.hh" included
//#include <rw/tpordvec.h>
//#include <rw/tvordvec.h>
#include "G4SmartVoxelHeader.hh"
#include "G4VoxelLimits.hh"
#include "G4AffineTransform.hh"
@@ -38,17 +39,21 @@
#include "G4LogicalVolume.hh"
#include "G4VSolid.hh"
#define voxel_width 0;
#define voxel_width 0
#define G4DrawVoxelsDebug
// ***********************************************************************
class G4DrawVoxels
{
public: // with description
//***************************************************************************************************
class G4DrawVoxels{
public:
//constructor. It initialises the members data to default colors
G4DrawVoxels();
// Constructor. It initialises the members data to default colors
// Copy constructor and assignment operator not supported (array
// fvoxelcolours ...).
~G4DrawVoxels(){};
//Copy constructor Assignment operator not supported (array fvoxelcolours ...)
// Destructor NOT virtual. Not a base class.
void DrawVoxels(const G4LogicalVolume* lv) const;
G4PlacedPolyhedronList* CreatePlacedPolyhedra(const G4LogicalVolume*) const;
@@ -57,7 +62,8 @@ class G4DrawVoxels{
void SetBoundingBoxVisAttributes(G4VisAttributes&);
private:
//Member data
// Member data
G4VisAttributes fVoxelsVisAttributes[3];
G4VisAttributes fBoundingBoxVisAttributes;
@@ -65,7 +71,8 @@ class G4DrawVoxels{
G4AffineTransform GetAbsoluteTransformation(const G4VPhysicalVolume*) const;
//Copy constructor Assignment operator not supported (array fvoxelcolours ...)
// Copy constructor Assignment operator not supported (array
// fvoxelcolours ...)
G4DrawVoxels(const G4DrawVoxels&);
G4DrawVoxels operator=(const G4DrawVoxels&);
};
@@ -5,33 +5,23 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GeometryManager.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4GeometryManager.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4GeometryManager
//
// A class resposible for high level geometrical functions, and for
// Class description:
//
// A class responsible for high level geometrical functions, and for
// high level objects in the geometry subdomain.
// The class is `singleton', with access via G4GeometryManager::GetInstance
//
// Member functions:
//
// G4bool CloseGeometry(G4bool pOptimise=true);
// Close (`lock') the geometry: perform sanity and `completion' checks
// and optionally [default=yes] Build optimisation information.
//
// void OpenGeometry();
// Open (`unlock') the geometry and remove optimisation information if
// present.
//
// static G4GeometryManager* GetInstance()
// Return ptr to singleton instance of the class.
// The class is a `singleton', with access via the static method
// G4GeometryManager::GetInstance().
//
// Member data:
//
// static G4GeometryManager* fgInstance
// Ptr to the unique instance of class
//
// static G4GeometryManager* fgInstance
// - Ptr to the unique instance of class
// History:
// 26.07.95 P.Kent Initial version, incuding optimisation Build
@@ -51,14 +41,25 @@
class G4GeometryManager
{
public:
public: // with description
G4bool CloseGeometry(G4bool pOptimise=true);
// Close (`lock') the geometry: perform sanity and `completion' checks
// and optionally [default=yes] build optimisation information.
void OpenGeometry();
static G4GeometryManager* GetInstance();
// Open (`unlock') the geometry and remove optimisation information if
// present.
static G4GeometryManager* GetInstance();
// Return ptr to singleton instance of the class.
protected:
protected:
G4GeometryManager();
private:
private:
void BuildOptimisations(const G4bool allOpt);
void DeleteOptimisations();
@@ -67,5 +68,3 @@ private:
};
#endif
@@ -5,22 +5,37 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalSurface.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4LogicalSurface.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
////////////////////////////////////////////////////////////////////////
// G4LogicalSurface Definition
// Class G4LogicalSurface
////////////////////////////////////////////////////////////////////////
//
// File: G4LogicalSurface.hh
// Description: An abstraction of a geometrical surface, it is an abstract
// base class for different implementations of surfaces.
// Its primary function is to hold pointers
// to objects that describe the surface's physical properties.
// For example it holds a pointer to a surface's optical
// properties, and because of this it is used in processes like
// G4OpBoundaryProcess.
// Class description:
//
// An abstraction of a geometrical surface, it is an abstract
// base class for different implementations of surfaces.
// Its primary function is to hold pointers to objects that describe the
// surface's physical properties. For example it holds a pointer to a
// surface's optical properties, and because of this it is used in processes
// like G4OpBoundaryProcess.
//
// Methods:
// G4OpticalSurface* GetOpticalSurface() const
// void SetOpticalSurface(G4OpticalSurface*)
//
// G4String GetName() const
// void SetName(const G4String&)
//
// G4TransitionRadiationSurface* GetTransitionRadiationSurface() const
// void SetTransitionRadiationSurface(G4TransitionRadiationSurface*)
//
// Data members:
// G4String theName
// G4OpticalSurface* theOpticalSurface
// G4TransitionRadiationSurface* theTransRadSurface
// Version: 1.0
// Created: 1997, June, 4th to 17th
// Author: John Apostolakis, (with help of Peter Gumplinger)
@@ -38,7 +53,6 @@
/////////////
#include "globals.hh"
#include "templates.hh"
class G4OpticalSurface;
class G4TransitionRadiationSurface;
@@ -52,59 +66,54 @@ class G4LogicalSurface
////////////
// Methods
////////////
public:
G4OpticalSurface* GetOpticalSurface() const
{ return theOpticalSurface; }
public:
G4OpticalSurface* GetOpticalSurface() const;
void SetOpticalSurface(G4OpticalSurface* ptrOpticalSurface);
void SetOpticalSurface(G4OpticalSurface* ptrOpticalSurface)
{ theOpticalSurface= ptrOpticalSurface; }
G4String GetName() const;
void SetName(const G4String& name);
G4String GetName() const { return theName; }
void SetName(const G4String& name){theName = name;}
G4TransitionRadiationSurface* GetTransitionRadiationSurface() const
{ return theTransRadSurface; }
void SetTransitionRadiationSurface( G4TransitionRadiationSurface* transRadSurf )
{ theTransRadSurface= transRadSurf; }
G4TransitionRadiationSurface* GetTransitionRadiationSurface() const;
void SetTransitionRadiationSurface(G4TransitionRadiationSurface* transRadSurf);
////////////////////////////////
// Constructors and Destructor
////////////////////////////////
protected:
protected:
// There should be no instances of this class
G4LogicalSurface(const G4String& name,
G4OpticalSurface* opticalSurface);
G4LogicalSurface(const G4String& name,
G4OpticalSurface* opticalSurface);
// Is the name more meaningful for the properties or the logical
// surface ?
// surface ?
public:
virtual ~G4LogicalSurface();
public:
virtual ~G4LogicalSurface();
private:
G4LogicalSurface(const G4LogicalSurface &right); // Copying restricted
private:
G4LogicalSurface(const G4LogicalSurface &right); // Copying restricted
//////////////
// Operators
//////////////
public:
G4int operator==(const G4LogicalSurface &right) const;
G4int operator!=(const G4LogicalSurface &right) const;
public:
G4int operator==(const G4LogicalSurface &right) const;
G4int operator!=(const G4LogicalSurface &right) const;
private:
const G4LogicalSurface& operator=(const G4LogicalSurface& right);
private:
const G4LogicalSurface& operator=(const G4LogicalSurface& right);
// ------------------
// Basic data members ( To define a 'logical' surface)
// ------------------
private:
G4String theName; // Surface name
private:
G4String theName; // Surface name
G4OpticalSurface* theOpticalSurface;
G4TransitionRadiationSurface* theTransRadSurface;
G4OpticalSurface* theOpticalSurface;
G4TransitionRadiationSurface* theTransRadSurface;
};
////////////////////
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalSurface.icc,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4LogicalSurface.icc,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
////////////////////////////////////////////////////////////////////////
// Surface Class Inline Methods
@@ -20,31 +20,70 @@
//
////////////////////////////////////////////////////////////////////////
// #include "G4ios.hh"
/////////////////////////
// Class Inline Methods
/////////////////////////
inline G4OpticalSurface*
G4LogicalSurface::GetOpticalSurface() const
{
return theOpticalSurface;
}
inline void
G4LogicalSurface::SetOpticalSurface(G4OpticalSurface* ptrOpticalSurface)
{
theOpticalSurface = ptrOpticalSurface;
}
inline G4String
G4LogicalSurface::GetName() const
{
return theName;
}
inline void
G4LogicalSurface::SetName(const G4String& name)
{
theName = name;
}
inline G4TransitionRadiationSurface*
G4LogicalSurface::GetTransitionRadiationSurface() const
{
return theTransRadSurface;
}
inline void
G4LogicalSurface::SetTransitionRadiationSurface(G4TransitionRadiationSurface*
transRadSurf )
{
theTransRadSurface= transRadSurf;
}
//////////////
// Operators
//////////////
inline const G4LogicalSurface & G4LogicalSurface::operator=(const G4LogicalSurface &right)
inline const G4LogicalSurface &
G4LogicalSurface::operator=(const G4LogicalSurface &right)
{
return right;
}
inline G4int G4LogicalSurface::operator==(const G4LogicalSurface &right) const
inline G4int
G4LogicalSurface::operator==(const G4LogicalSurface &right) const
{
return (this == (G4LogicalSurface *) &right);
}
inline G4int G4LogicalSurface::operator!=(const G4LogicalSurface &right) const
inline G4int
G4LogicalSurface::operator!=(const G4LogicalSurface &right) const
{
return (this != (G4LogicalSurface *) &right);
}
/////////////////
// Constructors
/////////////////
@@ -5,166 +5,68 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalVolume.hh,v 1.4 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4LogicalVolume.hh,v 1.5 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4LogicalVolume
//
// Class description:
//
// Represents a leaf node or unpositioned subtree in the geometry hierarchy.
// Logical volumes are named, and may have daughters ascribed to them.
// They are responsible for retrieval of the physical and tracking attributes
// of the physical volume that it represents: Solid, material, magnetic field,
// and optionally: user limits, sensitive detectors.
// of the physical volume that it represents: solid, material, magnetic field,
// and optionally, user limits, sensitive detectors.
//
// Get and Set functionality is provided for all atributes, but note that
// Get and Set functionality is provided for all attributes, but note that
// most set functions should not be used when the geometry is `closed'.
// As a further development, `Guard' checks can be added to ensure
// only legal operations at tracking time.
//
// On construction, solid, material and name must be specified
//
// On construction, solid, material and name must be specified.
//
// Daughters are ascribed and managed by means of a simple
// GetNoDaughters,Get&SetDaughter(n),AddDaughter interface
// GetNoDaughters,Get&SetDaughter(n),AddDaughter interface.
//
// Smart voxels as used for tracking optimisation are also an attribute.
//
// Logical volumes self register to the logical volume Store on construction,
// and deregister on destruction.
//
// NOTE: This class is currently *NOT* subclassed. If subclassed make
// destructor virtual.
// NOTE: This class is currently *NOT* subclassed, since not meant to
// act as a base class. Therefore, the destructor is NOT virtual.
//
// Member functions:
//
// G4LogicalVolume(const G4VSolid *pSolid, const G4Material *pMaterial,
// const G4String& name,
// const G4MagneticField *pField=0,
// const G4VSensitiveDetector *pSDetector=0,
// const G4UserLimits *pULimits=0)
//
// Constructor. The solid and material pointer must be non null. The
// parameters for field, detector and user limits are optional.
// The volume also enters itself into the logical volume Store.
//
// ~G4LogicalVolume()
// Destructor. Removes the logical volume from the logical volume Store.
//
// G4String GetName() const
// Returns name of logical volume
// void SetName(const G4String& pName)
// Sets name of logical volume
//
// G4int GetNoDaughters() const
// Returns the number of daughters (0 to n)
// G4VPhysicalVolume* GetDaughter(const G4int i) const
// Return the ith daughter. Note numbering starts from 0, and no bounds
// checkingis performed.
// void SetDaughter(const G4int i,G4VPhysicalVolume* p)
// Set the ith daughter to be p, where 0<=i<GetNoDaughters(). Intended
// for UI use only
// void AddDaughter(G4VPhysicalVolume* p)
// Add the volume p as a daughter of the current logical volume.
// G4bool IsDaughter(const G4VPhsyicalVolume* p) const
// Returns true is the volume p is a daughter of the current logical volume
// void RemoveDaughter(const G4VPhysicalVolume* p )
// Remove the volume p from the List of daughter of the current logical
// volume.
//
// G4VSolid* GetSolid() const
// Gets current solid.
// void SetSolid(G4VSolid *pSolid)
// Sets solid.
//
// G4Material* GetMaterial() const
// Gets current Material.
// void SetMaterial(G4Material *pMaterial)
// Sets Material.
//
// G4FieldManager* GetFieldManager() const
// Gets current FieldManager.
// void SetFieldManager(G4FieldManager *pField, G4bool forceToAllDaughters)
// Sets FieldManager and propagates it
// i) only to daughters with G4FieldManager = 0 if forceToAllDaughters=false
// ii) to all daughters if forceToAllDaughters=true
//
// G4VSensitiveDetector* GetSensitiveDetector() const
// Gets current SensitiveDetector.
// void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
// Sets SensitiveDetector (can be NULL)
//
// G4UserLimits* GetUserLimits() const
// Gets current UserLimits.
// void SetUserLimits(G4UserLimits *pULimits)
// Sets UserLimits.
//
// G4VoxelHeader* GetVoxelHeader() const
// Gets current VoxelHeader.
// void SetVoxelHeader(G4VoxelHeader *pVoxel)
// Sets VoxelHeader.
//
// G4double GetSmartless()
// Gets user defined optimisation quality
// void SetSmartless(G4double)
// Sets user defined optimisation quality
//
// void BecomeEnvelopeForFastSimulation(G4FastSimulationManager* );
// Makes this an Envelope for given FastSimulationManager.
// Ensures that all its daughter volumes get it too - unless they
// have one already.
// G4FastSimulationManager* GetFastSimulationManager () const;
// Gets current FastSimulationManager pointer.
// void ClearEnvelopeForFastSimulation(G4LogicalVolume* motherLogVol);
// Erase volume's Envelope status and propagate the FastSimulationManager
// of its mother volume to itself and its daughters.
//
// void SetFastSimulationManager (G4FastSimulationManager* pPA,
// G4bool IsEnvelope);
// Sets the fast simulation manager. Private method called by the
// public SetIsEnvelope method with IsEnvelope = TRUE. It is
// then called recursivaly to the daughters to propagate the
// FastSimulationManager pointer with IsEnvelope = FALSE.
//
// void SetBiasWeight (G4double w);
// Sets the bias weight
// G4double GetBiasWeight() const;
// Gets the bias weight
//
// Operators:
//
// G4bool operator == (G4LogicalVolume,G4LogicalVolume)
// Equality defined by address only- return true if objects are at
// same address, else false
//
//
// Member data:
//
// G4RWTPtrOrderedVector<G4VPhysicalVolume> fDaughters
// Vector of daughters. Given initial size of 0.
// G4FieldManager *fFieldManager
// Pointer (possibly NULL) to (magnetic or other) field manager object
// G4Material *fMaterial
// Pointer to material at this node
// G4String fName
// Name of logical volume
// G4SensitiveDetector *fSensitiveDetector
// Pointer (possibly NULL) to `Hit' object
// G4VSolid *fSolid
// Pointer to solid
// G4UserLimits *fUserLimits
// Pointer (possibly NULL) to user Step limit object for this node
// G4VoxelHeader *fVoxel
// Pointer (possibly NULL) to optimisation info objects
// G4double smartless
// Quality for optimisation, average number of voxels to be spent per content
// G4FastSimulationManager *fFastSimulationManager
// Pointer (possibly NULL) to G4FastSimulationManager object
// G4bool fIsEnvelope
// Flags if the Logical Volume is an envelope for a FastSimulationManager.
// G4double fBiasWeight
// weight used in the event biasing technique
// Data members:
//
// G4RWTPtrOrderedVector<G4VPhysicalVolume> fDaughters
// - Vector of daughters. Given initial size of 0.
// G4FieldManager *fFieldManager
// - Pointer (possibly NULL) to (magnetic or other) field manager object.
// G4Material *fMaterial
// - Pointer to material at this node.
// G4String fName
// - Name of logical volume.
// G4VSensitiveDetector *fSensitiveDetector
// - Pointer (possibly NULL) to `Hit' object.
// G4VSolid *fSolid
// - Pointer to solid.
// G4UserLimits *fUserLimits
// - Pointer (possibly NULL) to user Step limit object for this node.
// G4SmartVoxelHeader *fVoxel
// - Pointer (possibly NULL) to optimisation info objects.
// G4double fSmartless
// - Quality for optimisation, average number of voxels to be spent
// per content.
// const G4VisAttributes* fVisAttributes
// - Pointer (possibly NULL) to visualization attributes.
// G4FastSimulationManager *fFastSimulationManager
// - Pointer (possibly NULL) to G4FastSimulationManager object.
// G4bool fIsEnvelope
// - Flags if the Logical Volume is an envelope for a FastSimulationManager.
// G4double fBiasWeight
// - Weight used in the event biasing technique.
// History:
// 12.02.99 S.Giani: Added user defined optimisation quality
// 09.11.98 J. Apostolakis: Changed G4MagneticField to G4FieldManager
@@ -195,79 +97,139 @@ class G4FastSimulationManager;
class G4LogicalVolume
{
public:
public: // with description
G4LogicalVolume(G4VSolid *pSolid, G4Material *pMaterial,
const G4String& name,
G4FieldManager *pFieldMgr=0,
G4VSensitiveDetector *pSDetector=0,
G4UserLimits *pULimits=0);
// Constructor. The solid and material pointer must be non null. The
// parameters for field, detector and user limits are optional.
// The volume also enters itself into the logical volume Store.
~G4LogicalVolume();
// Destructor. Removes the logical volume from the logical volume Store.
// NOT virtual, since not meant to act as base class.
G4String GetName() const;
void SetName(const G4String& pName);
// Returns and sets the name of the logical volume.
G4int GetNoDaughters() const;
// Returns the number of daughters (0 to n).
G4VPhysicalVolume* GetDaughter(const G4int i) const;
// Return the ith daughter. Note numbering starts from 0,
// and no bounds checking is performed.
void AddDaughter(G4VPhysicalVolume* p);
// Add the volume p as a daughter of the current logical volume.
G4bool IsDaughter(const G4VPhysicalVolume* p) const;
// Returns true is the volume p is a daughter of the current
// logical volume.
void RemoveDaughter(const G4VPhysicalVolume* p);
// Remove the volume p from the List of daughter of the current
// logical volume.
G4VSolid* GetSolid() const;
void SetSolid(G4VSolid *pSolid);
// Gets and sets the current solid.
G4Material* GetMaterial() const;
void SetMaterial(G4Material *pMaterial);
// Gets and sets the current material.
G4FieldManager* GetFieldManager() const;
// Gets current FieldManager.
void SetFieldManager(G4FieldManager *pFieldMgr, G4bool forceToAllDaughters);
// Sets FieldManager and propagates it:
// i) only to daughters with G4FieldManager = 0
// if forceToAllDaughters=false
// ii) to all daughters
// if forceToAllDaughters=true
G4VSensitiveDetector* GetSensitiveDetector() const;
// Gets current SensitiveDetector.
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector);
// Sets SensitiveDetector (can be NULL).
G4UserLimits* GetUserLimits() const;
void SetUserLimits(G4UserLimits *pULimits);
// Gets and sets current UserLimits.
G4SmartVoxelHeader* GetVoxelHeader() const;
void SetVoxelHeader(G4SmartVoxelHeader *pVoxel);
// Gets and sets current VoxelHeader.
G4double GetSmartless();
void SetSmartless(G4double s);
// Gets and sets user defined optimisation quality.
G4bool operator == ( const G4LogicalVolume& lv) const;
// Equality defined by address only- return true if objects are at
// same address, else false.
const G4VisAttributes* GetVisAttributes () const;
void SetVisAttributes (const G4VisAttributes* pVA);
void SetVisAttributes (const G4VisAttributes& VA);
// Gets and sets visualization attributes.
void BecomeEnvelopeForFastSimulation(G4FastSimulationManager* );
// Makes this an Envelope for given FastSimulationManager.
// Ensures that all its daughter volumes get it too - unless they
// have one already.
void ClearEnvelopeForFastSimulation(G4LogicalVolume* motherLV= 0);
// Erase volume's Envelope status and propagate the FastSimulationManager
// of its mother volume to itself and its daughters.
G4FastSimulationManager* GetFastSimulationManager () const;
// Gets current FastSimulationManager pointer.
void SetBiasWeight (G4double w);
G4double GetBiasWeight() const;
// Sets and gets bias weight.
private:
private:
void SetFastSimulationManager (G4FastSimulationManager* pPA,
G4bool IsEnvelope);
G4LogicalVolume* FindMotherLogicalVolumeForEnvelope();
//
// Data members:
G4bool IsEnvelope);
// Sets the fast simulation manager. Private method called by the
// public SetIsEnvelope method with IsEnvelope = TRUE. It is
// then called recursivaly to the daughters to propagate the
// FastSimulationManager pointer with IsEnvelope = FALSE.
G4LogicalVolume* FindMotherLogicalVolumeForEnvelope();
private:
// Data members:
private:
G4RWTPtrOrderedVector<G4VPhysicalVolume> fDaughters;
// Vector of daughters. Given initial size of 0.
G4FieldManager *fFieldManager;
// Pointer (possibly NULL) to (magnetic or other) field manager object.
G4Material *fMaterial;
// Pointer to material at this node.
G4String fName;
// Name of logical volume.
G4VSensitiveDetector *fSensitiveDetector;
// Pointer (possibly NULL) to `Hit' object.
G4VSolid *fSolid;
// Pointer to solid.
G4UserLimits *fUserLimits;
// Pointer (possibly NULL) to user Step limit object for this node.
G4SmartVoxelHeader *fVoxel;
// Pointer (possibly NULL) to optimisation info objects.
G4double fSmartless;
// Quality for optimisation, average number of voxels to be spent
// per content.
const G4VisAttributes* fVisAttributes;
// Pointer (possibly NULL) to visualization attributes.
G4FastSimulationManager *fFastSimulationManager;
// Pointer (possibly NULL) to G4FastSimulationManager object.
G4bool fIsEnvelope;
// Flags if the Logical Volume is an envelope for a
// FastSimulationManager.
G4double fBiasWeight;
// Weight used in the event biasing technique.
};
#include "G4LogicalVolume.icc"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4LogicalVolume.icc,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4LogicalVolume Inline Implementation file
@@ -5,43 +5,30 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalVolumeStore.hh,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4LogicalVolumeStore.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4LogicalVolumeStore
//
// Container for all LogicalVolumes, with functionality derived from
// G4RWTPtrOrderedVector<T>. The class is `singleton', in that only
// one can exist, and access is facillitated via G4LogicalVolumeStore::GetInstance()
// Class description:
//
// All LogicalVolumes should be registered with G4LogicalVolumeStore, and removed on their
// destruction. Intended principally for UI browser. The underlying
// container initially has a capacity of 100.
// Container for all LogicalVolumes, with functionality derived from
// G4RWTPtrOrderedVector<T>. The class is a `singleton', in that only
// one can exist, and access is provided via the static function
// G4LogicalVolumeStore::GetInstance()
//
// All LogicalVolumes should be registered with G4LogicalVolumeStore,
// and removed on their destruction. Intended principally for UI browser.
// The underlying container initially has a capacity of 100.
//
// If much additional functionality is added, should consider containment
// instead of inheritance for G4RWTPtrOrderedVector<T>
//
// Class member functions:
//
// static void Register(G4LogicalVolume* pVolume)
// Add the logical volume to the collection
// static void DeRegister(G4LogicalVolume* pVolume)
// REmove the logical volume from the collection
// static G4LogicalVolumeStore* GetInstance()
// Get a ptr to the unique G4LogicalVolumeStore, creting it if necessary
//
// Member functions:
//
// [as per RWTPtrOrderedvector]
//
// NOTE: Constructor is protected - creation and subsequent access is via
// GetInstance
// instead of inheritance for G4RWTPtrOrderedVector<T>.
//
// Member data:
//
// static G4LogicalVolumeStore* fgInstance
// Ptr to the single G4LogicalVolumeStore
//
// - Ptr to the single G4LogicalVolumeStore.
// History:
// 10.07.95 P.Kent Initial version
@@ -54,14 +41,25 @@
class G4LogicalVolumeStore : public G4RWTPtrOrderedVector<G4LogicalVolume>
{
public:
public: // with description
static void Register(G4LogicalVolume* pVolume);
// Add the logical volume to the collection.
static void DeRegister(G4LogicalVolume* pVolume);
// Remove the logical volume from the collection.
static G4LogicalVolumeStore* GetInstance();
// Get a ptr to the unique G4LogicalVolumeStore,
// creating it if necessary.
virtual ~G4LogicalVolumeStore();
// Destructor.
protected:
G4LogicalVolumeStore();
private:
static G4LogicalVolumeStore* fgInstance;
};
@@ -5,38 +5,19 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PVParameterised.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4PVParameterised.hh,v 1.3 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4PVParameterised
//
// Class description:
//
// Represents many touchable detector elements differing in their
// positioning and dimensions. Both are calculated by means
// of a G4VParameterisation object. The positioning is assumed to
// be dominant along a cartesian axis (specified).
//
// G4PVParameterised(const G4String& pName,
// G4LogicalVolume *pLogical,
// G4VPhysicalVolume *pMother,
// const EAxis pAxis,
// const G4int nReplicas,
// G4VPVParameteriastion *pParam)
//
// Replicate the volume nReplicas Times using the paramaterisation pParam,
// withing the mother volume pMother. The positioning of the replicas
// is dominant along the specified axis
//
// G4PVParameterised(const G4String& pName,
// G4LogicalVolume *pLogical,
// G4LogicalVolume *pMotherLogical,
// const EAxis pAxis,
// const G4int nReplicas,
// G4VPVParameteriastion *pParam)
//
// Almost exactly similar to first constructor, changing only mother
// pointer's type to LogicalVolume.
//
// History:
// 29.07.95 P.Kent First non-stub version
@@ -47,13 +28,17 @@
class G4PVParameterised : public G4PVReplica
{
public:
public: // with description
G4PVParameterised(const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMother,
const EAxis pAxis,
const G4int nReplicas,
G4VPVParameterisation *pParam);
// Replicate the volume nReplicas Times using the paramaterisation pParam,
// within the mother volume pMother. The positioning of the replicas is
// dominant along the specified axis.
G4PVParameterised(const G4String& pName,
G4LogicalVolume* pLogical,
@@ -61,19 +46,22 @@ public:
const EAxis pAxis,
const G4int nReplicas,
G4VPVParameterisation *pParam);
// Almost exactly similar to first constructor, changing only mother
// pointer's type to LogicalVolume.
virtual G4VPVParameterisation* GetParameterisation() const;
// Returns the current pointer to the parameterisation.
virtual void GetReplicationData(EAxis& axis,
G4int& nReplicas,
G4double& width,
G4double& offset,
G4bool& consuming) const;
private:
G4int& nReplicas,
G4double& width,
G4double& offset,
G4bool& consuming) const;
// Fills arguments with the attributes from the base replica.
private:
G4VPVParameterisation *fparam;
};
#endif
@@ -5,80 +5,17 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PVPlacement.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4PVPlacement.hh,v 1.3 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4PVPlacement
//
// Class description:
//
// Class representing a single volume positioned within and relative
// to a mother volume.
//
//
// G4PVPlacement(G4RotationMatrix *pRot, // 1st constructor
// const G4Threevector &tlate,
// const G4String& pName,
// G4LogicalVolume *pLogical,
// G4VPhysicalVolume *pMother,
// G4bool pMany,
// G4int pCopyNo)
//
// Initialise a single volume, positioned in a frame which is rotated by
// *pFrameRot, relative to the coordinate system of the mother volume pMother.
// The center of the object is then placed at volumeCenterCrd in
// the new coordinates.
// If pRot=0 the volume is unrotated with respect to its mother.
// The physical volume is added to the mother's logical volume.
// (The above are exactly the arguments of G4VPhysicalVolume)
// Arguments particular to G4PVPlacement:
// pMany must be true if the volume is MANY in the GEANT 3 sense, else false
// pCopyNo should be set to 0 for the first volume of a given type
//
//
// G4PVPlacement(const G4Transform3D &Transform3D, // 2nd constructor
// const G4String &pName,
// G4LogicalVolume *pLogical,
// G4VPhysicalVolume *pMother,
// G4bool pMany,
// G4int pCopyNo);
//
// Additional constructor, which expects a G4Transform3D that represents
// the direct rotation and translation of the solid (NOT of the frame).
// To repeat: the G4Transform3D argument should be constructed by
// i) First rotating it to align the solid to the system of
// reference of its mother volume *pMother, and
// ii) Then placing the solid at the location Transform3D.getTranslation(),
// with respect to the origin of the system of coordinates of the
// mother volume.
// ( This is useful for the people who prefer to think in terms
// of moving objects in a given reference frame. )
// All other arguments are the same as for the previous constructor.
//
//
// G4PVPlacement::G4PVPlacement(G4RotationMatrix *pRot, // 3rd constructor
// const G4ThreeVector &tlate,
// G4LogicalVolume *pCurrentLogical,
// const G4String& pName,
// G4LogicalVolume *pMotherLogical,
// G4bool pMany,
// G4int pCopyNo);
//
// A simple variation of the 1st constructor, only specifying the
// mother volume as a pointer to its logical volume instead of its physical
// volume. [ This is a very natural way of defining a physical volume, and
// is especially useful when creating subdetectors: the mother volumes is
// not placed until a later stage of the assembly program. ]
//
//
// G4PVPlacement(const G4Transform3D &Transform3D, // 4th constructor
// G4LogicalVolume *pCurrentLogical,
// const G4String& pName,
// G4LogicalVolume *pMotherLogical,
// G4bool pMany,
// G4int pCopyNo);
//
// Utilises both variations above (from 2nd and 3rd constructor).
//
// History:
// 24.07.95 P.Kent First non-stub version
// 25.07.96 P.Kent Modified interface for new `Replica' capable geometry
@@ -91,12 +28,12 @@
#define G4PVPLACEMENT_HH
#include "G4VPhysicalVolume.hh"
// class G4Transform3D;
#include "G4Transform3D.hh"
class G4PVPlacement : public G4VPhysicalVolume
{
public:
public: // with description
G4PVPlacement(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String &pName,
@@ -104,6 +41,17 @@ public:
G4VPhysicalVolume *pMother,
G4bool pMany,
G4int pCopyNo);
// Initialise a single volume, positioned in a frame which is rotated by
// *pFrameRot, relative to the coordinate system of the mother volume
// pMother. The center of the object is then placed at volumeCenterCrd
// in the new coordinates.
// If pRot=0 the volume is unrotated with respect to its mother.
// The physical volume is added to the mother's logical volume.
// (The above are exactly the arguments of G4VPhysicalVolume)
// Arguments particular to G4PVPlacement:
// pMany Currently NOT used. For future use to identify if the volume
// is MANY in the GEANT 3 sense, or not.
// pCopyNo should be set to 0 for the first volume of a given type.
G4PVPlacement(const G4Transform3D &Transform3D,
const G4String &pName,
@@ -111,6 +59,17 @@ public:
G4VPhysicalVolume *pMother,
G4bool pMany,
G4int pCopyNo);
// Additional constructor, which expects a G4Transform3D that represents
// the direct rotation and translation of the solid (NOT of the frame).
// The G4Transform3D argument should be constructed by:
// i) First rotating it to align the solid to the system of
// reference of its mother volume *pMother, and
// ii) Then placing the solid at the location Transform3D.getTranslation(),
// with respect to the origin of the system of coordinates of the
// mother volume.
// [ This is useful for the people who prefer to think in terms
// of moving objects in a given reference frame. ]
// All other arguments are the same as for the previous constructor.
G4PVPlacement(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
@@ -119,6 +78,12 @@ public:
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo);
// A simple variation of the 1st constructor, only specifying the
// mother volume as a pointer to its logical volume instead of its
// physical volume. [ This is a very natural way of defining a physical
// volume, and is especially useful when creating subdetectors: the
// mother volumes is not placed until a later stage of the assembly
// program. ]
G4PVPlacement(const G4Transform3D &Transform3D,
G4LogicalVolume *pCurrentLogical,
@@ -126,12 +91,22 @@ public:
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo);
// Utilises both variations above (from 2nd and 3rd constructor).
~G4PVPlacement();
// Default destructor.
virtual G4bool IsMany() const;
virtual G4int GetCopyNo() const;
virtual void SetCopyNo(G4int CopyNo);
// Gets and sets the copy number of the volume.
virtual void Setup(G4VPhysicalVolume *pMother);
// Sets the pointer to the mother volume.
// Must not be called when geometry closed.
public: // without description
virtual G4bool IsMany() const;
virtual G4bool IsReplicated() const;
virtual G4VPVParameterisation* GetParameterisation() const;
virtual void GetReplicationData(EAxis& axis,
@@ -139,16 +114,17 @@ public:
G4double& width,
G4double& offset,
G4bool& consuming) const;
virtual void Setup(G4VPhysicalVolume *pMother);
private:
G4bool fmany; // flag for booleans
private:
G4bool fmany; // flag for booleans/MANY - not used
G4bool fallocatedRotM; // flag for allocation of Rotation Matrix
G4int fcopyNo; // for identification
// Auxiliary function for 2nd constructor (one with G4Transform3D)
// Creates a new RotMatrix on the heap (using "new") and copies
// its argument into it.
static G4RotationMatrix* NewPtrRotMatrix(const G4RotationMatrix &RotMat);
// Auxiliary function for 2nd constructor (one with G4Transform3D).
// Creates a new RotMatrix on the heap (using "new") and copies
// its argument into it.
};
#endif
@@ -5,12 +5,14 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PVReplica.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4PVReplica.hh,v 1.3 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4PVReplica
//
// Class description:
//
// Represents many touchable detector elements differing only in their
// positioning. The elements' positions are calculated by means of a simple
// linear formula, and the elements completely fill the containing mother
@@ -51,7 +53,7 @@
// The replications are `phi sections' or wedges, and of cons/tubs form
// They have phi of offset+n*width to offset+(n+1)*width where
// n=0..nReplicas-1
//
// History:
// 29.07.95 P.Kent First non-stub version
// 26.10.97 J.Apostolakis Added constructor that takes mother logical volume
@@ -65,7 +67,8 @@
class G4PVReplica : public G4VPhysicalVolume
{
public:
public:
G4PVReplica(const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMother,
@@ -95,13 +98,16 @@ public:
G4double& offset,
G4bool& consuming) const;
virtual void Setup(G4VPhysicalVolume *pMother);
private:
private:
void CheckAndSetParameters(
const EAxis pAxis,
const G4int nReplicas,
const G4double width,
const G4double offset);
protected:
protected:
EAxis faxis;
G4int fnReplicas;
G4double fwidth,foffset;
@@ -5,14 +5,16 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicalVolumeStore.hh,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4PhysicalVolumeStore.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4PhysicalVolume
//
// Class description:
//
// Container for all solids, with functionality derived from
// G4RWTPtrOrderedVector<T>. The class is `singleton', in that only
// one can exist, and access is facillitated via
// G4RWTPtrOrderedVector<T>. The class is a `singleton', in that only
// one can exist, and access is provided via the static method
// G4PhysicalVolumeStore::GetInstance()
//
// All solids should be registered with G4PhysicalVolumeStore, and removed on
@@ -22,27 +24,11 @@
// If much additional functionality is added, should consider containment
// instead of inheritance for G4RWTPtrOrderedVector<T>
//
// Class member functions:
//
// static void Register(G4VPhysicalVolume* pVolume)
// Add the volume to the collection
// static void DeRegister(G4VPhysicalVolume* pVolume)
// Remove the volume from the collection
// static G4PhysicalVolumeStore* GetInstance()
// Get a ptr to the unique G4PhysicalVolumeStore, creating it if necessary
//
// Member functions:
//
// [as per RWTPtrOrderedvector]
//
// NOTE: Constructor is protected - creation and subsequent access is via
// GetInstance
//
// Member data:
//
// static G4PhysicalVolumeStore*
// Ptr to the single G4PhysicalVolumeStore
//
// - Ptr to the single G4PhysicalVolumeStore.
// History:
// 25.07.95 P.Kent Initial version
@@ -55,14 +41,25 @@
class G4PhysicalVolumeStore : public G4RWTPtrOrderedVector<G4VPhysicalVolume>
{
public:
public: // with description
static void Register(G4VPhysicalVolume* pSolid);
// Add the volume to the collection.
static void DeRegister(G4VPhysicalVolume* pSolid);
// Remove the volume from the collection.
static G4PhysicalVolumeStore* GetInstance();
// Get a ptr to the unique G4PhysicalVolumeStore,
// creating it if necessary.
virtual ~G4PhysicalVolumeStore();
// Default destructor.
protected:
G4PhysicalVolumeStore();
private:
static G4PhysicalVolumeStore* fgInstance;
};
@@ -5,68 +5,32 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SmartVoxelHeader.hh,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4SmartVoxelHeader.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4SmartVoxelHeader
//
// Represents set of voxels, created by a single axis of virtual division.
// Class description:
//
// Represents a set of voxels, created by a single axis of virtual division.
// Contains the individual voxels, which are potentially further divided
// along different axes
// along different axes.
//
// Member functions:
//
// G4SmartVoxelHeader(G4LogicalVolume* pVolume,const G4int pSlice=0)
// Constructor for topmost header, to begin voxel construction at a
// given logical volume. pSlice is used to set max and min equivalent slice
// nos for the header - they apply to the level of the header, not its nodes.
//
// ~G4SmartVoxelHeader()
// Delete all referenced nodes [but *not* referenced physical volumes]
//
// EAxis GetAxis() const
// Return the current division axis
//
// G4double GetMaxExtent() const
// Return the maximum coordinate limit along the current axis
// G4double GetMinExtent() const
// Return the minimum coordinate limit along the current axis
//
// G4int GetNoSlices() const
// Return the no of slices along the current axis
// G4SmartVoxelProxy* GetSlice(const G4int n) const
// Return ptr to the proxy for the nth slice (numbering from 0, no
// bounds checking)
//
//
// Private functions:
//
// G4SmartVoxelHeader(G4LogicalVolume* pVolume,G4VoxelLimits& pLimits,
// G4RWTValOrderedVector<G4int>& pCandidates,
// const G4int pSlice=0)
// Build and refine voxels between specified limits, considering only
// the physical volumes numbered `pCandidates'. pSlice is used to set max
// and min equivalent slice nos for the header - they apply to the level
// of the header, not its nodes.
//
// extra functions...
// Member data:
//
// EAxis faxis
// The (cartesian) slicing/division axis
// - The (cartesian) slicing/division axis
// G4double fmaxExtent
// G4double fminExtent
// Minimum and maximum coordiantes along the axis
// - Minimum and maximum coordiantes along the axis
// G4RWTPtrOrderedVector<G4SmartVoxelProxy> fslices
// The slices along the axis
// - The slices along the axis
//
// G4int fminEquivalent
// G4int fmaxEquivalent
// Minimum and maximum equivalent slice nos. [Applies to the level of
// the header, not its nodes]
//
// - Minimum and maximum equivalent slice nos.
// [Applies to the level of the header, not its nodes]
// History:
// 13.07.95 P.Kent Initial version
@@ -85,12 +49,13 @@
#include "g4rw/tvvector.h"
#include "g4rw/tpordvec.h"
#include "g4rw/tvordvec.h"
// Forward declarations
class G4LogicalVolume;
class G4VoxelLimits;
class G4VPhysicalVolume;
// Typedefs
typedef G4RWTPtrOrderedVector<G4SmartVoxelProxy> G4ProxyVector;
typedef G4RWTPtrOrderedVector<G4SmartVoxelNode> G4NodeVector;
typedef G4RWTValOrderedVector<G4int> G4VolumeNosVector;
@@ -98,142 +63,126 @@ typedef G4RWTValVector<G4double> G4VolumeExtentVector;
class G4SmartVoxelHeader
{
public:
// Constructor for topmost header, to begin voxel construction at a
// given logical volume
G4SmartVoxelHeader(G4LogicalVolume* pVolume,const G4int pSlice=0);
~G4SmartVoxelHeader();
// Access functions for min/max equivalent slices (nodes & headers)
G4int GetMaxEquivalentSliceNo() const
{
return fmaxEquivalent;
}
void SetMaxEquivalentSliceNo(const G4int pMax)
{
fmaxEquivalent=pMax;
}
G4int GetMinEquivalentSliceNo() const
{
return fminEquivalent;
}
void SetMinEquivalentSliceNo(const G4int pMin)
{
fminEquivalent=pMin;
}
public: // with description
// Axis enquiry
EAxis GetAxis() const
{
return faxis;
}
G4SmartVoxelHeader(G4LogicalVolume* pVolume,const G4int pSlice=0);
// Constructor for topmost header, to begin voxel construction at a
// given logical volume. pSlice is used to set max and min equivalent
// slice nos for the header - they apply to the level of the header,
// not its nodes.
~G4SmartVoxelHeader();
// Delete all referenced nodes [but *not* referenced physical volumes].
// Extent enquiry functions
G4double GetMaxExtent() const
{
return fmaxExtent;
}
G4int GetMaxEquivalentSliceNo() const;
void SetMaxEquivalentSliceNo(const G4int pMax);
G4int GetMinEquivalentSliceNo() const;
void SetMinEquivalentSliceNo(const G4int pMin);
// Access functions for min/max equivalent slices (nodes & headers).
EAxis GetAxis() const;
// Return the current division axis.
G4double GetMinExtent() const
{
return fminExtent;
}
G4double GetMaxExtent() const;
// Return the maximum coordinate limit along the current axis.
G4double GetMinExtent() const;
// Return the minimum coordinate limit along the current axis.
// Slice enquiry functions
G4int GetNoSlices() const
{
return fslices.entries();
}
G4int GetNoSlices() const;
// Return the no of slices along the current axis.
// Slice access
G4SmartVoxelProxy* GetSlice(const G4int n) const
{
return fslices(n);
}
// True if all slices equal (after collection)
G4SmartVoxelProxy* GetSlice(const G4int n) const;
// Return ptr to the proxy for the nth slice (numbering from 0,
// no bounds checking performed).
G4bool AllSlicesEqual() const;
// True if all slices equal (after collection).
public: // without description
G4bool operator == (const G4SmartVoxelHeader& pHead) const;
friend G4std::ostream& operator << (G4std::ostream&s, const G4SmartVoxelHeader& h);
friend G4std::ostream&
operator << (G4std::ostream&s, const G4SmartVoxelHeader& h);
protected:
protected:
G4SmartVoxelHeader(G4LogicalVolume* pVolume,
const G4VoxelLimits& pLimits,
const G4VolumeNosVector* pCandidates,
const G4int pSlice=0);
// Build and refine voxels between specified limits, considering only
// the physical volumes numbered `pCandidates'. pSlice is used to set max
// and min equivalent slice nos for the header - they apply to the level
// of the header, not its nodes.
// `Worker' / operation functions:
// `Worker' / operation functions:
// Build and refine voxels for daughters of specified volume which
// DOES NOT contain a REPLICATED daughter
void BuildVoxels(G4LogicalVolume* pVolume);
// Build and refine voxels for daughters of specified volume which
// DOES NOT contain a REPLICATED daughter.
// Build voxels for specified volume containing a single
// replicated volume
void BuildReplicaVoxels(G4LogicalVolume* pVolume);
// Build voxels for specified volume containing a single
// replicated volume.
// Construct nodes in simple consuming case
void BuildConsumedNodes(const G4int nReplicas);
// Construct nodes in simple consuming case.
// Build and refine voxels between specified limits, considering only
// the physical volumes `pCandidates'. Main entry point for "construction"
// Hardwired to stop at third level of refinement, using the xyz cartesian
// axes in any order
void BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
G4VoxelLimits pLimits,
const G4VolumeNosVector* pCandidates);
// Build and refine voxels between specified limits, considering only
// the physical volumes `pCandidates'. Main entry point for "construction".
// Hardwired to stop at third level of refinement, using the xyz cartesian
// axes in any order.
// Calculate and Store the minimum and maximum equivalent neighbour
// values for all slices
void BuildEquivalentSliceNos();
// Collect common nodes, deleting all but one to save memory, and adjusting
// stored slice ptrs appropriately.
// Calculate and Store the minimum and maximum equivalent neighbour
// values for all slices.
void CollectEquivalentNodes();
// Collect common nodes, deleting all but one to save memory,
// and adjusting stored slice ptrs appropriately.
// Collect common headers, deleting all but one to save memory, and adjusting
// stored slice ptrs appropriately.
void CollectEquivalentHeaders();
// Collect common headers, deleting all but one to save memory,
// and adjusting stored slice ptrs appropriately.
// Build the nodes corresponding to the specified axis, within
// the specified limits, considering the daughters numbered pCandidates
// of the logical volume
G4ProxyVector* BuildNodes(G4LogicalVolume* pVolume,
G4VoxelLimits pLimits,
const G4VolumeNosVector* pCandidates,
EAxis pAxis);
G4ProxyVector* BuildNodes(G4LogicalVolume* pVolume,
G4VoxelLimits pLimits,
const G4VolumeNosVector* pCandidates,
EAxis pAxis);
// Build the nodes corresponding to the specified axis, within
// the specified limits, considering the daughters numbered pCandidates
// of the logical volume.
// Calculate a "quality value" for the specified vector of voxels
// The value returned should be >0 and such that the smaller the
// number the higher the quality of the slice.
//
// pSlice must consist of smartvoxelnodeproxies only
G4double CalculateQuality(G4ProxyVector *pSlice);
// Calculate a "quality value" for the specified vector of voxels
// The value returned should be >0 and such that the smaller the
// number the higher the quality of the slice.
// pSlice must consist of smartvoxelnodeproxies only.
// Examined each contained node, refine (create a replacement additional
// dimension of voxels) when there is more than one voxel in the slice
void RefineNodes(G4LogicalVolume* pVolume,G4VoxelLimits pLimits);
// Examined each contained node, refine (create a replacement additional
// dimension of voxels) when there is more than one voxel in the slice.
// Min and max equivalent slice nos for previous level
G4int fminEquivalent;
G4int fmaxEquivalent;
// Min and max equivalent slice nos for previous level.
// Axis for slices
EAxis faxis;
// Max and min coordinate along faxis
// Axis for slices.
G4double fmaxExtent;
G4double fminExtent;
// Slices along axis
// Max and min coordinate along faxis.
G4ProxyVector fslices;
// Slices along axis.
};
#include "G4SmartVoxelHeader.icc"
#endif
@@ -0,0 +1,67 @@
// 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: G4SmartVoxelHeader.icc,v 1.1 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// G4SmartVoxelHeader Inline implementation
//
inline
G4int G4SmartVoxelHeader::GetMaxEquivalentSliceNo() const
{
return fmaxEquivalent;
}
inline
void G4SmartVoxelHeader::SetMaxEquivalentSliceNo(const G4int pMax)
{
fmaxEquivalent=pMax;
}
inline
G4int G4SmartVoxelHeader::GetMinEquivalentSliceNo() const
{
return fminEquivalent;
}
inline
void G4SmartVoxelHeader::SetMinEquivalentSliceNo(const G4int pMin)
{
fminEquivalent=pMin;
}
inline
EAxis G4SmartVoxelHeader::GetAxis() const
{
return faxis;
}
inline
G4double G4SmartVoxelHeader::GetMaxExtent() const
{
return fmaxExtent;
}
inline
G4double G4SmartVoxelHeader::GetMinExtent() const
{
return fminExtent;
}
inline
G4int G4SmartVoxelHeader::GetNoSlices() const
{
return fslices.entries();
}
inline
G4SmartVoxelProxy* G4SmartVoxelHeader::GetSlice(const G4int n) const
{
return fslices(n);
}
@@ -5,60 +5,27 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SmartVoxelNode.hh,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4SmartVoxelNode.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4SmartVoxelNode
//
// Class description:
//
// A node in the smart voxel hierarchy - a `slice' of space along a given
// axis between given minima and maxima. Note that the node is not aware
// of its position - this information being available/derivable by the
// node's owner(s) (voxelheaders).
//
//
// Member functions:
//
// G4SmartVoxelNode(const G4int pSlice=0)
// Constructor. Create an empty node with slice number pSlice. THis number
// is not stored, but used to provide defaults for the minimum and maximum
// equivalent node numbers
// ~G4SmartVoxelNode()
// Destructor. No actions.
//
// G4RWTValOrderedVector<G4int>* GetContents()
// Return ptr to vector of volume no.s in the node. Use with care.
// Intended for inspection by navigator at tracking time only.
//
// G4int GetVolume(const G4int pVolumeNo) const
// Return the pVolumeNo'th contained volume. Note: Starts from 0,
// no bounds checking.
//
// void Insert(G4int pVolumeNo)
// Add the specified volume no. to the node's contents
//
// G4int GetNoContained() const
// Returns the number of volumes contained
//
// G4int GetMaxEquivalenSliceNo() const
// Return the maximum slice (node/header) no with the same contents, and
// with all intermediate slice also having the same contents
// void SetMaxEquivalentSliceNo(const G4int pMax)
// Set the maximum slice no (as above)
// G4int GetMinEquivalentSliceNo() const
// Return the minimum slice (node/header) no with the same contents, and
// with all intermediate nodes also having the same contents
// void SetMinEquivalentSliceNo(const G4int pMin)
// Set the maximum slice no (as above)
//
// Member Data:
//
// G4int fminEquivalent
// G4int fmaxEquivalent
// Min and maximum nodes with same contents. Set by constructor
// and set methods.
// - Min and maximum nodes with same contents. Set by constructor
// and set methods.
// G4RWTValOrderedVector<G4int>(1) fcontents
// Vector of no.s of volumes inside the node
//
// - Vector of no.s of volumes inside the node.
// History:
// 12.07.95 P.Kent Initial version
@@ -76,66 +43,48 @@ typedef G4RWTValOrderedVector<G4int> G4SliceVector;
class G4SmartVoxelNode
{
public:
public: // with description
// Constructor. Set min and max equivalent nodes to default.
G4SmartVoxelNode(const G4int pSlice=0) : fminEquivalent(pSlice),
fmaxEquivalent(pSlice)
{
}
fmaxEquivalent(pSlice) {}
// Constructor. Create an empty node with slice number pSlice.
// THis number is not stored, but used to provide defaults for the
// minimum and maximum equivalent node numbers.
// Destructor. No actions necessary
~G4SmartVoxelNode()
{
}
~G4SmartVoxelNode() {}
// Destructor. No actions.
// Access functions for contents
G4int GetVolume(const G4int pVolumeNo) const;
// Return contained volume number pVolumeNo.
// Note: starts from 0 and no bounds checking performed.
// Return contained volume no pVolumeNo.
// No bounds checking
void Insert(G4int pVolumeNo);
// Add the specified volume number to the contents.
G4int GetVolume(const G4int pVolumeNo) const
{
return fcontents(pVolumeNo);
}
G4int GetNoContained() const;
// Return the number of volumes inside the node.
// Add the speicifed volume no to the contents
void Insert(G4int pVolumeNo)
{
fcontents.insert(pVolumeNo);
}
// Return the no of volumes inside the node
G4int GetNoContained() const
{
return fcontents.entries();
}
// Access functions for min/max equivalent slices (nodes & headers)
G4int GetMaxEquivalentSliceNo() const
{
return fmaxEquivalent;
}
void SetMaxEquivalentSliceNo(const G4int pMax)
{
fmaxEquivalent=pMax;
}
G4int GetMinEquivalentSliceNo() const
{
return fminEquivalent;
}
void SetMinEquivalentSliceNo(const G4int pMin)
{
fminEquivalent=pMin;
}
G4int GetMaxEquivalentSliceNo() const;
// Return the maximum slice (node/header) number with the same contents,
// and with all intermediate slice also having the same contents.
void SetMaxEquivalentSliceNo(const G4int pMax);
// Set the maximum slice number (as above).
G4int GetMinEquivalentSliceNo() const;
// Return the minimum slice (node/header) number with the same contents,
// and with all intermediate nodes also having the same contents.
void SetMinEquivalentSliceNo(const G4int pMin);
// Set the minimum slice number (as above).
G4bool operator == (const G4SmartVoxelNode& v) const;
private:
// Equality operator.
private:
G4int fminEquivalent;
G4int fmaxEquivalent;
G4SliceVector fcontents;
};
#include "G4SmartVoxelNode.icc"
#endif
@@ -0,0 +1,55 @@
// 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: G4SmartVoxelNode.icc,v 1.1 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// G4SmartVoxelNode Inline implementation
//
inline
G4int G4SmartVoxelNode::GetVolume(const G4int pVolumeNo) const
{
return fcontents(pVolumeNo);
}
inline
void G4SmartVoxelNode::Insert(G4int pVolumeNo)
{
fcontents.insert(pVolumeNo);
}
inline
G4int G4SmartVoxelNode::GetNoContained() const
{
return fcontents.entries();
}
inline
G4int G4SmartVoxelNode::GetMaxEquivalentSliceNo() const
{
return fmaxEquivalent;
}
inline
void G4SmartVoxelNode::SetMaxEquivalentSliceNo(const G4int pMax)
{
fmaxEquivalent=pMax;
}
inline
G4int G4SmartVoxelNode::GetMinEquivalentSliceNo() const
{
return fminEquivalent;
}
inline
void G4SmartVoxelNode::SetMinEquivalentSliceNo(const G4int pMin)
{
fminEquivalent=pMin;
}
@@ -5,39 +5,20 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SmartVoxelProxy.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4SmartVoxelProxy.hh,v 1.3 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4SmartVoxelProxy
//
// Class for proxying smart voxels. The class
// represents either a header (in turn refering to more VoxelProxies)
// or a node. If created as a node, calls to GetHeader cause an exception,
// and likewise GetNode when a header.
// Class description:
//
// Class for proxying smart voxels. The class represents either a header
// (in turn refering to more VoxelProxies) or a node. If created as a node,
// calls to GetHeader cause an exception, and likewise GetNode when a header.
//
// Note that the proxy does NOT gain deletion responsibility for proxied
// objects.
//
// Member functions:
//
// G4SmartVoxelProxy(G4SmartVoxelHeader *pHeader);
// Proxy for the specified header
// G4SmartVoxelProxy(G4SmartVoxelNode *pNode)
// Proxy for the specified node
// G4bool IsHeader() const
// Return true if proxying for a header, else false
// G4bool IsNode() const
// Return true if proxying for a node, else false
// G4SmartVoxelNode* GetNode() const
// Return ptr to proxied node, else call G4Exception
// G4SmartVoxelHeader* GetHeader() const
// Return ptr to proxied header, else call G4Exception
//
//
// operator == (const G4SmartVoxelProxy& v)
// True when objects share same address.
//
// History:
// 12.07.95 P.Kent Initial version
// 03.08.95 P.Kent Updated to become non abstract class, removing
@@ -55,55 +36,41 @@ class G4SmartVoxelHeader;
class G4SmartVoxelProxy
{
public:
public: // with description
G4SmartVoxelProxy(G4SmartVoxelHeader *pHeader)
{
fHeader=pHeader;
fNode=0;
}
: fHeader(pHeader), fNode(0) {}
// Proxy for the specified header.
G4SmartVoxelProxy(G4SmartVoxelNode *pNode)
{
fHeader=0;
fNode=pNode;
}
: fHeader(0), fNode(pNode) {}
// Proxy for the specified node.
// Destructor - do nothing. Not responsible for proxied objects
~G4SmartVoxelProxy() {;}
~G4SmartVoxelProxy() {}
// Destructor - do nothing. Not responsible for proxied objects.
G4bool IsHeader() const
{
return (fHeader) ? true:false;
}
G4bool IsHeader() const;
// Return true if proxying for a header, else false.
G4bool IsNode() const
{
return (fNode) ? true:false;
}
G4SmartVoxelNode* GetNode() const
{
assert(fNode != 0);
return fNode;
}
G4bool IsNode() const;
// Return true if proxying for a node, else false.
G4SmartVoxelHeader* GetHeader() const
{
assert(fHeader != 0);
return fHeader;
}
G4SmartVoxelNode* GetNode() const;
// Return ptr to proxied node, else call G4Exception.
G4bool operator == (const G4SmartVoxelProxy& v) const
{
return (this==&v) ? true : false;
}
G4SmartVoxelHeader* GetHeader() const;
// Return ptr to proxied header, else call G4Exception
G4bool operator == (const G4SmartVoxelProxy& v) const;
// Equality operator.
// True when objects share same address.
private:
private:
G4SmartVoxelNode* fNode;
G4SmartVoxelHeader* fHeader;
};
#include "G4SmartVoxelProxy.icc"
#endif
@@ -0,0 +1,45 @@
// 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: G4SmartVoxelProxy.icc,v 1.1 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// G4SmartVoxelProxy Inline implementation
//
inline
G4bool G4SmartVoxelProxy::IsHeader() const
{
return (fHeader) ? true:false;
}
inline
G4bool G4SmartVoxelProxy::IsNode() const
{
return (fNode) ? true:false;
}
inline
G4SmartVoxelNode* G4SmartVoxelProxy::GetNode() const
{
assert(fNode != 0);
return fNode;
}
inline
G4SmartVoxelHeader* G4SmartVoxelProxy::GetHeader() const
{
assert(fHeader != 0);
return fHeader;
}
inline
G4bool G4SmartVoxelProxy::operator == (const G4SmartVoxelProxy& v) const
{
return (this==&v) ? true : false;
}

Some files were not shown because too many files have changed in this diff Show More