Import Geant4 8.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:07:44 +02:00
parent fe73f43734
commit 75c7fd177d
764 changed files with 45230 additions and 95238 deletions
@@ -0,0 +1,115 @@
//
// ********************************************************************
// * 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: G4QuasiElasticChannel.cc,v 1.1 2007/03/30 15:25:54 gunter Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// Author : Gunter Folger March 2007
// Class Description
// Final state production model for theoretical models of hadron inelastic
// quasi elastic scattering in geant4;
// Class Description - End
//
// Modified:
#include "G4QuasiElasticChannel.hh"
#include "G4HadTmpUtil.hh" //lrint
G4QuasiElasticChannel::G4QuasiElasticChannel()
{
theQuasiElastic=G4QuasiFreeRatios::GetPointer();
}
G4QuasiElasticChannel::~G4QuasiElasticChannel()
{}
G4double G4QuasiElasticChannel::GetFraction(G4Nucleus &theNucleus,
const G4DynamicParticle & thePrimary)
{
std::pair<G4double,G4double> ratios;
ratios=theQuasiElastic->GetRatios(thePrimary.GetTotalMomentum(),
thePrimary.GetDefinition()->GetPDGEncoding(),
G4lrint(theNucleus.GetZ()),
G4lrint(theNucleus.GetN()-theNucleus.GetZ()));
#ifdef debug_getFraction
G4cout << "G4QuasiElasticChannel::ratios " << ratios.first << " x " <<ratios.second
<< " = " << ratios.first*ratios.second << G4endl;
#endif
return ratios.first*ratios.second;
}
G4KineticTrackVector * G4QuasiElasticChannel::Scatter(G4Nucleus &theNucleus,
const G4DynamicParticle & thePrimary)
{
G4int A=G4lrint(theNucleus.GetN());
G4int Z=G4lrint(theNucleus.GetZ());
G4double an=G4UniformRand()*A;
G4ParticleDefinition * pDef;
if ( an < Z )
{
pDef=G4Proton::Proton();
} else
{
pDef=G4Neutron::Neutron();
}
#ifdef debug_scatter
G4cout << " neutron - proton? A, Z, an, pdg" <<" "<< A <<" "<<Z
<< " "<<an <<" " << pDef->GetParticleName()<< G4endl;
#endif
G4LorentzVector pNucleon(G4ThreeVector(0,0,0),pDef->GetPDGMass());
std::pair<G4LorentzVector,G4LorentzVector> result;
result=theQuasiElastic->Scatter(pDef->GetPDGEncoding(),pNucleon,
thePrimary.GetDefinition()->GetPDGEncoding(),
thePrimary.Get4Momentum());
if (result.first.e() == 0.)
{
G4cout << "Warning - G4QuasiElasticChannel::Scatter no scattering" << G4endl;
return 0; //no scatter
}
G4KineticTrackVector * ktv;
ktv=new G4KineticTrackVector();
G4KineticTrack * sPrim=new G4KineticTrack(thePrimary.GetDefinition(),
0.,G4ThreeVector(0), result.second);
ktv->push_back(sPrim);
G4KineticTrack * sNuc=new G4KineticTrack(pDef,
0.,G4ThreeVector(0), result.first);
ktv->push_back(sNuc);
#ifdef debug_scatter
G4cout << " scattered Nucleon : " << result.first << G4endl;
G4cout << " scattered Project : " << result.second << G4endl;
#endif
return ktv;
}
@@ -24,21 +24,26 @@
// ********************************************************************
//
//
// $Id: G4TheoFSGenerator.cc,v 1.5 2006/06/29 21:00:39 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4TheoFSGenerator.cc,v 1.7 2007/04/12 07:53:38 gunter Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// G4TheoFSGenerator
#include "G4DynamicParticle.hh"
#include "G4TheoFSGenerator.hh"
#include "G4ReactionProductVector.hh"
#include "G4ReactionProduct.hh"
G4TheoFSGenerator::G4TheoFSGenerator()
G4TheoFSGenerator::G4TheoFSGenerator(const G4String& name)
: G4HadronicInteraction(name)
, theParallelFSGenerator(0)
{
theParticleChange = new G4HadFinalState;
}
G4TheoFSGenerator::G4TheoFSGenerator(const G4TheoFSGenerator &) : G4HadronicInteraction()
G4TheoFSGenerator::G4TheoFSGenerator(const G4TheoFSGenerator &)
: G4HadronicInteraction("TheoFSGenerator")
, theParallelFSGenerator(0)
{
}
@@ -80,14 +85,39 @@ G4HadFinalState * G4TheoFSGenerator::ApplyYourself(const G4HadProjectile & thePr
G4DynamicParticle aTemp(const_cast<G4ParticleDefinition *>(thePrimary.GetDefinition()),
thePrimary.Get4Momentum().vect());
const G4DynamicParticle * aPart = &aTemp;
if ( theParallelFSGenerator ) {
if ( theParallelFSGenerator->GetFraction(theNucleus, *aPart) > G4UniformRand() )
{
G4KineticTrackVector *result= theParallelFSGenerator->Scatter(theNucleus, *aPart);
if (result)
{
for(unsigned int i=0; i<result->size(); i++)
{
G4DynamicParticle * aNew =
new G4DynamicParticle(result->operator[](i)->GetDefinition(),
result->operator[](i)->Get4Momentum().e(),
result->operator[](i)->Get4Momentum().vect());
theParticleChange->AddSecondary(aNew);
delete result->operator[](i);
}
delete result;
} else
{
theParticleChange->SetStatusChange(isAlive);
theParticleChange->SetEnergyChange(thePrimary.GetKineticEnergy());
theParticleChange->SetMomentumChange(thePrimary.Get4Momentum().vect().unit());
}
return theParticleChange;
}
}
G4KineticTrackVector * theInitialResult =
theHighEnergyGenerator->Scatter(theNucleus, *aPart);
G4double predecayEnergy = 0;
for(size_t hpw=0; hpw<theInitialResult->size(); hpw++)
{
predecayEnergy += (*theInitialResult)[hpw]->Get4Momentum().t();
}
G4ReactionProductVector * theTransportResult = NULL;
G4int hitCount = 0;