G4EMDataSet.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
00034 //
00035 // 15 Jul 2009   N.A.Karakatsanis    New methods added for loading logarithmic data
00036 //                                   to enhance computing performance of interpolation
00037 //
00038 // -------------------------------------------------------------------
00039 
00040 // Class description:
00041 // Low Energy Electromagnetic Physics
00042 // Data set for an electromagnetic physics process
00043 // A strategy pattern is used to encapsulate algorithms for data interpolation
00044 // Further documentation available from http://www.ge.infn.it/geant4/lowE
00045 
00046 // -------------------------------------------------------------------
00047 
00048 #ifndef G4EMDATASET_HH
00049 #define G4EMDATASET_HH 1
00050 
00051 #include <CLHEP/Units/SystemOfUnits.h>
00052 
00053 #include "globals.hh"
00054 #include "G4VEMDataSet.hh"
00055 
00056 class G4VDataSetAlgorithm;
00057 
00058 class G4EMDataSet : public G4VEMDataSet
00059 {
00060 public:
00061   G4EMDataSet(G4int argZ, 
00062               G4VDataSetAlgorithm* algo, 
00063               G4double xUnit=CLHEP::MeV, 
00064               G4double yUnit=CLHEP::barn,
00065               G4bool random=false);
00066 
00067   G4EMDataSet(G4int argZ, 
00068               G4DataVector* xData, 
00069               G4DataVector* data, 
00070               G4VDataSetAlgorithm* algo, 
00071               G4double xUnit=CLHEP::MeV, 
00072               G4double yUnit=CLHEP::barn,
00073               G4bool random=false);
00074 
00075   G4EMDataSet(G4int argZ, 
00076               G4DataVector* xData, 
00077               G4DataVector* data,
00078               G4DataVector* xLogData, 
00079               G4DataVector* Logdata, 
00080               G4VDataSetAlgorithm* algo, 
00081               G4double xUnit=CLHEP::MeV, 
00082               G4double yUnit=CLHEP::barn,
00083               G4bool random=false);
00084 
00085   virtual ~G4EMDataSet();
00086  
00087   virtual G4double FindValue(G4double x, G4int componentId=0) const;
00088   
00089   virtual void PrintData(void) const;
00090 
00091   virtual const G4VEMDataSet* GetComponent(G4int /* componentId */) const { return 0; }
00092 
00093   virtual void AddComponent(G4VEMDataSet* /* dataSet */) {}
00094 
00095   virtual size_t NumberOfComponents(void) const { return 0; }
00096 
00097   virtual const G4DataVector& GetEnergies(G4int /* componentId */) const { return *energies; }
00098   virtual const G4DataVector& GetData(G4int /* componentId */) const { return *data; }
00099   virtual const G4DataVector& GetLogEnergies(G4int /* componentId */) const { return *log_energies; }
00100   virtual const G4DataVector& GetLogData(G4int /* componentId */) const { return *log_data; }
00101 
00102   virtual void SetEnergiesData(G4DataVector* xData, G4DataVector* data, G4int componentId);
00103   virtual void SetLogEnergiesData(G4DataVector* xData,
00104                                   G4DataVector* data,
00105                                   G4DataVector* xLogData, 
00106                                   G4DataVector* Logdata,
00107                                   G4int componentId);
00108 
00109 
00110   virtual G4bool LoadData(const G4String& fileName);
00111   virtual G4bool LoadNonLogData(const G4String& fileName);
00112 
00113   virtual G4bool SaveData(const G4String& fileName) const;
00114 
00115   virtual G4double RandomSelect(G4int componentId = 0) const;
00116     
00117 
00118 private:
00119 
00120   size_t FindLowerBound(G4double energy) const;
00121   size_t FindLowerBound(G4double x, G4DataVector* values) const;
00122 
00123   G4double IntegrationFunction(G4double x);
00124 
00125   virtual void BuildPdf();
00126   
00127   G4String FullFileName(const G4String& fileName) const;
00128 
00129   // Hide copy constructor and assignment operator 
00130   G4EMDataSet();
00131   G4EMDataSet(const G4EMDataSet& copy);
00132   G4EMDataSet& operator=(const G4EMDataSet& right);
00133 
00134   G4int z;
00135 
00136   G4DataVector* energies;            // Owned pointer
00137   G4DataVector* data;                // Owned pointer
00138   G4DataVector* log_energies;        // Owned pointer
00139   G4DataVector* log_data;            // Owned pointer
00140 
00141   G4VDataSetAlgorithm* algorithm;    // Owned pointer 
00142   
00143   G4double unitEnergies;
00144   G4double unitData;
00145 
00146   G4DataVector* pdf;
00147   G4bool randomSet;
00148 };
00149 #endif /* G4EMDATASET_HH */

Generated on Mon May 27 17:48:08 2013 for Geant4 by  doxygen 1.4.7