Import Geant4 5.2.0 source tree
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AuxiliaryNavServices.cc,v 1.3 2002/08/06 08:23:37 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4BlockingList.cc,v 1.7 2002/11/27 17:50:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
//
|
||||
// class G4BlockingList Implementation
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GRSSolid.cc,v 1.6 2003/03/31 14:39:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
//
|
||||
// class G4GRSSolid Implementation
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GRSVolume.cc,v 1.6 2003/03/31 14:39:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
//
|
||||
// class G4GRSVolume Implementation
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometryMessenger.cc,v 1.10 2003/03/17 13:46:25 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// $Id: G4GeometryMessenger.cc,v 1.12 2003/06/16 16:54:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
@@ -33,7 +33,7 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
|
||||
#include "g4std/iomanip"
|
||||
#include <iomanip>
|
||||
#include "G4GeometryMessenger.hh"
|
||||
|
||||
#include "G4TransportationManager.hh"
|
||||
@@ -46,7 +46,9 @@
|
||||
#include "G4UIcmdWith3VectorAndUnit.hh"
|
||||
#include "G4UIcmdWith3Vector.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
|
||||
#include "G4GeomTestStreamLogger.hh"
|
||||
@@ -56,8 +58,9 @@
|
||||
// Constructor
|
||||
//
|
||||
G4GeometryMessenger::G4GeometryMessenger(G4TransportationManager* tman)
|
||||
: x(0,0,0), p(0,0,1), newtol(false), tol(1E-4*mm),
|
||||
tmanager(tman), tlogger(0), tvolume(0)
|
||||
: x(0,0,0), p(0,0,1), grdRes(100,100,100), cylRes(90,50,50),
|
||||
cylfZ(0.8), cylfR(0.8), newtol(false), tol(1E-4*mm),
|
||||
recLevel(0), recDepth(-1), tmanager(tman), tlogger(0), tvolume(0)
|
||||
{
|
||||
geodir = new G4UIdirectory( "/geometry/" );
|
||||
geodir->SetGuidance( "Geometry control commands." );
|
||||
@@ -96,51 +99,123 @@ G4GeometryMessenger::G4GeometryMessenger(G4TransportationManager* tman)
|
||||
|
||||
tolCmd = new G4UIcmdWithADoubleAndUnit( "/geometry/test/tolerance",this );
|
||||
tolCmd->SetGuidance( "Set error tolerance value." );
|
||||
tolCmd->SetGuidance( "Default: 1E-4*mm." );
|
||||
tolCmd->SetGuidance( "Initial default value: 1E-4*mm." );
|
||||
tolCmd->SetParameterName( "Tolerance", true, true );
|
||||
tolCmd->SetDefaultValue( 1E-4 );
|
||||
tolCmd->SetDefaultUnit( "mm" );
|
||||
tolCmd->SetUnitCategory( "Length" );
|
||||
|
||||
posCmd = new G4UIcmdWith3VectorAndUnit( "/geometry/test/position", this );
|
||||
posCmd->SetGuidance( "Set starting position." );
|
||||
posCmd->SetGuidance( "Set starting position for the line_test." );
|
||||
posCmd->SetParameterName( "X", "Y", "Z", true, true );
|
||||
posCmd->SetDefaultUnit( "cm" );
|
||||
|
||||
dirCmd = new G4UIcmdWith3VectorAndUnit( "/geometry/test/direction", this );
|
||||
dirCmd->SetGuidance( "Set momentum direction." );
|
||||
dirCmd->SetGuidance( "Set momentum direction for the line_test." );
|
||||
dirCmd->SetGuidance( "Direction needs not to be a unit vector." );
|
||||
dirCmd->SetParameterName( "Px", "Py", "Pz", true, true );
|
||||
dirCmd->SetRange( "Px != 0 || Py != 0 || Pz != 0" );
|
||||
|
||||
linCmd = new G4UIcmdWithoutParameter( "/geometry/test/line_test", this );
|
||||
linCmd = new G4UIcmdWithABool( "/geometry/test/line_test", this );
|
||||
linCmd->SetGuidance( "Performs test along a single specified direction/position." );
|
||||
linCmd->SetGuidance( "Use position and direction commands to change default." );
|
||||
linCmd->SetGuidance( "Default: position(0,0,0), direction(0,0,1)." );
|
||||
linCmd->SetGuidance( "Initial default: position(0,0,0), direction(0,0,1)." );
|
||||
linCmd->SetGuidance( "If recursion flag is set to TRUE, the intersection checks" );
|
||||
linCmd->SetGuidance( "will be performed recursively in the geometry tree." );
|
||||
linCmd->SetParameterName("recursionFlag",true);
|
||||
linCmd->SetDefaultValue(false);
|
||||
linCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
grdCmd = new G4UIcmdWithoutParameter( "/geometry/test/grid_test", this );
|
||||
grzCmd = new G4UIcmdWith3Vector( "/geometry/test/grid_cells", this );
|
||||
grzCmd->SetGuidance( "Define resolution of grid geometry as number of cells," );
|
||||
grzCmd->SetGuidance( "specifying them for each dimension, X, Y and Z." );
|
||||
grzCmd->SetGuidance( "Will be applied to grid_test and recursive_test commands." );
|
||||
grzCmd->SetGuidance( "Initial default values: X=100, Y=100, Z=100." );
|
||||
grzCmd->SetParameterName( "X", "Y", "Z", true, true );
|
||||
grzCmd->SetDefaultValue( G4ThreeVector(100, 100, 100) );
|
||||
|
||||
grdCmd = new G4UIcmdWithABool( "/geometry/test/grid_test", this );
|
||||
grdCmd->SetGuidance( "Start running the default grid test." );
|
||||
grdCmd->SetGuidance( "A grid of lines parallel to a cartesian axis is used;" );
|
||||
grdCmd->SetGuidance( "Only direct daughters of the mother volumes are checked." );
|
||||
grdCmd->SetGuidance( "By default, only direct daughters of the mother volumes are checked." );
|
||||
grdCmd->SetGuidance( "If recursion flag is set to TRUE, the intersection checks" );
|
||||
grdCmd->SetGuidance( "will be performed recursively in the geometry tree." );
|
||||
grdCmd->SetGuidance( "NOTE: the recursion may take a very long time," );
|
||||
grdCmd->SetGuidance( " depending on the geometry complexity !");
|
||||
grdCmd->SetParameterName("recursionFlag",true);
|
||||
grdCmd->SetDefaultValue(false);
|
||||
grdCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
cyzCmd = new G4UIcmdWith3Vector( "/geometry/test/cylinder_geometry", this );
|
||||
cyzCmd->SetGuidance( "Define details of the cylinder geometry, specifying:" );
|
||||
cyzCmd->SetGuidance( " nPhi - number of lines per Phi" );
|
||||
cyzCmd->SetGuidance( " nZ - number of Z points" );
|
||||
cyzCmd->SetGuidance( " nRho - number of Rho points" );
|
||||
cyzCmd->SetGuidance( "Will be applied to the cylinder_test command." );
|
||||
cyzCmd->SetGuidance( "Initial default values: nPhi=90, nZ=50, nRho=50." );
|
||||
cyzCmd->SetParameterName( "nPhi", "nZ", "nRho", true, true );
|
||||
cyzCmd->SetDefaultValue( G4ThreeVector(90, 50, 50) );
|
||||
|
||||
cfzCmd = new G4UIcmdWithADouble( "/geometry/test/cylinder_scaleZ", this );
|
||||
cfzCmd->SetGuidance( "Define the resolution of the cylinder geometry, specifying" );
|
||||
cfzCmd->SetGuidance( "the fraction scale for points along Z." );
|
||||
cfzCmd->SetGuidance( "Initial default values: fracZ=0.8" );
|
||||
cfzCmd->SetParameterName("fracZ",true);
|
||||
cfzCmd->SetDefaultValue(0.8);
|
||||
|
||||
cfrCmd = new G4UIcmdWithADouble( "/geometry/test/cylinder_scaleRho", this );
|
||||
cfrCmd->SetGuidance( "Define the resolution of the cylinder geometry, specifying" );
|
||||
cfrCmd->SetGuidance( "the fraction scale for points along Rho." );
|
||||
cfrCmd->SetGuidance( "Initial default values: fracRho=0.8" );
|
||||
cfrCmd->SetParameterName("fracRho",true);
|
||||
cfrCmd->SetDefaultValue(0.8);
|
||||
|
||||
cylCmd = new G4UIcmdWithABool( "/geometry/test/cylinder_test", this );
|
||||
cylCmd->SetGuidance( "Start running the cylinder test." );
|
||||
cylCmd->SetGuidance( "A set of lines in a cylindrical pattern of gradually" );
|
||||
cylCmd->SetGuidance( "increasing mesh size." );
|
||||
cylCmd->SetGuidance( "By default, only direct daughters of the mother volumes are checked." );
|
||||
cylCmd->SetGuidance( "If recursion flag is set to TRUE, the intersection checks" );
|
||||
cylCmd->SetGuidance( "will be performed recursively in the geometry tree." );
|
||||
cylCmd->SetGuidance( "NOTE: the recursion may take a very long time," );
|
||||
cylCmd->SetGuidance( " depending on the geometry complexity !");
|
||||
cylCmd->SetParameterName("recursionFlag",true);
|
||||
cylCmd->SetDefaultValue(false);
|
||||
cylCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
rcsCmd = new G4UIcmdWithAnInteger( "/geometry/test/recursion_start", this );
|
||||
rcsCmd->SetGuidance( "Set the initial level in the geometry tree for recursion." );
|
||||
rcsCmd->SetGuidance( "recursive_test will then start from the specified level." );
|
||||
rcsCmd->SetParameterName("initial_level",true);
|
||||
rcsCmd->SetDefaultValue(0);
|
||||
|
||||
rcdCmd = new G4UIcmdWithAnInteger( "/geometry/test/recursion_depth", this );
|
||||
rcdCmd->SetGuidance( "Set the depth in the geometry tree for recursion." );
|
||||
rcdCmd->SetGuidance( "recursive_test will then stop after reached the specified depth." );
|
||||
rcdCmd->SetGuidance( "By default, recursion will proceed for the whole depth." );
|
||||
rcdCmd->SetParameterName("recursion_depth",true);
|
||||
rcdCmd->SetDefaultValue(-1);
|
||||
|
||||
// Obsolete verification commands ...
|
||||
|
||||
runCmd = new G4UIcmdWithABool( "/geometry/test/run", this );
|
||||
runCmd->SetGuidance( "Start running the default grid test." );
|
||||
runCmd->SetGuidance( "Same as the grid_test command." );
|
||||
runCmd->SetGuidance( "If recursion flag is set to TRUE, the intersection checks" );
|
||||
runCmd->SetGuidance( "will be performed recursively in the geometry tree." );
|
||||
runCmd->SetGuidance( "NOTE: the recursion may take a very long time," );
|
||||
runCmd->SetGuidance( " depending on the geometry complexity !");
|
||||
runCmd->SetParameterName("recursionFlag",true);
|
||||
runCmd->SetDefaultValue(false);
|
||||
runCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
recCmd = new G4UIcmdWithoutParameter( "/geometry/test/recursive_test", this );
|
||||
recCmd->SetGuidance( "Start running the recursive grid test." );
|
||||
recCmd->SetGuidance( "A grid of lines along a cartesian axis is recursively" );
|
||||
recCmd->SetGuidance( "to all daughters and daughters of daughters, etc." );
|
||||
recCmd->SetGuidance( "WARNING: it may take a very long time, depending on geometry complexity !");
|
||||
recCmd->SetGuidance( "NOTE: it may take a very long time," );
|
||||
recCmd->SetGuidance( " depending on the geometry complexity !");
|
||||
recCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
cylCmd = new G4UIcmdWithoutParameter( "/geometry/test/cylinder_test", this );
|
||||
cylCmd->SetGuidance( "Start running the cylinder test." );
|
||||
cylCmd->SetGuidance( "A set of lines in a cylindrical pattern of gradually" );
|
||||
cylCmd->SetGuidance( "increasing mesh size." );
|
||||
cylCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
runCmd = new G4UIcmdWithoutParameter( "/geometry/test/run", this );
|
||||
runCmd->SetGuidance( "Start running the default grid test." );
|
||||
runCmd->SetGuidance( "Same as the grid_test command." );
|
||||
runCmd->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -148,21 +223,14 @@ G4GeometryMessenger::G4GeometryMessenger(G4TransportationManager* tman)
|
||||
//
|
||||
G4GeometryMessenger::~G4GeometryMessenger()
|
||||
{
|
||||
delete linCmd;
|
||||
delete posCmd;
|
||||
delete dirCmd;
|
||||
delete grdCmd;
|
||||
delete recCmd;
|
||||
delete cylCmd;
|
||||
delete runCmd;
|
||||
delete resCmd;
|
||||
delete verbCmd;
|
||||
delete linCmd; delete posCmd; delete dirCmd;
|
||||
delete grzCmd; delete grdCmd; delete recCmd; delete runCmd;
|
||||
delete rcsCmd; delete rcdCmd;
|
||||
delete cyzCmd; delete cfzCmd; delete cfrCmd; delete cylCmd;
|
||||
delete tolCmd;
|
||||
delete geodir;
|
||||
delete navdir;
|
||||
delete testdir;
|
||||
delete tvolume;
|
||||
delete tlogger;
|
||||
delete resCmd; delete verbCmd;
|
||||
delete geodir; delete navdir; delete testdir;
|
||||
delete tvolume; delete tlogger;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -178,7 +246,7 @@ G4GeometryMessenger::Init()
|
||||
|
||||
// Create a logger to send errors/output to cout
|
||||
//
|
||||
tlogger = new G4GeomTestStreamLogger(G4std::cout);
|
||||
tlogger = new G4GeomTestStreamLogger(std::cout);
|
||||
|
||||
// Get the world volume
|
||||
//
|
||||
@@ -200,7 +268,7 @@ G4GeometryMessenger::SetNewValue( G4UIcommand* command, G4String newValues )
|
||||
ResetNavigator();
|
||||
}
|
||||
else if (command == verbCmd) {
|
||||
SetVerbosity(newValues);
|
||||
SetVerbosity( newValues );
|
||||
}
|
||||
else if (command == posCmd) {
|
||||
x = posCmd->GetNew3VectorValue( newValues );
|
||||
@@ -208,7 +276,7 @@ G4GeometryMessenger::SetNewValue( G4UIcommand* command, G4String newValues )
|
||||
else if (command == dirCmd) {
|
||||
p = dirCmd->GetNew3VectorValue( newValues );
|
||||
if (p.mag() < DBL_MIN) {
|
||||
G4cerr << "Please specify non-zero momentum" << G4endl;
|
||||
G4cerr << "Please specify non-zero momentum!" << G4endl;
|
||||
p = G4ThreeVector(0,0,1);
|
||||
}
|
||||
}
|
||||
@@ -218,11 +286,39 @@ G4GeometryMessenger::SetNewValue( G4UIcommand* command, G4String newValues )
|
||||
}
|
||||
else if (command == linCmd) {
|
||||
Init();
|
||||
LineTest();
|
||||
if (linCmd->GetNewBoolValue( newValues ))
|
||||
RecursiveLineTest();
|
||||
else
|
||||
LineTest();
|
||||
}
|
||||
else if ((command == grdCmd) || (command == runCmd)){
|
||||
Init();
|
||||
GridTest();
|
||||
if (grdCmd->GetNewBoolValue( newValues ) || runCmd->GetNewBoolValue( newValues ))
|
||||
RecursiveGridTest();
|
||||
else
|
||||
GridTest();
|
||||
}
|
||||
else if (command == grzCmd) {
|
||||
grdRes = grzCmd->GetNew3VectorValue( newValues );
|
||||
if (grdRes.mag() < DBL_MIN) {
|
||||
G4cerr << "Please specify non-zero resolution!" << G4endl;
|
||||
grdRes = G4ThreeVector(100,100,100);
|
||||
}
|
||||
}
|
||||
else if (command == cyzCmd) {
|
||||
cylRes = cyzCmd->GetNew3VectorValue( newValues );
|
||||
}
|
||||
else if (command == cfzCmd) {
|
||||
cylfZ = cfzCmd->GetNewDoubleValue( newValues );
|
||||
}
|
||||
else if (command == cfrCmd) {
|
||||
cylfR = cfrCmd->GetNewDoubleValue( newValues );
|
||||
}
|
||||
else if (command == rcsCmd) {
|
||||
recLevel = rcsCmd->GetNewIntValue( newValues );
|
||||
}
|
||||
else if (command == rcdCmd) {
|
||||
recDepth = rcdCmd->GetNewIntValue( newValues );
|
||||
}
|
||||
else if (command == recCmd) {
|
||||
Init();
|
||||
@@ -230,7 +326,10 @@ G4GeometryMessenger::SetNewValue( G4UIcommand* command, G4String newValues )
|
||||
}
|
||||
else if (command == cylCmd) {
|
||||
Init();
|
||||
CylinderTest();
|
||||
if (cylCmd->GetNewBoolValue( newValues ))
|
||||
RecursiveCylinderTest();
|
||||
else
|
||||
CylinderTest();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,6 +362,7 @@ G4GeometryMessenger::CheckGeometry()
|
||||
//
|
||||
G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
|
||||
if (!geomManager->IsGeometryClosed()) {
|
||||
geomManager->OpenGeometry();
|
||||
geomManager->CloseGeometry(true);
|
||||
}
|
||||
}
|
||||
@@ -273,14 +373,15 @@ G4GeometryMessenger::CheckGeometry()
|
||||
void
|
||||
G4GeometryMessenger::ResetNavigator()
|
||||
{
|
||||
// Close geometry if necessary
|
||||
// Close geometry and reset optimisation if necessary
|
||||
//
|
||||
CheckGeometry();
|
||||
|
||||
// Reset navigator's state
|
||||
//
|
||||
G4ThreeVector pt(0,0,0);
|
||||
tmanager->GetNavigatorForTracking()->LocateGlobalPointAndSetup(pt,0,false);
|
||||
G4Navigator* navigator = tmanager->GetNavigatorForTracking();
|
||||
navigator->LocateGlobalPointAndSetup(pt,0,false);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -317,6 +418,29 @@ G4GeometryMessenger::LineTest()
|
||||
tvolume->ReportErrors();
|
||||
}
|
||||
|
||||
//
|
||||
// RecursiveLineTest
|
||||
//
|
||||
void
|
||||
G4GeometryMessenger::RecursiveLineTest()
|
||||
{
|
||||
// Close geometry if necessary
|
||||
//
|
||||
CheckGeometry();
|
||||
|
||||
// Verify if error tolerance has changed
|
||||
//
|
||||
if (newtol) tvolume->SetTolerance(tol);
|
||||
|
||||
// Make test on single line supplied by user recursively
|
||||
//
|
||||
tvolume->TestRecursiveLine( x, p, recLevel, recDepth );
|
||||
|
||||
// Print out any errors, if found
|
||||
//
|
||||
tvolume->ReportErrors();
|
||||
}
|
||||
|
||||
//
|
||||
// GridTest
|
||||
//
|
||||
@@ -331,9 +455,11 @@ G4GeometryMessenger::GridTest()
|
||||
//
|
||||
if (newtol) tvolume->SetTolerance(tol);
|
||||
|
||||
// Apply default set of trajectories in a 3D grid pattern
|
||||
// Apply set of trajectories in a 3D grid pattern
|
||||
//
|
||||
tvolume->TestCartGridXYZ();
|
||||
tvolume->TestCartGridXYZ( G4int(grdRes.x()),
|
||||
G4int(grdRes.y()),
|
||||
G4int(grdRes.z()) );
|
||||
|
||||
// Print out any errors, if found
|
||||
//
|
||||
@@ -354,9 +480,12 @@ G4GeometryMessenger::RecursiveGridTest()
|
||||
//
|
||||
if (newtol) tvolume->SetTolerance(tol);
|
||||
|
||||
// Apply default set of trajectories in a 3D grid pattern recursively
|
||||
// Apply set of trajectories in a 3D grid pattern recursively
|
||||
//
|
||||
tvolume->TestRecursiveCartGrid();
|
||||
tvolume->TestRecursiveCartGrid( G4int(grdRes.x()),
|
||||
G4int(grdRes.y()),
|
||||
G4int(grdRes.z()),
|
||||
recLevel, recDepth );
|
||||
|
||||
// Print out any errors, if found
|
||||
//
|
||||
@@ -378,9 +507,40 @@ G4GeometryMessenger::CylinderTest()
|
||||
if (newtol) tvolume->SetTolerance(tol);
|
||||
|
||||
// Apply default set of lines in a cylindrical pattern of gradually
|
||||
// increasing mesh size of trajectories in a 3D grid pattern recursively
|
||||
// increasing mesh size of trajectories in a 3D grid pattern
|
||||
//
|
||||
tvolume->TestCylinder();
|
||||
tvolume->TestCylinder(G4int(cylRes.x()),
|
||||
G4int(cylRes.y()),
|
||||
G4int(cylRes.z()),
|
||||
cylfZ, cylfR, true);
|
||||
|
||||
// Print out any errors, if found
|
||||
//
|
||||
tvolume->ReportErrors();
|
||||
}
|
||||
|
||||
//
|
||||
// RecursiveCylinderTest
|
||||
//
|
||||
void
|
||||
G4GeometryMessenger::RecursiveCylinderTest()
|
||||
{
|
||||
// Close geometry if necessary
|
||||
//
|
||||
CheckGeometry();
|
||||
|
||||
// Verify if error tolerance has changed
|
||||
//
|
||||
if (newtol) tvolume->SetTolerance(tol);
|
||||
|
||||
// Apply default set of lines in a cylindrical pattern of gradually
|
||||
// increasing mesh size of trajectories in a 3D grid pattern recursively
|
||||
//
|
||||
tvolume->TestRecursiveCylinder(G4int(cylRes.x()),
|
||||
G4int(cylRes.y()),
|
||||
G4int(cylRes.z()),
|
||||
cylfZ, cylfR, true,
|
||||
recLevel, recDepth );
|
||||
|
||||
// Print out any errors, if found
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4IdentityTrajectoryFilter.cc,v 1.4 2003/02/06 18:53:16 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
|
||||
#include "G4IdentityTrajectoryFilter.hh"
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4LogicalBorderSurface.cc,v 1.8 2002/08/06 08:23:38 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// $Id: G4LogicalBorderSurface.cc,v 1.9 2003/06/16 16:54:53 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// G4LogicalBorderSurface Implementation
|
||||
@@ -106,7 +106,7 @@ G4LogicalBorderSurface::operator!=(const G4LogicalBorderSurface &right) const
|
||||
// Methods
|
||||
//
|
||||
|
||||
const G4std::vector<G4LogicalBorderSurface*> *
|
||||
const std::vector<G4LogicalBorderSurface*> *
|
||||
G4LogicalBorderSurface::GetSurfaceTable()
|
||||
{
|
||||
return &theBorderSurfaceTable;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4LogicalSkinSurface.cc,v 1.8 2002/08/06 08:23:38 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// G4LogicalSkinSurface Implementation
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4NavigationHistory.cc,v 1.6 2002/08/06 10:35:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// $Id: G4NavigationHistory.cc,v 1.7 2003/06/16 16:54:54 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
//
|
||||
// G4NavigationHistory Implementation
|
||||
@@ -52,8 +52,8 @@ G4NavigationHistory::~G4NavigationHistory()
|
||||
// delete fNavHistory(0);
|
||||
}
|
||||
|
||||
G4std::ostream&
|
||||
operator << (G4std::ostream& os, const G4NavigationHistory& nav)
|
||||
std::ostream&
|
||||
operator << (std::ostream& os, const G4NavigationHistory& nav)
|
||||
{
|
||||
G4cout << "History depth=" << nav.GetDepth() << G4endl;
|
||||
for ( G4int i=0; i<=nav.GetDepth(); i++ )
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Navigator.cc,v 1.35 2003/03/17 13:42:33 gcosmo Exp $
|
||||
// $Id: G4Navigator.cc,v 1.36 2003/06/16 16:54:55 gunter Exp $
|
||||
// GEANT4 tag $ Name: $
|
||||
//
|
||||
// class G4Navigator Implementation
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "g4std/iomanip"
|
||||
#include <iomanip>
|
||||
|
||||
// ********************************************************************
|
||||
// Constructor
|
||||
@@ -531,14 +531,14 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
G4LogicalVolume *motherLogical = motherPhysical->GetLogicalVolume();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
G4std::cout.precision(8);
|
||||
std::cout.precision(8);
|
||||
if( fVerbose > 1 )
|
||||
{
|
||||
G4cout << "*** G4Navigator::ComputeStep: ***" << G4endl;
|
||||
G4std::cout.precision(8);
|
||||
std::cout.precision(8);
|
||||
G4cout << " I was called with the following arguments: " << G4endl
|
||||
<< " Globalpoint = " << G4std::setw(25) << pGlobalpoint << G4endl
|
||||
<< " Direction = " << G4std::setw(25) << pDirection << G4endl
|
||||
<< " Globalpoint = " << std::setw(25) << pGlobalpoint << G4endl
|
||||
<< " Direction = " << std::setw(25) << pDirection << G4endl
|
||||
<< " ProposedStepLength= " << pCurrentProposedStepLength << G4endl;
|
||||
}
|
||||
if( fVerbose > 2 )
|
||||
@@ -966,7 +966,7 @@ G4double G4Navigator::ComputeSafety( const G4ThreeVector &pGlobalpoint,
|
||||
#ifdef G4VERBOSE
|
||||
if( fVerbose > 1 )
|
||||
{
|
||||
G4std::cout.precision(8);
|
||||
std::cout.precision(8);
|
||||
G4cout << "Upon exiting my state is: " << G4endl;
|
||||
PrintState();
|
||||
G4cout << " and I return a value of Safety = " << newSafety << G4endl;
|
||||
@@ -1003,24 +1003,24 @@ void G4Navigator::PrintState()
|
||||
if( ( 1 < fVerbose) && (fVerbose < 4) )
|
||||
{
|
||||
G4cout.precision(3);
|
||||
G4cout << G4std::setw(24) << " ExitNormal " << " "
|
||||
<< G4std::setw( 5) << " Valid " << " "
|
||||
<< G4std::setw( 9) << " Exiting " << " "
|
||||
<< G4std::setw( 9) << " Entering" << " "
|
||||
<< G4std::setw(15) << " Blocked:Volume " << " "
|
||||
<< G4std::setw( 9) << " ReplicaNo" << " "
|
||||
<< G4std::setw( 8) << " LastStepZero " << " "
|
||||
G4cout << std::setw(24) << " ExitNormal " << " "
|
||||
<< std::setw( 5) << " Valid " << " "
|
||||
<< std::setw( 9) << " Exiting " << " "
|
||||
<< std::setw( 9) << " Entering" << " "
|
||||
<< std::setw(15) << " Blocked:Volume " << " "
|
||||
<< std::setw( 9) << " ReplicaNo" << " "
|
||||
<< std::setw( 8) << " LastStepZero " << " "
|
||||
<< G4endl;
|
||||
G4cout << G4std::setw(24) << fExitNormal << " "
|
||||
<< G4std::setw( 5) << fValidExitNormal << " "
|
||||
<< G4std::setw( 9) << fExiting << " "
|
||||
<< G4std::setw( 9) << fEntering << " ";
|
||||
G4cout << std::setw(24) << fExitNormal << " "
|
||||
<< std::setw( 5) << fValidExitNormal << " "
|
||||
<< std::setw( 9) << fExiting << " "
|
||||
<< std::setw( 9) << fEntering << " ";
|
||||
if (fBlockedPhysicalVolume==0 )
|
||||
G4cout << G4std::setw(15) << "None";
|
||||
G4cout << std::setw(15) << "None";
|
||||
else
|
||||
G4cout << G4std::setw(15)<< fBlockedPhysicalVolume->GetName();
|
||||
G4cout << G4std::setw( 9) << fBlockedReplicaNo << " "
|
||||
<< G4std::setw( 8) << fLastStepWasZero << " "
|
||||
G4cout << std::setw(15)<< fBlockedPhysicalVolume->GetName();
|
||||
G4cout << std::setw( 9) << fBlockedReplicaNo << " "
|
||||
<< std::setw( 8) << fLastStepWasZero << " "
|
||||
<< G4endl;
|
||||
}
|
||||
if( fVerbose > 2 )
|
||||
@@ -1036,7 +1036,7 @@ void G4Navigator::PrintState()
|
||||
// Operator <<
|
||||
// ********************************************************************
|
||||
//
|
||||
G4std::ostream& operator << (G4std::ostream &os,const G4Navigator &n)
|
||||
std::ostream& operator << (std::ostream &os,const G4Navigator &n)
|
||||
{
|
||||
os << "Current History: " << G4endl << n.fHistory;
|
||||
return os;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4NormalNavigation.cc,v 1.5 2002/08/06 10:35:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
//
|
||||
// class G4NormalNavigation Implementation
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisedNavigation.cc,v 1.8 2003/03/31 14:39:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// $Id: G4ParameterisedNavigation.cc,v 1.9 2003/06/16 16:54:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
//
|
||||
// class G4ParameterisedNavigation Implementation
|
||||
@@ -359,7 +359,7 @@ ComputeVoxelSafety(const G4ThreeVector& localPoint,
|
||||
maxCurCommonDelta = fVoxelSliceWidth-minCurCommonDelta;
|
||||
plusVoxelSafety = minCurNodeNoDelta*fVoxelSliceWidth+minCurCommonDelta;
|
||||
minusVoxelSafety = maxCurNodeNoDelta*fVoxelSliceWidth+maxCurCommonDelta;
|
||||
voxelSafety = G4std::min(plusVoxelSafety,minusVoxelSafety);
|
||||
voxelSafety = std::min(plusVoxelSafety,minusVoxelSafety);
|
||||
|
||||
if ( voxelSafety<0 )
|
||||
{
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PropagatorInField.cc,v 1.39.4.1 2003/03/31 14:34:27 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// $Id: G4PropagatorInField.cc,v 1.49 2003/06/25 13:12:37 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
//
|
||||
// This class implements an algorithm to track a particle in a
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#include "G4PropagatorInField.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "g4std/iomanip"
|
||||
#include <iomanip>
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4VCurvedTrajectoryFilter.hh"
|
||||
|
||||
@@ -57,10 +57,11 @@ G4PropagatorInField::G4PropagatorInField( G4Navigator *theNavigator,
|
||||
fVerboseLevel(0),
|
||||
fEpsilonMinDefault(5.0e-7),
|
||||
fEpsilonMaxDefault(0.05),
|
||||
fmax_loop_count(10000),
|
||||
fMax_loop_count(1000),
|
||||
fNoZeroStep(0),
|
||||
fCharge(0.0), fInitialMomentumModulus(0.0), fMass(0.0),
|
||||
fpTrajectoryFilter( 0 )
|
||||
fCharge(0.0), fInitialMomentumModulus(0.0), fMass(0.0),
|
||||
fSetFieldMgr(false),
|
||||
fpTrajectoryFilter( 0 )
|
||||
{
|
||||
fEpsilonMin = fEpsilonMinDefault;
|
||||
fEpsilonMax = fEpsilonMaxDefault;
|
||||
@@ -71,6 +72,9 @@ G4PropagatorInField::G4PropagatorInField( G4Navigator *theNavigator,
|
||||
fFull_CurveLen_of_LastAttempt = -1;
|
||||
fLast_ProposedStepLength = -1;
|
||||
fLargestAcceptableStep = 1000.0 * meter;
|
||||
|
||||
fPreviousSftOrigin= G4ThreeVector(0.,0.,0.);
|
||||
fPreviousSafety= 0.0;
|
||||
}
|
||||
|
||||
G4PropagatorInField::~G4PropagatorInField()
|
||||
@@ -88,6 +92,10 @@ G4PropagatorInField::ComputeStep(
|
||||
G4double& currentSafety, // IN/OUT
|
||||
G4VPhysicalVolume* pPhysVol)
|
||||
{
|
||||
// If CurrentProposedStepLength is too small for finding Chords
|
||||
// just forget.
|
||||
if(CurrentProposedStepLength<kCarTolerance) return DBL_MAX;
|
||||
|
||||
// Introducing smooth trajectory display (jacek 01/11/2002)
|
||||
if (fpTrajectoryFilter) {
|
||||
fpTrajectoryFilter->CreateNewTrajectorySegment();
|
||||
@@ -105,16 +113,14 @@ G4PropagatorInField::ComputeStep(
|
||||
G4double NewSafety;
|
||||
fParticleIsLooping = false;
|
||||
|
||||
// Set the field manager if the volume has one, else use the global one
|
||||
// If not yet done,
|
||||
// Set the field manager to the local one if the volume has one,
|
||||
// or to the global one if not
|
||||
//
|
||||
fCurrentFieldMgr = fDetectorFieldMgr;
|
||||
if( pPhysVol)
|
||||
{
|
||||
G4FieldManager *newFieldMgr = 0;
|
||||
newFieldMgr= pPhysVol->GetLogicalVolume()->GetFieldManager();
|
||||
if ( newFieldMgr )
|
||||
fCurrentFieldMgr = newFieldMgr;
|
||||
}
|
||||
if( !fSetFieldMgr ) FindAndSetFieldManager( pPhysVol );
|
||||
// For the next call, the field manager must again be set
|
||||
fSetFieldMgr= false;
|
||||
|
||||
GetChordFinder()->SetChargeMomentumMass(fCharge, fInitialMomentumModulus, fMass);
|
||||
|
||||
G4FieldTrack CurrentState(pFieldTrack);
|
||||
@@ -132,14 +138,18 @@ G4PropagatorInField::ComputeStep(
|
||||
G4double trialProposedStep = 1.e2 * ( 10.0 * cm +
|
||||
fNavigator->GetWorldVolume()->GetLogicalVolume()->
|
||||
GetSolid()->DistanceToOut(StartPointA, VelocityUnit) );
|
||||
CurrentProposedStepLength= G4std::min( trialProposedStep,
|
||||
CurrentProposedStepLength= std::min( trialProposedStep,
|
||||
fLargestAcceptableStep );
|
||||
}
|
||||
epsilon = GetDeltaOneStep() / CurrentProposedStepLength;
|
||||
// G4double raw_epsilon= epsilon;
|
||||
if( epsilon < fEpsilonMin ) epsilon = fEpsilonMin;
|
||||
if( epsilon > fEpsilonMax ) epsilon = fEpsilonMax;
|
||||
SetEpsilonStep( epsilon );
|
||||
|
||||
// G4cout << "G4PiF: Epsilon of current step - raw= " << raw_epsilon
|
||||
// << " final= " << epsilon << G4endl;
|
||||
|
||||
// Shorten the proposed step in case of earlier problems (zero steps)
|
||||
//
|
||||
if( fNoZeroStep > fActionThreshold_NoZeroSteps )
|
||||
@@ -232,61 +242,36 @@ G4PropagatorInField::ComputeStep(
|
||||
// CurrentState is updated with the final position and velocity.
|
||||
//
|
||||
G4ThreeVector EndPointB = CurrentState.GetPosition();
|
||||
G4ThreeVector InterSectionPointE;
|
||||
G4double LinearStepLength;
|
||||
|
||||
// Intersect chord AB with geometry
|
||||
intersects= IntersectChord( SubStartPoint, EndPointB, NewSafety,
|
||||
LinearStepLength, InterSectionPointE );
|
||||
// E <- Intersection Point of chord AB and either volume A's surface
|
||||
// or a daughter volume's surface ..
|
||||
|
||||
// Calculate the direction and length of the chord AB
|
||||
|
||||
G4ThreeVector ChordAB_Vector = EndPointB - SubStartPoint;
|
||||
G4double ChordAB_Length = ChordAB_Vector.mag(); // Magnitude (norm)
|
||||
G4ThreeVector ChordAB_Dir = ChordAB_Vector.unit();
|
||||
|
||||
// Check whether any volumes are encountered by the chord AB
|
||||
|
||||
G4double LinearStepLength =
|
||||
fNavigator->ComputeStep( SubStartPoint, ChordAB_Dir,
|
||||
ChordAB_Length, NewSafety );
|
||||
if( first_substep )
|
||||
{
|
||||
currentSafety = NewSafety;
|
||||
}
|
||||
// It might also be possible to update safety in other steps, but
|
||||
// it must be done with care. J.Apostolakis August 5th, 1997
|
||||
|
||||
intersects = (LinearStepLength <= ChordAB_Length);
|
||||
// G4Navigator contracts to return k_infinity if len==asked
|
||||
// and it did not find a surface boundary at that length
|
||||
LinearStepLength = G4std::min( LinearStepLength, ChordAB_Length);
|
||||
if( first_substep ) {
|
||||
currentSafety = NewSafety;
|
||||
} // Updating safety in other steps is potential future extention
|
||||
|
||||
if( intersects )
|
||||
{
|
||||
// E <- Intersection Point of chord AB and either volume A's surface
|
||||
// or a daughter volume's surface ..
|
||||
G4FieldTrack IntersectPointVelct_G(CurrentState); // FT-Def-Construct
|
||||
|
||||
G4ThreeVector pointE = SubStartPoint + LinearStepLength * ChordAB_Dir;
|
||||
|
||||
G4FieldTrack IntersectPointVelct_G(CurrentState); // FT-Def-Construct
|
||||
|
||||
// Find the intersection point of AB true path with the surface
|
||||
// of vol(A) given our current "estimate" point E.
|
||||
|
||||
G4bool found_intersection =
|
||||
LocateIntersectionPoint( SubStepStartState, CurrentState,
|
||||
pointE, IntersectPointVelct_G );
|
||||
if( found_intersection )
|
||||
{
|
||||
End_PointAndTangent= IntersectPointVelct_G; // G is our EndPoint ...
|
||||
StepTaken = TruePathLength = IntersectPointVelct_G.GetCurveLength()
|
||||
- OriginalState.GetCurveLength();
|
||||
// which is Zero now.
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if( Verbose() > 0 )
|
||||
G4cout << " Found intersection after Step of length "
|
||||
<< StepTaken << G4endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
intersects= false; // "Minor" chords do not intersect
|
||||
}
|
||||
// Find the intersection point of AB true path with the surface
|
||||
// of vol(A), if it exists. Start with point E as first "estimate".
|
||||
G4bool found_intersection =
|
||||
LocateIntersectionPoint( SubStepStartState, CurrentState,
|
||||
InterSectionPointE, IntersectPointVelct_G );
|
||||
// intersects = intersects & found_intersection;
|
||||
if( found_intersection ) {
|
||||
End_PointAndTangent= IntersectPointVelct_G; // G is our EndPoint ...
|
||||
StepTaken = TruePathLength = IntersectPointVelct_G.GetCurveLength()
|
||||
- OriginalState.GetCurveLength();
|
||||
} else {
|
||||
intersects= false; // "Minor" chords do not intersect
|
||||
}
|
||||
}
|
||||
if( !intersects )
|
||||
{
|
||||
@@ -304,11 +289,8 @@ G4PropagatorInField::ComputeStep(
|
||||
if( fNoZeroStep > fActionThreshold_NoZeroSteps )
|
||||
{
|
||||
printStatus( SubStepStartState, // or OriginalState,
|
||||
CurrentState,
|
||||
CurrentProposedStepLength,
|
||||
NewSafety,
|
||||
do_loop_count,
|
||||
pPhysVol );
|
||||
CurrentState, CurrentProposedStepLength,
|
||||
NewSafety, do_loop_count, pPhysVol );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -316,9 +298,9 @@ G4PropagatorInField::ComputeStep(
|
||||
|
||||
} while( (!intersects )
|
||||
&& (StepTaken + kCarTolerance < CurrentProposedStepLength)
|
||||
&& ( do_loop_count < GetMaxLoopCount() ) );
|
||||
&& ( do_loop_count < fMax_loop_count ) );
|
||||
|
||||
if( do_loop_count >= GetMaxLoopCount() )
|
||||
if( do_loop_count >= fMax_loop_count )
|
||||
{
|
||||
G4cout << "G4PropagateInField: Warning: Particle is looping - "
|
||||
<< " tracking in field will be stopped. " << G4endl;
|
||||
@@ -335,9 +317,6 @@ G4PropagatorInField::ComputeStep(
|
||||
{
|
||||
// Chord AB or "minor chords" do not intersect
|
||||
// B is the endpoint Step of the current Step.
|
||||
// [ But if we were angle limited we could use B
|
||||
// as a new starting point ? ]
|
||||
// On return we specify the endpoint, point B
|
||||
//
|
||||
End_PointAndTangent = CurrentState;
|
||||
TruePathLength = StepTaken;
|
||||
@@ -366,11 +345,14 @@ G4PropagatorInField::ComputeStep(
|
||||
#endif
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
if( fNoZeroStep )
|
||||
{
|
||||
G4cout << " PiF: Step returning= " << StepTaken << G4endl;
|
||||
G4cout << " ------------------------------------------------------- "
|
||||
<< G4endl;
|
||||
// static G4std::vector<G4int> ZeroStepNumberHist(fAbandonThreshold+1);
|
||||
if( fNoZeroStep ){
|
||||
// ZeroStepNumberHist[fNoZeroStep]++;
|
||||
if( fNoZeroStep > fActionThreshold_NoZeroSteps ){
|
||||
G4cout << " PiF: Step returning=" << StepTaken << G4endl;
|
||||
G4cout << " ------------------------------------------------------- "
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -384,17 +366,14 @@ G4PropagatorInField::ComputeStep(
|
||||
fNoZeroStep = 0;
|
||||
|
||||
if( fNoZeroStep > fAbandonThreshold_NoZeroSteps ) {
|
||||
G4cout << " WARNING - G4PropagatorInField::ComputeStep():" << G4endl
|
||||
<< " Zero progress for " << fNoZeroStep << " attempted steps."
|
||||
<< G4endl;
|
||||
#ifdef G4VERBOSE
|
||||
G4cout << " WARNING - G4PropagatorInField::ComputeStep():" << G4endl
|
||||
<< " No progress after " << fNoZeroStep << " trial steps. "
|
||||
<< G4endl;
|
||||
G4cout << " Particle will be killed." << G4endl;
|
||||
#else
|
||||
G4cout << " WARNING - G4PropagatorInField::ComputeStep():" << G4endl
|
||||
<< " Particle that is stuck will be killed." << G4endl;
|
||||
G4cout << " Particle that is stuck will be killed." << G4endl;
|
||||
#endif
|
||||
fNoZeroStep = 0;
|
||||
fParticleIsLooping = true;
|
||||
fNoZeroStep = 0;
|
||||
fParticleIsLooping = true;
|
||||
}
|
||||
return TruePathLength;
|
||||
}
|
||||
@@ -500,62 +479,41 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
// called at the start of the physical Step
|
||||
|
||||
first_step = false;
|
||||
|
||||
// Calculate the length and direction of the chord AF
|
||||
//
|
||||
G4ThreeVector ChordAF_Vector = CurrentF_Point - Point_A;
|
||||
G4double ChordAF_Length = ChordAF_Vector.mag();
|
||||
G4ThreeVector ChordAF_Dir = ChordAF_Vector.unit();
|
||||
|
||||
G4double stepLength = fNavigator->ComputeStep( Point_A, ChordAF_Dir,
|
||||
ChordAF_Length, NewSafety);
|
||||
|
||||
G4bool Intersects_AF = (stepLength <= ChordAF_Length);
|
||||
stepLength = G4std::min(stepLength, ChordAF_Length);
|
||||
G4ThreeVector PointG; // Candidate intersection point
|
||||
G4double stepLengthAF;
|
||||
G4bool Intersects_AF = IntersectChord( Point_A, CurrentF_Point,
|
||||
NewSafety, stepLengthAF,
|
||||
PointG
|
||||
);
|
||||
if( Intersects_AF )
|
||||
{
|
||||
// There is an intersection of AF with a volume boundary
|
||||
// G <- First Intersection of Chord AF
|
||||
//
|
||||
G4ThreeVector PointG = Point_A + stepLength * ChordAF_Dir;
|
||||
|
||||
// G is our new Candidate for the intersection point.
|
||||
// It replaces "E" and we will repeat the test to see if
|
||||
// it is a good enough approximate point for us.
|
||||
// B <- F
|
||||
// E <- G
|
||||
//
|
||||
CurrentB_PointVelocity = ApproxIntersecPointV;
|
||||
CurrentE_Point = PointG;
|
||||
}
|
||||
else // not Intersects_AF
|
||||
{
|
||||
}
|
||||
else // not Intersects_AF
|
||||
{
|
||||
// In this case:
|
||||
// There is NO intersection of AF with a volume boundary.
|
||||
// We must continue the search in the segment FB!
|
||||
fNavigator->LocateGlobalPointWithinVolume( CurrentF_Point );
|
||||
|
||||
G4double stepLengthFB;
|
||||
G4ThreeVector PointH;
|
||||
// Check whether any volumes are encountered by the chord FB
|
||||
// ---------------------------------------------------------
|
||||
// Calculate the length and direction of the chord AF
|
||||
//
|
||||
G4ThreeVector ChordFB_Vector = Point_B - CurrentF_Point;
|
||||
G4double ChordFB_Length = ChordFB_Vector.mag();
|
||||
G4ThreeVector ChordFB_Dir = ChordFB_Vector.unit();
|
||||
|
||||
fNavigator->LocateGlobalPointWithinVolume( CurrentF_Point );
|
||||
G4double stepLength =
|
||||
fNavigator->ComputeStep( CurrentF_Point, ChordFB_Dir,
|
||||
ChordFB_Length, NewSafety);
|
||||
|
||||
G4bool Intersects_FB = stepLength <= ChordFB_Length;
|
||||
stepLength = G4std::min(stepLength, ChordFB_Length);
|
||||
G4bool Intersects_FB =
|
||||
IntersectChord( CurrentF_Point, Point_B,
|
||||
NewSafety, stepLengthFB, PointH );
|
||||
|
||||
if( Intersects_FB )
|
||||
{
|
||||
// There is an intersection of FB with a volume boundary
|
||||
// H <- First Intersection of Chord FB
|
||||
//
|
||||
G4ThreeVector PointH = CurrentF_Point + stepLength * ChordFB_Dir;
|
||||
|
||||
// H is our new Candidate for the intersection point.
|
||||
// It replaces "E" and we will repeat the test to see if
|
||||
@@ -591,29 +549,14 @@ G4PropagatorInField::LocateIntersectionPoint(
|
||||
- CurrentA_PointVelocity.GetCurveLength();
|
||||
if( curveDist*(curveDist+2*perMillion ) < linDistSq )
|
||||
{
|
||||
// Re-integrate to obtain a new B
|
||||
//
|
||||
G4FieldTrack newEndpoint = CurrentA_PointVelocity;
|
||||
GetChordFinder()->GetIntegrationDriver()
|
||||
->AccurateAdvance(newEndpoint, curveDist, fEpsilonStep);
|
||||
CurrentB_PointVelocity = newEndpoint;
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
static G4int noInaccuracyWarnings = 0;
|
||||
G4int maxNoWarnings = 10;
|
||||
if ( (noInaccuracyWarnings < maxNoWarnings )
|
||||
|| (Verbose() > 1) )
|
||||
{
|
||||
G4cerr << "G4PropagatorInField::LocateIntersectionPoint():"
|
||||
<< G4endl
|
||||
<< " Warning: Integration inaccuracy requires " << G4endl
|
||||
<< " an adjustment in the step's endpoint " << G4endl
|
||||
<< " Two mid-points are further apart than their "
|
||||
<< "curve length difference" << G4endl
|
||||
<< " Dist = " << sqrt(linDistSq)
|
||||
<< " curve length = " << curveDist << G4endl;
|
||||
}
|
||||
#endif
|
||||
// Re-integrate to obtain a new B
|
||||
//
|
||||
G4FieldTrack newEndPoint=
|
||||
ReEstimateEndpoint( CurrentA_PointVelocity,
|
||||
CurrentB_PointVelocity,
|
||||
linDistSq, // to avoid recalculation
|
||||
curveDist );
|
||||
CurrentB_PointVelocity = newEndPoint;
|
||||
}
|
||||
if( curveDist < 0.0 )
|
||||
{
|
||||
@@ -668,20 +611,20 @@ G4PropagatorInField::printStatus( const G4FieldTrack& StartFT,
|
||||
static G4int noPrecision= 4;
|
||||
G4cout.precision(noPrecision);
|
||||
// G4cout.setf(ios_base::fixed,ios_base::floatfield);
|
||||
G4cout << G4std::setw( 6) << " "
|
||||
<< G4std::setw( 25) << " Current Position and Direction" << " "
|
||||
G4cout << std::setw( 6) << " "
|
||||
<< std::setw( 25) << " Current Position and Direction" << " "
|
||||
<< G4endl;
|
||||
G4cout << G4std::setw( 5) << "Step#" << " "
|
||||
<< G4std::setw( 9) << "X(mm)" << " "
|
||||
<< G4std::setw( 9) << "Y(mm)" << " "
|
||||
<< G4std::setw( 9) << "Z(mm)" << " "
|
||||
<< G4std::setw( 7) << " N_x " << " "
|
||||
<< G4std::setw( 7) << " N_y " << " "
|
||||
<< G4std::setw( 7) << " N_z " << " "
|
||||
<< G4std::setw( 9) << "StepLen" << " "
|
||||
<< G4std::setw(12) << "PhsStep" << " "
|
||||
<< G4std::setw(12) << "StartSafety" << " "
|
||||
<< G4std::setw(18) << "NextVolume" << " "
|
||||
G4cout << std::setw( 5) << "Step#" << " "
|
||||
<< std::setw( 9) << "X(mm)" << " "
|
||||
<< std::setw( 9) << "Y(mm)" << " "
|
||||
<< std::setw( 9) << "Z(mm)" << " "
|
||||
<< std::setw( 7) << " N_x " << " "
|
||||
<< std::setw( 7) << " N_y " << " "
|
||||
<< std::setw( 7) << " N_z " << " "
|
||||
<< std::setw( 9) << "StepLen" << " "
|
||||
<< std::setw(12) << "PhsStep" << " "
|
||||
<< std::setw(12) << "StartSafety" << " "
|
||||
<< std::setw(18) << "NextVolume" << " "
|
||||
<< G4endl;
|
||||
|
||||
// Recurse to print the start values
|
||||
@@ -692,32 +635,32 @@ G4PropagatorInField::printStatus( const G4FieldTrack& StartFT,
|
||||
{
|
||||
G4cout.precision(3);
|
||||
if( stepNo >= 0)
|
||||
G4cout << G4std::setw( 5) << stepNo << " ";
|
||||
G4cout << std::setw( 5) << stepNo << " ";
|
||||
else
|
||||
G4cout << G4std::setw( 5) << "Start" << " ";
|
||||
G4cout << G4std::setw( 9) << CurrentPosition.x() << " "
|
||||
<< G4std::setw( 9) << CurrentPosition.y() << " "
|
||||
<< G4std::setw( 9) << CurrentPosition.z() << " "
|
||||
<< G4std::setw( 7) << CurrentUnitVelocity.x() << " "
|
||||
<< G4std::setw( 7) << CurrentUnitVelocity.y() << " "
|
||||
<< G4std::setw( 7) << CurrentUnitVelocity.z() << " ";
|
||||
G4cout << G4std::setw( 9) << step_len << " ";
|
||||
G4cout << std::setw( 5) << "Start" << " ";
|
||||
G4cout << std::setw( 9) << CurrentPosition.x() << " "
|
||||
<< std::setw( 9) << CurrentPosition.y() << " "
|
||||
<< std::setw( 9) << CurrentPosition.z() << " "
|
||||
<< std::setw( 7) << CurrentUnitVelocity.x() << " "
|
||||
<< std::setw( 7) << CurrentUnitVelocity.y() << " "
|
||||
<< std::setw( 7) << CurrentUnitVelocity.z() << " ";
|
||||
G4cout << std::setw( 9) << step_len << " ";
|
||||
if( requestStep != -1.0 )
|
||||
G4cout << G4std::setw( 12) << requestStep << " ";
|
||||
G4cout << std::setw( 12) << requestStep << " ";
|
||||
else
|
||||
G4cout << G4std::setw( 12) << "InitialStep" << " ";
|
||||
G4cout << G4std::setw(12) << safety << " ";
|
||||
G4cout << std::setw( 12) << "InitialStep" << " ";
|
||||
G4cout << std::setw(12) << safety << " ";
|
||||
|
||||
if( startVolume != 0)
|
||||
{
|
||||
G4cout << G4std::setw(12) << startVolume->GetName() << " ";
|
||||
G4cout << std::setw(12) << startVolume->GetName() << " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
if( step_len != -1 )
|
||||
G4cout << G4std::setw(12) << "OutOfWorld" << " ";
|
||||
G4cout << std::setw(12) << "OutOfWorld" << " ";
|
||||
else
|
||||
G4cout << G4std::setw(12) << "NotGiven" << " ";
|
||||
G4cout << std::setw(12) << "NotGiven" << " ";
|
||||
}
|
||||
|
||||
G4cout << G4endl;
|
||||
@@ -756,8 +699,126 @@ G4PropagatorInField::PrintStepLengthDiagnostic(
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
G4bool
|
||||
G4PropagatorInField::IntersectChord( G4ThreeVector StartPointA,
|
||||
G4ThreeVector EndPointB,
|
||||
G4double &NewSafety,
|
||||
G4double &LinearStepLength,
|
||||
G4ThreeVector &IntersectionPoint
|
||||
)
|
||||
{
|
||||
// Calculate the direction and length of the chord AB
|
||||
G4ThreeVector ChordAB_Vector = EndPointB - StartPointA;
|
||||
G4double ChordAB_Length = ChordAB_Vector.mag(); // Magnitude (norm)
|
||||
G4ThreeVector ChordAB_Dir = ChordAB_Vector.unit();
|
||||
G4bool intersects;
|
||||
|
||||
G4std::vector<G4ThreeVector>*
|
||||
G4ThreeVector OriginShift = StartPointA - fPreviousSftOrigin ;
|
||||
G4double MagSqShift = OriginShift.mag2() ;
|
||||
G4double currentSafety;
|
||||
G4bool doCallNav= false;
|
||||
|
||||
if( MagSqShift >= sqr(fPreviousSafety) )
|
||||
{
|
||||
currentSafety = 0.0 ;
|
||||
}else{
|
||||
currentSafety = fPreviousSafety - sqrt(MagSqShift) ;
|
||||
}
|
||||
|
||||
if( ChordAB_Length <= currentSafety )
|
||||
{
|
||||
// The Step is guaranteed to be taken
|
||||
|
||||
LinearStepLength = ChordAB_Length;
|
||||
intersects = false;
|
||||
|
||||
NewSafety= currentSafety;
|
||||
}
|
||||
else
|
||||
{
|
||||
doCallNav= true;
|
||||
// Check whether any volumes are encountered by the chord AB
|
||||
LinearStepLength =
|
||||
fNavigator->ComputeStep( StartPointA, ChordAB_Dir,
|
||||
ChordAB_Length, NewSafety );
|
||||
intersects = (LinearStepLength <= ChordAB_Length);
|
||||
// G4Navigator contracts to return k_infinity if len==asked
|
||||
// and it did not find a surface boundary at that length
|
||||
LinearStepLength = std::min( LinearStepLength, ChordAB_Length);
|
||||
|
||||
// Save the last calculated safety!
|
||||
fPreviousSftOrigin = StartPointA;
|
||||
fPreviousSafety= NewSafety;
|
||||
|
||||
if( intersects ){
|
||||
// Intersection Point of chord AB and either volume A's surface
|
||||
// or a daughter volume's surface ..
|
||||
IntersectionPoint = StartPointA + LinearStepLength * ChordAB_Dir;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_INTERSECTS_CHORD
|
||||
// printIntersection(
|
||||
// StartPointA, EndPointB, LinearStepLength, IntersectionPoint, NewSafety
|
||||
|
||||
G4cout << "Start=" << std::setw(12) << StartPointA << " "
|
||||
<< "End= " << std::setw(8) << EndPointB << " "
|
||||
<< "StepIn=" << std::setw(8) << LinearStepLength << " "
|
||||
<< "NewSft=" << std::setw(8) << NewSafety
|
||||
<< "NavCall" << doCallNav << " "
|
||||
<< "In T/F " << intersects << " "
|
||||
<< "IntrPt=" << std::setw(8) << IntersectionPoint << " "
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
return intersects;
|
||||
}
|
||||
|
||||
G4FieldTrack G4PropagatorInField::
|
||||
ReEstimateEndpoint( const G4FieldTrack &CurrentStateA,
|
||||
const G4FieldTrack &EstimatedEndStateB,
|
||||
double linearDistSq,
|
||||
double curveDist
|
||||
)
|
||||
{
|
||||
G4FieldTrack newEndPoint( CurrentStateA );
|
||||
GetChordFinder()->GetIntegrationDriver()
|
||||
->AccurateAdvance(newEndPoint, curveDist, fEpsilonStep);
|
||||
// EstimatedEndStateB = newEndpoint;
|
||||
|
||||
#ifdef G4DEBUG_FIELD
|
||||
static G4int noInaccuracyWarnings = 0;
|
||||
G4int maxNoWarnings = 10;
|
||||
if ( (noInaccuracyWarnings < maxNoWarnings )
|
||||
|| (Verbose() > 1) )
|
||||
{
|
||||
G4cerr << "G4PropagatorInField::LocateIntersectionPoint():"
|
||||
<< G4endl
|
||||
<< " Warning: Integration inaccuracy requires"
|
||||
<< " an adjustment in the step's endpoint." << G4endl
|
||||
<< " Two mid-points are further apart than their"
|
||||
<< " curve length difference" << G4endl
|
||||
<< " Dist = " << sqrt(linearDistSq)
|
||||
<< " curve length = " << curveDist << G4endl;
|
||||
G4cerr << " Correction applied is "
|
||||
<< (newEndPoint.GetPosition()-EstimatedEndStateB.GetPosition()).mag()
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
return newEndPoint;
|
||||
}
|
||||
|
||||
// Access the points which have passed through the filter. The
|
||||
// points are stored as ThreeVectors for the initial impelmentation
|
||||
// only (jacek 30/10/2002)
|
||||
// Responsibility for deleting the points lies with
|
||||
// SmoothTrajectoryPoint, which is the points' final
|
||||
// destination. The points pointer is set to NULL, to ensure that
|
||||
// the points are not re-used in subsequent steps, therefore THIS
|
||||
// METHOD MUST BE CALLED EXACTLY ONCE PER STEP. (jacek 08/11/2002)
|
||||
|
||||
|
||||
std::vector<G4ThreeVector>*
|
||||
G4PropagatorInField::GimmeTrajectoryVectorAndForgetIt() const {
|
||||
// NB, GimmeThePointsAndForgetThem really forgets them, so it can
|
||||
// only be called (exactly) once for each step.
|
||||
@@ -768,8 +829,35 @@ G4PropagatorInField::GimmeTrajectoryVectorAndForgetIt() const {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
G4PropagatorInField::SetTrajectoryFilter(G4VCurvedTrajectoryFilter* filter) {
|
||||
fpTrajectoryFilter = filter;
|
||||
}
|
||||
|
||||
|
||||
void G4PropagatorInField::ClearPropagatorState()
|
||||
{
|
||||
G4Exception("G4PropagatorInField::ClearPropagatorState is not yet implemented");
|
||||
|
||||
}
|
||||
|
||||
G4FieldManager*
|
||||
G4PropagatorInField::FindAndSetFieldManager( G4VPhysicalVolume* pCurrentPhysicalVolume)
|
||||
{
|
||||
G4FieldManager* currentFieldMgr;
|
||||
|
||||
currentFieldMgr = fDetectorFieldMgr;
|
||||
if( pCurrentPhysicalVolume)
|
||||
{
|
||||
G4FieldManager *newFieldMgr = 0;
|
||||
newFieldMgr= pCurrentPhysicalVolume->GetLogicalVolume()->GetFieldManager();
|
||||
if ( newFieldMgr )
|
||||
currentFieldMgr = newFieldMgr;
|
||||
}
|
||||
fCurrentFieldMgr= currentFieldMgr;
|
||||
|
||||
// Flag that field manager has been set.
|
||||
fSetFieldMgr= true;
|
||||
|
||||
return currentFieldMgr;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ReplicaNavigation.cc,v 1.12 2003/03/31 14:39:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
//
|
||||
// class G4ReplicaNavigation Implementation
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4TouchableHistory.cc,v 1.6 2002/08/06 10:35:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
//
|
||||
// class G4TouchableHistory Implementation
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TransportationManager.cc,v 1.11 2002/08/06 10:35:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// $Id: G4TransportationManager.cc,v 1.12 2003/06/13 09:27:34 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
//
|
||||
// G4TransportationManager
|
||||
@@ -80,3 +80,13 @@ G4TransportationManager* G4TransportationManager::GetTransportationManager()
|
||||
|
||||
return fTransportationManager;
|
||||
}
|
||||
|
||||
void G4TransportationManager::SetFieldManager(G4FieldManager* newFieldManager)
|
||||
{
|
||||
fFieldManager = newFieldManager;
|
||||
|
||||
// Message the PropagatorInField,
|
||||
// which also maintains this information (to be reviewed)
|
||||
if( fPropagatorInField )
|
||||
fPropagatorInField -> SetDetectorFieldManager( newFieldManager );
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VCurvedTrajectoryFilter.cc,v 1.4 2003/02/06 18:53:16 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// $Id: G4VCurvedTrajectoryFilter.cc,v 1.5 2003/06/16 16:54:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
|
||||
#include "G4VCurvedTrajectoryFilter.hh"
|
||||
|
||||
@@ -35,10 +35,10 @@ G4VCurvedTrajectoryFilter::~G4VCurvedTrajectoryFilter()
|
||||
{
|
||||
}
|
||||
|
||||
G4std::vector<G4ThreeVector>*
|
||||
std::vector<G4ThreeVector>*
|
||||
G4VCurvedTrajectoryFilter::GimmeThePointsAndForgetThem()
|
||||
{
|
||||
G4std::vector<G4ThreeVector>* tmp = fpFilteredPoints;
|
||||
std::vector<G4ThreeVector>* tmp = fpFilteredPoints;
|
||||
// ParticleChangeForTransport invokes this method (via
|
||||
// PropagatorInField) at every Step, even if the step did not
|
||||
// involve PropagatorInField. Must, therefore, ensure that points
|
||||
@@ -62,5 +62,5 @@ G4VCurvedTrajectoryFilter::CreateNewTrajectorySegment( )
|
||||
G4cout << "!!!!!!!! Filter: auxiliary points are being memory leaked !!!!!"
|
||||
<< G4endl;
|
||||
}
|
||||
fpFilteredPoints = new G4std::vector<G4ThreeVector>;
|
||||
fpFilteredPoints = new std::vector<G4ThreeVector>;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelNavigation.cc,v 1.13 2003/03/31 14:39:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
// $Id: G4VoxelNavigation.cc,v 1.14 2003/06/16 16:55:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
//
|
||||
//
|
||||
// class G4VoxelNavigation Implementation
|
||||
@@ -279,7 +279,7 @@ G4VoxelNavigation::ComputeVoxelSafety(const G4ThreeVector& localPoint) const
|
||||
else // (maxCurNodeNoDelta == minCurNodeNoDelta)
|
||||
{
|
||||
voxelSafety = minCurNodeNoDelta*curNodeWidth;
|
||||
voxelSafety += G4std::min(minCurCommonDelta,maxCurCommonDelta);
|
||||
voxelSafety += std::min(minCurCommonDelta,maxCurCommonDelta);
|
||||
}
|
||||
|
||||
// Compute isotropic safety to boundaries of previous levels
|
||||
|
||||
Reference in New Issue
Block a user