CMS 3D CMS Logo

LaserOpticalPhysicsList.cc
Go to the documentation of this file.
1 
11 
12 #include "G4ParticleTable.hh"
13 #include "G4ProcessManager.hh"
14 
15 #include "G4Cerenkov.hh"
16 #include "G4OpAbsorption.hh"
17 #include "G4OpBoundaryProcess.hh"
18 #include "G4OpRayleigh.hh"
19 #include "G4Scintillation.hh"
20 
22  : G4VPhysicsConstructor(name),
23  wasActivated(false),
24  theScintProcess(),
25  theCerenkovProcess(),
26  theAbsorptionProcess(),
27  theRayleighScattering(),
28  theBoundaryProcess(),
29  theWLSProcess() {
30  if (verboseLevel > 0)
31  std::cout << "<LaserOpticalPhysicsList::LaserOpticalPhysicsList(...)> "
32  "entering constructor ..."
33  << std::endl;
34 }
35 
37  if (verboseLevel > 0) {
38  std::cout << "<LaserOpticalPhysicsList::~LaserOpticalPhysicsList()> "
39  "entering destructor ... "
40  << std::endl;
41  std::cout << " deleting the processes ... ";
42  }
43  if (theWLSProcess != nullptr) {
44  delete theWLSProcess;
45  }
46  if (theBoundaryProcess != nullptr) {
47  delete theBoundaryProcess;
48  }
49  if (theRayleighScattering != nullptr) {
50  delete theRayleighScattering;
51  }
52  if (theAbsorptionProcess != nullptr) {
53  delete theAbsorptionProcess;
54  }
55  if (theScintProcess != nullptr) {
56  delete theScintProcess;
57  }
58  if (verboseLevel > 0)
59  G4cout << " done " << G4endl;
60 }
61 
63  if (verboseLevel > 0)
64  G4cout << "<LaserOpticalPhysicsList::ConstructParticle()>: constructing "
65  "the optical photon ... "
66  << G4endl;
67 
68  // optical photon
69  G4OpticalPhoton::OpticalPhotonDefinition();
70 }
71 
73  if (verboseLevel > 0)
74  G4cout << "<LaserOpticalPhysicsList::ConstructProcess()>: constructing "
75  "the physics ... "
76  << G4endl;
77 
78  theScintProcess = new G4Scintillation();
79  theAbsorptionProcess = new G4OpAbsorption();
80  theRayleighScattering = new G4OpRayleigh();
81  theBoundaryProcess = new G4OpBoundaryProcess("OpBoundary");
82  theWLSProcess = new G4OpWLS();
83 
84  // set the verbosity level
85  theAbsorptionProcess->SetVerboseLevel(verboseLevel);
86  theBoundaryProcess->SetVerboseLevel(verboseLevel);
87 
88  G4ProcessManager *pManager = nullptr;
89 
90  pManager = G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
91  pManager->AddDiscreteProcess(theAbsorptionProcess);
92  pManager->AddDiscreteProcess(theRayleighScattering);
93  pManager->AddDiscreteProcess(theBoundaryProcess);
94  pManager->AddDiscreteProcess(theWLSProcess);
95 
96  theScintProcess->SetTrackSecondariesFirst(true);
97 
98  G4ParticleTable *table = G4ParticleTable::GetParticleTable();
99  EmParticleList emList;
100  for (const auto &particleName : emList.PartNames()) {
101  G4ParticleDefinition *particle = table->FindParticle(particleName);
102  pManager = particle->GetProcessManager();
103  if (theScintProcess->IsApplicable(*particle)) {
104  pManager->AddProcess(theScintProcess);
105  pManager->SetProcessOrderingToLast(theScintProcess, idxAtRest);
106  pManager->SetProcessOrderingToLast(theScintProcess, idxPostStep);
107  }
108  }
109 
110  wasActivated = true;
111 }
~LaserOpticalPhysicsList() override
destructor
void ConstructParticle() override
construct Optical Photons
LaserOpticalPhysicsList(const G4String &name="optical")
constructor
G4OpBoundaryProcess * theBoundaryProcess
void ConstructProcess() override
construct Optical Processes
const std::vector< G4String > & PartNames() const
G4OpAbsorption * theAbsorptionProcess