Import Geant4 10.2.0 source tree
This commit is contained in:
@@ -0,0 +1,272 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: B3DetectorConstruction.cc 71079 2013-06-10 20:37:11Z ihrivnac $
|
||||
//
|
||||
/// \file B3DetectorConstruction.cc
|
||||
/// \brief Implementation of the B3DetectorConstruction class
|
||||
|
||||
#include "B3DetectorConstruction.hh"
|
||||
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4MultiFunctionalDetector.hh"
|
||||
#include "G4VPrimitiveScorer.hh"
|
||||
#include "G4PSEnergyDeposit.hh"
|
||||
#include "G4PSDoseDeposit.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3DetectorConstruction::B3DetectorConstruction()
|
||||
: G4VUserDetectorConstruction(),
|
||||
fCheckOverlaps(true)
|
||||
{
|
||||
DefineMaterials();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3DetectorConstruction::~B3DetectorConstruction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B3DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
G4NistManager* man = G4NistManager::Instance();
|
||||
|
||||
G4bool isotopes = false;
|
||||
|
||||
G4Element* O = man->FindOrBuildElement("O" , isotopes);
|
||||
G4Element* Si = man->FindOrBuildElement("Si", isotopes);
|
||||
G4Element* Lu = man->FindOrBuildElement("Lu", isotopes);
|
||||
|
||||
G4Material* LSO = new G4Material("Lu2SiO5", 7.4*g/cm3, 3);
|
||||
LSO->AddElement(Lu, 2);
|
||||
LSO->AddElement(Si, 1);
|
||||
LSO->AddElement(O , 5);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* B3DetectorConstruction::Construct()
|
||||
{
|
||||
// Gamma detector Parameters
|
||||
//
|
||||
G4double cryst_dX = 6*cm, cryst_dY = 6*cm, cryst_dZ = 3*cm;
|
||||
G4int nb_cryst = 32;
|
||||
G4int nb_rings = 9;
|
||||
//
|
||||
G4double dPhi = twopi/nb_cryst, half_dPhi = 0.5*dPhi;
|
||||
G4double cosdPhi = std::cos(half_dPhi);
|
||||
G4double tandPhi = std::tan(half_dPhi);
|
||||
//
|
||||
G4double ring_R1 = 0.5*cryst_dY/tandPhi;
|
||||
G4double ring_R2 = (ring_R1+cryst_dZ)/cosdPhi;
|
||||
//
|
||||
G4double detector_dZ = nb_rings*cryst_dX;
|
||||
//
|
||||
G4NistManager* nist = G4NistManager::Instance();
|
||||
G4Material* default_mat = nist->FindOrBuildMaterial("G4_AIR");
|
||||
G4Material* cryst_mat = nist->FindOrBuildMaterial("Lu2SiO5");
|
||||
|
||||
//
|
||||
// World
|
||||
//
|
||||
G4double world_sizeXY = 2.4*ring_R2;
|
||||
G4double world_sizeZ = 1.2*detector_dZ;
|
||||
|
||||
G4Box* solidWorld =
|
||||
new G4Box("World", //its name
|
||||
0.5*world_sizeXY, 0.5*world_sizeXY, 0.5*world_sizeZ); //its size
|
||||
|
||||
G4LogicalVolume* logicWorld =
|
||||
new G4LogicalVolume(solidWorld, //its solid
|
||||
default_mat, //its material
|
||||
"World"); //its name
|
||||
|
||||
G4VPhysicalVolume* physWorld =
|
||||
new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
logicWorld, //its logical volume
|
||||
"World", //its name
|
||||
0, //its mother volume
|
||||
false, //no boolean operation
|
||||
0, //copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// ring
|
||||
//
|
||||
G4Tubs* solidRing =
|
||||
new G4Tubs("Ring", ring_R1, ring_R2, 0.5*cryst_dX, 0., twopi);
|
||||
|
||||
G4LogicalVolume* logicRing =
|
||||
new G4LogicalVolume(solidRing, //its solid
|
||||
default_mat, //its material
|
||||
"Ring"); //its name
|
||||
|
||||
//
|
||||
// define crystal
|
||||
//
|
||||
G4double gap = 0.5*mm; //a gap for wrapping
|
||||
G4double dX = cryst_dX - gap, dY = cryst_dY - gap;
|
||||
G4Box* solidCryst = new G4Box("crystal", dX/2, dY/2, cryst_dZ/2);
|
||||
|
||||
G4LogicalVolume* logicCryst =
|
||||
new G4LogicalVolume(solidCryst, //its solid
|
||||
cryst_mat, //its material
|
||||
"CrystalLV"); //its name
|
||||
|
||||
// place crystals within a ring
|
||||
//
|
||||
for (G4int icrys = 0; icrys < nb_cryst ; icrys++) {
|
||||
G4double phi = icrys*dPhi;
|
||||
G4RotationMatrix rotm = G4RotationMatrix();
|
||||
rotm.rotateY(90*deg);
|
||||
rotm.rotateZ(phi);
|
||||
G4ThreeVector uz = G4ThreeVector(std::cos(phi), std::sin(phi),0.);
|
||||
G4ThreeVector position = (ring_R1+0.5*cryst_dZ)*uz;
|
||||
G4Transform3D transform = G4Transform3D(rotm,position);
|
||||
|
||||
new G4PVPlacement(transform, //rotation,position
|
||||
logicCryst, //its logical volume
|
||||
"crystal", //its name
|
||||
logicRing, //its mother volume
|
||||
false, //no boolean operation
|
||||
icrys, //copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
}
|
||||
|
||||
//
|
||||
// full detector
|
||||
//
|
||||
G4Tubs* solidDetector =
|
||||
new G4Tubs("Detector", ring_R1, ring_R2, 0.5*detector_dZ, 0., twopi);
|
||||
|
||||
G4LogicalVolume* logicDetector =
|
||||
new G4LogicalVolume(solidDetector, //its solid
|
||||
default_mat, //its material
|
||||
"Detector"); //its name
|
||||
|
||||
//
|
||||
// place rings within detector
|
||||
//
|
||||
G4double OG = -0.5*(detector_dZ + cryst_dX);
|
||||
for (G4int iring = 0; iring < nb_rings ; iring++) {
|
||||
OG += cryst_dX;
|
||||
new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(0,0,OG), //position
|
||||
logicRing, //its logical volume
|
||||
"ring", //its name
|
||||
logicDetector, //its mother volume
|
||||
false, //no boolean operation
|
||||
iring, //copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
}
|
||||
|
||||
//
|
||||
// place detector in world
|
||||
//
|
||||
new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
logicDetector, //its logical volume
|
||||
"Detector", //its name
|
||||
logicWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0, //copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// patient
|
||||
//
|
||||
G4double patient_radius = 8*cm;
|
||||
G4double patient_dZ = 10*cm;
|
||||
G4Material* patient_mat = nist->FindOrBuildMaterial("G4_BRAIN_ICRP");
|
||||
|
||||
G4Tubs* solidPatient =
|
||||
new G4Tubs("Patient", 0., patient_radius, 0.5*patient_dZ, 0., twopi);
|
||||
|
||||
G4LogicalVolume* logicPatient =
|
||||
new G4LogicalVolume(solidPatient, //its solid
|
||||
patient_mat, //its material
|
||||
"PatientLV"); //its name
|
||||
|
||||
//
|
||||
// place patient in world
|
||||
//
|
||||
new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
logicPatient, //its logical volume
|
||||
"Patient", //its name
|
||||
logicWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0, //copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
// Visualization attributes
|
||||
//
|
||||
logicRing->SetVisAttributes (G4VisAttributes::Invisible);
|
||||
logicDetector->SetVisAttributes (G4VisAttributes::Invisible);
|
||||
|
||||
// Print materials
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
|
||||
//always return the physical World
|
||||
//
|
||||
return physWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B3DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
|
||||
|
||||
// declare crystal as a MultiFunctionalDetector scorer
|
||||
//
|
||||
G4MultiFunctionalDetector* cryst = new G4MultiFunctionalDetector("crystal");
|
||||
G4VPrimitiveScorer* primitiv1 = new G4PSEnergyDeposit("edep");
|
||||
cryst->RegisterPrimitive(primitiv1);
|
||||
SetSensitiveDetector("CrystalLV",cryst);
|
||||
|
||||
// declare patient as a MultiFunctionalDetector scorer
|
||||
//
|
||||
G4MultiFunctionalDetector* patient = new G4MultiFunctionalDetector("patient");
|
||||
G4VPrimitiveScorer* primitiv2 = new G4PSDoseDeposit("dose");
|
||||
patient->RegisterPrimitive(primitiv2);
|
||||
SetSensitiveDetector("PatientLV",patient);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: B3PhysicsList.cc 66536 2012-12-19 14:32:36Z ihrivnac $
|
||||
//
|
||||
/// \file B3PhysicsList.cc
|
||||
/// \brief Implementation of the B3PhysicsList class
|
||||
|
||||
#include "B3PhysicsList.hh"
|
||||
|
||||
#include "G4DecayPhysics.hh"
|
||||
#include "G4RadioactiveDecayPhysics.hh"
|
||||
#include "G4EmStandardPhysics.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3PhysicsList::B3PhysicsList()
|
||||
: G4VModularPhysicsList(){
|
||||
SetVerboseLevel(1);
|
||||
|
||||
// Default physics
|
||||
RegisterPhysics(new G4DecayPhysics());
|
||||
|
||||
// Radioactive decay
|
||||
RegisterPhysics(new G4RadioactiveDecayPhysics());
|
||||
|
||||
// EM physics
|
||||
RegisterPhysics(new G4EmStandardPhysics());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3PhysicsList::~B3PhysicsList()
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B3PhysicsList::SetCuts()
|
||||
{
|
||||
G4VUserPhysicsList::SetCuts();
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: B3PrimaryGeneratorAction.cc 73744 2013-09-09 20:25:07Z asaim $
|
||||
//
|
||||
/// \file B3PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the B3PrimaryGeneratorAction class
|
||||
|
||||
#include "B3PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4IonTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ChargedGeantino.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3PrimaryGeneratorAction::B3PrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle kinematic
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle("chargedgeantino");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,0.));
|
||||
fParticleGun->SetParticleEnergy(1*eV);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3PrimaryGeneratorAction::~B3PrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B3PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
G4ParticleDefinition* particle = fParticleGun->GetParticleDefinition();
|
||||
if (particle == G4ChargedGeantino::ChargedGeantino()) {
|
||||
//fluorine
|
||||
G4int Z = 9, A = 18;
|
||||
G4double ionCharge = 0.*eplus;
|
||||
G4double excitEnergy = 0.*keV;
|
||||
|
||||
G4ParticleDefinition* ion
|
||||
= G4IonTable::GetIonTable()->GetIon(Z,A,excitEnergy);
|
||||
fParticleGun->SetParticleDefinition(ion);
|
||||
fParticleGun->SetParticleCharge(ionCharge);
|
||||
}
|
||||
|
||||
// randomized position
|
||||
//
|
||||
///G4double x0 = 0*cm, y0 = 0*cm, z0 = 0*cm;
|
||||
///G4double dx0 = 0*cm, dy0 = 0*cm, dz0 = 0*cm;
|
||||
G4double x0 = 4*cm, y0 = 4*cm, z0 = 4*cm;
|
||||
G4double dx0 = 1*cm, dy0 = 1*cm, dz0 = 1*cm;
|
||||
x0 += dx0*(G4UniformRand()-0.5);
|
||||
y0 += dy0*(G4UniformRand()-0.5);
|
||||
z0 += dz0*(G4UniformRand()-0.5);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
|
||||
|
||||
//create vertex
|
||||
//
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: B3StackingAction.cc 66536 2012-12-19 14:32:36Z ihrivnac $
|
||||
//
|
||||
/// \file B3StackingAction.cc
|
||||
/// \brief Implementation of the B3StackingAction class
|
||||
|
||||
#include "B3StackingAction.hh"
|
||||
|
||||
#include "G4Track.hh"
|
||||
#include "G4NeutrinoE.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3StackingAction::B3StackingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3StackingAction::~B3StackingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ClassificationOfNewTrack
|
||||
B3StackingAction::ClassifyNewTrack(const G4Track* track)
|
||||
{
|
||||
//keep primary particle
|
||||
if (track->GetParentID() == 0) return fUrgent;
|
||||
|
||||
//kill secondary neutrino
|
||||
if (track->GetDefinition() == G4NeutrinoE::NeutrinoE()) return fKill;
|
||||
else return fUrgent;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B3bActionInitialization.cc 68058 2013-03-13 14:47:43Z gcosmo $
|
||||
//
|
||||
/// \file B3bActionInitialization.cc
|
||||
/// \brief Implementation of the B3bActionInitialization class
|
||||
|
||||
#include "B3bActionInitialization.hh"
|
||||
#include "B3bRunAction.hh"
|
||||
#include "B3PrimaryGeneratorAction.hh"
|
||||
#include "B3StackingAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3bActionInitialization::B3bActionInitialization()
|
||||
: G4VUserActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3bActionInitialization::~B3bActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B3bActionInitialization::BuildForMaster() const
|
||||
{
|
||||
SetUserAction(new B3bRunAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B3bActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new B3bRunAction);
|
||||
SetUserAction(new B3PrimaryGeneratorAction);
|
||||
SetUserAction(new B3StackingAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,127 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: B3bRun.cc 68058 2013-03-13 14:47:43Z gcosmo $
|
||||
//
|
||||
/// \file B3bRun.cc
|
||||
/// \brief Implementation of the B3bRun class
|
||||
|
||||
#include "B3bRun.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Event.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4THitsMap.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3bRun::B3bRun()
|
||||
: G4Run(),
|
||||
fCollID_cryst(-1),
|
||||
fCollID_patient(-1),
|
||||
fPrintModulo(10000),
|
||||
fGoodEvents(0),
|
||||
fSumDose(0.)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3bRun::~B3bRun()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B3bRun::RecordEvent(const G4Event* event)
|
||||
{
|
||||
if ( fCollID_cryst < 0 ) {
|
||||
fCollID_cryst
|
||||
= G4SDManager::GetSDMpointer()->GetCollectionID("crystal/edep");
|
||||
//G4cout << " fCollID_cryst: " << fCollID_cryst << G4endl;
|
||||
}
|
||||
|
||||
if ( fCollID_patient < 0 ) {
|
||||
fCollID_patient
|
||||
= G4SDManager::GetSDMpointer()->GetCollectionID("patient/dose");
|
||||
//G4cout << " fCollID_patient: " << fCollID_patient << G4endl;
|
||||
}
|
||||
|
||||
G4int evtNb = event->GetEventID();
|
||||
|
||||
if (evtNb%fPrintModulo == 0) {
|
||||
G4cout << G4endl << "---> end of event: " << evtNb << G4endl;
|
||||
}
|
||||
|
||||
//Hits collections
|
||||
//
|
||||
G4HCofThisEvent* HCE = event->GetHCofThisEvent();
|
||||
if(!HCE) return;
|
||||
|
||||
//Energy in crystals : identify 'good events'
|
||||
//
|
||||
const G4double eThreshold = 500*keV;
|
||||
G4int nbOfFired = 0;
|
||||
|
||||
G4THitsMap<G4double>* evtMap =
|
||||
static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_cryst));
|
||||
|
||||
std::map<G4int,G4double*>::iterator itr;
|
||||
for (itr = evtMap->GetMap()->begin(); itr != evtMap->GetMap()->end(); itr++) {
|
||||
G4double edep = *(itr->second);
|
||||
if (edep > eThreshold) nbOfFired++;
|
||||
///G4int copyNb = (itr->first);
|
||||
///G4cout << G4endl << " cryst" << copyNb << ": " << edep/keV << " keV ";
|
||||
}
|
||||
if (nbOfFired == 2) fGoodEvents++;
|
||||
|
||||
//Dose deposit in patient
|
||||
//
|
||||
G4double dose = 0.;
|
||||
|
||||
evtMap = static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_patient));
|
||||
|
||||
for (itr = evtMap->GetMap()->begin(); itr != evtMap->GetMap()->end(); itr++) {
|
||||
///G4int copyNb = (itr->first);
|
||||
dose = *(itr->second);
|
||||
}
|
||||
fSumDose += dose;
|
||||
|
||||
G4Run::RecordEvent(event);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B3bRun::Merge(const G4Run* aRun)
|
||||
{
|
||||
const B3bRun* localRun = static_cast<const B3bRun*>(aRun);
|
||||
fGoodEvents += localRun->fGoodEvents;
|
||||
fSumDose += localRun->fSumDose;
|
||||
|
||||
G4Run::Merge(aRun);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,130 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: B3bRunAction.cc 94031 2015-11-05 11:54:38Z ihrivnac $
|
||||
//
|
||||
/// \file B3bRunAction.cc
|
||||
/// \brief Implementation of the B3bRunAction class
|
||||
|
||||
#include "B3bRunAction.hh"
|
||||
#include "B3bRun.hh"
|
||||
#include "B3PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3bRunAction::B3bRunAction()
|
||||
: G4UserRunAction()
|
||||
{
|
||||
//add new units for dose
|
||||
//
|
||||
const G4double milligray = 1.e-3*gray;
|
||||
const G4double microgray = 1.e-6*gray;
|
||||
const G4double nanogray = 1.e-9*gray;
|
||||
const G4double picogray = 1.e-12*gray;
|
||||
|
||||
new G4UnitDefinition("milligray", "milliGy" , "Dose", milligray);
|
||||
new G4UnitDefinition("microgray", "microGy" , "Dose", microgray);
|
||||
new G4UnitDefinition("nanogray" , "nanoGy" , "Dose", nanogray);
|
||||
new G4UnitDefinition("picogray" , "picoGy" , "Dose", picogray);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B3bRunAction::~B3bRunAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4Run* B3bRunAction::GenerateRun()
|
||||
{ return new B3bRun; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B3bRunAction::BeginOfRunAction(const G4Run* run)
|
||||
{
|
||||
G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
|
||||
|
||||
//inform the runManager to save random number seed
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B3bRunAction::EndOfRunAction(const G4Run* run)
|
||||
{
|
||||
G4int nofEvents = run->GetNumberOfEvent();
|
||||
if (nofEvents == 0) return;
|
||||
|
||||
// Run conditions
|
||||
// note: There is no primary generator action object for "master"
|
||||
// run manager for multi-threaded mode.
|
||||
const B3PrimaryGeneratorAction* generatorAction
|
||||
= static_cast<const B3PrimaryGeneratorAction*>(
|
||||
G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction());
|
||||
G4String partName;
|
||||
if (generatorAction)
|
||||
{
|
||||
G4ParticleDefinition* particle
|
||||
= generatorAction->GetParticleGun()->GetParticleDefinition();
|
||||
partName = particle->GetParticleName();
|
||||
}
|
||||
|
||||
//results
|
||||
//
|
||||
const B3bRun* b3Run = static_cast<const B3bRun*>(run);
|
||||
G4int nbGoodEvents = b3Run->GetNbGoodEvents();
|
||||
G4double sumDose = b3Run->GetSumDose();
|
||||
|
||||
//print
|
||||
//
|
||||
if (IsMaster())
|
||||
{
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< "--------------------End of Global Run-----------------------"
|
||||
<< G4endl
|
||||
<< " The run was " << nofEvents << " events ";
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< "--------------------End of Local Run------------------------"
|
||||
<< G4endl
|
||||
<< " The run was " << nofEvents << " "<< partName;
|
||||
}
|
||||
G4cout
|
||||
<< "; Nb of 'good' e+ annihilations: " << nbGoodEvents << G4endl
|
||||
<< " Total dose in patient : " << G4BestUnit(sumDose,"Dose") << G4endl
|
||||
<< "------------------------------------------------------------" << G4endl
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
Reference in New Issue
Block a user