Import Geant4 10.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 12:08:39 +02:00
parent 286caacf06
commit c9b32a6c0a
5770 changed files with 1050949 additions and 367105 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile 73609 2013-09-02 10:10:30Z gcosmo $
# $Id: GNUmakefile 78838 2014-01-28 08:46:17Z gcosmo $
# --------------------------------------------------------------
# GNUmakefile for modeling library. John Allison, 31/12/1997.
# --------------------------------------------------------------
@@ -9,7 +9,7 @@ ifndef G4INSTALL
G4INSTALL = ../../..
endif
GLOBLIBS = libG4event.lib
GLOBLIBS = libG4run.lib libG4event.lib
GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
@@ -31,6 +31,7 @@ CPPFLAGS += -I$(G4BASE)/materials/include
CPPFLAGS += -I$(G4BASE)/global/HEPRandom/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/utils/include
CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
+68 -1
View File
@@ -1,4 +1,4 @@
$Id: History 77479 2013-11-25 10:01:22Z gcosmo $
$Id: History 87360 2014-12-01 16:07:16Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,73 @@ committal in the CVS repository !
History file for visualization/modeling
---------------------------------------
28th November 2014 John Allison (modeling-V10-00-12)
- G4TrajectoriesModel.cc: Tidied.
29th October 2014 Makoto Asai (modeling-V10-00-11)
- G4TrajectoriesModel.cc: Further fix.
27th October 2014 Makoto Asai (modeling-V10-00-10)
- G4TrajectoriesModel.cc: Protect against incorrect casting if G4RunManager
base class is used in multithreaded Geant4 installation.
22nd October 2014 Laurent Garnier (modeling-V10-00-09 require greps-V10-00-08)
- G4ModelingParameters.cc
o Change constant in .cc nSidesMin by GetMinLineSegmentsPerCircle() in the G4VisAttribute
22nd October 2014 John Allison (modeling-V10-00-08)
- G4TrajectoriesModel.cc: Get appropriate run manager in MT mode.
11th August 2014 John Allison (modeling-V10-00-07)
- Corrected date. modeling-V10-00-06 should be August.
9th July 2014 John Allison (modeling-V10-00-06)
- G4AxesModel: Added a parameter for text size. (Default 10 pixels.)
- G4TrajectoryDrawerUtils.cc and G4TouchableDumpScene.cc:
o Fixed small memory leak. (AttValues must be deleted by the user
after use.)
19th May 2014 John Allison (modeling-V10-00-05)
- Introduced G4TouchableDumpScene.
- Introduced G4PseudoScene. The following now inherit it:
o G4PhysicalVolumeSearchScene
o G4BoundingSphereScene
o G4TouchableDumpScene
- G4PhysicalVolumeModel
o Allow instantiation of an empty model via the default constructor so
that it can be used, for example, to get the G4AttDefs. If it
proves to be a problem we might have to disallow it again, but it is
unlikley to be used except by visualisation experts. See, for example,
/vis/list, where it is used simply to get a list of G4AttDefs
o Introduced Abort - all further geometry traversal is stopped. (This
is useful in G4TouchableDumpScene - once the required touchable is found
there is no need to continue.)
o Tidied.
6th March 2014 John Allison (modeling-V10-00-04)
- G4PhysicalVolumeModel.cc:
o More careful protection of zero pointers in constructor.
26th January 2014 John Allison (modeling-V10-00-02)
- GNUmakefile: Added dependency on run category.
- G4PhysicalVolumeModel:
o Augmented constructor to set sensible values of some data members,
namely fpCurrentPV, fpCurrentLV, fpCurrentMaterial and
fpCurrentTransform, so that CreateCurrentAttValues gives the G4Atts
of the top volume if called without any further processing.
23rd January 2014 John Allison (modeling-V10-00-01)
- G4TrajectoriesModel:
o Add run ID.
o Initialise fRunID and fEventID to -1.
13th January 2014 John Allison (modeling-V10-00-00)
- Requires greps-V10-00-01.
- G4TrajectoryDrawByAttribute:
o Migrated to operator<< for const reference G4AttDefs map.
- G4TrajectoriesModel:
o Added SetCurrentTrajectory and SetEventID.
15th November 2013 John Allison (modeling-V09-06-22)
- Some changes as suggested by PVS.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4AxesModel.hh 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4AxesModel.hh 83403 2014-08-21 15:07:30Z gcosmo $
//
//
// John Allison 3rd April 2001
@@ -51,7 +51,8 @@ public: // With description
G4double arrowWidth = 1.,
const G4String& colourString = "auto",
const G4String& description = "",
G4bool withAnnotation = true
G4bool withAnnotation = true,
G4double textSize = 10.
);
virtual ~G4AxesModel ();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4BoundingSphereScene.hh 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4BoundingSphereScene.hh 81056 2014-05-20 09:02:16Z gcosmo $
//
//
// John Allison 7th June 1997
@@ -33,46 +33,23 @@
#ifndef G4BOUNDINGSPHERESCENE_HH
#define G4BOUNDINGSPHERESCENE_HH
#include "G4VGraphicsScene.hh"
#include "G4PseudoScene.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 "G4Polycone.hh"
#include "G4Polyhedra.hh"
class G4VModel;
class G4BoundingSphereScene: public G4VGraphicsScene {
class G4BoundingSphereScene: public G4PseudoScene {
public:
G4BoundingSphereScene (G4VModel* pModel = 0);
virtual ~G4BoundingSphereScene ();
void PreAddSolid (const G4Transform3D& objectTransformation,
const G4VisAttributes&);
void PostAddSolid () {}
void AddSolid (const G4Box& solid) {Accrue (solid);}
void AddSolid (const G4Cons& solid) {Accrue (solid);}
void AddSolid (const G4Tubs& solid) {Accrue (solid);}
void AddSolid (const G4Trd& solid) {Accrue (solid);}
void AddSolid (const G4Trap& solid) {Accrue (solid);}
void AddSolid (const G4Sphere& solid) {Accrue (solid);}
void AddSolid (const G4Para& solid) {Accrue (solid);}
void AddSolid (const G4Torus& solid) {Accrue (solid);}
void AddSolid (const G4Polycone& solid) {Accrue (solid);}
void AddSolid (const G4Polyhedra& solid) {Accrue (solid);}
void AddSolid (const G4VSolid& solid) {Accrue (solid);}
void AddCompound (const G4VTrajectory&) {}
void AddCompound (const G4VHit&) {}
void AddCompound (const G4VDigi&) {}
void AddCompound (const G4THitsMap<G4double>&) {}
G4VisExtent GetBoundingSphereExtent ();
const G4Point3D& GetCentre() const {return fCentre;}
G4double GetRadius() const {return fRadius;}
void SetCentre(const G4Point3D& centre) {fCentre = centre;}
@@ -86,27 +63,13 @@ public:
void AccrueBoundingSphere (const G4Point3D& centre,
G4double radius);
////////////////////////////////////////////////////////////////
// Functions not used by required by the abstract interface.
virtual void BeginPrimitives (const G4Transform3D&) {}
virtual void EndPrimitives () {}
virtual void BeginPrimitives2D (const G4Transform3D&) {}
virtual void EndPrimitives2D () {}
virtual void AddPrimitive (const G4Polyline&) {}
virtual void AddPrimitive (const G4Scale&) {}
virtual void AddPrimitive (const G4Text&) {}
virtual void AddPrimitive (const G4Circle&) {}
virtual void AddPrimitive (const G4Square&) {}
virtual void AddPrimitive (const G4Polymarker&) {}
virtual void AddPrimitive (const G4Polyhedron&) {}
private:
void Accrue (const G4VSolid& solid);
void ProcessVolume (const G4VSolid& solid);
G4VModel* fpModel; // Instantiating code may optionally set this.
G4Point3D fCentre;
G4double fRadius;
const G4Transform3D* fpObjectTransformation;
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.hh 77479 2013-11-25 10:01:22Z gcosmo $
// $Id: G4ModelingParameters.hh 81056 2014-05-20 09:02:16Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -74,6 +74,7 @@ public: // With description
VASForceAuxEdgeVisible,
VASForceLineSegmentsPerCircle
};
class PVNameCopyNo {
public:
PVNameCopyNo(G4String name, G4int copyNo):
@@ -88,6 +89,7 @@ public: // With description
};
typedef std::vector<PVNameCopyNo> PVNameCopyNoPath;
typedef PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator;
class VisAttributesModifier {
public:
VisAttributesModifier
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.hh 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4PhysicalVolumeModel.hh 81056 2014-05-20 09:02:16Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -219,7 +219,11 @@ public: // With description
G4bool Validate (G4bool warn);
// Validate, but allow internal changes (hence non-const function).
void CurtailDescent() {fCurtailDescent = true;}
void Abort () const {fAbort = true;}
// Abort all further traversing.
void CurtailDescent() const {fCurtailDescent = true;}
// Curtail descent of current branch.
protected:
@@ -260,7 +264,8 @@ protected:
std::vector<G4PhysicalVolumeNodeID> fBaseFullPVPath;
std::vector<G4PhysicalVolumeNodeID> fFullPVPath;
std::vector<G4PhysicalVolumeNodeID> fDrawnPVPath;
G4bool fCurtailDescent;// Can be set to curtail descent.
mutable G4bool fAbort; // Abort all further traversing.
mutable G4bool fCurtailDescent;// Can be set to curtail descent.
G4VSolid* fpClippingSolid;
ClippingMode fClippingMode;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeSearchScene.hh 68043 2013-03-13 14:27:49Z gcosmo $
// $Id: G4PhysicalVolumeSearchScene.hh 81056 2014-05-20 09:02:16Z gcosmo $
//
//
// John Allison 10th August 1998.
@@ -33,77 +33,42 @@
#ifndef G4PHYSICALVOLUMESEARCHSCENE_HH
#define G4PHYSICALVOLUMESEARCHSCENE_HH
#include "G4VGraphicsScene.hh"
#include "G4PseudoScene.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 "G4Polycone.hh"
#include "G4Polyhedra.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4PhysicalVolumeModel.hh"
class G4PhysicalVolumeSearchScene: public G4VGraphicsScene {
class G4PhysicalVolumeSearchScene: public G4PseudoScene {
public:
G4PhysicalVolumeSearchScene
(G4PhysicalVolumeModel*,
const G4String& requiredPhysicalVolumeName,
G4int requiredCopyNo,
G4int verbosity = 99);
virtual ~G4PhysicalVolumeSearchScene ();
void PreAddSolid (const G4Transform3D& objectTransformation,
const G4VisAttributes&);
void PostAddSolid ();
void AddSolid (const G4Box& solid) {FindVolume (solid);}
void AddSolid (const G4Cons & solid) {FindVolume (solid);}
void AddSolid (const G4Tubs& solid) {FindVolume (solid);}
void AddSolid (const G4Trd& solid) {FindVolume (solid);}
void AddSolid (const G4Trap& solid) {FindVolume (solid);}
void AddSolid (const G4Sphere& solid) {FindVolume (solid);}
void AddSolid (const G4Para& solid) {FindVolume (solid);}
void AddSolid (const G4Torus& solid) {FindVolume (solid);}
void AddSolid (const G4Polycone& solid) {FindVolume (solid);}
void AddSolid (const G4Polyhedra& solid) {FindVolume (solid);}
void AddSolid (const G4VSolid& solid) {FindVolume (solid);}
void AddCompound (const G4VTrajectory&) {}
void AddCompound (const G4VHit&) {}
void AddCompound (const G4VDigi&) {}
void AddCompound (const G4THitsMap<G4double>&) {}
const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>&
GetFoundFullPVPath () const;
G4int GetFoundDepth () const;
G4VPhysicalVolume* GetFoundVolume () const;
const G4Transform3D& GetFoundTransformation () const;
GetFoundFullPVPath() const
{return fFoundFullPVPath;}
////////////////////////////////////////////////////////////////
// Functions not used but required by the abstract interface.
G4int GetFoundDepth() const {return fFoundDepth;}
virtual void BeginPrimitives (const G4Transform3D&) {}
virtual void EndPrimitives () {}
virtual void BeginPrimitives2D (const G4Transform3D&) {}
virtual void EndPrimitives2D () {}
virtual void AddPrimitive (const G4Polyline&) {}
virtual void AddPrimitive (const G4Scale&) {}
virtual void AddPrimitive (const G4Text&) {}
virtual void AddPrimitive (const G4Circle&) {}
virtual void AddPrimitive (const G4Square&) {}
virtual void AddPrimitive (const G4Polymarker&) {}
virtual void AddPrimitive (const G4Polyhedron&) {}
G4VPhysicalVolume* GetFoundVolume() const {return fpFoundPV;}
const G4Transform3D& GetFoundTransformation () const
{return fFoundObjectTransformation;}
private:
void FindVolume (const G4VSolid&);
void ProcessVolume(const G4VSolid&);
const G4PhysicalVolumeModel* fpPVModel;
G4String fRequiredPhysicalVolumeName;
G4int fRequiredCopyNo;
const G4Transform3D* fpCurrentObjectTransformation;
std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>
fFoundFullPVPath; // Found full path.
G4int fFoundDepth; // Found depth.
@@ -114,6 +79,4 @@ private:
G4bool fMultipleOccurrence;
};
#include "G4PhysicalVolumeSearchScene.icc"
#endif
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4PseudoScene.hh 66773 2013-01-12 14:48:08Z allison $
//
//
// John Allison 15th May 2014
// A base class for "pseudo" scenes/graphics systems.
#ifndef G4PSEUDOSCENE_HH
#define G4PSEUDOSCENE_HH
#include "G4VGraphicsScene.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 "G4Polycone.hh"
#include "G4Polyhedra.hh"
class G4PseudoScene: public G4VGraphicsScene {
public:
G4PseudoScene(): fpCurrentObjectTransformation(0) {}
virtual ~G4PseudoScene () {}
void PreAddSolid (const G4Transform3D& objectTransformation,
const G4VisAttributes&)
{fpCurrentObjectTransformation = &objectTransformation;}
void PostAddSolid () {}
void AddSolid (const G4Box& solid) {ProcessVolume (solid);}
void AddSolid (const G4Cons & solid) {ProcessVolume (solid);}
void AddSolid (const G4Tubs& solid) {ProcessVolume (solid);}
void AddSolid (const G4Trd& solid) {ProcessVolume (solid);}
void AddSolid (const G4Trap& solid) {ProcessVolume (solid);}
void AddSolid (const G4Sphere& solid) {ProcessVolume (solid);}
void AddSolid (const G4Para& solid) {ProcessVolume (solid);}
void AddSolid (const G4Torus& solid) {ProcessVolume (solid);}
void AddSolid (const G4Polycone& solid) {ProcessVolume (solid);}
void AddSolid (const G4Polyhedra& solid) {ProcessVolume (solid);}
void AddSolid (const G4VSolid& solid) {ProcessVolume (solid);}
void AddCompound (const G4VTrajectory&) {}
void AddCompound (const G4VHit&) {}
void AddCompound (const G4VDigi&) {}
void AddCompound (const G4THitsMap<G4double>&) {}
void BeginPrimitives (const G4Transform3D&) {}
void EndPrimitives () {}
void BeginPrimitives2D (const G4Transform3D&) {}
void EndPrimitives2D () {}
void AddPrimitive (const G4Polyline&) {}
void AddPrimitive (const G4Scale&) {}
void AddPrimitive (const G4Text&) {}
void AddPrimitive (const G4Circle&) {}
void AddPrimitive (const G4Square&) {}
void AddPrimitive (const G4Polymarker&) {}
void AddPrimitive (const G4Polyhedron&) {}
protected:
virtual void ProcessVolume (const G4VSolid&) = 0;
const G4Transform3D* fpCurrentObjectTransformation;
};
#endif
@@ -24,35 +24,43 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeSearchScene.icc 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4TouchableDumpScene.hh 66773 2013-01-12 14:48:08Z allison $
//
//
// John Allison 10th August 1998.
// An artificial scene to find physical volumes.
inline void G4PhysicalVolumeSearchScene::PreAddSolid
(const G4Transform3D& objectTransformation,
const G4VisAttributes&) {
fpCurrentObjectTransformation = &objectTransformation;
}
#ifndef G4TOUCHABLEDUMPSCENE_HH
#define G4TOUCHABLEDUMPSCENE_HH
inline void G4PhysicalVolumeSearchScene::PostAddSolid () {}
#include "G4PseudoScene.hh"
#include "G4VisExtent.hh"
#include "G4ModelingParameters.hh"
#include "G4PhysicalVolumeModel.hh"
inline const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>&
G4PhysicalVolumeSearchScene::GetFoundFullPVPath () const {
return fFoundFullPVPath;
}
#include <iostream>
inline G4int G4PhysicalVolumeSearchScene::GetFoundDepth () const {
return fFoundDepth;
}
class G4TouchableDumpScene: public G4PseudoScene {
inline G4VPhysicalVolume*
G4PhysicalVolumeSearchScene::GetFoundVolume () const {
return fpFoundPV;
}
public:
inline const G4Transform3D&
G4PhysicalVolumeSearchScene::GetFoundTransformation () const {
return fFoundObjectTransformation;
}
G4TouchableDumpScene
(std::ostream& os,
G4PhysicalVolumeModel* pPVModel,
const G4ModelingParameters::PVNameCopyNoPath& requiredTouchable);
virtual ~G4TouchableDumpScene ();
G4bool IsFound() {return fFound;}
private:
void ProcessVolume(const G4VSolid&);
std::ostream& fos;
const G4PhysicalVolumeModel* fpPVModel;
G4ModelingParameters::PVNameCopyNoPath fRequiredTouchable;
G4bool fFound;
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4TrajectoriesModel.hh 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4TrajectoriesModel.hh 78838 2014-01-28 08:46:17Z gcosmo $
//
//
// John Allison 26th August 1998.
@@ -63,12 +63,22 @@ public: // With description
const G4VTrajectory* GetCurrentTrajectory() const
{return fpCurrentTrajectory;}
void SetCurrentTrajectory(const G4VTrajectory* pTraj)
{fpCurrentTrajectory = pTraj;}
void SetRunID(G4int runID)
{fRunID = runID;}
void SetEventID(G4int eventID)
{fEventID = eventID;}
const std::map<G4String,G4AttDef>* GetAttDefs() const;
std::vector<G4AttValue>* CreateCurrentAttValues() const;
private:
const G4VTrajectory* fpCurrentTrajectory;
G4int fRunID;
G4int fEventID;
};
+7 -2
View File
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 73344 2013-08-26 07:07:06Z gcosmo $
# $Id: sources.cmake 81056 2014-05-20 09:02:16Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -24,6 +24,7 @@ include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/digits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/utils/include)
include_directories(${CMAKE_SOURCE_DIR}/source/event/include)
include_directories(${CMAKE_SOURCE_DIR}/source/run/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/navigation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/magneticfield/include)
@@ -73,9 +74,10 @@ GEANT4_DEFINE_MODULE(NAME G4modeling
G4PhysicalVolumeMassScene.hh
G4PhysicalVolumeModel.hh
G4PhysicalVolumeSearchScene.hh
G4PhysicalVolumeSearchScene.icc
G4PseudoScene.hh
G4ScaleModel.hh
G4TextModel.hh
G4TouchableDumpScene.hh
G4TrajectoriesModel.hh
G4TrajectoryChargeFilter.hh
G4TrajectoryDrawByAttribute.hh
@@ -115,6 +117,7 @@ GEANT4_DEFINE_MODULE(NAME G4modeling
G4PhysicalVolumeSearchScene.cc
G4ScaleModel.cc
G4TextModel.cc
G4TouchableDumpScene.cc
G4TrajectoriesModel.cc
G4TrajectoryChargeFilter.cc
G4TrajectoryDrawByAttribute.cc
@@ -135,6 +138,7 @@ GEANT4_DEFINE_MODULE(NAME G4modeling
G4detector
G4detutils
G4digits
G4run
G4event
G4geomBoolean
G4geometrymng
@@ -152,6 +156,7 @@ GEANT4_DEFINE_MODULE(NAME G4modeling
G4volumes
GLOBAL_DEPENDENCIES
G4digits_hits
G4run
G4event
G4geometry
G4global
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4AxesModel.cc 68043 2013-03-13 14:27:49Z gcosmo $
// $Id: G4AxesModel.cc 83403 2014-08-21 15:07:30Z gcosmo $
//
//
// John Allison 3rd April 2001
@@ -56,10 +56,10 @@ G4AxesModel::~G4AxesModel ()
G4AxesModel::G4AxesModel
(G4double x0, G4double y0, G4double z0, G4double length,
G4double arrowWidth,
const G4String& colourString,
G4double arrowWidth, const G4String& colourString,
const G4String& description,
G4bool withAnnotation):
G4bool withAnnotation,
G4double textSize):
fXAxisModel(0),
fXLabelModel(0),
fXAnnotationModel(0),
@@ -102,15 +102,16 @@ G4AxesModel::G4AxesModel
xColour, "x-axis: " + description);
if (withAnnotation) {
text = new G4Text("x",G4Point3D(x0+1.05*length, y0, z0));
text->SetScreenSize(10.);
text->SetScreenSize(textSize);
text->SetOffset(0.5*textSize,0.5*textSize);
text->SetLayout(G4Text::centre);
va = new G4VisAttributes(xColour);
text->SetVisAttributes(va);
fXLabelModel = new G4TextModel(*text);
delete text;
text = new G4Text(annotation,G4Point3D(x0+0.8*length, y0, z0));
text->SetScreenSize(10.);
text->SetOffset(5.,5.);
text->SetScreenSize(textSize);
text->SetOffset(-1.5*textSize,-1.5*textSize);
text->SetLayout(G4Text::centre);
va = new G4VisAttributes(xColour);
text->SetVisAttributes(va);
@@ -125,15 +126,16 @@ G4AxesModel::G4AxesModel
yColour, "y-axis: " + description);
if (withAnnotation) {
text = new G4Text("y",G4Point3D(x0, y0+1.05*length, z0));
text->SetScreenSize(10.);
text->SetScreenSize(textSize);
text->SetOffset(0.5*textSize,0.5*textSize);
text->SetLayout(G4Text::centre);
va = new G4VisAttributes(yColour);
text->SetVisAttributes(va);
fYLabelModel = new G4TextModel(*text);
delete text;
text = new G4Text(annotation,G4Point3D(x0, y0+0.8*length, z0));
text->SetScreenSize(10.);
text->SetOffset(5.,5.);
text->SetScreenSize(textSize);
text->SetOffset(-1.5*textSize,-1.5*textSize);
text->SetLayout(G4Text::centre);
va = new G4VisAttributes(yColour);
text->SetVisAttributes(va);
@@ -148,15 +150,16 @@ G4AxesModel::G4AxesModel
zColour, "z-axis: " + description);
if (withAnnotation) {
text = new G4Text("z",G4Point3D(x0, y0, z0+1.05*length));
text->SetScreenSize(10.);
text->SetScreenSize(textSize);
text->SetOffset(0.5*textSize,0.5*textSize);
text->SetLayout(G4Text::centre);
va = new G4VisAttributes(zColour);
text->SetVisAttributes(va);
fZLabelModel = new G4TextModel(*text);
delete text;
text = new G4Text(annotation,G4Point3D(x0, y0, z0+0.8*length));
text->SetScreenSize(10.);
text->SetOffset(5.,5.);
text->SetScreenSize(textSize);
text->SetOffset(-1.5*textSize,-1.5*textSize);
text->SetLayout(G4Text::centre);
va = new G4VisAttributes(zColour);
text->SetVisAttributes(va);
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4BoundingSphereScene.cc 66373 2012-12-18 09:41:34Z gcosmo $
// $Id: G4BoundingSphereScene.cc 81056 2014-05-20 09:02:16Z gcosmo $
//
//
// John Allison 7th June 1997
@@ -36,30 +36,23 @@
#include "G4PhysicalVolumeModel.hh"
#include "G4Vector3D.hh"
G4BoundingSphereScene::G4BoundingSphereScene (G4VModel* pModel):
fpModel (pModel),
fRadius (-1.),
fpObjectTransformation (0)
G4BoundingSphereScene::G4BoundingSphereScene (G4VModel* pModel)
:fpModel(pModel)
,fRadius(-1.)
{}
G4BoundingSphereScene::~G4BoundingSphereScene () {}
void G4BoundingSphereScene::PreAddSolid
(const G4Transform3D& objectTransformation,
const G4VisAttributes&) {
fpObjectTransformation = &objectTransformation;
}
G4VisExtent G4BoundingSphereScene::GetBoundingSphereExtent () {
return G4VisExtent (fCentre, fRadius);
}
void G4BoundingSphereScene::Accrue (const G4VSolid& solid) {
void G4BoundingSphereScene::ProcessVolume(const G4VSolid& solid)
{
const G4VisExtent& newExtent = solid.GetExtent ();
G4Point3D newCentre = newExtent.GetExtentCentre ();
if (fpObjectTransformation) {
newCentre.transform (*fpObjectTransformation);
if (fpCurrentObjectTransformation) {
newCentre.transform (*fpCurrentObjectTransformation);
}
const G4double newRadius = newExtent.GetExtentRadius ();
AccrueBoundingSphere (newCentre, newRadius);
@@ -72,7 +65,7 @@ void G4BoundingSphereScene::Accrue (const G4VSolid& solid) {
void G4BoundingSphereScene::ResetBoundingSphere () {
fCentre = G4Point3D ();
fRadius = -1.;
fpObjectTransformation = 0;
fpCurrentObjectTransformation = 0;
}
void G4BoundingSphereScene::AccrueBoundingSphere
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.cc 71534 2013-06-17 16:07:53Z gcosmo $
// $Id: G4ModelingParameters.cc 85020 2014-10-23 09:52:52Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -125,7 +125,7 @@ void G4ModelingParameters::SetVisibleDensity (G4double visibleDensity) {
}
G4int G4ModelingParameters::SetNoOfSides (G4int nSides) {
const G4int nSidesMin = 12;
const G4int nSidesMin = fpDefaultVisAttributes->GetMinLineSegmentsPerCircle();
if (nSides < nSidesMin) {
nSides = nSidesMin;
if (fWarning)
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.cc 70646 2013-06-03 15:07:58Z gcosmo $
// $Id: G4PhysicalVolumeModel.cc 81056 2014-05-20 09:02:16Z gcosmo $
//
//
// John Allison 31st December 1997.
@@ -56,28 +56,45 @@
#include <sstream>
G4PhysicalVolumeModel::G4PhysicalVolumeModel
(G4VPhysicalVolume* pVPV,
G4int requestedDepth,
const G4Transform3D& modelTransformation,
const G4ModelingParameters* pMP,
G4bool useFullExtent):
G4VModel (modelTransformation, pMP),
fpTopPV (pVPV),
fTopPVCopyNo (0),
fRequestedDepth (requestedDepth),
fUseFullExtent (useFullExtent),
fCurrentDepth (0),
fpCurrentPV (0),
fpCurrentLV (0),
fpCurrentMaterial (0),
fpCurrentTransform (0),
fCurtailDescent (false),
fpClippingSolid (0),
fClippingMode (subtraction)
(G4VPhysicalVolume* pVPV
, G4int requestedDepth
, const G4Transform3D& modelTransformation
, const G4ModelingParameters* pMP
, G4bool useFullExtent)
: G4VModel (modelTransformation, pMP)
, fpTopPV (pVPV)
, fTopPVCopyNo (0)
, fRequestedDepth (requestedDepth)
, fUseFullExtent (useFullExtent)
, fCurrentDepth (0)
, fpCurrentPV (0)
, fpCurrentLV (0)
, fpCurrentMaterial (0)
, fpCurrentTransform (0)
, fAbort (false)
, fCurtailDescent (false)
, fpClippingSolid (0)
, fClippingMode (subtraction)
{
if (fpTopPV) {
fType = "G4PhysicalVolumeModel";
fType = "G4PhysicalVolumeModel";
if (!fpTopPV) {
// In some circumstances creating an "empty" G4PhysicalVolumeModel is
// allowed, so I have supressed the G4Exception below. If it proves to
// be a problem we might have to re-instate it, but it is unlikley to
// be used except by visualisation experts. See, for example, /vis/list,
// where it is used simply to get a list of G4AttDefs.
// G4Exception
// ("G4PhysicalVolumeModel::G4PhysicalVolumeModel",
// "modeling0010", FatalException, "Null G4PhysicalVolumeModel pointer.");
fTopPVName = "NULL";
fGlobalTag = "Empty";
fGlobalDescription = "G4PhysicalVolumeModel " + fGlobalTag;
} else {
fTopPVName = fpTopPV -> GetName ();
fTopPVCopyNo = fpTopPV -> GetCopyNo ();
std::ostringstream o;
@@ -85,6 +102,11 @@ G4PhysicalVolumeModel::G4PhysicalVolumeModel
fGlobalTag = fpTopPV -> GetName () + "." + o.str();
fGlobalDescription = "G4PhysicalVolumeModel " + fGlobalTag;
fpCurrentPV = fpTopPV;
if (fpCurrentPV) fpCurrentLV = fpCurrentPV->GetLogicalVolume();
if (fpCurrentLV) fpCurrentMaterial = fpCurrentLV->GetMaterial();
fpCurrentTransform = const_cast<G4Transform3D*>(&modelTransformation);
CalculateExtent ();
}
}
@@ -170,6 +192,8 @@ void G4PhysicalVolumeModel::DescribeYourselfTo
"\nwrong. Please contact visualisation coordinator.");
}
fDrawnPVPath.clear();
fAbort = false;
fCurtailDescent = false;
}
G4String G4PhysicalVolumeModel::GetCurrentTag () const
@@ -328,8 +352,6 @@ void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
}
}
}
return;
}
void G4PhysicalVolumeModel::DescribeAndDescend
@@ -492,7 +514,9 @@ void G4PhysicalVolumeModel::DescribeAndDescend
if (density < densityCut) thisToBeDrawn = false;
}
}
// 6) The user has asked for all further traversing to be aborted...
if (fAbort) thisToBeDrawn = false;
// Record thisToBeDrawn in path...
fFullPVPath.back().SetDrawn(thisToBeDrawn);
@@ -533,7 +557,9 @@ void G4PhysicalVolumeModel::DescribeAndDescend
if (!nDaughters) daughtersToBeDrawn = false;
// 2) We are at the limit if requested depth...
else if (requestedDepth == 0) daughtersToBeDrawn = false;
// 3) The user has asked that the descent be curtailed...
// 3) The user has asked for all further traversing to be aborted...
else if (fAbort) daughtersToBeDrawn = false;
// 4) The user has asked that the descent be curtailed...
else if (fCurtailDescent) daughtersToBeDrawn = false;
// Now, reasons that depend on culling policy...
@@ -554,20 +580,20 @@ void G4PhysicalVolumeModel::DescribeAndDescend
}
}
G4bool opaque = pVisAttribs->GetColour().GetAlpha() >= 1.;
// 4) Global culling is on....
// 5) Global culling is on....
if (culling) {
// 5) ..and culling of invisible volumes is on...
// 6) ..and culling of invisible volumes is on...
if (cullingInvisible) {
// 6) ...and the mother requests daughters invisible
// 7) ...and the mother requests daughters invisible
if (daughtersInvisible) daughtersToBeDrawn = false;
}
// 7) Or culling of covered daughters is requested...
// 8) Or culling of covered daughters is requested...
if (cullingCovered) {
// 8) ...and surface drawing is operating...
// 9) ...and surface drawing is operating...
if (surfaceDrawing) {
// 9) ...but only if mother is visible...
// 10) ...but only if mother is visible...
if (thisToBeDrawn) {
// 10) ...and opaque...
// 11) ...and opaque...
if (opaque) daughtersToBeDrawn = false;
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeSearchScene.cc 68043 2013-03-13 14:27:49Z gcosmo $
// $Id: G4PhysicalVolumeSearchScene.cc 81056 2014-05-20 09:02:16Z gcosmo $
//
//
// John Allison 10th August 1998.
@@ -44,7 +44,6 @@ G4PhysicalVolumeSearchScene::G4PhysicalVolumeSearchScene
fpPVModel (pPVModel),
fRequiredPhysicalVolumeName (requiredPhysicalVolumeName),
fRequiredCopyNo (requiredCopyNo),
fpCurrentObjectTransformation (0),
fFoundDepth (0),
fpFoundPV (0),
fpFoundLV (0),
@@ -54,7 +53,7 @@ G4PhysicalVolumeSearchScene::G4PhysicalVolumeSearchScene
G4PhysicalVolumeSearchScene::~G4PhysicalVolumeSearchScene () {}
void G4PhysicalVolumeSearchScene::FindVolume (const G4VSolid&) {
void G4PhysicalVolumeSearchScene::ProcessVolume (const G4VSolid&) {
typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
typedef std::vector<PVNodeID> PVPath;
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4TouchableDumpScene.cc 66773 2013-01-12 14:48:08Z allison $
//
//
// John Allison 15th May 2014.
// An artificial scene to dump touchable attributes.
#include "G4TouchableDumpScene.hh"
#include "G4VSolid.hh"
#include "G4Vector3D.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PhysicalVolumeModel.hh"
#include "G4AttValue.hh"
#include "G4AttCheck.hh"
G4TouchableDumpScene::G4TouchableDumpScene
(std::ostream& os,
G4PhysicalVolumeModel* pPVModel,
const G4ModelingParameters::PVNameCopyNoPath& requiredTouchable)
:fos(os)
,fpPVModel(pPVModel)
,fRequiredTouchable(requiredTouchable)
,fFound(false)
{}
G4TouchableDumpScene::~G4TouchableDumpScene () {}
void G4TouchableDumpScene::ProcessVolume (const G4VSolid&) {
const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>&
fullPVPath = fpPVModel->GetFullPVPath();
if (fRequiredTouchable.size() == fullPVPath.size()) {
// OK - there's a size match. Check it out.
// G4cout << "Size match" << G4endl;
G4ModelingParameters::PVNameCopyNoPathConstIterator iNameCopyNo;
std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>::const_iterator
iPVNodeId;
for (iNameCopyNo = fRequiredTouchable.begin(), iPVNodeId = fullPVPath.begin();
iNameCopyNo != fRequiredTouchable.end();
++iNameCopyNo, ++iPVNodeId) {
// G4cout
// << iNameCopyNo->GetName()
// << ',' << iNameCopyNo->GetCopyNo()
// << "; " << iPVNodeId->GetPhysicalVolume()->GetName()
// << ',' << iPVNodeId->GetPhysicalVolume()->GetCopyNo()
// << G4endl;
if (!(
iNameCopyNo->GetName() ==
iPVNodeId->GetPhysicalVolume()->GetName() &&
iNameCopyNo->GetCopyNo() ==
iPVNodeId->GetPhysicalVolume()->GetCopyNo()
)) {
break;
}
}
if (iNameCopyNo == fRequiredTouchable.end()) {
// G4cout << "Match found" << G4endl;
fFound = true;
const std::map<G4String,G4AttDef>* attDefs = fpPVModel->GetAttDefs();
std::vector<G4AttValue>* attValues = fpPVModel->CreateCurrentAttValues();
fos << G4AttCheck(attValues, attDefs);
delete attValues;
fpPVModel->Abort(); // No need to look further.
}
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4TrajectoriesModel.cc 68043 2013-03-13 14:27:49Z gcosmo $
// $Id: G4TrajectoriesModel.cc 87360 2014-12-01 16:07:16Z gcosmo $
//
//
// John Allison 26th August 1998.
@@ -34,16 +34,23 @@
#include "G4ModelingParameters.hh"
#include "G4VGraphicsScene.hh"
#include "G4RunManager.hh"
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#endif
#include "G4Run.hh"
#include "G4Event.hh"
#include "G4AttDefStore.hh"
#include "G4AttValue.hh"
#include "G4AttDef.hh"
#include "G4AttCheck.hh"
#include "G4UIcommand.hh"
#include "G4VVisManager.hh"
G4TrajectoriesModel::G4TrajectoriesModel ():
fpCurrentTrajectory(0),
fEventID(0)
G4TrajectoriesModel::G4TrajectoriesModel ()
:fpCurrentTrajectory(0)
,fRunID(-1)
,fEventID(-1)
{
fType = "G4TrajectoriesModel";
fGlobalTag = "G4TrajectoriesModel for all trajectories.";
@@ -54,11 +61,26 @@ G4TrajectoriesModel::~G4TrajectoriesModel () {}
void G4TrajectoriesModelDebugG4AttValues(const G4VTrajectory*);
#include "G4VVisManager.hh"
void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler)
{
G4RunManager* runManager = G4RunManager::GetRunManager();
#ifdef G4MULTITHREADED
if(G4Threading::IsMultithreadedApplication())
{ runManager = G4MTRunManager::GetMasterRunManager(); }
#endif
const G4Run* currentRun = runManager->GetCurrentRun();
if (currentRun) {
fRunID = currentRun->GetRunID();
} else {
fRunID = -1;
}
const G4Event* event = fpMP->GetEvent();
if (!event) return;
if (event) {
fEventID = event->GetEventID();
} else {
fEventID = -1;
}
G4TrajectoryContainer* TC = event -> GetTrajectoryContainer ();
if (!TC) return;
@@ -66,8 +88,6 @@ void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler)
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if (!pVVisManager) return;
fEventID = event->GetEventID();
pVVisManager->BeginDraw();
// The use of Begin/EndDraw (optional methods to improve drawing
// speed) assumes all trajectories are drawn with the same
@@ -91,6 +111,8 @@ const std::map<G4String,G4AttDef>* G4TrajectoriesModel::GetAttDefs() const
std::map<G4String,G4AttDef>* store
= G4AttDefStore::GetInstance("G4TrajectoriesModel", isNew);
if (isNew) {
(*store)["RunID"] =
G4AttDef("RunID","Run ID","Physics","","G4int");
(*store)["EventID"] =
G4AttDef("EventID","Event ID","Physics","","G4int");
}
@@ -101,6 +123,8 @@ std::vector<G4AttValue>* G4TrajectoriesModel::CreateCurrentAttValues() const
{
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
values->push_back
(G4AttValue("RunID",G4UIcommand::ConvertToString(fRunID),""));
values->push_back
(G4AttValue("EventID",G4UIcommand::ConvertToString(fEventID),""));
return values;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawByAttribute.cc 68732 2013-04-05 09:44:10Z gcosmo $
// $Id: G4TrajectoryDrawByAttribute.cc 78838 2014-01-28 08:46:17Z gcosmo $
//
// Jane Tinslay August 2006
//
@@ -95,7 +95,7 @@ G4TrajectoryDrawByAttribute::Draw(const G4VTrajectory& object,
("G4TrajectoryDrawByAttribute::Draw",
"modeling0117", JustWarning, ed, ". Invalid attribute name");
G4cout << "Available attributes:\n"
<< object.GetAttDefs();
<< *object.GetAttDefs();
warnedUnableToExtract = true;
}
return;
@@ -133,7 +133,7 @@ G4TrajectoryDrawByAttribute::Draw(const G4VTrajectory& object,
("G4TrajectoryDrawByAttribute::Draw",
"modeling0118", JustWarning, ed, ". Invalid attribute name");
G4cout << "Available attributes:\n"
<< object.GetAttDefs();
<< *object.GetAttDefs();
warnedUnableToExtract = true;
}
return;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawerUtils.cc 66870 2013-01-14 23:38:59Z adotti $
// $Id: G4TrajectoryDrawerUtils.cc 83403 2014-08-21 15:07:30Z gcosmo $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -123,6 +123,7 @@ namespace G4TrajectoryDrawerUtils {
validity = InvalidTimes;
}
}
delete trajectoryPointAttValues; // (Must be deleted after use.)
}
const std::vector<G4ThreeVector>* auxiliaries