Import Geant4 4.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:18:25 +02:00
parent 36c080dca6
commit 921d3b1cda
3990 changed files with 185376 additions and 82884 deletions
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4AxesModel.cc,v 1.2.2.1 2001/06/28 19:16:19 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4AxesModel.cc,v 1.5 2001/08/14 18:43:29 johna Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 3rd April 2001
@@ -45,7 +45,7 @@ G4AxesModel::G4AxesModel
fGlobalDescription = fGlobalTag;
}
void G4AxesModel::DescribeYourselfTo (G4VGraphicsScene& scene) {
void G4AxesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
G4Polyline x_axis, y_axis, z_axis;
@@ -57,21 +57,25 @@ void G4AxesModel::DescribeYourselfTo (G4VGraphicsScene& scene) {
G4VisAttributes ay(cy); // VA for y-axis
G4VisAttributes az(cz); // VA for z-axis
sceneHandler.BeginPrimitives();
//----- Draw x-axis
x_axis.SetVisAttributes(&ax);
x_axis.push_back(G4Point3D(fX0,fY0,fZ0));
x_axis.push_back(G4Point3D((fX0 + fLength),fY0,fZ0));
scene.AddPrimitive(x_axis);
sceneHandler.AddPrimitive(x_axis);
//----- Draw y-axis
y_axis.SetVisAttributes(&ay);
y_axis.push_back(G4Point3D(fX0,fY0,fZ0));
y_axis.push_back(G4Point3D(fX0,(fY0 + fLength),fZ0));
scene.AddPrimitive(y_axis);
sceneHandler.AddPrimitive(y_axis);
//----- Draw z-axis
z_axis.SetVisAttributes(&az);
z_axis.push_back(G4Point3D(fX0,fY0,fZ0));
z_axis.push_back(G4Point3D(fX0,fY0,(fZ0 + fLength)));
scene.AddPrimitive(z_axis);
sceneHandler.AddPrimitive(z_axis);
sceneHandler.EndPrimitives();
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4BoundingSphereScene.cc,v 1.4.4.1 2001/06/28 19:16:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4BoundingSphereScene.cc,v 1.8 2001/07/25 21:10:22 johna Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 7th June 1997
@@ -31,9 +31,11 @@
#include "G4BoundingSphereScene.hh"
#include "G4VSolid.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4Vector3D.hh"
G4BoundingSphereScene::G4BoundingSphereScene ():
G4BoundingSphereScene::G4BoundingSphereScene (G4VModel* pModel):
fpModel (pModel),
fRadius (-1.),
fpObjectTransformation (0)
{}
@@ -51,17 +53,18 @@ G4VisExtent G4BoundingSphereScene::GetBoundingSphereExtent () {
}
void G4BoundingSphereScene::Accrue (const G4VSolid& solid) {
const G4VisExtent& thisExtent = solid.GetExtent ();
G4Point3D thisCentre = thisExtent.GetExtentCentre ();
const G4VisExtent& newExtent = solid.GetExtent ();
G4Point3D newCentre = newExtent.GetExtentCentre ();
if (fpObjectTransformation) {
thisCentre.transform (*fpObjectTransformation);
newCentre.transform (*fpObjectTransformation);
}
const G4double thisRadius = thisExtent.GetExtentRadius ();
AccrueBoundingSphere (thisCentre, thisRadius);
/***********************************************
G4cout << "G4BoundingSphereScene::Accrue: centre: " << fCentre
<< ", radius: " << fRadius << G4endl;
***********************************************/
const G4double newRadius = newExtent.GetExtentRadius ();
AccrueBoundingSphere (newCentre, newRadius);
// Curtail descent - can assume daughters are contained within mother...
G4PhysicalVolumeModel* pPVM = fpModel->GetG4PhysicalVolumeModel();
if (pPVM) pPVM->CurtailDescent();
}
void G4BoundingSphereScene::ResetBoundingSphere () {
@@ -71,28 +74,43 @@ void G4BoundingSphereScene::ResetBoundingSphere () {
}
void G4BoundingSphereScene::AccrueBoundingSphere
(const G4Point3D& thisCentre,
G4double thisRadius) {
(const G4Point3D& newCentre,
G4double newRadius) {
if (fRadius < 0 ) { // First time.
fCentre = thisCentre;
fRadius = thisRadius;
fCentre = newCentre;
fRadius = newRadius;
}
else {
G4Vector3D join = thisCentre - fCentre;
G4Vector3D join = newCentre - fCentre;
if (join == G4Vector3D (0., 0., 0.)) { // Centres coincide.
if (fRadius < thisRadius) fRadius = thisRadius;
if (fRadius < newRadius) fRadius = newRadius;
}
else if (join.mag () + thisRadius <= fRadius) { // Inside accrued sphere.
else if (join.mag () + newRadius <= fRadius) { // Inside accrued sphere.
// Do nothing.
}
else {
G4Vector3D unitJoin = join.unit ();
G4Point3D extremity1 = fCentre - fRadius * unitJoin;
G4Point3D extremity2 = thisCentre + thisRadius * unitJoin;
G4Point3D oldExtremity1 = fCentre - fRadius * unitJoin;
G4Point3D newExtremity1 = newCentre - newRadius * unitJoin;
G4Point3D oldExtremity2 = fCentre + fRadius * unitJoin;
G4Point3D newExtremity2 = newCentre + newRadius * unitJoin;
G4Point3D extremity1;
if (oldExtremity1 * unitJoin < newExtremity1 * unitJoin) {
extremity1 = oldExtremity1;
}
else {
extremity1 = newExtremity1;
}
G4Point3D extremity2;
if (oldExtremity2 * unitJoin > newExtremity2 * unitJoin) {
extremity2 = oldExtremity2;
}
else {
extremity2 = newExtremity2;
}
fCentre = 0.5 * (extremity2 + extremity1);
fRadius = 0.5 * (extremity2 - extremity1).mag ();
}
}
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FlavoredParallelWorldModel.cc,v 1.4.4.1 2001/06/28 19:16:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4FlavoredParallelWorldModel.cc,v 1.5 2001/07/11 10:09:22 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// 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.4.4.1 2001/06/28 19:16:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4HitsModel.cc,v 1.7 2001/08/14 18:43:30 johna Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 26th August 1998.
@@ -30,6 +30,7 @@
#include "G4HitsModel.hh"
#include "G4VGraphicsScene.hh"
#include "G4ModelingParameters.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
@@ -42,7 +43,7 @@ G4HitsModel::G4HitsModel () {
fGlobalDescription = fGlobalTag;
}
void G4HitsModel::DescribeYourselfTo (G4VGraphicsScene& scene) {
void G4HitsModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
if (fpMP && fpMP -> IsViewHits ()) {
G4RunManager* runManager = G4RunManager::GetRunManager ();
const G4Event* event = runManager -> GetCurrentEvent ();
@@ -50,9 +51,11 @@ void G4HitsModel::DescribeYourselfTo (G4VGraphicsScene& scene) {
G4HCofThisEvent* HCE = event -> GetHCofThisEvent ();
if (HCE) {
G4int nHC = HCE -> GetCapacity ();
sceneHandler.BeginPrimitives ();
for (int iHC = 0; iHC < nHC; iHC++) {
HCE -> GetHC (iHC) -> DrawAllHits ();
}
sceneHandler.EndPrimitives ();
}
}
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolumeModel.cc,v 1.7.2.1 2001/06/28 19:16:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4LogicalVolumeModel.cc,v 1.8 2001/07/11 10:09:22 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 26th July 1999.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.cc,v 1.4.4.1 2001/06/28 19:16:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ModelingParameters.cc,v 1.5 2001/07/11 10:09:23 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 31st December 1997.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NullModel.cc,v 1.3.4.1 2001/06/28 19:16:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4NullModel.cc,v 1.6 2001/08/24 20:36:28 johna Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 4th April 1998.
@@ -36,10 +36,6 @@ G4NullModel::G4NullModel (const G4ModelingParameters* pMP):
G4NullModel::~G4NullModel () {}
void G4NullModel::DescribeYourselfTo (G4VGraphicsScene& scene) {
void G4NullModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
G4Exception ("G4NullModel::DescribeYourselfTo called.");
}
G4bool G4NullModel::Validate () {
return true;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.cc,v 1.15.2.1 2001/06/28 19:16:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PhysicalVolumeModel.cc,v 1.20 2001/08/24 20:34:25 johna Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 31st December 1997.
@@ -55,6 +55,7 @@ G4PhysicalVolumeModel::G4PhysicalVolumeModel
fTopPVName (pVPV -> GetName ()),
fTopPVCopyNo (pVPV -> GetCopyNo ()),
fRequestedDepth (requestedDepth),
fUseFullExtent (useFullExtent),
fCurrentDepth (0),
fpCurrentPV (0),
fpCurrentLV (0),
@@ -69,11 +70,17 @@ G4PhysicalVolumeModel::G4PhysicalVolumeModel
fGlobalTag = fpTopPV -> GetName () + "." + a;
fGlobalDescription = "G4PhysicalVolumeModel " + fGlobalTag;
if (useFullExtent) {
CalculateExtent ();
}
G4PhysicalVolumeModel::~G4PhysicalVolumeModel () {}
void G4PhysicalVolumeModel::CalculateExtent () {
if (fUseFullExtent) {
fExtent = fpTopPV -> GetLogicalVolume () -> GetSolid () -> GetExtent ();
}
else {
G4BoundingSphereScene bsScene;
G4BoundingSphereScene bsScene(this);
const G4ModelingParameters* tempMP = fpMP;
G4ModelingParameters mParams
(0, // No default vis attributes.
@@ -94,8 +101,6 @@ G4PhysicalVolumeModel::G4PhysicalVolumeModel
}
}
G4PhysicalVolumeModel::~G4PhysicalVolumeModel () {}
void G4PhysicalVolumeModel::DescribeYourselfTo
(G4VGraphicsScene& sceneHandler) {
@@ -225,6 +230,8 @@ void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
// They have phi of offset+n*width to offset+(n+1)*width where
// n=0..nReplicas-1
//
G4ThreeVector originalTranslation = pVPV -> GetTranslation ();
G4RotationMatrix* pOriginalRotation = pVPV -> GetRotation ();
for (int n = 0; n < nReplicas; n++) {
G4ThreeVector translation; // Null.
G4RotationMatrix rotation; // Null - life long enough for visualizing.
@@ -241,7 +248,7 @@ void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
translation = G4ThreeVector (0,0,-width*(nReplicas-1)*0.5+n*width);
break;
case kRho:
G4cerr <<
G4cout <<
"G4PhysicalVolumeModel::VisitGeometryAndGetVisReps: WARNING:"
"\n built-in replicated volumes replicated in radius are not yet"
"\n properly visualizable."
@@ -263,6 +270,9 @@ void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
DescribeAndDescend (pVPV, requestedDepth, pLV, pSol, pMaterial,
theAT, sceneHandler);
}
// Restore originals...
pVPV -> SetTranslation (originalTranslation);
pVPV -> SetRotation (pOriginalRotation);
}
}
@@ -432,32 +442,41 @@ G4bool G4PhysicalVolumeModel::IsDaughterCulled
}
}
G4bool G4PhysicalVolumeModel::Validate () {
G4bool G4PhysicalVolumeModel::Validate (G4bool warn) {
G4VPhysicalVolume* world =
G4TransportationManager::GetTransportationManager ()
-> GetNavigatorForTracking () -> GetWorldVolume ();
// The idea now is to seek a PV with the same name and copy no
// in the hope it's the same one!!
G4cout << "G4PhysicalVolumeModel::Validate() called." << G4endl;
if (warn) {
G4cout << "G4PhysicalVolumeModel::Validate() called." << G4endl;
}
G4PhysicalVolumeSearchScene searchScene (fTopPVName, fTopPVCopyNo);
G4PhysicalVolumeModel searchModel (world);
G4ModelingParameters mp; // Default modeling parameters for this search.
searchModel.SetModelingParameters (&mp);
searchModel.DescribeYourselfTo (searchScene);
G4VPhysicalVolume* foundVolume = searchScene.GetFoundVolume ();
if (foundVolume) {
G4cout << " Volume of the same name and copy number (\""
<< fTopPVName << "\", copy " << fTopPVCopyNo
<< ") still exists and is being used."
"\n Be warned that this does not necessarily guarantee it's the same"
"\n volume you originally specified in /vis/scene/add/."
<< G4endl;
if (warn) {
G4cout << " Volume of the same name and copy number (\""
<< fTopPVName << "\", copy " << fTopPVCopyNo
<< ") still exists and is being used."
"\n Be warned that this does not necessarily guarantee it's the same"
"\n volume you originally specified in /vis/scene/add/."
<< G4endl;
}
fpTopPV = foundVolume;
CalculateExtent ();
return true;
}
else {
G4cout << " A volume of the same name and copy number (\""
<< fTopPVName << "\", copy " << fTopPVCopyNo
<< ") no longer exists."
<< G4endl;
if (warn) {
G4cout << " A volume of the same name and copy number (\""
<< fTopPVName << "\", copy " << fTopPVCopyNo
<< ") no longer exists."
<< G4endl;
}
return false;
}
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeSearchScene.cc,v 1.5.2.1 2001/06/28 19:16:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PhysicalVolumeSearchScene.cc,v 1.6 2001/07/11 10:09:23 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 10th August 1998.
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4ScaleModel.cc,v 1.3 2001/08/14 18:43:31 johna Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 21st July 2001.
// Model which knows how to draw scale.
#include "G4ScaleModel.hh"
#include "G4ModelingParameters.hh"
#include "G4VGraphicsScene.hh"
G4ScaleModel::~G4ScaleModel () {}
G4ScaleModel::G4ScaleModel (const G4Scale& scale): fScale(scale) {
fGlobalTag = "G4ScaleModel: " + fScale.GetAnnotation();
switch (fScale.GetDirection()) {
case G4Scale::x:
fGlobalTag += " x";
break;
case G4Scale::y:
fGlobalTag += " y";
break;
case G4Scale::z:
fGlobalTag += " z";
break;
}
fGlobalDescription = fGlobalTag;
}
void G4ScaleModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
sceneHandler.BeginPrimitives ();
sceneHandler.AddPrimitive (fScale);
sceneHandler.EndPrimitives ();
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TextModel.cc,v 1.1.2.1 2001/06/28 19:16:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4TextModel.cc,v 1.4 2001/08/14 18:43:32 johna Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 3rd April 2001
@@ -40,6 +40,8 @@ G4TextModel::G4TextModel (const G4Text& text): fText(text) {
fGlobalDescription = fGlobalTag;
}
void G4TextModel::DescribeYourselfTo (G4VGraphicsScene& scene) {
scene.AddPrimitive (fText);
void G4TextModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
sceneHandler.BeginPrimitives ();
sceneHandler.AddPrimitive (fText);
sceneHandler.EndPrimitives ();
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TrajectoriesModel.cc,v 1.6.4.1 2001/06/28 19:16:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4TrajectoriesModel.cc,v 1.9 2001/08/14 18:43:33 johna Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 26th August 1998.
@@ -30,6 +30,7 @@
#include "G4TrajectoriesModel.hh"
#include "G4VGraphicsScene.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
@@ -40,13 +41,14 @@ G4TrajectoriesModel::G4TrajectoriesModel () {
fGlobalDescription = fGlobalTag;
}
void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& scene) {
void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
G4RunManager* runManager = G4RunManager::GetRunManager ();
const G4Event* event = runManager -> GetCurrentEvent ();
if (event) {
G4TrajectoryContainer* TC = event -> GetTrajectoryContainer ();
if (TC) {
G4int nT = TC -> entries ();
sceneHandler.BeginPrimitives ();
for (int iT = 0; iT < nT; iT++) {
// GB : default representation should be the most efficent one.
// Representation with a circle at each step should be an option
@@ -54,6 +56,7 @@ void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& scene) {
// (*TC) [iT] -> DrawTrajectory (50);
(*TC) [iT] -> DrawTrajectory ();
}
sceneHandler.EndPrimitives ();
}
}
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VModel.cc,v 1.5.2.1 2001/06/28 19:16:20 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4VModel.cc,v 1.7 2001/08/24 20:36:29 johna Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 31st December 1997.
@@ -51,8 +51,8 @@ G4String G4VModel::GetCurrentDescription () const {
return G4String("Default Current Description");
}
G4bool G4VModel::Validate () {
return false;
G4bool G4VModel::Validate (G4bool warn) {
return true;
}
G4std::ostream& operator << (G4std::ostream& os, const G4VModel& m) {