Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
+51
View File
@@ -0,0 +1,51 @@
# $Id: GNUmakefile,v 1.4 2000/12/12 16:29:24 gunter Exp $
# -----------------------------------------------------------------------
# GNUmakefile for visualization and modeling. John Allison, 5/7/95.
# Modeling is always made. Others by environment. John Allison 4/7/98.
# -----------------------------------------------------------------------
MAKEFLAGS= --no-print-directory
name := G4analysis
ifndef G4INSTALL
G4INSTALL = ../..
endif
include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/analysis.gmk
G4LIBDIR := $(G4LIB)/$(G4SYSTEM)
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(name)
SUBDIRS += management
SUBLIBS += G4analysis_management
ifdef G4ANALYSIS_BUILD_LIZARD
SUBDIRS += Lizard
SUBLIBS += G4Lizard
endif
ifdef G4ANALYSIS_BUILD_JAS
SUBDIRS += jas
SUBLIBS += G4jas
endif
ifdef G4ANALYSIS_BUILD_LAB
SUBDIRS += Lab
SUBLIBS += G4Lab
endif
.PHONY: granular glob global clean
granular:
@for dir in $(SUBDIRS); do (cd $$dir; $(MAKE)); done
includes:
@for dir in $(SUBDIRS); do (cd $$dir && $(MAKE) $@ ); done
glob global:
@echo "ERROR: The global target not relevant for the analysis category."
clean:
@for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) clean); done
+19
View File
@@ -0,0 +1,19 @@
# $Id: GNUmakefile,v 1.1.1.1 2000/11/07 14:31:38 barrand Exp $
name := G4Lab
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/analysis.gmk
include $(G4INSTALL)/config/interactivity.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include
ifdef G4ANALYSIS_BUILD_OPEN_SCIENTIST
# CPPFLAGS +=
endif
include $(G4INSTALL)/config/common.gmk
@@ -0,0 +1,55 @@
// 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: G4LabSystem.hh,v 1.2 2000/11/16 13:44:38 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// Guy Barrand 14 September 2000
#ifndef G4LABSYSTEM_H
#define G4LABSYSTEM_H
#if defined(G4ANALYSIS_BUILD_LAB) || defined(G4ANALYSIS_USE_LAB)
#include "G4VAnalysisSystem.hh"
class IHistogramManager;
class IStorageSystemManager;
class ICloud;
class ICloudFactory;
class ICloudManager;
class ITuple;
class ITupleManager;
class ISession;
class G4LabSystem : public G4VAnalysisSystem {
public: // I methods :
virtual const G4String& GetName() const;
virtual IHistogramFactory* GetHistogramFactory();
virtual ICloudFactory* GetCloudFactory();
virtual ITuple* CreateTuple(const G4String&,const G4String&);
//
virtual void Store(IHistogram* = 0,const G4String& = "");
virtual void Plot(IHistogram*);
virtual void Plot(ICloud*);
public:
G4LabSystem(const G4String& name = "Lab");
virtual ~G4LabSystem();
private:
G4String fName;
IStorageSystemManager* fStorageManager;
IHistogramManager* fHistogramManager;
ICloudManager* fCloudManager;
ITupleManager* fTupleManager;
ISession* fSession;
};
#endif
#endif
+167
View File
@@ -0,0 +1,167 @@
// 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: G4LabSystem.cc,v 1.2 2000/11/16 13:44:41 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// Guy Barrand 14 September 2000
#ifdef G4ANALYSIS_BUILD_LAB
#include <Lab/Analysis.h>
#include "G4ios.hh"
#include "G4LabSystem.hh"
#ifdef G4ANALYSIS_LAB_VISUALIZATION
#include <ISession.h>
#include <IUI.h>
#include <IViewer.h>
#include <Lib/Compiler.h>
BegNameSpace(Lib)
#include <Lib/Memory.h>
EndNameSpace
BegNameSpace(OnX)
#include <OnX/Interpreters.h>
#include <OnX/Session.h>
#include <OnX/XmUI.h>
EndNameSpace
#endif
G4LabSystem::G4LabSystem (
const G4String& aName
)
:fName(aName)
,fStorageManager(0)
,fHistogramManager(0)
,fCloudManager(0)
,fTupleManager(0)
,fSession(0)
{
#ifdef G4ANALYSIS_LAB_VISUALIZATION
fSession = new OnX::Session;
if(fSession) {
OnX::XmUI* gui = new OnX::XmUI(fSession,0,0);
if(gui) {
fSession->addManager(gui);
gui->executeCreateCallbacks();
//gui->steer();
}
}
fHistogramManager =
(IHistogramManager*)fSession->findManager("HistogramManager");
if(!fHistogramManager) {
G4cout << "Can't find the histogram manager" << G4std::endl;
}
fCloudManager =
(ICloudManager*)fSession->findManager("CloudManager");
if(!fCloudManager) {
G4cout << "Can't find the cloud manager" << G4std::endl;
}
fTupleManager =
(ITupleManager*)fSession->findManager("TupleManager");
if(!fTupleManager) {
G4cout << "Can't find the tuple manager" << G4std::endl;
}
fStorageManager =
(IStorageSystemManager*)fSession->findManager("StorageManager");
if(!fStorageManager) {
G4cout << "Can't find the storage manager" << G4std::endl;
}
#else
fHistogramManager = new Lab::HistogramManager();
fCloudManager = new Lab::CloudManager();
fTupleManager = new Lab::TupleManager();
fStorageManager = new Lab::StorageManager();
#endif
}
G4LabSystem::~G4LabSystem (){
#ifdef G4ANALYSIS_LAB_VISUALIZATION
delete fSession; // Will delete the gui object and the managers.
#else
delete fHistogramManager;
delete fCloudManager;
delete fTupleManager;
delete fStorageManager;
#endif
Lib::Memory::dump();
}
const G4String& G4LabSystem::GetName() const {
return fName;
}
IHistogramFactory* G4LabSystem::GetHistogramFactory() {
return fHistogramManager;
}
ICloudFactory* G4LabSystem::GetCloudFactory() {
return fCloudManager;
}
ITuple* G4LabSystem::CreateTuple(
const G4String& aStorage
,const G4String& aSID
){
if(!fTupleManager) return 0;
Lab::RioStorage* storageRio = new Lab::RioStorage(aStorage,
"RECREATE",
fStorageManager);
return new Lab::RioTuple(storageRio,aSID,fTupleManager);
}
void G4LabSystem::Store(IHistogram*,const G4String&){
if(!fHistogramManager) return;
Lab::RioStorage* storage = new Lab::RioStorage("g4osc.root","RECREATE");
//rioDB->createDirectory("histograms");
//rioDB->cd("histograms");
int number = fHistogramManager->size();
for(int count=0;count<number;count++) {
IHistogram* histo = (*fHistogramManager)[count];
const char* title = histo->title().c_str();
//G4cout << "G4Lab : store : " << title << G4std::endl;
fHistogramManager->store(histo,storage,title);
}
storage->commit();
delete storage;
//if(verboseLevel>1) G4cout << "Analysis is deleting." << G4endl;
//clear();
}
void G4LabSystem::Plot(IHistogram* aHistogram){
if(!fHistogramManager) return;
#ifdef G4ANALYSIS_LAB_VISUALIZATION
if(fSession) {
IUI* ui = (IUI*)fSession->findManager("UI_Manager");
if(ui) {
IViewer* viewer = ui->getCurrentViewer();
if(viewer) {
viewer->erase("region");
fHistogramManager->visualize(aHistogram,viewer);
viewer->next();
ui->synchronize();
}
}
}
#endif
}
void G4LabSystem::Plot(ICloud* aCloud){
if(!fCloudManager) return;
#ifdef G4ANALYSIS_LAB_VISUALIZATION
if(fSession) {
IUI* ui = (IUI*)fSession->findManager("UI_Manager");
if(ui) {
IViewer* viewer = ui->getCurrentViewer();
if(viewer) {
viewer->erase("region");
fCloudManager->visualize(aCloud,viewer);
viewer->next();
ui->synchronize();
}
}
}
#endif
}
#endif
+18
View File
@@ -0,0 +1,18 @@
# $Id: GNUmakefile,v 1.1.1.1 2000/10/31 21:42:25 barrand Exp $
name := G4Lizard
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/analysis.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include
ifdef G4ANALYSIS_BUILD_LIZARD
# CPPFLAGS +=
endif
include $(G4INSTALL)/config/common.gmk
@@ -0,0 +1,45 @@
// 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: G4LizardSystem.hh,v 1.5 2000/11/16 13:44:41 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// Guy Barrand 14 September 2000
#ifndef G4LIZARDSYSTEM_H
#define G4LIZARDSYSTEM_H
#if defined(G4ANALYSIS_BUILD_LIZARD) || defined(G4ANALYSIS_USE_LIZARD)
#include "G4VAnalysisSystem.hh"
class IHistogramFactory;
class IVectorFactory;
class IPlotter;
class G4LizardSystem : 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:
G4LizardSystem(const G4String& name = "Lizard");
virtual ~G4LizardSystem();
private:
G4String fName;
IHistogramFactory* fHistogramFactory;
IVectorFactory* fVectorFactory;
IPlotter* fPlotter;
};
#endif
#endif
@@ -0,0 +1,128 @@
// 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: G4LizardSystem.cc,v 1.8 2000/11/17 08:16:45 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// Guy Barrand 14 September 2000
#ifdef G4ANALYSIS_BUILD_LIZARD
#include <IHistogram1D.h>
#include <IHistogram2D.h>
//#include <IHistogramFactory.h>
#ifdef AIDA_DONT_USE_STD
#define AIDA_STD
#else
#define AIDA_STD std
#endif
// Lizard :
#include <AIDAHistogramFactory.h>
#include "AIDA_Plotter/AIDAPlotter.h"
#include "Interfaces/IVector.h"
#include "Interfaces/IVectorFactory.h"
#include "G4ios.hh"
#include "G4LizardSystem.hh"
G4LizardSystem::G4LizardSystem (
const G4String& aName
)
:fName(aName)
,fHistogramFactory(0)
,fVectorFactory(0)
,fPlotter(0)
{
fHistogramFactory = createIHistogramFactory();
if (fHistogramFactory == 0) {
G4cout << "Can't find the histogram factory." << G4std::endl;
}
fVectorFactory = createIVectorFactory();
if (fVectorFactory == 0) {
G4cout << "Can't find the vector factory." << G4std::endl;
}
fPlotter = createIPlotter(); // create plotter with 1 zone
if (fPlotter == 0) {
G4cout << "Can't create a plotter." << G4std::endl;
}
}
G4LizardSystem::~G4LizardSystem (){
delete fHistogramFactory;
}
const G4String& G4LizardSystem::GetName() const {
return fName;
}
IHistogramFactory* G4LizardSystem::GetHistogramFactory() {
return fHistogramFactory;
}
void G4LizardSystem::Store(IHistogram* aHistogram,const G4String& aStorageID){
if (!aHistogram) return;
if (aStorageID == "") return;
if (aHistogram->dimensions()==1) {
IVector* v =
fVectorFactory->from1D(dynamic_cast<IHistogram1D*>(aHistogram));
if (v == 0) {
G4cerr << "G4LizardSystem::Store> ERROR: could not create vector !" <<
G4std::endl;
return;
}
v->toAscii(aStorageID.c_str());
delete v; // don't forget this !
}
if(aHistogram->dimensions()==2) {
IVector* v =
fVectorFactory->from2D(dynamic_cast<IHistogram2D*>(aHistogram));
if (v == 0) {
G4cerr << "G4LizardSystem::Store> ERROR: could not create vector !" <<
G4std::endl;
return;
}
v->toAscii(aStorageID.c_str());
delete v; // don't forget this !
}
}
void G4LizardSystem::Plot(IHistogram* aHistogram){
if(!fVectorFactory) return;
if(!fPlotter) return;
if(!aHistogram) return;
if(aHistogram->dimensions()==1) {
IVector* v =
fVectorFactory->from1D(dynamic_cast<IHistogram1D*>(aHistogram));
if (v == 0) {
G4cerr << "ERROR: could not create vector !" << G4std::endl;
return;
}
fPlotter->plot(v);
fPlotter->refresh();
delete v; // don't forget this !
}
if(aHistogram->dimensions()==2) {
IVector* v =
fVectorFactory->from2D(dynamic_cast<IHistogram2D*>(aHistogram));
if (v == 0) {
G4cerr << "ERROR: could not create vector !" << G4std::endl;
return;
}
fPlotter->plot(v);
fPlotter->refresh();
delete v; // don't forget this !
}
//fPlotter->psPrint("posplot.ps");
}
#endif
+18
View File
@@ -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
+24
View File
@@ -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
+49
View File
@@ -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
+15
View File
@@ -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
+89
View File
@@ -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
+98
View File
@@ -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
+18
View File
@@ -0,0 +1,18 @@
# $Id: GNUmakefile,v 1.1.1.1 2000/06/21 12:36:24 barrand Exp $
# -------------------------------------------------------------
# GNUmakefile for visualization library. John Allison, 5/7/95.
name := G4analysis_management
ifndef G4INSTALL
G4INSTALL = ../../..
endif
include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/analysis.gmk
G4TMPDIR = $(G4TMP)/$(G4SYSTEM)/$(name)
CPPFLAGS += -I$(G4BASE)/global/management/include
include $(G4INSTALL)/config/common.gmk
@@ -0,0 +1,53 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4AnalysisManager.hh,v 1.8 2000/11/16 13:44:45 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// Guy Barrand 20th Mai 2000
//
// Class description
//
// Base class for the analysis manager proxy mechanism.
//
#ifndef G4ANALYSIS_HH
#define G4ANALYSIS_HH
#if defined(G4ANALYSIS_BUILD) || defined(G4ANALYSIS_USE)
#include "globals.hh"
#include "g4std/vector"
#include "G4VAnalysisManager.hh"
class G4AnalysisManager : public G4VAnalysisManager {
public: // I methods :
G4bool RegisterAnalysisSystem(G4VAnalysisSystem*);
IHistogramFactory* GetHistogramFactory(const G4String&);
//
virtual void Store(IHistogram* = 0,const G4String& = "");
virtual void Plot(IHistogram*);
public:
G4AnalysisManager();
virtual ~G4AnalysisManager();
private:
G4VAnalysisSystem* FindSystem(const G4String&);
G4std::vector<G4VAnalysisSystem*> fSystems;
G4VAnalysisSystem* fCurrentSystem;
//
#ifdef G4ANALYSIS_NON_AIDA
public:
ICloudFactory* GetCloudFactory(const G4String&);
virtual void Plot(ICloud*);
ITuple* CreateTuple(const G4String&,const G4String&,const G4String&);
#endif
};
#endif
#endif
@@ -0,0 +1,57 @@
// 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: G4VAnalysisManager.hh,v 1.5 2000/11/16 13:44:46 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// Guy Barrand 20th Mai 2000
//
// Class description
//
// Abstract base class for the analysis manager proxy mechanism.
//
#ifndef G4VANALYSIS_HH
#define G4VANALYSIS_HH
#if defined(G4ANALYSIS_BUILD) || defined(G4ANALYSIS_USE)
#include "globals.hh"
class IHistogram;
class IHistogramFactory;
#ifdef G4ANALYSIS_NON_AIDA
class ICloudFactory;
class ICloud;
class ITuple;
#endif
class G4VAnalysisSystem;
class G4VAnalysisManager {
public:
virtual ~G4VAnalysisManager() {}
virtual G4bool RegisterAnalysisSystem(G4VAnalysisSystem*) = 0;
//
// Get the factories :
virtual IHistogramFactory* GetHistogramFactory(const G4String&) = 0;
//
// Access to facilites methods :
virtual void Store(IHistogram* = 0,const G4String& = "") = 0;
virtual void Plot(IHistogram*) = 0;
//
#ifdef G4ANALYSIS_NON_AIDA
virtual ICloudFactory* GetCloudFactory(const G4String&) = 0;
virtual ITuple* CreateTuple(const G4String&,const G4String&,const G4String&) = 0;
virtual void Plot(ICloud*) = 0;
#endif
};
#endif
#endif
@@ -0,0 +1,47 @@
// 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: G4VAnalysisSystem.hh,v 1.8 2000/11/16 13:44:46 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
#ifndef G4VANALYSISSYSTEM_HH
#define G4VANALYSISSYSTEM_HH
#ifdef G4ANALYSIS_BUILD
#include "g4rw/cstring.h"
class IHistogram;
class IHistogramFactory;
#ifdef G4ANALYSIS_NON_AIDA
class ICloudFactory;
class ICloud;
class ITuple;
#endif
class G4VAnalysisSystem {
public:
virtual ~G4VAnalysisSystem() {}
virtual const G4String& GetName() const = 0;
virtual IHistogramFactory* GetHistogramFactory() = 0;
//
virtual void Store(IHistogram* = 0,const G4String& = "") = 0;
virtual void Plot(IHistogram*) = 0;
//
#ifdef G4ANALYSIS_NON_AIDA
virtual ICloudFactory* GetCloudFactory() = 0;
virtual void Plot(ICloud*) = 0;
virtual ITuple* CreateTuple(const G4String&,const G4String&) = 0;
#endif
};
#endif
#endif
@@ -0,0 +1,105 @@
// 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: G4AnalysisManager.cc,v 1.10 2000/11/21 15:41:25 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// Guy Barrand 20th Mai 2000
//
// Class description
//
// This class is a plug-in for various analysis systems
// that follow the AIDA/Histogramming conventions.
//
#ifdef G4ANALYSIS_BUILD
#include "globals.hh"
#include "G4ios.hh"
#include "G4VAnalysisSystem.hh"
#include "G4AnalysisManager.hh"
G4AnalysisManager::G4AnalysisManager(){}
G4AnalysisManager::~G4AnalysisManager(){
int number = fSystems.size();
for(int count=0;count<number;count++) {
delete fSystems[count];
}
}
G4bool G4AnalysisManager::RegisterAnalysisSystem(
G4VAnalysisSystem* aSystem
){
fSystems.push_back(aSystem);
return true;
}
G4VAnalysisSystem* G4AnalysisManager::FindSystem(const G4String& aName) {
int number = fSystems.size();
for(int count=0;count<number;count++) {
if(aName==fSystems[count]->GetName()) return fSystems[count];
}
return 0;
}
IHistogramFactory* G4AnalysisManager::GetHistogramFactory(
const G4String& aSystem
){
G4VAnalysisSystem* analysisSystem = FindSystem(aSystem);
if(!analysisSystem) {
G4cerr << "G4AnalysisManager : " << G4std::endl;
G4cerr << " " << aSystem << " unknown analysis system." << G4std::endl;
return 0;
}
// Set it as current system.
fCurrentSystem = analysisSystem;
return analysisSystem->GetHistogramFactory();
}
void G4AnalysisManager::Store(IHistogram* aHistogram,const G4String& aSID){
if(!fCurrentSystem) return;
fCurrentSystem->Store(aHistogram,aSID);
}
void G4AnalysisManager::Plot(IHistogram* aHistogram){
if(!fCurrentSystem) return;
fCurrentSystem->Plot(aHistogram);
}
// Non AIDA things :
#ifdef G4ANALYSIS_NON_AIDA
ITuple* G4AnalysisManager::CreateTuple(
const G4String& aSystem
,const G4String& aStorage
,const G4String& aSID
){
G4VAnalysisSystem* analysisSystem = FindSystem(aSystem);
if(!analysisSystem) {
G4cerr << "G4AnalysisManager : " << G4std::endl;
G4cerr << " " << aSystem << " unknown analysis system." << G4std::endl;
return 0;
}
// Set it as current system.
fCurrentSystem = analysisSystem;
return analysisSystem->CreateTuple(aStorage,aSID);
}
ICloudFactory* G4AnalysisManager::GetCloudFactory(
const G4String& aSystem
){
G4VAnalysisSystem* analysisSystem = FindSystem(aSystem);
if(!analysisSystem) {
G4cerr << "G4AnalysisManager : " << G4std::endl;
G4cerr << " " << aSystem << " unknown analysis system." << G4std::endl;
return 0;
}
// Set it as current system.
fCurrentSystem = analysisSystem;
return analysisSystem->GetCloudFactory();
}
void G4AnalysisManager::Plot(ICloud* aCloud){
if(!fCurrentSystem) return;
fCurrentSystem->Plot(aCloud);
}
#endif
#endif