Import Geant4 9.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:37:50 +02:00
parent a8e9364cea
commit 96c8bcd0af
6923 changed files with 198390 additions and 41849 deletions
@@ -0,0 +1,36 @@
# $Id: GNUmakefile,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := monopole
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../../..
endif
.PHONY: all
all: lib bin
ifdef G4ANALYSIS_USE
CPPFLAGS += -DG4ANALYSIS_USE
endif
include $(G4INSTALL)/config/architecture.gmk
ifdef G4ANALYSIS_USE
# for the aida-config command see the README file
CPPFLAGS += `aida-config --include`
LOADLIBS += `aida-config --lib`
endif
include $(G4INSTALL)/config/binmake.gmk
visclean:
rm -f g4*.prim g4*.eps g4*.wrl
rm -f .DAWN_*
histclean:
rm ${G4WORKDIR}/tmp/${G4SYSTEM}/${G4TARGET}/RunAction.o
@@ -0,0 +1,20 @@
$Id: History,v 1.2 2007/08/16 12:57:59 vnivanch Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
monopol History file
--------------------
This file should be used by the G4 example coordinator to briefly
summarize all major modifications introduced in the code and keep
track of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
16 August 07: V.Ivant (monopole-V09-00-00)
- First release
@@ -0,0 +1,141 @@
$Id: README,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
monopole
--------
V.Ivanchenko, M.Vladymyrov
CERN, Geneva, Switzerland
Lebedev Physical Institute, Moscow, Russia
This example is devoted to the energy deposited by classical magnetic
monopole.
1- GEOMETRY DEFINITION
The geometry consists of a single block of a homogenous material,
placed in a world.
Four parameters define the geometry :
- the material of the box
- the thickness of the box
- the tranverse dimension of the box
- the maximal step size in target
The default is 10 cm of alumunium, step is limited by 5mm.
Equivalent UI commands are following:
/testex/det/setMat G4_Al
/testex/det/sizeX 10 cm
/testex/det/sizeYZ 5 cm
/testex/det/setStepSize 5 mm
The default geometry is constructed in DetectorConstruction class,
but all of the above parameters can be changed interactively via
the commands defined in the DetectorMessenger class. After changing
material and/or dimentions one must update the detector construction:
/testex/det/update
2- PHYSICS LIST
Physics Lists include standard QGSP physics and additional builder
for monopole physics.
3- AN EVENT : THE PRIMARY GENERATOR
The primary kinematic consists of a single particle which hits the
block perpendicular to the input face. The type of the particle
and its energy are set in the PrimaryGeneratorAction class, and can
changed via the G4 build-in commands of ParticleGun class (see
the macros provided with this example).
The default is monopole 100 GeV
In addition one can define randomly the impact point of the incident
particle. The corresponding interactive command is built in
PrimaryGeneratorMessenger class.
A RUN is a set of events.
4- VISUALIZATION
The Visualization Manager is set in the main() for interactive session.
The initialisation of the drawing is done via the command
/control/execute vis.mac
The detector has a default view which is a longitudinal view of the box.
The tracks are drawn at the end of event, and erased at the end of run.
Optionaly one can choose to draw all particles, only the charged one,
or none. This command is defined in EventActionMessenger class.
5- HOW TO START ?
- compile and link to generate an executable
% cd monopole
% gmake
- execute Test in 'batch' mode from macro files
% monopole monopole.in
- execute Test in 'interactive mode' with visualization
% monopole
....
Idle> type your commands
....
Idle> exit
6- HISTOGRAMS
The result is five histograms:
- Monopole eneregy deposition in current material
- dedx for proton
- dedx for monopole
- range for proton in current material
- range for monopole in current material
The histogram is saved in hbook (default monopole.hbook, but can be changed
using testex/run/HistoName and testex/run/HistoType comands)
Limit of bin size can be set with testex/run/binSize (default 5mm). Real size
is chosen as a minimal between this and step limit (see Geometry section)
Note that, by default, histograms are disabled. To activate them, uncomment
G4ANALYSIS_USE in GNUmakefile.
7- Using histograms
-------------------
By default the histograms are not activated. To activate histograms
the environment variable G4ANALYSIS_USE should be defined. For instance
uncomment the flag G4ANALYSIS_USE in GNUmakefile.
To use histograms any of implementations of AIDA interfaces should
be available (see http://aida.freehep.org).
A package including AIDA and extended interfaces also using Python
is PI, available from: http://cern.ch/pi .
Once installed PI or PI-Lite in a specified local area $MYPY, it is
required to add the installation path to $PATH, i.e. for example,
for release 1.2.1 of PI:
setenv PATH ${PATH}:$MYPI/1.2.1/app/releases/PI/PI_1_2_1/rh73_gcc32/bin
CERN users can use the PATH to the LCG area on AFS.
Before compilation of the example it is optimal to clean up old files:
gmake histclean
gmake
Before running the example the command should be issued:
eval `aida-config --runtime csh`
@@ -0,0 +1,100 @@
//
// ********************************************************************
// * 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: DetectorConstruction.hh,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
#include "G4ThreeVector.hh"
class G4LogicalVolume;
class G4Material;
class G4UniformMagField;
class DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
~DetectorConstruction();
public:
void SetSizeX (G4double);
void SetSizeYZ (G4double);
void SetMaterial (G4String);
void SetMagField (G4double);
void SetMaxStepSize (G4double);
G4VPhysicalVolume* Construct();
void UpdateGeometry();
public:
G4double GetWorldSizeX() {return worldSizeX;};
G4double GetWorldSizeYZ() {return worldSizeYZ;};
G4Material* GetWorldMaterial() {return worldMaterial;};
G4double GetAbsorSizeX() {return absorSizeX;};
G4double GetAbsorSizeYZ() {return absorSizeYZ;};
G4double GetMaxStepSize() {return maxStepSize;};
G4Material* GetAbsorMaterial() {return absorMaterial;};
void PrintParameters();
private:
G4double worldSizeX;
G4double worldSizeYZ;
G4Material* worldMaterial;
G4double absorSizeX;
G4double absorSizeYZ;
G4double maxStepSize;
G4Material* absorMaterial;
G4UniformMagField* magField;
G4LogicalVolume* lAbsor;
DetectorMessenger* detectorMessenger;
private:
void DefineMaterials();
G4VPhysicalVolume* ConstructVolumes();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * 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: DetectorMessenger.hh,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWith3VectorAndUnit;
class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorMessenger: public G4UImessenger
{
public:
DetectorMessenger(DetectorConstruction* );
~DetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
DetectorConstruction* Detector;
G4UIdirectory* detDir;
G4UIcmdWithAString* MaterCmd;
G4UIcmdWithADoubleAndUnit* SizeXCmd;
G4UIcmdWithADoubleAndUnit* SizeYZCmd;
G4UIcmdWithADoubleAndUnit* StepSizeCmd;
G4UIcmdWithADoubleAndUnit* MagFieldCmd;
G4UIcmdWithoutParameter* UpdateCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * 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: EventAction.hh,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef EventAction_h
#define EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class EventActionMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class EventAction : public G4UserEventAction
{
public:
EventAction();
~EventAction();
public:
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
void SetDrawFlag(G4String val) {drawFlag = val;};
void SetPrintModulo(G4int val) {printModulo = val;};
private:
G4String drawFlag;
G4int printModulo;
EventActionMessenger* eventMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * 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: EventActionMessenger.hh,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef EventActionMessenger_h
#define EventActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class EventAction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class EventActionMessenger: public G4UImessenger
{
public:
EventActionMessenger(EventAction*);
~EventActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
EventAction* eventAction;
G4UIdirectory* eventDir;
G4UIcmdWithAString* DrawCmd;
G4UIcmdWithAnInteger* PrintCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifndef G4Monopole_h
#define G4Monopole_h 1
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
//
// ClassName: G4Monopole
//
// Authors: 21.03.05 V.Ivanchenko
//
// Modified:
//
//----------------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4ParticleDefinition.hh"
#include "globals.hh"
// ######################################################################
// ### Monopole ###
// ######################################################################
class G4Monopole : public G4ParticleDefinition
{
private:
static G4Monopole* theMonopole;
G4Monopole(
const G4String& aName, G4double mass,
G4double width, G4double charge,
G4int iSpin, G4int iParity,
G4int iConjugation, G4int iIsospin,
G4int iIsospin3, G4int gParity,
const G4String& pType, G4int lepton,
G4int baryon, G4int encoding,
G4bool stable, G4double lifetime,
G4DecayTable *decaytable );
public:
virtual ~G4Monopole();
static G4Monopole* MonopoleDefinition(G4double mass_ = 100.*GeV,
G4int magCharge_ = 1,
G4int elCharge_ = 0);
static G4Monopole* Monopole();
static G4double MagneticCharge() {return magCharge;};
private:
static G4double magCharge;
};
#endif
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * 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: G4MonopolePhysics.hh,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef G4MonopolePhysics_h
#define G4MonopolePhysics_h 1
#include "G4VPhysicsConstructor.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4MonopolePhysics : public G4VPhysicsConstructor
{
public:
G4MonopolePhysics(const G4String& name = "EM_monopole");
virtual ~G4MonopolePhysics();
// This method is dummy for physics
virtual void ConstructParticle();
// This method will be invoked in the Construct() method.
// each physics process will be instantiated and
// registered to the process manager of each particle type
virtual void ConstructProcess();
private:
// hide assignment operator
G4MonopolePhysics & operator=(const G4MonopolePhysics &right);
G4MonopolePhysics(const G4MonopolePhysics&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * 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: PrimaryGeneratorAction.hh,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
#include "globals.hh"
class G4Event;
class DetectorConstruction;
class PrimaryGeneratorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction(DetectorConstruction*);
~PrimaryGeneratorAction();
public:
void SetRndmBeam(G4double val) {rndmBeam = val;}
void GeneratePrimaries(G4Event*);
void ResetEbeamCumul() {EbeamCumul = 0.;}
G4double GetEbeamCumul() {return EbeamCumul;}
G4ParticleGun* GetParticleGun() {return particleGun;}
private:
G4ParticleGun* particleGun;
DetectorConstruction* detector;
G4double rndmBeam;
G4double EbeamCumul;
PrimaryGeneratorMessenger* gunMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * 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: PrimaryGeneratorMessenger.hh,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PrimaryGeneratorMessenger_h
#define PrimaryGeneratorMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class PrimaryGeneratorAction;
class G4UIdirectory;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PrimaryGeneratorMessenger: public G4UImessenger
{
public:
PrimaryGeneratorMessenger(PrimaryGeneratorAction*);
~PrimaryGeneratorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
PrimaryGeneratorAction* Action;
G4UIdirectory* testexDir;
G4UIdirectory* gunDir;
G4UIcmdWithADoubleAndUnit* RndmCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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: RunAction.hh,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RunAction_h
#define RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
#include "QGSP.hh"
class DetectorConstruction;
class RunActionMessenger;
class PrimaryGeneratorAction;
class G4Run;
namespace AIDA {
class IAnalysisFactory;
class ITree;
class IHistogram1D;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class RunAction : public G4UserRunAction
{
public:
RunAction(DetectorConstruction* ,PrimaryGeneratorAction*);
virtual ~RunAction();
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
G4double GetBinLength() {return binLength;};
G4double GetOffsetX() {return offsetX;}
void SetBinSize(G4double size);
void FillHisto(G4int id, G4double x, G4double weight = 1.0);
void SetVerbose(G4int verbose) {verboseLevel = verbose;}
void SetHistoName(G4String name) {fname = name;}
void SetHistoType(G4String type) {ftype = type;}
G4int GetVerbose() {return verboseLevel;}
void AddProjRange (G4double x) {projRange += x; projRange2 += x*x;};
private:
void bookHisto();
void saveHisto();
DetectorConstruction* detector;
PrimaryGeneratorAction* kinematic;
RunActionMessenger* runActionMessenger;
G4int verboseLevel;
G4double binLength;
G4double offsetX;
G4double projRange, projRange2;
G4String ftype, fname;
AIDA::IAnalysisFactory* af;
AIDA::ITree* tree;
AIDA::IHistogram1D* histo[5];
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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: RunActionMessenger.hh,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RunActionMessenger_h
#define RunActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class RunAction;
class G4UIdirectory;
class G4UIcmdWithADouble;
class G4UIcmdWithAnInteger;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class RunActionMessenger: public G4UImessenger
{
public:
RunActionMessenger(RunAction* );
~RunActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
RunAction* runaction;
G4UIdirectory* actDir;
G4UIcmdWithADouble* binSizeCmd;
G4UIcmdWithAnInteger* verboseCmd;
G4UIcmdWithAString* histoNameCmd;
G4UIcmdWithAString* histoTypeCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * 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: SteppingAction.hh,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SteppingAction_h
#define SteppingAction_h 1
#include "G4UserSteppingAction.hh"
class DetectorConstruction;
class RunAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(DetectorConstruction*,RunAction*);
~SteppingAction();
void UserSteppingAction(const G4Step*);
private:
DetectorConstruction* detector;
RunAction* runAction;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * 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: TrackingAction.hh,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef TrackingAction_h
#define TrackingAction_h 1
#include "G4UserTrackingAction.hh"
#include "globals.hh"
class RunAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class TrackingAction : public G4UserTrackingAction {
public:
TrackingAction(RunAction*);
~TrackingAction() {};
void PostUserTrackingAction(const G4Track*);
private:
RunAction* runAction;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,122 @@
//
// ********************************************************************
// * 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: monopole.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "G4MonopolePhysics.hh"
#include "QGSP.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "TrackingAction.hh"
#include "SteppingAction.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv) {
//choose the Random engine
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
//Construct the default run manager
G4RunManager * runManager = new G4RunManager;
//set mandatory initialization classes
DetectorConstruction* det;
//ceate physicsList
QGSP* phys = new QGSP();
G4MonopolePhysics * theMonopole = new G4MonopolePhysics;
phys->RegisterPhysics(theMonopole);
PrimaryGeneratorAction* kin;
runManager->SetUserInitialization(det = new DetectorConstruction);
runManager->SetUserInitialization(phys);
runManager->SetUserAction(kin = new PrimaryGeneratorAction(det));
#ifdef G4VIS_USE
//visualization manager
G4VisManager* visManager = 0;
#endif
//set user action classes
RunAction* run;
runManager->SetUserAction(run = new RunAction(det, kin));
runManager->SetUserAction(new EventAction);
runManager->SetUserAction(new TrackingAction(run));
runManager->SetUserAction(new SteppingAction(det, run));
//get the pointer to the User Interface manager
G4UImanager* UI = G4UImanager::GetUIpointer();
G4cout << "User actions are instantiated" << G4endl;
if (argc == 1) // Define UI terminal for interactive mode
{
visManager = new G4VisExecutive();
visManager->Initialize();
G4UIsession* session = 0;
#ifdef G4UI_USE_TCSH
session = new G4UIterminal(new G4UItcsh);
#else
session = new G4UIterminal();
#endif
session->SessionStart();
delete session;
}
else // Batch mode
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UI->ApplyCommand(command+fileName);
}
//job termination
#ifdef G4VIS_USE
delete visManager;
#endif
delete runManager;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,25 @@
# 07.08.02 M Vladymyrov
# Macro file for "monopole.cc"
# (can be run in batch, without graphic)
#
#
/control/verbose 1
/run/verbose 0
/testex/run/verbose 1
/tracking/verbose 0
#
/testex/det/setMat G4_Si
/testex/det/setSizeX 10 cm
/testex/det/setSizeYZ 20 cm
/testex/det/setStepSize 0.2 mm
/testex/run/binSize 0.2 mm
#
/run/initialize
#
/process/eLoss/verbose 0
/testex/event/printModulo 10
#
/gun/particle monopole
/gun/energy 100 GeV
/run/beamOn 100
@@ -0,0 +1,84 @@
*************************************************************
Geant4 version Name: geant4-09-00-cand-03 (29-June-2007)
Copyright : Geant4 Collaboration
Reference : NIM A 506 (2003), 250-303
WWW : http://cern.ch/geant4
*************************************************************
<<< Geant4 Physics List engine packaging library: PACK 5.3
<<< Geant4 Physics List simulation engine: QGSP 3.3
***** Table : Nb of materials = 2 *****
Material: Air density: 1.290 kg/m3 temperature: 273.15 K pressure: 1.00 atm RadLength: 285.161 m
---> Element: Nitrogen (N) Z = 7.0 N = 14.0 A = 14.01 g/mole ElmMassFraction: 70.00 % ElmAbundance 72.71 %
---> Element: Oxygen (O) Z = 8.0 N = 16.0 A = 16.00 g/mole ElmMassFraction: 30.00 % ElmAbundance 27.29 %
Material: Galactic density: 0.000 kg/m3 temperature: 2.73 K pressure: 0.00 atm RadLength: 204322175.595 pc
---> Element: Galactic ( ) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 100.00 % ElmAbundance 100.00 %
Monopole is created: m(GeV)= 100 Qel= 0 Qmag= 68.518
User actions are instantiated
/run/verbose 0
/testex/run/verbose 1
/tracking/verbose 0
/testex/det/setMat G4_Si
/testex/det/setSizeX 10 cm
/testex/det/setSizeYZ 20 cm
/testex/det/setStepSize 0.2 mm
/testex/run/binSize 0.2 mm
/run/initialize
---------------------------------------------------------
---> The Absorber is 10 cm of G4_Si
---------------------------------------------------------
### Adding Neutron tracking cut for neutron
### cut value is 10 microseconds
G4MonopolePhysics::ConstructProcess
/process/eLoss/verbose 0
/testex/event/printModulo 10
/gun/particle monopole
/gun/energy 100 GeV
/run/beamOn 100
G4UHadronElasticProcess for neutron PDGcode= 2112 Elow(MeV)= 19 Elowest(eV)= 0
### Run 0 start.
--------- Ranecu engine status ---------
Initial seed (index) = 0
Current couple of seeds = 920957765, 580137259
----------------------------------------
---> Begin of Event: 0
---> Begin of Event: 10
---> Begin of Event: 20
---> Begin of Event: 30
---> Begin of Event: 40
---> Begin of Event: 50
---> Begin of Event: 60
---> Begin of Event: 70
---> Begin of Event: 80
---> Begin of Event: 90
The run consists of 100 monopole of 100 GeV through 10 cm of G4_Si (density: 2.33 g/cm3 )
projected Range= 7.6273 cm rms= 221.61 um
--------- Ranecu engine status ---------
Initial seed (index) = 0
Current couple of seeds = 1960403491, 168857775
----------------------------------------
@@ -0,0 +1,241 @@
//
// ********************************************************************
// * 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: DetectorConstruction.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4UniformMagField.hh"
#include "G4GeometryManager.hh"
#include "G4UserLimits.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4UnitsTable.hh"
#include "G4NistManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
{
// default parameter values
absorSizeX = absorSizeYZ = 10 * cm;
worldSizeX = worldSizeYZ = 1.2 * absorSizeX;
maxStepSize = 5 * mm;
worldMaterial = absorMaterial = 0;
magField = 0;
lAbsor = 0;
DefineMaterials();
SetMaterial("G4_Al");
// create commands for interactive definition of the detector
detectorMessenger = new DetectorMessenger(this);
}
DetectorConstruction::~DetectorConstruction()
{delete detectorMessenger;}
G4VPhysicalVolume* DetectorConstruction::Construct()
{ return ConstructVolumes();}
void DetectorConstruction::DefineMaterials()
{
/*********************** define Elements *********************/
G4double z, a;
G4Element* N = new G4Element("Nitrogen", "N", z= 7, a= 14.01*g/mole);
G4Element* O = new G4Element("Oxygen" , "O", z= 8, a= 16.00*g/mole);
/*********************** define Materials **********************/
G4double density, temperature, pressure;
G4int ncomponents;
G4double fractionmass;
G4Material* Air = new G4Material("Air" , density = 1.290 * mg/cm3, ncomponents=2);
Air->AddElement(N, fractionmass = 0.7);
Air->AddElement(O, fractionmass = 0.3);
density = universe_mean_density; //from PhysicalConstants.h
pressure = 3.e-18 * pascal;
temperature = 2.73 * kelvin;
G4Material* vacuum = new G4Material("Galactic", z = 1, a = 1.008 * g/mole, density,
kStateGas, temperature, pressure);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
//default materials
worldMaterial = vacuum;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
{
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
/**************************** World *****************************/
G4Box * sWorld = new G4Box("world", //name
worldSizeX / 2, worldSizeYZ / 2, worldSizeYZ / 2); //dimensions
G4LogicalVolume * lWorld = new G4LogicalVolume(sWorld, //shape
worldMaterial, //material
"world"); //name
G4VPhysicalVolume * pWorld = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
lWorld, //logical volume
"world", //name
0, //mother volume
false, //no boolean operation
0); //copy number
/************************** Absorber ***************************/
G4Box * sAbsor = new G4Box("Absorber", //name
absorSizeX / 2, absorSizeYZ / 2, absorSizeYZ / 2); //dimensions
lAbsor = new G4LogicalVolume(sAbsor, //shape
absorMaterial, //material
"Absorber"); //name
new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
lAbsor, //logical volume
"Absorber", //name
lWorld, //mother volume
false, //no boolean operation
0); //copy number
lAbsor->SetUserLimits(new G4UserLimits(maxStepSize));
PrintParameters();
/************ always return the World volume *****************/
return pWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::PrintParameters()
{
G4cout << "\n---------------------------------------------------------\n";
G4cout << "---> The Absorber is " << G4BestUnit(absorSizeX, "Length")
<< " of " << absorMaterial->GetName() << G4endl;
G4cout << "\n---------------------------------------------------------\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetSizeX(G4double value)
{
absorSizeX = value; worldSizeX = 1.2 * absorSizeX;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetSizeYZ(G4double value)
{
absorSizeYZ = value;
worldSizeYZ = 1.2 * absorSizeYZ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetMaterial(G4String materialChoice)
{
// search the material by its name
G4Material * pttoMaterial = G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
if (pttoMaterial) absorMaterial = pttoMaterial;
else G4cout << "Material does not exist in DB" << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
void DetectorConstruction::SetMagField(G4double fieldValue)
{
//apply a global uniform magnetic field along Z axis
G4FieldManager * fieldMgr = G4TransportationManager::GetTransportationManager()->GetFieldManager();
if (magField) delete magField; //delete the existing magn field
if (fieldValue != 0.) // create a new one if non nul
{
magField = new G4UniformMagField(G4ThreeVector(0., 0., fieldValue));
fieldMgr->SetDetectorField(magField);
fieldMgr->CreateChordFinder(magField);
}
else
{
magField = 0;
fieldMgr->SetDetectorField(magField);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetMaxStepSize(G4double step_)
{
maxStepSize = step_;
if(lAbsor) lAbsor->SetUserLimits(new G4UserLimits(maxStepSize));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4RunManager.hh"
void DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,126 @@
//
// ********************************************************************
// * 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: DetectorMessenger.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
:Detector(Det)
{
detDir = new G4UIdirectory("/testex/det/");
detDir->SetGuidance("detector construction commands");
MaterCmd = new G4UIcmdWithAString("/testex/det/setMat",this);
MaterCmd->SetGuidance("Select material of the box.");
MaterCmd->SetParameterName("choice",false);
MaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
SizeXCmd = new G4UIcmdWithADoubleAndUnit("/testex/det/setSizeX",this);
SizeXCmd->SetGuidance("Set sizeX of the absorber");
SizeXCmd->SetParameterName("SizeX",false);
SizeXCmd->SetRange("SizeX>0.");
SizeXCmd->SetUnitCategory("Length");
SizeXCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/testex/det/setSizeYZ",this);
SizeYZCmd->SetGuidance("Set sizeYZ of the absorber");
SizeYZCmd->SetParameterName("SizeYZ",false);
SizeYZCmd->SetRange("SizeYZ>0.");
SizeYZCmd->SetUnitCategory("Length");
SizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
StepSizeCmd = new G4UIcmdWithADoubleAndUnit("/testex/det/setStepSize",this);
StepSizeCmd->SetGuidance("Set maxStepSize in the absorber");
StepSizeCmd->SetParameterName("StepSize",false);
StepSizeCmd->SetRange("StepSize>0.");
StepSizeCmd->SetUnitCategory("Length");
StepSizeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testex/det/setField",this);
MagFieldCmd->SetGuidance("Define magnetic field.");
MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
MagFieldCmd->SetParameterName("Bz",false);
MagFieldCmd->SetUnitCategory("Magnetic flux density");
MagFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
UpdateCmd = new G4UIcmdWithoutParameter("/testex/det/update",this);
UpdateCmd->SetGuidance("Update calorimeter geometry.");
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
UpdateCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::~DetectorMessenger()
{
delete MaterCmd;
delete SizeXCmd;
delete SizeYZCmd;
delete StepSizeCmd;
delete MagFieldCmd;
delete UpdateCmd;
delete detDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == MaterCmd )
{ Detector->SetMaterial(newValue);}
if( command == SizeXCmd )
{ Detector->SetSizeX(SizeXCmd->GetNewDoubleValue(newValue));}
if( command == SizeYZCmd )
{ Detector->SetSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
if( command == MagFieldCmd )
{ Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
if( command == StepSizeCmd )
{ Detector->SetMaxStepSize(StepSizeCmd->GetNewDoubleValue(newValue));}
if( command == UpdateCmd )
{ Detector->UpdateGeometry();}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,89 @@
//
// ********************************************************************
// * 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: EventAction.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "EventAction.hh"
#include "EventActionMessenger.hh"
#include "G4Event.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction(): drawFlag("none"), printModulo(10000), eventMessenger(0)
{
eventMessenger = new EventActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::~EventAction()
{
delete eventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
//printing survey
if (evtNb % printModulo == 0)
G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::EndOfEventAction(const G4Event* evt)
{
if (G4VVisManager::GetConcreteInstance())
{
G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
for(G4int i=0; i<n_trajectories; i++)
{
G4Trajectory* trj = (G4Trajectory*) ((*(evt->GetTrajectoryContainer()))[i]);
if (drawFlag == "all")
trj->DrawTrajectory(1000);
else
if ((drawFlag == "charged") && (trj->GetCharge() != 0.))
trj->DrawTrajectory(1000);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * 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: EventActionMessenger.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "EventActionMessenger.hh"
#include "EventAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventActionMessenger::EventActionMessenger(EventAction* EvAct):eventAction(EvAct)
{
eventDir = new G4UIdirectory("/testex/event/");
eventDir->SetGuidance("event control");
DrawCmd = new G4UIcmdWithAString("/testex/event/drawTracks",this);
DrawCmd->SetGuidance("Draw the tracks in the event");
DrawCmd->SetGuidance(" Choice : none,charged, all");
DrawCmd->SetParameterName("choice",true);
DrawCmd->SetDefaultValue("all");
DrawCmd->SetCandidates("none charged all");
DrawCmd->AvailableForStates(G4State_Idle);
PrintCmd = new G4UIcmdWithAnInteger("/testex/event/printModulo",this);
PrintCmd->SetGuidance("Print events modulo n");
PrintCmd->SetParameterName("EventNb",false);
PrintCmd->SetRange("EventNb>0");
PrintCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventActionMessenger::~EventActionMessenger()
{
delete DrawCmd;
delete PrintCmd;
delete eventDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if(command == DrawCmd)
{eventAction->SetDrawFlag(newValue);}
if(command == PrintCmd)
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//---------------------------------------------------------------------------
//
// ClassName: G4Monopole
//
// Description:
//
// Authors: 21.03.05 V.Ivanchenko
//
// Modified:
//
//----------------------------------------------------------------------------
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4Monopole.hh"
#include "G4ParticleTable.hh"
// ######################################################################
// ### Monopole ###
// ######################################################################
G4Monopole* G4Monopole::theMonopole = 0;
G4double G4Monopole::magCharge = 0.0;
G4Monopole::G4Monopole(
const G4String& aName, G4double mass,
G4double width, G4double charge,
G4int iSpin, G4int iParity,
G4int iConjugation, G4int iIsospin,
G4int iIsospin3, G4int gParity,
const G4String& pType, G4int lepton,
G4int baryon, G4int encoding,
G4bool stable, G4double lifetime,
G4DecayTable *decaytable)
: G4ParticleDefinition( aName, mass, width, charge, iSpin, iParity,
iConjugation, iIsospin, iIsospin3, gParity, pType,
lepton, baryon, encoding, stable, lifetime, decaytable )
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4Monopole::~G4Monopole()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
// Arguments for constructor are as follows
// name mass width charge
// 2*spin parity C-conjugation
// 2*Isospin 2*Isospin3 G-parity
// type lepton number baryon number PDG encoding
// stable lifetime decay table
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4Monopole* G4Monopole::MonopoleDefinition(G4double mass, G4int mCharge, G4int eCharge)
{
if(!theMonopole) {
magCharge = eplus * G4double(mCharge) / fine_structure_const * 0.5;
theMonopole = new G4Monopole(
"monopole", mass, 0.0*MeV, eplus*G4double(eCharge),
0, 0, 0,
0, 0, 0,
"boson", 0, 0, 0,
true, -1.0, 0);
G4cout << "Monopole is created: m(GeV)= " << theMonopole->GetPDGMass()/GeV
<< " Qel= " << theMonopole->GetPDGCharge()/eplus
<< " Qmag= " << magCharge/eplus
<< G4endl;
}
return theMonopole;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4Monopole* G4Monopole::Monopole()
{
if(!theMonopole) theMonopole = MonopoleDefinition();
return theMonopole;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * 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: G4MonopolePhysics.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//---------------------------------------------------------------------------
//
// ClassName: G4MonopolePhysics
//
// Author: V.Ivanchenko 13.03.2005
//
// Modified:
//
//----------------------------------------------------------------------------
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Monopole.hh"
#include "G4MonopolePhysics.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4StepLimiter.hh"
#include "G4Transportation.hh"
#include "G4MultipleScattering.hh"
#include "G4mplIonisation.hh"
#include "G4hhIonisation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4MonopolePhysics::G4MonopolePhysics(const G4String& name): G4VPhysicsConstructor(name)
{}
G4MonopolePhysics::~G4MonopolePhysics()
{}
void G4MonopolePhysics::ConstructParticle()
{
G4Monopole::MonopoleDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MonopolePhysics::ConstructProcess()
{
// Add standard EM Processes for gamma
G4cout << "G4MonopolePhysics::ConstructProcess" << G4endl;
G4Monopole* mpl = G4Monopole::MonopoleDefinition();
G4ProcessManager* pmanager = new G4ProcessManager(mpl);
mpl->SetProcessManager(pmanager);
pmanager->AddProcess( new G4Transportation(), -1, 0, 0);
pmanager->AddProcess( new G4mplIonisation(mpl->MagneticCharge()), -1, 1, 1);
pmanager->AddProcess( new G4StepLimiter(), -1, -1, 3);
if(mpl->GetPDGCharge() != 0.0) {
pmanager->AddProcess(new G4hhIonisation(), -1, 2, 2);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * 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: PrimaryGeneratorAction.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* det)
:detector(det)
{
particleGun = new G4ParticleGun(1);
G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()->FindParticle("monopole");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleEnergy(100 * GeV);
particleGun->SetParticleMomentumDirection(G4ThreeVector(1., 0., 0.));
rndmBeam = 0.;
EbeamCumul = 0.;
//create a messenger for this class
gunMessenger = new PrimaryGeneratorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete particleGun;
delete gunMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
G4double x0 = -0.5*(detector->GetWorldSizeX());
G4double y0 = 0.*cm, z0 = 0.*cm;
//randomize the beam, if requested.
if (rndmBeam > 0.)
{
if (rndmBeam > detector->GetAbsorSizeYZ())
rndmBeam = detector->GetAbsorSizeYZ();
G4double rbeam = 0.5*rndmBeam;
y0 = (2*G4UniformRand()-1.)*rbeam;
z0 = (2*G4UniformRand()-1.)*rbeam;
}
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
particleGun->GeneratePrimaryVertex(anEvent);
EbeamCumul += particleGun->GetParticleEnergy();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,74 @@
//
// ********************************************************************
// * 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: PrimaryGeneratorMessenger.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PrimaryGeneratorMessenger.hh"
#include "PrimaryGeneratorAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorMessenger::PrimaryGeneratorMessenger(PrimaryGeneratorAction* Gun):Action(Gun)
{
testexDir = new G4UIdirectory("/testex/");
testexDir->SetGuidance(" detector control.");
gunDir = new G4UIdirectory("/testex/gun/");
gunDir->SetGuidance("gun control");
RndmCmd = new G4UIcmdWithADoubleAndUnit("/testex/gun/rndm", this);
RndmCmd->SetGuidance("random lateral extension on the beam");
RndmCmd->SetParameterName("rBeam", false);
RndmCmd->SetRange("rBeam>=0.");
RndmCmd->SetUnitCategory("Length");
RndmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorMessenger::~PrimaryGeneratorMessenger()
{
delete RndmCmd;
delete gunDir;
delete testexDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == RndmCmd)
{Action->SetRndmBeam(RndmCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,249 @@
//
// ********************************************************************
// * 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: RunAction.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "RunAction.hh"
#include "DetectorConstruction.hh"
#include "QGSP.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunActionMessenger.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
#include "Randomize.hh"
#include "G4EmCalculator.hh"
#ifdef G4ANALYSIS_USE
#include "AIDA/AIDA.h"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin):detector(det), kinematic(kin), af(0), tree(0)
{
verboseLevel = 0;
binLength = offsetX = 0.;
histo[0] = 0;
tree = 0;
af = 0;
#ifdef G4ANALYSIS_USE
// Creating the analysis factory
af = AIDA_createAnalysisFactory();
ftype = "hbook";
fname = "monopole";
#endif
// create commands for interactive definition of the detector
runActionMessenger = new RunActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::~RunAction()
{
#ifdef G4ANALYSIS_USE
delete af;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::bookHisto()
{
G4double length = detector->GetAbsorSizeX();
if(!binLength) binLength = 5 * mm;
if(binLength > detector->GetMaxStepSize()) binLength = detector->GetMaxStepSize();
G4int nbBins = (int)(0.5 + length / binLength);
offsetX = 0.5 * length;
#ifdef G4ANALYSIS_USE
if(GetVerbose() > 0) G4cout << "\n----> Histogram Tree opened" << G4endl;
// Create the tree factory
AIDA::ITreeFactory* tf = af->createTreeFactory();
// Create a tree mapped to an hbook file.
G4bool readOnly = false;
G4bool createNew = true;
//G4String ftype = "hbook";
//G4String fname = "monopole";
G4String fName = fname;
fName += ".";
fName += ftype;
G4String option = "--noErrors uncompress";
tree = tf->create(fName,ftype, readOnly, createNew, option);
// Create a histogram factory, whose histograms will be handled by the tree
AIDA::IHistogramFactory* hf = af->createHistogramFactory(*tree);
// Create histograms
histo[0] = hf->createHistogram1D("1","Edep (MeV/mm) along absorber (mm)", nbBins, 0, length);
histo[1] = hf->createHistogram1D("2","DEDX (MeV/mm) of proton", 100, -3., 7.);
histo[2] = hf->createHistogram1D("3","DEDX (MeV/mm) of monopole", 100, -3., 7.);
histo[3] = hf->createHistogram1D("4","Range(mm) of proton", 100, -3., 7.);
histo[4] = hf->createHistogram1D("5","Range(mm) of monopole", 100, -3., 7.);
delete tf;
delete hf;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::saveHisto()
{
#ifdef G4ANALYSIS_USE
tree->commit(); // Writing the histograms to the file
tree->close(); // and closing the tree (and the file)
delete tree;
tree = 0;
if(GetVerbose() > 0) G4cout << "\n----> Histogram Tree saved" << G4endl;
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::SetBinSize(G4double size)
{
binLength = size;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::FillHisto(G4int ih, G4double x, G4double weight)
{
#ifdef G4ANALYSIS_USE
if(histo[ih]) histo[ih]->fill(x, weight);
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::BeginOfRunAction(const G4Run* aRun)
{
if(GetVerbose() > 0) G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
// save Rndm status
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
CLHEP::HepRandom::showEngineStatus();
//initialize projected range, tallies, Ebeam, and book histograms
projRange = projRange2 = 0.;
kinematic->ResetEbeamCumul();
bookHisto();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::EndOfRunAction(const G4Run* aRun)
{
G4int NbofEvents = aRun->GetNumberOfEvent();
if (NbofEvents == 0) return;
//run conditions
//
G4Material* material = detector->GetAbsorMaterial();
G4double density = material->GetDensity();
G4String particle = kinematic->GetParticleGun()->GetParticleDefinition()->GetParticleName();
G4double energy = kinematic->GetParticleGun()->GetParticleEnergy();
if(GetVerbose() > 0){
G4cout << "\n The run consists of " << NbofEvents << " "<< particle << " of "
<< G4BestUnit(energy,"Energy") << " through "
<< G4BestUnit(detector->GetAbsorSizeX(),"Length") << " of "
<< material->GetName() << " (density: "
<< G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
};
//compute projected range and straggling
projRange /= NbofEvents; projRange2 /= NbofEvents;
G4double rms = projRange2 - projRange*projRange;
if (rms>0.) rms = std::sqrt(rms); else rms = 0.;
if(GetVerbose() > 0){
G4cout.precision(5);
G4cout << "\n projected Range= " << G4BestUnit(projRange, "Length")
<< " rms= " << G4BestUnit(rms, "Length")
<< G4endl;
};
G4double ekin[100], dedxproton[100], dedxmp[100];
G4EmCalculator calc;
calc.SetVerbose(0);
G4int i;
for(i = 0; i < 100; i++) {
ekin[i] = std::pow(10., 0.1*G4double(i)) * keV;
dedxproton[i] = calc.ComputeElectronicDEDX(ekin[i], "proton", material->GetName());
dedxmp[i] = calc.ComputeElectronicDEDX(ekin[i], "monopole", material->GetName());
}
if(GetVerbose() > 1){
G4cout << "### Stopping Powers" << G4endl;
for(i=0; i<100; i++) {
G4cout << " E(MeV)= " << ekin[i] << " dedxp= " << dedxproton[i]
<< " dedxmp= " << dedxmp[i]
<< G4endl;
}
};
#ifdef G4ANALYSIS_USE
// normalize histogram
G4double fac = (mm/MeV) / (NbofEvents * binLength);
histo[0]->scale(fac);
G4String matName = detector->GetAbsorMaterial()->GetName();
if(GetVerbose() > 0){
G4cout << "Range table for " << matName << G4endl;
};
for(i=0; i<100; i++) {
G4double e = std::log10(ekin[i] / MeV) + 0.05;
histo[1]->fill(e, dedxproton[i]);
histo[2]->fill(e, dedxmp[i]);
histo[3]->fill(e, std::log10(calc.GetRange(ekin[i], "proton", matName) / mm));
histo[4]->fill(e, std::log10(calc.GetRange(ekin[i], "monopole", matName) / mm));
}
#endif
// save and clean histo
saveHisto();
// show Rndm status
CLHEP::HepRandom::showEngineStatus();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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: RunActionMessenger.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "RunActionMessenger.hh"
#include "RunAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunActionMessenger::RunActionMessenger(RunAction * ra): runaction(ra)
{
actDir = new G4UIdirectory("/testex/run/");
actDir->SetGuidance("run commands");
binSizeCmd = new G4UIcmdWithADouble("/testex/run/binSize", this);
binSizeCmd->SetGuidance("Set bin size.");
binSizeCmd->SetParameterName("binSize", false);
binSizeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
verboseCmd = new G4UIcmdWithAnInteger("/testex/run/verbose", this);
verboseCmd->SetGuidance("Set verbose level.");
verboseCmd->SetParameterName("verbose", false);
verboseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
histoNameCmd = new G4UIcmdWithAString("/testex/run/HistoName", this);
histoNameCmd->SetGuidance("Set histo file name.");
histoNameCmd->SetParameterName("histoName", false);
histoNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
histoTypeCmd = new G4UIcmdWithAString("/testex/run/HistoType", this);
histoTypeCmd->SetGuidance("Set histo file type.");
histoTypeCmd->SetParameterName("histoType", false);
histoTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunActionMessenger::~RunActionMessenger()
{
delete binSizeCmd;
delete verboseCmd;
delete histoNameCmd;
delete histoTypeCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == binSizeCmd )
{ runaction->SetBinSize(binSizeCmd->GetNewDoubleValue(newValue));}
if( command == verboseCmd )
{ runaction->SetVerbose(verboseCmd->GetNewIntValue(newValue));}
if( command == histoNameCmd )
{ runaction->SetHistoName(newValue);}
if( command == histoTypeCmd )
{ runaction->SetHistoType(newValue);}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,65 @@
//
// ********************************************************************
// * 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: SteppingAction.cc,v 1.2 2007/12/10 16:28:17 gunter Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SteppingAction.hh"
#include "DetectorConstruction.hh"
#include "RunAction.hh"
#include "G4SteppingManager.hh"
#include "G4VProcess.hh"
#include "G4ParticleTypes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(DetectorConstruction* det,RunAction* RuAct):detector(det), runAction(RuAct)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::~SteppingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if (edep <= 0.) return;
//Bragg curve
G4StepPoint* prePoint = aStep->GetPreStepPoint();
G4StepPoint* postPoint = aStep->GetPostStepPoint();
G4double x = (prePoint->GetPosition().x() + postPoint->GetPosition().x()) * 0.5;
x += runAction->GetOffsetX();
runAction->FillHisto(0, x/mm , edep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,53 @@
//
// ********************************************************************
// * 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: TrackingAction.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-01 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "TrackingAction.hh"
#include "RunAction.hh"
#include "G4Track.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TrackingAction::TrackingAction(RunAction* run): runAction(run)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void TrackingAction::PostUserTrackingAction(const G4Track* aTrack)
{
// extract Projected Range of primary particle
if (aTrack->GetTrackID() == 1) {
G4double x = aTrack->GetPosition().x() + runAction->GetOffsetX();
runAction->AddProjRange(x);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......