Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: HistoManager.cc 72240 2013-07-12 08:42:44Z gcosmo $
// $Id: HistoManager.cc 110439 2018-05-23 11:24:51Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -60,20 +60,28 @@ void HistoManager::Book()
analysisManager->SetActivation(true); //enable inactivation of histograms
// Define histograms start values
const G4int kMaxHisto = 10;
const G4String id[] = { "0", "1", "2", "3" , "4", "5", "6" , "7", "8", "9"};
const G4int kMaxHisto = 17;
const G4String id[] = { "0", "1", "2", "3" , "4", "5", "6" , "7", "8", "9",
"10","11","12","13","14","15","16"};
const G4String title[] =
{ "dummy", //0
"Multiple Scattering. True step length", //1
"Multiple Scattering. Geom step length", //2
"Multiple Scattering. Ratio geomSl/trueSl", //3
"Multiple Scattering. Lateral displacement: radius", //4
"Multiple Scattering. Lateral displac: psi_space", //5
"Multiple Scattering. Angular distrib: theta_plane", //6
"Multiple Scattering. Phi-position angle", //7
"Multiple Scattering. Phi-direction angle", //8
"Multiple Scattering. Correlation: std::cos(phiPos-phiDir)"//9
};
{ "dummy", //0
"Multiple Scattering. True step length", //1
"Multiple Scattering. Geom step length", //2
"Multiple Scattering. Ratio geomSl/trueSl", //3
"Multiple Scattering. Lateral displacement: radius", //4
"Multiple Scattering. Lateral displac: psi_space", //5
"Multiple Scattering. Angular distrib: theta_plane", //6
"Multiple Scattering. Phi-position angle", //7
"Multiple Scattering. Phi-direction angle", //8
"Multiple Scattering. Correlation: std::cos(phiPos-phiDir)",//9
"Gamma Conversion. Open Angle * Egamma", //10
"Gamma Conversion. Log10(P recoil)", //11
"Gamma Conversion. Phi P recoil angle", //12
"Gamma Conversion. Phi P plus angle", //13
"Gamma Conversion. 2 * cos(phiplus + phiminus) Asymmetry", //14
"Gamma Conversion. E plus / E gamma", //15
"Gamma Conversion. Phi of Gamma Polarization" //16
};
// Default values (to be reset via /analysis/h1/set command)
G4int nbins = 100;
@@ -0,0 +1,351 @@
//
// ********************************************************************
// * 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: $
//
//---------------------------------------------------------------------------
//
// ClassName: PhysListEm5DStandard
//
// Author: IgS 07.11.2017
//
// Modified:
// 17.11.2017 Created using PhysListEm5DStandard from V.Ivanchenko
//
//----------------------------------------------------------------------------
//
#include "PhysListEm5DStandard.hh"
#include "G4SystemOfUnits.hh"
#include "G4ParticleDefinition.hh"
#include "G4EmParameters.hh"
#include "G4LossTableManager.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4RayleighScattering.hh"
#include "G4BetheHeitler5DModel.hh"
#include "G4eMultipleScattering.hh"
#include "G4MuMultipleScattering.hh"
#include "G4hMultipleScattering.hh"
#include "G4CoulombScattering.hh"
#include "G4eCoulombScatteringModel.hh"
#include "G4WentzelVIModel.hh"
#include "G4UrbanMscModel.hh"
#include "G4MuBremsstrahlungModel.hh"
#include "G4MuPairProductionModel.hh"
#include "G4hBremsstrahlungModel.hh"
#include "G4hPairProductionModel.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4UAtomicDeexcitation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hBremsstrahlung.hh"
#include "G4hPairProduction.hh"
#include "G4hIonisation.hh"
#include "G4ionIonisation.hh"
#include "G4alphaIonisation.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
#include "G4Proton.hh"
#include "G4AntiProton.hh"
#include "G4Deuteron.hh"
#include "G4Triton.hh"
#include "G4He3.hh"
#include "G4Alpha.hh"
#include "G4GenericIon.hh"
#include "G4PhysicsListHelper.hh"
#include "G4BuilderType.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEm5DStandard::PhysListEm5DStandard(G4int ver, const G4String&)
: G4VPhysicsConstructor("G4EmStandard_5D"), verbose(ver)
{
G4EmParameters* param = G4EmParameters::Instance();
param->SetDefaults();
param->SetVerbose(verbose);
param->SetNumberOfBinsPerDecade(10);
param->SetMscStepLimitType(fUseSafetyPlus);
#if G4VERSION_NUMBER >= 1040
param->SetLateralDisplacementAlg96(false);
#endif
param->SetFluo(true);
SetPhysicsType(bElectromagnetic);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEm5DStandard::~PhysListEm5DStandard()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListEm5DStandard::ConstructParticle()
{
// gamma
G4Gamma::Gamma();
// leptons
G4Electron::Electron();
G4Positron::Positron();
G4MuonPlus::MuonPlus();
G4MuonMinus::MuonMinus();
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
// barions
G4Proton::Proton();
G4AntiProton::AntiProton();
// ions
G4Deuteron::Deuteron();
G4Triton::Triton();
G4He3::He3();
G4Alpha::Alpha();
G4GenericIon::GenericIonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListEm5DStandard::ConstructProcess()
{
if(verbose > 1) {
G4cout << "### " << GetPhysicsName() << " Construct Processes " << G4endl;
}
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
// muon & hadron bremsstrahlung and pair production
G4MuBremsstrahlung* mub = new G4MuBremsstrahlung();
G4MuPairProduction* mup = new G4MuPairProduction();
G4hBremsstrahlung* pib = new G4hBremsstrahlung();
G4hPairProduction* pip = new G4hPairProduction();
G4hBremsstrahlung* kb = new G4hBremsstrahlung();
G4hPairProduction* kp = new G4hPairProduction();
G4hBremsstrahlung* pb = new G4hBremsstrahlung();
G4hPairProduction* pp = new G4hPairProduction();
// muon & hadron multiple scattering
G4MuMultipleScattering* mumsc = new G4MuMultipleScattering();
mumsc->AddEmModel(0, new G4WentzelVIModel());
G4CoulombScattering* muss = new G4CoulombScattering();
G4MuMultipleScattering* pimsc = new G4MuMultipleScattering();
pimsc->AddEmModel(0, new G4WentzelVIModel());
G4CoulombScattering* piss = new G4CoulombScattering();
G4MuMultipleScattering* kmsc = new G4MuMultipleScattering();
kmsc->AddEmModel(0, new G4WentzelVIModel());
G4CoulombScattering* kss = new G4CoulombScattering();
G4hMultipleScattering* hmsc = new G4hMultipleScattering("ionmsc");
// high energy limit for e+- scattering models
G4double highEnergyLimit = 100*MeV;
// Add standard EM Processes
auto myParticleIterator=GetParticleIterator();
myParticleIterator->reset();
while( (*myParticleIterator)() ){
G4ParticleDefinition* particle = myParticleIterator->value();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// photo-effect and Compton
ph->RegisterProcess(new G4PhotoElectricEffect(), particle);
ph->RegisterProcess(new G4ComptonScattering(), particle);
// Gamma conversion
G4GammaConversion* gc = new G4GammaConversion();
G4VEmModel* theGC5DModel = new G4BetheHeitler5DModel();
gc->SetEmModel(theGC5DModel);
ph->RegisterProcess(gc, particle);
// Rayleigh scattering
ph->RegisterProcess(new G4RayleighScattering(), particle);
} else if (particleName == "e-") {
G4eMultipleScattering* msc = new G4eMultipleScattering;
G4UrbanMscModel* msc1 = new G4UrbanMscModel();
G4WentzelVIModel* msc2 = new G4WentzelVIModel();
msc1->SetHighEnergyLimit(highEnergyLimit);
msc2->SetLowEnergyLimit(highEnergyLimit);
msc->AddEmModel(0, msc1);
msc->AddEmModel(0, msc2);
G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel();
G4CoulombScattering* ss = new G4CoulombScattering();
ss->SetEmModel(ssm, 1);
ss->SetMinKinEnergy(highEnergyLimit);
ssm->SetLowEnergyLimit(highEnergyLimit);
ssm->SetActivationLowEnergyLimit(highEnergyLimit);
ph->RegisterProcess(msc, particle);
ph->RegisterProcess(new G4eIonisation(), particle);
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
ph->RegisterProcess(ss, particle);
} else if (particleName == "e+") {
G4eMultipleScattering* msc = new G4eMultipleScattering;
G4UrbanMscModel* msc1 = new G4UrbanMscModel();
G4WentzelVIModel* msc2 = new G4WentzelVIModel();
msc1->SetHighEnergyLimit(highEnergyLimit);
msc2->SetLowEnergyLimit(highEnergyLimit);
msc->AddEmModel(0, msc1);
msc->AddEmModel(0, msc2);
G4eCoulombScatteringModel* ssm = new G4eCoulombScatteringModel();
G4CoulombScattering* ss = new G4CoulombScattering();
ss->SetEmModel(ssm, 1);
ss->SetMinKinEnergy(highEnergyLimit);
ssm->SetLowEnergyLimit(highEnergyLimit);
ssm->SetActivationLowEnergyLimit(highEnergyLimit);
ph->RegisterProcess(msc, particle);
ph->RegisterProcess(new G4eIonisation(), particle);
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
ph->RegisterProcess(new G4eplusAnnihilation(), particle);
ph->RegisterProcess(ss, particle);
} else if (particleName == "mu+" ||
particleName == "mu-" ) {
ph->RegisterProcess(mumsc, particle);
ph->RegisterProcess(new G4MuIonisation(), particle);
ph->RegisterProcess(mub, particle);
ph->RegisterProcess(mup, particle);
ph->RegisterProcess(muss, particle);
} else if (particleName == "alpha" ||
particleName == "He3") {
ph->RegisterProcess(new G4hMultipleScattering(), particle);
ph->RegisterProcess(new G4ionIonisation(), particle);
} else if (particleName == "GenericIon") {
ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(new G4ionIonisation(), particle);
} else if (particleName == "pi+" ||
particleName == "pi-" ) {
ph->RegisterProcess(pimsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
ph->RegisterProcess(pib, particle);
ph->RegisterProcess(pip, particle);
ph->RegisterProcess(piss, particle);
} else if (particleName == "kaon+" ||
particleName == "kaon-" ) {
ph->RegisterProcess(kmsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
ph->RegisterProcess(kb, particle);
ph->RegisterProcess(kp, particle);
ph->RegisterProcess(kss, particle);
} else if (particleName == "proton" ||
particleName == "anti_proton") {
G4hMultipleScattering* pmsc = new G4hMultipleScattering();
pmsc->SetEmModel(new G4WentzelVIModel());
G4hIonisation* hIoni = new G4hIonisation();
hIoni->SetStepFunction(0.1, 10*um);
ph->RegisterProcess(pmsc, particle);
ph->RegisterProcess(hIoni, particle);
ph->RegisterProcess(pb, particle);
ph->RegisterProcess(pp, particle);
ph->RegisterProcess(new G4CoulombScattering(), particle);
} else if (particleName == "B+" ||
particleName == "B-" ||
particleName == "D+" ||
particleName == "D-" ||
particleName == "Ds+" ||
particleName == "Ds-" ||
particleName == "anti_He3" ||
particleName == "anti_alpha" ||
particleName == "anti_deuteron" ||
particleName == "anti_lambda_c+" ||
particleName == "anti_omega-" ||
particleName == "anti_sigma_c+" ||
particleName == "anti_sigma_c++" ||
particleName == "anti_sigma+" ||
particleName == "anti_sigma-" ||
particleName == "anti_triton" ||
particleName == "anti_xi_c+" ||
particleName == "anti_xi-" ||
particleName == "deuteron" ||
particleName == "lambda_c+" ||
particleName == "omega-" ||
particleName == "sigma_c+" ||
particleName == "sigma_c++" ||
particleName == "sigma+" ||
particleName == "sigma-" ||
particleName == "tau+" ||
particleName == "tau-" ||
particleName == "triton" ||
particleName == "xi_c+" ||
particleName == "xi-" ) {
ph->RegisterProcess(hmsc, particle);
ph->RegisterProcess(new G4hIonisation(), particle);
}
}
// Deexcitation
//
G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
G4LossTableManager::Instance()->SetAtomDeexcitation(de);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,7 +27,7 @@
/// \brief Implementation of the PhysicsList class
//
//
// $Id: PhysicsList.cc 100277 2016-10-17 08:32:55Z gcosmo $
// $Id: PhysicsList.cc 110788 2018-06-14 06:45:08Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -190,6 +190,11 @@ void PhysicsList::ConstructProcess()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4EmStandardPhysics_option3.hh"
#include "G4EmStandardPhysicsWVI.hh"
#include "G4EmStandardPhysicsGS.hh"
#include "G4EmStandardPhysicsSS.hh"
#include "G4EmLivermorePolarizedPhysics.hh"
#include "PhysListEm5DStandard.hh"
void PhysicsList::AddPhysicsList(const G4String& name)
{
@@ -210,7 +215,35 @@ void PhysicsList::AddPhysicsList(const G4String& name)
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysics_option3();
} else if (name == "emstandardSS") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsSS();
} else if (name == "emstandardWVI") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsWVI();
} else if (name == "emstandardGS") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmStandardPhysicsGS();
} else if (name == "emstandard5D") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new PhysListEm5DStandard();
} else if (name == "emlivermorePola") {
fEmName = name;
delete fEmPhysicsList;
fEmPhysicsList = new G4EmLivermorePolarizedPhysics();
} else {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
<< " is not defined"
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm15/src/RunAction.cc
/// \brief Implementation of the RunAction class
//
// $Id: RunAction.cc 82283 2014-06-13 14:49:40Z gcosmo $
// $Id: RunAction.cc 109394 2018-04-18 06:22:36Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -129,83 +129,87 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
G4cout << "\t" << procName << " = " << count;
}
if (fTotalCount == 0) return;
if (fTotalCount > 0) {
//compute path length and related quantities
//
G4double MeanTPL = fTruePL /fTotalCount;
G4double MeanTPL2 = fTruePL2/fTotalCount;
G4double rmsTPL = std::sqrt(std::fabs(MeanTPL2 - MeanTPL*MeanTPL));
G4double MeanGPL = fGeomPL /fTotalCount;
G4double MeanGPL2 = fGeomPL2/fTotalCount;
G4double rmsGPL = std::sqrt(std::fabs(MeanGPL2 - MeanGPL*MeanGPL));
G4double MeanLaD = fLDispl /fTotalCount;
G4double MeanLaD2 = fLDispl2/fTotalCount;
G4double rmsLaD = std::sqrt(std::fabs(MeanLaD2 - MeanLaD*MeanLaD));
G4double MeanPsi = fPsiSpa /(fTotalCount);
G4double MeanPsi2 = fPsiSpa2/(fTotalCount);
G4double rmsPsi = std::sqrt(std::fabs(MeanPsi2 - MeanPsi*MeanPsi));
G4double MeanTeta = fTetPrj /(2*fTotalCount);
G4double MeanTeta2 = fTetPrj2/(2*fTotalCount);
G4double rmsTeta = std::sqrt(std::fabs(MeanTeta2 - MeanTeta*MeanTeta));
G4double MeanCorrel = fPhiCor /(fTotalCount);
G4double MeanCorrel2 = fPhiCor2/(fTotalCount);
G4double rmsCorrel = std::sqrt(std::fabs(MeanCorrel2-MeanCorrel*MeanCorrel));
G4cout << "\n\n truePathLength :\t" << G4BestUnit(MeanTPL,"Length")
<< " +- " << G4BestUnit( rmsTPL,"Length")
<< "\n geomPathLength :\t" << G4BestUnit(MeanGPL,"Length")
<< " +- " << G4BestUnit( rmsGPL,"Length")
<< "\n lateralDisplac :\t" << G4BestUnit(MeanLaD,"Length")
<< " +- " << G4BestUnit( rmsLaD,"Length")
<< "\n Psi :\t" << MeanPsi/mrad << " mrad"
<< " +- " << rmsPsi /mrad << " mrad"
<< " (" << MeanPsi/deg << " deg"
<< " +- " << rmsPsi /deg << " deg)"
<< G4endl;
G4cout << "\n Theta_plane :\t" << rmsTeta/mrad << " mrad"
<< " (" << rmsTeta/deg << " deg)"
<< "\n phi correlation:\t" << MeanCorrel
<< " +- " << rmsCorrel
<< " (std::cos(phi_pos - phi_dir))"
<< G4endl;
//cross check from G4EmCalculator
//
G4cout << "\n Verification from G4EmCalculator. \n";
G4EmCalculator emCal;
//get transport mean free path (for multiple scattering)
G4double MSmfp = emCal.GetMeanFreePath(energy,particle,"msc",material);
//compute path length and related quantities
//
G4double MeanTPL = fTruePL /fTotalCount;
G4double MeanTPL2 = fTruePL2/fTotalCount;
G4double rmsTPL = std::sqrt(std::fabs(MeanTPL2 - MeanTPL*MeanTPL));
//get range from restricted dedx
G4double range = emCal.GetRangeFromRestricteDEDX(energy,particle,material);
G4double MeanGPL = fGeomPL /fTotalCount;
G4double MeanGPL2 = fGeomPL2/fTotalCount;
G4double rmsGPL = std::sqrt(std::fabs(MeanGPL2 - MeanGPL*MeanGPL));
G4double MeanLaD = fLDispl /fTotalCount;
G4double MeanLaD2 = fLDispl2/fTotalCount;
G4double rmsLaD = std::sqrt(std::fabs(MeanLaD2 - MeanLaD*MeanLaD));
G4double MeanPsi = fPsiSpa /(fTotalCount);
G4double MeanPsi2 = fPsiSpa2/(fTotalCount);
G4double rmsPsi = std::sqrt(std::fabs(MeanPsi2 - MeanPsi*MeanPsi));
G4double MeanTeta = fTetPrj /(2*fTotalCount);
G4double MeanTeta2 = fTetPrj2/(2*fTotalCount);
G4double rmsTeta = std::sqrt(std::fabs(MeanTeta2 - MeanTeta*MeanTeta));
G4double MeanCorrel = fPhiCor /(fTotalCount);
G4double MeanCorrel2 = fPhiCor2/(fTotalCount);
G4double rmsCorrel =
std::sqrt(std::fabs(MeanCorrel2-MeanCorrel*MeanCorrel));
G4cout << "\n\n truePathLength :\t" << G4BestUnit(MeanTPL,"Length")
<< " +- " << G4BestUnit( rmsTPL,"Length")
<< "\n geomPathLength :\t" << G4BestUnit(MeanGPL,"Length")
<< " +- " << G4BestUnit( rmsGPL,"Length")
<< "\n lateralDisplac :\t" << G4BestUnit(MeanLaD,"Length")
<< " +- " << G4BestUnit( rmsLaD,"Length")
<< "\n Psi :\t" << MeanPsi/mrad << " mrad"
<< " +- " << rmsPsi /mrad << " mrad"
<< " (" << MeanPsi/deg << " deg"
<< " +- " << rmsPsi /deg << " deg)"
<< G4endl;
G4cout << "\n Theta_plane :\t" << rmsTeta/mrad << " mrad"
<< " (" << rmsTeta/deg << " deg)"
<< "\n phi correlation:\t" << MeanCorrel
<< " +- " << rmsCorrel
<< " (std::cos(phi_pos - phi_dir))"
<< G4endl;
//cross check from G4EmCalculator
//
G4cout << "\n Verification from G4EmCalculator. \n";
G4EmCalculator emCal;
//effective facRange
G4double efFacrange = MeanTPL/std::max(MSmfp, range);
if (MeanTPL/range >= 0.99) efFacrange = 1.;
G4cout << "\n transport mean free path :\t" << G4BestUnit(MSmfp,"Length")
<< "\n range from restrict dE/dx:\t" << G4BestUnit(range,"Length")
<< "\n ---> effective facRange :\t" << efFacrange
<< G4endl;
G4cout << "\n compute theta0 from Highland :\t"
<< ComputeMscHighland(MeanTPL)/mrad << " mrad"
<< " (" << ComputeMscHighland(MeanTPL)/deg << " deg)"
<< G4endl;
//get transport mean free path (for multiple scattering)
G4double MSmfp = emCal.GetMeanFreePath(energy,particle,"msc",material);
//get range from restricted dedx
G4double range = emCal.GetRangeFromRestricteDEDX(energy,particle,material);
//effective facRange
G4double efFacrange = MeanTPL/std::max(MSmfp, range);
if (MeanTPL/range >= 0.99) efFacrange = 1.;
G4cout << "\n transport mean free path :\t" << G4BestUnit(MSmfp,"Length")
<< "\n range from restrict dE/dx:\t" << G4BestUnit(range,"Length")
<< "\n ---> effective facRange :\t" << efFacrange
<< G4endl;
G4cout << "\n compute theta0 from Highland :\t"
<< ComputeMscHighland(MeanTPL)/mrad << " mrad"
<< " (" << ComputeMscHighland(MeanTPL)/deg << " deg)"
<< G4endl;
} else
G4cout<< G4endl;
//restore default format
G4cout.precision(prec);
// delete and remove all contents in fProcCounter
while (fProcCounter->size()>0){
OneProcessCount* aProcCount=fProcCounter->back();
@@ -217,8 +221,8 @@ void RunAction::EndOfRunAction(const G4Run* aRun)
//save histograms
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
if ( analysisManager->IsActive() ) {
analysisManager->Write();
analysisManager->CloseFile();
analysisManager->Write();
analysisManager->CloseFile();
}
// show Rndm status
@@ -26,7 +26,7 @@
/// \file electromagnetic/TestEm15/src/SteppingAction.cc
/// \brief Implementation of the SteppingAction class
//
// $Id: SteppingAction.cc 73022 2013-08-15 09:09:48Z gcosmo $
// $Id: SteppingAction.cc 110439 2018-05-23 11:24:51Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -35,9 +35,13 @@
#include "DetectorConstruction.hh"
#include "RunAction.hh"
#include "HistoManager.hh"
#include "G4ParticleTypes.hh"
#include "G4RunManager.hh"
#include <G4ThreeVector.hh>
#include <G4RotationMatrix.hh>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(DetectorConstruction* det,
@@ -64,57 +68,144 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
//
G4RunManager::GetRunManager()->AbortEvent();
//count processes and keep only Multiple Scattering
//count processes and keep only Multiple Scattering or gamma converion
//
G4StepPoint* endPoint = aStep->GetPostStepPoint();
G4String procName = endPoint->GetProcessDefinedStep()->GetProcessName();
fRunAction->CountProcesses(procName);
if (procName != "msc" && procName != "muMsc" && procName != "stepMax") return;
//below, only multiple Scattering happens
//
G4ThreeVector position = endPoint->GetPosition();
G4ThreeVector direction = endPoint->GetMomentumDirection();
G4double truePathLength = aStep->GetStepLength();
G4double geomPathLength = position.x() + 0.5*fDetector->GetBoxSize();
G4double ratio = geomPathLength/truePathLength;
fRunAction->SumPathLength(truePathLength,geomPathLength);
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->FillH1(1,truePathLength);
analysisManager->FillH1(2,geomPathLength);
analysisManager->FillH1(3,ratio);
G4double yend = position.y(), zend = position.z();
G4double lateralDisplacement = std::sqrt(yend*yend + zend*zend);
fRunAction->SumLateralDisplacement(lateralDisplacement);
analysisManager->FillH1(4,lateralDisplacement);
G4double psi = std::atan(lateralDisplacement/geomPathLength);
fRunAction->SumPsi(psi);
analysisManager->FillH1(5,psi);
G4double xdir = direction.x(), ydir = direction.y(), zdir = direction.z();
G4double tetaPlane = std::atan2(ydir, xdir);
fRunAction->SumTetaPlane(tetaPlane);
analysisManager->FillH1(6,tetaPlane);
tetaPlane = std::atan2(zdir, xdir);
fRunAction->SumTetaPlane(tetaPlane);
analysisManager->FillH1(6,tetaPlane);
G4double phiPos = std::atan2(zend, yend);
analysisManager->FillH1(7,phiPos);
G4double phiDir = std::atan2(zdir, ydir);
analysisManager->FillH1(8,phiDir);
if (procName == "msc" || procName == "muMsc" || procName == "stepMax") {
//below, only multiple Scattering happens
//
G4ThreeVector position = endPoint->GetPosition();
G4ThreeVector direction = endPoint->GetMomentumDirection();
G4double truePathLength = aStep->GetStepLength();
G4double geomPathLength = position.x() + 0.5*fDetector->GetBoxSize();
G4double ratio = geomPathLength/truePathLength;
fRunAction->SumPathLength(truePathLength,geomPathLength);
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->FillH1(1,truePathLength);
analysisManager->FillH1(2,geomPathLength);
analysisManager->FillH1(3,ratio);
G4double yend = position.y(), zend = position.z();
G4double lateralDisplacement = std::sqrt(yend*yend + zend*zend);
fRunAction->SumLateralDisplacement(lateralDisplacement);
analysisManager->FillH1(4,lateralDisplacement);
G4double psi = std::atan(lateralDisplacement/geomPathLength);
fRunAction->SumPsi(psi);
analysisManager->FillH1(5,psi);
G4double xdir = direction.x(), ydir = direction.y(), zdir = direction.z();
G4double tetaPlane = std::atan2(ydir, xdir);
fRunAction->SumTetaPlane(tetaPlane);
analysisManager->FillH1(6,tetaPlane);
tetaPlane = std::atan2(zdir, xdir);
fRunAction->SumTetaPlane(tetaPlane);
analysisManager->FillH1(6,tetaPlane);
G4double phiPos = std::atan2(zend, yend);
analysisManager->FillH1(7,phiPos);
G4double phiDir = std::atan2(zdir, ydir);
analysisManager->FillH1(8,phiDir);
G4double phiCorrel = 0.;
if (lateralDisplacement > 0.)
phiCorrel = (yend*ydir + zend*zdir)/lateralDisplacement;
fRunAction->SumPhiCorrel(phiCorrel);
analysisManager->FillH1(9,phiCorrel);
G4double phiCorrel = 0.;
if (lateralDisplacement > 0.)
phiCorrel = (yend*ydir + zend*zdir)/lateralDisplacement;
fRunAction->SumPhiCorrel(phiCorrel);
analysisManager->FillH1(9,phiCorrel);
} else if (procName == "conv" ) {
// gamma conversion
G4StepPoint* PrePoint = aStep->GetPreStepPoint();
G4double EGamma = PrePoint->GetTotalEnergy();
G4ThreeVector PGamma = PrePoint->GetMomentum();
G4ThreeVector PolaGamma = PrePoint->GetPolarization();
G4double Eplus=-1;
// G4double Eminus=-1;
// G4double Erecoil=-1;
G4ThreeVector Pplus, Pminus, Precoil;
//G4int recPDG;
const G4TrackVector* secondary = fpSteppingManager->GetSecondary();
for (size_t lp=0; lp< std::min((*secondary).size(),size_t(2) ); lp++) {
if ((*secondary)[lp]->GetDefinition()==G4Electron::ElectronDefinition()) {
// Eminus = (*secondary)[lp]->GetTotalEnergy();
Pminus = (*secondary)[lp]->GetMomentum();
} //else {
if ((*secondary)[lp]->GetDefinition()==G4Positron::PositronDefinition()) {
Eplus = (*secondary)[lp]->GetTotalEnergy();
Pplus = (*secondary)[lp]->GetMomentum();
}
}
if ( (*secondary).size() >= 3 ) {
// Erecoil = (*secondary)[2]->GetTotalEnergy();
Precoil = (*secondary)[2]->GetMomentum();
// recPDG = (*secondary)[2]->GetDynamicParticle()->GetPDGcode();
} else {
// Erecoil = 0.0;
Precoil = G4ThreeVector();
// recPDG = 0;
}
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
// Fill Histograms
G4ThreeVector gammadir = PGamma.unit(); // gamma direction
G4ThreeVector z = gammadir;
G4ThreeVector x(1.,0.,0.);
// pola perpendicular to direction
if ( PolaGamma.mag() != 0.0 ) {
x = PolaGamma.unit();
} else { // Pola = 0 case
// Direction (z) is unitary vector
// (projection to plane) p_proj = p - (p o d)/(d o d) x d
if ( x.howOrthogonal(z) != 0) {
x = x - x.dot(z) * z;
}
if (x.mag() != 0.0 ) {
x = x.unit();
} else {
x.set(0.0,0.0,1.0);
}
}
G4ThreeVector y = z;
y = y.cross(x);
G4RotationMatrix GtoW(x,y,z); // from gamma ref. sys. to World
G4RotationMatrix WtoG = inverseOf(GtoW); // from World to gamma ref. sys.
G4double angleE = Pplus.angle(Pminus) * EGamma;
analysisManager->FillH1(10,angleE);
analysisManager->FillH1(11,std::log10(Precoil.mag()));
//analysisManager->FillH1(12,Precoil.rotateUz(gammadir).phi());
analysisManager->FillH1(12,Precoil.transform(WtoG).phi());
// G4double phiPlus = Pplus.rotateUz(gammadir).phi();
// G4double phiMinus = Pminus.rotateUz(gammadir).phi();
G4double phiPlus = Pplus.transform(WtoG).phi();
G4double phiMinus = Pminus.transform(WtoG).phi();
analysisManager->FillH1(13,phiPlus);
analysisManager->FillH1(14,std::cos(phiPlus + phiMinus) * -2.0);
analysisManager->FillH1(15,Eplus/EGamma);
//G4double phiPola = PolaGamma.rotateUz(gammadir).phi();
G4double phiPola = PolaGamma.transform(WtoG).phi();
analysisManager->FillH1(16, phiPola);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......