Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:15:55

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // Calculation of the total, elastic and inelastic cross-sections
0027 // based on Barashenkov parametrisations of pion data
0028 //
0029 // 16.08.06 V.Ivanchenko - first implementation
0030 // 22.01.07 V.Ivanchenko - add cross section interfaces with Z and A
0031 // 05.03.07 V.Ivanchenko - add IfZAApplicable
0032 //
0033 
0034 #ifndef G4UPiNuclearCrossSection_h
0035 #define G4UPiNuclearCrossSection_h
0036 
0037 #include "G4VCrossSectionDataSet.hh"
0038 #include "G4DynamicParticle.hh"
0039 #include "G4ParticleDefinition.hh"
0040 #include "globals.hh"
0041 
0042 class G4PhysicsTable;
0043 
0044 class G4UPiNuclearCrossSection : public G4VCrossSectionDataSet
0045 {
0046 public:
0047   
0048   explicit G4UPiNuclearCrossSection();
0049 
0050   ~G4UPiNuclearCrossSection() override = default;
0051 
0052   G4bool IsElementApplicable(const G4DynamicParticle* aParticle, 
0053                  G4int Z, const G4Material*) final;
0054 
0055   inline
0056   G4double GetElasticCrossSection(const G4DynamicParticle* aParticle, 
0057                   G4int Z, G4int A) const;
0058 
0059   inline
0060   G4double GetInelasticCrossSection(const G4DynamicParticle* aParticle, 
0061                     G4int Z, G4int A) const;
0062 
0063   void BuildPhysicsTable(const G4ParticleDefinition&) final;
0064 
0065   void DumpPhysicsTable(const G4ParticleDefinition&) final;
0066 
0067   void CrossSectionDescription(std::ostream&) const final;
0068   
0069 private:
0070 
0071   G4double Interpolate(G4int Z, G4int A, G4double ekin, 
0072                        const G4PhysicsTable*) const;
0073 
0074   void AddDataSet(const G4String& p, const G4double* tot, 
0075           const G4double* in, const G4double* e, G4int n); 
0076 
0077   void LoadData();
0078 
0079   const G4ParticleDefinition* piPlus;
0080   const G4ParticleDefinition* piMinus;
0081 
0082   static const G4int NZ = 16;
0083   static G4int theZ[NZ];
0084   static G4int idxZ[93];
0085 
0086   static G4double theA[NZ];
0087   static G4double APower[93];
0088 
0089   static G4PhysicsTable* piPlusElastic;
0090   static G4PhysicsTable* piPlusInelastic;
0091   static G4PhysicsTable* piMinusElastic;
0092   static G4PhysicsTable* piMinusInelastic;
0093 
0094   G4double aPower{0.75};
0095   G4double elow;
0096 
0097   G4bool spline{false};
0098 };
0099 
0100 inline G4double 
0101 G4UPiNuclearCrossSection::GetElasticCrossSection(
0102        const G4DynamicParticle* dp, G4int Z, G4int A) const
0103 {
0104   const G4PhysicsTable* table = 
0105     (dp->GetDefinition() == piPlus) ? piPlusElastic : piMinusElastic; 
0106   return Interpolate(Z, A, dp->GetKineticEnergy(), table);
0107 }
0108 
0109 inline G4double 
0110 G4UPiNuclearCrossSection::GetInelasticCrossSection(
0111        const G4DynamicParticle* dp, G4int Z, G4int A) const
0112 {
0113   const G4PhysicsTable* table = 
0114     (dp->GetDefinition() == piPlus) ? piPlusInelastic : piMinusInelastic; 
0115   return Interpolate(Z, A, dp->GetKineticEnergy(), table);
0116 }
0117 
0118 #endif