Import Geant4 7.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 12:11:21 +02:00
parent 516dbf1a58
commit d93e1e39a9
5384 changed files with 125662 additions and 82444 deletions
@@ -22,7 +22,7 @@
//
//
// $Id: G4AxesModel.cc,v 1.5 2001/08/14 18:43:29 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 3rd April 2001
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4BoundingSphereScene.cc,v 1.8 2001/07/25 21:10:22 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4BoundingSphereScene.cc,v 1.9 2005/01/27 20:06:49 johna Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 7th June 1997
@@ -42,7 +42,7 @@ G4BoundingSphereScene::G4BoundingSphereScene (G4VModel* pModel):
G4BoundingSphereScene::~G4BoundingSphereScene () {}
void G4BoundingSphereScene::PreAddThis
void G4BoundingSphereScene::PreAddSolid
(const G4Transform3D& objectTransformation,
const G4VisAttributes&) {
fpObjectTransformation = &objectTransformation;
@@ -22,7 +22,7 @@
//
//
// $Id: G4FlavoredParallelWorldModel.cc,v 1.6 2002/11/20 17:21:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
// P. Mora de Freitas et M.Verderi - 19 June 1998.
// Model for flavored parallel world volumes.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HitsModel.cc,v 1.9 2002/10/24 15:07:21 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4HitsModel.cc,v 1.11 2005/01/27 20:06:52 johna Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 26th August 1998.
@@ -54,10 +54,9 @@ void G4HitsModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
for (int iHC = 0; iHC < nHC; iHC++) {
G4VHitsCollection* HC = HCE -> GetHC (iHC);
if (HC) {
size_t nHits = HC -> GetSize ();
for(size_t iHit = 0; iHit < nHits; ++iHit) {
for(size_t iHit = 0; iHit < HC->GetSize(); ++iHit) {
G4VHit* hit = HC -> GetHit (iHit);
sceneHandler.AddThis (*hit);
sceneHandler.AddCompound (*hit);
}
}
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolumeModel.cc,v 1.9 2003/11/03 17:08:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4LogicalVolumeModel.cc,v 1.11 2005/02/15 14:51:33 johna Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 26th July 1999.
@@ -36,10 +36,15 @@
#include "G4ModelingParameters.hh"
#include "G4VGraphicsScene.hh"
#include "G4DrawVoxels.hh"
#include "G4VSensitiveDetector.hh"
#include "G4VReadOutGeometry.hh"
G4LogicalVolumeModel::G4LogicalVolumeModel
(G4LogicalVolume* pLV,
G4int soughtDepth,
G4bool booleans,
G4bool voxels,
G4bool readout,
const G4Transform3D& modelTransformation,
const G4ModelingParameters* pMP):
// Instantiate a G4PhysicalVolumeModel with a G4PVPlacement to
@@ -60,7 +65,10 @@ G4LogicalVolumeModel::G4LogicalVolumeModel
modelTransformation,
pMP,
true), // Use full extent.
fpLV (pLV)
fpLV (pLV),
fBooleans (booleans),
fVoxels (voxels),
fReadout (readout)
{
fGlobalTag = fpLV -> GetName ();
fGlobalDescription = "G4LogicalVolumeModel " + fGlobalTag;
@@ -83,19 +91,39 @@ void G4LogicalVolumeModel::DescribeYourselfTo
G4PhysicalVolumeModel::DescribeYourselfTo (sceneHandler);
fpMP = tpMP;
if (fpTopPV->GetLogicalVolume()->GetVoxelHeader()) {
// Add Voxels.
G4DrawVoxels dv;
G4PlacedPolyhedronList* pPPL =
dv.CreatePlacedPolyhedra (fpTopPV -> GetLogicalVolume ());
for (size_t i = 0; i < pPPL -> size (); i++) {
const G4Transform3D& transform = (*pPPL)[i].GetTransform ();
const G4Polyhedron& polyhedron = (*pPPL)[i].GetPolyhedron ();
sceneHandler.BeginPrimitives (transform);
sceneHandler.AddPrimitive (polyhedron);
sceneHandler.EndPrimitives ();
if (fVoxels) {
if (fpTopPV->GetLogicalVolume()->GetVoxelHeader()) {
// Add Voxels.
G4DrawVoxels dv;
G4PlacedPolyhedronList* pPPL =
dv.CreatePlacedPolyhedra (fpTopPV -> GetLogicalVolume ());
for (size_t i = 0; i < pPPL -> size (); i++) {
const G4Transform3D& transform = (*pPPL)[i].GetTransform ();
const G4Polyhedron& polyhedron = (*pPPL)[i].GetPolyhedron ();
sceneHandler.BeginPrimitives (transform);
sceneHandler.AddPrimitive (polyhedron);
sceneHandler.EndPrimitives ();
}
delete pPPL;
}
}
if (fReadout) {
// Draw readout geometry...
G4VSensitiveDetector* sd = fpLV->GetSensitiveDetector();
if (sd) {
G4VReadOutGeometry* roGeom = sd->GetROgeometry();
if (roGeom) {
G4VPhysicalVolume* roWorld = roGeom->GetROWorld();
G4cout << "Readout geometry \"" << roGeom->GetName()
<< "\" with top physical volume \""
<< roWorld->GetName()
<< "\"" << G4endl;
G4PhysicalVolumeModel pvModel(roWorld);
pvModel.SetModelingParameters(fpMP);
pvModel.DescribeYourselfTo(sceneHandler);
}
}
delete pPPL;
}
}
@@ -106,23 +134,27 @@ void G4LogicalVolumeModel::DescribeSolid
G4VSolid* pSol,
const G4VisAttributes* pVisAttribs,
G4VGraphicsScene& sceneHandler) {
// Look for "constituents". Could be a Boolean solid.
G4VSolid* pSol0 = pSol -> GetConstituentSolid (0);
if (pSol0) { // Composite solid...
G4VSolid* pSol1 = pSol -> GetConstituentSolid (1);
if (!pSol1) {
G4Exception
("G4PhysicalVolumeModel::DescribeSolid:"
" 2nd component solid is missing.");
if (fBooleans) {
// Look for "constituents". Could be a Boolean solid.
G4VSolid* pSol0 = pSol -> GetConstituentSolid (0);
if (pSol0) { // Composite solid...
G4VSolid* pSol1 = pSol -> GetConstituentSolid (1);
if (!pSol1) {
G4Exception
("G4PhysicalVolumeModel::DescribeSolid:"
" 2nd component solid is missing.");
}
// Draw these constituents white and "forced wireframe"...
G4VisAttributes constituentAttributes;
constituentAttributes.SetForceWireframe(true);
DescribeSolid (theAT, pSol0, &constituentAttributes, sceneHandler);
DescribeSolid (theAT, pSol1, &constituentAttributes, sceneHandler);
}
// Draw these constituents white and "forced wireframe"...
G4VisAttributes constituentAttributes;
constituentAttributes.SetForceWireframe(true);
DescribeSolid (theAT, pSol0, &constituentAttributes, sceneHandler);
DescribeSolid (theAT, pSol1, &constituentAttributes, sceneHandler);
}
// In any case draw the original/resultant solid...
sceneHandler.PreAddThis (theAT, *pVisAttribs);
sceneHandler.PreAddSolid (theAT, *pVisAttribs);
pSol -> DescribeYourselfTo (sceneHandler);
sceneHandler.PostAddThis ();
sceneHandler.PostAddSolid ();
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.cc,v 1.6 2003/06/16 17:14:30 gunter Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4ModelingParameters.cc,v 1.7 2005/03/15 12:56:29 allison Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 31st December 1997.
@@ -115,8 +115,8 @@ void G4ModelingParameters::SetVisibleDensity (G4double visibleDensity) {
}
}
void G4ModelingParameters::SetNoOfSides (G4int nSides) {
const G4int nSidesMin = 3;
G4int G4ModelingParameters::SetNoOfSides (G4int nSides) {
const G4int nSidesMin = 12;
if (nSides < nSidesMin) {
nSides = nSidesMin;
G4cout << "G4ModelingParameters::SetNoOfSides: attempt to set the"
@@ -124,6 +124,7 @@ void G4ModelingParameters::SetNoOfSides (G4int nSides) {
<< "; forced to" << nSides << G4endl;
}
fNoOfSides = nSides;
return fNoOfSides;
}
void G4ModelingParameters::PrintDifferences
@@ -22,7 +22,7 @@
//
//
// $Id: G4NullModel.cc,v 1.7 2003/05/30 13:01:32 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 4th April 1998.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeMassScene.cc,v 1.3 2004/11/11 16:06:49 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4PhysicalVolumeMassScene.cc,v 1.4 2005/01/26 16:48:56 johna Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 10th August 1998.
@@ -48,7 +48,8 @@ G4PhysicalVolumeMassScene::G4PhysicalVolumeMassScene ():
fLastDensity (0.),
fCurrentDepth (0),
fpCurrentPV (0),
fpCurrentLV (0)
fpCurrentLV (0),
fpCurrentMaterial (0)
{}
G4PhysicalVolumeMassScene::~G4PhysicalVolumeMassScene () {}
@@ -57,7 +58,8 @@ void G4PhysicalVolumeMassScene::EstablishSpecials
(G4PhysicalVolumeModel& pvModel) {
pvModel.DefinePointersToWorkingSpace (&fCurrentDepth,
&fpCurrentPV,
&fpCurrentLV);
&fpCurrentLV,
&fpCurrentMaterial);
}
void G4PhysicalVolumeMassScene::Reset ()
@@ -72,7 +74,7 @@ void G4PhysicalVolumeMassScene::Reset ()
fCurrentDepth = 0;
fpCurrentPV = 0;
fpCurrentLV = 0;
fpCurrentMaterial = 0;
}
void G4PhysicalVolumeMassScene::AccrueMass (const G4VSolid& solid)
@@ -82,8 +84,9 @@ void G4PhysicalVolumeMassScene::AccrueMass (const G4VSolid& solid)
fPVPCount = 0;
}
G4double currentVolume;
G4double currentDensity;
G4double currentVolume = ((G4VSolid&)solid).GetCubicVolume();
G4double currentDensity = fpCurrentMaterial->GetDensity();
/* Using G4Polyhedron... (gives slightly different answers on Tubs, e.g.).
G4Polyhedron* pPolyhedron = solid.GetPolyhedron();
if (pPolyhedron) {
G4Material* pMaterial;
@@ -93,6 +96,7 @@ void G4PhysicalVolumeMassScene::AccrueMass (const G4VSolid& solid)
} else {
pMaterial = fpCurrentLV->GetMaterial();
}
assert(pMaterial == fpCurrentMaterial);
currentVolume = pPolyhedron->GetVolume();
currentDensity = pMaterial->GetDensity();
} else {
@@ -106,6 +110,7 @@ void G4PhysicalVolumeMassScene::AccrueMass (const G4VSolid& solid)
currentVolume = 0.;
currentDensity = 0.;
}
*/
if (fCurrentDepth == 0) fVolume = currentVolume;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.cc,v 1.25 2004/09/22 19:50:32 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4PhysicalVolumeModel.cc,v 1.32 2005/06/07 16:54:33 allison Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 31st December 1997.
@@ -41,6 +41,8 @@
#include "G4BoundingSphereScene.hh"
#include "G4PhysicalVolumeSearchScene.hh"
#include "G4TransportationManager.hh"
#include "G4VVisManager.hh"
#include "G4Polyhedron.hh"
#include <strstream>
@@ -60,9 +62,11 @@ G4PhysicalVolumeModel::G4PhysicalVolumeModel
fpCurrentPV (0),
fpCurrentLV (0),
fCurtailDescent (false),
fpClippingPolyhedron (0),
fpCurrentDepth (0),
fppCurrentPV (0),
fppCurrentLV (0)
fppCurrentLV (0),
fppCurrentMaterial (0)
{
const int len = 8; char a [len];
std::ostrstream o (a, len); o.seekp (std::ios::beg);
@@ -98,9 +102,18 @@ void G4PhysicalVolumeModel::CalculateExtent () {
false); // View digis - not relevant for physical volume model.
fpMP = &mParams;
DescribeYourselfTo (bsScene);
fExtent = bsScene.GetBoundingSphereExtent ();
if (!(fExtent.GetXmin() < fExtent.GetXmax())) {
G4double radius = bsScene.GetRadius();
if (radius < 0.) { // Nothing in the scene.
fExtent = fpTopPV -> GetLogicalVolume () -> GetSolid () -> GetExtent ();
} else {
// Transform back to coordinates relative to the top
// transformation, which is in G4VModel::fTransform. This makes
// it conform to all models, which are defined by a
// transformation and an extent relative to that
// transformation...
G4Point3D centre = bsScene.GetCentre();
centre.transform(fTransform.inverse());
fExtent = G4VisExtent(centre, radius);
}
fpMP = tempMP;
fRequestedDepth = tempRequestedDepth;
@@ -133,13 +146,14 @@ void G4PhysicalVolumeModel::DescribeYourselfTo
if (fpCurrentDepth) *fpCurrentDepth = fCurrentDepth;
if (fppCurrentPV) *fppCurrentPV = fpCurrentPV;
if (fppCurrentLV) *fppCurrentLV = fpCurrentLV;
if (fppCurrentMaterial) *fppCurrentMaterial = fpCurrentMaterial;
sceneHandler.DecommissionSpecials (*this);
// Clear pointers to working space.
fpCurrentDepth = 0;
fppCurrentPV = 0;
fppCurrentLV = 0;
fppCurrentMaterial = 0;
}
}
@@ -162,10 +176,12 @@ G4String G4PhysicalVolumeModel::GetCurrentDescription () const {
void G4PhysicalVolumeModel::DefinePointersToWorkingSpace
(G4int* pCurrentDepth,
G4VPhysicalVolume** ppCurrentPV,
G4LogicalVolume** ppCurrentLV) {
G4LogicalVolume** ppCurrentLV,
G4Material** ppCurrentMaterial) {
fpCurrentDepth = pCurrentDepth;
fppCurrentPV = ppCurrentPV;
fppCurrentLV = ppCurrentLV;
fppCurrentMaterial = ppCurrentMaterial;
}
void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
@@ -209,6 +225,7 @@ void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
pMaterial = pP -> ComputeMaterial (n, pVPV);
pP -> ComputeTransformation (n, pVPV);
pSol -> ComputeDimensions (pP, n, pVPV);
pVPV -> SetCopyNo (n);
DescribeAndDescend (pVPV, requestedDepth, pLV, pSol, pMaterial,
theAT, sceneHandler);
}
@@ -268,8 +285,7 @@ void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
}
pVPV -> SetTranslation (translation);
pVPV -> SetRotation (pRotation);
// pVPV -> SetCopyNo (n); // Has no effect and might even be
// dangerous.
pVPV -> SetCopyNo (n);
pSol = pLV -> GetSolid ();
pMaterial = pLV -> GetMaterial ();
DescribeAndDescend (pVPV, requestedDepth, pLV, pSol, pMaterial,
@@ -289,7 +305,7 @@ void G4PhysicalVolumeModel::DescribeAndDescend
G4int requestedDepth,
G4LogicalVolume* pLV,
G4VSolid* pSol,
const G4Material* pMaterial,
G4Material* pMaterial,
const G4Transform3D& theAT,
G4VGraphicsScene& sceneHandler) {
@@ -298,8 +314,10 @@ void G4PhysicalVolumeModel::DescribeAndDescend
if (fpCurrentDepth) *fpCurrentDepth = fCurrentDepth;
fpCurrentPV = pVPV;
fpCurrentLV = pLV;
fpCurrentMaterial = pMaterial;
if (fppCurrentPV) *fppCurrentPV = fpCurrentPV;
if (fppCurrentLV) *fppCurrentLV = fpCurrentLV;
if (fppCurrentMaterial) *fppCurrentMaterial = fpCurrentMaterial;
const G4RotationMatrix objectRotation = pVPV -> GetObjectRotationValue ();
const G4ThreeVector& translation = pVPV -> GetTranslation ();
@@ -384,9 +402,40 @@ void G4PhysicalVolumeModel::DescribeSolid
G4VSolid* pSol,
const G4VisAttributes* pVisAttribs,
G4VGraphicsScene& sceneHandler) {
sceneHandler.PreAddThis (theAT, *pVisAttribs);
pSol -> DescribeYourselfTo (sceneHandler);
sceneHandler.PostAddThis ();
sceneHandler.PreAddSolid (theAT, *pVisAttribs);
if (fpClippingPolyhedron) // Clip and force polyhedral representation...
{
G4Polyhedron clipper(*fpClippingPolyhedron); // Local copy.
clipper.Transform(theAT.inverse());
G4Polyhedron::SetNumberOfRotationSteps (fpMP->GetNoOfSides());
G4Polyhedron* pClippee = pSol->GetPolyhedron();
G4Polyhedron::ResetNumberOfRotationSteps ();
if (pClippee) // Solid can provide.
{
G4Polyhedron clipped(pClippee->subtract(clipper));
if(clipped.IsErrorBooleanProcess())
{
G4cout <<
"WARNING: G4PhysicalVolumeModel::DescribeSolid: polyhedron for solid\n \""
<< pSol->GetName() <<
"\" skipped due to error during Boolean processing."
<< G4endl;
}
else
{
clipped.SetVisAttributes(pVisAttribs);
G4VVisManager::GetConcreteInstance()->Draw(clipped,theAT);
}
}
}
else // Standard treatment...
{
pSol -> DescribeYourselfTo (sceneHandler);
}
sceneHandler.PostAddSolid ();
}
G4bool G4PhysicalVolumeModel::IsThisCulled (const G4LogicalVolume* pLV,
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeSearchScene.cc,v 1.7 2003/05/30 13:01:32 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4PhysicalVolumeSearchScene.cc,v 1.8 2005/01/26 17:07:37 johna Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 10th August 1998.
@@ -41,6 +41,7 @@ G4PhysicalVolumeSearchScene::G4PhysicalVolumeSearchScene
fCurrentDepth (0),
fpCurrentPV (0),
fpCurrentLV (0),
fpCurrentMaterial (0),
fpCurrentObjectTransformation (0),
fFoundDepth (0),
fpFoundPV (0),
@@ -54,7 +55,8 @@ void G4PhysicalVolumeSearchScene::EstablishSpecials
(G4PhysicalVolumeModel& pvModel) {
pvModel.DefinePointersToWorkingSpace (&fCurrentDepth,
&fpCurrentPV,
&fpCurrentLV);
&fpCurrentLV,
&fpCurrentMaterial);
}
void G4PhysicalVolumeSearchScene::FindVolume (const G4VSolid&) {
@@ -22,7 +22,7 @@
//
//
// $Id: G4ScaleModel.cc,v 1.3 2001/08/14 18:43:31 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 21st July 2001.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TextModel.cc,v 1.4 2001/08/14 18:43:32 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4TextModel.cc,v 1.6 2005/06/07 16:53:40 allison Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 3rd April 2001
@@ -33,15 +33,23 @@
#include "G4ModelingParameters.hh"
#include "G4VGraphicsScene.hh"
#include "G4UnitsTable.hh"
#include <sstream>
G4TextModel::~G4TextModel () {}
G4TextModel::G4TextModel (const G4Text& text): fText(text) {
fGlobalTag = "G4TextModel: " + fText.GetText();
G4TextModel::G4TextModel (const G4Text& g4Text): fG4Text(g4Text) {
std::ostringstream oss;
oss << "G4TextModel: \"" << fG4Text.GetText()
<< "\" at " << G4BestUnit(g4Text.GetPosition(),"Length")
<< "with size " << g4Text.GetScreenSize()
<< " with offsets " << g4Text.GetXOffset() << ',' << g4Text.GetYOffset();
fGlobalTag = oss.str();
fGlobalDescription = fGlobalTag;
}
void G4TextModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
sceneHandler.BeginPrimitives ();
sceneHandler.AddPrimitive (fText);
sceneHandler.AddPrimitive (fG4Text);
sceneHandler.EndPrimitives ();
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TrajectoriesModel.cc,v 1.12 2002/11/11 18:39:28 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4TrajectoriesModel.cc,v 1.14 2005/01/27 20:07:05 johna Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 26th August 1998.
@@ -48,9 +48,8 @@ void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
if (event) {
G4TrajectoryContainer* TC = event -> GetTrajectoryContainer ();
if (TC) {
G4int nT = TC -> entries ();
for (int iT = 0; iT < nT; iT++) {
sceneHandler.AddThis (*((*TC) [iT]));
for (G4int iT = 0; iT < TC->entries(); iT++) {
sceneHandler.AddCompound (*((*TC) [iT]));
}
}
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4VModel.cc,v 1.9 2003/06/16 17:14:32 gunter Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// John Allison 31st December 1997.