Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:17

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 #include "G4Threading.hh"
0042 
0043 class G4PhysicsTable;
0044 
0045 class G4UPiNuclearCrossSection : public G4VCrossSectionDataSet
0046 {
0047 public:
0048   
0049   explicit G4UPiNuclearCrossSection();
0050 
0051   ~G4UPiNuclearCrossSection() override;
0052 
0053   G4bool IsElementApplicable(const G4DynamicParticle* aParticle, 
0054                  G4int Z, const G4Material*) final;
0055 
0056   inline
0057   G4double GetElasticCrossSection(const G4DynamicParticle* aParticle, 
0058                   G4int Z, G4int A) const;
0059 
0060   inline
0061   G4double GetInelasticCrossSection(const G4DynamicParticle* aParticle, 
0062                     G4int Z, G4int A) const;
0063 
0064   void BuildPhysicsTable(const G4ParticleDefinition&) final;
0065 
0066   void DumpPhysicsTable(const G4ParticleDefinition&) final;
0067 
0068   void CrossSectionDescription(std::ostream&) const final;
0069   
0070 private:
0071 
0072   G4double Interpolate(G4int Z, G4int A, G4double ekin, 
0073                        const G4PhysicsTable*) const;
0074 
0075   void AddDataSet(const G4String& p, const G4double* tot, 
0076           const G4double* in, const G4double* e, G4int n); 
0077 
0078   void LoadData();
0079 
0080   const G4ParticleDefinition* piPlus;
0081   const G4ParticleDefinition* piMinus;
0082 
0083   static const G4int NZ = 16;
0084   static G4int theZ[NZ];
0085   static G4int idxZ[93];
0086 
0087   static G4double theA[NZ];
0088   static G4double APower[93];
0089 
0090   static G4PhysicsTable* piPlusElastic;
0091   static G4PhysicsTable* piPlusInelastic;
0092   static G4PhysicsTable* piMinusElastic;
0093   static G4PhysicsTable* piMinusInelastic;
0094 
0095   G4double aPower;
0096   G4double elow;
0097 
0098   G4bool isMaster;
0099   G4bool spline;
0100 
0101 #ifdef G4MULTITHREADED
0102   static G4Mutex pionUXSMutex;
0103 #endif
0104 };
0105 
0106 inline G4double 
0107 G4UPiNuclearCrossSection::GetElasticCrossSection(
0108        const G4DynamicParticle* dp, G4int Z, G4int A) const
0109 {
0110   const G4PhysicsTable* table = 
0111     (dp->GetDefinition() == piPlus) ? piPlusElastic : piMinusElastic; 
0112   return Interpolate(Z, A, dp->GetKineticEnergy(), table);
0113 }
0114 
0115 inline G4double 
0116 G4UPiNuclearCrossSection::GetInelasticCrossSection(
0117        const G4DynamicParticle* dp, G4int Z, G4int A) const
0118 {
0119   const G4PhysicsTable* table = 
0120     (dp->GetDefinition() == piPlus) ? piPlusInelastic : piMinusInelastic; 
0121   return Interpolate(Z, A, dp->GetKineticEnergy(), table);
0122 }
0123 
0124 #endif