Import Geant4 8.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:36:02 +02:00
parent d93e1e39a9
commit 8a51e0bc40
5471 changed files with 99628 additions and 55248 deletions
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4AuxiliaryNavServices.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
+24 -47
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4DrawVoxels.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4DrawVoxels.cc,v 1.3 2005/09/19 10:35:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// class G4DrawVoxels
@@ -75,6 +75,7 @@ void G4DrawVoxels::SetVoxelsVisAttributes(G4VisAttributes& VA_voxelX,
fVoxelsVisAttributes[1]=VA_voxelY;
fVoxelsVisAttributes[2]=VA_voxelZ;
}
void G4DrawVoxels::SetBoundingBoxVisAttributes(G4VisAttributes& VA_boundingbox)
{
fBoundingBoxVisAttributes=VA_boundingbox;
@@ -90,12 +91,6 @@ G4DrawVoxels::ComputeVoxelPolyhedra(const G4LogicalVolume* lv,
{
// Let's draw the selected voxelisation now !
#ifdef G4DrawVoxelsDebug
G4cout << "**** !!! G4DrawVoxels::Draw_Voxels : "
<< "a query for drawing voxelisation";
G4cout << "Logical Volume:" << lv->GetName() << G4endl;
#endif
G4VSolid* solid=lv->GetSolid();
G4double dx=kInfinity,dy=kInfinity,dz=kInfinity;
@@ -103,12 +98,6 @@ G4DrawVoxels::ComputeVoxelPolyhedra(const G4LogicalVolume* lv,
if (lv->GetNoDaughters()<=0)
{
#ifdef G4DrawVoxelsDebug
G4cout << "**** !!! G4DrawVoxels::Draw_Voxels : "
<< "a query for drawing voxelisation" << G4endl;
G4cout << "of a logical volume that has no (or <=0) daughter "
<< "has been detected !!! ****" << G4endl;
#endif
return;
}
@@ -123,7 +112,8 @@ G4DrawVoxels::ComputeVoxelPolyhedra(const G4LogicalVolume* lv,
dy=ymax-ymin;
dz=zmax-zmin;
//Preparing the colored bounding polyhedronBox for the pVolume
// Preparing the colored bounding polyhedronBox for the pVolume
//
G4PolyhedronBox bounding_polyhedronBox(dx*0.5,dy*0.5,dz*0.5);
bounding_polyhedronBox.SetVisAttributes(&fBoundingBoxVisAttributes);
G4ThreeVector t_centerofBoundingBox((xmin+xmax)*0.5,
@@ -163,11 +153,6 @@ G4DrawVoxels::ComputeVoxelPolyhedra(const G4LogicalVolume* lv,
voxelsVisAttributes=&fVoxelsVisAttributes[2];
break;
default:
/************************/
G4cout << "PANIC: in Draw_Voxels:DrawVoxels(...) header is decayed."
<< G4endl;
G4cout << "header->GetAxis returns an invalid axis." << G4endl;
/************************/
break;
};
@@ -179,19 +164,8 @@ G4DrawVoxels::ComputeVoxelPolyhedra(const G4LogicalVolume* lv,
G4double beginning=header->GetMinExtent(),
step=(header->GetMaxExtent()-beginning)/no_slices;
#ifdef G4DrawVoxelsDebug
G4cout << "Axis of the voxelisation:" << header->GetAxis();
G4cout << "No slices of the voxelisation:" << header->GetNoSlices();
G4cout << "step:" << step << G4endl;
#endif
while (slice_no<no_slices)
{
#ifdef G4DrawVoxelsDebug
G4cout << "slice_no:" << slice_no;
G4cout << "header/node:" << slice->IsHeader() << G4endl;
#endif
{
if (slice->IsHeader())
{
G4VoxelLimits newlimit(limit);
@@ -208,9 +182,9 @@ G4DrawVoxels::ComputeVoxelPolyhedra(const G4LogicalVolume* lv,
slice_no=(slice->IsHeader()
? slice->GetHeader()->GetMaxEquivalentSliceNo()+1
: slice->GetNode()->GetMaxEquivalentSliceNo()+1);
if (slice_no<no_slices) slice=header->GetSlice(slice_no);
if (slice_no<no_slices) { slice=header->GetSlice(slice_no); }
}
} //end of ComputeVoxelPolyhedra...
}
// ########################################################################
@@ -225,17 +199,11 @@ G4DrawVoxels::CreatePlacedPolyhedra(const G4LogicalVolume* lv) const
void G4DrawVoxels::DrawVoxels(const G4LogicalVolume* lv) const
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if (lv->GetNoDaughters()<=0)
{
#ifdef G4DrawVoxelsDebug
G4cout << "**** !!! G4DrawVoxels::Draw_Voxels : "
<< "a query for drawing voxelisation" << G4endl;
G4cout << "of a logical volume that has no (or <=0) daughter "
<< "has been detected !!! ****" << G4endl;
#endif
return;
if (lv->GetNoDaughters()<=0)
{
return;
}
// Computing the transformation according to the world volume
@@ -253,13 +221,22 @@ void G4DrawVoxels::DrawVoxels(const G4LogicalVolume* lv) const
G4PlacedPolyhedronList* pplist=CreatePlacedPolyhedra(lv);
if(pVVisManager)
{
//Drawing the bounding and voxel polyhedra for the pVolume
// Drawing the bounding and voxel polyhedra for the pVolume
//
for (size_t i=0;i<pplist->size();i++)
{
pVVisManager->Draw((*pplist)[i].GetPolyhedron(),
(*pplist)[i].GetTransform()*transf3D);
}
}
else
G4cout << "@@@@ void G4DrawVoxels::DrawVoxels(const G4LogicalVolume*)"
<< " pVVisManager is null! @@@@" << G4endl;
{
G4cerr << "ERROR - G4DrawVoxels::DrawVoxels()" << G4endl
<< " Pointer to visualization manager is null!"
<< G4endl;
G4Exception("G4DrawVoxels::DrawVoxels()",
"NotApplicable", JustWarning,
"Pointer to visualization manager is null!");
}
delete pplist;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeomTestErrorList.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeomTestOverlapList.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeomTestOvershootList.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeomTestPoint.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeomTestSegment.cc,v 1.4 2004/09/02 14:44:11 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeomTestStreamLogger.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeomTestVolPoint.cc,v 1.2 2003/11/03 17:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeomTestVolume.cc,v 1.4 2004/12/02 09:31:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeometryMessenger.cc,v 1.4 2004/03/11 13:09:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
+11 -4
View File
@@ -21,7 +21,7 @@
// ********************************************************************
//
//
// $Id: G4Navigator.cc,v 1.17 2004/12/02 09:31:23 gcosmo Exp $
// $Id: G4Navigator.cc,v 1.18 2005/11/24 17:31:03 japost Exp $
// GEANT4 tag $ Name: $
//
// class G4Navigator Implementation
@@ -182,6 +182,7 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
case kParameterised:
G4VSolid *pSolid;
G4VPVParameterisation *pParam;
G4TouchableHistory parentTouchable( fHistory );
pParam = fBlockedPhysicalVolume->GetParameterisation();
pSolid = pParam->ComputeSolid(fBlockedReplicaNo,
fBlockedPhysicalVolume);
@@ -198,8 +199,10 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
G4LogicalVolume *pLogical;
pLogical = fBlockedPhysicalVolume->GetLogicalVolume();
pLogical->SetSolid( pSolid );
pLogical->UpdateMaterial(pParam->ComputeMaterial(fBlockedReplicaNo,
fBlockedPhysicalVolume));
pLogical->UpdateMaterial(pParam->ComputeMaterial(
fBlockedReplicaNo,
fBlockedPhysicalVolume,
&parentTouchable));
break;
}
fEntering = false;
@@ -987,11 +990,15 @@ void G4Navigator::SetupHierarchy()
pSolid->ComputeDimensions(pParam, replicaNo, current);
pParam->ComputeTransformation(replicaNo, current);
G4TouchableHistory touchable( fHistory );
touchable.MoveUpHistory(); // move up to the parent level
// Set up the correct solid and material in Logical Volume
//
G4LogicalVolume *pLogical = current->GetLogicalVolume();
pLogical->SetSolid( pSolid );
pLogical->UpdateMaterial( pParam->ComputeMaterial(replicaNo, current));
pLogical->UpdateMaterial( pParam->ComputeMaterial(replicaNo, current,
&touchable) );
break;
}
mother = current;
@@ -22,7 +22,7 @@
//
//
// $Id: G4NormalNavigation.cc,v 1.7 2004/09/10 15:38:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// class G4NormalNavigation Implementation
@@ -21,17 +21,34 @@
// ********************************************************************
//
//
// $Id: G4ParameterisedNavigation.cc,v 1.4 2004/09/10 15:38:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4ParameterisedNavigation.cc,v 1.9 2005/11/24 17:49:37 japost Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// class G4ParameterisedNavigation Implementation
//
// Author: P.Kent, 1996
//
// Initial Author: P.Kent, 1996
// Revisions:
// J. Apostolakis 24 Nov 2005, Revised/fixed treatment of nested params
// J. Apostolakis 4 Feb 2005, Reintroducting multi-level parameterisation
// for materials only - see note 1 below
// G. Cosmo 11 Mar 2004, Added Check mode
// G. Cosmo 15 May 2002, Extended to 3-d voxelisation, made subclass
// J. Apostolakis 5 Mar 1998, Enabled parameterisation of material & solid type
// --------------------------------------------------------------------
// Note 1: Design/implementation note for extensions
// J. Apostolakis, March 1st, 2005
// We cannot make the solid, dimensions and transformation dependant on parent
// because the voxelisation will not have access to this.
// So the following can NOT be done:
// sampleSolid = curParam->ComputeSolid(num, curPhysical, pParentTouch);
// sampleSolid->ComputeDimensions(curParam, num, curPhysical, pParentTouch);
// curParam->ComputeTransformation(num, curPhysical, pParentTouch);
#include "G4ParameterisedNavigation.hh"
#include "G4TouchableHistory.hh"
#include "G4VNestedParameterisation.hh"
// ********************************************************************
// Constructor
@@ -54,6 +71,24 @@ G4ParameterisedNavigation::~G4ParameterisedNavigation()
#endif
}
// ***************************************************************************
// IdentifyAndPlaceSolid
// ***************************************************************************
//
G4VSolid* G4ParameterisedNavigation::
IdentifyAndPlaceSolid( G4int num,
G4VPhysicalVolume *apparentPhys, // PhysV or PhysT
G4VPVParameterisation *curParam )
{
G4VSolid *sampleSolid;
sampleSolid = curParam->ComputeSolid(num, apparentPhys);
sampleSolid->ComputeDimensions(curParam, num, apparentPhys);
curParam->ComputeTransformation(num, apparentPhys);
return sampleSolid;
}
// ***************************************************************************
// ComputeStep
// ***************************************************************************
@@ -102,6 +137,9 @@ G4double G4ParameterisedNavigation::
motherSafety = motherSolid->DistanceToOut(localPoint);
ourSafety = motherSafety; // Working isotropic safety
// G4cout << "DebugLOG - G4ParameterisedNavigation::ComputeStep()" << G4endl
// << " Current solid " << motherSolid->GetName() << G4endl;
#ifdef G4VERBOSE
if ( fCheck )
{
@@ -175,6 +213,8 @@ G4double G4ParameterisedNavigation::
sampleParam = samplePhysical->GetParameterisation();
// G4cerr << " Attaching parent touchable information to Phys Volume " << G4endl;
do
{
curVoxelNode = fVoxelNode;
@@ -186,9 +226,13 @@ G4double G4ParameterisedNavigation::
if ( !fBList.IsBlocked(sampleNo) )
{
fBList.BlockVolume(sampleNo);
sampleSolid = sampleParam->ComputeSolid(sampleNo, samplePhysical);
sampleSolid->ComputeDimensions(sampleParam, sampleNo, samplePhysical);
sampleParam->ComputeTransformation(sampleNo, samplePhysical);
// sampleSolid = sampleParam->ComputeSolid(sampleNo, samplePhysical);
// sampleSolid->ComputeDimensions(sampleParam, sampleNo, samplePhysical);
// sampleParam->ComputeTransformation(sampleNo, samplePhysical);
// Call virtual methods, and copy information if needed
sampleSolid= IdentifyAndPlaceSolid( sampleNo, samplePhysical, sampleParam );
G4AffineTransform sampleTf(samplePhysical->GetRotation(),
samplePhysical->GetTranslation());
sampleTf.Invert();
@@ -376,7 +420,7 @@ G4ParameterisedNavigation::ComputeSafety(const G4ThreeVector& localPoint,
motherSafety = motherSolid->DistanceToOut(localPoint);
ourSafety = motherSafety; // Working isotropic safety
//
// Compute daughter safeties
//
@@ -388,6 +432,10 @@ G4ParameterisedNavigation::ComputeSafety(const G4ThreeVector& localPoint,
samplePhysical->GetReplicationData(axis, nReplicas, width, offset, consuming);
sampleParam = samplePhysical->GetParameterisation();
// Check development
// G4cerr << "DebugLOG - G4ParameterisedNavigation::ComputeSafety()" << G4endl
// << " Current solid " << motherSolid->GetName() << G4endl;
// Look inside the current Voxel only at the current point
//
if ( axis==kUndefined ) // 3D case: current voxel node is retrieved
@@ -407,9 +455,13 @@ G4ParameterisedNavigation::ComputeSafety(const G4ThreeVector& localPoint,
for ( contentNo=curNoVolumes-1; contentNo>=0; contentNo-- )
{
sampleNo = curVoxelNode->GetVolume(contentNo);
sampleSolid = sampleParam->ComputeSolid(sampleNo, samplePhysical);
sampleSolid->ComputeDimensions(sampleParam, sampleNo, samplePhysical);
sampleParam->ComputeTransformation(sampleNo, samplePhysical);
// Call virtual methods, and copy information if needed
sampleSolid= IdentifyAndPlaceSolid( sampleNo, samplePhysical, sampleParam );
// sampleSolid = sampleParam->ComputeSolid(sampleNo, samplePhysical);
// sampleSolid->ComputeDimensions(sampleParam, sampleNo, samplePhysical);
// sampleParam->ComputeTransformation(sampleNo, samplePhysical);
G4AffineTransform sampleTf(samplePhysical->GetRotation(),
samplePhysical->GetTranslation());
sampleTf.Invert();
@@ -426,6 +478,7 @@ G4ParameterisedNavigation::ComputeSafety(const G4ThreeVector& localPoint,
{
ourSafety=voxelSafety;
}
return ourSafety;
}
@@ -440,6 +493,9 @@ G4double G4ParameterisedNavigation::
ComputeVoxelSafety(const G4ThreeVector& localPoint,
const EAxis pAxis) const
{
// Check development
// G4cout << "DebugLOG - G4ParameterisedNavigation::ComputeVoxelSafety()" << G4endl;
// If no best axis is specified, adopt default
// strategy as for placements
//
@@ -535,3 +591,103 @@ LocateNextVoxel( const G4ThreeVector& localPoint,
}
return isNewVoxel;
}
// ********************************************************************
// LevelLocate
// ********************************************************************
//
G4bool
G4ParameterisedNavigation::LevelLocate( G4NavigationHistory& history,
const G4VPhysicalVolume* blockedVol,
const G4int blockedNum,
const G4ThreeVector& globalPoint,
const G4ThreeVector* globalDirection,
const G4bool pLocatedOnEdge,
G4ThreeVector& localPoint )
{
G4SmartVoxelHeader *motherVoxelHeader;
G4SmartVoxelNode *motherVoxelNode;
G4VPhysicalVolume *motherPhysical, *pPhysical;
G4VPVParameterisation *pParam;
G4LogicalVolume *motherLogical;
G4VSolid *pSolid;
G4ThreeVector samplePoint;
G4int voxelNoDaughters, replicaNo;
motherPhysical = history.GetTopVolume();
motherLogical = motherPhysical->GetLogicalVolume();
motherVoxelHeader = motherLogical->GetVoxelHeader();
// Find the voxel containing the point
//
motherVoxelNode = ParamVoxelLocate(motherVoxelHeader,localPoint);
voxelNoDaughters = motherVoxelNode->GetNoContained();
if ( voxelNoDaughters==0 ) return false;
pPhysical = motherLogical->GetDaughter(0);
pParam = pPhysical->GetParameterisation();
// Check development
// G4cerr << "DebugLOG - G4ParameterisedNavigation::LevelLocate() "
// << " Current solid "
// << motherLogical->GetSolid()->GetName() << G4endl;
// G4cerr << " Attaching parent touchable information to Phys Volume "
// << G4endl;
// Save parent history in touchable history
// ... for use as parent t-h in ComputeMaterial method of param
G4TouchableHistory parentTouchable( history );
// Search replicated daughter volume
//
for ( register int sampleNo=voxelNoDaughters-1; sampleNo>=0; sampleNo-- )
{
replicaNo = motherVoxelNode->GetVolume(sampleNo);
if ( (replicaNo!=blockedNum) || (pPhysical!=blockedVol) )
{
// Obtain solid (as it can vary) and obtain its parameters
//
// pSolid = pParam->ComputeSolid(replicaNo, pPhysical);
// pSolid->ComputeDimensions(pParam, replicaNo, pPhysical);
// pParam->ComputeTransformation(replicaNo, pPhysical);
// Call virtual methods, and copy information if needed
pSolid= IdentifyAndPlaceSolid( replicaNo, pPhysical, pParam );
// Setup history
//
history.NewLevel(pPhysical, kParameterised, replicaNo);
samplePoint = history.GetTopTransform().TransformPoint(globalPoint);
if ( !G4AuxiliaryNavServices::CheckPointOnSurface(pSolid,
samplePoint, globalDirection,
history.GetTopTransform(), pLocatedOnEdge) )
{
history.BackLevel();
}
else
{
// Enter this daughter
//
localPoint = samplePoint;
// Set the correct copy number in physical
//
pPhysical->SetCopyNo(replicaNo);
// Set the correct solid and material in Logical Volume
//
G4LogicalVolume *pLogical = pPhysical->GetLogicalVolume();
pLogical->SetSolid(pSolid);
pLogical->UpdateMaterial(
pParam->ComputeMaterial(replicaNo, pPhysical, &parentTouchable) );
return true;
}
}
}
return false;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4PropagatorInField.cc,v 1.20 2004/12/02 09:31:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// This class implements an algorithm to track a particle in a
@@ -22,7 +22,7 @@
//
//
// $Id: G4ReplicaNavigation.cc,v 1.10 2004/12/10 16:20:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// class G4ReplicaNavigation Implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4TransportationManager.cc,v 1.4 2003/12/05 17:08:27 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// G4TransportationManager
@@ -22,7 +22,7 @@
//
//
// $Id: G4VoxelNavigation.cc,v 1.5 2004/09/10 15:38:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// class G4VoxelNavigation Implementation