G4DataSet.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 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
00030 //
00031 // History:
00032 // -----------
00033 // 31 Jul 2001   MGP        Created as G4EMDataSet
00034 // 31 Jul 2008   MGP        Revised and renamed to G4DataSet
00035 //
00036 // -------------------------------------------------------------------
00037 
00038 // Class description:
00039 // Leaf data set 
00040 // Applies a Composite design pattern for data library management
00041 
00042 // -------------------------------------------------------------------
00043 
00044 #ifndef  G4DATASET_HH
00045 #define  G4DATASET_HH 1
00046 
00047 #include <CLHEP/Units/SystemOfUnits.h>
00048 
00049 #include "globals.hh"
00050 #include "G4IDataSet.hh"
00051 
00052 class G4IInterpolator;
00053 
00054 class G4DataSet : public G4IDataSet
00055 {
00056 public:
00057   G4DataSet(G4int argZ, 
00058             G4IInterpolator* algo, 
00059             G4double xUnit=CLHEP::MeV, 
00060             G4double yUnit=CLHEP::barn,
00061             G4bool random=false);
00062 
00063   G4DataSet(G4int argZ, 
00064             G4DataVector* xData, 
00065             G4DataVector* data, 
00066             G4IInterpolator* algo, 
00067             G4double xUnit=CLHEP::MeV, 
00068             G4double yUnit=CLHEP::barn,
00069             G4bool random=false);
00070 
00071   virtual ~G4DataSet();
00072  
00073   virtual G4double FindValue(G4double x, G4int componentId=0) const;
00074   
00075   virtual void PrintData(void) const;
00076 
00077   virtual const G4IDataSet* GetComponent(G4int /* componentId */) const { return 0; }
00078 
00079   virtual void AddComponent(G4IDataSet* /* dataSet */) {}
00080 
00081   virtual size_t NumberOfComponents(void) const { return 0; }
00082 
00083   virtual const G4DataVector& GetEnergies(G4int /* componentId */) const { return *energies; }
00084   virtual const G4DataVector& GetData(G4int /* componentId */) const { return *data; }
00085   virtual void SetEnergiesData(G4DataVector* xData, G4DataVector* data, G4int componentId);
00086 
00087   virtual G4bool LoadData(const G4String& fileName);
00088   virtual G4bool SaveData(const G4String& fileName) const;
00089 
00090   virtual G4double RandomSelect(G4int componentId = 0) const;
00091     
00092 
00093 private:
00094 
00095   size_t FindLowerBound(G4double energy) const;
00096   size_t FindLowerBound(G4double x, G4DataVector* values) const;
00097 
00098   G4double IntegrationFunction(G4double x);
00099 
00100   virtual void BuildPdf();
00101   
00102   G4String FullFileName(const G4String& fileName) const;
00103 
00104   // Hide copy constructor and assignment operator 
00105   G4DataSet();
00106   G4DataSet(const G4DataSet& copy);
00107   G4DataSet& operator=(const G4DataSet& right);
00108 
00109   G4int z;
00110 
00111   G4DataVector* energies;            // Owned pointer
00112   G4DataVector* data;                // Owned pointer
00113 
00114   G4IInterpolator* algorithm;    // Owned pointer 
00115   
00116   G4double unitEnergies;
00117   G4double unitData;
00118 
00119   G4DataVector* pdf;
00120   G4bool randomSet;
00121 };
00122 #endif /* G4DATASET_HH */

Generated on Mon May 27 17:47:59 2013 for Geant4 by  doxygen 1.4.7