Import Geant4 9.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:15:05 +02:00
parent b79225fb37
commit 74cad5e589
3877 changed files with 234205 additions and 167127 deletions
+9 -11
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01app.cc,v 1.8 2006/11/06 19:46:06 allison Exp $
// $Id: A01app.cc,v 1.9 2009/11/14 14:41:13 allison Exp $
// --------------------------------------------------------------
//
// --------------------------------------------------------------
@@ -36,10 +36,6 @@
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#ifdef G4UI_USE_TCSH
#include "G4UItcsh.hh"
#endif
#include "A01DetectorConstruction.hh"
#include "A01PhysicsList.hh"
@@ -51,6 +47,10 @@
#include "G4VisExecutive.hh"
#endif
#ifdef G4UI_USE
#include "G4UIExecutive.hh"
#endif
int main(int argc,char** argv)
{
// RunManager construction
@@ -86,13 +86,11 @@ int main(int argc,char** argv)
else
// start interactive session
{
#ifdef G4UI_USE_TCSH
G4UIsession* session = new G4UIterminal(new G4UItcsh);
#else
G4UIsession* session = new G4UIterminal();
#ifdef G4UI_USE
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
ui->SessionStart();
delete ui;
#endif
session->SessionStart();
delete session;
}
#ifdef G4VIS_USE
+1 -5
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.10 2006/11/10 21:04:51 duns Exp $
# $Id: GNUmakefile,v 1.11 2009/03/05 09:21:30 gbarrand Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module
# --------------------------------------------------------------
@@ -52,7 +52,3 @@ $(G4TMP)/$(G4SYSTEM)/$(name)/A01HadronPhysics.o: src/A01HadronPhysics.cc
@$(CXX) $(CXXFLAGS_WITHOUT_O) $(CPPFLAGS) -c $(OUT_OBJ)$@ src/A01HadronPhysics.cc
endif
ifdef G4ANALYSIS_USE
CPPFLAGS += `aida-config --include`
LDLIBS += `aida-config --lib`
endif
+22 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.43 2007/05/17 09:55:13 duns Exp $
$Id: History,v 1.48 2009/12/02 22:45:09 perl Exp $
-------------------------------------------------------------------
=========================================================
@@ -10,6 +10,27 @@ $Id: History,v 1.43 2007/05/17 09:55:13 duns Exp $
----------------------------------------------------------
---------------------------------------------------------------------------
2 Dec 2009 Joseph Perl (exampleA01-V09-02-02)
- A01MuonPhysics: change hMultipleScattering to MuMultipleScattering.
20 Mov 2009 Joseph Perl (exampleA01-V09-02-01)
- A01DetectorConstruction, A01MagneticField: improve handing of field.
Resolves bug 1012.
- A01Trajectory: removed. Example uses G4Trajectory.
- Update to new multiple scattering classes.
- README: General update.
Remove references to obsolete SLAC Geant4 tutorial CD.
14 Mov 2009 John Allison (exampleA01-V09-02-00)
- A01app.cc: Introduced G4UIExecutive.
5 March 2009 Guy Barrand
- GNUmakefile : remove the G4ANALYSIS_USE logic found in this file, since
it is handled already in the config/analysis.gmk.
This avoids a duplication in the compilation and link commands
of the aida-config options.
17 May 2007 - Mark Donszelmann (exampleA01-V08-03-01)
- Fixed memory leak for plotter
+18 -72
View File
@@ -1,4 +1,4 @@
$Id: README,v 1.9 2005/06/01 18:10:15 duns Exp $
$Id: README,v 1.10 2009/11/21 00:22:55 perl Exp $
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
@@ -9,9 +9,7 @@ $Id: README,v 1.9 2005/06/01 18:10:15 duns Exp $
Example A01 implements a double-arm spectrometer with wire chambers,
hodoscopes and calorimeters. Event simulation and collection are
enabled, as well as event display and analysis. This example is
extensively documented on the Geant4 Workshop Tutorial CD available at:
http://geant4.slac.stanford.edu/g4cd/Welcome.html
enabled, as well as event display and analysis.
1. GEOMETRY
@@ -71,8 +69,6 @@ $Id: README,v 1.9 2005/06/01 18:10:15 duns Exp $
are invoked in this example.
3. EVENT:
An event consists of the generation of a single particle which is
@@ -129,91 +125,41 @@ $Id: README,v 1.9 2005/06/01 18:10:15 duns Exp $
5. VISUALIZATION:
Simulated events can be displayed on top of a representation of
the spectrometer.
Simulated events can be displayed on top of a representation of the spectrometer.
vis.mac outputs HepRep version 1 files suitable for viewing in WIRED.
vis.mac outputs HepRep version 1 files suitable for viewing in HepRApp or WIRED4.
Change the /vis/open line from HepRepFile to DAWNFILE to instead
make .prim files suitable for viewing in DAWN.
heprep2-000-gz.mac outputs a series of gzipped HepRep version 2 files
each containing a single event, suitable for viewing in WIRED (there
is no need to ungzip them since WIRED can do this itself).
each containing a single event, suitable for viewing in HepRApp or WIRED4
heprep2zip.mac outputs a single zip file that unzips to a series of
HepRep version 2 files, each each containing a single event (unzip
the single file by hand, then view the resulting individial HepRep
files in WIRED 3).
the single file by hand, then view the resulting individial HepRep files).
heprep2-000-zip.mac outputs a series of zipped HepRep version 2 files
each containing a single event (not yet viewable in WIRED unless you
each containing a single event (not yet viewable unless you
explicitly unzip them before viewing).
heprep2.mac outputs a HepRep version 2 file with multiple events
appended to a single file in an experimental manner (not yet viewable
in WIRED).
appended to a single file in an experimental manner
heprep2gz.mac outputs a HepRep version 2 file with multiple events
appended to a single file in an experimental manner (not yet viewable
in WIRED).
appended to a single file in an experimental manner
Any of the heprep mac files above with the name bheprep (for instance
bheprep2zip.mac) will write a Binary HepRep version 2 file, readable
by WIRED 4.
WIRED 4 can read Binary HepRep and XML HepRep version 2 files without
the need for manual unzipping.
bheprep2zip.mac) will write a Binary HepRep version 2 file, readable only
by WIRED4 (not by HepRApp).
For more information on visualization with this A01 example,
see the visualization tutorials on the Geant4 Workshop Tutorial CD
available at:
http://geant4.slac.stanford.edu/g4cd/Welcome.html
6. ANALYSIS:
This example implements an AIDA-compliant analysis system which
creates histograms, ntuples and plotters. At the completion of a
simulation run a file A01.aida is produced which contains these
data structures. This file can be used as an input to the Java
Analysis Studio (JAS) which allows the histograms and ntuples to
examined, manipulated, saved and printed. For further details,
see README.JAIDA.
7. GETTING STARTED:
Build the A01 executable:
cd to A01
gmake clean
gmake
gmake will create tmp and bin directories in your work directory.
The executable, named A01app, will be in /bin/$G4SYSTEM/
While in directory A01, run the executable:
../bin/$G4SYSTEM/A01app
which will bring up the interactive prompt:
Idle>
To run 10 events you can now enter:
/run/beamOn 10
If all goes well, a JAS window will appear containing two histograms
and three scatterplots.
To terminate the job, at the prompt enter:
exit
Currently you must also close the JAS-AIDA window to get the job to stop.
In the A01 directory will be a file A01.aida which contains the plots.
To examine them
/usr/local.bin/jas3 & or jas3 &
creates histograms, ntuples and plotters. If you have built Geant4 with
the option to use anlaysis (answering yes to the appropriate question in
./Configure -build), then at the completion of a simulation run,
a file A01.aida is produced which contains these data structures.
This file can be used as an input to the Java Analysis Studio (JAS) which allows
the histograms and ntuples to examined, manipulated, saved and printed.
For further details, see README.JAIDA.
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01DetectorConstruction.hh,v 1.5 2006/06/29 16:30:50 gunter Exp $
// $Id: A01DetectorConstruction.hh,v 1.6 2009/11/21 00:22:55 perl Exp $
// --------------------------------------------------------------
//
@@ -33,6 +33,7 @@
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4RotationMatrix.hh"
#include "G4FieldManager.hh"
class G4VPhysicalVolume;
class G4Material;
@@ -60,6 +61,7 @@ class A01DetectorConstruction : public G4VUserDetectorConstruction
private:
A01DetectorConstMessenger* messenger;
A01MagneticField* magneticField;
G4FieldManager* fieldMgr;
G4Material* air;
G4Material* argonGas;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01EMPhysics.hh,v 1.6 2006/06/29 16:30:58 gunter Exp $
// $Id: A01EMPhysics.hh,v 1.7 2009/11/21 01:00:19 perl Exp $
// --------------------------------------------------------------
//
// 09-Oct-2003 Chhange gamma, electron, positorn process T. Koi
@@ -40,7 +40,7 @@
#include "G4PhotoElectricEffect.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4MultipleScattering.hh"
#include "G4eMultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01HadronPhysics.hh,v 1.6 2006/06/29 16:31:14 gunter Exp $
// $Id: A01HadronPhysics.hh,v 1.7 2009/11/21 01:00:19 perl Exp $
// --------------------------------------------------------------
//
// 10-Oct-2003 Full Hadron Processes with Parameterization Model T. Koi
@@ -35,7 +35,7 @@
#include "G4ios.hh"
#include "G4VPhysicsConstructor.hh"
#include "G4MultipleScattering.hh"
#include "G4hMultipleScattering.hh"
#include "G4hIonisation.hh"
// Hadronic Processes
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01IonPhysics.hh,v 1.7 2006/06/29 16:31:22 gunter Exp $
// $Id: A01IonPhysics.hh,v 1.8 2009/11/21 01:00:19 perl Exp $
// --------------------------------------------------------------
// 05-Jan-2004 Add G4ionIonisation T. Koi
//
@@ -50,7 +50,7 @@
#include "G4hIonisation.hh"
#include "G4ionIonisation.hh"
#include "G4MultipleScattering.hh"
#include "G4hMultipleScattering.hh"
class A01IonPhysics : public G4VPhysicsConstructor
{
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01MagneticField.hh,v 1.4 2006/06/29 16:31:27 gunter Exp $
// $Id: A01MagneticField.hh,v 1.5 2009/11/21 00:22:55 perl Exp $
// --------------------------------------------------------------
//
@@ -40,15 +40,12 @@ class A01MagneticField : public G4MagneticField
A01MagneticField();
~A01MagneticField();
virtual void GetFieldValue( const double Point[3],
double *Bfield ) const;
virtual void GetFieldValue(const G4double Point[4],double *Bfield ) const;
private:
A01MagneticFieldMessenger* messenger;
G4double By;
G4double rmax_sq;
G4double ymax;
public:
inline void SetField(G4double val) { By = val; }
inline G4double GetField() const { return By; }
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01MuonPhysics.hh,v 1.6 2006/06/29 16:31:31 gunter Exp $
// $Id: A01MuonPhysics.hh,v 1.8 2009/12/02 22:45:09 perl Exp $
// --------------------------------------------------------------
//
// 09-Oct-2003 mu+- tau+- processes are changed by T. Koi
@@ -36,7 +36,7 @@
#include "G4ios.hh"
#include "G4VPhysicsConstructor.hh"
#include "G4MultipleScattering.hh"
#include "G4MuMultipleScattering.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4MuIonisation.hh"
@@ -1,134 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01Trajectory.hh,v 1.6 2006/06/29 16:31:41 gunter Exp $
// --------------------------------------------------------------
//
class A01Trajectory;
#ifndef A01Trajectory_h
#define A01Trajectory_h 1
#include "G4VTrajectory.hh"
#include "G4Allocator.hh"
#include <stdlib.h> // Include from 'system'
#include "G4ios.hh" // Include from 'system'
#include <vector> //
#include <iostream> //
#include "globals.hh" // Include from 'global'
#include "G4ParticleDefinition.hh" // Include from 'particle+matter'
#include "G4TrajectoryPoint.hh" // Include from 'tracking'
#include "G4Track.hh"
#include "G4Step.hh"
typedef std::vector<G4VTrajectoryPoint*> A01TrajectoryPointContainer;
class G4Polyline; // Forward declaration.
///////////////////
class A01Trajectory : public G4VTrajectory
///////////////////
{
//--------
public:
//--------
// Constructor/Destrcutor
A01Trajectory();
A01Trajectory(const G4Track* aTrack);
A01Trajectory(A01Trajectory &);
virtual ~A01Trajectory();
// Operators
inline void* operator new(size_t);
inline void operator delete(void*);
inline int operator == (const A01Trajectory& right) const
{return (this==&right);}
// Get/Set functions
inline G4int GetTrackID() const
{ return fTrackID; }
inline G4int GetParentID() const
{ return fParentID; }
inline G4String GetParticleName() const
{ return ParticleName; }
inline G4double GetCharge() const
{ return PDGCharge; }
inline G4int GetPDGEncoding() const
{ return PDGEncoding; }
inline G4ThreeVector GetInitialMomentum() const
{ return InitialMomentum; }
// Other member functions
virtual void ShowTrajectory() const;
virtual void ShowTrajectory(std::ostream& o) const;
virtual void DrawTrajectory(G4int i_mode=0) const;
virtual void AppendStep(const G4Step* aStep);
virtual void MergeTrajectory(G4VTrajectory* secondTrajectory);
G4ParticleDefinition* GetParticleDefinition();
//---------
private:
//---------
A01TrajectoryPointContainer* positionRecord;
G4int fTrackID;
G4int fParentID;
G4ParticleDefinition* fpParticleDefinition;
G4String ParticleName;
G4double PDGCharge;
G4int PDGEncoding;
// FIXME not initialized !!!
G4ThreeVector InitialMomentum;
//---------
public:
//---------
virtual int GetPointEntries() const
{ return positionRecord->size(); }
virtual G4VTrajectoryPoint* GetPoint(G4int i) const
{ return (*positionRecord)[i]; }
};
extern G4Allocator<A01Trajectory> myTrajectoryAllocator;
inline void* A01Trajectory::operator new(size_t)
{
void* aTrajectory;
aTrajectory = (void*)myTrajectoryAllocator.MallocSingle();
return aTrajectory;
}
inline void A01Trajectory::operator delete(void* aTrajectory)
{
myTrajectoryAllocator.FreeSingle((A01Trajectory*)aTrajectory);
}
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01DetectorConstruction.cc,v 1.9 2006/06/29 16:32:22 gunter Exp $
// $Id: A01DetectorConstruction.cc,v 1.10 2009/11/21 00:22:55 perl Exp $
// --------------------------------------------------------------
//
@@ -31,10 +31,12 @@
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4Mag_UsualEqRhs.hh"
#include "G4Material.hh"
#include "G4Element.hh"
#include "G4MaterialTable.hh"
#include "G4NistManager.hh"
#include "G4VSolid.hh"
#include "G4Box.hh"
@@ -75,6 +77,7 @@ A01DetectorConstruction::A01DetectorConstruction()
{
messenger = new A01DetectorConstMessenger(this);
magneticField = new A01MagneticField();
fieldMgr = new G4FieldManager();
armRotation = new G4RotationMatrix();
armRotation->rotateY(armAngle);
}
@@ -83,6 +86,7 @@ A01DetectorConstruction::~A01DetectorConstruction()
{
delete armRotation;
delete magneticField;
delete fieldMgr;
delete messenger;
DestroyMaterials();
@@ -110,15 +114,13 @@ G4VPhysicalVolume* A01DetectorConstruction::Construct()
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
G4VSensitiveDetector* HadCalorimeter;
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ConstructMaterials();
// Magnetic field ----------------------------------------------------------
// Local Magnetic Field
static G4bool fieldIsInitialized = false;
if(!fieldIsInitialized)
{
G4FieldManager* fieldMgr
= G4TransportationManager::GetTransportationManager()->GetFieldManager();
fieldMgr->SetDetectorField(magneticField);
fieldMgr->CreateChordFinder(magneticField);
fieldIsInitialized = true;
@@ -132,10 +134,18 @@ G4VPhysicalVolume* A01DetectorConstruction::Construct()
G4VPhysicalVolume* worldPhysical
= new G4PVPlacement(0,G4ThreeVector(),worldLogical,"worldPhysical",0,0,0);
// magnetic field region
// Tube with Local Magnetic field
G4VSolid* magneticSolid = new G4Tubs("magneticTubs",0.,1.*m,1.*m,0.,360.*deg);
G4LogicalVolume* magneticLogical
= new G4LogicalVolume(magneticSolid,air,"magneticLogical",0,0,0);
G4NistManager* man = G4NistManager::Instance();
G4Material* G4_Galactic = man->FindOrBuildMaterial("G4_Galactic");
G4LogicalVolume* magneticLogical
= new G4LogicalVolume(magneticSolid,G4_Galactic,"magneticLogical",fieldMgr,0,0);
// ********
// placement of Tube
G4RotationMatrix* fieldRot = new G4RotationMatrix();
fieldRot->rotateX(90.*deg);
new G4PVPlacement(fieldRot,G4ThreeVector(),magneticLogical,
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01EMPhysics.cc,v 1.8 2006/06/29 16:32:30 gunter Exp $
// $Id: A01EMPhysics.cc,v 1.9 2009/11/21 01:00:19 perl Exp $
// --------------------------------------------------------------
//
//
@@ -72,7 +72,7 @@ void A01EMPhysics::ConstructProcess()
//Electorn
pManager = G4Electron::Electron()->GetProcessManager();
G4VProcess* theeminusMultipleScattering = new G4MultipleScattering();
G4VProcess* theeminusMultipleScattering = new G4eMultipleScattering();
G4VProcess* theeminusIonisation = new G4eIonisation();
G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
//
@@ -93,7 +93,7 @@ void A01EMPhysics::ConstructProcess()
//Positron
pManager = G4Positron::Positron()->GetProcessManager();
G4VProcess* theeplusMultipleScattering = new G4MultipleScattering();
G4VProcess* theeplusMultipleScattering = new G4eMultipleScattering();
G4VProcess* theeplusIonisation = new G4eIonisation();
G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01HadronPhysics.cc,v 1.8 2006/06/29 16:32:48 gunter Exp $
// $Id: A01HadronPhysics.cc,v 1.9 2009/11/21 01:00:19 perl Exp $
// --------------------------------------------------------------
//
// 09-Oct-2003 Hadron Physics List with Parameterization Model by T. Koi
@@ -73,7 +73,7 @@ void A01HadronPhysics::ConstructProcess()
thePionPlusInelasticProcess->RegisterMe(thePionPlusHEPModel);
pManager->AddDiscreteProcess(thePionPlusInelasticProcess);
G4VProcess* theppMultipleScattering = new G4MultipleScattering();
G4VProcess* theppMultipleScattering = new G4hMultipleScattering();
G4VProcess* theppIonisation = new G4hIonisation();
//
pManager->AddProcess(theppIonisation);
@@ -106,7 +106,7 @@ void A01HadronPhysics::ConstructProcess()
thePionMinusInelasticProcess->RegisterMe(thePionMinusHEPModel);
pManager->AddDiscreteProcess(thePionMinusInelasticProcess);
G4VProcess* thepmMultipleScattering = new G4MultipleScattering();
G4VProcess* thepmMultipleScattering = new G4hMultipleScattering();
G4VProcess* thepmIonisation = new G4hIonisation();
//
// add processes
@@ -140,7 +140,7 @@ void A01HadronPhysics::ConstructProcess()
theKaonPlusInelasticProcess->RegisterMe(theKaonPlusHEPModel);
pManager->AddDiscreteProcess(theKaonPlusInelasticProcess);
G4VProcess* thekpMultipleScattering = new G4MultipleScattering();
G4VProcess* thekpMultipleScattering = new G4hMultipleScattering();
G4VProcess* thekpIonisation = new G4hIonisation();
//
// add processes
@@ -175,7 +175,7 @@ void A01HadronPhysics::ConstructProcess()
theKaonMinusInelasticProcess->RegisterMe(theKaonMinusHEPModel);
pManager->AddDiscreteProcess(theKaonMinusInelasticProcess);
G4VProcess* thekmMultipleScattering = new G4MultipleScattering();
G4VProcess* thekmMultipleScattering = new G4hMultipleScattering();
G4VProcess* thekmIonisation = new G4hIonisation();
pManager->AddProcess(thekmIonisation);
@@ -247,7 +247,7 @@ void A01HadronPhysics::ConstructProcess()
theProtonInelasticProcess->RegisterMe(theProtonHEPModel);
pManager->AddDiscreteProcess(theProtonInelasticProcess);
G4VProcess* thepMultipleScattering = new G4MultipleScattering();
G4VProcess* thepMultipleScattering = new G4hMultipleScattering();
G4VProcess* thepIonisation = new G4hIonisation();
pManager->AddProcess(thepIonisation);
@@ -285,7 +285,7 @@ void A01HadronPhysics::ConstructProcess()
= new G4AntiProtonAnnihilationAtRest();
pManager->AddRestProcess(theAntiProtonAnnihilation);
G4VProcess* theapMultipleScattering = new G4MultipleScattering();
G4VProcess* theapMultipleScattering = new G4hMultipleScattering();
G4VProcess* theapIonisation = new G4hIonisation();
pManager->AddProcess(theapIonisation);
@@ -416,7 +416,7 @@ void A01HadronPhysics::ConstructProcess()
theSigmaPlusInelasticProcess->RegisterMe(theSigmaPlusHEPModel);
pManager->AddDiscreteProcess(theSigmaPlusInelasticProcess);
G4VProcess* thespMultipleScattering = new G4MultipleScattering();
G4VProcess* thespMultipleScattering = new G4hMultipleScattering();
G4VProcess* thespIonisation = new G4hIonisation();
pManager->AddProcess(thespIonisation);
@@ -450,7 +450,7 @@ void A01HadronPhysics::ConstructProcess()
theAntiSigmaPlusInelasticProcess->RegisterMe(theAntiSigmaPlusHEPModel);
pManager->AddDiscreteProcess(theAntiSigmaPlusInelasticProcess);
G4VProcess* theaspMultipleScattering = new G4MultipleScattering();
G4VProcess* theaspMultipleScattering = new G4hMultipleScattering();
G4VProcess* theaspIonisation = new G4hIonisation();
pManager->AddProcess(theaspIonisation);
@@ -484,7 +484,7 @@ void A01HadronPhysics::ConstructProcess()
theSigmaMinusInelasticProcess->RegisterMe(theSigmaMinusHEPModel);
pManager->AddDiscreteProcess(theSigmaMinusInelasticProcess);
G4VProcess* thesmMultipleScattering = new G4MultipleScattering();
G4VProcess* thesmMultipleScattering = new G4hMultipleScattering();
G4VProcess* thesmIonisation = new G4hIonisation();
pManager->AddProcess(thesmIonisation);
@@ -518,7 +518,7 @@ void A01HadronPhysics::ConstructProcess()
theAntiSigmaMinusInelasticProcess->RegisterMe(theAntiSigmaMinusHEPModel);
pManager->AddDiscreteProcess(theAntiSigmaMinusInelasticProcess);
G4VProcess* theasmMultipleScattering = new G4MultipleScattering();
G4VProcess* theasmMultipleScattering = new G4hMultipleScattering();
G4VProcess* theasmIonisation = new G4hIonisation();
pManager->AddProcess(theasmIonisation);
@@ -592,7 +592,7 @@ void A01HadronPhysics::ConstructProcess()
theXiMinusInelasticProcess->RegisterMe(theXiMinusHEPModel);
pManager->AddDiscreteProcess(theXiMinusInelasticProcess);
G4VProcess* thexmMultipleScattering = new G4MultipleScattering();
G4VProcess* thexmMultipleScattering = new G4hMultipleScattering();
G4VProcess* thexmIonisation = new G4hIonisation();
pManager->AddProcess(thexmIonisation);
@@ -626,7 +626,7 @@ void A01HadronPhysics::ConstructProcess()
theAntiXiMinusInelasticProcess->RegisterMe(theAntiXiMinusHEPModel);
pManager->AddDiscreteProcess(theAntiXiMinusInelasticProcess);
G4VProcess* theaxmMultipleScattering = new G4MultipleScattering();
G4VProcess* theaxmMultipleScattering = new G4hMultipleScattering();
G4VProcess* theaxmIonisation = new G4hIonisation();
pManager->AddProcess(theaxmIonisation);
@@ -660,7 +660,7 @@ void A01HadronPhysics::ConstructProcess()
theOmegaMinusInelasticProcess->RegisterMe(theOmegaMinusHEPModel);
pManager->AddDiscreteProcess(theOmegaMinusInelasticProcess);
G4VProcess* theomMultipleScattering = new G4MultipleScattering();
G4VProcess* theomMultipleScattering = new G4hMultipleScattering();
G4VProcess* theomIonisation = new G4hIonisation();
pManager->AddProcess(theomIonisation);
@@ -694,7 +694,7 @@ void A01HadronPhysics::ConstructProcess()
theAntiOmegaMinusInelasticProcess->RegisterMe(theAntiOmegaMinusHEPModel);
pManager->AddDiscreteProcess(theAntiOmegaMinusInelasticProcess);
G4VProcess* theaomMultipleScattering = new G4MultipleScattering();
G4VProcess* theaomMultipleScattering = new G4hMultipleScattering();
G4VProcess* theaomIonisation = new G4hIonisation();
pManager->AddProcess(theaomIonisation);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01IonPhysics.cc,v 1.9 2006/06/29 16:32:55 gunter Exp $
// $Id: A01IonPhysics.cc,v 1.10 2009/11/21 01:00:19 perl Exp $
// --------------------------------------------------------------
//
// 13-Oct-2003 Add Comment for Ionisation of Generic Ion by T. Koi
@@ -61,7 +61,7 @@ void A01IonPhysics::ConstructProcess()
pManager = G4GenericIon::GenericIon()->GetProcessManager();
// add process
G4VProcess* thegionMultipleScattering = new G4MultipleScattering();
G4VProcess* thegionMultipleScattering = new G4hMultipleScattering();
//
// G4hIonization may be not able to use for Geanric Ion in future
// Please take care using this physics list after v5.2.p02
@@ -99,7 +99,7 @@ void A01IonPhysics::ConstructProcess()
theDeuteronInelasticProcess->RegisterMe(theDeuteronLEPModel);
pManager->AddDiscreteProcess(theDeuteronInelasticProcess);
G4VProcess* thedueMultipleScattering = new G4MultipleScattering();
G4VProcess* thedueMultipleScattering = new G4hMultipleScattering();
G4VProcess* thedueIonisation = new G4hIonisation();
//
pManager->AddProcess(thedueIonisation);
@@ -131,7 +131,7 @@ void A01IonPhysics::ConstructProcess()
theTritonInelasticProcess->RegisterMe(theTritonLEPModel);
pManager->AddDiscreteProcess(theTritonInelasticProcess);
G4VProcess* thetriMultipleScattering = new G4MultipleScattering();
G4VProcess* thetriMultipleScattering = new G4hMultipleScattering();
G4VProcess* thetriIonisation = new G4hIonisation();
//
pManager->AddProcess(thetriIonisation);
@@ -163,7 +163,7 @@ void A01IonPhysics::ConstructProcess()
theAlphaInelasticProcess->RegisterMe(theAlphaLEPModel);
pManager->AddDiscreteProcess(theAlphaInelasticProcess);
G4VProcess* thealpMultipleScattering = new G4MultipleScattering();
G4VProcess* thealpMultipleScattering = new G4hMultipleScattering();
G4VProcess* thealpIonisation = new G4hIonisation();
//
pManager->AddProcess(thealpIonisation);
@@ -188,7 +188,7 @@ void A01IonPhysics::ConstructProcess()
thehe3ElasticProcess->RegisterMe(thehe3ElasticModel);
pManager->AddDiscreteProcess(thehe3ElasticProcess);
G4VProcess* thehe3MultipleScattering = new G4MultipleScattering();
G4VProcess* thehe3MultipleScattering = new G4hMultipleScattering();
G4VProcess* thehe3Ionisation = new G4hIonisation();
//
pManager->AddProcess(thehe3Ionisation);
@@ -23,31 +23,29 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01MagneticField.cc,v 1.6 2006/06/29 16:32:57 gunter Exp $
// $Id: A01MagneticField.cc,v 1.7 2009/11/21 00:22:55 perl Exp $
// --------------------------------------------------------------
//
#include "A01MagneticField.hh"
#include "A01MagneticFieldMessenger.hh"
#include "globals.hh"
A01MagneticField::A01MagneticField()
{
messenger = new A01MagneticFieldMessenger(this);
By = 1.0*tesla;
rmax_sq = sqr(1.*m);
ymax = 100.*cm;
}
A01MagneticField::~A01MagneticField()
{ delete messenger; }
void A01MagneticField::GetFieldValue(const double Point[3],double *Bfield) const
void A01MagneticField::GetFieldValue(const G4double [4],double *Bfield) const
{
Bfield[0] = 0.;
Bfield[2] = 0.;
if(std::abs(Point[1])<ymax && (sqr(Point[0])+sqr(Point[2]))<rmax_sq)
{ Bfield[1] = By; }
else
{ Bfield[1] = 0.; }
Bfield[1] = By;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01MuonPhysics.cc,v 1.8 2006/06/29 16:33:01 gunter Exp $
// $Id: A01MuonPhysics.cc,v 1.10 2009/12/02 22:45:09 perl Exp $
// --------------------------------------------------------------
//
// 09-Oct-2003 mu+- tau+- processes are changed by T. Koi
@@ -61,7 +61,7 @@ void A01MuonPhysics::ConstructProcess()
//Muon+
pManager = G4MuonPlus::MuonPlus()->GetProcessManager();
G4VProcess* thempMultipleScattering = new G4MultipleScattering();
G4VProcess* thempMultipleScattering = new G4MuMultipleScattering();
G4VProcess* thempBremsstrahlung = new G4MuBremsstrahlung();
G4VProcess* thempPairProduction = new G4MuPairProduction();
G4VProcess* thempIonisation = new G4MuIonisation();
@@ -86,7 +86,7 @@ void A01MuonPhysics::ConstructProcess()
//Muon-
pManager = G4MuonMinus::MuonMinus()->GetProcessManager();
G4VProcess* themmMultipleScattering = new G4MultipleScattering();
G4VProcess* themmMultipleScattering = new G4MuMultipleScattering();
G4VProcess* themmBremsstrahlung = new G4MuBremsstrahlung();
G4VProcess* themmPairProduction = new G4MuPairProduction();
G4VProcess* themmIonisation = new G4MuIonisation();
@@ -110,7 +110,7 @@ void A01MuonPhysics::ConstructProcess()
// Tau+ Physics
pManager = G4TauPlus::TauPlus()->GetProcessManager();
G4VProcess* thetpMultipleScattering = new G4MultipleScattering();
G4VProcess* thetpMultipleScattering = new G4MuMultipleScattering();
G4VProcess* thetpIonisation = new G4hIonisation();
//
// add processes
@@ -127,7 +127,7 @@ void A01MuonPhysics::ConstructProcess()
// Tau- Physics
pManager = G4TauMinus::TauMinus()->GetProcessManager();
G4VProcess* thetmMultipleScattering = new G4MultipleScattering();
G4VProcess* thetmMultipleScattering = new G4MuMultipleScattering();
G4VProcess* thetmIonisation = new G4hIonisation();
//
// add processes
@@ -1,184 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: A01Trajectory.cc,v 1.6 2006/06/29 16:33:11 gunter Exp $
// --------------------------------------------------------------
//
#include "A01Trajectory.hh"
#include "G4TrajectoryPoint.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleTypes.hh"
#include "G4ThreeVector.hh"
#include "G4Polyline.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4VVisManager.hh"
G4Allocator<A01Trajectory> myTrajectoryAllocator;
A01Trajectory::A01Trajectory()
{
fpParticleDefinition = 0;
ParticleName = "";
PDGCharge = 0;
PDGEncoding = 0;
fTrackID = 0;
fParentID = 0;
positionRecord = 0;
}
A01Trajectory::A01Trajectory(const G4Track* aTrack)
{
fpParticleDefinition = aTrack->GetDefinition();
ParticleName = fpParticleDefinition->GetParticleName();
PDGCharge = fpParticleDefinition->GetPDGCharge();
PDGEncoding = fpParticleDefinition->GetPDGEncoding();
fTrackID = aTrack->GetTrackID();
fParentID = aTrack->GetParentID();
positionRecord = new A01TrajectoryPointContainer();
positionRecord->push_back(new G4TrajectoryPoint(aTrack->GetPosition()));
}
A01Trajectory::A01Trajectory(A01Trajectory & right)
: G4VTrajectory()
{
ParticleName = right.ParticleName;
fpParticleDefinition = right.fpParticleDefinition;
PDGCharge = right.PDGCharge;
PDGEncoding = right.PDGEncoding;
fTrackID = right.fTrackID;
fParentID = right.fParentID;
positionRecord = new A01TrajectoryPointContainer();
for(int i=0;i<(int)right.positionRecord->size();i++)
{
G4TrajectoryPoint* rightPoint = (G4TrajectoryPoint*)((*(right.positionRecord))[i]);
positionRecord->push_back(new G4TrajectoryPoint(*rightPoint));
}
}
A01Trajectory::~A01Trajectory()
{
size_t i;
for(i=0;i<positionRecord->size();i++){
delete (*positionRecord)[i];
}
positionRecord->clear();
delete positionRecord;
}
void A01Trajectory::ShowTrajectory() const
{
G4cout << G4endl << "TrackID =" << fTrackID
<< ":ParentID=" << fParentID << G4endl;
G4cout << "Particle name : " << ParticleName
<< " Charge : " << PDGCharge << G4endl;
G4cout << " Current trajectory has " << positionRecord->size()
<< " points." << G4endl;
for( size_t i=0 ; i < positionRecord->size() ; i++){
G4TrajectoryPoint* aTrajectoryPoint = (G4TrajectoryPoint*)((*positionRecord)[i]);
G4cout << "Point[" << i << "]"
<< " Position= " << aTrajectoryPoint->GetPosition() << G4endl;
}
}
void A01Trajectory::ShowTrajectory(std::ostream& o) const
{
G4VTrajectory::ShowTrajectory(o);
}
void A01Trajectory::DrawTrajectory(G4int /*i_mode*/) const
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
G4ThreeVector pos;
G4Polyline pPolyline;
for (int i = 0; i < (int)positionRecord->size() ; i++) {
G4TrajectoryPoint* aTrajectoryPoint = (G4TrajectoryPoint*)((*positionRecord)[i]);
pos = aTrajectoryPoint->GetPosition();
pPolyline.push_back( pos );
}
G4Colour colour(0.75,0.75,0.75); // LightGray
if(fpParticleDefinition==G4Gamma::GammaDefinition())
colour = G4Colour(0.,1.,1.); // Cyan
else if(fpParticleDefinition==G4Electron::ElectronDefinition()
||fpParticleDefinition==G4Positron::PositronDefinition())
colour = G4Colour(1.,1.,0.); // Yellow
else if(fpParticleDefinition==G4MuonMinus::MuonMinusDefinition()
||fpParticleDefinition==G4MuonPlus::MuonPlusDefinition())
colour = G4Colour(1.,0.,1.); // Magenta
else if(fpParticleDefinition->GetParticleType()=="meson")
{
if(PDGCharge!=0.)
colour = G4Colour(1.,0.,0.); // Red
else
colour = G4Colour(0.5,0.,0.); // HalfRed
}
else if(fpParticleDefinition->GetParticleType()=="baryon")
{
if(PDGCharge!=0.)
colour = G4Colour(1.,0.78,0.); // Orange
else
colour = G4Colour(0.5,0.39,0.);// HalfOrange
}
G4VisAttributes attribs(colour);
pPolyline.SetVisAttributes(attribs);
if(pVVisManager) pVVisManager->Draw(pPolyline);
}
void A01Trajectory::AppendStep(const G4Step* aStep)
{
positionRecord->push_back( new G4TrajectoryPoint(aStep->GetPostStepPoint()->
GetPosition() ));
}
G4ParticleDefinition* A01Trajectory::GetParticleDefinition()
{
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
}
void A01Trajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
{
if(!secondTrajectory) return;
A01Trajectory* seco = (A01Trajectory*)secondTrajectory;
G4int ent = seco->GetPointEntries();
for(int i=1;i<ent;i++) // initial point of the second trajectory should not be merged
{
positionRecord->push_back((*(seco->positionRecord))[i]);
}
delete (*seco->positionRecord)[0];
seco->positionRecord->clear();
}
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.2 2003/12/03 10:34:02 gcosmo Exp $
# $Id: GNUmakefile,v 1.3 2009/03/05 09:20:52 gbarrand Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
@@ -15,10 +15,3 @@ endif
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
ifdef G4ANALYSIS_USE
CPPFLAGS += `aida-config --include`
LDFLAGS += `aida-config --lib`
LOADLIBS += `aida-config --lib`
endif
+18 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.15 2006/08/16 15:43:44 gcosmo Exp $
$Id: History,v 1.18 2009/05/13 08:46:37 gbarrand Exp $
--------------------------------------------------
=========================================================
@@ -15,6 +15,23 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
13 May 2009 Guy Barrand (AnaEx01-V09-02-00)
- Tagged all changes.
13 May 2009 Guy Barrand
- update the README.
- remove the content of the analysis/[Falsetto,jas,Lab] directories.
In fact the analysis directory should not be distributed anymore.
- have a run.mac in the main example directory.
- AnaEx01AnalysisManager : arrange to have histo and tuple name
as interger in case of hbook file format.
5 March 2009 Guy Barrand
- GNUmakefile : remove the G4ANALYSIS_USE logic found in this file, since
it is handled already in the config/analysis.gmk.
This avoids a duplication in the compilation and link commands
of the aida-config options.
16th August 2006 Gabriele Cosmo (AnaEx01-V08-01-00)
- Corrected text in README for AIDA setup.
+62 -94
View File
@@ -1,4 +1,4 @@
$Id: README,v 1.15 2006/08/16 15:42:16 gcosmo Exp $
$Id: README,v 1.16 2009/05/13 08:32:36 gbarrand Exp $
-------------------------------------------------------------------
=========================================================
@@ -10,103 +10,71 @@ $Id: README,v 1.15 2006/08/16 15:42:16 gcosmo Exp $
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.
(attaching an AIDA implementation, histo booking, filling, saving
histos in a file, etc...) are concentrated in one class :
AnaEx01AnalysisManager.
To use an AIDA compliant analysis system with this example, the environment
variables :
To include the analysis code, the environment variable
G4ANALYSIS_USE
G4ANALYSIS_AIDA_CONFIG_CFLAGS
G4ANALYSIS_AIDA_CONFIG_LIBS
must be properly set.
must be defined before doing "make". If not, at run time, no
histograms and file will be created.
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.
For example, a typical session from a UNIX csh flavoured shell is :
csh> source <aida tool>/aida-setup.csh
csh> setenv G4ANALYSIS_USE 1
csh> make
csh> ${G4BIN}/${G4SYSTEM}/AnaEx01
After execution, a file AnaEx01.aida should have been created.
Someone can change the default file format by changing the
value of the std::string variable format in the AnaEx01AnalysisManager
constructor :
// File format :
std::string format("xml");
//std::string format("hbook");
//std::string format("root");
Working with the OpenScientist packages :
---------------------------------------
To create the analysis file, you can install the light "osc_batch"
binary kit (See http://OpenScientist.lal.in2p3.fr ). For example
from a UNIX sh flavoured shell :
sh> cd /usr/local
sh> <arrange to be su>
sh> <get an osc_batch binary kit>
sh> unzip -q osc_batch<platform>.zip
sh> cd osc_batch/<version>
sh> ./install
Then you build the example with :
<create another terminal>
csh> source /usr/local/osc_batch/<version>/aida-setup.csh
csh> <source setup Geant4>
csh> setenv G4ANALYSIS_USE 1
csh> cd <G4_install_path>/examples/extended/analysis/AnaEx01
csh> make
csh> ${G4BIN}/${G4SYSTEM}/AnaEx01
Depending of the file format, you can visualize the produced
file with various interactive tools (CERN/PAW, CERN/ROOT, jas).
But if installing also an OpenScientist osc_vis binary kit,
you shall be able to visualize all formats by using
the osc-plot program. To install an osc_vis kit :
sh> cd /usr/local
sh> <arrange to be su>
sh> <get an osc_vis binary kit>
sh> unzip -q osc_vis<platform>.zip
sh> cd osc_vis/<version>
sh> ./install
Then to browse the AnaEx01.<format> file (for exa from an UNIX sh shell) :
<create another terminal>
sh> . /usr/local/osc_vis/<version>/setup.sh
sh> <setenv DISPLAY if needed>
sh> osc-plot AnaEx01.[aida,root,hbook]
The variable G4ANALYSIS_USE must be defined in the environment, and the
the system properly configured to use one of the AIDA compliant analysis
tools (i.e. path set to retrieve the 'aida-config' command).
The OpenScientist URL is :
http://OpenScientist.lal.in2p3.fr.
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> cd $G4INSTALL/examples/extended/analysis/AnaEx01
csh> gmake
Note that OpenScientist is installed on CERN/lxplus under :
/afs/cern.ch/sw/contrib/[osc_batch,osc_vis].
To run :
csh> cd analyis/Lab
csh> $G4WORKDIR/bin/$G4SYSTEM/AnaEx01
It must produce an AnaEx01.aida file that contains some histograms
and a tuple.
To plot some histograms, spawn the Lab interactive tool with :
csh> onx
(DOS> onx (for Windows))
click in 'File/Open AIDA file...' to map a file chooser,
then choose AnaEx01.aida. The file name should appear in the left
tree widget beside the plotting area. Use the tree widget to browse
the file. You can visualize histos by selecting them with the mouse.
If the OpenScientist/OnX and Lab Python drivers had been
reconstructed at installation of OpenScientist, then
you can also work with the OpenScientist/Lab/AIDA Python API.
You can execute AnaEx01.py by doing :
OS> python AnaEx01.py
or :
OS> python
(>>> import AIDA)
>>> import AnaEx01
The AnaEx01 file contains a Python script that
does some analysis over the AnaEx01.aida file by using the AIDA interfaces.
This script gets an histo (EAbs) and plots it in a first drawing region.
Then it gets the 'AnaEx01' tuple, books and fills another histo
from the tuple colum 'EAbs' and plots it a secon drawing region.
If exporting a AnaEx01.root file (see src/AnaEx01AnalysisManager.cc),
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://OpenScientist.lal.in2p3.fr.
OpenScientist is installed at CERN under /afs/cern.ch/sw/contrib.
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> cd $G4INSTALL/examples/extended/analysis/AnaEx01
csh> gmake
To run :
csh> cd analyis/Falsetto
csh> $G4WORKDIR/bin/$G4SYSTEM/AnaEx01
At the beginning of output ;should appear :
AIDA analysis factory not found.
The Falsetto URL is : http://www.lal.in2p3.fr/SI/Falsetto
Falsetto is installed at CERN under /afs/cern.ch/sw/contrib.
@@ -1,25 +0,0 @@
//
// To do some analysis over the AnaEx01.root file with the ROOT tool.
//
// Note that .root is not the default file format and that someone has
// to ask for an export of a ROOT file in the AnaEx01AnalysisManager.cc
// constructor.
//
// 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();
}
@@ -1,123 +0,0 @@
#
# ********************************************************************
# * DISCLAIMER *
# * *
# * The following disclaimer summarizes all the specific disclaimers *
# * of contributors to this software. The specific disclaimers,which *
# * govern, are listed with their locations in: *
# * http://cern.ch/geant4/license *
# * *
# * Neither the authors of this software system, nor their employing *
# * institutes,nor the agencies providing financial support for this *
# * work make any representation or warranty, express or implied, *
# * regarding this software system or assume any liability for its *
# * use. *
# * *
# * This code implementation is the intellectual property of the *
# * GEANT4 collaboration. *
# * By copying, distributing or modifying the Program (or any work *
# * based on the Program) you indicate your acceptance of this *
# * statement, and all its terms. *
# ********************************************************************
#
#/////////////////////////////////////////////////////////////////////////////
#/////////////////////////////////////////////////////////////////////////////
#/////////////////////////////////////////////////////////////////////////////
#
# Example of a Python script using the AnaEx01.aida file.
#
#/////////////////////////////////////////////////////////////////////////////
#
# To be executed from the Python shell :
# OS> <setup Lab>
# OS> python
# (>>> import AIDA)
# >>> import AnaEx01
#
from AIDA import AIDA_createAnalysisFactory
aida = AIDA_createAnalysisFactory()
# Get some AIDA factories :
plotterFactory = aida.createPlotterFactory()
treeFactory = aida.createTreeFactory()
memoryTree = treeFactory.createDefault()
histogramFactory = aida.createHistogramFactory(memoryTree)
# Attach the current plotter :
plotter = plotterFactory.create('')
plotter.createRegions(1,2,0)
plotter.setParameter('title','AnaEx01 analysis')
tree = treeFactory.create('AnaEx01.aida','xml',1,0)
tree.ls()
#/////////////////////////////////////////////////////////////////////////////
# In first region, get and plot the EAbs histo :
#/////////////////////////////////////////////////////////////////////////////
tree.cd('histograms')
tree.ls()
# From an AIDA tree we retreive IManagedObjects, we have to cast.
#FIXME : IManagedObject_to_IHistogram1D is not AIDA, it is OSC specific.
from AIDA import IManagedObject_to_IHistogram1D
EAbs = IManagedObject_to_IHistogram1D(tree.find('EAbs'))
if EAbs == None:
print 'EAbs not found or is not an AIDA::IHistogram1D.'
else :
# Plot the histo :
region = plotter.currentRegion()
region.plot(EAbs)
#/////////////////////////////////////////////////////////////////////////////
# In second region plot the EAbs histo built from the tuple :
#/////////////////////////////////////////////////////////////////////////////
tree.cd('..')
tree.cd('tuples')
tree.ls()
tupleFactory = aida.createTupleFactory(tree)
# Get a tuple from the tree :
#tuple = tupleFactory.create('AnaEx01','AnaEx01','')
from AIDA import IManagedObject_to_ITuple
tuple = IManagedObject_to_ITuple(tree.find('AnaEx01'))
if tuple == None:
print 'Tuple AnaEx01 not found or is not an AIDA::ITuple.'
# Create an histo in the default memory tree :
tuple_EAbs = histogramFactory.createHistogram1D('tuple_EAbs','AnaEx01/EAbs',100,0,100)
# Create an Evaluator and a Filter object :
evaluator = tupleFactory.createEvaluator('EAbs')
evaluator.initialize(tuple)
filter = tupleFactory.createFilter('')
filter.initialize(tuple)
# Project tuple AnaEx01/EAbs column on the tuple_EAbs histo :
tuple.project(tuple_EAbs,evaluator,filter)
plotter.next()
region = plotter.currentRegion()
region.plot(tuple_EAbs)
plotter.show()
plotter.interact()
del evaluator
del filter
print 'The two histos must give the same information !'
del tupleFactory
del tree
del plotter
del region
del plotterFactory
del treeFactory
del histogramFactory
@@ -1,19 +0,0 @@
#
# 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
@@ -1,19 +0,0 @@
#
# 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 10000
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: AnaEx01AnalysisManager.cc,v 1.16 2006/06/29 16:33:42 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: AnaEx01AnalysisManager.cc,v 1.18 2009/05/13 08:33:17 gbarrand Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
//
// Guy Barrand 14th Septembre 2000.
@@ -69,18 +69,59 @@ AnaEx01AnalysisManager::AnaEx01AnalysisManager(AIDA::IAnalysisFactory* aAIDA)
if(!treeFactory) return;
// Create a tree-like container to handle histograms.
// This tree is associated to a AnaEx01.aida file.
//std::string opts = "compress=yes";
std::string opts = "compress=no";
fTree = treeFactory->create("AnaEx01.aida","xml",false,true,opts);
//std::string opts = "export=root";
//fTree = treeFactory->create("AnaEx01.root","ROOT",false,true,opts);
// This tree is associated to a AnaEx01.<format> file.
std::string h_name_EAbs("EAbs");
std::string h_name_LAbs("LAbs");
std::string h_name_EGap("EGap");
std::string h_name_LGap("LGap");
std::string t_name("AnaEx01");
// File format :
std::string format("xml");
//std::string format("hbook");
//std::string format("root");
std::string file("AnaEx01");
std::string ext;
ext = "."+format;
std::string opts;
if(format=="hbook") {
opts = "compress=no";
h_name_EAbs = "1";
h_name_LAbs = "2";
h_name_EGap = "3";
h_name_LGap = "4";
t_name = "101";
} else if(format=="root") {
opts = "compress=yes";
} else if(format=="xml") {
ext = ".aida";
opts = "compress=no";
} else {
G4cout << "storage format \"" << format << "\""
<< " not handled in this example."
<< G4endl;
return;
}
file += ext;
fTree = treeFactory->create(file,format,false,true,opts);
// Factories are not "managed" by an AIDA analysis system.
// They must be deleted by the AIDA user code.
delete treeFactory;
if(!fTree) return;
if(!fTree) {
G4cout << "can't create tree associated to file \"" << file << "\"."
<< G4endl;
return;
}
fTree->mkdir("histograms");
fTree->cd("histograms");
@@ -89,10 +130,14 @@ AnaEx01AnalysisManager::AnaEx01AnalysisManager(AIDA::IAnalysisFactory* aAIDA)
AIDA::IHistogramFactory* histoFactory =
fAIDA->createHistogramFactory(*fTree);
if(histoFactory) {
fEAbs = histoFactory->createHistogram1D("EAbs",100,0,100);
fLAbs = histoFactory->createHistogram1D("LAbs",100,0,100);
fEGap = histoFactory->createHistogram1D("EGap",100,0,10);
fLGap = histoFactory->createHistogram1D("LGap",100,0,100);
fEAbs = histoFactory->createHistogram1D(h_name_EAbs,"EAbs",100,0,100);
if(!fEAbs) G4cout << "can't create histo EAbs." << G4endl;
fLAbs = histoFactory->createHistogram1D(h_name_LAbs,"LAbs",100,0,100);
if(!fLAbs) G4cout << "can't create histo LAbs." << G4endl;
fEGap = histoFactory->createHistogram1D(h_name_EGap,"EGap",100,0,10);
if(!fEGap) G4cout << "can't create histo EGap." << G4endl;
fLGap = histoFactory->createHistogram1D(h_name_LGap,"LGap",100,0,100);
if(!fLGap) G4cout << "can't create histo LGap." << G4endl;
delete histoFactory;
}
@@ -105,12 +150,14 @@ AnaEx01AnalysisManager::AnaEx01AnalysisManager(AIDA::IAnalysisFactory* aAIDA)
if(tupleFactory) {
// Create a tuple :
fTuple = tupleFactory->create("AnaEx01","AnaEx01",
fTuple = tupleFactory->create(t_name,"AnaEx01",
"double EAbs,double LAbs,double EGap,double LGap");
if(!fTuple) G4cout << "can't create tuple." << G4endl;
delete tupleFactory;
}
fTree->cd("..");
}
AnaEx01AnalysisManager::~AnaEx01AnalysisManager() {
}