Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:48

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // -------------------------------------------------------------------
0028 //
0029 // GEANT4 Class header file
0030 //
0031 //
0032 // File name:     G4PAIModel
0033 //
0034 // Author:        V. Grichine based on Vladimir Ivanchenko  code
0035 //
0036 // Creation date: 05.10.2003
0037 //
0038 // Modifications:
0039 // 08-04-05 Major optimisation of internal interfaces (V.Ivantchenko)
0040 // 26-09-07 Fixed tmax computation (V.Ivantchenko)
0041 // 19.08.13 V.Ivanchenko extract data handling to G4PAIModelData class 
0042 //          added sharing of internal data between threads (MT migration)
0043 //
0044 //
0045 // Class Description:
0046 //
0047 // Implementation of PAI model of energy loss and
0048 // delta-electron production by heavy charged particles
0049 
0050 // -------------------------------------------------------------------
0051 //
0052 
0053 #ifndef G4PAIModel_h
0054 #define G4PAIModel_h 1
0055 
0056 #include <CLHEP/Units/PhysicalConstants.h>
0057 
0058 #include "G4VEmModel.hh"
0059 #include "G4VEmFluctuationModel.hh"
0060 #include "globals.hh"
0061 #include <vector>
0062 
0063 class G4Region;
0064 class G4MaterialCutsCouple;
0065 class G4ParticleChangeForLoss;
0066 class G4PAIModelData;
0067 
0068 class G4PAIModel final : public G4VEmModel, public G4VEmFluctuationModel
0069 {
0070 
0071 public:
0072 
0073   explicit G4PAIModel(const G4ParticleDefinition* p = nullptr, 
0074               const G4String& nam = "PAI");
0075 
0076   ~G4PAIModel() final;
0077 
0078   void Initialise(const G4ParticleDefinition*, const G4DataVector&) final;
0079 
0080   void InitialiseLocal(const G4ParticleDefinition*, 
0081                        G4VEmModel* masterModel) final;
0082 
0083   G4double MinEnergyCut(const G4ParticleDefinition*,
0084                         const G4MaterialCutsCouple* couple) final;
0085 
0086   G4double ComputeDEDXPerVolume(const G4Material*,
0087                     const G4ParticleDefinition*,
0088                     G4double kineticEnergy,
0089                     G4double cutEnergy) final;
0090 
0091   G4double CrossSectionPerVolume(const G4Material*,
0092                      const G4ParticleDefinition*,
0093                  G4double kineticEnergy,
0094                  G4double cutEnergy,
0095                  G4double maxEnergy) final;
0096 
0097   void SampleSecondaries(std::vector<G4DynamicParticle*>*,
0098                  const G4MaterialCutsCouple*,
0099                  const G4DynamicParticle*,
0100                  G4double tmin,
0101                  G4double maxEnergy) final;
0102 
0103   G4double SampleFluctuations(const G4MaterialCutsCouple*,
0104                   const G4DynamicParticle*,
0105                   const G4double, const G4double,
0106                               const G4double, const G4double) final;
0107 
0108   G4double Dispersion(const G4Material*, const G4DynamicParticle*,
0109               const G4double, const G4double, 
0110                       const G4double) final;
0111 
0112   void DefineForRegion(const G4Region* r) final;
0113 
0114   inline G4PAIModelData* GetPAIModelData();
0115 
0116   inline const std::vector<const G4MaterialCutsCouple*>& GetVectorOfCouples();
0117 
0118   inline G4double ComputeMaxEnergy(G4double scaledEnergy);
0119 
0120   inline void SetVerboseLevel(G4int verbose);
0121 
0122   // hide assignment operator 
0123   G4PAIModel & operator=(const  G4PAIModel &right) = delete;
0124   G4PAIModel(const  G4PAIModel&) = delete;
0125 
0126 protected:
0127 
0128   G4double MaxSecondaryEnergy(const G4ParticleDefinition*, 
0129                               G4double kinEnergy) final;
0130 
0131 private:
0132 
0133   inline G4int FindCoupleIndex(const G4MaterialCutsCouple*);
0134 
0135   inline void SetParticle(const G4ParticleDefinition* p);
0136 
0137   G4int                       fVerbose; 
0138 
0139   G4PAIModelData*             fModelData; 
0140 
0141   std::vector<const G4MaterialCutsCouple*> fMaterialCutsCoupleVector;
0142   std::vector<const G4Region*>      fPAIRegionVector;
0143 
0144   const G4ParticleDefinition* fParticle;
0145   const G4ParticleDefinition* fElectron;
0146   const G4ParticleDefinition* fPositron;
0147   G4ParticleChangeForLoss*    fParticleChange;
0148 
0149   G4double fMass;
0150   G4double fRatio;
0151   G4double fChargeSquare;
0152   G4double fLowestTcut;
0153 };
0154 
0155 inline G4PAIModelData* G4PAIModel::GetPAIModelData()
0156 {
0157   return fModelData;
0158 }
0159 
0160 inline const std::vector<const G4MaterialCutsCouple*>& 
0161 G4PAIModel::GetVectorOfCouples()
0162 {
0163   return fMaterialCutsCoupleVector;
0164 }
0165 
0166 inline G4double G4PAIModel::ComputeMaxEnergy(G4double scaledEnergy)
0167 {
0168   return MaxSecondaryEnergy(fParticle, scaledEnergy/fRatio);
0169 }
0170 
0171 inline void G4PAIModel::SetVerboseLevel(G4int verbose) 
0172 { 
0173   fVerbose=verbose; 
0174 }
0175 
0176 inline G4int G4PAIModel::FindCoupleIndex(const G4MaterialCutsCouple* couple)
0177 {
0178   G4int idx = -1;
0179   G4int jMatMax = (G4int)fMaterialCutsCoupleVector.size();
0180   for(G4int jMat = 0;jMat < jMatMax; ++jMat) { 
0181     if(couple == fMaterialCutsCoupleVector[jMat]) {
0182       idx = jMat; 
0183       break; 
0184     }
0185   }
0186   return idx;
0187 }
0188 
0189 inline void G4PAIModel::SetParticle(const G4ParticleDefinition* p)
0190 {
0191   if(fParticle != p) {
0192     fParticle = p;
0193     fMass = fParticle->GetPDGMass();
0194     fRatio = CLHEP::proton_mass_c2/fMass;
0195     G4double q = fParticle->GetPDGCharge()/CLHEP::eplus;
0196     fChargeSquare = q*q;
0197   }
0198 }
0199 
0200 #endif