source: trunk/examples/extended/field/field04/src/F04OpticalPhysics.cc@ 1337

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

update

File size: 4.4 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27//
28
29#include "globals.hh"
30
31#include "G4Scintillation.hh"
32#include "G4Cerenkov.hh"
33
34#include "G4OpAbsorption.hh"
35#include "G4OpRayleigh.hh"
36#include "G4OpBoundaryProcess.hh"
37#include "G4OpWLS.hh"
38
39#include "F04OpticalPhysics.hh"
40
41F04OpticalPhysics::F04OpticalPhysics()
42 : G4VPhysicsConstructor("Optical") { }
43
44F04OpticalPhysics::~F04OpticalPhysics() { }
45
46#include "G4ParticleDefinition.hh"
47#include "G4ParticleTable.hh"
48
49#include "G4OpticalPhoton.hh"
50
51void F04OpticalPhysics::ConstructParticle()
52{
53 G4OpticalPhoton::OpticalPhotonDefinition();
54}
55
56#include "G4ProcessManager.hh"
57
58void F04OpticalPhysics::ConstructProcess()
59{
60 G4cout << "F04OpticalPhysics:: Add Optical Physics Processes"
61 << G4endl;
62
63 G4Scintillation* theScintProcess = new G4Scintillation();
64 G4Cerenkov* theCerenkovProcess= new G4Cerenkov();
65
66 G4OpAbsorption* theAbsorptionProcess= new G4OpAbsorption();
67 G4OpRayleigh* theRayleighScattering = new G4OpRayleigh();
68 G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
69 G4OpWLS* theWLSProcess=new G4OpWLS();
70
71 G4ProcessManager* pManager =
72 G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
73
74 if (!pManager) {
75 std::ostringstream o;
76 o << "Optical Photon without a Process Manager";
77 G4Exception("F04OpticalPhysics::ConstructProcess()","",
78 FatalException,o.str().c_str());
79 }
80
81
82 pManager->AddDiscreteProcess(theAbsorptionProcess);
83 pManager->AddDiscreteProcess(theRayleighScattering);
84
85 theBoundaryProcess->SetModel(unified);
86// theBoundaryProcess->SetModel(glisur);
87
88 pManager->AddDiscreteProcess(theBoundaryProcess);
89
90 theWLSProcess->UseTimeProfile("delta");
91// theWLSProcess->UseTimeProfile("exponential");
92
93 pManager->AddDiscreteProcess(theWLSProcess);
94
95 theScintProcess->SetScintillationYieldFactor(1.);
96 theScintProcess->SetScintillationExcitationRatio(0.0);
97 theScintProcess->SetTrackSecondariesFirst(true);
98
99 theParticleIterator->reset();
100
101 while( (*theParticleIterator)() ){
102
103 G4ParticleDefinition* particle = theParticleIterator->value();
104 G4String particleName = particle->GetParticleName();
105
106 pManager = particle->GetProcessManager();
107 if (!pManager) {
108 std::ostringstream o;
109 o << "Particle " << particleName << "without a Process Manager";
110 G4Exception("F04OpticalPhysics::ConstructProcess()","",
111 FatalException,o.str().c_str());
112 }
113
114 if(theCerenkovProcess->IsApplicable(*particle)){
115 pManager->AddProcess(theCerenkovProcess);
116 pManager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
117 }
118 if(theScintProcess->IsApplicable(*particle)){
119 pManager->AddProcess(theScintProcess);
120 pManager->SetProcessOrderingToLast(theScintProcess,idxAtRest);
121 pManager->SetProcessOrderingToLast(theScintProcess,idxPostStep);
122 }
123
124 }
125}
Note: See TracBrowser for help on using the repository browser.