Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-07-09 05:00:33

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 G4bool CMSSIMPInelasticXS::IsElementApplicable(const G4DynamicParticle*, G4int, const G4Material*) { return true; }
0020 
0021 G4bool CMSSIMPInelasticXS::IsIsoApplicable(const G4DynamicParticle*, G4int, G4int, const G4Element*, const G4Material*) {
0022   return true;
0023 }
0024 
0025 G4double CMSSIMPInelasticXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
0026                                                     G4int Z,
0027                                                     const G4Material* mat) {
0028   return nXsection->GetElementCrossSection(aParticle, Z, mat);
0029 }
0030 
0031 G4double CMSSIMPInelasticXS::GetIsoCrossSection(const G4DynamicParticle* aParticle,
0032                                                 G4int Z,
0033                                                 G4int A,
0034                                                 const G4Isotope* iso,
0035                                                 const G4Element* elm,
0036                                                 const G4Material* mat) {
0037   return nXsection->GetIsoCrossSection(aParticle, Z, A, iso, elm, mat);
0038 }
0039 
0040 void CMSSIMPInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p) {
0041   if (isInitialized) {
0042     return;
0043   }
0044   nXsection->BuildPhysicsTable(p);
0045   if (verboseLevel > 0) {
0046     G4cout << "CMSSIMPInelasticXS::BuildPhysicsTable for " << p.GetParticleName() << G4endl;
0047   }
0048   if (p.GetParticleName() != "chi" && p.GetParticleName() != "anti_chi" && p.GetParticleName() != "chibar") {
0049     G4ExceptionDescription ed;
0050     ed << p.GetParticleName() << " is a wrong particle type -"
0051        << " only simp is allowed";
0052     G4Exception("CMSSIMPInelasticXS::BuildPhysicsTable(..)", "had012", FatalException, ed, "");
0053     return;
0054   }
0055   isInitialized = true;
0056 }