Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:52

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 //
0027 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
0028 //
0029 #ifndef G4ParticleHPLegendreTable_h
0030 #define G4ParticleHPLegendreTable_h 1
0031 
0032 #include "G4InterpolationManager.hh"
0033 #include "G4ios.hh"
0034 #include "globals.hh"
0035 
0036 #include <CLHEP/Units/SystemOfUnits.h>
0037 
0038 #include <fstream>
0039 
0040 class G4ParticleHPLegendreTable
0041 {
0042   public:
0043     G4ParticleHPLegendreTable()
0044     {
0045       nCoeff = 0;
0046       theCoeff = nullptr;
0047       theRep = 0;
0048       theEnergy = 0.0;
0049       theTemp = 0.0;
0050     }
0051     ~G4ParticleHPLegendreTable() { delete[] theCoeff; }
0052 
0053     void operator=(const G4ParticleHPLegendreTable& aSet)
0054     {
0055       if (&aSet != this) {
0056         theRep = aSet.theRep;
0057         theEnergy = aSet.theEnergy;
0058         theTemp = aSet.theTemp;
0059         theManager = aSet.theManager;
0060         nCoeff = aSet.nCoeff;
0061         delete[] theCoeff;
0062         theCoeff = new G4double[nCoeff];
0063         for (G4int i = 0; i < nCoeff; i++) {
0064           theCoeff[i] = aSet.theCoeff[i];
0065         }
0066       }
0067     }
0068 
0069     inline void Init(std::istream& aDataFile)
0070     {
0071       G4double eNeu, coeff;
0072       G4int nPoly;
0073       aDataFile >> eNeu >> nPoly;
0074       eNeu *= CLHEP::eV;
0075       Init(eNeu, nPoly);
0076       for (G4int l = 0; l < nPoly; l++) {
0077         aDataFile >> coeff;
0078         SetCoeff(l + 1, coeff);
0079       }
0080     }
0081 
0082     inline void Init(G4double e, G4int n)
0083     {
0084       nCoeff = n + 1;
0085       theCoeff = new G4double[nCoeff];
0086       for (G4int i = 0; i < nCoeff; i++)
0087         theCoeff[i] = 0;
0088       theCoeff[0] = 1.;
0089       theEnergy = e;
0090       //    G4cout << "G4ParticleHPLegendreTable::Init called "<<e<<" "<<n<<G4endl;
0091     }
0092     inline void SetEnergy(G4double energy) { theEnergy = energy; }
0093     inline void SetTemperature(G4double temp) { theTemp = temp; }
0094     inline void SetCoeff(G4int l, G4double coeff) { theCoeff[l] = coeff; }
0095     inline void SetRepresentation(G4int aRep) { theRep = aRep; }
0096 
0097     inline G4double GetCoeff(G4int l) { return theCoeff[l]; }
0098     inline G4double GetEnergy() { return theEnergy; }
0099     inline G4double GetTemperature() { return theTemp; }
0100     inline G4int GetNumberOfPoly() { return nCoeff; }
0101     inline G4int GetRepresentation() { return theRep; }
0102     inline const G4InterpolationManager& GetManager() { return theManager; }
0103 
0104   private:
0105     G4int theRep;
0106     G4double theEnergy;
0107     G4double theTemp;
0108     G4int nCoeff;
0109     G4InterpolationManager theManager;  // knows the interpolation between stores
0110     G4double* theCoeff;
0111 };
0112 
0113 #endif