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

Last change on this file was 1342, checked in by garnier, 15 years ago

update ti head

File size: 4.5 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 "G4OpMieHG.hh"
37#include "G4OpBoundaryProcess.hh"
38#include "G4OpWLS.hh"
39
40#include "F04OpticalPhysics.hh"
41
42F04OpticalPhysics::F04OpticalPhysics()
43 : G4VPhysicsConstructor("Optical") { }
44
45F04OpticalPhysics::~F04OpticalPhysics() { }
46
47#include "G4ParticleDefinition.hh"
48#include "G4ParticleTable.hh"
49
50#include "G4OpticalPhoton.hh"
51
52void F04OpticalPhysics::ConstructParticle()
53{
54 G4OpticalPhoton::OpticalPhotonDefinition();
55}
56
57#include "G4ProcessManager.hh"
58
59void F04OpticalPhysics::ConstructProcess()
60{
61 G4cout << "F04OpticalPhysics:: Add Optical Physics Processes"
62 << G4endl;
63
64 G4Scintillation* theScintProcess = new G4Scintillation();
65 G4Cerenkov* theCerenkovProcess= new G4Cerenkov();
66
67 G4OpAbsorption* theAbsorptionProcess= new G4OpAbsorption();
68 G4OpRayleigh* theRayleighScattering = new G4OpRayleigh();
69 G4OpMieHG* theMieHGScatteringProcess = new G4OpMieHG();
70 G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
71 G4OpWLS* theWLSProcess=new G4OpWLS();
72
73 G4ProcessManager* pManager =
74 G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
75
76 if (!pManager) {
77 std::ostringstream o;
78 o << "Optical Photon without a Process Manager";
79 G4Exception("F04OpticalPhysics::ConstructProcess()","",
80 FatalException,o.str().c_str());
81 }
82
83
84 pManager->AddDiscreteProcess(theAbsorptionProcess);
85 pManager->AddDiscreteProcess(theRayleighScattering);
86 pManager->AddDiscreteProcess(theMieHGScatteringProcess);
87
88 theBoundaryProcess->SetModel(unified);
89// theBoundaryProcess->SetModel(glisur);
90
91 pManager->AddDiscreteProcess(theBoundaryProcess);
92
93 theWLSProcess->UseTimeProfile("delta");
94// theWLSProcess->UseTimeProfile("exponential");
95
96 pManager->AddDiscreteProcess(theWLSProcess);
97
98 theScintProcess->SetScintillationYieldFactor(1.);
99 theScintProcess->SetScintillationExcitationRatio(0.0);
100 theScintProcess->SetTrackSecondariesFirst(true);
101
102 theParticleIterator->reset();
103
104 while( (*theParticleIterator)() ){
105
106 G4ParticleDefinition* particle = theParticleIterator->value();
107 G4String particleName = particle->GetParticleName();
108
109 pManager = particle->GetProcessManager();
110 if (!pManager) {
111 std::ostringstream o;
112 o << "Particle " << particleName << "without a Process Manager";
113 G4Exception("F04OpticalPhysics::ConstructProcess()","",
114 FatalException,o.str().c_str());
115 }
116
117 if(theCerenkovProcess->IsApplicable(*particle)){
118 pManager->AddProcess(theCerenkovProcess);
119 pManager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
120 }
121 if(theScintProcess->IsApplicable(*particle)){
122 pManager->AddProcess(theScintProcess);
123 pManager->SetProcessOrderingToLast(theScintProcess,idxAtRest);
124 pManager->SetProcessOrderingToLast(theScintProcess,idxPostStep);
125 }
126
127 }
128}
Note: See TracBrowser for help on using the repository browser.