Import Geant4 9.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:25:56 +02:00
parent 74cad5e589
commit 89a9605df1
4440 changed files with 379508 additions and 189225 deletions
@@ -0,0 +1,20 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4visHepRep
# Package: Geant4.src.G4visualization.G4visHepRep
#
# CMakeLists.txt for single level library that may be build global or granular
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:11:49 bmorgan Exp $
#
#------------------------------------------------------------------------------
include(Geant4MacroLibraryTargets)
if(GEANT4_BUILD_GRANULAR_LIBS)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
else()
GEANT4_GLOBAL_LIBRARY_TARGET(COMPONENTS sources.cmake)
endif()
+14 -1
View File
@@ -1,4 +1,4 @@
.$Id: History,v 1.132 2009/11/23 05:42:28 perl Exp $
.$Id: History,v 1.136 2010/11/07 22:29:30 perl Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,19 @@ committal in the CVS repository !
History file for visualization/HepRep sub-category
--------------------------------------------------
7th November 2010 Joseph Perl (vis-HepRep-V09-03-04)
- G4HepRepFileSceneHandler.hh: Fix coverity warning about uninitialized variables. Turns out they were unneeded.
20th June 2010 Joseph Perl (vis-HepRep-V09-03-03)
- G4HepRepMessenger: Correct default of new option renderCylAsPolygons
4th June 2010 Joseph Perl (vis-HepRep-V09-03-02)
- G4HepRepMessenger: Add command renderCylAsPolygons
- G4HepRepFileSceneHandler: Use new command
30th May 2010 John Allison (vis-HepRep-V09-03-00)
- G4HepRep[File}SceneHandler: Added AddCompound(const G4VDigi&).
22nd November 2009 Joseph Perl (vis-HepRep-V09-02-03)
- Changed messenger to a singleton.
- Added messenger commands to HepRepFile.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4HepRepFileSceneHandler.hh,v 1.31 2009/10/21 15:08:35 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4HepRepFileSceneHandler.hh,v 1.33 2010/11/07 22:29:30 perl Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
//
// Joseph Perl 27th January 2002
@@ -84,6 +84,9 @@ public:
void AddCompound (const G4THitsMap<G4double>& hits) {
G4VSceneHandler::AddCompound(hits);
}
void AddCompound (const G4VDigi& digi) {
G4VSceneHandler::AddCompound(digi);
}
// void PreAddSolid(const G4Transform3D& objectTransformation,
// const G4VisAttributes&);
// void PostAddSolid();
@@ -140,17 +143,12 @@ private:
const G4Visible visible);
void CheckFileOpen();
int fileCounter;
char fileDir[256];
char fileName[256];
G4bool fileOverwrite;
G4bool cullInvisibleObjects;
G4bool haveVisible;
G4bool inPrimitives2D;
G4bool warnedAbout3DText;
G4bool warnedAbout2DMarkers;
G4bool drawingTraj;
G4bool doneInitTraj;
G4bool drawTrajPts;
G4bool drawingHit;
G4bool doneInitHit;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRepMessenger.hh,v 1.8 2009/11/23 05:42:28 perl Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4HepRepMessenger.hh,v 1.9 2010/06/05 06:25:03 perl Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
#ifndef G4HepRepMessenger_HH
@@ -50,6 +50,7 @@ class G4HepRepMessenger : public G4UImessenger {
virtual G4String getFileName();
virtual G4bool getOverwrite();
virtual G4bool getCullInvisibles();
virtual G4bool renderCylAsPolygons();
// Used by HepRepXML
virtual G4String getEventNumberSuffix();
@@ -75,7 +76,10 @@ class G4HepRepMessenger : public G4UImessenger {
G4bool cullInvisibles;
G4UIcmdWithABool* setCullInvisiblesCommand;
G4bool cylAsPolygons;
G4UIcmdWithABool* renderCylAsPolygonsCommand;
G4String suffix;
G4UIcmdWithAString* setEventNumberSuffixCommand;
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRepSceneHandler.hh,v 1.44 2009/11/23 05:42:28 perl Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4HepRepSceneHandler.hh,v 1.45 2010/05/30 10:28:02 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
/**
@@ -82,6 +82,9 @@ class G4HepRepSceneHandler: public G4VSceneHandler {
void AddCompound (const G4VTrajectory&);
void AddCompound (const G4VHit& hit);
void AddCompound (const G4VDigi& digi) {
G4VSceneHandler::AddCompound(digi);
}
void AddCompound (const G4THitsMap<G4double>& hits) {
G4VSceneHandler::AddCompound(hits);
}
+110
View File
@@ -0,0 +1,110 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4visHepRep
# Package: Geant4.src.G4visualization.G4visHepRep
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.2 2010/09/30 13:50:34 bmorgan Exp $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/CSG/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/solids/specific/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/graphics_reps/include)
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
include_directories(${CMAKE_SOURCE_DIR}/source/tracking/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/externals/zlib/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/visualization/modeling/include)
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4visHepRep
HEADERS
G4HepRep.hh
G4HepRepFile.hh
G4HepRepFileSceneHandler.hh
G4HepRepFileViewer.hh
G4HepRepFileXMLWriter.hh
G4HepRepMessenger.hh
G4HepRepSceneHandler.hh
G4HepRepViewer.hh
SOURCES
BHepRepWriter.cc
DefaultHepRep.cc
DefaultHepRepAction.cc
DefaultHepRepAttDef.cc
DefaultHepRepAttValue.cc
DefaultHepRepAttribute.cc
DefaultHepRepDefinition.cc
DefaultHepRepFactory.cc
DefaultHepRepInstance.cc
DefaultHepRepInstanceTree.cc
DefaultHepRepPoint.cc
DefaultHepRepTreeID.cc
DefaultHepRepType.cc
DefaultHepRepTypeTree.cc
DeflateOutputStreamBuffer.cc
G4HepRep.cc
G4HepRepFile.cc
G4HepRepFileSceneHandler.cc
G4HepRepFileViewer.cc
G4HepRepFileXMLWriter.cc
G4HepRepMessenger.cc
G4HepRepSceneHandler.cc
G4HepRepViewer.cc
GZIPOutputStream.cc
GZIPOutputStreamBuffer.cc
IndentPrintWriter.cc
XMLHepRepFactory.cc
XMLHepRepWriter.cc
XMLWriter.cc
ZipOutputStream.cc
ZipOutputStreamBuffer.cc
GRANULAR_DEPENDENCIES
G4csg
G4geometrymng
G4globman
G4graphics_reps
G4hits
G4intercoms
G4materials
G4modeling
G4specsolids
G4tracking
G4vis_management
G4zlib
GLOBAL_DEPENDENCIES
G4digits_hits
G4geometry
G4global
G4graphics_reps
G4intercoms
G4materials
G4modeling
G4tracking
G4vis_management
G4zlib
LINK_LIBRARIES
)
# List any source specific properties here
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRepFileSceneHandler.cc,v 1.68 2009/12/16 17:51:21 gunter Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4HepRepFileSceneHandler.cc,v 1.69 2010/06/05 06:25:03 perl Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
//
// Joseph Perl 27th January 2002
@@ -209,10 +209,24 @@ void G4HepRepFileSceneHandler::AddSolid(const G4Cons& cons) {
PrintThings();
#endif
// HepRApp does not correctly represent the end faces of cones at
// non-standard angles, let the base class convert these solids to polygons.
CLHEP::HepRotation r = fpObjectTransformation->getRotation();
G4bool linedUpWithAnAxis = (std::fabs(r.phiX())<=.001 ||
std::fabs(r.phiY())<=.001 ||
std::fabs(r.phiZ())<=.001 ||
std::fabs(r.phiX()-pi)<=.001 ||
std::fabs(r.phiY()-pi)<=.001 ||
std::fabs(r.phiZ()-pi)<=.001);
//G4cout << "Angle X:" << r.phiX() << ", Angle Y:" << r.phiY() << ", Angle Z:" << r.phiZ() << G4endl;
//G4cout << "linedUpWithAnAxis:" << linedUpWithAnAxis << G4endl;
// HepRep does not have a primitive for a cut cone,
// so if this cone is cut, let the base class convert this
// solid to polygons.
if (cons.GetDeltaPhiAngle() < twopi) {
G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance();
if (cons.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis || messenger->renderCylAsPolygons())
{
G4VSceneHandler::AddSolid(cons); // Invoke default action.
} else {
@@ -277,7 +291,8 @@ void G4HepRepFileSceneHandler::AddSolid(const G4Tubs& tubs) {
// HepRep does not have a primitive for a cut cylinder,
// so if this cylinder is cut, let the base class convert this
// solid to polygons.
if (tubs.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis)
G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance();
if (tubs.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis || messenger->renderCylAsPolygons())
{
G4VSceneHandler::AddSolid(tubs); // Invoke default action.
} else {
@@ -291,8 +306,6 @@ void G4HepRepFileSceneHandler::AddSolid(const G4Tubs& tubs) {
haveVisible = false;
AddHepRepInstance("Cylinder", NULL);
G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance();
if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles())
return;
@@ -474,7 +487,6 @@ void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
dynamic_cast<G4TrajectoriesModel*>(fpModel);
if (!pTrModel) G4Exception
("G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&): Not a G4TrajectoriesModel.");
G4int drawingMode = pTrModel->GetDrawingMode();
// Pointers to hold trajectory attribute values and definitions.
std::vector<G4AttValue>* rawTrajAttValues = traj.CreateAttValues();
@@ -550,7 +562,7 @@ void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
// Take all TrajectoryPoint attDefs from first point of first trajectory.
// Would rather be able to get these attDefs without needing a reference from any
// particular point, but don't know how to do that.
if ((drawingMode!=0 || trajContext->GetDrawStepPts() || trajContext->GetDrawAuxPts())
if ((trajContext->GetDrawStepPts() || trajContext->GetDrawAuxPts())
&& traj.GetPointEntries()>0) {
G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0);
@@ -625,7 +637,7 @@ void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
drawingTraj = false;
// Draw step points.
if (drawingMode!=0 || trajContext->GetDrawStepPts()) {
if (trajContext->GetDrawStepPts()) {
if (!doneInitTraj)
InitTrajectory();
// Create Trajectory Points as a subType of Trajectories.
@@ -641,22 +653,13 @@ void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
G4int markSize;
G4bool visible;
G4bool square;
if (drawingMode==0) {
G4Colour colour = trajContext->GetStepPtsColour();
redness = colour.GetRed();
greenness = colour.GetGreen();
blueness = colour.GetBlue();
markSize = (G4int) trajContext->GetStepPtsSize();
visible = (G4int) trajContext->GetStepPtsVisible();
square = (trajContext->GetStepPtsType()==G4Polymarker::squares);
} else {
redness = 1.;
greenness = 1.;
blueness = 1.;
markSize = std::abs(drawingMode/1000);
visible = true;
square = false;
}
G4Colour colour = trajContext->GetStepPtsColour();
redness = colour.GetRed();
greenness = colour.GetGreen();
blueness = colour.GetBlue();
markSize = (G4int) trajContext->GetStepPtsSize();
visible = (G4int) trajContext->GetStepPtsVisible();
square = (trajContext->GetStepPtsType()==G4Polymarker::squares);
// Avoiding drawing anything black on black.
if (redness==0. && greenness==0. && blueness==0.) {
@@ -734,7 +737,7 @@ void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
}
// Draw Auxiliary Points
if (drawingMode!=0 || trajContext->GetDrawAuxPts()) {
if (trajContext->GetDrawAuxPts()) {
if (!doneInitTraj)
InitTrajectory();
// Create Trajectory Points as a subType of Trajectories.
@@ -750,22 +753,13 @@ void G4HepRepFileSceneHandler::AddCompound (const G4VTrajectory& traj) {
G4int markSize;
G4bool visible;
G4bool square;
if (drawingMode==0) {
G4Colour colour = trajContext->GetAuxPtsColour();
redness = colour.GetRed();
greenness = colour.GetGreen();
blueness = colour.GetBlue();
markSize = (G4int) trajContext->GetAuxPtsSize();
visible = (G4int) trajContext->GetAuxPtsVisible();
square = (trajContext->GetAuxPtsType()==G4Polymarker::squares);
} else {
redness = 1.;
greenness = 1.;
blueness = 1.;
markSize = std::abs(drawingMode/1000);
visible = true;
square = false;
}
G4Colour colour = trajContext->GetAuxPtsColour();
redness = colour.GetRed();
greenness = colour.GetGreen();
blueness = colour.GetBlue();
markSize = (G4int) trajContext->GetAuxPtsSize();
visible = (G4int) trajContext->GetAuxPtsVisible();
square = (trajContext->GetAuxPtsType()==G4Polymarker::squares);
// Avoiding drawing anything black on black.
if (redness==0. && greenness==0. && blueness==0.) {
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRepMessenger.cc,v 1.11 2009/11/23 05:42:28 perl Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4HepRepMessenger.cc,v 1.13 2010/06/21 04:43:07 perl Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
#include "G4HepRepMessenger.hh"
@@ -43,6 +43,7 @@ G4HepRepMessenger::G4HepRepMessenger() :
fileName("G4Data"),
overwrite(false),
cullInvisibles(false),
cylAsPolygons(false),
suffix (""),
geometry(true),
solids(true),
@@ -100,6 +101,13 @@ G4HepRepMessenger::G4HepRepMessenger() :
}
setCullInvisiblesCommand->AvailableForStates(G4State_Idle);
renderCylAsPolygonsCommand = new G4UIcmdWithABool("/vis/heprep/renderCylAsPolygons", this);
renderCylAsPolygonsCommand->SetGuidance("Render cylinders and cones as polygons.");
renderCylAsPolygonsCommand->SetGuidance("This command is used by HepRepFile, not by HepRepXML.");
renderCylAsPolygonsCommand->SetParameterName("flag",false);
renderCylAsPolygonsCommand->SetDefaultValue(false);
renderCylAsPolygonsCommand->AvailableForStates(G4State_Idle);
setEventNumberSuffixCommand = new G4UIcmdWithAString("/vis/heprep/setEventNumberSuffix", this);
setEventNumberSuffixCommand->SetGuidance("Write separate event files, appended with given suffix.");
setEventNumberSuffixCommand->SetGuidance("Define the suffix with a pattern such as '-0000'.");
@@ -121,13 +129,13 @@ G4HepRepMessenger::G4HepRepMessenger() :
addPointAttributesCommand->SetParameterName("flag",false);
addPointAttributesCommand->SetDefaultValue(false);
addPointAttributesCommand->AvailableForStates(G4State_Idle);
useSolidsCommand = new G4UIcmdWithABool("/vis/heprep/useSolids", this);
useSolidsCommand->SetGuidance("Use HepRep Solids, rather than Geant4 Primitives.");
useSolidsCommand->SetGuidance("This command is used by HepRepXML, not by HepRepFile.");
useSolidsCommand->SetParameterName("flag",false);
useSolidsCommand->SetDefaultValue(true);
useSolidsCommand->AvailableForStates(G4State_Idle);
useSolidsCommand = new G4UIcmdWithABool("/vis/heprep/useSolids", this);
useSolidsCommand->SetGuidance("Use HepRep Solids, rather than Geant4 Primitives.");
useSolidsCommand->SetGuidance("This command is used by HepRepXML, not by HepRepFile..");
useSolidsCommand->SetParameterName("flag",false);
useSolidsCommand->SetDefaultValue(true);
useSolidsCommand->AvailableForStates(G4State_Idle);
}
G4HepRepMessenger::~G4HepRepMessenger() {
@@ -135,6 +143,7 @@ G4HepRepMessenger::~G4HepRepMessenger() {
delete setFileNameCommand;
delete setOverwriteCommand;
delete setCullInvisiblesCommand;
delete renderCylAsPolygonsCommand;
delete setEventNumberSuffixCommand;
delete appendGeometryCommand;
delete addPointAttributesCommand;
@@ -151,6 +160,8 @@ G4String G4HepRepMessenger::GetCurrentValue(G4UIcommand * command) {
return overwrite;
} else if (command==setCullInvisiblesCommand) {
return cullInvisibles;
} else if (command==renderCylAsPolygonsCommand) {
return renderCylAsPolygonsCommand->ConvertToString(cylAsPolygons);
} else if (command==setEventNumberSuffixCommand) {
return suffix;
} else if (command==appendGeometryCommand) {
@@ -173,6 +184,8 @@ void G4HepRepMessenger::SetNewValue(G4UIcommand * command, G4String newValue) {
overwrite = setOverwriteCommand->GetNewBoolValue(newValue);
} else if (command==setCullInvisiblesCommand) {
cullInvisibles = setCullInvisiblesCommand->GetNewBoolValue(newValue);
} else if (command==renderCylAsPolygonsCommand) {
cylAsPolygons = renderCylAsPolygonsCommand->GetNewBoolValue(newValue);
} else if (command==setEventNumberSuffixCommand) {
suffix = newValue;
} else if (command==appendGeometryCommand) {
@@ -200,6 +213,10 @@ G4bool G4HepRepMessenger::getCullInvisibles() {
return cullInvisibles;
}
G4bool G4HepRepMessenger::renderCylAsPolygons() {
return cylAsPolygons;
}
G4String G4HepRepMessenger::getEventNumberSuffix() {
return suffix;
}