]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4PhysicsConstructorOptical.cxx
Some additional changes related to the previous changes. AliL3Transform
[u/mrichter/AliRoot.git] / TGeant4 / TG4PhysicsConstructorOptical.cxx
1 // $Id$
2 // Category: physics
3 //
4 // Author: I. Hrivnacova
5 //
6 // Class TG4PhysicsConstructorOptical
7 // ----------------------------------
8 // See the class description in the header file.
9 // According to ExN06PhysicsList (geant4 1.1)
10
11 #include "TG4PhysicsConstructorOptical.h"
12 #include "TG4ProcessControlMap.h"
13 #include "TG4ProcessMCMap.h"
14
15 #include <G4ParticleDefinition.hh>
16 #include <G4ProcessManager.hh>
17 #include <G4Cerenkov.hh>
18 #include <G4OpAbsorption.hh>
19 #include <G4OpRayleigh.hh>
20 #include <G4OpBoundaryProcess.hh>
21
22 //_____________________________________________________________________________
23 TG4PhysicsConstructorOptical::TG4PhysicsConstructorOptical(const G4String& name)
24   : TG4VPhysicsConstructor(name) {
25 //
26 }
27
28 //_____________________________________________________________________________
29 TG4PhysicsConstructorOptical::TG4PhysicsConstructorOptical(G4int verboseLevel,
30                                                            const G4String& name)
31   : TG4VPhysicsConstructor(name, verboseLevel) {
32 //
33 }
34
35 //_____________________________________________________________________________
36 TG4PhysicsConstructorOptical::~TG4PhysicsConstructorOptical() {
37 //
38 }
39
40 // protected methods
41
42 //_____________________________________________________________________________
43 void TG4PhysicsConstructorOptical::ConstructParticle()
44 {
45 // Instantiates particles.
46 // ---
47
48   // optical photon
49   G4OpticalPhoton::OpticalPhotonDefinition();
50 }
51
52 //_____________________________________________________________________________
53 void TG4PhysicsConstructorOptical::ConstructProcess()
54 {
55 // Constructs optical processes.
56 // According to ExN06PhysicsList.cc.
57 // (geant4 1.1)
58 // ---
59
60   G4Cerenkov*     theCerenkovProcess = new G4Cerenkov("Cerenkov");
61   G4OpAbsorption* theAbsorptionProcess = new G4OpAbsorption();
62   G4OpRayleigh*   theRayleighScatteringProcess = new G4OpRayleigh();
63   G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
64
65   theCerenkovProcess->DumpPhysicsTable();
66   //theAbsorptionProcess->DumpPhysicsTable();
67   //theRayleighScatteringProcess->DumpPhysicsTable();
68
69   // add verbose 
70   theCerenkovProcess->SetVerboseLevel(0);
71   theAbsorptionProcess->SetVerboseLevel(0);
72   theRayleighScatteringProcess->SetVerboseLevel(0);
73   theBoundaryProcess->SetVerboseLevel(0);
74
75   G4int maxNumPhotons = 300;
76
77   theCerenkovProcess->SetTrackSecondariesFirst(true);
78   theCerenkovProcess->SetMaxNumPhotonsPerStep(maxNumPhotons);
79
80   //G4OpticalSurfaceModel themodel = unified;   
81   // model from GEANT3
82   G4OpticalSurfaceModel themodel = glisur;
83   theBoundaryProcess->SetModel(themodel);
84
85   theParticleIterator->reset();
86   while( (*theParticleIterator)() ){
87     G4ParticleDefinition* particle = theParticleIterator->value();
88     G4ProcessManager* processManager = particle->GetProcessManager();
89     G4String particleName = particle->GetParticleName();
90     if (theCerenkovProcess->IsApplicable(*particle)) {
91       processManager->AddContinuousProcess(theCerenkovProcess);
92     }
93     if (particleName == "opticalphoton") {
94       G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl;
95       processManager->AddDiscreteProcess(theAbsorptionProcess);
96       processManager->AddDiscreteProcess(theRayleighScatteringProcess);
97       processManager->AddDiscreteProcess(theBoundaryProcess);
98     }
99   }
100
101   // map to G3 controls
102   TG4ProcessControlMap* controlMap = TG4ProcessControlMap::Instance();
103   controlMap->Add(theCerenkovProcess, kCKOV); 
104   controlMap->Add(theAbsorptionProcess, kLABS); 
105   controlMap->Add(theRayleighScatteringProcess, kRAYL); 
106   controlMap->Add(theBoundaryProcess, kLABS); 
107
108   // map to AliMCProcess codes
109   TG4ProcessMCMap* mcMap = TG4ProcessMCMap::Instance();
110   mcMap->Add(theCerenkovProcess, kPCerenkov); 
111   mcMap->Add(theAbsorptionProcess, kPLightAbsorption); 
112   mcMap->Add(theRayleighScatteringProcess, kPRayleigh); 
113   mcMap->Add(theBoundaryProcess, kPLightScattering); 
114
115   if (VerboseLevel() > 0) {
116     G4cout << "### " << namePhysics << " physics constructed." << G4endl;
117   }  
118 }
119