Import Geant4 3.0.0 source tree
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# $Id: GNUmakefile,v 1.2 2000/09/14 12:42:32 barrand Exp $
|
||||
|
||||
name := G4jas
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
include $(G4INSTALL)/config/analysis.gmk
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include
|
||||
|
||||
ifdef G4ANALYSIS_BUILD_JAS
|
||||
# CPPFLAGS +=
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
@@ -0,0 +1,42 @@
|
||||
// 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: G4JasSystem.hh,v 1.8 2000/11/16 13:44:43 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 14 September 2000
|
||||
|
||||
#ifndef G4JASSYSTEM_H
|
||||
#define G4JASSYSTEM_H
|
||||
|
||||
#if defined(G4ANALYSIS_BUILD_JAS) || defined(G4ANALYSIS_USE_JAS)
|
||||
|
||||
#include "G4VAnalysisSystem.hh"
|
||||
|
||||
class IHistogramManager;
|
||||
class JasHistogramFactory;
|
||||
|
||||
class G4JasSystem : public G4VAnalysisSystem {
|
||||
public: // I methods :
|
||||
virtual const G4String& GetName() const;
|
||||
virtual IHistogramFactory* GetHistogramFactory();
|
||||
//
|
||||
virtual void Store(IHistogram* = 0,const G4String& = "");
|
||||
virtual void Plot(IHistogram*);
|
||||
public:
|
||||
G4JasSystem(const G4String& name = "jas");
|
||||
virtual ~G4JasSystem();
|
||||
private:
|
||||
G4String fName;
|
||||
JasHistogramFactory* fHistogramFactory;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef JASAXIS_H
|
||||
#define JASAXIS_H
|
||||
|
||||
#if defined(G4ANALYSIS_BUILD_JAS)
|
||||
|
||||
#include <IAxis.h>
|
||||
|
||||
class JasAxis : public IAxis {
|
||||
public:
|
||||
virtual ~JasAxis() {}
|
||||
public:
|
||||
virtual double lowerEdge() const;
|
||||
virtual double upperEdge() const;
|
||||
virtual int bins() const;
|
||||
virtual double binLowerEdge(int) const;
|
||||
virtual double binUpperEdge(int) const;
|
||||
virtual double binWidth(int) const;
|
||||
virtual double binCentre(int) const;
|
||||
virtual int coordToIndex(double) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
#ifndef JASHISTOGRAM1D_H
|
||||
#define JASHISTOGRAM1D_H
|
||||
|
||||
#if defined(G4ANALYSIS_BUILD_JAS)
|
||||
|
||||
#include <IHistogram1D.h>
|
||||
|
||||
#include "JasAxis.h"
|
||||
|
||||
class JasHistogramFactory;
|
||||
|
||||
class JasHistogram1D : public IHistogram1D {
|
||||
public: // IHistogram IMethods :
|
||||
virtual std_string title() const;
|
||||
virtual int dimensions() const;
|
||||
virtual int entries() const;
|
||||
virtual int allEntries() const;
|
||||
virtual int extraEntries() const;
|
||||
virtual double equivalentBinEntries() const;
|
||||
virtual double sumBinHeights() const;
|
||||
virtual double sumAllBinHeights() const;
|
||||
virtual double sumExtraBinHeights() const;
|
||||
virtual double minBinHeight() const;
|
||||
virtual double maxBinHeight() const;
|
||||
virtual void reset();
|
||||
virtual IAnnotation* annotation();
|
||||
public: // IHistogram1D IMethods :
|
||||
// The fill :
|
||||
virtual void fill(double,double = 1.0);
|
||||
|
||||
// Partition :
|
||||
virtual int minBin() const;
|
||||
virtual int maxBin() const;
|
||||
virtual int coordToIndex(double) const;
|
||||
|
||||
virtual double mean() const;
|
||||
virtual double rms() const;
|
||||
|
||||
// Bins :
|
||||
virtual int binEntries(int) const;
|
||||
virtual double binHeight(int) const;
|
||||
virtual double binError(int) const;
|
||||
|
||||
// Axis :
|
||||
virtual const IAxis& xAxis() const;
|
||||
public:
|
||||
JasHistogram1D(JasHistogramFactory *factory, const char *title);
|
||||
virtual ~JasHistogram1D();
|
||||
private:
|
||||
jmethodID fillMethod;
|
||||
jobject fJasHist;
|
||||
JNIEnv* fEnv;
|
||||
JasAxis fAxis;
|
||||
std_string fTitle;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,67 @@
|
||||
#ifndef JASHISTOGRAM2D_H
|
||||
#define JASHISTOGRAM2D_H
|
||||
|
||||
#if defined(G4ANALYSIS_BUILD_JAS)
|
||||
|
||||
#include <IHistogram2D.h>
|
||||
|
||||
#include "JasAxis.h"
|
||||
|
||||
class JasHistogramFactory;
|
||||
|
||||
class JasHistogram2D : public IHistogram2D {
|
||||
public: // IHistogram IMethods :
|
||||
virtual std_string title() const;
|
||||
virtual int dimensions() const;
|
||||
virtual int entries() const;
|
||||
virtual int allEntries() const;
|
||||
virtual int extraEntries() const;
|
||||
virtual double equivalentBinEntries() const;
|
||||
virtual double sumBinHeights() const;
|
||||
virtual double sumAllBinHeights() const;
|
||||
virtual double sumExtraBinHeights() const;
|
||||
virtual double minBinHeight() const;
|
||||
virtual double maxBinHeight() const;
|
||||
virtual void reset();
|
||||
virtual IAnnotation* annotation();
|
||||
public: // IHistogram2D IMethods :
|
||||
virtual void fill( double x, double y, double weight = 1 );
|
||||
virtual int binEntries( int indexX, int indexY ) const;
|
||||
virtual int binEntriesX( int indexX ) const;
|
||||
virtual int binEntriesY( int indexY ) const;
|
||||
virtual double binHeight( int indexX, int indexY ) const;
|
||||
virtual double binHeightX( int indexX ) const;
|
||||
virtual double binHeightY( int indexY ) const;
|
||||
virtual double binError( int indexX, int indexY ) const;
|
||||
virtual double meanX() const;
|
||||
virtual double meanY() const;
|
||||
virtual double rmsX() const;
|
||||
virtual double rmsY() const;
|
||||
virtual int minBinX() const;
|
||||
virtual int minBinY() const;
|
||||
virtual int maxBinX() const;
|
||||
virtual int maxBinY() const;
|
||||
virtual const IAxis& xAxis() const;
|
||||
virtual const IAxis& yAxis() const;
|
||||
virtual int coordToIndexX( double coordX ) const;
|
||||
virtual int coordToIndexY( double coordY ) const;
|
||||
virtual IHistogram1D* projectionX() const;
|
||||
virtual IHistogram1D* projectionY() const;
|
||||
virtual IHistogram1D* sliceX( int indexY ) const;
|
||||
virtual IHistogram1D* sliceY( int indexX ) const;
|
||||
virtual IHistogram1D* sliceX( int indexY1, int indexY2 ) const;
|
||||
virtual IHistogram1D* sliceY( int indexX1, int indexX2 ) const;
|
||||
public:
|
||||
JasHistogram2D(JasHistogramFactory *factory, const char *title);
|
||||
virtual ~JasHistogram2D();
|
||||
private:
|
||||
jmethodID fillMethod;
|
||||
jobject fJasHist;
|
||||
JNIEnv* fEnv;
|
||||
JasAxis fAxis;
|
||||
std_string fTitle;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
// JHistogramFactory.h: interface for the JHistogramFactory class.
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#ifndef JASHISTOGRAMFACTORY
|
||||
#define JASHISTOGRAMFACTORY
|
||||
|
||||
#if defined(G4ANALYSIS_BUILD_JAS)
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include <IHistogramFactory.h>
|
||||
|
||||
class JasHistogramFactory
|
||||
: public IHistogramFactory
|
||||
{
|
||||
public: // IMethods :
|
||||
virtual IHistogram1D* create1D(const std_string&,
|
||||
int=0,double=0,double=0,
|
||||
int=0);
|
||||
virtual IHistogram2D* create2D(const std_string&,
|
||||
int=0,double=0,double=0,
|
||||
int=0,double=0,double=0,
|
||||
int=0);
|
||||
virtual void destroy(IHistogram*);
|
||||
public:
|
||||
JasHistogramFactory();
|
||||
virtual ~JasHistogramFactory();
|
||||
JNIEnv* getEnv();
|
||||
void error(const char* message);
|
||||
private:
|
||||
jobject fJob;
|
||||
void createJVM();
|
||||
void destroyJVM();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
// 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: G4JasSystem.cc,v 1.8 2000/11/16 13:44:43 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 14 September 2000
|
||||
|
||||
#ifdef G4ANALYSIS_BUILD_JAS
|
||||
|
||||
#include "JasHistogramFactory.h"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4JasSystem.hh"
|
||||
|
||||
G4JasSystem::G4JasSystem (
|
||||
const G4String& aName
|
||||
)
|
||||
:fName(aName)
|
||||
,fHistogramFactory(0)
|
||||
{
|
||||
}
|
||||
G4JasSystem::~G4JasSystem (
|
||||
)
|
||||
{
|
||||
delete fHistogramFactory;
|
||||
}
|
||||
const G4String& G4JasSystem::GetName() const {
|
||||
return fName;
|
||||
}
|
||||
IHistogramFactory* G4JasSystem::GetHistogramFactory() {
|
||||
if(!fHistogramFactory) {
|
||||
G4cout << "Activate jas analysis system" << G4std::endl;
|
||||
fHistogramFactory = new JasHistogramFactory();
|
||||
}
|
||||
return fHistogramFactory;
|
||||
}
|
||||
void G4JasSystem::Store(IHistogram*,const G4String&) {
|
||||
}
|
||||
void G4JasSystem::Plot(IHistogram*) {
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
#ifdef G4ANALYSIS_BUILD_JAS
|
||||
|
||||
#include "JasAxis.h"
|
||||
|
||||
double JasAxis::lowerEdge() const {return 0;}
|
||||
double JasAxis::upperEdge() const { return 0;}
|
||||
int JasAxis::bins() const { return 0;}
|
||||
double JasAxis::binLowerEdge(int) const { return 0;}
|
||||
double JasAxis::binUpperEdge(int) const { return 0;}
|
||||
double JasAxis::binWidth(int) const { return 0;}
|
||||
double JasAxis::binCentre(int) const { return 0;}
|
||||
int JasAxis::coordToIndex(double) const { return 0;}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,89 @@
|
||||
// JasHistogram.cpp: implementation of the JasHistogram1D class.
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef G4ANALYSIS_BUILD_JAS
|
||||
|
||||
#include <jni.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "JasHistogram1D.h"
|
||||
#include "JasHistogramFactory.h"
|
||||
|
||||
JasHistogram1D::JasHistogram1D(JasHistogramFactory* factory, const char* title)
|
||||
:fillMethod(NULL)
|
||||
,fJasHist(NULL)
|
||||
,fEnv(NULL)
|
||||
{
|
||||
fEnv = factory->getEnv();
|
||||
if(fEnv==NULL) return;
|
||||
// Create the corresponding Java histogram
|
||||
jclass cls = fEnv->FindClass("hep/analysis/Histogram");
|
||||
if (cls == NULL) {
|
||||
factory->error("Could not create hep.analysis.Histogram");
|
||||
fEnv = 0;
|
||||
return;
|
||||
}
|
||||
jmethodID constructor =
|
||||
fEnv->GetMethodID(cls, "<init>", "(Ljava/lang/String;)V");
|
||||
if (constructor == NULL) {
|
||||
factory->error("Could not find constructor for hep.analysis.Histogram");
|
||||
fEnv = 0;
|
||||
return;
|
||||
}
|
||||
fillMethod = fEnv->GetMethodID(cls,"fill","(D)V");
|
||||
if (fillMethod == NULL) {
|
||||
factory->error("Could not find fill method for hep.analysis.Histogram");
|
||||
fEnv = 0;
|
||||
return;
|
||||
}
|
||||
jstring jtitle = fEnv->NewStringUTF(title);
|
||||
fJasHist = fEnv->NewObject(cls,constructor,jtitle);
|
||||
}
|
||||
|
||||
JasHistogram1D::~JasHistogram1D()
|
||||
{
|
||||
if(fEnv==NULL) return;
|
||||
fEnv->DeleteLocalRef(fJasHist);
|
||||
}
|
||||
|
||||
void JasHistogram1D::fill(double value,double)
|
||||
{
|
||||
if(fEnv==NULL) return;
|
||||
fEnv->CallVoidMethod(fJasHist,fillMethod,value);
|
||||
}
|
||||
|
||||
// Today dummy methods....
|
||||
#define IWeight double
|
||||
#define ICoordinate double
|
||||
#define ISize int
|
||||
#define IBin int
|
||||
|
||||
// IHistogram :
|
||||
std_string JasHistogram1D::title() const {return fTitle;}
|
||||
int JasHistogram1D::dimensions() const {return 1;}
|
||||
ISize JasHistogram1D::entries() const {return 0;}
|
||||
ISize JasHistogram1D::allEntries() const {return 0;}
|
||||
ISize JasHistogram1D::extraEntries() const {return 0;}
|
||||
IWeight JasHistogram1D::equivalentBinEntries() const {return 0;}
|
||||
IWeight JasHistogram1D::sumBinHeights() const {return 0;}
|
||||
IWeight JasHistogram1D::sumAllBinHeights() const {return 0;}
|
||||
IWeight JasHistogram1D::sumExtraBinHeights() const {return 0;}
|
||||
IWeight JasHistogram1D::minBinHeight() const {return 0;}
|
||||
IWeight JasHistogram1D::maxBinHeight() const {return 0;}
|
||||
void JasHistogram1D::reset() {}
|
||||
IAnnotation* JasHistogram1D::annotation() {return 0;}
|
||||
// IHistogram1D :
|
||||
IBin JasHistogram1D::minBin() const {return 0;}
|
||||
IBin JasHistogram1D::maxBin() const {return 0;}
|
||||
IBin JasHistogram1D::coordToIndex(ICoordinate) const {return 0;}
|
||||
ICoordinate JasHistogram1D::mean() const {return 0;}
|
||||
ICoordinate JasHistogram1D::rms() const {return 0;}
|
||||
|
||||
// Bins :
|
||||
ISize JasHistogram1D::binEntries(IBin) const {return 0;}
|
||||
IWeight JasHistogram1D::binHeight(IBin) const {return 0;}
|
||||
IWeight JasHistogram1D::binError(IBin) const {return 0;}
|
||||
|
||||
const IAxis& JasHistogram1D::xAxis() const {return fAxis;}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,98 @@
|
||||
// JasHistogram.cpp: implementation of the JasHistogram2D class.
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef G4ANALYSIS_BUILD_JAS
|
||||
|
||||
#include <jni.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "JasHistogram2D.h"
|
||||
#include "JasHistogramFactory.h"
|
||||
|
||||
JasHistogram2D::JasHistogram2D(JasHistogramFactory* factory, const char* title)
|
||||
:fillMethod(NULL)
|
||||
,fJasHist(NULL)
|
||||
,fEnv(NULL)
|
||||
{
|
||||
fEnv = factory->getEnv();
|
||||
if(fEnv==NULL) return;
|
||||
// Create the corresponding Java histogram
|
||||
jclass cls = fEnv->FindClass("hep/analysis/Histogram");
|
||||
if (cls == NULL) {
|
||||
factory->error("Could not create hep.analysis.Histogram");
|
||||
fEnv = 0;
|
||||
return;
|
||||
}
|
||||
jmethodID constructor =
|
||||
fEnv->GetMethodID(cls, "<init>", "(Ljava/lang/String;)V");
|
||||
if (constructor == NULL) {
|
||||
factory->error("Could not find constructor for hep.analysis.Histogram");
|
||||
fEnv = 0;
|
||||
return;
|
||||
}
|
||||
fillMethod = fEnv->GetMethodID(cls,"fill","(D)V");
|
||||
if (fillMethod == NULL) {
|
||||
factory->error("Could not find fill method for hep.analysis.Histogram");
|
||||
fEnv = 0;
|
||||
return;
|
||||
}
|
||||
jstring jtitle = fEnv->NewStringUTF(title);
|
||||
fJasHist = fEnv->NewObject(cls,constructor,jtitle);
|
||||
}
|
||||
|
||||
JasHistogram2D::~JasHistogram2D()
|
||||
{
|
||||
if(fEnv==NULL) return;
|
||||
fEnv->DeleteLocalRef(fJasHist);
|
||||
}
|
||||
|
||||
void JasHistogram2D::fill(double x,double y, double w)
|
||||
{
|
||||
if(fEnv==NULL) return;
|
||||
fEnv->CallVoidMethod(fJasHist,fillMethod,x);
|
||||
}
|
||||
|
||||
// IHistogram :
|
||||
std_string JasHistogram2D::title() const {return fTitle;}
|
||||
int JasHistogram2D::dimensions() const {return 1;}
|
||||
int JasHistogram2D::entries() const {return 0;}
|
||||
int JasHistogram2D::allEntries() const {return 0;}
|
||||
int JasHistogram2D::extraEntries() const {return 0;}
|
||||
double JasHistogram2D::equivalentBinEntries() const {return 0;}
|
||||
double JasHistogram2D::sumBinHeights() const {return 0;}
|
||||
double JasHistogram2D::sumAllBinHeights() const {return 0;}
|
||||
double JasHistogram2D::sumExtraBinHeights() const {return 0;}
|
||||
double JasHistogram2D::minBinHeight() const {return 0;}
|
||||
double JasHistogram2D::maxBinHeight() const {return 0;}
|
||||
void JasHistogram2D::reset() {}
|
||||
IAnnotation* JasHistogram2D::annotation() {return 0;}
|
||||
|
||||
// IHistogram2D :
|
||||
int JasHistogram2D::binEntries( int indexX, int indexY ) const {return 0;}
|
||||
int JasHistogram2D::binEntriesX( int indexX ) const {return 0;}
|
||||
int JasHistogram2D::binEntriesY( int indexY ) const {return 0;}
|
||||
double JasHistogram2D::binHeight( int indexX, int indexY ) const {return 0;}
|
||||
double JasHistogram2D::binHeightX( int indexX ) const {return 0;}
|
||||
double JasHistogram2D::binHeightY( int indexY ) const {return 0;}
|
||||
double JasHistogram2D::binError( int indexX, int indexY ) const {return 0;}
|
||||
double JasHistogram2D::meanX() const {return 0;}
|
||||
double JasHistogram2D::meanY() const {return 0;}
|
||||
double JasHistogram2D::rmsX() const {return 0;}
|
||||
double JasHistogram2D::rmsY() const {return 0;}
|
||||
int JasHistogram2D::minBinX() const {return 0;}
|
||||
int JasHistogram2D::minBinY() const {return 0;}
|
||||
int JasHistogram2D::maxBinX() const {return 0;}
|
||||
int JasHistogram2D::maxBinY() const {return 0;}
|
||||
const IAxis& JasHistogram2D::xAxis() const {return fAxis;}
|
||||
const IAxis& JasHistogram2D::yAxis() const {return fAxis;}
|
||||
int JasHistogram2D::coordToIndexX( double coordX ) const {return 0;}
|
||||
int JasHistogram2D::coordToIndexY( double coordY ) const {return 0;}
|
||||
IHistogram1D* JasHistogram2D::projectionX() const {return 0;}
|
||||
IHistogram1D* JasHistogram2D::projectionY() const {return 0;}
|
||||
IHistogram1D* JasHistogram2D::sliceX( int indexY ) const {return 0;}
|
||||
IHistogram1D* JasHistogram2D::sliceY( int indexX ) const {return 0;}
|
||||
IHistogram1D* JasHistogram2D::sliceX( int indexY1, int indexY2 ) const {return 0;}
|
||||
IHistogram1D* JasHistogram2D::sliceY( int indexX1, int indexX2 ) const {return 0;}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,119 @@
|
||||
// JasHistogramFactory.cpp: implementation of the JasHistogramFactory class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef G4ANALYSIS_BUILD_JAS
|
||||
|
||||
#include <jni.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "JasHistogramFactory.h"
|
||||
#include "JasHistogram1D.h"
|
||||
|
||||
static JNIEnv* env = 0;
|
||||
static JavaVM* jvm = 0;
|
||||
|
||||
|
||||
JasHistogramFactory::JasHistogramFactory()
|
||||
:fJob(NULL)
|
||||
{
|
||||
createJVM();
|
||||
|
||||
if(env==NULL) return;
|
||||
|
||||
const char* title = "G4Job";
|
||||
// Create a Job to encapsulate the histograms
|
||||
jclass cls = env->FindClass("jas/server/HistogramServer");
|
||||
if (cls == NULL) {
|
||||
error("Could not find class jas.server.HistogramServer");
|
||||
return;
|
||||
}
|
||||
jmethodID constructor =
|
||||
env->GetMethodID(cls,"<init>","(Ljava/lang/String;)V");
|
||||
if (constructor == NULL) {
|
||||
error("Could not find constructor");
|
||||
return;
|
||||
}
|
||||
jstring jtitle = env->NewStringUTF(title);
|
||||
fJob = env->NewObject(cls,constructor,jtitle);
|
||||
if (fJob == NULL) {
|
||||
error("Could not create job");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
JasHistogramFactory::~JasHistogramFactory()
|
||||
{
|
||||
destroyJVM();
|
||||
}
|
||||
IHistogram1D* JasHistogramFactory::create1D(
|
||||
const std_string& name
|
||||
,int,double,double
|
||||
,int
|
||||
)
|
||||
{
|
||||
return new JasHistogram1D(this,name.c_str());
|
||||
}
|
||||
IHistogram2D* JasHistogramFactory::create2D(
|
||||
const std_string& name
|
||||
,int,double,double
|
||||
,int,double,double
|
||||
,int
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void JasHistogramFactory::error(const char* msg)
|
||||
{
|
||||
G4cerr << "G4 JasHistogramFactory : Error: " << msg << G4std::endl;
|
||||
//exit(1);
|
||||
}
|
||||
JNIEnv* JasHistogramFactory::getEnv()
|
||||
{
|
||||
return env;
|
||||
}
|
||||
void JasHistogramFactory::createJVM()
|
||||
{
|
||||
JavaVMInitArgs vm_args;
|
||||
JavaVMOption options[2];
|
||||
|
||||
char* cp = getenv("CLASSPATH");
|
||||
if(cp==NULL) {
|
||||
error("env variable CLASSPATH not setted");
|
||||
return;
|
||||
}
|
||||
|
||||
//char* cp ="c:\\program files\\java analysis studio\\lib\\hep.jar";
|
||||
char* opt = new char[strlen(cp)+100];
|
||||
strcpy(opt,"-Djava.class.path=");
|
||||
strcat(opt,cp);
|
||||
G4cout << "cp=" << opt <<G4std::endl;
|
||||
options[0].optionString = opt;
|
||||
options[1].optionString = "-verbose";
|
||||
|
||||
vm_args.version = JNI_VERSION_1_2;
|
||||
vm_args.options = options;
|
||||
vm_args.nOptions = 1;
|
||||
vm_args.ignoreUnrecognized = 1;
|
||||
|
||||
int rc = JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args);
|
||||
delete [] opt;
|
||||
|
||||
if (rc < 0) {
|
||||
error("Failed to create Java VM");
|
||||
return;
|
||||
}
|
||||
}
|
||||
void JasHistogramFactory::destroy(IHistogram*){}
|
||||
void JasHistogramFactory::destroyJVM()
|
||||
{
|
||||
if(jvm) jvm->DestroyJavaVM();
|
||||
jvm = 0;
|
||||
env = 0;
|
||||
fJob = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user