Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolumeModel.cc 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4LogicalVolumeModel.cc 110480 2018-05-25 07:25:18Z gcosmo $
//
//
// John Allison 26th July 1999.
@@ -47,6 +47,7 @@ G4LogicalVolumeModel::G4LogicalVolumeModel
G4bool booleans,
G4bool voxels,
G4bool readout,
G4bool checkOverlaps,
const G4Transform3D& modelTransformation,
const G4ModelingParameters* pMP):
// Instantiate a G4PhysicalVolumeModel with a G4PVPlacement to
@@ -70,7 +71,8 @@ G4LogicalVolumeModel::G4LogicalVolumeModel
fpLV (pLV),
fBooleans (booleans),
fVoxels (voxels),
fReadout (readout)
fReadout (readout),
fCheckOverlaps(checkOverlaps)
{
fType = "G4LogicalVolumeModel";
fGlobalTag = fpLV -> GetName ();
@@ -125,6 +127,15 @@ void G4LogicalVolumeModel::DescribeYourselfTo
}
}
}
if (fCheckOverlaps) {
G4LogicalVolume* lv = fpTopPV->GetLogicalVolume();
G4int nSisters = lv->GetNoDaughters();
for (G4int iSister = 0; iSister < nSisters; ++iSister) {
G4PVPlacement* placement = dynamic_cast<G4PVPlacement*>(lv->GetDaughter(iSister));
if (placement) placement->CheckOverlaps();
}
}
}
// This called from G4PhysicalVolumeModel::DescribeAndDescend by the
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.cc 106122 2017-09-13 12:51:53Z gcosmo $
// $Id: G4ModelingParameters.cc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -39,6 +39,7 @@
#include "G4VSolid.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4UnitsTable.hh"
G4ModelingParameters::G4ModelingParameters ():
fWarning (true),
@@ -49,6 +50,7 @@ G4ModelingParameters::G4ModelingParameters ():
fDensityCulling (false),
fVisibleDensity (0.01 * g / cm3),
fCullCovered (false),
fCBDAlgorithmNumber (0),
fExplodeFactor (1.),
fNoOfSides (24),
fpSectionSolid (0),
@@ -74,6 +76,7 @@ G4ModelingParameters::G4ModelingParameters
fDensityCulling (isDensityCulling),
fVisibleDensity (visibleDensity),
fCullCovered (isCullingCovered),
fCBDAlgorithmNumber(0),
fExplodeFactor (1.),
fNoOfSides (noOfSides),
fpSectionSolid (0),
@@ -193,6 +196,16 @@ std::ostream& operator << (std::ostream& os, const G4ModelingParameters& mp)
if (mp.fCullCovered) os << "on";
else os << "off";
os << "\n Colour by density: ";
if (mp.fCBDAlgorithmNumber <= 0) {
os << "inactive";
} else {
os << "Algorithm " << mp.fCBDAlgorithmNumber << ", Parameters:";
for (auto p: mp.fCBDParameters) {
os << ' ' << G4BestUnit(p,"Volumic Mass");
}
}
os << "\n Explode factor: " << mp.fExplodeFactor
<< " about centre: " << mp.fExplodeCentre;
@@ -231,6 +244,7 @@ G4bool G4ModelingParameters::operator !=
(fCullInvisible != mp.fCullInvisible) ||
(fDensityCulling != mp.fDensityCulling) ||
(fCullCovered != mp.fCullCovered) ||
(fCBDAlgorithmNumber != mp.fCBDAlgorithmNumber) ||
(fExplodeFactor != mp.fExplodeFactor) ||
(fExplodeCentre != mp.fExplodeCentre) ||
(fNoOfSides != mp.fNoOfSides) ||
@@ -243,6 +257,11 @@ G4bool G4ModelingParameters::operator !=
if (fDensityCulling &&
(fVisibleDensity != mp.fVisibleDensity)) return true;
if (fCBDAlgorithmNumber > 0) {
if (fCBDParameters.size() != mp.fCBDParameters.size()) return true;
else if (fCBDParameters != mp.fCBDParameters) return true;
}
if (fVisAttributesModifiers != mp.fVisAttributesModifiers)
return true;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeMassScene.cc 110128 2018-05-16 06:36:57Z gcosmo $
// $Id: G4PhysicalVolumeMassScene.cc 108859 2018-03-12 07:44:53Z gcosmo $
//
//
// John Allison 10th August 1998.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.cc 106122 2017-09-13 12:51:53Z gcosmo $
// $Id: G4PhysicalVolumeModel.cc 110743 2018-06-12 06:33:37Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -229,8 +229,8 @@ void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
// local variables to preserve re-entrancy.
G4LogicalVolume* pLV = pVPV -> GetLogicalVolume ();
G4VSolid* pSol;
G4Material* pMaterial;
G4VSolid* pSol = nullptr;
G4Material* pMaterial = nullptr;
if (!(pVPV -> IsReplicated ())) {
// Non-replicated physical volume.
@@ -384,12 +384,42 @@ void G4PhysicalVolumeModel::DescribeAndDescend
fpCurrentTransform = &theNewAT;
const G4VisAttributes* pVisAttribs = pLV->GetVisAttributes();
if (!pVisAttribs) pVisAttribs = fpMP->GetDefaultVisAttributes();
// Beware - pVisAttribs might still be zero - probably will, since that's
// the default for G4ModelingParameters. So create one if necessary...
// If the volume does not have any vis attributes, create it.
G4VisAttributes* tempVisAtts = nullptr;
if (!pVisAttribs) {
static G4VisAttributes defaultVisAttribs;
pVisAttribs = &defaultVisAttribs;
tempVisAtts = new G4VisAttributes; // Default value.
// The user may request /vis/viewer/set/colourByDensity.
if (fpMP->GetCBDAlgorithmNumber() == 1) {
// Algorithm 1: 3 parameters: Simple rainbow mapping.
if (fpMP->GetCBDParameters().size() != 3) {
G4Exception("G4PhysicalVolumeModelTouchable::DescribeAndDescend",
"modeling0014",
FatalErrorInArgument,
"Algorithm-parameter mismatch for Colour By Density");
} else {
const G4double d = pMaterial? pMaterial->GetDensity(): 0.;
const G4double d0 = fpMP->GetCBDParameters()[0]; // Invisible d < d0.
const G4double d1 = fpMP->GetCBDParameters()[1]; // Rainbow d0->d1->d2.
const G4double d2 = fpMP->GetCBDParameters()[2]; // Blue d > d2.
if (d < d0) { // Density < d0 is invisible.
tempVisAtts->SetVisibility(false);
} else { // Intermediate densities are on a spectrum.
G4double red, green, blue;
if (d < d1) {
red = (d1-d)/(d1-d0); green = (d-d0)/(d1-d0); blue = 0.;
} else if (d < d2) {
red = 0.; green = (d2-d)/(d2-d1); blue = (d-d1)/(d2-d1);
} else { // Density >= d2 is blue.
red = 0.; green = 0.; blue = 1.;
}
tempVisAtts->SetColour(G4Colour(red,green,blue));
}
}
} else if (fpMP->GetCBDAlgorithmNumber() == 2) {
// Algorithm 2
// ...etc.
}
pVisAttribs = tempVisAtts;
}
// From here, can assume pVisAttribs is a valid pointer. This is necessary
// because PreAddSolid needs a vis attributes object.
@@ -604,6 +634,8 @@ void G4PhysicalVolumeModel::DescribeAndDescend
}
}
delete tempVisAtts;
// Reset for normal descending of next volume at this level...
fCurtailDescent = false;
@@ -89,7 +89,7 @@ G4TrajectoryDrawByEncounteredVolume::Draw(const G4VTrajectory& traj, const G4boo
}
catch (std::bad_cast)
catch (const std::bad_cast&)
{
G4ExceptionDescription ed;
ed << "Requires G4RichTrajectory - \"/vis/scene/add/trajectories rich\"";
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawerUtils.cc 108542 2018-02-16 09:35:32Z gcosmo $
// $Id: G4TrajectoryDrawerUtils.cc 107920 2017-12-13 08:06:00Z gcosmo $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -67,7 +67,7 @@ G4TrajectoryEncounteredVolumeFilter::Evaluate(const G4VTrajectory& traj) const
return false;
}
catch (std::bad_cast)
catch (const std::bad_cast&)
{
G4ExceptionDescription ed;
ed << "Requires G4RichTrajectory - \"/vis/scene/add/trajectories rich\"";