Import Geant4 4.0.0 source tree
This commit is contained in:
@@ -21,16 +21,20 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01.cc,v 1.6.4.2 2001/06/28 20:18:43 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01.cc,v 1.8 2001/11/16 14:35:10 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 - exampleN03
|
||||
// GEANT 4 - AnaEx01
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// Comments
|
||||
//
|
||||
// Example of histogram and tuple manipulations using an AIDA compliant
|
||||
// system. All analysis manipulations (hooking an AIDA implementation,
|
||||
// histo booking, filling, etc...) are concentrated in one
|
||||
// class : AnaEx01AnalysisManager.
|
||||
// See the README file within the same directory to have more infos.
|
||||
// --------------------------------------------------------------
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
@@ -39,9 +43,7 @@
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
#include "AnaEx01AnalysisManager.hh"
|
||||
#endif
|
||||
|
||||
#include "AnaEx01DetectorConstruction.hh"
|
||||
#include "AnaEx01PhysicsList.hh"
|
||||
@@ -66,16 +68,15 @@ int main(int argc,char** argv) {
|
||||
AnaEx01DetectorConstruction* detector = new AnaEx01DetectorConstruction;
|
||||
runManager->SetUserInitialization(detector);
|
||||
runManager->SetUserInitialization(new AnaEx01PhysicsList);
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
AnaEx01AnalysisManager* analysisManager =
|
||||
new AnaEx01AnalysisManager(argc==1?"Lab":argv[1]);
|
||||
|
||||
runManager->SetUserAction(new AnaEx01PrimaryGeneratorAction(detector));
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
AnaEx01AnalysisManager* analysisManager = new AnaEx01AnalysisManager();
|
||||
runManager->SetUserAction(new AnaEx01RunAction(analysisManager));
|
||||
runManager->SetUserAction(new AnaEx01EventAction(analysisManager));
|
||||
runManager->SetUserAction(new AnaEx01SteppingAction(analysisManager));
|
||||
#else
|
||||
runManager->SetUserAction(new AnaEx01PrimaryGeneratorAction(detector));
|
||||
runManager->SetUserAction(new AnaEx01RunAction());
|
||||
runManager->SetUserAction(new AnaEx01EventAction());
|
||||
runManager->SetUserAction(new AnaEx01SteppingAction());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.2 2001/06/20 06:49:05 barrand Exp $
|
||||
$Id: History,v 1.5 2001/12/03 08:22:31 barrand Exp $
|
||||
--------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -15,6 +15,15 @@ track of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
03th December 2001 Guy Barrand (AnaEx01-V03-02-01)
|
||||
- Change README : Explain CMTSITE setup for Lab usage.
|
||||
|
||||
19th November 2001 Guy Barrand
|
||||
- Change README : G4ANALYSIS_USE_AIDA -> G4ANALYSIS_USE.
|
||||
|
||||
16rd November 2001 Guy Barrand
|
||||
- * : AIDA 2.2 compliant code. Usage of tuple.
|
||||
|
||||
20 June 2001, Guy Barrand :
|
||||
- AnaEx01SteppingVerbose.cc : replace "entries" to "size" in order
|
||||
to compile with 03-00-ref-03 kernel.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: README,v 1.6 2000/12/06 13:08:13 barrand Exp $
|
||||
$Id: README,v 1.11 2001/12/03 07:49:17 barrand Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -8,61 +8,104 @@ $Id: README,v 1.6 2000/12/06 13:08:13 barrand Exp $
|
||||
AnaEx01
|
||||
-------
|
||||
|
||||
This example shows the usage of histogramming with the
|
||||
analysis category.
|
||||
|
||||
To use the G4AnalysisManager the source/analysis category
|
||||
must have been reconstructed with one of the environment
|
||||
variable setted :
|
||||
G4ANALYSIS_BUILD_JAS
|
||||
G4ANALYSIS_BUILD_LAB
|
||||
G4ANALYSIS_BUILD_LIZARD
|
||||
This example shows the usage of histogram and tuple manipulations using
|
||||
an AIDA compliant system. In this example, all analysis manipulations
|
||||
(hooking an AIDA implementation, histo booking, filling, etc...) are
|
||||
concentrated in one class : AnaEx01AnalysisManager.
|
||||
|
||||
To use an analysis system with this example, the coresponding
|
||||
environment variable must be setted :
|
||||
G4ANALYSIS_USE_JAS
|
||||
G4ANALYSIS_USE_LAB
|
||||
G4ANALYSIS_USE_LIZARD
|
||||
To use an AIDA compliant analysis system with this example, the environment
|
||||
variables :
|
||||
G4ANALYSIS_USE
|
||||
G4ANALYSIS_AIDA_CONFIG_CFLAGS
|
||||
G4ANALYSIS_AIDA_CONFIG_LIBS
|
||||
must be properly set.
|
||||
|
||||
Then to cosntruct this example :
|
||||
The first one permits to validate/devalidate the AIDA analysis code
|
||||
in the example code. The two others permit to give the compilation
|
||||
and link flags of the AIDA compliant system used.
|
||||
An AIDA compliant system should define the command 'aida-config' that
|
||||
permits to retrieve the correct values. For example under some
|
||||
UNIX csh flavour :
|
||||
csh> source <your Geant4 setup script>.csh
|
||||
csh> source <AIDA_SYSTEM setup>.csh (or some equivalent)
|
||||
csh> setenv G4ANALYSIS_USE 1
|
||||
csh> setenv G4ANALYSIS_AIDA_CONFIG_CFLAGS `aida-config --cflags`
|
||||
csh> setenv G4ANALYSIS_AIDA_CONFIG_LIBS `aida-config --libs`
|
||||
csh> cd $G4INSTALL/examples/extended/analysis/AnaEx01
|
||||
csh> setenv G4ANALYSIS_USE_JAS 1
|
||||
csh> setenv G4ANALYSIS_USE_LAB 1
|
||||
csh> setenv G4ANALYSIS_USE_LIZARD 1
|
||||
csh> gmake
|
||||
|
||||
Working with the Lab package :
|
||||
----------------------------
|
||||
If working with the Lab package run the program
|
||||
from the analysis/Lab directory :
|
||||
csh> cd analyis/Lab
|
||||
csh> $G4WORKDIR/bin/$G4SYSTEM/AnaEx01 Lab
|
||||
It must produce a g4osc.root file that contains
|
||||
some histograms. You can visualize them with :
|
||||
csh> source <path>/Lab/<version>/cmt/setup.csh
|
||||
csh> oxm
|
||||
and click in File/session to execute the session.tcl
|
||||
file.
|
||||
|
||||
Working with jas :
|
||||
--------------------------
|
||||
If working with jas :
|
||||
For info, the CPP macros G4ANALYSIS_*_AIDA_* are used in the
|
||||
config/analysis.gmk file of the Geant4 GNUmakefile system.
|
||||
|
||||
Working with the Falsetto package :
|
||||
---------------------------------
|
||||
Falsetto is a little package containing a dummy
|
||||
AIDA analysis factory. It permits to check compilation
|
||||
and link of some user AIDA code without embarquing a
|
||||
full analysis system.
|
||||
|
||||
To reconstruct this example by using the Falsetto
|
||||
package (assuming that it is installed !), do :
|
||||
csh> source <your Geant4 setup script>.csh
|
||||
csh> source <some directory>/Falsetto/<version>/cmt/setup.csh
|
||||
csh> setenv G4ANALYSIS_USE 1
|
||||
csh> setenv G4ANALYSIS_AIDA_CONFIG_CFLAGS `aida-config --cflags`
|
||||
csh> setenv G4ANALYSIS_AIDA_CONFIG_LIBS `aida-config --libs`
|
||||
csh> cd $G4INSTALL/examples/extended/analysis/AnaEx01
|
||||
csh> $G4WORKDIR/bin/$G4SYSTEM/AnaEx01 jas
|
||||
The program will pend for a connection toward jas, then
|
||||
spawn jas :
|
||||
csh> <path_to_jas_bin>/jas
|
||||
csh> gmake
|
||||
|
||||
From jas panel, open a connection toward the AnaEx01 job :
|
||||
- File/Reconnect
|
||||
- Give no server name if running on same machine.
|
||||
- Next to end the connect panel.
|
||||
To run :
|
||||
csh> cd analyis/Falsetto
|
||||
csh> $G4WORKDIR/bin/$G4SYSTEM/AnaEx01
|
||||
At the beginning of output ;should appear :
|
||||
AIDA analysis factory not found.
|
||||
|
||||
When connection is established, the tree widget
|
||||
on the left of jas panel must display "G4Job".
|
||||
Click on the tree items to access an histogram.
|
||||
Double click on the histogram name to visualize it.
|
||||
|
||||
The histogram will update itself according time.
|
||||
The Falsetto URL is : http://www.lal.in2p3.fr/SI/Falsetto
|
||||
Falsetto is installed at CERN under /afs/cern.ch/sw/contrib.
|
||||
|
||||
Working with the OpenScientist/Lab package :
|
||||
------------------------------------------
|
||||
To reconstruct this example by using the OpenScientist/Lab
|
||||
package (assuming that OpenScientist is installed ! ) you have
|
||||
first to "setup" the environment of the Lab package and Geant4.
|
||||
The Lab package (and all OpenScientist packages) being handled
|
||||
by the CMT tools, you may have to setup the environment
|
||||
variable "CMTSITE" to execute site specific things in the chain
|
||||
of setup files of the OpenScientist packages. Then for example at CERN :
|
||||
csh> setenv CMTSITE CERN
|
||||
(DOS> set CMTSITE=CERN_WIN32 (for Windows))
|
||||
When done then do :
|
||||
csh> source <some directory>/Lab/<version>/cmt/setup.csh
|
||||
csh> source <your Geant4 setup script>.csh
|
||||
csh> setenv G4ANALYSIS_USE 1
|
||||
csh> setenv G4ANALYSIS_AIDA_CONFIG_CFLAGS `aida-config --cflags`
|
||||
csh> setenv G4ANALYSIS_AIDA_CONFIG_LIBS `aida-config --libs`
|
||||
csh> cd $G4INSTALL/examples/extended/analysis/AnaEx01
|
||||
csh> gmake
|
||||
|
||||
To run :
|
||||
csh> cd analyis/Lab
|
||||
csh> $G4WORKDIR/bin/$G4SYSTEM/AnaEx01
|
||||
|
||||
It must produce an AnaEx01.root file that contains
|
||||
some HCL histograms and a Lab tuple (stored as a ROOT/TTree).
|
||||
|
||||
To plot some histograms, spawn the Lab interactive tool with :
|
||||
csh> onx
|
||||
(DOS> onx (for Windows))
|
||||
click in File/Python to map a file chooser, choose AnaEx01.py
|
||||
to execute the AnaEx01.py that contains a Python script that
|
||||
do some analysis over the AnaEx01.root file (it gets an histo, plots it
|
||||
in a first drawing region, gets the tuple, books and fills another histo
|
||||
from the tuple colum and plots it in another drawing region).
|
||||
|
||||
The AnaEx01.C file could also be used, within the ROOT tool,
|
||||
to see a projection of the first column of the tuple contained
|
||||
in the AnaEx01.root file. For example :
|
||||
csh> root
|
||||
root[0] .X AnaEx01.C
|
||||
|
||||
The OpenScientist URL is : http://www.lal.in2p3.fr/OpenScientist
|
||||
OpenScientist is installed at CERN under /afs/cern.ch/sw/contrib.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# Macro file for "AnEx01.cc"
|
||||
#
|
||||
# (can be run in batch, without graphic)
|
||||
#
|
||||
#/control/verbose 2
|
||||
#/control/saveHistory
|
||||
#
|
||||
#/run/verbose 2
|
||||
#/event/verbose 0
|
||||
#/tracking/verbose 1
|
||||
#
|
||||
# muon 300 MeV to the direction (1.,0.,0.)
|
||||
# 3 events
|
||||
#
|
||||
#/gun/particle mu+
|
||||
/gun/particle e+
|
||||
/gun/energy 300 MeV
|
||||
/run/beamOn 100
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// To do some analysis over the AnaEx01.root file with the ROOT tool.
|
||||
// Usage :
|
||||
// UNIX> root
|
||||
// root[0] .X AnaEx01.C
|
||||
//
|
||||
|
||||
{
|
||||
TFile* file = new TFile("AnaEx01.root");
|
||||
file->ls();
|
||||
|
||||
TTree* tree = (TTree*)file->Get("/tuples/AnaEx01");
|
||||
tree->Print();
|
||||
|
||||
TCanvas* canvas = new TCanvas("canvas","EAbs",10,10,800,600);
|
||||
|
||||
tree->Draw("EAbs","","");
|
||||
|
||||
canvas->Update();
|
||||
}
|
||||
+53
-41
@@ -24,48 +24,60 @@
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
#
|
||||
# Example of tcl script using a root file.
|
||||
# Example of a Python script using the AnaEx01.root file.
|
||||
#
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# If reexecuted :
|
||||
delete storage
|
||||
delete v
|
||||
#
|
||||
# Get a SWIG handler over the current viewer :
|
||||
IViewer v -this [ui getCurrentViewer]
|
||||
v reset page
|
||||
#
|
||||
# 2x2 regions :
|
||||
#v set page "2 2"
|
||||
v set pageTitle "G4 analysis with Open Scientist"
|
||||
#
|
||||
RioStorage storage g4osc.root READ
|
||||
storage ls
|
||||
#
|
||||
delete EAbs
|
||||
#
|
||||
#storage cd histograms
|
||||
#storage ls
|
||||
#
|
||||
|
||||
# Hook the current plotter :
|
||||
plotter = Plotter('')
|
||||
|
||||
plotter.createRegions(1,2)
|
||||
plotter.setParameter('pageTitle','AnaEx01 analysis')
|
||||
|
||||
rootTree = RootTree('AnaEx01.root','READ')
|
||||
rootTree.ls()
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# In first region, get and plot the EAbs histo :
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
rootTree.cd('histograms')
|
||||
rootTree.ls()
|
||||
|
||||
# Get some histograms with the H1Get
|
||||
# builtin procedure defined in Lab/user/init.tcl :
|
||||
# In the below the first "EAbs" is a variable and
|
||||
# the second is the name of the object in the storage
|
||||
# (the SID, storage identifier) :
|
||||
# H1DGet <variable> <storage> <SID>
|
||||
H1DGet EAbs storage EAbs
|
||||
#
|
||||
# builtin Python procedure (defined in Lab/scripts/Python/Lab_init.py).
|
||||
|
||||
EAbs = H1D_get(rootTree,'EAbs')
|
||||
|
||||
# Plot the histo :
|
||||
EAbs vis
|
||||
#
|
||||
v set textContext "color black fontName TTF/couri"
|
||||
v set histogramContext "color red modeling solid"
|
||||
#
|
||||
# Fit :
|
||||
#delete fitExp
|
||||
#
|
||||
#Exponential fitExp 0. 1.
|
||||
#fitExp fit [& EAbs]
|
||||
#
|
||||
#fitExp vis
|
||||
#
|
||||
plotter.plot(EAbs)
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# In second region plot the EAbs histo built from the tuple :
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
rootTree.cd('..')
|
||||
rootTree.cd('tuples')
|
||||
rootTree.ls()
|
||||
|
||||
tuple = Tuple("AnaEx01","AnaEx01","",rootTree)
|
||||
|
||||
# Create an histo in the default memory tree :
|
||||
tuple_EAbs = H1D('tuple_EAbs','AnaEx01/EAbs',100,0,100)
|
||||
|
||||
# Create an Evaluator and a Filter object :
|
||||
evaluator = Evaluator(tuple,'EAbs')
|
||||
filter = Filter(tuple,'')
|
||||
|
||||
# Project tuple AnaEx01/EAbs column on the tuple_EAbs histo :
|
||||
tuple.project(tuple_EAbs,evaluator,filter)
|
||||
|
||||
plotter.next()
|
||||
plotter.plot(tuple_EAbs)
|
||||
plotter.setParameter('histogramContext','color red modeling solid')
|
||||
|
||||
# Evaluators and Filters are not managed, delete them explicitly :
|
||||
delete_IEvaluator(evaluator)
|
||||
delete_IFilter(filter)
|
||||
|
||||
echo('The two histos must give the same information !')
|
||||
@@ -21,36 +21,29 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01AnalysisManager.hh,v 1.3.4.1 2001/06/28 19:06:44 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01AnalysisManager.hh,v 1.5 2001/11/16 14:30:50 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
// Example Analysis Manager implementing virtual function
|
||||
// RegisterAnalysisSystems. Exploits C-pre-processor variables
|
||||
// G4ANALYSIS_USE_JAS, etc., which are set by the GNUmakefiles if
|
||||
// environment variables of the same name are set.
|
||||
|
||||
// So all you have to do is set environment variables and compile and
|
||||
// instantiate this in your main().
|
||||
|
||||
#ifndef AnaEx01AnalysisManager_h
|
||||
#define AnaEx01AnalysisManager_h 1
|
||||
|
||||
#ifdef G4ANALYSIS_USE
|
||||
|
||||
#include "G4AnalysisManager.hh"
|
||||
|
||||
class G4Run;
|
||||
class G4Event;
|
||||
class G4Step;
|
||||
|
||||
class IAnalysisFactory;
|
||||
class ITree;
|
||||
class IHistogram1D;
|
||||
//class ITuple;
|
||||
class ITuple;
|
||||
|
||||
class AnaEx01AnalysisManager: public G4AnalysisManager {
|
||||
class AnaEx01AnalysisManager {
|
||||
public:
|
||||
AnaEx01AnalysisManager(const G4String&);
|
||||
AnaEx01AnalysisManager();
|
||||
virtual ~AnaEx01AnalysisManager();
|
||||
public:
|
||||
virtual void BeginOfRun(const G4Run*);
|
||||
virtual void EndOfRun(const G4Run*);
|
||||
@@ -58,12 +51,14 @@ public:
|
||||
virtual void EndOfEvent(const G4Event*);
|
||||
virtual void Step(const G4Step*);
|
||||
private:
|
||||
G4int fCalorimeterCollID;
|
||||
int fCalorimeterCollID;
|
||||
IAnalysisFactory* fAnalysisFactory;
|
||||
ITree* fTree;
|
||||
IHistogram1D* fEAbs;
|
||||
IHistogram1D* fLAbs;
|
||||
IHistogram1D* fEGap;
|
||||
IHistogram1D* fLGap;
|
||||
//ITuple* fTuple;
|
||||
ITuple* fTuple;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01CalorHit.hh,v 1.1.1.1.4.1 2001/06/28 19:06:44 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01CalorHit.hh,v 1.2 2001/07/11 09:57:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01CalorimeterSD.hh,v 1.1.1.1.4.1 2001/06/28 19:06:44 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01CalorimeterSD.hh,v 1.2 2001/07/11 09:57:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01DetectorConstruction.hh,v 1.1.1.1.4.1 2001/06/28 19:06:45 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01DetectorConstruction.hh,v 1.2 2001/07/11 09:57:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01DetectorMessenger.hh,v 1.1.1.1.4.1 2001/06/28 19:06:45 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01DetectorMessenger.hh,v 1.2 2001/07/11 09:57:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01EventAction.hh,v 1.3.4.1 2001/06/28 19:06:45 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01EventAction.hh,v 1.4 2001/07/11 09:57:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01PhysicsList.hh,v 1.1.1.1.4.1 2001/06/28 19:06:45 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01PhysicsList.hh,v 1.2 2001/07/11 09:57:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01PrimaryGeneratorAction.hh,v 1.1.1.1.4.1 2001/06/28 19:06:45 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01PrimaryGeneratorAction.hh,v 1.2 2001/07/11 09:57:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01PrimaryGeneratorMessenger.hh,v 1.1.1.1.4.1 2001/06/28 19:06:45 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01PrimaryGeneratorMessenger.hh,v 1.2 2001/07/11 09:57:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01RunAction.hh,v 1.3.4.1 2001/06/28 19:06:45 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01RunAction.hh,v 1.4 2001/07/11 09:57:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01SteppingAction.hh,v 1.3.4.1 2001/06/28 19:06:45 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01SteppingAction.hh,v 1.4 2001/07/11 09:57:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01SteppingVerbose.hh,v 1.1.1.1.4.1 2001/06/28 19:06:45 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01SteppingVerbose.hh,v 1.2 2001/07/11 09:57:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01VisManager.hh,v 1.1.1.1.4.1 2001/06/28 19:06:45 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01VisManager.hh,v 1.2 2001/07/11 09:57:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01AnalysisManager.cc,v 1.9.4.1 2001/06/28 19:06:45 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01AnalysisManager.cc,v 1.11 2001/11/16 14:31:11 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
// Guy Barrand 14th Septembre 2000.
|
||||
@@ -35,54 +35,102 @@
|
||||
#include "G4Event.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
|
||||
#include <IHistogramFactory.h>
|
||||
|
||||
#ifdef G4ANALYSIS_USE_JAS
|
||||
#include "G4JasSystem.hh"
|
||||
#endif
|
||||
#ifdef G4ANALYSIS_USE_LAB
|
||||
#include "G4LabSystem.hh"
|
||||
#endif
|
||||
#ifdef G4ANALYSIS_USE_LIZARD
|
||||
#include "G4LizardSystem.hh"
|
||||
#endif
|
||||
#include <AIDA/IAnalysisFactory.h>
|
||||
#include <AIDA/ITreeFactory.h>
|
||||
#include <AIDA/ITupleFactory.h>
|
||||
#include <AIDA/IHistogramFactory.h>
|
||||
#include <AIDA/ITree.h>
|
||||
#include <AIDA/IHistogram1D.h>
|
||||
#include <AIDA/ITuple.h>
|
||||
|
||||
#include "AnaEx01CalorHit.hh"
|
||||
#include "AnaEx01AnalysisManager.hh"
|
||||
|
||||
AnaEx01AnalysisManager::AnaEx01AnalysisManager(
|
||||
const G4String& aSystem
|
||||
)
|
||||
AnaEx01AnalysisManager::AnaEx01AnalysisManager()
|
||||
:fCalorimeterCollID(-1)
|
||||
,fAnalysisFactory(0)
|
||||
,fTree(0)
|
||||
,fEAbs(0)
|
||||
,fLAbs(0)
|
||||
,fEGap(0)
|
||||
,fLGap(0)
|
||||
,fTuple(0)
|
||||
{
|
||||
#ifdef G4ANALYSIS_USE_JAS
|
||||
RegisterAnalysisSystem(new G4JasSystem);
|
||||
#endif
|
||||
#ifdef G4ANALYSIS_USE_LAB
|
||||
RegisterAnalysisSystem(new G4LabSystem);
|
||||
#endif
|
||||
#ifdef G4ANALYSIS_USE_LIZARD
|
||||
RegisterAnalysisSystem(new G4LizardSystem);
|
||||
#endif
|
||||
// The factory and histograms will be deleted by the analysis manager.
|
||||
IHistogramFactory* hfactory = GetHistogramFactory(aSystem);
|
||||
if(!hfactory) return;
|
||||
fEAbs = hfactory->create1D("EAbs",100,0,100);
|
||||
fLAbs = hfactory->create1D("LAbs",100,0,100);
|
||||
fEGap = hfactory->create1D("EGap",100,0,10);
|
||||
fLGap = hfactory->create1D("LGap",100,0,100);
|
||||
fAnalysisFactory = AIDA_createAnalysisFactory();
|
||||
|
||||
// Could fail if no AIDA implementation found :
|
||||
if(!fAnalysisFactory) {
|
||||
G4cout << "AIDA analysis factory not found." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
ITreeFactory* treeFactory = fAnalysisFactory->createTreeFactory();
|
||||
if(!treeFactory) {
|
||||
delete fAnalysisFactory;
|
||||
fAnalysisFactory = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a "tree" to handle histograms.
|
||||
// This tree is associated to a ROOT "store" (in RECREATE mode).
|
||||
fTree = treeFactory->create("AnaEx01.root",false,false,"ROOT");
|
||||
|
||||
// Factories are not "managed" by an AIDA analysis system.
|
||||
// They must be deleted by the AIDA user code.
|
||||
delete treeFactory;
|
||||
|
||||
if(!fTree) {
|
||||
delete fAnalysisFactory;
|
||||
fAnalysisFactory = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
fTree->mkdir("histograms");
|
||||
fTree->cd("histograms");
|
||||
|
||||
// Create an histo factory that will create histo in the tree :
|
||||
IHistogramFactory* histoFactory =
|
||||
fAnalysisFactory->createHistogramFactory(*fTree);
|
||||
if(histoFactory) {
|
||||
fEAbs = histoFactory->create1D("EAbs",100,0,100);
|
||||
fLAbs = histoFactory->create1D("LAbs",100,0,100);
|
||||
fEGap = histoFactory->create1D("EGap",100,0,10);
|
||||
fLGap = histoFactory->create1D("LGap",100,0,100);
|
||||
delete histoFactory;
|
||||
}
|
||||
|
||||
fTree->cd("..");
|
||||
fTree->mkdir("tuples");
|
||||
fTree->cd("tuples");
|
||||
|
||||
// Get a tuple factory :
|
||||
ITupleFactory* tupleFactory =
|
||||
fAnalysisFactory->createTupleFactory(*fTree);
|
||||
if(tupleFactory) {
|
||||
|
||||
// Create a tuple :
|
||||
fTuple = tupleFactory->create("AnaEx01","AnaEx01","EAbs LAbs EGap LGap");
|
||||
|
||||
delete tupleFactory;
|
||||
}
|
||||
|
||||
}
|
||||
AnaEx01AnalysisManager::~AnaEx01AnalysisManager() {
|
||||
delete fAnalysisFactory;
|
||||
}
|
||||
|
||||
void AnaEx01AnalysisManager::BeginOfRun(const G4Run* aRun){
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
}
|
||||
|
||||
void AnaEx01AnalysisManager::EndOfRun(const G4Run*){
|
||||
Store();
|
||||
//if(fEAbs) Plot(fEAbs);
|
||||
if(fTree) fTree->commit();
|
||||
if(fEAbs) {
|
||||
G4cout << "Histo : EAbs : mean " << fEAbs->mean() << " rms : " << fEAbs->rms() << G4endl;
|
||||
G4cout << "Histo : LAbs : mean " << fLAbs->mean() << " rms : " << fLAbs->rms() << G4endl;
|
||||
G4cout << "Histo : EGap : mean " << fEGap->mean() << " rms : " << fEGap->rms() << G4endl;
|
||||
G4cout << "Histo : LGap : mean " << fLGap->mean() << " rms : " << fLGap->rms() << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
void AnaEx01AnalysisManager::BeginOfEvent(const G4Event*){
|
||||
@@ -94,9 +142,9 @@ void AnaEx01AnalysisManager::BeginOfEvent(const G4Event*){
|
||||
|
||||
void AnaEx01AnalysisManager::EndOfEvent(const G4Event* aEvent){
|
||||
if(!fEAbs) return; // No histo booked !
|
||||
//if(!fTuple) return; // No tuple booked !
|
||||
if(!fTuple) return; // No tuple booked !
|
||||
|
||||
G4int evtNb = aEvent->GetEventID();
|
||||
//G4int evtNb = aEvent->GetEventID();
|
||||
|
||||
G4HCofThisEvent* HCE = aEvent->GetHCofThisEvent();
|
||||
AnaEx01CalorHitsCollection* CHC =
|
||||
@@ -104,16 +152,21 @@ void AnaEx01AnalysisManager::EndOfEvent(const G4Event* aEvent){
|
||||
|
||||
if(CHC) {
|
||||
G4int n_hit = CHC->entries();
|
||||
//G4double totEAbs=0, totLAbs=0, totEGap=0, totLGap=0;
|
||||
for (G4int i=0;i<n_hit;i++) {
|
||||
//totEAbs += (*CHC)[i]->GetEdepAbs();
|
||||
//totLAbs += (*CHC)[i]->GetTrakAbs();
|
||||
//totEGap += (*CHC)[i]->GetEdepGap();
|
||||
//totLGap += (*CHC)[i]->GetTrakGap();
|
||||
fEAbs->fill((*CHC)[i]->GetEdepAbs());
|
||||
fLAbs->fill((*CHC)[i]->GetTrakAbs());
|
||||
fEGap->fill((*CHC)[i]->GetEdepGap());
|
||||
fLGap->fill((*CHC)[i]->GetTrakGap());
|
||||
G4double EAbs = (*CHC)[i]->GetEdepAbs();
|
||||
G4double LAbs = (*CHC)[i]->GetTrakAbs();
|
||||
G4double EGap = (*CHC)[i]->GetEdepGap();
|
||||
G4double LGap = (*CHC)[i]->GetTrakGap();
|
||||
fEAbs->fill(EAbs);
|
||||
fLAbs->fill(LAbs);
|
||||
fEGap->fill(EGap);
|
||||
fLGap->fill(LGap);
|
||||
|
||||
fTuple->fill(0,EAbs);
|
||||
fTuple->fill(1,LAbs);
|
||||
fTuple->fill(2,EGap);
|
||||
fTuple->fill(3,LGap);
|
||||
fTuple->addRow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01CalorHit.cc,v 1.1.1.1.4.1 2001/06/28 19:06:46 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01CalorHit.cc,v 1.3 2001/11/16 14:31:11 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01CalorimeterSD.cc,v 1.1.1.1.4.1 2001/06/28 19:06:46 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01CalorimeterSD.cc,v 1.3 2001/11/16 14:31:12 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01DetectorConstruction.cc,v 1.1.1.1.4.1 2001/06/28 19:06:46 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01DetectorConstruction.cc,v 1.3 2001/11/16 14:31:12 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01DetectorMessenger.cc,v 1.1.1.1.4.1 2001/06/28 19:06:46 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01DetectorMessenger.cc,v 1.3 2001/11/16 14:31:12 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01EventAction.cc,v 1.3.4.1 2001/06/28 19:06:46 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01EventAction.cc,v 1.5 2001/11/16 14:31:12 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01PhysicsList.cc,v 1.1.1.1.4.1 2001/06/28 19:06:46 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01PhysicsList.cc,v 1.3 2001/11/16 14:31:13 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01PrimaryGeneratorAction.cc,v 1.1.1.1.4.1 2001/06/28 19:06:46 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01PrimaryGeneratorAction.cc,v 1.3 2001/11/16 14:31:13 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01PrimaryGeneratorMessenger.cc,v 1.1.1.1.4.1 2001/06/28 19:06:46 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01PrimaryGeneratorMessenger.cc,v 1.3 2001/11/16 14:31:13 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01RunAction.cc,v 1.3.4.1 2001/06/28 19:06:46 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01RunAction.cc,v 1.5 2001/11/16 14:31:13 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01SteppingAction.cc,v 1.3.4.1 2001/06/28 19:06:46 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01SteppingAction.cc,v 1.5 2001/11/16 14:31:13 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01SteppingVerbose.cc,v 1.2.2.1 2001/06/28 19:06:46 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01SteppingVerbose.cc,v 1.4 2001/11/16 14:31:13 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: AnaEx01VisManager.cc,v 1.2.2.1 2001/06/28 19:06:46 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: AnaEx01VisManager.cc,v 1.4 2001/11/15 13:09:52 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 24th January 1998.
|
||||
@@ -36,18 +36,21 @@
|
||||
|
||||
// Supported drivers...
|
||||
|
||||
#ifdef G4VIS_USE_ASCIITREE
|
||||
// Not needing external packages or libraries...
|
||||
#include "G4ASCIITree.hh"
|
||||
#endif
|
||||
#include "G4DAWNFILE.hh"
|
||||
#include "G4GAGTree.hh"
|
||||
#include "G4HepRepFile.hh"
|
||||
#include "G4RayTracer.hh"
|
||||
#include "G4VRML1File.hh"
|
||||
#include "G4VRML2File.hh"
|
||||
|
||||
// Needing external packages or libraries...
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
#include "G4FukuiRenderer.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_DAWNFILE
|
||||
#include "G4DAWNFILE.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPACS
|
||||
#include "G4Wo.hh"
|
||||
#include "G4Xo.hh"
|
||||
@@ -76,20 +79,11 @@
|
||||
#include "G4OpenInventorWin32.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_RAYTRACER
|
||||
#include "G4RayTracer.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRML
|
||||
#include "G4VRML1.hh"
|
||||
#include "G4VRML2.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRMLFILE
|
||||
#include "G4VRML1File.hh"
|
||||
#include "G4VRML2File.hh"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
AnaEx01VisManager::AnaEx01VisManager () {}
|
||||
@@ -98,18 +92,21 @@ AnaEx01VisManager::AnaEx01VisManager () {}
|
||||
|
||||
void AnaEx01VisManager::RegisterGraphicsSystems () {
|
||||
|
||||
#ifdef G4VIS_USE_ASCIITREE
|
||||
// Graphics Systems not needing external packages or libraries...
|
||||
RegisterGraphicsSystem (new G4ASCIITree);
|
||||
#endif
|
||||
RegisterGraphicsSystem (new G4DAWNFILE);
|
||||
RegisterGraphicsSystem (new G4GAGTree);
|
||||
RegisterGraphicsSystem (new G4HepRepFile);
|
||||
RegisterGraphicsSystem (new G4RayTracer);
|
||||
RegisterGraphicsSystem (new G4VRML1File);
|
||||
RegisterGraphicsSystem (new G4VRML2File);
|
||||
|
||||
// Graphics systems needing external packages or libraries...
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
RegisterGraphicsSystem (new G4FukuiRenderer);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_DAWNFILE
|
||||
RegisterGraphicsSystem (new G4DAWNFILE);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_OPACS
|
||||
RegisterGraphicsSystem (new G4Wo);
|
||||
RegisterGraphicsSystem (new G4Xo);
|
||||
@@ -138,20 +135,11 @@ void AnaEx01VisManager::RegisterGraphicsSystems () {
|
||||
RegisterGraphicsSystem (new G4OpenInventorWin32);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_RAYTRACER
|
||||
RegisterGraphicsSystem (new G4RayTracer);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRML
|
||||
RegisterGraphicsSystem (new G4VRML1);
|
||||
RegisterGraphicsSystem (new G4VRML2);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRMLFILE
|
||||
RegisterGraphicsSystem (new G4VRML1File);
|
||||
RegisterGraphicsSystem (new G4VRML2File);
|
||||
#endif
|
||||
|
||||
if (fVerbose > 0) {
|
||||
G4cout <<
|
||||
"\nYou have successfully chosen to use the following graphics systems."
|
||||
|
||||
Reference in New Issue
Block a user