EDepSimExtraPhysics.cc
Go to the documentation of this file.
1 #include "EDepSimExtraPhysics.hh"
2 #include "EDepSimException.hh"
3 
4 // Include NEST
7 
8 #include "EDepSimDokeBirks.hh"
9 #include "EDepSimLog.hh"
10 
11 #include <globals.hh>
12 #include <G4ParticleTypes.hh>
13 #include <G4ParticleDefinition.hh>
14 #include <G4ParticleWithCuts.hh>
15 #include <G4ProcessManager.hh>
16 #include <G4ProcessVector.hh>
17 #include <G4ParticleTypes.hh>
18 #include <G4ParticleTable.hh>
19 #include <G4Material.hh>
20 #include <G4ios.hh>
21 #include <G4StepLimiter.hh>
22 
24  : G4VPhysicsConstructor("EDepSimExtra"), fIonizationModel(1) { }
25 
27 
30 }
31 
33  EDepSimLog("EDepSim::ExtraPhysics:: Add Extra Physics Processes");
34 
35  G4ParticleTable::G4PTblDicIterator* theParticleIterator
36  = theParticleTable->GetIterator();
37 
38  theParticleIterator->reset();
39  while ((*theParticleIterator)()) {
40  G4ParticleDefinition* particle = theParticleIterator->value();
41  G4ProcessManager* pman = particle->GetProcessManager();
42  G4String particleName = particle->GetParticleName();
43  G4String particleType = particle->GetParticleType();
44  double charge = particle->GetPDGCharge();
45 
46  if (!pman) {
47  EDepSimError("Particle "
48  << particleName
49  << " without a Process Manager.");
50  EDepSimThrow("Particle without a Process Manager.");
51  }
52 
53  // All charged particles should have a step limiter to make sure that
54  // the steps do not get too long.
55  if (std::abs(charge) > 0.1) {
56  pman->AddDiscreteProcess(new G4StepLimiter("Step Limit"));
57  }
58 
59  switch (fIonizationModel) {
60  case 0: {
61  // Add nest to any applicable particle.
62  G4S1Light* scintProcess = new G4S1Light();
63  scintProcess->SetScintillationYieldFactor(1.0);
64  if (scintProcess->IsApplicable(*particle)) {
65  pman->AddProcess(scintProcess,ordDefault,
66  ordInActive,ordDefault);
67  }
68  break;
69  }
70  case 1: default: {
71  // Add EDepSim::DokeBirks to any applicable particle.
72  EDepSim::DokeBirks* scintProcess = new EDepSim::DokeBirks();
73  if (scintProcess->IsApplicable(*particle)) {
74  pman->AddProcess(scintProcess,ordDefault,
75  ordInActive,ordDefault);
76  }
77  break;
78  }
79  }
80  }
81 }
#define EDepSimLog(outStream)
Definition: EDepSimLog.hh:717
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
Determine which particles this process should be applied too.
virtual void ConstructParticle()
#define EDepSimThrow(message)
Print an error message, and then throw an exception.
T abs(T value)
G4bool IsApplicable(const G4ParticleDefinition &aParticleType)
Definition: G4S1Light.hh:124
void SetScintillationYieldFactor(const G4double yieldfactor)
Definition: G4S1Light.hh:150
virtual void ConstructProcess()
#define EDepSimError(outStream)
Definition: EDepSimLog.hh:503
static G4ThermalElectron * Definition()