Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
# $Id: GNUmakefile,v 2.4 1998/11/18 18:38:21 kurasige Exp $
# --------------------------------------------------------------
# GNUmakefile for modeling library. John Allison, 31/12/1997.
# --------------------------------------------------------------
name := G4modeling
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include
CPPFLAGS += -I$(G4BASE)/graphics_reps/include
CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
CPPFLAGS += -I$(G4BASE)/geometry/management/include
CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
CPPFLAGS += -I$(G4BASE)/materials/include
CPPFLAGS += -I$(G4BASE)/global/HEPRandom/include
CPPFLAGS += -I$(G4BASE)/processes/parameterisation/include
CPPFLAGS += -I$(G4BASE)/processes/electromagnetic/utils/include
CPPFLAGS += -I$(G4BASE)/processes/management/include
CPPFLAGS += -I$(G4BASE)/particles/management/include
CPPFLAGS += -I$(G4BASE)/run/include
CPPFLAGS += -I$(G4BASE)/event/include
CPPFLAGS += -I$(G4BASE)/digits+hits/hits/include
CPPFLAGS += -I$(G4BASE)/digits+hits/digits/include
CPPFLAGS += -I$(G4BASE)/digits+hits/detector/include
CPPFLAGS += -I$(G4BASE)/tracking/include
CPPFLAGS += -I$(G4BASE)/track/include
CPPFLAGS += -I$(G4BASE)/intercoms/include
include $(G4INSTALL)/config/common.gmk
+54
View File
@@ -0,0 +1,54 @@
$Id: History,v 2.5 1998/11/25 16:26:53 allison Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the CVS log-message one should put at every
committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
History file for visualization/modeling
---------------------------------------
vis-00-04-01 25th November 1998 John Allison.
- Added const G4VisAttributes* fpDefaultVisAttributes and access
functions to G4ModelingParameters.
- Reverted to default assignment operator and copy constructor for
G4ModelingParameters.
- G4PhysicalVolumeModel can now handle invisible daughters.
31st August 1998 John Allison
- Added G4VModel::Validate() and in subclasses.
vis-00-02-05 27th August 1998 John Allison
- Added G4HitsModel and G4TrajectoriesModel.
vis-00-02-04 22nd August 1998 John Allison
- Made G4Transform3D fTransform a member of G4VModel (instead of pointer).
- Reversed order of parameters in G4VModel constructor.
- Much bug fixing.
vis-00-06-06 11th June 1998 John Allison
- G4PhysicalVolumeModel handles parametrised solids and materials.
vis-00-06-04 10th June 1998 John Allison
- Moved G4BoundingSphereScene from management to modeling.
- Added G4Transform3D data member.
modeling-00-04-01 4th March 1998 John Allison
- Last tag before moving to visualization.
- Removed G4ModelingParameters:: from G4ModelingParameters.hh constructor.
27th January 1998 John Allison
- New (temporay?) category.
- Incorporates modeling code which was in G4VScene.
+6
View File
@@ -0,0 +1,6 @@
Modeling
=======
The idea is to put GEANT4-aware but user-enviroment-independent code
here. It introduces the concept of a G4VModel.
@@ -0,0 +1,67 @@
// This code implementation is the intellectual property of
// the RD44 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: G4BoundingSphereScene.hh,v 2.2 1998/08/22 16:34:57 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 7th June 1997
// An artificial scene to reuse G4VScene code to calculate a bounding sphere.
#ifndef G4BOUNDINGSPHERESCENE_HH
#define G4BOUNDINGSPHERESCENE_HH
#include "G4VGraphicsScene.hh"
#include "G4VisExtent.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Tubs.hh"
#include "G4Trd.hh"
#include "G4Trap.hh"
#include "G4Sphere.hh"
#include "G4Para.hh"
#include "G4Torus.hh"
class G4BoundingSphereScene: public G4VGraphicsScene {
public:
G4BoundingSphereScene ();
~G4BoundingSphereScene ();
virtual void AddThis (const G4Box& s) {Accrue (s);}
virtual void AddThis (const G4Cons& s) {Accrue (s);}
virtual void AddThis (const G4Tubs& s) {Accrue (s);}
virtual void AddThis (const G4Trd& s) {Accrue (s);}
virtual void AddThis (const G4Trap& s) {Accrue (s);}
virtual void AddThis (const G4Sphere& s) {Accrue (s);}
virtual void AddThis (const G4Para& s) {Accrue (s);}
virtual void AddThis (const G4Torus& s) {Accrue (s);}
virtual void AddThis (const G4VSolid& s) {Accrue (s);}
void PreAddThis (const G4Transform3D& objectTransformation,
const G4VisAttributes&) {
fpObjectTransformation = &objectTransformation;
}
void PostAddThis () {}
G4VisExtent GetBoundingSphereExtent ();
////////////////////////////////////////////////////////////////
// The following 2 functions can be used by any code which wishes to
// accrue a bounding sphere. Just instantiate a
// G4BoundingSphereScene and use AccrueBoundingSphere.
void ResetBoundingSphere ();
void AccrueBoundingSphere (const G4Point3D& centre,
G4double radius);
private:
void Accrue (const G4VSolid& solid);
G4Point3D fCentre;
G4double fRadius;
const G4Transform3D* fpObjectTransformation;
};
#endif
@@ -0,0 +1,39 @@
// This code implementation is the intellectual property of
// the RD44 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: G4FlavoredParallelWorldModel.hh,v 2.3 1998/08/22 16:34:58 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
// P. Mora de Freitas et M.Verderi - 19 June 1998.
// Model for flavored parallel world volumes.
#ifndef G4FLAVOREDPARALLELWORLDMODEL_HH
#define G4FLAVOREDPARALLELWORLDMODEL_HH
#include "G4PhysicalVolumeModel.hh"
class G4FlavoredParallelWorld;
class G4FlavoredParallelWorldModel : public G4PhysicalVolumeModel {
public:
G4FlavoredParallelWorldModel
(G4FlavoredParallelWorld* FPW,
G4int soughtDepth = G4PhysicalVolumeModel::UNLIMITED,
const G4Transform3D& modelTransformation = G4Transform3D::Identity,
const G4ModelingParameters* mp = 0);
~G4FlavoredParallelWorldModel ();
private:
G4FlavoredParallelWorld* theFlavoredParallelWorld;
};
#endif
@@ -0,0 +1,44 @@
// This code implementation is the intellectual property of
// the RD44 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: G4HitsModel.hh,v 1.2 1998/08/31 15:41:59 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 26th August 1998.
// Model which knows how to draw GEANT4 hits.
#ifndef G4HITSMODEL_HH
#define G4HITSMODEL_HH
#include "G4VModel.hh"
class G4HitsModel: public G4VModel {
public:
G4HitsModel ();
virtual ~G4HitsModel ();
virtual void DescribeYourselfTo (G4VGraphicsScene&);
// The main task of a model is to describe itself to the scene.
virtual G4String GetCurrentTag () const;
// A tag which depends on the current state of the model.
virtual G4String GetCurrentDescription () const;
// A description which depends on the current state of the model.
virtual G4bool Validate ();
// Validate, but allow internal changes (hence non-const function).
};
#include "G4HitsModel.icc"
#endif
@@ -0,0 +1,23 @@
// This code implementation is the intellectual property of
// the RD44 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: G4HitsModel.icc,v 2.1 1998/08/31 15:42:00 allison Exp $
// GEANT4 tag $Name: geant4-00 $
inline G4HitsModel::~G4HitsModel () {}
inline G4String G4HitsModel::GetCurrentTag () const {
return fGlobalTag;
}
inline G4String G4HitsModel::GetCurrentDescription () const {
return fGlobalDescription;
}
inline G4bool G4HitsModel::Validate () {
return true;
}
@@ -0,0 +1,98 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ModelingParameters.hh,v 2.2 1998/11/25 16:24:28 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 31st December 1997.
// Parameters associated with the modeling of GEANT4 objects.
#ifndef G4MODELINGPARAMETERS_HH
#define G4MODELINGPARAMETERS_HH
#include "globals.hh"
#include "G4VisExtent.hh"
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4VisAttributes;
class G4ModelingParameters {
friend ostream& operator << (ostream& os, const G4ModelingParameters&);
friend G4bool operator != (const G4ModelingParameters&,
const G4ModelingParameters&);
public:
enum RepStyle {
wireframe, // Use G4Wireframe.
polyhedron, // Use G4Polyhedron.
nurbs, // Use G4NURBS.
hierarchy // Draw as geometry hierarchy (DTREE in GEANT3 language!).
};
// RepStyle is used to determine which graphics_reps classes to use,
// if required.
G4ModelingParameters ();
G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
RepStyle repStyle,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
G4double visibleDensity,
G4bool isCullingCovered,
G4int noOfSides);
// noOfSides is suggested no. of sides per circle in case a
// polygonal representation is produced.
~G4ModelingParameters ();
// Note: uses default assignment operator and copy constructor.
// Get and Is functions...
const G4VisAttributes* GetDefaultVisAttributes () const;
RepStyle GetRepStyle () const;
G4bool IsCulling () const;
G4bool IsCullingInvisible () const;
G4bool IsDensityCulling () const;
G4double GetVisibleDensity () const;
G4bool IsCullingCovered () const;
G4int GetNoOfSides () const;
// Set functions...
void SetDefaultVisAttributes (const G4VisAttributes* pDefaultVisAttributes);
void SetRepStyle (RepStyle);
void SetCulling (G4bool);
void SetCullingInvisible (G4bool);
void SetDensityCulling (G4bool);
void SetVisibleDensity (G4double);
void SetCullingCovered (G4bool);
void SetNoOfSides (G4int);
// Other functions...
void PrintDifferences (const G4ModelingParameters& that) const;
private:
// Data members...
const G4VisAttributes* fpDefaultVisAttributes;
RepStyle fRepStyle; // Representation style.
G4bool fCulling; // Culling requested.
G4bool fCullInvisible; // Cull (don't Draw) invisible objects.
G4bool fDensityCulling; // Density culling requested. If so...
G4double fVisibleDensity; // ...density lower than this not drawn.
G4bool fCullCovered; // Cull daughters covered by opaque mothers.
G4int fNoOfSides; // ...if polygon approximates circle.
};
#include "G4ModelingParameters.icc"
#endif
@@ -0,0 +1,73 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ModelingParameters.icc,v 2.1 1998/11/25 16:24:30 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 31st December 1997.
// Parameters associated with the modeling of GEANT4 objects.
inline const G4VisAttributes*
G4ModelingParameters::GetDefaultVisAttributes () const {
return fpDefaultVisAttributes;
}
inline G4ModelingParameters::RepStyle
G4ModelingParameters::GetRepStyle () const {
return fRepStyle;
}
inline G4bool G4ModelingParameters::IsCulling () const {
return fCulling;
}
inline G4bool G4ModelingParameters::IsCullingInvisible () const {
return fCullInvisible;
}
inline G4bool G4ModelingParameters::IsDensityCulling () const {
return fDensityCulling;
}
inline G4double G4ModelingParameters::GetVisibleDensity () const {
return fVisibleDensity;
}
inline G4bool G4ModelingParameters::IsCullingCovered () const {
return fCullCovered;
}
inline G4int G4ModelingParameters::GetNoOfSides () const {
return fNoOfSides;
}
inline void G4ModelingParameters::SetDefaultVisAttributes
(const G4VisAttributes* pDefaultVisAttributes) {
fpDefaultVisAttributes = pDefaultVisAttributes;
}
inline void
G4ModelingParameters::SetRepStyle (G4ModelingParameters::RepStyle style) {
fRepStyle = style;
}
inline void G4ModelingParameters::SetCulling (G4bool value) {
fCulling = value;
}
inline void G4ModelingParameters::SetCullingInvisible (G4bool value) {
fCullInvisible = value;
}
inline void G4ModelingParameters::SetDensityCulling (G4bool value) {
fDensityCulling = value;
}
inline void G4ModelingParameters::SetCullingCovered (G4bool value) {
fCullCovered = value;
}
@@ -0,0 +1,42 @@
// This code implementation is the intellectual property of
// the RD44 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: G4NullModel.hh,v 2.1 1998/08/31 15:42:01 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 4th April 1998.
// Null model - simply a holder for modeling parameter.
// DO NOT INVOKE DescribeYourself.
#ifndef G4NULLMODEL_HH
#define G4NULLMODEL_HH
#include "G4VModel.hh"
class G4NullModel: public G4VModel {
public:
G4NullModel (const G4ModelingParameters* = 0);
~G4NullModel ();
virtual void DescribeYourselfTo (G4VGraphicsScene&);
// An exception is thrown if this is called!!!!!!!!!!!!!!!!!!!!
virtual G4bool Validate ();
// Validate, but allow internal changes (hence non-const function).
/////////////////////////////////////////////////
// Access to other information: use GetModelingParameters()
// (inherited from G4VModel) and the access functions of
// G4ModelingParameters.
};
#endif
@@ -0,0 +1,115 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PhysicalVolumeModel.hh,v 2.3 1998/08/31 15:42:02 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 31st December 1997.
// Model for physical volumes.
// It describes a physical volume and its daughters to any desired depth.
// Note: the "sought depth" is specified in the modeling parameters.
#ifndef G4PHYSICALVOLUMEMODEL_HH
#define G4PHYSICALVOLUMEMODEL_HH
#include "G4VModel.hh"
#include "G4Transform3D.hh"
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4VSolid;
class G4Material;
class G4PhysicalVolumeModel: public G4VModel {
public:
enum {UNLIMITED = -1};
G4PhysicalVolumeModel
(G4VPhysicalVolume*,
G4int soughtDepth = UNLIMITED,
const G4Transform3D& modelTransformation = G4Transform3D::Identity,
const G4ModelingParameters* = 0);
~G4PhysicalVolumeModel ();
virtual void DescribeYourselfTo (G4VGraphicsScene&);
// The main task of a model is to describe itself to the scene. It
// can also provide special information through pointers to working
// space in the scene. These pointers must be set up (if required
// by the scene) in the scene's implementaion of EstablishSpecials
// (G4PhysicalVolumeModel&) which is called from here. To do this,
// the scene should call DefinePointersToWorkingSpace - see below.
// DecommissionSpecials (G4PhysicalVolumeModel&) is also called from
// here. To see how this works, look at the implementation of this
// function and G4VScene::Establish/DecommissionSpecials.
virtual G4String GetCurrentTag () const;
// A tag which depends on the current state of the model.
virtual G4String GetCurrentDescription () const;
// A description which depends on the current state of the model.
virtual G4bool Validate ();
// Validate, but allow internal changes (hence non-const function).
//////////////////////////////////////////////////////////
// Access functions.
void DefinePointersToWorkingSpace (G4int* pCurrentDepth,
G4VPhysicalVolume** ppCurrentPV,
G4LogicalVolume** ppCurrentLV);
/////////////////////////////////////////////////
// Access to other information: use GetModelingParameters()
// (inherited from G4VModel) and the access functions of
// G4ModelingParameters.
private:
void VisitGeometryAndGetVisReps (G4VPhysicalVolume* pVPV,
G4int soughtDepth,
const G4Transform3D& theAT,
G4VGraphicsScene& scene);
void DescribeAndDescend (G4VPhysicalVolume* pVPV,
G4int soughtDepth,
G4LogicalVolume* pLV,
G4VSolid* pSol,
const G4Material* pMaterial,
const G4Transform3D& theAT,
G4VGraphicsScene& scene);
G4bool IsThisCulled (const G4LogicalVolume* pLV,
const G4Material* pMaterial);
G4bool IsDaughterCulled (const G4LogicalVolume* pMotherLV);
/////////////////////////////////////////////////////////
// Data members...
G4VPhysicalVolume* fpTopPV; // The physical volume.
G4String fTopPVName; // ...of the physical volume.
G4int fTopPVCopyNo; // ...of the physical volume.
G4int fSoughtDepth; // Sought depth of geom. hierarchy search.
G4int fCurrentDepth; // Current depth of geom. hierarchy.
G4VPhysicalVolume* fpCurrentPV; // Current physical volume.
G4LogicalVolume* fpCurrentLV; // Current logical volume.
////////////////////////////////////////////////////////////
// Pointers to working space in scene, if required.
G4int* fpCurrentDepth; // Current depth of geom. hierarchy.
G4VPhysicalVolume** fppCurrentPV; // Current physical volume.
G4LogicalVolume** fppCurrentLV; // Current logical volume.
};
#include "G4PhysicalVolumeModel.icc"
#endif
@@ -0,0 +1,15 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PhysicalVolumeModel.icc,v 2.0 1998/07/02 16:50:29 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 31st December 1997.
// Model for physical volumes.
inline G4PhysicalVolumeModel::~G4PhysicalVolumeModel () {}
@@ -0,0 +1,71 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PhysicalVolumeSearchScene.hh,v 2.2 1998/08/22 16:34:59 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 10th August 1998.
// An artificial scene to find physical volumes.
#ifndef G4PHYSICALVOLUMESEARCHSCENE_HH
#define G4PHYSICALVOLUMESEARCHSCENE_HH
#include "G4VGraphicsScene.hh"
#include "G4VisExtent.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Tubs.hh"
#include "G4Trd.hh"
#include "G4Trap.hh"
#include "G4Sphere.hh"
#include "G4Para.hh"
#include "G4Torus.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
class G4PhysicalVolumeSearchScene: public G4VGraphicsScene {
public:
G4PhysicalVolumeSearchScene
(const G4String& requiredPhysicalVolumeName, G4int requiredCopyNo);
~G4PhysicalVolumeSearchScene ();
void AddThis (const G4Box& s) {FindVolume (s);}
void AddThis (const G4Cons & s) {FindVolume (s);}
void AddThis (const G4Tubs& s) {FindVolume (s);}
void AddThis (const G4Trd& s) {FindVolume (s);}
void AddThis (const G4Trap& s) {FindVolume (s);}
void AddThis (const G4Sphere& s) {FindVolume (s);}
void AddThis (const G4Para& s) {FindVolume (s);}
void AddThis (const G4Torus& s) {FindVolume (s);}
void AddThis (const G4VSolid& s) {FindVolume (s);}
void PreAddThis (const G4Transform3D& objectTransformation,
const G4VisAttributes&);
void PostAddThis ();
void EstablishSpecials (G4PhysicalVolumeModel&);
G4int GetFoundDepth () const;
G4VPhysicalVolume* GetFoundVolume () const;
const G4Transform3D& GetFoundTransformation () const;
private:
void FindVolume (const G4VSolid&);
G4String fRequiredPhysicalVolumeName;
G4int fRequiredCopyNo;
G4int fCurrentDepth; // Current depth of geom. hierarchy.
G4VPhysicalVolume* fpCurrentPV; // Current physical volume.
G4LogicalVolume* fpCurrentLV; // Current logical volume.
const G4Transform3D* fpCurrentObjectTransformation;
G4int fFoundDepth; // Found depth.
G4VPhysicalVolume* fpFoundPV; // Found physical volume.
G4LogicalVolume* fpFoundLV; // Found logical volume.
G4Transform3D fFoundObjectTransformation; // Found transformation.
G4bool fMultipleOccurrence;
};
#include "G4PhysicalVolumeSearchScene.icc"
#endif
@@ -0,0 +1,35 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PhysicalVolumeSearchScene.icc,v 2.1 1998/08/22 16:35:00 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 10th August 1998.
// An artificial scene to find physical volumes.
inline void G4PhysicalVolumeSearchScene::PreAddThis
(const G4Transform3D& objectTransformation,
const G4VisAttributes&) {
fpCurrentObjectTransformation = &objectTransformation;
}
inline void G4PhysicalVolumeSearchScene::PostAddThis () {}
inline G4int G4PhysicalVolumeSearchScene::GetFoundDepth () const {
return fFoundDepth;
}
inline G4VPhysicalVolume*
G4PhysicalVolumeSearchScene::GetFoundVolume () const {
return fpFoundPV;
}
inline const G4Transform3D&
G4PhysicalVolumeSearchScene::GetFoundTransformation () const {
return fFoundObjectTransformation;
}
@@ -0,0 +1,44 @@
// This code implementation is the intellectual property of
// the RD44 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: G4TrajectoriesModel.hh,v 1.2 1998/08/31 15:42:03 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 26th August 1998.
// Model which knows how to draw GEANT4 trajectories.
#ifndef G4TRAJECTORIESMODEL_HH
#define G4TRAJECTORIESMODEL_HH
#include "G4VModel.hh"
class G4TrajectoriesModel: public G4VModel {
public:
G4TrajectoriesModel ();
virtual ~G4TrajectoriesModel ();
virtual void DescribeYourselfTo (G4VGraphicsScene&);
// The main task of a model is to describe itself to the scene.
virtual G4String GetCurrentTag () const;
// A tag which depends on the current state of the model.
virtual G4String GetCurrentDescription () const;
// A description which depends on the current state of the model.
virtual G4bool Validate ();
// Validate, but allow internal changes (hence non-const function).
};
#include "G4TrajectoriesModel.icc"
#endif
@@ -0,0 +1,24 @@
// This code implementation is the intellectual property of
// the RD44 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: G4TrajectoriesModel.icc,v 2.1 1998/08/31 15:42:04 allison Exp $
// GEANT4 tag $Name: geant4-00 $
inline G4TrajectoriesModel::~G4TrajectoriesModel () {}
inline G4String G4TrajectoriesModel::GetCurrentTag () const {
return fGlobalTag;
}
inline G4String G4TrajectoriesModel::GetCurrentDescription () const {
return fGlobalDescription;
}
inline G4bool G4TrajectoriesModel::Validate () {
return true;
}
@@ -0,0 +1,86 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VModel.hh,v 2.3 1998/08/31 15:42:05 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 31st December 1997.
// Base class for models.
#ifndef G4VMODEL_HH
#define G4VMODEL_HH
#include "globals.hh"
#include "G4VisExtent.hh"
#include "G4Transform3D.hh"
class G4VGraphicsScene;
class G4ModelingParameters;
class G4VModel {
friend ostream& operator << (ostream& os, const G4VModel&);
public:
G4VModel
(const G4Transform3D& modelTransformation = G4Transform3D::Identity,
const G4ModelingParameters* = 0);
virtual ~G4VModel ();
// For RWTPtrOrderedVector...
G4bool operator == (const G4VModel&) const;
virtual void DescribeYourselfTo (G4VGraphicsScene&) = 0;
// The main task of a model is to describe itself to the scene.
virtual G4String GetCurrentTag () const;
// A tag which depends on the current state of the model.
virtual G4String GetCurrentDescription () const;
// A description which depends on the current state of the model.
virtual G4bool Validate ();
// Validate, but allow internal changes (hence non-const function).
//////////////////////////////////////////////////////////
// Access functions...
const G4ModelingParameters* GetModelingParameters () const;
const G4String& GetGlobalTag () const;
// A tag which does not change and lasts the life of the model.
// Define protected data member in derived class constructor.
const G4String& GetGlobalDescription () const;
// A description which does not change and lasts the life of the model.
// Define protected data member in derived class constructor.
const G4VisExtent& GetExtent () const;
// Extent of visible objects in local coordinate system.
// Define protected data member in derived class constructor.
const G4Transform3D& GetTransformation () const;
// Model transformation, i.e., position and orientation of model in world.
void SetModelingParameters (const G4ModelingParameters*);
protected:
G4String fGlobalTag;
G4String fGlobalDescription;
const G4ModelingParameters* fpMP;
G4VisExtent fExtent;
G4Transform3D fTransform;
};
#include "G4VModel.icc"
#endif
@@ -0,0 +1,55 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VModel.icc,v 2.3 1998/08/31 15:42:06 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 31st December 1997.
// Base class for models.
inline G4VModel::~G4VModel () {}
inline G4bool G4VModel::operator == (const G4VModel& model) const{
return this == &model;
}
inline const G4ModelingParameters* G4VModel::GetModelingParameters () const {
return fpMP;
}
inline const G4String& G4VModel::GetGlobalTag () const {
return fGlobalTag;
}
inline const G4String& G4VModel::GetGlobalDescription () const {
return fGlobalDescription;
}
inline G4String G4VModel::GetCurrentTag () const {
return "Default Current Tag";
}
inline G4String G4VModel::GetCurrentDescription () const {
return "Default Current Description";
}
inline G4bool G4VModel::Validate () {
return false;
}
inline const G4VisExtent& G4VModel::GetExtent () const {
return fExtent;
}
inline const G4Transform3D& G4VModel::GetTransformation () const {
return fTransform;
}
inline void G4VModel::SetModelingParameters (const G4ModelingParameters* pMP) {
fpMP = pMP;
}
@@ -0,0 +1,75 @@
// This code implementation is the intellectual property of
// the RD44 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: G4BoundingSphereScene.cc,v 2.4 1998/11/23 10:12:16 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 7th June 1997
// An artificial scene to reuse G4VScene code to calculate a bounding sphere.
#include "G4BoundingSphereScene.hh"
#include "G4VSolid.hh"
#include "G4Vector3D.hh"
G4BoundingSphereScene::G4BoundingSphereScene ():
fRadius (-1.),
fpObjectTransformation (0)
{}
G4BoundingSphereScene::~G4BoundingSphereScene () {}
G4VisExtent G4BoundingSphereScene::GetBoundingSphereExtent () {
return G4VisExtent (fCentre, fRadius);
}
void G4BoundingSphereScene::Accrue (const G4VSolid& solid) {
const G4VisExtent& thisExtent = solid.GetExtent ();
G4Point3D thisCentre = thisExtent.GetExtentCentre ();
if (fpObjectTransformation) {
thisCentre.transform (*fpObjectTransformation);
}
const G4double thisRadius = thisExtent.GetExtentRadius ();
AccrueBoundingSphere (thisCentre, thisRadius);
/***********************************************
G4cout << "G4BoundingSphereScene::Accrue: centre: " << fCentre
<< ", radius: " << fRadius << endl;
***********************************************/
}
void G4BoundingSphereScene::ResetBoundingSphere () {
fCentre = G4Point3D ();
fRadius = -1.;
fpObjectTransformation = 0;
}
void G4BoundingSphereScene::AccrueBoundingSphere
(const G4Point3D& thisCentre,
G4double thisRadius) {
if (fRadius < 0 ) { // First time.
fCentre = thisCentre;
fRadius = thisRadius;
}
else {
G4Vector3D join = thisCentre - fCentre;
if (join == G4Vector3D (0., 0., 0.)) { // Centres coincide.
if (fRadius < thisRadius) fRadius = thisRadius;
}
else if (join.mag () + thisRadius <= fRadius) { // Inside accrued sphere.
// Do nothing.
}
else {
G4Vector3D unitJoin = join.unit ();
G4Point3D extremity1 = fCentre - fRadius * unitJoin;
G4Point3D extremity2 = thisCentre + thisRadius * unitJoin;
fCentre = 0.5 * (extremity2 + extremity1);
fRadius = 0.5 * (extremity2 - extremity1).mag ();
}
}
}
@@ -0,0 +1,36 @@
// This code implementation is the intellectual property of
// the RD44 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: G4FlavoredParallelWorldModel.cc,v 2.1 1998/08/22 16:35:04 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
// P. Mora de Freitas et M.Verderi - 19 June 1998.
// Model for flavored parallel world volumes.
#include "G4FlavoredParallelWorldModel.hh"
#include "G4FlavoredParallelWorld.hh"
#include "G4VisAttributes.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
G4FlavoredParallelWorldModel::G4FlavoredParallelWorldModel
(G4FlavoredParallelWorld* FPW,
G4int soughtDepth,
const G4Transform3D& modelTransformation,
const G4ModelingParameters* mp)
: G4PhysicalVolumeModel (FPW -> GetThePhysicalVolumeWorld (),
soughtDepth,
modelTransformation,
mp),
theFlavoredParallelWorld (FPW)
{
FPW -> GetThePhysicalVolumeWorld () ->
GetLogicalVolume () -> SetVisAttributes (G4VisAttributes::Invisible);
}
G4FlavoredParallelWorldModel::~G4FlavoredParallelWorldModel () {}
@@ -0,0 +1,38 @@
// This code implementation is the intellectual property of
// the RD44 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: G4HitsModel.cc,v 1.2 1998/08/31 15:42:15 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 26th August 1998.
// Model which knows how to draw GEANT4 hits.
#include "G4HitsModel.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4HCofThisEvent.hh"
G4HitsModel::G4HitsModel () {
fGlobalTag = "G4HitsModel for all hits.";
fGlobalDescription = fGlobalTag;
}
void G4HitsModel::DescribeYourselfTo (G4VGraphicsScene& scene) {
G4RunManager* runManager = G4RunManager::GetRunManager ();
const G4Event* event = runManager -> GetCurrentEvent ();
if (event) {
G4HCofThisEvent* HCE = event -> GetHCofThisEvent ();
if (HCE) {
G4int nHC = HCE -> GetCapacity ();
for (int iHC = 0; iHC < nHC; iHC++) {
HCE -> GetHC (iHC) -> DrawAllHits ();
}
}
}
}
@@ -0,0 +1,151 @@
// This code implementation is the intellectual property of
// the RD44 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: G4ModelingParameters.cc,v 2.2 1998/11/25 16:24:34 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 31st December 1997.
// Parameters associated with the modeling of GEANT4 objects.
#include "G4ModelingParameters.hh"
#include "G4ios.hh"
#include "G4VisAttributes.hh"
G4ModelingParameters::G4ModelingParameters ():
fpDefaultVisAttributes (0),
fRepStyle (polyhedron),
fCulling (false),
fCullInvisible (false),
fDensityCulling (false),
fVisibleDensity (0.01 * g / cm3),
fCullCovered (false),
fNoOfSides (24) {}
G4ModelingParameters::G4ModelingParameters
(const G4VisAttributes* pDefaultVisAttributes,
G4ModelingParameters::RepStyle repStyle,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
G4double visibleDensity,
G4bool isCullingCovered,
G4int noOfSides):
fpDefaultVisAttributes (pDefaultVisAttributes),
fRepStyle (repStyle),
fCulling (isCulling),
fCullInvisible (isCullingInvisible),
fDensityCulling (isDensityCulling),
fVisibleDensity (visibleDensity),
fCullCovered (isCullingCovered),
fNoOfSides (noOfSides) {}
G4ModelingParameters::~G4ModelingParameters () {}
void G4ModelingParameters::SetVisibleDensity (G4double visibleDensity) {
const G4double reasonableMaximum = 10.0 * g / cm3;
if (visibleDensity < 0) {
G4cout << "G4ModelingParameters::SetVisibleDensity: attempt to set negative "
"density - ignored." << endl;
}
else {
if (fVisibleDensity > reasonableMaximum) {
G4cout << "G4ModelingParameters::SetVisibleDensity: density > "
<< reasonableMaximum
<< " g / cm3 - did you mean this?"
<< endl;
}
fVisibleDensity = visibleDensity;
}
}
void G4ModelingParameters::SetNoOfSides (G4int nSides) {
const G4int nSidesMin = 3;
if (nSides < nSidesMin) {
nSides = nSidesMin;
G4cout << "G4ModelingParameters::SetNoOfSides: attempt to set the"
"\nnumber of sides per circle < " << nSidesMin
<< "; forced to" << nSides << endl;
}
fNoOfSides = nSides;
}
void G4ModelingParameters::PrintDifferences
(const G4ModelingParameters& that) const {
if (
(fpDefaultVisAttributes != that.fpDefaultVisAttributes) ||
(fRepStyle != that.fRepStyle) ||
(fCulling != that.fCulling) ||
(fCullInvisible != that.fCullInvisible) ||
(fDensityCulling != that.fDensityCulling) ||
(fVisibleDensity != that.fVisibleDensity) ||
(fCullCovered != that.fCullCovered) ||
(fNoOfSides != that.fNoOfSides))
G4cout << "Difference in 1st batch." << endl;
}
ostream& operator << (ostream& os, const G4ModelingParameters& mp) {
os << "Modeling parameters and options:";
os << "\n Default vis. attributes: " << *mp.fpDefaultVisAttributes;
os << "\n Representation style for graphics reps, if needed: ";
switch (mp.fRepStyle) {
case G4ModelingParameters::wireframe:
os << "wireframe"; break;
case G4ModelingParameters::polyhedron:
os << "polyhedron"; break;
case G4ModelingParameters::nurbs:
os << "nurbs"; break;
default: os << "unrecognised"; break;
}
os << "\n Culling: ";
if (mp.fCulling) os << "on";
else os << "off";
os << "\n Culling invisible objects: ";
if (mp.fCullInvisible) os << "on";
else os << "off";
os << "\n Density culling: ";
if (mp.fDensityCulling) {
os << "on - invisible if density less than "
<< mp.fVisibleDensity / (1. * g / cm3) << " g cm^-3";
}
else os << "off";
os << "\n Culling daughters covered by opaque mothers: ";
if (mp.fCullCovered) os << "on";
else os << "off";
os << "\n No. of sides used in circle polygon approximation: "
<< mp.fNoOfSides;
return os;
}
G4bool operator != (const G4ModelingParameters& mp1,
const G4ModelingParameters& mp2) {
if (
(*mp1.fpDefaultVisAttributes != *mp2.fpDefaultVisAttributes) ||
(mp1.fRepStyle != mp2.fRepStyle) ||
(mp1.fCulling != mp2.fCulling) ||
(mp1.fCullInvisible != mp2.fCullInvisible) ||
(mp1.fDensityCulling != mp2.fDensityCulling) ||
(mp1.fCullCovered != mp2.fCullCovered) ||
(mp1.fNoOfSides != mp2.fNoOfSides))
return true;
if (mp1.fDensityCulling &&
(mp1.fVisibleDensity != mp2.fVisibleDensity)) return true;
return false;
}
@@ -0,0 +1,29 @@
// This code implementation is the intellectual property of
// the RD44 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: G4NullModel.cc,v 2.2 1998/08/31 15:42:16 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 4th April 1998.
// Null model - simply a holder for modeling parameter.
// DO NOT INVOKE DescribeYourself.
#include "G4NullModel.hh"
G4NullModel::G4NullModel (const G4ModelingParameters* pMP):
G4VModel (G4Transform3D::Identity, pMP) {}
G4NullModel::~G4NullModel () {}
void G4NullModel::DescribeYourselfTo (G4VGraphicsScene& scene) {
G4Exception ("G4NullModel::DescribeYourselfTo called.");
}
G4bool G4NullModel::Validate () {
return true;
}
@@ -0,0 +1,406 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PhysicalVolumeModel.cc,v 2.6 1998/11/25 16:25:49 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 31st December 1997.
// Model for physical volumes.
#include "G4PhysicalVolumeModel.hh"
#include "G4ModelingParameters.hh"
#include "G4VGraphicsScene.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VPVParameterisation.hh"
#include "G4LogicalVolume.hh"
#include "G4VSolid.hh"
#include "G4Material.hh"
#include "G4VisAttributes.hh"
#include "G4BoundingSphereScene.hh"
#include "G4PhysicalVolumeSearchScene.hh"
#include "G4TransportationManager.hh"
#ifdef WIN32
#include <strstrea.h>
#else
#include <strstream.h>
#endif
G4PhysicalVolumeModel::G4PhysicalVolumeModel
(G4VPhysicalVolume* pVPV,
G4int soughtDepth,
const G4Transform3D& modelTransformation,
const G4ModelingParameters* pMP):
G4VModel (modelTransformation, pMP),
fpTopPV (pVPV),
fTopPVName (pVPV -> GetName ()),
fTopPVCopyNo (pVPV -> GetCopyNo ()),
fSoughtDepth (soughtDepth),
fCurrentDepth (0),
fpCurrentPV (0),
fpCurrentLV (0),
fpCurrentDepth (0),
fppCurrentPV (0),
fppCurrentLV (0)
{
const int len = 8; char a [len];
ostrstream o (a, len); o.seekp (ios::beg);
o << fpTopPV -> GetCopyNo () << ends;
fGlobalTag = fpTopPV -> GetName () + "." + a;
fGlobalDescription = "G4PhysicalVolumeModel " + fGlobalTag;
G4BoundingSphereScene bsScene;
const G4ModelingParameters* tempMP = fpMP;
G4ModelingParameters mParams
(0, // No default vis attributes.
G4ModelingParameters::wireframe,
true, // Global culling.
true, // Cull invisible volumes.
false, // Density culling.
0., // Density (not relevant if density culling false).
true, // Cull daughters of opaque mothers.
24); // No of sides (not relevant for this operation).
fpMP = &mParams;
//bsScene.SetBoundingSphereExtent
// (fpTopPV -> GetLogicalVolume () -> GetSolid () -> GetExtent ());
DescribeYourselfTo (bsScene);
fExtent = bsScene.GetBoundingSphereExtent ();
fpMP = tempMP;
}
void G4PhysicalVolumeModel::DescribeYourselfTo (G4VGraphicsScene& scene) {
scene.EstablishSpecials (*this);
// See .hh file for explanation of this mechanism.
fCurrentDepth = 0;
// Store in working space (via pointer to working space).
if (fpCurrentDepth) *fpCurrentDepth = fCurrentDepth;
//G4Transform3D startingTransformation = fTransform;
G4Transform3D startingTransformation;
VisitGeometryAndGetVisReps (fpTopPV,
fSoughtDepth,
startingTransformation,
scene);
// Clear current data and working space (via pointers to working space).
fCurrentDepth = 0;
fpCurrentPV = 0;
fpCurrentLV = 0;
if (fpCurrentDepth) *fpCurrentDepth = fCurrentDepth;
if (fppCurrentPV) *fppCurrentPV = fpCurrentPV;
if (fppCurrentLV) *fppCurrentLV = fpCurrentLV;
scene.DecommissionSpecials (*this);
// Clear pointers to working space.
fpCurrentDepth = 0;
fppCurrentPV = 0;
fppCurrentLV = 0;
}
G4String G4PhysicalVolumeModel::GetCurrentTag () const {
const int len = 8; char a [len];
ostrstream o (a, len); o.seekp (ios::beg);
if (fpCurrentPV) {
o << fpCurrentPV -> GetCopyNo () << ends;
return fpCurrentPV -> GetName () + "." + a;
}
else {
return "WARNING: NO CURRENT VOLUME - global tag is " + fGlobalTag;
}
}
G4String G4PhysicalVolumeModel::GetCurrentDescription () const {
return "G4PhysicalVolumeModel " + GetCurrentTag ();
}
void G4PhysicalVolumeModel::DefinePointersToWorkingSpace
(G4int* pCurrentDepth,
G4VPhysicalVolume** ppCurrentPV,
G4LogicalVolume** ppCurrentLV) {
fpCurrentDepth = pCurrentDepth;
fppCurrentPV = ppCurrentPV;
fppCurrentLV = ppCurrentLV;
}
void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
(G4VPhysicalVolume* pVPV,
G4int soughtDepth,
const G4Transform3D& theAT,
G4VGraphicsScene& scene) {
// Visits geometry structure to a given depth (soughtDepth), starting
// at given physical volume with given starting transformation and
// describes volumes to the scene.
// soughtDepth < 0 (default) implies full visit.
// theAT is the Accumulated Transformation.
// Find corresponding logical volume and (later) solid, storing in
// local variables to preserve re-entrancy.
G4LogicalVolume* pLV = pVPV -> GetLogicalVolume ();
// Maintain data members and store in working space (via pointers to
// working space).
if (fpCurrentDepth) *fpCurrentDepth = fCurrentDepth;
fpCurrentPV = pVPV;
fpCurrentLV = pLV;
if (fppCurrentPV) *fppCurrentPV = fpCurrentPV;
if (fppCurrentLV) *fppCurrentLV = fpCurrentLV;
G4VSolid* pSol;
G4Material* pMaterial;
if (pVPV -> IsReplicated ()) {
EAxis axis;
G4int nReplicas;
G4double width;
G4double offset;
G4bool consuming;
pVPV -> GetReplicationData (axis, nReplicas, width, offset, consuming);
G4VPVParameterisation* pP = pVPV -> GetParameterisation ();
if (pP) { // Parametrised volume.
for (int n = 0; n < nReplicas; n++) {
pSol = pP -> ComputeSolid (n, pVPV);
pMaterial = pP -> ComputeMaterial (n, pVPV);
pP -> ComputeTransformation (n, pVPV);
pSol -> ComputeDimensions (pP, n, pVPV);
pVPV -> SetCopyNo (n);
DescribeAndDescend (pVPV, soughtDepth, pLV, pSol, pMaterial,
theAT, scene);
}
}
else { // Plain replicated volume. From geometry_guide.txt...
// The replica's positions are claculated by means of a linear formula.
// Replication may occur along:
//
// o Cartesian axes (kXAxis,kYAxis,kZAxis)
//
// The replications, of specified width have coordinates of
// form (-width*(nReplicas-1)*0.5+n*width,0,0) where n=0.. nReplicas-1
// for the case of kXAxis, and are unrotated.
//
// o Radial axis (cylindrical polar) (kRho)
//
// The replications are cons/tubs sections, centred on the origin
// and are unrotated.
// They have radii of width*n+offset to width*(n+1)+offset
// where n=0..nReplicas-1
//
// o Phi axis (cylindrical polar) (kPhi)
// The replications are `phi sections' or wedges, and of cons/tubs form
// They have phi of offset+n*width to offset+(n+1)*width where
// n=0..nReplicas-1
//
for (int n = 0; n < nReplicas; n++) {
G4ThreeVector translation; // Null.
G4RotationMatrix rotation; // Null - life long enough for visualizing.
G4RotationMatrix* pRotation = 0;
switch (axis) {
default:
case kXAxis:
translation = G4ThreeVector (-width*(nReplicas-1)*0.5+n*width,0,0);
break;
case kYAxis:
translation = G4ThreeVector (0,-width*(nReplicas-1)*0.5+n*width,0);
break;
case kZAxis:
translation = G4ThreeVector (0,0,-width*(nReplicas-1)*0.5+n*width);
break;
case kRho:
G4cerr <<
"G4PhysicalVolumeModel::VisitGeometryAndGetVisReps: WARNING:"
"\n built-in replicated volumes replicated in radius are not yet"
"\n properly visualizable."
<< endl;
break;
case kPhi:
rotation.rotateZ (-(offset+n*width));
// Minus Sign because for the physical volume we need the
// coordinate system rotation.
pRotation = &rotation;
break;
}
pVPV -> SetTranslation (translation);
pVPV -> SetRotation (pRotation);
pVPV -> SetCopyNo (n);
pSol = pLV -> GetSolid ();
pMaterial = pLV -> GetMaterial ();
DescribeAndDescend (pVPV, soughtDepth, pLV, pSol, pMaterial,
theAT, scene);
}
}
}
else {
pSol = pLV -> GetSolid ();
pMaterial = pLV -> GetMaterial ();
DescribeAndDescend (pVPV, soughtDepth, pLV, pSol, pMaterial, theAT, scene);
}
return;
}
void G4PhysicalVolumeModel::DescribeAndDescend
(G4VPhysicalVolume* pVPV,
G4int soughtDepth,
G4LogicalVolume* pLV,
G4VSolid* pSol,
const G4Material* pMaterial,
const G4Transform3D& theAT,
G4VGraphicsScene& scene) {
const HepRotation* pObjectRotation = pVPV -> GetObjectRotation ();
const Hep3Vector& translation = pVPV -> GetTranslation ();
G4Transform3D theLT = G4Transform3D (*pObjectRotation, translation);
G4Transform3D theNewAT = theAT * theLT;
/********************************************************
G4cout << "G4PhysicalVolumeModel::DescribeAndDescend: "
<< pVPV -> GetName () << "." << pVPV -> GetCopyNo ();
G4cout << "\n theAT: ";
G4cout << "\n Rotation: ";
HepRotation rotation = theAT.getRotation ();
G4cout << rotation.thetaX() << ", "
<< rotation.phiX() << ", "
<< rotation.thetaY() << ", "
<< rotation.phiY() << ", "
<< rotation.thetaZ() << ", "
<< rotation.phiZ();
G4cout << "\n Translation: " << theAT.getTranslation();
G4cout << "\n theNewAT: ";
G4cout << "\n Rotation: ";
rotation = theNewAT.getRotation ();
G4cout << rotation.thetaX() << ", "
<< rotation.phiX() << ", "
<< rotation.thetaY() << ", "
<< rotation.phiY() << ", "
<< rotation.thetaZ() << ", "
<< rotation.phiZ();
G4cout << "\n Translation: " << theNewAT.getTranslation();
G4cout << endl;
**********************************************************/
// Make decision to Draw.
G4bool thisToBeDrawn = !IsThisCulled (pLV, pMaterial);
if (thisToBeDrawn) {
scene.PreAddThis (theNewAT, *(pLV -> GetVisAttributes ()));
pSol -> DescribeYourselfTo (scene);
scene.PostAddThis ();
}
// First check if mother covers...
// This is only effective in surface drawing style, and then only if
// the volumes are visible and opaque, and then only if no sections
// or cutways are in operation.
G4bool cullDaughter = thisToBeDrawn && IsDaughterCulled (pLV);
if (!(thisToBeDrawn && IsDaughterCulled (pLV))) {
// OK, now let's check for daughters...
if (soughtDepth != 0) {
int nDaughters = pLV -> GetNoDaughters ();
if (nDaughters) {
for (int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
G4VPhysicalVolume* pVPV = pLV -> GetDaughter (iDaughter);
// Descend the geometry structure recursively...
fCurrentDepth++;
VisitGeometryAndGetVisReps (pVPV, soughtDepth - 1, theNewAT, scene);
fCurrentDepth--;
}
}
}
}
}
G4bool G4PhysicalVolumeModel::IsThisCulled (const G4LogicalVolume* pLV,
const G4Material* pMaterial) {
// If true, cull, i.e., do not Draw.
G4double density = pMaterial -> GetDensity ();
const G4VisAttributes* pVisAttribs = pLV -> GetVisAttributes ();
if (!pVisAttribs) pVisAttribs = fpMP -> GetDefaultVisAttributes ();
if (fpMP) {
return
fpMP -> IsCulling () && // Global culling flag.
(
// Invisible volumes...
(fpMP -> IsCullingInvisible () &&
!(pVisAttribs ? pVisAttribs -> IsVisible () : true)) ||
// Low density volumes...
(fpMP -> IsDensityCulling () &&
(density < fpMP -> GetVisibleDensity ()))
)
;
}
else {
return false;
}
}
G4bool G4PhysicalVolumeModel::IsDaughterCulled
(const G4LogicalVolume* pMotherLV) {
// If true, cull, i.e., do not Draw.
const G4VisAttributes* pVisAttribs = pMotherLV -> GetVisAttributes ();
if (!pVisAttribs) pVisAttribs = fpMP -> GetDefaultVisAttributes ();
if (fpMP) {
return
fpMP -> IsCulling () // Global culling flag.
&&
(
// Does mother request daughters not to be drawn?
(pVisAttribs ? pVisAttribs -> IsDaughtersInvisible () : false)
||
(
// Global covered daughter flag. This is affected by drawing
// style, etc. The enforcing of this is done in
// G4VScene::CreateModelingParameters ()
fpMP -> IsCullingCovered ()
&&
// Cull only if mother is visible...
(pVisAttribs ? pVisAttribs -> IsVisible () : true)
// &&
// true // ...and opaque (transparency parameter not yet implemented).
)
)
;
}
else {
return false;
}
}
G4bool G4PhysicalVolumeModel::Validate () {
G4VPhysicalVolume* world =
G4TransportationManager::GetTransportationManager ()
-> GetNavigatorForTracking () -> GetWorldVolume ();
// The idea now is to seek a PV with the same name and copy no
// in the hope it's the same one!!
G4cout << "G4PhysicalVolumeModel::Validate() called." << endl;
G4PhysicalVolumeSearchScene searchScene (fTopPVName, fTopPVCopyNo);
G4PhysicalVolumeModel searchModel (world);
searchModel.DescribeYourselfTo (searchScene);
G4VPhysicalVolume* foundVolume = searchScene.GetFoundVolume ();
if (foundVolume) {
G4cout << " Volume of the same name and copy number (\""
<< fTopPVName << "\", copy " << fTopPVCopyNo
<< ") still exists and is being used."
"\n Be warned that this does not necessarily guarantee it's the same"
"\n volume you originally specified in /vis/scene/add/."
<< endl;
fpTopPV = foundVolume;
return true;
}
else {
G4cout << " A volume of the same name and copy number (\""
<< fTopPVName << "\", copy " << fTopPVCopyNo
<< ") no longer exists."
<< endl;
return false;
}
}
@@ -0,0 +1,75 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PhysicalVolumeSearchScene.cc,v 2.1 1998/08/22 16:35:06 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 10th August 1998.
// An artificial scene to find physical volumes.
#include "G4PhysicalVolumeSearchScene.hh"
#include "G4VSolid.hh"
#include "G4Vector3D.hh"
#include "G4PhysicalVolumeModel.hh"
G4PhysicalVolumeSearchScene::G4PhysicalVolumeSearchScene
(const G4String& requiredPhysicalVolumeName, G4int requiredCopyNo):
fRequiredPhysicalVolumeName (requiredPhysicalVolumeName),
fRequiredCopyNo (requiredCopyNo),
fCurrentDepth (0),
fpCurrentPV (0),
fpCurrentLV (0),
fpCurrentObjectTransformation (0),
fFoundDepth (0),
fpFoundPV (0),
fpFoundLV (0),
fMultipleOccurrence (false)
{}
G4PhysicalVolumeSearchScene::~G4PhysicalVolumeSearchScene () {}
void G4PhysicalVolumeSearchScene::EstablishSpecials
(G4PhysicalVolumeModel& pvModel) {
pvModel.DefinePointersToWorkingSpace (&fCurrentDepth,
&fpCurrentPV,
&fpCurrentLV);
}
void G4PhysicalVolumeSearchScene::FindVolume (const G4VSolid& solid) {
/**************************************************
G4cout << "Required volume: \"" << fRequiredPhysicalVolumeName
<< "\", copy no. " << fRequiredCopyNo << endl;
G4cout << "PhysicalVolume: \"" << fpCurrentPV -> GetName ()
<< "\", copy no. " << fpCurrentPV -> GetCopyNo () << endl;
*******************************************/
if (fRequiredPhysicalVolumeName == fpCurrentPV -> GetName () &&
fRequiredCopyNo == fpCurrentPV -> GetCopyNo ()) {
// Current policy - take first one found!!
if (!fpFoundPV) { // i.e., if not already found.
fFoundDepth = fCurrentDepth;
fpFoundPV = fpCurrentPV;
fpFoundLV = fpCurrentLV;
fFoundObjectTransformation = *fpCurrentObjectTransformation;
}
else {
if (!fMultipleOccurrence) {
fMultipleOccurrence = true;
G4cout << "G4PhysicalVolumeSearchScene::FindVolume:"
<< "\n Required volume: \"" << fRequiredPhysicalVolumeName
<< "\", copy no. " << fRequiredCopyNo
<< " found more than once."
"\n This function is not smart enough to distinguish identical"
"\n physical volumes which have different parentage. Besides,"
"\n it's tricky to specify in general; we plan a GUI to do this."
"\n This function gives you access to the first occurrence only."
<< endl;
}
}
}
}
@@ -0,0 +1,37 @@
// This code implementation is the intellectual property of
// the RD44 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: G4TrajectoriesModel.cc,v 1.2 1998/08/31 15:42:18 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 26th August 1998.
// Model which knows how to draw GEANT4 trajectories.
#include "G4TrajectoriesModel.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
G4TrajectoriesModel::G4TrajectoriesModel () {
fGlobalTag = "G4TrajectoriesModel for all trajectories.";
fGlobalDescription = fGlobalTag;
}
void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& scene) {
G4RunManager* runManager = G4RunManager::GetRunManager ();
const G4Event* event = runManager -> GetCurrentEvent ();
if (event) {
G4TrajectoryContainer* TC = event -> GetTrajectoryContainer ();
if (TC) {
G4int nT = TC -> entries ();
for (int iT = 0; iT < nT; iT++) {
(*TC) [iT] -> DrawTrajectory (50);
}
}
}
}
@@ -0,0 +1,49 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VModel.cc,v 2.2 1998/08/22 16:34:30 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 31st December 1997.
// Base class for models.
#include "G4VModel.hh"
#include "G4ModelingParameters.hh"
G4VModel::G4VModel (const G4Transform3D& modelTransformation,
const G4ModelingParameters* pMP):
fTransform (modelTransformation),
fpMP (pMP)
{
fGlobalTag = "Default Global Tag";
fGlobalDescription = "Default Global Description";
}
ostream& operator << (ostream& os, const G4VModel& m) {
os << m.fGlobalDescription;
os << "\n Modeling parameters:";
if (m.fpMP) {
os << "\n " << *(m.fpMP);
}
else {
os << " none.";
}
os << "\n Extent: " << m.fExtent;
os << "\n Transformation: ";
os << "\n Rotation: ";
HepRotation rotation = m.fTransform.getRotation ();
os << rotation.thetaX() << ", "
<< rotation.phiX() << ", "
<< rotation.thetaY() << ", "
<< rotation.phiY() << ", "
<< rotation.thetaZ() << ", "
<< rotation.phiZ();
os << "\n Translation: " << m.fTransform.getTranslation ();
return os;
}