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 G4CompositeEMDataSet 00034 // 31 Jul 2008 MGP Revised and renamed to G4CompositeDataSet 00035 // 00036 // ------------------------------------------------------------------- 00037 00038 // Class description: 00039 // Composite data set 00040 // Applies a Composite design pattern for data library management 00041 00042 // ------------------------------------------------------------------- 00043 00044 #ifndef G4COMPOSITEDATASET_HH 00045 #define G4COMPOSITEDATASET_HH 1 00046 00047 #include <vector> 00048 #include <CLHEP/Units/SystemOfUnits.h> 00049 00050 #include "globals.hh" 00051 #include "G4IDataSet.hh" 00052 00053 class G4IInterpolator; 00054 00055 class G4CompositeDataSet : public G4IDataSet 00056 { 00057 public: 00058 G4CompositeDataSet(G4IInterpolator* argAlgorithm, 00059 G4double eUnit=CLHEP::MeV, 00060 G4double dataUnit=CLHEP::barn, 00061 G4int zMin=1, 00062 G4int zMax=99); 00063 00064 virtual ~G4CompositeDataSet(); 00065 00066 virtual G4double FindValue(G4double x, G4int componentId=0) const; 00067 00068 virtual void PrintData(void) const; 00069 00070 virtual const G4IDataSet* GetComponent(G4int componentId) const 00071 { return components[componentId]; } 00072 00073 virtual void AddComponent(G4IDataSet* dataSet) 00074 { components.push_back(dataSet); } 00075 00076 virtual size_t NumberOfComponents() const 00077 { return components.size(); } 00078 00079 virtual const G4DataVector& GetEnergies(G4int componentId) const 00080 { return GetComponent(componentId)->GetEnergies(0); } 00081 00082 virtual const G4DataVector& GetData(G4int componentId) const 00083 { return GetComponent(componentId)->GetData(0); } 00084 00085 virtual void SetEnergiesData(G4DataVector* x, 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) const; 00091 00092 private: 00093 00094 void CleanUpComponents(void); 00095 00096 // Hide copy constructor and assignment operator 00097 G4CompositeDataSet(); 00098 G4CompositeDataSet(const G4CompositeDataSet& copy); 00099 G4CompositeDataSet& operator=(const G4CompositeDataSet& right); 00100 00101 std::vector<G4IDataSet*> components; // Owned pointers 00102 00103 G4IInterpolator* algorithm; // Owned pointer 00104 00105 G4double unitEnergies; 00106 G4double unitData; 00107 00108 G4int minZ; 00109 G4int maxZ; 00110 }; 00111 #endif /* G4COMPOSITEDATASET_HH */ 00112 00113 00114 00115 00116 00117 00118 00119 00120