]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4PhysicsConstructorOptical.cxx
Noninitialized pointers set to 0 (J. Belikov)
[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   : G4VPhysicsConstructor(name)
25 {
26 //
27   SetVerboseLevel(1);
28 }
29
30 //_____________________________________________________________________________
31 TG4PhysicsConstructorOptical::~TG4PhysicsConstructorOptical() {
32 //
33 }
34
35 // protected methods
36
37 //_____________________________________________________________________________
38 void TG4PhysicsConstructorOptical::ConstructParticle()
39 {
40 // Instantiates particles.
41 // ---
42
43   // optical photon
44   G4OpticalPhoton::OpticalPhotonDefinition();
45 }
46
47 //_____________________________________________________________________________
48 void TG4PhysicsConstructorOptical::ConstructProcess()
49 {
50 // Constructs optical processes.
51 // According to ExN06PhysicsList.cc.
52 // (geant4 1.1)
53 // ---
54
55   G4Cerenkov*     theCerenkovProcess = new G4Cerenkov("Cerenkov");
56   G4OpAbsorption* theAbsorptionProcess = new G4OpAbsorption();
57   G4OpRayleigh*   theRayleighScatteringProcess = new G4OpRayleigh();
58   G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
59
60   theCerenkovProcess->DumpPhysicsTable();
61   //theAbsorptionProcess->DumpPhysicsTable();
62   //theRayleighScatteringProcess->DumpPhysicsTable();
63
64   // add verbose 
65   theCerenkovProcess->SetVerboseLevel(0);
66   theAbsorptionProcess->SetVerboseLevel(0);
67   theRayleighScatteringProcess->SetVerboseLevel(0);
68   theBoundaryProcess->SetVerboseLevel(0);
69
70   G4int maxNumPhotons = 300;
71
72   theCerenkovProcess->SetTrackSecondariesFirst(true);
73   theCerenkovProcess->SetMaxNumPhotonsPerStep(maxNumPhotons);
74
75   //G4OpticalSurfaceModel themodel = unified;   
76   // model from GEANT3
77   G4OpticalSurfaceModel themodel = glisur;
78   theBoundaryProcess->SetModel(themodel);
79
80   theParticleIterator->reset();
81   while( (*theParticleIterator)() ){
82     G4ParticleDefinition* particle = theParticleIterator->value();
83     G4ProcessManager* processManager = particle->GetProcessManager();
84     G4String particleName = particle->GetParticleName();
85     if (theCerenkovProcess->IsApplicable(*particle)) {
86       processManager->AddContinuousProcess(theCerenkovProcess);
87     }
88     if (particleName == "opticalphoton") {
89       G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl;
90       processManager->AddDiscreteProcess(theAbsorptionProcess);
91       processManager->AddDiscreteProcess(theRayleighScatteringProcess);
92       processManager->AddDiscreteProcess(theBoundaryProcess);
93     }
94   }
95
96   // map to G3 controls
97   TG4ProcessControlMap* controlMap = TG4ProcessControlMap::Instance();
98   controlMap->Add(theCerenkovProcess, kCKOV); 
99   controlMap->Add(theAbsorptionProcess, kLABS); 
100   controlMap->Add(theRayleighScatteringProcess, kRAYL); 
101   controlMap->Add(theBoundaryProcess, kLABS); 
102
103   // map to AliMCProcess codes
104   TG4ProcessMCMap* mcMap = TG4ProcessMCMap::Instance();
105   mcMap->Add(theCerenkovProcess, kPCerenkov); 
106   mcMap->Add(theAbsorptionProcess, kPLightAbsorption); 
107   mcMap->Add(theRayleighScatteringProcess, kPRayleigh); 
108   mcMap->Add(theBoundaryProcess, kPLightScattering); 
109
110   if (verboseLevel>0)
111     G4cout << "### " << namePhysics << " physics constructed." << G4endl;
112 }
113