G4NeutronHPPartial.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 // 070618 Comment out unused private member leaking by T. Koi
00030 //
00031 #ifndef G4NeutronHPPartial_h
00032 #define G4NeutronHPPartial_h 1
00033 
00034 #include <CLHEP/Units/SystemOfUnits.h>
00035 
00036 #include "globals.hh"
00037 #include "G4NeutronHPVector.hh"
00038 #include "G4InterpolationManager.hh"
00039 #include "G4NeutronHPInterpolator.hh"
00040 
00041 class G4NeutronHPPartial
00042 {
00043   public:
00044   
00045   G4NeutronHPPartial(G4int n)
00046   { 
00047     X = new G4double[n];
00048     data = new G4NeutronHPVector[n];
00049     nData = n;
00050     T=0;
00051   }
00052   
00053   G4NeutronHPPartial(G4int n1, G4int n2)
00054   {
00055     T = new G4double[n2];
00056     X = new G4double[n1];
00057     data = new G4NeutronHPVector[n1];
00058     nData = std::max(n1,n2);
00059   }  
00060   
00061   void InitInterpolation(G4int i, std::ifstream & aDataFile)
00062   {
00063     data[i].InitInterpolation(aDataFile);
00064   }
00065   
00066   void InitInterpolation(std::ifstream & aDataFile)
00067   {
00068     theManager.Init(aDataFile);
00069   }
00070   
00071   void Init(std::ifstream & aDataFile)
00072   {
00073     G4int i;
00074     G4double e;
00075     for( i=0; i<nData; i++)
00076     {
00077       aDataFile >> e;
00078       e *= CLHEP::eV;
00079       SetX(i,e);
00080       InitData(i, aDataFile, CLHEP::eV); // energy and probability for gammas
00081     }  
00082   }
00083   
00084   void InitData(G4int i, std::ifstream & aDataFile, G4double unit=1.)
00085   {
00086     G4int ii;
00087     G4double eg, pg;
00088     G4int neg;
00089     aDataFile >> neg;
00090     data[i].InitInterpolation(aDataFile);
00091     for (ii=0; ii<neg; ii++)
00092     { 
00093       aDataFile >> eg >> pg;
00094       eg *= unit;
00095       SetX(i,ii,eg);
00096       SetY(i,ii,pg);
00097     }          
00098   }
00099   
00100   ~G4NeutronHPPartial()
00101   {
00102     delete [] X;
00103     if(T!=0) delete [] T;
00104     delete [] data;
00105   }
00106   inline G4int GetNumberOfEnergies() {return nData;}
00107   
00108   inline void SetX(G4int i, G4double x) {X[i]=x;}
00109   inline void SetT(G4int i, G4double x) {T[i]=x;}
00110   inline void SetX(G4int i, G4int j, G4double x) {data[i].SetX(j,x);}
00111   inline void SetY(G4int i, G4int j, G4double y) {data[i].SetY(j,y);}
00112   
00113   inline G4double GetX(G4int i) {return X[i];}
00114   inline G4double GetT(G4int i) {return T[i];}
00115   inline G4double GetX(G4int i, G4int j) {return data[i].GetX(j);}
00116   inline G4double GetY(G4int i, G4int j) {return data[i].GetY(j);}
00117   inline G4double GetY(G4int i, G4double e) {return data[i].GetY(e);}
00118   inline G4int GetNEntries(G4int i) {return data[i].GetVectorLength();}
00119   G4NeutronHPVector * GetY(G4double e1);
00120   G4double Sample(G4double x);
00121   
00122   private:
00123   
00124   G4double * X;
00125   G4double * T;
00126   G4NeutronHPVector * data;
00127   // TKDB
00128   //G4NeutronHPVector * theBuffer;
00129   G4int nData;
00130   G4InterpolationManager theManager; // interpolate between different data[i]
00131   G4NeutronHPInterpolator theInt;
00132 };
00133 
00134 #endif

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