source: trunk/examples/novice/gemc/src/OpticalPhysics.cc@ 1198

Last change on this file since 1198 was 807, checked in by garnier, 17 years ago

update

File size: 3.5 KB
RevLine 
[807]1// %%%%%%%%%%
2// G4 headers
3// %%%%%%%%%%
4#include "G4OpAbsorption.hh"
5#include "G4OpBoundaryProcess.hh"
6#include "G4OpRayleigh.hh"
7#include "G4OpticalPhoton.hh"
8#include "G4OpWLS.hh"
9// #include "G4ParticleDefinition.hh"
10// #include "G4ParticleTable.hh"
11#include "G4ProcessManager.hh"
12
13#include "G4Cerenkov.hh"
14
15// %%%%%%%%%%%%
16// gemc headers
17// %%%%%%%%%%%%
18#include "OpticalPhysics.h"
19
20// %%%%%%%%%%%
21// C++ headers
22// %%%%%%%%%%%
23#include <string>
24using namespace std;
25
26OpticalPhysics::OpticalPhysics(gemc_opts Opt) : G4VPhysicsConstructor("Optical Physics")
27{
28 gemcOpt = Opt;
29}
30
31OpticalPhysics::~OpticalPhysics(){}
32
33void OpticalPhysics::ConstructParticle()
34{
35 G4OpticalPhoton::OpticalPhotonDefinition();
36}
37
38
39void OpticalPhysics::ConstructProcess()
40{
41 string hd_msg = gemcOpt.args["LOG_MSG"].args + " Optical Physics List: <<< ";
42 double VERB = gemcOpt.args["PHY_VERBOSITY"].arg ;
43 cout << hd_msg << " Building Optical Physics processes " << endl;
44
45 theScintProcess = new G4Scintillation("Scintillation");
46 theScintProcess->SetScintillationYieldFactor(1.);
47 theScintProcess->SetScintillationExcitationRatio(0.0);
48 theScintProcess->SetTrackSecondariesFirst(true);
49
50 G4Cerenkov* theCerenkovProcess = new G4Cerenkov("Cerenkov");
51 theCerenkovProcess->SetMaxNumPhotonsPerStep(200);
52 theCerenkovProcess->SetTrackSecondariesFirst(true);
53
54 G4OpAbsorption* theAbsorptionProcess = new G4OpAbsorption();
55 G4OpRayleigh* theRayleighScattering = new G4OpRayleigh();
56
57 G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
58 theBoundaryProcess->SetModel(unified);
59
60 G4OpWLS* theWLSProcess = new G4OpWLS();
61 theWLSProcess->UseTimeProfile("delta");
62
63 G4ProcessManager * pManager = 0;
64
65 if(VERB > 2) cout << hd_msg << endl
66 << " > Optical Photon: " << endl
67 << " Absorption " << endl
68 << " Rayleigh Scattering" << endl
69 << " Boundary Processes" << endl
70 << " WaveLength Shifting " << endl;
71 pManager = G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
72 pManager->AddDiscreteProcess(theAbsorptionProcess);
73 pManager->AddDiscreteProcess(theRayleighScattering);
74 pManager->AddDiscreteProcess(theBoundaryProcess);
75 pManager->AddDiscreteProcess(theWLSProcess);
76
77 theParticleIterator->reset();
78 while( (*theParticleIterator)() )
79 {
80 G4ParticleDefinition* particle = theParticleIterator->value();
81 string particleName = particle->GetParticleName();
82
83 pManager = particle->GetProcessManager();
84 if(theCerenkovProcess->IsApplicable(*particle))
85 {
86 if(VERB > 2) cout << hd_msg << " " << particleName << ": Cerenkov Process" << endl;
87 pManager->AddProcess(theCerenkovProcess);
88 pManager->SetProcessOrdering(theCerenkovProcess, idxPostStep);
89 }
90
91 if(theScintProcess->IsApplicable(*particle))
92 {
93 if(VERB > 2) cout << hd_msg << " " << particleName << ": Scintillation Process" << endl;
94 pManager->AddProcess(theScintProcess);
95 pManager->SetProcessOrderingToLast(theScintProcess, idxAtRest);
96 pManager->SetProcessOrderingToLast(theScintProcess, idxPostStep);
97 }
98 }
99}
100
101
102void OpticalPhysics::SetScintYieldFactor(G4double yf)
103{
104 string hd_msg = gemcOpt.args["LOG_MSG"].args + " Optical Physics List: <<< ";
105 double VERB = gemcOpt.args["PHY_VERBOSITY"].arg ;
106
107 if(VERB > 2) cout << hd_msg << " Scintillation yield factor: " << yf << endl;
108 if(theScintProcess)
109 theScintProcess->SetScintillationYieldFactor(yf);
110}
111
112
Note: See TracBrowser for help on using the repository browser.