G4CompositeEMDataSet.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 // Composite 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 G4COMPOSITEEMDATASET_HH
00049 #define G4COMPOSITEEMDATASET_HH 1
00050 
00051 #include <vector>
00052 #include <CLHEP/Units/SystemOfUnits.h>
00053 
00054 #include "globals.hh"
00055 #include "G4VEMDataSet.hh"
00056 
00057 class G4VDataSetAlgorithm;
00058 
00059 class G4CompositeEMDataSet : public G4VEMDataSet 
00060 {
00061 public:
00062   G4CompositeEMDataSet(G4VDataSetAlgorithm* argAlgorithm, 
00063                        G4double eUnit=CLHEP::MeV, 
00064                        G4double dataUnit=CLHEP::barn, 
00065                        G4int zMin=1, 
00066                        G4int zMax=99); 
00067 
00068   virtual ~G4CompositeEMDataSet();
00069  
00070   virtual G4double FindValue(G4double x, G4int componentId=0) const;
00071   
00072   virtual void PrintData(void) const;
00073 
00074   virtual const G4VEMDataSet* GetComponent(G4int componentId) const { return components[componentId]; }
00075   virtual void AddComponent(G4VEMDataSet* dataSet) { components.push_back(dataSet); }
00076   virtual size_t NumberOfComponents() const { return components.size(); }
00077 
00078   virtual const G4DataVector& GetEnergies(G4int componentId) const { return GetComponent(componentId)->GetEnergies(0); }
00079   virtual const G4DataVector& GetData(G4int componentId) const { return GetComponent(componentId)->GetData(0); }
00080   virtual const G4DataVector& GetLogEnergies(G4int componentId) const { return GetComponent(componentId)->GetLogEnergies(0); }
00081   virtual const G4DataVector& GetLogData(G4int componentId) const { return GetComponent(componentId)->GetLogData(0); }
00082 
00083   virtual void SetEnergiesData(G4DataVector* x, G4DataVector* data, G4int componentId);
00084   virtual void SetLogEnergiesData(G4DataVector* xData,
00085                                   G4DataVector* data,
00086                                   G4DataVector* xLogData, 
00087                                   G4DataVector* Logdata,
00088                                   G4int componentId);
00089 
00090   virtual G4bool LoadData(const G4String& fileName);
00091   virtual G4bool LoadNonLogData(const G4String& fileName);
00092 
00093   virtual G4bool SaveData(const G4String& fileName) const;
00094 
00095  virtual G4double RandomSelect(G4int componentId) const;
00096 
00097    
00098 private:
00099 
00100   void CleanUpComponents(void);
00101   
00102   // Hide copy constructor and assignment operator 
00103   G4CompositeEMDataSet();
00104   G4CompositeEMDataSet(const G4CompositeEMDataSet& copy);
00105   G4CompositeEMDataSet& operator=(const G4CompositeEMDataSet& right);
00106 
00107   std::vector<G4VEMDataSet*> components;    // Owned pointers
00108 
00109   G4VDataSetAlgorithm* algorithm;           // Owned pointer 
00110   
00111   G4double unitEnergies;
00112   G4double unitData;
00113 
00114   G4int minZ;
00115   G4int maxZ;
00116 };
00117 #endif /* G4COMPOSITEEMDATASET_HH */
00118 
00119 
00120 
00121 
00122 
00123 
00124 
00125 
00126 

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