Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

MJGeneratorPNNLLookup.hh

Go to the documentation of this file.
00001 // This code implementation is the intellectual property of
00002 // the RD44 GEANT4 collaboration.
00003 //
00004 // By copying, distributing or modifying the Program (or any work
00005 // based on the Program) you indicate your acceptance of this statement,
00006 // and all its terms.
00007 //
00008 // $Id: MJGeneratorPNNLLookup.hh,v 1.2 2004/11/09 13:42:39 xliu Exp $
00009 // GEANT4 tag $Name:  $
00010 //
00011 // File:        MJGeneratorPNNLLookup.hh
00012 // Description: Utility class for lookup table storage and sampling in PNNL
00013 //              radioactive decay model.
00014 // Version:     1.0
00015 // Created:     2004-04-23
00016 // Author:      David Jordan
00017 // mail:        david.jordan@pnl.gov
00018 // phone:       509-376-0115
00019 
00020 
00021 #ifndef MJGeneratorPNNLLookup_h
00022 #define MJGeneratorPNNLLookup_h 1
00023 
00024 #include "globals.hh"
00025 
00026 // Lookup table utility class for PNNL radioactive decay generator.
00027 // Handles calculation of lookup table and sampling from table for two
00028 // lookup table types: an "interpolated" lookup on a table of (x,f(x))
00029 // values, where f(x) is a probability distribution in x, and a "discrete
00030 // index" lookup on a table of f(n), n = 0, 1, 2, ..., nmax values.
00031 
00032 class MJGeneratorPNNLLookup {
00033 
00034 public:
00035   MJGeneratorPNNLLookup() { };
00036   MJGeneratorPNNLLookup(G4int num_entries, G4double* x_arr, G4double* f_arr);
00037   MJGeneratorPNNLLookup(G4int num_entries, G4double* f_arr);
00038   MJGeneratorPNNLLookup(const MJGeneratorPNNLLookup& Lookup);
00039   ~MJGeneratorPNNLLookup();
00040   void operator=(const MJGeneratorPNNLLookup& Lookup);
00041 
00042   G4int     GetType()        const {return fType;         };
00043   G4double* GetXTable()      const {return f_pX_table;    };
00044   G4double* GetDistTable()   const {return f_pDist_table; };
00045   G4double* GetLookupTable() const {return f_pSum_table;  };
00046 
00047   void DoCreateTable(G4int num_entries, G4double* x_arr, G4double* f_arr);
00048   void DoCreateTable(G4int num_entries, G4double* f_arr);
00049   G4double DoLookupInterp(G4double x_rnd);
00050   G4int    DoLookupDiscrete(G4double x_rnd);
00051 
00052 private:
00053   G4int     fType;          // interpolated- or discrete-index lookup type
00054   G4int     fNum_entries;   // refers to # of entries in input distribution
00055   G4double* f_pX_table;     // not used for discrete-index lookup type
00056   G4double* f_pDist_table;  // input distribution array
00057   G4double* f_pSum_table;   // lookup table
00058 
00059   G4int Locate(double x);
00060   const static G4int kTYPE_INTERPOLATED_LOOKUP;
00061   const static G4int kTYPE_DISCRETE_LOOKUP;
00062 
00063 };
00064 
00065 #endif

Generated on Mon Nov 29 16:58:50 2004 for Majorana Simulation by  doxygen 1.3.9.1