Import Geant4 9.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:25:56 +02:00
parent 74cad5e589
commit 89a9605df1
4440 changed files with 379508 additions and 189225 deletions
@@ -0,0 +1,18 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4hadronic_interface_ci
# Package: Geant4.src.G4processes.G4hadronic.G4hadronic_models.G4hadronic_chips.G4hadronic_interface_ci
#
# CMakeLists.txt for building a single granular library.
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 18:58:05 bmorgan Exp $
#
#------------------------------------------------------------------------------
if(GEANT4_BUILD_GRANULAR_LIBS)
include(Geant4MacroLibraryTargets)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
endif()
@@ -12,6 +12,33 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
18-Nov-2010 J.Apostolakis (hadr-chips-inter-V09-03-03)
---------------------------------------------------------------------------
- G4ChiralInvariantPhaseSpace.cc: Change to use integer value of Z and A.
10-Nov-2010 V.Ivanchenko (hadr-chips-inter-V09-03-02)
---------------------------------------------------------------------------
- G4ElectroNuclearReaction - cross section classes are included by pointer
and not by value, this should not change any result but providing
clear siquence of removel of cross sections after execution
(fixed old problem reported in HyperNews)
13-Sep-2010 A. Dotti (hadr-chips-inter-V09-03-01)
---------------------------------------------------------------------------
- Fix in G4ChiralInvariantPhaseSpace to catch previously un-handled exceptions
produced when a 'chipolino' pseudo-particle is produced by the model and
thrown by Q4QEnvironment::Fragment, retrying the interaction; handles the
case in which Q4QEnvironment returns a 90000000 fragment, and converts it
to a gamma. Addressing problem report #1138.
25-May-2010 M.Kosov (hadr-chips-inter-V09-03-00)
---------------------------------------------------------------------------
Z+N instead of N for A, which sometimes in G4Had is called N.
24-Jan-2010 M.Kosov (hadr-chips-V09-03-01)
-----------------------------------------------------------------------
Mutual tag: G4Hadr interface to CHIPS elastic is added
17-Nov-2009 M.Kosov (hadr-chips-V09-02-24)
-----------------------------------------------------------------------
Mutual tag: Migration of CHIPS-cross_section depenent files to CHIPS-xs_dep
@@ -23,13 +23,14 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ElectroNuclearReaction.hh,v 1.27 2009/02/23 09:49:24 mkossov Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4ElectroNuclearReaction.hh,v 1.28 2010/11/10 16:20:11 vnivanch Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// GEANT4 physics class: G4ElectroNuclearReaction -- header file for CHIPS
// Created: J.P. Wellisch, following M. Kossov's algorithm. 12/11/2001
// The last update: J.P. Wellisch, 06-June-02
// 17.02.2009 M.Kossov, now it is recommended to use the G4QCollision process
// 10.11.2010 V.Ivanchenko use cross sections by pointer and not by value
//
#ifndef G4ElectroNuclearReaction_h
#define G4ElectroNuclearReaction_h 1
@@ -69,6 +70,8 @@ public:
theStringModel.SetFragmentationModel(theStringDecay);
theHEModel->SetMinEnergy(2.5*GeV);
theHEModel->SetMaxEnergy(100*TeV);
theElectronData = new G4ElectroNuclearCrossSection;
thePhotonData = new G4PhotoNuclearCrossSection;
}
virtual ~G4ElectroNuclearReaction() {delete theStringDecay;};
@@ -84,8 +87,8 @@ private:
G4QGSModel< G4GammaParticipants > theStringModel;
G4QGSMFragmentation theFragmentation;
G4ExcitedStringDecay * theStringDecay;
G4ElectroNuclearCrossSection theElectronData;
G4PhotoNuclearCrossSection thePhotonData;
G4ElectroNuclearCrossSection* theElectronData;
G4PhotoNuclearCrossSection* thePhotonData;
G4HadFinalState theResult;
};
@@ -124,7 +127,7 @@ G4HadFinalState* G4ElectroNuclearReaction::ApplyYourself(const G4HadProjectile&
}
// Note: high energy gamma nuclear now implemented.
G4double xSec = theElectronData.GetCrossSection(theElectron, anElement);// Check XSection
G4double xSec = theElectronData->GetCrossSection(theElectron, anElement);// Check XSection
if(xSec<=0.)
{
theResult.SetStatusChange(isAlive);
@@ -133,7 +136,7 @@ G4HadFinalState* G4ElectroNuclearReaction::ApplyYourself(const G4HadProjectile&
theResult.SetMomentumChange(theElectron->GetMomentumDirection());
return &theResult; // DO-NOTHING condition
}
G4double photonEnergy = theElectronData.GetEquivalentPhotonEnergy();
G4double photonEnergy = theElectronData->GetEquivalentPhotonEnergy();
G4double theElectronKinEnergy=theElectron->GetKineticEnergy();
if( theElectronKinEnergy < photonEnergy )
{
@@ -145,7 +148,7 @@ G4HadFinalState* G4ElectroNuclearReaction::ApplyYourself(const G4HadProjectile&
theResult.SetMomentumChange(theElectron->GetMomentumDirection());
return &theResult; // DO-NOTHING condition
}
G4double photonQ2 = theElectronData.GetEquivalentPhotonQ2(photonEnergy);
G4double photonQ2 = theElectronData->GetEquivalentPhotonQ2(photonEnergy);
G4double W=photonEnergy-photonQ2/dM; // Hadronic energy flow from the virtual photon
if(getenv("debug_G4ElectroNuclearReaction") )
{
@@ -164,11 +167,11 @@ G4HadFinalState* G4ElectroNuclearReaction::ApplyYourself(const G4HadProjectile&
G4DynamicParticle* theDynamicPhoton = new
G4DynamicParticle(G4Gamma::GammaDefinition(),
G4ParticleMomentum(1.,0.,0.), photonEnergy*MeV); //----->-*
G4double sigNu=thePhotonData.GetCrossSection(theDynamicPhoton, anElement); // |
G4double sigNu=thePhotonData->GetCrossSection(theDynamicPhoton, anElement); // |
theDynamicPhoton->SetKineticEnergy(W); // Redefine photon with equivalent energy |
G4double sigK =thePhotonData.GetCrossSection(theDynamicPhoton, anElement); // |
G4double sigK =thePhotonData->GetCrossSection(theDynamicPhoton, anElement); // |
delete theDynamicPhoton; // <-------------------------------------------------------*
G4double rndFraction = theElectronData.GetVirtualFactor(photonEnergy, photonQ2);
G4double rndFraction = theElectronData->GetVirtualFactor(photonEnergy, photonQ2);
if(sigNu*G4UniformRand()>sigK*rndFraction)
{
theResult.SetStatusChange(isAlive);
@@ -0,0 +1,100 @@
//
// ********************************************************************
// * 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: G4QHadronElasticDataSet.hh,v 1.2 2010/02/16 07:53:05 mkossov Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// GEANT4 physics class: G4QHadronElasticDataSet -- header file
// Created by M. Kosov (Mikhail.Kossov@cern.ch) 21.01.10
//
// ----------------------------------------------------------------------
// Short description: G4hadr wrapper for CHIPS elastic hA cross-sections.
// ----------------------------------------------------------------------
#ifndef G4QHadronElasticDataSet_h
#define G4QHadronElasticDataSet_h 1
#include "G4VCrossSectionDataSet.hh"
#include "G4DynamicParticle.hh"
#include "G4Element.hh"
#include "G4Neutron.hh"
#include "G4Proton.hh"
#include "G4PionMinus.hh"
#include "G4PionPlus.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
#include "G4KaonZeroLong.hh"
#include "G4KaonZeroShort.hh"
#include "G4Lambda.hh"
#include "G4SigmaPlus.hh"
#include "G4SigmaMinus.hh"
#include "G4SigmaZero.hh"
#include "G4XiMinus.hh"
#include "G4XiZero.hh"
#include "G4OmegaMinus.hh"
#include "G4AntiNeutron.hh"
#include "G4AntiProton.hh"
#include "G4AntiLambda.hh"
#include "G4AntiSigmaPlus.hh"
#include "G4AntiSigmaMinus.hh"
#include "G4AntiSigmaZero.hh"
#include "G4AntiXiMinus.hh"
#include "G4AntiXiZero.hh"
#include "G4AntiOmegaMinus.hh"
#include "G4QIsotope.hh"
#include "G4QProtonElasticCrossSection.hh"
#include "G4QNeutronElasticCrossSection.hh"
#include "G4QPionMinusElasticCrossSection.hh"
#include "G4QPionPlusElasticCrossSection.hh"
#include "G4QKaonPlusElasticCrossSection.hh"
#include "G4QKaonMinusElasticCrossSection.hh"
#include "G4QHyperonElasticCrossSection.hh"
#include "G4QHyperonPlusElasticCrossSection.hh"
#include "G4QAntiBaryonElasticCrossSection.hh"
class G4QHadronElasticDataSet : public G4VCrossSectionDataSet
{
public:
G4QHadronElasticDataSet();
~G4QHadronElasticDataSet() {}
G4bool IsApplicable(const G4DynamicParticle* aParticle, const G4Element* anElement);
G4bool IsZAApplicable(const G4DynamicParticle* aParticle, G4double Z, G4double A);
G4double GetCrossSection(const G4DynamicParticle* Part, const G4Element* El, G4double T);
G4double GetIsoZACrossSection(const G4DynamicParticle* P,G4double Z,G4double A,G4double);
void BuildPhysicsTable(const G4ParticleDefinition&){}
void DumpPhysicsTable(const G4ParticleDefinition&) {}
private:
G4QIsotope* Isotopes; // Pointer to the G4QIsotopes singleton
static std::vector <G4int> ElementZ; // Z of the element(i) in theLastCalc
static std::vector <std::vector<G4int>*> ElIsoN; // N of isotope(j) of Element(i)
static std::vector <std::vector<G4double>*> IsoProbInEl;// SumProbabIsotopes in Element i
};
#endif
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4QHadronInelasticDataSet.hh,v 1.1 2009/11/20 10:08:36 mkossov Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4QHadronInelasticDataSet.hh,v 1.2 2010/01/22 17:02:49 mkossov Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// GEANT4 physics class: G4QHadronInelasticDataSet -- header file
// Created by M. Kosov (Mikhail.Kossov@cern.ch) 11.11.09
@@ -116,27 +116,6 @@ public:
private:
//G4VQCrossSection* CHIPSpAin;
//G4VQCrossSection* CHIPSnAin;
//G4VQCrossSection* CHIPSpimAin;
//G4VQCrossSection* CHIPSpipAin;
//G4VQCrossSection* CHIPSkpAin;
//G4VQCrossSection* CHIPSkmAin;
//G4VQCrossSection* CHIPSk0Ain;
//G4VQCrossSection* CHIPShAin;
//G4VQCrossSection* CHIPShpAin;
//G4VQCrossSection* CHIPSabpAin;
//G4VQCrossSection* CHIPSabAin;
////G4VQCrossSection* CHIPSphAin;
////G4VQCrossSection* CHIPSeAin;
////G4VQCrossSection* CHIPSmuAin;
////G4VQCrossSection* CHIPStauAin;
////G4VQCrossSection* CHIPSnumAin;
////G4VQCrossSection* CHIPSanumAin;
////G4VQCrossSection* CHIPSnueAin;
////G4VQCrossSection* CHIPSanueAin;
////G4VQCrossSection* CHIPSnunuAin;
////G4VQCrossSection* CHIPSananAin;
G4QIsotope* Isotopes; // Pointer to the G4QIsotopes singleton
static std::vector <G4int> ElementZ; // Z of the element(i) in theLastCalc
static std::vector <std::vector<G4int>*> ElIsoN; // N of isotope(j) of Element(i)
@@ -0,0 +1,110 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4hadronic_interface_ci
# Package: Geant4.src.G4processes.G4hadronic.G4hadronic_models.G4hadronic_chips.G4hadronic_interface_ci
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.1 2010/09/29 18:58:13 bmorgan Exp $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/magneticfield/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/navigation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/bosons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/hadrons/barions/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/hadrons/ions/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/hadrons/mesons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/leptons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/shortlived/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/cross_sections/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/chiral_inv_phase_space/body/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/chiral_inv_phase_space/cross_sections/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/chiral_inv_phase_space/fragmentation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/chiral_inv_phase_space/interface/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/util/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/util/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/track/include)
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4hadronic_interface_ci
HEADERS
G4ChiralInvariantPhaseSpace.hh
G4ElectroNuclearReaction.hh
G4GammaNuclearReaction.hh
G4PionMinusNuclearAtRestChips.hh
G4PionMinusNuclearReaction.hh
G4ProtonAntiProtonAtRestChips.hh
G4ProtonAntiProtonReaction.hh
G4QHadronElasticDataSet.hh
G4QHadronInelasticDataSet.hh
G4QStringChipsParticleLevelInterface.hh
G4StringChipsInterface.hh
G4StringChipsParticleLevelInterface.hh
SOURCES
G4ChiralInvariantPhaseSpace.cc
G4GammaNuclearReaction.cc
G4QHadronElasticDataSet.cc
G4QHadronInelasticDataSet.cc
G4QStringChipsParticleLevelInterface.cc
G4StringChipsInterface.cc
G4StringChipsParticleLevelInterface.cc
GRANULAR_DEPENDENCIES
G4baryons
G4bosons
G4geometrymng
G4globman
G4had_mod_man
G4had_mod_util
G4hadronic_body_ci
G4hadronic_crosec_ci
G4hadronic_fragm_ci
G4hadronic_interface_ci
G4hadronic_mgt
G4hadronic_util
G4hadronic_xsect
G4ions
G4leptons
G4magneticfield
G4materials
G4mesons
G4navigation
G4partman
G4procman
G4shortlived
G4track
G4volumes
GLOBAL_DEPENDENCIES
G4geometry
G4global
G4materials
G4particles
G4track
LINK_LIBRARIES
)
# List any source specific properties here
@@ -23,8 +23,14 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// Created: H.-P. Wellicsh: GHAD model wrapper for the CHIPS model (1997)
// Modified:
// 24.08.10 A. Dotti (andrea.dotti@cern.ch) handle exceptions
// thrown by Q4QEnvironment::Fragment retying interaction
// 17.06.10 A. Dotti (andrea.dotti@cern.ch) handle case in which
// Q4QEnvironment returns a 90000000 fragment (see code comments)
// Created:
// 16.01.08 V.Ivanchenko use initialization similar to other CHIPS models
//
@@ -34,6 +40,7 @@
#include "G4DynamicParticle.hh"
#include "G4IonTable.hh"
#include "G4Neutron.hh"
#include "G4Gamma.hh"
G4ChiralInvariantPhaseSpace::G4ChiralInvariantPhaseSpace()
{}
@@ -64,8 +71,8 @@ G4HadFinalState * G4ChiralInvariantPhaseSpace::ApplyYourself(
->GetPDGEncoding();
//target properties needed in constructor of quasmon
G4int targetZ = G4int(aTargetNucleus.GetZ()+0.5);
G4int targetA = G4int(aTargetNucleus.GetN()+0.5);
G4int targetZ = aTargetNucleus.GetZ_asInt();
G4int targetA = aTargetNucleus.GetA_asInt();
G4int targetPDGCode = 90000000 + 1000*targetZ + (targetA-targetZ);
// NOT NECESSARY ______________
G4double targetMass = G4ParticleTable::GetParticleTable()->GetIonTable()
@@ -94,37 +101,56 @@ G4HadFinalState * G4ChiralInvariantPhaseSpace::ApplyYourself(
halfTheStrangenessOfSee,
etaToEtaPrime);
// G4QEnvironment::SetParameters(solidAngle);
// G4cout << "Input info "<< projectilePDGCode << " "
// << targetPDGCode <<" "
// << 1./MeV*proj4Mom<<" "
// << 1./MeV*targ4Mom << " "
// << nop << G4endl;
// G4cout << "Input info "<< projectilePDGCode << " "
// << targetPDGCode <<" "
// << 1./MeV*proj4Mom<<" "
// << 1./MeV*targ4Mom << " "
// << nop << G4endl;
G4QHadronVector projHV;
G4QHadron* iH = new G4QHadron(projectilePDGCode, 1./MeV*proj4Mom);
projHV.push_back(iH);
G4QEnvironment* pan= new G4QEnvironment(projHV, targetPDGCode);
//G4Quasmon* pan= new G4Quasmon(projectilePDGCode, targetPDGCode,
// 1./MeV*proj4Mom, 1./MeV*targ4Mom, nop);
//AND
//A. Dotti 24 Aug. : Trying to handle situation when G4QEnvironment::Fragment throws an exception
// Seen by ATLAS for gamma+Nuclear interaction for Gamma@2.4GeV on Al
// The poor-man solution here is to re-try interaction if a G4QException is catched
// Warning: G4QExcpetion does NOT inherit from base class G4HadException
G4QHadronVector* output=0;
try
{
output = pan->Fragment();
}
catch(G4HadronicException & aR)
{
G4cerr << "Exception thrown passing through G4ChiralInvariantPhaseSpace "<<G4endl;
G4cerr << " targetPDGCode = "<< targetPDGCode <<G4endl;
G4cerr << " Dumping the information in the pojectile list"<<G4endl;
for(size_t i=0; i< projHV.size(); i++)
bool retry=true;
int retryes=0;
int maxretries=10;
while ( retry && retryes < maxretries )
{
G4cerr <<" Incoming 4-momentum and PDG code of "<<i<<"'th hadron: "
<<" "<< projHV[i]->Get4Momentum()<<" "<<projHV[i]->GetPDGCode()<<G4endl;
G4QEnvironment* pan= new G4QEnvironment(projHV, targetPDGCode);
try
{
++retryes;
output = pan->Fragment();
retry=false;//If here, Fragment did not throw! (AND)
}
catch( ... )
{
G4cerr << "***WARNING*** Exception thrown passing through G4ChiralInvariantPhaseSpace "<<G4endl;
G4cerr << " targetPDGCode = "<< targetPDGCode <<G4endl;
G4cerr << " Dumping the information in the pojectile list"<<G4endl;
for(size_t i=0; i< projHV.size(); i++)
{
G4cerr <<" Incoming 4-momentum and PDG code of "<<i<<"'th hadron: "
<<" "<< projHV[i]->Get4Momentum()<<" "<<projHV[i]->GetPDGCode()<<G4endl;
}
G4cerr << "Retrying interaction "<<G4endl; //AND
//throw; //AND
}
delete pan;
} //AND
if ( retryes >= maxretries ) //AND
{
G4cerr << "***ERROR*** Maximum number of retries ("<<maxretries<<") reached for G4QEnvironment::Fragment(), exception is being thrown" << G4endl;
throw G4HadronicException(__FILE__,__LINE__,"G4ChiralInvariantPhaseSpace::ApplyYourself(...) - Maximum number of re-tries reached, abandon interaction");
}
throw;
}
std::for_each(projHV.begin(), projHV.end(), DeleteQHadron());
projHV.clear();
delete pan;
// Fill the particle change.
G4DynamicParticle * theSec;
@@ -132,6 +158,8 @@ G4HadFinalState * G4ChiralInvariantPhaseSpace::ApplyYourself(
G4cout << "G4ChiralInvariantPhaseSpace: NEW EVENT #ofHadrons="
<<output->size()<<G4endl;
#endif
unsigned int particle;
for( particle = 0; particle < output->size(); particle++)
{
@@ -159,17 +187,62 @@ G4HadFinalState * G4ChiralInvariantPhaseSpace::ApplyYourself(
theDefinition = G4ParticleTable::GetParticleTable()->FindIon(aZ,anN+aZ,0,aZ);
if(aZ == 0 && anN == 1) theDefinition = G4Neutron::Neutron();
}
//AND
else if ( pdgCode == 90000000 && output->operator[](particle)->Get4Momentum().m()<1*MeV )
{
//A. Dotti:
//We cure the case the model returns a (A,Z)=0,0 G4QHadron with a very small mass
//We convert this to a gamma. According to the author of the model this is the
//correct thing to do and it is done also in other parts of the CHIPS package
theDefinition = G4Gamma::Gamma();
}
//AND
else
{
theDefinition = G4ParticleTable::GetParticleTable()
->FindParticle(output->operator[](particle)->GetPDGCode());
}
//AND
//A. Dotti: Handle problematic cases in which one of the products has not been recognized
// This should never happen but we want to add an extra-protection
if ( theDefinition == NULL )
{
//If we arrived here something bad really happened. We do not know how to handle the products of the interaction, we give up, resetting the
//result and keeping the primary alive.
G4cerr<<"**WARNING*** G4ChiralInvariantPhaseSpace::ApplyYourself(...) : G4QEnvironment::Fragment() returns an invalid fragment\n with fourMom(MeV)=";
G4cerr<<output->operator[](particle)->Get4Momentum()<<" and mass(MeV)="<<output->operator[](particle)->Get4Momentum().m();
G4cerr<<". Offending PDG is:"<<pdgCode<<" abandon interaction. \n Taget PDG was:"<<targetPDGCode<<" \n Dumping the information in the projectile list:\n";
for(size_t i=0; i< projHV.size(); i++)
{
G4cerr <<" Incoming 4-momentum and PDG code of "<<i<<"'th hadron: "
<<" "<< projHV[i]->Get4Momentum()<<" "<<projHV[i]->GetPDGCode()<<"\n";
}
G4cerr<<"\n Please report as bug \n***END OF MESSAGE***"<<G4endl;
for ( unsigned int cparticle=0 ; cparticle<output->size();++cparticle)
delete output->operator[](cparticle);
delete output;
std::for_each(projHV.begin(), projHV.end(), DeleteQHadron());
projHV.clear();
aResult->Clear();
aResult->SetStatusChange(isAlive);
aResult->SetEnergyChange(aTrack.GetKineticEnergy());
aResult->SetMomentumChange(aTrack.Get4Momentum().vect().unit());
return aResult;
}
//AND
theSec->SetDefinition(theDefinition);
theSec->SetMomentum(output->operator[](particle)->Get4Momentum().vect());
aResult->AddSecondary(theSec);
delete output->operator[](particle);
}
delete output;
std::for_each(projHV.begin(), projHV.end(), DeleteQHadron());
projHV.clear();
return aResult;
}
@@ -0,0 +1,312 @@
//
// ********************************************************************
// * 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: G4QHadronElasticDataSet.cc,v 1.3 2010/05/26 12:19:06 mkossov Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// GEANT4 physics class: G4QHadronElasticDataSet -- header file
// Created by M. Kosov (Mikhail.Kossov@cern.ch) 21.01.10
//
// ----------------------------------------------------------------------
// Short description: G4hadr wrapper for CHIPS elastic hA cross-sections.
// ----------------------------------------------------------------------
//
#include "G4QHadronElasticDataSet.hh"
// Initialization of static vectors
std::vector<G4int> G4QHadronElasticDataSet::ElementZ; // Z of the element(i) in LastCalc
std::vector<std::vector<G4int>*> G4QHadronElasticDataSet::ElIsoN; // N of iso(j) of El(i)
std::vector<std::vector<G4double>*> G4QHadronElasticDataSet::IsoProbInEl;//SumProbIsoInEl
G4QHadronElasticDataSet::G4QHadronElasticDataSet()
{
Isotopes = G4QIsotope::Get(); // Pointer to the G4QIsotopes singleton
}
G4bool G4QHadronElasticDataSet::IsApplicable(const G4DynamicParticle* P,const G4Element*)
{
G4ParticleDefinition* particle = P->GetDefinition();
if (particle == G4Neutron::Neutron() ) return true;
else if (particle == G4Proton::Proton() ) return true;
else if (particle == G4PionMinus::PionMinus() ) return true;
else if (particle == G4PionPlus::PionPlus() ) return true;
else if (particle == G4KaonPlus::KaonPlus() ) return true;
else if (particle == G4KaonMinus::KaonMinus() ) return true;
else if (particle == G4KaonZeroLong::KaonZeroLong() ) return true;
else if (particle == G4KaonZeroShort::KaonZeroShort() ) return true;
else if (particle == G4Lambda::Lambda() ) return true;
else if (particle == G4SigmaPlus::SigmaPlus() ) return true;
else if (particle == G4SigmaMinus::SigmaMinus() ) return true;
else if (particle == G4SigmaZero::SigmaZero() ) return true;
else if (particle == G4XiMinus::XiMinus() ) return true;
else if (particle == G4XiZero::XiZero() ) return true;
else if (particle == G4OmegaMinus::OmegaMinus() ) return true;
else if (particle == G4AntiNeutron::AntiNeutron() ) return true;
else if (particle == G4AntiProton::AntiProton() ) return true;
else if (particle == G4AntiLambda::AntiLambda() ) return true;
else if (particle == G4AntiSigmaPlus::AntiSigmaPlus() ) return true;
else if (particle == G4AntiSigmaMinus::AntiSigmaMinus() ) return true;
else if (particle == G4AntiSigmaZero::AntiSigmaZero() ) return true;
else if (particle == G4AntiXiMinus::AntiXiMinus() ) return true;
else if (particle == G4AntiXiZero::AntiXiZero() ) return true;
else if (particle == G4AntiOmegaMinus::AntiOmegaMinus() ) return true;
return false;
}
G4bool G4QHadronElasticDataSet::IsZAApplicable(const G4DynamicParticle* Pt,
G4double, G4double)
{
G4ParticleDefinition* particle = Pt->GetDefinition();
if (particle == G4Neutron::Neutron() ) return true; // @@ isotopes?
else if (particle == G4Proton::Proton() ) return true;
else if (particle == G4PionMinus::PionMinus() ) return true;
else if (particle == G4PionPlus::PionPlus() ) return true;
else if (particle == G4KaonPlus::KaonPlus() ) return true;
else if (particle == G4KaonMinus::KaonMinus() ) return true;
else if (particle == G4KaonZeroLong::KaonZeroLong() ) return true;
else if (particle == G4KaonZeroShort::KaonZeroShort() ) return true;
else if (particle == G4Lambda::Lambda() ) return true;
else if (particle == G4SigmaPlus::SigmaPlus() ) return true;
else if (particle == G4SigmaMinus::SigmaMinus() ) return true;
else if (particle == G4SigmaZero::SigmaZero() ) return true;
else if (particle == G4XiMinus::XiMinus() ) return true;
else if (particle == G4XiZero::XiZero() ) return true;
else if (particle == G4OmegaMinus::OmegaMinus() ) return true;
else if (particle == G4AntiNeutron::AntiNeutron() ) return true;
else if (particle == G4AntiProton::AntiProton() ) return true;
else if (particle == G4AntiLambda::AntiLambda() ) return true;
else if (particle == G4AntiSigmaPlus::AntiSigmaPlus() ) return true;
else if (particle == G4AntiSigmaMinus::AntiSigmaMinus() ) return true;
else if (particle == G4AntiSigmaZero::AntiSigmaZero() ) return true;
else if (particle == G4AntiXiMinus::AntiXiMinus() ) return true;
else if (particle == G4AntiXiZero::AntiXiZero() ) return true;
else if (particle == G4AntiOmegaMinus::AntiOmegaMinus() ) return true;
return false;
}
G4double G4QHadronElasticDataSet::GetCrossSection(const G4DynamicParticle* Pt,
const G4Element* pElement,
G4double)
{
G4int IPIE=IsoProbInEl.size(); // How many old elements?
if(IPIE) for(G4int ip=0; ip<IPIE; ++ip) // Clean up the SumProb's of Isotopes (SPI)
{
std::vector<G4double>* SPI=IsoProbInEl[ip]; // Pointer to the SPI vector
SPI->clear();
delete SPI;
std::vector<G4int>* IsN=ElIsoN[ip]; // Pointer to the N vector
IsN->clear();
delete IsN;
}
ElementZ.clear(); // Clear the body vector for Z of Elements
IsoProbInEl.clear(); // Clear the body vector for SPI
ElIsoN.clear(); // Clear the body vector for N of Isotopes
G4int Z = static_cast<G4int>(pElement->GetZ()); // Z of the Element
ElementZ.push_back(Z); // Remember Z of the Element
G4int isoSize=0; // The default for the isoVectorLength is 0
G4int indEl=0; // Index of non-trivial element or 0(default)
G4IsotopeVector* isoVector=pElement->GetIsotopeVector(); // Get the predefined IsoVect
if(isoVector) isoSize=isoVector->size();// Get size of the existing isotopeVector
if(isoSize) // The Element has non-trivial abundance set
{
indEl=pElement->GetIndex()+1; // Index of the non-trivial element
if(!Isotopes->IsDefined(Z,indEl)) // This index is not defined for this Z: define
{
std::vector<std::pair<G4int,G4double>*>* newAbund =
new std::vector<std::pair<G4int,G4double>*>;
G4double* abuVector=pElement->GetRelativeAbundanceVector();
for(G4int j=0; j<isoSize; j++) // Calculation of abundance vector for isotopes
{
G4int N=pElement->GetIsotope(j)->GetN()-Z; // N means A=N+Z !
if(pElement->GetIsotope(j)->GetZ()!=Z)
G4cerr<<"G4QHadronElasticDataSet::GetCrossSection"<<": Z="
<<pElement->GetIsotope(j)->GetZ()<<" # "<<Z<<G4endl;
G4double abund=abuVector[j];
std::pair<G4int,G4double>* pr= new std::pair<G4int,G4double>(N,abund);
newAbund->push_back(pr);
}
indEl=G4QIsotope::Get()->InitElement(Z,indEl,newAbund); // definition of the newInd
for(G4int k=0; k<isoSize; k++) delete (*newAbund)[k]; // Cleaning temporary
delete newAbund; // Was "new" in the beginning of the name space
}
}
std::vector<std::pair<G4int,G4double>*>* cs= Isotopes->GetCSVector(Z,indEl);//CSPointer
std::vector<G4double>* SPI = new std::vector<G4double>; // Pointer to the SPI vector
IsoProbInEl.push_back(SPI);
std::vector<G4int>* IsN = new std::vector<G4int>; // Pointer to the N vector
ElIsoN.push_back(IsN);
G4int nIs=cs->size(); // A#Of Isotopes in the Element
G4double susi=0.; // sum of CS over isotopes
if(nIs) for(G4int j=0; j<nIs; j++) // Calculate CS for eachIsotope of El
{
std::pair<G4int,G4double>* curIs=(*cs)[j]; // A pointer, which is used twice
G4int N=curIs->first; // #of Neuterons in the isotope j of El i
IsN->push_back(N); // Remember Min N for the Element
G4double CSI=GetIsoZACrossSection(Pt,Z,Z+N,0.);//CrossSection(j,i) for the isotope
curIs->second = CSI;
susi+=CSI; // Make a sum per isotopes
SPI->push_back(susi); // Remember summed cross-section
} // End of temporary initialization of the cross sections in the G4QIsotope singeltone
return Isotopes->GetMeanCrossSection(Z,indEl); // MeanCS over isotopes
}
G4double G4QHadronElasticDataSet::GetIsoZACrossSection(const G4DynamicParticle* Pt,
G4double Z, G4double A, G4double)
{
G4ParticleDefinition* particle = Pt->GetDefinition();
G4double Momentum=Pt->GetTotalMomentum();
G4VQCrossSection* CSmanager=0;
G4VQCrossSection* CSmanager2=0;
//G4VQCrossSection* CSmanager2=0;
G4int pPDG=0;
if(particle == G4Neutron::Neutron())
{
CSmanager=G4QNeutronElasticCrossSection::GetPointer();
pPDG=2112;
}
else if(particle == G4Proton::Proton())
{
CSmanager=G4QProtonElasticCrossSection::GetPointer();
pPDG=2212;
}
else if(particle == G4PionMinus::PionMinus())
{
CSmanager=G4QPionMinusElasticCrossSection::GetPointer();
pPDG=-211;
}
else if(particle == G4PionPlus::PionPlus())
{
CSmanager=G4QPionPlusElasticCrossSection::GetPointer();
pPDG=211;
}
else if(particle == G4KaonMinus::KaonMinus())
{
CSmanager=G4QKaonMinusElasticCrossSection::GetPointer();
pPDG=-321;
}
else if(particle == G4KaonPlus::KaonPlus())
{
CSmanager=G4QKaonPlusElasticCrossSection::GetPointer();
pPDG=321;
}
else if(particle == G4KaonZeroLong::KaonZeroLong() ||
particle == G4KaonZeroShort::KaonZeroShort() ||
particle == G4KaonZero::KaonZero() ||
particle == G4AntiKaonZero::AntiKaonZero() )
{
CSmanager=G4QKaonMinusElasticCrossSection::GetPointer();
CSmanager2=G4QKaonPlusElasticCrossSection::GetPointer();
if(G4UniformRand() > 0.5) pPDG= 321;
else pPDG=-321;
}
else if(particle == G4Lambda::Lambda())
{
CSmanager=G4QHyperonElasticCrossSection::GetPointer();
pPDG=3122;
}
else if(particle == G4SigmaPlus::SigmaPlus())
{
CSmanager=G4QHyperonElasticCrossSection::GetPointer();
pPDG=3222;
}
else if(particle == G4SigmaMinus::SigmaMinus())
{
CSmanager=G4QHyperonElasticCrossSection::GetPointer();
pPDG=3112;
}
else if(particle == G4SigmaZero::SigmaZero())
{
CSmanager=G4QHyperonElasticCrossSection::GetPointer();
pPDG=3212;
}
else if(particle == G4XiMinus::XiMinus())
{
CSmanager=G4QHyperonElasticCrossSection::GetPointer();
pPDG=3312;
}
else if(particle == G4XiZero::XiZero())
{
CSmanager=G4QHyperonElasticCrossSection::GetPointer();
pPDG=3322;
}
else if(particle == G4OmegaMinus::OmegaMinus())
{
CSmanager=G4QHyperonElasticCrossSection::GetPointer();
pPDG=3334;
}
else if(particle == G4AntiNeutron::AntiNeutron())
{
CSmanager=G4QAntiBaryonElasticCrossSection::GetPointer();
pPDG=-2112;
}
else if(particle == G4AntiProton::AntiProton())
{
CSmanager=G4QAntiBaryonElasticCrossSection::GetPointer();
pPDG=-2212;
}
else if(particle == G4AntiLambda::AntiLambda())
{
CSmanager=G4QAntiBaryonElasticCrossSection::GetPointer();
pPDG=-3122;
}
else if(particle == G4AntiSigmaPlus::AntiSigmaPlus())
{
CSmanager=G4QAntiBaryonElasticCrossSection::GetPointer();
pPDG=-3222;
}
else if(particle == G4AntiSigmaMinus::AntiSigmaMinus())
{
CSmanager=G4QAntiBaryonElasticCrossSection::GetPointer();
pPDG=-3112;
}
else if(particle == G4AntiSigmaZero::AntiSigmaZero())
{
CSmanager=G4QAntiBaryonElasticCrossSection::GetPointer();
pPDG=-3212;
}
else if(particle == G4AntiXiMinus::AntiXiMinus())
{
CSmanager=G4QAntiBaryonElasticCrossSection::GetPointer();
pPDG=-3312;
}
else if(particle == G4AntiXiZero::AntiXiZero())
{
CSmanager=G4QAntiBaryonElasticCrossSection::GetPointer();
pPDG=-3322;
}
else if(particle == G4AntiOmegaMinus::AntiOmegaMinus())
{
CSmanager=G4QAntiBaryonElasticCrossSection::GetPointer();
pPDG=-3334;
}
else G4cout<<"-Warning-G4QHadronElasticDataSet::GetIsoZACrossSection: PDG="
<<particle->GetPDGEncoding()<<" isn't supported by CHIPS"<<G4endl;
G4int tZ=(G4int)(Z);
G4int tN=(G4int)(A-Z);
G4double CSI=CSmanager->GetCrossSection(true, Momentum, tZ, tN, pPDG); // CS(j,i) basic
if(CSmanager2) CSI= (CSI +CSmanager2->GetCrossSection(true, Momentum, tZ, tN, pPDG))/2.;
return CSI;
}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4QHadronInelasticDataSet.cc,v 1.1 2009/11/20 10:08:36 mkossov Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4QHadronInelasticDataSet.cc,v 1.2 2010/05/26 12:19:06 mkossov Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// GEANT4 physics class: G4QHadronInelasticDataSet -- header file
// Created by M. Kosov (Mikhail.Kossov@cern.ch) 11.11.09
@@ -159,19 +159,19 @@ G4double G4QHadronInelasticDataSet::GetCrossSection(const G4DynamicParticle* Pt,
const G4Element* pElement,
G4double)
{
G4int IPIE=IsoProbInEl.size(); // How many old elements?
if(IPIE) for(G4int ip=0; ip<IPIE; ++ip) // Clean up the SumProb's of Isotopes (SPI)
G4int IPIE=IsoProbInEl.size(); // How many old elements?
if(IPIE) for(G4int ip=0; ip<IPIE; ++ip) // Clean up the SumProb's of Isotopes (SPI)
{
std::vector<G4double>* SPI=IsoProbInEl[ip]; // Pointer to the SPI vector
SPI->clear();
delete SPI;
std::vector<G4int>* IsN=ElIsoN[ip]; // Pointer to the N vector
std::vector<G4int>* IsN=ElIsoN[ip]; // Pointer to the N vector
IsN->clear();
delete IsN;
}
ElementZ.clear(); // Clear the body vector for Z of Elements
IsoProbInEl.clear(); // Clear the body vector for SPI
ElIsoN.clear(); // Clear the body vector for N of Isotopes
ElementZ.clear(); // Clear the body vector for Z of Elements
IsoProbInEl.clear(); // Clear the body vector for SPI
ElIsoN.clear(); // Clear the body vector for N of Isotopes
G4int Z = static_cast<G4int>(pElement->GetZ()); // Z of the Element
ElementZ.push_back(Z); // Remember Z of the Element
G4int isoSize=0; // The default for the isoVectorLength is 0
@@ -189,8 +189,9 @@ G4double G4QHadronInelasticDataSet::GetCrossSection(const G4DynamicParticle* Pt,
for(G4int j=0; j<isoSize; j++) // Calculation of abundance vector for isotopes
{
G4int N=pElement->GetIsotope(j)->GetN()-Z; // N means A=N+Z !
if(pElement->GetIsotope(j)->GetZ()!=Z)G4cerr<<"G4QCollision::GetMeanFreePath"
<<": Z="<<pElement->GetIsotope(j)->GetZ()<<"#"<<Z<<G4endl;
if(pElement->GetIsotope(j)->GetZ()!=Z)
G4cerr<<"G4QHadronInelasticDataSet::GetCrossSection"<<": Z="
<<pElement->GetIsotope(j)->GetZ()<<" # "<<Z<<G4endl;
G4double abund=abuVector[j];
std::pair<G4int,G4double>* pr= new std::pair<G4int,G4double>(N,abund);
newAbund->push_back(pr);
@@ -212,7 +213,7 @@ G4double G4QHadronInelasticDataSet::GetCrossSection(const G4DynamicParticle* Pt,
std::pair<G4int,G4double>* curIs=(*cs)[j]; // A pointer, which is used twice
G4int N=curIs->first; // #of Neuterons in the isotope j of El i
IsN->push_back(N); // Remember Min N for the Element
G4double CSI=GetIsoZACrossSection(Pt,Z,N,0.);//CrossSection(j,i) for the isotope
G4double CSI=GetIsoZACrossSection(Pt,Z,Z+N,0.);//CrossSection(j,i) for the isotope
curIs->second = CSI;
susi+=CSI; // Make a sum per isotopes
SPI->push_back(susi); // Remember summed cross-section