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 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 /processes/electromagnetic/utils/include/G4EmBiasingManager.hh (Version 11.3.0) and /processes/electromagnetic/utils/include/G4EmBiasingManager.hh (Version 9.5.p1)


  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 // $Id: G4EmBiasingManager.hh,v 1.61 2010-08-17 17:36:59 vnivanch Exp $
                                                   >>  27 // GEANT4 tag $Name: not supported by cvs2svn $
 26 //                                                 28 //
 27 // -------------------------------------------     29 // -------------------------------------------------------------------
 28 //                                                 30 //
 29 // GEANT4 Class header file                        31 // GEANT4 Class header file
 30 //                                                 32 //
 31 //                                                 33 //
 32 // File name:     G4EmBiasingManager               34 // File name:     G4EmBiasingManager
 33 //                                                 35 //
 34 // Author:        Vladimir Ivanchenko              36 // Author:        Vladimir Ivanchenko
 35 //                                                 37 //
 36 // Creation date: 28.07.2011                       38 // Creation date: 28.07.2011
 37 //                                                 39 //
 38 // Modifications:                                  40 // Modifications:
 39 //                                                 41 //
 40 // Class Description:                              42 // Class Description:
 41 //                                                 43 //
 42 // It is a class providing step limit for forc     44 // It is a class providing step limit for forced process biasing
 43                                                    45 
 44 // -------------------------------------------     46 // -------------------------------------------------------------------
 45 //                                                 47 //
 46                                                    48 
 47 #ifndef G4EmBiasingManager_h                       49 #ifndef G4EmBiasingManager_h
 48 #define G4EmBiasingManager_h 1                     50 #define G4EmBiasingManager_h 1
 49                                                    51 
 50 #include "globals.hh"                              52 #include "globals.hh"
 51 #include "G4ParticleDefinition.hh"                 53 #include "G4ParticleDefinition.hh"
 52 #include "G4DynamicParticle.hh"                << 
 53 #include "Randomize.hh"                        << 
 54 #include <vector>                                  54 #include <vector>
 55                                                    55 
 56 //....oooOO0OOooo........oooOO0OOooo........oo     56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
 57                                                    57 
 58 class G4Region;                                    58 class G4Region;
                                                   >>  59 class G4DynamicParticle;
 59 class G4Track;                                     60 class G4Track;
 60 class G4VEnergyLossProcess;                    << 
 61 class G4VEmModel;                              << 
 62 class G4MaterialCutsCouple;                    << 
 63 class G4ParticleChangeForLoss;                 << 
 64 class G4ParticleChangeForGamma;                << 
 65                                                    61 
 66 class G4EmBiasingManager                           62 class G4EmBiasingManager 
 67 {                                                  63 {
 68 public:                                            64 public:
 69                                                    65 
 70   G4EmBiasingManager();                            66   G4EmBiasingManager();
 71                                                    67 
 72   ~G4EmBiasingManager();                           68   ~G4EmBiasingManager();
 73                                                    69 
 74   void Initialise(const G4ParticleDefinition&      70   void Initialise(const G4ParticleDefinition& part,
 75       const G4String& procName, G4int verbose)     71       const G4String& procName, G4int verbose);
 76                                                    72 
 77   // default parameters are possible               73   // default parameters are possible
 78   void ActivateForcedInteraction(G4double leng     74   void ActivateForcedInteraction(G4double length = 0.0, 
 79          const G4String& r = "");                  75          const G4String& r = "");
 80                                                    76 
 81   // no default parameters                         77   // no default parameters
 82   void ActivateSecondaryBiasing(const G4String     78   void ActivateSecondaryBiasing(const G4String& region, G4double factor,
 83         G4double energyLimit);                     79         G4double energyLimit);
 84                                                    80 
 85   // return forced step limit                      81   // return forced step limit
 86   G4double GetStepLimit(G4int coupleIdx, G4dou     82   G4double GetStepLimit(G4int coupleIdx, G4double previousStep);
 87                                                    83 
 88   // return weight of splitting or Russian rou     84   // return weight of splitting or Russian roulette
 89   // G4DynamicParticle may be deleted              85   // G4DynamicParticle may be deleted
 90   // two functions are required because of the << 
 91   // ApplySecondaryBiasing() are wrappers      << 
 92                                                << 
 93   // for G4VEmProcess                          << 
 94   G4double ApplySecondaryBiasing(std::vector<G     86   G4double ApplySecondaryBiasing(std::vector<G4DynamicParticle*>&, 
 95          const G4Track& track,                 << 
 96          G4VEmModel* currentModel,             << 
 97          G4ParticleChangeForGamma* pParticleCh << 
 98          G4double& eloss,                      << 
 99          G4int coupleIdx,                      << 
100          G4double tcut,                        << 
101          G4double safety = 0.0);               << 
102                                                << 
103   // for G4VEnergyLossProcess                  << 
104   G4double ApplySecondaryBiasing(std::vector<G << 
105          const G4Track& track,                 << 
106          G4VEmModel* currentModel,             << 
107          G4ParticleChangeForLoss* pParticleCha << 
108          G4double& eloss,                      << 
109                  G4int coupleIdx,              << 
110          G4double tcut,                        << 
111          G4double safety = 0.0);               << 
112                                                << 
113   // for G4VEnergyLossProcess                  << 
114   G4double ApplySecondaryBiasing(std::vector<G << 
115          G4int coupleIdx);                         87          G4int coupleIdx);
116                                                    88 
                                                   >>  89   // Splitting or Russian roulette, G4Track may be deleted
                                                   >>  90   void ApplySecondaryBiasing(std::vector<G4Track*>&, G4double primaryWeight, 
                                                   >>  91            G4int coupleIdx);
                                                   >>  92 
117   inline G4bool SecondaryBiasingRegion(G4int c     93   inline G4bool SecondaryBiasingRegion(G4int coupleIdx);
118                                                    94 
119   inline G4bool ForcedInteractionRegion(G4int      95   inline G4bool ForcedInteractionRegion(G4int coupleIdx);
120                                                    96 
121   inline void ResetForcedInteraction();            97   inline void ResetForcedInteraction();
122                                                    98 
123   G4bool CheckDirection(G4ThreeVector pos, G4T << 
124                                                << 
125   G4bool  GetDirectionalSplitting() { return f << 
126   void    SetDirectionalSplitting(G4bool v) {  << 
127                                                << 
128   void SetDirectionalSplittingTarget(G4ThreeVe << 
129     { fDirectionalSplittingTarget = v; }       << 
130   void SetDirectionalSplittingRadius(G4double  << 
131     { fDirectionalSplittingRadius = r; }       << 
132   G4double GetWeight(G4int i);                 << 
133                                                << 
134   // hide copy constructor and assignment oper << 
135   G4EmBiasingManager(G4EmBiasingManager &) = d << 
136   G4EmBiasingManager & operator=(const G4EmBia << 
137                                                << 
138 private:                                           99 private:
139                                                   100 
140   void ApplyRangeCut(std::vector<G4DynamicPart << 101   // copy constructor and hide assignment operator
141          const G4Track& track,                 << 102   G4EmBiasingManager(G4EmBiasingManager &);
142          G4double& eloss,                      << 103   G4EmBiasingManager & operator=(const G4EmBiasingManager &right);
143          G4double safety);                     << 
144                                                << 
145   G4double ApplySplitting(std::vector<G4Dynami << 
146         const G4Track& track,                  << 
147         G4VEmModel* currentModel,              << 
148         G4int index,                           << 
149         G4double tcut);                        << 
150                                                << 
151   G4double ApplyDirectionalSplitting(std::vect << 
152         const G4Track& track,                  << 
153         G4VEmModel* currentModel,              << 
154         G4int index,                           << 
155         G4double tcut,                         << 
156         G4ParticleChangeForGamma* partChange); << 
157                                                << 
158   G4double ApplyDirectionalSplitting(std::vect << 
159         const G4Track& track,                  << 
160         G4VEmModel* currentModel,              << 
161         G4int index,                           << 
162         G4double tcut);                        << 
163                                                << 
164   inline G4double ApplyRussianRoulette(std::ve << 
165                G4int index);                   << 
166                                                << 
167   G4VEnergyLossProcess* eIonisation = nullptr; << 
168                                                << 
169   const G4ParticleDefinition* theElectron;     << 
170   const G4ParticleDefinition* theGamma;        << 
171                                                << 
172   G4double fSafetyMin;                         << 
173   G4double currentStepLimit = 0.0;             << 
174   G4double fDirectionalSplittingRadius = 0.0;  << 
175                                                << 
176   G4int nForcedRegions = 0;                    << 
177   G4int nSecBiasedRegions = 0;                 << 
178                                                << 
179   G4bool startTracking = true;                 << 
180   G4bool fDirectionalSplitting = false;        << 
181                                                << 
182   G4ThreeVector fDirectionalSplittingTarget;   << 
183   std::vector<G4double> fDirectionalSplittingW << 
184                                                   104 
                                                   >> 105   G4int                        nForcedRegions;
                                                   >> 106   G4int                        nSecBiasedRegions;
                                                   >> 107   std::vector<const G4Region*> forcedRegions;
185   std::vector<G4double>        lengthForRegion    108   std::vector<G4double>        lengthForRegion;
                                                   >> 109   std::vector<const G4Region*> secBiasedRegions;
186   std::vector<G4double>        secBiasedWeight    110   std::vector<G4double>        secBiasedWeight;
187   std::vector<G4double>        secBiasedEnegry    111   std::vector<G4double>        secBiasedEnegryLimit;
188                                                << 
189   std::vector<const G4Region*> forcedRegions;  << 
190   std::vector<const G4Region*> secBiasedRegion << 
191                                                << 
192   std::vector<G4int>           nBremSplitting;    112   std::vector<G4int>           nBremSplitting;
                                                   >> 113 
193   std::vector<G4int>           idxForcedCouple    114   std::vector<G4int>           idxForcedCouple;
194   std::vector<G4int>           idxSecBiasedCou    115   std::vector<G4int>           idxSecBiasedCouple;
195                                                   116 
196   std::vector<G4DynamicParticle*> tmpSecondari << 117   G4double currentStepLimit;
                                                   >> 118   G4bool   startTracking;
197 };                                                119 };
198                                                   120 
199 inline G4bool                                     121 inline G4bool 
200 G4EmBiasingManager::SecondaryBiasingRegion(G4i    122 G4EmBiasingManager::SecondaryBiasingRegion(G4int coupleIdx)
201 {                                                 123 {
202   G4bool res = false;                             124   G4bool res = false;
203   if(nSecBiasedRegions > 0) {                     125   if(nSecBiasedRegions > 0) {
204     if(idxSecBiasedCouple[coupleIdx] >= 0) { r    126     if(idxSecBiasedCouple[coupleIdx] >= 0) { res = true; }
205   }                                               127   }
206   return res;                                     128   return res;
207 }                                                 129 }
208                                                   130 
209 inline G4bool G4EmBiasingManager::ForcedIntera    131 inline G4bool G4EmBiasingManager::ForcedInteractionRegion(G4int coupleIdx)
210 {                                                 132 {
211   G4bool res = false;                             133   G4bool res = false;
212   if(nForcedRegions > 0) {                        134   if(nForcedRegions > 0) {
213     if(idxForcedCouple[coupleIdx] >= 0) { res     135     if(idxForcedCouple[coupleIdx] >= 0) { res = true; }
214   }                                               136   }
215   return res;                                     137   return res;
216 }                                                 138 }
217                                                   139 
218 inline void G4EmBiasingManager::ResetForcedInt    140 inline void G4EmBiasingManager::ResetForcedInteraction()
219 {                                                 141 {
220   startTracking = true;                           142   startTracking = true;
221 }                                              << 
222                                                << 
223 //....oooOO0OOooo........oooOO0OOooo........oo << 
224                                                << 
225 inline G4double                                << 
226 G4EmBiasingManager::ApplyRussianRoulette(std:: << 
227            G4int index)                        << 
228 {                                              << 
229   size_t n = vd.size();                        << 
230   G4double weight = secBiasedWeight[index];    << 
231   for(size_t k=0; k<n; ++k) {                  << 
232     if(G4UniformRand()*weight > 1.0) {         << 
233       const G4DynamicParticle* dp = vd[k];     << 
234       delete dp;                               << 
235       vd[k] = nullptr;                         << 
236     }                                          << 
237   }                                            << 
238   return weight;                               << 
239 }                                                 143 }
240                                                   144 
241 //....oooOO0OOooo........oooOO0OOooo........oo    145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
242                                                   146 
243 #endif                                            147 #endif
244                                                   148