Import Geant4 10.4.0.beta source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History 102778 2017-02-22 10:50:10Z gcosmo $
|
||||
$Id: History 104015 2017-05-08 07:28:08Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -24,7 +24,50 @@ committal in the CVS repository !
|
||||
History file for Ray Tracer category
|
||||
---------------------------------------
|
||||
|
||||
22nd February 2017 John Allison (raytracer-V10-02-02)
|
||||
7th May 2017 John Allison (raytracer-V10-03-04)
|
||||
- G4RayTracerViewer.cc:
|
||||
o Expanded filename numbering to 4 digits, zero filled, e.g.,
|
||||
g4RayTracer.viewer-1_0000.jpeg
|
||||
g4RayTracer.viewer-1_0001.jpeg
|
||||
etc.
|
||||
o Useful for producing many files for a movie.
|
||||
|
||||
5th May 2017 John Allison (raytracer-V10-03-03)
|
||||
- Pick up vis attributes of the geometry from the vis scene (G4Scene).
|
||||
Make a map of the vis attributes by touchable path from the G4Scene in
|
||||
G4RayTracerSceneHandler. When a touchable is encountered in the Ray
|
||||
Tracer, pick up the vis attributes from the map instead of from the
|
||||
geometry tree. For simple use, for example
|
||||
/vis/open RayTracer # or RayTracerX
|
||||
/vis/drawVolume
|
||||
/vis/viewer/flush
|
||||
the result will be the same as before. But when a user selects a
|
||||
sub-component, for example
|
||||
/vs/drawVolume Shape1
|
||||
the Ray Tracer will now draw only Shape1. The Ray Tracer will also
|
||||
follow changes made in other viewers by copying the view. For example
|
||||
the user can chose a viewing angle and zoom, and change the visibility
|
||||
and colour of volumes, using, say, a Qt viewer (say viewer-0), and see
|
||||
the effect in the Ray Tracer:
|
||||
/vis/open RayTracer # Gets the same scene as the Qt viewer
|
||||
/vis/viewer/copyViewFrom viewer-0 # Copies camera parameters, or...
|
||||
/vis/viewer/set/all viewer-0 # ...copies all parameters
|
||||
/vis/viewerflush
|
||||
|
||||
19th February 2017 John Allison (raytracer-V10-03-02)
|
||||
- G4RTXScanner.cc:
|
||||
o Changed back to XA_RGB_BEST_MAP. (I don't know what was going on
|
||||
but it seems OK now.)
|
||||
- G4RayTracer.cc and G4RayTracerViewer.cc:
|
||||
o The ray tracer pointer is now passed from G4RayTracer to
|
||||
G4RayTracerViewer so that there is no need to instantiate it there.
|
||||
This works for both sequential and MT modes. (G4RayTracerViewer.cc
|
||||
no longer has any need for special action for G4MULTITHREADED - it
|
||||
is all done in G4RayTracer.cc.)
|
||||
o Introduced G4RayTracerViewer::Initialise. Fixes a bug whereby the
|
||||
jpeg for RayTracer was always 600x600.
|
||||
|
||||
22nd February 2017 John Allison (raytracer-V10-03-00)
|
||||
- G4RTXScanner.cc: Changed XA_RGB_BEST_MAP to XA_RGB_DEFAULT_MAP.
|
||||
(It seems XA_RGB_BEST_MAP no longer available on Mac XQuartz 2.7.11.)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerSceneHandler.hh 99152 2016-09-07 08:04:30Z gcosmo $
|
||||
// $Id: G4RayTracerSceneHandler.hh 104015 2017-05-08 07:28:08Z gcosmo $
|
||||
|
||||
// John Allison 17th March 2000
|
||||
|
||||
@@ -33,14 +33,24 @@
|
||||
|
||||
#include "G4VSceneHandler.hh"
|
||||
|
||||
class G4RayTracerSceneHandler: public G4VSceneHandler {
|
||||
#include "G4ModelingParameters.hh"
|
||||
#include <map>
|
||||
|
||||
class G4RayTracerSceneHandler: public G4VSceneHandler
|
||||
{
|
||||
public:
|
||||
|
||||
G4RayTracerSceneHandler(G4VGraphicsSystem& system,
|
||||
const G4String& name = "");
|
||||
virtual ~G4RayTracerSceneHandler();
|
||||
|
||||
void BuildVisAttsMap (const G4VSolid& solid);
|
||||
// BuildVisAttsMap is the appropriate name for what it does in this class
|
||||
// but it is actually an override of G4VSceneHandler::RequestPrimitives.
|
||||
void RequestPrimitives (const G4VSolid& solid)
|
||||
{BuildVisAttsMap(solid);}
|
||||
|
||||
// Required pure virtual functions, not used in Ray Tracer.
|
||||
void AddPrimitive(const G4Polyline&){}
|
||||
void AddPrimitive(const G4Text&){}
|
||||
void AddPrimitive(const G4Circle&){}
|
||||
@@ -49,27 +59,26 @@ public:
|
||||
void AddPrimitive(const G4Polymarker&){}
|
||||
void AddPrimitive(const G4Scale&){}
|
||||
|
||||
void AddSolid(const G4Box&){}
|
||||
void AddSolid(const G4Cons&){}
|
||||
void AddSolid(const G4Tubs&){}
|
||||
void AddSolid(const G4Trd&){}
|
||||
void AddSolid(const G4Trap&){}
|
||||
void AddSolid(const G4Sphere&){}
|
||||
void AddSolid(const G4Para&){}
|
||||
void AddSolid(const G4Torus&){}
|
||||
void AddSolid(const G4Polycone&){}
|
||||
void AddSolid(const G4Polyhedra&){}
|
||||
void AddSolid(const G4Orb&){}
|
||||
void AddSolid(const G4Ellipsoid&){}
|
||||
void AddSolid(const G4VSolid&){}
|
||||
void AddCompound(const G4VTrajectory&){}
|
||||
void AddCompound(const G4VHit&){}
|
||||
void AddCompound(const G4VDigi&){}
|
||||
void AddCompound(const G4THitsMap<G4double>&) {}
|
||||
void AddCompound(const G4THitsMap<G4StatDouble>&) {}
|
||||
void ClearStore ();
|
||||
|
||||
struct PathLessThan
|
||||
{G4bool operator()
|
||||
(const G4ModelingParameters::PVPointerCopyNoPath&,
|
||||
const G4ModelingParameters::PVPointerCopyNoPath&) const;
|
||||
};
|
||||
|
||||
const std::map
|
||||
<G4ModelingParameters::PVPointerCopyNoPath,G4VisAttributes,PathLessThan>&
|
||||
GetSceneVisAttsMap() const
|
||||
{return fSceneVisAttsMap;}
|
||||
|
||||
private:
|
||||
static G4int fSceneIdCount; // Counter for RayTracer scene handlers.
|
||||
|
||||
static G4int fSceneIdCount; // Counter for RayTracer scene handlers.
|
||||
|
||||
std::map
|
||||
<G4ModelingParameters::PVPointerCopyNoPath,G4VisAttributes,PathLessThan>
|
||||
fSceneVisAttsMap;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerViewer.hh 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4RayTracerViewer.hh 103626 2017-04-19 13:29:18Z gcosmo $
|
||||
|
||||
// John Allison 17th March 2000
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
const G4String& name,
|
||||
G4TheRayTracer* = 0);
|
||||
virtual ~G4RayTracerViewer();
|
||||
void Initialise();
|
||||
void SetView();
|
||||
void ClearView();
|
||||
void DrawView();
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
//G4RTRun.cc
|
||||
///////////////////////
|
||||
|
||||
#include "G4RTRun.hh"
|
||||
#include "G4RTRun.hh"
|
||||
#include "G4TheMTRayTracer.hh"
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RTSteppingAction.cc 74050 2013-09-20 09:38:19Z gcosmo $
|
||||
// $Id: G4RTSteppingAction.cc 104015 2017-05-08 07:28:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "G4RTSteppingAction.hh"
|
||||
|
||||
#include "G4RayTracerSceneHandler.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4VisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
@@ -50,27 +51,42 @@ void G4RTSteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
// Stop the ray particle if it reaches to the coloured volume with its alpha = 1
|
||||
// or coloured volume and the user request to ignore transparency
|
||||
|
||||
G4StepPoint* fpStepPoint = aStep -> GetPostStepPoint();
|
||||
G4VPhysicalVolume* postVolume_phys=fpStepPoint->GetPhysicalVolume();
|
||||
G4StepPoint* postStepPoint = aStep -> GetPostStepPoint();
|
||||
|
||||
G4VPhysicalVolume* postVolume_phys=postStepPoint->GetPhysicalVolume();
|
||||
if(!postVolume_phys) return; // Reach to out of the world
|
||||
|
||||
const G4LogicalVolume* postVolume_log = postVolume_phys->GetLogicalVolume();
|
||||
const G4VisAttributes* postVisAtt = postVolume_log -> GetVisAttributes();
|
||||
G4VisManager* visManager = G4VisManager::GetInstance();
|
||||
if(visManager) {
|
||||
G4VViewer* viewer = visManager->GetCurrentViewer();
|
||||
if (viewer) {
|
||||
postVisAtt = viewer->GetApplicableVisAttributes(postVisAtt);
|
||||
}
|
||||
}
|
||||
if((!postVisAtt) || (!(postVisAtt->IsVisible()))) return; // Invisible volume, continue tracking
|
||||
G4RayTracerSceneHandler* sceneHandler =
|
||||
static_cast<G4RayTracerSceneHandler*>(visManager->GetCurrentSceneHandler());
|
||||
|
||||
if((postVisAtt->IsForceDrawingStyle())
|
||||
&&(postVisAtt->GetForcedDrawingStyle()==G4VisAttributes::wireframe)) return;
|
||||
// Make a path from the touchable
|
||||
const G4VTouchable* postTouchable = postStepPoint->GetTouchable();
|
||||
G4int postDepth = postTouchable->GetHistoryDepth();
|
||||
G4ModelingParameters::PVPointerCopyNoPath localPostPVPointerCopyNoPath;
|
||||
for (G4int i = postDepth; i >= 0; --i) {
|
||||
localPostPVPointerCopyNoPath.push_back
|
||||
(G4ModelingParameters::PVPointerCopyNo
|
||||
(postTouchable->GetVolume(i),postTouchable->GetCopyNumber(i)));
|
||||
}
|
||||
|
||||
// Pick up the vis atts, if any, from the scene handler
|
||||
const auto& sceneVisAttsMap = sceneHandler->GetSceneVisAttsMap();
|
||||
auto postIterator = sceneVisAttsMap.find(localPostPVPointerCopyNoPath);
|
||||
const G4VisAttributes* postVisAtts;
|
||||
if (postIterator != sceneVisAttsMap.end()) {
|
||||
postVisAtts = &postIterator->second;
|
||||
} else {
|
||||
postVisAtts = 0;
|
||||
}
|
||||
|
||||
if((!postVisAtts) || (!(postVisAtts->IsVisible()))) return; // Invisible volume, continue tracking
|
||||
|
||||
if((postVisAtts->IsForceDrawingStyle())
|
||||
&&(postVisAtts->GetForcedDrawingStyle()==G4VisAttributes::wireframe)) return;
|
||||
// Wire frame volume, continue tracking
|
||||
|
||||
G4double postAlpha=(postVisAtt->GetColour()).GetAlpha();
|
||||
G4double postAlpha=(postVisAtts->GetColour()).GetAlpha();
|
||||
|
||||
if(postAlpha==1.0 || ignoreTransparency) // Stop stepping
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RTXScanner.cc 102778 2017-02-22 10:50:10Z gcosmo $
|
||||
// $Id: G4RTXScanner.cc 103626 2017-04-19 13:29:18Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -177,16 +177,16 @@ G4bool G4RTXScanner::GetXWindow(const G4String& name, G4ViewParameters& vp)
|
||||
int nMaps;
|
||||
Status status = XGetRGBColormaps
|
||||
(display, RootWindow(display, screen_num),
|
||||
&scmap, &nMaps, XA_RGB_DEFAULT_MAP);
|
||||
&scmap, &nMaps, XA_RGB_BEST_MAP);
|
||||
if (!status) {
|
||||
system("xstdcmap -best"); // ...and try again...
|
||||
status = XGetRGBColormaps
|
||||
(display, RootWindow(display, screen_num),
|
||||
&scmap, &nMaps, XA_RGB_DEFAULT_MAP);
|
||||
&scmap, &nMaps, XA_RGB_BEST_MAP);
|
||||
if (!status) {
|
||||
G4cerr <<
|
||||
"G4RTXScanner::Initialize(): cannot get color map."
|
||||
"\n Perhaps your system does not support XA_RGB_DEFAULT_MAP."
|
||||
"\n Perhaps your system does not support XA_RGB_BEST_MAP."
|
||||
<< G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracer.cc 74050 2013-09-20 09:38:19Z gcosmo $
|
||||
// $Id: G4RayTracer.cc 103626 2017-04-19 13:29:18Z gcosmo $
|
||||
|
||||
#include "G4RayTracer.hh"
|
||||
#include "G4RayTracerFeatures.hh"
|
||||
@@ -61,7 +61,8 @@ G4VSceneHandler* G4RayTracer::CreateSceneHandler (const G4String& name) {
|
||||
|
||||
G4VViewer* G4RayTracer::CreateViewer (G4VSceneHandler& sceneHandler,
|
||||
const G4String& name) {
|
||||
G4VViewer* pViewer = new G4RayTracerViewer (sceneHandler, name);
|
||||
G4VViewer* pViewer = new G4RayTracerViewer
|
||||
(sceneHandler, name, theRayTracer);
|
||||
if (pViewer) {
|
||||
if (pViewer->GetViewId() < 0) {
|
||||
G4cout <<
|
||||
|
||||
@@ -24,17 +24,20 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerSceneHandler.cc 66870 2013-01-14 23:38:59Z adotti $
|
||||
// $Id: G4RayTracerSceneHandler.cc 104015 2017-05-08 07:28:08Z gcosmo $
|
||||
|
||||
#include "G4RayTracerSceneHandler.hh"
|
||||
|
||||
#include "G4VisManager.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
|
||||
G4int G4RayTracerSceneHandler::fSceneIdCount = 0;
|
||||
|
||||
G4RayTracerSceneHandler::G4RayTracerSceneHandler(G4VGraphicsSystem& system,
|
||||
const G4String& name):
|
||||
G4VSceneHandler(system, fSceneIdCount++, name)
|
||||
const G4String& name)
|
||||
: G4VSceneHandler(system, fSceneIdCount++, name)
|
||||
{
|
||||
// Ray Tracer does not use the vis concept of scene (G4Scene) - keep
|
||||
// vis manager happy when someone opens a ray tracer with "/vis/open
|
||||
// Keep vis manager happy when someone opens a ray tracer with "/vis/open
|
||||
// RayTracer" but uses the ray tracer with "/vis/rayTracer" commands
|
||||
// before creating any scenes, for example, instead of using
|
||||
// "/vis/drawVolume"...
|
||||
@@ -58,4 +61,55 @@ G4RayTracerSceneHandler::G4RayTracerSceneHandler(G4VGraphicsSystem& system,
|
||||
G4RayTracerSceneHandler::~G4RayTracerSceneHandler()
|
||||
{}
|
||||
|
||||
G4int G4RayTracerSceneHandler::fSceneIdCount = 0;
|
||||
void G4RayTracerSceneHandler::ClearStore()
|
||||
{
|
||||
fSceneVisAttsMap.clear();
|
||||
}
|
||||
|
||||
G4bool G4RayTracerSceneHandler::PathLessThan::operator()
|
||||
(const G4ModelingParameters::PVPointerCopyNoPath& a,
|
||||
const G4ModelingParameters::PVPointerCopyNoPath& b) const
|
||||
{
|
||||
if (a.size() != b.size()) return a.size() < b.size();
|
||||
auto ia = a.begin();
|
||||
auto ib = b.begin();
|
||||
for (; ia != a.end(); ++ia, ++ib) {
|
||||
if (ia->GetPVPointer() < ib->GetPVPointer()) return true;
|
||||
if (ia->GetPVPointer() > ib->GetPVPointer()) return false;
|
||||
// Pointers equal
|
||||
if (ia->GetCopyNo() < ib->GetCopyNo()) return true;
|
||||
if (ia->GetCopyNo() > ib->GetCopyNo()) return false;
|
||||
// Both pointers and copy no are equal - continue
|
||||
}
|
||||
// Equality
|
||||
return false;
|
||||
}
|
||||
|
||||
void G4RayTracerSceneHandler::BuildVisAttsMap (const G4VSolid&)
|
||||
{
|
||||
// Build map of vis attributes
|
||||
|
||||
G4PhysicalVolumeModel* fpPVModel = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
|
||||
if (fpPVModel) {
|
||||
G4ModelingParameters::PVPointerCopyNoPath temp;
|
||||
for (const auto& nodeID: fpPVModel->GetFullPVPath()) {
|
||||
// Build an element from the nodeid.
|
||||
temp.push_back(G4ModelingParameters::PVPointerCopyNo(nodeID));
|
||||
}
|
||||
const G4VisAttributes* pVisAtts = fpVisAttribs;
|
||||
if (!pVisAtts) {
|
||||
// Shouldn't happen.
|
||||
if (G4VisManager::GetInstance()->GetVerbosity() >= G4VisManager::warnings) {
|
||||
G4cout <<
|
||||
"WARNING: G4RayTracerSceneHandler::BuildVisAttsMap: null vis atts pointer."
|
||||
"\n Using a default vis atts."
|
||||
<< G4endl;
|
||||
}
|
||||
static const G4VisAttributes defaultVisAtts;
|
||||
pVisAtts = &defaultVisAtts;
|
||||
}
|
||||
// Copy vis atts into the vis atts map
|
||||
fSceneVisAttsMap[temp] = *pVisAtts;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,12 +24,14 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerViewer.cc 74050 2013-09-20 09:38:19Z gcosmo $
|
||||
// $Id: G4RayTracerViewer.cc 104015 2017-05-08 07:28:08Z gcosmo $
|
||||
|
||||
#include "G4RayTracerViewer.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include "G4VSceneHandler.hh"
|
||||
@@ -37,30 +39,29 @@
|
||||
#include "G4TheRayTracer.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
#include "G4TheMTRayTracer.hh"
|
||||
#endif
|
||||
|
||||
G4RayTracerViewer::G4RayTracerViewer
|
||||
(G4VSceneHandler& sceneHandler,
|
||||
const G4String& name,
|
||||
G4TheRayTracer* aTracer):
|
||||
G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name),
|
||||
fFileCount(0)
|
||||
G4TheRayTracer* aTracer)
|
||||
: G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name)
|
||||
, fFileCount(0)
|
||||
, theTracer(aTracer)
|
||||
{
|
||||
theTracer = aTracer;
|
||||
#ifdef G4MULTITHREADED
|
||||
if (!aTracer) theTracer = G4TheMTRayTracer::theInstance;
|
||||
if (!theTracer) theTracer = new G4TheMTRayTracer;
|
||||
#else
|
||||
if (!aTracer) theTracer = new G4TheRayTracer;
|
||||
#endif
|
||||
theTracer->SetNColumn(fVP.GetWindowSizeHintX());
|
||||
theTracer->SetNRow(fVP.GetWindowSizeHintY());
|
||||
if (!theTracer) {
|
||||
G4cerr << "G4RayTracerViewer::Initialise: No tracer" << G4endl;
|
||||
fViewId = -1; // This flags an error.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
G4RayTracerViewer::~G4RayTracerViewer() {}
|
||||
|
||||
void G4RayTracerViewer::Initialise()
|
||||
{
|
||||
theTracer->SetNColumn(fVP.GetWindowSizeHintX());
|
||||
theTracer->SetNRow(fVP.GetWindowSizeHintY());
|
||||
}
|
||||
|
||||
void G4RayTracerViewer::SetView()
|
||||
{
|
||||
// Get radius of scene, etc. (See G4OpenGLViewer::SetView().)
|
||||
@@ -110,14 +111,16 @@ void G4RayTracerViewer::DrawView()
|
||||
<< fieldHalfAngle <<
|
||||
" radians."
|
||||
<< G4endl;
|
||||
SetView(); // Special graphics system - bypass ProcessView().
|
||||
SetView(); // With this fieldHalfAngle
|
||||
ProcessView();
|
||||
fVP.SetFieldHalfAngle(0.);
|
||||
}
|
||||
else {
|
||||
SetView(); // Special graphics system - bypass ProcessView().
|
||||
ProcessView();
|
||||
}
|
||||
std::ostringstream filename;
|
||||
filename << "g4RayTracer." << fShortName << '_' << fFileCount++ << ".jpeg";
|
||||
filename << "g4RayTracer." << fShortName << '_'
|
||||
<< std::setw(4) << std::setfill('0') << fFileCount++ << ".jpeg";
|
||||
theTracer->Trace(filename.str());
|
||||
|
||||
// Reset call flag
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerXViewer.cc 66373 2012-12-18 09:41:34Z gcosmo $
|
||||
// $Id: G4RayTracerXViewer.cc 104015 2017-05-08 07:28:08Z gcosmo $
|
||||
|
||||
#ifdef G4VIS_BUILD_RAYTRACERX_DRIVER
|
||||
|
||||
@@ -50,14 +50,7 @@ G4RayTracerXViewer::~G4RayTracerXViewer() {}
|
||||
|
||||
void G4RayTracerXViewer::Initialise() {
|
||||
|
||||
if (!theTracer) {
|
||||
G4cerr << "G4RayTracerXViewer::Initialise: No tracer" << G4endl;
|
||||
fViewId = -1; // This flags an error.
|
||||
return;
|
||||
}
|
||||
|
||||
theTracer->SetNColumn(fVP.GetWindowSizeHintX());
|
||||
theTracer->SetNRow(fVP.GetWindowSizeHintY());
|
||||
G4RayTracerViewer::Initialise();
|
||||
|
||||
// Set up X Window...
|
||||
G4RTXScanner* theXScanner = (G4RTXScanner*)theTracer->GetScanner();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTrajectory.cc 71495 2013-06-17 09:13:30Z gcosmo $
|
||||
// $Id: G4RayTrajectory.cc 104015 2017-05-08 07:28:08Z gcosmo $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "G4RayTrajectory.hh"
|
||||
#include "G4RayTrajectoryPoint.hh"
|
||||
#include "G4RayTracerSceneHandler.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4VisManager.hh"
|
||||
@@ -86,29 +87,52 @@ void G4RayTrajectory::AppendStep(const G4Step* aStep)
|
||||
= theNavigator->GetLocalToGlobalTransform().TransformAxis(theLocalNormal);
|
||||
trajectoryPoint->SetSurfaceNormal(theGrobalNormal);
|
||||
|
||||
G4VPhysicalVolume* prePhys = aStep->GetPreStepPoint()->GetPhysicalVolume();
|
||||
const G4VisAttributes* preVisAtt = prePhys->GetLogicalVolume()->GetVisAttributes();
|
||||
G4VisManager* visManager = G4VisManager::GetInstance();
|
||||
if(visManager) {
|
||||
G4VViewer* viewer = visManager->GetCurrentViewer();
|
||||
if (viewer) {
|
||||
preVisAtt = viewer->GetApplicableVisAttributes(preVisAtt);
|
||||
}
|
||||
}
|
||||
trajectoryPoint->SetPreStepAtt(preVisAtt);
|
||||
G4RayTracerSceneHandler* sceneHandler =
|
||||
static_cast<G4RayTracerSceneHandler*>(visManager->GetCurrentSceneHandler());
|
||||
const auto& sceneVisAttsMap = sceneHandler->GetSceneVisAttsMap();
|
||||
|
||||
const G4VPhysicalVolume* postPhys = aStep->GetPostStepPoint()->GetPhysicalVolume();
|
||||
const G4VisAttributes* postVisAtt = NULL;
|
||||
if(postPhys) {
|
||||
postVisAtt = postPhys->GetLogicalVolume()->GetVisAttributes();
|
||||
if(visManager) {
|
||||
G4VViewer* viewer = visManager->GetCurrentViewer();
|
||||
if (viewer) {
|
||||
postVisAtt = viewer->GetApplicableVisAttributes(postVisAtt);
|
||||
}
|
||||
}
|
||||
// Make a path from the preStepPoint touchable
|
||||
G4StepPoint* preStepPoint = aStep -> GetPreStepPoint();
|
||||
const G4VTouchable* preTouchable = preStepPoint->GetTouchable();
|
||||
G4int preDepth = preTouchable->GetHistoryDepth();
|
||||
G4ModelingParameters::PVPointerCopyNoPath localPrePVPointerCopyNoPath;
|
||||
for (G4int i = preDepth; i >= 0; --i) {
|
||||
localPrePVPointerCopyNoPath.push_back
|
||||
(G4ModelingParameters::PVPointerCopyNo
|
||||
(preTouchable->GetVolume(i),preTouchable->GetCopyNumber(i)));
|
||||
}
|
||||
trajectoryPoint->SetPostStepAtt(postVisAtt);
|
||||
|
||||
// Pick up the vis atts, if any, from the scene handler
|
||||
auto preIterator = sceneVisAttsMap.find(localPrePVPointerCopyNoPath);
|
||||
const G4VisAttributes* preVisAtts;
|
||||
if (preIterator != sceneVisAttsMap.end()) {
|
||||
preVisAtts = &preIterator->second;
|
||||
} else {
|
||||
preVisAtts = 0;
|
||||
}
|
||||
trajectoryPoint->SetPreStepAtt(preVisAtts);
|
||||
|
||||
// Make a path from the postStepPoint touchable
|
||||
G4StepPoint* postStepPoint = aStep -> GetPostStepPoint();
|
||||
const G4VTouchable* postTouchable = postStepPoint->GetTouchable();
|
||||
G4int postDepth = postTouchable->GetHistoryDepth();
|
||||
G4ModelingParameters::PVPointerCopyNoPath localPostPVPointerCopyNoPath;
|
||||
for (G4int i = postDepth; i >= 0; --i) {
|
||||
localPostPVPointerCopyNoPath.push_back
|
||||
(G4ModelingParameters::PVPointerCopyNo
|
||||
(postTouchable->GetVolume(i),postTouchable->GetCopyNumber(i)));
|
||||
}
|
||||
|
||||
// Pick up the vis atts, if any, from the scene handler
|
||||
auto postIterator = sceneVisAttsMap.find(localPostPVPointerCopyNoPath);
|
||||
const G4VisAttributes* postVisAtts;
|
||||
if (postIterator != sceneVisAttsMap.end()) {
|
||||
postVisAtts = &postIterator->second;
|
||||
} else {
|
||||
postVisAtts = 0;
|
||||
}
|
||||
trajectoryPoint->SetPostStepAtt(postVisAtts);
|
||||
|
||||
positionRecord->push_back(trajectoryPoint);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user