Import Geant4 8.0.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile,v 1.9 2004/06/11 14:30:49 gcosmo Exp $
|
||||
# $Id: GNUmakefile,v 1.11 2005/11/18 23:07:04 allison Exp $
|
||||
|
||||
name := G4RayTracer
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.25 2004/06/11 15:23:39 gcosmo Exp $
|
||||
$Id: History,v 1.39 2005/12/05 06:44:10 perl Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -24,6 +24,45 @@ committal in the CVS repository !
|
||||
History file for visualization category
|
||||
---------------------------------------
|
||||
|
||||
4th December 2005 Makoto Asai (raytracer-V07-01-08)
|
||||
- Correct initialization of G4RTTrackingAction and G4RTSteppingAction
|
||||
|
||||
28th November 2005 Jane Tinslay (raytracer-V07-01-07)
|
||||
- Remove names of unused parameters to stop compiler warnings
|
||||
|
||||
18th November 2005 John Allison (raytracer-V07-01-06)
|
||||
- Merged in raytracer-V07-01-04 - see below.
|
||||
- Implemented window positioning.
|
||||
|
||||
28th October 2005 Makoto Asai (raytracer-V07-01-05)
|
||||
- Working tag for merging "envelope" into G4Region.
|
||||
- This tag does not contain raytracer-V07-01-04 tag that might be
|
||||
already done by J. Allison but does not yet appear on this file.
|
||||
|
||||
13th October September 2005 John Allison (raytracer-V07-01-04)
|
||||
(On branch raytracer-V07-01-01-branch; changes *not* merged into head -
|
||||
need to cvs update -j raytracer-V07-01-02 -j raytracer-V07-01-01-branch.)
|
||||
- Migrated to <sstream>.
|
||||
- Default background black - can be changed by /vis/viewer/set/background.
|
||||
- GNUmakefile: Removed temporary CPPFLAGS += -DG4VIS_BUILD_RAYTRACERX_DRIVER.
|
||||
|
||||
30th September 2005 Joseph Perl (raytracer-V07-01-03)
|
||||
New tag to include change Makoto made an hour after V07-01-02 was tagged.
|
||||
Change seems to just involve passing pWorld to material list where no argument was passed in previous version.
|
||||
|
||||
16th September 2005 John Allison (raytracer-V07-01-02)
|
||||
(On branch raytracer-V07-01-01-branch; changes merged into head.)
|
||||
- Bug fix (black holes): Made small epsilon push into world to ensure inside.
|
||||
|
||||
20th July 2005 John Allison (raytracer-V07-01-01)
|
||||
- Protected RayTracerX by G4VIS macro.
|
||||
|
||||
17th July 2005 John Allison (raytracer-V07-01-00)
|
||||
- Introduced RayTracerX. RayTracerX opens an X window and builds up
|
||||
the picture, refining it gradually. Already calculated pixels are
|
||||
not recalculated, so it is as efficient as a top-to-bottom raster
|
||||
scan. It produces a jpeg file as well, just like RayTracer.
|
||||
|
||||
11th June 2004 Gabriele Cosmo (raytracer-V06-01-00)
|
||||
- Use global flag G4VIS_ALLOC_EXPORT to export extern symbols for DLLs.
|
||||
Modified GNUmakefile and rearranged usage of extern symbols in classes.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTJpeg.hh,v 1.5 2001/07/11 10:09:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTJpegCoder.hh,v 1.5 2001/07/11 10:09:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTJpegCoderTables.hh,v 1.5 2001/07/11 10:09:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
|
||||
// class description:
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTJpegMaker.hh,v 1.5 2001/07/11 10:09:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTMessenger.hh,v 1.5 2003/09/18 11:13:24 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTOutBitStream.hh,v 1.6 2001/07/11 10:09:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RTSimpleScanner.hh,v 1.1 2003/09/18 11:14:02 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4RTSimpleScanner.hh,v 1.2 2005/07/17 13:59:24 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -45,6 +45,14 @@ public: // with description
|
||||
// Compiler defaults for destructor, copy constructor and
|
||||
// assignmemt.
|
||||
|
||||
virtual const G4String& GetGSName() const;
|
||||
// Get name that acts as graphics system name.
|
||||
|
||||
virtual const G4String& GetGSNickname() const;
|
||||
// Get name that acts as graphics system nickname. It is this that
|
||||
// the user specifies on the /vis/open and /vis/sceneHandler/create
|
||||
// commands.
|
||||
|
||||
virtual void Initialize(G4int nRow, G4int nColumn);
|
||||
// Intialises scanner for window with nRow rows and nColumn columns.
|
||||
|
||||
@@ -54,6 +62,7 @@ public: // with description
|
||||
// last valid coordinate.
|
||||
|
||||
protected:
|
||||
G4String theGSName, theGSNickname;
|
||||
G4int theNRow, theNColumn, theIRow, theIColumn;
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTSteppingAction.hh,v 1.4 2001/07/11 10:09:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTTrackingAction.hh,v 1.5 2003/05/30 13:01:20 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RTXScanner.hh,v 1.2 2005/07/20 20:39:02 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
#ifdef G4VIS_BUILD_RAYTRACERX_DRIVER
|
||||
|
||||
#ifndef G4RTXScanner_H
|
||||
#define G4RTXScanner_H 1
|
||||
|
||||
// class description:
|
||||
//
|
||||
// G4RTXScanner
|
||||
// Provides a sequence of window coordinates suitable for a visible
|
||||
// window of ever increasing resolution.
|
||||
|
||||
#include "G4VRTScanner.hh"
|
||||
|
||||
class G4RayTracer;
|
||||
|
||||
class G4RTXScanner: public G4VRTScanner {
|
||||
|
||||
public: // with description
|
||||
|
||||
G4RTXScanner();
|
||||
|
||||
// Compiler defaults for destructor, copy constructor and
|
||||
// assignmemt.
|
||||
|
||||
virtual const G4String& GetGSName() const;
|
||||
// Get name that acts as graphics system name.
|
||||
|
||||
virtual const G4String& GetGSNickname() const;
|
||||
// Get name that acts as graphics system nickname. It is this that
|
||||
// the user specifies on the /vis/open and /vis/sceneHandler/create
|
||||
// commands.
|
||||
|
||||
virtual void Initialize(G4int nRow, G4int nColumn);
|
||||
// Intialises scanner for window with nRow rows and nColumn columns.
|
||||
|
||||
virtual G4bool Coords(G4int& iRow, G4int& iColumn);
|
||||
// Supplies coordinate (iRow,iColumn) and returns false when the
|
||||
// sequence has finished, i.e., on the call *after* suplying the
|
||||
// last valid coordinate.
|
||||
|
||||
virtual void Draw
|
||||
(unsigned char red, unsigned char green, unsigned char blue,
|
||||
G4RayTracer*);
|
||||
// Draw coloured square at current position.
|
||||
|
||||
protected:
|
||||
G4String theGSName, theGSNickname;
|
||||
G4int theNRow, theNColumn, theStep, theIRow, theIColumn;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayShooter.hh,v 1.3 2001/07/11 10:09:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
|
||||
// class description:
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracer.hh,v 1.9 2003/09/18 11:14:03 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerFeatures.hh,v 1.3 2001/07/11 10:09:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerSceneHandler.hh,v 1.8 2005/06/02 17:43:46 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
|
||||
// John Allison 17th March 2000
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerViewer.hh,v 1.4 2001/07/11 10:09:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4RayTracerViewer.hh,v 1.5 2005/07/17 13:59:24 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
|
||||
// John Allison 17th March 2000
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
void SetView();
|
||||
void ClearView();
|
||||
void DrawView();
|
||||
private:
|
||||
protected:
|
||||
G4int fFileCount;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerX.hh,v 1.2 2005/07/20 20:39:02 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 11th September 2003
|
||||
|
||||
#if defined (G4VIS_BUILD_RAYTRACERX_DRIVER) || (G4VIS_USE_RAYTRACERX)
|
||||
|
||||
#ifndef G4RAYTRACERX_HH
|
||||
#define G4RAYTRACERX_HH
|
||||
|
||||
// class description:
|
||||
//
|
||||
// G4RayTracerX
|
||||
// X window version of RayTracer (also produces jpeg file - see class
|
||||
// description for G4RayTracer).
|
||||
|
||||
#include "G4RayTracer.hh"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
class G4RayTracerX : public G4RayTracer
|
||||
{
|
||||
public:
|
||||
G4RayTracerX();
|
||||
G4VSceneHandler* CreateSceneHandler (const G4String& );
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& );
|
||||
|
||||
// X Window variables...
|
||||
Display* display;
|
||||
Window win;
|
||||
GC gc;
|
||||
XStandardColormap *scmap;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerXViewer.hh,v 1.2 2005/07/20 20:39:02 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
|
||||
// John Allison 17th March 2000
|
||||
|
||||
#ifdef G4VIS_BUILD_RAYTRACERX_DRIVER
|
||||
|
||||
#ifndef G4RAYTRACERXVIEWER_HH
|
||||
#define G4RAYTRACERXVIEWER_HH
|
||||
|
||||
#include "G4RayTracerViewer.hh"
|
||||
|
||||
class G4RayTracerXViewer: public G4RayTracerViewer {
|
||||
public:
|
||||
G4RayTracerXViewer(G4VSceneHandler&,const G4String& name);
|
||||
virtual ~G4RayTracerXViewer();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTrajectory.hh,v 1.14 2004/06/11 14:30:49 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTrajectoryPoint.hh,v 1.8 2004/06/11 14:30:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VFigureFileMaker.hh,v 1.4 2001/07/11 10:09:03 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VRTScanner.hh,v 1.1 2003/09/18 11:14:03 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4VRTScanner.hh,v 1.3 2005/11/28 20:07:44 tinslay Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -36,10 +36,20 @@
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4RayTracer;
|
||||
|
||||
class G4VRTScanner {
|
||||
|
||||
public: // with description
|
||||
|
||||
virtual const G4String& GetGSName() const = 0;
|
||||
// Get name that acts as graphics system name.
|
||||
|
||||
virtual const G4String& GetGSNickname() const = 0;
|
||||
// Get name that acts as graphics system nickname. It is this that
|
||||
// the user specifies on the /vis/open and /vis/sceneHandler/create
|
||||
// commands.
|
||||
|
||||
virtual void Initialize(G4int nRow, G4int nColumn) = 0;
|
||||
// Intialises scanner for window with nRow rows and nColumn columns.
|
||||
|
||||
@@ -48,6 +58,11 @@ public: // with description
|
||||
// sequence has finished, i.e., on the call *after* suplying the
|
||||
// last valid coordinate.
|
||||
|
||||
virtual void Draw
|
||||
(unsigned char, unsigned char, unsigned char,
|
||||
G4RayTracer*) {}
|
||||
// Draw coloured square at current position.
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTJpegCoder.cc,v 1.5 2004/12/07 23:41:00 perl Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTJpegMaker.cc,v 1.9 2003/06/18 08:23:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTMessenger.cc,v 1.7 2003/09/18 11:13:25 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTOutBitStream.cc,v 1.4 2001/07/11 10:09:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -21,30 +21,44 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RTSimpleScanner.cc,v 1.1 2003/09/18 11:14:04 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4RTSimpleScanner.cc,v 1.2 2005/07/17 13:59:24 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4RTSimpleScanner.hh"
|
||||
|
||||
G4RTSimpleScanner::G4RTSimpleScanner():
|
||||
theGSName("RayTracer"), theGSNickname("RayTracer"),
|
||||
theNRow(0), theNColumn(0), theIRow(0), theIColumn(0) {}
|
||||
|
||||
const G4String& G4RTSimpleScanner::GetGSName() const
|
||||
{return theGSName;}
|
||||
|
||||
const G4String& G4RTSimpleScanner::GetGSNickname() const
|
||||
{return theGSNickname;}
|
||||
|
||||
void G4RTSimpleScanner::Initialize(G4int nRow, G4int nColumn) {
|
||||
theNRow = nRow;
|
||||
theNColumn = nColumn;
|
||||
theIRow = 0;
|
||||
theIColumn = 0;
|
||||
theIColumn = -1;
|
||||
}
|
||||
|
||||
G4bool G4RTSimpleScanner::Coords(G4int& iRow, G4int& iColumn) {
|
||||
if (theIRow >= theNRow) return false;
|
||||
iRow = theIRow;
|
||||
iColumn = theIColumn;
|
||||
if (++theIColumn >= theNColumn) {
|
||||
G4bool G4RTSimpleScanner::Coords(G4int& iRow, G4int& iColumn)
|
||||
{
|
||||
// Increment column and, if necessary, increment row...
|
||||
++theIColumn;
|
||||
if (theIColumn >= theNColumn) {
|
||||
theIColumn = 0;
|
||||
++theIRow;
|
||||
}
|
||||
|
||||
// Return if finished...
|
||||
if (theIRow >= theNRow) return false;
|
||||
|
||||
// Return current row and column...
|
||||
iRow = theIRow;
|
||||
iColumn = theIColumn;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTSteppingAction.cc,v 1.6 2001/07/11 10:09:04 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RTTrackingAction.cc,v 1.4 2003/05/30 13:01:21 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RTXScanner.cc,v 1.2 2005/07/20 20:39:02 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
|
||||
#ifdef G4VIS_BUILD_RAYTRACERX_DRIVER
|
||||
|
||||
#include "G4RTXScanner.hh"
|
||||
|
||||
#include "G4RayTracerX.hh"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
G4RTXScanner::G4RTXScanner():
|
||||
theGSName("RayTracerX"), theGSNickname("RayTracerX"),
|
||||
theNRow(0), theNColumn(0), theIRow(0), theIColumn(0) {}
|
||||
|
||||
const G4String& G4RTXScanner::GetGSName() const
|
||||
{return theGSName;}
|
||||
|
||||
const G4String& G4RTXScanner::GetGSNickname() const
|
||||
{return theGSNickname;}
|
||||
|
||||
void G4RTXScanner::Initialize(G4int nRow, G4int nColumn) {
|
||||
theNRow = nRow;
|
||||
theNColumn = nColumn;
|
||||
G4int nMax = std::max (nRow, nColumn);
|
||||
theStep = 1;
|
||||
if (nMax > 3) {
|
||||
for (;;) {
|
||||
theStep *= 3;
|
||||
if (theStep > nMax) break;
|
||||
}
|
||||
}
|
||||
theIRow = theStep / 2;
|
||||
theIColumn = theStep / 2 - theStep;
|
||||
}
|
||||
|
||||
G4bool G4RTXScanner::Coords(G4int& iRow, G4int& iColumn)
|
||||
{
|
||||
// Increment column...
|
||||
theIColumn += theStep;
|
||||
|
||||
// Skip coordinates covered in the previous scan...
|
||||
if ((theIColumn + (3 * theStep) / 2 + 1)%(3 * theStep) == 0 &&
|
||||
(theIRow + (3 * theStep) / 2 + 1)%(3 * theStep) == 0)
|
||||
theIColumn += theStep;
|
||||
|
||||
// If necessary, increment row...
|
||||
if (theIColumn >= theNColumn) {
|
||||
theIColumn = theStep / 2;
|
||||
theIRow += theStep;
|
||||
}
|
||||
|
||||
// Return if finished...
|
||||
if (theIRow >= theNRow && theStep <= 1) return false;
|
||||
|
||||
// Start next scan if necessary...
|
||||
if (theIRow >= theNRow) {
|
||||
theStep /= 3;
|
||||
theIRow = theStep / 2;
|
||||
theIColumn = theStep / 2;
|
||||
}
|
||||
|
||||
// Return current row and column...
|
||||
iRow = theIRow;
|
||||
iColumn = theIColumn;
|
||||
return true;
|
||||
}
|
||||
|
||||
void G4RTXScanner::Draw
|
||||
(unsigned char red, unsigned char green, unsigned char blue,
|
||||
G4RayTracer* aTracer)
|
||||
// Draw coloured square at current position.
|
||||
{
|
||||
G4RayTracerX* theTracer = (G4RayTracerX*) aTracer;
|
||||
Display*& display = theTracer->display;
|
||||
Window& win = theTracer->win;
|
||||
GC& gc = theTracer->gc;
|
||||
XStandardColormap*& scmap = theTracer->scmap;
|
||||
|
||||
unsigned long pixel_value = scmap->base_pixel +
|
||||
((unsigned long) ((red * scmap->red_max) / 256.) * scmap->red_mult) +
|
||||
((unsigned long) ((green * scmap->green_max) / 256.) * scmap->green_mult) +
|
||||
((unsigned long) ((blue * scmap->blue_max) / 256.) * scmap->blue_mult);
|
||||
XSetForeground(display, gc, pixel_value);
|
||||
|
||||
if (theStep > 1) {
|
||||
XFillRectangle(display, win, gc,
|
||||
theIColumn - theStep / 2,
|
||||
theIRow - theStep / 2,
|
||||
theStep, theStep);
|
||||
} else {
|
||||
XDrawPoint(display, win, gc, theIColumn, theIRow);
|
||||
}
|
||||
|
||||
XFlush(display);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -21,14 +21,17 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayShooter.cc,v 1.3 2004/12/07 23:41:00 perl Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4RayShooter.cc,v 1.4 2005/12/05 04:13:50 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
|
||||
#include "G4RayShooter.hh"
|
||||
#include "G4PrimaryParticle.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4Geantino.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
|
||||
G4RayShooter::G4RayShooter()
|
||||
{
|
||||
@@ -37,7 +40,7 @@ G4RayShooter::G4RayShooter()
|
||||
|
||||
void G4RayShooter::SetInitialValues()
|
||||
{
|
||||
particle_definition = G4Geantino::GeantinoDefinition();
|
||||
particle_definition = 0;
|
||||
G4ThreeVector zero;
|
||||
particle_momentum_direction = (G4ParticleMomentum)zero;
|
||||
particle_energy = 1.0*GeV;
|
||||
@@ -52,6 +55,20 @@ G4RayShooter::~G4RayShooter()
|
||||
|
||||
void G4RayShooter::Shoot(G4Event* evt,G4ThreeVector vtx,G4ThreeVector direc)
|
||||
{
|
||||
if(!particle_definition)
|
||||
{
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
particle_definition = particleTable->FindParticle(particleName="geantino");
|
||||
if(!particle_definition)
|
||||
{
|
||||
G4String msg;
|
||||
msg = " G4RayTracer uses geantino to trace the ray, but your physics list does not\n";
|
||||
msg += "define G4Geantino. Please add G4Geantino in your physics list.";
|
||||
G4Exception("G4RayShooter::Shoot","RayTracer001",FatalException,msg);
|
||||
}
|
||||
}
|
||||
|
||||
// create a new vertex
|
||||
G4PrimaryVertex* vertex = new G4PrimaryVertex(vtx,particle_time);
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracer.cc,v 1.15 2005/06/02 17:43:46 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4RayTracer.cc,v 1.19 2005/12/05 03:51:22 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -56,8 +56,11 @@
|
||||
|
||||
G4RayTracer::G4RayTracer(G4VFigureFileMaker* figMaker,
|
||||
G4VRTScanner* scanner)
|
||||
:G4VGraphicsSystem("RayTracer","RayTracer",RAYTRACER_FEATURES,
|
||||
G4VGraphicsSystem::threeD)
|
||||
:G4VGraphicsSystem
|
||||
(scanner ? scanner->GetGSName() : "RayTracer",
|
||||
scanner ? scanner->GetGSNickname() : "RayTracer",
|
||||
RAYTRACER_FEATURES,
|
||||
G4VGraphicsSystem::threeD)
|
||||
{
|
||||
theFigMaker = figMaker;
|
||||
if(!theFigMaker) theFigMaker = new G4RTJpegMaker();
|
||||
@@ -66,8 +69,8 @@ G4RayTracer::G4RayTracer(G4VFigureFileMaker* figMaker,
|
||||
theRayShooter = new G4RayShooter();
|
||||
theRayTracerEventAction = 0;
|
||||
theRayTracerStackingAction = 0;
|
||||
theRayTracerTrackingAction = new G4RTTrackingAction();
|
||||
theRayTracerSteppingAction = new G4RTSteppingAction();
|
||||
theRayTracerTrackingAction = 0;
|
||||
theRayTracerSteppingAction = 0;
|
||||
theMessenger = new G4RTMessenger(this,theRayTracerSteppingAction);
|
||||
theEventManager = G4EventManager::GetEventManager();
|
||||
|
||||
@@ -89,8 +92,8 @@ G4RayTracer::G4RayTracer(G4VFigureFileMaker* figMaker,
|
||||
G4RayTracer::~G4RayTracer()
|
||||
{
|
||||
delete theRayShooter;
|
||||
delete theRayTracerTrackingAction;
|
||||
delete theRayTracerSteppingAction;
|
||||
if(theRayTracerTrackingAction) delete theRayTracerTrackingAction;
|
||||
if(theRayTracerSteppingAction) delete theRayTracerSteppingAction;
|
||||
delete theMessenger;
|
||||
delete theScanner;
|
||||
delete theFigMaker;
|
||||
@@ -157,6 +160,9 @@ void G4RayTracer::StoreUserActions()
|
||||
theUserTrackingAction = theEventManager->GetUserTrackingAction();
|
||||
theUserSteppingAction = theEventManager->GetUserSteppingAction();
|
||||
|
||||
if(!theRayTracerTrackingAction) theRayTracerTrackingAction = new G4RTTrackingAction();
|
||||
if(!theRayTracerSteppingAction) theRayTracerSteppingAction = new G4RTSteppingAction();
|
||||
|
||||
theEventManager->SetUserAction(theRayTracerEventAction);
|
||||
theEventManager->SetUserAction(theRayTracerStackingAction);
|
||||
theEventManager->SetUserAction(theRayTracerTrackingAction);
|
||||
@@ -196,8 +202,11 @@ G4bool G4RayTracer::CreateBitMap()
|
||||
G4bool succeeded;
|
||||
|
||||
// Confirm process(es) of Geantino is initialized
|
||||
G4RegionStore::GetInstance()->UpdateMaterialList();
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->UpdateCoupleTable();
|
||||
G4VPhysicalVolume* pWorld =
|
||||
G4TransportationManager::GetTransportationManager()->
|
||||
GetNavigatorForTracking()->GetWorldVolume();
|
||||
G4RegionStore::GetInstance()->UpdateMaterialList(pWorld);
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->UpdateCoupleTable(pWorld);
|
||||
G4ProcessVector* pVector
|
||||
= G4Geantino::GeantinoDefinition()->GetProcessManager()->GetProcessList();
|
||||
for (G4int j=0; j < pVector->size(); ++j) {
|
||||
@@ -223,26 +232,22 @@ G4bool G4RayTracer::CreateBitMap()
|
||||
while (theScanner->Coords(iRow,iColumn)) {
|
||||
G4int iCoord = iRow * nColumn + iColumn;
|
||||
G4Event* anEvent = new G4Event(iEvent++);
|
||||
|
||||
G4double angleX = -(viewSpanX/2. - iColumn*stepAngle);
|
||||
G4double angleY = viewSpanY/2. - iRow*stepAngle;
|
||||
G4ThreeVector rayDirection;
|
||||
if(distortionOn)
|
||||
{
|
||||
rayDirection = G4ThreeVector(std::tan(angleX)/std::cos(angleY),-std::tan(angleY)/std::cos(angleX),1.0);
|
||||
rayDirection = G4ThreeVector(std::tan(angleX)/std::cos(angleY),-std::tan(angleY)/std::cos(angleX),1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
rayDirection = G4ThreeVector(std::tan(angleX),-std::tan(angleY),1.0);
|
||||
rayDirection = G4ThreeVector(std::tan(angleX),-std::tan(angleY),1.0);
|
||||
}
|
||||
rayDirection.rotateZ(headAngle);
|
||||
rayDirection.rotateUz(eyeDirection);
|
||||
G4ThreeVector rayPosition(eyePosition);
|
||||
G4bool interceptable = true;
|
||||
// Check if rayPosition is in the world.
|
||||
G4VPhysicalVolume* pWorld =
|
||||
G4TransportationManager::GetTransportationManager()->
|
||||
GetNavigatorForTracking()->GetWorldVolume ();
|
||||
EInside whereisit =
|
||||
pWorld->GetLogicalVolume()->GetSolid()->Inside(rayPosition);
|
||||
if (whereisit != kInside) {
|
||||
@@ -251,7 +256,11 @@ G4bool G4RayTracer::CreateBitMap()
|
||||
pWorld->GetLogicalVolume()->GetSolid()->
|
||||
DistanceToIn(rayPosition,rayDirection);
|
||||
if (outsideDistance != kInfinity) {
|
||||
rayPosition = rayPosition+outsideDistance*rayDirection;
|
||||
// Borrowing form geometry, where 1e-8 < epsilon < 1e-3, in
|
||||
// absolute/internal length units, is used for ensuring good
|
||||
// nehaviour, choose to add 0.001 to ensure rayPosition is
|
||||
// definitely inside the world volume (JA 16/9/2005)...
|
||||
rayPosition = rayPosition+(outsideDistance+0.001)*rayDirection;
|
||||
}
|
||||
else {
|
||||
interceptable = false;
|
||||
@@ -261,15 +270,16 @@ G4bool G4RayTracer::CreateBitMap()
|
||||
theRayShooter->Shoot(anEvent,rayPosition,rayDirection);
|
||||
theEventManager->ProcessOneEvent(anEvent);
|
||||
succeeded = GenerateColour(anEvent,iCoord);
|
||||
//G4cout << iColumn << " " << iRow << " " << anEvent->GetEventID() << G4endl;
|
||||
}
|
||||
else { // Ray does not intercept world at all.
|
||||
// Store background colour...
|
||||
colorR[iCoord] = (unsigned char)(int(255*backgroundColour.GetRed()));
|
||||
colorG[iCoord] = (unsigned char)(int(255*backgroundColour.GetGreen()));
|
||||
colorB[iCoord] = (unsigned char)(int(255*backgroundColour.GetBlue()));
|
||||
theScanner->Draw(colorR[iCoord],colorG[iCoord],colorB[iCoord],this);
|
||||
succeeded = true;
|
||||
}
|
||||
|
||||
delete anEvent;
|
||||
if(!succeeded) return false;
|
||||
}
|
||||
@@ -311,6 +321,7 @@ G4bool G4RayTracer::GenerateColour(G4Event* anEvent, G4int iCoord)
|
||||
colorR[iCoord] = (unsigned char)(int(255*rayColour.GetRed()));
|
||||
colorG[iCoord] = (unsigned char)(int(255*rayColour.GetGreen()));
|
||||
colorB[iCoord] = (unsigned char)(int(255*rayColour.GetBlue()));
|
||||
theScanner->Draw(colorR[iCoord],colorG[iCoord],colorB[iCoord],this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerSceneHandler.cc,v 1.3 2005/06/02 17:43:46 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
|
||||
#include "G4RayTracerSceneHandler.hh"
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerViewer.cc,v 1.12 2004/12/07 23:41:01 perl Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4RayTracerViewer.cc,v 1.14 2005/11/18 23:07:04 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
|
||||
#include "G4RayTracerViewer.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include <strstream>
|
||||
#include <sstream>
|
||||
|
||||
#include "G4VSceneHandler.hh"
|
||||
#include "G4Scene.hh"
|
||||
@@ -37,7 +37,13 @@
|
||||
G4RayTracerViewer::G4RayTracerViewer
|
||||
(G4VSceneHandler& sceneHandler, const G4String& name):
|
||||
G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name),
|
||||
fFileCount(0) {}
|
||||
fFileCount(0)
|
||||
{
|
||||
G4RayTracer* theTracer =
|
||||
(G4RayTracer*) fSceneHandler.GetGraphicsSystem();
|
||||
theTracer->SetNColumn(fVP.GetWindowSizeHintX());
|
||||
theTracer->SetNRow(fVP.GetWindowSizeHintY());
|
||||
}
|
||||
|
||||
G4RayTracerViewer::~G4RayTracerViewer() {}
|
||||
|
||||
@@ -69,6 +75,7 @@ void G4RayTracerViewer::SetView() {
|
||||
const G4Vector3D
|
||||
actualLightpointDirection(-fVP.GetActualLightpointDirection());
|
||||
theTracer->SetLightDirection(actualLightpointDirection);
|
||||
theTracer->SetBackgroundColour(fVP.GetBackgroundColour());
|
||||
}
|
||||
|
||||
|
||||
@@ -93,9 +100,7 @@ void G4RayTracerViewer::DrawView() {
|
||||
}
|
||||
G4RayTracer* theTracer =
|
||||
(G4RayTracer*) fSceneHandler.GetGraphicsSystem();
|
||||
char fileName [100];
|
||||
std::ostrstream ost(fileName, 100);
|
||||
ost << "g4RayTracer." << fShortName << '_' << fFileCount++ << ".jpeg"
|
||||
<< std::ends;
|
||||
theTracer->Trace(fileName);
|
||||
std::ostringstream filename;
|
||||
filename << "g4RayTracer." << fShortName << '_' << fFileCount++ << ".jpeg";
|
||||
theTracer->Trace(filename.str());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerX.cc,v 1.3 2005/11/18 23:07:04 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
#ifdef G4VIS_BUILD_RAYTRACERX_DRIVER
|
||||
|
||||
#include "G4RayTracerX.hh"
|
||||
|
||||
#include "G4RayTracerSceneHandler.hh"
|
||||
#include "G4RayTracerXViewer.hh"
|
||||
#include "G4RTXScanner.hh"
|
||||
|
||||
G4RayTracerX::G4RayTracerX():
|
||||
G4RayTracer(0, new G4RTXScanner)
|
||||
{}
|
||||
|
||||
G4VSceneHandler* G4RayTracerX::CreateSceneHandler (const G4String& name) {
|
||||
G4VSceneHandler* pSceneHandler = new G4RayTracerSceneHandler (*this, name);
|
||||
return pSceneHandler;
|
||||
}
|
||||
|
||||
G4VViewer* G4RayTracerX::CreateViewer (G4VSceneHandler& sceneHandler,
|
||||
const G4String& name) {
|
||||
G4VViewer* pViewer = new G4RayTracerXViewer (sceneHandler, name);
|
||||
if (pViewer) {
|
||||
if (pViewer->GetViewId() < 0) {
|
||||
G4cerr << "G4RayTracerX::CreateViewer: error flagged by negative"
|
||||
"\n view id in G4RayTracerXViewer creation."
|
||||
"\n Destroying view and returning null pointer."
|
||||
<< G4endl;
|
||||
delete pViewer;
|
||||
pViewer = 0;
|
||||
}
|
||||
}
|
||||
return pViewer;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,162 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTracerXViewer.cc,v 1.3 2005/11/18 23:05:04 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
|
||||
#ifdef G4VIS_BUILD_RAYTRACERX_DRIVER
|
||||
|
||||
#include "G4RayTracerXViewer.hh"
|
||||
|
||||
#include "G4VSceneHandler.hh"
|
||||
#include "G4Scene.hh"
|
||||
#include "G4RayTracerX.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
extern "C" {
|
||||
Bool G4RayTracerXViewerWaitForNotify (Display*, XEvent* e, char* arg) {
|
||||
return (e->type == MapNotify) && (e->xmap.window == (Window) arg);
|
||||
}
|
||||
}
|
||||
|
||||
G4RayTracerXViewer::G4RayTracerXViewer
|
||||
(G4VSceneHandler& sceneHandler, const G4String& name):
|
||||
G4RayTracerViewer(sceneHandler, name)
|
||||
{
|
||||
G4RayTracerX* theTracer =
|
||||
(G4RayTracerX*) fSceneHandler.GetGraphicsSystem();
|
||||
|
||||
Display*& display = theTracer->display;
|
||||
Window& win = theTracer->win;
|
||||
GC& gc = theTracer->gc;
|
||||
XStandardColormap*& scmap = theTracer->scmap;
|
||||
|
||||
display = XOpenDisplay(0); // Use display defined by DISPLAY environment.
|
||||
if (!display) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr << "G4RayTracerXViewer::G4RayTracerXViewer: cannot get display."
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int screen_num = DefaultScreen(display);
|
||||
|
||||
// Window size and position...
|
||||
int xOffset = 0, yOffset = 0;
|
||||
unsigned int width, height;
|
||||
XSizeHints* size_hints = XAllocSizeHints();
|
||||
const G4String& XGeometryString = fVP.GetXGeometryString();
|
||||
if (!XGeometryString.empty()) {
|
||||
G4int geometryResultMask = XParseGeometry
|
||||
((char*)XGeometryString.c_str(),
|
||||
&xOffset, &yOffset, &width, &height);
|
||||
if (geometryResultMask & (WidthValue | HeightValue)) {
|
||||
if (geometryResultMask & XValue) {
|
||||
if (geometryResultMask & XNegative) {
|
||||
xOffset = DisplayWidth(display, screen_num) + xOffset - width;
|
||||
}
|
||||
size_hints->flags |= PPosition;
|
||||
size_hints->x = xOffset;
|
||||
}
|
||||
if (geometryResultMask & YValue) {
|
||||
if (geometryResultMask & YNegative) {
|
||||
yOffset = DisplayHeight(display, screen_num) + yOffset - height;
|
||||
}
|
||||
size_hints->flags |= PPosition;
|
||||
size_hints->y = yOffset;
|
||||
}
|
||||
} else {
|
||||
G4cout << "ERROR: Geometry string \""
|
||||
<< XGeometryString
|
||||
<< "\" invalid. Using \"600x600\"."
|
||||
<< G4endl;
|
||||
width = 600;
|
||||
height = 600;
|
||||
}
|
||||
}
|
||||
size_hints->width = width;
|
||||
size_hints->height = height;
|
||||
size_hints->flags |= PSize;
|
||||
|
||||
win = XCreateSimpleWindow
|
||||
(display, RootWindow(display, screen_num),
|
||||
xOffset, yOffset, width, height,
|
||||
0, // Border width.
|
||||
WhitePixel(display, screen_num), // Border colour.
|
||||
BlackPixel(display, screen_num)); // Background colour.
|
||||
|
||||
XGCValues values;
|
||||
gc = XCreateGC(display, win, 0, &values);
|
||||
|
||||
int nMaps;
|
||||
Status status = XGetRGBColormaps
|
||||
(display, RootWindow(display, screen_num),
|
||||
&scmap, &nMaps, XA_RGB_BEST_MAP);
|
||||
if (!status) {
|
||||
system("xstdcmap -best"); // ...and try again...
|
||||
Status status = XGetRGBColormaps
|
||||
(display, RootWindow(display, screen_num),
|
||||
&scmap, &nMaps, XA_RGB_BEST_MAP);
|
||||
if (!status) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr <<
|
||||
"G4RayTracerXViewer::G4RayTracerXViewer: cannot get color map."
|
||||
"\n Perhaps your system does not support RGB_BEST_MAP."
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!scmap->colormap) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr << "G4RayTracerXViewer::G4RayTracerXViewer: color map empty."
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
XWMHints* wm_hints = XAllocWMHints();
|
||||
XClassHint* class_hint = XAllocClassHint();
|
||||
const char* window_name = fName.c_str();
|
||||
XTextProperty windowName;
|
||||
XStringListToTextProperty((char**)&window_name, 1, &windowName);
|
||||
|
||||
XSetWMProperties(display, win, &windowName, &windowName,
|
||||
0, 0, size_hints, wm_hints, class_hint);
|
||||
|
||||
XMapWindow(display, win);
|
||||
|
||||
// Wait for window to appear (wait for an "map notify" event).
|
||||
XSelectInput(display, win, StructureNotifyMask);
|
||||
XEvent event;
|
||||
XIfEvent (display, &event, G4RayTracerXViewerWaitForNotify, (char*) win);
|
||||
|
||||
}
|
||||
|
||||
G4RayTracerXViewer::~G4RayTracerXViewer() {}
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTrajectory.cc,v 1.14 2004/06/11 14:30:51 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4RayTrajectoryPoint.cc,v 1.5 2004/06/11 14:30:51 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user