Import Geant4 11.0.0 source tree
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
add_subdirectory(module)
|
||||
configure_file(test.py test.py)
|
||||
add_test(NAME geant4py-test01 COMMAND ${PYTHON_EXECUTABLE} test.py)
|
||||
set_tests_properties(geant4py-test01 PROPERTIES ENVIRONMENT "PYTHONPATH=${GEANT4_PYTHON_OUTPUT_DIR};${GEANT4_TEST_ENVIRONMENT}")
|
||||
@@ -0,0 +1,8 @@
|
||||
# gun.mac
|
||||
|
||||
/gun/number 1
|
||||
/gun/particle e-
|
||||
/gun/energy 200 MeV
|
||||
/gun/direction 0.2 0. 1.
|
||||
/gun/position 0. 0. -14.9 cm
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# - build test library
|
||||
|
||||
# library
|
||||
set(_TARGET gtest01)
|
||||
g4py_add_module(${_TARGET}
|
||||
Particles.cc
|
||||
PhysicsListEMstd.cc
|
||||
QDetectorConstruction.cc
|
||||
QEventAction.cc
|
||||
QMaterials.cc
|
||||
QPhysicsList.cc
|
||||
QPrimaryGeneratorAction.cc
|
||||
gtest01.cc
|
||||
)
|
||||
target_link_libraries(${_TARGET} PRIVATE G4particles G4processes G4run)
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// Particles.cc
|
||||
//
|
||||
// Physics list for defining particles
|
||||
//
|
||||
// ====================================================================
|
||||
#include "Particles.hh"
|
||||
|
||||
#include "G4LeptonConstructor.hh"
|
||||
#include "G4BosonConstructor.hh"
|
||||
#include "G4MesonConstructor.hh"
|
||||
#include "G4BaryonConstructor.hh"
|
||||
#include "G4ShortLivedConstructor.hh"
|
||||
#include "G4IonConstructor.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
//////////////////////////////////////
|
||||
Particles::Particles()
|
||||
: G4VPhysicsConstructor("Particles")
|
||||
//////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////
|
||||
Particles::~Particles()
|
||||
///////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
void Particles::ConstructParticle()
|
||||
///////////////////////////////////
|
||||
{
|
||||
G4LeptonConstructor::ConstructParticle();
|
||||
G4BosonConstructor::ConstructParticle();
|
||||
G4MesonConstructor::ConstructParticle();
|
||||
G4BaryonConstructor::ConstructParticle();
|
||||
G4ShortLivedConstructor::ConstructParticle();
|
||||
G4IonConstructor::ConstructParticle();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
void Particles::ConstructProcess()
|
||||
//////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// Particles.hh
|
||||
//
|
||||
// 2004 Q
|
||||
// ====================================================================
|
||||
#ifndef PARTICLES_H
|
||||
#define PARTICLES_H
|
||||
|
||||
#include "G4VPhysicsConstructor.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class Particles : public G4VPhysicsConstructor {
|
||||
|
||||
public:
|
||||
Particles();
|
||||
~Particles();
|
||||
|
||||
virtual void ConstructParticle();
|
||||
virtual void ConstructProcess();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// PhysicsListEMstd.cc
|
||||
//
|
||||
// Physics list for electron/positron/gamma
|
||||
// EM-standard package w/ default parameters
|
||||
//
|
||||
// ====================================================================
|
||||
#include "PhysicsListEMstd.hh"
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4NeutrinoE.hh"
|
||||
#include "G4AntiNeutrinoE.hh"
|
||||
|
||||
#include "G4ComptonScattering.hh"
|
||||
#include "G4GammaConversion.hh"
|
||||
#include "G4PhotoElectricEffect.hh"
|
||||
#include "G4eMultipleScattering.hh"
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
#include "G4eplusAnnihilation.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////////////////////////
|
||||
PhysicsListEMstd::PhysicsListEMstd()
|
||||
: G4VPhysicsConstructor("EM-std")
|
||||
////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
PhysicsListEMstd::~PhysicsListEMstd()
|
||||
/////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
void PhysicsListEMstd::ConstructParticle()
|
||||
//////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
void PhysicsListEMstd::ConstructProcess()
|
||||
/////////////////////////////////////////
|
||||
{
|
||||
G4ProcessManager* pm;
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// gamma physics
|
||||
// ----------------------------------------------------------
|
||||
pm= G4Gamma::Gamma()-> GetProcessManager();
|
||||
pm-> AddDiscreteProcess(new G4PhotoElectricEffect);
|
||||
pm-> AddDiscreteProcess(new G4ComptonScattering);
|
||||
pm-> AddDiscreteProcess(new G4GammaConversion);
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// electron physics
|
||||
// ----------------------------------------------------------
|
||||
G4eMultipleScattering* msc= new G4eMultipleScattering;
|
||||
G4eIonisation* eion= new G4eIonisation;
|
||||
G4eBremsstrahlung* ebrems= new G4eBremsstrahlung;
|
||||
|
||||
pm= G4Electron::Electron()->GetProcessManager();
|
||||
pm-> AddProcess(msc, ordInActive, 1, 1);
|
||||
pm-> AddProcess(eion, ordInActive, 2, 2);
|
||||
pm-> AddProcess(ebrems, ordInActive, ordInActive, 3);
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// positron physics
|
||||
// ----------------------------------------------------------
|
||||
msc= new G4eMultipleScattering;
|
||||
eion= new G4eIonisation;
|
||||
ebrems= new G4eBremsstrahlung;
|
||||
G4eplusAnnihilation* annihilation= new G4eplusAnnihilation;
|
||||
|
||||
pm= G4Positron::Positron()-> GetProcessManager();
|
||||
pm-> AddProcess(msc, ordInActive, 1, 1);
|
||||
pm-> AddProcess(eion, ordInActive, 2, 2);
|
||||
pm-> AddProcess(ebrems, ordInActive, ordInActive, 3);
|
||||
pm-> AddProcess(annihilation, 0, ordInActive, 4);
|
||||
|
||||
}
|
||||
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// PhysicsListEMstd.hh
|
||||
//
|
||||
// 2004 Q
|
||||
// ====================================================================
|
||||
#ifndef PHYSICS_LIST_EM_STD_H
|
||||
#define PHYSICS_LIST_EM_STD_H
|
||||
|
||||
#include "G4VPhysicsConstructor.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class PhysicsListEMstd : public G4VPhysicsConstructor {
|
||||
|
||||
public:
|
||||
PhysicsListEMstd();
|
||||
~PhysicsListEMstd();
|
||||
|
||||
virtual void ConstructParticle();
|
||||
virtual void ConstructProcess();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// QDetectorConstruction.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include "QDetectorConstruction.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
// constants (detector parameters)
|
||||
static const G4double DXYZ_AREA= 30.*cm;
|
||||
|
||||
//////////////////////////////////////////////
|
||||
QDetectorConstruction::QDetectorConstruction()
|
||||
//////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////
|
||||
QDetectorConstruction::~QDetectorConstruction()
|
||||
///////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
G4VPhysicalVolume* QDetectorConstruction::Construct()
|
||||
/////////////////////////////////////////////////////
|
||||
{
|
||||
G4Material* mate;
|
||||
G4VisAttributes* va;
|
||||
|
||||
// ==============================================================
|
||||
// world volume
|
||||
// ==============================================================
|
||||
G4Box* areaSolid= new G4Box("AREA",
|
||||
DXYZ_AREA/2., DXYZ_AREA/2., DXYZ_AREA/2.);
|
||||
|
||||
G4Material* vacuum= G4Material::GetMaterial("Vacuum");
|
||||
G4LogicalVolume* areaLV= new G4LogicalVolume(areaSolid, vacuum, "AREA_LV");
|
||||
G4PVPlacement* area= new G4PVPlacement(0, G4ThreeVector(), "AREA_PV",
|
||||
areaLV, 0, false, 0);
|
||||
// vis. attributes
|
||||
va= new G4VisAttributes(G4Color(1.,1.,1.));
|
||||
va-> SetForceWireframe(true);
|
||||
areaLV-> SetVisAttributes(va);
|
||||
|
||||
// ==============================================================
|
||||
// detectors
|
||||
// ==============================================================
|
||||
// voxel
|
||||
const G4double dvoxel= 10.*mm;
|
||||
const G4double dl= 10.*cm;
|
||||
|
||||
G4Box* svoxel= new G4Box("voxel", dvoxel, dl, dvoxel);
|
||||
mate= G4Material::GetMaterial("Vacuum");
|
||||
G4LogicalVolume* lvoxel= new G4LogicalVolume(svoxel, mate, "voxel");
|
||||
va= new G4VisAttributes(G4Color(0.,0.8,0.8));
|
||||
va-> SetVisibility(false);
|
||||
lvoxel-> SetVisAttributes(va);
|
||||
|
||||
G4int ix, iz;
|
||||
G4int index=0;
|
||||
for (iz=0; iz<5; iz++) {
|
||||
for (ix=-7; ix<=7; ix++) {
|
||||
G4double x0= (2.*ix)*cm;
|
||||
G4double z0= (-13.+2.*iz)*cm;
|
||||
/*G4PVPlacement* pvoxel=*/ new G4PVPlacement(0, G4ThreeVector(x0, 0., z0),
|
||||
lvoxel, "voxel", areaLV, false, index);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
// tube
|
||||
//G4Tubs* stube= new G4Tubs("tube", 15./2.*mm, 19./2.*mm, dl,
|
||||
G4Tubs* stube= new G4Tubs("tube", 0.*mm, 19./2.*mm, dl,
|
||||
0., 360.*deg);
|
||||
mate= G4Material::GetMaterial("Al");
|
||||
G4LogicalVolume* ltube= new G4LogicalVolume(stube, mate, "tube");
|
||||
va= new G4VisAttributes(G4Color(0.,0.8,0.8));
|
||||
ltube-> SetVisAttributes(va);
|
||||
|
||||
G4RotationMatrix* rmtube= new G4RotationMatrix;
|
||||
rmtube-> rotateX(-90.*deg);
|
||||
/*G4PVPlacement* ptube=*/ new G4PVPlacement(rmtube, G4ThreeVector(),
|
||||
ltube, "tube", lvoxel, false, 0);
|
||||
|
||||
// cal
|
||||
const G4double dxycal= 25.*mm;
|
||||
const G4double dzcal= 3.*cm;
|
||||
|
||||
G4Box* scal= new G4Box("cal", dxycal, dxycal, dzcal);
|
||||
mate= G4Material::GetMaterial("CsI");
|
||||
G4LogicalVolume* lcal= new G4LogicalVolume(scal, mate, "cal");
|
||||
va= new G4VisAttributes(G4Color(0.5,0.5,0.));
|
||||
lcal-> SetVisAttributes(va);
|
||||
|
||||
index= 0;
|
||||
for (ix=-2; ix<=2; ix++) {
|
||||
G4double x0= (5.*ix)*cm;
|
||||
/*G4PVPlacement* pcal=*/ new G4PVPlacement(0, G4ThreeVector(x0, 0., 2.*cm),
|
||||
lcal, "cal", areaLV, false, index);
|
||||
index++;
|
||||
}
|
||||
|
||||
return area;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// QDetectorConstruction.hh
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#ifndef Q_DETECTOR_CONSTRUCTION_H
|
||||
#define Q_DETECTOR_CONSTRUCTION_H
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class QDetectorConstruction : public G4VUserDetectorConstruction {
|
||||
|
||||
public:
|
||||
QDetectorConstruction();
|
||||
~QDetectorConstruction();
|
||||
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// QEventAction.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include "QEventAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////////////////
|
||||
QEventAction::QEventAction()
|
||||
////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
QEventAction::~QEventAction()
|
||||
/////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void QEventAction::BeginOfEventAction(const G4Event* /*aevent*/)
|
||||
////////////////////////////////////////////////////////////
|
||||
{
|
||||
G4cout << "QEventAction::BofEA is called." << G4endl;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
void QEventAction::EndOfEventAction(const G4Event* /*aevent*/)
|
||||
//////////////////////////////////////////////////////////
|
||||
{
|
||||
G4cout << "QEventAction::EofEA is called." << G4endl;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// QEventAction.hh
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#ifndef Q_EVENT_ACTION_H
|
||||
#define Q_EVENT_ACTION_H
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class QEventAction : public G4UserEventAction {
|
||||
public:
|
||||
QEventAction();
|
||||
~QEventAction();
|
||||
|
||||
virtual void BeginOfEventAction(const G4Event* aevent);
|
||||
virtual void EndOfEventAction(const G4Event* aevent);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,163 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// QMaterials.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include "QMaterials.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////////////
|
||||
QMaterials::QMaterials()
|
||||
////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////
|
||||
QMaterials::~QMaterials()
|
||||
/////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////
|
||||
void QMaterials::Construct()
|
||||
////////////////////////////
|
||||
{
|
||||
G4double A, Z;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Elements
|
||||
// ------------------------------------------------------------------------
|
||||
G4Element* elH = new G4Element("Hydrogen","H", Z=1., A=1.00794*g/mole);
|
||||
G4Element* elC = new G4Element("Carbon", "C", Z=6., A= 12.011 *g/mole);
|
||||
G4Element* elN = new G4Element("Nitrogen","N", Z=7., A= 14.00674*g/mole);
|
||||
G4Element* elO = new G4Element("Oxygen", "O", Z=8., A= 15.9994*g/mole);
|
||||
G4Element* elNa = new G4Element("Sodium", "Na", Z=11., A= 22.989768*g/mole);
|
||||
G4Element* elSi = new G4Element("Silicon", "Si", Z=14., A= 28.0855*g/mole);
|
||||
G4Element* elAr = new G4Element("Argon", "Ar", Z=18., A= 39.948*g/mole);
|
||||
G4Element* elI = new G4Element("Iodine", "I", Z=53., A= 126.90447*g/mole);
|
||||
G4Element* elCs = new G4Element("Cesium", "Cs", Z=55., A= 132.90543*g/mole);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Materials
|
||||
// ------------------------------------------------------------------------
|
||||
G4double density, massfraction;
|
||||
G4int natoms, nel;
|
||||
|
||||
// temperature of experimental hall is controlled at 20 degree.
|
||||
const G4double expTemp= STP_Temperature+20.*kelvin;
|
||||
|
||||
// vacuum
|
||||
density= universe_mean_density;
|
||||
G4Material* Vacuum= new G4Material("Vacuum", density, nel=2);
|
||||
Vacuum-> AddElement(elN, .7);
|
||||
Vacuum-> AddElement(elO, .3);
|
||||
|
||||
// air
|
||||
density= 1.2929e-03 *g/cm3; // at 20 degree
|
||||
G4Material* Air= new G4Material("Air", density, nel=3,
|
||||
kStateGas, expTemp);
|
||||
G4double ttt= 75.47+23.20+1.28;
|
||||
Air-> AddElement(elN, massfraction= 75.47/ttt);
|
||||
Air-> AddElement(elO, massfraction= 23.20/ttt);
|
||||
Air-> AddElement(elAr, massfraction= 1.28/ttt);
|
||||
|
||||
// Ar gas
|
||||
A= 39.948 *g/mole;
|
||||
const G4double denAr= 1.782e-03 *g/cm3 * STP_Temperature/expTemp;
|
||||
G4Material* Ar= new G4Material("ArgonGas", Z=18., A, denAr,
|
||||
kStateGas, expTemp);
|
||||
|
||||
// ethane (C2H6)
|
||||
const G4double denEthane= 1.356e-3 *g/cm3 * STP_Temperature/expTemp;
|
||||
G4Material* Ethane= new G4Material("Ethane", denEthane, nel=2,
|
||||
kStateGas, expTemp);
|
||||
Ethane-> AddElement(elC, natoms=2);
|
||||
Ethane-> AddElement(elH, natoms=6);
|
||||
|
||||
// Ar(50%) + ethane(50%) mixture
|
||||
density= (denAr+denEthane)/2.;
|
||||
G4Material* ArEthane= new G4Material("ArEthane", density, nel=2,
|
||||
kStateGas, expTemp);
|
||||
ArEthane-> AddMaterial(Ar, massfraction= denAr/density/2.);
|
||||
ArEthane-> AddMaterial(Ethane, massfraction= denEthane/density/2.);
|
||||
|
||||
// silicon
|
||||
A= 28.0855 *g/mole;
|
||||
density= 2.33 *g/cm3;
|
||||
/*G4Material* Si=*/ new G4Material("SiliconWafer", Z=14., A, density);
|
||||
|
||||
// alminium
|
||||
A= 26.98 *g/mole;
|
||||
density= 2.70 *g/cm3;
|
||||
/*G4Material* Al=*/ new G4Material("Al", Z=13., A, density);
|
||||
|
||||
// iron
|
||||
A= 55.847 *g/mole;
|
||||
density= 7.87 *g/cm3;
|
||||
/*G4Material* Fe=*/ new G4Material("Iron", Z=26., A, density);
|
||||
|
||||
// lead
|
||||
A= 207.2 *g/mole;
|
||||
density= 11.35 *g/cm3;
|
||||
/*G4Material* Pb=*/ new G4Material("Lead", Z=82., A, density);
|
||||
|
||||
// scintillator (Polystyene(C6H5CH=CH2))
|
||||
density= 1.032 *g/cm3;
|
||||
G4Material* Scinti= new G4Material("Scinti", density, nel=2);
|
||||
Scinti-> AddElement(elC, natoms=8);
|
||||
Scinti-> AddElement(elH, natoms=8);
|
||||
|
||||
// quartz (SiO2, crystalline)
|
||||
density= 2.64 *g/cm3;
|
||||
G4Material* Quartz= new G4Material("Quartz", density, nel= 2);
|
||||
Quartz-> AddElement(elSi, natoms=1);
|
||||
Quartz-> AddElement(elO, natoms=2);
|
||||
|
||||
// NaI crystal
|
||||
density= 3.67 *g/cm3;
|
||||
G4Material* NaI= new G4Material("NaI", density, nel= 2);
|
||||
NaI-> AddElement(elNa, natoms=1);
|
||||
NaI-> AddElement(elI, natoms=1);
|
||||
|
||||
// CsI crystal
|
||||
density= 4.51 *g/cm3;
|
||||
G4Material* CsI= new G4Material("CsI", density, nel= 2);
|
||||
CsI-> AddElement(elCs, natoms=1);
|
||||
CsI-> AddElement(elI, natoms=1);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// QMaterials.hh
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#ifndef Q_MATERIALS_H
|
||||
#define Q_MATERIALS_H
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
class QMaterials {
|
||||
public:
|
||||
QMaterials();
|
||||
~QMaterials();
|
||||
|
||||
void Construct();
|
||||
};
|
||||
|
||||
#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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// QPhysicsList.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include "QPhysicsList.hh"
|
||||
#include "Particles.hh"
|
||||
#include "PhysicsListEMstd.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////////////////
|
||||
QPhysicsList::QPhysicsList()
|
||||
: G4VModularPhysicsList()
|
||||
////////////////////////////
|
||||
{
|
||||
// default cut value (1.0mm)
|
||||
defaultCutValue = 1.*mm;
|
||||
SetVerboseLevel(1);
|
||||
|
||||
// particles
|
||||
RegisterPhysics(new Particles);
|
||||
|
||||
// EM Physics
|
||||
RegisterPhysics(new PhysicsListEMstd);
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
QPhysicsList::~QPhysicsList()
|
||||
/////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
void QPhysicsList::SetCuts()
|
||||
////////////////////////////
|
||||
{
|
||||
// " G4VUserPhysicsList::SetCutsWithDefault" method sets
|
||||
// the default cut value for all particle types
|
||||
SetCutsWithDefault();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// QPhysicsList.hh
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#ifndef Q_PHYSICS_LIST_H
|
||||
#define Q_PHYSICS_LIST_H
|
||||
|
||||
#include "G4VModularPhysicsList.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
class QPhysicsList: public G4VModularPhysicsList {
|
||||
public:
|
||||
QPhysicsList();
|
||||
~QPhysicsList();
|
||||
|
||||
virtual void SetCuts();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// QPrimaryGeneratorAction.cc
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include "QPrimaryGeneratorAction.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
QPrimaryGeneratorAction::QPrimaryGeneratorAction()
|
||||
//////////////////////////////////////////////////
|
||||
{
|
||||
particleGun= new G4ParticleGun;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
QPrimaryGeneratorAction::~QPrimaryGeneratorAction()
|
||||
///////////////////////////////////////////////////
|
||||
{
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
void QPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
/////////////////////////////////////////////////////////////////
|
||||
{
|
||||
particleGun-> GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// QPrimaryGeneratorAction.hh
|
||||
//
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#ifndef Q_PRIMARY_GENERATOR_ACTION_H
|
||||
#define Q_PRIMARY_GENERATOR_ACTION_H
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
class QPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
|
||||
private:
|
||||
// use G4 particle gun
|
||||
G4ParticleGun* particleGun;
|
||||
|
||||
public:
|
||||
QPrimaryGeneratorAction();
|
||||
~QPrimaryGeneratorAction();
|
||||
|
||||
G4ParticleGun* GetParticleGun() const;
|
||||
|
||||
virtual void GeneratePrimaries(G4Event* anEvent);
|
||||
};
|
||||
|
||||
// ====================================================================
|
||||
// inline functions
|
||||
// ====================================================================
|
||||
inline G4ParticleGun* QPrimaryGeneratorAction::GetParticleGun() const
|
||||
{ return particleGun; }
|
||||
|
||||
#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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// ====================================================================
|
||||
// gtest01.cc
|
||||
//
|
||||
// python wrapper for user application
|
||||
// 2005 Q
|
||||
// ====================================================================
|
||||
#include <boost/python.hpp>
|
||||
#include "QMaterials.hh"
|
||||
#include "QDetectorConstruction.hh"
|
||||
#include "QPhysicsList.hh"
|
||||
#include "QPrimaryGeneratorAction.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "QEventAction.hh"
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
// ====================================================================
|
||||
// Expose to Python
|
||||
// ====================================================================
|
||||
|
||||
BOOST_PYTHON_MODULE(gtest01) {
|
||||
class_<QMaterials>("QMaterials", "my material")
|
||||
.def("Construct", &QMaterials::Construct)
|
||||
;
|
||||
|
||||
class_<QDetectorConstruction, QDetectorConstruction*,
|
||||
bases<G4VUserDetectorConstruction> >
|
||||
("QDetectorConstruction", "my detector")
|
||||
;
|
||||
|
||||
class_<QPhysicsList, QPhysicsList*,
|
||||
bases<G4VUserPhysicsList> >
|
||||
("QPhysicsList", "my physics list")
|
||||
;
|
||||
|
||||
class_<QPrimaryGeneratorAction, QPrimaryGeneratorAction*,
|
||||
bases<G4VUserPrimaryGeneratorAction> >
|
||||
("QPrimaryGeneratorAction", "my primary generator action")
|
||||
.def("GetParticleGun", &QPrimaryGeneratorAction::GetParticleGun,
|
||||
return_internal_reference<>())
|
||||
;
|
||||
|
||||
class_<QEventAction, QEventAction*,
|
||||
bases<G4UserEventAction> >
|
||||
("QEventAction", "my event action")
|
||||
;
|
||||
}
|
||||
|
||||
Executable
+143
@@ -0,0 +1,143 @@
|
||||
#!/usr/bin/python
|
||||
# ==================================================================
|
||||
# python script for Geant4Py test
|
||||
#
|
||||
# gtest01
|
||||
# - check basic control flow
|
||||
# ==================================================================
|
||||
from Geant4 import *
|
||||
import gtest01
|
||||
import ROOT
|
||||
|
||||
# ==================================================================
|
||||
# ROOT PART #
|
||||
# ==================================================================
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
def init_root():
|
||||
# ------------------------------------------------------------------
|
||||
ROOT.gROOT.Reset()
|
||||
|
||||
# plot style
|
||||
ROOT.gStyle.SetTextFont(82)
|
||||
ROOT.gStyle.SetTitleFont(82, "X")
|
||||
ROOT.gStyle.SetLabelFont(82, "X")
|
||||
ROOT.gStyle.SetTitleFont(82, "Y")
|
||||
ROOT.gStyle.SetLabelFont(82, "Y")
|
||||
|
||||
#ROOT.gStyle.SetOptTitle(0)
|
||||
ROOT.gStyle.SetErrorX(0)
|
||||
|
||||
canvas= ROOT.TCanvas("g4py_plots",
|
||||
"Geant4Py Sample Plots",
|
||||
620, 30, 600, 400)
|
||||
|
||||
#canvas.Divide(2,2);
|
||||
#canvas.SetFillColor(29)
|
||||
|
||||
canvas.SetGrid()
|
||||
|
||||
return canvas
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
def hini():
|
||||
# ------------------------------------------------------------------
|
||||
global hist1
|
||||
hist1= ROOT.TH1D("dE/dx/step", "dE/dx", 100, 0., 2000.)
|
||||
hist1.SetXTitle("(keV)")
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
def hshow():
|
||||
# ------------------------------------------------------------------
|
||||
hist1.Draw()
|
||||
|
||||
# ==================================================================
|
||||
# Geant4 PART #
|
||||
# ==================================================================
|
||||
|
||||
# ==================================================================
|
||||
# user actions in python
|
||||
# ==================================================================
|
||||
class MyPrimaryGeneratorAction(G4VUserPrimaryGeneratorAction):
|
||||
"My Primary Generator Action"
|
||||
|
||||
def __init__(self):
|
||||
G4VUserPrimaryGeneratorAction.__init__(self)
|
||||
self.particleGun= G4ParticleGun(1)
|
||||
|
||||
def GeneratePrimaries(self, event):
|
||||
self.particleGun.GeneratePrimaryVertex(event)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
class MyRunAction(G4UserRunAction):
|
||||
"My Run Action"
|
||||
|
||||
def BeginOfRunAction(self, run):
|
||||
print "*** #event to be processed (BRA)=",
|
||||
run.numberOfEventToBeProcessed
|
||||
|
||||
def EndOfRunAction(self, run):
|
||||
print "*** run end run(ERA)=", run.runID
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
class MyEventAction(G4UserEventAction):
|
||||
"My Event Action"
|
||||
|
||||
def BeginOfEventAction(self, event):
|
||||
print "*** current event (BEA)=", event.eventID
|
||||
|
||||
def EndOfEventAction(self, event):
|
||||
print "*** current event (EEA)=", event.eventID
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
class MySteppingAction(G4UserSteppingAction):
|
||||
"My Stepping Action"
|
||||
|
||||
def UserSteppingAction(self, step):
|
||||
#print "*** dE/dx in current step=", step.GetTotalEnergyDeposit()
|
||||
dedx= step.GetTotalEnergyDeposit()
|
||||
if(dedx>0):
|
||||
hist1.Fill(dedx/HEPUnit.keV)
|
||||
|
||||
# ==================================================================
|
||||
# main
|
||||
# ==================================================================
|
||||
g4pyCanvas= init_root()
|
||||
hini()
|
||||
|
||||
app= gtest01.MyApplication()
|
||||
app.Configure()
|
||||
|
||||
# set user actions...
|
||||
myPGA= MyPrimaryGeneratorAction()
|
||||
gRunManager.SetUserAction(myPGA)
|
||||
|
||||
myRA= MyRunAction()
|
||||
gRunManager.SetUserAction(myRA)
|
||||
|
||||
#myEA= MyEventAction()
|
||||
#gRunManager.SetUserAction(myEA)
|
||||
|
||||
mySA= MySteppingAction()
|
||||
gRunManager.SetUserAction(mySA)
|
||||
|
||||
|
||||
# set particle gun
|
||||
#ApplyUICommand("/control/execute gun.mac")
|
||||
pg= myPGA.particleGun
|
||||
pg.SetParticleByName("e-")
|
||||
pg.SetParticleEnergy(200.*HEPUnit.MeV)
|
||||
pg.SetParticleMomentumDirection(G4ThreeVector(0.2, 0., 1.))
|
||||
pg.SetParticlePosition(G4ThreeVector(0.,0.,-14.9)*HEPUnit.cm)
|
||||
|
||||
# visualization
|
||||
ApplyUICommand("/control/execute vis.mac")
|
||||
|
||||
# beamOn
|
||||
gRunManager.BeamOn(1000)
|
||||
|
||||
#
|
||||
hshow()
|
||||
|
||||
|
||||
Executable
+123
@@ -0,0 +1,123 @@
|
||||
#!/usr/bin/python
|
||||
# ==================================================================
|
||||
# python script for Geant4Py test
|
||||
#
|
||||
# gtest01
|
||||
# - check basic control flow
|
||||
# ==================================================================
|
||||
from Geant4 import *
|
||||
import gtest01
|
||||
import random
|
||||
#import thread
|
||||
|
||||
# ==================================================================
|
||||
# user actions in python
|
||||
# ==================================================================
|
||||
class MyPrimaryGeneratorAction(G4VUserPrimaryGeneratorAction):
|
||||
"My Primary Generator Action"
|
||||
|
||||
def __init__(self):
|
||||
G4VUserPrimaryGeneratorAction.__init__(self)
|
||||
self.particleGun= G4ParticleGun(1)
|
||||
|
||||
def GeneratePrimaries(self, event):
|
||||
#dx= random.gauss(0., 0.1)
|
||||
dx=0.
|
||||
self.particleGun.SetParticleMomentumDirection(G4ThreeVector(dx, 0., 1.))
|
||||
self.particleGun.GeneratePrimaryVertex(event)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
class MyRunAction(G4UserRunAction):
|
||||
"My Run Action"
|
||||
|
||||
def BeginOfRunAction(self, run):
|
||||
print "*** #event to be processed (BRA)=",
|
||||
run.GetNumberOfEventToBeProcessed()
|
||||
|
||||
def EndOfRunAction(self, run):
|
||||
print "*** run end run(ERA)=", run.GetRunID()
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
class MyEventAction(G4UserEventAction):
|
||||
"My Event Action"
|
||||
|
||||
#def BeginOfEventAction(self, event):
|
||||
#print "*** current event (BEA)=", event.GetEventID()
|
||||
# pass
|
||||
|
||||
#def EndOfEventAction(self, event):
|
||||
# print "*** current event (EEA)=", event.GetEventID()
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
class MySteppingAction(G4UserSteppingAction):
|
||||
"My Stepping Action"
|
||||
|
||||
def UserSteppingAction(self, step):
|
||||
#print "*** dE/dx in current step=", step.GetTotalEnergyDeposit()
|
||||
track= step.GetTrack()
|
||||
touchable= track.GetTouchable()
|
||||
pv= touchable.GetVolume()
|
||||
#print pv.GetCopyNo()
|
||||
#print touchable.GetReplicaNumber(0)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
class MyField(G4MagneticField):
|
||||
"My Magnetic Field"
|
||||
|
||||
def GetFieldValue(self, pos, time):
|
||||
bfield= G4ThreeVector()
|
||||
bfield.x= 0.
|
||||
bfield.y= 5.*tesla
|
||||
bfield.z= 0.
|
||||
return bfield
|
||||
|
||||
# ==================================================================
|
||||
# main
|
||||
# ==================================================================
|
||||
qMaterials= gtest01.QMaterials()
|
||||
qMaterials.Construct()
|
||||
|
||||
qDC= gtest01.QDetectorConstruction()
|
||||
gRunManager.SetUserInitialization(qDC)
|
||||
|
||||
qPL= gtest01.QPhysicsList()
|
||||
gRunManager.SetUserInitialization(qPL)
|
||||
|
||||
# set user actions...
|
||||
#qPGA= gtest01.QPrimaryGeneratorAction()
|
||||
myPGA= MyPrimaryGeneratorAction()
|
||||
gRunManager.SetUserAction(myPGA)
|
||||
|
||||
#myRA= MyRunAction()
|
||||
#gRunManager.SetUserAction(myRA)
|
||||
|
||||
myEA= MyEventAction()
|
||||
gRunManager.SetUserAction(myEA)
|
||||
|
||||
mySA= MySteppingAction()
|
||||
gRunManager.SetUserAction(mySA)
|
||||
|
||||
# set particle gun
|
||||
#ApplyUICommand("/control/execute gun.mac")
|
||||
#pg= qPGA.GetParticleGun()
|
||||
pg= myPGA.particleGun
|
||||
pg.SetParticleByName("e-")
|
||||
pg.SetParticleEnergy(200.*MeV)
|
||||
pg.SetParticlePosition(G4ThreeVector(0.,0.,-14.9)*cm)
|
||||
|
||||
# magnetic field
|
||||
fieldMgr= gTransportationManager.GetFieldManager()
|
||||
myField= G4UniformMagField(G4ThreeVector(0.,10.*tesla,0.))
|
||||
#myField= MyField()
|
||||
fieldMgr.SetDetectorField(myField)
|
||||
fieldMgr.CreateChordFinder(myField)
|
||||
|
||||
gRunManager.Initialize()
|
||||
|
||||
# visualization
|
||||
gControlExecute("vis.mac")
|
||||
|
||||
# beamOn
|
||||
gRunManager.BeamOn(10)
|
||||
#thread.start_new_thread(gRunManager.BeamOn, (100000))
|
||||
|
||||
Executable
+118
@@ -0,0 +1,118 @@
|
||||
#!/usr/bin/python3
|
||||
# ==================================================================
|
||||
# python script for Geant4Py test
|
||||
#
|
||||
# gtest01
|
||||
# - check basic control flow
|
||||
# ==================================================================
|
||||
from Geant4 import *
|
||||
import gtest01
|
||||
import random
|
||||
|
||||
# ==================================================================
|
||||
# user actions in python
|
||||
# ==================================================================
|
||||
class MyPrimaryGeneratorAction(G4VUserPrimaryGeneratorAction):
|
||||
"My Primary Generator Action"
|
||||
|
||||
def __init__(self):
|
||||
G4VUserPrimaryGeneratorAction.__init__(self)
|
||||
self.particleGun= G4ParticleGun(1)
|
||||
|
||||
def GeneratePrimaries(self, event):
|
||||
#dx= random.gauss(0., 0.1)
|
||||
dx=0.
|
||||
self.particleGun.SetParticleMomentumDirection(G4ThreeVector(dx, 0., 1.))
|
||||
self.particleGun.GeneratePrimaryVertex(event)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
class MyRunAction(G4UserRunAction):
|
||||
"My Run Action"
|
||||
|
||||
def BeginOfRunAction(self, run):
|
||||
print("*** #event to be processed (BRA)=",
|
||||
run.GetNumberOfEventToBeProcessed())
|
||||
|
||||
def EndOfRunAction(self, run):
|
||||
print("*** run end run(ERA)=", run.GetRunID())
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
class MyEventAction(G4UserEventAction):
|
||||
"My Event Action"
|
||||
|
||||
#def BeginOfEventAction(self, event):
|
||||
#print("*** current event (BEA)=", event.GetEventID())
|
||||
# pass
|
||||
|
||||
#def EndOfEventAction(self, event):
|
||||
#print("*** current event (EEA)=", event.GetEventID())
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
class MySteppingAction(G4UserSteppingAction):
|
||||
"My Stepping Action"
|
||||
|
||||
def UserSteppingAction(self, step):
|
||||
#print("*** dE/dx in current step=", step.GetTotalEnergyDeposit())
|
||||
track= step.GetTrack()
|
||||
touchable= track.GetTouchable()
|
||||
pv= touchable.GetVolume()
|
||||
#print(pv.GetCopyNo())
|
||||
#print(touchable.GetReplicaNumber(0))
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
class MyField(G4MagneticField):
|
||||
"My Magnetic Field"
|
||||
|
||||
def GetFieldValue(self, pos, time):
|
||||
bfield= G4ThreeVector()
|
||||
bfield.x= 0.
|
||||
bfield.y= 5.*tesla
|
||||
bfield.z= 0.
|
||||
return bfield
|
||||
|
||||
# ==================================================================
|
||||
# main
|
||||
# ==================================================================
|
||||
qMaterials= gtest01.QMaterials()
|
||||
qMaterials.Construct()
|
||||
|
||||
qDC= gtest01.QDetectorConstruction()
|
||||
gRunManager.SetUserInitialization(qDC)
|
||||
|
||||
qPL= gtest01.QPhysicsList()
|
||||
gRunManager.SetUserInitialization(qPL)
|
||||
|
||||
# set user actions...
|
||||
#qPGA= gtest01.QPrimaryGeneratorAction()
|
||||
myPGA= MyPrimaryGeneratorAction()
|
||||
gRunManager.SetUserAction(myPGA)
|
||||
|
||||
#myRA= MyRunAction()
|
||||
#gRunManager.SetUserAction(myRA)
|
||||
|
||||
myEA= MyEventAction()
|
||||
gRunManager.SetUserAction(myEA)
|
||||
|
||||
mySA= MySteppingAction()
|
||||
gRunManager.SetUserAction(mySA)
|
||||
|
||||
# set particle gun
|
||||
#ApplyUICommand("/control/execute gun.mac")
|
||||
#pg= qPGA.GetParticleGun()
|
||||
pg= myPGA.particleGun
|
||||
pg.SetParticleByName("e-")
|
||||
pg.SetParticleEnergy(200.*MeV)
|
||||
pg.SetParticlePosition(G4ThreeVector(0.,0.,-14.9)*cm)
|
||||
|
||||
# magnetic field
|
||||
fieldMgr= gTransportationManager.GetFieldManager()
|
||||
myField= G4UniformMagField(G4ThreeVector(0.,10.*tesla,0.))
|
||||
#myField= MyField()
|
||||
fieldMgr.SetDetectorField(myField)
|
||||
fieldMgr.CreateChordFinder(myField)
|
||||
|
||||
gRunManager.Initialize()
|
||||
|
||||
# beamOn
|
||||
gRunManager.BeamOn(10)
|
||||
gTerminate()
|
||||
@@ -0,0 +1,16 @@
|
||||
# vis.mac
|
||||
|
||||
/vis/open OGLSX
|
||||
|
||||
/vis/scene/create
|
||||
/vis/scene/add/volume
|
||||
#/vis/scene/add/volume cal 3
|
||||
|
||||
/vis/sceneHandler/attach
|
||||
|
||||
/vis/viewer/set/viewpointThetaPhi 90. -90.
|
||||
|
||||
/tracking/storeTrajectory 1
|
||||
/vis/scene/add/trajectories
|
||||
/vis/scene/endOfEventAction accumulate
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/vis/scene/create
|
||||
/vis/scene/add/volume
|
||||
|
||||
/vis/sceneHandler/create VRML2FILE
|
||||
|
||||
/vis/viewer/create
|
||||
|
||||
/tracking/storeTrajectory 1
|
||||
/vis/scene/add/trajectories
|
||||
/vis/scene/endOfEventAction accumulate
|
||||
|
||||
Reference in New Issue
Block a user