source: JEM-EUSO/esaf_lal/tags/v1_r0/esaf/packages/simulation/detector/G4Detector/optics/src/OptPhysicsList.cc @ 117

Last change on this file since 117 was 117, checked in by moretto, 11 years ago

ESAF version compilable on mac OS

File size: 10.0 KB
Line 
1#include <G4ios.hh>
2#include <iomanip>
3
4#include <globals.hh>
5#include "OptPhysicsList.hh"
6//#include "OptPhysicsListMessenger.hh"
7
8#include <G4ParticleDefinition.hh>
9#include <G4ParticleTypes.hh>
10#include <G4ParticleTable.hh>
11
12#include <G4Material.hh>
13#include <G4MaterialTable.hh>
14
15#include <G4ProcessManager.hh>
16#include <G4ProcessVector.hh>
17
18#include <G4Cerenkov.hh>
19#include <G4Scintillation.hh>
20#include <G4OpAbsorption.hh>
21#include <G4OpRayleigh.hh>
22#include <G4OpBoundaryProcess.hh>
23#include "OpEUSODiffraction.hh"
24
25//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
26
27OptPhysicsList::OptPhysicsList() :  G4VUserPhysicsList()
28{
29  SetSender("OptPhysicsList");
30
31  theCerenkovProcess           = 0;
32  theScintillationProcess      = 0;
33  theAbsorptionProcess         = 0;
34  theRayleighScatteringProcess = 0;
35  theBoundaryProcess           = 0;
36
37  //pMessenger = new OptPhysicsListMessenger(this);
38  SetVerboseLevel(0);
39}
40
41//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42
43OptPhysicsList::~OptPhysicsList() { //delete pMessenger;
44}
45
46//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47
48void OptPhysicsList::ConstructParticle()
49{
50  // In this method, static member functions should be called
51  // for all particles which you want to use.
52  // This ensures that objects of these particle types will be
53  // created in the program.
54
55  ConstructBosons();
56  ConstructLeptons();
57  ConstructMesons();
58  //ConstructBaryons();
59}
60
61//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62
63void OptPhysicsList::ConstructBosons()
64{
65  // pseudo-particles
66  G4Geantino::GeantinoDefinition();
67  G4ChargedGeantino::ChargedGeantinoDefinition();
68
69  // gamma
70   G4Gamma::GammaDefinition();
71
72  // optical photon
73  G4OpticalPhoton::OpticalPhotonDefinition();
74}
75
76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77
78void OptPhysicsList::ConstructLeptons()
79{
80  // leptons
81  G4Electron::ElectronDefinition();
82  G4Positron::PositronDefinition();
83  G4NeutrinoE::NeutrinoEDefinition();
84  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
85  G4MuonPlus::MuonPlusDefinition();
86  G4MuonMinus::MuonMinusDefinition();
87  G4NeutrinoMu::NeutrinoMuDefinition();
88  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
89}
90
91//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
92
93void OptPhysicsList::ConstructMesons()
94{
95 //  mesons
96  G4PionPlus::PionPlusDefinition();
97  G4PionMinus::PionMinusDefinition();
98  G4PionZero::PionZeroDefinition();
99}
100
101//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
102
103void OptPhysicsList::ConstructBaryons()
104{
105//  barions
106  G4Proton::ProtonDefinition();
107  G4AntiProton::AntiProtonDefinition();
108  G4Neutron::NeutronDefinition();
109  G4AntiNeutron::AntiNeutronDefinition();
110}
111
112//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113
114void OptPhysicsList::ConstructProcess()
115{
116  AddTransportation();
117   ConstructGeneral();
118   ConstructEM();
119  ConstructOp();
120}
121
122//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
123
124#include <G4Decay.hh>
125
126//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
127
128void OptPhysicsList::ConstructGeneral()
129{
130  // Add Decay Process
131  G4Decay* theDecayProcess = new G4Decay();
132  theParticleIterator->reset();
133  while( (*theParticleIterator)() ){
134    G4ParticleDefinition* particle = theParticleIterator->value();
135    G4ProcessManager* pmanager = particle->GetProcessManager();
136    if (theDecayProcess->IsApplicable(*particle)) {
137        pmanager->AddDiscreteProcess(theDecayProcess);
138//      pmanager ->AddProcess(theDecayProcess);
139//       // set ordering for PostStepDoIt and AtRestDoIt
140//       pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
141//       pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
142    }
143  }
144}
145
146//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
147
148#include <G4ComptonScattering.hh>
149#include <G4GammaConversion.hh>
150#include <G4PhotoElectricEffect.hh>
151
152
153#include <G4eMultipleScattering.hh>
154#include <G4MuMultipleScattering.hh>
155#include <G4hMultipleScattering.hh>
156
157#include <G4eIonisation.hh>
158#include <G4eBremsstrahlung.hh>
159#include <G4eplusAnnihilation.hh>
160
161#include <G4MuIonisation.hh>
162#include <G4MuBremsstrahlung.hh>
163#include <G4MuPairProduction.hh>
164
165#include <G4hIonisation.hh>
166
167//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
168
169void OptPhysicsList::ConstructEM()
170{
171  theParticleIterator->reset();
172  while( (*theParticleIterator)() ){
173    G4ParticleDefinition* particle = theParticleIterator->value();
174    G4ProcessManager* pmanager = particle->GetProcessManager();
175    G4String particleName = particle->GetParticleName();
176
177    if (particleName == "gamma") {
178    // gamma
179      // Construct processes for gamma
180     pmanager->AddDiscreteProcess(new G4GammaConversion());
181     pmanager->AddDiscreteProcess(new G4ComptonScattering());
182     pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
183
184    } else if (particleName == "e-") {
185    //electron
186      // Construct processes for electron
187      pmanager->AddProcess(new G4eMultipleScattering(),-1, 1, 1);
188      pmanager->AddProcess(new G4eIonisation(),       -1, 2, 2);
189      pmanager->AddProcess(new G4eBremsstrahlung(),   -1, 3, 3);
190
191    } else if (particleName == "e+") {
192    //positron
193      // Construct processes for positron
194      pmanager->AddProcess(new G4eMultipleScattering(),-1, 1, 1);
195      pmanager->AddProcess(new G4eIonisation(),       -1, 2, 2);
196      pmanager->AddProcess(new G4eBremsstrahlung(),   -1, 3, 3);
197      pmanager->AddProcess(new G4eplusAnnihilation(),  0,-1, 4);
198
199    } else if( particleName == "mu+" ||
200               particleName == "mu-"    ) {
201    //muon
202     // Construct processes for muon
203     pmanager->AddProcess(new G4MuMultipleScattering(),-1, 1, 1);
204     pmanager->AddProcess(new G4MuIonisation(),      -1, 2, 2);
205     pmanager->AddProcess(new G4MuBremsstrahlung(),  -1, 3, 3);
206     pmanager->AddProcess(new G4MuPairProduction(),  -1, 4, 4);
207
208    } else {
209      if ((particle->GetPDGCharge() != 0.0) &&
210          (particle->GetParticleName() != "chargedgeantino")) {
211     // all others charged particles except geantino
212       pmanager->AddProcess(new G4hMultipleScattering(),-1,1,1);
213       pmanager->AddProcess(new G4hIonisation(),       -1,2,2);
214     }
215    }
216  }
217}
218
219//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
220
221#include "G4Cerenkov.hh"
222#include "G4Scintillation.hh"
223#include "G4OpAbsorption.hh"
224#include "G4OpRayleigh.hh"
225#include "G4OpBoundaryProcess.hh"
226void OptPhysicsList::ConstructOp()
227{
228  theCerenkovProcess           = new G4Cerenkov("Cerenkov");
229//  theScintillationProcess = new G4Scintillation("Scintillation");
230  theAbsorptionProcess     = new G4OpAbsorption();
231  theRayleighScatteringProcess = new G4OpRayleigh();
232  theBoundaryProcess  = new G4OpBoundaryProcess();
233  int use_diffraction = (int)Conf()->GetNum("OptPhysicsList.UseDiffraction");
234  if ( use_diffraction ) theEUSODiffractionProcess = new OpEUSODiffraction();
235  else Msg(EsafMsg::Warning) << "Diffraction is turned off." << MsgDispatch;
236    theCerenkovProcess           -> SetVerboseLevel(0);
237    theAbsorptionProcess         -> SetVerboseLevel(0);
238    theRayleighScatteringProcess -> SetVerboseLevel(0);
239    theBoundaryProcess           -> SetVerboseLevel(0);
240//  theCerenkovProcess->DumpPhysicsTable();
241//  theScintillationProcess->DumpPhysicsTable();
242//  theAbsorptionProcess->DumpPhysicsTable();
243//  theRayleighScatteringProcess->DumpPhysicsTable();
244
245 // theCerenkovProcess->SetMaxNumPhotonsPerStep(300);
246  theCerenkovProcess->SetTrackSecondariesFirst(true);
247/*
248  theScintillationProcess->SetScintillationYieldFactor(1.);
249  theScintillationProcess->SetTrackSecondariesFirst(true);*/
250
251//   G4EmSaturation* emSaturation = G4LossTableManager::Instance()->EmSaturation();
252//   theScintillationProcess->AddSaturation(emSaturation);
253
254  G4OpticalSurfaceModel themodel = unified;
255  theBoundaryProcess->SetModel(themodel);
256
257  theParticleIterator->reset();
258  while( (*theParticleIterator)() ){
259    G4ParticleDefinition* particle = theParticleIterator->value();
260    G4ProcessManager* pmanager = particle->GetProcessManager();
261    G4String particleName = particle->GetParticleName();
262    if (theCerenkovProcess->IsApplicable(*particle)) {
263        //pmanager->AddContinuousProcess(theCerenkovProcess);
264      pmanager->AddProcess(theCerenkovProcess);
265      pmanager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
266    }
267//     if (theScintillationProcess->IsApplicable(*particle)) {
268//       pmanager->AddProcess(theScintillationProcess);
269//       pmanager->SetProcessOrderingToLast(theScintillationProcess, idxAtRest);
270//       pmanager->SetProcessOrderingToLast(theScintillationProcess, idxPostStep);
271//     }
272    if (particleName == "opticalphoton") {
273      G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl;
274      pmanager->AddDiscreteProcess(theAbsorptionProcess);
275      pmanager->AddDiscreteProcess(theRayleighScatteringProcess);
276      pmanager->AddDiscreteProcess(theBoundaryProcess);
277      if ( use_diffraction ) pmanager->AddDiscreteProcess(theEUSODiffractionProcess);
278    }
279  }
280}
281
282//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
283
284void OptPhysicsList::SetVerbose(G4int verbose)
285{
286  theCerenkovProcess->SetVerboseLevel(verbose);
287  theScintillationProcess->SetVerboseLevel(verbose);
288  theAbsorptionProcess->SetVerboseLevel(verbose);
289  theRayleighScatteringProcess->SetVerboseLevel(verbose);
290  theBoundaryProcess->SetVerboseLevel(verbose);
291}
292
293//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
294
295void OptPhysicsList::SetNbOfPhotonsCerenkov(G4int MaxNumber)
296{
297  //theCerenkovProcess->SetMaxNumPhotonsPerStep(MaxNumber);
298}
299//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
300
301void OptPhysicsList::SetCuts()
302{
303  //  " G4VUserPhysicsList::SetCutsWithDefault" method sets
304  //   the default cut value for all particle types
305  //
306  SetCutsWithDefault();
307
308//  if (verboseLevel>0) DumpCutValuesTable();
309}
310
311//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.