Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -23,11 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4PVDivision Implementation file
|
||||
//
|
||||
//
|
||||
// class G4PVDivision Implementation file
|
||||
//
|
||||
// 26.05.03 - P.Arce Initial version
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4PVDivision.hh"
|
||||
@@ -50,10 +48,9 @@ G4PVDivision::G4PVDivision(const G4String& pName,
|
||||
const G4int nDivs,
|
||||
const G4double width,
|
||||
const G4double offset )
|
||||
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0),
|
||||
fcopyNo(-1)
|
||||
: G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr)
|
||||
{
|
||||
if (!pMotherLogical)
|
||||
if (pMotherLogical == nullptr)
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Invalid setup." << G4endl
|
||||
@@ -85,10 +82,9 @@ G4PVDivision::G4PVDivision(const G4String& pName,
|
||||
const EAxis pAxis,
|
||||
const G4int nDivs,
|
||||
const G4double offset )
|
||||
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0),
|
||||
fcopyNo(-1)
|
||||
: G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr)
|
||||
{
|
||||
if (!pMotherLogical)
|
||||
if (pMotherLogical == nullptr)
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Invalid setup." << G4endl
|
||||
@@ -118,10 +114,9 @@ G4PVDivision::G4PVDivision(const G4String& pName,
|
||||
const EAxis pAxis,
|
||||
const G4double width,
|
||||
const G4double offset )
|
||||
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0),
|
||||
fcopyNo(-1)
|
||||
: G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr)
|
||||
{
|
||||
if (!pMotherLogical)
|
||||
if (pMotherLogical == nullptr)
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Invalid setup." << G4endl
|
||||
@@ -144,6 +139,42 @@ G4PVDivision::G4PVDivision(const G4String& pName,
|
||||
CheckAndSetParameters (pAxis, 0, width, offset, DivWIDTH, pMotherLogical);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4PVDivision::G4PVDivision(const G4String& pName,
|
||||
G4LogicalVolume* pLogical,
|
||||
G4VPhysicalVolume* pMotherPhysical,
|
||||
const EAxis pAxis,
|
||||
const G4int nDivs,
|
||||
const G4double width,
|
||||
const G4double offset )
|
||||
: G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr)
|
||||
{
|
||||
if (pMotherPhysical == nullptr)
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Invalid setup." << G4endl
|
||||
<< "NULL pointer specified as mother for volume: " << pName;
|
||||
G4Exception("G4PVDivision::G4PVDivision()", "GeomDiv0002",
|
||||
FatalException, message);
|
||||
return;
|
||||
}
|
||||
G4LogicalVolume* pMotherLogical = pMotherPhysical->GetLogicalVolume();
|
||||
if (pLogical == pMotherLogical)
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Invalid setup." << G4endl
|
||||
<< "Cannot place a volume inside itself! Volume: " << pName;
|
||||
G4Exception("G4PVDivision::G4PVDivision()", "GeomDiv0002",
|
||||
FatalException, message);
|
||||
}
|
||||
pMotherLogical->AddDaughter(this);
|
||||
SetMotherLogical(pMotherLogical);
|
||||
SetParameterisation(pMotherLogical, pAxis, nDivs,
|
||||
width, offset, DivNDIVandWIDTH);
|
||||
CheckAndSetParameters (pAxis, nDivs, width, offset,
|
||||
DivNDIVandWIDTH, pMotherLogical);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
void
|
||||
G4PVDivision::CheckAndSetParameters( const EAxis pAxis,
|
||||
@@ -199,7 +230,7 @@ G4PVDivision::CheckAndSetParameters( const EAxis pAxis,
|
||||
// in G4VPVParameterisation::ComputeTransformation, for others
|
||||
// it will stay the unity
|
||||
//
|
||||
G4RotationMatrix *pRMat = new G4RotationMatrix();
|
||||
G4RotationMatrix* pRMat = new G4RotationMatrix();
|
||||
SetRotation(pRMat);
|
||||
|
||||
switch (faxis)
|
||||
@@ -268,7 +299,7 @@ G4int G4PVDivision::GetCopyNo() const
|
||||
//--------------------------------------------------------------------------
|
||||
void G4PVDivision::SetCopyNo(G4int newCopyNo)
|
||||
{
|
||||
fcopyNo= newCopyNo;
|
||||
fcopyNo = newCopyNo;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -296,17 +327,23 @@ void G4PVDivision::GetReplicationData(EAxis& axis,
|
||||
G4double& offset,
|
||||
G4bool& consuming ) const
|
||||
{
|
||||
axis=faxis;
|
||||
nDivs=fnReplicas;
|
||||
width=fwidth;
|
||||
offset=foffset;
|
||||
consuming=false;
|
||||
axis = faxis;
|
||||
nDivs = fnReplicas;
|
||||
width = fwidth;
|
||||
offset = foffset;
|
||||
consuming = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
EVolume G4PVDivision::VolumeType() const
|
||||
{
|
||||
return kParameterised;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//TODO: this method should check that the child lv is of the correct type,
|
||||
// else the ComputeDimensions will never be called
|
||||
// TODO: this method should check that the child lv is of the correct type,
|
||||
// else the ComputeDimensions will never be called
|
||||
//
|
||||
void G4PVDivision::SetParameterisation( G4LogicalVolume* motherLogical,
|
||||
const EAxis axis,
|
||||
const G4int nDivs,
|
||||
@@ -523,11 +560,13 @@ void G4PVDivision::ErrorInAxis( EAxis axis, G4VSolid* solid )
|
||||
G4Exception("G4PVDivision::ErrorInAxis()", "GeomDiv0002",
|
||||
FatalException, error);
|
||||
}
|
||||
// The next methods are for specialised repeated volumes
|
||||
// (replicas, parameterised vol.) which are completely regular.
|
||||
|
||||
// The next methods are for specialised repeated volumes (replicas,
|
||||
// parameterised vol.) which are completely regular.
|
||||
// Currently this is not applicable to divisions ( J.A. Nov 2005 )
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// IsRegularRepeatedStructure()
|
||||
// IsRegularStructure()
|
||||
//
|
||||
G4bool G4PVDivision::IsRegularStructure() const
|
||||
{
|
||||
@@ -535,10 +574,9 @@ G4bool G4PVDivision::IsRegularStructure() const
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// IsRegularRepeatedStructure()
|
||||
// GetRegularStructureId()
|
||||
//
|
||||
G4int G4PVDivision::GetRegularStructureId() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// This is for specialised repeated volumes (replicas, parameterised vol.)
|
||||
|
||||
@@ -23,11 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4PVDivisionFactory Implementation file
|
||||
//
|
||||
//
|
||||
// class G4PVDivisionFactory Implementation file
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 4.5.2004 (Ivana.Hrivnacova@cern.ch)
|
||||
// Author: Ivana Hrivnacova, 04.05.2004 (Ivana.Hrivnacova@cern.ch)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4PVDivisionFactory.hh"
|
||||
@@ -53,7 +51,7 @@ G4PVDivisionFactory::~G4PVDivisionFactory()
|
||||
|
||||
G4PVDivisionFactory* G4PVDivisionFactory::GetInstance()
|
||||
{
|
||||
if (!fgInstance)
|
||||
if (fgInstance == nullptr)
|
||||
{
|
||||
fgInstance = new G4PVDivisionFactory;
|
||||
}
|
||||
@@ -128,12 +126,12 @@ G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
|
||||
const G4VDivisionParameterisation* divParam
|
||||
= dynamic_cast<const G4VDivisionParameterisation*>(param);
|
||||
|
||||
if (!divParam)
|
||||
if (divParam == nullptr)
|
||||
{
|
||||
G4Exception("G4PVDivisionFactory::CreatePVDivision()",
|
||||
"GeomDiv0001", FatalException,
|
||||
"Unexpected parameterisation type!");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -154,9 +152,6 @@ G4bool G4PVDivisionFactory::IsPVDivision(const G4VPhysicalVolume* pv) const
|
||||
// Returns true if pv is division
|
||||
// ---
|
||||
|
||||
if (dynamic_cast<const G4PVDivision*>(pv))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return (dynamic_cast<const G4PVDivision*>(pv) != nullptr) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4ParameterisationBox Implementation file
|
||||
// G4ParameterisationBox[X/Y/Z] implementation
|
||||
//
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4ParameterisationCons Implementation file
|
||||
// G4ParameterisationCons[Rho/Phi/Z] implementation
|
||||
//
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
@@ -172,8 +170,8 @@ ComputeDimensions( G4Cons& cons, const G4int copyNo,
|
||||
{
|
||||
G4Cons* msol = (G4Cons*)(fmotherSolid);
|
||||
|
||||
G4double pRMin1 = msol->GetInnerRadiusMinusZ() + foffset + fwidth * copyNo;
|
||||
G4double pRMax1 = msol->GetInnerRadiusMinusZ() + foffset + fwidth * (copyNo+1);
|
||||
G4double pRMin1 = msol->GetInnerRadiusMinusZ() + foffset + fwidth*copyNo;
|
||||
G4double pRMax1 = msol->GetInnerRadiusMinusZ() + foffset + fwidth*(copyNo+1);
|
||||
|
||||
//width at Z Plus
|
||||
//- G4double fwidthPlus =
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4ParameterisationPara Implementation file
|
||||
// class G4ParameterisationPara[X,Y,Z] implementation
|
||||
//
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4ParameterisationPolycone Implementation file
|
||||
// G4ParameterisationPolycone[Rho/Phi/Z] implementation
|
||||
//
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
@@ -58,20 +56,23 @@ G4VParameterisationPolycone( EAxis axis, G4int nDiv, G4double width,
|
||||
G4Polycone* msol = (G4Polycone*)(msolid);
|
||||
if (msolid->GetEntityType() == "G4ReflectedSolid")
|
||||
{
|
||||
// Get constituent solid
|
||||
// Get constituent solid
|
||||
//
|
||||
G4VSolid* mConstituentSolid
|
||||
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
|
||||
msol = (G4Polycone*)(mConstituentSolid);
|
||||
|
||||
// Get parameters
|
||||
//
|
||||
G4int nofZplanes = msol->GetOriginalParameters()->Num_z_planes;
|
||||
G4double* zValues = msol->GetOriginalParameters()->Z_values;
|
||||
G4double* rminValues = msol->GetOriginalParameters()->Rmin;
|
||||
G4double* rmaxValues = msol->GetOriginalParameters()->Rmax;
|
||||
|
||||
// Invert z values
|
||||
G4double* zValuesRefl = new double[nofZplanes];
|
||||
for (G4int i=0; i<nofZplanes; i++) zValuesRefl[i] = - zValues[i];
|
||||
//
|
||||
G4double* zValuesRefl = new G4double[nofZplanes];
|
||||
for (G4int i=0; i<nofZplanes; ++i) { zValuesRefl[i] = - zValues[i]; }
|
||||
|
||||
G4Polycone* newSolid
|
||||
= new G4Polycone(msol->GetName(),
|
||||
@@ -219,7 +220,7 @@ ComputeDimensions( G4Polycone& pcone, const G4int copyNo,
|
||||
G4int nZplanes = origparamMother->Num_z_planes;
|
||||
|
||||
G4double width = 0.;
|
||||
for( G4int ii = 0; ii < nZplanes; ii++ )
|
||||
for( G4int ii = 0; ii < nZplanes; ++ii )
|
||||
{
|
||||
width = CalculateWidth( origparamMother->Rmax[ii]
|
||||
- origparamMother->Rmin[ii], fnDiv, foffset );
|
||||
@@ -288,7 +289,7 @@ G4double G4ParameterisationPolyconePhi::GetMaxParameter() const
|
||||
//---------------------------------------------------------------------
|
||||
void
|
||||
G4ParameterisationPolyconePhi::
|
||||
ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
|
||||
ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol ) const
|
||||
{
|
||||
//----- translation
|
||||
G4ThreeVector origin(0.,0.,0.);
|
||||
@@ -352,7 +353,6 @@ G4ParameterisationPolyconeZ( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType)
|
||||
: G4VParameterisationPolycone( axis, nDiv, width, offset, msolid, divType ),
|
||||
fNSegment(0),
|
||||
fOrigParamMother(((G4Polycone*)fmotherSolid)->GetOriginalParameters())
|
||||
{
|
||||
|
||||
@@ -429,7 +429,7 @@ G4double G4ParameterisationPolyconeZ::GetRmax(G4double z, G4int nseg) const
|
||||
G4double G4ParameterisationPolyconeZ::GetMaxParameter() const
|
||||
{
|
||||
return std::abs (fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
|
||||
-fOrigParamMother->Z_values[0]);
|
||||
-fOrigParamMother->Z_values[0]);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
@@ -438,8 +438,11 @@ void G4ParameterisationPolyconeZ::CheckParametersValidity()
|
||||
G4VDivisionParameterisation::CheckParametersValidity();
|
||||
|
||||
// Division will be following the mother polycone segments
|
||||
if( fDivisionType == DivNDIV ) {
|
||||
if( fnDiv > fOrigParamMother->Num_z_planes-1 ) {
|
||||
//
|
||||
if( fDivisionType == DivNDIV )
|
||||
{
|
||||
if( fnDiv > fOrigParamMother->Num_z_planes-1 )
|
||||
{
|
||||
std::ostringstream error;
|
||||
error << "Configuration not supported." << G4endl
|
||||
<< "Division along Z will be done by splitting in the defined"
|
||||
@@ -454,52 +457,64 @@ void G4ParameterisationPolyconeZ::CheckParametersValidity()
|
||||
|
||||
// Division will be done within one polycone segment
|
||||
// with applying given width and offset
|
||||
if( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH ) {
|
||||
//
|
||||
if( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH )
|
||||
{
|
||||
// Check if divided region does not span over more
|
||||
// than one z segment
|
||||
|
||||
G4int isegstart = -1; // number of the segment containing start position
|
||||
G4int isegend = -1; // number of the segment containing end position
|
||||
|
||||
if ( ! fReflectedSolid ) {
|
||||
if ( !fReflectedSolid )
|
||||
{
|
||||
// The start/end position of the divided region
|
||||
//
|
||||
G4double zstart
|
||||
= fOrigParamMother->Z_values[0] + foffset;
|
||||
G4double zend
|
||||
= fOrigParamMother->Z_values[0] + foffset + fnDiv* fwidth;
|
||||
|
||||
G4int counter = 0;
|
||||
while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 ) {
|
||||
while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 )
|
||||
{
|
||||
// first segment
|
||||
if ( zstart >= fOrigParamMother->Z_values[counter] &&
|
||||
zstart < fOrigParamMother->Z_values[counter+1] ) {
|
||||
zstart < fOrigParamMother->Z_values[counter+1] )
|
||||
{
|
||||
isegstart = counter;
|
||||
}
|
||||
// last segment
|
||||
if ( zend > fOrigParamMother->Z_values[counter] &&
|
||||
zend <= fOrigParamMother->Z_values[counter+1] ) {
|
||||
zend <= fOrigParamMother->Z_values[counter+1] )
|
||||
{
|
||||
isegend = counter;
|
||||
}
|
||||
++counter;
|
||||
} // Loop checking, 06.08.2015, G.Cosmo
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// The start/end position of the divided region
|
||||
//
|
||||
G4double zstart
|
||||
= fOrigParamMother->Z_values[0] - foffset;
|
||||
G4double zend
|
||||
= fOrigParamMother->Z_values[0] - ( foffset + fnDiv* fwidth);
|
||||
|
||||
G4int counter = 0;
|
||||
while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 ) {
|
||||
while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 )
|
||||
{
|
||||
// first segment
|
||||
if ( zstart <= fOrigParamMother->Z_values[counter] &&
|
||||
zstart > fOrigParamMother->Z_values[counter+1] ) {
|
||||
zstart > fOrigParamMother->Z_values[counter+1] )
|
||||
{
|
||||
isegstart = counter;
|
||||
}
|
||||
// last segment
|
||||
if ( zend < fOrigParamMother->Z_values[counter] &&
|
||||
zend >= fOrigParamMother->Z_values[counter+1] ) {
|
||||
zend >= fOrigParamMother->Z_values[counter+1] )
|
||||
{
|
||||
isegend = counter;
|
||||
}
|
||||
++counter;
|
||||
@@ -507,7 +522,8 @@ void G4ParameterisationPolyconeZ::CheckParametersValidity()
|
||||
}
|
||||
|
||||
|
||||
if ( isegstart != isegend ) {
|
||||
if ( isegstart != isegend )
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Condiguration not supported." << G4endl
|
||||
<< "Division with user defined width." << G4endl
|
||||
@@ -526,19 +542,22 @@ void
|
||||
G4ParameterisationPolyconeZ::
|
||||
ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol) const
|
||||
{
|
||||
if ( fDivisionType == DivNDIV ) {
|
||||
if ( fDivisionType == DivNDIV )
|
||||
{
|
||||
// The position of the centre of copyNo-th mother polycone segment
|
||||
G4double posi
|
||||
= ( fOrigParamMother->Z_values[copyNo]
|
||||
+ fOrigParamMother->Z_values[copyNo+1])/2;
|
||||
//
|
||||
G4double posi = ( fOrigParamMother->Z_values[copyNo]
|
||||
+ fOrigParamMother->Z_values[copyNo+1])/2;
|
||||
physVol->SetTranslation( G4ThreeVector(0, 0, posi) );
|
||||
}
|
||||
|
||||
if ( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH ) {
|
||||
if ( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH )
|
||||
{
|
||||
// The position of the centre of copyNo-th division
|
||||
//
|
||||
G4double posi = fOrigParamMother->Z_values[0];
|
||||
|
||||
if ( ! fReflectedSolid )
|
||||
if ( !fReflectedSolid )
|
||||
posi += foffset + (2*copyNo + 1) * fwidth/2.;
|
||||
else
|
||||
posi -= foffset + (2*copyNo + 1) * fwidth/2.;
|
||||
@@ -578,6 +597,7 @@ ComputeDimensions( G4Polycone& pcone, const G4int copyNo,
|
||||
{
|
||||
|
||||
// Define division solid
|
||||
//
|
||||
G4PolyconeHistorical origparam;
|
||||
G4int nz = 2;
|
||||
origparam.Num_z_planes = nz;
|
||||
@@ -585,11 +605,13 @@ ComputeDimensions( G4Polycone& pcone, const G4int copyNo,
|
||||
origparam.Opening_angle = fOrigParamMother->Opening_angle;
|
||||
|
||||
// Define division solid z sections
|
||||
//
|
||||
origparam.Z_values = new G4double[nz];
|
||||
origparam.Rmin = new G4double[nz];
|
||||
origparam.Rmax = new G4double[nz];
|
||||
|
||||
if ( fDivisionType == DivNDIV ) {
|
||||
if ( fDivisionType == DivNDIV )
|
||||
{
|
||||
// The position of the centre of copyNo-th mother polycone segment
|
||||
G4double posi = (fOrigParamMother->Z_values[copyNo]
|
||||
+ fOrigParamMother->Z_values[copyNo+1])/2;
|
||||
@@ -602,16 +624,20 @@ ComputeDimensions( G4Polycone& pcone, const G4int copyNo,
|
||||
origparam.Rmax[1] = fOrigParamMother->Rmax[copyNo+1];
|
||||
}
|
||||
|
||||
if ( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH ) {
|
||||
if ( ! fReflectedSolid ) {
|
||||
if ( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH )
|
||||
{
|
||||
if ( !fReflectedSolid )
|
||||
{
|
||||
origparam.Z_values[0] = - fwidth/2.;
|
||||
origparam.Z_values[1] = fwidth/2.;
|
||||
|
||||
// The position of the centre of copyNo-th division
|
||||
G4double posi
|
||||
= fOrigParamMother->Z_values[0] + foffset + (2*copyNo + 1) * fwidth/2.;
|
||||
//
|
||||
G4double posi = fOrigParamMother->Z_values[0]
|
||||
+ foffset + (2*copyNo + 1) * fwidth/2.;
|
||||
|
||||
// The first and last z sides z values
|
||||
//
|
||||
G4double zstart = posi - fwidth/2.;
|
||||
G4double zend = posi + fwidth/2.;
|
||||
origparam.Rmin[0] = GetRmin(zstart, fNSegment);
|
||||
@@ -619,15 +645,18 @@ ComputeDimensions( G4Polycone& pcone, const G4int copyNo,
|
||||
origparam.Rmin[1] = GetRmin(zend, fNSegment);
|
||||
origparam.Rmax[1] = GetRmax(zend, fNSegment);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
origparam.Z_values[0] = fwidth/2.;
|
||||
origparam.Z_values[1] = - fwidth/2.;
|
||||
|
||||
// The position of the centre of copyNo-th division
|
||||
G4double posi
|
||||
= fOrigParamMother->Z_values[0] - ( foffset + (2*copyNo + 1) * fwidth/2.);
|
||||
//
|
||||
G4double posi = fOrigParamMother->Z_values[0]
|
||||
- ( foffset + (2*copyNo + 1) * fwidth/2.);
|
||||
|
||||
// The first and last z sides z values
|
||||
//
|
||||
G4double zstart = posi + fwidth/2.;
|
||||
G4double zend = posi - fwidth/2.;
|
||||
origparam.Rmin[0] = GetRmin(zstart, fNSegment);
|
||||
@@ -637,6 +666,7 @@ ComputeDimensions( G4Polycone& pcone, const G4int copyNo,
|
||||
}
|
||||
|
||||
// It can happen due to rounding errors
|
||||
//
|
||||
if ( origparam.Rmin[0] < 0.0 ) origparam.Rmin[0] = 0.0;
|
||||
if ( origparam.Rmin[nz-1] < 0.0 ) origparam.Rmin[1] = 0.0;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4ParameterisationPolyhedra Implementation file
|
||||
// G4ParameterisationPolyhedra[Rho/Phi/Z] implementation
|
||||
//
|
||||
// 14.10.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
@@ -69,24 +67,26 @@ G4VParameterisationPolyhedra( EAxis axis, G4int nDiv, G4double width,
|
||||
}
|
||||
if (msolid->GetEntityType() == "G4ReflectedSolid")
|
||||
{
|
||||
// Get constituent solid
|
||||
// Get constituent solid
|
||||
//
|
||||
G4VSolid* mConstituentSolid
|
||||
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
|
||||
msol = (G4Polyhedra*)(mConstituentSolid);
|
||||
|
||||
// Get parameters
|
||||
G4int nofSides = msol->GetOriginalParameters()->numSide;
|
||||
G4int nofZplanes = msol->GetOriginalParameters()->Num_z_planes;
|
||||
G4double* zValues = msol->GetOriginalParameters()->Z_values;
|
||||
G4double* rminValues = msol->GetOriginalParameters()->Rmin;
|
||||
G4double* rmaxValues = msol->GetOriginalParameters()->Rmax;
|
||||
//
|
||||
G4int nofSides = msol->GetOriginalParameters()->numSide;
|
||||
G4int nofZplanes = msol->GetOriginalParameters()->Num_z_planes;
|
||||
G4double* zValues = msol->GetOriginalParameters()->Z_values;
|
||||
G4double* rminValues = msol->GetOriginalParameters()->Rmin;
|
||||
G4double* rmaxValues = msol->GetOriginalParameters()->Rmax;
|
||||
|
||||
// Invert z values,
|
||||
// convert radius parameters
|
||||
// Invert z values, convert radius parameters
|
||||
//
|
||||
G4double* rminValues2 = new G4double[nofZplanes];
|
||||
G4double* rmaxValues2 = new G4double[nofZplanes];
|
||||
G4double* zValuesRefl = new G4double[nofZplanes];
|
||||
for (G4int i=0; i<nofZplanes; i++)
|
||||
for (G4int i=0; i<nofZplanes; ++i)
|
||||
{
|
||||
rminValues2[i] = rminValues[i] * ConvertRadiusFactor(*msol);
|
||||
rmaxValues2[i] = rmaxValues[i] * ConvertRadiusFactor(*msol);
|
||||
@@ -258,7 +258,7 @@ ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
|
||||
G4int nZplanes = origparamMother->Num_z_planes;
|
||||
|
||||
G4double width = 0.;
|
||||
for( G4int ii = 0; ii < nZplanes; ii++ )
|
||||
for( G4int ii = 0; ii < nZplanes; ++ii )
|
||||
{
|
||||
width = CalculateWidth( origparamMother->Rmax[ii]
|
||||
- origparamMother->Rmin[ii], fnDiv, foffset );
|
||||
@@ -368,7 +368,7 @@ void G4ParameterisationPolyhedraPhi::CheckParametersValidity()
|
||||
//--------------------------------------------------------------------------
|
||||
void
|
||||
G4ParameterisationPolyhedraPhi::
|
||||
ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
|
||||
ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol ) const
|
||||
{
|
||||
//----- translation
|
||||
G4ThreeVector origin(0.,0.,0.);
|
||||
@@ -393,8 +393,8 @@ ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
|
||||
#ifdef G4DIVDEBUG
|
||||
if( verbose >= 2 )
|
||||
{
|
||||
G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraPhi " << copyNo
|
||||
<< G4endl
|
||||
G4cout << std::setprecision(8) << " G4ParameterisationPolyhedraPhi "
|
||||
<< copyNo << G4endl
|
||||
<< " Position: " << origin << " - Width: " << fwidth
|
||||
<< " - Axis: " << faxis << G4endl;
|
||||
}
|
||||
@@ -434,28 +434,27 @@ G4ParameterisationPolyhedraZ( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType ),
|
||||
fNSegment(0),
|
||||
fOrigParamMother(((G4Polyhedra*)fmotherSolid)->GetOriginalParameters())
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionPolyhedraZ" );
|
||||
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
{
|
||||
fnDiv =
|
||||
CalculateNDiv( fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
|
||||
- fOrigParamMother->Z_values[0] , width, offset );
|
||||
CalculateNDiv(fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
|
||||
- fOrigParamMother->Z_values[0] , width, offset);
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
{
|
||||
fwidth =
|
||||
CalculateNDiv( fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
|
||||
- fOrigParamMother->Z_values[0] , nDiv, offset );
|
||||
CalculateNDiv(fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
|
||||
- fOrigParamMother->Z_values[0] , nDiv, offset);
|
||||
}
|
||||
|
||||
#ifdef G4DIVDEBUG
|
||||
if( verbose >= 1 )
|
||||
{
|
||||
{
|
||||
G4cout << " G4ParameterisationPolyhedraZ - # divisions " << fnDiv << " = "
|
||||
<< nDiv << G4endl
|
||||
<< " Offset " << foffset << " = " << offset << G4endl
|
||||
@@ -509,8 +508,8 @@ G4double G4ParameterisationPolyhedraZ::GetRmax(G4double z, G4int nseg) const
|
||||
//------------------------------------------------------------------------
|
||||
G4double G4ParameterisationPolyhedraZ::GetMaxParameter() const
|
||||
{
|
||||
return std::abs (fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
|
||||
-fOrigParamMother->Z_values[0]);
|
||||
return std::abs(fOrigParamMother->Z_values[fOrigParamMother->Num_z_planes-1]
|
||||
-fOrigParamMother->Z_values[0]);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
@@ -519,8 +518,11 @@ void G4ParameterisationPolyhedraZ::CheckParametersValidity()
|
||||
G4VDivisionParameterisation::CheckParametersValidity();
|
||||
|
||||
// Division will be following the mother polyhedra segments
|
||||
if( fDivisionType == DivNDIV ) {
|
||||
if( fOrigParamMother->Num_z_planes-1 != fnDiv ) {
|
||||
//
|
||||
if( fDivisionType == DivNDIV )
|
||||
{
|
||||
if( fOrigParamMother->Num_z_planes-1 != fnDiv )
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Configuration not supported." << G4endl
|
||||
<< "Division along Z will be done splitting in the defined"
|
||||
@@ -535,59 +537,70 @@ void G4ParameterisationPolyhedraZ::CheckParametersValidity()
|
||||
|
||||
// Division will be done within one polyhedra segment
|
||||
// with applying given width and offset
|
||||
if( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH ) {
|
||||
//
|
||||
if( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH )
|
||||
{
|
||||
// Check if divided region does not span over more
|
||||
// than one z segment
|
||||
|
||||
G4int isegstart = -1; // number of the segment containing start position
|
||||
G4int isegend = -1; // number of the segment containing end position
|
||||
|
||||
if ( ! fReflectedSolid ) {
|
||||
if ( !fReflectedSolid )
|
||||
{
|
||||
// The start/end position of the divided region
|
||||
G4double zstart
|
||||
= fOrigParamMother->Z_values[0] + foffset;
|
||||
G4double zend
|
||||
= fOrigParamMother->Z_values[0] + foffset + fnDiv* fwidth;
|
||||
//
|
||||
G4double zstart = fOrigParamMother->Z_values[0] + foffset;
|
||||
G4double zend = fOrigParamMother->Z_values[0]
|
||||
+ foffset + fnDiv*fwidth;
|
||||
|
||||
G4int counter = 0;
|
||||
while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 ) {
|
||||
while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 )
|
||||
{
|
||||
// first segment
|
||||
if ( zstart >= fOrigParamMother->Z_values[counter] &&
|
||||
zstart < fOrigParamMother->Z_values[counter+1] ) {
|
||||
zstart < fOrigParamMother->Z_values[counter+1] )
|
||||
{
|
||||
isegstart = counter;
|
||||
}
|
||||
// last segment
|
||||
if ( zend > fOrigParamMother->Z_values[counter] &&
|
||||
zend <= fOrigParamMother->Z_values[counter+1] ) {
|
||||
zend <= fOrigParamMother->Z_values[counter+1] )
|
||||
{
|
||||
isegend = counter;
|
||||
}
|
||||
++counter;
|
||||
} // Loop checking, 06.08.2015, G.Cosmo
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// The start/end position of the divided region
|
||||
G4double zstart
|
||||
= fOrigParamMother->Z_values[0] - foffset;
|
||||
G4double zend
|
||||
= fOrigParamMother->Z_values[0] - ( foffset + fnDiv* fwidth);
|
||||
//
|
||||
G4double zstart = fOrigParamMother->Z_values[0] - foffset;
|
||||
G4double zend = fOrigParamMother->Z_values[0]
|
||||
- (foffset + fnDiv* fwidth);
|
||||
|
||||
G4int counter = 0;
|
||||
while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 ) {
|
||||
while ( isegend < 0 && counter < fOrigParamMother->Num_z_planes-1 )
|
||||
{
|
||||
// first segment
|
||||
if ( zstart <= fOrigParamMother->Z_values[counter] &&
|
||||
zstart > fOrigParamMother->Z_values[counter+1] ) {
|
||||
zstart > fOrigParamMother->Z_values[counter+1] )
|
||||
{
|
||||
isegstart = counter;
|
||||
}
|
||||
// last segment
|
||||
if ( zend < fOrigParamMother->Z_values[counter] &&
|
||||
zend >= fOrigParamMother->Z_values[counter+1] ) {
|
||||
zend >= fOrigParamMother->Z_values[counter+1] )
|
||||
{
|
||||
isegend = counter;
|
||||
}
|
||||
++counter;
|
||||
} // Loop checking, 06.08.2015, G.Cosmo
|
||||
}
|
||||
|
||||
if ( isegstart != isegend ) {
|
||||
if ( isegstart != isegend )
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Configuration not supported." << G4endl
|
||||
<< "Division with user defined width." << G4endl
|
||||
@@ -606,19 +619,22 @@ void
|
||||
G4ParameterisationPolyhedraZ::
|
||||
ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol) const
|
||||
{
|
||||
if ( fDivisionType == DivNDIV ) {
|
||||
if ( fDivisionType == DivNDIV )
|
||||
{
|
||||
// The position of the centre of copyNo-th mother polycone segment
|
||||
|
||||
G4double posi = ( fOrigParamMother->Z_values[copyNo]
|
||||
+ fOrigParamMother->Z_values[copyNo+1])/2;
|
||||
physVol->SetTranslation( G4ThreeVector(0, 0, posi) );
|
||||
}
|
||||
|
||||
if ( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH ) {
|
||||
if ( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH )
|
||||
{
|
||||
// The position of the centre of copyNo-th division
|
||||
|
||||
G4double posi = fOrigParamMother->Z_values[0];
|
||||
|
||||
if ( ! fReflectedSolid )
|
||||
if ( !fReflectedSolid )
|
||||
posi += foffset + (2*copyNo + 1) * fwidth/2.;
|
||||
else
|
||||
posi -= foffset + (2*copyNo + 1) * fwidth/2.;
|
||||
@@ -657,6 +673,7 @@ ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
|
||||
const G4VPhysicalVolume* ) const
|
||||
{
|
||||
// Define division solid
|
||||
//
|
||||
G4PolyhedraHistorical origparam;
|
||||
G4int nz = 2;
|
||||
origparam.Num_z_planes = nz;
|
||||
@@ -665,14 +682,17 @@ ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
|
||||
origparam.Opening_angle = fOrigParamMother->Opening_angle;
|
||||
|
||||
// Define division solid z sections
|
||||
//
|
||||
origparam.Z_values = new G4double[nz];
|
||||
origparam.Rmin = new G4double[nz];
|
||||
origparam.Rmax = new G4double[nz];
|
||||
origparam.Z_values[0] = - fwidth/2.;
|
||||
origparam.Z_values[1] = fwidth/2.;
|
||||
|
||||
if ( fDivisionType == DivNDIV ) {
|
||||
if ( fDivisionType == DivNDIV )
|
||||
{
|
||||
// The position of the centre of copyNo-th mother polycone segment
|
||||
//
|
||||
G4double posi = ( fOrigParamMother->Z_values[copyNo]
|
||||
+ fOrigParamMother->Z_values[copyNo+1])/2;
|
||||
|
||||
@@ -684,14 +704,17 @@ ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
|
||||
origparam.Rmax[1] = fOrigParamMother->Rmax[copyNo+1];
|
||||
}
|
||||
|
||||
if ( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH ) {
|
||||
if ( ! fReflectedSolid ) {
|
||||
origparam.Z_values[0] = - fwidth/2.;
|
||||
if ( fDivisionType == DivNDIVandWIDTH || fDivisionType == DivWIDTH )
|
||||
{
|
||||
if ( !fReflectedSolid )
|
||||
{
|
||||
origparam.Z_values[0] = -fwidth/2.;
|
||||
origparam.Z_values[1] = fwidth/2.;
|
||||
|
||||
// The position of the centre of copyNo-th division
|
||||
G4double posi
|
||||
= fOrigParamMother->Z_values[0] + foffset + (2*copyNo + 1) * fwidth/2.;
|
||||
//
|
||||
G4double posi = fOrigParamMother->Z_values[0]
|
||||
+ foffset + (2*copyNo + 1) * fwidth/2.;
|
||||
|
||||
// The first and last z sides z values
|
||||
G4double zstart = posi - fwidth/2.;
|
||||
@@ -701,15 +724,18 @@ ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
|
||||
origparam.Rmin[1] = GetRmin(zend, fNSegment);
|
||||
origparam.Rmax[1] = GetRmax(zend, fNSegment);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
origparam.Z_values[0] = fwidth/2.;
|
||||
origparam.Z_values[1] = - fwidth/2.;
|
||||
origparam.Z_values[1] = -fwidth/2.;
|
||||
|
||||
// The position of the centre of copyNo-th division
|
||||
G4double posi
|
||||
= fOrigParamMother->Z_values[0] - ( foffset + (2*copyNo + 1) * fwidth/2.);
|
||||
//
|
||||
G4double posi = fOrigParamMother->Z_values[0]
|
||||
- ( foffset + (2*copyNo + 1) * fwidth/2.);
|
||||
|
||||
// The first and last z sides z values
|
||||
//
|
||||
G4double zstart = posi + fwidth/2.;
|
||||
G4double zend = posi - fwidth/2.;
|
||||
origparam.Rmin[0] = GetRmin(zstart, fNSegment);
|
||||
@@ -719,6 +745,7 @@ ComputeDimensions( G4Polyhedra& phedra, const G4int copyNo,
|
||||
}
|
||||
|
||||
// It can happen due to rounding errors
|
||||
//
|
||||
if ( origparam.Rmin[0] < 0.0 ) origparam.Rmin[0] = 0.0;
|
||||
if ( origparam.Rmin[nz-1] < 0.0 ) origparam.Rmin[1] = 0.0;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4ParameterisationTrd Implementation file
|
||||
// G4ParameterisationTrd[X/Y/Z] implementation
|
||||
//
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
@@ -48,8 +46,7 @@ G4VParameterisationTrd::
|
||||
G4VParameterisationTrd( EAxis axis, G4int nDiv, G4double width,
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid ),
|
||||
bDivInTrap(false)
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
{
|
||||
G4Trd* msol = (G4Trd*)(msolid);
|
||||
if (msolid->GetEntityType() == "G4ReflectedSolid")
|
||||
@@ -201,7 +198,7 @@ ComputeDimensions( G4Trd& trd, const G4int, const G4VPhysicalVolume* ) const
|
||||
}
|
||||
|
||||
G4VSolid* G4ParameterisationTrdX::
|
||||
ComputeSolid(const G4int i, G4VPhysicalVolume * pv)
|
||||
ComputeSolid(const G4int i, G4VPhysicalVolume* pv)
|
||||
{
|
||||
if( bDivInTrap )
|
||||
{
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4ParameterisationTubs Implementation file
|
||||
// G4ParameterisationTubs[Rho/Phi/Z] implementation
|
||||
//
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
@@ -45,9 +43,9 @@
|
||||
//--------------------------------------------------------------------------
|
||||
G4VParameterisationTubs::
|
||||
G4VParameterisationTubs( EAxis axis, G4int nDiv, G4double width,
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
{
|
||||
G4Tubs* msol = (G4Tubs*)(msolid);
|
||||
if (msolid->GetEntityType() == "G4ReflectedSolid")
|
||||
@@ -71,7 +69,7 @@ G4ParameterisationTubsRho::
|
||||
G4ParameterisationTubsRho( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
|
||||
: G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionTubsRho" );
|
||||
@@ -154,8 +152,8 @@ ComputeDimensions( G4Tubs& tubs, const G4int copyNo,
|
||||
{
|
||||
G4Tubs* msol = (G4Tubs*)(fmotherSolid);
|
||||
|
||||
G4double pRMin = msol->GetInnerRadius() + foffset + fwidth * copyNo + fhgap;
|
||||
G4double pRMax = msol->GetInnerRadius() + foffset + fwidth * (copyNo+1) - fhgap;
|
||||
G4double pRMin = msol->GetInnerRadius() + foffset + fwidth*copyNo + fhgap;
|
||||
G4double pRMax = msol->GetInnerRadius() + foffset + fwidth*(copyNo+1) - fhgap;
|
||||
G4double pDz = msol->GetZHalfLength();
|
||||
//- already rotated G4double pSR = foffset + copyNo*fwidth;
|
||||
G4double pSPhi = msol->GetStartPhiAngle();
|
||||
@@ -182,7 +180,7 @@ G4ParameterisationTubsPhi::
|
||||
G4ParameterisationTubsPhi( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
|
||||
: G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionTubsPhi" );
|
||||
|
||||
@@ -23,8 +23,9 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4ReplicatedSlice implementation
|
||||
//
|
||||
//
|
||||
// Author: M.Asai (SLAC), 20/04/2010 - Extended from G4PVDivision
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ReplicatedSlice.hh"
|
||||
@@ -48,7 +49,7 @@ G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName,
|
||||
const G4double width,
|
||||
const G4double half_gap,
|
||||
const G4double offset )
|
||||
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fcopyNo(-1)
|
||||
: G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr)
|
||||
{
|
||||
CheckAndSetParameters(pAxis, nDivs, width, half_gap, offset,
|
||||
DivNDIVandWIDTH, pMotherLogical, pLogical);
|
||||
@@ -62,7 +63,7 @@ G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName,
|
||||
const G4int nDivs,
|
||||
const G4double half_gap,
|
||||
const G4double offset )
|
||||
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fcopyNo(-1)
|
||||
: G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr)
|
||||
{
|
||||
CheckAndSetParameters(pAxis, nDivs, 0., half_gap, offset,
|
||||
DivNDIV, pMotherLogical, pLogical);
|
||||
@@ -76,7 +77,7 @@ G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName,
|
||||
const G4double width,
|
||||
const G4double half_gap,
|
||||
const G4double offset )
|
||||
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fcopyNo(-1)
|
||||
: G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr)
|
||||
{
|
||||
CheckAndSetParameters(pAxis, 0, width, half_gap, offset,
|
||||
DivWIDTH, pMotherLogical, pLogical);
|
||||
@@ -91,7 +92,7 @@ G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName,
|
||||
const G4double width,
|
||||
const G4double half_gap,
|
||||
const G4double offset )
|
||||
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fcopyNo(-1)
|
||||
: G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr)
|
||||
{
|
||||
CheckAndSetParameters(pAxis, nDivs, width, half_gap, offset,
|
||||
DivNDIVandWIDTH, pMotherPhysical->GetLogicalVolume(), pLogical);
|
||||
@@ -105,7 +106,7 @@ G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName,
|
||||
const G4int nDivs,
|
||||
const G4double half_gap,
|
||||
const G4double offset )
|
||||
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fcopyNo(-1)
|
||||
: G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr)
|
||||
{
|
||||
CheckAndSetParameters(pAxis, nDivs, 0., half_gap, offset,
|
||||
DivNDIV, pMotherPhysical->GetLogicalVolume(), pLogical);
|
||||
@@ -119,7 +120,7 @@ G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName,
|
||||
const G4double width,
|
||||
const G4double half_gap,
|
||||
const G4double offset )
|
||||
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fcopyNo(-1)
|
||||
: G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr)
|
||||
{
|
||||
CheckAndSetParameters(pAxis, 0, width, half_gap, offset,
|
||||
DivWIDTH, pMotherPhysical->GetLogicalVolume(), pLogical);
|
||||
@@ -136,7 +137,7 @@ G4ReplicatedSlice::CheckAndSetParameters( const EAxis pAxis,
|
||||
G4LogicalVolume* pMotherLogical,
|
||||
const G4LogicalVolume* pLogical )
|
||||
{
|
||||
if(!pMotherLogical)
|
||||
if(pMotherLogical == nullptr)
|
||||
{
|
||||
std::ostringstream message;
|
||||
message << "Invalid setup." << G4endl
|
||||
@@ -240,7 +241,7 @@ G4ReplicatedSlice::CheckAndSetParameters( const EAxis pAxis,
|
||||
// in G4VPVParameterisation::ComputeTransformation, for others
|
||||
// it will stay the unity
|
||||
//
|
||||
G4RotationMatrix *pRMat = new G4RotationMatrix();
|
||||
G4RotationMatrix* pRMat = new G4RotationMatrix();
|
||||
SetRotation(pRMat);
|
||||
}
|
||||
|
||||
@@ -298,6 +299,12 @@ G4VPVParameterisation* G4ReplicatedSlice::GetParameterisation() const
|
||||
return fparam;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
EVolume G4ReplicatedSlice::VolumeType() const
|
||||
{
|
||||
return kParameterised;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
void G4ReplicatedSlice::GetReplicationData(EAxis& axis,
|
||||
G4int& nDivs,
|
||||
@@ -305,11 +312,11 @@ void G4ReplicatedSlice::GetReplicationData(EAxis& axis,
|
||||
G4double& offset,
|
||||
G4bool& consuming ) const
|
||||
{
|
||||
axis=faxis;
|
||||
nDivs=fnReplicas;
|
||||
width=fwidth;
|
||||
offset=foffset;
|
||||
consuming=false;
|
||||
axis = faxis;
|
||||
nDivs = fnReplicas;
|
||||
width = fwidth;
|
||||
offset = foffset;
|
||||
consuming = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -324,7 +331,7 @@ void G4ReplicatedSlice::SetParameterisation( G4LogicalVolume* motherLogical,
|
||||
{
|
||||
G4VSolid* mSolid = motherLogical->GetSolid();
|
||||
G4String mSolidType = mSolid->GetEntityType();
|
||||
fparam = 0;
|
||||
fparam = nullptr;
|
||||
|
||||
// If the solid is a reflected one, update type to its
|
||||
// real constituent solid.
|
||||
@@ -532,10 +539,11 @@ void G4ReplicatedSlice::ErrorInAxis( EAxis axis, G4VSolid* solid )
|
||||
}
|
||||
|
||||
// The next methods are for specialised repeated volumes
|
||||
// (replicas, parameterised vol.) which are completely regular.
|
||||
// (replicas, parameterised vol.) which are completely regular.
|
||||
// Currently this is not applicable to divisions ( J.A. Nov 2005 )
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// IsRegularRepeatedStructure()
|
||||
// IsRegularStructure()
|
||||
//
|
||||
G4bool G4ReplicatedSlice::IsRegularStructure() const
|
||||
{
|
||||
@@ -543,7 +551,7 @@ G4bool G4ReplicatedSlice::IsRegularStructure() const
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// IsRegularRepeatedStructure()
|
||||
// GetRegularStructureId()
|
||||
//
|
||||
G4int G4ReplicatedSlice::GetRegularStructureId() const
|
||||
{
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
// class G4VDivisionParameterisation Implementation file
|
||||
// G4VDivisionParameterisation implementation
|
||||
//
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
@@ -41,7 +39,7 @@
|
||||
#include "G4AutoDelete.hh"
|
||||
|
||||
const G4int G4VDivisionParameterisation::verbose = 5;
|
||||
G4ThreadLocal G4RotationMatrix* G4VDivisionParameterisation::fRot = 0;
|
||||
G4ThreadLocal G4RotationMatrix* G4VDivisionParameterisation::fRot = nullptr;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4VDivisionParameterisation::
|
||||
@@ -49,8 +47,7 @@ G4VDivisionParameterisation( EAxis axis, G4int nDiv,
|
||||
G4double step, G4double offset,
|
||||
DivisionType divType, G4VSolid* motherSolid )
|
||||
: faxis(axis), fnDiv( nDiv), fwidth(step), foffset(offset),
|
||||
fDivisionType(divType), fmotherSolid( motherSolid ), fReflectedSolid(false),
|
||||
fDeleteSolid(false), theVoluFirstCopyNo(1), fhgap(0.)
|
||||
fDivisionType(divType), fmotherSolid( motherSolid )
|
||||
{
|
||||
#ifdef G4DIVDEBUG
|
||||
if (verbose >= 1)
|
||||
@@ -67,7 +64,7 @@ G4VDivisionParameterisation( EAxis axis, G4int nDiv,
|
||||
//--------------------------------------------------------------------------
|
||||
G4VDivisionParameterisation::~G4VDivisionParameterisation()
|
||||
{
|
||||
if (fDeleteSolid) delete fmotherSolid;
|
||||
if (fDeleteSolid) { delete fmotherSolid; }
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -86,9 +83,9 @@ ComputeSolid( const G4int i, G4VPhysicalVolume* pv )
|
||||
//--------------------------------------------------------------------------
|
||||
void
|
||||
G4VDivisionParameterisation::
|
||||
ChangeRotMatrix( G4VPhysicalVolume *physVol, G4double rotZ ) const
|
||||
ChangeRotMatrix( G4VPhysicalVolume* physVol, G4double rotZ ) const
|
||||
{
|
||||
if (!fRot)
|
||||
if (fRot == nullptr)
|
||||
{
|
||||
fRot = new G4RotationMatrix();
|
||||
G4AutoDelete::Register(fRot);
|
||||
@@ -173,8 +170,12 @@ void G4VDivisionParameterisation::CheckNDivAndWidth( G4double maxPar )
|
||||
G4double G4VDivisionParameterisation::OffsetZ() const
|
||||
{
|
||||
// take into account reflection in the offset
|
||||
|
||||
G4double offset = foffset;
|
||||
if (fReflectedSolid) offset = GetMaxParameter() - fwidth*fnDiv - foffset;
|
||||
if (fReflectedSolid)
|
||||
{
|
||||
offset = GetMaxParameter() - fwidth*fnDiv - foffset;
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user