Import Geant4 6.2.0 source tree
This commit is contained in:
@@ -21,17 +21,18 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PVDivision.cc,v 1.10 2003/11/19 11:51:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4PVDivision.cc,v 1.11 2004/05/13 14:57:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// class G4PVDivision Implementation file
|
||||
//
|
||||
// 26.05.03 - P.Arce Initial version
|
||||
// ********************************************************************
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4PVDivision.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4ReflectedSolid.hh"
|
||||
#include "G4ParameterisationBox.hh"
|
||||
#include "G4ParameterisationTubs.hh"
|
||||
#include "G4ParameterisationCons.hh"
|
||||
@@ -257,6 +258,15 @@ void G4PVDivision::SetParameterisation( G4LogicalVolume* motherLogical,
|
||||
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" )
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PVDivisionFactory.cc,v 1.1 2004/05/13 14:56:31 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// class G4PVDivisionFactory Implementation file
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 4.5.2004 (Ivana.Hrivnacova@cern.ch)
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4PVDivisionFactory.hh"
|
||||
#include "G4PVDivision.hh"
|
||||
#include "G4VDivisionParameterisation.hh"
|
||||
|
||||
//_____________________________________________________________________________
|
||||
|
||||
G4PVDivisionFactory::G4PVDivisionFactory()
|
||||
: G4VPVDivisionFactory()
|
||||
{
|
||||
// Protected singleton constructor.
|
||||
// ---
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
|
||||
G4PVDivisionFactory::~G4PVDivisionFactory()
|
||||
{
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
|
||||
G4PVDivisionFactory* G4PVDivisionFactory::GetInstance()
|
||||
{
|
||||
static G4PVDivisionFactory theFactory;
|
||||
if (!fgInstance)
|
||||
{
|
||||
fgInstance = &theFactory;
|
||||
}
|
||||
return &theFactory;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
|
||||
G4VPhysicalVolume*
|
||||
G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
|
||||
G4LogicalVolume* pLogical,
|
||||
G4LogicalVolume* pMotherLogical,
|
||||
const EAxis pAxis,
|
||||
const G4int nReplicas,
|
||||
const G4double width,
|
||||
const G4double offset )
|
||||
{
|
||||
// Create division - with number of divisions and width
|
||||
// ---
|
||||
|
||||
return new G4PVDivision(pName, pLogical, pMotherLogical,
|
||||
pAxis, nReplicas, width, offset);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
|
||||
G4VPhysicalVolume*
|
||||
G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
|
||||
G4LogicalVolume* pLogical,
|
||||
G4LogicalVolume* pMotherLogical,
|
||||
const EAxis pAxis,
|
||||
const G4int nReplicas,
|
||||
const G4double offset )
|
||||
{
|
||||
// Create division - with number of divisions
|
||||
// ---
|
||||
|
||||
return new G4PVDivision(pName, pLogical, pMotherLogical,
|
||||
pAxis, nReplicas, offset);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
|
||||
G4VPhysicalVolume*
|
||||
G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
|
||||
G4LogicalVolume* pLogical,
|
||||
G4LogicalVolume* pMotherLogical,
|
||||
const EAxis pAxis,
|
||||
const G4double width,
|
||||
const G4double offset )
|
||||
{
|
||||
// Create division - with width
|
||||
// ---
|
||||
|
||||
return new G4PVDivision(pName, pLogical, pMotherLogical,
|
||||
pAxis, width, offset);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
|
||||
G4VPhysicalVolume*
|
||||
G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
|
||||
G4LogicalVolume* pLogical,
|
||||
G4LogicalVolume* pMotherLogical,
|
||||
const G4VPVParameterisation* param)
|
||||
{
|
||||
// Create division - with parameterisation
|
||||
// ---
|
||||
|
||||
// Get parameterisation data
|
||||
//
|
||||
const G4VDivisionParameterisation* divParam
|
||||
= dynamic_cast<const G4VDivisionParameterisation*>(param);
|
||||
|
||||
if (!divParam)
|
||||
{
|
||||
G4Exception("G4PVDivisionFactory::CreatePVDivision()",
|
||||
"WrongType", FatalException,
|
||||
"Unexpected parameterisation type !");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
|
||||
G4bool G4PVDivisionFactory::IsPVDivision(const G4VPhysicalVolume* pv) const
|
||||
{
|
||||
// Returns true if pv is division
|
||||
// ---
|
||||
|
||||
if (dynamic_cast<const G4PVDivision*>(pv))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -21,13 +21,14 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisationBox.cc,v 1.5 2003/11/19 11:51:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4ParameterisationBox.cc,v 1.7 2004/05/17 07:20:40 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// class G4ParameterisationBox Implementation file
|
||||
//
|
||||
// 26.05.03 - P.Arce Initial version
|
||||
// ********************************************************************
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ParameterisationBox.hh"
|
||||
|
||||
@@ -36,26 +37,50 @@
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ReflectedSolid.hh"
|
||||
#include "G4Box.hh"
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4VParameterisationBox::
|
||||
G4VParameterisationBox( EAxis axis, G4int nDiv, G4double width,
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
{
|
||||
G4Box* msol = (G4Box*)(msolid);
|
||||
if (msolid->GetEntityType() == "G4ReflectedSolid")
|
||||
{
|
||||
// Get constituent solid
|
||||
G4VSolid* mConstituentSolid
|
||||
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
|
||||
msol = (G4Box*)(mConstituentSolid);
|
||||
fmotherSolid = msol;
|
||||
fReflectedSolid = true;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4VParameterisationBox::~G4VParameterisationBox()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4ParameterisationBoxX::
|
||||
G4ParameterisationBoxX( EAxis axis, G4int nDiv, G4double width,
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationBox( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionBoxX" );
|
||||
|
||||
G4Box* mbox = (G4Box*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Box* mbox = (G4Box*)(msolid);
|
||||
fnDiv = CalculateNDiv( 2*mbox->GetXHalfLength(), width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Box* mbox = (G4Box*)(msolid);
|
||||
fwidth = CalculateWidth( 2*mbox->GetXHalfLength(), nDiv, offset );
|
||||
}
|
||||
#ifdef G4DIVDEBUG
|
||||
@@ -149,19 +174,18 @@ G4ParameterisationBoxY::
|
||||
G4ParameterisationBoxY( EAxis axis, G4int nDiv, G4double width,
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType)
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationBox( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionBoxY" );
|
||||
|
||||
G4Box* mbox = (G4Box*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Box* mbox = (G4Box*)(msolid);
|
||||
fnDiv = CalculateNDiv( 2*mbox->GetYHalfLength(), width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Box* mbox = (G4Box*)(msolid);
|
||||
fwidth = CalculateWidth( 2*mbox->GetYHalfLength(), nDiv, offset );
|
||||
}
|
||||
|
||||
@@ -254,19 +278,18 @@ G4ParameterisationBoxZ::
|
||||
G4ParameterisationBoxZ( EAxis axis, G4int nDiv, G4double width,
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationBox( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionBoxZ" );
|
||||
|
||||
G4Box* mbox = (G4Box*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Box* mbox = (G4Box*)(msolid);
|
||||
fnDiv = CalculateNDiv( 2*mbox->GetZHalfLength(), width, offset );
|
||||
}
|
||||
else if ( divType == DivNDIV )
|
||||
{
|
||||
G4Box* mbox = (G4Box*)(msolid);
|
||||
fwidth = CalculateWidth( 2*mbox->GetZHalfLength(), nDiv, offset );
|
||||
}
|
||||
#ifdef G4DIVDEBUG
|
||||
@@ -301,7 +324,8 @@ ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
|
||||
|
||||
//----- translation
|
||||
G4ThreeVector origin(0.,0.,0.);
|
||||
G4double posi = -mdz + foffset + (copyNo+0.5)*fwidth;
|
||||
G4double posi = -mdz + OffsetZ() + (copyNo+0.5)*fwidth;
|
||||
|
||||
if( faxis == kZAxis )
|
||||
{
|
||||
origin.setZ( posi );
|
||||
|
||||
@@ -21,13 +21,14 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisationCons.cc,v 1.6 2003/11/19 11:51:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4ParameterisationCons.cc,v 1.8 2004/05/17 07:20:40 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// class G4ParameterisationCons Implementation file
|
||||
//
|
||||
// 26.05.03 - P.Arce Initial version
|
||||
// ********************************************************************
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ParameterisationCons.hh"
|
||||
|
||||
@@ -36,19 +37,54 @@
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4ReflectedSolid.hh"
|
||||
#include "G4Cons.hh"
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4VParameterisationCons::
|
||||
G4VParameterisationCons( EAxis axis, G4int nDiv, G4double width,
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
{
|
||||
G4Cons* msol = (G4Cons*)(msolid);
|
||||
if (msolid->GetEntityType() == "G4ReflectedSolid")
|
||||
{
|
||||
// Get constituent solid
|
||||
G4VSolid* mConstituentSolid
|
||||
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
|
||||
msol = (G4Cons*)(mConstituentSolid);
|
||||
|
||||
// Create a new solid with inversed parameters
|
||||
G4Cons* newSolid
|
||||
= new G4Cons(msol->GetName(),
|
||||
msol->GetInnerRadiusPlusZ(), msol->GetOuterRadiusPlusZ(),
|
||||
msol->GetInnerRadiusMinusZ(), msol->GetOuterRadiusMinusZ(),
|
||||
msol->GetZHalfLength(),
|
||||
msol->GetStartPhiAngle(), msol->GetDeltaPhiAngle());
|
||||
msol = newSolid;
|
||||
fmotherSolid = newSolid;
|
||||
fReflectedSolid = true;
|
||||
fDeleteSolid = true;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
G4VParameterisationCons::~G4VParameterisationCons()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4ParameterisationConsRho::
|
||||
G4ParameterisationConsRho( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationCons( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionConsRho" );
|
||||
|
||||
G4Cons* msol = (G4Cons*)(msolid);
|
||||
G4Cons* msol = (G4Cons*)(fmotherSolid);
|
||||
if( msol->GetInnerRadiusPlusZ() == 0. )
|
||||
{
|
||||
G4cerr << "WARNING - G4ParameterisationConsRho, OuterRadiusMinusZ = 0. "
|
||||
@@ -175,19 +211,18 @@ G4ParameterisationConsPhi::
|
||||
G4ParameterisationConsPhi( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationCons( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionConsPhi" );
|
||||
|
||||
G4Cons* msol = (G4Cons*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Cons* msol = (G4Cons*)(msolid);
|
||||
fnDiv = CalculateNDiv( msol->GetDeltaPhiAngle(), width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Cons* msol = (G4Cons*)(msolid);
|
||||
fwidth = CalculateWidth( msol->GetDeltaPhiAngle(), nDiv, offset );
|
||||
}
|
||||
|
||||
@@ -282,19 +317,18 @@ G4ParameterisationConsZ::
|
||||
G4ParameterisationConsZ( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationCons( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionConsZ" );
|
||||
|
||||
G4Cons* msol = (G4Cons*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Cons* msol = (G4Cons*)(msolid);
|
||||
fnDiv = CalculateNDiv( 2*msol->GetZHalfLength(), width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Cons* msol = (G4Cons*)(msolid);
|
||||
fwidth = CalculateWidth( 2*msol->GetZHalfLength(), nDiv, offset );
|
||||
}
|
||||
|
||||
@@ -329,7 +363,7 @@ ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol ) const
|
||||
{
|
||||
//----- set translation: along Z axis
|
||||
G4Cons* motherCons = (G4Cons*)(GetMotherSolid());
|
||||
G4double posi = - motherCons->GetZHalfLength() + foffset
|
||||
G4double posi = - motherCons->GetZHalfLength() + OffsetZ()
|
||||
+ fwidth/2 + copyNo*fwidth;
|
||||
G4ThreeVector origin(0.,0.,posi);
|
||||
physVol->SetTranslation( origin );
|
||||
@@ -367,8 +401,8 @@ ComputeDimensions( G4Cons& cons, const G4int copyNo,
|
||||
- msol->GetOuterRadiusMinusZ()) / (2*mHalfLength);
|
||||
G4double bROuter = (msol->GetOuterRadiusPlusZ()
|
||||
+ msol->GetOuterRadiusMinusZ()) / 2;
|
||||
G4double xMinusZ = -mHalfLength + foffset + fwidth*copyNo;
|
||||
G4double xPlusZ = -mHalfLength + foffset + fwidth*(copyNo+1);
|
||||
G4double xMinusZ = -mHalfLength + OffsetZ() + fwidth*copyNo;
|
||||
G4double xPlusZ = -mHalfLength + OffsetZ() + fwidth*(copyNo+1);
|
||||
cons.SetInnerRadiusMinusZ( aRInner * xMinusZ + bRInner );
|
||||
cons.SetOuterRadiusMinusZ( aROuter * xMinusZ + bROuter );
|
||||
cons.SetInnerRadiusPlusZ( aRInner * xPlusZ + bRInner );
|
||||
@@ -390,4 +424,5 @@ ComputeDimensions( G4Cons& cons, const G4int copyNo,
|
||||
if( verbose >= 4 ) cons.DumpInfo();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -21,13 +21,14 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisationPara.cc,v 1.6 2003/11/19 11:51:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4ParameterisationPara.cc,v 1.8 2004/05/17 07:20:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// class G4ParameterisationPara Implementation file
|
||||
//
|
||||
// 26.05.03 - P.Arce Initial version
|
||||
// ********************************************************************
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ParameterisationPara.hh"
|
||||
|
||||
@@ -37,26 +38,64 @@
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ReflectedSolid.hh"
|
||||
#include "G4Para.hh"
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4VParameterisationPara::
|
||||
G4VParameterisationPara( EAxis axis, G4int nDiv, G4double width,
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
{
|
||||
G4Para* msol = (G4Para*)(msolid);
|
||||
if (msolid->GetEntityType() == "G4ReflectedSolid")
|
||||
{
|
||||
// Get constituent solid
|
||||
G4VSolid* mConstituentSolid
|
||||
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
|
||||
msol = (G4Para*)(mConstituentSolid);
|
||||
fmotherSolid = msol;
|
||||
|
||||
// Create a new solid with inversed parameters
|
||||
G4Para* newSolid
|
||||
= new G4Para(msol->GetName(),
|
||||
msol->GetXHalfLength(),
|
||||
msol->GetYHalfLength(),
|
||||
msol->GetZHalfLength(),
|
||||
atan(msol->GetTanAlpha()),
|
||||
M_PI - msol->GetSymAxis().theta(),
|
||||
msol->GetSymAxis().phi());
|
||||
|
||||
msol = newSolid;
|
||||
fmotherSolid = newSolid;
|
||||
fReflectedSolid = true;
|
||||
fDeleteSolid = true;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
G4VParameterisationPara::~G4VParameterisationPara()
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
G4ParameterisationParaX::
|
||||
G4ParameterisationParaX( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationPara( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionParaX" );
|
||||
|
||||
G4Para* mpara = (G4Para*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Para* mpara = (G4Para*)(msolid);
|
||||
fnDiv = CalculateNDiv( 2*mpara->GetXHalfLength(), width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Para* mpara = (G4Para*)(msolid);
|
||||
fwidth = CalculateWidth( 2*mpara->GetXHalfLength(), nDiv, offset );
|
||||
}
|
||||
|
||||
@@ -145,19 +184,18 @@ G4ParameterisationParaY::
|
||||
G4ParameterisationParaY( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationPara( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionParaY" );
|
||||
|
||||
G4Para* mpara = (G4Para*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Para* mpara = (G4Para*)(msolid);
|
||||
fnDiv = CalculateNDiv( 2*mpara->GetYHalfLength(), width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Para* mpara = (G4Para*)(msolid);
|
||||
fwidth = CalculateWidth( 2*mpara->GetYHalfLength(), nDiv, offset );
|
||||
}
|
||||
|
||||
@@ -248,19 +286,18 @@ G4ParameterisationParaZ::
|
||||
G4ParameterisationParaZ( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationPara( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionParaZ" );
|
||||
|
||||
G4Para* mpara = (G4Para*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Para* mpara = (G4Para*)(msolid);
|
||||
fnDiv = CalculateNDiv( 2*mpara->GetZHalfLength(), width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Para* mpara = (G4Para*)(msolid);
|
||||
fwidth = CalculateWidth( 2*mpara->GetZHalfLength(), nDiv, offset );
|
||||
}
|
||||
|
||||
@@ -296,7 +333,7 @@ ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
|
||||
G4double mdz = msol->GetZHalfLength( );
|
||||
|
||||
//----- translation
|
||||
G4double posi = -mdz + foffset + (copyNo+0.5)*fwidth;
|
||||
G4double posi = -mdz + OffsetZ() + (copyNo+0.5)*fwidth;
|
||||
G4ThreeVector symAxis = msol->GetSymAxis();
|
||||
G4ThreeVector origin( symAxis * posi / symAxis.z() );
|
||||
|
||||
|
||||
@@ -21,12 +21,13 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisationPolycone.cc,v 1.7 2003/11/19 11:51:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4ParameterisationPolycone.cc,v 1.9 2004/05/17 07:20:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// class G4ParameterisationPolycone Implementation file
|
||||
//
|
||||
// 26.05.03 - P.Arce Initial version
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
#include "G4ParameterisationPolycone.hh"
|
||||
@@ -36,18 +37,64 @@
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4ReflectedSolid.hh"
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
G4VParameterisationPolycone::
|
||||
G4VParameterisationPolycone( EAxis axis, G4int nDiv, G4double width,
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
{
|
||||
G4Polycone* msol = (G4Polycone*)(msolid);
|
||||
if (msolid->GetEntityType() == "G4ReflectedSolid")
|
||||
{
|
||||
// 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];
|
||||
|
||||
G4Polycone* newSolid
|
||||
= new G4Polycone(msol->GetName(),
|
||||
msol->GetStartPhi(),
|
||||
msol->GetEndPhi() - msol->GetStartPhi(),
|
||||
nofZplanes, zValuesRefl, rminValues, rmaxValues);
|
||||
|
||||
delete [] zValuesRefl;
|
||||
|
||||
msol = newSolid;
|
||||
fmotherSolid = newSolid;
|
||||
fReflectedSolid = true;
|
||||
fDeleteSolid = true;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
G4VParameterisationPolycone::~G4VParameterisationPolycone()
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
G4ParameterisationPolyconeRho::
|
||||
G4ParameterisationPolyconeRho( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationPolycone( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionPolyconeRho" );
|
||||
|
||||
G4Polycone* msol = (G4Polycone*)(msolid);
|
||||
G4Polycone* msol = (G4Polycone*)(fmotherSolid);
|
||||
G4PolyconeHistorical* origparamMother = msol->GetOriginalParameters();
|
||||
|
||||
if( divType == DivWIDTH )
|
||||
@@ -190,12 +237,12 @@ G4ParameterisationPolyconePhi::
|
||||
G4ParameterisationPolyconePhi( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationPolycone( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionPolyconePhi" );
|
||||
|
||||
G4Polycone* msol = (G4Polycone*)(msolid);
|
||||
G4Polycone* msol = (G4Polycone*)(fmotherSolid);
|
||||
G4double deltaPhi = msol->GetEndPhi() - msol->GetStartPhi();
|
||||
|
||||
if( divType == DivWIDTH )
|
||||
@@ -296,12 +343,13 @@ G4ParameterisationPolyconeZ::
|
||||
G4ParameterisationPolyconeZ( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType)
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationPolycone( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionPolyconeZ" );
|
||||
|
||||
G4Polycone* msol = (G4Polycone*)(msolid);
|
||||
G4Polycone* msol = (G4Polycone*)(fmotherSolid);
|
||||
G4PolyconeHistorical* origparamMother = msol->GetOriginalParameters();
|
||||
|
||||
if( divType == DivWIDTH )
|
||||
@@ -338,8 +386,8 @@ G4double G4ParameterisationPolyconeZ::GetMaxParameter() const
|
||||
{
|
||||
G4Polycone* msol = (G4Polycone*)(fmotherSolid);
|
||||
G4PolyconeHistorical* origparamMother = msol->GetOriginalParameters();
|
||||
return (origparamMother->Z_values[origparamMother->Num_z_planes-1]
|
||||
-origparamMother->Z_values[0]);
|
||||
return abs (origparamMother->Z_values[origparamMother->Num_z_planes-1]
|
||||
-origparamMother->Z_values[0]);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@@ -21,13 +21,14 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisationPolyhedra.cc,v 1.6 2003/11/19 11:51:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4ParameterisationPolyhedra.cc,v 1.8 2004/05/17 07:20:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// class G4ParameterisationPolyhedra Implementation file
|
||||
//
|
||||
// 14.10.03 - P.Arce Initial version
|
||||
//---------------------------------------------------------------------
|
||||
// 14.10.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ParameterisationPolyhedra.hh"
|
||||
|
||||
@@ -36,19 +37,92 @@
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4ReflectedSolid.hh"
|
||||
#include "G4Polyhedra.hh"
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4VParameterisationPolyhedra::
|
||||
G4VParameterisationPolyhedra( EAxis axis, G4int nDiv, G4double width,
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
{
|
||||
G4Polyhedra* msol = (G4Polyhedra*)(msolid);
|
||||
if (msolid->GetEntityType() == "G4ReflectedSolid")
|
||||
{
|
||||
// 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;
|
||||
|
||||
// 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++)
|
||||
{
|
||||
rminValues2[i] = rminValues[i] * ConvertRadiusFactor(*msol);
|
||||
rmaxValues2[i] = rmaxValues[i] * ConvertRadiusFactor(*msol);
|
||||
zValuesRefl[i] = - zValues[i];
|
||||
}
|
||||
|
||||
G4Polyhedra* newSolid
|
||||
= new G4Polyhedra(msol->GetName(),
|
||||
msol->GetStartPhi(),
|
||||
msol->GetEndPhi() - msol->GetStartPhi(),
|
||||
nofSides,
|
||||
nofZplanes, zValuesRefl, rminValues2, rmaxValues2);
|
||||
|
||||
delete [] rminValues2;
|
||||
delete [] rmaxValues2;
|
||||
delete [] zValuesRefl;
|
||||
|
||||
msol = newSolid;
|
||||
fmotherSolid = newSolid;
|
||||
fReflectedSolid = true;
|
||||
fDeleteSolid = true;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
G4VParameterisationPolyhedra::~G4VParameterisationPolyhedra()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4double
|
||||
G4VParameterisationPolyhedra::
|
||||
ConvertRadiusFactor(const G4Polyhedra& phedra) const
|
||||
{
|
||||
G4double phiTotal = phedra.GetEndPhi() - phedra.GetStartPhi();
|
||||
G4int nofSides = phedra.GetOriginalParameters()->numSide;
|
||||
|
||||
if ( (phiTotal <=0) || (phiTotal > 2*M_PI+kAngTolerance) )
|
||||
phiTotal = 2*M_PI;
|
||||
|
||||
return cos(0.5*phiTotal/nofSides);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4ParameterisationPolyhedraRho::
|
||||
G4ParameterisationPolyhedraRho( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionPolyhedraRho" );
|
||||
|
||||
G4Polyhedra* msol = (G4Polyhedra*)(msolid);
|
||||
G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
|
||||
G4PolyhedraHistorical* original_pars = msol->GetOriginalParameters();
|
||||
|
||||
if( divType == DivWIDTH )
|
||||
@@ -190,12 +264,12 @@ G4ParameterisationPolyhedraPhi::
|
||||
G4ParameterisationPolyhedraPhi( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionPolyhedraPhi" );
|
||||
|
||||
G4Polyhedra* msol = (G4Polyhedra*)(msolid);
|
||||
G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
|
||||
G4double deltaPhi = msol->GetEndPhi() - msol->GetStartPhi();
|
||||
|
||||
if( divType == DivWIDTH )
|
||||
@@ -345,12 +419,12 @@ G4ParameterisationPolyhedraZ::
|
||||
G4ParameterisationPolyhedraZ( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionPolyhedraZ" );
|
||||
|
||||
G4Polyhedra* msol = (G4Polyhedra*)(msolid);
|
||||
G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
|
||||
G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
|
||||
|
||||
if( divType == DivWIDTH )
|
||||
@@ -387,8 +461,8 @@ G4double G4ParameterisationPolyhedraZ::GetMaxParameter() const
|
||||
{
|
||||
G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
|
||||
G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
|
||||
return (origparamMother->Z_values[origparamMother->Num_z_planes-1]
|
||||
-origparamMother->Z_values[0]);
|
||||
return abs (origparamMother->Z_values[origparamMother->Num_z_planes-1]
|
||||
-origparamMother->Z_values[0]);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@@ -21,13 +21,14 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisationTrd.cc,v 1.8 2003/11/19 11:51:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4ParameterisationTrd.cc,v 1.10 2004/05/17 07:20:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// class G4ParameterisationTrd Implementation file
|
||||
//
|
||||
// 26.05.03 - P.Arce Initial version
|
||||
// ********************************************************************
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ParameterisationTrd.hh"
|
||||
|
||||
@@ -36,29 +37,62 @@
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4ReflectedSolid.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4Trap.hh"
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4VParameterisationTrd::
|
||||
G4VParameterisationTrd( EAxis axis, G4int nDiv, G4double width,
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
{
|
||||
G4Trd* msol = (G4Trd*)(msolid);
|
||||
if (msolid->GetEntityType() == "G4ReflectedSolid")
|
||||
{
|
||||
// Get constituent solid
|
||||
G4VSolid* mConstituentSolid
|
||||
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
|
||||
msol = (G4Trd*)(mConstituentSolid);
|
||||
|
||||
// Create a new solid with inversed parameters
|
||||
G4Trd* newSolid
|
||||
= new G4Trd(msol->GetName(),
|
||||
msol->GetXHalfLength2(), msol->GetXHalfLength1(),
|
||||
msol->GetYHalfLength2(), msol->GetYHalfLength1(),
|
||||
msol->GetZHalfLength());
|
||||
msol = newSolid;
|
||||
fmotherSolid = newSolid;
|
||||
fReflectedSolid = true;
|
||||
fDeleteSolid = true;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
G4VParameterisationTrd::~G4VParameterisationTrd()
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
G4ParameterisationTrdX::
|
||||
G4ParameterisationTrdX( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationTrd( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionTrdX" );
|
||||
|
||||
G4Trd* msol = (G4Trd*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Trd* mtrd = (G4Trd*)(msolid);
|
||||
fnDiv = CalculateNDiv( 2*mtrd->GetXHalfLength1(),
|
||||
fnDiv = CalculateNDiv( 2*msol->GetXHalfLength1(),
|
||||
width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Trd* mtrd = (G4Trd*)(msolid);
|
||||
fwidth = CalculateWidth( 2*mtrd->GetXHalfLength1(), nDiv, offset );
|
||||
fwidth = CalculateWidth( 2*msol->GetXHalfLength1(), nDiv, offset );
|
||||
}
|
||||
|
||||
#ifdef G4DIVDEBUG
|
||||
@@ -175,21 +209,20 @@ G4ParameterisationTrdY::
|
||||
G4ParameterisationTrdY( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType)
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationTrd( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionTrdY" );
|
||||
|
||||
G4Trd* msol = (G4Trd*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Trd* mtrd = (G4Trd*)(msolid);
|
||||
fnDiv = CalculateNDiv( 2*mtrd->GetYHalfLength1(),
|
||||
fnDiv = CalculateNDiv( 2*msol->GetYHalfLength1(),
|
||||
width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Trd* mtrd = (G4Trd*)(msolid);
|
||||
fwidth = CalculateWidth( 2*mtrd->GetYHalfLength1(),
|
||||
fwidth = CalculateWidth( 2*msol->GetYHalfLength1(),
|
||||
nDiv, offset );
|
||||
}
|
||||
|
||||
@@ -304,21 +337,20 @@ G4ParameterisationTrdZ::
|
||||
G4ParameterisationTrdZ( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationTrd( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivTrdZ" );
|
||||
|
||||
G4Trd* msol = (G4Trd*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Trd* mtrd = (G4Trd*)(msolid);
|
||||
fnDiv = CalculateNDiv( 2*mtrd->GetZHalfLength(),
|
||||
fnDiv = CalculateNDiv( 2*msol->GetZHalfLength(),
|
||||
width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Trd* mtrd = (G4Trd*)(msolid);
|
||||
fwidth = CalculateWidth( 2*mtrd->GetZHalfLength(),
|
||||
fwidth = CalculateWidth( 2*msol->GetZHalfLength(),
|
||||
nDiv, offset );
|
||||
}
|
||||
|
||||
@@ -355,7 +387,7 @@ ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const
|
||||
|
||||
//----- translation
|
||||
G4ThreeVector origin(0.,0.,0.);
|
||||
G4double posi = -mdz + foffset + (copyNo+0.5)*fwidth;
|
||||
G4double posi = -mdz + OffsetZ() + (copyNo+0.5)*fwidth;
|
||||
if( faxis == kZAxis )
|
||||
{
|
||||
origin.setZ( posi );
|
||||
@@ -397,10 +429,10 @@ ComputeDimensions(G4Trd& trd, const G4int copyNo,
|
||||
G4double pDz = fwidth/2.;
|
||||
G4double zLength = 2*msol->GetZHalfLength();
|
||||
|
||||
trd.SetAllParameters ( pDx1+DDx*(foffset+copyNo*fwidth)/zLength,
|
||||
pDx1+DDx*(foffset+(copyNo+1)*fwidth)/zLength,
|
||||
pDy1+DDy*(foffset+copyNo*fwidth)/zLength,
|
||||
pDy1+DDy*(foffset+(copyNo+1)*fwidth)/zLength, pDz );
|
||||
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 );
|
||||
|
||||
#ifdef G4DIVDEBUG
|
||||
if( verbose >= 1 )
|
||||
|
||||
@@ -21,13 +21,14 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParameterisationTubs.cc,v 1.5 2003/11/19 11:51:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4ParameterisationTubs.cc,v 1.7 2004/05/17 07:20:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// class G4ParameterisationTubs Implementation file
|
||||
//
|
||||
// 26.05.03 - P.Arce Initial version
|
||||
// ********************************************************************
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4ParameterisationTubs.hh"
|
||||
|
||||
@@ -36,27 +37,51 @@
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4ReflectedSolid.hh"
|
||||
#include "G4Tubs.hh"
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4VParameterisationTubs::
|
||||
G4VParameterisationTubs( EAxis axis, G4int nDiv, G4double width,
|
||||
G4double offset, G4VSolid* msolid,
|
||||
DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
{
|
||||
G4Tubs* msol = (G4Tubs*)(msolid);
|
||||
if (msolid->GetEntityType() == "G4ReflectedSolid")
|
||||
{
|
||||
//----- get constituent solid
|
||||
G4VSolid* mConstituentSolid
|
||||
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
|
||||
msol = (G4Tubs*)(mConstituentSolid);
|
||||
fmotherSolid = msol;
|
||||
fReflectedSolid = true;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
G4VParameterisationTubs::~G4VParameterisationTubs()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4ParameterisationTubsRho::
|
||||
G4ParameterisationTubsRho( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionTubsRho" );
|
||||
|
||||
G4Tubs* msol = (G4Tubs*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Tubs* msol = (G4Tubs*)(msolid);
|
||||
fnDiv = CalculateNDiv( msol->GetOuterRadius() - msol->GetInnerRadius(),
|
||||
width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Tubs* msol = (G4Tubs*)(msolid);
|
||||
fwidth = CalculateWidth( msol->GetOuterRadius() - msol->GetInnerRadius(),
|
||||
nDiv, offset );
|
||||
}
|
||||
@@ -155,19 +180,18 @@ G4ParameterisationTubsPhi::
|
||||
G4ParameterisationTubsPhi( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionTubsPhi" );
|
||||
|
||||
G4Tubs* msol = (G4Tubs*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Tubs* msol = (G4Tubs*)(msolid);
|
||||
fnDiv = CalculateNDiv( msol->GetDeltaPhiAngle(), width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Tubs* msol = (G4Tubs*)(msolid);
|
||||
fwidth = CalculateWidth( msol->GetDeltaPhiAngle(), nDiv, offset );
|
||||
}
|
||||
|
||||
@@ -265,18 +289,18 @@ G4ParameterisationTubsZ::
|
||||
G4ParameterisationTubsZ( EAxis axis, G4int nDiv,
|
||||
G4double width, G4double offset,
|
||||
G4VSolid* msolid, DivisionType divType )
|
||||
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
|
||||
: G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
|
||||
{
|
||||
CheckParametersValidity();
|
||||
SetType( "DivisionTubsZ" );
|
||||
|
||||
G4Tubs* msol = (G4Tubs*)(fmotherSolid);
|
||||
if( divType == DivWIDTH )
|
||||
{
|
||||
G4Tubs* msol = (G4Tubs*)(msolid);
|
||||
fnDiv = CalculateNDiv( 2*msol->GetZHalfLength(), width, offset );
|
||||
}
|
||||
else if( divType == DivNDIV )
|
||||
{
|
||||
G4Tubs* msol = (G4Tubs*)(msolid);
|
||||
fwidth = CalculateWidth( 2*msol->GetZHalfLength(), nDiv, offset );
|
||||
}
|
||||
|
||||
@@ -310,7 +334,7 @@ ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const
|
||||
{
|
||||
//----- set translation: along Z axis
|
||||
G4Tubs* motherTubs = (G4Tubs*)(fmotherSolid);
|
||||
G4double posi = - motherTubs->GetZHalfLength() + foffset
|
||||
G4double posi = - motherTubs->GetZHalfLength() + OffsetZ()
|
||||
+ fwidth/2 + copyNo*fwidth;
|
||||
G4ThreeVector origin(0.,0.,posi);
|
||||
physVol->SetTranslation( origin );
|
||||
|
||||
@@ -21,18 +21,20 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VDivisionParameterisation.cc,v 1.8 2003/11/19 11:51:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4VDivisionParameterisation.cc,v 1.10 2004/05/17 07:20:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
//
|
||||
// class G4VDivisionParameterisation Implementation file
|
||||
//
|
||||
// 26.05.03 - P.Arce Initial version
|
||||
// ********************************************************************
|
||||
// 26.05.03 - P.Arce, Initial version
|
||||
// 08.04.04 - I.Hrivnacova, Implemented reflection
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4VDivisionParameterisation.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4ReflectedSolid.hh"
|
||||
|
||||
G4int G4VDivisionParameterisation::verbose = 5;
|
||||
|
||||
@@ -41,8 +43,9 @@ G4VDivisionParameterisation::
|
||||
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 )
|
||||
: faxis(axis), fnDiv( nDiv), fwidth(step), foffset(offset),
|
||||
fDivisionType(divType), fmotherSolid( motherSolid ), fReflectedSolid(false),
|
||||
fDeleteSolid(false)
|
||||
{
|
||||
#ifdef G4DIVDEBUG
|
||||
if (verbose >= 1)
|
||||
@@ -60,8 +63,22 @@ G4VDivisionParameterisation( EAxis axis, G4int nDiv,
|
||||
//--------------------------------------------------------------------------
|
||||
G4VDivisionParameterisation::~G4VDivisionParameterisation()
|
||||
{
|
||||
if (fDeleteSolid) delete fmotherSolid;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4VSolid*
|
||||
G4VDivisionParameterisation::
|
||||
ComputeSolid( const G4int i, G4VPhysicalVolume* pv )
|
||||
{
|
||||
G4VSolid* solid = G4VPVParameterisation::ComputeSolid(i, pv);
|
||||
if (solid->GetEntityType() == "G4ReflectedSolid")
|
||||
{
|
||||
solid = ((G4ReflectedSolid*)solid)->GetConstituentMovedSolid();
|
||||
}
|
||||
return solid;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
void
|
||||
G4VDivisionParameterisation::
|
||||
@@ -149,3 +166,15 @@ void G4VDivisionParameterisation::CheckNDivAndWidth( G4double maxPar )
|
||||
"Not supported configuration.");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
G4double G4VDivisionParameterisation::OffsetZ() const
|
||||
{
|
||||
// take into account reflection in the offset
|
||||
G4double offset = foffset;
|
||||
if (fReflectedSolid) offset = GetMaxParameter() - fwidth*fnDiv - foffset;
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user