Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
@@ -0,0 +1,72 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4OwnColormapXView.hh,v 2.1 1998/10/23 17:58:21 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// John Allison 1st June 1997
// Loosely based on G4OpenGLXView by Andrew Walkden 7th February 1997
// G4OwnColormapXView : Class to provide X Windows with its own colormap
// for a GEANT4 view. The derived view must define the colormap.
#ifdef G4VIS_BUILD_RAYX_DRIVER
#ifndef G4OWNCOLORMAPXVIEW_HH
#define G4OWNCOLORMAPXVIEW_HH
#include "G4VView.hh"
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
class G4VScene;
class G4OwnColormapXView: virtual public G4VView {
public:
G4OwnColormapXView (G4VScene& scene);
~G4OwnColormapXView ();
void ClearView ();
void FinishView ();
protected:
char* fcharViewName;
Display* fpDisplay;
int fScreen;
int fDepth;
G4String fVisualName;
G4bool fTrueColor;
Visual* fpVisual;
int fMapEntries;
Window fRootW;
int fRedShift;
int fGreenShift;
int fBlueShift;
float fRedMax;
float fGreenMax;
float fBlueMax;
Colormap fColormap;
XWindowAttributes fRootWA;
GC fGC;
XSetWindowAttributes fSWA;
Window fWindow;
XTextProperty fWindowName;
XTextProperty fIconName;
XSizeHints* fSize_hints;
XWMHints* fWM_hints;
XClassHint* fClass_hints;
XWindowAttributes fWA;
int fWidth;
int fHeight;
Pixmap fIcon_pixmap;
XEvent fEvent;
};
#endif
#endif
@@ -0,0 +1,43 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RayMessenger.hh,v 2.2 1998/07/12 03:44:31 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// GEANT4 Ray tracing Messenger - John Allison 5th June 1997
#ifndef G4RAYMESSENGER_HH
#define G4RAYMESSENGER_HH
#include "G4UImessenger.hh"
#include "globals.hh"
class G4RayX;
class G4RayScene;
class G4RayView;
class G4UIcommand;
class G4RayMessenger: public G4UImessenger {
public:
G4RayMessenger ();
~G4RayMessenger ();
void SetNewValue (G4UIcommand* command, G4String newValues);
G4String GetCurrentValue (G4UIcommand* command);
void RegisterScene (G4RayScene* pScene);
void RegisterView (G4RayView* pView);
private:
G4RayScene* fpScene;
G4RayView* fpView;
G4UIcommand* fpVisRayCommandDirectory;
G4UIcommand* fpResolutionCommand;
};
#include "G4RayMessenger.icc"
#endif
@@ -0,0 +1,20 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RayMessenger.icc,v 2.0 1998/07/02 16:42:42 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// GEANT4 Ray tracing Messenger - John Allison 5th June 1997
inline void G4RayMessenger::RegisterScene (G4RayScene* pScene) {
fpScene = pScene;
}
inline void G4RayMessenger::RegisterView (G4RayView* pView) {
fpView = pView;
}
@@ -0,0 +1,36 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RayPrimaryGeneratorAction.hh,v 2.1 1998/07/12 03:09:19 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4RayPrimaryGeneratorAction_h
#define G4RayPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
class G4ParticleGun;
class G4Event;
class G4RayPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
G4RayPrimaryGeneratorAction();
~G4RayPrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event* anEvent);
G4ParticleGun* GetParticleGun();
private:
G4ParticleGun* particleGun;
};
#endif
@@ -0,0 +1,52 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RayScene.hh,v 2.2 1998/11/06 13:41:50 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Nikos Savvas 1st June 1997
// GEANT4 Ray Tracing scene.
#ifndef G4RAYSCENE_HH
#define G4RAYSCENE_HH
#include "G4VScene.hh"
class G4RayScene: public G4VScene {
public:
G4RayScene (G4VGraphicsSystem& system, const G4String& name = "");
~G4RayScene ();
static G4int GetSceneCount ();
// The following functions don't make sense for G4Ray...
void AddPrimitive (const G4Polyline&);
void AddPrimitive (const G4Text&);
void AddPrimitive (const G4Circle&);
void AddPrimitive (const G4Square&);
void AddPrimitive (const G4Polymarker&);
void AddPrimitive (const G4Polyhedron&);
void AddPrimitive (const G4NURBS&);
void AddThis (const G4Box&);
void AddThis (const G4Cons&);
void AddThis (const G4Tubs&);
void AddThis (const G4Trd&);
void AddThis (const G4Trap&);
void AddThis (const G4Sphere&);
void AddThis (const G4Para&);
void AddThis (const G4Torus&);
void AddThis (const G4VSolid&);
private:
static G4int fSceneIdCount; // static counter for Ray scenes.
static G4int fSceneCount; // No. of extanct scenes.
};
#include "G4RayScene.icc"
#endif
@@ -0,0 +1,53 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RayScene.icc,v 2.1 1998/08/07 08:17:02 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Nikos Savvas 1st June 1997
// GEANT4 Ray Tracing scene.
inline void G4RayScene::AddThis (const G4Box& box) {
G4VScene::AddThis (box);
}
inline void G4RayScene::AddThis (const G4Cons& cons) {
G4VScene::AddThis (cons);
}
inline void G4RayScene::AddThis (const G4Tubs& tubs) {
G4VScene::AddThis (tubs);
}
inline void G4RayScene::AddThis (const G4Trd& trd) {
G4VScene::AddThis (trd);
}
inline void G4RayScene::AddThis (const G4Trap& trap) {
G4VScene::AddThis (trap);
}
inline void G4RayScene::AddThis (const G4Sphere& sphere) {
G4VScene::AddThis (sphere);
}
inline void G4RayScene::AddThis (const G4Para& para) {
G4VScene::AddThis (para);
}
inline void G4RayScene::AddThis (const G4Torus& torus) {
G4VScene::AddThis (torus);
}
inline void G4RayScene::AddThis (const G4VSolid& vsolid) {
G4VScene::AddThis (vsolid);
}
inline void G4RayScene::AddPrimitive (const G4Polymarker& polymarker) {
G4VScene::AddPrimitive (polymarker);
}
@@ -0,0 +1,40 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RaySteppingAction.hh,v 2.0 1998/07/02 16:42:50 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// 16/Apr/1997 J. Allison: For visualization/test/test19.
// moved here and renamed 14/April/1997
#ifndef MYSTEPPINGACTION_HH
#define MYSTEPPINGACTION_HH
#include "G4UserSteppingAction.hh"
#include "G4Normal3D.hh"
class G4RaySteppingAction: public G4UserSteppingAction {
public:
G4RaySteppingAction();
void UserSteppingAction();
G4bool WeHaveContact () const {return weHaveContact;}
G4Normal3D GetSurfaceNormal () const {return normal;}
const G4VisAttributes* GetVisAttributes () const {return pVisAttribs;}
G4VPhysicalVolume* GetPhysicalVolume () const {return pVPV;}
G4LogicalVolume* GetLogicalVolume () const {return pLV;}
G4VSolid* GetSolid () const {return pSol;}
private:
G4bool weHaveContact;
G4Normal3D normal;
const G4VisAttributes* pVisAttribs;
G4VPhysicalVolume* pVPV;
G4LogicalVolume* pLV;
G4VSolid* pSol;
};
#endif
@@ -0,0 +1,168 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RayView.hh,v 2.2 1998/11/06 13:41:51 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Nikos Savvas 1st June 1997
// GEANT4 Ray Tracing view.
#include "G4RunManager.hh"
#include "G4RaySteppingAction.hh"
#include "G4RayPrimaryGeneratorAction.hh"
#ifndef G4RAYVIEW_HH
#define G4RAYVIEW_HH
#include "G4VView.hh"
#include "G4Colour.hh"
#include "G4VPhysicalVolume.hh"
#include <rw/tvordvec.h>
#include <rw/tvhdict.h>
class G4RayScene;
class G4RaySteppingAction;
class G4RayColourCell {
public:
G4RayColourCell (): red (0), green (0), blue (0), nHits (0) {}
G4RayColourCell (float rr, float gg, float bb, G4int ii):
red (rr), green (gg), blue (bb), nHits (ii) {}
float red, green, blue;
G4int nHits; // No. of ray hits using this colour.
G4bool operator == (const G4RayColourCell& h) const {
return this == &h;
}
};
class G4RayCoordinate {
public:
G4RayCoordinate (): coord (0) {}
G4RayCoordinate (G4double x, G4double y):
coord (((unsigned int) (0x7fff * (x + 1.0))) |
((unsigned int) (0x7fff * (1.0 - y)) << 16)) {}
// Assumes -1.0 <= x, y <= 1.0. Assigns 16 bits each.
unsigned int coord;
G4bool operator == (const G4RayCoordinate& c) const {
return coord == c.coord;
}
};
class G4RayHitColour {
public:
G4RayHitColour (): colour (0) {}
G4RayHitColour (float r, float g, float b):
colour ((((unsigned int) (0x3ff * r)) << 20) |
(((unsigned int) (0x3ff * g)) << 10) |
((unsigned int) (0x3ff * b))) {}
// Assumes 0.0 <= r, g, b <= 1.0. Assigns 10 bits each.
unsigned int colour;
G4bool operator == (const G4RayHitColour& h) const {
return colour == h.colour;
}
float GetRed () {return (float ((colour >> 20) )) / 0x3ff;}
float GetGreen () {return (float ((colour >> 10) & 0x3ff)) / 0x3ff;}
float GetBlue () {return (float ((colour ) & 0x3ff)) / 0x3ff;}
};
class G4RayView: virtual public G4VView {
public:
G4RayView (G4RayScene& scene, const G4String& name = "");
~G4RayView();
G4double GetResolution () const;
void SetResolution (G4double resolution);
protected:
void SetView ();
void InitialiseImage ();
void TriggerRedraw ();
G4bool Scan (int& i, int& j, int& k,
float& red, float& green, float& blue,
int& iPixVal);
// Iterate over window, return false when finished. Return i, j,
// and k which define a coloured Square of side k whose upper left
// corner is (i, j). Note origin is at upper left corner of window
// - X and PostScript convention. iPixVal is the pixel value for
// this colour, i.e., the key in fRayHitColourIndex.
// The following static members define an image. They are static so
// that (a) there is only ever one of them (they can take a lot of
// memory) and (b) any object of the class or its descendants can
// access it. It is *not* cleared by ClearView (). It is only
// cleared by a change of view parameters and some other crucial
// parameters. It can be progressively refined by multiple calls to
// DrawView.
static G4ViewParameters fImageViewParameters;
static G4double fInitialResolution;
static G4double fRequestedResolution;
static G4double fCurrentResolution;
static G4float fMaxMinColourSeparation;
static G4int fImageWidth, fImageHeight;
static G4int fMaxImageMapEntries;
static G4bool fImageMapRejigged;
static G4bool fTriggerRescan;
static G4int fWaitLimit; // Waits between refresh.
static G4int fWaitCount;
static RWTValOrderedVector <G4RayColourCell> fRayHitColourMap;
static RWTValHashDictionary <G4RayCoordinate, G4RayHitColour> fRayHits;
static unsigned int RayCoordHash (const G4RayCoordinate& rayCoord);
static RWTValHashDictionary <G4RayHitColour, G4int> fRayHitColourIndex;
static unsigned int RayColourHash (const G4RayHitColour& rayColour);
private:
void Trace (G4double x, G4double y, float& red, float& green, float& blue);
// Trace the ray from (x, y) in screen coordinates (-1 <= x,y <= 1)
// and fill colour.
void CompactColour (G4bool Print);
float ColourSeparation (float ri, float gi, float bi,
float rj, float gj, float bj);
static void ChangePixVals (const G4RayHitColour& colour,
G4int& index, void* ij);
static void DecrementPixVals (const G4RayHitColour& colour,
G4int& index, void* ij);
static void PrintPixVals (const G4RayHitColour& colour,
G4int& index, void* ij);
G4RayScene& fScene; // Graphics Scene for this view.
G4Vector3D fXprime;
G4Vector3D fYprime;
G4Point3D fCenterofscreen;
G4Point3D fCamerapoint;
G4RunManager* fG4RayRunManager ;
G4RaySteppingAction* fG4RaySteppingAction;
G4RayPrimaryGeneratorAction* fG4RayGenerator;
G4ParticleGun * fG4RayGun ;
G4VPhysicalVolume * fpWorld;
};
#include "G4RayView.icc"
#endif
@@ -0,0 +1,31 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RayView.icc,v 2.0 1998/07/02 16:42:54 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Nikos Savvas 1st June 1997
// GEANT4 Ray Tracing view.
inline G4double G4RayView::GetResolution () const {
return fRequestedResolution;
}
inline void G4RayView::SetResolution (G4double resolution) {
fRequestedResolution = resolution;
}
inline unsigned int G4RayView::RayCoordHash
(const G4RayCoordinate& rayCoord) {
return rayCoord.coord;
}
inline unsigned int G4RayView::RayColourHash
(const G4RayHitColour& rayColour) {
return rayColour.colour;
}
@@ -0,0 +1,37 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RayX.hh,v 2.1 1998/11/06 13:41:52 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Nikos Savvas 1st June 1997
// GEANT4 Ray Tracing graphics system factory.
#if defined (G4VIS_BUILD_RAYX_DRIVER) || defined (G4VIS_USE_RAYX)
#ifndef G4RAYX_HH
#define G4RAYX_HH
#include "G4VGraphicsSystem.hh"
class G4RayXMessenger;
class G4RayX: public G4VGraphicsSystem {
public:
G4RayX ();
~G4RayX ();
G4VScene* CreateScene (const G4String& name = "");
G4VView* CreateView (G4VScene&, const G4String& name = "");
private:
static G4int fInstances;
G4RayXMessenger* fpMessenger; // Pointer to messenger.
};
#endif
#endif
@@ -0,0 +1,36 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RayXMessenger.hh,v 2.2 1998/07/12 03:44:33 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// GEANT4 Ray tracing for X windows Messenger - John Allison 5th June 1997
#ifdef G4VIS_BUILD_RAYX_DRIVER
#ifndef G4RAYXMESSENGER_HH
#define G4RAYXMESSENGER_HH
#include "G4RayMessenger.hh"
class G4RayX;
class G4UIcommand;
class G4RayXMessenger: public G4RayMessenger {
public:
G4RayXMessenger (G4RayX* pRayX);
~G4RayXMessenger ();
void SetNewValue (G4UIcommand* command, G4String newValues);
G4String GetCurrentValue (G4UIcommand* command);
private:
G4RayX* fpRayX;
};
#endif
#endif
@@ -0,0 +1,46 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RayXView.hh,v 2.1 1998/11/06 13:41:53 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Nikos Savvas 1st June 1997
// GEANT4 Ray Tracing X window view.
#ifdef G4VIS_BUILD_RAYX_DRIVER
#ifndef G4RAYXVIEW_HH
#define G4RAYXVIEW_HH
#include "G4RayView.hh"
#include "G4OwnColormapXView.hh"
class G4RayScene;
class G4RayXView: public G4RayView, public G4OwnColormapXView {
public:
G4RayXView (G4RayScene& scene, const G4String& name = "");
void DrawView ();
private:
int ncells;
/*****************************
// An RGB map for now
int red_max;
int green_max;
int blue_max;
int red_mult;
int green_mult;
int blue_mult;
********************************/
};
#endif
#endif