Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
+39 -14
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.14 2000/05/12 15:12:36 gcosmo Exp $
$Id: History,v 1.16 2000/11/20 19:16:37 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,14 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Nov 20, 2000 Gabriele Cosmo geometry-V02-00-00
-----------------------------
- QA code cleanup from Code-Wizard and warnings issued by
"-Wall -ansi -pedantic" g++ compiler options. Includes tags:
geom-solids-csg-V02-00-11, breps-V02-00-03, geom-solid-bool-V02-00-02,
STEP-V02-00-00, stepinterface-V02-00-02, geom-solids-specific-V02-00-04,
field-V02-00-02, geommng-V02-00-04, geomvol-V02-00-01.
May 12, 2000 Gabriele Cosmo geometry-V01-01-03
-----------------------------
- magneticfield (field-V01-01-03):
@@ -98,33 +106,50 @@ Jan 19, 2000 Gabriele Cosmo geometry-V01-00-00
Collecting subtags: field-V01-00-00, geomsolids-V01-00-00,
geommng-V01-00-00 and geomvol-V01-00-00.
Changes are now documented in the individual sub-category History files.
------------------------------------------------------------------------
Nov 10, 99 John Apostolakis geometry-V00-01-01
geomsolids-V00-01-03
which includes the following sub-tags:
geom-solids-csg-01-00-02-cand
geom-solid-bool-V00-01-03b
breps-V00-01-00
stepinterface-V00-01-00
geomvol-01-01-01b
geommng-V00-01-01
field-V00-01-02
===============================================================================
Geant4 1.0 , 1st STL-based release.
===============================================================================
May 21, 98 John Apostolakis geometry-01-00-05
May 21, 99 John Apostolakis geometry-01-00-05
- Tagged.
May 20, 98 S.Giani, S.Magni
May 20, 99 S.Giani, S.Magni
Fixes in BREP Line, & (PCone, FCylindrical/FConical surf) respectively
For more details see solids/BREP/History
Also see changes mentioned in solids/CSG/History for CSG Pcon/Pgon
May 19, 98 Frank Behner
May 19, 99 Frank Behner
Volumes: Further minor fixes for STL.
May 12, 98 John Apostolakis geometry-01-00-04
May 12, 99 John Apostolakis geometry-01-00-04
- Tagged.
May 12, 98 Simone Giani
May 12, 99 Simone Giani
Fixes to G4BREPSolidPolyhedra and G4FPlane.
May 10, 98 Frank Behner
May 10, 99 Frank Behner
Changes in RW use for compatibility with RW/STL in
management/src/G4PhysicalVolumeStore.cc
management/src/G4LogicalVolumeStore.cc
@@ -135,7 +160,7 @@ May 7, 98 John Apostolakis
Changed G4Navigator to issue warning in the case of small inaccuracies
& cause fatal exception only for large deviations.
May 3, 98 John Apostolakis geometry-01-00-03
May 3, 99 John Apostolakis geometry-01-00-03
Minor fixes
In CSG solids: Cons & Tubs minor, and in PCon/PGon
@@ -153,7 +178,7 @@ Apr 15, 99 John Allison
Added -I$(G4BASE)/intercoms/include to BREPS, Boolean abd CSG GNUmakefiles
in preparation for move of G4VGraphicsScene to intercoms.
Mar 19, 98 John Apostolakis geometry-01-00-01
Mar 19, 99 John Apostolakis geometry-01-00-01
Category tag using:
solids: [tag geomsolids-01-00-01]
@@ -161,7 +186,7 @@ Mar 19, 98 John Apostolakis geometry-01-00-01
management: [tag geommng-01-00-02 ]
magneticfield [tag field-01-00-03]
Mar 19, 98 John Apostolakis
Mar 19, 99 John Apostolakis
Summary of significant changes in sub-categories/sub-directories
management: [tag geommng-01-00-02 ]
@@ -169,17 +194,17 @@ Mar 19, 98 John Apostolakis
[.... Add information here .... ? ]
Jan 15, 98 John Apostolakis
Jan 15, 99 John Apostolakis
Fixes in CSG solids (Cons by V.Grichine, CSG Pcone+Pgon by D.C.Williams)
Jan 15, 98 Simone Giani ( rec by JA. )
Jan 15, 99 Simone Giani ( rec by JA. )
Fixes in the creation of Smart Voxels:
Less memory intensive and much more performant at initialisation.
No worse, but a little faster at tracking time. (G4SmartVoxelHeader)
Jan 10, 98 John Apostolakis ( geometry-01-00-01 to be done)
Jan 10, 99 John Apostolakis ( geometry-01-00-01 to be done)
geometry as in geant4-00-patch2
Fixes in BREPs (Pcone, Pgon, ...) see solids/BREPS/History
@@ -1,43 +0,0 @@
// 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: BuildBoxWorld.hh,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef BUILDBOXWORLD_HH
#define BUILDBOXWORLD_HH
#include "G4PVPlacement.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4Material.hh"
G4VPhysicalVolume* BuildBoxWorld()
{
G4double z = 13.;
G4double a = 26.98*g/mole;
G4double density = 2.7*g/cm3;
G4Box *myWorldBox= new G4Box ("WBox",10000,10000,10000);
G4Box *myTargetBox = new G4Box ("TBox",100,200,400);
G4LogicalVolume *myWorldLog=new G4LogicalVolume(myWorldBox,0,
"WLog",0,0,0);
G4LogicalVolume *myTargetLog=new G4LogicalVolume(myTargetBox,0,
"YLog",0,0,0);
G4PVPlacement *myWorldPhys=new G4PVPlacement(0,G4ThreeVector(),
"WPhys",
myWorldLog,
0,false,0);
G4PVPlacement *myTargetPhys=new G4PVPlacement(0,G4ThreeVector(),
"TPhys",
myTargetLog,
myWorldPhys,false,0);
return myWorldPhys;
}
#endif
@@ -1,91 +0,0 @@
// 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: BuildCalorimeter.hh,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef BUILDCALORIMETER_HH
#define BUILDCALORIMETER_HH
#include "G4PVPlacement.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
G4VPhysicalVolume* BuildCalorimeter()
{
G4double offset=22.5,xTlate,yTlate;
G4int i,j,copyNo;
G4double z = 13.;
G4double a = 26.98*g/mole;
G4double density = 2.7*g/cm3;
G4Box *myWorldBox= new G4Box ("WBox",10000,10000,10000);
G4Box *myCalBox = new G4Box ("CBox",1500,1500,1000);
G4Tubs *myTargetTube = new G4Tubs ("TTube",0,22.5,1000,0,360);
G4LogicalVolume *myWorldLog=new G4LogicalVolume(myWorldBox,0,
"WLog",0,0,0);
G4LogicalVolume *myCalLog=new G4LogicalVolume(myCalBox,0,
"CLog",0,0,0);
G4LogicalVolume *myTargetLog=new G4LogicalVolume(myTargetTube,0,
"TLog",0,0,0);
G4PVPlacement *myWorldPhys=new G4PVPlacement(0,G4ThreeVector(),
"WPhys",
myWorldLog,
0,false,0);
G4PVPlacement *myCalPhys=new G4PVPlacement(0,G4ThreeVector(),
"CalPhys",
myCalLog,
myWorldPhys,false,0);
G4String tName1("TPhys1"); // Allow all target physicals to share
// same name (delayed copy)
copyNo=0;
for (j=1;j<=25;j++)
{
yTlate=-1000.0-40.0+j*80.0;
for (i=1;i<=50;i++)
{
copyNo++;
xTlate=-1000.0-20.0+i*45.0-offset;
G4PVPlacement *myTargetPhys=new G4PVPlacement(0,G4ThreeVector(xTlate,yTlate,0),
tName1,
myTargetLog,
myCalPhys,
false,
copyNo);
}
}
G4String tName2("TPhys2"); // Allow all target physicals to share
// same name (delayed copy)
copyNo=0;
for (j=1;j<=26;j++)
{
yTlate=-1000.0-80.0+j*80.0;
for (i=1;i<=50;i++)
{
copyNo++;
xTlate=-1000.0-20.0+i*45.0;
G4PVPlacement *myTargetPhys=new G4PVPlacement(0,G4ThreeVector(xTlate,yTlate,0),
tName2,
myTargetLog,
myCalPhys,
false,
copyNo);
}
}
return myWorldPhys;
}
#endif
-38
View File
@@ -1,38 +0,0 @@
# $Id: GNUmakefile,v 1.2 2000/02/29 09:46:21 gcosmo Exp $
# ----------------------------------------------------------------
# Makes test program in environment variable G4TARGET.
# ----------------------------------------------------------------
ifndef G4TARGET
G4TARGET := $(TESTTARGET)
endif
ifndef G4INSTALL
G4INSTALL = ../../..
endif
G4EXEC_BUILD = true
include $(G4INSTALL)/config/architecture.gmk
# Override some variables for binmake.gmk.
#
INCFLAGS := -I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/solids/CSG/include \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/graphics_reps/include
LDLIBS := \
-lG4csg \
-lG4volumes \
-lG4magneticfield \
-lG4geometrymng \
-lG4materials \
-lG4graphics_reps \
-lG4globman
include $(G4INSTALL)/config/binmake.gmk
-83
View File
@@ -1,83 +0,0 @@
// 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: Shoot.hh,v 1.3 2000/02/29 09:45:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef SHOOT_HH
#define SHOOT_HH
#include "G4Timer.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Navigator.hh"
#include "G4ThreeVector.hh"
#include "G4ios.hh"
void Shoot(const G4int numShoot,
G4VPhysicalVolume *pTopNode,
const G4ThreeVector& pSource,
const G4ThreeVector& pVec)
{
const G4double physStep=kInfinity;
G4int i;
G4double safety,Step;
G4Navigator myNav;
G4Timer timer;
G4ThreeVector partLoc;
G4VPhysicalVolume *located;
myNav.SetWorldVolume(pTopNode);
timer.Start();
for (i=numShoot;i>0;i--)
{
partLoc=pSource;
located=myNav.LocateGlobalPointAndSetup(partLoc,false);
while (located)
{
Step=myNav.ComputeStep(partLoc,pVec,physStep,safety);
partLoc+=Step*pVec;
myNav.SetGeometricallyLimitedStep();
located=myNav.LocateGlobalPointAndSetup(partLoc);
};
}
timer.Stop();
G4cout << "Shots = " << numShoot << " " << timer << G4endl;
}
void ShootVerbose(G4VPhysicalVolume *pTopNode,
const G4ThreeVector& pSource,
const G4ThreeVector& pVec)
{
const G4double physStep=kInfinity;
G4double safety,Step;
G4Navigator myNav;
G4ThreeVector partLoc;
G4VPhysicalVolume *located=0;
myNav.SetWorldVolume(pTopNode);
partLoc=pSource;
located=myNav.LocateGlobalPointAndSetup(partLoc);
while (located)
{
Step=myNav.ComputeStep(partLoc,pVec,physStep,safety);
G4cout << "Physical Location=" << located->GetName()
<< " #" << located->GetCopyNo() << G4endl
<< " Step=" << Step << " Safety=" << safety
<< " ---->" << G4endl;
partLoc+=Step*pVec;
myNav.SetGeometricallyLimitedStep();
located=myNav.LocateGlobalPointAndSetup(partLoc);
};
}
#endif
-102
View File
@@ -1,102 +0,0 @@
// 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: calorimeter.cc,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// calorimeter
//
// World consisting of CSoC '95 tube calorimeter
// For comparison against F77 case. Toggle optimisation with 0/1
// on command line. Default - optimisation ON
#include "G4ios.hh"
#include <stdlib.h>
#include <math.h>
#include "G4GeometryManager.hh"
#include "BuildCalorimeter.hh"
#include "Shoot.hh"
#include "G4Timer.hh"
#include "globals.hh"
#include "geomdefs.hh"
const G4int numShoot = 10000;
const G4bool optimise= true;
int main()
{
G4ThreeVector origin(0,0,0),pMX(-500,0,0);
G4ThreeVector vx(1,0,0);
G4ThreeVector vy(0,1,0);
G4ThreeVector vxy(1/sqrt(2.0),1/sqrt(2.0),0);
G4VPhysicalVolume *myTopNode;
G4Timer timer;
G4cout << " Calorimeter Performance Test - P.Kent 21.08.95" << G4endl
<< "Using calorimeter from CERN School of Computing '95" << G4endl;
#ifndef NDEBUG
G4cout << "WARNING: *** ASSERTs are compiled IN ***" << G4endl;
#endif
myTopNode=BuildCalorimeter(); // Build the geometry
timer.Start();
G4GeometryManager::GetInstance()->CloseGeometry(optimise);
timer.Stop();
if (optimise)
{
G4cout << "Optimisation ON";
}
else
{
G4cout << "Optimisation OFF";
}
G4cout << " Geometry close took " << timer << G4endl;
#ifdef G4GEOMETRY_VERBOSE
G4cout << G4endl << "Voxels for:"
<< G4LogicalVolumeStore::GetInstance()->at(1)->GetName() << G4endl
<< *G4LogicalVolumeStore::GetInstance()->at(1)->GetVoxelHeader()
<< G4endl;
#endif
G4SmartVoxelHeader* top=G4LogicalVolumeStore::GetInstance()
->at(1)->GetVoxelHeader();
if (top)
{
G4cout << "1st level voxels along ";
switch (top->GetAxis())
{
case kXAxis:
G4cout << "X" << G4endl;
break;
case kYAxis:
G4cout << "Y" << G4endl;
break;
case kZAxis:
G4cout << "Z" << G4endl;
break;
}
}
G4cout << G4endl << "Shooting from " << origin << " along " << vx << G4endl;
ShootVerbose(myTopNode,origin,vx);
Shoot(numShoot,myTopNode,origin,vx);
G4cout << G4endl << "Shooting from " << origin << " along " << vy << G4endl;
ShootVerbose(myTopNode,origin,vy);
Shoot(numShoot,myTopNode,origin,vy);
G4cout << G4endl << "Shooting from " << origin << " along " << vxy << G4endl;
ShootVerbose(myTopNode,origin,vxy);
Shoot(numShoot,myTopNode,origin,vxy);
G4GeometryManager::GetInstance()->OpenGeometry();
return EXIT_SUCCESS;
}
@@ -1,439 +0,0 @@
// 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: G4Box.cc,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Implementation for G4Box class
//
#include "G4Box.hh"
//#include "G4VoxelLimits.hh"
//#include "G4Transform.hh"
//#ifdef G4VISUALIZE
//#include "G4VWindow.hh"
//#include "G4Polyline.hh"
//#endif
#include <math.h>
// Private (implementation) enum: Not for external use
// Codes for faces (kPX=plus x face,kMY= minus y face etc)
enum ESide {kPX,kMX,kPY,kMY,kPZ,kMZ};
// Constructor - check & set half widths
G4Box::G4Box(const G4double pX,
const G4double pY,
const G4double pZ)
{
fDx=pX; fDy=pY; fDz=pZ;
}
// Return whether point inside/outside/on surface, using tolerance
EInside G4Box::Inside(const G4ThreeVector& p) const
{
EInside in=kOutside;
if (fabs(p.x())<=fDx-kCarTolerance*0.5)
{
if (fabs(p.y())<=fDy-kCarTolerance*0.5)
{
if (fabs(p.z())<=fDz-kCarTolerance*0.5)
{
in=kInside;
}
else if (fabs(p.z())<=fDz+kCarTolerance*0.5)
{
in=kSurface;
}
}
else if (fabs(p.y())<=fDy+kCarTolerance*0.5)
{
if (fabs(p.z())<=fDz+kCarTolerance*0.5)
{
in=kSurface;
}
}
}
else if (fabs(p.x())<=fDx+kCarTolerance*0.5)
{
if (fabs(p.y())<=fDy+kCarTolerance*0.5)
{
if (fabs(p.z())<=fDz+kCarTolerance*0.5)
{
in=kSurface;
}
}
}
return in;
}
// Calculate side nearest to p, and return normal
// If two sides are equidistant, normal of first side (x/y/z)
// encountered returned
G4ThreeVector G4Box::SurfaceNormal( const G4ThreeVector& p) const
{
G4double distx,disty,distz;
G4ThreeVector norm;
// Calculate distances as if in 1st octant
distx=fabs(fabs(p.x())-fDx);
disty=fabs(fabs(p.y())-fDy);
distz=fabs(fabs(p.z())-fDz);
if (distx<=disty)
{
if (distx<=distz)
{
// Closest to X
if (p.x()<0) norm=G4ThreeVector(-1.0,0,0);
else norm=G4ThreeVector(1.0,0,0);
}
else
{
// Closest to Z
if (p.z()<0) norm=G4ThreeVector(0,0,-1.0);
else norm=G4ThreeVector(0,0,1.0);
}
}
else
{
if (disty<=distz)
{
// Closest to Y
if (p.y()<0) norm=G4ThreeVector(0,-1.0,0);
else norm=G4ThreeVector(0,1.0,0);
}
else
{
// Closest to Z
if (p.z()<0) norm=G4ThreeVector(0,0,-1.0);
else norm=G4ThreeVector(0,0,1.0);
}
}
return norm;
}
// Calculate distance to box from an outside point
// - return kInfinity if no intersection.
//
// ALGORITHM:
//
// Check that if point lies outside x/y/z extent of box, travel is towards
// the box (ie. there is a possiblity of an intersection)
//
// Calculate pairs of minimum and maximum distances for x/y/z travel for
// intersection with the box's x/y/z extent.
// If there is a valid intersection, it is given by the maximum min distance
// (ie. distance to satisfy x/y/z intersections) *if* <= minimum max distance
// (ie. distance after which 1+ of x/y/z intersections not satisfied)
//
// NOTE:
//
// `Inside' safe - meaningful answers given if point is inside the exact
// shape.
G4double G4Box::DistanceToIn(const G4ThreeVector& p,const G4ThreeVector& v) const
{
G4double safx,safy,safz;
G4double smin,sminy,sminz;
G4double smax,smaxy,smaxz;
G4double stmp;
safx=fabs(p.x())-fDx; // minimum distance to x surface of shape
safy=fabs(p.y())-fDy;
safz=fabs(p.z())-fDz;
// Will we intersect?
// If safx/y/z is >-tol/2 the point is outside/on the box's x/y/z extent.
// If both p.x/y/z and v.x/y/z repectively are both positive/negative,
// travel is in a direction away from the shape.
if ( ((p.x()*v.x()>=0.0) && safx>-kCarTolerance*0.5)
|| ((p.y()*v.y()>=0.0) && safy>-kCarTolerance*0.5)
|| ((p.z()*v.z()>=0.0) && safz>-kCarTolerance*0.5)) return kInfinity;
// Compute min / max distances for x/y/z travel:
// X Planes
if (v.x())
{
stmp=1.0/fabs(v.x());
smin=safx*stmp;
smax=(fDx+fabs(p.x()))*stmp;
}
else
{
if (safx<=0.0)
{
smin=0.0;
smax=kInfinity;
}
else
{
return kInfinity; // Travel parallel
}
}
// Y Planes
if (v.y())
{
stmp=1.0/fabs(v.y());
sminy=safy*stmp;
smaxy=(fDy+fabs(p.y()))*stmp;
if (sminy>smin) smin=sminy;
if (smaxy<smax) smax=smaxy;
if (smin>smax) return kInfinity;
}
else
{
if (safy>0.0)
{
return kInfinity; // Travel parallel
}
}
// Z planes
if (v.z())
{
stmp=1.0/fabs(v.z());
sminz=safz*stmp;
smaxz=(fDz+fabs(p.z()))*stmp;
if (sminz>smin) smin=sminz;
if (smaxz<smax) smax=smaxz;
if (smin>smax) return kInfinity;
}
else
{
if (safz>0.0)
{
return kInfinity; // Travel parallel
}
}
if (smin<0)
{
return 0.0;
}
return smin;
}
// Appoximate distance to box.
// Returns largest perpendicular distance to the closest x/y/z sides of
// the box.
// - If inside return 0
G4double G4Box::DistanceToIn(const G4ThreeVector& p) const
{
G4double safex,safey,safez,safe=0.0;
safex=fabs(p.x())-fDx;
safey=fabs(p.y())-fDy;
safez=fabs(p.z())-fDz;
if (safex>safe) safe=safex;
if (safey>safe) safe=safey;
if (safez>safe) safe=safez;
return safe;
}
// Calcluate distance to surface of box from inside
// by calculating distances to box's x/y/z planes.
// Smallest distance is exact distance to exiting.
// - Eliminate one side of each pair by considering direction of v
// - when leaving a surface & v.close, return 0
G4double G4Box::DistanceToOut(const G4ThreeVector& p,const G4ThreeVector& v,
const G4bool calcNorm,
G4bool *validNorm,G4ThreeVector *n) const
{
ESide side;
G4double pdist,stmp,snxt;
if (calcNorm) *validNorm=true; // All normals are valid
if (v.x()>0)
{
pdist=fDx-p.x();
if (pdist>kCarTolerance*0.5)
{
snxt=pdist/v.x();
side=kPX;
}
else
{
if (calcNorm)
{
*n=G4ThreeVector(1,0,0);
}
return snxt=0;
}
}
else if (v.x()<0)
{
pdist=fDx+p.x();
if (pdist>kCarTolerance*0.5)
{
snxt=-pdist/v.x();
side=kMX;
}
else
{
if (calcNorm)
{
*n=G4ThreeVector(-1,0,0);
}
return snxt=0;
}
}
else
{
snxt=kInfinity;
}
if (v.y()>0)
{
pdist=fDy-p.y();
if (pdist>kCarTolerance*0.5)
{
stmp=pdist/v.y();
if (stmp<snxt)
{
snxt=stmp;
side=kPY;
}
}
else
{
if (calcNorm)
{
*n=G4ThreeVector(0,1,0);
}
return snxt=0;
}
}
else if (v.y()<0)
{
pdist=fDy+p.y();
if (pdist>kCarTolerance*0.5)
{
stmp=-pdist/v.y();
if (stmp<snxt)
{
snxt=stmp;
side=kMY;
}
}
else
{
if (calcNorm)
{
*n=G4ThreeVector(0,-1,0);
}
return snxt=0;
}
}
if (v.z()>0)
{
pdist=fDz-p.z();
if (pdist>kCarTolerance*0.5)
{
stmp=pdist/v.z();
if (stmp<snxt)
{
snxt=stmp;
side=kPZ;
}
}
else
{
if (calcNorm)
{
*n=G4ThreeVector(0,0,1);
}
return snxt=0;
}
}
else if (v.z()<0)
{
pdist=fDz+p.z();
if (pdist>kCarTolerance*0.5)
{
stmp=-pdist/v.z();
if (stmp<snxt)
{
snxt=stmp;
side=kMZ;
}
}
else
{
if (calcNorm)
{
*n=G4ThreeVector(0,0,-1);
}
return snxt=0;
}
}
if (calcNorm)
{
switch (side)
{
case kPX:
*n=G4ThreeVector(1,0,0);
break;
case kMX:
*n=G4ThreeVector(-1,0,0);
break;
case kPY:
*n=G4ThreeVector(0,1,0);
break;
case kMY:
*n=G4ThreeVector(0,-1,0);
break;
case kPZ:
*n=G4ThreeVector(0,0,1);
break;
case kMZ:
*n=G4ThreeVector(0,0,-1);
break;
}
}
return snxt;
}
// Calculate exact shortest distance to any boundary from inside
// - If outside return 0
G4double G4Box::DistanceToOut(const G4ThreeVector& p) const
{
G4double safx1,safx2,safy1,safy2,safz1,safz2,safe;
safx1=fDx-p.x();
safx2=fDx+p.x();
safy1=fDy-p.y();
safy2=fDy+p.y();
safz1=fDz-p.z();
safz2=fDz+p.z();
// shortest Dist to any boundary now MIN(safx1,safx2,safy1..)
if (safx2<safx1) safe=safx2;
else safe=safx1;
if (safy1<safe) safe=safy1;
if (safy2<safe) safe=safy2;
if (safz1<safe) safe=safz1;
if (safz2<safe) safe=safz2;
if (safe<0) safe=0;
return safe;
}
@@ -1,93 +0,0 @@
// 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: G4Box.hh,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4Box
//
// A Box is a cuboid of given half lengths dx,dy,dz. The Box is
// centred on the origin with sides parallel to the x/y/z axes.
//
// Member functions:
//
// As inherited from G4VSolid +
//
// G4Box(const G4String& pName,const G4double pX,
// const G4double pY,const G4double pZ)
// Construct a box with name, and half lengths pX,pY,pZ
//
// G4double GetXHalfLength() const
// G4double GetYHalfLength() const
// G4double GetZHalfLength() const
//
// Return the respective parameter
//
// Protected:
//
// G4ThreeVectorList*
// CreateRotatedVertices(const G4Transform& pTransform) const
//
// Create the List of transformed vertices in the format required
// for G4VSolid:: ClipCrossSection and ClipBetweenSections.
//
// Member Data:
//
// fDx,fDy,fDz - The box's half-widths
//
// History:
// 30.06.95 P.Kent Converted from source code developed end 94
// 18.07.95 J.Allison Added virtual function Wireframe.
// 31.07.95 J.Allison Added virtual function DispatchWireframe.
#ifndef G4BOX_HH
#define G4BOX_HH
#include "G4ThreeVector.hh"
class G4Box
{
public:
G4Box(const G4double pX,
const G4double pY,const G4double pZ);
// Access functions
G4double GetXHalfLength() const
{
return fDx;
}
G4double GetYHalfLength() const
{
return fDy;
}
G4double GetZHalfLength() const
{
return fDz;
}
EInside Inside(const G4ThreeVector& p) const;
G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
G4double DistanceToIn(const G4ThreeVector& p,const G4ThreeVector& v) const;
G4double DistanceToIn(const G4ThreeVector& p) const;
G4double DistanceToOut(const G4ThreeVector& p,const G4ThreeVector& v,
const G4bool calcNorm=false,
G4bool *validNorm=0,G4ThreeVector *n=0) const;
G4double DistanceToOut(const G4ThreeVector& p) const;
protected:
G4double fDx,fDy,fDz;
};
#endif
@@ -1,445 +0,0 @@
// 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: G4Box_fastfabs.cc,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Implementation for G4Box class
//
#include "G4Box.hh"
//#include "G4VoxelLimits.hh"
//#include "G4Transform.hh"
//#ifdef G4VISUALIZE
//#include "G4VWindow.hh"
//#include "G4Polyline.hh"
//#endif
//#include <math.h>
inline G4double fastfabs(const G4double p)
{
return (p>=0) ? p : -p ;
}
// Private (implementation) enum: Not for external use
// Codes for faces (kPX=plus x face,kMY= minus y face etc)
enum ESide {kPX,kMX,kPY,kMY,kPZ,kMZ};
// Constructor - check & set half widths
G4Box::G4Box(const G4double pX,
const G4double pY,
const G4double pZ)
{
fDx=pX; fDy=pY; fDz=pZ;
}
// Return whether point inside/outside/on surface, using tolerance
EInside G4Box::Inside(const G4ThreeVector& p) const
{
EInside in=kOutside;
if (fastfabs(p.x())<=fDx-kCarTolerance*0.5)
{
if (fastfabs(p.y())<=fDy-kCarTolerance*0.5)
{
if (fastfabs(p.z())<=fDz-kCarTolerance*0.5)
{
in=kInside;
}
else if (fastfabs(p.z())<=fDz+kCarTolerance*0.5)
{
in=kSurface;
}
}
else if (fastfabs(p.y())<=fDy+kCarTolerance*0.5)
{
if (fastfabs(p.z())<=fDz+kCarTolerance*0.5)
{
in=kSurface;
}
}
}
else if (fastfabs(p.x())<=fDx+kCarTolerance*0.5)
{
if (fastfabs(p.y())<=fDy+kCarTolerance*0.5)
{
if (fastfabs(p.z())<=fDz+kCarTolerance*0.5)
{
in=kSurface;
}
}
}
return in;
}
// Calculate side nearest to p, and return normal
// If two sides are equidistant, normal of first side (x/y/z)
// encountered returned
G4ThreeVector G4Box::SurfaceNormal( const G4ThreeVector& p) const
{
G4double distx,disty,distz;
G4ThreeVector norm;
// Calculate distances as if in 1st octant
distx=fastfabs(fastfabs(p.x())-fDx);
disty=fastfabs(fastfabs(p.y())-fDy);
distz=fastfabs(fastfabs(p.z())-fDz);
if (distx<=disty)
{
if (distx<=distz)
{
// Closest to X
if (p.x()<0) norm=G4ThreeVector(-1.0,0,0);
else norm=G4ThreeVector(1.0,0,0);
}
else
{
// Closest to Z
if (p.z()<0) norm=G4ThreeVector(0,0,-1.0);
else norm=G4ThreeVector(0,0,1.0);
}
}
else
{
if (disty<=distz)
{
// Closest to Y
if (p.y()<0) norm=G4ThreeVector(0,-1.0,0);
else norm=G4ThreeVector(0,1.0,0);
}
else
{
// Closest to Z
if (p.z()<0) norm=G4ThreeVector(0,0,-1.0);
else norm=G4ThreeVector(0,0,1.0);
}
}
return norm;
}
// Calculate distance to box from an outside point
// - return kInfinity if no intersection.
//
// ALGORITHM:
//
// Check that if point lies outside x/y/z extent of box, travel is towards
// the box (ie. there is a possiblity of an intersection)
//
// Calculate pairs of minimum and maximum distances for x/y/z travel for
// intersection with the box's x/y/z extent.
// If there is a valid intersection, it is given by the maximum min distance
// (ie. distance to satisfy x/y/z intersections) *if* <= minimum max distance
// (ie. distance after which 1+ of x/y/z intersections not satisfied)
//
// NOTE:
//
// `Inside' safe - meaningful answers given if point is inside the exact
// shape.
G4double G4Box::DistanceToIn(const G4ThreeVector& p,const G4ThreeVector& v) const
{
G4double safx,safy,safz;
G4double smin,sminy,sminz;
G4double smax,smaxy,smaxz;
G4double stmp;
safx=fastfabs(p.x())-fDx; // minimum distance to x surface of shape
safy=fastfabs(p.y())-fDy;
safz=fastfabs(p.z())-fDz;
// Will we intersect?
// If safx/y/z is >-tol/2 the point is outside/on the box's x/y/z extent.
// If both p.x/y/z and v.x/y/z repectively are both positive/negative,
// travel is in a direction away from the shape.
if ( ((p.x()*v.x()>=0.0) && safx>-kCarTolerance*0.5)
|| ((p.y()*v.y()>=0.0) && safy>-kCarTolerance*0.5)
|| ((p.z()*v.z()>=0.0) && safz>-kCarTolerance*0.5)) return kInfinity;
// Compute min / max distances for x/y/z travel:
// X Planes
if (v.x())
{
stmp=1.0/fastfabs(v.x());
smin=safx*stmp;
smax=(fDx+fastfabs(p.x()))*stmp;
}
else
{
if (safx<=0.0)
{
smin=0.0;
smax=kInfinity;
}
else
{
return kInfinity; // Travel parallel
}
}
// Y Planes
if (v.y())
{
stmp=1.0/fastfabs(v.y());
sminy=safy*stmp;
smaxy=(fDy+fastfabs(p.y()))*stmp;
if (sminy>smin) smin=sminy;
if (smaxy<smax) smax=smaxy;
if (smin>smax) return kInfinity;
}
else
{
if (safy>0.0)
{
return kInfinity; // Travel parallel
}
}
// Z planes
if (v.z())
{
stmp=1.0/fastfabs(v.z());
sminz=safz*stmp;
smaxz=(fDz+fastfabs(p.z()))*stmp;
if (sminz>smin) smin=sminz;
if (smaxz<smax) smax=smaxz;
if (smin>smax) return kInfinity;
}
else
{
if (safz>0.0)
{
return kInfinity; // Travel parallel
}
}
if (smin<0)
{
return 0.0;
}
return smin;
}
// Appoximate distance to box.
// Returns largest perpendicular distance to the closest x/y/z sides of
// the box.
// - If inside return 0
G4double G4Box::DistanceToIn(const G4ThreeVector& p) const
{
G4double safex,safey,safez,safe=0.0;
safex=fastfabs(p.x())-fDx;
safey=fastfabs(p.y())-fDy;
safez=fastfabs(p.z())-fDz;
if (safex>safe) safe=safex;
if (safey>safe) safe=safey;
if (safez>safe) safe=safez;
return safe;
}
// Calcluate distance to surface of box from inside
// by calculating distances to box's x/y/z planes.
// Smallest distance is exact distance to exiting.
// - Eliminate one side of each pair by considering direction of v
// - when leaving a surface & v.close, return 0
G4double G4Box::DistanceToOut(const G4ThreeVector& p,const G4ThreeVector& v,
const G4bool calcNorm,
G4bool *validNorm,G4ThreeVector *n) const
{
ESide side;
G4double pdist,stmp,snxt;
if (calcNorm) *validNorm=true; // All normals are valid
if (v.x()>0)
{
pdist=fDx-p.x();
if (pdist>kCarTolerance*0.5)
{
snxt=pdist/v.x();
side=kPX;
}
else
{
if (calcNorm)
{
*n=G4ThreeVector(1,0,0);
}
return snxt=0;
}
}
else if (v.x()<0)
{
pdist=fDx+p.x();
if (pdist>kCarTolerance*0.5)
{
snxt=-pdist/v.x();
side=kMX;
}
else
{
if (calcNorm)
{
*n=G4ThreeVector(-1,0,0);
}
return snxt=0;
}
}
else
{
snxt=kInfinity;
}
if (v.y()>0)
{
pdist=fDy-p.y();
if (pdist>kCarTolerance*0.5)
{
stmp=pdist/v.y();
if (stmp<snxt)
{
snxt=stmp;
side=kPY;
}
}
else
{
if (calcNorm)
{
*n=G4ThreeVector(0,1,0);
}
return snxt=0;
}
}
else if (v.y()<0)
{
pdist=fDy+p.y();
if (pdist>kCarTolerance*0.5)
{
stmp=-pdist/v.y();
if (stmp<snxt)
{
snxt=stmp;
side=kMY;
}
}
else
{
if (calcNorm)
{
*n=G4ThreeVector(0,-1,0);
}
return snxt=0;
}
}
if (v.z()>0)
{
pdist=fDz-p.z();
if (pdist>kCarTolerance*0.5)
{
stmp=pdist/v.z();
if (stmp<snxt)
{
snxt=stmp;
side=kPZ;
}
}
else
{
if (calcNorm)
{
*n=G4ThreeVector(0,0,1);
}
return snxt=0;
}
}
else if (v.z()<0)
{
pdist=fDz+p.z();
if (pdist>kCarTolerance*0.5)
{
stmp=-pdist/v.z();
if (stmp<snxt)
{
snxt=stmp;
side=kMZ;
}
}
else
{
if (calcNorm)
{
*n=G4ThreeVector(0,0,-1);
}
return snxt=0;
}
}
if (calcNorm)
{
switch (side)
{
case kPX:
*n=G4ThreeVector(1,0,0);
break;
case kMX:
*n=G4ThreeVector(-1,0,0);
break;
case kPY:
*n=G4ThreeVector(0,1,0);
break;
case kMY:
*n=G4ThreeVector(0,-1,0);
break;
case kPZ:
*n=G4ThreeVector(0,0,1);
break;
case kMZ:
*n=G4ThreeVector(0,0,-1);
break;
}
}
return snxt;
}
// Calculate exact shortest distance to any boundary from inside
// - If outside return 0
G4double G4Box::DistanceToOut(const G4ThreeVector& p) const
{
G4double safx1,safx2,safy1,safy2,safz1,safz2,safe;
safx1=fDx-p.x();
safx2=fDx+p.x();
safy1=fDy-p.y();
safy2=fDy+p.y();
safz1=fDz-p.z();
safz2=fDz+p.z();
// shortest Dist to any boundary now MIN(safx1,safx2,safy1..)
if (safx2<safx1) safe=safx2;
else safe=safx1;
if (safy1<safe) safe=safy1;
if (safy2<safe) safe=safy2;
if (safz1<safe) safe=safz1;
if (safz2<safe) safe=safz2;
if (safe<0) safe=0;
return safe;
}
@@ -1,112 +0,0 @@
// 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: G4RotationMatrix.hh,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Rotation Matrix class, converted from CLHEP:
// Author: Leif Lonnblad
// History:
// 30.11.94 P.Kent: Added phiX/thetaX (etc) + IsIdentity functions
#ifndef G4ROTATIONMATRIX_HH
#define G4ROTATIONMATRIX_HH
#include "globals.hh"
//#include "G4ThreeVector.hh"
class G4ThreeVector;
class G4RotationMatrix {
public:
// Default constructor. Gives a unit matrix.
inline G4RotationMatrix()
: xx(1.0), xy(0.0), xz(0.0),
yx(0.0), yy(1.0), yz(0.0),
zx(0.0), zy(0.0), zz(1.0)
{;}
// Copy constructor.
inline G4RotationMatrix(const G4RotationMatrix & m)
: xx(m.xx), xy(m.xy), xz(m.xz),
yx(m.yx), yy(m.yy), yz(m.yz),
zx(m.zx), zy(m.zy), zz(m.zz)
{;}
inline G4RotationMatrix & operator = (const G4RotationMatrix & m);
// Assignment.
inline G4bool operator == (const G4RotationMatrix &m) const;
// Comparison
inline G4ThreeVector operator * (const G4ThreeVector &) const;
// Multiplication with a d3Vector
G4RotationMatrix operator * (const G4RotationMatrix &) const;
inline G4RotationMatrix & operator *= (const G4RotationMatrix &);
inline G4RotationMatrix & transform(const G4RotationMatrix &);
// Matrix multiplication.
// Note a *= b; <=> a = a * b; while a.transform(b); <=> a = b * a;
inline G4RotationMatrix inverse() const;
// Returns the inverse.
inline G4RotationMatrix & invert();
// Inverts the Rotation matrix
G4RotationMatrix & rotateX(double);
// Rotation around the x-axis.
G4RotationMatrix & rotateY(double);
// Rotation around the y-axis.
G4RotationMatrix & rotateZ(double);
// Rotation around the z-axis.
G4RotationMatrix & rotate(double angle, const G4ThreeVector & axis);
inline G4RotationMatrix & rotate(double angle, const G4ThreeVector * axis);
// Rotation around a specified vector.
// Function to return angles (RADS) made by rotated axes against original axes
inline double phiX() const;
inline double phiY() const;
inline double phiZ() const;
inline double thetaX() const;
inline double thetaY() const;
inline double thetaZ() const;
inline G4bool isIdentity() const;
// IsIdentity function returns true if identity matrix
protected:
inline G4RotationMatrix(double, double, double, double, double,
double, double, double, double);
// Protected constructor;.
G4double xx, xy, xz, yx, yy, yz, zx, zy, zz;
// The matrix elements.
};
#include "G4ThreeVector.hh"
#include "G4RotationMatrix.icc"
#endif
@@ -1,138 +0,0 @@
// 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: G4RotationMatrix.icc,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// Inline functions for class G4RotationMatrix
// Converted from CLHEP:
// Author: Leif Lonnblad
//
// History:
// 30.11.94 P.Kent
inline G4RotationMatrix & G4RotationMatrix::operator = (const G4RotationMatrix & m) {
xx = m.xx;
xy = m.xy;
xz = m.xz;
yx = m.yx;
yy = m.yy;
yz = m.yz;
zx = m.zx;
zy = m.zy;
zz = m.zz;
return *this;
}
inline G4bool G4RotationMatrix::operator == (const G4RotationMatrix& m) const
{
return ( (xx == m.xx)
&&(xy == m.xy)
&&(xz == m.xz)
&&(yx == m.yx)
&&(yy == m.yy)
&&(yz == m.yz)
&&(zx == m.zx)
&&(zy == m.zy)
&&(zz == m.zz) ) ? true : false;
}
inline G4ThreeVector G4RotationMatrix::operator * (const G4ThreeVector & p) const {
return G4ThreeVector(xx*p.x() + xy*p.y() + xz*p.z(),
yx*p.x() + yy*p.y() + yz*p.z(),
zx*p.x() + zy*p.y() + zz*p.z());
}
inline G4RotationMatrix & G4RotationMatrix::operator *= (const G4RotationMatrix & m) {
return *this = operator * (m);
}
inline G4RotationMatrix & G4RotationMatrix::transform(const G4RotationMatrix & m) {
return *this = m.operator * (*this);
}
inline G4RotationMatrix G4RotationMatrix::inverse() const {
G4RotationMatrix m(xx, yx, zx, xy, yy, zy, xz, yz, zz);
return m;
}
inline G4RotationMatrix & G4RotationMatrix::invert() {
return *this=inverse();
}
inline G4RotationMatrix & G4RotationMatrix::rotate(double psi, const G4ThreeVector * p) {
return rotate(psi, *p);
}
inline G4RotationMatrix::G4RotationMatrix(double mxx, double mxy, double mxz,
double myx, double myy, double myz,
double mzx, double mzy, double mzz)
: xx(mxx), xy(mxy), xz(mxz), yx(myx), yy(myy), yz(myz),
zx(mzx), zy(mzy), zz(mzz) {}
inline double G4RotationMatrix::phiX() const
{
double radang;
if (yx) radang=atan2(yx,xx);
else radang=0.0;
return radang;
}
inline double G4RotationMatrix::phiY() const
{
double radang;
if (yy) radang=atan2(yy,xy);
else radang=0.0;
return radang;
}
inline double G4RotationMatrix::phiZ() const
{
double radang;
if (yz) radang=atan2(yz,xz);
else radang=0.0;
return radang;
}
inline double G4RotationMatrix::thetaX() const
{
// double zang=xz;
// if (zang>=1.0) return 0;
// else if (zang <=1.0) return 180.0;
// else return acos(zang);
return acos(xz);
}
inline double G4RotationMatrix::thetaY() const
{
//Angs should always be <1.0 && >-1.0
// double zang=yz;
// if (zang>=1.0) return 0;
// else if (zang <=1.0) return 180.0;
// else return acos(zang);
return acos(yz);
}
inline double G4RotationMatrix::thetaZ() const
{
//Angs should always be <1.0 && >-1.0
// double zang=zz;
// if (zang>=1.0) return 0;
// else if (zang <=1.0) return 180.0;
// else return acos(zang);
return acos(zz);
}
// Return zero if identity, else non-zero
// Does not use `fuzzy' check - must be exactly identity
inline G4bool G4RotationMatrix::isIdentity() const
{
return (xx==1.0 && xy==0.0 && xz==0.0 &&
yx==0.0 && yy==1.0 && yz==0.0 &&
zx==0.0 && zy==0.0 && zz==1.0 ) ? true : false;
}
@@ -1,161 +0,0 @@
// 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: G4ThreeVector.hh,v 1.3 1999/12/15 17:17:14 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ThreeVector class, converted from CLHEP:
// Authors: Leif Lonnblad and Anders Nilsson.
//
// History:
// 30.06.95 P.Kent
#ifndef G4THREEVECTOR_HH
#define G4THREEVECTOR_HH
#include "globals.hh"
#include "geomdefs.hh"
#include "g4std/iostream"
class G4ThreeVector {
friend class G4RotationMatrix;
public:
// The Constructors
inline G4ThreeVector(G4double x = 0.0, G4double y = 0.0, G4double z = 0.0)
: dx(x), dy(y), dz(z)
{;}
inline G4ThreeVector(const G4ThreeVector & p)
: dx(p.dx), dy(p.dy), dz(p.dz)
{;}
// the x, y and z components.
inline G4double x() const
{
return dx;
}
inline G4double y() const
{
return dy;
}
inline G4double z() const
{
return dz;
}
// Assignment.
inline G4ThreeVector & operator = (const G4ThreeVector & p)
{
dx = p.x();
dy = p.y();
dz = p.z();
return *this;
}
inline G4bool operator==(const G4ThreeVector& v) const;
// Test for equality
inline G4ThreeVector & operator += (const G4ThreeVector &);
// Addition.
inline G4ThreeVector & operator -= (const G4ThreeVector &);
// Subtraction operator.
inline G4ThreeVector operator - () const;
// Unary minus.
inline G4ThreeVector & operator *= (G4double);
// Operators for scaling with real numbers.
inline G4double dot(const G4ThreeVector &) const;
// Scalar product.
inline G4ThreeVector cross(const G4ThreeVector &) const;
// Cross product.
inline G4double operator () (const EAxis) const;
// Component access
inline G4ThreeVector unit() const;
// the unit vector parallel to this
inline G4double mag2() const;
// the Magnitude squared.
inline G4double mag() const;
// the magnutude.
inline G4double perp2() const;
// The transverse component squared.
inline G4double perp() const;
// The transverse component.
inline G4double perp2(const G4ThreeVector &) const;
// The transverse component wrt. given axis squared.
inline G4double perp(const G4ThreeVector &) const;
// The transverse component wrt. given axis.
inline G4double phi() const;
// The azimuth angle.
inline G4double theta() const;
// The polar angle.
inline G4double cosTheta() const;
// Cosine of the polar angle.
inline G4double angle(const G4ThreeVector &) const;
// The angle w.r.t. another 3-vector.
inline G4ThreeVector & operator *= (const G4RotationMatrix &);
inline G4ThreeVector & transform(const G4RotationMatrix &);
// Transformation with a Rotation matrix.
void rotateX(G4double);
// Rotates the G4ThreeVector around the x-axis.
void rotateY(G4double);
// Rotates the G4ThreeVector around the y-axis.
void rotateZ(G4double);
// Rotates the G4ThreeVector around the z-axis.
void rotate(G4double, const G4ThreeVector &);
// Rotates around the axis specified by another G4ThreeVector.
protected:
inline void setX(G4double);
inline void setY(G4double);
inline void setZ(G4double);
// Set the x, y and z components.
private:
G4double dx, dy, dz;
// The components.
};
G4std::ostream & operator << (G4std::ostream &, const G4ThreeVector &);
// output to a stream
#include "G4ThreeVector.icc"
// Inline functions
#endif
@@ -1,177 +0,0 @@
// 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: G4ThreeVector.icc,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Inline functions for class G4ThreeVector
// Converted from CLHEP:
// Authors: Leif Lonnblad and Anders Nilsson.
//
// History:
// 30.06.95 P.Kent
#include <math.h>
#include <assert.h>
#include "G4RotationMatrix.hh"
inline G4bool G4ThreeVector::operator == (const G4ThreeVector& v) const
{
return (v.x()==x()&&v.y()==y()&&v.z()==z()) ? true : false;
}
inline G4ThreeVector& G4ThreeVector::operator += (const G4ThreeVector & p) {
dx += p.x();
dy += p.y();
dz += p.z();
return *this;
}
inline G4ThreeVector& G4ThreeVector::operator -= (const G4ThreeVector & p) {
dx -= p.x();
dy -= p.y();
dz -= p.z();
return *this;
}
inline G4ThreeVector G4ThreeVector::operator - () const {
G4ThreeVector q(-dx, -dy, -dz);
return q;
}
inline G4ThreeVector& G4ThreeVector::operator *= (G4double a) {
dx *= a;
dy *= a;
dz *= a;
return *this;
}
inline G4ThreeVector & G4ThreeVector::operator *= (const G4RotationMatrix & m){
*this = m * (*this);
return *this;
}
inline G4ThreeVector & G4ThreeVector::transform(const G4RotationMatrix & m) {
*this = m * (*this);
return *this;
}
inline G4double G4ThreeVector::dot(const G4ThreeVector & p) const {
return dx*p.x() + dy*p.y() + dz*p.z();
}
inline G4ThreeVector G4ThreeVector::cross(const G4ThreeVector & p) const {
G4ThreeVector q(dy*p.z() - p.y()*dz, dz*p.x() - p.z()*dx, dx*p.y() - p.x()*dy);
return q;
}
inline G4double G4ThreeVector::operator () (const EAxis p) const
{
if (p==kXAxis)
{
return dx;
}
else if (p==kYAxis)
{
return dy;
}
else
{
assert(p==kZAxis);
return dz;
}
}
inline G4double G4ThreeVector::mag2() const {
return dx*dx + dy*dy + dz*dz;
}
inline G4double G4ThreeVector::mag() const {
return sqrt(mag2());
}
inline G4ThreeVector G4ThreeVector::unit() const {
G4double tot = dx*dx+dy*dy+dz*dz;
G4ThreeVector p(*this);
// If 0 Magnitude, return same vector (null)
return tot >0.0 ? p*=(1.0/sqrt(tot)) : p;
}
inline G4double G4ThreeVector::perp2() const {
return dx*dx + dy*dy;
}
inline G4double G4ThreeVector::perp() const {
return sqrt(perp2());
}
inline G4double G4ThreeVector::perp2(const G4ThreeVector & p) const {
G4double tot = p.mag2();
// return tot > 0.0 ? mag2()-sqr(dot(p))/tot : mag2();
return tot > 0.0 ? mag2()-(dot(p))*(dot(p))/tot : mag2();
}
inline G4double G4ThreeVector::perp(const G4ThreeVector & p) const {
return sqrt(perp2(p));
}
inline G4double G4ThreeVector::phi() const {
return dx == 0.0 && dy == 0.0 ? 0.0 : atan2(dy,dx);
}
inline G4double G4ThreeVector::theta() const {
return dx == 0.0 && dy == 0.0 && dz == 0.0 ? 0.0 : atan2(perp(),dz);
}
inline G4double G4ThreeVector::cosTheta() const {
G4double ptot = mag();
return ptot == 0.0 ? 1.0 : dz/ptot;
}
inline G4double G4ThreeVector::angle(const G4ThreeVector & q) const {
G4double ptot2 = mag2()*q.mag2();
return ptot2 <= 0.0 ? 0.0 : acos(dot(q)/sqrt(ptot2));
}
inline void G4ThreeVector::setX(G4double x) {
dx = x;
}
inline void G4ThreeVector::setY(G4double y) {
dy = y;
}
inline void G4ThreeVector::setZ(G4double z) {
dz = z;
}
inline G4ThreeVector operator + (const G4ThreeVector & a, const G4ThreeVector & b) {
G4ThreeVector p(a.x() + b.x(), a.y() + b.y(), a.z() + b.z());
return p;
}
inline G4ThreeVector operator - (const G4ThreeVector & a, const G4ThreeVector & b) {
G4ThreeVector p(a.x() - b.x(), a.y() - b.y(), a.z() - b.z());
return p;
}
inline G4ThreeVector operator * (const G4ThreeVector & p, G4double a) {
G4ThreeVector q(a*p.x(), a*p.y(), a*p.z());
return q;
}
inline G4ThreeVector operator * (G4double a, const G4ThreeVector & p) {
G4ThreeVector q(a*p.x(), a*p.y(), a*p.z());
return q;
}
inline G4double operator * (const G4ThreeVector & a, const G4ThreeVector & b) {
return a.dot(b);
}
@@ -1,47 +0,0 @@
#
# Build stand-alone DistanceToIn tests for AIX
#
# boxtoinf77.aix - gnobox.f test
# boxtoincpp.aix - DistanceToIn test [note: calls not virtual - modified
# G4Box.hh/.cc]
# boxtoincpp.aix_fastfabs - DistanceToIn test, with `custom' inline fabs
# [actually slower than boxtoincpp.aix on SP2]
all: boxtoinf77.aix boxtoincpp.aix boxtoincpp.aix_fastfabs
boxtoinf77.aix: boxtoinf77.o gnobox.o
xlf -O3 -o boxtoinf77.aix boxtoinf77.o gnobox.o
boxtoinf77.o: boxtoinf77.f
xlf -c -O3 boxtoinf77.f
gnobox.o: gnobox.f
xlf -c -O3 gnobox.f
boxtoincpp.aix: boxtoincpp.o G4Box.o
xlC -+ -O3 -o boxtoincpp.aix boxtoincpp.o G4Box.o -lm
boxtoincpp.aix_fastfabs: boxtoincpp.o G4Box_fastfabs.o
xlC -+ -O3 -o boxtoincpp.aix_fastfabs boxtoincpp.o G4Box_fastfabs.o -lm
boxtoincpp.o: boxtoincpp.cc
xlC -+ -O3 -c boxtoincpp.cc
G4Box.o: G4Box.cc
xlC -+ -O3 -c G4Box.cc
G4Box_fastfabs.o: G4Box_fastfabs.cc
xlC -+ -O3 -c G4Box_fastfabs.cc
clean:
rm -f *.o boxtoinf77.aix boxtoincpp.aix boxtoincpp.aix_fastfabs
@@ -1,39 +0,0 @@
#
# Build stand-alone DistanceToIn tests for HP
#
# boxtoinf77.hp - gnobox.f test
# boxtoincpp.hp - DistanceToIn test [note: calls not virtual - modified
# G4Box.hh/.cc]
# boxtoincpp.hp_fastfabs - DistanceToIn test, with `custom' inline fabs
#
all: boxtoinf77.hp boxtoincpp.hp boxtoincpp.hp_fastfabs
boxtoinf77.hp: boxtoinf77.o gnobox.o
f77 +O3 -o boxtoinf77.hp boxtoinf77.o gnobox.o
boxtoinf77.o: boxtoinf77.f
f77 -c +O3 boxtoinf77.f
gnobox.o: gnobox.f
f77 -c +O3 gnobox.f
boxtoincpp.hp: boxtoincpp.o G4Box.o
CC +O3 -o boxtoincpp.hp boxtoincpp.o G4Box.o -Wl,-a,archive -DNDEBUG -lm
boxtoincpp.hp_fastfabs: boxtoincpp.o G4Box_fastfabs.o
CC +O3 -o boxtoincpp.hp_fastfabs boxtoincpp.o G4Box_fastfabs.o -Wl,-a,archive -DNDEBUG -lm
boxtoincpp.o: boxtoincpp.cc
CC +O3 -c boxtoincpp.cc
G4Box.o: G4Box.cc
CC +O3 -c G4Box.cc
G4Box_fastfabs.o: G4Box_fastfabs.cc
CC +O3 -c G4Box_fastfabs.cc
clean:
rm -f *.o boxtoinf77.hp boxtoincpp.hp boxtoincpp.hp_fastfabs
@@ -1,39 +0,0 @@
// 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: boxtoincpp.cc,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4ios.hh"
#include "G4Box.hh"
#include "G4ThreeVector.hh"
const G4int norept=1000000;
void main()
{
G4int i;
G4double snxt,total=0;
G4ThreeVector endpt,startpt(-500,0,0),dir(1,0,0);
G4Box testbox(100,200,400);
for (i=1;i<=norept;i++)
{
snxt=testbox.DistanceToIn(startpt,dir);
endpt=G4ThreeVector(startpt.x()+snxt*dir.x(),
startpt.y()+snxt*dir.y(),
startpt.z()+snxt*dir.z());
total=total+endpt.x()+endpt.y()+endpt.z();
}
if ((!total)&&(!endpt.x())&&(!endpt.y())&&(!endpt.z()))
{
G4cout << "total=0";
}
return;
}
@@ -1,51 +0,0 @@
// 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: geomdefs.hh,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// Constants, typedefs, enums for Geometry Section
//
// History:
// 30.06.95 P.Kent
#ifndef GEOMDEFS_HH
#define GEOMDEFS_HH
#include "globals.hh"
// `Infinity' - Distance returned for no intersection etc.
const G4double kInfinity = 9E99;
// Thickness of shapes for Inside function / tracking.
// Should be greater than largest math error from the shape
// distance calculation routines.
// Tolerance is centred on surface: Inside routine uses a
// tolerance dx +/- kTol/2
// Note: values not `tuned', and because of approximations kRadtolerance and
// kAngTolerance may not always be used as an exact radius
const G4double kCarTolerance = 1E-9;
const G4double kRadTolerance = 1E-9;
const G4double kAngTolerance = 1E-9;
// Define axes for function params etc.
// X/Y/ZAxis = Normal Catesian axes
// Radial2D = Radial axis in cylindrical polar
// Radial3D = Radial axis in spherical polar
enum EAxis {kXAxis,kYAxis,kZAxis,kRadial2D,kRadial3D};
// VShape::Inside routine return codes
// kSurface => within tolerance of exact surface
enum EInside {kOutside,kSurface,kInside};
#endif
@@ -1,49 +0,0 @@
// 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: globals.hh,v 1.3 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// Global Constants and typedefs
//
// History:
// 30.06.95 P.Kent
#ifndef GLOBALS_HH
#define GLOBALS_HH
// Typedefs for numeric types
// [NOTE: Will in future need to be made more sophisticated]
typedef double G4double;
typedef float G4float;
typedef long G4long;
typedef int G4int;
// Typedefs to decouple from library classes
//#include <rw/cstring.h>
//typedef G4String G4String;
// Boolean - define G4_HAVE_BOOL if bool type available
#ifdef G4_HAVE_BOOL
typedef bool G4bool;
#else
typedef int G4bool;
const int false = 0;
const int true = 1;
//enum G4bool {false = 0, true = 1};
#endif
// Global error function
//void G4Exception(const char* s=0);
#endif
-136
View File
@@ -1,136 +0,0 @@
// 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: replicaCal.cc,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//
// Replicated geometry performance test - ~calorimeter with end caps. Main
// calorimeter block is replicated (divided) in r & z.
// Toggle optimisation with 0/1 on command line. Default - optimisation ON
#include "G4ios.hh"
#include <stdlib.h>
#include <math.h>
#include "G4GeometryManager.hh"
#include "Shoot.hh"
#include "G4Timer.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4LogicalVolume.hh"
#include "G4Tubs.hh"
const G4int numShoot = 10000;
const G4bool optimise= true;
const G4double x0=1.12343*cm;
G4VPhysicalVolume* BuildReplicaCal(G4Material* Air)
{
G4double xr=x0/4;
G4int nr=20;
G4int nl=20;
G4double r1=20*xr,r2=21*xr,z1=10*x0,z2=11*x0;
// Container
G4Tubs *ecalTube=new G4Tubs("ECAL",0,r2,z2,0,360*deg);
// End cap
G4Tubs *leakTube=new G4Tubs("LEAK",0,r2,0.5*x0,0,360*deg);
// Wrapper
G4Tubs *latrTube=new G4Tubs("LATR",r1,r2,z1,0,360*deg);
// Main calorimeter block
G4Tubs *blocTube=new G4Tubs("BLOC",0,r1,z1,0,360*deg);
G4Tubs *blocTubeR=new G4Tubs("BLOCR",0,r1/nr,z1,0,360*deg);
G4Tubs *blocTubeRZ=new G4Tubs("BLOCRZ",0,r1/nr,z1/nl,0,360*deg);
G4double zc=0.5*(z1+z2);
G4LogicalVolume *ecalLog=new G4LogicalVolume(ecalTube,Air,
"ecalLog",0,0,0);
G4LogicalVolume *leakLog=new G4LogicalVolume(leakTube,Air,
"leakLog",0,0,0);
G4LogicalVolume *latrLog=new G4LogicalVolume(latrTube,Air,
"latrLog",0,0,0);
G4LogicalVolume *blocLog=new G4LogicalVolume(blocTube,Air,
"blocLog",0,0,0);
G4LogicalVolume *blocRLog=new G4LogicalVolume(blocTubeR,Air,
"blocRLog",0,0,0);
G4LogicalVolume *blocRZLog=new G4LogicalVolume(blocTubeRZ,Air,
"blocRZLog",0,0,0);
G4PVPlacement *ecalPhys=new G4PVPlacement(0,G4ThreeVector(),
"ecalPhys",
ecalLog,
0,false,0);
// Position end caps, wrapper and calorimeter bloc within ecal
G4PVPlacement *leakPhys=new G4PVPlacement(0,G4ThreeVector(0,0,-zc),
"leakPhys",
leakLog,
ecalPhys,false,0);
G4PVPlacement *leakPhys2=new G4PVPlacement(0,G4ThreeVector(0,0,zc),
"leakPhys",
leakLog,
ecalPhys,false,1);
G4PVPlacement *latrPhys=new G4PVPlacement(0,G4ThreeVector(),
"latrPhys",
latrLog,
ecalPhys,false,0);
G4PVPlacement *blocPhys=new G4PVPlacement(0,G4ThreeVector(),
"blocPhys",
blocLog,
ecalPhys,false,0);
// Create replicas
G4PVReplica *blocPhysR=new G4PVReplica("blocRepR",
blocRLog,blocPhys,
kRho,nr,r1/nr,0);
G4PVReplica *blocPhysRZ=new G4PVReplica("blocRepRZ",
blocRZLog,blocPhysR,
kZAxis,nl,2*z1/nl);
return ecalPhys;
}
int main()
{
G4ThreeVector pos(0,0,-10*x0+0.01*cm);
G4double phi=M_PI*0.5,theta=15*deg;
G4ThreeVector dir(cos(phi)*sin(theta),sin(phi)*sin(theta),cos(theta));
G4VPhysicalVolume *myTopNode;
G4Timer timer;
G4cout << " Replication Performance Test - P.Kent 26.09.96" << G4endl;
#ifndef NDEBUG
G4cout << "WARNING: *** ASSERTs are compiled IN ***" << G4endl;
#endif
myTopNode=BuildReplicaCal(NULL); // Build the geometry
timer.Start();
G4GeometryManager::GetInstance()->CloseGeometry(optimise);
timer.Stop();
if (optimise)
{
G4cout << "Optimisation ON";
}
else
{
G4cout << "Optimisation OFF";
}
G4cout << " Geometry close took " << timer << G4endl;
G4cout << G4endl << "Shooting from " << pos << " along " << dir << G4endl;
ShootVerbose(myTopNode,pos,dir);
Shoot(numShoot,myTopNode,pos,dir);
G4GeometryManager::GetInstance()->OpenGeometry();
return EXIT_SUCCESS;
}
-55
View File
@@ -1,55 +0,0 @@
// 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: shooter.cc,v 1.2 1999/12/15 14:49:45 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// shooter - perform test shots through simple box world.
//
// World consisting of single box positioned inside large box world
// For comparison against F77 case. No voxels involved
#include "G4ios.hh"
#include <stdlib.h>
#include "G4GeometryManager.hh"
#include "BuildBoxWorld.hh"
#include "Shoot.hh"
const G4int numShoot = 10000;
int main()
{
G4ThreeVector origin(0,0,0),pMX(-500,0,0);
G4ThreeVector vx(1,0,0);
G4ThreeVector vy(0,1,0);
G4VPhysicalVolume *myTopNode;
G4cout << "Simple BoxWorld Performance Test - P.Kent 21.08.95" << G4endl;
#ifndef NDEBUG
G4cout << "WARNING: *** ASSERTs are compiled IN ***" << G4endl;
#endif
myTopNode=BuildBoxWorld(); // Build the geometry
G4GeometryManager::GetInstance()->CloseGeometry();
G4cout << G4endl << "Shooting from " << origin << " along " << vx << G4endl;
ShootVerbose(myTopNode,origin,vx);
Shoot(numShoot,myTopNode,origin,vx);
G4cout << G4endl << "Shooting from " << origin << " along " << vy << G4endl;
ShootVerbose(myTopNode,origin,vy);
Shoot(numShoot,myTopNode,origin,vy);
G4cout << G4endl << "Shooting from " << pMX << " along " << vx << G4endl;
ShootVerbose(myTopNode,pMX,vx);
Shoot(numShoot,myTopNode,pMX,vx);
G4GeometryManager::GetInstance()->OpenGeometry();
return EXIT_SUCCESS;
}
+37 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.21 2000/05/12 13:57:53 gcosmo Exp $
$Id: History,v 1.24 2000/11/20 17:29:03 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,42 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Nov 20th, 2000 G. Cosmo - field-V02-00-02
- Fixes to remove warnings from "-Wall -ansi -pedantic" g++ compiler options:
o commented out variables declared and not used.
o fixed declaration of variables used before being initialised.
o fixed order of initialisation of member data in constructors.
o fixed usage of unsigned-int (size_t) for array indeces.
Nov 9th, 2000 G. Cosmo - field-V02-00-01
- G4FieldManager: added check on existence of allocated fChordFinder
in CreateChordFinder(G4MagneticField*) method.
Nov 1st, 2000 G. Cosmo - field-V02-00-00
- QA code revision and cleanup (+fixes from CodeWizard filtering):
o Added (private) declarations of copy constructor and assignment operator
where needed.
o Added "const" qualifier to accessor methods, wherever needed.
o Added equality check on operator= where needed.
o Made destructor "virtual" for classes having virtual methods,
wherever missing.
o Changed virtual functions to non-inline wherever's the case.
o Changed return value to be "const" pointer to functions:
- G4EquationOfMotion::GetFieldObj()
- G4FieldManager::GetDetectorField()
- G4MagIntegratorDriver::GetStepper()
o Fixed and corrected signature to G4MagIntegratorDriver::SetHmin().
o Added "inline" qualifier to methods' declarations.
o General cosmetics
Jun 2nd, 2000 J. Apostolakis
- G4FieldManager[.hh.icc]
o Added DeltaIntersection and DeltaOneStep to FieldManager: added
Get/Set methods and SetAccuraciesWithDeltaOneStep().
May 11th, 2000 J. Apostolakis - field-V01-01-02
- G4ChordFinder[.hh.cc]
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4CashKarpRKF45.hh,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4CashKarpRKF45.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4CashKarpRKF45
@@ -28,7 +28,7 @@
#include "G4MagIntegratorStepper.hh"
class G4CashKarpRKF45: public G4MagIntegratorStepper
class G4CashKarpRKF45 : public G4MagIntegratorStepper
{
public: // with description
@@ -38,13 +38,13 @@ class G4CashKarpRKF45: public G4MagIntegratorStepper
void Stepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double h,
G4double yout[],
G4double yerr[] ) ;
void StepWithEst( const G4double yIn[],
const G4double dydx[],
const G4double Step,
G4double Step,
G4double yOut[],
G4double& alpha2,
G4double& beta2,
@@ -55,7 +55,13 @@ class G4CashKarpRKF45: public G4MagIntegratorStepper
G4double DistChord() const = 0 ; // This is not IMPLEMENTED yet.
// It must be done before it can work.
G4int IntegratorOrder() { return 4 ; };
G4int IntegratorOrder() const { return 4; }
private:
G4CashKarpRKF45(const G4CashKarpRKF45&);
G4CashKarpRKF45& operator=(const G4CashKarpRKF45&);
// Private copy constructor and assignment operator.
private:
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ChordFinder.hh,v 1.4 2000/05/11 14:47:00 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4ChordFinder.hh,v 1.5 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4ChordFinder
@@ -45,8 +45,8 @@ class G4ChordFinder
G4double AdvanceChordLimited( G4FieldTrack& yCurrent,
const G4double stepInitial,
const G4double epsStep_Relative );
G4double stepInitial,
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.
@@ -54,34 +54,40 @@ class G4ChordFinder
G4FieldTrack ApproxCurvePointV(const G4FieldTrack& curveAPointVelocity,
const G4FieldTrack& curveBPointVelocity,
const G4ThreeVector& currentEPoint,
const G4double epsStep);
G4double epsStep);
G4double GetDeltaChord();
void SetDeltaChord( G4double newval);
inline G4double GetDeltaChord() const;
inline void SetDeltaChord(G4double newval);
void SetChargeMomentumMass( const G4double pCharge, // in e+ units
const G4double pMomentum,
const G4double pMass );
inline void SetChargeMomentumMass(G4double pCharge, // in e+ units
G4double pMomentum,
G4double pMass );
// Function to inform integration driver of charge, speed.
void SetIntegrationDriver(G4MagInt_Driver* IntegrationDriver);
G4MagInt_Driver* GetIntegrationDriver();
inline void SetIntegrationDriver(G4MagInt_Driver* IntegrationDriver);
inline G4MagInt_Driver* GetIntegrationDriver();
// Access and set Driver.
protected: // .........................................................
G4bool AcceptableMissDist(G4double dChordStep);
inline G4bool AcceptableMissDist(G4double dChordStep) const;
G4double NewStep( const G4double stepTrialOld,
const G4double dChordStep, // Current dchord estimate
G4double& stepEstimate_Unconstrained ) ;
G4double NewStep( G4double stepTrialOld,
G4double dChordStep, // Current dchord estimate
G4double& stepEstimate_Unconstrained ) ;
G4double FindNextChord( const G4FieldTrack yStart,
const G4double stepMax,
G4double stepMax,
G4FieldTrack& yEnd,
G4double& dyErr, // Error of endpoint
G4double epsStep );
private: // ............................................................
G4ChordFinder(const G4ChordFinder&);
G4ChordFinder& operator=(const G4ChordFinder&);
// Private copy constructor and assignment operator.
private: // ............................................................
// G4int nOK, nBAD;
G4MagInt_Driver* fIntgrDriver;
@@ -5,8 +5,8 @@
// 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 $
// $Id: G4ChordFinder.icc,v 1.2 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// G4ChordFinder inline implementations
//
@@ -33,21 +33,21 @@ G4MagInt_Driver* G4ChordFinder::GetIntegrationDriver()
}
inline
G4bool G4ChordFinder::AcceptableMissDist(G4double dChordStep)
G4bool G4ChordFinder::AcceptableMissDist(G4double dChordStep) const
{
return (dChordStep <= fDeltaChord) ;
}
inline
void G4ChordFinder::SetChargeMomentumMass(const G4double pCharge, // in e+ units
const G4double pMomentum,
const G4double pMass)
void G4ChordFinder::SetChargeMomentumMass(G4double pCharge, // in e+ units
G4double pMomentum,
G4double pMass)
{
fIntgrDriver-> SetChargeMomentumMass(pCharge, pMomentum, pMass);
}
inline
G4double G4ChordFinder::GetDeltaChord()
G4double G4ChordFinder::GetDeltaChord() const
{
return fDeltaChord;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ClassicalRK4.hh,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4ClassicalRK4.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4ClassicalRK4
@@ -36,8 +36,8 @@ class G4ClassicalRK4 : public G4MagErrorStepper
void DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[]) ;
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
@@ -50,16 +50,22 @@ class G4ClassicalRK4 : public G4MagErrorStepper
void StepWithEst( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double h,
G4double yOut[],
G4double& alpha2,
G4double& beta2,
const G4double B1[],
G4double B2[] );
G4double B2[] );
// Could make above G4SixPoint to keep tangents too ...?
G4int IntegratorOrder() { return 4; };
G4int IntegratorOrder() const { return 4; }
private:
G4ClassicalRK4(const G4ClassicalRK4&);
G4ClassicalRK4& operator=(const G4ClassicalRK4&);
// Private copy constructor and assignment operator.
private:
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ElectroMagneticField.hh,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4ElectroMagneticField.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4ElectroMagneticField
@@ -32,19 +32,21 @@ class G4ElectroMagneticField : public G4MagneticField
G4ElectroMagneticField() {;}
virtual ~G4ElectroMagneticField() {;}
G4ElectroMagneticField(const G4ElectroMagneticField &p) {;}
G4ElectroMagneticField& operator = (const G4ElectroMagneticField &p);
G4ElectroMagneticField(const G4ElectroMagneticField &) {;}
G4ElectroMagneticField& operator = (const G4ElectroMagneticField &);
// Copy constructor & assignment operators.
virtual void GetFieldValue( const double Point[3],
double *Bfield ) const = 0;
virtual void GetFieldValue(const G4double Point[3],
G4double *Bfield ) const = 0;
};
// Inline implementations
inline G4ElectroMagneticField&
inline
G4ElectroMagneticField&
G4ElectroMagneticField::operator = (const G4ElectroMagneticField &p)
{
if (&p == this) return *this;
*this = p; return *this;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4EqMagElectricField.hh,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4EqMagElectricField.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4EqMagElectricField
@@ -34,13 +34,13 @@ class G4EqMagElectricField : public G4Mag_EqRhs
~G4EqMagElectricField() {;}
void SetChargeMomentumMass( const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double mass);
void SetChargeMomentumMass(G4double particleCharge, // in e+ units
G4double MomentumXc,
G4double mass);
void EvaluateRhsGivenB( const G4double y[],
const G4double Field[],
G4double dydx[] ) const;
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.
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4EquationOfMotion.hh,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4EquationOfMotion.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4EquationOfMotion
@@ -42,10 +42,9 @@ class G4EquationOfMotion
// This is the _only_ function a subclass must define.
// The other two functions use Rhs_givenB.
virtual void SetChargeMomentumMass(
const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double MassXc2) = 0;
virtual void SetChargeMomentumMass(G4double particleCharge, // in e+ units
G4double MomentumXc,
G4double MassXc2) = 0;
// Set the charge, momentum and mass of the current particle
// --> used to set the equation's coefficients ...
@@ -67,8 +66,8 @@ class G4EquationOfMotion
// 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);
const G4Field* GetFieldObj() const;
void SetFieldObj(G4Field* pField);
private:
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4EquationOfMotion.icc,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4EquationOfMotion.icc,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// Inline implementation
@@ -18,11 +18,7 @@ G4EquationOfMotion::G4EquationOfMotion(G4Field* pField)
{}
inline
G4EquationOfMotion::~G4EquationOfMotion()
{}
inline
G4Field* G4EquationOfMotion::GetFieldObj()
const G4Field* G4EquationOfMotion::GetFieldObj() const
{
return itsField;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ExplicitEuler.hh,v 1.3 2000/04/27 09:14:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4ExplicitEuler.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4ExplicitEuler
@@ -35,12 +35,12 @@ class G4ExplicitEuler : public G4MagErrorStepper
void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double h,
G4double yout[]);
public: // without description
G4int IntegratorOrder() { return 1; };
G4int IntegratorOrder() const { return 1; }
private:
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Field.hh,v 1.3 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4Field.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4Field
@@ -29,8 +29,8 @@ class G4Field
virtual void GetFieldValue( const double Point[3],
double *Bfield ) const = 0;
G4Field(){};
virtual ~G4Field(){};
G4Field(){;}
virtual ~G4Field(){;}
// A field signature function that can be used to insure
// that the Equation of motion object and the G4Field object
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FieldManager.hh,v 1.3 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4FieldManager.hh,v 1.5 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4FieldManager
@@ -35,6 +35,9 @@
// 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.
//
// Our current design envisions that one Field manager is
// valid for each region detector.
// History:
// - 10.03.97 John Apostolakis, design and implementation.
@@ -54,13 +57,34 @@ class G4FieldManager
G4FieldManager(G4MagneticField *detectorField);
~G4FieldManager();
G4bool SetDetectorField(G4Field *detectorField);
G4Field* GetDetectorField();
G4bool DoesFieldExist();
inline G4bool SetDetectorField(G4Field *detectorField);
inline const G4Field* GetDetectorField() const;
inline G4bool DoesFieldExist() const;
void CreateChordFinder(G4MagneticField *detectorMagField);
void SetChordFinder(G4ChordFinder *aChordFinder);
G4ChordFinder* GetChordFinder();
inline void SetChordFinder(G4ChordFinder *aChordFinder);
inline G4ChordFinder* GetChordFinder();
public: // without description
inline G4double GetDeltaIntersection() const;
// Accuracy for boundary intersection.
inline G4double GetDeltaOneStep() const;
// Accuracy for one tracking/physics step.
inline void SetAccuraciesWithDeltaOneStep(G4double valDeltaOneStep);
// Sets both accuracies, maintaining a fixed ratio for accuracties
// of volume Intersection and Integration (in One Step)
inline void SetDeltaOneStep(G4double valueD1step);
inline void SetDeltaIntersection(G4double valueDintersection);
private:
G4FieldManager(const G4FieldManager&);
G4FieldManager& operator=(const G4FieldManager&);
// Private copy constructor and assignment operator.
private:
@@ -69,10 +93,19 @@ class G4FieldManager
G4bool fAllocatedChordFinder; // Did we used "new" to
// create fChordFinder ?
// Values for the required accuracies
//
G4double fDelta_One_Step_Value; // for one tracking/physics step
G4double fDelta_Intersection_Val; // for boundary intersection
// Their default values ... (set in G4PropagatemagField.cc)
//
static const G4double fDefault_Delta_One_Step_Value; // = 0.25 * mm;
static const G4double fDefault_Delta_Intersection_Val; // = 0.1 * mm;
};
// Our current design envisions that one Field manager is
// valid for a detector.
// Our current design envisions that one Field manager is valid for a region of the 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.)
@@ -5,8 +5,8 @@
// 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 $
// $Id: G4FieldManager.icc,v 1.3 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// G4FieldManager inline implementation
@@ -20,14 +20,14 @@ G4bool G4FieldManager::SetDetectorField(G4Field *detectorField)
}
inline
G4Field* G4FieldManager::GetDetectorField()
const G4Field* G4FieldManager::GetDetectorField() const
{
// If pointer is null, should this raise an exception ??
return fDetectorField;
}
inline
G4bool G4FieldManager::DoesFieldExist()
G4bool G4FieldManager::DoesFieldExist() const
{
return (fDetectorField != 0);
}
@@ -43,3 +43,34 @@ G4ChordFinder* G4FieldManager::GetChordFinder()
{
return fChordFinder;
}
inline
G4double G4FieldManager::GetDeltaIntersection() const
{
return fDelta_Intersection_Val;
}
inline
G4double G4FieldManager::GetDeltaOneStep() const
{
return fDelta_One_Step_Value;
}
inline
void G4FieldManager::SetDeltaOneStep(G4double valDeltaOneStep)
{
fDelta_One_Step_Value= valDeltaOneStep;
}
inline
void G4FieldManager::SetDeltaIntersection(G4double valDeltaIntersection)
{
fDelta_Intersection_Val = valDeltaIntersection;
}
inline
void G4FieldManager::SetAccuraciesWithDeltaOneStep(G4double valDeltaOneStep)
{
fDelta_One_Step_Value= valDeltaOneStep;
fDelta_Intersection_Val = 0.4 * fDelta_One_Step_Value;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FieldTrack.hh,v 1.3 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4FieldTrack.hh,v 1.4 2000/11/01 15:15:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4FieldTrack
@@ -36,10 +36,10 @@ class G4FieldTrack
G4FieldTrack( const G4ThreeVector& pPosition,
const G4ThreeVector& pVelocity, // Or UnitVelocity
const G4double curve_length,
const G4double Energy,
const G4double LabratTimeOfFlight=0.0,
const G4double ProperTimeOfFlight=0.0,
G4double curve_length,
G4double Energy,
G4double LabratTimeOfFlight=0.0,
G4double ProperTimeOfFlight=0.0,
const G4ThreeVector* pSpin=0);
G4FieldTrack( const G4FieldTrack& pFieldTrack );
@@ -47,48 +47,49 @@ class G4FieldTrack
~G4FieldTrack();
// Destructor
G4FieldTrack& operator = ( const G4FieldTrack & rStVec );
// Equality operator
inline G4FieldTrack& operator = ( const G4FieldTrack & rStVec );
// Assignment operator
G4ThreeVector GetVelocity() const;
G4ThreeVector GetPosition() const;
const G4ThreeVector& GetMomentumDir() const;
G4double GetCurveLength() const;
inline G4ThreeVector GetVelocity() const;
inline G4ThreeVector GetPosition() const;
inline const G4ThreeVector& GetMomentumDir() const;
inline G4double GetCurveLength() const;
// Distance along curve of point.
G4double GetMomentumModulus() const;
G4ThreeVector GetSpin() const;
G4double GetLabTimeOfFlight() const;
G4double GetProperTimeOfFlight() const;
inline G4double GetMomentumModulus() const;
inline G4ThreeVector GetSpin() const;
inline G4double GetLabTimeOfFlight() const;
inline G4double GetProperTimeOfFlight() const;
// Accessors.
void SetPosition(G4ThreeVector nPos);
void SetVelocity(G4ThreeVector nMomDir);
inline void SetPosition(G4ThreeVector nPos);
inline void SetVelocity(G4ThreeVector nMomDir);
// Does change mom-dir too.
void SetMomentumDir(G4ThreeVector nMomDir);
inline void SetMomentumDir(G4ThreeVector nMomDir);
// Does NOT change velocity.
void SetCurveLength(G4double nCurve_s);
inline void SetCurveLength(G4double nCurve_s);
// Distance along curve.
void SetEnergy(G4double nEnergy);
inline void SetEnergy(G4double nEnergy);
// Does not modify momentum.
void SetMomentumModulus(G4double nMomentumMod);
inline void SetMomentumModulus(G4double nMomentumMod);
// Does not modify energy.
void SetSpin(G4ThreeVector nSpin);
void SetLabTimeOfFlight(G4double nTOF);
void SetProperTimeOfFlight(G4double nTOF);
inline void SetSpin(G4ThreeVector nSpin);
inline void SetLabTimeOfFlight(G4double nTOF);
inline void SetProperTimeOfFlight(G4double nTOF);
// Modifiers
public: // without description
G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition,
const G4ThreeVector& pVelocity,
const G4double s_curve );
inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition,
const G4ThreeVector& pVelocity,
G4double s_curve );
// Old multi-set method
G4ThreeVector Position() const;
inline G4ThreeVector Position() const;
// Renamed to GetPosition
G4double CurveS() const; // distance along curve of point
void SetCurveS(G4double new_curve_s);
inline G4double CurveS() const;
// Distance along curve of point
inline void SetCurveS(G4double new_curve_s);
// Old methods to be deleted.
// G4double GetEnergy() const; // Wrong Energy --> FIXME
@@ -99,8 +100,8 @@ class G4FieldTrack
// 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] );
inline void DumpToArray(G4double valArr[ncompSVEC]) const;
inline void LoadFromArray(G4double valArr[ncompSVEC]);
friend G4std::ostream&
operator<<( G4std::ostream& os, G4FieldTrack& SixVec);
@@ -5,15 +5,59 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FieldTrack.icc,v 1.2 1999/12/15 14:49:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4FieldTrack.icc,v 1.4 2000/11/20 17:29:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "PhysicalConstants.h"
inline
G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition,
const G4ThreeVector& pVelocity, // Can be unit
G4double curve_length,
G4double pEnergy,
G4double pLabortTimeOfFlight,
G4double pProperTimeOfFlight,
const G4ThreeVector* pSpin)
: fEnergy(pEnergy),
fLabTimeOfFlight(pLabortTimeOfFlight),
fProperTimeOfFlight(pProperTimeOfFlight),
fMomentumDir(pVelocity.unit())
{
SetCurvePnt( pPosition, pVelocity, curve_length );
if(pSpin) fSpin = *pSpin;
}
inline
G4FieldTrack::G4FieldTrack( const G4FieldTrack& rStVec )
: fDistanceAlongCurve( rStVec.fDistanceAlongCurve),
fEnergy( rStVec.fEnergy ),
fLabTimeOfFlight( rStVec.fLabTimeOfFlight ),
fProperTimeOfFlight( rStVec.fProperTimeOfFlight ),
fMomentumModulus( rStVec.fMomentumModulus ),
fSpin( rStVec.fSpin ),
fMomentumDir( rStVec.fMomentumDir )
{
SixVector[0]= rStVec.SixVector[0];
SixVector[1]= rStVec.SixVector[1];
SixVector[2]= rStVec.SixVector[2];
SixVector[3]= rStVec.SixVector[3];
SixVector[4]= rStVec.SixVector[4];
SixVector[5]= rStVec.SixVector[5];
// Old code:
// SetCurvePnt(rStVec.GetPosition(),
// rStVec.GetMomentumDir(),
// rStVec.GetCurveLength() ); // Slow, so changed it
}
inline
G4FieldTrack::~G4FieldTrack()
{
}
inline G4FieldTrack&
G4FieldTrack::SetCurvePnt( const G4ThreeVector& pPosition,
G4FieldTrack::SetCurvePnt(const G4ThreeVector& pPosition,
const G4ThreeVector& pVelocity, // Can be Unit
const G4double s_curve )
G4double s_curve )
{
SixVector[0] = pPosition.x();
SixVector[1] = pPosition.y();
@@ -31,54 +75,14 @@ G4FieldTrack::SetCurvePnt( const G4ThreeVector& pPosition,
}
inline
G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition,
const G4ThreeVector& pVelocity, // Can be unit
const G4double curve_length,
const G4double pEnergy,
const G4double pLabortTimeOfFlight,
const G4double pProperTimeOfFlight,
const G4ThreeVector* pSpin) :
fEnergy(pEnergy),
fLabTimeOfFlight(pLabortTimeOfFlight),
fProperTimeOfFlight(pProperTimeOfFlight)
{
SetCurvePnt( pPosition, pVelocity, curve_length );
if(pSpin){ fSpin= *pSpin; }
fMomentumDir = pVelocity.unit();
}
inline
G4FieldTrack::G4FieldTrack( const G4FieldTrack& rStVec ) :
fEnergy( rStVec.fEnergy ),
fLabTimeOfFlight( rStVec.fLabTimeOfFlight ),
fProperTimeOfFlight( rStVec.fProperTimeOfFlight ),
fMomentumModulus( rStVec.fMomentumModulus ),
fMomentumDir( rStVec.fMomentumDir ),
fSpin( rStVec.fSpin ),
fDistanceAlongCurve( rStVec.fDistanceAlongCurve)
{
SixVector[0]= rStVec.SixVector[0];
SixVector[1]= rStVec.SixVector[1];
SixVector[2]= rStVec.SixVector[2];
SixVector[3]= rStVec.SixVector[3];
SixVector[4]= rStVec.SixVector[4];
SixVector[5]= rStVec.SixVector[5];
// Old code:
// SetCurvePnt(rStVec.GetPosition(),
// rStVec.GetMomentumDir(),
// rStVec.GetCurveLength() ); // Slow, so changed it
}
// Destructor
inline G4FieldTrack::~G4FieldTrack(){}
inline G4ThreeVector G4FieldTrack::GetPosition() const
G4ThreeVector G4FieldTrack::GetPosition() const
{
G4ThreeVector myPosition( SixVector[0], SixVector[1], SixVector[2] );
return myPosition;
}
inline void G4FieldTrack::SetPosition( G4ThreeVector pPosition)
inline
void G4FieldTrack::SetPosition( G4ThreeVector pPosition)
{
SixVector[0] = pPosition.x();
SixVector[1] = pPosition.y();
@@ -86,72 +90,120 @@ inline void G4FieldTrack::SetPosition( G4ThreeVector pPosition)
}
// Older ... obsolete
inline G4ThreeVector G4FieldTrack::Position() const
inline
G4ThreeVector G4FieldTrack::Position() const
{
return this->GetPosition();
}
inline const G4ThreeVector& G4FieldTrack::GetMomentumDir() const
inline
const G4ThreeVector& G4FieldTrack::GetMomentumDir() const
{
// G4ThreeVector myVelocity( SixVector[3], SixVector[4], SixVector[5] );
// return myVelocity;
return fMomentumDir;
}
inline G4double G4FieldTrack::GetCurveLength() const
inline
G4double G4FieldTrack::GetCurveLength() const
{
return fDistanceAlongCurve;
}
inline G4double G4FieldTrack::CurveS() const
inline
G4double G4FieldTrack::CurveS() const
{
return this->GetCurveLength();
}
inline void G4FieldTrack::SetCurveLength(G4double nCurve_s)
inline
void G4FieldTrack::SetCurveLength(G4double nCurve_s)
{
fDistanceAlongCurve= nCurve_s;
}
inline void G4FieldTrack::SetCurveS(G4double new_curve_s)
inline
void G4FieldTrack::SetCurveS(G4double new_curve_s)
{
this->SetCurveLength(new_curve_s);
}
#ifdef ENERGY_OK
inline G4double G4FieldTrack::GetEnergy() const
{ return fEnergy;}
inline
G4double G4FieldTrack::GetEnergy() const
{
return fEnergy;
}
#endif
inline void G4FieldTrack::SetEnergy(G4double nEnergy)
{ fEnergy=nEnergy;}
inline G4ThreeVector G4FieldTrack::GetSpin() const
{ return fSpin;}
inline void G4FieldTrack::SetSpin(G4ThreeVector nSpin)
{ fSpin=nSpin; }
inline
void G4FieldTrack::SetEnergy(G4double nEnergy)
{
fEnergy=nEnergy;
}
inline G4double G4FieldTrack::GetLabTimeOfFlight() const
{ return fLabTimeOfFlight; }
inline void G4FieldTrack::SetLabTimeOfFlight(G4double nTOF)
{ fLabTimeOfFlight=nTOF;}
inline
G4ThreeVector G4FieldTrack::GetSpin() const
{
return fSpin;
}
inline G4double G4FieldTrack::GetProperTimeOfFlight() const
{ return fProperTimeOfFlight; }
inline void G4FieldTrack::SetProperTimeOfFlight(G4double nTOF)
{ fProperTimeOfFlight=nTOF;}
inline
void G4FieldTrack::SetSpin(G4ThreeVector nSpin)
{
fSpin=nSpin;
}
inline G4double G4FieldTrack::GetMomentumModulus() const
{ return fMomentumModulus;}
inline void G4FieldTrack::SetMomentumModulus(G4double nMomentumMod)
{ fMomentumModulus= nMomentumMod ;} // does not modify energy
inline
G4double G4FieldTrack::GetLabTimeOfFlight() const
{
return fLabTimeOfFlight;
}
inline void G4FieldTrack::SetMomentumDir(G4ThreeVector newMomDir)
{ fMomentumDir= newMomDir; }
inline
void G4FieldTrack::SetLabTimeOfFlight(G4double nTOF)
{
fLabTimeOfFlight=nTOF;
}
inline G4ThreeVector G4FieldTrack::GetVelocity() const
{ return G4ThreeVector( SixVector[3], SixVector[4], SixVector[5] ); }
inline
G4double G4FieldTrack::GetProperTimeOfFlight() const
{
return fProperTimeOfFlight;
}
inline void G4FieldTrack::SetVelocity(G4ThreeVector pVelocity)
inline
void G4FieldTrack::SetProperTimeOfFlight(G4double nTOF)
{
fProperTimeOfFlight=nTOF;
}
inline
G4double G4FieldTrack::GetMomentumModulus() const
{
return fMomentumModulus;
}
inline
void G4FieldTrack::SetMomentumModulus(G4double nMomentumMod)
{
fMomentumModulus= nMomentumMod; // does not modify energy
}
inline
void G4FieldTrack::SetMomentumDir(G4ThreeVector newMomDir)
{
fMomentumDir= newMomDir;
}
inline
G4ThreeVector G4FieldTrack::GetVelocity() const
{
return G4ThreeVector( SixVector[3], SixVector[4], SixVector[5] );
}
inline
void G4FieldTrack::SetVelocity(G4ThreeVector pVelocity)
{
SixVector[3] = pVelocity.x();
SixVector[4] = pVelocity.y();
@@ -198,7 +250,7 @@ void G4FieldTrack::DumpToArray(G4double valArr[ncompSVEC] ) const
// note that momentum direction must-be/is normalised
inline
void G4FieldTrack::LoadFromArray( const G4double valArr[ncompSVEC] )
void G4FieldTrack::LoadFromArray(G4double valArr[ncompSVEC])
{
SixVector[0]=valArr[0];
SixVector[1]=valArr[1];
@@ -227,6 +279,8 @@ void G4FieldTrack::LoadFromArray( const G4double valArr[ncompSVEC] )
inline
G4FieldTrack & G4FieldTrack::operator = ( const G4FieldTrack& rStVec )
{
if (&rStVec == this) return *this;
// SetCurvePnt(rStVec.GetPosition(),
// rStVec.GetMomentumDir(),
// rStVec.GetCurveLength() );
@@ -247,6 +301,3 @@ G4FieldTrack & G4FieldTrack::operator = ( const G4FieldTrack& rStVec )
return *this;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixExplicitEuler.hh,v 1.4 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4HelixExplicitEuler.hh,v 1.5 2000/11/01 15:15:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4HelixExplicitEuler
@@ -47,7 +47,7 @@ class G4HelixExplicitEuler : public G4MagHelicalStepper
// Replaced by MagFieldEvaluate( const G4double y[], G4double B[] )
// in G4HelicalStepper
G4int IntegratorOrder() { return 1; }
G4int IntegratorOrder() const { return 1; }
};
#endif /* G4EXPLICITEULER_HH */
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixHeum.hh,v 1.4 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4HelixHeum.hh,v 1.5 2000/11/01 15:15:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4HelixHeum
@@ -43,7 +43,7 @@ class G4HelixHeum : public G4MagHelicalStepper
public: // without description
G4int IntegratorOrder() { return 2; }
G4int IntegratorOrder() const { return 2; }
};
#endif /* G4HELIXHEUM_HH */
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixImplicitEuler.hh,v 1.4 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4HelixImplicitEuler.hh,v 1.5 2000/11/01 15:15:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4HelixImplicitEuler
@@ -42,7 +42,7 @@ class G4HelixImplicitEuler : public G4MagHelicalStepper
public: // without description
G4int IntegratorOrder() { return 2; }
G4int IntegratorOrder() const { 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.3 2000/04/12 18:28:51 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4HelixSimpleRunge.hh,v 1.4 2000/11/01 15:15:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// W. Wander <wwc@mit.edu> 03/12/98
@@ -15,19 +15,22 @@
#define G4HELIXSIMPLERUNGE_HH
#include "G4MagHelicalStepper.hh"
class G4HelixSimpleRunge: public G4MagHelicalStepper
class G4HelixSimpleRunge : public G4MagHelicalStepper
{
public:
G4HelixSimpleRunge(G4Mag_EqRhs *EqRhs): G4MagHelicalStepper(EqRhs){};
~G4HelixSimpleRunge(){};
G4HelixSimpleRunge(G4Mag_EqRhs *EqRhs)
: G4MagHelicalStepper(EqRhs){}
~G4HelixSimpleRunge(){}
void DumbStepper( const G4double y[],
G4ThreeVector Bfld,
G4double h,
G4double yout[]);
G4int IntegratorOrder() { return 2; };
G4int IntegratorOrder() const { return 2; }
};
#endif /* G4HELIXSIMPLERUNGE_HH */
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ImplicitEuler.hh,v 1.2 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4ImplicitEuler.hh,v 1.3 2000/11/01 15:15:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// W. Wander <wwc@mit.edu> 12/09/97
@@ -15,7 +15,7 @@
#define G4IMPLICITEULER_HH
#include "G4MagErrorStepper.hh"
class G4ImplicitEuler: public G4MagErrorStepper
class G4ImplicitEuler : public G4MagErrorStepper
{
public:
@@ -24,14 +24,14 @@ class G4ImplicitEuler: public G4MagErrorStepper
void DumbStepper( const G4double y[] ,
const G4double dydx[] ,
const G4double h ,
G4double h ,
G4double yout[] ) ;
G4int IntegratorOrder() { return 2 ; } ;
G4int IntegratorOrder() const { return 2 ; } ;
private:
G4int fNumberOfVariables ;
G4int fNumberOfVariables ;
};
#endif /* G4IMPLICITEULER_HH */
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4LineSection.hh,v 1.4 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4LineSection
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagErrorStepper.hh,v 1.6 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagErrorStepper.hh,v 1.7 2000/11/01 15:15:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4MagErrorStepper
@@ -34,13 +34,13 @@ class G4MagErrorStepper : public G4MagIntegratorStepper
public: // with description
G4MagErrorStepper(G4Mag_EqRhs *EqRhs,G4int numberOfVariables);
~G4MagErrorStepper();
virtual ~G4MagErrorStepper();
void Stepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[],
G4double yerr[] );
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].
@@ -48,14 +48,20 @@ class G4MagErrorStepper : public G4MagIntegratorStepper
virtual void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[] ) = 0;
G4double h,
G4double yout[] ) = 0;
// Performs a 'dump' Step without error calculation.
G4double DistChord() const;
G4double DistChord() const;
private:
G4MagErrorStepper(const G4MagErrorStepper&);
G4MagErrorStepper& operator=(const G4MagErrorStepper&);
// Private copy constructor and assignment operator.
private:
G4ThreeVector fInitialPoint, fMidPoint, fFinalPoint;
// Data stored in order to find the chord
@@ -5,25 +5,18 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagErrorStepper.icc,v 1.6 2000/03/03 12:09:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagErrorStepper.icc,v 1.7 2000/11/01 15:15:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
inline G4MagErrorStepper::G4MagErrorStepper(G4Mag_EqRhs *EqRhs,
G4int numberOfVariables)
:G4MagIntegratorStepper(EqRhs,numberOfVariables)
inline
G4MagErrorStepper::G4MagErrorStepper(G4Mag_EqRhs *EqRhs,
G4int numberOfVariables)
: G4MagIntegratorStepper(EqRhs,numberOfVariables)
{
const G4int nvar = this->GetNumberOfVariables() ;
G4int nvar = this->GetNumberOfVariables() ;
yMiddle= new G4double[nvar];
dydxMid= new G4double[nvar];
yInitial= new G4double[nvar];
yOneStep= new G4double[nvar];
}
inline G4MagErrorStepper::~G4MagErrorStepper()
{
delete[] yMiddle;
delete[] dydxMid;
delete[] yInitial;
delete[] yOneStep;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagHelicalStepper.hh,v 1.4 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagHelicalStepper.hh,v 1.5 2000/11/01 15:15:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4MagHelicalStepper
@@ -32,13 +32,13 @@ class G4MagHelicalStepper : public G4MagIntegratorStepper
public: // with description
G4MagHelicalStepper(G4Mag_EqRhs *EqRhs);
~G4MagHelicalStepper() {;}
virtual ~G4MagHelicalStepper();
void Stepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double yout[],
G4double yerr[] );
G4double h,
G4double yout[],
G4double yerr[] );
// The stepper for the Runge Kutta integration.
// The stepsize is fixed, equal to h.
// Integrates ODE starting values y[0 to 6]
@@ -50,16 +50,14 @@ class G4MagHelicalStepper : public G4MagIntegratorStepper
G4double yout[] ) = 0;
// Performs a 'dump' Step without error calculation.
G4double DistChord() const;
G4double DistChord() const;
// Estimate maximum distance of curved solution and chord ...
protected: // with description
// --- Methods used to implement all the derived classes -----
void LinearStep( const G4double yIn[],
const G4double h,
G4double yHelix[]);
inline void LinearStep( const G4double yIn[],
G4double h,
G4double yHelix[]);
// A linear Step in regions without magnetic field.
void AdvanceHelix( const G4double yIn[],
@@ -68,7 +66,7 @@ class G4MagHelicalStepper : public G4MagIntegratorStepper
G4double yHelix[]); // output
// A first order Step along a helix inside the field.
void MagFieldEvaluate( const G4double y[], G4ThreeVector& Bfield );
inline void MagFieldEvaluate( const G4double y[], G4ThreeVector& Bfield );
// Evaluate the field at a certain point.
protected: // without description
@@ -76,6 +74,12 @@ class G4MagHelicalStepper : public G4MagIntegratorStepper
// void MagFieldEvaluate( const G4double y[], G4double B[] )
// { GetEquationOfMotion()-> GetFieldValue(y, B); }
private:
G4MagHelicalStepper(const G4MagHelicalStepper&);
G4MagHelicalStepper& operator=(const G4MagHelicalStepper&);
// Private copy constructor and assignment operator.
private:
G4ThreeVector yInitial, yMidPoint, yFinal;
@@ -5,16 +5,16 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagHelicalStepper.icc,v 1.3 2000/04/27 09:14:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagHelicalStepper.icc,v 1.4 2000/11/01 15:15:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// linear Step in regions of no field
inline void
G4MagHelicalStepper::LinearStep( const G4double yIn[],
const G4double h,
G4double yLinear[])
G4double h,
G4double yLinear[])
{
for( G4int i = 0; i < 3; i++ ) {
yLinear[i] = yIn[i] + h * yIn[i+3];
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagIntegratorDriver.hh,v 1.6 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagIntegratorDriver.hh,v 1.7 2000/11/01 15:15:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4MagInt_Driver
@@ -31,8 +31,8 @@ class G4MagInt_Driver
public: // with description
G4bool AccurateAdvance(G4FieldTrack& y_current,
const G4double hstep,
const G4double eps); // Requested y_err/hstep
G4double hstep,
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.
@@ -49,109 +49,114 @@ class G4MagInt_Driver
G4MagInt_Driver( G4double hminimum,
G4MagIntegratorStepper *pItsStepper,
G4int numberOfComponents=6);
~G4MagInt_Driver(){}
~G4MagInt_Driver();
// Constructor, destructor.
G4double GetHmin();
G4double Hmin(); // Obsolete
G4double GetSafety();
G4double GetPshrnk();
G4double GetPgrow();
G4double GetErrcon();
void GetDerivatives( const G4FieldTrack y_curr, // const, INput
G4double dydx[] ); // OUTput
inline G4double GetHmin() const;
inline G4double Hmin() const; // Obsolete
inline G4double GetSafety() const;
inline G4double GetPshrnk() const;
inline G4double GetPgrow() const;
inline G4double GetErrcon() const;
inline void GetDerivatives( const G4FieldTrack y_curr, // const, INput
G4double dydx[] ); // OUTput
// Accessors.
void RenewStepperAndAdjust(G4MagIntegratorStepper *pItsStepper);
inline void RenewStepperAndAdjust(G4MagIntegratorStepper *pItsStepper);
// Sets a new stepper pItsStepper for this driver. Then it calls
// ReSetParameters to reset its parameters accordingly.
void ReSetParameters(G4double new_safety= 0.9 );
inline void ReSetParameters(G4double new_safety= 0.9 );
// 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);
inline void SetSafety(G4double valS);
inline void SetPshrnk(G4double valPs);
inline void SetPgrow (G4double valPg);
inline void SetErrcon(G4double valEc);
// When setting safety or pgrow, errcon will be set to a
// compatible value.
G4double ComputeAndSetErrcon();
inline G4double ComputeAndSetErrcon();
void SetChargeMomentumMass( const G4double particleCharge,
const G4double MomentumXc,
const G4double Mass );
inline void SetChargeMomentumMass( G4double particleCharge,
G4double MomentumXc,
G4double Mass );
// Change them in Equation. particleCharge is in e+ units.
G4MagIntegratorStepper* GetStepper();
inline const G4MagIntegratorStepper* GetStepper() const;
void OneGoodStep( G4double ystart[], // Like old RKF45step()
const G4double dydx[],
G4double& x,
const G4double htry,
const G4double eps, // memb variables ?
G4double& hdid,
G4double& hnext ) ;
void OneGoodStep( G4double ystart[], // Like old RKF45step()
const G4double dydx[],
G4double& x,
G4double htry,
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|
G4double ComputeNewStepSize(
G4double errMaxNorm, // normalised error
G4double hstepCurrent); // current step size
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.
// Do not limit the next step's size within a factor of the
// current one.
G4double ComputeNewStepSize_WithinLimits(
G4double errMaxNorm, // normalised error
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);
inline G4int GetMaxNoSteps() const;
inline void SetMaxNoSteps( G4int val);
public: // without description
G4double SetHmin(G4double newval);
inline void SetHmin(G4double newval);
protected:
void WarnSmallStepSize( G4double hnext, G4double hstep,
G4double h, G4double xDone,
G4int noSteps);
void WarnTooManyStep( G4double x1start, G4double x2end, G4double xCurrent);
void WarnEndPointTooFar (G4double endPointDist,
G4double hStepSize ,
G4double epsilonRelative,
G4int debugFlag);
void WarnSmallStepSize( G4double hnext, G4double hstep,
G4double h, G4double xDone,
G4int noSteps);
void WarnTooManyStep( G4double x1start, G4double x2end, G4double xCurrent);
void WarnEndPointTooFar (G4double endPointDist,
G4double hStepSize ,
G4double epsilonRelative,
G4int debugFlag);
// Issue warnings for undesirable situations
private:
G4double hminimum_val;
G4MagInt_Driver(const G4MagInt_Driver&);
G4MagInt_Driver& operator=(const G4MagInt_Driver&);
// Private copy constructor and assignment operator.
private:
G4double hminimum_val;
// Minimum Step allowed in a Step.
const G4int nvar;
G4int nvar;
G4MagIntegratorStepper *pIntStepper;
G4int fMaxNoSteps;
static const G4int fMaxStepBase;
G4MagIntegratorStepper *pIntStepper;
G4int fMaxNoSteps;
static const G4int fMaxStepBase;
G4double safety;
G4double pshrnk; // exponent for shrinking
G4double pgrow; // exponent for growth
G4double errcon;
G4double safety;
G4double pshrnk; // exponent for shrinking
G4double pgrow; // exponent for growth
G4double errcon;
// Parameters used to grow and shrink trial stepsize.
static const G4double max_stepping_increase;
static const G4double max_stepping_decrease;
static const G4double max_stepping_increase;
static const G4double max_stepping_decrease;
// Maximum stepsize increase/decrease factors.
};
@@ -5,52 +5,61 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagIntegratorDriver.icc,v 1.4 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagIntegratorDriver.icc,v 1.5 2000/11/01 15:15:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
inline G4double G4MagInt_Driver::GetHmin()
inline
G4double G4MagInt_Driver::GetHmin() const
{
return hminimum_val;
}
inline G4double G4MagInt_Driver::Hmin()
inline
G4double G4MagInt_Driver::Hmin() const
{
return hminimum_val;
}
inline G4double G4MagInt_Driver::GetSafety()
inline
G4double G4MagInt_Driver::GetSafety() const
{
return safety;
}
inline G4double G4MagInt_Driver::GetPshrnk()
inline
G4double G4MagInt_Driver::GetPshrnk() const
{
return pshrnk;
}
inline G4double G4MagInt_Driver::GetPgrow()
inline
G4double G4MagInt_Driver::GetPgrow() const
{
return pgrow;
}
inline G4double G4MagInt_Driver::GetErrcon()
inline
G4double G4MagInt_Driver::GetErrcon() const
{
return errcon;
}
inline G4double G4MagInt_Driver::SetHmin(G4double newval)
inline
void G4MagInt_Driver::SetHmin(G4double newval)
{
return hminimum_val;
hminimum_val = newval;
}
inline G4double G4MagInt_Driver::ComputeAndSetErrcon()
inline
G4double G4MagInt_Driver::ComputeAndSetErrcon()
{
errcon = pow(max_stepping_increase/GetSafety(),1.0/GetPgrow());
return errcon;
}
inline void G4MagInt_Driver::ReSetParameters( G4double new_safety )
inline
void G4MagInt_Driver::ReSetParameters(G4double new_safety)
{
safety = new_safety;
pshrnk = -1.0 / pIntStepper->IntegratorOrder();
@@ -58,66 +67,65 @@ inline void G4MagInt_Driver::ReSetParameters( G4double new_safety )
ComputeAndSetErrcon();
}
inline void G4MagInt_Driver::SetSafety(G4double val)
inline
void G4MagInt_Driver::SetSafety(G4double val)
{
safety=val;
ComputeAndSetErrcon();
}
inline void G4MagInt_Driver::SetPgrow(G4double val)
inline
void G4MagInt_Driver::SetPgrow(G4double val)
{
pgrow=val;
ComputeAndSetErrcon();
}
inline void G4MagInt_Driver::SetErrcon(G4double val)
inline
void G4MagInt_Driver::SetErrcon(G4double val)
{
errcon=val;
}
inline void G4MagInt_Driver::RenewStepperAndAdjust(G4MagIntegratorStepper *pItsStepper)
inline
void G4MagInt_Driver::RenewStepperAndAdjust(G4MagIntegratorStepper *pItsStepper)
{
pIntStepper = pItsStepper;
ReSetParameters();
}
inline void G4MagInt_Driver:: SetChargeMomentumMass(
const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double Mass )
inline
void G4MagInt_Driver::SetChargeMomentumMass(G4double particleCharge, // e+
G4double MomentumXc,
G4double Mass )
{
pIntStepper->GetEquationOfMotion()
->SetChargeMomentumMass(particleCharge, MomentumXc, Mass);
}
// Constructor
//
inline G4MagInt_Driver::G4MagInt_Driver( G4double hminimum,
G4MagIntegratorStepper *pItsStepper,
G4int numComponents)
: nvar(numComponents)
{
RenewStepperAndAdjust( pItsStepper );
hminimum_val= hminimum;
fMaxNoSteps = fMaxStepBase / pIntStepper->IntegratorOrder();
inline
const G4MagIntegratorStepper* G4MagInt_Driver::GetStepper() const
{
return pIntStepper;
}
inline G4MagIntegratorStepper* G4MagInt_Driver::GetStepper()
{ return pIntStepper; }
inline
G4int G4MagInt_Driver::GetMaxNoSteps() const
{
return fMaxNoSteps;
}
inline G4int G4MagInt_Driver::GetMaxNoSteps()
{ return fMaxNoSteps; }
inline
void G4MagInt_Driver::SetMaxNoSteps(G4int val)
{
fMaxNoSteps= val;
}
inline void G4MagInt_Driver::SetMaxNoSteps(G4int val)
{ fMaxNoSteps= val; }
inline void G4MagInt_Driver::GetDerivatives(
const G4FieldTrack y_curr, // const, INput
G4double dydx[] ) // OUTput
inline
void G4MagInt_Driver::GetDerivatives(const G4FieldTrack y_curr, // const, INput
G4double dydx[]) // OUTput
{
G4double tmpValArr[G4FieldTrack::ncompSVEC];
y_curr.DumpToArray( tmpValArr );
pIntStepper -> RightHandSide( tmpValArr , dydx );
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagIntegratorStepper.hh,v 1.4 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagIntegratorStepper.hh,v 1.5 2000/11/01 15:15:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4MagIntegratorStepper
@@ -30,12 +30,12 @@ class G4MagIntegratorStepper
public: // with description
G4MagIntegratorStepper(G4Mag_EqRhs *EqRhs, G4int num_variables);
~G4MagIntegratorStepper(){;}
virtual ~G4MagIntegratorStepper();
// Constructor and destructor. No actions.
virtual void Stepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double h,
G4double yout[],
G4double yerr[] ) = 0 ;
// The stepper for the Runge Kutta integration.
@@ -47,22 +47,22 @@ class G4MagIntegratorStepper
// Estimate the maximum distance of a chord from the true path
// over the segment last integrated.
void NormaliseTangentVector( G4double vec[6] );
inline void NormaliseTangentVector( G4double vec[6] );
// Simple utility function to (re)normalise 'unit velocity' vector.
virtual void RightHandSide( const double y[], double dydx[] );
virtual void RightHandSide( const double y[], double dydx[] );
// Utility method to supply the standard Evaluation of the
// Right Hand side of the associated equation.
G4int GetNumberOfVariables();
void SetNumberOfVariables(G4int newNo);
inline G4int GetNumberOfVariables() const;
inline void SetNumberOfVariables(G4int newNo);
// Get/Set the number of variables that the stepper will compile over.
virtual G4int IntegratorOrder() = 0;
virtual G4int IntegratorOrder() const = 0;
// Returns the order of the integrator
// i.e. its error behaviour is of the order O(h^order).
G4EquationOfMotion *GetEquationOfMotion() const;
inline G4EquationOfMotion *GetEquationOfMotion();
// As some steppers (eg RKG3) require other methods of Eq_Rhs
// this function allows for access to them.
@@ -70,13 +70,18 @@ class G4MagIntegratorStepper
#if 0
void
SetChargeAndMomentum( const G4double particleCharge, // in e+ units
const G4double MomentumXc)
SetChargeAndMomentum( G4double particleCharge, // in e+ units
G4double MomentumXc)
// Supply the standard Evaluation of the Right Hand side
// of the associated equation.
{theEquation_Rhs -> SetChargeAndMomentum(particleCharge, MomentumXc);}
#endif
private:
G4MagIntegratorStepper(const G4MagIntegratorStepper&);
G4MagIntegratorStepper& operator=(const G4MagIntegratorStepper&);
// Private copy constructor and assignment operator.
private:
@@ -5,23 +5,30 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagIntegratorStepper.icc,v 1.3 1999/12/15 14:49:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagIntegratorStepper.icc,v 1.4 2000/11/01 15:15:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
inline G4EquationOfMotion* G4MagIntegratorStepper::GetEquationOfMotion() const
{ return fEquation_Rhs; }
inline void G4MagIntegratorStepper::RightHandSide( const double y[], double dydx[] )
{ fEquation_Rhs-> RightHandSide(y, dydx); }
inline
G4EquationOfMotion* G4MagIntegratorStepper::GetEquationOfMotion()
{
return fEquation_Rhs;
}
inline G4int G4MagIntegratorStepper::GetNumberOfVariables()
{ return fNumberOfVariables; }
inline void G4MagIntegratorStepper::SetNumberOfVariables(G4int newNo)
{ fNumberOfVariables = newNo; }
inline
G4int G4MagIntegratorStepper::GetNumberOfVariables() const
{
return fNumberOfVariables;
}
inline
void G4MagIntegratorStepper::SetNumberOfVariables(G4int newNo)
{
fNumberOfVariables = newNo;
}
inline void G4MagIntegratorStepper::
NormaliseTangentVector( G4double vec[6] )
inline
void G4MagIntegratorStepper::NormaliseTangentVector( G4double vec[6] )
{
double drds2 = vec[3]*vec[3]+vec[4]*vec[4]+vec[5]*vec[5];
@@ -31,4 +38,3 @@ NormaliseTangentVector( G4double vec[6] )
vec[i+3] *= normx;
}
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Mag_EqRhs.hh,v 1.4 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4Mag_EqRhs.hh,v 1.5 2000/11/01 15:15:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4Mag_EqRhs
@@ -34,27 +34,26 @@ class G4Mag_EqRhs : public G4EquationOfMotion
public: // with description
G4Mag_EqRhs( G4MagneticField *magField );
~G4Mag_EqRhs();
virtual ~G4Mag_EqRhs();
// Constructor and destructor. No actions.
virtual void EvaluateRhsGivenB( const G4double y[],
const G4double B[3],
G4double dydx[] ) const = 0;
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;
inline G4double FCof() const;
virtual void
SetChargeMomentumMass( const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double mass);
virtual void SetChargeMomentumMass( G4double particleCharge, // in e+ units
G4double MomentumXc,
G4double mass);
private:
G4double fCof_val;
G4double fCof_val;
static const G4double fUnitConstant; // Set in G4Mag_EqRhs.cc
// to 0.299792458
@@ -5,8 +5,8 @@
// 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 $
// $Id: G4Mag_SpinEqRhs.hh,v 1.4 2000/11/01 15:15:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4Mag_SpinEqRhs
@@ -26,8 +26,8 @@
#include "G4Mag_EqRhs.hh"
#include "G4MagneticField.hh"
class G4Mag_SpinEqRhs : public G4Mag_EqRhs{
class G4Mag_SpinEqRhs : public G4Mag_EqRhs
{
public: // with description
G4Mag_SpinEqRhs( G4MagneticField* MagField )
@@ -35,9 +35,9 @@ class G4Mag_SpinEqRhs : public G4Mag_EqRhs{
~G4Mag_SpinEqRhs() {;}
// Constructor and destructor. No actions.
void SetChargeMomentumMass(const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double mass);
void SetChargeMomentumMass(G4double particleCharge, // in e+ units
G4double MomentumXc,
G4double mass);
void EvaluateRhsGivenB( const G4double y[],
const G4double B[3],
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4Mag_UsualEqRhs.hh,v 1.3 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4Mag_UsualEqRhs
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagneticField.hh,v 1.4 2000/05/10 12:36:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagneticField.hh,v 1.5 2000/11/01 15:15:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4MagneticField
@@ -41,12 +41,12 @@ class G4MagneticField : public G4Field
double *Bfield ) const = 0;
};
// Implementation
// Inline implementations
inline G4MagneticField::G4MagneticField() {}
inline G4MagneticField::~G4MagneticField() {}
inline G4MagneticField::G4MagneticField(const G4MagneticField &) {}
inline G4MagneticField& G4MagneticField::operator = (const G4MagneticField &)
{ return *this; }
inline G4MagneticField& G4MagneticField::operator = (const G4MagneticField &p)
{ if (&p == this) return *this; *this = p; return *this; }
#endif /* G4MAGNETIC_FIELD_DEF */
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RKG3_Stepper.hh,v 1.4 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4RKG3_Stepper.hh,v 1.5 2000/11/01 15:15:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4RKG3_Stepper
@@ -36,7 +36,7 @@ class G4RKG3_Stepper : public G4MagIntegratorStepper
void Stepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double h,
G4double yOut[],
G4double yErr[] );
// The method which must be provided, even if less efficient.
@@ -45,7 +45,7 @@ class G4RKG3_Stepper : public G4MagIntegratorStepper
void StepNoErr( const G4double tIn[7],
const G4double dydx[7],
const G4double Step,
G4double Step,
G4double tOut[7],
G4double B[3] );
// Integrator RK Stepper from G3 with only two field evaluation per
@@ -55,7 +55,7 @@ class G4RKG3_Stepper : public G4MagIntegratorStepper
void StepWithEst( const G4double tIn[7],
const G4double dydx[7],
const G4double Step,
G4double Step,
G4double tOut[7],
G4double& alpha2, // to delete ?
G4double& beta2,
@@ -68,11 +68,11 @@ class G4RKG3_Stepper : public G4MagIntegratorStepper
public: // without description
G4int IntegratorOrder() { return 4; };
G4int IntegratorOrder() const { return 4; }
protected:
// void Field( const double Point[3],
// double Bfield[3] ) const
// void Field( const G4double Point[3],
// G4double Bfield[3] ) const
// { EqRhs-> GetFieldValue( Point, Bfield ) ; }
private:
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SimpleHeum.hh,v 1.3 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4SimpleHeum.hh,v 1.4 2000/11/01 15:15:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4SimpleHeum
@@ -39,16 +39,16 @@ class G4SimpleHeum : public G4MagErrorStepper
void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double h,
G4double yout[]);
public: // without description
G4int IntegratorOrder() { return 3; }
G4int IntegratorOrder() const { return 3; }
private:
const G4int fNumberOfVariables;
G4int fNumberOfVariables;
G4double* dydxTemp ;
G4double* dydxTemp2 ;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SimpleRunge.hh,v 1.3 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4SimpleRunge.hh,v 1.4 2000/11/01 15:15:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4SimpleRunge
@@ -40,12 +40,12 @@ class G4SimpleRunge : public G4MagErrorStepper
void DumbStepper( const G4double y[],
const G4double dydx[],
const G4double h,
G4double h,
G4double yout[]);
public: // without description
G4int IntegratorOrder() { return 2; }
G4int IntegratorOrder() const { return 2; }
private:
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UniformElectricField.hh,v 1.3 2000/04/27 09:14:06 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4UniformElectricField.hh,v 1.4 2000/11/01 15:15:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4UniformElectricField
@@ -50,7 +50,8 @@ class G4UniformElectricField : public G4ElectroMagneticField
G4double B[] ) const ;
private:
G4double fFieldComponents[6] ;
G4double fFieldComponents[6] ;
};
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UniformMagField.hh,v 1.3 2000/04/27 09:14:07 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4UniformMagField.hh,v 1.4 2000/11/01 15:15:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4UniformMagField
@@ -47,15 +47,16 @@ class G4UniformMagField : public G4MagneticField
// Copy constructor and assignment operator.
void GetFieldValue(const G4double yTrack[3] ,
G4double *MagField ) const ;
G4double *MagField) const ;
void SetFieldValue( const G4ThreeVector& newFieldValue );
void SetFieldValue(const G4ThreeVector& newFieldValue);
G4ThreeVector GetConstantFieldValue() const;
// Return the field value
// Return the field value
private:
G4double fFieldComponents[3] ;
G4double fFieldComponents[3] ;
};
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4CashKarpRKF45.cc,v 1.4 1999/12/15 14:49:48 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4CashKarpRKF45.cc,v 1.6 2000/11/20 17:29:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// The Cash-Karp Runge-Kutta-Fehlberg 4/5 method is an embedded fourth
// order method (giving fifth-order accuracy) for the solution
@@ -24,8 +24,8 @@
//
// Constructor
G4CashKarpRKF45::G4CashKarpRKF45(G4Mag_EqRhs *EqRhs, G4int numberOfVariables):
G4MagIntegratorStepper(EqRhs, numberOfVariables)
G4CashKarpRKF45::G4CashKarpRKF45(G4Mag_EqRhs *EqRhs, G4int numberOfVariables)
: G4MagIntegratorStepper(EqRhs, numberOfVariables)
{
fNumberOfVariables = numberOfVariables ;
@@ -67,16 +67,15 @@ G4CashKarpRKF45::~G4CashKarpRKF45()
void
G4CashKarpRKF45::Stepper(const G4double yInput[],
const G4double dydx[],
const G4double Step,
G4double Step,
G4double yOut[],
G4double yErr[])
{
// const G4int nvar = 6 ;
// const G4double a2 = 0.2 , a3 = 0.3 , a4 = 0.6 , a5 = 1.0 , a6 = 0.875;
G4int i;
const G4double a2 = 0.2 , a3 = 0.3 , a4 = 0.6 , a5 = 1.0 , a6 = 0.875 ,
b21 = 0.2 ,
const G4double b21 = 0.2 ,
b31 = 3.0/40.0 , b32 = 9.0/40.0 ,
b41 = 0.3 , b42 = -0.9 , b43 = 1.2 ,
@@ -156,7 +155,7 @@ G4CashKarpRKF45::Stepper(const G4double yInput[],
void
G4CashKarpRKF45::StepWithEst(const G4double yInput[],
const G4double dydx[],
const G4double Step,
G4double Step,
G4double yOut[],
G4double& alpha2,
G4double& beta2,
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ChordFinder.cc,v 1.14 2000/05/11 17:34:32 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4ChordFinder.cc,v 1.16 2000/11/20 17:29:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// 25.02.97 John Apostolakis, design and implimentation
@@ -70,9 +70,9 @@ G4ChordFinder::~G4ChordFinder()
// ......................................................................
G4double
G4ChordFinder::AdvanceChordLimited( G4FieldTrack& yCurrent,
const G4double stepMax,
const G4double epsStep )
G4ChordFinder::AdvanceChordLimited( G4FieldTrack& yCurrent,
G4double stepMax,
G4double epsStep )
{
G4double stepPossible;
G4double dyErr;
@@ -122,7 +122,7 @@ G4ChordFinder::AdvanceChordLimited( G4FieldTrack& yCurrent,
G4double
G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
const G4double stepMax,
G4double stepMax,
G4FieldTrack& yEnd, // Endpoint
G4double& dyErr, // Error of endpoint
G4double epsStep )
@@ -138,7 +138,7 @@ G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
// 2.) Evaluate if resulting chord gives d_chord that is good enough.
// 2a.) If d_chord is not good enough, find one that is.
G4bool validEndPoint= false, dbg= false;
G4bool validEndPoint= false;
G4double dChordStep, oldStepTrial, stepOfLastGoodChord;
fIntgrDriver-> GetDerivatives( yCurrent, dydx ) ;
@@ -225,10 +225,9 @@ G4ChordFinder::FindNextChord( const G4FieldTrack yStart,
// ...........................................................................
G4double G4ChordFinder::NewStep(
const G4double stepTrialOld,
const G4double dChordStep, // Current dchord achieved.
G4double& stepEstimate_Unconstrained )
G4double G4ChordFinder::NewStep(G4double stepTrialOld,
G4double dChordStep, // Current dchord achieved.
G4double& stepEstimate_Unconstrained )
{
G4double stepTrial;
@@ -283,7 +282,7 @@ G4FieldTrack G4ChordFinder::ApproxCurvePointV(
const G4FieldTrack& CurveA_PointVelocity,
const G4FieldTrack& CurveB_PointVelocity,
const G4ThreeVector& CurrentE_Point,
const G4double eps_step)
G4double eps_step)
{
// 1st implementation:
// if r=|AE|/|AB|, and s=true path lenght (AB)
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ClassicalRK4.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4ClassicalRK4.cc,v 1.3 2000/11/01 15:15:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4ClassicalRK4.hh"
#include "G4ThreeVector.hh"
@@ -16,9 +16,9 @@
//
// Constructor sets the number of variables (default = 6)
G4ClassicalRK4:: G4ClassicalRK4(G4Mag_EqRhs *EqRhs, G4int numberOfVariables):
G4MagErrorStepper(EqRhs, numberOfVariables),
fNumberOfVariables(numberOfVariables)
G4ClassicalRK4::G4ClassicalRK4(G4Mag_EqRhs *EqRhs, G4int numberOfVariables)
: G4MagErrorStepper(EqRhs, numberOfVariables),
fNumberOfVariables(numberOfVariables)
{
dydxm = new G4double[fNumberOfVariables];
dydxt = new G4double[fNumberOfVariables];
@@ -29,7 +29,7 @@ G4MagErrorStepper(EqRhs, numberOfVariables),
//
// Destructor
G4ClassicalRK4:: ~G4ClassicalRK4()
G4ClassicalRK4::~G4ClassicalRK4()
{
delete[] dydxm;
delete[] dydxt;
@@ -49,8 +49,8 @@ G4ClassicalRK4:: ~G4ClassicalRK4()
void
G4ClassicalRK4::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[])
G4double h,
G4double yOut[])
{
const G4int nvar = fNumberOfVariables; // GetNumberOfVariables();
G4int i;
@@ -93,8 +93,8 @@ G4ClassicalRK4::DumbStepper( const G4double yIn[],
void
G4ClassicalRK4::StepWithEst( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[],
G4double h,
G4double yOut[],
G4double& alpha2,
G4double& beta2,
const G4double B1[],
@@ -104,7 +104,7 @@ G4ClassicalRK4::StepWithEst( const G4double yIn[],
G4Exception(" G4ClassicalRK4::StepWithEst ERROR: this Method is no longer used.");
#if 0 // const G4int nvar = 6 ;
const G4int nvar = GetNumberOfVariables();
G4int nvar = GetNumberOfVariables();
G4int i;
G4double hh = h*0.5 , h6 = h/6.0 ;
G4double B[3] ;
@@ -10,22 +10,20 @@
#include "G4EqMagElectricField.hh"
void
G4EqMagElectricField::
SetChargeMomentumMass( const G4double particleCharge, // e+ units
const G4double MomentumXc,
const G4double particleMass)
G4EqMagElectricField::SetChargeMomentumMass(G4double particleCharge, // e+ units
G4double MomentumXc,
G4double particleMass)
{
fElectroMagCof = eplus*c_squared ;
fElectroMagCof *= particleCharge/particleMass;
}
void
G4EqMagElectricField::EvaluateRhsGivenB( const G4double y[],
const G4double Field[],
G4double dydx[] ) const
G4EqMagElectricField::EvaluateRhsGivenB(const G4double y[],
const G4double Field[],
G4double dydx[] ) const
{
// Components of y:
@@ -5,13 +5,16 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4EquationOfMotion.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4EquationOfMotion.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4EquationOfMotion.hh"
static const int G4maximum_number_of_field_components = 16;
G4EquationOfMotion::~G4EquationOfMotion()
{}
void
G4EquationOfMotion::RightHandSide( const G4double y[],
G4double dydx[] ) const
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ExplicitEuler.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4ExplicitEuler.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// Explicit Euler: x_1 = x_0 + h * dx_0
@@ -24,9 +24,9 @@
// Constructor
G4ExplicitEuler::G4ExplicitEuler(G4Mag_EqRhs *EqRhs,
G4int numberOfVariables) :
G4MagErrorStepper(EqRhs, numberOfVariables),
fNumberOfVariables(numberOfVariables)
G4int numberOfVariables)
: G4MagErrorStepper(EqRhs, numberOfVariables),
fNumberOfVariables(numberOfVariables)
{
}
@@ -37,7 +37,6 @@ G4ExplicitEuler::G4ExplicitEuler(G4Mag_EqRhs *EqRhs,
G4ExplicitEuler::~G4ExplicitEuler()
{
;
}
@@ -48,7 +47,7 @@ G4ExplicitEuler::~G4ExplicitEuler()
void
G4ExplicitEuler::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double h,
G4double yOut[] )
{
// const G4int nvar = 6 ;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4FieldManager.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4FieldManager.cc,v 1.3 2000/11/09 18:06:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4FieldManager.hh"
@@ -34,6 +34,8 @@ G4FieldManager::~G4FieldManager()
void
G4FieldManager::CreateChordFinder(G4MagneticField *detectorMagField)
{
if ( fAllocatedChordFinder )
delete fChordFinder;
fChordFinder= new G4ChordFinder( detectorMagField );
fAllocatedChordFinder= true;
}
@@ -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-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4FieldTrack.hh"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4HelixExplicitEuler.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4HelixExplicitEuler.hh"
#include "G4ThreeVector.hh"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4HelixHeum.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4HelixHeum.hh"
#include "G4ThreeVector.hh"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4HelixImplicitEuler.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4HelixImplicitEuler.hh"
#include "G4ThreeVector.hh"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4HelixSimpleRunge.cc,v 1.3 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4HelixSimpleRunge.cc,v 1.4 2000/11/20 17:29:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4HelixSimpleRunge.hh"
#include "G4ThreeVector.hh"
@@ -31,7 +31,6 @@ G4HelixSimpleRunge::DumbStepper( const G4double yIn[],
G4double yOut[])
{
const G4int nvar = 6 ;
G4double dydxTemp[nvar];
G4double yTemp[nvar]; // , yAdd[nvar];
G4ThreeVector Bfld_midpoint;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ImplicitEuler.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4ImplicitEuler.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// Implicit Euler:
@@ -43,7 +43,6 @@ G4MagErrorStepper(EqRhs, numberOfVariables),
G4ImplicitEuler::~G4ImplicitEuler()
{
;
}
//////////////////////////////////////////////////////////////////////
@@ -53,7 +52,7 @@ G4ImplicitEuler::~G4ImplicitEuler()
void
G4ImplicitEuler::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double h,
G4double yOut[])
{
// const G4int nvar = 6 ;
@@ -5,18 +5,18 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LineSection.cc,v 1.3 2000/02/25 16:57:15 grichine Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4LineSection.cc,v 1.4 2000/11/01 15:15:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// typedef double G4double;
#include "G4LineSection.hh"
G4LineSection::G4LineSection( const G4ThreeVector& PntA,
const G4ThreeVector& PntB )
const G4ThreeVector& PntB )
: EndpointA(PntA),
VecAtoB(PntB-PntA)
{
EndpointA= PntA;
VecAtoB=PntB-PntA;
G4double distABsquared = VecAtoB.mag2() ;
if ( distABsquared == 0.0)
{
@@ -5,19 +5,27 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagErrorStepper.cc,v 1.7 2000/05/09 11:41:00 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagErrorStepper.cc,v 1.8 2000/11/01 15:15:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4MagErrorStepper.hh"
#include "G4ThreeVector.hh"
#include "G4LineSection.hh"
G4MagErrorStepper::~G4MagErrorStepper()
{
delete[] yMiddle;
delete[] dydxMid;
delete[] yInitial;
delete[] yOneStep;
}
void
G4MagErrorStepper::Stepper( const G4double yInput[],
const G4double dydx[],
const G4double hstep,
G4double yOutput[],
G4double yError [] )
const G4double dydx[],
G4double hstep,
G4double yOutput[],
G4double yError [] )
{
const G4int nvar = this->GetNumberOfVariables() ;
@@ -59,7 +67,7 @@ G4MagErrorStepper::Stepper( const G4double yInput[],
G4double
G4MagErrorStepper::DistChord() const
G4MagErrorStepper::DistChord() const
{
// Estimate the maximum distance from the curve to the chord
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagHelicalStepper.cc,v 1.4 2000/04/12 18:29:26 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagHelicalStepper.cc,v 1.6 2000/11/20 17:29:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4MagHelicalStepper.hh"
#include "G4ThreeVector.hh"
@@ -25,6 +25,10 @@ G4MagHelicalStepper::G4MagHelicalStepper(G4Mag_EqRhs *EqRhs)
fPtrMagEqOfMot = EqRhs;
}
G4MagHelicalStepper::~G4MagHelicalStepper()
{
}
void
G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
G4ThreeVector Bfld,
@@ -125,16 +129,16 @@ G4MagHelicalStepper::AdvanceHelix( const G4double yIn[],
void
G4MagHelicalStepper::Stepper( const G4double yInput[],
const G4double dydx[],
const G4double hstep,
G4double yOut[],
G4double yErr[] )
const G4double dydx[],
G4double hstep,
G4double yOut[],
G4double yErr[] )
{
const G4int nvar = 6 ;
G4int i;
// correction for Richardson Extrapolation.
G4double correction = 1. / ( (1 << IntegratorOrder()) -1 );
// G4double correction = 1. / ( (1 << IntegratorOrder()) -1 );
G4double yTemp[7], yIn[7] ;
G4ThreeVector Bfld_initial, Bfld_midpoint;
@@ -182,7 +186,7 @@ G4MagHelicalStepper::Stepper( const G4double yInput[],
G4double
G4MagHelicalStepper::DistChord() const
G4MagHelicalStepper::DistChord() const
{
// Soon: must check whether h/R > 2 pi !!
// Method below is good only for < 2 pi
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagIntegratorDriver.cc,v 1.12 2000/05/09 11:51:47 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagIntegratorDriver.cc,v 1.14 2000/11/20 17:29:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//
@@ -23,8 +23,7 @@
#include "G4ios.hh"
#include "G4MagIntegratorDriver.hh"
#include "G4FieldTrack.hh"
#include "geomdefs.hh"
// for kCarTolerance
#include "geomdefs.hh" // for kCarTolerance
// Stepsize can increase by no more than 5.0
// and decrease by no more than 1/10. = 0.1
@@ -33,14 +32,31 @@ const G4double G4MagInt_Driver::max_stepping_increase = 5.0;
const G4double G4MagInt_Driver::max_stepping_decrease = 0.1;
// The (default) maximum number of steps is Base divided by the order of Stepper
//
const G4int G4MagInt_Driver::fMaxStepBase = 5000;
// Constructor
//
G4MagInt_Driver::G4MagInt_Driver( G4double hminimum,
G4MagIntegratorStepper *pItsStepper,
G4int numComponents)
: nvar(numComponents)
{
RenewStepperAndAdjust( pItsStepper );
hminimum_val= hminimum;
fMaxNoSteps = fMaxStepBase / pIntStepper->IntegratorOrder();
}
// Destructor
//
G4MagInt_Driver::~G4MagInt_Driver()
{
}
G4bool
G4MagInt_Driver::AccurateAdvance(
G4FieldTrack& y_current,
const G4double hstep,
const G4double eps
)
G4MagInt_Driver::AccurateAdvance(G4FieldTrack& y_current,
G4double hstep,
G4double eps )
// const G4double dydx[6], // We could may add this ??
// Runge-Kutta driver with adaptive stepsize control. Integrate starting
@@ -84,7 +100,7 @@ G4MagInt_Driver::AccurateAdvance(
G4bool lastStep= false;
nstp=1;
G4double lastStepThreshold = G4std::min( eps * hstep, Hmin() );
// G4double lastStepThreshold = G4std::min( eps * hstep, Hmin() );
do{
G4ThreeVector StartPos( y[0], y[1], y[2] );
@@ -242,8 +258,8 @@ void
G4MagInt_Driver::OneGoodStep( G4double y[],
const G4double dydx[],
G4double& x,
const G4double htry,
const G4double eps_rel_max,
G4double htry,
G4double eps_rel_max,
G4double& hdid,
G4double& hnext )
@@ -326,11 +342,11 @@ G4MagInt_Driver::OneGoodStep( G4double y[],
// QuickAdvance just tries one Step - it does not ensure accuracy
//
G4bool G4MagInt_Driver::QuickAdvance(
G4FieldTrack& y_posvel, // INOUT
const G4double dydx[],
G4double hstep, // In
G4double& dchord_step,
G4double& dyerr )
G4FieldTrack& y_posvel, // INOUT
const G4double dydx[],
G4double hstep, // In
G4double& dchord_step,
G4double& dyerr )
{
G4double yerr_vec[G4FieldTrack::ncompSVEC], yarrin[G4FieldTrack::ncompSVEC], yarrout[G4FieldTrack::ncompSVEC];
G4double s_start;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagIntegratorStepper.cc,v 1.3 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4MagIntegratorStepper.cc,v 1.4 2000/11/01 15:15:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4MagIntegratorStepper.hh"
@@ -15,8 +15,16 @@
G4MagIntegratorStepper::G4MagIntegratorStepper(G4Mag_EqRhs *EqRhs,
G4int num_var)
: fEquation_Rhs(EqRhs),
fNumberOfVariables(num_var)
{
fEquation_Rhs= EqRhs;
fNumberOfVariables = num_var;
}
G4MagIntegratorStepper::~G4MagIntegratorStepper()
{
}
void G4MagIntegratorStepper::RightHandSide( const double y[], double dydx[] )
{
fEquation_Rhs-> RightHandSide(y, dydx);
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Mag_EqRhs.cc,v 1.2 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4Mag_EqRhs.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// This is the standard right-hand side for equation of motion
// in a pure Magnetic Field .
@@ -31,9 +31,9 @@ G4Mag_EqRhs::G4Mag_EqRhs( G4MagneticField *magField )
}
void
G4Mag_EqRhs::SetChargeMomentumMass( const G4double particleCharge, // e+ units
const G4double MomentumXc,
const G4double particleMass)
G4Mag_EqRhs::SetChargeMomentumMass( G4double particleCharge, // e+ units
G4double MomentumXc,
G4double particleMass)
{
fCof_val = fUnitConstant*particleCharge/MomentumXc; // B must be in Tesla
// fMass = particleMass;
@@ -12,9 +12,9 @@
#include "globals.hh"
void
G4Mag_SpinEqRhs::SetChargeMomentumMass(const G4double particleCharge, // in e+ units
const G4double MomentumXc,
const G4double mass)
G4Mag_SpinEqRhs::SetChargeMomentumMass(G4double particleCharge, // in e+ units
G4double MomentumXc,
G4double mass)
{
// To set fCof_val
G4Mag_EqRhs::SetChargeMomentumMass(particleCharge, MomentumXc, mass);
@@ -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-02-00 $
// GEANT4 tag $Name: geant4-03-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.3 2000/05/09 11:54:23 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4RKG3_Stepper.cc,v 1.5 2000/11/20 17:29:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4RKG3_Stepper.hh"
#include "G4ThreeVector.hh"
@@ -14,14 +14,14 @@
void G4RKG3_Stepper::Stepper( const G4double yInput[7],
const G4double dydx[7],
const G4double Step,
G4double Step,
G4double yOut[7],
G4double yErr[])
{
G4double B[3];
// G4double yderiv[6];
// G4double alpha2, beta2;
const G4int nvar = 6 ;
G4int nvar = 6 ;
// G4double beTemp2, beta2=0;
G4int i;
@@ -84,7 +84,7 @@ void G4RKG3_Stepper::Stepper( const G4double yInput[7],
void G4RKG3_Stepper::StepWithEst( const G4double tIn[7],
const G4double dydx[7],
const G4double Step,
G4double Step,
G4double tOut[7],
G4double& alpha2,
G4double& beta2,
@@ -96,7 +96,7 @@ void G4RKG3_Stepper::StepWithEst( const G4double tIn[7],
G4Exception(" G4RKG3_Stepper::StepWithEst ERROR: this Method is no longer used.");
#if 0
// const G4int nvar = 6 ;
// G4int nvar = 6 ;
G4double K1[7],K2[7],K3[7],K4[7] ;
G4double tTemp[7], yderiv[6] ;
G4double B[3];
@@ -170,9 +170,9 @@ void G4RKG3_Stepper::StepWithEst( const G4double tIn[7],
void G4RKG3_Stepper::StepNoErr(const G4double tIn[7],
const G4double dydx[7],
const G4double Step,
G4double tOut[7],
G4double B[3] ) // const
G4double Step,
G4double tOut[7],
G4double B[3] ) // const
{
// Copy and edit the routine above, to delete alpha2, beta2, ...
@@ -212,7 +212,6 @@ void G4RKG3_Stepper::StepNoErr(const G4double tIn[7],
// Calculates y-deriv(atives) & returns B too!
GetEquationOfMotion()->EvaluateRhsReturnB(tTemp,yderiv,B) ;
G4double drds2 = 0 ;
for(i=0;i<3;i++) // Output trajectory vector
{
K4[i] = Step * yderiv[i+3];
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SimpleHeum.cc,v 1.3 1999/12/15 14:49:49 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4SimpleHeum.cc,v 1.4 2000/11/01 15:15:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// Simple Heum:
// x_1 = x_0 + h *
@@ -56,9 +56,9 @@ G4SimpleHeum::~G4SimpleHeum()
void
G4SimpleHeum::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double yOut[])
const G4double dydx[],
G4double h,
G4double yOut[])
{
// const G4int nvar = 6 ;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SimpleRunge.cc,v 1.2 1999/12/15 14:49:50 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4SimpleRunge.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// Simple Runge:
//
@@ -29,9 +29,9 @@
//
// Constructor
G4SimpleRunge::G4SimpleRunge(G4Mag_EqRhs *EqRhs, G4int numberOfVariables):
G4MagErrorStepper(EqRhs, numberOfVariables),
fNumberOfVariables(numberOfVariables)
G4SimpleRunge::G4SimpleRunge(G4Mag_EqRhs *EqRhs, G4int numberOfVariables)
: G4MagErrorStepper(EqRhs, numberOfVariables),
fNumberOfVariables(numberOfVariables)
{
dydxTemp = new G4double[fNumberOfVariables] ;
yTemp = new G4double[fNumberOfVariables] ;
@@ -55,7 +55,7 @@ G4SimpleRunge::~G4SimpleRunge()
void
G4SimpleRunge::DumbStepper( const G4double yIn[],
const G4double dydx[],
const G4double h,
G4double h,
G4double yOut[])
{
// const G4int nvar = 6 ;
@@ -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-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UniformMagField.cc,v 1.2 1999/12/15 14:49:50 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4UniformMagField.cc,v 1.3 2000/11/01 15:15:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//
@@ -64,6 +64,7 @@ G4UniformMagField::G4UniformMagField (const G4UniformMagField &p)
G4UniformMagField& G4UniformMagField::operator = (const G4UniformMagField &p)
{
if (&p == this) return *this;
for (G4int i=0; i<3; i++)
fFieldComponents[i] = p.fFieldComponents[i];
return *this;
+33 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.10 2000/06/06 13:18:51 gcosmo Exp $
$Id: History,v 1.15 2000/11/20 17:31:33 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,38 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
November 20, 2000 G. Cosmo geommng-V02-00-04
- Fixes to remove warnings from "-Wall -ansi -pedantic" g++ compiler options:
o commented out variables declared and not used.
o fixed declaration of variables used before being initialised.
o fixed order of initialisation of member data in constructors.
o fixed usage of unsigned-int (size_t) for array indeces.
November 16, 2000 V.Grichine geommng-V02-00-03
- Fix in G4VSolid::CalculateClippedPoligonExtent(): removed assumption
that pMin<pMax by eliminating "else" condition. (D.Williams)
November 9, 2000 G.Cosmo geommng-V02-00-02
- Included test directory containing "voxel" test by L.Grainac.
November 1, 2000 G.Cosmo geommng-V02-00-01
- QA code revision and cleanup (+fixes from CodeWizard filtering):
o Added (private) declarations of copy constructor and assignment
operator where needed.
o Added "const" qualifier to accessor methods, wherever needed.
o Added equality check on operator= where needed.
o Made destructor "virtual" for classes having virtual methods,
wherever missing.
o Changed virtual functions to non-inline wherever's the case.
o Added "inline" qualifier to methods' declarations.
o Replaced usage of "do-loops" with "while-loops" in
G4VoxelLimits::ClipToLimits().
o General cosmetics
September 11, 2000 G.Cosmo geommng-V02-00-00
- G4SolidStore.cc: fixed bug in destructor causing memory corruption at
application exit when Boolean solids are involved (bug #154).
June 06, 2000 G.Cosmo geommng-V01-01-00
- G4DrawVoxels.hh: removed line '#define G4DrawVoxelsDebug' left in place
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4AffineTransform.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4AffineTransform
@@ -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-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// G4AffineTransformation Inline implementation
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4DrawVoxels.hh,v 1.9 2000/06/06 13:18:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4DrawVoxels
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4GeometryManager.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
// class G4GeometryManager
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalSurface.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4LogicalSurface.hh,v 1.4 2000/11/01 15:39:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
////////////////////////////////////////////////////////////////////////
// Class G4LogicalSurface
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4LogicalSurface.icc,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
////////////////////////////////////////////////////////////////////////
// Surface Class Inline Methods
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalVolume.hh,v 1.5 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4LogicalVolume.hh,v 1.6 2000/11/01 15:39:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4LogicalVolume
@@ -112,33 +112,33 @@ class 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);
inline G4String GetName() const;
inline void SetName(const G4String& pName);
// Returns and sets the name of the logical volume.
G4int GetNoDaughters() const;
inline G4int GetNoDaughters() const;
// Returns the number of daughters (0 to n).
G4VPhysicalVolume* GetDaughter(const G4int i) const;
inline 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);
inline void AddDaughter(G4VPhysicalVolume* p);
// Add the volume p as a daughter of the current logical volume.
G4bool IsDaughter(const G4VPhysicalVolume* p) const;
inline 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);
inline 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);
inline G4VSolid* GetSolid() const;
inline void SetSolid(G4VSolid *pSolid);
// Gets and sets the current solid.
G4Material* GetMaterial() const;
void SetMaterial(G4Material *pMaterial);
inline G4Material* GetMaterial() const;
inline void SetMaterial(G4Material *pMaterial);
// Gets and sets the current material.
G4FieldManager* GetFieldManager() const;
inline G4FieldManager* GetFieldManager() const;
// Gets current FieldManager.
void SetFieldManager(G4FieldManager *pFieldMgr, G4bool forceToAllDaughters);
// Sets FieldManager and propagates it:
@@ -147,44 +147,44 @@ class G4LogicalVolume
// ii) to all daughters
// if forceToAllDaughters=true
G4VSensitiveDetector* GetSensitiveDetector() const;
inline G4VSensitiveDetector* GetSensitiveDetector() const;
// Gets current SensitiveDetector.
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector);
inline void SetSensitiveDetector(G4VSensitiveDetector *pSDetector);
// Sets SensitiveDetector (can be NULL).
G4UserLimits* GetUserLimits() const;
void SetUserLimits(G4UserLimits *pULimits);
inline G4UserLimits* GetUserLimits() const;
inline void SetUserLimits(G4UserLimits *pULimits);
// Gets and sets current UserLimits.
G4SmartVoxelHeader* GetVoxelHeader() const;
void SetVoxelHeader(G4SmartVoxelHeader *pVoxel);
inline G4SmartVoxelHeader* GetVoxelHeader() const;
inline void SetVoxelHeader(G4SmartVoxelHeader *pVoxel);
// Gets and sets current VoxelHeader.
G4double GetSmartless();
void SetSmartless(G4double s);
inline G4double GetSmartless();
inline 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);
inline const G4VisAttributes* GetVisAttributes () const;
inline void SetVisAttributes (const G4VisAttributes* pVA);
inline void SetVisAttributes (const G4VisAttributes& VA);
// Gets and sets visualization attributes.
void BecomeEnvelopeForFastSimulation(G4FastSimulationManager* );
inline 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;
inline G4FastSimulationManager* GetFastSimulationManager () const;
// Gets current FastSimulationManager pointer.
void SetBiasWeight (G4double w);
G4double GetBiasWeight() const;
inline void SetBiasWeight (G4double w);
inline G4double GetBiasWeight() const;
// Sets and gets bias weight.
private:
@@ -198,6 +198,10 @@ class G4LogicalVolume
G4LogicalVolume* FindMotherLogicalVolumeForEnvelope();
G4LogicalVolume(const G4LogicalVolume&);
G4LogicalVolume& operator=(const G4LogicalVolume&);
// Private copy-constructor and assignment operator.
private:
// Data members:
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalVolume.icc,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4LogicalVolume.icc,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4LogicalVolume Inline Implementation file
@@ -16,46 +16,55 @@
// 09.11.98 - J. Apostolakis: Changed MagneticField to FieldManager
// 12.02.99 - S.Giani: Added set/get methods for voxelization quality
inline G4String G4LogicalVolume::GetName() const
inline
G4String G4LogicalVolume::GetName() const
{
return fName;
}
inline void G4LogicalVolume::SetName(const G4String& pName)
inline
void G4LogicalVolume::SetName(const G4String& pName)
{
fName=pName;
}
inline G4FieldManager* G4LogicalVolume::GetFieldManager() const
inline
G4FieldManager* G4LogicalVolume::GetFieldManager() const
{
return fFieldManager;
}
inline G4int G4LogicalVolume::GetNoDaughters() const
inline
G4int G4LogicalVolume::GetNoDaughters() const
{
return fDaughters.entries();
}
inline G4VPhysicalVolume* G4LogicalVolume::GetDaughter(const G4int i) const
inline
G4VPhysicalVolume* G4LogicalVolume::GetDaughter(const G4int i) const
{
return fDaughters(i);
}
inline G4FastSimulationManager*
G4LogicalVolume::GetFastSimulationManager () const
inline
G4FastSimulationManager* G4LogicalVolume::GetFastSimulationManager () const
{
return fFastSimulationManager;
}
inline void G4LogicalVolume::AddDaughter(G4VPhysicalVolume* pNewDaughter)
inline
void G4LogicalVolume::AddDaughter(G4VPhysicalVolume* pNewDaughter)
{
// manual resize operation to avoid Rogue grabbing RW_DEFAULT
// manual resize operation to avoid Rogue grabbing RW_DEFAULT
fDaughters.resize(fDaughters.entries()+1);
fDaughters.insert(pNewDaughter);
// Propagates the mother's FastSimulationManager pointer. If we are in
// the World logical volume, propagates only if pointer != 0.
// (perhaps someone would like to parametrize all the World volume
// for a particle type, why not ?).
// Propagates the mother's FastSimulationManager pointer. If we are in
// the World logical volume, propagates only if pointer != 0.
// (perhaps someone would like to parametrize all the World volume
// for a particle type, why not ?).
G4VPhysicalVolume *myPhysical= pNewDaughter->GetMother();
G4VPhysicalVolume *pMotherPhys;
G4LogicalVolume *pDaughterLogical;
@@ -68,124 +77,153 @@ inline void G4LogicalVolume::AddDaughter(G4VPhysicalVolume* pNewDaughter)
( pMotherPhys==0) && (fFastSimulationManager!=0))
{
if(pDaughterLogical->GetFastSimulationManager() != fFastSimulationManager)
pDaughterLogical->
SetFastSimulationManager(fFastSimulationManager,FALSE);
pDaughterLogical->SetFastSimulationManager(fFastSimulationManager,
FALSE);
}
else {
else
{
pDaughterLogical->SetFastSimulationManager(NULL,FALSE);
}
}
// Propagate the Field Manager, if the daughter has no field Manager.
pDaughterLogical = pNewDaughter->GetLogicalVolume();
G4FieldManager* pDaughterFieldManager = pDaughterLogical->GetFieldManager();
// Propagate the Field Manager, if the daughter has no field Manager.
if( pDaughterFieldManager == 0 ){
pDaughterLogical->SetFieldManager(fFieldManager,
true);
pDaughterLogical = pNewDaughter->GetLogicalVolume();
G4FieldManager* pDaughterFieldManager =
pDaughterLogical->GetFieldManager();
if( pDaughterFieldManager == 0 )
{
pDaughterLogical->SetFieldManager(fFieldManager, true);
}
}
inline G4bool G4LogicalVolume::IsDaughter(const G4VPhysicalVolume* p) const
inline
G4bool G4LogicalVolume::IsDaughter(const G4VPhysicalVolume* p) const
{
return fDaughters.contains(p);
}
inline void G4LogicalVolume::RemoveDaughter(const G4VPhysicalVolume* p)
inline
void G4LogicalVolume::RemoveDaughter(const G4VPhysicalVolume* p)
{
fDaughters.remove(p);
fDaughters.resize(fDaughters.entries());
}
inline G4VSolid* G4LogicalVolume::GetSolid() const
inline
G4VSolid* G4LogicalVolume::GetSolid() const
{
return fSolid;
}
inline void G4LogicalVolume::SetSolid(G4VSolid *pSolid)
inline
void G4LogicalVolume::SetSolid(G4VSolid *pSolid)
{
assert(pSolid != 0);
fSolid=pSolid;
}
inline G4Material* G4LogicalVolume::GetMaterial() const
inline
G4Material* G4LogicalVolume::GetMaterial() const
{
return fMaterial;
}
inline void G4LogicalVolume::SetMaterial(G4Material *pMaterial)
inline
void G4LogicalVolume::SetMaterial(G4Material *pMaterial)
{
// assert(pMaterial != 0);
fMaterial=pMaterial;
}
inline G4VSensitiveDetector* G4LogicalVolume::GetSensitiveDetector() const
inline
G4VSensitiveDetector* G4LogicalVolume::GetSensitiveDetector() const
{
return fSensitiveDetector;
}
inline void G4LogicalVolume::SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
inline
void G4LogicalVolume::SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
{
fSensitiveDetector=pSDetector;
}
inline G4UserLimits* G4LogicalVolume::GetUserLimits() const
inline
G4UserLimits* G4LogicalVolume::GetUserLimits() const
{
return fUserLimits;
}
inline void G4LogicalVolume::SetUserLimits(G4UserLimits *pULimits)
inline
void G4LogicalVolume::SetUserLimits(G4UserLimits *pULimits)
{
fUserLimits=pULimits;
}
inline G4SmartVoxelHeader* G4LogicalVolume::GetVoxelHeader() const
inline
G4SmartVoxelHeader* G4LogicalVolume::GetVoxelHeader() const
{
return fVoxel;
}
inline void G4LogicalVolume::SetVoxelHeader(G4SmartVoxelHeader *pVoxel)
inline
void G4LogicalVolume::SetVoxelHeader(G4SmartVoxelHeader *pVoxel)
{
fVoxel=pVoxel;
}
inline G4double G4LogicalVolume::GetSmartless()
inline
G4double G4LogicalVolume::GetSmartless()
{
return fSmartless;
}
inline void G4LogicalVolume::SetSmartless(G4double s)
inline
void G4LogicalVolume::SetSmartless(G4double s)
{
fSmartless=s;
}
inline G4bool G4LogicalVolume::operator == ( const G4LogicalVolume& lv) const
inline
G4bool G4LogicalVolume::operator == ( const G4LogicalVolume& lv) const
{
return (this==&lv) ? true : false;
}
inline const G4VisAttributes* G4LogicalVolume::GetVisAttributes () const {
return fVisAttributes;
}
inline
const G4VisAttributes* G4LogicalVolume::GetVisAttributes () const
{
return fVisAttributes;
}
inline void G4LogicalVolume::SetVisAttributes (const G4VisAttributes* pVA) {
fVisAttributes = pVA;
}
inline
void G4LogicalVolume::SetVisAttributes (const G4VisAttributes* pVA)
{
fVisAttributes = pVA;
}
inline void G4LogicalVolume::SetVisAttributes (const G4VisAttributes& VA) {
fVisAttributes = &VA;
}
inline
void G4LogicalVolume::SetVisAttributes (const G4VisAttributes& VA)
{
fVisAttributes = &VA;
}
inline void
G4LogicalVolume::BecomeEnvelopeForFastSimulation(G4FastSimulationManager* pPA) {
SetFastSimulationManager(pPA,TRUE);
}
G4LogicalVolume::BecomeEnvelopeForFastSimulation(G4FastSimulationManager* pPA)
{
SetFastSimulationManager(pPA,TRUE);
}
inline void G4LogicalVolume::SetBiasWeight(G4double w)
{ fBiasWeight = w; }
inline G4double G4LogicalVolume::GetBiasWeight() const
{ return fBiasWeight; }
inline
void G4LogicalVolume::SetBiasWeight(G4double w)
{
fBiasWeight = w;
}
inline
G4double G4LogicalVolume::GetBiasWeight() const
{
return fBiasWeight;
}
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4LogicalVolumeStore.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
// class G4LogicalVolumeStore
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PVParameterised.hh,v 1.3 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4PVParameterised.hh,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4PVParameterised
@@ -49,6 +49,9 @@ class G4PVParameterised : public G4PVReplica
// Almost exactly similar to first constructor, changing only mother
// pointer's type to LogicalVolume.
virtual ~G4PVParameterised();
// Virtual empty destructor.
virtual G4VPVParameterisation* GetParameterisation() const;
// Returns the current pointer to the parameterisation.
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PVPlacement.hh,v 1.3 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4PVPlacement.hh,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4PVPlacement
@@ -93,7 +93,7 @@ class G4PVPlacement : public G4VPhysicalVolume
G4int pCopyNo);
// Utilises both variations above (from 2nd and 3rd constructor).
~G4PVPlacement();
virtual ~G4PVPlacement();
// Default destructor.
virtual G4int GetCopyNo() const;
@@ -117,14 +117,21 @@ class G4PVPlacement : public G4VPhysicalVolume
private:
G4bool fmany; // flag for booleans/MANY - not used
G4bool fallocatedRotM; // flag for allocation of Rotation Matrix
G4int fcopyNo; // for identification
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.
G4PVPlacement(const G4PVPlacement&);
G4PVPlacement& operator=(const G4PVPlacement&);
// Private copy constructor and assignement operator.
private:
G4bool fmany; // flag for booleans/MANY - not used
G4bool fallocatedRotM; // flag for allocation of Rotation Matrix
G4int fcopyNo; // for identification
};
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PVReplica.hh,v 1.3 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4PVReplica.hh,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// class G4PVReplica
@@ -67,7 +67,7 @@
class G4PVReplica : public G4VPhysicalVolume
{
public:
public: // with description
G4PVReplica(const G4String& pName,
G4LogicalVolume* pLogical,
@@ -85,7 +85,7 @@ class G4PVReplica : public G4VPhysicalVolume
const G4double width,
const G4double offset=0);
~G4PVReplica();
virtual ~G4PVReplica();
virtual G4bool IsMany() const;
virtual G4int GetCopyNo() const;
@@ -106,6 +106,10 @@ class G4PVReplica : public G4VPhysicalVolume
const G4int nReplicas,
const G4double width,
const G4double offset);
G4PVReplica(const G4PVReplica&);
const G4PVReplica& operator=(const G4PVReplica&);
protected:
EAxis faxis;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicalVolumeStore.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4PhysicalVolumeStore.hh,v 1.5 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// class G4PhysicalVolume
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SmartVoxelHeader.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
// class G4SmartVoxelHeader
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SmartVoxelHeader.icc,v 1.1 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// G4SmartVoxelHeader Inline implementation

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