Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "SteppingAction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "TrackingAction.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::ActionInitialization(DetectorConstruction* detConstruction)
|
||||
: G4VUserActionInitialization(),
|
||||
fDetectorConstruction(detConstruction)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::~ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
// In MT mode, to be clearer, the RunAction class for the master thread might be
|
||||
// different than the one used for the workers.
|
||||
// This RunAction will be called before and after starting the
|
||||
// workers.
|
||||
// For more details, please refer to :
|
||||
// https://twiki.cern.ch/twiki/bin/view/Geant4/Geant4MTForApplicationDevelopers
|
||||
//
|
||||
// RunAction* runAction= new RunAction(fDetectorConstruction);
|
||||
// SetUserAction(runAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
// G4cout << "Build for = "<< G4RunManager::GetRunManager()->GetRunManagerType() << G4endl;
|
||||
|
||||
SetUserAction(new PrimaryGeneratorAction);
|
||||
|
||||
TrackingAction* trackingAction = new TrackingAction(fDetectorConstruction);
|
||||
SetUserAction(trackingAction);
|
||||
|
||||
RunAction* runAction= new RunAction();
|
||||
SetUserAction(runAction);
|
||||
|
||||
SetUserAction(new SteppingAction());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,140 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
// $Id: DetectorConstruction.cc,v 1.1 2012-09-20 mraine Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Region.hh"
|
||||
#include "G4ProductionCuts.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
:fPhysiWorld(NULL), fLogicWorld(NULL), fSolidWorld(NULL)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
|
||||
{
|
||||
DefineMaterials();
|
||||
return ConstructDetector();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
|
||||
// Silicon is defined from NIST material database
|
||||
G4NistManager * man = G4NistManager::Instance();
|
||||
G4Material * Si = man->FindOrBuildMaterial("G4_Si");
|
||||
|
||||
// Default materials in setup.
|
||||
fSiMaterial = Si;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
G4VPhysicalVolume* DetectorConstruction::ConstructDetector()
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
// WORLD VOLUME
|
||||
|
||||
fWorldSizeX = 1*um;
|
||||
fWorldSizeY = 1*um;
|
||||
fWorldSizeZ = 1*um;
|
||||
|
||||
fSolidWorld = new G4Box("World", //its name
|
||||
fWorldSizeX/2,fWorldSizeY/2,fWorldSizeZ/2); //its size
|
||||
|
||||
|
||||
fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
|
||||
fSiMaterial, //its material
|
||||
"World"); //its name
|
||||
|
||||
fPhysiWorld = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
"World", //its name
|
||||
fLogicWorld, //its logical volume
|
||||
0, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
G4double TargetSizeZ = 0.2*um;
|
||||
|
||||
G4Box* targetSolid = new G4Box("Target", //its name
|
||||
fWorldSizeX/2,fWorldSizeY/2,TargetSizeZ/2); //its size
|
||||
|
||||
|
||||
G4LogicalVolume* logicTarget = new G4LogicalVolume(targetSolid, //its solid
|
||||
fSiMaterial, //its material
|
||||
"Target"); //its name
|
||||
|
||||
new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
"Target", //its name
|
||||
logicTarget, //its logical volume
|
||||
fPhysiWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
// Visualization attributes
|
||||
G4VisAttributes* worldVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); //White
|
||||
worldVisAtt->SetVisibility(true);
|
||||
fLogicWorld->SetVisAttributes(worldVisAtt);
|
||||
|
||||
G4VisAttributes* worldVisAtt1 = new G4VisAttributes(G4Colour(1.0,0.0,0.0));
|
||||
worldVisAtt1->SetVisibility(true);
|
||||
logicTarget->SetVisAttributes(worldVisAtt1);
|
||||
|
||||
// Create Target G4Region and add logical volume
|
||||
|
||||
fRegion = new G4Region("Target");
|
||||
|
||||
G4ProductionCuts* cuts = new G4ProductionCuts();
|
||||
|
||||
G4double defCut = 1*nanometer;
|
||||
cuts->SetProductionCut(defCut,"gamma");
|
||||
cuts->SetProductionCut(defCut,"e-");
|
||||
cuts->SetProductionCut(defCut,"e+");
|
||||
cuts->SetProductionCut(defCut,"proton");
|
||||
|
||||
fRegion->SetProductionCuts(cuts);
|
||||
fRegion->AddRootLogicalVolume(logicTarget);
|
||||
|
||||
return fPhysiWorld;
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ElectronCapture.cc,v 1.1 2010-08-31 11:23:58 vnivanch Exp $
|
||||
// GEANT4 tag $Name: not supported by cvs2svn $
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// ClassName: G4ElectronCapture
|
||||
//
|
||||
// Description: The process to kill particles to save CPU
|
||||
//
|
||||
// Author: V.Ivanchenko 31 August 2010
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4ElectronCapture.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Region.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4Electron.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ElectronCapture::G4ElectronCapture(const G4String& regName, G4double ekinlim)
|
||||
: G4VDiscreteProcess("eCapture", fElectromagnetic), kinEnergyThreshold(ekinlim),
|
||||
regionName(regName), region(0)
|
||||
{
|
||||
if(regName == "" || regName == "world") {
|
||||
regionName = "DefaultRegionForTheWorld";
|
||||
}
|
||||
pParticleChange = &fParticleChange;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ElectronCapture::~G4ElectronCapture()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4ElectronCapture::SetKinEnergyLimit(G4double val)
|
||||
{
|
||||
kinEnergyThreshold = val;
|
||||
if(verboseLevel > 0) {
|
||||
G4cout << "### G4ElectronCapture: Tracking cut E(MeV) = "
|
||||
<< kinEnergyThreshold/MeV << G4endl;
|
||||
}
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4ElectronCapture::BuildPhysicsTable(const G4ParticleDefinition&)
|
||||
{
|
||||
region = (G4RegionStore::GetInstance())->GetRegion(regionName);
|
||||
if(region && verboseLevel > 0) {
|
||||
G4cout << "### G4ElectronCapture: Tracking cut E(MeV) = "
|
||||
<< kinEnergyThreshold/MeV << " is assigned to " << regionName
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool G4ElectronCapture::IsApplicable(const G4ParticleDefinition&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
G4double
|
||||
G4ElectronCapture::PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
|
||||
G4double,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
G4double limit = DBL_MAX;
|
||||
if(region) {
|
||||
if(aTrack.GetVolume()->GetLogicalVolume()->GetRegion() == region &&
|
||||
aTrack.GetKineticEnergy() < kinEnergyThreshold) { limit = 0.0; }
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VParticleChange* G4ElectronCapture::PostStepDoIt(const G4Track& aTrack,
|
||||
const G4Step&)
|
||||
{
|
||||
pParticleChange->Initialize(aTrack);
|
||||
pParticleChange->ProposeTrackStatus(fStopAndKill);
|
||||
pParticleChange->ProposeLocalEnergyDeposit(aTrack.GetKineticEnergy());
|
||||
fParticleChange.SetProposedKineticEnergy(0.0);
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4ElectronCapture::GetMeanFreePath(const G4Track&,G4double,
|
||||
G4ForceCondition*)
|
||||
{
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -0,0 +1,308 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: PhysicsList.cc,v 1.1 2012-09-21 mraine Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "PhysicsList.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
PhysicsList::PhysicsList(): G4VUserPhysicsList()
|
||||
{
|
||||
defaultCutValue = 1*micrometer;
|
||||
cutForGamma = defaultCutValue;
|
||||
cutForElectron = defaultCutValue;
|
||||
cutForPositron = defaultCutValue;
|
||||
cutForProton = defaultCutValue;
|
||||
|
||||
SetVerboseLevel(1);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
PhysicsList::~PhysicsList()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructParticle()
|
||||
{
|
||||
ConstructBosons();
|
||||
ConstructLeptons();
|
||||
ConstructBarions();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructBosons()
|
||||
{
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructLeptons()
|
||||
{
|
||||
// leptons
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructBarions()
|
||||
{
|
||||
// baryons
|
||||
G4Proton::ProtonDefinition();
|
||||
G4GenericIon::GenericIonDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
ConstructGeneral();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
// Geant4-MicroElec MODELS
|
||||
|
||||
#include "G4MicroElecElastic.hh"
|
||||
#include "G4MicroElecElasticModel.hh"
|
||||
|
||||
#include "G4MicroElecInelastic.hh"
|
||||
#include "G4MicroElecInelasticModel.hh"
|
||||
//
|
||||
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4EmConfigurator.hh"
|
||||
#include "G4VEmModel.hh"
|
||||
#include "G4DummyModel.hh"
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4hIonisation.hh"
|
||||
#include "G4ionIonisation.hh"
|
||||
#include "G4eMultipleScattering.hh"
|
||||
#include "G4hMultipleScattering.hh"
|
||||
#include "G4BraggModel.hh"
|
||||
#include "G4BraggIonModel.hh"
|
||||
#include "G4BetheBlochModel.hh"
|
||||
#include "G4UrbanMscModel.hh"
|
||||
#include "G4MollerBhabhaModel.hh"
|
||||
#include "G4IonFluctuations.hh"
|
||||
#include "G4UniversalFluctuation.hh"
|
||||
|
||||
#include "G4ElectronCapture.hh"
|
||||
|
||||
#include "G4UAtomicDeexcitation.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructEM()
|
||||
{
|
||||
|
||||
theParticleIterator->reset();
|
||||
|
||||
while( (*theParticleIterator)() )
|
||||
{
|
||||
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
// *********************************
|
||||
// 1) Processes for the World region
|
||||
// *********************************
|
||||
|
||||
if (particleName == "e-") {
|
||||
|
||||
// STANDARD msc is active in the world
|
||||
G4eMultipleScattering* msc = new G4eMultipleScattering();
|
||||
pmanager->AddProcess(msc, -1, 1, 1);
|
||||
|
||||
// STANDARD ionisation is active in the world
|
||||
G4eIonisation* eion = new G4eIonisation();
|
||||
pmanager->AddProcess(eion, -1, 2, 2);
|
||||
|
||||
// MicroElec elastic is not active in the world
|
||||
G4MicroElecElastic* theMicroElecElasticProcess = new G4MicroElecElastic("e-_G4MicroElecElastic");
|
||||
theMicroElecElasticProcess->SetEmModel(new G4DummyModel(),1);
|
||||
pmanager->AddDiscreteProcess(theMicroElecElasticProcess);
|
||||
|
||||
// MicroElec ionisation is not active in the world
|
||||
G4MicroElecInelastic* microelecioni = new G4MicroElecInelastic("e-_G4MicroElecInelastic");
|
||||
microelecioni->SetEmModel(new G4DummyModel(),1);
|
||||
pmanager->AddDiscreteProcess(microelecioni);
|
||||
|
||||
// THE FOLLOWING PROCESS WILL KILL ALL ELECTRONS BELOW A SELECTED ENERY THRESHOLD
|
||||
// Capture of low-energy e-
|
||||
G4ElectronCapture* ecap = new G4ElectronCapture("Target", 16.7*eV);
|
||||
pmanager->AddDiscreteProcess(ecap);
|
||||
|
||||
} else if ( particleName == "proton" ) {
|
||||
|
||||
// STANDARD msc is active in the world
|
||||
G4hMultipleScattering* msc = new G4hMultipleScattering();
|
||||
pmanager->AddProcess(msc, -1, 1, 1);
|
||||
|
||||
// STANDARD ionisation is active in the world
|
||||
G4hIonisation* hion = new G4hIonisation();
|
||||
pmanager->AddProcess(hion, -1, 2, 2);
|
||||
|
||||
// MicroElec ionisation is not active in the world
|
||||
G4MicroElecInelastic* microelecioni = new G4MicroElecInelastic("p_G4MicroElecInelastic");
|
||||
microelecioni->SetEmModel(new G4DummyModel(),1);
|
||||
microelecioni->SetEmModel(new G4DummyModel(),2);
|
||||
pmanager->AddDiscreteProcess(microelecioni);
|
||||
|
||||
} else if (particleName == "GenericIon") {
|
||||
|
||||
// STANDARD msc is active in the world
|
||||
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
|
||||
|
||||
// STANDARD ionisation is active in the world
|
||||
G4ionIonisation* hion = new G4ionIonisation();
|
||||
pmanager->AddProcess(hion, -1, 2, 2);
|
||||
|
||||
// MicroElec ionisation is not active in the world
|
||||
G4MicroElecInelastic* microelecioni = new G4MicroElecInelastic("ion_G4MicroElecInelastic");
|
||||
microelecioni->SetEmModel(new G4DummyModel(),1);
|
||||
microelecioni->SetEmModel(new G4DummyModel(),2);
|
||||
pmanager->AddDiscreteProcess(microelecioni);
|
||||
}
|
||||
}
|
||||
|
||||
// **************************************
|
||||
// 2) Define processes for Target region
|
||||
// **************************************
|
||||
|
||||
// STANDARD EM processes should be inactivated when corresponding MicroElec processes are used
|
||||
// - STANDARD EM e- processes are inactivated below 100 MeV
|
||||
// - STANDARD EM proton & ion processes are inactivated below standEnergyLimit
|
||||
//
|
||||
G4EmConfigurator* em_config = G4LossTableManager::Instance()->EmConfigurator();
|
||||
|
||||
G4VEmModel* mod;
|
||||
// *** e-
|
||||
|
||||
// ---> STANDARD EM processes are inactivated below 100 MeV
|
||||
|
||||
G4UrbanMscModel* msc = new G4UrbanMscModel();
|
||||
msc->SetActivationLowEnergyLimit(100*MeV);
|
||||
em_config->SetExtraEmModel("e-","msc",msc,"Target");
|
||||
|
||||
mod = new G4MollerBhabhaModel();
|
||||
mod->SetActivationLowEnergyLimit(99.99*MeV);
|
||||
em_config->SetExtraEmModel("e-","eIoni",mod,"Target",0.0,10*TeV, new G4UniversalFluctuation());
|
||||
|
||||
// ---> MicroElec processes activated
|
||||
|
||||
mod = new G4MicroElecElasticModel();
|
||||
em_config->SetExtraEmModel("e-","e-_G4MicroElecElastic",mod,"Target",0.0,100*MeV);
|
||||
|
||||
mod = new G4MicroElecInelasticModel();
|
||||
em_config->SetExtraEmModel("e-","e-_G4MicroElecInelastic",mod,"Target",16.7*eV,100*MeV);
|
||||
|
||||
// *** proton
|
||||
|
||||
// ---> STANDARD EM processes inactivated below standEnergyLimit
|
||||
|
||||
// STANDARD msc is still active
|
||||
// Inactivate following STANDARD processes
|
||||
|
||||
mod = new G4BraggModel();
|
||||
mod->SetActivationHighEnergyLimit(0.499);
|
||||
em_config->SetExtraEmModel("proton","hIoni",mod,"Target",0.0,2*MeV, new G4IonFluctuations());
|
||||
|
||||
mod = new G4BetheBlochModel();
|
||||
mod->SetActivationLowEnergyLimit(0.99*GeV);
|
||||
em_config->SetExtraEmModel("proton","hIoni",mod,"Target",2*MeV,100*GeV, new G4IonFluctuations());
|
||||
|
||||
// ---> MicroElec processes activated
|
||||
mod = new G4MicroElecInelasticModel();
|
||||
em_config->SetExtraEmModel("proton","p_G4MicroElecInelastic",mod,"Target",50*keV,10*GeV);
|
||||
|
||||
// *** ion
|
||||
|
||||
// ---> STANDARD EM processes inactivated below standEnergyLimit
|
||||
|
||||
// STANDARD msc is still active
|
||||
// Inactivate following STANDARD processes
|
||||
|
||||
mod = new G4BraggIonModel();
|
||||
mod->SetActivationHighEnergyLimit(49.9*keV);
|
||||
em_config->SetExtraEmModel("GenericIon","ionIoni",mod,"Target",0.0,2*MeV, new G4IonFluctuations());
|
||||
|
||||
mod = new G4BetheBlochModel();
|
||||
mod->SetActivationLowEnergyLimit(0.99*GeV);
|
||||
em_config->SetExtraEmModel("GenericIon","ionIoni",mod,"Target",2*MeV,100*GeV, new G4IonFluctuations());
|
||||
|
||||
// ---> MicroElec processes activated
|
||||
mod = new G4MicroElecInelasticModel();
|
||||
em_config->SetExtraEmModel("GenericIon","ion_G4MicroElecInelastic",mod,"Target",50*keV,10*GeV);
|
||||
|
||||
// Deexcitation
|
||||
//
|
||||
G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
|
||||
G4LossTableManager::Instance()->SetAtomDeexcitation(de);
|
||||
de->SetFluo(true);
|
||||
de->SetAuger(true);
|
||||
de->SetPIXE(true);
|
||||
de->InitialiseForNewRun();
|
||||
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructGeneral()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::SetCuts()
|
||||
{
|
||||
if (verboseLevel >0)
|
||||
{
|
||||
G4cout << "PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
|
||||
}
|
||||
|
||||
// set cut values for gamma at first and for e- second and next for e+,
|
||||
// because some processes for e+/e- need cut values for gamma
|
||||
SetCutValue(cutForGamma, "gamma");
|
||||
SetCutValue(cutForElectron, "e-");
|
||||
SetCutValue(cutForPositron, "e+");
|
||||
SetCutValue(cutForProton, "proton");
|
||||
|
||||
if (verboseLevel>0) { DumpCutValuesTable(); }
|
||||
}
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
// $Id: PrimaryGeneratorAction.cc,v 1.1 2012-09-21 mraine Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default gun parameters
|
||||
fParticleGun->SetParticleEnergy(10.*keV);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,-0.4*um));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
// $Id: RunAction.cc,v 1.1 2012-09-21 mraine Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "TrackingAction.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "Analysis.hh"
|
||||
#include "G4Threading.hh"
|
||||
|
||||
void PrintNParticles(std::map<const G4ParticleDefinition*, int>& container);
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
RunAction::RunAction()
|
||||
{
|
||||
fpTrackingAction = 0;
|
||||
fInitialized = 0;
|
||||
fDebug = false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
RunAction::~RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* run)
|
||||
{
|
||||
// In this example, we considered that the same class was
|
||||
// used for both master and worker threads.
|
||||
// However, in case the run action is long,
|
||||
// for better code review, this practice is not recommanded.
|
||||
//
|
||||
|
||||
if(isMaster) // WARNING : in sequential mode, isMaster == true
|
||||
BeginMaster(run);
|
||||
else
|
||||
BeginWorker(run);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::EndOfRunAction(const G4Run* run)
|
||||
{
|
||||
if(isMaster)
|
||||
EndMaster(run);
|
||||
else
|
||||
EndWorker(run);
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::BeginMaster(const G4Run* run)
|
||||
{
|
||||
bool sequential = (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::sequentialRM);
|
||||
|
||||
if(fDebug)
|
||||
{
|
||||
G4cout << "°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°" << G4endl;
|
||||
if(!sequential)
|
||||
G4cout << "°°°°°°°°°°°°°°°° RunAction::BeginMaster" << G4endl;
|
||||
PrintRunInfo(run);
|
||||
G4cout << "°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°" << G4endl;
|
||||
}
|
||||
|
||||
if(sequential)
|
||||
{
|
||||
if(!fInitialized)
|
||||
InitializeWorker(run);
|
||||
// Note: fpTrackingAction could be used as a flag for initialization instead
|
||||
|
||||
CreateHistogram();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::BeginWorker(const G4Run* run)
|
||||
{
|
||||
if(fDebug)
|
||||
{
|
||||
G4cout << "°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°" << G4endl;
|
||||
G4cout << "°°°°°°°°°°°°°°°° RunAction::BeginWorker" << G4endl;
|
||||
PrintRunInfo(run);
|
||||
G4cout << "°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°" << G4endl;
|
||||
}
|
||||
if(!fInitialized)
|
||||
InitializeWorker(run);
|
||||
|
||||
CreateHistogram();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::EndMaster(const G4Run* run)
|
||||
{
|
||||
bool sequential = (G4RunManager::GetRunManager()->GetRunManagerType()
|
||||
== G4RunManager::sequentialRM);
|
||||
if(sequential)
|
||||
EndWorker(run);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::EndWorker(const G4Run* run)
|
||||
{
|
||||
if(fDebug)
|
||||
{
|
||||
PrintRunInfo(run);
|
||||
}
|
||||
|
||||
G4int nofEvents = run->GetNumberOfEvent();
|
||||
if ( nofEvents == 0 )
|
||||
{
|
||||
if(fDebug)
|
||||
{
|
||||
G4cout << "°°°°°°°°°°°°°°°° NO EVENTS TREATED IN THIS RUN ==> LEAVING RunAction::EndOfRunAction "<< G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
///////////////
|
||||
// Write Histo
|
||||
//
|
||||
WriteHistogram();
|
||||
|
||||
///////////////
|
||||
// Complete cleanup
|
||||
//
|
||||
delete G4AnalysisManager::Instance();
|
||||
|
||||
///////////////
|
||||
// Printouts
|
||||
//
|
||||
std::map<const G4ParticleDefinition*, int>&
|
||||
particlesCreatedInWorld = fpTrackingAction->GetNParticlesCreatedInWorld();
|
||||
|
||||
G4cout << "Number and type of particles created outside region \"Target\" :" << G4endl;
|
||||
|
||||
PrintNParticles(particlesCreatedInWorld);
|
||||
|
||||
G4cout << "_______________________" << G4endl;
|
||||
|
||||
std::map<const G4ParticleDefinition*, int>&
|
||||
particlesCreatedInTarget = fpTrackingAction->GetNParticlesCreatedInTarget();
|
||||
|
||||
G4cout << "Number and type of particles created in region \"Target\" :" << G4endl;
|
||||
|
||||
PrintNParticles(particlesCreatedInTarget);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::InitializeWorker(const G4Run*)
|
||||
{
|
||||
if (fpTrackingAction == 0)
|
||||
{
|
||||
fpTrackingAction = (TrackingAction*) G4RunManager::GetRunManager()->GetUserTrackingAction();
|
||||
|
||||
if(fpTrackingAction == 0 && isMaster == false)
|
||||
{
|
||||
G4ExceptionDescription exDescrption ;
|
||||
exDescrption << "fpTrackingAction is a null pointer. Has it been correctly initialized ?";
|
||||
G4Exception("RunAction::BeginOfRunAction","RunAction001",FatalException, exDescrption);
|
||||
}
|
||||
}
|
||||
|
||||
fInitialized = true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::CreateHistogram()
|
||||
{
|
||||
// Book histograms, ntuple
|
||||
|
||||
// Create analysis manager
|
||||
// The choice of analysis technology is done via selection of a namespace
|
||||
// in Analysis.hh
|
||||
|
||||
G4cout << "##### Create analysis manager " << " " << this << G4endl;
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
G4cout << "Using " << analysisManager->GetType() << " analysis manager" << G4endl;
|
||||
|
||||
// Create directories
|
||||
|
||||
//analysisManager->SetHistoDirectoryName("histograms");
|
||||
//analysisManager->SetNtupleDirectoryName("ntuple");
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
|
||||
// Open an output file
|
||||
|
||||
G4String fileName = "microelectronics";
|
||||
analysisManager->OpenFile(fileName);
|
||||
|
||||
// Creating ntuple
|
||||
|
||||
analysisManager->CreateNtuple("microelectronics", "physics");
|
||||
analysisManager->CreateNtupleDColumn("flagParticle");
|
||||
analysisManager->CreateNtupleDColumn("flagProcess");
|
||||
analysisManager->CreateNtupleDColumn("x");
|
||||
analysisManager->CreateNtupleDColumn("y");
|
||||
analysisManager->CreateNtupleDColumn("z");
|
||||
analysisManager->CreateNtupleDColumn("totalEnergyDeposit");
|
||||
analysisManager->CreateNtupleDColumn("stepLength");
|
||||
analysisManager->CreateNtupleDColumn("kineticEnergyDifference");
|
||||
analysisManager->FinishNtuple();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::WriteHistogram()
|
||||
{
|
||||
// print histogram statistics
|
||||
//
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// save histograms
|
||||
//
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::PrintRunInfo(const G4Run* run)
|
||||
{
|
||||
G4cout << "°°°°°°°°°°°°°°°° Run is = " << run->GetRunID() << G4endl;
|
||||
G4cout << "°°°°°°°°°°°°°°°° Run type is = " << G4RunManager::GetRunManager()->GetRunManagerType() << G4endl;
|
||||
G4cout << "°°°°°°°°°°°°°°°° Event processed = " << run->GetNumberOfEventToBeProcessed() << G4endl;
|
||||
G4cout << "°°°°°°°°°°°°°°°° N° Event = " << run->GetNumberOfEvent() << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
void PrintNParticles(std::map<const G4ParticleDefinition*, int>& container)
|
||||
{
|
||||
std::map<const G4ParticleDefinition*, int>::iterator it;
|
||||
for(it = container.begin() ;
|
||||
it != container.end(); it ++)
|
||||
{
|
||||
G4cout << "N " << it->first->GetParticleName() << " : " << it->second << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
// $Id: SteppingAction.cc,v 1.1 2012-09-21 mraine Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Analysis.hh"
|
||||
|
||||
#include "SteppingAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
SteppingAction::SteppingAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
SteppingAction::~SteppingAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void SteppingAction::UserSteppingAction(const G4Step* step)
|
||||
{
|
||||
G4double flagParticle=0.;
|
||||
G4double flagProcess=0.;
|
||||
G4double x,y,z,xp,yp,zp;
|
||||
|
||||
if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "e-") flagParticle = 1;
|
||||
if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "proton") flagParticle = 2;
|
||||
if (step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "GenericIon") flagParticle = 3;
|
||||
|
||||
if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="msc") flagProcess =10;
|
||||
if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4MicroElecElastic") flagProcess =11;
|
||||
if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="e-_G4MicroElecInelastic") flagProcess =12;
|
||||
if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="eCapture") flagProcess =13;
|
||||
|
||||
if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="p_G4MicroElecInelastic") flagProcess =14;
|
||||
|
||||
if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="ion_G4MicroElecInelastic") flagProcess =15;
|
||||
|
||||
if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="hIoni") flagProcess =16;
|
||||
if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="eIoni") flagProcess =17;
|
||||
|
||||
if (step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()!="Transportation")
|
||||
{
|
||||
x=step->GetPreStepPoint()->GetPosition().x()/nanometer;
|
||||
y=step->GetPreStepPoint()->GetPosition().y()/nanometer;
|
||||
z=step->GetPreStepPoint()->GetPosition().z()/nanometer;
|
||||
xp=step->GetPostStepPoint()->GetPosition().x()/nanometer;
|
||||
yp=step->GetPostStepPoint()->GetPosition().y()/nanometer;
|
||||
zp=step->GetPostStepPoint()->GetPosition().z()/nanometer;
|
||||
|
||||
// get analysis manager
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// fill ntuple
|
||||
analysisManager->FillNtupleDColumn(0, flagParticle);
|
||||
analysisManager->FillNtupleDColumn(1, flagProcess);
|
||||
analysisManager->FillNtupleDColumn(2, x);
|
||||
analysisManager->FillNtupleDColumn(3, y);
|
||||
analysisManager->FillNtupleDColumn(4, z);
|
||||
analysisManager->FillNtupleDColumn(5, step->GetTotalEnergyDeposit()/eV);
|
||||
analysisManager->FillNtupleDColumn(6, std::sqrt((x-xp)*(x-xp)+(y-yp)*(y-yp)+(z-zp)*(z-zp))/nm);
|
||||
analysisManager->FillNtupleDColumn(7, (step->GetPreStepPoint()->GetKineticEnergy() - step->GetPostStepPoint()->GetKineticEnergy())/eV );
|
||||
analysisManager->AddNtupleRow();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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$
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "TrackingAction.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4Region.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
TrackingAction::TrackingAction(DetectorConstruction* detector)
|
||||
{
|
||||
fDetector = detector;
|
||||
fTargetRegion = 0;
|
||||
}
|
||||
|
||||
TrackingAction::~TrackingAction()
|
||||
{
|
||||
fDetector = 0;
|
||||
fTargetRegion = 0;
|
||||
}
|
||||
|
||||
void TrackingAction::PreUserTrackingAction(const G4Track* track)
|
||||
{
|
||||
const G4ParticleDefinition* particleDefinition = track->GetParticleDefinition();
|
||||
|
||||
if(particleDefinition == G4Electron::Definition() || particleDefinition == G4Gamma::Definition())
|
||||
{
|
||||
if(fTargetRegion == 0) // target region is initialized after detector construction instantiation
|
||||
{
|
||||
fTargetRegion = fDetector->GetTargetRegion();
|
||||
}
|
||||
|
||||
const G4ThreeVector& position = track->GetPosition();
|
||||
|
||||
int N = fTargetRegion->GetNumberOfRootVolumes();
|
||||
std::vector<G4LogicalVolume*>::iterator it_logicalVolumeInRegion =
|
||||
fTargetRegion->GetRootLogicalVolumeIterator();
|
||||
|
||||
bool inside_target = false;
|
||||
|
||||
for(int i = 0; i < N ; i++, it_logicalVolumeInRegion++)
|
||||
{
|
||||
EInside test_status = (*it_logicalVolumeInRegion)->GetSolid()->Inside(position) ;
|
||||
if(test_status == kInside)
|
||||
{
|
||||
inside_target = true;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
else if (test_status == kSurface)
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
if(inside_target == true)
|
||||
{
|
||||
fNParticleInTarget[particleDefinition]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
fNParticleInWorld[particleDefinition]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user