Import Geant4 2.0.0 source tree
This commit is contained in:
@@ -0,0 +1,191 @@
|
||||
// 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: G4RTJpeg.hh,v 1.4 2000/03/09 17:38:31 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This header file defines some static constant variables and error classes
|
||||
// used internally by G4JpegMaker and related classes
|
||||
//
|
||||
|
||||
#ifndef G4RTJpeg_H
|
||||
#define G4RTJpeg_H 1
|
||||
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned int u_int;
|
||||
|
||||
const char JFIF[] = "JFIF";
|
||||
const char JFXX[] = "JFXX";
|
||||
|
||||
const double Sqrt2 = 1.41421356;
|
||||
const double DisSqrt2 = 1.0 / Sqrt2;
|
||||
const double PaiDiv16 = 3.14159265 / 16;
|
||||
|
||||
//Zigzag
|
||||
static const int Zigzag[64] = {
|
||||
0, 1, 8, 16, 9, 2, 3, 10,
|
||||
17, 24, 32, 25, 18, 11, 4, 5,
|
||||
12, 19, 26, 33, 40, 48, 41, 34,
|
||||
27, 20, 13, 6, 7, 14, 21, 28,
|
||||
35, 42, 49, 56, 57, 50, 43, 36,
|
||||
29, 22, 15, 23, 30, 37, 44, 51,
|
||||
58, 59, 52, 45, 38, 31, 39, 46,
|
||||
53, 60, 61, 54, 47, 55, 62, 63
|
||||
};
|
||||
|
||||
//ProcessResult
|
||||
enum
|
||||
jProcessResult{
|
||||
M_NoError = 0,
|
||||
M_RuntimeError = -1,
|
||||
M_DataError = -2
|
||||
};
|
||||
|
||||
// JpegMarkerCode
|
||||
enum
|
||||
jMarker{
|
||||
|
||||
M_SOF0 = 0xc0,
|
||||
M_SOF1 = 0xc1,
|
||||
M_SOF2 = 0xc2,
|
||||
M_SOF3 = 0xc3,
|
||||
|
||||
M_SOF5 = 0xc5,
|
||||
M_SOF6 = 0xc6,
|
||||
M_SOF7 = 0xc7,
|
||||
|
||||
M_JPG = 0xc8,
|
||||
M_SOF9 = 0xc9,
|
||||
M_SOF10 = 0xca,
|
||||
M_SOF11 = 0xcb,
|
||||
|
||||
M_SOF13 = 0xcd,
|
||||
M_SOF14 = 0xce,
|
||||
M_SOF15 = 0xcf,
|
||||
|
||||
M_DHT = 0xc4,
|
||||
|
||||
M_DAC = 0xcc,
|
||||
|
||||
M_RST0 = 0xd0, M_RST1 = 0xd1,
|
||||
M_RST2 = 0xd2, M_RST3 = 0xd3,
|
||||
M_RST4 = 0xd4, M_RST5 = 0xd5,
|
||||
M_RST6 = 0xd6, M_RST7 = 0xd7,
|
||||
|
||||
M_SOI = 0xd8,
|
||||
M_EOI = 0xd9,
|
||||
M_SOS = 0xda,
|
||||
M_DQT = 0xdb,
|
||||
M_DNL = 0xdc,
|
||||
M_DRI = 0xdd,
|
||||
M_DHP = 0xde,
|
||||
M_EXP = 0xdf,
|
||||
M_COM = 0xfe,
|
||||
|
||||
M_APP0 = 0xe0, M_APP1 = 0xe1,
|
||||
M_APP2 = 0xe2, M_APP3 = 0xe3,
|
||||
M_APP4 = 0xe4, M_APP5 = 0xe5,
|
||||
M_APP6 = 0xe6, M_APP7 = 0xe7,
|
||||
M_APP8 = 0xe8, M_APP9 = 0xe9,
|
||||
M_APP10 = 0xea, M_APP11 = 0xeb,
|
||||
M_APP12 = 0xec, M_APP13 = 0xed,
|
||||
M_APP14 = 0xee, M_APP15 = 0xef,
|
||||
|
||||
|
||||
M_JPG0 = 0xf0, M_JPG1 = 0xf1,
|
||||
M_JPG2 = 0xf2, M_JPG3 = 0xf3,
|
||||
M_JPG4 = 0xf4, M_JPG5 = 0xf5,
|
||||
M_JPG6 = 0xf6, M_JPG7 = 0xf7,
|
||||
M_JPG8 = 0xf8, M_JPG9 = 0xf9,
|
||||
M_JPG10 = 0xfa, M_JPG11 = 0xfb,
|
||||
M_JPG12 = 0xfc, M_JPG13 = 0xfd,
|
||||
|
||||
|
||||
M_TEM = 0x01,
|
||||
M_RESst = 0x02,
|
||||
M_RESend = 0xbf,
|
||||
|
||||
M_Error = 0xff,
|
||||
M_Marker = 0xff
|
||||
};
|
||||
|
||||
//JpegProperty
|
||||
struct
|
||||
G4JpegProperty{
|
||||
int nRow;
|
||||
int nColumn;
|
||||
int Dimension;
|
||||
int SamplePrecision;
|
||||
const char * Comment;
|
||||
int Format;
|
||||
u_char MajorRevisions;
|
||||
u_char MinorRevisions;
|
||||
int Units;
|
||||
int HDensity;
|
||||
int VDensity;
|
||||
int HThumbnail;
|
||||
int VThumbnail;
|
||||
int ExtensionCode;
|
||||
};
|
||||
|
||||
|
||||
//MemoryError
|
||||
class G4MemoryError
|
||||
{
|
||||
public:
|
||||
G4MemoryError(int size, const char* message)
|
||||
{mSize = size; mMessage = message;};
|
||||
int mSize;
|
||||
const char* mMessage;
|
||||
};
|
||||
|
||||
//IndexError
|
||||
class G4IndexError
|
||||
{
|
||||
public:
|
||||
G4IndexError(int maxIndex, int errorIndex, const char* mes)
|
||||
{mMaxIndex = maxIndex; mErrorIndex = errorIndex; mMessage = mes;};
|
||||
int mMaxIndex;
|
||||
int mErrorIndex;
|
||||
const char* mMessage;
|
||||
};
|
||||
|
||||
//BufferError
|
||||
class G4BufferError
|
||||
{
|
||||
public:
|
||||
G4BufferError(const char* mes)
|
||||
{mMessage = mes;};
|
||||
const char* mMessage;
|
||||
};
|
||||
|
||||
//DataFormatError
|
||||
class G4DataFormatError
|
||||
{
|
||||
public:
|
||||
G4DataFormatError(void* address, const char* message)
|
||||
{mAddress = address; mMessage = message;};
|
||||
void* mAddress;
|
||||
const char* mMessage;
|
||||
};
|
||||
|
||||
|
||||
//NotSupported
|
||||
class G4NotSupported
|
||||
{
|
||||
public:
|
||||
G4NotSupported(jMarker aMark, void* address)
|
||||
{mMark = aMark; mAddress = address;};
|
||||
jMarker mMark;
|
||||
void* mAddress;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,80 @@
|
||||
// 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: G4RTJpegCoder.hh,v 1.4 2000/03/09 17:38:31 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This class converts 8 bit unsighned ints array to JPEG code.
|
||||
//
|
||||
|
||||
#ifndef G4RTJpegCoder_H
|
||||
#define G4RTJpegCoder_H 1
|
||||
#include "G4RTJpeg.hh"
|
||||
|
||||
//HuffmanTable
|
||||
struct
|
||||
G4HuffmanCodeTable
|
||||
{
|
||||
int numOfElement;
|
||||
int* SizeT;
|
||||
int* CodeT;
|
||||
};
|
||||
|
||||
class G4OutBitStream;
|
||||
|
||||
class G4JpegCoder
|
||||
{
|
||||
public:
|
||||
G4JpegCoder(u_char* colorR,u_char* colorG,u_char* colorB);
|
||||
~G4JpegCoder(void);
|
||||
|
||||
void GetJpegData(char** aJpegData,int& size);
|
||||
|
||||
void SetJpegProperty(const G4JpegProperty& aProperty);
|
||||
|
||||
int DoCoding(void);
|
||||
|
||||
|
||||
protected:
|
||||
u_char* mRgb[3];
|
||||
int mYBlock[4][64];
|
||||
int mCbBlock[64];
|
||||
int mCrBlock[64];
|
||||
double mCosT[8][8];
|
||||
int mDCTData[64];
|
||||
int mPreDC[3];
|
||||
|
||||
G4JpegProperty mProperty;
|
||||
int mNumVUnits;
|
||||
int mNumHUnits;
|
||||
|
||||
G4OutBitStream *mOBSP;
|
||||
|
||||
void CodeMCU();
|
||||
|
||||
void makeYCC(int ux,int uy);
|
||||
|
||||
void CodeHuffman(int cs);
|
||||
|
||||
void ForwardDCT(int* picData);
|
||||
|
||||
void Quantization(int cs);
|
||||
|
||||
void WriteHeader(void);
|
||||
void WriteEOI(void);
|
||||
};
|
||||
|
||||
const u_int JFIFLength = 16;
|
||||
const u_int JFIFVersion = 0x0102; //JFIF Ver 1.02
|
||||
const u_char YSampleF = 0x22;
|
||||
const u_char CSampleF = 0x11;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,316 @@
|
||||
// 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: G4RTJpegCoderTables.hh,v 1.4 2000/03/09 17:38:32 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This header file defines some hard coded numbers used by G4RTJpegCoder
|
||||
// to convert 8 bits RGB to JPEG.
|
||||
//
|
||||
|
||||
#ifndef G4RTJpegCoderTable_H
|
||||
#define G4RTJpegCoderTable_H 1
|
||||
|
||||
#include "G4RTJpeg.hh"
|
||||
|
||||
//QuantumTable
|
||||
|
||||
static const int YQuantumT[] = {
|
||||
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
};
|
||||
|
||||
static const int CQuantumT[] = {
|
||||
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
};
|
||||
|
||||
//HuffmanCode
|
||||
|
||||
static const int YDcSizeT[] = {
|
||||
0x0002, 0x0003, 0x0003, 0x0003,
|
||||
0x0003, 0x0003, 0x0004, 0x0005,
|
||||
0x0006, 0x0007, 0x0008, 0x0009 };
|
||||
static const int YDcCodeT[] = {
|
||||
0x0000, 0x0002, 0x0003, 0x0004,
|
||||
0x0005, 0x0006, 0x000e, 0x001e,
|
||||
0x003e, 0x007e, 0x00fe, 0x01fe };
|
||||
static const G4HuffmanCodeTable YDcHuffmanT = {
|
||||
12,
|
||||
(int*)YDcSizeT,
|
||||
(int*)YDcCodeT
|
||||
};
|
||||
|
||||
|
||||
static const int CDcSizeT[] = {
|
||||
0x0002, 0x0002, 0x0002, 0x0003,
|
||||
0x0004, 0x0005, 0x0006, 0x0007,
|
||||
0x0008, 0x0009, 0x000a, 0x000b };
|
||||
static const int CDcCodeT[] = {
|
||||
0x0000, 0x0001, 0x0002, 0x0006,
|
||||
0x000e, 0x001e, 0x003e, 0x007e,
|
||||
0x00fe, 0x01fe, 0x03fe, 0x07fe };
|
||||
static const G4HuffmanCodeTable CDcHuffmanT = {
|
||||
12,
|
||||
(int*)CDcSizeT,
|
||||
(int*)CDcCodeT
|
||||
};
|
||||
|
||||
|
||||
static const int YAcSizeT[] = {
|
||||
4, 2, 2, 3, 4, 5, 7, 8,
|
||||
10, 16, 16, 4, 5, 7, 9, 11,
|
||||
16, 16, 16, 16, 16, 5, 8, 10,
|
||||
12, 16, 16, 16, 16, 16, 16, 6,
|
||||
9, 12, 16, 16, 16, 16, 16, 16,
|
||||
16, 6, 10, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 7, 11, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 7, 12, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 8,
|
||||
12, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 9, 15, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 9, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 9, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 10,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 10, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 11, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 11,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16 };
|
||||
static const int YAcCodeT[] = {
|
||||
0x000a, 0x0000, 0x0001, 0x0004,
|
||||
0x000b, 0x001a, 0x0078, 0x00f8,
|
||||
0x03f6, 0xff82, 0xff83, 0x000c,
|
||||
0x001b, 0x0079, 0x01f6, 0x07f6,
|
||||
0xff84, 0xff85, 0xff86, 0xff87,
|
||||
0xff88, 0x001c, 0x00f9, 0x03f7,
|
||||
0x0ff4, 0xff89, 0xff8a, 0xff8b,
|
||||
0xff8c, 0xff8d, 0xff8e, 0x003a,
|
||||
0x01f7, 0x0ff5, 0xff8f, 0xff90,
|
||||
0xff91, 0xff92, 0xff93, 0xff94,
|
||||
0xff95, 0x003b, 0x03f8, 0xff96,
|
||||
0xff97, 0xff98, 0xff99, 0xff9a,
|
||||
0xff9b, 0xff9c, 0xff9d, 0x007a,
|
||||
0x07f7, 0xff9e, 0xff9f, 0xffa0,
|
||||
0xffa1, 0xffa2, 0xffa3, 0xffa4,
|
||||
0xffa5, 0x007b, 0x0ff6, 0xffa6,
|
||||
0xffa7, 0xffa8, 0xffa9, 0xffaa,
|
||||
0xffab, 0xffac, 0xffad, 0x00fa,
|
||||
0x0ff7, 0xffae, 0xffaf, 0xffb0,
|
||||
0xffb1, 0xffb2, 0xffb3, 0xffb4,
|
||||
0xffb5, 0x01f8, 0x7fc0, 0xffb6,
|
||||
0xffb7, 0xffb8, 0xffb9, 0xffba,
|
||||
0xffbb, 0xffbc, 0xffbd, 0x01f9,
|
||||
0xffbe, 0xffbf, 0xffc0, 0xffc1,
|
||||
0xffc2, 0xffc3, 0xffc4, 0xffc5,
|
||||
0xffc6, 0x01fa, 0xffc7, 0xffc8,
|
||||
0xffc9, 0xffca, 0xffcb, 0xffcc,
|
||||
0xffcd, 0xffce, 0xffcf, 0x03f9,
|
||||
0xffd0, 0xffd1, 0xffd2, 0xffd3,
|
||||
0xffd4, 0xffd5, 0xffd6, 0xffd7,
|
||||
0xffd8, 0x03fa, 0xffd9, 0xffda,
|
||||
0xffdb, 0xffdc, 0xffdd, 0xffde,
|
||||
0xffdf, 0xffe0, 0xffe1, 0x07f8,
|
||||
0xffe2, 0xffe3, 0xffe4, 0xffe5,
|
||||
0xffe6, 0xffe7, 0xffe8, 0xffe9,
|
||||
0xffea, 0xffeb, 0xffec, 0xffed,
|
||||
0xffee, 0xffef, 0xfff0, 0xfff1,
|
||||
0xfff2, 0xfff3, 0xfff4, 0x07f9,
|
||||
0xfff5, 0xfff6, 0xfff7, 0xfff8,
|
||||
0xfff9, 0xfffa, 0xfffb, 0xfffc,
|
||||
0xfffd, 0xfffe };
|
||||
static const G4HuffmanCodeTable YAcHuffmanT = {
|
||||
162,
|
||||
(int*)YAcSizeT,
|
||||
(int*)YAcCodeT
|
||||
};
|
||||
|
||||
static const int YEOBidx = 0;
|
||||
static const int YZRLidx = 151;
|
||||
|
||||
|
||||
static const int CAcSizeT[] = {
|
||||
2, 2, 3, 4, 5, 5, 6, 7,
|
||||
9, 10, 12, 4, 6, 8, 9, 11,
|
||||
12, 16, 16, 16, 16, 5, 8, 10,
|
||||
12, 15, 16, 16, 16, 16, 16, 5,
|
||||
8, 10, 12, 16, 16, 16, 16, 16,
|
||||
16, 6, 9, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 6, 10, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 7, 11, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 7,
|
||||
11, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 8, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 9, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 9, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 9,
|
||||
16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 9, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 11, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 14, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 10,
|
||||
15, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16 };
|
||||
static const int CAcCodeT[] = {
|
||||
0x0000, 0x0001, 0x0004, 0x000a,
|
||||
0x0018, 0x0019, 0x0038, 0x0078,
|
||||
0x01f4, 0x03f6, 0x0ff4, 0x000b,
|
||||
0x0039, 0x00f6, 0x01f5, 0x07f6,
|
||||
0x0ff5, 0xff88, 0xff89, 0xff8a,
|
||||
0xff8b, 0x001a, 0x00f7, 0x03f7,
|
||||
0x0ff6, 0x7fc2, 0xff8c, 0xff8d,
|
||||
0xff8e, 0xff8f, 0xff90, 0x001b,
|
||||
0x00f8, 0x03f8, 0x0ff7, 0xff91,
|
||||
0xff92, 0xff93, 0xff94, 0xff95,
|
||||
0xff96, 0x003a, 0x01f6, 0xff97,
|
||||
0xff98, 0xff99, 0xff9a, 0xff9b,
|
||||
0xff9c, 0xff9d, 0xff9e, 0x003b,
|
||||
0x03f9, 0xff9f, 0xffa0, 0xffa1,
|
||||
0xffa2, 0xffa3, 0xffa4, 0xffa5,
|
||||
0xffa6, 0x0079, 0x07f7, 0xffa7,
|
||||
0xffa8, 0xffa9, 0xffaa, 0xffab,
|
||||
0xffac, 0xffad, 0xffae, 0x007a,
|
||||
0x07f8, 0xffaf, 0xffb0, 0xffb1,
|
||||
0xffb2, 0xffb3, 0xffb4, 0xffb5,
|
||||
0xffb6, 0x00f9, 0xffb7, 0xffb8,
|
||||
0xffb9, 0xffba, 0xffbb, 0xffbc,
|
||||
0xffbd, 0xffbe, 0xffbf, 0x01f7,
|
||||
0xffc0, 0xffc1, 0xffc2, 0xffc3,
|
||||
0xffc4, 0xffc5, 0xffc6, 0xffc7,
|
||||
0xffc8, 0x01f8, 0xffc9, 0xffca,
|
||||
0xffcb, 0xffcc, 0xffcd, 0xffce,
|
||||
0xffcf, 0xffd0, 0xffd1, 0x01f9,
|
||||
0xffd2, 0xffd3, 0xffd4, 0xffd5,
|
||||
0xffd6, 0xffd7, 0xffd8, 0xffd9,
|
||||
0xffda, 0x01fa, 0xffdb, 0xffdc,
|
||||
0xffdd, 0xffde, 0xffdf, 0xffe0,
|
||||
0xffe1, 0xffe2, 0xffe3, 0x07f9,
|
||||
0xffe4, 0xffe5, 0xffe6, 0xffe7,
|
||||
0xffe8, 0xffe9, 0xffea, 0xffeb,
|
||||
0xffec, 0x3fe0, 0xffed, 0xffee,
|
||||
0xffef, 0xfff0, 0xfff1, 0xfff2,
|
||||
0xfff3, 0xfff4, 0xfff5, 0x03fa,
|
||||
0x7fc3, 0xfff6, 0xfff7, 0xfff8,
|
||||
0xfff9, 0xfffa, 0xfffb, 0xfffc,
|
||||
0xfffd, 0xfffe };
|
||||
static const G4HuffmanCodeTable CAcHuffmanT = {
|
||||
162,
|
||||
(int*)CAcSizeT,
|
||||
(int*)CAcCodeT
|
||||
};
|
||||
|
||||
static const int CEOBidx = 0;
|
||||
static const int CZRLidx = 151;
|
||||
|
||||
//HuffmanCode
|
||||
|
||||
static const int DcDhtLength = 0x21;
|
||||
static const int AcDhtLength = 0xb7;
|
||||
|
||||
static const u_char YDcDht[] = {
|
||||
0xff, 0xc4,
|
||||
0x00, 0x1f,
|
||||
0x00,
|
||||
0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0a, 0x0b
|
||||
};
|
||||
|
||||
static const u_char CDcDht[] = {
|
||||
0xff, 0xc4,
|
||||
0x00, 0x1f,
|
||||
0x01,
|
||||
0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0a, 0x0b
|
||||
};
|
||||
|
||||
static const u_char YAcDht[] = {
|
||||
0xff, 0xc4,
|
||||
0x00, 0xb5,
|
||||
0x10,
|
||||
|
||||
0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x03,
|
||||
0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7d,
|
||||
|
||||
0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
|
||||
0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
|
||||
0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
|
||||
0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
|
||||
0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
|
||||
0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
|
||||
0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
|
||||
0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
|
||||
0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||
0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
|
||||
0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
|
||||
0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
|
||||
0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
|
||||
0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
||||
0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
|
||||
0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
|
||||
0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
|
||||
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
|
||||
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
|
||||
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa
|
||||
};
|
||||
|
||||
static const u_char CAcDht[] = {
|
||||
0xff, 0xc4,
|
||||
0x00, 0xb5,
|
||||
0x11,
|
||||
|
||||
0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04,
|
||||
0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77,
|
||||
|
||||
0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
|
||||
0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
|
||||
0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
|
||||
0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
|
||||
0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
|
||||
0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
|
||||
0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
|
||||
0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
|
||||
0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
|
||||
0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
|
||||
0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
|
||||
0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
|
||||
0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
|
||||
0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
|
||||
0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
|
||||
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
|
||||
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// 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: G4RTJpegMaker.hh,v 1.4 2000/03/09 17:38:32 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a concrete class of G4VFigureFileMaker.
|
||||
// This class converts 8 bits unsighned integer arrays which represent RGB of
|
||||
// each pixel to JPEG code and stores it to a file. The only one public method
|
||||
// of this class will be invoked by G4RayTracer.
|
||||
//
|
||||
|
||||
#ifndef G4RTJpegMaker_H
|
||||
#define G4RTJpegMaker_H 1
|
||||
|
||||
#include "G4VFigureFileMaker.hh"
|
||||
#include "G4RTJpeg.hh"
|
||||
|
||||
class G4RTJpegMaker : public G4VFigureFileMaker
|
||||
{
|
||||
public:
|
||||
G4RTJpegMaker();
|
||||
virtual ~G4RTJpegMaker();
|
||||
|
||||
public:
|
||||
virtual void CreateFigureFile(G4String fileName,
|
||||
int nColumn,int nRow,
|
||||
u_char* colorR, u_char* colorG,
|
||||
u_char* colorB);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
// 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: G4RTMessenger.hh,v 1.3 2000/03/09 17:38:32 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a concrete class of G4UImessenger. This class defines various
|
||||
// UI commands which are unique to G4RayTracer.
|
||||
//
|
||||
|
||||
|
||||
#ifndef G4RTMessenger_HH
|
||||
#define G4RTMessenger_HH 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithABool;
|
||||
class G4UIcmdWith3Vector;
|
||||
class G4UIcmdWith3VectorAndUnit;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithAString;
|
||||
class G4RayTracer;
|
||||
class G4RTSteppingAction;
|
||||
|
||||
class G4RTMessenger : public G4UImessenger
|
||||
{
|
||||
public:
|
||||
G4RTMessenger(G4RayTracer* p1,G4RTSteppingAction* p2);
|
||||
virtual ~G4RTMessenger();
|
||||
|
||||
virtual G4String GetCurrentValue(G4UIcommand * command);
|
||||
virtual void SetNewValue(G4UIcommand * command,G4String newValue);
|
||||
|
||||
private:
|
||||
G4RayTracer* theTracer;
|
||||
G4RTSteppingAction* theSteppingAction;
|
||||
|
||||
G4UIdirectory* rayDirectory;
|
||||
G4UIcmdWithAnInteger* columnCmd;
|
||||
G4UIcmdWithAnInteger* rowCmd;
|
||||
G4UIcmdWith3VectorAndUnit* targetCmd;
|
||||
G4UIcmdWith3VectorAndUnit* eyePosCmd;
|
||||
G4UIcmdWith3Vector* lightCmd;
|
||||
G4UIcmdWithADoubleAndUnit* spanXCmd;
|
||||
G4UIcmdWithADoubleAndUnit* headCmd;
|
||||
G4UIcmdWithADoubleAndUnit* attCmd;
|
||||
G4UIcmdWithABool* distCmd;
|
||||
G4UIcmdWithABool* transCmd;
|
||||
G4UIcmdWithAString* fileCmd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// 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: G4RTOutBitStream.hh,v 1.5 2000/03/09 17:38:32 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This class represents a line of JPEG code. This class must be used exclusively
|
||||
// by G4RTJpegCoder.
|
||||
//
|
||||
|
||||
#ifndef G4RTOutBitStream_H
|
||||
#define G4RTOutBitStream_H 1
|
||||
#include "G4RTJpeg.hh"
|
||||
|
||||
static const u_char BitFullMaskT[8] = {0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f
|
||||
, 0xff};
|
||||
|
||||
class G4OutBitStream
|
||||
{
|
||||
public:
|
||||
G4OutBitStream(int size);
|
||||
void SetBits(int v, int numBits);
|
||||
void SetByte(u_char dat);
|
||||
void SetWord(u_int dat);
|
||||
void CopyByte(const char* src, int n);
|
||||
|
||||
u_char* GetStreamAddress(void){return mHeadOfBuf;};
|
||||
int GetStreamSize(void){return mBuf - mHeadOfBuf;};
|
||||
|
||||
|
||||
protected:
|
||||
u_char* mHeadOfBuf;
|
||||
u_char* mBuf;
|
||||
u_char* mEndOfBuf;
|
||||
int mBitPos;
|
||||
int mWriteFlag;
|
||||
|
||||
void IncBuf(void);
|
||||
void FullBit(void);
|
||||
void Set8Bits(u_char v, int numBits);
|
||||
void SetFewBits(u_char v, int numBits);
|
||||
void SetBits2Byte(u_char v, int numBits);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,52 @@
|
||||
// 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: G4RTSteppingAction.hh,v 1.3 2000/03/09 17:38:32 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a concrete class of G4UserSteppingAction. This class is used
|
||||
// by G4RayTracer for managing a ray tracked through volumes. An object
|
||||
// of this class is constructed by G4RayTracer and set to G4SteppingManager
|
||||
// with replacement of user defined stepping action during the period of
|
||||
// ray tracing.
|
||||
//
|
||||
|
||||
//////////////////////
|
||||
//G4RTSteppingAction
|
||||
/////////////////////
|
||||
|
||||
|
||||
#ifndef G4RTSteppingAction_h
|
||||
#define G4RTSteppingAction_h 1
|
||||
|
||||
|
||||
#include "G4UserSteppingAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4RTSteppingAction : public G4UserSteppingAction
|
||||
{
|
||||
public:
|
||||
G4RTSteppingAction();
|
||||
virtual ~G4RTSteppingAction(){;}
|
||||
|
||||
virtual void UserSteppingAction(const G4Step*);
|
||||
|
||||
private:
|
||||
G4bool ignoreTransparency;
|
||||
|
||||
public:
|
||||
inline void SetIgnoreTransparency(G4bool val)
|
||||
{ ignoreTransparency = val; }
|
||||
inline G4bool GetIgnoreTransparency() const
|
||||
{ return ignoreTransparency; }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
// 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: G4RTTrackingAction.hh,v 1.3 2000/03/09 17:38:32 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a concrete class of G4UserTrackingAction. This class is used
|
||||
// by G4RayTracer for managing a ray tracked through volumes. An object
|
||||
// of this class is constructed by G4RayTracer and set to G4TrackingManager
|
||||
// with replacement of user defined tracking action during the period of
|
||||
// ray tracing.
|
||||
//
|
||||
|
||||
///////////////////////
|
||||
//G4RTTrackingAction.hh
|
||||
///////////////////////
|
||||
|
||||
|
||||
#ifndef G4RTTrackingAction_h
|
||||
#define G4RTTrackingAction_h 1
|
||||
|
||||
#include "G4UserTrackingAction.hh"
|
||||
|
||||
class G4Track;
|
||||
|
||||
///////////////////////////
|
||||
class G4RTTrackingAction : public G4UserTrackingAction
|
||||
///////////////////////////
|
||||
{
|
||||
|
||||
//--------
|
||||
public:
|
||||
//--------
|
||||
|
||||
// Constructor & Destructor
|
||||
G4RTTrackingAction(){;}
|
||||
virtual ~G4RTTrackingAction(){;}
|
||||
|
||||
// Member functions
|
||||
virtual void PreUserTrackingAction(const G4Track* aTrack);
|
||||
virtual void PostUserTrackingAction(const G4Track* aTrack){;}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
// 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: G4RayShooter.hh,v 1.2 2000/03/09 17:38:33 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// the object of this class shoots a ray (actually geantino) primary particle
|
||||
// associated with a G4Event object. This slass must be used exclusively by
|
||||
// G4RayTracer.
|
||||
//
|
||||
|
||||
#ifndef G4RayShooter_h
|
||||
#define G4RayShooter_h 1
|
||||
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4PrimaryVertex.hh"
|
||||
#include "G4ParticleMomentum.hh"
|
||||
|
||||
class G4Event;
|
||||
|
||||
class G4RayShooter
|
||||
{
|
||||
public:
|
||||
G4RayShooter();
|
||||
public:
|
||||
virtual ~G4RayShooter();
|
||||
|
||||
public: // with description
|
||||
void Shoot(G4Event* evt,G4ThreeVector vtx,G4ThreeVector direc);
|
||||
// This method generates a primary vertex and a primary particle at the
|
||||
// given vertex point and with the given direction. This method is invoked
|
||||
// by G4RayTracer.
|
||||
|
||||
private:
|
||||
void SetInitialValues();
|
||||
|
||||
G4ParticleDefinition* particle_definition;
|
||||
G4ParticleMomentum particle_momentum_direction;
|
||||
G4double particle_energy;
|
||||
G4ThreeVector particle_position;
|
||||
G4double particle_time;
|
||||
G4ThreeVector particle_polarization;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
// 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: G4RayTracer.hh,v 1.5 2000/03/09 17:38:33 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#ifndef G4RayTracer_H
|
||||
#define G4RayTracer_H 1
|
||||
|
||||
// class description:
|
||||
//
|
||||
// G4RayTracer
|
||||
// This is a graphics driver of Geant4 which generates a figure file by
|
||||
// ray tracing technique. The format of output figure file can be selected
|
||||
// by assigning a pointer of G4VFigureFileMaker concrete class object.
|
||||
// The main entry of ray tracing is Trace() method, which is available
|
||||
// only at Idle state. G4RayTracer shoots rays and controls its own event
|
||||
// loop. It generates G4Event objects used for its own purpose. When ray
|
||||
// tracing is working, all sensitive detectors are inactivated and all
|
||||
// user action classes are swapped out. Still, verbosities set to Geant4
|
||||
// manager classes are concerned. Thus, it is recommended to set verbosities
|
||||
// to minimum (usually zero).
|
||||
// G4RayTracer can visualise absolutely all kinds of geometrical shapes
|
||||
// which G4Navigator can deal with. Instead, it can NOT visualise hits
|
||||
// nor trajectories generated by usual simulation.
|
||||
// To make G4RayTracer library, G4VIS_BUILD_RAYTRACER_DRIVER environment
|
||||
// variable must be set before compiling visualization category. To use
|
||||
// G4RayTracer with your program, G4VIS_USE_RAYTRACER environment variable
|
||||
// must be set before compiling your program and your VisManager concrete
|
||||
// implementation must contain
|
||||
// RegisterGraphicsSystem (new G4RayTracer);
|
||||
//
|
||||
|
||||
#if defined (G4VIS_BUILD_RAYTRACER_DRIVER) || defined (G4VIS_USE_RAYTRACER)
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
class G4Event;
|
||||
class G4EventManager;
|
||||
class G4UserEventAction;
|
||||
class G4UserStackingAction;
|
||||
class G4UserTrackingAction;
|
||||
class G4UserSteppingAction;
|
||||
class G4RTTrackingAction;
|
||||
class G4RTSteppingAction;
|
||||
class G4Colour;
|
||||
class G4RTMessenger;
|
||||
class G4RayShooter;
|
||||
class G4VFigureFileMaker;
|
||||
class G4RayTrajectoryPoint;
|
||||
class G4VisAttributes;
|
||||
|
||||
|
||||
class G4RayTracer : public G4VGraphicsSystem
|
||||
{
|
||||
public: // with description
|
||||
G4RayTracer(G4VFigureFileMaker* figMaker = 0);
|
||||
// Constructor. The argument is the pointer to G4VFigureFileMaker concrete
|
||||
// class object. If it is not set and SetFigureFileMaker() method is not
|
||||
// invoked before Trace() command is invoked, then G4RTJpegMaker will be
|
||||
// used and JPEG file will be generated.
|
||||
|
||||
public:
|
||||
~G4RayTracer();
|
||||
|
||||
public: // with description
|
||||
void Trace(G4String fileName);
|
||||
// The main entry point which triggers ray tracing. "fileName" is output
|
||||
// file name, and it must contain extention (e.g. myFigure.jpg). This
|
||||
// method is available only if Geant4 is at Idle state.
|
||||
|
||||
public:
|
||||
virtual G4VSceneHandler* CreateSceneHandler (const G4String& );
|
||||
virtual G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& );
|
||||
|
||||
private:
|
||||
G4bool CreateBitMap();
|
||||
// Event loop
|
||||
void CreateFigureFile(G4String fileName);
|
||||
// Create figure file after an event loop
|
||||
G4bool GenerateColour(G4Event* anEvent);
|
||||
// Calcurate RGB for one trajectory
|
||||
void StoreUserActions();
|
||||
void RestoreUserActions();
|
||||
// Store and restore user action classes if defined
|
||||
|
||||
G4Colour GetSurfaceColour(G4RayTrajectoryPoint* point);
|
||||
G4Colour GetMixedColour(G4Colour surfCol,G4Colour transCol,G4double weight=0.5);
|
||||
G4Colour Attenuate(G4RayTrajectoryPoint* point, G4Colour sourceCol);
|
||||
G4bool ValidColour(const G4VisAttributes* visAtt);
|
||||
|
||||
public: // with description
|
||||
inline void SetFigureFileMaker(G4VFigureFileMaker* figMaker)
|
||||
// Set a concrete class of G4VFigureFileMaker for assigning the format of
|
||||
// output figure file.
|
||||
{ theFigMaker = figMaker; }
|
||||
|
||||
private:
|
||||
G4RayShooter * theRayShooter;
|
||||
G4VFigureFileMaker * theFigMaker;
|
||||
G4RTMessenger * theMessenger;
|
||||
|
||||
G4EventManager * theEventManager;
|
||||
|
||||
G4UserEventAction * theUserEventAction;
|
||||
G4UserStackingAction * theUserStackingAction;
|
||||
G4UserTrackingAction * theUserTrackingAction;
|
||||
G4UserSteppingAction * theUserSteppingAction;
|
||||
|
||||
G4UserEventAction * theRayTracerEventAction;
|
||||
G4UserStackingAction * theRayTracerStackingAction;
|
||||
G4RTTrackingAction * theRayTracerTrackingAction;
|
||||
G4RTSteppingAction * theRayTracerSteppingAction;
|
||||
|
||||
unsigned char* colorR;
|
||||
unsigned char* colorG;
|
||||
unsigned char* colorB;
|
||||
|
||||
G4int nColumn;
|
||||
G4int nRow;
|
||||
|
||||
G4ThreeVector eyePosition;
|
||||
G4ThreeVector targetPosition;
|
||||
G4ThreeVector eyeDirection;
|
||||
G4ThreeVector lightDirection;
|
||||
G4double headAngle;
|
||||
G4double viewSpan; // Angle per 100 pixels
|
||||
G4double attenuationLength;
|
||||
|
||||
G4bool distortionOn;
|
||||
|
||||
public:
|
||||
inline void SetNColumn(G4int val) { nColumn = val; }
|
||||
inline G4int GetNColumn() const { return nColumn; }
|
||||
inline void SetNRow(G4int val) { nRow = val; }
|
||||
inline G4int GetNRow() const { return nRow; }
|
||||
inline void SetEyePosition(G4ThreeVector val) { eyePosition = val; }
|
||||
inline G4ThreeVector GetEyePosition() const { return eyePosition; }
|
||||
inline void SetTargetPosition(G4ThreeVector val) { targetPosition = val; }
|
||||
inline G4ThreeVector GetTargetPosition() const { return targetPosition; }
|
||||
inline void SetLightDirection(G4ThreeVector val) { lightDirection = val.unit(); }
|
||||
inline G4ThreeVector GetLightDirection() const { return lightDirection; }
|
||||
inline void SetHeadAngle(G4double val) { headAngle = val; }
|
||||
inline G4double GetHeadAngle() const { return headAngle; }
|
||||
inline void SetViewSpan(G4double val) { viewSpan = val; }
|
||||
inline G4double GetViewSpan() const { return viewSpan; }
|
||||
inline void SetAttenuationLength(G4double val) { attenuationLength = val; }
|
||||
inline G4double GetAttenuationLength() const { return attenuationLength; }
|
||||
inline void SetDistortion(G4bool val) { distortionOn = val; }
|
||||
inline G4bool GetDistortion() const { return distortionOn; }
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// 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: G4RayTracerFeatures.hh,v 1.2 2000/03/09 15:36:35 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#ifndef G4RayTracerFeatures_HH
|
||||
#define G4RayTracerFeatures_HH 1
|
||||
|
||||
// To make John Allison happy...........
|
||||
|
||||
const char RAYTRACER_FEATURES[] =
|
||||
"Low quality high speed visualization using Geant4 kernel tracking mechanism.\
|
||||
\n Features: Generate JPEG file(s) as default \
|
||||
\n Visualize all kinds of solids including boolean solids \
|
||||
\n Disadvantages : Conceptually trajectories and hits cannot be drawn \
|
||||
\n No direct visualization";
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// 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: G4RayTracerSceneHandler.hh,v 1.2 2000/02/28 15:19:49 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
|
||||
// John Allison 17th March 2000
|
||||
|
||||
#ifndef G4RAYTRACERSCENEHANDLER_HH
|
||||
#define G4RAYTRACERSCENEHANDLER_HH
|
||||
|
||||
#include "G4VSceneHandler.hh"
|
||||
|
||||
class G4RayTracerSceneHandler: public G4VSceneHandler {
|
||||
|
||||
public:
|
||||
|
||||
G4RayTracerSceneHandler(G4VGraphicsSystem& system,
|
||||
const G4String& name = "");
|
||||
virtual ~G4RayTracerSceneHandler();
|
||||
|
||||
void AddPrimitive(const G4Polyline&){}
|
||||
void AddPrimitive(const G4Text&){}
|
||||
void AddPrimitive(const G4Circle&){}
|
||||
void AddPrimitive(const G4Square&){}
|
||||
void AddPrimitive(const G4Polyhedron&){}
|
||||
void AddPrimitive(const G4NURBS&){}
|
||||
void AddPrimitive(const G4Polymarker&){}
|
||||
|
||||
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 G4Polycone&){}
|
||||
void AddThis(const G4Polyhedra&){}
|
||||
void AddThis(const G4VSolid&){}
|
||||
|
||||
static G4int GetSceneCount();
|
||||
|
||||
private:
|
||||
static G4int fSceneIdCount; // Counter for RayTracer scene handlers.
|
||||
static G4int fSceneCount; // No. of extanct scenes.
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
// 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: G4RayTracerViewer.hh,v 1.2 2000/02/28 15:19:49 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
|
||||
// John Allison 17th March 2000
|
||||
|
||||
#ifndef G4RAYTRACERVIEWER_HH
|
||||
#define G4RAYTRACERVIEWER_HH
|
||||
|
||||
#include "G4VViewer.hh"
|
||||
|
||||
class G4RayTracerViewer: virtual public G4VViewer {
|
||||
public:
|
||||
G4RayTracerViewer(G4VSceneHandler&,const G4String& name);
|
||||
virtual ~G4RayTracerViewer();
|
||||
void SetView();
|
||||
void ClearView();
|
||||
void DrawView();
|
||||
private:
|
||||
G4int fFileCount;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
// 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: G4RayTrajectory.hh,v 1.5 2000/03/09 17:38:33 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a concrete class of G4VTrajectory which represents a trajectory of a ray.
|
||||
// This class is used by G4RayTracer. Objects of this class are created by G4RTTrackingAction.
|
||||
// This class does not have concrete implementations of draw and print methods but
|
||||
// information stored in this class is used by determining a colour of a pixel of the picture.
|
||||
//
|
||||
|
||||
///////////////////
|
||||
//G4RayTrajectory.hh
|
||||
///////////////////
|
||||
|
||||
#ifndef G4RayTrajectory_h
|
||||
#define G4RayTrajectory_h 1
|
||||
|
||||
class G4Step;
|
||||
|
||||
#include "G4VTrajectory.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include <stdlib.h>
|
||||
#include <g4rw/tpordvec.h>
|
||||
#include "globals.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4RayTrajectoryPoint.hh"
|
||||
|
||||
|
||||
class G4RayTrajectory : public G4VTrajectory
|
||||
{
|
||||
public:
|
||||
|
||||
G4RayTrajectory();
|
||||
G4RayTrajectory(G4RayTrajectory & right);
|
||||
virtual ~G4RayTrajectory();
|
||||
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
inline int operator == (const G4RayTrajectory& right){return (this==&right);}
|
||||
|
||||
virtual void AppendStep(const G4Step*);
|
||||
virtual void ShowTrajectory() const;
|
||||
virtual void DrawTrajectory(G4int i_mode=0) const {;}
|
||||
virtual int GetPointEntries() const {return positionRecord->entries();}
|
||||
virtual G4VTrajectoryPoint* GetPoint(G4int i) const
|
||||
{ return (*positionRecord)[i]; }
|
||||
G4RayTrajectoryPoint* GetPointC(G4int i) const
|
||||
{ return (*positionRecord)[i]; }
|
||||
virtual void MergeTrajectory(G4VTrajectory* secondTrajectory);
|
||||
|
||||
private:
|
||||
|
||||
G4RWTPtrOrderedVector<G4RayTrajectoryPoint>* positionRecord;
|
||||
};
|
||||
|
||||
|
||||
extern G4Allocator<G4RayTrajectory> G4RayTrajectoryAllocator;
|
||||
|
||||
inline void* G4RayTrajectory::operator new(size_t)
|
||||
{
|
||||
void* aTrajectory;
|
||||
aTrajectory = (void*)G4RayTrajectoryAllocator.MallocSingle();
|
||||
return aTrajectory;
|
||||
}
|
||||
|
||||
inline void G4RayTrajectory::operator delete(void* aTrajectory)
|
||||
{
|
||||
G4RayTrajectoryAllocator.FreeSingle((G4RayTrajectory*)aTrajectory);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
// 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: G4RayTrajectoryPoint.hh,v 1.3 2000/03/09 17:38:33 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a concrete class of G4VTrajectoryPoint which represents a point where
|
||||
// a ray crosses upon a surface of a volume regardless of its visibility. Objects
|
||||
// of this class are created by G4RayTrajectory class object.
|
||||
//
|
||||
|
||||
/////////////////////////
|
||||
//G4RayTrajectoryPoint.hh
|
||||
/////////////////////////
|
||||
|
||||
#ifndef G4RayTrajectoryPoint_h
|
||||
#define G4RayTrajectoryPoint_h 1
|
||||
|
||||
class G4VisAttributes;
|
||||
#include "globals.hh"
|
||||
#include "G4VTrajectoryPoint.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4RayTrajectoryPoint :public G4VTrajectoryPoint
|
||||
{
|
||||
public:
|
||||
G4RayTrajectoryPoint();
|
||||
virtual ~G4RayTrajectoryPoint();
|
||||
|
||||
inline void *operator new(size_t);
|
||||
inline void operator delete(void *aTrajectoryPoint);
|
||||
inline int operator==(const G4RayTrajectoryPoint& right) const
|
||||
{ return (this==&right); };
|
||||
|
||||
private:
|
||||
const G4VisAttributes* preStepAtt;
|
||||
const G4VisAttributes* postStepAtt;
|
||||
G4ThreeVector surfaceNormal;
|
||||
G4double stepLength;
|
||||
|
||||
public:
|
||||
inline void SetPreStepAtt(const G4VisAttributes* val) { preStepAtt = val; }
|
||||
inline const G4VisAttributes* GetPreStepAtt() const { return preStepAtt; }
|
||||
inline void SetPostStepAtt(const G4VisAttributes* val) { postStepAtt = val; }
|
||||
inline const G4VisAttributes* GetPostStepAtt() const { return postStepAtt; }
|
||||
inline void SetSurfaceNormal(G4ThreeVector val) { surfaceNormal = val; }
|
||||
inline G4ThreeVector GetSurfaceNormal() const { return surfaceNormal; }
|
||||
inline void SetStepLength(G4double val) { stepLength = val; }
|
||||
inline G4double GetStepLength() const { return stepLength; }
|
||||
|
||||
};
|
||||
|
||||
extern G4Allocator<G4RayTrajectoryPoint> G4RayTrajectoryPointAllocator;
|
||||
|
||||
inline void* G4RayTrajectoryPoint::operator new(size_t)
|
||||
{
|
||||
void *aTrajectoryPoint;
|
||||
aTrajectoryPoint = (void *) G4RayTrajectoryPointAllocator.MallocSingle();
|
||||
return aTrajectoryPoint;
|
||||
}
|
||||
|
||||
inline void G4RayTrajectoryPoint::operator delete(void *aTrajectoryPoint)
|
||||
{
|
||||
G4RayTrajectoryPointAllocator.FreeSingle((G4RayTrajectoryPoint *) aTrajectoryPoint);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// 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: G4VFigureFileMaker.hh,v 1.3 2000/03/09 17:38:33 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is an abstract class represents a class which generates a figure file
|
||||
// converting from RGB 8 bits unsigned integers to a kind of picture format.
|
||||
//
|
||||
|
||||
#ifndef G4VFigureFileMaker_H
|
||||
#define G4VFigureFileMaker_H 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4VFigureFileMaker
|
||||
{
|
||||
public:
|
||||
G4VFigureFileMaker() {;}
|
||||
virtual ~G4VFigureFileMaker() {;}
|
||||
|
||||
public:
|
||||
virtual void CreateFigureFile(G4String fileName,
|
||||
int nColumn,int nRow,
|
||||
unsigned char* colorR, unsigned char* colorG,
|
||||
unsigned char* colorB) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user