Initial version
[u/mrichter/AliRoot.git] / TGeant4 / TG4PhysicsConstructorOptical.cxx
1 // $Id$
2 // Category: physics
3 //
4 // According to ExN06PhysicsList (geant4 1.1)
5
6 #include "TG4PhysicsConstructorOptical.h"
7
8 #include <G4ParticleDefinition.hh>
9 #include <G4ProcessManager.hh>
10 #include <G4Cerenkov.hh>
11 #include <G4OpAbsorption.hh>
12 #include <G4OpRayleigh.hh>
13 #include <G4OpBoundaryProcess.hh>
14
15 TG4PhysicsConstructorOptical::TG4PhysicsConstructorOptical(const G4String& name)
16   : G4VPhysicsConstructor(name)
17 {
18 //
19   SetVerboseLevel(1);
20 }
21
22 TG4PhysicsConstructorOptical::~TG4PhysicsConstructorOptical() {
23 //
24 }
25
26 // protected methods
27
28 void TG4PhysicsConstructorOptical::ConstructParticle()
29 {
30 // The particles are constructed in the 
31 // TG4ModularPhysicsList.
32 // ---
33 }
34
35 void TG4PhysicsConstructorOptical::ConstructProcess()
36 {
37 // Constructs optical processes.
38 // According to ExN06PhysicsList.cc.
39 // (geant4 1.1)
40 // ---
41
42   G4Cerenkov*     theCerenkovProcess = new G4Cerenkov("Cerenkov");
43   G4OpAbsorption* theAbsorptionProcess = new G4OpAbsorption();
44   G4OpRayleigh*   theRayleighScatteringProcess = new G4OpRayleigh();
45   G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
46
47   theCerenkovProcess->DumpPhysicsTable();
48   //theAbsorptionProcess->DumpPhysicsTable();
49   //theRayleighScatteringProcess->DumpPhysicsTable();
50
51   // add verbose 
52   //theCerenkovProcess->SetVerboseLevel(1);
53   //theAbsorptionProcess->SetVerboseLevel(1);
54   //theRayleighScatteringProcess->SetVerboseLevel(1);
55   //theBoundaryProcess->SetVerboseLevel(1);
56
57   G4int maxNumPhotons = 300;
58
59   theCerenkovProcess->SetTrackSecondariesFirst(true);
60   theCerenkovProcess->SetMaxNumPhotonsPerStep(maxNumPhotons);
61
62   //G4OpticalSurfaceModel themodel = unified;   
63   // model from GEANT3
64   G4OpticalSurfaceModel themodel = glisur;
65   theBoundaryProcess->SetModel(themodel);
66
67   theParticleIterator->reset();
68   while( (*theParticleIterator)() ){
69     G4ParticleDefinition* particle = theParticleIterator->value();
70     G4ProcessManager* processManager = particle->GetProcessManager();
71     G4String particleName = particle->GetParticleName();
72     if (theCerenkovProcess->IsApplicable(*particle)) {
73       processManager->AddContinuousProcess(theCerenkovProcess);
74     }
75     if (particleName == "opticalphoton") {
76       G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl;
77       processManager->AddDiscreteProcess(theAbsorptionProcess);
78       processManager->AddDiscreteProcess(theRayleighScatteringProcess);
79       processManager->AddDiscreteProcess(theBoundaryProcess);
80     }
81   }
82
83   if (verboseLevel>0)
84     G4cout << "### " << namePhysics << " physics constructed." << G4endl;
85 }
86