File indexing completed on 2023-03-17 11:24:50
0001
0002 #include "SimG4Core/CustomPhysics/interface/CMSSIMPInelasticXS.h"
0003 #include "SimG4Core/CustomPhysics/interface/CMSSIMP.h"
0004 #include "G4DynamicParticle.hh"
0005 #include "G4Element.hh"
0006 #include "G4ElementTable.hh"
0007 #include "G4PhysicsLogVector.hh"
0008 #include "G4PhysicsVector.hh"
0009 #include "G4NeutronInelasticXS.hh"
0010 #include "G4Proton.hh"
0011 #include "G4Neutron.hh"
0012
0013 CMSSIMPInelasticXS::CMSSIMPInelasticXS() : G4VCrossSectionDataSet("CMSSIMPInelasticXS"), neutron(G4Neutron::Neutron()) {
0014 verboseLevel = 1;
0015 nXsection = new G4NeutronInelasticXS();
0016 isInitialized = false;
0017 }
0018
0019 CMSSIMPInelasticXS::~CMSSIMPInelasticXS() {}
0020
0021 G4bool CMSSIMPInelasticXS::IsElementApplicable(const G4DynamicParticle*, G4int, const G4Material*) { return true; }
0022
0023 G4bool CMSSIMPInelasticXS::IsIsoApplicable(const G4DynamicParticle*, G4int, G4int, const G4Element*, const G4Material*) {
0024 return true;
0025 }
0026
0027 G4double CMSSIMPInelasticXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
0028 G4int Z,
0029 const G4Material* mat) {
0030 return nXsection->GetElementCrossSection(aParticle, Z, mat);
0031 }
0032
0033 G4double CMSSIMPInelasticXS::GetIsoCrossSection(const G4DynamicParticle* aParticle,
0034 G4int Z,
0035 G4int A,
0036 const G4Isotope* iso,
0037 const G4Element* elm,
0038 const G4Material* mat) {
0039 return nXsection->GetIsoCrossSection(aParticle, Z, A, iso, elm, mat);
0040 }
0041
0042 void CMSSIMPInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p) {
0043 if (isInitialized) {
0044 return;
0045 }
0046 nXsection->BuildPhysicsTable(p);
0047 if (verboseLevel > 0) {
0048 G4cout << "CMSSIMPInelasticXS::BuildPhysicsTable for " << p.GetParticleName() << G4endl;
0049 }
0050 if (p.GetParticleName() != "chi" && p.GetParticleName() != "anti_chi" && p.GetParticleName() != "chibar") {
0051 G4ExceptionDescription ed;
0052 ed << p.GetParticleName() << " is a wrong particle type -"
0053 << " only simp is allowed";
0054 G4Exception("CMSSIMPInelasticXS::BuildPhysicsTable(..)", "had012", FatalException, ed, "");
0055 return;
0056 }
0057 isInitialized = true;
0058 }