Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4MicroElecSurface Class Reference

#include <G4MicroElecSurface.hh>

+ Inheritance diagram for G4MicroElecSurface:

Public Member Functions

 G4MicroElecSurface (const G4String &processName="MicroElecSurface", G4ProcessType type=fElectromagnetic)
 
 ~G4MicroElecSurface () override
 
G4bool IsApplicable (const G4ParticleDefinition &aParticleType) override
 
void SetFlagFranchissement ()
 
G4double GetMeanFreePath (const G4Track &, G4double, G4ForceCondition *condition) override
 
G4VParticleChangePostStepDoIt (const G4Track &aTrack, const G4Step &aStep) override
 
void BuildPhysicsTable (const G4ParticleDefinition &) override
 
G4MicroElecSurfaceStatus GetStatus () const
 
 G4MicroElecSurface (const G4MicroElecSurface &right)=delete
 
G4MicroElecSurfaceoperator= (const G4MicroElecSurface &right)=delete
 
void Initialise ()
 
- Public Member Functions inherited from G4VDiscreteProcess
 G4VDiscreteProcess (const G4String &aName, G4ProcessType aType=fNotDefined)
 
 G4VDiscreteProcess (G4VDiscreteProcess &)
 
virtual ~G4VDiscreteProcess ()
 
G4VDiscreteProcessoperator= (const G4VDiscreteProcess &)=delete
 
virtual G4double PostStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
 
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &, G4double, G4double, G4double &, G4GPILSelection *)
 
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &, G4ForceCondition *)
 
virtual G4VParticleChangeAtRestDoIt (const G4Track &, const G4Step &)
 
virtual G4VParticleChangeAlongStepDoIt (const G4Track &, const G4Step &)
 
virtual G4double GetCrossSection (const G4double, const G4MaterialCutsCouple *)
 
virtual G4double MinPrimaryEnergy (const G4ParticleDefinition *, const G4Material *)
 
- Public Member Functions inherited from G4VProcess
 G4VProcess (const G4String &aName="NoName", G4ProcessType aType=fNotDefined)
 
 G4VProcess (const G4VProcess &right)
 
virtual ~G4VProcess ()
 
G4VProcessoperator= (const G4VProcess &)=delete
 
G4bool operator== (const G4VProcess &right) const
 
G4bool operator!= (const G4VProcess &right) const
 
G4double GetCurrentInteractionLength () const
 
void SetPILfactor (G4double value)
 
G4double GetPILfactor () const
 
G4double AlongStepGPIL (const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
 
G4double AtRestGPIL (const G4Track &track, G4ForceCondition *condition)
 
G4double PostStepGPIL (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
 
virtual void PreparePhysicsTable (const G4ParticleDefinition &)
 
virtual G4bool StorePhysicsTable (const G4ParticleDefinition *, const G4String &, G4bool)
 
virtual G4bool RetrievePhysicsTable (const G4ParticleDefinition *, const G4String &, G4bool)
 
const G4StringGetPhysicsTableFileName (const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
 
const G4StringGetProcessName () const
 
G4ProcessType GetProcessType () const
 
void SetProcessType (G4ProcessType)
 
G4int GetProcessSubType () const
 
void SetProcessSubType (G4int)
 
virtual const G4VProcessGetCreatorProcess () const
 
virtual void StartTracking (G4Track *)
 
virtual void EndTracking ()
 
virtual void SetProcessManager (const G4ProcessManager *)
 
virtual const G4ProcessManagerGetProcessManager ()
 
virtual void ResetNumberOfInteractionLengthLeft ()
 
G4double GetNumberOfInteractionLengthLeft () const
 
G4double GetTotalNumberOfInteractionLengthTraversed () const
 
G4bool isAtRestDoItIsEnabled () const
 
G4bool isAlongStepDoItIsEnabled () const
 
G4bool isPostStepDoItIsEnabled () const
 
virtual void DumpInfo () const
 
virtual void ProcessDescription (std::ostream &outfile) const
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
virtual void SetMasterProcess (G4VProcess *masterP)
 
const G4VProcessGetMasterProcess () const
 
virtual void BuildWorkerPhysicsTable (const G4ParticleDefinition &part)
 
virtual void PrepareWorkerPhysicsTable (const G4ParticleDefinition &)
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VProcess
static const G4StringGetProcessTypeName (G4ProcessType)
 
- Protected Member Functions inherited from G4VDiscreteProcess
- Protected Member Functions inherited from G4VProcess
void SubtractNumberOfInteractionLengthLeft (G4double prevStepSize)
 
void ClearNumberOfInteractionLengthLeft ()
 
- Protected Attributes inherited from G4VProcess
const G4ProcessManageraProcessManager = nullptr
 
G4VParticleChangepParticleChange = nullptr
 
G4ParticleChange aParticleChange
 
G4double theNumberOfInteractionLengthLeft = -1.0
 
G4double currentInteractionLength = -1.0
 
G4double theInitialNumberOfInteractionLength = -1.0
 
G4String theProcessName
 
G4String thePhysicsTableFileName
 
G4ProcessType theProcessType = fNotDefined
 
G4int theProcessSubType = -1
 
G4double thePILfactor = 1.0
 
G4int verboseLevel = 0
 
G4bool enableAtRestDoIt = true
 
G4bool enableAlongStepDoIt = true
 
G4bool enablePostStepDoIt = true
 

Detailed Description

Definition at line 90 of file G4MicroElecSurface.hh.

Constructor & Destructor Documentation

◆ G4MicroElecSurface() [1/2]

G4MicroElecSurface::G4MicroElecSurface ( const G4String & processName = "MicroElecSurface",
G4ProcessType type = fElectromagnetic )
explicit

Definition at line 59 of file G4MicroElecSurface.cc.

60 : G4VDiscreteProcess(processName, type),
61 oldMomentum(0.,0.,0.), previousMomentum(0.,0.,0.),
62 theGlobalNormal(0.,0.,0.), theFacetNormal(0.,0.,0.)
63{
64 if ( verboseLevel > 0)
65 {
66 G4cout << GetProcessName() << " is created " << G4endl;
67 }
68
69 isInitialised=false;
71
72 theStatus = UndefinedSurf;
73 material1 = nullptr;
74 material2 = nullptr;
75
77 theParticleMomentum = 0.;
78
79 flag_franchissement_surface = false;
80 flag_normal = false;
81 flag_reflexion = false;
82 teleportToDo = teleportDone = false;
83
84 ekint = thetat = thetaft = energyThreshold = crossingProbability = 0.0;
85}
@ fSurfaceReflection
@ UndefinedSurf
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
G4int verboseLevel
void SetProcessSubType(G4int)
const G4String & GetProcessName() const

◆ ~G4MicroElecSurface()

G4MicroElecSurface::~G4MicroElecSurface ( )
override

Definition at line 89 of file G4MicroElecSurface.cc.

90{}

◆ G4MicroElecSurface() [2/2]

G4MicroElecSurface::G4MicroElecSurface ( const G4MicroElecSurface & right)
delete

Member Function Documentation

◆ BuildPhysicsTable()

void G4MicroElecSurface::BuildPhysicsTable ( const G4ParticleDefinition & )
overridevirtual

Reimplemented from G4VProcess.

Definition at line 132 of file G4MicroElecSurface.cc.

133{
134 if (isInitialised) { return; }
135
136 G4ProductionCutsTable* theCoupleTable =
138 G4int numOfCouples = (G4int)theCoupleTable->GetTableSize();
139 G4cout << "G4MicroElecSurface::Initialise: Ncouples= "
140 << numOfCouples << G4endl;
141
142 for (G4int i = 0; i < numOfCouples; ++i)
143 {
144 const G4Material* material =
145 theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial();
146
147 G4cout << "G4Surface, Material " << i + 1 << " / "
148 << numOfCouples << " : " << material->GetName() << G4endl;
149 if (material->GetName() == "Vacuum")
150 {
151 tableWF[material->GetName()] = 0;
152 continue;
153 }
154 G4String mat = material->GetName();
156 tableWF[mat] = str.GetWorkFunction();
157 }
158 isInitialised = true;
159}
int G4int
Definition G4Types.hh:85
const G4Material * GetMaterial() const
const G4String & GetName() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()

◆ GetMeanFreePath()

G4double G4MicroElecSurface::GetMeanFreePath ( const G4Track & ,
G4double ,
G4ForceCondition * condition )
overridevirtual

Implements G4VDiscreteProcess.

Definition at line 444 of file G4MicroElecSurface.cc.

446{
447 *condition = Forced;
448 return DBL_MAX;
449}
G4double condition(const G4ErrorSymMatrix &m)
@ Forced
#define DBL_MAX
Definition templates.hh:62

◆ GetStatus()

G4MicroElecSurfaceStatus G4MicroElecSurface::GetStatus ( ) const

Definition at line 529 of file G4MicroElecSurface.cc.

530{
531 return theStatus;
532}

◆ Initialise()

void G4MicroElecSurface::Initialise ( )

Definition at line 102 of file G4MicroElecSurface.cc.

103{
104 if (isInitialised) { return; }
105
106 G4ProductionCutsTable* theCoupleTable =
108 G4int numOfCouples = (G4int)theCoupleTable->GetTableSize();
109 G4cout << numOfCouples << G4endl;
110
111 for (G4int i = 0; i < numOfCouples; ++i)
112 {
113 const G4Material* material =
114 theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial();
115
116 G4cout << this->GetProcessName() << ", Material " << i + 1
117 << " / " << numOfCouples << " : " << material->GetName() << G4endl;
118 if (material->GetName() == "Vacuum")
119 {
120 tableWF[material->GetName()] = 0; continue;
121 }
122 G4String mat = material->GetName();
124 tableWF[mat] = str.GetWorkFunction();
125 }
126
127 isInitialised = true;
128}

Referenced by PostStepDoIt().

◆ IsApplicable()

G4bool G4MicroElecSurface::IsApplicable ( const G4ParticleDefinition & aParticleType)
overridevirtual

Reimplemented from G4VProcess.

Definition at line 95 of file G4MicroElecSurface.cc.

96{
97 return ( aParticleType.GetPDGEncoding() == 11 );
98}

◆ operator=()

G4MicroElecSurface & G4MicroElecSurface::operator= ( const G4MicroElecSurface & right)
delete

◆ PostStepDoIt()

G4VParticleChange * G4MicroElecSurface::PostStepDoIt ( const G4Track & aTrack,
const G4Step & aStep )
overridevirtual

Reimplemented from G4VDiscreteProcess.

Definition at line 163 of file G4MicroElecSurface.cc.

164{
165
166 if (!isInitialised) { Initialise(); }
167 theStatus = UndefinedSurf;
168
169 // Definition of the parameters for the particle
172
173 G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint();
174 G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();
175
176 material1 = pPreStepPoint -> GetMaterial();
177 material2 = pPostStepPoint -> GetMaterial();
178
179 theStatus = UndefinedSurf;
180
181 const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
182
183 theParticleMomentum = aParticle->GetTotalMomentum();
184 previousMomentum = oldMomentum;
185 oldMomentum = aParticle->GetMomentumDirection();
186
187
188 // Fisrt case: not a boundary
189 if (pPostStepPoint->GetStepStatus() != fGeomBoundary
190 || pPostStepPoint->GetPhysicalVolume()->GetName() == pPreStepPoint->GetPhysicalVolume()->GetName())
191 {
192 theStatus = NotAtBoundarySurf;
193 flag_franchissement_surface = false;
194 flag_reflexion = false;
195 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
196 }
197 theStatus = UndefinedSurf;
198
199 // Third case: same material
200 if (material1 == material2)
201 {
202 theStatus = SameMaterialSurf;
203 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
204 }
205 if (verboseLevel > 3)
206 {
207 G4cout << G4endl << " Electron at Boundary! " << G4endl;
208 G4VPhysicalVolume* thePrePV = pPreStepPoint->GetPhysicalVolume();
209 G4VPhysicalVolume* thePostPV = pPostStepPoint->GetPhysicalVolume();
210 if (thePrePV) G4cout << " thePrePV: " << thePrePV->GetName() << G4endl;
211 if (thePostPV) G4cout << " thePostPV: " << thePostPV->GetName() << G4endl;
212 G4cout << " Old Momentum Direction: " << oldMomentum << G4endl;
213 }
214
215 // Definition of the parameters for the surface
216 G4ThreeVector theGlobalPoint = pPostStepPoint->GetPosition();
217
220
221 G4bool valid;
222 theGlobalNormal = theNavigator->GetGlobalExitNormal(theGlobalPoint, &valid);
223
224 if (valid)
225 {
226 theGlobalNormal = -theGlobalNormal;
227 }
228 else
229 {
231 ed << " G4MicroElecSurface/PostStepDoIt(): "
232 << " The Navigator reports that it returned an invalid normal"
233 << G4endl;
234 G4Exception("G4MuElecSurf::PostStepDoIt", "OpBoun01",
236 "Invalid Surface Normal - Geometry must return valid surface normal");
237 }
238
239 // Exception: the particle is not in the right direction
240 if (oldMomentum * theGlobalNormal > 0.0)
241 {
242 theGlobalNormal = -theGlobalNormal;
243 }
244
245 if (aTrack.GetStepLength()<=kCarTolerance/2 * 0.0000000001)
246 {
247 if (flag_reflexion == true)
248 {
249 flag_reflexion = false;
250 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
251 }
252
253 theStatus = StepTooSmallSurf;
254
255 G4double energyThreshold_surface = 0.0*eV;
256
257 WorkFunctionTable::iterator postStepWF;
258 postStepWF = tableWF.find(pPostStepPoint->GetMaterial()->GetName());
259 WorkFunctionTable::iterator preStepWF;
260 preStepWF = tableWF.find(pPreStepPoint->GetMaterial()->GetName());
261
262 if (postStepWF == tableWF.end())
263 {
264 G4String str = "Material ";
265 str += pPostStepPoint->GetMaterial()->GetName() + " not found!";
266 G4Exception("G4Surface::G4Surface", "em0002", FatalException, str);
267 return nullptr;
268 }
269 else if (preStepWF == tableWF.end())
270 {
271 G4String str = "Material ";
272 str += pPreStepPoint->GetMaterial()->GetName() + " not found!";
273 G4Exception("G4Surface::G4Surface", "em0002", FatalException, str);
274 return nullptr;
275 }
276 else
277 {
278 G4double thresholdNew_surface = postStepWF->second;
279 G4double thresholdOld_surface = preStepWF->second;
280 energyThreshold_surface = thresholdNew_surface - thresholdOld_surface;
281 }
282
283 if (flag_franchissement_surface == true)
284 {
285 aParticleChange.ProposeEnergy(aStep.GetPostStepPoint()->GetKineticEnergy() + energyThreshold_surface);
286 flag_franchissement_surface = false;
287 }
288 if (flag_reflexion == true && flag_normal == true)
289 {
291 flag_reflexion = false;
292 flag_normal = false;
293 }
294 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
295 }
296
297 flag_normal = (theGlobalNormal == G4ThreeVector(0, 0, 1)
298 || theGlobalNormal == G4ThreeVector(0, 0, -1));
299
300 G4LogicalSurface* Surface = nullptr;
301
303 (pPreStepPoint ->GetPhysicalVolume(),
304 pPostStepPoint->GetPhysicalVolume());
305
306 if (Surface == nullptr)
307 {
308 G4bool enteredDaughter=(pPostStepPoint->GetPhysicalVolume()->GetMotherLogical()
309 == pPreStepPoint->GetPhysicalVolume()->GetLogicalVolume());
310 if(enteredDaughter)
311 {
313 (pPostStepPoint->GetPhysicalVolume()->GetLogicalVolume());
314
315 if(Surface == nullptr)
317 (pPreStepPoint->GetPhysicalVolume()->GetLogicalVolume());
318 }
319 else
320 {
322 (pPreStepPoint->GetPhysicalVolume()->GetLogicalVolume());
323
324 if(Surface == nullptr)
326 (pPostStepPoint->GetPhysicalVolume()->GetLogicalVolume());
327 }
328 }
329
330 // Definition of the parameters for the surface crossing
331 G4VPhysicalVolume* thePrePV = pPreStepPoint->GetPhysicalVolume();
332 G4VPhysicalVolume* thePostPV = pPostStepPoint->GetPhysicalVolume();
333
334 energyThreshold = 0.0*eV;
335 G4double energyDelta = 0;
336
337 if ((thePrePV)&&(thePostPV))
338 {
339 WorkFunctionTable::iterator postStepWF;
340 postStepWF = tableWF.find(thePostPV->GetLogicalVolume()->GetMaterial()->GetName());
341 WorkFunctionTable::iterator preStepWF;
342 preStepWF = tableWF.find(thePrePV->GetLogicalVolume()->GetMaterial()->GetName());
343
344 if (postStepWF == tableWF.end())
345 {
346 G4String str = "Material ";
347 str += thePostPV->GetLogicalVolume()->GetMaterial()->GetName() + " not found!";
348 G4Exception("G4Surface::G4Surface", "em0002", FatalException, str);
349 return nullptr;
350 }
351 else if (preStepWF == tableWF.end())
352 {
353 G4String str = "Material ";
354 str += thePrePV->GetLogicalVolume()->GetMaterial()->GetName() + " not found!";
355 G4Exception("G4Surface::G4Surface", "em0002", FatalException, str);
356 return nullptr;
357 }
358 else
359 {
360 G4double thresholdNew = postStepWF->second;
361 G4double thresholdOld = preStepWF->second;
362
363 energyThreshold = thresholdNew - thresholdOld;
364 energyDelta = thresholdOld- thresholdNew;
365 }
366 }
367
368 ekint=aStep.GetPostStepPoint()->GetKineticEnergy();
369 thetat= GetIncidentAngle(); //angle d'incidence
370 G4double ekinNormalt=ekint*std::cos(thetat)*std::cos(thetat);
371
372 thetaft=std::asin(std::sqrt(ekint/(ekint+energyThreshold))*std::sin(thetat));//Angle de refraction
373 if(std::sqrt(ekint/(ekint+energyThreshold))*std::sin(thetat)>1.0)
374 {
375 thetaft=std::asin(1.0);
376 }
377
378 G4double aleat=G4UniformRand();
379
380 G4double waveVectort=std::sqrt(2*9.1093826E-31*1.602176487E-19)/(6.6260755E-34/(2.0*pi));
381
382 // Parameter for an exponential barrier of potential (Thesis P68)
383 G4double at=0.5E-10;
384
385 crossingProbability=0;
386
387 G4double kft=waveVectort*std::sqrt(ekint+energyThreshold)*std::cos(thetaft);
388 G4double kit=waveVectort*std::sqrt(ekinNormalt);
389
390 crossingProbability=1-(std::pow(std::sinh(pi*at*(kit-kft)), 2.0)/std::pow(std::sinh(pi*at*(kit+kft)), 2.0));
391
392 // First case: the electron crosses the surface
393 if((aleat<=crossingProbability)&&(ekint> energyDelta))
394 {
395 if (aStep.GetPreStepPoint()->GetMaterial()->GetName()
396 != aStep.GetPostStepPoint()->GetMaterial()->GetName())
397 {
398 aParticleChange.ProposeEnergy(ekint - energyDelta);
399 flag_franchissement_surface = true;
400 }
401
402 thetaft=std::abs(thetaft-thetat);
403
405 G4ThreeVector xVerst = zVerst.orthogonal();
406 G4ThreeVector yVerst = zVerst.cross(xVerst);
407
408 G4double xDirt = std::sqrt(1. - std::cos(thetaft)*std::cos(thetaft));
409 G4double yDirt = xDirt;
410
411 G4ThreeVector zPrimeVerst=((xDirt*xVerst + yDirt*yVerst + std::cos(thetaft)*zVerst));
412
414 }
415 else if ((aleat > crossingProbability) && (ekint> energyDelta))
416 {
417 flag_reflexion = true;
418 if (flag_normal)
419 {
421 }
422 else
423 {
425 }
426 }
427 else
428 {
429 if (flag_normal)
430 {
432 }
433 else
434 {
436 }
437 flag_reflexion = true;
438 }
439 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
440}
@ FatalException
@ EventMustBeAborted
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
@ StepTooSmallSurf
@ SameMaterialSurf
@ NotAtBoundarySurf
@ fGeomBoundary
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
#define G4UniformRand()
Definition Randomize.hh:52
Hep3Vector unit() const
Hep3Vector orthogonal() const
Hep3Vector cross(const Hep3Vector &) const
const G4ThreeVector & GetMomentumDirection() const
G4double GetTotalMomentum() const
static G4LogicalBorderSurface * GetSurface(const G4VPhysicalVolume *vol1, const G4VPhysicalVolume *vol2)
static G4LogicalSkinSurface * GetSurface(const G4LogicalVolume *vol)
G4Material * GetMaterial() const
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &point, G4bool *valid)
void Initialize(const G4Track &) override
void ProposeVelocity(G4double finalVelocity)
void ProposeEnergy(G4double finalEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4StepStatus GetStepStatus() const
G4Material * GetMaterial() const
const G4ThreeVector & GetPosition() const
const G4ThreeVector & GetMomentumDirection() const
G4VPhysicalVolume * GetPhysicalVolume() const
G4double GetKineticEnergy() const
G4StepPoint * GetPreStepPoint() const
G4StepPoint * GetPostStepPoint() const
G4double GetVelocity() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetStepLength() const
static G4TransportationManager * GetTransportationManager()
G4Navigator * GetNavigatorForTracking() const
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
G4ParticleChange aParticleChange

◆ SetFlagFranchissement()

void G4MicroElecSurface::SetFlagFranchissement ( )

Definition at line 537 of file G4MicroElecSurface.cc.

538{
539 flag_franchissement_surface = false;
540}

The documentation for this class was generated from the following files: