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
+25 -4
View File
@@ -1,4 +1,4 @@
$Id: History 110128 2018-05-16 06:36:57Z gcosmo $
$Id: History 110743 2018-06-12 06:33:37Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,14 +20,35 @@ committal in the CVS repository !
History file for visualization/modeling
---------------------------------------
11th March 2018 John Allison (modeling-V10-03-10)
11 June 2018 John Allison (modeling-V10-04-06)
- G4PhysicalVolumeModel.cc: Fix Coverity warning.
o Unnecessary check on pointer.
24 May 2018 John Allison (modeling-V10-04-05)
- G4LogicalVolumeModel:
o Add fCheckOverlaps flag. Calls CheckOverlaps for each G4PVPlacement.
o Note: G4PVParameterised not coded in this tag.
- G4TrajectoryDrawByEncounteredVolume.cc,
G4TrajectoryEncounteredVolumeFilter.cc:
o Fix gcc-8 warnings.
30 April 2018 John Allison
- G4PhysicalVolumeModel.cc: Colour by density: improved comments.
24 April 2018 John Allison (modeling-V10-04-04)
- G4ModelingParameters.cc: Small bug fix.
24 April 2018 John Allison (modeling-V10-04-03)
- Implement /vis/viewer/set/colourByDensity.
11th March 2018 John Allison (modeling-V10-04-02)
- G4PhysicalVolumeMassScene.cc: Protect case of no material in parallel world.
19th December 2017 Gabriele Cosmo (modeling-V10-03-09)
19th December 2017 Gabriele Cosmo (modeling-V10-04-01)
- Fixed self-consistency in G4AttValueFilterT header (missing #include).
Thanks to Raphael Isemann for reporting this.
12th December 2017 John Allison
12th December 2017 John Allison (modeling-V10-04-00)
- G4TrajectoryDrawerUtils.cc: Improvement to an informational message.
13th September 2017 John Allison (modeling-V10-03-08)
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AttValueFilterT.hh 108542 2018-02-16 09:35:32Z gcosmo $
// $Id: G4AttValueFilterT.hh 108059 2017-12-19 15:13:34Z gcosmo $
//
// Templated class for G4AttValue filters.
//
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolumeModel.hh 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4LogicalVolumeModel.hh 110480 2018-05-25 07:25:18Z gcosmo $
//
//
// John Allison 26th July 1999.
@@ -58,6 +58,7 @@ public: // With description
G4bool booleans = true,
G4bool voxels = true,
G4bool readout = true,
G4bool checkOverlaps = true,
const G4Transform3D& modelTransformation = G4Transform3D(),
const G4ModelingParameters* = 0);
@@ -84,6 +85,7 @@ protected:
G4bool fBooleans; // Flag for drawing boolean components.
G4bool fVoxels; // Flag for drawing voxels.
G4bool fReadout; // Flag for drawing readout geometry.
G4bool fCheckOverlaps; // Flag for checking overlaps.
};
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.hh 103627 2017-04-19 13:30:26Z gcosmo $
// $Id: G4ModelingParameters.hh 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -178,6 +178,8 @@ public: // With description
G4bool IsDensityCulling () const;
G4double GetVisibleDensity () const;
G4bool IsCullingCovered () const;
G4int GetCBDAlgorithmNumber () const;
const std::vector<G4double>& GetCBDParameters () const;
G4bool IsExplode () const;
G4double GetExplodeFactor () const;
const G4Point3D& GetExplodeCentre () const;
@@ -196,6 +198,8 @@ public: // With description
void SetDensityCulling (G4bool);
void SetVisibleDensity (G4double);
void SetCullingCovered (G4bool);
void SetCBDAlgorithmNumber (G4int);
void SetCBDParameters (const std::vector<G4double>&);
void SetExplodeFactor (G4double explodeFactor);
void SetExplodeCentre (const G4Point3D& explodeCentre);
G4int SetNoOfSides (G4int); // Returns actual number set.
@@ -228,6 +232,8 @@ private:
G4bool fDensityCulling; // Density culling requested. If so...
G4double fVisibleDensity; // ...density lower than this not drawn.
G4bool fCullCovered; // Cull daughters covered by opaque mothers.
G4int fCBDAlgorithmNumber; // Colour by density algorithm number.
std::vector<G4double> fCBDParameters; // Colour by density parameters.
G4double fExplodeFactor; // Explode along radius by this factor...
G4Point3D fExplodeCentre; // ...about this centre.
G4int fNoOfSides; // ...if polygon approximates circle.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.icc 99418 2016-09-21 09:18:42Z gcosmo $
// $Id: G4ModelingParameters.icc 109510 2018-04-26 07:15:57Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -64,6 +64,14 @@ inline G4bool G4ModelingParameters::IsCullingCovered () const {
return fCullCovered;
}
inline G4int G4ModelingParameters::GetCBDAlgorithmNumber () const {
return fCBDAlgorithmNumber;
}
inline const std::vector<G4double>& G4ModelingParameters::GetCBDParameters () const {
return fCBDParameters;
}
inline G4bool G4ModelingParameters::IsExplode () const {
return fExplodeFactor > 1.;
}
@@ -125,6 +133,14 @@ inline void G4ModelingParameters::SetCullingCovered (G4bool value) {
fCullCovered = value;
}
inline void G4ModelingParameters::SetCBDAlgorithmNumber (G4int n) {
fCBDAlgorithmNumber = n;
}
inline void G4ModelingParameters::SetCBDParameters (const std::vector<G4double>& p) {
fCBDParameters = p;
}
inline void G4ModelingParameters::SetExplodeFactor (G4double explodeFactor) {
fExplodeFactor = explodeFactor;
}
@@ -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\"";