Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-13 08:21:05

0001 
0002 #ifndef G4HepEmSBBremTableBuilder_HH
0003 #define G4HepEmSBBremTableBuilder_HH
0004 
0005 // #g4 includes
0006 #include "globals.hh"
0007 #include "G4String.hh"
0008 
0009 #include <vector>
0010 
0011 // forward declar
0012 class G4MaterialCutsCouple;
0013 
0014 class G4HepEmSBBremTableBuilder {
0015 
0016 public:
0017    // CTR/DTR
0018    G4HepEmSBBremTableBuilder();
0019 
0020   ~G4HepEmSBBremTableBuilder();
0021 
0022    // loads and init sampling tables: lowe/highe are the low/high energy usage
0023    // limits of the corresponding Seltzerberger-model.
0024    void Initialize(const G4double lowe, const G4double highe);
0025 
0026    // clean away all sampling tables and makes ready for re-initialisation
0027    void ClearSamplingTables();
0028 
0029 
0030    // used only for development: print out table related information
0031     void Dump();
0032 
0033 // data structure definitions
0034 public:
0035 
0036    // Sampling-Table point: describes one [E_i],[kappa_j] point
0037    struct STPoint {
0038      G4double fCum;    // value of the cumulative function
0039      G4double fParA;   // rational function approximation based interp. parameter
0040      G4double fParB;   // rational function approximation based interp. parameter
0041    };
0042 
0043    // Sampling-Table: describes one [E_j] e- energy point i.e. one Table
0044    struct STable {
0045      // cumulative values for the kappa-cuts: kappa_cut_i=E_gamma_cut_i/E_el_j
0046      std::vector<G4double> fCumCutValues;
0047      // as many STPoint-s as kappa values
0048      std::vector<STPoint>  fSTable;
0049    };
0050 
0051    // Sampling-Tables for a given Z:
0052    // describes all tables (i.e. for all e- energies) for a given element (Z)
0053    struct SamplingTablePerZ {
0054      SamplingTablePerZ() : fNumGammaCuts(0), fMinElEnergyIndx(-1), fMaxElEnergyIndx(-1) {}
0055      size_t                fNumGammaCuts;     // number of gamma-cut for this
0056      G4int                 fMinElEnergyIndx;  // max(i) such E_i <= E for all E
0057      G4int                 fMaxElEnergyIndx;  // min(i) such E_i >= E for all E
0058      std::vector<STable*>  fTablesPerEnergy;  // as many table as e-ekin grid point
0059      //the different gamma-cut values that are defined for this element(Z) and ln
0060      std::vector<G4double> fGammaECuts;
0061      std::vector<G4double> fLogGammaECuts;
0062      // the couple index element stores the corresponding (sorted) gamma-cut index
0063      std::vector<size_t>   fMatCutIndxToGamCutIndx;
0064      // temporary vector to store some indecis during initialisation
0065      std::vector< std::vector<size_t> >   fGamCutIndxToMatCutIndx;
0066    };
0067 
0068 
0069 // access of data structures 
0070     const SamplingTablePerZ* GetSamplingTablesForZ(int iz) { return fSBSamplingTables[iz]; }
0071     const double*            GetElEnergyVect()             { return fElEnergyVect.data(); }
0072     const double*            GetKappaVect()                { return fKappaVect.data(); }
0073 
0074 
0075 private:
0076 
0077   void  BuildSamplingTables();
0078 
0079   void  InitSamplingTables();
0080 
0081   void  LoadSTGrid();
0082 
0083   void  LoadSamplingTables(G4int iz);
0084 
0085   void  ReadCompressedFile(const G4String &fname, std::istringstream &iss);
0086 
0087 
0088 //  // simple linear search: most of the time faster than anything in our case
0089 //  G4int LinSearch(const std::vector<STPoint>& vect,
0090 //                  const G4int size,
0091 //                  const G4double val);
0092 
0093 public:
0094 
0095   // pre-prepared sampling tables are available:
0096   G4int                           fMaxZet;      // max Z number
0097   G4int                           fNumElEnergy; // # e- kine (E_k) per Z
0098   G4int                           fNumKappa;    // # red. photon eners per E_k
0099 
0100   // min/max electron kinetic energy usage limits
0101   G4double                        fUsedLowEenergy;
0102   G4double                        fUsedHighEenergy;
0103   G4double                        fLogMinElEnergy;
0104   G4double                        fILDeltaElEnergy;
0105 
0106   // e- kinetic energy and reduced photon energy grids and tehir logarithms
0107   std::vector<G4double>           fElEnergyVect;
0108   std::vector<G4double>           fLElEnergyVect;
0109   std::vector<G4double>           fKappaVect;
0110   std::vector<G4double>           fLKappaVect;
0111 
0112   // container to store samplingtables per Z (size is fMaxZet+1)
0113   std::vector<SamplingTablePerZ*> fSBSamplingTables;
0114 
0115 };
0116 
0117 #endif