G4NeutronHPLegendreTable.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 #ifndef G4NeutronHPLegendreTable_h
00030 #define G4NeutronHPLegendreTable_h 1
00031 
00032 #include <fstream>
00033 #include <CLHEP/Units/SystemOfUnits.h>
00034 
00035 #include "globals.hh"
00036 #include "G4ios.hh"
00037 #include "G4InterpolationManager.hh"
00038 
00039 class G4NeutronHPLegendreTable
00040 {
00041   public:
00042   G4NeutronHPLegendreTable()
00043   {
00044     nCoeff=0; 
00045     theCoeff = 0;
00046   }
00047   ~G4NeutronHPLegendreTable(){if(theCoeff!=0) delete [] theCoeff;}
00048   
00049   void operator= (const G4NeutronHPLegendreTable & aSet)
00050   {
00051     if(&aSet!=this)
00052     {
00053       theRep = aSet.theRep;
00054       theEnergy = aSet.theEnergy;
00055       theTemp = aSet.theTemp;
00056       theManager = aSet.theManager;
00057       nCoeff = aSet.nCoeff;
00058       if(theCoeff!=0) delete [] theCoeff;
00059       theCoeff = new G4double[nCoeff];
00060       for(G4int i=0; i<nCoeff; i++)
00061       {
00062         theCoeff[i] = aSet.theCoeff[i];
00063       }
00064     }
00065   }
00066   
00067   inline void Init(std::ifstream & aDataFile) 
00068   {
00069     G4double eNeu, coeff;
00070     G4int nPoly;
00071     aDataFile >> eNeu >> nPoly;
00072     eNeu *= CLHEP::eV;
00073     Init(eNeu, nPoly);
00074     for(G4int l=0; l<nPoly; l++)
00075     {
00076       aDataFile >> coeff;
00077       SetCoeff(l+1, coeff);
00078     }
00079   }
00080   
00081   inline void Init(G4double e, G4int n)
00082   {
00083     nCoeff = n+1;
00084     theCoeff = new G4double[nCoeff];
00085     for(G4int i=0; i<nCoeff; i++) theCoeff[i] = 0;
00086     theCoeff[0]=1.;
00087     theEnergy = e;
00088 //    G4cout << "G4NeutronHPLegendreTable::Init called "<<e<<" "<<n<<G4endl;
00089   }
00090   inline void SetEnergy(G4double energy){ theEnergy = energy; }
00091   inline void SetTemperature(G4double temp){ theTemp = temp; }
00092   inline void SetCoeff(G4int l, G4double coeff) {theCoeff[l]=coeff;}
00093   inline void SetRepresentation(G4int aRep) {theRep = aRep;}
00094   
00095   inline G4double GetCoeff(G4int l) {return theCoeff[l];}
00096   inline G4double GetEnergy(){return theEnergy;}
00097   inline G4double GetTemperature(){return theTemp;}
00098   inline G4int GetNumberOfPoly() {return nCoeff;}
00099   inline G4int GetRepresentation() {return theRep;}
00100   inline const G4InterpolationManager & GetManager() {return theManager;}
00101   private:
00102   
00103   G4int theRep;
00104   G4double theEnergy;
00105   G4double theTemp;
00106   G4int nCoeff;
00107   G4InterpolationManager theManager; // knows the interpolation between stores
00108   G4double * theCoeff;
00109 };
00110 
00111 #endif

Generated on Mon May 27 17:49:02 2013 for Geant4 by  doxygen 1.4.7