Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
@@ -0,0 +1,261 @@
###########################################
## Environmental variables to CUSTOMIZE ##
## Geant4 DAWNFILE visualization driver ##
###########################################
Sept. 1, 2002
Satoshi Tanaka
stanaka@cs.ritsumei.ac.jp
#----- << G4DAWNFILE_DEST_DIR >> -----
# Set a directory where g4_XX.prim and g4_XX.eps files
# are generated.
# Do not forget to add the file separator
# "/" (Unix/Linux) or "\" (Windows) at the end.
# The default directory is the current directory.
#
# Example:
#
# setenv G4DAWNFILE_DEST_DIR "/home/username/tmp/"
#----- << G4DAWNFILE_MAX_FILE_NUM >> -----
# Set a maximal number of generated g4_XX.prim files.
# Upto this number "XX" is automatically incremented,
# starting from "00".
# The default number is 100.
#
# Example:
#
# setenv G4DAWNFILE_MAX_FILE_NUM 100
#----- << G4DAWNFILE_MULTI_WINDOW >> -----
# Boolean flag to set on/off multi-window mode.
# If this variable is set and its value is non-zero,
# Geant4 invokes Renderer DAWN with the multi-X-window mode.
# Otherwise DAWN is invoked with the EPS mode, in which
# EPS files are generated and viewed with a PS viewer.
# The default value is "0".
#
# Example:
#
# setenv G4DAWNFILE_MULTI_WINDOW "0"
# setenv G4DAWNFILE_MULTI_WINDOW "1"
#----- << G4DAWNFILE_PRECISION >> -----
# Set precision of double numbers in g4_XX.prim files.
# The number is used as
# sprintf( string, "%*.*g", (precision+8), precision, value).
# See G4DAWNFILESceneHandler::G4DAWNFILESceneHandler()
# for more details.
# The default precision is "9".
#
# Example:
#
# setenv G4DAWNFILE_PRECISION 9
#----- << G4DAWNFILE_PS_VIEWER >> -----
# Set a name of the PostScript viewer to visualize
# generated g4_XX.eps files.
# The default viewer name is "gv".
#
# Example:
#
# setenv G4DAWNFILE_PS_VIEWER gv
#----- << G4DAWNFILE_VIEWER >> -----
# Set a name of the renderer to visualize
# generated g4_XX.prim files.
# The default renderer name is "dawn".
# Set this variable to "david" to execute
# volume-overlapping detection.
#
# Example:
#
# setenv G4DAWNFILE_VIEWER dawn
# setenv G4DAWNFILE_VIEWER david
###########################################
## Environmental variables to CUSTOMIZE ##
## Renderer DAWN ##
###########################################
#----- << DAWN_BATCH >> -----
# Set on/off the batch mode.
#
# If this variable is set to "1",
# the DAWN GUI panel does not invoked.
# Visualization is not performed, either.
# But an EPS file is generated.
#
# If this variable is set to "a",
# the effects are the same as "1" except that
# every generated EPS data is appended to one file.
# In the on-line use of Renderer DAWN connected
# with the Geant4 DAWNFILE driver,
# you should also set as
#
# setenv G4DAWNFILE_MAX_FILENUM 1
#
# The dafault value is "0", i.e., the batch mode is off.
#
# Example:
#
# setenv DAWN_BATCH "0"
# setenv DAWN_BATCH "1"
# setenv DAWN_BATCH "a"
#----- << DAWN_BFC_MODE >> -----
# Set on/off the back-face-culling mode.
# If this mode is set on, analytical hidden-surface removal
# is skipped, and only back-face culling is performed.
# This mode is fast, but inaccurate.
# "1": on
# "0": off
# The default value of "0".
#
# Example:
#
# setenv DAWN_BFC_MODE "0"
# setenv DAWN_BFC_MODE "1"
#----- << DAWN_DEVICE >> -----
# Set the default viewing device
# 1: PS: 2: XWIN, 3: PS2, 4: XWIN2, 5: OPEN_GL
#
# Note: This variable is effective only in the
# off-line use of Renderer DAWN.
#
# Example:
#
# setenv DAWN_DEVICE "1"
# setenv DAWN_DEVICE "2"
# setenv DAWN_DEVICE "3"
# setenv DAWN_DEVICE "4"
# setenv DAWN_DEVICE "5"
#----- << DAWN_HIDLINE_REMOVAL >> -----
# Set on/off the hidden-line-removal mode
# If this mode is on, hidden-line removal is performed.
# "1": on
# "0": off
# The default value is "1".
#
# Example:
#
# setenv DAWN_HIDLINE_REMOVAL "0"
# setenv DAWN_HIDLINE_REMOVAL "1"
#----- << DAWN_PS_PREVIEWER >> -----
# Set a name of the PostScript viewer.
# The default value is "gv".
# "NONE" to skip viewing.
#
# Example:
#
# setenv DAWN_PS_PREVIEWER "gv"
#----- << DAWN_UP_DIRECTION >> -----
# Set viewing-upward direction.
# Select "Y" or "Z".
# The default is "Y", i.e., (0,1,0)-direction
#
# Example:
#
# setenv DAWN_UP_DIRECTION "Y"
# setenv DAWN_UP_DIRECTION "Z"
#----- << DAWN_USE_STENCIL >> -----
# Set on/off use of the stencil buffer in the OpenGL mode.
# If this mode is on, edges are drawn.
# "1": on
# "0": off
# The default value of "0".
#
# Example:
#
# setenv DAWN_USE_STENCIL "0"
# setenv DAWN_USE_STENCIL "1"
###############################################
## Environmental variables to CUSTOMIZE ##
## Geant4 DAWN-Network visualization driver ##
## ##
## Note: This driver should be used only ##
## for remote visualizaton.) ##
###############################################
#----- << G4DAWN_GUI_ALWAYS >>
# Boolean flag to control GUI invokation.
# If this variable is set and the value is non-zero,
# DAWN connected with GEANT4 always pops up GUI menu.
# The default is "0", i.e., no GUI.
#
# Example:
#
# setenv G4DAWN_GUI_ALWAYS "0"
# setenv G4DAWN_GUI_ALWAYS "1"
#----- << G4DAWN_HOST_NAME >>
# Set a host where Renderer DAWN is running with
# the INET mode, i.e., invoked as "dawn -G".
# If the environmental variable G4DAWN_NAMED_PIPE
# is set to "1", this host setting is ignored.
#
# Example:
#
# setenv G4DAWN_HOST_NAME cernsp.cern.ch
#----- << G4DAWN_MULTI_WINDOW >>
# Boolean flag to set on/off multi-window mode.
# If this variable is set and its value is non-zero,
# Geant4 invokes Renderer DAWN with the multi-X-window mode.
# Otherwise DAWN is invoked with the EPS mode, in which
# EPS files are generated and viewed with a PS viewer.
# The default value is "0".
#
# Example:
#
# setenv G4DAWN_MULTI_WINDOW "0"
# setenv G4DAWN_MULTI_WINDOW "1"
#----- << G4DAWN_NAMED_PIPE >> -----
# Boolean flag to set on/off BSD-type Unix-domain connection.
# If this variable is set and the value is non-zero,
# Renderer DAWN connected with GEANT4 in the BSD-type Unix domain,
# i.e. through named pipe.
# The default is "0", i.e., do no use this type of connection.
#
# Example:
#
# setenv G4DAWN_NAMED_PIPE "0"
# setenv G4DAWN_NAMED_PIPE "1"
#----- << G4DAWN_PRECISION >> -----
# Set precision of double numbers in g4_XX.prim files.
# The number is used as
# sprintf( string, "%*.*g", (precision+8), precision, value).
# See G4DAWNFILESceneHandler::G4DAWNFILESceneHandler()
# for more details.
# The default precision is "9".
#
# Example:
#
# setenv G4DAWN_PRECISION 9
@@ -1,3 +1,6 @@
DAWN-V04-01-01 Satoshi TANAKA Sept 01, 2002
- Precision control with "setenv G4DAWNFILE_PRECISION number".
DAWN-V03-02-01 Satoshi TANAKA Sept 18, 2001
- Maximal number of g4.prim file is changed from 99 to 100.
@@ -22,7 +22,7 @@
//
//
// $Id: G4DAWNFILE.hh,v 1.8 2001/07/27 22:32:55 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// Satoshi TANAKA
// DAWNFILE driver factory.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4DAWNFILESceneHandler.hh,v 1.10 2001/09/17 07:40:32 stanaka Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4DAWNFILESceneHandler.hh,v 1.12 2002/12/11 15:58:02 johna Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// Satoshi TANAKA
@@ -86,6 +86,12 @@ public:
G4VSceneHandler::AddThis (polyhedra);
}
void AddThis ( const G4VSolid& solid );
void AddThis ( const G4VTrajectory& traj) {
G4VSceneHandler::AddThis(traj);
}
void AddThis ( const G4VHit& hit) {
G4VSceneHandler::AddThis(hit);
}
void ClearTransientStore(); // Used for triggering detector re-drawing.
@@ -229,6 +235,8 @@ private:
char fG4PrimDestDir [256] ;
char fG4PrimFileName[256] ;
G4int fMaxFileNum ;
G4int fPrec, fPrec2 ;
};
@@ -22,7 +22,7 @@
//
//
// $Id: G4DAWNFILEViewer.hh,v 1.8 2001/07/27 22:32:57 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// Satoshi TANAKA
// DAWNFILE viewer - opens window, hard copy, etc.
@@ -22,7 +22,7 @@
//
//
// $Id: G4FRClientServer.hh,v 1.6 2001/07/11 10:08:44 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// Satoshi TANAKA, Wed Jul 3 14:13:52 JST 1996
////////////////////////////////
@@ -22,7 +22,7 @@
//
//
// $Id: G4FRConst.hh,v 1.6 2001/07/11 10:08:44 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// Satoshi TANAKA, Tue Jul 2 15:30:49 JST 1996
///////////////////////////////////
@@ -22,7 +22,7 @@
//
//
// $Id: G4FRFeatures.hh,v 1.5 2001/07/11 10:08:44 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#if !defined G4_FR_FEATURES_HH
#define G4_FR_FEATURES_HH
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FRSceneFunc.icc,v 1.1 2001/12/01 20:59:59 stanaka Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4FRSceneFunc.icc,v 1.2 2002/09/02 04:39:10 stanaka Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
@@ -1094,7 +1094,9 @@ void G4FRSCENEHANDLER::SendStrDouble( const char* char_string ,
G4int num_char ;
char* command = new char [ COMMAND_BUF_SIZE ];
num_char = sprintf( command, "%s %g", char_string , dval ) ;
num_char = sprintf( command, "%s %*.*g", \
char_string , \
fPrec2, fPrec, dval ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble(), 1\n" ;
}
@@ -1114,7 +1116,9 @@ G4FRSCENEHANDLER::SendStrDouble2( const char* char_string ,
G4int num_char ;
char* command = new char [ COMMAND_BUF_SIZE ];
num_char = sprintf( command, "%s %g %g", char_string , dval1, dval2 ) ;
num_char = sprintf( command, "%s %*.*g %*.*g", char_string , \
fPrec2, fPrec, dval1, \
fPrec2, fPrec, dval2 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble2(), 1\n" ;
}
@@ -1135,7 +1139,11 @@ G4FRSCENEHANDLER::SendStrDouble3( const char* char_string ,
G4int num_char ;
char* command = new char [ COMMAND_BUF_SIZE ];
num_char = sprintf( command, "%s %g %g %g", char_string , dval1, dval2, dval3 ) ;
num_char = sprintf( command, "%s %*.*g %*.*g %*.*g", \
char_string , \
fPrec2, fPrec, dval1, \
fPrec2, fPrec, dval2, \
fPrec2, fPrec, dval3 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble3(), 1\n" ;
}
@@ -1157,8 +1165,12 @@ G4FRSCENEHANDLER::SendStrDouble4( const char* char_string ,
G4int num_char ;
char* command = new char [ COMMAND_BUF_SIZE ];
num_char = sprintf( command, "%s %g %g %g %g", \
char_string , dval1, dval2, dval3, dval4) ;
num_char = sprintf( command, "%s %*.*g %*.*g %*.*g %*.*g", \
char_string , \
fPrec2, fPrec, dval1, \
fPrec2, fPrec, dval2, \
fPrec2, fPrec, dval3, \
fPrec2, fPrec, dval4) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble4(), 1\n" ;
}
@@ -1181,8 +1193,13 @@ G4FRSCENEHANDLER::SendStrDouble5( const char* char_string ,
G4int num_char ;
char* command = new char [ COMMAND_BUF_SIZE ];
num_char = sprintf( command, "%s %g %g %g %g %g", \
char_string , dval1, dval2, dval3, dval4, dval5 ) ;
num_char = sprintf( command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g", \
char_string , \
fPrec2, fPrec, dval1, \
fPrec2, fPrec, dval2, \
fPrec2, fPrec, dval3, \
fPrec2, fPrec, dval4, \
fPrec2, fPrec, dval5 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble5(), 1\n" ;
}
@@ -1206,8 +1223,14 @@ G4FRSCENEHANDLER::SendStrDouble6( const char* char_string ,
G4int num_char ;
char* command = new char [ COMMAND_BUF_SIZE ];
num_char = sprintf( command, "%s %g %g %g %g %g %g", \
char_string , dval1, dval2, dval3, dval4, dval5, dval6 ) ;
num_char = sprintf( command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g", \
char_string , \
fPrec2, fPrec, dval1, \
fPrec2, fPrec, dval2, \
fPrec2, fPrec, dval3, \
fPrec2, fPrec, dval4, \
fPrec2, fPrec, dval5, \
fPrec2, fPrec, dval6 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble6(), 1\n" ;
}
@@ -1232,8 +1255,15 @@ G4FRSCENEHANDLER::SendStrDouble7( const char* char_string ,
G4int num_char ;
char* command = new char [ COMMAND_BUF_SIZE ];
num_char = sprintf( command, "%s %g %g %g %g %g %g %g", \
char_string , dval1, dval2, dval3, dval4, dval5, dval6, dval7 ) ;
num_char = sprintf( command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g", \
char_string , \
fPrec2, fPrec, dval1,\
fPrec2, fPrec, dval2,\
fPrec2, fPrec, dval3,\
fPrec2, fPrec, dval4,\
fPrec2, fPrec, dval5,\
fPrec2, fPrec, dval6,\
fPrec2, fPrec, dval7 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble7(), 1\n" ;
}
@@ -1262,9 +1292,19 @@ G4FRSCENEHANDLER::SendStrDouble11( const char* char_string ,
G4int num_char ;
char* command = new char [ COMMAND_BUF_SIZE ];
num_char = sprintf( command, "%s %g %g %g %g %g %g %g %g %g %g %g", \
char_string , dval1, dval2, dval3, dval4, dval5, \
dval6, dval7, dval8, dval9, dval10, dval11 ) ;
num_char = sprintf( command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g", \
char_string ,\
fPrec2, fPrec, dval1, \
fPrec2, fPrec, dval2, \
fPrec2, fPrec, dval3, \
fPrec2, fPrec, dval4, \
fPrec2, fPrec, dval5, \
fPrec2, fPrec, dval6, \
fPrec2, fPrec, dval7, \
fPrec2, fPrec, dval8, \
fPrec2, fPrec, dval9, \
fPrec2, fPrec, dval10,\
fPrec2, fPrec, dval11 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble11(), 1\n" ;
}
@@ -1285,8 +1325,11 @@ G4FRSCENEHANDLER::SendIntDouble3( G4int ival ,
G4int num_char ;
char* command = new char [ COMMAND_BUF_SIZE ];
num_char = sprintf( command, "%d %g %g %g", \
ival , dval1, dval2, dval3 ) ;
num_char = sprintf( command, "%d %*.*g %*.*g %*.*g", \
ival , \
fPrec2, fPrec, dval1, \
fPrec2, fPrec, dval2, \
fPrec2, fPrec, dval3 ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendIntDouble3(),1\n" ;
}
@@ -1350,9 +1393,15 @@ G4FRSCENEHANDLER::SendStrDouble6Str( const char* char_string1 ,
G4int num_char ;
char* command = new char [ COMMAND_BUF_SIZE ];
num_char = sprintf( command, "%s %g %g %g %g %g %g %s", \
char_string1, dval1, dval2 , dval3, dval4, \
dval5 , dval6, char_string2 );
num_char = sprintf( command, "%s %*.*g %*.*g %*.*g %*.*g %*.*g %*.*g %s", \
char_string1,\
fPrec2, fPrec, dval1 , \
fPrec2, fPrec, dval2 , \
fPrec2, fPrec, dval3 , \
fPrec2, fPrec, dval4 , \
fPrec2, fPrec, dval5 , \
fPrec2, fPrec, dval6, \
char_string2 );
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrDouble6Str(), 1\n" ;
}
@@ -1385,7 +1434,7 @@ void G4FRSCENEHANDLER::SendDouble( G4double val )
G4int num_char ;
char* command = new char [ COMMAND_BUF_SIZE ];
num_char = sprintf( command, "%g", val ) ;
num_char = sprintf( command, "%*.*g", fPrec2, fPrec, val ) ;
if( num_char < 0 ) {
G4cerr << "ERROR G4FRSCENEHANDLER::SendStrInt(), 1\n" ;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4FRofstream.hh,v 1.5 2001/07/11 10:08:44 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
#include"g4std/fstream"
@@ -22,7 +22,7 @@
//
//
// $Id: G4FukuiRenderer.hh,v 1.7 2001/07/11 10:08:44 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Satoshi TANAKA
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FukuiRendererSceneHandler.hh,v 1.9 2001/09/17 07:40:32 stanaka Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4FukuiRendererSceneHandler.hh,v 1.11 2002/12/11 15:58:02 johna Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Satoshi TANAKA, Fri Jun 28 11:19:19 JST 1996
@@ -91,6 +91,12 @@ public:
G4VSceneHandler::AddThis (polyhedra);
}
void AddThis ( const G4VSolid& solid );
void AddThis ( const G4VTrajectory& traj) {
G4VSceneHandler::AddThis(traj);
}
void AddThis ( const G4VHit& hit) {
G4VSceneHandler::AddThis(hit);
}
void ClearTransientStore(); // Used for triggering detector re-drawing.
@@ -239,6 +245,9 @@ private:
G4bool flag_saving_g4_prim ;
const int COMMAND_BUF_SIZE ;
G4int fPrec, fPrec2 ;
};
#endif
@@ -22,7 +22,7 @@
//
//
// $Id: G4FukuiRendererViewer.hh,v 1.7 2001/07/11 10:08:44 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Satoshi TANAKA, Fri Jun 28 12:10:14 JST 1996
@@ -22,7 +22,7 @@
//
//
// $Id: G4DAWNFILE.cc,v 1.9 2001/07/27 22:32:59 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// Satoshi TANAKA
// DAWNFILE factory.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4DAWNFILESceneHandler.cc,v 1.11 2001/12/01 20:52:06 stanaka Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4DAWNFILESceneHandler.cc,v 1.12 2002/09/02 04:39:21 stanaka Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// Satoshi TANAKA
// DAWNFILE scene.
@@ -86,7 +86,8 @@ fSystem (system) ,
fPrimDest () ,
FRflag_in_modeling (false) ,
flag_saving_g4_prim (false) ,
COMMAND_BUF_SIZE (G4FRofstream::SEND_BUFMAX)
COMMAND_BUF_SIZE (G4FRofstream::SEND_BUFMAX),
fPrec (9), fPrec2 (16)
{
// count instantiated scenes
fSceneCount++;
@@ -111,6 +112,15 @@ COMMAND_BUF_SIZE (G4FRofstream::SEND_BUFMAX)
}
if( fMaxFileNum < 1 ) { fMaxFileNum = 1 ; }
//----- precision control
if( getenv( "G4DAWNFILE_PRECISION" ) != NULL ) {
sscanf( getenv("G4DAWNFILE_PRECISION"), "%d", &fPrec ) ;
} else {
fPrec = 9 ;
}
fPrec2 = fPrec + 7 ;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4DAWNFILEViewer.cc,v 1.13 2001/07/27 22:33:01 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// Satoshi TANAKA
// DAWNFILE view - opens window, hard copy, etc.
@@ -22,7 +22,7 @@
//
//
// $Id: G4FRClientServer.cc,v 1.5 2001/07/11 10:08:45 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
// Satoshi TANAKA, Wed Jul 3 14:14:29 JST 1996
////////////////////////////////
@@ -22,7 +22,7 @@
//
//
// $Id: G4FukuiRenderer.cc,v 1.7 2001/07/11 10:08:46 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Satoshi TANAKA
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FukuiRendererSceneHandler.cc,v 1.8 2001/12/01 20:52:06 stanaka Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4FukuiRendererSceneHandler.cc,v 1.9 2002/09/02 04:39:21 stanaka Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Satoshi TANAKA, Fri Jun 28 11:34:24 JST 1996
@@ -84,7 +84,8 @@ fSystem (system) ,
fPrimDest (system.GetPrimDest() ) ,
FRflag_in_modeling (false) ,
flag_saving_g4_prim (false) ,
COMMAND_BUF_SIZE (G4FRClientServer::SEND_BUFMAX)
COMMAND_BUF_SIZE (G4FRClientServer::SEND_BUFMAX),
fPrec (9), fPrec2 (16)
{
//----- Connection to FukuiRenderer is set in the first scene
@@ -110,6 +111,14 @@ COMMAND_BUF_SIZE (G4FRClientServer::SEND_BUFMAX)
//----- count instantiated scenes
fSceneCount++;
//----- precision control
if( getenv( "G4DAWN_PRECISION" ) != NULL ) {
sscanf( getenv("G4DAWN_PRECISION"), "%d", &fPrec ) ;
} else {
fPrec = 9 ;
}
fPrec2 = fPrec + 7 ;
} // G4FukuiRendererSceneHandler, constructor
@@ -22,7 +22,7 @@
//
//
// $Id: G4FukuiRendererViewer.cc,v 1.7 2001/07/11 10:08:46 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Satoshi TANAKA, Fri Jun 28 12:09:11 JST 1996
+3 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.3 2001/11/08 21:50:51 perl Exp $
# $Id: GNUmakefile,v 1.4 2002/11/20 16:37:26 duns Exp $
name := G4visHepRep
@@ -10,6 +10,8 @@ include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/G4VIS_BUILD.gmk
include $(G4INSTALL)/config/interactivity.gmk
CPPFLAGS += -I$(G4BASE)/digits+hits/hits/include
CPPFLAGS += -I$(G4BASE)/tracking/include
CPPFLAGS += -I$(G4BASE)/visualization/management/include
CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
CPPFLAGS += -I$(G4BASE)/global/management/include
+35 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.16 2002/02/10 07:12:52 perl Exp $
$Id: History,v 1.24 2002/12/11 16:05:16 johna Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,40 @@ committal in the CVS repository !
History file for visualization/HepRep sub-category
---------------------------------------------------------------------------
11th December 2002 John Allison (vis-V04-01-10)
- Fixed default view parameters (global culling false).
9th December 2002 Mark Donszelmann
- Fixed bug that files were left open. Will close now, apart from stdin/stderr
- Fixed color call not to use array creation.
- Fixed HepRep standard (reader related), G4 is a writer.
- Fixed include file now to only include HepRep.h (which includes all others)
3rd December 2002 Mark Donszelmann
- Fixed bug that XML Output can be routed to stdout or stderr.
27th November 2002 Mark Donszelmann
- Fixed core dump (Solaris) if open HepRepXML and closed it w/o writing anything
27th November 2002 John Allison (vis-V04-01-08)
- Changed mickname of HepRep to HepRepXML.
- Fixed description of HepRepFile.
26th November 2002 Mark Donszelmann
- Fixed FillStyle, LineStyle, LineWidth, HasFrame and Symbol Names
- Fixed parent-child relationship for calorimeter hits
- Fixed material state number, now a string
- Fixed fillColor to be equal to color
25th November 2002 Mark Donszelmann
- Fixed HepRep1 warnings in HepRepFileSceneHandler
- Fixed HepRep2 radius of markers to be non-zero
- Fixed HepRep2 attributes some of which had wrong names, especially the markers
- Fixed HepRep2 filename to have sequence number
13th November 2002 Mark Donszelmann
- Added HepRep2 Driver
4th February 2002 Joseph Perl (vis-V04-00-01)
- Check for missing hierarchy layers in HepRepXMLWriter.
(Not strictly needed since have a culled layer check in SceneHandler,
+40
View File
@@ -3,6 +3,13 @@ by the WIRED Event Display client. It requires no external packages.
The HepRep graphics format is further described at
http://heprep.freehep.org
Two different drivers area available for either HepRep1 or HepRep2.
Driver: HepRepFile
------------------
The version of HepRep produced by this driver is HepRep Version 1.
Each call to /vis/viewer/update
@@ -18,3 +25,36 @@ This will reduce the file to about five percent of its original size.
Joseph Perl
9 November 2001
Driver: HepRepXML
-----------------
The version of HepRep produced by this driver is HepRep Version 2.
To set the base part of the filename (filename = basefilename-seqno.heprep):
/vis/scene/create basefilename
To route the HepRep XML output to stdout (or stderr) use:
/vis/scene/create stdout
To select the driver
/vis/open HepRepXML
Any call to draw part of an event will open the file and start writing.
Each file, apart from stdin/stderr, is closed by:
/vis/viewer/flush
(WARNING: files will not contain geometry if not flushed. G4 exit will only
close file)
Multiple events can be written by:
/vis/scene/endOfSceneAction accumulate
View the file using the WIRED Event Display, available from:
http://www.slac.stanford.edu/BFROOT/www/Computing/Graphics/Wired/
or in future
http://wired.freehep.org
9 Dec 2002
Mark Donszelmann
+10
View File
@@ -0,0 +1,10 @@
export HEPREP=$FREEHEP/hep/graphics/heprep
cp $FREEHEP/org/freehep/jni/FreeHepTypes.h include
cp $HEPREP/geant4/*.hh include
cp $HEPREP/streamer-c++/include/*.h include
cp $HEPREP/include/HEPREP/*.h include/HEPREP
cp $HEPREP/geant4/*.cc src
cp $HEPREP/streamer-c++/*.cc src
rm src/HepRepStreamerExample.cc
rm src/HepRepStreamerTest.cc
+9
View File
@@ -0,0 +1,9 @@
set HEPREP=%FREEHEP%\hep\graphics\heprep
copy %FREEHEP%\org\freehep\jni\FreeHepTypes.h include
copy %HEPREP%\geant4\include\*.hh include
copy "%HEPREP%\streamer-c++\include\*.h" include
copy %HEPREP%\include\HEPREP\*.h include\HEPREP
copy %HEPREP%\geant4\*.cc src
copy "%HEPREP%\streamer-c++\*.cc" src
del src\HepRepStreamerExample.cc
del src\HepRepStreamerTest.cc
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef DEFAULTHEPREPACTION_H
#define DEFAULTHEPREPACTION_H 1
#include "FreeHepTypes.h"
#include <string>
#include "HEPREP/HepRepAction.h"
/**
*
* @author M.Donszelmann
*/
class DefaultHepRepAction : public virtual HEPREP::HepRepAction {
private:
std::string name;
std::string expression;
public:
DefaultHepRepAction(std::string name, std::string expression);
~DefaultHepRepAction();
std::string getName();
std::string getExpression();
HEPREP::HepRepAction* copy();
};
#endif
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef DEFAULTHEPREPATTDEF_H
#define DEFAULTHEPREPATTDEF_H 1
#include "FreeHepTypes.h"
#include <string>
#include "HEPREP/HepRepAttDef.h"
/**
*
* @author M.Donszelmann
*/
class DefaultHepRepAttDef : public virtual HEPREP::HepRepAttDef {
private:
std::string name, desc, category, extra;
public:
DefaultHepRepAttDef(std::string name, std::string desc, std::string category, std::string extra);
~DefaultHepRepAttDef();
HEPREP::HepRepAttDef* copy();
std::string getName();
std::string getLowerCaseName();
std::string getDescription();
std::string getCategory();
std::string getExtra();
};
#endif
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef DEFAULTHEPREPATTVALUE_H
#define DEFAULTHEPREPATTVALUE_H 1
#include "FreeHepTypes.h"
#include <string>
#include "HEPREP/HepRepAttValue.h"
/**
*
* @author M.Donszelmann
*/
class DefaultHepRepAttValue : public virtual HEPREP::HepRepAttValue {
private:
enum { LABELSTRINGS_LEN = 4 };
std::string name;
int type;
// values implemented as separate items, so that they do not take up unnecessary space for an Object
// only ONE of these is filled
std::string stringValue;
long longValue;
double doubleValue;
bool booleanValue;
std::vector<double> colorValue;
int showLabelValue;
std::string labelStrings[LABELSTRINGS_LEN];
void init();
public:
DefaultHepRepAttValue(std::string name, std::string value, int showLabel);
DefaultHepRepAttValue(std::string name, long value, int showLabel);
DefaultHepRepAttValue(std::string name, int value, int showLabel);
DefaultHepRepAttValue(std::string name, double value, int showLabel);
DefaultHepRepAttValue(std::string name, bool value, int showLabel);
DefaultHepRepAttValue(std::string name, std::vector<double> value, int showLabel);
~DefaultHepRepAttValue();
HEPREP::HepRepAttValue* copy();
std::string getName();
std::string getLowerCaseName();
int getType();
std::string getTypeName();
int showLabel();
std::string getString();
long getLong();
int getInteger();
double getDouble();
bool getBoolean();
std::vector<double> getColor();
std::string getAsString();
std::string toShowLabel();
};
#endif
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef DEFAULTHEPREPTREEID_H
#define DEFAULTHEPREPTREEID_H 1
#include "FreeHepTypes.h"
#include <string>
#include "HEPREP/HepRepTreeID.h"
/**
*
* @author M.Donszelmann
*/
class DefaultHepRepTreeID : public virtual HEPREP::HepRepTreeID {
private:
std::string name;
std::string version;
std::string qualifier;
public:
DefaultHepRepTreeID(std::string name, std::string version, std::string qualifier = "top_level");
~DefaultHepRepTreeID();
std::string getQualifier();
void setQualifier(std::string qualifier);
std::string getName();
std::string getVersion();
HEPREP::HepRepTreeID* copy();
};
#endif
@@ -0,0 +1,32 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef FREEHEPTYPES_H
#define FREEHEPTYPES_H
#ifdef WIN32
// Disable warning C4786: identifier was truncated to '255' characters in the debug information
#pragma warning ( disable : 4786 )
#endif
#endif
@@ -0,0 +1,65 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/**
* @author Mark Donszelmann
*/
#ifndef G4HEPREP_HH
#define G4HEPREP_HH 1
//G4
#include "G4VGraphicsSystem.hh"
class G4HepRep: public G4VGraphicsSystem {
public:
G4HepRep ();
virtual ~G4HepRep ();
G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
};
#endif
@@ -21,8 +21,30 @@
// ********************************************************************
//
//
// $Id: G4HepRepFile.hh,v 1.4 2002/02/02 04:00:12 perl Exp $
// GEANT4 tag $Name: geant4-04-01 $
// ********************************************************************
// * 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: G4HepRepFile.hh,v 1.5 2002/12/13 11:17:59 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// John Allison 5th April 2001
@@ -21,10 +21,32 @@
// ********************************************************************
//
//
// $Id: G4HepRepFileSceneHandler.hh,v 1.7 2002/02/02 04:00:14 perl Exp $
// GEANT4 tag $Name: geant4-04-01 $
// ********************************************************************
// * 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: G4HepRepFileSceneHandler.hh,v 1.10 2002/12/13 11:17:59 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
//
// Joseph Perl 27th January 2002
// A base class for a scene handler to export geometry and trajectories
// to the HepRep xml file format.
@@ -73,6 +95,8 @@ public:
void AddThis(const G4Polycone&);
void AddThis(const G4Polyhedra&);
void AddThis(const G4VSolid&);
void AddThis (const G4VTrajectory&);
void AddThis (const G4VHit&);
// void PreAddThis(const G4Transform3D& objectTransformation,
// const G4VisAttributes&);
// void PostAddThis();
@@ -122,8 +146,6 @@ protected:
G4int fCurrentDepth; // Current depth of geom. hierarchy.
G4VPhysicalVolume* fpCurrentPV; // Current physical volume.
G4LogicalVolume* fpCurrentLV; // Current logical volume.
const G4ModelingParameters* fpOriginalMP; // Keeps pointer to original.
G4ModelingParameters* fpNonCullingMP; // For temporary non-culling.
private:
HepRepXMLWriter *hepRepXMLWriter;
@@ -21,8 +21,30 @@
// ********************************************************************
//
//
// $Id: G4HepRepFileViewer.hh,v 1.5 2002/02/02 04:00:16 perl Exp $
// GEANT4 tag $Name: geant4-04-01 $
// ********************************************************************
// * 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: G4HepRepFileViewer.hh,v 1.6 2002/12/13 11:17:59 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// John Allison 5th April 2001
@@ -0,0 +1,155 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/**
* @author Mark Donszelmann
*/
#ifndef G4HEPREPSCENEHANDLER_HH
#define G4HEPREPSCENEHANDLER_HH 1
#include "globals.hh"
#include "g4std/iostream"
// HepRep
#include "HEPREP/HepRep.h"
//G4
#include "G4VGraphicsSystem.hh"
#include "G4VSceneHandler.hh"
#include "G4Visible.hh"
#include "G4Material.hh"
#include "G4LogicalVolume.hh"
#include "G4PhysicalVolumeModel.hh"
//class G4HepRep;
class G4HepRepSceneHandler: public G4VSceneHandler {
public:
G4HepRepSceneHandler (G4VGraphicsSystem& system, const G4String& name = "");
virtual ~G4HepRepSceneHandler ();
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&);
void AddThis (const G4VTrajectory&);
void AddThis (const G4VHit&);
void PreAddThis (const G4Transform3D& objectTransformation,
const G4VisAttributes& visAttribs);
void PostAddThis ();
void EstablishSpecials(G4PhysicalVolumeModel&);
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 AddPrimitive (const G4Scale& scale) {
G4VSceneHandler::AddPrimitive(scale);
}
void BeginPrimitives (const G4Transform3D& objectTransformation);
void EndPrimitives ();
void BeginModeling ();
void EndModeling ();
static G4int GetSceneCount () { return sceneCount; }
HEPREP::HepRep *GetHepRep() { return heprep; }
HEPREP::HepRepWriter *GetHepRepWriter() { return writer; }
HEPREP::HepRepFactory *GetHepRepFactory();
void open();
void close();
protected:
// void RequestPrimitives (const G4VSolid& solid);
private:
static G4int sceneCount; // No. of extanct scenes.
static G4int sceneIdCount; // static counter for scenes.
G4int fileNo; // file sequence number
G4int currentDepth;
G4VPhysicalVolume* currentPV;
G4LogicalVolume* currentLV;
const G4ModelingParameters* originalMP; // Keeps pointer to original.
G4ModelingParameters* nonCullingMP; // For temporary non-culling.
G4Transform3D transform;
void SetColour (HEPREP::HepRepAttribute *attribute, const G4Colour& color,const G4String& key = G4String("Color"));
void SetLine (HEPREP::HepRepInstance *instance, const G4Visible& visible);
void SetMarker (HEPREP::HepRepInstance *instance, const G4VMarker& marker);
HEPREP::HepRepInstance* CreateInstance(HEPREP::HepRepInstance* p, HEPREP::HepRepType* altType);
bool IsEventData ();
G4std::ostream* out;
HEPREP::HepRepFactory* heprepFactory;
HEPREP::HepRepWriter* writer;
HEPREP::HepRepInstance *parent;
HEPREP::HepRep *heprep;
HEPREP::HepRepType *geometryType;
HEPREP::HepRepType *eventType;
HEPREP::HepRepType *trackType;
HEPREP::HepRepType *calHitType;
HEPREP::HepRepType *hitType;
};
#endif
@@ -0,0 +1,74 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/**
* @author Mark Donszelmann
*/
#ifndef G4HEPREPVIEWER_HH
#define G4HEPREPVIEWER_HH 1
// HepRep
#include "HEPREP/HepRep.h"
// Geant4
#include "G4VViewer.hh"
class G4HepRepViewer: public G4VViewer {
public:
G4HepRepViewer (G4VSceneHandler& scene, const G4String& name = "");
virtual ~G4HepRepViewer ();
void SetView ();
void ClearView ();
void DrawView ();
void ShowView ();
void FinishView ();
private:
bool drawn;
};
#endif
@@ -0,0 +1,227 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREP_H
#define HEPREP_HEPREP_H 1
// Copyright 2000-2002, FreeHEP.
#include <string>
#include <vector>
// Include all other HepRep header files here for convenience
#include "HEPREP/HepRepAction.h"
#include "HEPREP/HepRepAttDef.h"
#include "HEPREP/HepRepAttribute.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepConstants.h"
#include "HEPREP/HepRepDefinition.h"
#include "HEPREP/HepRepFactory.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepIterator.h"
#include "HEPREP/HepRepIteratorListener.h"
#include "HEPREP/HepRepPoint.h"
#include "HEPREP/HepRepSelectFilter.h"
#include "HEPREP/HepRepTreeID.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepTypeTree.h"
#include "HEPREP/HepRepWriter.h"
namespace HEPREP {
class HepRepAction;
class HepRepInstanceTree;
class HepRepSelectFilter;
class HepRepType;
class HepRepTypeTree;
/**
* The HepRep interface.
*
* Any of these methods may throw a UnsupportedOperationException in Java.
*
* This interface is NOT final yet.
*
* @author Mark Donszelmann
*/
class HepRep {
public:
/// Destructor.
virtual ~HepRep() { /* nop */; }
/**
* Add a layer to the list of layers in this heprep.
* The layer is added to the back of the list.
*
* @param layer name of layer to be added to the back of the list.
*/
virtual bool addLayer(std::string layer) = 0;
/**
* Returns the list of layers.
*
* @return the known layer names, in the order back-to-front.
*/
virtual std::vector<std::string> * getLayerOrder() = 0;
/**
* Add a typetree to this heprep.
*
* @param typeTree to be added.
* @return false only if the tree is written immediately to some stream.
*/
virtual bool addTypeTree(HepRepTypeTree * typeTree) = 0;
/**
* Remove a typetree from this heprep.
*
* @param typeTree to be removed.
*/
virtual void removeTypeTree(HepRepTypeTree * typeTree) = 0;
/**
* Returns the collection of all typetrees of this heprep.
*
* @return collection of HepRepTypeTrees.
*/
virtual std::vector<HepRepTypeTree *> * getTypeTrees() = 0;
/**
* Returns a named and versioned typetree.
*
* @param name name of the typetree.
* @param version version of the typetree.
* @return named and versioned HepRepTypeTree.
*/
virtual HepRepTypeTree * getTypeTree(std::string name, std::string version) = 0;
/**
* Searches for a named type in any of the typetrees.
* The first occurrence found is returned.
*
* @param name name of type.
* @return named HepRepType.
*/
virtual HepRepType * getType(std::string name) = 0;
/**
* Adds an instancetree to this heprep.
*
* @param instanceTree to be added.
* @return false only if the tree is written immediately to some stream.
*/
virtual bool addInstanceTree(HepRepInstanceTree * instanceTree) = 0;
/**
* Remove an instanectree from this heprep.
*
* @param instanceTree to be removed.
*/
virtual void removeInstanceTree(HepRepInstanceTree * instanceTree) = 0;
/**
* Returns a collection of instancetrees.
*
* @return collection of HepRepInstanceTrees.
*/
virtual std::vector<HepRepInstanceTree *> * getInstanceTrees() = 0;
/**
* Returns a named and versioned instancetree.
* FIXME: doc is incorrect here, should only return TOP of the tree. Filling
* in should be done by getInstances calls.
* <p>
* This tree needs to be added to the heprep afterwards.
*
* @param name name of the instancetree.
* @param version version of the instancetree.
* @return HepRepIntanceTree
*/
virtual HepRepInstanceTree * getInstanceTreeTop(std::string name, std::string version) = 0;
/**
* Returns a named and versioned instancetree for a list of typenames.
* <p>
* This tree needs to be added to the heprep afterwards.
*
* @param name name of the instancetree.
* @param version version of the instancetree.
* @param typeNames a list of typenames for which we need instancetrees.
* @return HepRepIntanceTree
*/
virtual HepRepInstanceTree * getInstances(std::string name, std::string version, std::vector<std::string> typeNames) = 0;
/**
* Returns a named and versioned instancetree for a list of typenames
* after executing some action and for specific filters.
*
* This tree needs to be added to the heprep afterwards.
* <p>
* The inversion effect of invertAtts depends on the values of
* GetDrawAtts and GetNonDrawAtts as follows:
* <UL>
* <LI>GetDrawAtts GetNonDrawAtts effect of InvertAtts
* <LI>FALSE FALSE all Attributes specified will be downloaded
* <LI>TRUE FALSE Draw Attributes specified will be omitted, NonDraw Attributes specified will be included
* <LI>FALSE TRUE Draw Attributes specified will be included, NonDraw Attributes specified will be omitted
* <LI>TRUE TRUE all Attributes specified will be omitted
* </UL>
*
* @param name name of the instancetree.
* @param version version of the instancetree.
* @param typeNames a list of typenames for which we need instancetrees.
* @param actions execute this list of actions before returning.
* @param getPoints include the HepRepPoints in the instance tree.
* @param getDrawAtts include the Draw attributes in the instance tree.
* @param getNonDrawAtts include the Non-Draw attributes in the instance tree.
* @param invertAtts list of attributes to be included or not depending on getDrawAtts and getNonDrawAtts.
* @return HepRepIntanceTree
*/
virtual HepRepInstanceTree * getInstancesAfterAction(std::string name, std::string version, std::vector<std::string> typeNames, std::vector<HepRepAction *> actions, bool getPoints, bool getDrawAtts, bool getNonDrawAtts, std::vector<std::string> invertAtts) = 0;
/**
* Returns last exception thrown and clears it. Useful for implementations without
* exception handling.
*
* @return last exception and clears it.
*/
virtual std::string checkForException() = 0;
/**
* Returns a deep copy of the heprep, with all its attached trees, where
* instances are filtered using a HepRepSelectFilter.
*
* @param filter to be used for filtering instances.
* @return copy of heprep.
*/
virtual HepRep * copy(HepRepSelectFilter * filter = NULL) = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREP_H */
@@ -0,0 +1,71 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPACTION_H
#define HEPREP_HEPREPACTION_H 1
// Copyright 2000-2002, FreeHEP.
#include <string>
namespace HEPREP {
/**
* HepRepAction interface.
*
* @author Mark Donszelmann
*/
class HepRepAction {
public:
/// Destructor.
virtual ~HepRepAction() { /* nop */; }
/**
* Returns name of this action.
*
* @return name of this action.
*/
virtual std::string getName() = 0;
/**
* Returns expression associated with this action.
*
* @return expression of this action.
*/
virtual std::string getExpression() = 0;
/**
* Returns a deep copy of this action.
*
* @return copy of this action.
*/
virtual HepRepAction * copy() = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPACTION_H */
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPATTDEF_H
#define HEPREP_HEPREPATTDEF_H 1
// Copyright 2000-2002, FreeHEP.
#include <string>
namespace HEPREP {
/**
* HepRepAttDef interface.
*
* @author Mark Donszelmann
*/
class HepRepAttDef {
public:
/// Destructor.
virtual ~HepRepAttDef() { /* nop */; }
/**
* Returns the mixed case name of this attdef.
*
* @return name.
*/
virtual std::string getName() = 0;
/**
* Returns the lowercased name of this attdef.
*
* @return lowercased name.
*/
virtual std::string getLowerCaseName() = 0;
/**
* Returns a description of this attdef.
*
* @return description.
*/
virtual std::string getDescription() = 0;
/**
* Returns category of this attdef.
*
* @return category.
*/
virtual std::string getCategory() = 0;
/**
* Returns any extra information of this attdef.
*
* @return extra info.
*/
virtual std::string getExtra() = 0;
/**
* Returns a deep copy of this attdef.
*
* @return copy of this attdef.
*/
virtual HepRepAttDef * copy() = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPATTDEF_H */
@@ -0,0 +1,142 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPATTVALUE_H
#define HEPREP_HEPREPATTVALUE_H 1
// Copyright 2000-2002, FreeHEP.
#include <string>
#include <vector>
namespace HEPREP {
/**
* HepRepAttValue interface.
*
* @author Mark Donszelmann
*/
class HepRepAttValue {
public:
/// Destructor.
virtual ~HepRepAttValue() { /* nop */; }
/**
* Returns name of the attvalue.
*
* @return Capitalized Name.
*/
virtual std::string getName() = 0;
/**
* Returns lowercased name of the attvalue.
*
* @return Lowercased Name.
*/
virtual std::string getLowerCaseName() = 0;
/**
* Returns type of the attvalue, defined in HepRepConstants with names TYPE_xxx.
*
* @return type.
*/
virtual int getType() = 0;
/**
* Returns the Java-like name for the type of this attvalue.
*
* @return type name.
*/
virtual std::string getTypeName() = 0;
/**
* Returns the flag bits for showing this attvalue as a label, defined in HepRepConstants with names SHOW_xxx.
*
* @return flag bits if should be shown as label.
*/
virtual int showLabel() = 0;
/**
* Returns value as string.
*
* @return value as string (if type is string).
*/
virtual std::string getString() = 0;
/**
* Returns value as string.
*
* @return value (of any type) in string format.
*/
virtual std::string getAsString() = 0;
/**
* Returns value as Color.
*
* @return value as Color.
*/
virtual std::vector<double> getColor() = 0;
/**
* Returns value as long.
*
* @return value as long.
*/
virtual long getLong() = 0;
/**
* Returns value as int.
*
* @return value as integer.
*/
virtual int getInteger() = 0;
/**
* Returns value as double.
*
* @return value as double.
*/
virtual double getDouble() = 0;
/**
* Returns value as boolean.
*
* @return value as boolean.
*/
virtual bool getBoolean() = 0;
/**
* Returns a deep copy of this attvalue.
*
* @return copy of this attvalue.
*/
virtual HepRepAttValue * copy() = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPATTVALUE_H */
@@ -0,0 +1,174 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPATTRIBUTE_H
#define HEPREP_HEPREPATTRIBUTE_H 1
// Copyright 2000-2002, FreeHEP.
#include <string>
#include <vector>
#include "HEPREP/HepRepConstants.h"
namespace HEPREP {
class HepRepAttValue;
/**
* HepRepAttribute interface.
*
* @author Mark Donszelmann
*/
class HepRepAttribute {
public:
/// Destructor.
virtual ~HepRepAttribute() { /* nop */; }
/**
* Adds an attValue.
*
* @param attValue to be added.
* @return false only if the value is immediately written to a stream.
*/
virtual bool addAttValue(HepRepAttValue * attValue) = 0;
/**
* Adds a char* attValue as a String.
* This call is mapped to addAttValue(std::string, std::string, int); and necessary
* because C++ converts char* into bool and would thus call addAttValue(std::string, bool, int)
* for a call such as addAttValue("drawAs", "Cylinder", 0);
*
* @param key name of attValue
* @param value value of attValue
* @param showLabel show this as label
* @return false if an IOException was created.
*/
bool addAttValue(std::string key, char* value, int showLabel = HepRepConstants::SHOW_NONE) {
return addAttValue(key, std::string(value), showLabel);
}
/**
* Adds an attValue.
*
* @param key name of attValue
* @param value value of attValue
* @param showLabel show this as label
* @return false only if the value is immediately written to a stream.
*/
virtual bool addAttValue(std::string key, std::string value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
/**
* Adds an attValue.
*
* @param key name of attValue
* @param value value of attValue
* @param showLabel show this as label
* @return false only if the value is immediately written to a stream.
*/
virtual bool addAttValue(std::string key, int value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
/**
* Adds an attValue.
*
* @param key name of attValue
* @param value value of attValue
* @param showLabel show this as label
* @return false only if the value is immediately written to a stream.
*/
virtual bool addAttValue(std::string key, double value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
/**
* Adds an attValue.
*
* @param key name of attValue
* @param value value of attValue
* @param showLabel show this as label
* @return false only if the value is immediately written to a stream.
*/
virtual bool addAttValue(std::string key, bool value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
/**
* Adds a Color attValue.
*
* @param key name of attValue
* @param value value of attValue
* @param showLabel show this as label
* @return false only if the value is immediately written to a stream.
*/
virtual bool addAttValue(std::string key, std::vector<double> value, int showLabel = HepRepConstants::SHOW_NONE) = 0;
/**
* Adds a Color attValue.
*
* @param key name of attValue
* @param red color
* @param green color
* @param blue color
* @param alpha value
* @param showLabel show this as label
* @return false only if the value is immediately written to a stream.
*/
virtual bool addAttValue(std::string key, double red, double green, double blue, double alpha = 1.0, int showLabel = HepRepConstants::SHOW_NONE) = 0;
/**
* Remove the attvalue named by key.
*
* @param key name of the attValue to be removed.
* @return removed HepRepAttValue, or null if not removed.
*/
virtual HepRepAttValue * removeAttValue(std::string key) = 0;
/**
* Returns the attValue specified by name. This attValue is normally searched
* on the node itself and then on its type, moving up the typetree.
*
* @param name of attribute value.
* @return attribute value.
*/
virtual HepRepAttValue * getAttValue(std::string name) = 0;
/**
* Returns a collection of all attribute values from this node.
*
* @return collection of HepRepAttValues.
*/
virtual std::vector<HepRepAttValue *> * getAttValuesFromNode() = 0;
/**
* Returns a named attribute value from this node.
*
* @param lowerCaseName name in all lowercase.
* @return corresponding HepRepAttValue.
*/
virtual HepRepAttValue * getAttValueFromNode(std::string lowerCaseName) = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPATTRIBUTE_H */
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPCONSTANTS_H
#define HEPREP_HEPREPCONSTANTS_H 1
// Copyright 2000, FreeHEP.
namespace HEPREP {
/**
* Constants for HepRep interfaces.
*
* @author Mark Donszelmann
*/
class HepRepConstants {
public:
/// Destructor.
virtual ~HepRepConstants() { /* nop */; }
/**
* Defines constants for type
*/
enum { TYPE_UNKNOWN = -1, TYPE_STRING = 1, TYPE_COLOR = 2, TYPE_LONG = 10, TYPE_INT = 11, TYPE_DOUBLE = 20, TYPE_BOOLEAN = 30 };
/**
* Defines constants for showLabel
*/
enum { SHOW_NONE = 0x0000, SHOW_NAME = 0x0001, SHOW_DESC = 0x0002, SHOW_VALUE = 0x0004, SHOW_EXTRA = 0x0008 };
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPCONSTANTS_H */
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPDEFINITION_H
#define HEPREP_HEPREPDEFINITION_H 1
// Copyright 2000-2002, FreeHEP.
#include <string>
#include <vector>
#include "HEPREP/HepRepAttribute.h"
namespace HEPREP {
class HepRepAttDef;
/**
* HepRepDefinition interface.
*
* @author Mark Donszelmann
*
*/
class HepRepDefinition : virtual public HepRepAttribute {
public:
/// Destructor.
virtual ~HepRepDefinition() { /* nop */; }
/**
* Adds an attdef.
*
* @param name name of the definition.
* @param desc description of the definition.
* @param category category of the definition.
* @param extra extra info of the definition.
* @return false only if this definition is written immediately to a stream.
*/
virtual bool addAttDef(std::string name, std::string desc, std::string category, std::string extra) = 0;
/**
* Adds an attdef.
*
* @param attDef to be added.
* @return false only if this definition is written immediately to a stream.
*/
virtual bool addAttDef(HepRepAttDef * attDef) = 0;
/**
* Return a named attribute definition searched on this node and any parent nodes.
*
* @param name of attribute definition.
* @return attribute definition.
*/
virtual HepRepAttDef * getAttDef(std::string name) = 0;
/**
* Returns a collection of all attribute definitions defined on this node.
*
* @return collection of attributes definitions.
*/
virtual std::vector<HepRepAttDef *> * getAttDefsFromNode() = 0;
/**
* Returns a named attribute definition defined on this node.
*
* @param lowerCaseName name of the attribute in lower case.
* @return attribute definition.
*/
virtual HepRepAttDef * getAttDefFromNode(std::string lowerCaseName) = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPDEFINITION_H */
@@ -0,0 +1,145 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPFACTORY_H
#define HEPREP_HEPREPFACTORY_H 1
// Copyright 2000-2002, FreeHEP.
#include <iostream>
#include <string>
namespace HEPREP {
class HepRep;
class HepRepAction;
class HepRepInstance;
class HepRepInstanceTree;
class HepRepPoint;
class HepRepTreeID;
class HepRepType;
class HepRepTypeTree;
class HepRepWriter;
/**
* HepRepFactory interface.
*
* @author Mark Donszelmann
*/
class HepRepFactory {
public:
/// Destructor.
virtual ~HepRepFactory() { /* nop */; }
/**
* Creates a HepRepWriter.
*
* @param out output stream.
*/
virtual HepRepWriter * createHepRepWriter(std::ostream * out) = 0;
/**
* Creates a HepRepPoint.
*
* @param instance to add the point to.
* @param x x coordinate of point.
* @param y y coordinate of point.
* @param z z coordinate of point.
*/
virtual HepRepPoint * createHepRepPoint(HepRepInstance * instance, double x, double y, double z) = 0;
/**
* Creates a HepRepInstance.
*
* @parent to add the instance to.
* @type type the associated type.
*/
virtual HepRepInstance * createHepRepInstance(HepRepInstance * parent, HepRepType * type) = 0;
/**
* Creates a HepRepInstance.
*
* @parent to add the instance to.
* @type type the associated type.
*/
virtual HepRepInstance * createHepRepInstance(HepRepInstanceTree * parent, HepRepType * type) = 0;
/**
* Creates a HepRepTreeID.
*
* @param name of the treeID.
* @param version of the treeID.
* @param qualifier of the treeID.
*/
virtual HepRepTreeID * createHepRepTreeID(std::string name, std::string version, std::string qualifier = "top-level") = 0;
/**
* Creates a HepRepAction.
*
* @param name of the action.
* @param expression of the action.
*/
virtual HepRepAction * createHepRepAction(std::string name, std::string expression) = 0;
/**
* Creates a HepRepInstanceTree.
* <p>
* The tree needs to be added to the HepRep.
*
* @param name of the instancetree.
* @param version of the instancetree.
* @param typeTree associated typetree.
*/
virtual HepRepInstanceTree * createHepRepInstanceTree(std::string name, std::string version, HepRepTreeID * typeTree) = 0;
/**
* Creates a HepRepType.
*
* @param parent to add this type to.
* @param name of the type to create.
*/
virtual HepRepType * createHepRepType(HepRepType * parent, std::string name) = 0;
/**
* Creates a HepRepTypeTree.
* <p>
* The tree needs to be added to the HepRep.
*
* @param treeID to name the tree being created.
*/
virtual HepRepTypeTree * createHepRepTypeTree(HepRepTreeID * treeID) = 0;
/**
* Creates a HepRep.
*
*/
virtual HepRep * createHepRep() = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPFACTORY_H */
@@ -0,0 +1,122 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPINSTANCE_H
#define HEPREP_HEPREPINSTANCE_H 1
// Copyright 2000-2002, FreeHEP.
#include <vector>
#include "HEPREP/HepRepAttribute.h"
namespace HEPREP {
class HepRep;
class HepRepInstanceTree;
class HepRepPoint;
class HepRepSelectFilter;
class HepRepType;
/**
* HepRepInstance interface.
*
* @author Mark Donszelmann
*/
class HepRepInstance : virtual public HepRepAttribute {
public:
/// Destructor.
virtual ~HepRepInstance() { /* nop */; }
/**
* Adds an sub-instance to this instance.
*
* @param instance sub-instance.
* @return false only if written immediately to a stream.
*/
virtual bool addInstance(HepRepInstance * instance) = 0;
/**
* Removes a sub-instance from this instance.
*
* @param instance sub-instance.
*/
virtual void removeInstance(HepRepInstance * instance) = 0;
/**
* Returns a collection of all sub-instances this instance keeps.
*
* @return collection of HepRepInstances.
*/
virtual std::vector<HepRepInstance *> * getInstances() = 0;
/**
* Returns the associated type for this instance.
*
* @return associated HepRepType.
*/
virtual HepRepType * getType() = 0;
/**
* Adds a point to this instance.
*
* @param point to be added.
* @return false only if written immediately to a stream.
*/
virtual bool addPoint(HepRepPoint * point) = 0;
/**
* Returns a collection of all points this instance keeps.
*
* @return collection of HepRepPoints.
*/
virtual std::vector<HepRepPoint *> * getPoints() = 0;
/**
* Returns a deep copy of this instance.
*
* @param heprep needed to find the associated type.
* @param parent to which the copy is added.
* @param filter run on all instances before copying.
* @return copy of this instance.
*/
virtual HepRepInstance * copy(HepRep * heprep, HepRepInstance * parent, HepRepSelectFilter * filter = NULL) = 0;
/**
* Returns a deep copy of this instance.
*
* @param heprep needed to find the associated type.
* @param parent to which the copy is added.
* @param filter run on all instances before copying.
* @return copy of this instance.
*/
virtual HepRepInstance * copy(HepRep * heprep, HepRepInstanceTree * parent, HepRepSelectFilter * filter = NULL) = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPINSTANCE_H */
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPINSTANCETREE_H
#define HEPREP_HEPREPINSTANCETREE_H 1
// Copyright 2000-2002, FreeHEP.
#include <vector>
#include "HEPREP/HepRepTreeID.h"
namespace HEPREP {
class HepRep;
class HepRepInstance;
class HepRepSelectFilter;
class HepRepTreeID;
/**
* HepRepInstanceTree interface.
*
* @author Mark Donszelmann
*/
class HepRepInstanceTree : virtual public HepRepTreeID {
public:
/// Destructor.
virtual ~HepRepInstanceTree() { /* nop */; }
/**
* Adds an instance to this instancetree.
*
* @param instance to be added.
* @return false only if written immediately to a stream.
*/
virtual bool addInstance(HepRepInstance * instance) = 0;
/**
* Removes an instance from this instancetree.
*
* @param instance to be removed.
*/
virtual void removeInstance(HepRepInstance * instance) = 0;
/**
* Returns a collection of instances.
*
* @return collection of HepRepInstances.
*/
virtual std::vector<HepRepInstance *> * getInstances() = 0;
/**
* Adds a related instance tree to this instancetree.
*
* @param instanceTree related instancetree.
* @return false only if written immediately to a stream.
*/
virtual bool addInstanceTree(HepRepTreeID * instanceTree) = 0;
/**
* Returns a collection of associated instance trees.
*
* @return collection of HepRepInstanceTrees.
*/
virtual std::vector<HepRepInstanceTree *> * getInstanceTrees() = 0;
/**
* Returns the associated typetree.
*
* @return TreeID of the associated typetree.
*/
virtual HepRepTreeID * getTypeTree() = 0;
/**
* Returns a deep copy of this instancetree.
*
* @param heprep needed to find the associated type.
* @param filter to filter the instances.
* @return copy of this instancetree.
*/
virtual HepRepInstanceTree * copy(HepRep * heprep, HepRepSelectFilter * filter = NULL) = 0;
virtual HepRepTreeID * copy() = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPINSTANCETREE_H */
@@ -0,0 +1,90 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPITERATOR_H
#define HEPREP_HEPREPITERATOR_H 1
// Copyright 2000-2002, FreeHEP.
#include <string>
namespace HEPREP {
class HepRepAttValue;
class HepRepInstance;
class HepRepIteratorListener;
/**
* HepRepIterator interface.
*
* @author Mark Donszelmann
*/
class HepRepIterator {
public:
/// Destructor.
virtual ~HepRepIterator() { /* nop */; }
/**
* Signals if there is a next instance to iterate to.
*
* @return true if next() can be called.
*/
virtual bool hasNext() = 0;
/**
* Returns next instance.
*
* @return next HepRepInstance.
*/
virtual HepRepInstance * nextInstance() = 0;
/**
* Adds a listener to be informed about attribute changes while iterating.
*
* @param listener to be added.
*/
virtual void addHepRepIteratorListener(HepRepIteratorListener * listener) = 0;
/**
* Removes a listener.
*
* @param listener to be removed.
*/
virtual void removeHepRepIteratorListener(HepRepIteratorListener * listener) = 0;
/**
* Returns the attValue for key at the current point of iteration.
*
* @param key name of tye attribute to be looked up.
* @return value associated to name at this point in the iteration.
*/
virtual HepRepAttValue * getAttValue(std::string key) = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPITERATOR_H */
@@ -0,0 +1,113 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPITERATORLISTENER_H
#define HEPREP_HEPREPITERATORLISTENER_H 1
// Copyright 2000-2002, FreeHEP.
#include <string>
#include <vector>
namespace HEPREP {
/**
* HepRepIteratorListener interface. The implementor is called back for changes
* of attributes while using the HepRepIterator to iterate over all the HepRepInstances.
*
* @author Mark Donszelmann
*/
class HepRepIteratorListener {
public:
/// Destructor.
virtual ~HepRepIteratorListener() { /* nop */; }
/**
* Called if attribute key changes its value.
*
* @param key name of the changed attribute.
* @param value value of the changed attribute.
* @param showLabel value of showLabel.
*/
virtual void setAttribute(std::string key, std::string value, int showLabel) = 0;
/**
* Called if attribute key changes its value.
*
* @param key name of the changed attribute.
* @param value value of the changed attribute.
* @param showLabel value of showLabel.
*/
virtual void setAttribute(std::string key, std::vector<double> value, int showLabel) = 0;
/**
* Called if attribute key changes its value.
*
* @param key name of the changed attribute.
* @param value value of the changed attribute.
* @param showLabel value of showLabel.
*/
virtual void setAttribute(std::string key, long value, int showLabel) = 0;
/**
* Called if attribute key changes its value.
*
* @param key name of the changed attribute.
* @param value value of the changed attribute.
* @param showLabel value of showLabel.
*/
virtual void setAttribute(std::string key, int value, int showLabel) = 0;
/**
* Called if attribute key changes its value.
*
* @param key name of the changed attribute.
* @param value value of the changed attribute.
* @param showLabel value of showLabel.
*/
virtual void setAttribute(std::string key, double value, int showLabel) = 0;
/**
* Called if attribute key changes its value.
*
* @param key name of the changed attribute.
* @param value value of the changed attribute.
* @param showLabel value of showLabel.
*/
virtual void setAttribute(std::string key, bool value, int showLabel) = 0;
/**
* Called if attribute key is removed from the attribute set.
*
* @param key name of the removed attribute.
*/
virtual void removeAttribute(std::string key) = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPITERATORLISTENER_H */
@@ -0,0 +1,190 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPPOINT_H
#define HEPREP_HEPREPPOINT_H 1
// Copyright 2000-2002, FreeHEP.
#include <vector>
#include "HEPREP/HepRepAttribute.h"
namespace HEPREP {
class HepRepInstance;
/**
* HepRepPoint interface. The HepRepMath class can be used to deal with the conversions.
*
* @author Mark Donszelmann
*/
class HepRepPoint : virtual public HepRepAttribute {
public:
/// Destructor.
virtual ~HepRepPoint() { /* nop */; }
/**
* Returns coordinate with respect to vertex at (0, 0, 0).
*
* @return dx-coordinate
*/
virtual double getX() = 0;
/**
* Returns coordinate with respect to vertex at (0, 0, 0).
*
* @return dy-coordinate
*/
virtual double getY() = 0;
/**
* Returns coordinate with respect to vertex at (0, 0, 0).
*
* @return dz-coordinate
*/
virtual double getZ() = 0;
/**
* Returns coordinate with respect to vertex at (0, 0, 0).
*
* @return rho = sqrt(dx2+dy2);
*/
virtual double getRho() = 0;
/**
* Returns coordinate with respect to vertex at (0, 0, 0).
*
* @return phi = atan2(dy, dx);
*/
virtual double getPhi() = 0;
/**
* Returns coordinate with respect to vertex at (0, 0, 0).
*
* @return theta = atan2(rho, dx);
*/
virtual double getTheta() = 0;
/**
* Returns coordinate with respect to vertex at (0, 0, 0).
*
* @return r = sqrt(dx2+dy2+dz2);
*/
virtual double getR() = 0;
/**
* Returns coordinate with respect to vertex at (0, 0, 0).
*
* @return eta = -0.5*clog((1.-ct)/(1.+ct)), where ct = .cos(getTheta(dx, dy, dz));
*/
virtual double getEta() = 0;
/**
* Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
*
* @return dx-coordinate
*/
virtual double getX(double xVertex, double yVertex, double zVertex) = 0;
/**
* Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
*
* @return dy-coordinate
*/
virtual double getY(double xVertex, double yVertex, double zVertex) = 0;
/**
* Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
*
* @return dz-coordinate
*/
virtual double getZ(double xVertex, double yVertex, double zVertex) = 0;
/**
* Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
*
* @return rho = sqrt(dx2+dy2);
*/
virtual double getRho(double xVertex, double yVertex, double zVertex) = 0;
/**
* Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
*
* @return phi = atan2(dy, dx);
*/
virtual double getPhi(double xVertex, double yVertex, double zVertex) = 0;
/**
* Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
*
* @return theta = atan2(rho, dx);
*/
virtual double getTheta(double xVertex, double yVertex, double zVertex) = 0;
/**
* Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
*
* @return r = sqrt(dx2+dy2+dz2);
*/
virtual double getR(double xVertex, double yVertex, double zVertex) = 0;
/**
* Returns coordinate with respect to vertex at (xVertex, yVertex, zVertex).
*
* @return eta = -0.5*clog((1.-ct)/(1.+ct)), where ct = .cos(getTheta(dx, dy, dz));
*/
virtual double getEta(double xVertex, double yVertex, double zVertex) = 0;
/**
* Returns coordinate with respect to vertex at (0, 0, 0).
*
* @param xyz list of three coordinates which are filled and returned.
* If null, a new list of three coordinates is allocated.
* @return list of 3 coordinates.
*/
virtual std::vector<double> * getXYZ(std::vector<double> * xyz) = 0;
/**
* Returns associated instance (parent).
*
* @return HepRepInstance.
*/
virtual HepRepInstance * getInstance() = 0;
/**
* Returns a deep copy of this point.
*
* @param parent to add the copy to.
* @return copy of this point.
*/
virtual HepRepPoint * copy(HepRepInstance * parent) = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPPOINT_H */
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPSELECTFILTER_H
#define HEPREP_HEPREPSELECTFILTER_H 1
// Copyright 2000-2002, FreeHEP.
namespace HEPREP {
class HepRepInstance;
/**
* HepRepSelectFilter interface used in copying HepReps.
*
* @author Mark Donszelmann
*/
class HepRepSelectFilter {
public:
/// Destructor.
virtual ~HepRepSelectFilter() { /* nop */; }
/**
* Selects if the given instance will pass.
*
* @param instance to be checked.
* @return true if instance passes.
*/
virtual bool select(HepRepInstance * instance) = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPSELECTFILTER_H */
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPTREEID_H
#define HEPREP_HEPREPTREEID_H 1
// Copyright 2000-2002, FreeHEP.
#include <string>
namespace HEPREP {
/**
* HepRepTreeID interface.
*
* @author Mark Donszelmann
*/
class HepRepTreeID {
public:
/// Destructor.
virtual ~HepRepTreeID() { /* nop */; }
/**
* Returns the name of this treeID.
*
* @return name of treeID.
*/
virtual std::string getName() = 0;
/**
* Returns the version of this treeID.
*
* @return version of treeID.
*/
virtual std::string getVersion() = 0;
/**
* Returns the qualifier that qualifies the relation that this treeID has with what it refers to.
*
* @return qualifier.
*/
virtual std::string getQualifier() = 0;
/**
* Sets the qualifier that qualifies the relation that this treeID has with what it refers to.
*
* @param qualifier to be set.
*/
virtual void setQualifier(std::string qualifier) = 0;
/**
* Returns a deep copy of this treeID.
*
* @return copy of this treeID.
*/
virtual HepRepTreeID * copy() = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPTREEID_H */
@@ -0,0 +1,107 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPTYPE_H
#define HEPREP_HEPREPTYPE_H 1
// Copyright 2000-2002, FreeHEP.
#include <string>
#include <vector>
#include "HEPREP/HepRepDefinition.h"
namespace HEPREP {
class HepRep;
/**
* HepRepType interface.
*
* @author Mark Donszelmann
*/
class HepRepType : virtual public HepRepDefinition {
public:
/// Destructor.
virtual ~HepRepType() { /* nop */; }
/**
* Adds a sub-type to this type.
*
* @param type sub-type to be added.
* @return false only if written directly to a stream.
*/
virtual bool addType(HepRepType * type) = 0;
/**
* Returns the name of this type.
*
* @return name of type.
*/
virtual std::string getName() = 0;
/**
* Returns the description of this type.
*
* @return description of type.
*/
virtual std::string getDescription() = 0;
/**
* Returns the information URL of this type.
*
* @return info URL of type.
*/
virtual std::string getInfoURL() = 0;
/**
* Returns the parent of this type.
*
* @return parent of type, or null if top-level.
*/
virtual HepRepType * getSuperType() = 0;
/**
* Returns a collection of all the sub-types of this type.
*
* @return collection of HepRepTypes.
*/
virtual std::vector<HepRepType *> * getTypes() = 0;
/**
* Returns a deep copy of this type.
*
* @param heprep top-level heprep. (Not sure if this is necessary).
* @param parent to which this copy is added.
* @return copy of this type.
*/
virtual HepRepType * copy(HepRep * heprep, HepRepType * parent) = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPTYPE_H */
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPTYPETREE_H
#define HEPREP_HEPREPTYPETREE_H 1
// Copyright 2000-2002, FreeHEP.
#include <vector>
#include "HEPREP/HepRepTreeID.h"
namespace HEPREP {
class HepRep;
class HepRepTreeID;
class HepRepType;
/**
* HepRepTypeTree interface.
*
* @author Mark Donszelmann
*/
class HepRepTypeTree : virtual public HepRepTreeID {
public:
/// Destructor.
virtual ~HepRepTypeTree() { /* nop */; }
/**
* Adds a type to this typetree.
*
* @param type to be added.
* @return false only if written immediatelty to a stream.
*/
virtual bool addType(HepRepType * type) = 0;
/**
* Returns a collection of all types in this tree.
*
* @return collection of HepRepTypes.
*/
virtual std::vector<HepRepType *> * getTypes() = 0;
/**
* Returns a deep copy of this typetree.
*
* @param heprep top-level heprep. (Not sure if this is necessary).
* @return copy of this typetree.
*/
virtual HepRepTypeTree * copy(HepRep * heprep) = 0;
// To be enable in g++ 3.0
// using HepRep::HepRepTreeID::copy;
// To be disabled in g++ 3.0
virtual HepRepTreeID * copy() = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPTYPETREE_H */
@@ -0,0 +1,164 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// -*- C++ -*-
// AID-GENERATED
// =========================================================================
// This class was generated by AID - Abstract Interface Definition
// DO NOT MODIFY, but use the org.freehep.aid.Aid utility to regenerate it.
// =========================================================================
#ifndef HEPREP_HEPREPWRITER_H
#define HEPREP_HEPREPWRITER_H 1
// Copyright 2002, Freehep.
namespace HEPREP {
class HepRep;
class HepRepAction;
class HepRepAttDef;
class HepRepAttValue;
class HepRepAttribute;
class HepRepDefinition;
class HepRepInstance;
class HepRepInstanceTree;
class HepRepPoint;
class HepRepTreeID;
class HepRepType;
class HepRepTypeTree;
/**
* HepRepWriter interface.
*
* @author Mark Donszelmann
*/
class HepRepWriter {
public:
/// Destructor.
virtual ~HepRepWriter() { /* nop */; }
/**
* Closes the writer and its underlying stream.
*
* @return false in case of a stream problem.
*/
virtual bool close() = 0;
/**
* Writes a HepRep.
*
* @param heprep to be written.
* @return false in case of a stream problem.
*/
virtual bool write(HepRep * heprep) = 0;
/**
* Writes a HepRepTypeTree.
*
* @param typeTree to be written.
* @return false in case of a stream problem.
*/
virtual bool write(HepRepTypeTree * typeTree) = 0;
/**
* Writes a HepRepType.
*
* @param type to be written.
* @return false in case of a stream problem.
*/
virtual bool write(HepRepType * type) = 0;
/**
* Writes a HepRepTreeID.
*
* @param treeID to be written.
* @return false in case of a stream problem.
*/
virtual bool write(HepRepTreeID * treeID) = 0;
/**
* Writes a HepRepAction.
*
* @param action to be written.
* @return false in case of a stream problem.
*/
virtual bool write(HepRepAction * action) = 0;
/**
* Writes a HepRepInstanceTree.
*
* @param instanceTree to be written.
* @return false in case of a stream problem.
*/
virtual bool write(HepRepInstanceTree * instanceTree) = 0;
/**
* Writes a HepRepInstance.
*
* @param instance to be written.
* @return false in case of a stream problem.
*/
virtual bool write(HepRepInstance * instance) = 0;
/**
* Writes a HepRepPoint.
*
* @param point to be written.
* @return false in case of a stream problem.
*/
virtual bool write(HepRepPoint * point) = 0;
/**
* Writes a HepRepAttribute.
*
* @param attribute to be written.
* @return false in case of a stream problem.
*/
virtual bool write(HepRepAttribute * attribute) = 0;
/**
* Writes a HepRepDefinition.
*
* @param definition to be written.
* @return false in case of a stream problem.
*/
virtual bool write(HepRepDefinition * definition) = 0;
/**
* Writes a HepRepAttValue.
*
* @param attValue to be written.
* @return false in case of a stream problem.
*/
virtual bool write(HepRepAttValue * attValue) = 0;
/**
* Writes a HepRepAttDef.
*
* @param attDef to be written.
* @return false in case of a stream problem.
*/
virtual bool write(HepRepAttDef * attDef) = 0;
}; // class
}; // namespace HEPREP
#endif /* ifndef HEPREP_HEPREPWRITER_H */
@@ -20,9 +20,31 @@
// * statement, and all its terms. *
// ********************************************************************
//
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//--------------------------------------------------------------------------
// File and Version Information:
// $Id: HepRepXMLWriter.hh,v 1.8 2002/02/02 04:00:19 perl Exp $
// $Id: HepRepXMLWriter.hh,v 1.9 2002/12/13 11:18:00 gunter Exp $
//
// Description:
// Create a HepRep XML File (HepRep version 1).
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef INDENTPRINTWRITER_H
#define INDENTPRINTWRITER_H 1
#include "FreeHepTypes.h"
#include <iostream>
#include <string>
/**
* A PrintWriter that keeps track of an indentation level
* and indents the output appropriately.
*
* <b>Warning:</b> Only print and println methods taking strings have been overriden,
* print, println methods taking other arguments may not be indented properly.
*
* @author Mark Donszelmann
*/
class IndentPrintWriter {
public:
IndentPrintWriter(std::ostream* out, int level = 0);
virtual ~IndentPrintWriter();
void close();
IndentPrintWriter& operator<< (const char *s);
IndentPrintWriter& operator<< (std::ostream& (*pf)(std::ostream&));
void println(std::string s);
void print(std::string s);
void println();
void indent();
void outdent();
int getIndent();
void setIndent(int level);
std::string getIndentString();
void setIndentString(std::string indentString);
private:
void doIndent();
std::ostream* out;
int indentLevel;
bool indented;
std::string indentString;
};
#endif
@@ -0,0 +1,16 @@
Apart from the heprep1 files:
G4HepRepFile.hh
G4HepRepFileSceneHandler.hh
G4HepRepFileViewer.hh
HepRepXMLWriter.hh
the other sources (heprep2) are copies from the FreeHEP library
(java.freehep.org) and are maintained there.
The files starting with G4 are geant4 compliant, the others may not be.
Changes made here may be overwritten.
12 Nov 2002
Mark Donszelmann
@@ -0,0 +1,77 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef STREAMERHEPREP_H
#define STREAMERHEPREP_H 1
#include "FreeHepTypes.h"
#include <string>
#include <vector>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepSelectFilter.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepTypeTree.h"
#include "HEPREP/HepRepInstanceTree.h"
/**
*
* @author M.Donszelmann
*/
class StreamerHepRep : public virtual HEPREP::HepRep {
private:
std::vector<std::string> layers;
public:
StreamerHepRep(HEPREP::HepRepWriter* streamer);
~StreamerHepRep();
HEPREP::HepRep* copy(HEPREP::HepRepSelectFilter* filter);
std::vector<std::string>* getLayerOrder();
bool addLayer(std::string layer);
bool addTypeTree(HEPREP::HepRepTypeTree* typeTree);
void removeTypeTree(HEPREP::HepRepTypeTree* typeTree);
HEPREP::HepRepTypeTree* getTypeTree(std::string name, std::string version);
std::vector<HEPREP::HepRepTypeTree*>* getTypeTrees();
HEPREP::HepRepType* getType(std::string name);
bool addInstanceTree(HEPREP::HepRepInstanceTree* instanceTree);
void removeInstanceTree(HEPREP::HepRepInstanceTree* instanceTree);
HEPREP::HepRepInstanceTree* getInstanceTreeTop(std::string name, std::string version);
HEPREP::HepRepInstanceTree* getInstances(std::string name, std::string version,
std::vector<std::string> typeNames);
HEPREP::HepRepInstanceTree* getInstancesAfterAction(
std::string name,
std::string version,
std::vector<std::string> typeNames,
std::vector<HEPREP::HepRepAction*> actions,
bool getPoints,
bool getDrawAtts,
bool getNonDrawAtts,
std::vector<std::string> invertAtts);
std::string checkForException();
std::vector<HEPREP::HepRepInstanceTree*>* getInstanceTrees();
};
#endif
@@ -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. *
// ********************************************************************
//
#ifndef STREAMERHEPREPATTRIBUTE_H
#define STREAMERHEPREPATTRIBUTE_H 1
#include "FreeHepTypes.h"
#include <string>
#include <vector>
#include "HEPREP/HepRepAttribute.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepWriter.h"
/**
*
* @author M.Donszelmann
*/
class StreamerHepRepAttribute : public virtual HEPREP::HepRepAttribute {
private:
HEPREP::HepRepWriter* streamer;
public:
StreamerHepRepAttribute(HEPREP::HepRepWriter* streamer);
~StreamerHepRepAttribute();
std::vector<HEPREP::HepRepAttValue*>* getAttValuesFromNode();
bool addAttValue(HEPREP::HepRepAttValue* hepRepAttValue);
bool addAttValue(std::string key, std::string value, int showLabel);
bool addAttValue(std::string key, int value, int showLabel);
bool addAttValue(std::string key, double value, int showLabel);
bool addAttValue(std::string key, bool value, int showLabel);
bool addAttValue(std::string key, std::vector<double> value, int showLabel);
bool addAttValue(std::string key, double red, double green, double blue, double alpha, int showLabel);
HEPREP::HepRepAttValue* getAttValueFromNode(std::string lowerCaseName);
HEPREP::HepRepAttValue* removeAttValue(std::string key);
HEPREP::HepRepAttValue* getAttValue(std::string name);
};
#endif
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef STREAMERHEPREPDEFINITION_H
#define STREAMERHEPREPDEFINITION_H 1
#include "FreeHepTypes.h"
#include <string>
#include <vector>
#include "HEPREP/HepRepDefinition.h"
#include "HEPREP/HepRepWriter.h"
#include "StreamerHepRepAttribute.h"
/**
*
* @author M.Donszelmann
*/
class StreamerHepRepDefinition : public StreamerHepRepAttribute, public virtual HEPREP::HepRepDefinition {
private:
HEPREP::HepRepWriter* streamer;
public:
StreamerHepRepDefinition(HEPREP::HepRepWriter* streamer);
~StreamerHepRepDefinition();
bool addAttDef(HEPREP::HepRepAttDef* hepRepAttDef);
bool addAttDef(std::string name, std::string desc, std::string type, std::string extra);
HEPREP::HepRepAttDef* getAttDef(std::string name);
std::vector<HEPREP::HepRepAttDef *>* getAttDefsFromNode();
HEPREP::HepRepAttDef* getAttDefFromNode(std::string lowerCaseName);
};
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef STREAMERHEPREPINSTANCE_H
#define STREAMERHEPREPINSTANCE_H 1
#include "FreeHepTypes.h"
#include <string>
#include <vector>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepSelectFilter.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepPoint.h"
#include "HEPREP/HepRepAttValue.h"
#include "StreamerHepRepAttribute.h"
/**
*
* @author M.Donszelmann
*/
class StreamerHepRepInstance : public StreamerHepRepAttribute, public virtual HEPREP::HepRepInstance {
private:
void* parent;
HEPREP::HepRepType* type;
public:
StreamerHepRepInstance(HEPREP::HepRepWriter* streamer, HEPREP::HepRepInstance* parent, HEPREP::HepRepType* type);
StreamerHepRepInstance(HEPREP::HepRepWriter* streamer, HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepType* type);
~StreamerHepRepInstance();
HEPREP::HepRepInstance* copy(HEPREP::HepRep* heprep, HEPREP::HepRepInstance* parent, HEPREP::HepRepSelectFilter* filter);
HEPREP::HepRepInstance* copy(HEPREP::HepRep* heprep, HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepSelectFilter* filter);
HEPREP::HepRepType* getType();
bool addPoint(HEPREP::HepRepPoint* point);
std::vector<HEPREP::HepRepPoint *>* getPoints();
bool addInstance(HEPREP::HepRepInstance* instance);
void removeInstance(HEPREP::HepRepInstance* instance);
std::vector<HEPREP::HepRepInstance *>* getInstances();
HEPREP::HepRepAttValue* getAttValue(std::string name);
void *getParent() { return parent; }
};
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef STREAMERHEPREPINSTANCETREE_H
#define STREAMERHEPREPINSTANCETREE_H 1
#include "FreeHepTypes.h"
#include <string>
#include <vector>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepSelectFilter.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepTreeID.h"
#include "DefaultHepRepTreeID.h"
/**
*
* @author M.Donszelmann
*/
class StreamerHepRepInstanceTree : public DefaultHepRepTreeID, public virtual HEPREP::HepRepInstanceTree {
private:
HEPREP::HepRepWriter* streamer;
HEPREP::HepRepTreeID* typeTree;
public:
StreamerHepRepInstanceTree(HEPREP::HepRepWriter* streamer, std::string name, std::string version, HEPREP::HepRepTreeID* typeTree);
~StreamerHepRepInstanceTree();
HEPREP::HepRepInstanceTree* copy(HEPREP::HepRep* heprep, HEPREP::HepRepSelectFilter* filter);
HEPREP::HepRepTreeID* copy();
bool addInstance(HEPREP::HepRepInstance* instance);
void removeInstance(HEPREP::HepRepInstance* instance);
std::vector<HEPREP::HepRepInstance*>* getInstances();
bool addInstanceTree(HEPREP::HepRepTreeID* treeID);
HEPREP::HepRepTreeID* getTypeTree();
std::vector<HEPREP::HepRepInstanceTree*>* getInstanceTrees();
};
#endif
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef STREAMERHEPREPPOINT_H
#define STREAMERHEPREPPOINT_H 1
#include "FreeHepTypes.h"
#include <string>
#include <vector>
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepPoint.h"
#include "StreamerHepRepAttribute.h"
/**
*
* @author M.Donszelmann
*/
class StreamerHepRepPoint : public StreamerHepRepAttribute, public virtual HEPREP::HepRepPoint {
private:
HEPREP::HepRepInstance* instance;
protected:
double x, y, z;
public:
StreamerHepRepPoint(HEPREP::HepRepWriter* streamer, HEPREP::HepRepInstance* instance, double x, double y, double z);
~StreamerHepRepPoint();
HEPREP::HepRepInstance* getInstance();
HEPREP::HepRepAttValue* getAttValue(std::string lowerCaseName);
HEPREP::HepRepPoint* copy(HEPREP::HepRepInstance* parent);
double getX();
double getY();
double getZ();
std::vector<double>* getXYZ(std::vector<double>* xyz);
double getRho();
double getPhi();
double getTheta();
double getR();
double getEta();
double getX(double xVertex, double yVertex, double zVertex);
double getY(double xVertex, double yVertex, double zVertex);
double getZ(double xVertex, double yVertex, double zVertex);
double getRho(double xVertex, double yVertex, double zVertex);
double getPhi(double xVertex, double yVertex, double zVertex);
double getTheta(double xVertex, double yVertex, double zVertex);
double getR(double xVertex, double yVertex, double zVertex);
double getEta(double xVertex, double yVertex, double zVertex);
};
#endif
@@ -0,0 +1,68 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef STREAMERHEPREPTYPE_H
#define STREAMERHEPREPTYPE_H 1
#include "FreeHepTypes.h"
#include <string>
#include <vector>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepAttDef.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepWriter.h"
#include "StreamerHepRepDefinition.h"
/**
*
* @author M.Donszelmann
*/
class StreamerHepRepType : public StreamerHepRepDefinition, public virtual HEPREP::HepRepType {
private:
HEPREP::HepRepType* parent;
std::string name;
std::string description;
std::string infoURL;
public:
StreamerHepRepType(HEPREP::HepRepWriter* streamer, HEPREP::HepRepType* parent, std::string name);
~StreamerHepRepType();
HEPREP::HepRepType* getSuperType();
HEPREP::HepRepAttDef* getAttDef(std::string name);
HEPREP::HepRepAttValue* getAttValue(std::string name);
HEPREP::HepRepType* copy(HEPREP::HepRep* heprep, HEPREP::HepRepType* parent);
std::string getName();
std::string getDescription();
void setDescription(std::string description);
std::string getInfoURL();
void setInfoURL(std::string infoURL);
bool addType(HEPREP::HepRepType* type);
std::vector<HEPREP::HepRepType*>* getTypes();
};
#endif
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef STREAMERHEPREPTYPETREE_H
#define STREAMERHEPREPTYPETREE_H 1
#include "FreeHepTypes.h"
#include <string>
#include <vector>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepTypeTree.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepTreeID.h"
#include "DefaultHepRepTreeID.h"
/**
*
* @author M.Donszelmann
*/
class StreamerHepRepTypeTree : public DefaultHepRepTreeID, public virtual HEPREP::HepRepTypeTree {
public:
StreamerHepRepTypeTree(HEPREP::HepRepWriter* streamer, HEPREP::HepRepTreeID* typeTree);
~StreamerHepRepTypeTree();
HEPREP::HepRepTypeTree* copy(HEPREP::HepRep* heprep);
HEPREP::HepRepTreeID* copy();
bool addType(HEPREP::HepRepType* type);
std::vector<HEPREP::HepRepType* >* getTypes();
};
#endif
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef XMLHEPREPSTREAMER_H
#define XMLHEPREPSTREAMER_H 1
#include "FreeHepTypes.h"
#include <iostream>
#include <string>
#include <stack>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepFactory.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepPoint.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepTreeID.h"
#include "HEPREP/HepRepAction.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepTypeTree.h"
#include "HEPREP/HepRepAttDef.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepAttribute.h"
#include "XMLWriter.h"
/**
*
* @author M.Donszelmann
*/
class XMLHepRepStreamer : public XMLWriter, public virtual HEPREP::HepRepWriter {
private:
std::string nameSpace;
bool writtenLayers;
std::stack<void *> hepreps;
HEPREP::HepRep *heprep;
HEPREP::HepRepTypeTree *heprepTypeTree;
public:
XMLHepRepStreamer(std::ostream* out);
~XMLHepRepStreamer();
bool close();
bool write(HEPREP::HepRep* heprep);
bool write(HEPREP::HepRepTypeTree* typeTree);
bool write(HEPREP::HepRepType* type);
bool write(HEPREP::HepRepTreeID* treeID);
bool write(HEPREP::HepRepAction* action);
bool write(HEPREP::HepRepInstanceTree* instanceTree);
bool write(HEPREP::HepRepInstance* instance);
bool write(HEPREP::HepRepPoint* point);
bool write(HEPREP::HepRepAttribute* attribute);
bool write(HEPREP::HepRepDefinition* definition);
bool write(HEPREP::HepRepAttValue* attValue);
bool write(HEPREP::HepRepAttDef* attDef);
};
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef XMLHEPREPSTREAMERFACTORY_H
#define XMLHEPREPSTREAMERFACTORY_H 1
#include "FreeHepTypes.h"
#include <string>
#include <iostream>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepFactory.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepPoint.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepTreeID.h"
#include "HEPREP/HepRepAction.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepTypeTree.h"
/**
*
* @author M.Donszelmann
*/
class XMLHepRepStreamerFactory : public virtual HEPREP::HepRepFactory {
private:
HEPREP::HepRepWriter* streamer;
public:
XMLHepRepStreamerFactory();
~XMLHepRepStreamerFactory();
// static HEPREP::HepRepFactory* create();
HEPREP::HepRepWriter* createHepRepWriter (std::ostream* out);
HEPREP::HepRepPoint* createHepRepPoint (HEPREP::HepRepInstance* instance,
double x, double y, double z);
HEPREP::HepRepInstance* createHepRepInstance (HEPREP::HepRepInstance* parent, HEPREP::HepRepType* type);
HEPREP::HepRepInstance* createHepRepInstance (HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepType* type);
HEPREP::HepRepTreeID* createHepRepTreeID (std::string name, std::string version, std::string qualifier = "top-level");
HEPREP::HepRepAction* createHepRepAction (std::string name, std::string expression);
HEPREP::HepRepInstanceTree* createHepRepInstanceTree (std::string name, std::string version,
HEPREP::HepRepTreeID* typeTreeID);
HEPREP::HepRepType* createHepRepType (HEPREP::HepRepType* parent, std::string name);
HEPREP::HepRepTypeTree* createHepRepTypeTree (HEPREP::HepRepTreeID* treeID);
HEPREP::HepRep* createHepRep ();
};
#endif
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef XMLWRITER_H
#define XMLWRITER_H 1
#include "FreeHepTypes.h"
#include <iostream>
#include <map>
#include <stack>
#include <vector>
#include <string>
#include "IndentPrintWriter.h"
/**
* A class that makes it easy to write XML documents.
*
* @author Tony Johnson
* @author Mark Donszelmann
*/
class XMLWriter {
public:
XMLWriter(std::ostream* out, std::string indentString = " ", std::string defaultNameSpace = "");
virtual ~XMLWriter();
void close();
void openDoc(std::string version = "1.0", std::string encoding = "", bool standalone = false);
void referToDTD(std::string name, std::string pid, std::string ref);
void referToDTD(std::string name, std::string system);
void closeDoc();
void printComment(std::string comment);
void print(std::string text);
void println(std::string text);
void openTag(std::string ns, std::string name);
void openTag(std::string name);
void closeTag();
void printTag(std::string ns, std::string name);
void printTag(std::string name);
void setAttribute(std::string name, std::string value);
void setAttribute(std::string ns, std::string name, std::string value);
void setAttribute(std::string name, double value);
void setAttribute(std::string ns, std::string name, double value);
void printAttributes(int tagLength);
std::string normalize(std::string s);
std::string normalizeText(std::string s);
void checkNameValid(std::string s);
protected:
bool closed;
IndentPrintWriter* writer;
std::string defaultNameSpace;
private:
std::string* dtdName;
std::map<std::string, std::string> attributes;
std::stack<std::string> openTags;
};
#endif
@@ -0,0 +1,47 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "DefaultHepRepAction.h"
using namespace std;
using namespace HEPREP;
DefaultHepRepAction::DefaultHepRepAction(string name, string expression)
: name(name), expression(expression) {
}
DefaultHepRepAction::~DefaultHepRepAction() {
}
string DefaultHepRepAction::getName() {
return name;
}
string DefaultHepRepAction::getExpression() {
return expression;
}
HepRepAction* DefaultHepRepAction::copy() {
return NULL;
}
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include <cstring>
#include <cctype>
#include "DefaultHepRepAttDef.h"
using namespace std;
using namespace HEPREP;
DefaultHepRepAttDef::DefaultHepRepAttDef(string name, string desc, string category, string extra)
: name(name), desc(desc), category(category), extra(extra) {
}
DefaultHepRepAttDef::~DefaultHepRepAttDef() {
}
HepRepAttDef* DefaultHepRepAttDef::copy() {
return NULL;
}
string DefaultHepRepAttDef::getName() {
return name;
}
string DefaultHepRepAttDef::getLowerCaseName() {
char* tmp = new char[strlen(name.c_str())];
strcpy(tmp, name.c_str());
int i = -1;
do {
i++;
tmp[i] = tolower(tmp[i]);
} while (tmp[i] != 0);
return tmp;
}
string DefaultHepRepAttDef::getDescription() {
return desc;
}
string DefaultHepRepAttDef::getCategory() {
return category;
}
string DefaultHepRepAttDef::getExtra() {
return extra;
}
@@ -0,0 +1,200 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cstdio>
#include <iostream>
#include "HEPREP/HepRepConstants.h"
#include "DefaultHepRepAttValue.h"
using namespace std;
using namespace HEPREP;
DefaultHepRepAttValue::DefaultHepRepAttValue(string name, string value, int showLabel)
: name(name), type(HepRepConstants::TYPE_STRING), stringValue(value), showLabelValue(showLabel) {
init();
}
DefaultHepRepAttValue::DefaultHepRepAttValue(string name, long value, int showLabel)
: name(name), type(HepRepConstants::TYPE_LONG), longValue(value), showLabelValue(showLabel) {
init();
}
DefaultHepRepAttValue::DefaultHepRepAttValue(string name, int value, int showLabel)
: name(name), type(HepRepConstants::TYPE_INT), longValue(value), showLabelValue(showLabel) {
init();
}
DefaultHepRepAttValue::DefaultHepRepAttValue(string name, double value, int showLabel)
: name(name), type(HepRepConstants::TYPE_DOUBLE), doubleValue(value), showLabelValue(showLabel) {
init();
}
DefaultHepRepAttValue::DefaultHepRepAttValue(string name, bool value, int showLabel)
: name(name), type(HepRepConstants::TYPE_BOOLEAN), booleanValue(value), showLabelValue(showLabel) {
init();
}
DefaultHepRepAttValue::DefaultHepRepAttValue(string name, vector<double> value, int showLabel)
: name(name), type(HepRepConstants::TYPE_COLOR), colorValue(value), showLabelValue(showLabel) {
init();
}
DefaultHepRepAttValue::~DefaultHepRepAttValue() {
}
void DefaultHepRepAttValue::init() {
labelStrings[0] = "NAME";
labelStrings[1] = "DESC";
labelStrings[2] = "VALUE";
labelStrings[3] = "EXTRA";
}
HepRepAttValue* DefaultHepRepAttValue::copy() {
return NULL;
}
string DefaultHepRepAttValue::getName() {
return name;
}
string DefaultHepRepAttValue::getLowerCaseName() {
char *tmp = new char[strlen(name.c_str())];
strcpy(tmp, name.c_str());
int i = -1;
do {
i++;
tmp[i] = tolower(tmp[i]);
} while (tmp[i] != 0);
return tmp;
}
int DefaultHepRepAttValue::getType() {
return type;
}
string DefaultHepRepAttValue::getTypeName() {
switch(type) {
case HepRepConstants::TYPE_COLOR: return("Color");
case HepRepConstants::TYPE_STRING: return("String");
case HepRepConstants::TYPE_LONG: return("long");
case HepRepConstants::TYPE_INT: return("int");
case HepRepConstants::TYPE_DOUBLE: return("double");
case HepRepConstants::TYPE_BOOLEAN: return("boolean");
default: return "Unknown type stored in HepRepAttDef";
}
}
int DefaultHepRepAttValue::showLabel() {
return showLabelValue;
}
string DefaultHepRepAttValue::getString() {
if (type != HepRepConstants::TYPE_STRING) cerr << "Trying to access AttValue as 'string'" << endl;
return stringValue;
}
long DefaultHepRepAttValue::getLong() {
if (type != HepRepConstants::TYPE_LONG) cerr << "Trying to access AttValue as 'long'" << endl;
return longValue;
}
int DefaultHepRepAttValue::getInteger() {
if (type != HepRepConstants::TYPE_INT) cerr << "Trying to access AttValue as 'int'" << endl;
return (int)longValue;
}
double DefaultHepRepAttValue::getDouble() {
if (type != HepRepConstants::TYPE_DOUBLE) cerr << "Trying to access AttValue as 'double'" << endl;
return doubleValue;
}
bool DefaultHepRepAttValue::getBoolean() {
if (type != HepRepConstants::TYPE_BOOLEAN) cerr << "Trying to access AttValue as 'boolean'" << endl;
return booleanValue;
}
vector<double> DefaultHepRepAttValue::getColor() {
if (type != HepRepConstants::TYPE_COLOR) cerr << "Trying to access AttValue as 'color'" << endl;
return colorValue;
}
string DefaultHepRepAttValue::getAsString() {
char buffer[40];
switch(type) {
case HepRepConstants::TYPE_COLOR: sprintf(buffer, "%4.2f, %4.2f, %4.2f, %4.2f",
colorValue[0],
colorValue[1],
colorValue[2],
(colorValue.size() > 3) ? colorValue[3] : 1.0);
return buffer;
case HepRepConstants::TYPE_STRING: return getString();
case HepRepConstants::TYPE_LONG: sprintf(buffer, "%ld", getLong());
return buffer;
case HepRepConstants::TYPE_INT: sprintf(buffer, "%d", getInteger());
return buffer;
case HepRepConstants::TYPE_DOUBLE: sprintf(buffer, "%f", getDouble());
return buffer;
case HepRepConstants::TYPE_BOOLEAN: return (getBoolean()) ? "true" : "false";
default: return "Unknown typecode";
}
}
string DefaultHepRepAttValue::toShowLabel() {
string label = "";
bool first = true;
if (showLabel() == HepRepConstants::SHOW_NONE) {
label = "NONE";
} else {
for (int i=0; i<16; i++) {
if (((showLabel() >> i) & 0x0001) == 0x0001) {
if (first) {
first = false;
} else {
label.append(", ");
}
if (i < LABELSTRINGS_LEN) {
label.append(labelStrings[i]);
} else {
char hex[20];
sprintf(hex, "%0x", 1 << i);
label.append(hex);
}
}
}
}
return label;
}
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include <iostream>
#include "DefaultHepRepTreeID.h"
using namespace std;
using namespace HEPREP;
DefaultHepRepTreeID::DefaultHepRepTreeID(string name, string version, string qualifier)
: name(name), version(version), qualifier(qualifier) {
}
DefaultHepRepTreeID::~DefaultHepRepTreeID() {
}
string DefaultHepRepTreeID::getQualifier() {
return qualifier;
}
void DefaultHepRepTreeID::setQualifier(string qual) {
this->qualifier = qual;
}
string DefaultHepRepTreeID::getName() {
return name;
}
string DefaultHepRepTreeID::getVersion() {
return version;
}
HepRepTreeID* DefaultHepRepTreeID::copy() {
return NULL;
}
@@ -0,0 +1,88 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/**
* @author Mark Donszelmann
*/
//G4
#include "G4Types.hh"
#include "G4HepRepViewer.hh"
#include "G4HepRepSceneHandler.hh"
//This
#include "G4HepRep.hh"
using namespace HEPREP;
G4HepRep::G4HepRep ()
: G4VGraphicsSystem ("G4HepRep",
"HepRepXML",
"HepRep Generic Driver for XML, RMI and CORBA",
G4VGraphicsSystem::threeD) {
}
G4HepRep::~G4HepRep () {
}
G4VSceneHandler* G4HepRep::CreateSceneHandler (const G4String& name) {
G4HepRepSceneHandler* scene = new G4HepRepSceneHandler (*this, name);
return scene;
}
G4VViewer* G4HepRep::CreateViewer (G4VSceneHandler& scene, const G4String& name) {
G4VViewer* view = new G4HepRepViewer ((G4HepRepSceneHandler&)scene, name);
if (view) {
if (view->GetViewId() < 0) {
G4cout << "G4HepRep::CreateViewer: ERROR flagged by negative view ID." << G4endl;
delete view;
view = NULL;
}
} else {
G4cout << "G4HepRep::CreateViewer: null pointer on new G4HepRepViewer." << G4endl;
}
return view;
}
@@ -21,8 +21,30 @@
// ********************************************************************
//
//
// $Id: G4HepRepFile.cc,v 1.4 2002/02/02 04:00:22 perl Exp $
// GEANT4 tag $Name: geant4-04-01 $
// ********************************************************************
// * 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: G4HepRepFile.cc,v 1.6 2002/12/13 11:18:03 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Joseph Perl 1 October 2001
@@ -41,8 +63,8 @@ static HepRepXMLWriter* hepRepXMLWriter;
G4HepRepFile::G4HepRepFile():
G4VGraphicsSystem("G4HepRepFile",
"HepRepFile",
"A template graphics driver",
G4VGraphicsSystem::noFunctionality) {
"A HepRep (format 1) ascii file driver",
G4VGraphicsSystem::threeD) {
hepRepXMLWriter = new HepRepXMLWriter();
}
@@ -21,10 +21,32 @@
// ********************************************************************
//
//
// $Id: G4HepRepFileSceneHandler.cc,v 1.7 2002/02/03 22:22:58 perl Exp $
// GEANT4 tag $Name: geant4-04-01 $
// ********************************************************************
// * 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: G4HepRepFileSceneHandler.cc,v 1.10 2002/12/13 11:18:03 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
//
// Joseph Perl 27th January 2002
// A base class for a scene handler to export geometry and trajectories
// to the HepRep xml file format.
@@ -45,6 +67,8 @@
#include "G4Square.hh"
#include "G4Polyhedron.hh"
#include "G4NURBS.hh"
#include "G4VTrajectory.hh"
#include "G4VHit.hh"
//HepRep
#include "HepRepXMLWriter.hh"
@@ -79,22 +103,9 @@ void G4HepRepFileSceneHandler::EstablishSpecials
void G4HepRepFileSceneHandler::BeginModeling() {
G4VSceneHandler::BeginModeling(); // Required: see G4VSceneHandler.hh.
// Force culling off...
if (fpModel) {
fpOriginalMP = fpModel->GetModelingParameters();
if (fpOriginalMP) {
fpNonCullingMP = new G4ModelingParameters(*fpOriginalMP);
fpNonCullingMP->SetCulling(false);
fpModel->SetModelingParameters(fpNonCullingMP);
}
}
}
void G4HepRepFileSceneHandler::EndModeling() {
if (fpModel && fpOriginalMP) {
fpModel->SetModelingParameters(fpOriginalMP);
delete fpNonCullingMP;
}
G4VSceneHandler::EndModeling(); // Required: see G4VSceneHandler.hh.
}
@@ -237,6 +248,19 @@ void G4HepRepFileSceneHandler::AddThis(const G4VSolid& solid) {
G4VSceneHandler::AddThis(solid); // Invoke default action.
}
void G4HepRepFileSceneHandler::AddThis (const G4VTrajectory& traj) {
#ifdef G4HEPREPFILEDEBUG
G4cout << "G4HepRepFileSceneHandler::AddThis(G4VTrajectory&) " << G4endl;
#endif
G4VSceneHandler::AddThis (traj);
}
void G4HepRepFileSceneHandler::AddThis (const G4VHit& hit) {
#ifdef G4HEPREPFILEDEBUG
G4cout << "G4HepRepFileSceneHandler::AddThis(G4VHit&) " << G4endl;
#endif
G4VSceneHandler::AddThis (hit);
}
void G4HepRepFileSceneHandler::AddPrimitive(const G4Polyline& polyline) {
#ifdef G4HEPREPFILEDEBUG
@@ -272,7 +296,7 @@ void G4HepRepFileSceneHandler::AddPrimitive (const G4Polymarker& line) {
hepRepXMLWriter->addAttValue("MarkSize", 4);
hepRepXMLWriter->addPrimitive();
for (size_t i=0; i < line.size(); i++) {
G4Point3D vertex = (*fpObjectTransformation) * line[i];
hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
@@ -303,7 +327,7 @@ void G4HepRepFileSceneHandler::AddPrimitive(const G4Circle& circle) {
hepRepXMLWriter->addAttValue("MarkName", "Dot");
hepRepXMLWriter->addAttValue("MarkSize", 4);
hepRepXMLWriter->addPrimitive();
G4Point3D center = (*fpObjectTransformation) * circle.GetPosition();
@@ -389,7 +413,7 @@ void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
length = sprintf (newFileSpec, "%s%d%s","G4Data",fileCounter,".heprep");
hepRepXMLWriter->open(newFileSpec);
fileCounter++;
hepRepXMLWriter->addAttDef("LVol", "Logical Volume", "Physics","");
hepRepXMLWriter->addAttDef("Solid", "Solid Name", "Physics","");
hepRepXMLWriter->addAttDef("EType", "Entity Type", "Physics","");
@@ -420,7 +444,7 @@ void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
}
hepRepXMLWriter->addInstance();
// Handle Type declaration for Detector Geometry,
// replacing G4's top geometry level name "worldPhysical" with the
// name "Detector Geometry".
@@ -435,13 +459,13 @@ void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
hepRepXMLWriter->addType("G4 Culled Layer", hepRepXMLWriter->typeDepth + 1);
hepRepXMLWriter->addInstance();
}
if (fCurrentDepth!=0) {
// Add the HepRepType for the current volume.
hepRepXMLWriter->addType(fpCurrentPV->GetName(),fCurrentDepth);
hepRepXMLWriter->addInstance();
}
// Additional attributes.
hepRepXMLWriter->addAttValue("LVol", fpCurrentLV->GetName());
hepRepXMLWriter->addAttValue("Solid", fpCurrentLV->GetSolid()->GetName());
@@ -451,7 +475,7 @@ void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
hepRepXMLWriter->addAttValue("State", fpCurrentLV->GetMaterial()->GetState());
hepRepXMLWriter->addAttValue("Radlen", fpCurrentLV->GetMaterial()->GetRadlen());
}
hepRepXMLWriter->addAttValue("DrawAs",primName);
hepRepXMLWriter->addAttValue("Layer",hepRepXMLWriter->typeDepth);
@@ -460,17 +484,17 @@ void G4HepRepFileSceneHandler::AddHepRepInstance(const char* primName,
float redness = colour.GetRed();
float greenness = colour.GetGreen();
float blueness = colour.GetBlue();
if (redness==0. && greenness==0. && blueness==0.) {
redness = 1.;
greenness = 1.;
blueness = 1.;
}
if (strcmp(primName,"Point")==0)
hepRepXMLWriter->addAttValue("MarkColor",redness,greenness,blueness);
else
hepRepXMLWriter->addAttValue("LineColor",redness,greenness,blueness);
hepRepXMLWriter->addAttValue("LineColor",redness,greenness,blueness);
// Handle visibility attribute.
const G4VisAttributes* visAtts = visible.GetVisAttributes();
@@ -21,8 +21,30 @@
// ********************************************************************
//
//
// $Id: G4HepRepFileViewer.cc,v 1.6 2002/02/02 04:00:27 perl Exp $
// GEANT4 tag $Name: geant4-04-01 $
// ********************************************************************
// * 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: G4HepRepFileViewer.cc,v 1.8 2002/12/13 11:18:03 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
#include "G4HepRepFileViewer.hh"
@@ -40,6 +62,9 @@ G4HepRepFileViewer::G4HepRepFileViewer
(G4VSceneHandler& sceneHandler, const G4String& name):
G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name) {
hepRepXMLWriter = ((G4HepRepFileSceneHandler*)(&sceneHandler))->GetHepRepXMLWriter();
// Make changes to view parameters for HepRep...
fVP.SetCulling(false);
fDefaultVP.SetCulling(false);
}
G4HepRepFileViewer::~G4HepRepFileViewer() {}
@@ -0,0 +1,617 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/**
* @author Mark Donszelmann
*/
#include "globals.hh"
#include "g4std/vector"
#include "g4std/strstream"
#include "g4std/fstream"
//HepRep
#include "HEPREP/HepRep.h"
//G4
#include "G4Types.hh"
#include "G4Point3D.hh"
#include "G4Normal3D.hh"
#include "G4Polyline.hh"
#include "G4Polymarker.hh"
#include "G4Polyhedron.hh"
#include "G4Circle.hh"
#include "G4Square.hh"
#include "G4Text.hh"
#include "G4NURBS.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VisAttributes.hh"
#include "G4VSolid.hh"
#include "G4VTrajectory.hh"
#include "G4VHit.hh"
#include "G4Scene.hh"
#include "G4Material.hh"
// Streamer
#include "XMLHepRepStreamerFactory.h"
// This
#include "G4HepRep.hh"
#include "G4HepRepSceneHandler.hh"
using namespace HEPREP;
G4int G4HepRepSceneHandler::sceneCount = 0;
G4int G4HepRepSceneHandler::sceneIdCount = 0;
G4HepRepSceneHandler::G4HepRepSceneHandler (G4VGraphicsSystem& system, const G4String& name)
: G4VSceneHandler (system, sceneIdCount++, name),
currentDepth (0),
currentPV (0),
currentLV (0) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::G4HepRepSceneHandler: "
<< system << " "
<< GetScene()->GetName() << G4endl;
#endif
heprepFactory = new XMLHepRepStreamerFactory();
writer = NULL;
fileNo = 0;
}
G4HepRepSceneHandler::~G4HepRepSceneHandler () {
close();
delete heprepFactory;
heprepFactory = NULL;
}
HepRepFactory* G4HepRepSceneHandler::GetHepRepFactory() {
if (writer == NULL) open();
return heprepFactory;
}
void G4HepRepSceneHandler::open() {
if (writer != NULL) return;
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::open(" << fname << ") " << G4endl;
#endif
if (strcmp(GetScene()->GetName(), "stdout") == 0) {
out = NULL;
writer = heprepFactory->createHepRepWriter(&G4cout);
} else if (strcmp(GetScene()->GetName(), "stderr") == 0) {
out = NULL;
writer = heprepFactory->createHepRepWriter(&G4cerr);
} else {
char fname [256];
G4std::ostrstream ost(fname, 256);
ost << GetScene()->GetName() << "-" << fileNo++ << ".heprep" << G4std::ends;
out = new G4std::ofstream(fname);
writer = heprepFactory->createHepRepWriter(out);
}
heprep = heprepFactory->createHepRep();
heprep->addLayer("Geometry");
heprep->addLayer("Event");
heprep->addLayer("CalHit");
heprep->addLayer("Track");
heprep->addLayer("Hit");
HepRepTreeID* treeID = heprepFactory->createHepRepTreeID("G4Types", "1.0");
HepRepTypeTree* typeTree = heprepFactory->createHepRepTypeTree(treeID);
heprep->addTypeTree(typeTree);
geometryType = heprepFactory->createHepRepType(NULL, "Detector Geometry");
geometryType->addAttDef("LVol", "Logical Volume", "Physics","");
geometryType->addAttDef("Solid", "Solid Name", "Physics","");
geometryType->addAttDef("EType", "Entity Type", "Physics","");
geometryType->addAttDef("Material", "Material Name", "Physics","");
geometryType->addAttDef("Density", "Material Density", "Physics","");
geometryType->addAttDef("State", "Material State", "Physics","");
geometryType->addAttDef("Radlen", "Material Radiation Length", "Physics","");
geometryType->addAttValue("Layer", G4String("Geometry"));
geometryType->addAttValue("HasFrame", true);
typeTree->addType(geometryType);
eventType = heprepFactory->createHepRepType(NULL, "Event");
eventType->addAttValue("Layer", G4String("Event"));
eventType->addAttValue("HasFrame", true);
typeTree->addType(eventType);
trackType = heprepFactory->createHepRepType(eventType, "Track");
trackType->addAttValue("Layer", G4String("Track"));
calHitType = heprepFactory->createHepRepType(eventType, "Calorimeter Hit");
calHitType->addAttValue("Layer", G4String("CalHit"));
calHitType->addAttValue("Fill", true);
hitType = heprepFactory->createHepRepType(eventType, "Hit");
hitType->addAttValue("Layer", G4String("Hit"));
HepRepInstanceTree* instanceTree = heprepFactory->createHepRepInstanceTree("G4Data", "1.0", typeTree);
heprep->addInstanceTree(instanceTree);
parent = heprepFactory->createHepRepInstance(instanceTree, eventType);
instanceTree->addInstance(parent);
delete treeID;
delete typeTree;
delete instanceTree;
}
void G4HepRepSceneHandler::close() {
if (writer == NULL) return;
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::close() " << G4endl;
#endif
writer->close();
delete writer;
delete out;
writer = NULL;
out = NULL;
delete heprep;
heprep = NULL;
delete geometryType;
geometryType = NULL;
delete eventType;
eventType = NULL;
delete trackType;
trackType = NULL;
delete hitType;
hitType = NULL;
delete calHitType;
calHitType = NULL;
delete parent;
parent = NULL;
}
void G4HepRepSceneHandler::EstablishSpecials(G4PhysicalVolumeModel& model) {
model.DefinePointersToWorkingSpace(&currentDepth, &currentPV, &currentLV);
}
void G4HepRepSceneHandler::BeginModeling() {
G4VSceneHandler::BeginModeling();
}
void G4HepRepSceneHandler::EndModeling() {
G4VSceneHandler::EndModeling();
}
void G4HepRepSceneHandler::AddPrimitive (const G4Polyline& line) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddPrimitive(G4Polyline&) " << line.size() << G4endl;
#endif
HepRepFactory* factory = GetHepRepFactory();
HepRepInstance* instance = CreateInstance(parent, trackType);
SetLine(instance, line);
instance->addAttValue("DrawAs", G4String("Line"));
SetColour(instance, GetColour(line));
for (size_t i=0; i < line.size(); i++) {
G4Point3D vertex = transform * line[i];
HepRepPoint* point = factory->createHepRepPoint(instance, vertex.x(), vertex.y(), vertex.z());
delete point;
}
delete instance;
}
void G4HepRepSceneHandler::AddPrimitive (const G4Polymarker& line) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddPrimitive(G4Polymarker&) " << line.size() << G4endl;
#endif
HepRepFactory* factory = GetHepRepFactory();
HepRepInstance* instance = CreateInstance(parent, hitType);
instance->addAttValue("DrawAs", G4String("Point"));
SetMarker(instance, line);
switch (line.GetMarkerType()) {
case line.dots:
instance->addAttValue("MarkName", G4String("Circle"));
instance->addAttValue("Fill", true);
SetColour(instance, GetColour(line), G4String("FillColor"));
break;
case line.circles:
instance->addAttValue("MarkName", G4String("Circle"));
break;
case line.squares:
instance->addAttValue("MarkName", G4String("Box"));
break;
case line.line:
default:
instance->addAttValue("MarkName", G4String("Plus"));
break;
}
SetColour(instance, GetColour(line));
for (size_t i=0; i < line.size(); i++) {
G4Point3D vertex = transform * line[i];
HepRepPoint* point = factory->createHepRepPoint(instance, vertex.x(), vertex.y(), vertex.z());
delete point;
}
delete instance;
}
void G4HepRepSceneHandler::AddPrimitive (const G4Circle& circle) {
G4Point3D center = transform * circle.GetPosition();
HepRepFactory* factory = GetHepRepFactory();
HepRepInstance* instance = CreateInstance(parent, hitType);
SetColour (instance, GetColour(circle));
instance->addAttValue("DrawAs", G4String("Point"));
instance->addAttValue("MarkName", G4String("Circle"));
SetMarker(instance, circle);
HepRepPoint* point = factory->createHepRepPoint(instance, center.x(), center.y(), center.z());
delete point;
delete instance;
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddPrimitive(G4Circle&) : center : "
<< " x : " << center.x()
<< " y : " << center.y()
<< " z : " << center.z()
<< " ,radius : " << size << G4endl;
#endif
}
void G4HepRepSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddPrimitive(G4Polyhedron&) " << G4endl;
#endif
G4Normal3D surfaceNormal;
G4Point3D vertex;
if (polyhedron.GetNoFacets()==0) return;
HepRepFactory* factory = GetHepRepFactory();
HepRepInstance* instance = CreateInstance(parent, calHitType);
G4bool notLastFace;
do {
HepRepInstance* face = CreateInstance(instance, calHitType);
SetLine(face, polyhedron);
face->addAttValue("DrawAs", G4String("Polygon"));
SetColour(face, GetColour(polyhedron));
if (IsEventData()) SetColour(face, GetColour(polyhedron), G4String("FillColor"));
notLastFace = polyhedron.GetNextNormal (surfaceNormal);
G4int edgeFlag = 1;
G4bool notLastEdge;
do {
notLastEdge = polyhedron.GetNextVertex (vertex, edgeFlag);
vertex = transform * vertex;
HepRepPoint* point = factory->createHepRepPoint(face, vertex.x(), vertex.y(), vertex.z());
delete point;
} while (notLastEdge);
delete face;
} while (notLastFace);
delete instance;
}
void G4HepRepSceneHandler::AddPrimitive (const G4Text& text) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddPrimitive(G4Text&) " << G4endl;
#endif
G4cout << "G4HepRepSceneHandler::AddPrimitive G4Text : not yet implemented. " << G4endl;
}
void G4HepRepSceneHandler::AddPrimitive (const G4Square& square) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddPrimitive(G4Square&) " << G4endl;
#endif
G4Point3D center = transform * square.GetPosition();
HepRepFactory* factory = GetHepRepFactory();
HepRepInstance* instance = CreateInstance(parent, hitType);
SetColour (instance, GetColour(square));
instance->addAttValue("DrawAs", G4String("Point"));
instance->addAttValue("MarkName", G4String("Box"));
SetMarker(instance, square);
HepRepPoint* point = factory->createHepRepPoint(instance, center.x(), center.y(), center.z());
delete point;
delete instance;
}
//Method for handling G4NURBS objects for drawing solids.
//Knots and Ctrl Pnts MUST be arrays of GLfloats.
void G4HepRepSceneHandler::AddPrimitive (const G4NURBS& nurb) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddPrimitive(G4NURBS&) " << G4endl;
#endif
G4cout << "G4HepRepSceneHandler::AddPrimitive G4NURBS : not yet implemented. " << G4endl;
}
void G4HepRepSceneHandler::AddThis (const G4Box& box) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4Box&) " << G4endl;
#endif
G4VSceneHandler::AddThis (box);
}
void G4HepRepSceneHandler::AddThis (const G4Cons& cons) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4Cons&) " << G4endl;
#endif
G4VSceneHandler::AddThis (cons);
}
void G4HepRepSceneHandler::AddThis (const G4Tubs& tubs) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4Tubs&) " << G4endl;
#endif
G4VSceneHandler::AddThis (tubs);
}
void G4HepRepSceneHandler::AddThis (const G4Trd& trd) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4Trd&) " << G4endl;
#endif
G4VSceneHandler::AddThis (trd);
}
void G4HepRepSceneHandler::AddThis (const G4Trap& trap) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4Trap&) " << G4endl;
#endif
G4VSceneHandler::AddThis (trap);
}
void G4HepRepSceneHandler::AddThis (const G4Sphere& sphere) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4Sphere&) " << G4endl;
#endif
G4VSceneHandler::AddThis (sphere);
}
void G4HepRepSceneHandler::AddThis (const G4Para& para) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4Para&) " << G4endl;
#endif
G4VSceneHandler::AddThis (para);
}
void G4HepRepSceneHandler::AddThis (const G4Torus& torus) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4Torus&) " << G4endl;
#endif
G4VSceneHandler::AddThis (torus);
}
void G4HepRepSceneHandler::AddThis (const G4Polycone& polycone) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4Polycone&) " << G4endl;
#endif
G4VSceneHandler::AddThis (polycone);
}
void G4HepRepSceneHandler::AddThis (const G4Polyhedra& polyhedra) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4Polyhedra&) " << G4endl;
#endif
G4VSceneHandler::AddThis (polyhedra);
}
void G4HepRepSceneHandler::AddThis (const G4VSolid& solid) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4VSolid&) " << G4endl;
#endif
G4VSceneHandler::AddThis (solid);
}
void G4HepRepSceneHandler::AddThis (const G4VTrajectory& traj) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4VTrajectory&) " << G4endl;
#endif
G4VSceneHandler::AddThis (traj);
}
void G4HepRepSceneHandler::AddThis (const G4VHit& hit) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::AddThis(G4VHit&) " << G4endl;
#endif
G4VSceneHandler::AddThis (hit);
}
void
G4HepRepSceneHandler::PreAddThis
(const G4Transform3D& objectTransformation,
const G4VisAttributes& visAttribs) {
G4VSceneHandler::PreAddThis (objectTransformation, visAttribs);
transform = objectTransformation;
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::PreAddThis : " << objectTransformation << G4endl;
G4cout << "G4HepRepSceneHandler::PreAddThis : " << visAttribs << G4endl;
#endif
}
void G4HepRepSceneHandler::PostAddThis () {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::PostAddThis" << G4endl;
#endif
G4VSceneHandler::PostAddThis();
}
void G4HepRepSceneHandler::BeginPrimitives (const G4Transform3D& objectTransformation) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::BeginPrimitives: " << G4endl;
#endif
G4VSceneHandler::BeginPrimitives (objectTransformation);
transform = objectTransformation;
}
void G4HepRepSceneHandler::EndPrimitives () {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::EndPrimitives" << G4endl;
#endif
G4VSceneHandler::EndPrimitives ();
}
void G4HepRepSceneHandler::SetColour (HepRepAttribute *attribute, const G4Colour& color, const G4String& key) {
#ifdef DEBUG
G4cout << "G4HepRepSceneHandler::SetColour : red : " << color.GetRed () <<
" green : " << color.GetGreen () <<
" blue : " << color.GetBlue () << G4endl;
#endif
attribute->addAttValue(key, color.GetRed(), color.GetGreen(), color.GetBlue(),color.GetAlpha());
}
void G4HepRepSceneHandler::SetLine (HepRepInstance *instance, const G4Visible& visible) {
G4VisAttributes atts = visible.GetVisAttributes();
instance->addAttValue("LineWidth", atts.GetLineWidth());
switch (atts.GetLineStyle()) {
case G4VisAttributes::dotted:
instance->addAttValue("LineStyle", G4String("Dotted"));
break;
case G4VisAttributes::dashed:
instance->addAttValue("LineStyle", G4String("Dashed"));
break;
case G4VisAttributes::unbroken:
default:
instance->addAttValue("LineStyle", G4String("Solid"));
break;
}
}
void G4HepRepSceneHandler::SetMarker (HepRepInstance *instance, const G4VMarker& marker) {
MarkerSizeType markerType;
G4double size = GetMarkerRadius( marker , markerType );
instance->addAttValue("MarkSize", size);
instance->addAttValue("MarkType", (markerType == screen) ? G4String("Symbol") : G4String("Real"));
if (marker.GetFillStyle() == G4VMarker::noFill) {
instance->addAttValue("Fill", false);
} else {
instance->addAttValue("Fill", true);
SetColour(instance, GetColour(marker), G4String("FillColor"));
}
}
HepRepInstance* G4HepRepSceneHandler::CreateInstance(HepRepInstance* p, HepRepType* altType) {
HepRepFactory* factory = GetHepRepFactory();
bool event = IsEventData();
HepRepType* type = (event) ? altType : geometryType;
HepRepInstance* instance = factory->createHepRepInstance(p, type);
if (!event) {
instance->addAttValue("LVol", currentLV->GetName());
instance->addAttValue("Solid", currentLV->GetSolid()->GetName());
instance->addAttValue("EType", currentLV->GetSolid()->GetEntityType());
instance->addAttValue("Material", currentLV->GetMaterial()->GetName());
instance->addAttValue("Density", currentLV->GetMaterial()->GetDensity());
instance->addAttValue("Radlen", currentLV->GetMaterial()->GetRadlen());
switch (currentLV->GetMaterial()->GetState()) {
case kStateSolid:
instance->addAttValue("State", G4String("Solid"));
break;
case kStateLiquid:
instance->addAttValue("State", G4String("Liquid"));
break;
case kStateGas:
instance->addAttValue("State", G4String("Gas"));
break;
case kStateUndefined:
default:
instance->addAttValue("State", G4String("Undefined"));
break;
}
}
return instance;
}
bool G4HepRepSceneHandler::IsEventData () {
return !currentPV || fReadyForTransients;
}
@@ -0,0 +1,131 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
/**
* @author Mark Donszelmann
*/
//HepRep
#include "HEPREP/HepRep.h"
//G4
#include "G4Types.hh"
//#include "G4VInteractorManager.hh"
#include "G4Scene.hh"
#include "G4HepRep.hh"
#include "G4HepRepSceneHandler.hh"
//This
#include "G4HepRepViewer.hh"
using namespace HEPREP;
G4HepRepViewer::G4HepRepViewer (G4VSceneHandler& scene, const G4String& name)
: G4VViewer (scene, scene.IncrementViewCount(), name),
drawn(false) {
#ifdef DEBUG
G4cout << "G4HepRepViewer::G4HepRepViewer" << G4endl;
#endif
// Make changes to view parameters for HepRep...
fVP.SetCulling(false);
fDefaultVP.SetCulling(false);
}
G4HepRepViewer::~G4HepRepViewer () {
}
void G4HepRepViewer::ClearView () {
#ifdef DEBUG
G4cout << "G4HepRepViewer::ClearView" << G4endl;
#endif
}
/***************************************************************************/
// Calculates view representation based on extent of object being
// viewed and (initial) direction of camera. (Note: it can change
// later due to user interaction via visualization system's GUI.)
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
void G4HepRepViewer::SetView () {
#ifdef DEBUG
G4cout << "G4HepRepViewer::SetView" << G4endl;
#endif
}
void G4HepRepViewer::DrawView () {
#ifdef DEBUG
G4cout << "G4HepRepViewer::DrawView" << G4endl;
#endif
NeedKernelVisit();
ProcessView();
drawn = true;
}
void G4HepRepViewer::ShowView () {
#ifdef DEBUG
G4cout << "G4HepRepViewer::ShowView" << G4endl;
#endif
G4VViewer::ShowView();
if (drawn) {
G4HepRepSceneHandler* sceneHandler = (G4HepRepSceneHandler*)GetSceneHandler();
sceneHandler->close();
drawn = false;
}
}
void G4HepRepViewer::FinishView () {
#ifdef DEBUG
G4cout << "G4HepRepViewer::FinishView" << G4endl;
#endif
G4VViewer::FinishView();
}
@@ -20,9 +20,31 @@
// * statement, and all its terms. *
// ********************************************************************
//
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//--------------------------------------------------------------------------
// File and Version Information:
// $Id: HepRepXMLWriter.cc,v 1.8 2002/02/05 19:52:01 perl Exp $
// $Id: HepRepXMLWriter.cc,v 1.9 2002/12/13 11:18:03 gunter Exp $
//
// Description:
// Create a HepRep XML File (HepRep version 1).
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include <fstream>
#include "IndentPrintWriter.h"
using namespace std;
IndentPrintWriter::IndentPrintWriter(ostream* out, int level)
: out(out), indentLevel(level) {
indentString = " ";
indented = false;
}
IndentPrintWriter::~IndentPrintWriter() {
}
void IndentPrintWriter::close() {
out->flush();
ofstream* fout = dynamic_cast<ofstream *>(out);
if (fout != NULL) {
fout->close();
}
}
IndentPrintWriter& IndentPrintWriter::operator<< (const char* s) {
if (!indented) doIndent();
*out << s;
return *this;
}
IndentPrintWriter& IndentPrintWriter::operator<< (ostream& (*pf)(ostream&)) {
*out << endl;
indented = false;
return *this;
}
void IndentPrintWriter::println(string s) {
*this << s.c_str() << endl;
}
void IndentPrintWriter::print(string s) {
*this << s.c_str();
}
void IndentPrintWriter::println() {
*out << endl;
indented = false;
}
void IndentPrintWriter::doIndent() {
for (int i=0; i<indentLevel; i++) {
*out << indentString.c_str();
}
indented = true;
}
void IndentPrintWriter::indent() {
indentLevel++;
}
void IndentPrintWriter::outdent() {
indentLevel--;
}
int IndentPrintWriter::getIndent() {
return indentLevel;
}
void IndentPrintWriter::setIndent(int level) {
indentLevel = level;
}
string IndentPrintWriter::getIndentString() {
return indentString;
}
void IndentPrintWriter::setIndentString(string indent) {
indentString = indent;
}
+16
View File
@@ -0,0 +1,16 @@
Apart from the heprep1 files:
G4HepRepFile.cc
G4HepRepFileSceneHandler.cc
G4HepRepFileViewer.cc
HepRepXMLWriter.cc
the other sources (heprep2) are copies from the FreeHEP library
(java.freehep.org) and are maintained there.
The files starting with G4 are geant4 compliant, the others may not be.
Changes made here may be overwritten.
12 Nov 2002
Mark Donszelmann
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "StreamerHepRep.h"
using namespace std;
using namespace HEPREP;
StreamerHepRep::StreamerHepRep(HepRepWriter* streamer) {
streamer->write(this);
}
StreamerHepRep::~StreamerHepRep() {
}
HepRep* StreamerHepRep::copy(HepRepSelectFilter* filter) {
return NULL;
}
vector<string>* StreamerHepRep::getLayerOrder() {
return &layers;
}
bool StreamerHepRep::addLayer(string layer) {
layers.push_back(layer);
return true;
}
bool StreamerHepRep::addTypeTree(HepRepTypeTree* typeTree) {
return true;
}
void StreamerHepRep::removeTypeTree(HepRepTypeTree* typeTree) {
}
HepRepTypeTree* StreamerHepRep::getTypeTree(string name, string version) {
return NULL;
}
vector<HepRepTypeTree*>* StreamerHepRep::getTypeTrees() {
return NULL;
}
HepRepType* StreamerHepRep::getType(string name) {
return NULL;
}
bool StreamerHepRep::addInstanceTree(HepRepInstanceTree* instanceTree) {
return true;
}
void StreamerHepRep::removeInstanceTree(HepRepInstanceTree* instanceTree) {
}
HepRepInstanceTree* StreamerHepRep::getInstanceTreeTop(string name, string version) {
return NULL;
}
HepRepInstanceTree* StreamerHepRep::getInstances(string name, string version,
vector<string> typeNames) {
return NULL;
}
HepRepInstanceTree* StreamerHepRep::getInstancesAfterAction(
string name,
string version,
vector<string> typeNames,
vector<HepRepAction*> actions,
bool getPoints,
bool getDrawAtts,
bool getNonDrawAtts,
vector<string> invertAtts) {
return NULL;
}
string StreamerHepRep::checkForException() {
return NULL;
}
vector<HepRepInstanceTree*>* StreamerHepRep::getInstanceTrees() {
return NULL;
}
@@ -0,0 +1,90 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include <iostream>
#include "StreamerHepRepAttribute.h"
#include "DefaultHepRepAttValue.h"
using namespace std;
using namespace HEPREP;
StreamerHepRepAttribute::StreamerHepRepAttribute(HepRepWriter* stream) {
this->streamer = stream;
}
StreamerHepRepAttribute::~StreamerHepRepAttribute() {
}
vector<HepRepAttValue*>* StreamerHepRepAttribute::getAttValuesFromNode() {
return NULL;
}
bool StreamerHepRepAttribute::addAttValue(HepRepAttValue* hepRepAttValue) {
streamer->write(hepRepAttValue);
delete hepRepAttValue;
return true;
}
bool StreamerHepRepAttribute::addAttValue(string key, string value, int showLabel) {
return addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
}
bool StreamerHepRepAttribute::addAttValue(string key, int value, int showLabel) {
return addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
}
bool StreamerHepRepAttribute::addAttValue(string key, double value, int showLabel) {
return addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
}
bool StreamerHepRepAttribute::addAttValue(string key, bool value, int showLabel) {
return addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
}
bool StreamerHepRepAttribute::addAttValue(string key, vector<double> value, int showLabel) {
return addAttValue(new DefaultHepRepAttValue(key, value, showLabel));
}
bool StreamerHepRepAttribute::addAttValue(string key, double red, double green, double blue, double alpha, int showLabel) {
vector<double> color;
color.push_back(red);
color.push_back(green);
color.push_back(blue);
color.push_back(alpha);
return addAttValue(new DefaultHepRepAttValue(key, color, showLabel));
}
HepRepAttValue* StreamerHepRepAttribute::getAttValueFromNode(string lowerCaseName) {
return NULL;
}
HepRepAttValue* StreamerHepRepAttribute::removeAttValue(string key) {
return NULL;
}
HepRepAttValue* StreamerHepRepAttribute::getAttValue(string name) {
return NULL;
}
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "StreamerHepRepDefinition.h"
#include "DefaultHepRepAttDef.h"
using namespace std;
using namespace HEPREP;
StreamerHepRepDefinition::StreamerHepRepDefinition(HepRepWriter* streamer)
: StreamerHepRepAttribute(streamer), streamer(streamer) {
}
StreamerHepRepDefinition::~StreamerHepRepDefinition() {
}
vector<HepRepAttDef *>* StreamerHepRepDefinition::getAttDefsFromNode() {
return NULL;
}
bool StreamerHepRepDefinition::addAttDef(HepRepAttDef* hepRepAttDef) {
streamer->write(hepRepAttDef);
delete hepRepAttDef;
return true;
}
bool StreamerHepRepDefinition::addAttDef(string name, string desc, string type, string extra) {
addAttDef(new DefaultHepRepAttDef(name, desc, type, extra));
return true;
}
HepRepAttDef* StreamerHepRepDefinition::getAttDefFromNode(string lowerCaseName) {
return NULL;
}
HepRepAttDef* StreamerHepRepDefinition::getAttDef(string name) {
return NULL;
}
@@ -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. *
// ********************************************************************
//
#include <iostream>
#include "StreamerHepRepInstance.h"
using namespace std;
using namespace HEPREP;
StreamerHepRepInstance::StreamerHepRepInstance(HepRepWriter* stream, HepRepInstance* instance, HepRepType* heprepType)
: StreamerHepRepAttribute(stream), parent(instance), type(heprepType) {
if (type == NULL) cerr << "HepRepInstance cannot be created without a HepRepType." << endl;
stream->write(this);
}
StreamerHepRepInstance::StreamerHepRepInstance(HepRepWriter* stream, HepRepInstanceTree* instanceTree, HepRepType* heprepType)
: StreamerHepRepAttribute(stream), parent(instanceTree), type(heprepType) {
if (type == NULL) cerr << "HepRepInstance cannot be created without a HepRepType." << endl;
stream->write(this);
}
StreamerHepRepInstance::~StreamerHepRepInstance() {
}
HepRepInstance* StreamerHepRepInstance::copy(HepRep* heprep, HepRepInstance* instance, HepRepSelectFilter* filter) {
return NULL;
}
HepRepInstance* StreamerHepRepInstance::copy(HepRep* heprep, HepRepInstanceTree* instanceTree, HepRepSelectFilter* filter) {
return NULL;
}
HepRepType* StreamerHepRepInstance::getType() {
return type;
}
bool StreamerHepRepInstance::addPoint(HepRepPoint* point) {
return true;
}
vector<HepRepPoint*>* StreamerHepRepInstance::getPoints() {
return NULL;
}
bool StreamerHepRepInstance::addInstance(HepRepInstance* instance) {
return true;
}
void StreamerHepRepInstance::removeInstance(HepRepInstance* instance) {
}
vector<HepRepInstance*>* StreamerHepRepInstance::getInstances() {
return NULL;
}
HepRepAttValue* StreamerHepRepInstance::getAttValue(string name) {
return NULL;
}
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "StreamerHepRepInstanceTree.h"
using namespace std;
using namespace HEPREP;
StreamerHepRepInstanceTree::StreamerHepRepInstanceTree(HepRepWriter* stream, string name, string version, HepRepTreeID* typeTree)
: DefaultHepRepTreeID(name, version), streamer(stream), typeTree(typeTree) {
stream->write(this);
}
StreamerHepRepInstanceTree::~StreamerHepRepInstanceTree() {
}
HepRepTreeID* StreamerHepRepInstanceTree::copy() {
return DefaultHepRepTreeID::copy();
}
HepRepInstanceTree* StreamerHepRepInstanceTree::copy(HepRep* heprep, HepRepSelectFilter* filter) {
return NULL;
}
bool StreamerHepRepInstanceTree::addInstance(HepRepInstance* instance) {
return true;
}
void StreamerHepRepInstanceTree::removeInstance(HepRepInstance* instance) {
}
vector<HepRepInstance*>* StreamerHepRepInstanceTree::getInstances() {
return NULL;
}
bool StreamerHepRepInstanceTree::addInstanceTree(HepRepTreeID* treeID) {
streamer->write(treeID);
return true;
}
HepRepTreeID* StreamerHepRepInstanceTree::getTypeTree() {
return typeTree;
}
vector<HepRepInstanceTree*>* StreamerHepRepInstanceTree::getInstanceTrees() {
return NULL;
}
@@ -0,0 +1,137 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include <string>
#include <iostream>
#include <cmath>
#include "StreamerHepRepPoint.h"
using namespace std;
using namespace HEPREP;
StreamerHepRepPoint::StreamerHepRepPoint(HepRepWriter* stream, HepRepInstance* inst, double x, double y, double z)
: StreamerHepRepAttribute(stream), instance(inst), x(x), y(y), z(z) {
if (instance == NULL) {
cerr << "HepRepPoints cannot be created without a HepRepInstance." << endl;
}
stream->write(this);
}
StreamerHepRepPoint::~StreamerHepRepPoint() {
}
HepRepInstance* StreamerHepRepPoint::getInstance() {
return instance;
}
HepRepAttValue* StreamerHepRepPoint::getAttValue(string lowerCaseName) {
HepRepAttValue* value = getAttValueFromNode(lowerCaseName);
return (value != NULL) ? value : instance->getAttValue(lowerCaseName);
}
HepRepPoint* StreamerHepRepPoint::copy(HepRepInstance* parent) {
return NULL;
}
double StreamerHepRepPoint::getX() {
return x;
}
double StreamerHepRepPoint::getY() {
return y;
}
double StreamerHepRepPoint::getZ() {
return z;
}
vector<double>* StreamerHepRepPoint::getXYZ(vector<double>* xyz) {
(*xyz)[0] = x;
(*xyz)[1] = y;
(*xyz)[2] = z;
return xyz;
}
double StreamerHepRepPoint::getRho() {
return sqrt(x*x + y*y);
}
double StreamerHepRepPoint::getPhi() {
return atan2(y, x);
}
double StreamerHepRepPoint::getTheta() {
return atan2(getRho(), z);
}
double StreamerHepRepPoint::getR() {
double r = getRho();
return sqrt(r*r + z*z);
}
double StreamerHepRepPoint::getEta() {
double ct = cos(getTheta());
return -0.5*log((1.-ct)/(1.+ct));
}
double StreamerHepRepPoint::getX(double xVertex, double yVertex, double zVertex) {
return x - xVertex;
}
double StreamerHepRepPoint::getY(double xVertex, double yVertex, double zVertex) {
return y - yVertex;
}
double StreamerHepRepPoint::getZ(double xVertex, double yVertex, double zVertex) {
return z - zVertex;
}
double StreamerHepRepPoint::getRho(double xVertex, double yVertex, double zVertex) {
double dx = getX(xVertex, yVertex, zVertex);
double dy = getY(xVertex, yVertex, zVertex);
return sqrt(dx*dx + dy*dy);
}
double StreamerHepRepPoint::getPhi(double xVertex, double yVertex, double zVertex) {
return atan2(getY(xVertex, yVertex, zVertex), getX(xVertex, yVertex, zVertex));
}
double StreamerHepRepPoint::getTheta(double xVertex, double yVertex, double zVertex) {
return atan2(getRho(xVertex, yVertex, zVertex), getZ(xVertex, yVertex, zVertex));
}
double StreamerHepRepPoint::getR(double xVertex, double yVertex, double zVertex) {
double dr = getRho(xVertex, yVertex, zVertex);
double dz = getZ(xVertex, yVertex, zVertex);
return sqrt(dr*dr + dz*dz);
}
double StreamerHepRepPoint::getEta(double xVertex, double yVertex, double zVertex) {
double ct = cos(getTheta(xVertex, yVertex, zVertex));
return -0.5*log((1.-ct)/(1.+ct));
}
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "StreamerHepRepType.h"
using namespace std;
using namespace HEPREP;
StreamerHepRepType::StreamerHepRepType(HepRepWriter* stream, HepRepType* parent, string name)
: StreamerHepRepDefinition(stream), parent(parent), name(name) {
this->description = "No Description";
this->infoURL = "No Info URL";
stream->write(this);
}
StreamerHepRepType::~StreamerHepRepType() {
}
HepRepType* StreamerHepRepType::getSuperType() {
return parent;
}
HepRepAttDef* StreamerHepRepType::getAttDef(string key) {
return NULL;
}
/**
* searched for a value with given name. Search up the type tree if needed.
*/
HepRepAttValue* StreamerHepRepType::getAttValue(string key) {
return NULL;
}
HepRepType* StreamerHepRepType::copy(HepRep* heprep, HepRepType* type) {
return NULL;
}
string StreamerHepRepType::getName() {
return name;
}
string StreamerHepRepType::getDescription() {
return description;
}
void StreamerHepRepType::setDescription(string desc) {
this->description = desc;
}
string StreamerHepRepType::getInfoURL() {
return infoURL;
}
void StreamerHepRepType::setInfoURL(string info) {
this->infoURL = info;
}
bool StreamerHepRepType::addType(HepRepType* type) {
return true;
}
vector<HepRepType*>* StreamerHepRepType::getTypes() {
return NULL;
}
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include <iostream>
#include "StreamerHepRepTypeTree.h"
using namespace std;
using namespace HEPREP;
StreamerHepRepTypeTree::StreamerHepRepTypeTree(HepRepWriter* streamer, HepRepTreeID* typeTree)
: DefaultHepRepTreeID(typeTree->getName(), typeTree->getVersion()) {
streamer->write(this);
}
StreamerHepRepTypeTree::~StreamerHepRepTypeTree() {
}
HepRepTreeID* StreamerHepRepTypeTree::copy() {
return DefaultHepRepTreeID::copy();
}
HepRepTypeTree* StreamerHepRepTypeTree::copy(HepRep* heprep) {
return NULL;
}
bool StreamerHepRepTypeTree::addType(HepRepType* type) {
return true;
}
vector<HepRepType*>* StreamerHepRepTypeTree::getTypes() {
return NULL;
}
@@ -0,0 +1,225 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "XMLHepRepStreamer.h"
#include "StreamerHepRepInstance.h"
#include "DefaultHepRepAttValue.h"
#define NAMESPACE "heprep"
using namespace std;
using namespace HEPREP;
XMLHepRepStreamer::XMLHepRepStreamer(ostream* out)
: XMLWriter(out, " ", NAMESPACE) {
this->nameSpace = NAMESPACE;
openDoc();
}
XMLHepRepStreamer::~XMLHepRepStreamer() {
}
bool XMLHepRepStreamer::close() {
while (!hepreps.empty()) {
hepreps.pop();
closeTag();
}
closeDoc();
XMLWriter::close();
return true;
}
bool XMLHepRepStreamer::write(HepRep* root) {
setAttribute("xmlns", "http://www.freehep.org/HepRep");
setAttribute("xmlns", "xsi", "http://www.w3.org/2001/XMLSchema-instance");
setAttribute("xsi", "schemaLocation", "HepRep.xsd");
openTag(nameSpace, "heprep");
writtenLayers = false;
hepreps.push(root);
this->heprep = root;
return true;
}
bool XMLHepRepStreamer::write(HepRepTypeTree* typeTree) {
while (hepreps.top() != heprep) {
if (hepreps.empty()) {
cerr << "XMLHepRepStreamer: cannot write typeTree without HepRep" << endl;
return false;
}
hepreps.pop();
closeTag();
}
if (!writtenLayers) {
writtenLayers = true;
string layerOrder = "";
bool comma = false;
vector<string> *layers = heprep->getLayerOrder();
for (vector<string>::iterator i=layers->begin(); i != layers->end(); i++) {
if (comma) {
layerOrder.append(", ");
}
layerOrder.append(*i);
comma = true;
}
setAttribute("order", layerOrder);
printTag(nameSpace, "layer");
}
setAttribute("name", typeTree->getName());
setAttribute("version", typeTree->getVersion());
openTag(nameSpace, "typetree");
hepreps.push(typeTree);
heprepTypeTree = typeTree;
return true;
}
bool XMLHepRepStreamer::write(HepRepType* type) {
HepRepType* parent = type->getSuperType();
if (parent != NULL) {
while (hepreps.top() != parent) {
if (hepreps.empty()) {
cerr << "XMLHepRepStreamer: cannot write type, parent not anymore on stack..." << endl;
return false;
}
hepreps.pop();
closeTag();
}
} else {
while (hepreps.top() != heprepTypeTree) {
if (hepreps.empty()) {
cerr << "XMLHepRepStreamer: cannot write type without parent typeTree." << endl;
return false;
}
hepreps.pop();
closeTag();
}
}
setAttribute("name", type->getName());
openTag(nameSpace, "type");
hepreps.push(type);
return true;
}
bool XMLHepRepStreamer::write(HepRepTreeID* treeID) {
setAttribute("qualifier", treeID->getQualifier());
setAttribute("name", treeID->getName());
setAttribute("version", treeID->getVersion());
printTag(nameSpace, "treeid");
return true;
}
bool XMLHepRepStreamer::write(HepRepAction* action) {
setAttribute("name", action->getName());
setAttribute("expression", action->getExpression());
printTag(nameSpace, "action");
return true;
}
bool XMLHepRepStreamer::write(HepRepInstanceTree* instanceTree) {
while (hepreps.top() != heprep) {
if (hepreps.empty()) {
cerr << "XMLHepRepStreamer cannot write instanceTree without HepRep." << endl;
return false;
}
hepreps.pop();
closeTag();
}
setAttribute("name", instanceTree->getName());
setAttribute("version", instanceTree->getVersion());
setAttribute("typetreename", instanceTree->getTypeTree()->getName());
setAttribute("typetreeversion", instanceTree->getTypeTree()->getVersion());
openTag(nameSpace, "instancetree");
hepreps.push(instanceTree);
return true;
}
bool XMLHepRepStreamer::write(HepRepInstance* instance) {
void* parent = dynamic_cast<StreamerHepRepInstance*>(instance)->getParent();
while (hepreps.top() != parent) {
if (hepreps.empty()) {
cerr << "XMLHepRepStreamer: cannot write instance, parent (instance/instanceTree) not anymore on Stack..." << endl;
return false;
}
hepreps.pop();
closeTag();
}
setAttribute("type", instance->getType()->getName());
openTag(nameSpace, "instance");
hepreps.push(instance);
return true;
}
bool XMLHepRepStreamer::write(HepRepPoint* point) {
while (hepreps.top() != point->getInstance()) {
if (hepreps.empty()) {
cerr << "XMLHepRepStreamer: cannot write point, parent instance not anymore on Stack..." << endl;
return false;
}
hepreps.pop();
closeTag();
}
setAttribute("x", point->getX());
setAttribute("y", point->getY());
setAttribute("z", point->getZ());
openTag(nameSpace, "point");
hepreps.push(point);
return true;
}
bool XMLHepRepStreamer::write(HepRepAttribute* attribute) {
return true;
}
bool XMLHepRepStreamer::write(HepRepDefinition* definition) {
return true;
}
bool XMLHepRepStreamer::write(HepRepAttValue* attValue) {
string name = attValue->getName();
setAttribute("name", name);
setAttribute("value", attValue->getAsString());
setAttribute("type", attValue->getTypeName());
string label = dynamic_cast<DefaultHepRepAttValue*>(attValue)->toShowLabel();
setAttribute("showLabel", label);
printTag(nameSpace, "attvalue");
return true;
}
bool XMLHepRepStreamer::write(HepRepAttDef* attDef) {
setAttribute("name", attDef->getName());
setAttribute("desc", attDef->getDescription());
setAttribute("category", attDef->getCategory());
setAttribute("extra", attDef->getExtra());
printTag(nameSpace, "attdef");
return true;
}
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include <iostream>
#include <fstream>
#include "XMLHepRepStreamerFactory.h"
#include "XMLHepRepStreamer.h"
#include "StreamerHepRepPoint.h"
#include "StreamerHepRepInstance.h"
#include "StreamerHepRepInstanceTree.h"
#include "StreamerHepRepType.h"
#include "StreamerHepRepTypeTree.h"
#include "StreamerHepRep.h"
#include "DefaultHepRepAction.h"
#include "DefaultHepRepTreeID.h"
using namespace std;
using namespace HEPREP;
XMLHepRepStreamerFactory::XMLHepRepStreamerFactory() {
}
XMLHepRepStreamerFactory::~XMLHepRepStreamerFactory() {
}
HepRepWriter* XMLHepRepStreamerFactory::createHepRepWriter(ostream* out) {
this->streamer = new XMLHepRepStreamer(out);
return streamer;
}
HepRepPoint* XMLHepRepStreamerFactory::createHepRepPoint (HepRepInstance* instance,
double x, double y, double z) {
return new StreamerHepRepPoint(streamer, instance, x, y, z);
}
HepRepInstance* XMLHepRepStreamerFactory::createHepRepInstance (HepRepInstance* parent, HepRepType* type) {
return new StreamerHepRepInstance(streamer, parent, type);
}
HepRepInstance* XMLHepRepStreamerFactory::createHepRepInstance (HepRepInstanceTree* parent, HepRepType* type) {
return new StreamerHepRepInstance(streamer, parent, type);
}
HepRepTreeID* XMLHepRepStreamerFactory::createHepRepTreeID (string name, string version, string qualifier) {
return new DefaultHepRepTreeID(name, version, qualifier);
}
HepRepAction* XMLHepRepStreamerFactory::createHepRepAction (string name, string expression) {
return new DefaultHepRepAction(name, expression);
}
HepRepInstanceTree* XMLHepRepStreamerFactory::createHepRepInstanceTree (string name, string version,
HepRepTreeID* typeTreeID) {
return new StreamerHepRepInstanceTree(streamer, name, version, typeTreeID);
}
HepRepType* XMLHepRepStreamerFactory::createHepRepType (HepRepType* parent, string name) {
return new StreamerHepRepType(streamer, parent, name);
}
HepRepTypeTree* XMLHepRepStreamerFactory::createHepRepTypeTree (HepRepTreeID* treeID) {
return new StreamerHepRepTypeTree(streamer, treeID);
}
HepRep* XMLHepRepStreamerFactory::createHepRep () {
return new StreamerHepRep(streamer);
}
@@ -0,0 +1,285 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include <cstdio>
#include "XMLWriter.h"
using namespace std;
XMLWriter::XMLWriter(ostream* out, string indentString, string defaultNameSpace)
: defaultNameSpace(defaultNameSpace) {
writer = new IndentPrintWriter(out);
writer->setIndentString(" ");
closed = true;
dtdName = NULL;
}
XMLWriter::~XMLWriter() {
writer->close();
delete writer;
}
void XMLWriter::close() {
closeDoc();
writer->close();
}
void XMLWriter::openDoc(string version, string encoding, bool standalone) {
string indentString = writer->getIndentString();
writer->setIndentString(indentString);
closed = false;
// if (!XMLCharacterProperties.validVersionNum(version)) throw new RuntimeException("Invalid version number: "+version);
*writer << "<?xml version=\"" << version.c_str() << "\" ";
if (encoding.compare("") != 0) {
// if (!XMLCharacterProperties.validEncName(encoding)) throw new RuntimeException("Invalid encoding name: "+encoding);
*writer << "encoding=\"" << encoding.c_str() << "\" ";
}
if (standalone) {
*writer << "standalone=\"yes\" ";
}
*writer << "?>";
*writer << endl;
writer->setIndentString(indentString);
}
void XMLWriter::referToDTD(string name, string pid, string ref) {
if (dtdName != NULL) {
cerr << "XMLWriter::ReferToDTD cannot be called twice" << endl;
}
dtdName = &name;
*writer << "<!DOCTYPE " << name.c_str() << " PUBLIC \"" << pid.c_str() << "\" \"" << ref.c_str() << "\">" << endl;
}
void XMLWriter::referToDTD(string name, string system) {
if (dtdName != NULL) {
cerr << "XMLWriter::ReferToDTD cannot be called twice";
}
dtdName = &name;
*writer << "<!DOCTYPE " << name.c_str() << " SYSTEM \"" << system.c_str() << "\">" << endl;
}
void XMLWriter::closeDoc() {
if (!closed) {
if (!openTags.empty()) {
cerr << "Not all tags were closed before closing XML document:" << endl;
while (!openTags.empty()) {
cerr << " </" << openTags.top().c_str() << ">" << endl;
openTags.pop();
}
}
closed = true;
}
}
void XMLWriter::printComment(string comment) {
if (comment.find("--") >= 0) {
cerr << "XMLWriter::printComment '--' sequence not allowed in comment" << endl;
}
*writer << "<!--" << normalizeText(comment).c_str() << "-->" << endl;
}
void XMLWriter::print(string text) {
*writer << normalizeText(text).c_str();
}
void XMLWriter::println(string text) {
print(text);
*writer << endl;
}
void XMLWriter::openTag(string ns, string name) {
if (ns.compare(defaultNameSpace) == 0) {
openTag(name);
} else {
openTag(ns.append(":").append(name));
}
}
void XMLWriter::openTag(string name) {
checkNameValid(name);
if (openTags.empty() && dtdName != NULL && dtdName->compare(name)) {
cerr << "XMLWriter::openTag(), First tag: '" << name.c_str() << "' not equal to DTD id: '" << dtdName->c_str() << "'" << endl;
}
*writer << "<" << name.c_str();
printAttributes(name.length());
*writer << ">" << endl;
writer->indent();
openTags.push(name);
}
void XMLWriter::closeTag() {
if (openTags.empty()) {
writer->close();
cerr << "XMLWriter::closeTag(), No open tags" << endl;
}
string name = openTags.top();
openTags.pop();
writer->outdent();
*writer << "</" << name.c_str() << ">" << endl;
}
void XMLWriter::printTag(string ns, string name) {
if (ns.compare(defaultNameSpace) == 0) {
printTag(name);
} else {
printTag(ns.append(":").append(name));
}
}
void XMLWriter::printTag(string name) {
checkNameValid(name);
*writer << "<" << name.c_str();
printAttributes(name.length());
*writer << "/>" << endl;
}
void XMLWriter::setAttribute(string name, string value) {
attributes[name] = value;
}
void XMLWriter::setAttribute(string ns, string name, string value) {
attributes[ns.append(":").append(name)] = value;
}
void XMLWriter::setAttribute(string name, double value) {
char buffer[40];
sprintf(buffer, "%f", value);
attributes[name] = buffer;
}
void XMLWriter::setAttribute(string ns, string name, double value) {
char buffer[40];
sprintf(buffer, "%f", value);
attributes[ns.append(":").append(name)] = buffer;
}
void XMLWriter::printAttributes(int tagLength) {
int width = tagLength + 1;
bool extraIndent = false;
for (map<string,string>::iterator i = attributes.begin(); i != attributes.end(); i++) {
string key = i->first;
checkNameValid(key);
string value = normalize(i->second);
int length = key.length() + value.length() + 3;
if (width > 0 && width + length + 2*writer->getIndent() > 60) {
width = 0;
*writer << endl;
if (!extraIndent) {
writer->indent();
extraIndent = true;
}
} else {
width += length;
*writer << " ";
}
*writer << key.c_str() << "=\"" << value.c_str() << "\"";
}
attributes.clear();
if (extraIndent) writer->outdent();
}
string XMLWriter::normalize(string s) {
string str = "";
char buffer[20];
int len = s.length();
for (int i = 0; i < len; i++) {
char ch = s[i];
switch (ch) {
case '<': {
str.append("&lt;");
break;
}
case '>': {
str.append("&gt;");
break;
}
case '&': {
str.append("&amp;");
break;
}
case '"': {
str.append("&quot;");
break;
}
case '\r':
case '\n': {
sprintf(buffer, "&#%ud", ch);
str.append(buffer);
str.append(";");
break;
}
default: {
// if (ch > 0x00FF) {
// sprintf(buffer, "&#x%4.4x", ch);
// str.append(buffer);
// str.append(";");
// } else {
str.append(&ch, 1);
// }
}
}
}
return str;
}
string XMLWriter::normalizeText(string s) {
string str = "";
int len = s.length();
for (int i = 0; i < len; i++) {
char ch = s[i];
switch (ch) {
case '<': {
str.append("&lt;");
break;
}
case '>': {
str.append("&gt;");
break;
}
case '&': {
str.append("&amp;");
break;
}
default: {
// if (ch > 0x00FF) {
// sprintf(buffer, "&#x%4.4x", ch);
// str.append(buffer);
// str.append(";");
// } else {
str.append(&ch, 1);
// }
}
}
}
return str;
}
void XMLWriter::checkNameValid(string s) {
// Could be added.
// if (!XMLCharacterProperties.validName(s)) throw new RuntimeException("Invalid name: "+s);
}
+93 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.193 2002/06/24 07:34:15 gcosmo Exp $
$Id: History,v 1.212 2002/12/11 16:11:44 johna Exp $
-------------------------------------------------------------------
=========================================================
@@ -24,6 +24,98 @@ committal in the CVS repository !
History file for visualization category
---------------------------------------
11th December 2002 John Allison (vis-V04-01-10)
- Fix for SUN-CC warnings: AddThis hides the virtual function...
- Fix memory leak in RayTracer.
- Fixed /vis/scene/add/trajectories command.
- Some fixes in HepRep.
4th December 2002 Makoto Asai (vis-V04-01-09)
- Migration to new G4ApplicationState
27th November 2002 John Allison (vis-V04-01-08)
- Fixes to HepRep - see History file.
- Added RegisterGraphicsSystem (new G4HepRep) in MyVisManager.cc.
- Fix (removal) of ambiguous G4VVisCommand::GetNewDoubleValue.
- Added /vis/viewer/set/globalMarkerScale.
- Improved algorithm of CompareForKernelVisit on OpenGL and OpenInventor.
21st November 2002 Gabriele Cosmo (vis-V04-01-07)
- Corrections to HepRep module to allow porting on egcs compiler
(M.Donszelmann).
- Patched access to static data in G4VisCommandsSceneAdd.cc, G4VisManager.cc
and G4FlavoredParallelWorldModel.cc to allow porting on Windows DLLs.
It requires co-working with tags "greps-V04-01-04" and "intercoms-V04-01-02".
15th November 2002 Mark Donszelmann (vis-V04-01-06)
- HepRep2 driver implemented.
11th November 2002 John Allison (vis-V04-01-05)
- Corrected inclusion of G4OpenGLXViewer #ifdef X_DRIVER for Windows
and other small changes in OpenGL (opengl-V04-01-02).
- Added integer argument to /vis/scene/add/trajectories [drawing-mode].
drawing-mode is passed to DrawTrajectory. See also modeling-V04-00-00.
- Fixed bug in G4VisManager wich lead to zero G4VModel pointer.
- Improved hamdling of models.
- Corrected G4RayTracer.cc devide-by-zero (raytracer-V04-00-01).
- VRML: bug fixing for marker size (*.icc files) (VRML-V04-01-00).
- Samll improvements to README.built_in_commands.
- Improved sample driver XXX.
1st November 2002 John Allison (vis-V04-01-04 with...)
geant4/source/tracking tracking-V04-01-03
geant4/source/intercoms intercoms-V04-01-00
geant4/source/graphics_reps greps-V04-01-01
geant4/source/digits+hits digits+hits-V04-01-01
Oct 28, 2002, J.Allison (vis-traj03, co-works with...
geant4/source/tracking traj03 (head as of Tue Oct 29 15:42:14 UTC 2002)
geant4/source/intercoms intercoms-V04-01-00 (ditto)
geant4/source/graphics_reps greps-V04-01-01 (ditto)
geant4/source/digits+hits hits-traj03 (*not* the head)
- Changed G4XXXSceneHandler.cc for map of G4AttDefs, and improved.
17th October 2002 John Allison (vis-V04-01-03 with...)
- Coworking tags are:
geant4/source/tracking traj02
geant4/source/intercoms intercoms-V04-00-04
geant4/source/graphics_reps greps-V04-01-00
geant4/source/digits+hits hits-traj02
- More changes for AddThis(const G4VTrajectory&) and (const G4VHit&).
- Minor corrections to warning messages, etc.
- Improved end of run behaviour for non-post-processing graphics
systems by changing false to true in G4VisManager::EndOfRun
fpSceneHandler->SetMarkForClearingTransientStore(true);
- Further corrections/improvements in OpenGLWin32 - not yet complete.
17th October 2002 John Allison (vis-V04-01-02 with intercoms-V04-01-00)
- Added two new pure virtual functions to G4VGraphicsScene:
AddThis(const G4VTrajectory&)
AddThis(const G4VHit&)
16th October 2002 John Allison (vis-traj01 co-works with tracking tag traj01)
- Tag for changes in G4VTrajectory, etc. (raytracer-V04-00-00).
16th October 2002 John Allison (vis-V04-01-01)
- Fix for WIN32. Now compiles but viewer not implemented. (opengl-V04-01-01)
- Small improvement to README.built_in_commands.
1st Sept 2002 Satoshi Tanaka (vis-V04-01-00)
- Precision control of g4_XX.prim files generated by
the DAWNFILE/DAWN-Network drivers.
Example:
setenv G4DAWNFILE_PRECISION 9
The precision number is used as:
sprintf( string, "%*.*g", (precision+8), precision, value)
The default precision is also changed from 6 to 9.
24th June 2002 John Allison
- Further cosmetic changes in G4OpenGL for DEC compiler (opengl-V04-01-00).
24th June 2002 Gabriele Cosmo (vis-V04-00-10)
- Exclude latest changes to OpenGL driver (opengl-V04-00-03), causing compilation
errors on some platforms (DEC-cxx).
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GoSceneHandler.hh,v 1.8 2001/08/24 21:49:59 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4GoSceneHandler.hh,v 1.9 2002/12/11 15:58:00 johna Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Guy Barrand 04 November 1996
@@ -72,6 +72,8 @@ public:
void AddThis (const G4Polycone&);
void AddThis (const G4Polyhedra&);
void AddThis (const G4VSolid&);
void AddThis (const G4VTrajectory&);
void AddThis (const G4VHit&);
void BeginPrimitives (const G4Transform3D& objectTransformation);
void EndPrimitives ();
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Wo.hh,v 1.6 2001/07/11 10:08:47 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Guy Barrand 04 November 1996
@@ -22,7 +22,7 @@
//
//
// $Id: G4WoViewer.hh,v 1.5 2001/07/11 10:08:47 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Guy Barrand 04 November 1996
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Xo.hh,v 1.6 2001/07/11 10:08:47 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Guy Barrand 04 November 1996
@@ -22,7 +22,7 @@
//
//
// $Id: G4XoViewer.hh,v 1.5 2001/07/11 10:08:47 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Guy Barrand 04 November 1996
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GoSceneHandler.cc,v 1.13 2001/11/12 18:22:09 johna Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4GoSceneHandler.cc,v 1.14 2002/12/11 15:58:01 johna Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Guy Barrand 04 November 1996
@@ -444,6 +444,30 @@ void G4GoSceneHandler::AddThis (
G4VSceneHandler::AddThis (solid);
}
/***************************************************************************/
void G4GoSceneHandler::AddThis (
const G4VTrajectory& traj
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
#ifdef DEBUG
G4cout << "G4GoSceneHandler::AddThis(G4VTrajectory&) " << G4endl;
#endif
G4VSceneHandler::AddThis (traj);
}
/***************************************************************************/
void G4GoSceneHandler::AddThis (
const G4VHit& hit
)
/***************************************************************************/
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
#ifdef DEBUG
G4cout << "G4GoSceneHandler::AddThis(G4VHit&) " << G4endl;
#endif
G4VSceneHandler::AddThis (hit);
}
/***************************************************************************/
void G4GoSceneHandler::PreAddThis (
const G4Transform3D& objectTransformation,
const G4VisAttributes& visAttribs
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Wo.cc,v 1.5 2001/07/11 10:08:47 gunter Exp $
// GEANT4 tag $Name: geant4-04-01 $
// GEANT4 tag $Name: geant4-05-00 $
//
//
// Guy Barrand 04 November 1996

Some files were not shown because too many files have changed in this diff Show More