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 G4ParticleHPLegendreStore_h
0030 #define G4ParticleHPLegendreStore_h 1
0031 
0032 #include "G4InterpolationManager.hh"
0033 #include "G4ParticleHPLegendreTable.hh"
0034 #include "G4ios.hh"
0035 
0036 #include <vector>
0037 #include <fstream>
0038 
0039 class G4ParticleHPLegendreStore
0040 {
0041   public:
0042     G4ParticleHPLegendreStore(G4int n)
0043     {
0044       theCoeff.resize(n);
0045       nEnergy = n;
0046     }
0047 
0048     ~G4ParticleHPLegendreStore() {}
0049 
0050     inline void Init(G4int i, G4double e, G4int n) { theCoeff[i].Init(e, n); }
0051     inline void SetNPoints(G4int n) { nEnergy = n; }
0052     inline void SetEnergy(G4int i, G4double energy) { theCoeff[i].SetEnergy(energy); }
0053     inline void SetTemperature(G4int i, G4double temp) { theCoeff[i].SetTemperature(temp); }
0054     inline void SetCoeff(G4int i, G4int l, G4double coeff) { theCoeff[i].SetCoeff(l, coeff); }
0055     inline void SetCoeff(G4int i, G4ParticleHPLegendreTable* theTable)
0056     {
0057       if (i > nEnergy)
0058         throw G4HadronicException(__FILE__, __LINE__, "LegendreTableIndex out of range");
0059       theCoeff[i] = *theTable;
0060       // not here -- see G4ParticleHPPhotonDist.cc line 275
0061       //    delete theTable;
0062     }
0063 
0064     inline G4double GetCoeff(G4int i, G4int l) { return theCoeff[i].GetCoeff(l); }
0065     inline G4double GetEnergy(G4int i) { return theCoeff[i].GetEnergy(); }
0066     inline G4double GetTemperature(G4int i) { return theCoeff[i].GetTemperature(); }
0067     inline G4int GetNumberOfPoly(G4int i) { return theCoeff[i].GetNumberOfPoly(); }
0068 
0069     G4double SampleDiscreteTwoBody(G4double anEnergy);
0070     G4double SampleElastic(G4double anEnergy);
0071     G4double Sample(G4double energy);
0072     G4double SampleMax(G4double energy);
0073     G4double Integrate(G4int k, G4double costh);
0074 
0075     void InitInterpolation(std::istream& aDataFile) { theManager.Init(aDataFile); }
0076 
0077     void SetManager(G4InterpolationManager& aManager) { theManager = aManager; }
0078 
0079   private:
0080     G4int nEnergy;
0081     std::vector<G4ParticleHPLegendreTable> theCoeff;
0082     G4InterpolationManager theManager;  // interpolate between different Tables
0083 };
0084 #endif