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3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/exoticphysics/dmparticle/src/G4LDMBremModel.cc (Version 11.3.0) and /examples/extended/exoticphysics/dmparticle/src/G4LDMBremModel.cc (Version 10.7.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27 // -------------------------------------------     27 // -------------------------------------------------------------------
 28 //                                                 28 //
 29 // 21.03.17 V. Grichine based on G4hBremsstrah     29 // 21.03.17 V. Grichine based on G4hBremsstrahlungModel
 30 //                                                 30 //
 31 // Class Description:                              31 // Class Description:
 32 //                                                 32 //
 33 // Implementation of energy loss for LDMPhoton     33 // Implementation of energy loss for LDMPhoton emission by hadrons
 34 //                                                 34 //
 35                                                    35 
 36 //....oooOO0OOooo........oooOO0OOooo........oo     36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 37                                                    37 
 38 #include "G4LDMBremModel.hh"                       38 #include "G4LDMBremModel.hh"
 39                                                << 
 40 #include "TestParameters.hh"                   << 
 41                                                << 
 42 #include "G4LDMPhoton.hh"                      << 
 43 #include "G4Log.hh"                            << 
 44 #include "G4ParticleChangeForLoss.hh"          << 
 45 #include "G4PhysicalConstants.hh"                  39 #include "G4PhysicalConstants.hh"
 46 #include "G4SystemOfUnits.hh"                      40 #include "G4SystemOfUnits.hh"
                                                   >>  41 #include "G4Log.hh"
                                                   >>  42 #include "G4LDMPhoton.hh"
                                                   >>  43 #include "G4ParticleChangeForLoss.hh"
                                                   >>  44 #include "TestParameters.hh"
 47                                                    45 
 48 //....oooOO0OOooo........oooOO0OOooo........oo     46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 49                                                    47 
 50 using namespace std;                               48 using namespace std;
 51                                                    49 
 52 G4LDMBremModel::G4LDMBremModel(const G4Particl <<  50 G4LDMBremModel::G4LDMBremModel(const G4ParticleDefinition* p,
                                                   >>  51                                const G4String& nam)
 53   : G4MuBremsstrahlungModel(p, nam)                52   : G4MuBremsstrahlungModel(p, nam)
 54 {                                                  53 {
 55   fEpsilon = TestParameters::GetPointer()->Get     54   fEpsilon = TestParameters::GetPointer()->GetAlphaFactor();
 56   theLDMPhoton = G4LDMPhoton::LDMPhoton();         55   theLDMPhoton = G4LDMPhoton::LDMPhoton();
 57   fLDMPhotonMass = theLDMPhoton->GetPDGMass();     56   fLDMPhotonMass = theLDMPhoton->GetPDGMass();
 58   minThreshold = 1.2 * fLDMPhotonMass;         <<  57   minThreshold = 1.2*fLDMPhotonMass;
 59 }                                                  58 }
 60                                                    59 
 61 //....oooOO0OOooo........oooOO0OOooo........oo     60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 62                                                    61 
 63 G4LDMBremModel::~G4LDMBremModel() {}           <<  62 G4LDMBremModel::~G4LDMBremModel()
                                                   >>  63 {}
 64                                                    64 
 65 //....oooOO0OOooo........oooOO0OOooo........oo     65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 66                                                    66 
 67 G4double G4LDMBremModel::ComputeDEDXPerVolume( <<  67 G4double G4LDMBremModel::ComputeDEDXPerVolume(const G4Material*,
                                                   >>  68                                               const G4ParticleDefinition*,
 68                                                    69                                               G4double, G4double)
 69 {                                                  70 {
 70   return 0.0;                                      71   return 0.0;
 71 }                                                  72 }
 72                                                    73 
 73 //....oooOO0OOooo........oooOO0OOooo........oo     74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 74                                                    75 
 75 G4double G4LDMBremModel::ComputeDMicroscopicCr <<  76 G4double G4LDMBremModel::ComputeDMicroscopicCrossSection(
 76                                                <<  77                                            G4double tkin,
                                                   >>  78                                            G4double Z,
                                                   >>  79                                            G4double gammaEnergy)
 77 //  differential cross section                     80 //  differential cross section
 78 {                                                  81 {
 79   G4double dxsection = 0.;                         82   G4double dxsection = 0.;
 80                                                    83 
 81   if (gammaEnergy > tkin || tkin < minThreshol <<  84   if( gammaEnergy > tkin || tkin < minThreshold) return dxsection;
 82   /*                                               85   /*
 83   G4cout << "G4LDMBremModel m= " << mass       <<  86   G4cout << "G4LDMBremModel m= " << mass 
 84          << "  " << particle->GetParticleName( <<  87          << "  " << particle->GetParticleName() 
 85          << "  Egamma(GeV)= " << gammaEnergy/G <<  88          << "  Egamma(GeV)= " << gammaEnergy/GeV 
 86          << "  Ekin(GeV)= " << tkin/GeV << G4e     89          << "  Ekin(GeV)= " << tkin/GeV << G4endl;
 87   */                                               90   */
 88   G4double E = tkin + mass;                    <<  91   G4double E = tkin + mass ;
 89   G4double v = gammaEnergy / E;                <<  92   G4double v = gammaEnergy/E ;
 90   G4double delta = 0.5 * mass * mass * v / (E  <<  93   G4double delta = 0.5*mass*mass*v/(E-gammaEnergy) ;
 91   G4double rab0 = delta * sqrte;               <<  94   G4double rab0=delta*sqrte ;
 92                                                    95 
 93   G4int iz = std::max(1, std::min(G4lrint(Z),  <<  96   G4int iz = std::max(1,std::min(G4lrint(Z),99));
 94                                                    97 
 95   G4double z13 = 1.0 / nist->GetZ13(iz);       <<  98   G4double z13 = 1.0/nist->GetZ13(iz);
 96   G4double dn = mass * nist->GetA27(iz) / (70. <<  99   G4double dn  = mass*nist->GetA27(iz)/(70.*MeV);
 97                                                   100 
 98   G4double b = btf;                            << 101   G4double    b = btf;
 99   if (1 == iz) b = bh;                         << 102   if(1 == iz) b = bh;
100                                                   103 
101   // nucleus contribution logarithm               104   // nucleus contribution logarithm
102   G4double rab1 = b * z13;                     << 105   G4double rab1=b*z13;
103   G4double fn =                                << 106   G4double fn=G4Log(rab1/(dn*(electron_mass_c2+rab0*rab1))*
104     G4Log(rab1 / (dn * (electron_mass_c2 + rab << 107               (mass+delta*(dn*sqrte-2.))) ;
105   if (fn < 0.) fn = 0.;                        << 108   if(fn <0.) fn = 0. ;
106                                                   109 
107   G4double x = 1.0 - v;                           110   G4double x = 1.0 - v;
108                                                   111 
109   if (particle->GetPDGSpin() != 0) {           << 112   if(particle->GetPDGSpin() != 0) { x += 0.75*v*v; }
110     x += 0.75 * v * v;                         << 
111   }                                            << 
112                                                   113 
113   dxsection = coeff * x * Z * Z * fn / gammaEn << 114   dxsection  = coeff*x*Z*Z*fn/gammaEnergy;
114   return dxsection;                               115   return dxsection;
115 }                                                 116 }
116                                                   117 
117 //....oooOO0OOooo........oooOO0OOooo........oo    118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118                                                   119 
119 G4double G4LDMBremModel::ComputeCrossSectionPe << 120 G4double G4LDMBremModel::ComputeCrossSectionPerAtom(
120                                                << 121                                            const G4ParticleDefinition*,
121                                                << 122                                                  G4double kineticEnergy,
                                                   >> 123                                                  G4double Z, G4double,
                                                   >> 124                                                  G4double cutEnergy,
                                                   >> 125                                                  G4double maxEnergy)
122 {                                                 126 {
123   G4double cross = 0.0;                           127   G4double cross = 0.0;
124                                                << 128  
125   if (kineticEnergy <= lowestKinEnergy) return    129   if (kineticEnergy <= lowestKinEnergy) return cross;
126                                                   130 
127   G4double tmax = std::min(maxEnergy, kineticE    131   G4double tmax = std::min(maxEnergy, kineticEnergy);
128   G4double cut = std::min(cutEnergy, kineticEn << 132   G4double cut  = std::min(cutEnergy, kineticEnergy);
129                                                << 133   
130   cut = std::max(cut, minThreshold);              134   cut = std::max(cut, minThreshold);
131   if (cut >= tmax) return cross;                  135   if (cut >= tmax) return cross;
132                                                   136 
133   cross = ComputeMicroscopicCrossSection(kinet << 137   cross = ComputeMicroscopicCrossSection (kineticEnergy, Z, cut);
134                                                   138 
135   if (tmax < kineticEnergy) {                  << 139   if(tmax < kineticEnergy) 
                                                   >> 140   {
136     cross -= ComputeMicroscopicCrossSection(ki    141     cross -= ComputeMicroscopicCrossSection(kineticEnergy, Z, tmax);
137   }                                               142   }
138   cross *= fEpsilon * fEpsilon;                << 143   cross *= fEpsilon*fEpsilon;
139                                                   144 
140   return cross;                                   145   return cross;
141 }                                                 146 }
142                                                   147 
143 //....oooOO0OOooo........oooOO0OOooo........oo    148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
144                                                   149 
145 void G4LDMBremModel::SampleSecondaries(std::ve << 150 void G4LDMBremModel::SampleSecondaries(
146                                        const G << 151                               std::vector<G4DynamicParticle*>* vdp,
147                                        const G << 152                               const G4MaterialCutsCouple* couple,
148                                        G4doubl << 153                               const G4DynamicParticle* dp,
                                                   >> 154                               G4double minEnergy,
                                                   >> 155                               G4double maxEnergy)
149 {                                                 156 {
150   G4double kineticEnergy = dp->GetKineticEnerg    157   G4double kineticEnergy = dp->GetKineticEnergy();
151   // check against insufficient energy            158   // check against insufficient energy
152   G4double tmax = std::min(kineticEnergy, maxE    159   G4double tmax = std::min(kineticEnergy, maxEnergy);
153   G4double tmin = std::min(kineticEnergy, minE    160   G4double tmin = std::min(kineticEnergy, minEnergy);
154   tmin = std::max(tmin, minThreshold);            161   tmin = std::max(tmin, minThreshold);
155   if (tmin >= tmax) return;                    << 162   if(tmin >= tmax) return;
156                                                   163 
157   // ===== sampling of energy transfer ======     164   // ===== sampling of energy transfer ======
158                                                   165 
159   G4ParticleMomentum partDirection = dp->GetMo    166   G4ParticleMomentum partDirection = dp->GetMomentumDirection();
160                                                   167 
161   // select randomly one element constituing t    168   // select randomly one element constituing the material
162   const G4Element* anElement = SelectRandomAto << 169   const G4Element* anElement = SelectRandomAtom(couple,particle,kineticEnergy);
163   G4double Z = anElement->GetZ();                 170   G4double Z = anElement->GetZ();
164                                                   171 
165   G4double totalEnergy = kineticEnergy + mass; << 172   G4double totalEnergy   = kineticEnergy + mass;
166   G4double totalMomentum = sqrt(kineticEnergy  << 173   G4double totalMomentum = sqrt(kineticEnergy*(kineticEnergy + 2.0*mass));
167                                                   174 
168   G4double func1 = tmin * ComputeDMicroscopicC << 175   G4double func1 = tmin*
                                                   >> 176     ComputeDMicroscopicCrossSection(kineticEnergy,Z,tmin);
169                                                   177 
170   G4double lnepksi, epksi;                        178   G4double lnepksi, epksi;
171   G4double func2;                                 179   G4double func2;
172                                                   180 
173   G4double xmin = G4Log(tmin / MeV);           << 181   G4double xmin = G4Log(tmin/MeV);
174   G4double xmax = G4Log(tmax / tmin);          << 182   G4double xmax = G4Log(tmax/tmin);
175                                                   183 
176   do {                                         << 184   do 
177     lnepksi = xmin + G4UniformRand() * xmax;   << 185   {
178     epksi = MeV * G4Exp(lnepksi);              << 186     lnepksi = xmin + G4UniformRand()*xmax;
179     func2 = epksi * ComputeDMicroscopicCrossSe << 187     epksi   = MeV*G4Exp(lnepksi);
                                                   >> 188     func2   = epksi*ComputeDMicroscopicCrossSection(kineticEnergy,Z,epksi);
180                                                   189 
181     // Loop checking, 03-Aug-2015, Vladimir Iv    190     // Loop checking, 03-Aug-2015, Vladimir Ivanchenko
182   } while (func2 < func1 * G4UniformRand());   << 191   } while(func2 < func1*G4UniformRand());
183                                                   192 
184   G4double gEnergy = std::max(epksi, fLDMPhoto    193   G4double gEnergy = std::max(epksi, fLDMPhotonMass);
185   G4double gMomentum = std::sqrt((epksi - fLDM << 194   G4double gMomentum = 
                                                   >> 195     std::sqrt((epksi - fLDMPhotonMass)*(epksi + fLDMPhotonMass));
186                                                   196 
187   // ===== sample angle =====                     197   // ===== sample angle =====
188                                                   198 
189   G4double gam = totalEnergy / mass;           << 199   G4double gam  = totalEnergy/mass;
190   G4double rmax = gam * std::min(1.0, totalEne << 200   G4double rmax = gam*std::min(1.0, totalEnergy/gEnergy - 1.0);
191   G4double rmax2 = rmax * rmax;                << 201   G4double rmax2= rmax*rmax;
192   G4double x = G4UniformRand() * rmax2 / (1.0  << 202   G4double x = G4UniformRand()*rmax2/(1.0 + rmax2);
193                                                << 203 
194   G4double theta = std::sqrt(x / (1.0 - x)) /  << 204   G4double theta = std::sqrt(x/(1.0 - x))/gam;
195   G4double sint = std::sin(theta);             << 205   G4double sint  = std::sin(theta);
196   G4double phi = twopi * G4UniformRand();      << 206   G4double phi   = twopi * G4UniformRand() ;
197   G4double dirx = sint * cos(phi), diry = sint << 207   G4double dirx  = sint*cos(phi), diry = sint*sin(phi), dirz = cos(theta) ;
198                                                   208 
199   G4ThreeVector gDirection(dirx, diry, dirz);     209   G4ThreeVector gDirection(dirx, diry, dirz);
200   gDirection.rotateUz(partDirection);             210   gDirection.rotateUz(partDirection);
201                                                   211 
202   partDirection *= totalMomentum;                 212   partDirection *= totalMomentum;
203   partDirection -= gMomentum * gDirection;     << 213   partDirection -= gMomentum*gDirection;
204   partDirection = partDirection.unit();           214   partDirection = partDirection.unit();
205                                                   215 
206   // primary change                               216   // primary change
207                                                   217 
208   kineticEnergy -= gEnergy;                       218   kineticEnergy -= gEnergy;
209                                                   219 
210   fParticleChange->SetProposedKineticEnergy(ki    220   fParticleChange->SetProposedKineticEnergy(kineticEnergy);
211   fParticleChange->SetProposedMomentumDirectio    221   fParticleChange->SetProposedMomentumDirection(partDirection);
212                                                   222 
213   // save secondary                               223   // save secondary
214   G4DynamicParticle* aLDMPhoton = new G4Dynami << 224   G4DynamicParticle* aLDMPhoton = 
                                                   >> 225     new G4DynamicParticle(theLDMPhoton,gDirection,gEnergy);
215   vdp->push_back(aLDMPhoton);                     226   vdp->push_back(aLDMPhoton);
216 }                                                 227 }
217                                                   228 
218 //....oooOO0OOooo........oooOO0OOooo........oo    229 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
219                                                   230