Import Geant4 6.0.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Polycone.cc,v 1.8.2.1 2003/06/16 17:18:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4Polycone.cc,v 1.19 2003/11/22 10:11:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "G4Polyhedron.hh"
|
||||
#include "G4EnclosingCylinder.hh"
|
||||
#include "G4ReduciblePolygon.hh"
|
||||
|
||||
#include "G4VPVParameterisation.hh"
|
||||
|
||||
//
|
||||
// Constructor (GEANT3 style parameters)
|
||||
@@ -72,11 +72,28 @@ G4Polycone::G4Polycone( const G4String& name,
|
||||
G4int i;
|
||||
for (i=0; i<numZPlanes; i++)
|
||||
{
|
||||
if (( i < numZPlanes-1) && ( zPlane[i] == zPlane[i+1] ))
|
||||
{
|
||||
if( (rInner[i] > rOuter[i+1])
|
||||
||(rInner[i+1] > rOuter[i]) )
|
||||
{
|
||||
DumpInfo();
|
||||
G4cerr << "ERROR - G4Polycone::G4Polycone()"
|
||||
<< G4endl
|
||||
<< " Segments are not contiguous !" << G4endl
|
||||
<< " rMin[" << i << "] = " << rInner[i]
|
||||
<< " -- rMax[" << i+1 << "] = " << rOuter[i+1] << G4endl
|
||||
<< " rMin[" << i+1 << "] = " << rInner[i+1]
|
||||
<< " -- rMax[" << i << "] = " << rOuter[i] << G4endl;
|
||||
G4Exception("G4Polycone::G4Polycone()", "InvalidSetup", FatalException,
|
||||
"Cannot create a Polycone with no contiguous segments.");
|
||||
}
|
||||
}
|
||||
original_parameters->Z_values[i] = zPlane[i];
|
||||
original_parameters->Rmin[i] = rInner[i];
|
||||
original_parameters->Rmax[i] = rOuter[i];
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Build RZ polygon using special PCON/PGON GEANT3 constructor
|
||||
//
|
||||
@@ -128,13 +145,11 @@ void G4Polycone::Create( G4double phiStart,
|
||||
//
|
||||
if (rz->Amin() < 0.0)
|
||||
{
|
||||
G4cout << "ERROR - G4Polycone::Create(): " << GetName() << G4endl
|
||||
<< " All R values must be >= 0 !"
|
||||
<< G4endl;
|
||||
G4cerr << "ERROR - G4Polycone::Create(): " << GetName() << G4endl
|
||||
<< " All R values must be >= 0 !"
|
||||
<< G4endl;
|
||||
G4Exception("G4Polycone::Create() - Illegal input parameters");
|
||||
G4Exception("G4Polycone::Create()", "InvalidSetup", FatalException,
|
||||
"Illegal input parameters.");
|
||||
}
|
||||
|
||||
G4double rzArea = rz->Area();
|
||||
@@ -143,36 +158,30 @@ void G4Polycone::Create( G4double phiStart,
|
||||
|
||||
else if (rzArea < -kCarTolerance)
|
||||
{
|
||||
G4cout << "ERROR - G4Polycone::Create(): " << GetName() << G4endl
|
||||
<< " R/Z cross section is zero or near zero: "
|
||||
<< rzArea << G4endl;
|
||||
G4cerr << "ERROR - G4Polycone::Create(): " << GetName() << G4endl
|
||||
<< " R/Z cross section is zero or near zero: "
|
||||
<< rzArea << G4endl;
|
||||
G4Exception("G4Polycone::Create() - Illegal input parameters");
|
||||
G4Exception("G4Polycone::Create()", "InvalidSetup", FatalException,
|
||||
"Illegal input parameters.");
|
||||
}
|
||||
|
||||
if ( (!rz->RemoveDuplicateVertices( kCarTolerance ))
|
||||
|| (!rz->RemoveRedundantVertices( kCarTolerance )) )
|
||||
{
|
||||
G4cout << "ERROR - G4Polycone::Create(): " << GetName() << G4endl
|
||||
<< " Too few unique R/Z values !"
|
||||
<< G4endl;
|
||||
G4cerr << "ERROR - G4Polycone::Create(): " << GetName() << G4endl
|
||||
<< " Too few unique R/Z values !"
|
||||
<< G4endl;
|
||||
G4Exception("G4Polycone::Create() - Illegal input parameters");
|
||||
G4Exception("G4Polycone::Create()", "InvalidSetup", FatalException,
|
||||
"Illegal input parameters.");
|
||||
}
|
||||
|
||||
if (rz->CrossesItself(1/kInfinity))
|
||||
{
|
||||
G4cout << "ERROR - G4Polycone::Create(): " << GetName() << G4endl
|
||||
<< " R/Z segments cross !"
|
||||
<< G4endl;
|
||||
G4cerr << "ERROR - G4Polycone::Create(): " << GetName() << G4endl
|
||||
<< " R/Z segments cross !"
|
||||
<< G4endl;
|
||||
G4Exception("G4Polycone::Create() - Illegal input parameters");
|
||||
G4Exception("G4Polycone::Create()", "InvalidSetup", FatalException,
|
||||
"Illegal input parameters.");
|
||||
}
|
||||
|
||||
numCorner = rz->NumVertices();
|
||||
@@ -373,6 +382,43 @@ void G4Polycone::CopyStuff( const G4Polycone &source )
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Reset
|
||||
//
|
||||
G4bool G4Polycone::Reset()
|
||||
{
|
||||
if (!original_parameters)
|
||||
{
|
||||
G4cerr << "Solid " << GetName() << " built using generic construct."
|
||||
<< G4endl << "Specify original parameters first !" << G4endl;
|
||||
G4Exception("G4Polycone::Reset()", "NotApplicableConstruct",
|
||||
JustWarning, "Parameters NOT resetted.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear old setup
|
||||
//
|
||||
G4VCSGfaceted::DeleteStuff();
|
||||
delete [] corners;
|
||||
delete enclosingCylinder;
|
||||
|
||||
//
|
||||
// Rebuild polycone
|
||||
//
|
||||
G4ReduciblePolygon *rz =
|
||||
new G4ReduciblePolygon( original_parameters->Rmin,
|
||||
original_parameters->Rmax,
|
||||
original_parameters->Z_values,
|
||||
original_parameters->Num_z_planes );
|
||||
Create( original_parameters->Start_angle,
|
||||
original_parameters->Opening_angle, rz );
|
||||
delete rz;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Inside
|
||||
//
|
||||
@@ -427,10 +473,11 @@ G4double G4Polycone::DistanceToIn( const G4ThreeVector &p ) const
|
||||
//
|
||||
// ComputeDimensions
|
||||
//
|
||||
void G4Polycone::ComputeDimensions( G4VPVParameterisation*,
|
||||
const G4int,
|
||||
const G4VPhysicalVolume* )
|
||||
void G4Polycone::ComputeDimensions( G4VPVParameterisation* p,
|
||||
const G4int n,
|
||||
const G4VPhysicalVolume* pRep )
|
||||
{
|
||||
p->ComputeDimensions(*this,n,pRep);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -464,13 +511,13 @@ std::ostream& G4Polycone::StreamInfo( std::ostream& os ) const
|
||||
os << " Z plane " << i << ": "
|
||||
<< original_parameters->Z_values[i] << "\n";
|
||||
}
|
||||
os << " Tangent distances to inner surface: \n";
|
||||
os << " Tangent distances to inner surface (Rmin): \n";
|
||||
for (i=0; i<numPlanes; i++)
|
||||
{
|
||||
os << " Z plane " << i << ": "
|
||||
<< original_parameters->Rmin[i] << "\n";
|
||||
}
|
||||
os << " Tangent distances to outer surface: \n";
|
||||
os << " Tangent distances to outer surface (Rmax): \n";
|
||||
for (i=0; i<numPlanes; i++)
|
||||
{
|
||||
os << " Z plane " << i << ": "
|
||||
@@ -478,7 +525,7 @@ std::ostream& G4Polycone::StreamInfo( std::ostream& os ) const
|
||||
}
|
||||
}
|
||||
os << " number of RZ points: " << numCorner << "\n"
|
||||
<< " RZ values: \n";
|
||||
<< " RZ values (corners): \n";
|
||||
for (i=0; i<numCorner; i++)
|
||||
{
|
||||
os << " "
|
||||
@@ -527,15 +574,13 @@ G4NURBS *G4Polycone::CreateNURBS() const
|
||||
|
||||
|
||||
//
|
||||
// G4Polycone:G4PolyconeHistorical stuff
|
||||
// G4PolyconeHistorical stuff
|
||||
//
|
||||
|
||||
G4Polycone::
|
||||
G4PolyconeHistorical::G4PolyconeHistorical()
|
||||
{
|
||||
}
|
||||
|
||||
G4Polycone::
|
||||
G4PolyconeHistorical::~G4PolyconeHistorical()
|
||||
{
|
||||
delete [] Z_values;
|
||||
@@ -543,22 +588,49 @@ G4PolyconeHistorical::~G4PolyconeHistorical()
|
||||
delete [] Rmax;
|
||||
}
|
||||
|
||||
G4Polycone::
|
||||
G4PolyconeHistorical::G4PolyconeHistorical( const G4PolyconeHistorical &source )
|
||||
G4PolyconeHistorical::
|
||||
G4PolyconeHistorical( const G4PolyconeHistorical &source )
|
||||
{
|
||||
Start_angle = source.Start_angle;
|
||||
Opening_angle = source.Opening_angle;
|
||||
Opening_angle = source.Opening_angle;
|
||||
Num_z_planes = source.Num_z_planes;
|
||||
|
||||
Z_values = new G4double[Num_z_planes];
|
||||
Rmin = new G4double[Num_z_planes];
|
||||
Rmax = new G4double[Num_z_planes];
|
||||
Rmin = new G4double[Num_z_planes];
|
||||
Rmax = new G4double[Num_z_planes];
|
||||
|
||||
G4int i;
|
||||
for( i = 0; i < Num_z_planes; i++)
|
||||
for( G4int i = 0; i < Num_z_planes; i++)
|
||||
{
|
||||
Z_values[i] = source.Z_values[i];
|
||||
Rmin[i] = source.Rmin[i];
|
||||
Rmax[i] = source.Rmax[i];
|
||||
Rmin[i] = source.Rmin[i];
|
||||
Rmax[i] = source.Rmax[i];
|
||||
}
|
||||
}
|
||||
|
||||
G4PolyconeHistorical&
|
||||
G4PolyconeHistorical::operator=( const G4PolyconeHistorical& right )
|
||||
{
|
||||
if ( &right == this ) return *this;
|
||||
|
||||
if (&right)
|
||||
{
|
||||
Start_angle = right.Start_angle;
|
||||
Opening_angle = right.Opening_angle;
|
||||
Num_z_planes = right.Num_z_planes;
|
||||
|
||||
delete [] Z_values;
|
||||
delete [] Rmin;
|
||||
delete [] Rmax;
|
||||
Z_values = new G4double[Num_z_planes];
|
||||
Rmin = new G4double[Num_z_planes];
|
||||
Rmax = new G4double[Num_z_planes];
|
||||
|
||||
for( G4int i = 0; i < Num_z_planes; i++)
|
||||
{
|
||||
Z_values[i] = right.Z_values[i];
|
||||
Rmin[i] = right.Rmin[i];
|
||||
Rmax[i] = right.Rmax[i];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user