Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.3 2003/11/19 11:51:44 gcosmo Exp $
# $Id: GNUmakefile,v 1.4 2004/06/11 14:17:13 gcosmo Exp $
# ----------------------------------------------------------------------
# GNUmakefile for geometry/divisions library. Gabriele Cosmo, 16/06/03.
# ----------------------------------------------------------------------
@@ -11,6 +11,7 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4GEOM_ALLOC_EXPORT
CPPFLAGS += \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPGeometry/include \
+13 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.10 2003/11/19 18:02:10 gcosmo Exp $
$Id: History,v 1.12 2004/05/17 07:20:59 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,18 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
May 17th, 2004 G.Cosmo (geomdiv-V06-01-01)
- Corrected handling of offset in Z for reflection.
May 13th, 2004 G.Cosmo (geomdiv-V06-01-00)
- Added support for reflection of divided volumes (courtesy of I.Hrivnacova):
o Added concrete istance of division-factory G4PVDivisionFactory
for the creation of volume divisions on demand.
o Enhanced unit-test suite "ExDivisions" to support reflections with
additional input argument for positioning type (normal/reflected).
o Coworks with tags: geommng-V06-01-00, geomvol-V06-01-00 and
geom-bool-V06-01-00.
Nov 19th, 2003 G.Cosmo (geomdiv-V05-02-07)
- Moved verbose output between G4DIVDEBUG compilation flag.
- Added testing framework for divisions to be used also as base for user's example.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PVDivision.hh,v 1.7 2003/11/19 11:51:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PVDivision.hh,v 1.8 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4PVDivision
//
@@ -61,9 +61,9 @@
// n=0..nReplicas-1
// History:
// 09.05.01 - P.Arce Initial version
// ********************************************************************
// -------
// 09.05.01 - P.Arce, Initial version
// ----------------------------------------------------------------------
#ifndef G4PVDIVISION_HH
#define G4PVDIVISION_HH
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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.hh,v 1.1 2004/05/13 14:56:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// class G4PVDivisionFactory
//
// Class description:
//
// Implementation of the interfaces for creating volumes divisions
// (defined in G4VPVDivisionFactory) for G4PVDivision type.
// Author: Ivana Hrivnacova, 4.5.2004 (Ivana.Hrivnacova@cern.ch)
// ------------------------------------------------------------------------
#ifndef G4PVDIVISION_FACTORY_HH
#define G4PVDIVISION_FACTORY_HH
#include "geomdefs.hh"
#include "G4VPVDivisionFactory.hh"
class G4LogicalVolume;
class G4PVDivisionFactory : public G4VPVDivisionFactory
{
public: // with description
virtual ~G4PVDivisionFactory();
virtual G4VPhysicalVolume* CreatePVDivision(
const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMother,
const EAxis pAxis,
const G4int nReplicas,
const G4double width,
const G4double offset );
// Create division - with number of divisions and width.
virtual G4VPhysicalVolume* CreatePVDivision(
const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4int nReplicas,
const G4double offset );
// Create division - with number of divisions.
virtual G4VPhysicalVolume* CreatePVDivision(
const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4double width,
const G4double offset );
// Create division - with width.
virtual G4VPhysicalVolume* CreatePVDivision(
const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const G4VPVParameterisation* param);
// Create division - with parameterisation.
virtual G4bool IsPVDivision(const G4VPhysicalVolume* pv) const;
// Returns true if pv is division.
static G4PVDivisionFactory* GetInstance();
// Create the unique instance of the singleton.
protected:
G4PVDivisionFactory();
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationBox.hh,v 1.3 2003/11/19 11:51:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationBox.hh,v 1.4 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationBoxX,
// G4ParameterisationBoxY,
@@ -34,9 +34,10 @@
// dividing a G4Box along one of each axis X, Y, Z.
// History:
// 09.05.01 - P.Arce Initial version
// ********************************************************************
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#ifndef G4ParameterisationBox_H
#define G4ParameterisationBox_H 1
@@ -58,7 +59,18 @@ class G4Tubs;
class G4Polycone;
class G4Polyhedra;
class G4ParameterisationBoxX : public G4VDivisionParameterisation
class G4VParameterisationBox : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationBox( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationBox();
};
class G4ParameterisationBoxX : public G4VParameterisationBox
{
public: // with description
@@ -75,8 +87,7 @@ class G4ParameterisationBoxX : public G4VDivisionParameterisation
void ComputeDimensions(G4Box& box, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
private: // Dummy declarations to get rid of warnings ...
private: // Dummy declarations to get rid of warnings ...
void ComputeDimensions (G4Cons&,const G4int,
const G4VPhysicalVolume*) const {}
@@ -102,7 +113,7 @@ class G4ParameterisationBoxX : public G4VDivisionParameterisation
const G4VPhysicalVolume*) const {}
};
class G4ParameterisationBoxY : public G4VDivisionParameterisation
class G4ParameterisationBoxY : public G4VParameterisationBox
{
public: // with description
@@ -145,7 +156,7 @@ class G4ParameterisationBoxY : public G4VDivisionParameterisation
const G4VPhysicalVolume*) const {}
};
class G4ParameterisationBoxZ : public G4VDivisionParameterisation
class G4ParameterisationBoxZ : public G4VParameterisationBox
{
public: // with description
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationCons.hh,v 1.4 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationCons.hh,v 1.5 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationConsRho,
// G4ParameterisationConsPhi,
@@ -34,9 +34,10 @@
// dividing a G4Cons along one of each axis Rho, Phi, Z.
// History:
// 09.05.01 - P.Arce Initial version
// ********************************************************************
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#ifndef G4ParameterisationCons_H
#define G4ParameterisationCons_H 1
@@ -58,7 +59,18 @@ class G4Tubs;
class G4Polycone;
class G4Polyhedra;
class G4ParameterisationConsRho : public G4VDivisionParameterisation
class G4VParameterisationCons : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationCons( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationCons();
};
class G4ParameterisationConsRho : public G4VParameterisationCons
{
public: // with description
@@ -100,7 +112,7 @@ class G4ParameterisationConsRho : public G4VDivisionParameterisation
const G4VPhysicalVolume*) const {}
};
class G4ParameterisationConsPhi : public G4VDivisionParameterisation
class G4ParameterisationConsPhi : public G4VParameterisationCons
{
public: // with description
@@ -142,7 +154,7 @@ class G4ParameterisationConsPhi : public G4VDivisionParameterisation
const G4VPhysicalVolume*) const {}
};
class G4ParameterisationConsZ : public G4VDivisionParameterisation
class G4ParameterisationConsZ : public G4VParameterisationCons
{
public: // with description
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationPara.hh,v 1.5 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationPara.hh,v 1.6 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationParaX,
// G4ParameterisationParaY,
@@ -34,9 +34,10 @@
// dividing a G4Para along one of each axis X, Y, Z.
// History:
// 09.05.01 - P.Arce First version
// ********************************************************************
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#ifndef G4ParameterisationPara_H
#define G4ParameterisationPara_H 1
@@ -56,8 +57,18 @@ class G4Tubs;
class G4Polycone;
class G4Polyhedra;
class G4VParameterisationPara : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationPara( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationPara();
};
class G4ParameterisationParaX : public G4VDivisionParameterisation
class G4ParameterisationParaX : public G4VParameterisationPara
{
public: // with description
@@ -101,7 +112,7 @@ class G4ParameterisationParaX : public G4VDivisionParameterisation
};
class G4ParameterisationParaY : public G4VDivisionParameterisation
class G4ParameterisationParaY : public G4VParameterisationPara
{
public: // with description
@@ -145,7 +156,7 @@ class G4ParameterisationParaY : public G4VDivisionParameterisation
};
class G4ParameterisationParaZ : public G4VDivisionParameterisation
class G4ParameterisationParaZ : public G4VParameterisationPara
{
public: // with description
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationPolycone.hh,v 1.5 2003/11/18 12:15:30 arce Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationPolycone.hh,v 1.6 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationPolyconeRho,
// G4ParameterisationPolyconePhi,
@@ -34,7 +34,9 @@
// dividing a G4Polycone along one of each axis Rho, Phi, Z.
// History:
// 09.05.01 - P.Arce First version
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
//---------------------------------------------------------------------
#ifndef G4ParameterisationPolycone_H
#define G4ParameterisationPolycone_H 1
@@ -56,11 +58,22 @@ class G4Hype;
class G4Tubs;
class G4Polyhedra;
class G4VParameterisationPolycone : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationPolycone( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationPolycone();
};
//---------------------------------------------------------------------
// Class G4ParameterisationPolyconeRho
//---------------------------------------------------------------------
class G4ParameterisationPolyconeRho : public G4VDivisionParameterisation
class G4ParameterisationPolyconeRho : public G4VParameterisationPolycone
{
public: // with description
@@ -109,7 +122,7 @@ class G4ParameterisationPolyconeRho : public G4VDivisionParameterisation
// Class G4ParameterisationPolyconePhi
//---------------------------------------------------------------------
class G4ParameterisationPolyconePhi : public G4VDivisionParameterisation
class G4ParameterisationPolyconePhi : public G4VParameterisationPolycone
{
public: // with description
@@ -156,7 +169,7 @@ class G4ParameterisationPolyconePhi : public G4VDivisionParameterisation
// Class G4ParameterisationPolyconeZ
//---------------------------------------------------------------------
class G4ParameterisationPolyconeZ : public G4VDivisionParameterisation
class G4ParameterisationPolyconeZ : public G4VParameterisationPolycone
{
public: // with description
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationPolyhedra.hh,v 1.6 2003/11/18 12:15:30 arce Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationPolyhedra.hh,v 1.7 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationPolyhedraRho,
// G4ParameterisationPolyhedraPhi,
@@ -34,7 +34,9 @@
// dividing a G4Polyhedra along one of each axis Rho, Phi, Z.
// History:
// 09.05.01 - P.Arce First version
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
//---------------------------------------------------------------------
#ifndef G4ParameterisationPolyhedra_H
#define G4ParameterisationPolyhedra_H 1
@@ -56,11 +58,28 @@ class G4Hype;
class G4Tubs;
class G4Polycone;
class G4VParameterisationPolyhedra : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationPolyhedra( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationPolyhedra();
private:
G4double ConvertRadiusFactor(const G4Polyhedra& phedra) const;
// Converts radius of the sides to radius of the corners:
// r_corners = r_sides/factor
};
//---------------------------------------------------------------------
// Class G4ParameterisationPolyhedraRho
//---------------------------------------------------------------------
class G4ParameterisationPolyhedraRho : public G4VDivisionParameterisation
class G4ParameterisationPolyhedraRho : public G4VParameterisationPolyhedra
{
public: // with description
@@ -109,7 +128,7 @@ class G4ParameterisationPolyhedraRho : public G4VDivisionParameterisation
// Class G4ParameterisationPolyhedraPhi
//---------------------------------------------------------------------
class G4ParameterisationPolyhedraPhi : public G4VDivisionParameterisation
class G4ParameterisationPolyhedraPhi : public G4VParameterisationPolyhedra
{
public: // with description
@@ -158,7 +177,7 @@ class G4ParameterisationPolyhedraPhi : public G4VDivisionParameterisation
// Class G4ParameterisationPolyhedraZ
//---------------------------------------------------------------------
class G4ParameterisationPolyhedraZ : public G4VDivisionParameterisation
class G4ParameterisationPolyhedraZ : public G4VParameterisationPolyhedra
{
public: // with description
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationTrd.hh,v 1.5 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationTrd.hh,v 1.6 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationTrdX
// G4ParameterisationTrdY
@@ -34,9 +34,10 @@
// dividing a trapezoid along one of each axis X, Y, Z.
// History:
// 09.05.01 P.Arce First version
// ********************************************************************
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#ifndef G4ParameterisationTrd_H
#define G4ParameterisationTrd_H 1
@@ -57,7 +58,18 @@ class G4Tubs;
class G4Polycone;
class G4Polyhedra;
class G4ParameterisationTrdX : public G4VDivisionParameterisation
class G4VParameterisationTrd : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationTrd( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationTrd();
};
class G4ParameterisationTrdX : public G4VParameterisationTrd
{
public: // with description
@@ -103,7 +115,7 @@ class G4ParameterisationTrdX : public G4VDivisionParameterisation
};
class G4ParameterisationTrdY : public G4VDivisionParameterisation
class G4ParameterisationTrdY : public G4VParameterisationTrd
{
public: // with description
@@ -149,7 +161,7 @@ class G4ParameterisationTrdY : public G4VDivisionParameterisation
};
class G4ParameterisationTrdZ : public G4VDivisionParameterisation
class G4ParameterisationTrdZ : public G4VParameterisationTrd
{
public: // with description
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationTubs.hh,v 1.4 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationTubs.hh,v 1.5 2004/05/13 14:57:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationTubsRho
// G4ParameterisationTubsPhi
@@ -34,9 +34,10 @@
// dividing a G4Tubs along one of each axis Rho, Phi, Z.
// History:
// 09.05.01 P.Arce First version
// ********************************************************************
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#ifndef G4ParameterisationTubsRho_H
#define G4ParameterisationTubsRho_H 1
@@ -56,8 +57,18 @@ class G4Hype;
class G4Polycone;
class G4Polyhedra;
class G4VParameterisationTubs : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationTubs( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationTubs();
};
class G4ParameterisationTubsRho : public G4VDivisionParameterisation
class G4ParameterisationTubsRho : public G4VParameterisationTubs
{
public: // with description
@@ -100,7 +111,7 @@ class G4ParameterisationTubsRho : public G4VDivisionParameterisation
};
class G4ParameterisationTubsPhi : public G4VDivisionParameterisation
class G4ParameterisationTubsPhi : public G4VParameterisationTubs
{
public: // with description
@@ -143,7 +154,7 @@ class G4ParameterisationTubsPhi : public G4VDivisionParameterisation
};
class G4ParameterisationTubsZ : public G4VDivisionParameterisation
class G4ParameterisationTubsZ : public G4VParameterisationTubs
{
public: // with description
@@ -21,20 +21,20 @@
// ********************************************************************
//
//
// $Id: G4VDivisionParameterisation.hh,v 1.6 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4VDivisionParameterisation.hh,v 1.8 2004/05/17 07:20:39 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4VDivisionParameterisation
//
// Class description:
//
// ......
//
// Member data:
//
// Base class for parameterisations defining divisions of volumes
// for different kind of CSG and specific solids.
// History:
// 09.05.01 - P.Arce Initial version
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
//---------------------------------------------------------------------
#ifndef G4VDivisionParameterisation_H
#define G4VDivisionParameterisation_H 1
@@ -58,6 +58,8 @@ class G4VDivisionParameterisation : public G4VPVParameterisation
G4VSolid* motherSolid = 0);
virtual ~G4VDivisionParameterisation();
virtual G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume *);
virtual void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume *physVol) const = 0;
@@ -84,6 +86,7 @@ class G4VDivisionParameterisation : public G4VPVParameterisation
void CheckOffset( G4double maxPar );
void CheckNDivAndWidth( G4double maxPar );
virtual G4double GetMaxParameter() const = 0;
G4double OffsetZ() const;
protected:
@@ -94,6 +97,8 @@ class G4VDivisionParameterisation : public G4VPVParameterisation
G4double foffset;
DivisionType fDivisionType;
G4VSolid* fmotherSolid;
G4bool fReflectedSolid;
G4bool fDeleteSolid;
static G4int verbose;
G4int theVoluFirstCopyNo;
@@ -21,13 +21,12 @@
// ********************************************************************
//
//
// $Id: G4VDivisionParameterisation.icc,v 1.2 2003/11/18 12:15:30 arce Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4VDivisionParameterisation.icc,v 1.3 2004/05/13 14:57:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4VDivisionParameterisation Inline Implementation file
//
// 26.05.03 - G.Cosmo: Created
// ********************************************************************
// --------------------------------------------------------------------
inline
const G4String& G4VDivisionParameterisation::GetType() const
+13 -3
View File
@@ -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;
}