Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 
0003 #ifndef G4HepEmSBTableData_HH
0004 #define G4HepEmSBTableData_HH
0005 
0006 // tables for sampling energy transfer for the Seltzer-Berger brem model
0007 
0008 struct G4HepEmSBTableData {
0009   // pre-prepared sampling tables are available:
0010   const int               fMaxZet           = 99; // max Z number
0011   const int               fNumElEnergy      = 65; // # e- kine (E_k) per Z
0012   const int               fNumKappa         = 54; // # red. photon eners per E_k
0013   // min/max electron kinetic energy usage limits
0014   double                  fLogMinElEnergy = 0.0;
0015   double                  fILDeltaElEnergy = 0.0;
0016 
0017   // e- kinetic energy and reduced photon energy grids and tehir logarithms
0018   double                  fElEnergyVect[65];   // [fNumElEnergy]
0019   double                  fLElEnergyVect[65];  // [fNumElEnergy]
0020   double                  fKappaVect[54];      // [fNumKappa]
0021   double                  fLKappaVect[54];     // [fNumKappa]
0022 
0023   int                     fNumHepEmMatCuts = 0;              // #hepEm-MC
0024   int                     fNumElemsInMatCuts = 0;            // #elements-in-all-hepEm-MC
0025   int*                    fGammaCutIndxStartIndexPerMC = nullptr;  // [fNumHepEmMatCuts]
0026   int*                    fGammaCutIndices = nullptr;              // [fNumElemsInMatCuts]
0027                                                                    // for each mat-cut and for each of their elements in the corresponding elemnt SB-table [ #elements-in-all-hepEm-MC]
0028 
0029   // data starts index for a given Z
0030   int                     fNumSBTableData = 0;     // # all data stored in fSBTableData
0031   int                     fSBTablesStartPerZ[121]; // max Z is 99 so all values above 99 will cast to 99 if any
0032   double*                 fSBTableData = nullptr;  // [fNumSBTableData]
0033   // for each Z:
0034   // - [0] #data
0035   // - [1] minE-grid index for table
0036   // - [2] maxE-grid index for table
0037   // - [3] #gamma-cuts i.e. #materia-cuts (with gamma-cut below upper model elenrgy i.e. 1 GeV)
0038   //       in which this Z appears
0039   // - then the S-tables for each energy grid i.e. (maxE-grid-index-minE-grid-indx)+1
0040   //   and each has ()#gamma-cuts + 3x#kappa-values) entries ==> i.e. for a given Z
0041   //   there are ([2]-[1]+1) x ([3] + 3x54) values stored.
0042 };
0043 
0044 
0045 // Allocates some of the dynamic part of the G4HepEmSBTableData structure (completed and filled in G4HepEmElectronInit)
0046 void AllocateSBTableData(struct G4HepEmSBTableData** theSBTableData, int numHepEmMatCuts, int numElemsInMC, int numElemsUnique);
0047 
0048 // Makes a new instance of G4HepEmSBTableData with the requested sizes for the dynamic components
0049 G4HepEmSBTableData* MakeSBTableData(int numHepEmMatCuts, int numElemsInMC, int numElemsUnique);
0050 
0051 
0052 // Clears all the dynamic part of the G4HepEmSBTableData structure (filled in G4HepEmElectronInit)
0053 void FreeSBTableData (struct G4HepEmSBTableData** theSBTableData);
0054 
0055 
0056 #ifdef G4HepEm_CUDA_BUILD
0057   /**
0058     * Allocates memory for and copies the G4HepEmSBTableData structure from the
0059     * host to the device.
0060     *
0061     * @param onHost    pointer to the host side, already initialised G4HepEmSBTableData structure.
0062     * @param onDevice  host side address of a device side G4HepEmSBTableData structure memory pointer.
0063     *   The pointed memory is cleaned (if not null at input) and points to the device side memory at
0064     *   termination that stores the copied G4HepEmSBTableDataa structure.
0065     */
0066   void CopySBTableDataToDevice(struct G4HepEmSBTableData* onHost, struct G4HepEmSBTableData** onDevice);
0067 
0068   /**
0069     * Frees all memory related to the device side G4HepEmSBTableDataa structure referred
0070     * by the pointer stored on the host side input argument address.
0071     *
0072     * @param onDevice host side address of a G4HepEmSBTableData structure located on the device side memory.
0073     *   The correspondig device memory will be freed and the input argument address will be set to null.
0074     */
0075   void FreeSBTableDataOnDevice(struct G4HepEmSBTableData** onDevice);
0076 #endif // DG4HepEm_CUDA_BUILD
0077 
0078 
0079 #endif // G4HepEmSBTables_HH