Import Geant4 9.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:25:56 +02:00
parent 74cad5e589
commit 89a9605df1
4440 changed files with 379508 additions and 189225 deletions
+10 -12
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PVDivision.cc,v 1.22 2008/12/03 16:41:45 arce Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4PVDivision.cc,v 1.24 2010/09/06 09:28:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// class G4PVDivision Implementation file
//
@@ -61,11 +61,11 @@ G4PVDivision::G4PVDivision(const G4String& pName,
"NULL pointer specified as mother,\n for volume: " + pName;
G4Exception("G4PVDivision::G4PVDivision()", "InvalidSetup",
FatalException, message_1);
return;
}
if (pLogical == pMotherLogical)
{
G4String message_2 =
"Cannot place a volume inside itself! Volume: " + pName;
G4String message_2 = "Cannot place a volume inside itself! Volume: "+ pName;
G4Exception("G4PVDivision::G4PVDivision()", "InvalidSetup",
FatalException, message_2);
}
@@ -89,15 +89,14 @@ G4PVDivision::G4PVDivision(const G4String& pName,
{
if (!pMotherLogical)
{
G4String message_1 =
"NULL pointer specified as mother! Volume: " + pName;
G4String message_1 = "NULL pointer specified as mother! Volume: " + pName;
G4Exception("G4PVDivision::G4PVDivision()", "InvalidSetup",
FatalException, message_1);
return;
}
if (pLogical == pMotherLogical)
{
G4String message_2 =
"Cannot place a volume inside itself! Volume: " + pName;
G4String message_2 = "Cannot place a volume inside itself! Volume: "+ pName;
G4Exception("G4PVDivision::G4PVDivision()", "InvalidSetup",
FatalException, message_2);
}
@@ -119,15 +118,14 @@ G4PVDivision::G4PVDivision(const G4String& pName,
{
if (!pMotherLogical)
{
G4String message_1 =
"NULL pointer specified as mother! Volume: " + pName;
G4String message_1 = "NULL pointer specified as mother! Volume: " + pName;
G4Exception("G4PVDivision::G4PVDivision()", "InvalidSetup",
FatalException, message_1);
return;
}
if (pLogical == pMotherLogical)
{
G4String message_2 =
"Cannot place a volume inside itself! Volume: " + pName;
G4String message_2 = "Cannot place a volume inside itself! Volume: "+ pName;
G4Exception("G4PVDivision::G4PVDivision()", "InvalidSetup",
FatalException, message_2);
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PVDivisionFactory.cc,v 1.2 2006/06/29 18:18:33 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4PVDivisionFactory.cc,v 1.3 2010/07/02 10:46:27 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// class G4PVDivisionFactory Implementation file
//
@@ -136,15 +136,18 @@ G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
G4Exception("G4PVDivisionFactory::CreatePVDivision()",
"WrongType", FatalException,
"Unexpected parameterisation type !");
return 0;
}
else
{
EAxis axis = divParam->GetAxis();
G4int nofDivisions = divParam->GetNoDiv();
G4double width = divParam->GetWidth();
G4double offset = divParam->GetOffset();
EAxis axis = divParam->GetAxis();
G4int nofDivisions = divParam->GetNoDiv();
G4double width = divParam->GetWidth();
G4double offset = divParam->GetOffset();
return new G4PVDivision(pName, pLogical, pMotherLogical,
axis, nofDivisions, width, offset);
return new G4PVDivision(pName, pLogical, pMotherLogical,
axis, nofDivisions, width, offset);
}
}
//_____________________________________________________________________________
@@ -24,13 +24,14 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationBox.cc,v 1.10 2006/06/29 18:18:35 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ParameterisationBox.cc,v 1.12 2010/11/10 09:15:56 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// class G4ParameterisationBox Implementation file
//
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// 21.04.10 - M.Asai, Added gaps
// --------------------------------------------------------------------
#include "G4ParameterisationBox.hh"
@@ -151,7 +152,7 @@ ComputeDimensions( G4Box& box, const G4int,
{
G4Box* msol = (G4Box*)(fmotherSolid);
G4double pDx = fwidth/2.;
G4double pDx = fwidth/2. - fhgap;
G4double pDy = msol->GetYHalfLength();
G4double pDz = msol->GetZHalfLength();
@@ -253,7 +254,7 @@ ComputeDimensions( G4Box& box, const G4int,
G4Box* msol = (G4Box*)(fmotherSolid);
G4double pDx = msol->GetXHalfLength();
G4double pDy = fwidth/2.;
G4double pDy = fwidth/2. - fhgap;
G4double pDz = msol->GetZHalfLength();
box.SetXHalfLength( pDx );
@@ -355,7 +356,7 @@ ComputeDimensions( G4Box& box, const G4int,
G4double pDx = msol->GetXHalfLength();
G4double pDy = msol->GetYHalfLength();
G4double pDz = fwidth/2.;
G4double pDz = fwidth/2. - fhgap;
box.SetXHalfLength( pDx );
box.SetYHalfLength( pDy );
@@ -24,13 +24,14 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationCons.cc,v 1.9 2006/06/29 18:18:38 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ParameterisationCons.cc,v 1.11 2010/11/10 09:15:58 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// class G4ParameterisationCons Implementation file
//
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// 21.04.10 - M.Asai, Added gaps
// --------------------------------------------------------------------
#include "G4ParameterisationCons.hh"
@@ -187,14 +188,15 @@ ComputeDimensions( G4Cons& cons, const G4int copyNo,
+ foffset + fwidthPlus * (copyNo+1);
G4double pDz = msol->GetZHalfLength();
G4double d_half_gap = fhgap * pRMax2 / pRMax1;
//- already rotated double pSR = foffset + copyNo*fwidth;
G4double pSPhi = msol->GetStartPhiAngle();
G4double pDPhi = msol->GetDeltaPhiAngle();;
cons.SetInnerRadiusMinusZ( pRMin1 );
cons.SetOuterRadiusMinusZ( pRMax1 );
cons.SetInnerRadiusPlusZ( pRMin2 );
cons.SetOuterRadiusPlusZ( pRMax2 );
cons.SetInnerRadiusMinusZ( pRMin1 + fhgap );
cons.SetOuterRadiusMinusZ( pRMax1 - fhgap );
cons.SetInnerRadiusPlusZ( pRMin2 + d_half_gap );
cons.SetOuterRadiusPlusZ( pRMax2 - d_half_gap );
cons.SetZHalfLength( pDz );
cons.SetStartPhiAngle( pSPhi );
cons.SetDeltaPhiAngle( pDPhi );
@@ -294,8 +296,8 @@ ComputeDimensions( G4Cons& cons, const G4int,
G4double pDz = msol->GetZHalfLength();
//- already rotated double pSPhi = foffset + copyNo*fwidth;
G4double pSPhi = foffset + msol->GetStartPhiAngle();
G4double pDPhi = fwidth;
G4double pSPhi = foffset + msol->GetStartPhiAngle() + fhgap;
G4double pDPhi = fwidth - 2.*fhgap;
cons.SetInnerRadiusMinusZ( pRMin1 );
cons.SetOuterRadiusMinusZ( pRMax1 );
@@ -395,7 +397,7 @@ ComputeDimensions( G4Cons& cons, const G4int copyNo,
{
G4Cons* msol = (G4Cons*)(fmotherSolid);
G4double mHalfLength = msol->GetZHalfLength();
G4double mHalfLength = msol->GetZHalfLength() - fhgap;
G4double aRInner = (msol->GetInnerRadiusPlusZ()
- msol->GetInnerRadiusMinusZ()) / (2*mHalfLength);
G4double bRInner = (msol->GetInnerRadiusPlusZ()
@@ -404,14 +406,14 @@ ComputeDimensions( G4Cons& cons, const G4int copyNo,
- msol->GetOuterRadiusMinusZ()) / (2*mHalfLength);
G4double bROuter = (msol->GetOuterRadiusPlusZ()
+ msol->GetOuterRadiusMinusZ()) / 2;
G4double xMinusZ = -mHalfLength + OffsetZ() + fwidth*copyNo;
G4double xPlusZ = -mHalfLength + OffsetZ() + fwidth*(copyNo+1);
G4double xMinusZ = -mHalfLength + OffsetZ() + fwidth*copyNo + fhgap;
G4double xPlusZ = -mHalfLength + OffsetZ() + fwidth*(copyNo+1) - fhgap;
cons.SetInnerRadiusMinusZ( aRInner * xMinusZ + bRInner );
cons.SetOuterRadiusMinusZ( aROuter * xMinusZ + bROuter );
cons.SetInnerRadiusPlusZ( aRInner * xPlusZ + bRInner );
cons.SetOuterRadiusPlusZ( aROuter * xPlusZ + bROuter );
G4double pDz = fwidth / 2.;
G4double pDz = fwidth / 2. - fhgap;
G4double pSPhi = msol->GetStartPhiAngle();
G4double pDPhi = msol->GetDeltaPhiAngle();
@@ -24,13 +24,14 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationPara.cc,v 1.11 2006/06/29 18:18:42 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ParameterisationPara.cc,v 1.13 2010/11/10 09:16:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// class G4ParameterisationPara Implementation file
//
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// 21.04.10 - M.Asai, Added gaps
// --------------------------------------------------------------------
#include "G4ParameterisationPara.hh"
@@ -161,7 +162,7 @@ ComputeDimensions(G4Para& para, const G4int,
G4Para* msol = (G4Para*)(fmotherSolid);
//---- Get
G4double pDx = fwidth/2.;
G4double pDx = fwidth/2. - fhgap;
G4double pDy = msol->GetYHalfLength();
G4double pDz = msol->GetZHalfLength();
G4double pAlpha = std::atan(msol->GetTanAlpha());
@@ -264,7 +265,7 @@ ComputeDimensions(G4Para& para, const G4int,
//---- Get
G4double pDx = msol->GetXHalfLength();
G4double pDy = fwidth/2.;
G4double pDy = fwidth/2. - fhgap;
G4double pDz = msol->GetZHalfLength();
G4double pAlpha = std::atan(msol->GetTanAlpha());
G4double pTheta = msol->GetSymAxis().theta();
@@ -365,10 +366,10 @@ ComputeDimensions(G4Para& para, const G4int,
//---- Get
G4double pDx = msol->GetXHalfLength();
G4double pDy = msol->GetYHalfLength();
G4double pDz = fwidth/2. - fhgap;
G4double pAlpha = std::atan(msol->GetTanAlpha());
G4double pTheta = msol->GetSymAxis().theta();
G4double pPhi = msol->GetSymAxis().phi();
G4double pDz = fwidth/2.;
para.SetAllParameters ( pDx, pDy, pDz, pAlpha, pTheta, pPhi );
@@ -24,13 +24,14 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationTrd.cc,v 1.16 2008/12/18 12:57:20 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ParameterisationTrd.cc,v 1.19 2010/11/10 09:16:08 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// class G4ParameterisationTrd Implementation file
//
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// 21.04.10 - M.Asai, Added gaps
// --------------------------------------------------------------------
#include "G4ParameterisationTrd.hh"
@@ -49,7 +50,8 @@ G4VParameterisationTrd::
G4VParameterisationTrd( EAxis axis, G4int nDiv, G4double width,
G4double offset, G4VSolid* msolid,
DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid ),
bDivInTrap(false)
{
G4Trd* msol = (G4Trd*)(msolid);
if (msolid->GetEntityType() == "G4ReflectedSolid")
@@ -140,9 +142,12 @@ ComputeTransformation( const G4int copyNo,
//----- translation
G4ThreeVector origin(0.,0.,0.);
G4double posi;
if( !bDivInTrap ) {
if( !bDivInTrap )
{
posi = -mdx + foffset + (copyNo+0.5)*fwidth;
} else {
}
else
{
G4double aveHL = (msol->GetXHalfLength1()+msol->GetXHalfLength2())/2.;
posi = - aveHL + foffset + (copyNo+0.5)*aveHL/fnDiv*2;
}
@@ -180,7 +185,7 @@ ComputeDimensions( G4Trd& trd, const G4int, const G4VPhysicalVolume* ) const
G4double pDy1 = msol->GetYHalfLength1();
G4double pDy2 = msol->GetYHalfLength2();
G4double pDz = msol->GetZHalfLength();
G4double pDx = fwidth/2.;
G4double pDx = fwidth/2. - fhgap;
trd.SetAllParameters ( pDx, pDx, pDy1, pDy2, pDz );
@@ -202,7 +207,7 @@ ComputeSolid(const G4int i, G4VPhysicalVolume * pv)
}
else
{
return theTrap;
return fmotherSolid;
}
}
@@ -231,8 +236,8 @@ ComputeDimensions( G4Trap& trap, const G4int copyNo, const G4VPhysicalVolume* )
pDx2,
alp,
pDy2,
pDx1,
pDx2,
pDx1 - fhgap,
pDx2 - fhgap * pDx2/pDx1,
alp);
#ifdef G4DIVDEBUG
@@ -248,7 +253,7 @@ ComputeDimensions( G4Trap& trap, const G4int copyNo, const G4VPhysicalVolume* )
void G4ParameterisationTrdX::CheckParametersValidity()
{
G4VDivisionParameterisation::CheckParametersValidity();
/*
G4Trd* msol = (G4Trd*)(fmotherSolid);
G4double mpDx1 = msol->GetXHalfLength1();
@@ -257,8 +262,6 @@ void G4ParameterisationTrdX::CheckParametersValidity()
if( std::fabs(mpDx1 - mpDx2) > kCarTolerance )
{
return;
G4cerr << "ERROR - G4ParameterisationTrdX::CheckParametersValidity()"
<< G4endl
<< " Making a division of a TRD along axis X," << G4endl
@@ -269,6 +272,7 @@ void G4ParameterisationTrdX::CheckParametersValidity()
"IllegalConstruct", FatalException,
"Invalid solid specification. NOT supported.");
}
*/
}
//--------------------------------------------------------------------------
@@ -369,7 +373,7 @@ ComputeDimensions(G4Trd& trd, const G4int, const G4VPhysicalVolume*) const
G4double pDx1 = msol->GetXHalfLength1();
G4double pDx2 = msol->GetXHalfLength2();
G4double pDz = msol->GetZHalfLength();
G4double pDy = fwidth/2.;
G4double pDy = fwidth/2. - fhgap;
trd.SetAllParameters ( pDx1, pDx2, pDy, pDy, pDz );
@@ -500,13 +504,13 @@ ComputeDimensions(G4Trd& trd, const G4int copyNo,
G4double DDx = (msol->GetXHalfLength2() - msol->GetXHalfLength1() );
G4double pDy1 = msol->GetYHalfLength1();
G4double DDy = (msol->GetYHalfLength2() - msol->GetYHalfLength1() );
G4double pDz = fwidth/2.;
G4double pDz = fwidth/2. - fhgap;
G4double zLength = 2*msol->GetZHalfLength();
trd.SetAllParameters( pDx1+DDx*(OffsetZ()+copyNo*fwidth)/zLength,
pDx1+DDx*(OffsetZ()+(copyNo+1)*fwidth)/zLength,
pDy1+DDy*(OffsetZ()+copyNo*fwidth)/zLength,
pDy1+DDy*(OffsetZ()+(copyNo+1)*fwidth)/zLength, pDz );
trd.SetAllParameters( pDx1+DDx*(OffsetZ()+copyNo*fwidth+fhgap)/zLength,
pDx1+DDx*(OffsetZ()+(copyNo+1)*fwidth-fhgap)/zLength,
pDy1+DDy*(OffsetZ()+copyNo*fwidth+fhgap)/zLength,
pDy1+DDy*(OffsetZ()+(copyNo+1)*fwidth-fhgap)/zLength, pDz );
#ifdef G4DIVDEBUG
if( verbose >= 1 )
@@ -24,13 +24,14 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationTubs.cc,v 1.8 2006/06/29 18:18:50 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ParameterisationTubs.cc,v 1.10 2010/11/10 09:16:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// class G4ParameterisationTubs Implementation file
//
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// 21.04.10 - M.Asai, Added gaps
// --------------------------------------------------------------------
#include "G4ParameterisationTubs.hh"
@@ -155,8 +156,8 @@ ComputeDimensions( G4Tubs& tubs, const G4int copyNo,
{
G4Tubs* msol = (G4Tubs*)(fmotherSolid);
G4double pRMin = msol->GetInnerRadius() + foffset + fwidth * copyNo;
G4double pRMax = msol->GetInnerRadius() + foffset + fwidth * (copyNo+1);
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();
@@ -268,8 +269,8 @@ ComputeDimensions( G4Tubs& tubs, const G4int,
G4double pRMax = msol->GetOuterRadius();
G4double pDz = msol->GetZHalfLength();
//----- already rotated in 'ComputeTransformation'
G4double pSPhi = msol->GetStartPhiAngle();
G4double pDPhi = fwidth;
G4double pSPhi = msol->GetStartPhiAngle() + fhgap;
G4double pDPhi = fwidth - 2.*fhgap;
tubs.SetInnerRadius( pRMin );
tubs.SetOuterRadius( pRMax );
@@ -378,7 +379,7 @@ ComputeDimensions( G4Tubs& tubs, const G4int,
G4double pRMin = msol->GetInnerRadius();
G4double pRMax = msol->GetOuterRadius();
// G4double pDz = msol->GetZHalfLength() / GetNoDiv();
G4double pDz = fwidth/2.;
G4double pDz = fwidth/2. - fhgap;
G4double pSPhi = msol->GetStartPhiAngle();
G4double pDPhi = msol->GetDeltaPhiAngle();
@@ -0,0 +1,542 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ReplicatedSlice.cc,v 1.2 2010/11/10 09:16:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// --------------------------------------------------------------------
#include "G4ReplicatedSlice.hh"
#include "G4LogicalVolume.hh"
#include "G4VSolid.hh"
#include "G4ReflectedSolid.hh"
#include "G4ParameterisationBox.hh"
#include "G4ParameterisationTubs.hh"
#include "G4ParameterisationCons.hh"
#include "G4ParameterisationTrd.hh"
#include "G4ParameterisationPara.hh"
#include "G4ParameterisationPolycone.hh"
#include "G4ParameterisationPolyhedra.hh"
//--------------------------------------------------------------------------
G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4int nDivs,
const G4double width,
const G4double half_gap,
const G4double offset )
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fcopyNo(-1)
{
CheckAndSetParameters(pAxis, nDivs, width, half_gap, offset,
DivNDIVandWIDTH, pMotherLogical, pLogical);
}
//--------------------------------------------------------------------------
G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4int nDivs,
const G4double half_gap,
const G4double offset )
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fcopyNo(-1)
{
CheckAndSetParameters(pAxis, nDivs, 0., half_gap, offset,
DivNDIV, pMotherLogical, pLogical);
}
//--------------------------------------------------------------------------
G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4double width,
const G4double half_gap,
const G4double offset )
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fcopyNo(-1)
{
CheckAndSetParameters(pAxis, 0, width, half_gap, offset,
DivWIDTH, pMotherLogical, pLogical);
}
//--------------------------------------------------------------------------
G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMotherPhysical,
const EAxis pAxis,
const G4int nDivs,
const G4double width,
const G4double half_gap,
const G4double offset )
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fcopyNo(-1)
{
CheckAndSetParameters(pAxis, nDivs, width, half_gap, offset,
DivNDIVandWIDTH, pMotherPhysical->GetLogicalVolume(), pLogical);
}
//--------------------------------------------------------------------------
G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMotherPhysical,
const EAxis pAxis,
const G4int nDivs,
const G4double half_gap,
const G4double offset )
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fcopyNo(-1)
{
CheckAndSetParameters(pAxis, nDivs, 0., half_gap, offset,
DivNDIV, pMotherPhysical->GetLogicalVolume(), pLogical);
}
//--------------------------------------------------------------------------
G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMotherPhysical,
const EAxis pAxis,
const G4double width,
const G4double half_gap,
const G4double offset )
: G4VPhysicalVolume(0,G4ThreeVector(),pName,pLogical,0), fcopyNo(-1)
{
CheckAndSetParameters(pAxis, 0, width, half_gap, offset,
DivWIDTH, pMotherPhysical->GetLogicalVolume(), pLogical);
}
//--------------------------------------------------------------------------
void
G4ReplicatedSlice::CheckAndSetParameters( const EAxis pAxis,
const G4int nDivs,
const G4double width,
const G4double half_gap,
const G4double offset,
DivisionType divType,
G4LogicalVolume* pMotherLogical,
const G4LogicalVolume* pLogical )
{
if(!pMotherLogical)
{
G4String message_1 = "NULL pointer specified as mother! Volume: "
+ GetName();
G4Exception("G4ReplicatedSlice::G4ReplicatedSlice()", "InvalidSetup",
FatalException, message_1);
}
if(pLogical == pMotherLogical)
{
G4String message_2 = "Cannot place a volume inside itself! Volume: "
+ GetName();
G4Exception("G4ReplicatedSlice::G4ReplicatedSlice()", "InvalidSetup",
FatalException, message_2);
}
//----- Check that mother solid is of the same type as
// daughter solid (otherwise, the corresponding
// Parameterisation::ComputeDimension() will not be called)
//
G4String msolType = pMotherLogical->GetSolid()->GetEntityType();
G4String dsolType = pLogical->GetSolid()->GetEntityType();
if( msolType != dsolType && ( msolType != "G4Trd" || dsolType != "G4Trap" ) )
{
G4String message = "Incorrect solid type for division of volume "
+ GetName() + " It is: " + msolType
+ ", while it should be: " + dsolType;
G4Exception("G4ReplicatedSlice::CheckAndSetParameters()",
"IllegalConstruct", FatalException, message );
}
pMotherLogical->AddDaughter(this);
SetMotherLogical(pMotherLogical);
SetParameterisation(pMotherLogical, pAxis, nDivs,
width, half_gap, offset, divType);
if( divType == DivWIDTH )
{
fnReplicas = fparam->GetNoDiv();
}
else
{
fnReplicas = nDivs;
}
if (fnReplicas < 1 )
{
G4Exception("G4ReplicatedSlice::G4ReplicatedSlice()", "IllegalConstruct",
FatalException, "Illegal number of replicas!");
}
if( divType != DivNDIV)
{
fwidth = fparam->GetWidth();
}
else
{
fwidth = width;
}
if( fwidth < 0 )
{
G4Exception("G4ReplicatedSlice::G4ReplicatedSlice()", "IllegalConstruct",
FatalException, "Width must be positive!");
}
if( fwidth < 2.*half_gap )
{
G4Exception("G4ReplicatedSlice::G4ReplicatedSlice()", "IllegalConstruct",
FatalException, "Half_gap is too large!");
}
foffset = offset;
fdivAxis = pAxis;
//!!!!! axis has to be x/y/z in G4VoxelLimits::GetMinExtent
//
if( pAxis == kRho || pAxis == kRadial3D || pAxis == kPhi )
{
faxis = kZAxis;
}
else
{
faxis = pAxis;
}
switch (faxis)
{
case kPhi:
case kRho:
case kXAxis:
case kYAxis:
case kZAxis:
break;
default:
G4Exception("G4ReplicatedSlice::G4ReplicatedSlice()", "IllegalConstruct",
FatalException, "Unknown axis of replication.");
break;
}
// Create rotation matrix: for phi axis it will be changed
// in G4VPVParameterisation::ComputeTransformation, for others
// it will stay the unity
//
G4RotationMatrix *pRMat = new G4RotationMatrix();
SetRotation(pRMat);
}
//--------------------------------------------------------------------------
G4ReplicatedSlice::~G4ReplicatedSlice()
{
delete GetRotation();
}
//--------------------------------------------------------------------------
EAxis G4ReplicatedSlice::GetDivisionAxis() const
{
return fdivAxis;
}
//--------------------------------------------------------------------------
G4bool G4ReplicatedSlice::IsParameterised() const
{
return true;
}
//--------------------------------------------------------------------------
G4bool G4ReplicatedSlice::IsMany() const
{
return false;
}
//--------------------------------------------------------------------------
G4int G4ReplicatedSlice::GetCopyNo() const
{
return fcopyNo;
}
//--------------------------------------------------------------------------
void G4ReplicatedSlice::SetCopyNo(G4int newCopyNo)
{
fcopyNo= newCopyNo;
}
//--------------------------------------------------------------------------
G4bool G4ReplicatedSlice::IsReplicated() const
{
return true;
}
//--------------------------------------------------------------------------
G4VPVParameterisation* G4ReplicatedSlice::GetParameterisation() const
{
return fparam;
}
//--------------------------------------------------------------------------
void G4ReplicatedSlice::GetReplicationData(EAxis& axis,
G4int& nDivs,
G4double& width,
G4double& offset,
G4bool& consuming ) const
{
axis=faxis;
nDivs=fnReplicas;
width=fwidth;
offset=foffset;
consuming=false;
}
//--------------------------------------------------------------------------
void G4ReplicatedSlice::SetParameterisation( G4LogicalVolume* motherLogical,
const EAxis axis,
const G4int nDivs,
const G4double width,
const G4double half_gap,
const G4double offset,
DivisionType divType )
{
G4VSolid* mSolid = motherLogical->GetSolid();
G4String mSolidType = mSolid->GetEntityType();
// If the solid is a reflected one, update type to its
// real constituent solid.
//
if (mSolidType == "G4ReflectedSolid")
{
mSolidType = ((G4ReflectedSolid*)mSolid)->GetConstituentMovedSolid()
->GetEntityType();
}
// Parameterisation type depend of mother solid type and axis of division
//
if( mSolidType == "G4Box" )
{
switch( axis )
{
case kXAxis:
fparam = new G4ParameterisationBoxX( axis, nDivs, width,
offset, mSolid, divType );
break;
case kYAxis:
fparam = new G4ParameterisationBoxY( axis, nDivs, width,
offset, mSolid, divType );
break;
case kZAxis:
fparam = new G4ParameterisationBoxZ( axis, nDivs, width,
offset, mSolid, divType );
break;
default:
ErrorInAxis( axis, mSolid );
break;
}
}
else if( mSolidType == "G4Tubs" )
{
switch( axis )
{
case kRho:
fparam = new G4ParameterisationTubsRho( axis, nDivs, width,
offset, mSolid, divType );
break;
case kPhi:
fparam = new G4ParameterisationTubsPhi( axis, nDivs, width,
offset, mSolid, divType );
break;
case kZAxis:
fparam = new G4ParameterisationTubsZ( axis, nDivs, width,
offset, mSolid, divType );
break;
default:
ErrorInAxis( axis, mSolid );
break;
}
}
else if( mSolidType == "G4Cons" )
{
switch( axis )
{
case kRho:
fparam = new G4ParameterisationConsRho( axis, nDivs, width,
offset, mSolid, divType );
break;
case kPhi:
fparam = new G4ParameterisationConsPhi( axis, nDivs, width,
offset, mSolid, divType );
break;
case kZAxis:
fparam = new G4ParameterisationConsZ( axis, nDivs, width,
offset, mSolid, divType );
break;
default:
ErrorInAxis( axis, mSolid );
break;
}
}
else if( mSolidType == "G4Trd" )
{
switch( axis )
{
case kXAxis:
fparam = new G4ParameterisationTrdX( axis, nDivs, width,
offset, mSolid, divType );
break;
case kYAxis:
fparam = new G4ParameterisationTrdY( axis, nDivs, width,
offset, mSolid, divType );
break;
case kZAxis:
fparam = new G4ParameterisationTrdZ( axis, nDivs, width,
offset, mSolid, divType );
break;
default:
ErrorInAxis( axis, mSolid );
break;
}
}
else if( mSolidType == "G4Para" )
{
switch( axis )
{
case kXAxis:
fparam = new G4ParameterisationParaX( axis, nDivs, width,
offset, mSolid, divType );
break;
case kYAxis:
fparam = new G4ParameterisationParaY( axis, nDivs, width,
offset, mSolid, divType );
break;
case kZAxis:
fparam = new G4ParameterisationParaZ( axis, nDivs, width,
offset, mSolid, divType );
break;
default:
ErrorInAxis( axis, mSolid );
break;
}
}
// else if( mSolidType == "G4Trap" )
// {
// }
// else if( mSolidType == "G4Polycone" )
// {
// switch( axis )
// {
// case kRho:
// fparam = new G4ParameterisationPolyconeRho( axis, nDivs, width,
// offset, mSolid, divType );
// break;
// case kPhi:
// fparam = new G4ParameterisationPolyconePhi( axis, nDivs, width,
// offset, mSolid, divType );
// break;
// case kZAxis:
// fparam = new G4ParameterisationPolyconeZ( axis, nDivs, width,
// offset, mSolid, divType );
// break;
// default:
// ErrorInAxis( axis, mSolid );
// break;
// }
// }
// else if( mSolidType == "G4Polyhedra" )
// {
// switch( axis )
// {
// case kRho:
// fparam = new G4ParameterisationPolyhedraRho( axis, nDivs, width,
// offset, mSolid, divType );
// break;
// case kPhi:
// fparam = new G4ParameterisationPolyhedraPhi( axis, nDivs, width,
// offset, mSolid, divType );
// break;
// case kZAxis:
// fparam = new G4ParameterisationPolyhedraZ( axis, nDivs, width,
// offset, mSolid, divType );
// break;
// default:
// ErrorInAxis( axis, mSolid );
// break;
// }
// }
else
{
G4cerr << "ERROR - G4ReplicatedSlice::SetParameterisation()" << G4endl
<< " Divisions for " << mSolidType
<< " not implemented." << G4endl;
G4String message = "Solid type not supported: " + mSolidType;
G4Exception("G4ReplicatedSlice::SetParameterisation()", "IllegalConstruct",
FatalException, message);
}
fparam->SetHalfGap(half_gap);
}
//--------------------------------------------------------------------------
void G4ReplicatedSlice::ErrorInAxis( EAxis axis, G4VSolid* solid )
{
G4String error = "Trying to divide solid " + solid->GetName()
+ " of type " + solid->GetEntityType() + " along axis ";
switch( axis )
{
case kXAxis:
error += "X.";
break;
case kYAxis:
error += "Y.";
break;
case kZAxis:
error += "Z.";
break;
case kRho:
error += "Rho.";
break;
case kRadial3D:
error += "Radial3D.";
break;
case kPhi:
error += "Phi.";
break;
default:
break;
}
G4Exception("G4ReplicatedSlice::ErrorInAxis()", "IllegalConstruct",
FatalException, error);
}
// 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()
//
G4bool G4ReplicatedSlice::IsRegularStructure() const
{
return false;
}
// ----------------------------------------------------------------------
// IsRegularRepeatedStructure()
//
G4int G4ReplicatedSlice::GetRegularStructureId() const
{
return 0;
}
@@ -24,13 +24,14 @@
// ********************************************************************
//
//
// $Id: G4VDivisionParameterisation.cc,v 1.14 2008/12/03 16:41:15 arce Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VDivisionParameterisation.cc,v 1.16 2010/11/10 09:16:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// class G4VDivisionParameterisation Implementation file
//
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// 21.04.10 - M.Asai, Added gaps
// --------------------------------------------------------------------
#include "G4VDivisionParameterisation.hh"
@@ -49,7 +50,7 @@ G4VDivisionParameterisation( EAxis axis, G4int nDiv,
DivisionType divType, G4VSolid* motherSolid )
: faxis(axis), fnDiv( nDiv), fwidth(step), foffset(offset),
fDivisionType(divType), fmotherSolid( motherSolid ), fReflectedSolid(false),
fDeleteSolid(false)
fDeleteSolid(false), theVoluFirstCopyNo(1), fhgap(0.)
{
#ifdef G4DIVDEBUG
if (verbose >= 1)
@@ -60,8 +61,6 @@ G4VDivisionParameterisation( EAxis axis, G4int nDiv,
<< " step " << fwidth << " = " << step << G4endl;
}
#endif
theVoluFirstCopyNo = 1;
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
}