Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 #ifndef G4HepEmParameters_HH
0003 #define G4HepEmParameters_HH
0004 
0005 /**
0006  * @file    G4HepEmParameters.hh
0007  * @struct  G4HepEmParameters
0008  * @author  M. Novak
0009  * @date    2020
0010  *
0011  * @brief Physics configuration related parameters.
0012  *
0013  * Collection of physics modelling related configuration parameters used in
0014  * ``G4HepEm`` at initialization- and run-time.
0015  *
0016  * A single instance of this structure is created and stored in the `master`
0017  * G4HepEmRunManager when its InitializeGlobal() method is invoked by calling
0018  * the InitHepEmParameters() function declared in the G4HepEmParamatersInit
0019  * header file. This method extracts information (mainly) from the G4EmParameters
0020  * singletone object. Therefore, the default values given here will be updated
0021  * during the initialisation.
0022  */
0023 
0024 /** Parameters per detector region. */
0025 struct G4HepEmRegionParmeters {
0026   /** The *final range* parameter of the sub-threshold energy loss related step limit function.*/
0027   double fFinalRange = 1.0;
0028   /** The *rover range* parameter of the sub-threshold energy loss related step limit function.*/
0029   double fDRoverRange = 0.2;
0030   /** Maximum allowed *linear* energy loss along step due to sub-threshold (continuous) energy losses
0031     * given as fraction of the intial kinetic energy. Proper integral is used to compute the mean energy loss
0032     * when the energy loss, according to linear approximation, is over this threshold.*/
0033   double fLinELossLimit = 0.01;
0034 
0035   /** MSC range and safety factor parameters */
0036   double fMSCRangeFactor  = 0.04;
0037   double fMSCSafetyFactor = 0.6;
0038   /** Flag to indicate if the non-default, simplified `fMinimal` MSC step limit should be used.*/
0039   bool   fIsMSCMinimalStepLimit = false;
0040 
0041   /** Flag to indicate if energy loss fluctuation should be used.*/
0042   bool   fIsELossFluctuation = true;
0043 
0044   /** Flag to indicate if the combined MSC + Transportation process is allowed for multiple steps. */
0045   bool   fIsMultipleStepsInMSCTrans = true;
0046 
0047   /** Apply secondary production threshold on all interactions (beyond ioni. and brem.) */
0048   bool   fIsApplyCuts = true;
0049 };
0050 
0051 
0052 struct G4HepEmParameters {
0053   /** \f$e^-/e^+\f$ tracking (kinetic) energy cut in Geant4 internal energy units:
0054     * \f$e^-/e^+\f$ tracks are stopped when their energy drops below this threshold,
0055     * their kinetic energy is deposited and annihilation to two \f$\gamma\f$-s interaction
0056     * is invoked in case of \f$e^+\f$.*/
0057   double fElectronTrackingCut = 0.001;
0058 
0059   /** \f$\gamma\f$ tracking (energy) cut in Geant4 internal energy units:
0060     * \f$\gamma\f$ tracks are stopped when their energy drops below this threshold,
0061     * and their kinetic energy is deposited. */
0062   double fGammaTrackingCut = 0.0;
0063 
0064   // The configuration of the kinetic energy grid of the energy loss related tables:
0065   /** Minimum of the kinetic energy grid used to build the sub-(secondary-production)threshold
0066     * related energy loss quantity tables such as the *restricted stopping power*, *range* and
0067     * *inverse range* tables. */
0068   double fMinLossTableEnergy = 0.0001; // 100 eV
0069   /** Maximum of the kinetic energy grid for loss tables.*/
0070   double fMaxLossTableEnergy = 1.0E+08; // 100 TeV
0071   /** Number of bins (equally spaced on log scale) of the loss table kinetic energy grid. */
0072   int    fNumLossTableBins   = 84;
0073 
0074   /** Kinetic energy limit between the two (Seltzer-Berger and Relativistic) models for bremsstrahlung photon emission
0075     * in case of \f$e^-/e^+\f$ primary particles.*/
0076   double fElectronBremModelLim = 1000; // 1 GeV
0077 
0078   /** Flag to indicate if the e+ correction should be used in the MSC \theta_0 angle. */
0079   bool   fIsMSCPositronCor  = true;
0080   /** Flag to indicate if displacement should be calculated/applied in MSC. */
0081   bool   fIsMSCDisplacement = true;
0082 
0083 
0084   /** Number of detector regions */
0085   int fNumRegions = 0;
0086   /** A `G4HepEmRegionParmeters` array for the individual detector regions. */
0087   G4HepEmRegionParmeters* fParametersPerRegion = nullptr; //[fNumRegions]
0088 
0089 #ifdef G4HepEm_CUDA_BUILD
0090   G4HepEmRegionParmeters* fParametersPerRegion_gpu = nullptr; //[fNumRegions]
0091 #endif  // G4HepEm_CUDA_BUILD
0092 
0093 };
0094 
0095 /** Function that ...*/
0096 void InitG4HepEmParameters (struct G4HepEmParameters* theHepEmParams);
0097 
0098 /** Function that ...*/
0099 void FreeG4HepEmParameters (struct G4HepEmParameters* theHepEmParams);
0100 
0101 
0102 #ifdef G4HepEm_CUDA_BUILD
0103   /** Function that makes the `G4HepEmRegionParmeters` array member of `G4HepEmParameters`
0104     * available on the device (the host side `_gpu` pointer will refer to the device side array).*/
0105   void CopyG4HepEmParametersToGPU(struct G4HepEmParameters* onCPU);
0106 
0107   /** Function that ...*/
0108   void FreeG4HepEmParametersOnGPU(struct G4HepEmParameters* onCPU);
0109 #endif  // G4HepEm_CUDA_BUILD
0110 
0111 
0112 
0113 #endif // G4HepEmParameters_HH