source: trunk/examples/advanced/Rich/src/RichTbPhysicsList.cc @ 1288

Last change on this file since 1288 was 807, checked in by garnier, 16 years ago

update

File size: 9.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// Rich advanced example for Geant4
27// RichTbPhysicsList.cc for Rich of LHCb
28// History:
29// Created: Sajan Easo (Sajan.Easo@cern.ch)
30// Revision and changes: Patricia Mendez (Patricia.Mendez@cern.ch)
31/////////////////////////////////////////////////////////////////////////////
32#include "G4ios.hh"
33#include <iomanip>
34
35#include "globals.hh"
36#include "RichTbPhysicsList.hh"
37
38#include "G4ParticleDefinition.hh"
39#include "G4ParticleTypes.hh"
40#include "G4ParticleWithCuts.hh"
41#include "G4ParticleTable.hh"
42#include "G4VUserPhysicsList.hh"
43#include "G4ParticleTable.hh"
44#include "G4UserPhysicsListMessenger.hh"
45#include "G4UImanager.hh"
46#include "G4Material.hh"
47#include "G4MaterialTable.hh"
48
49#include "G4ProcessManager.hh"
50#include "G4ProcessVector.hh"
51#include "G4UnitsTable.hh"
52
53
54RichTbPhysicsList::RichTbPhysicsList(RichTbRunConfig* RConfig) 
55  : G4VUserPhysicsList() {
56
57  G4cout<<" Now define the physics List"<<G4endl;
58  rConfigPh = RConfig;
59
60
61    defaultCutValue = 0.1*mm;
62
63  // pointer to the particle table
64  theParticleTable = G4ParticleTable::GetParticleTable();
65  theParticleIterator = theParticleTable->GetIterator();
66
67}
68RichTbPhysicsList::RichTbPhysicsList() :G4VUserPhysicsList(){
69  // pointer to the particle table
70  theParticleTable = G4ParticleTable::GetParticleTable();
71  theParticleIterator = theParticleTable->GetIterator();
72
73
74}
75
76RichTbPhysicsList::~RichTbPhysicsList() {}
77
78void RichTbPhysicsList::ConstructParticle()
79{
80  // In this method, static member functions should be called
81  // for all particles which you want to use.
82  // This ensures that objects of these particle types will be
83  // created in the program.
84
85  ConstructBosons();
86  ConstructLeptons();
87  ConstructMesons();
88  ConstructBaryons();
89
90}
91
92void RichTbPhysicsList::ConstructBosons()
93{
94  // pseudo-particles
95  G4Geantino::GeantinoDefinition();
96  G4ChargedGeantino::ChargedGeantinoDefinition();
97
98  // gamma
99  G4Gamma::GammaDefinition();
100
101  // optical photon
102  G4OpticalPhoton::OpticalPhotonDefinition();
103}
104
105void RichTbPhysicsList::ConstructLeptons()
106{
107  // leptons
108  G4Electron::ElectronDefinition();
109  G4Positron::PositronDefinition();
110  G4NeutrinoE::NeutrinoEDefinition();
111  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
112  G4MuonPlus::MuonPlusDefinition();
113  G4MuonMinus::MuonMinusDefinition();
114  G4NeutrinoMu::NeutrinoMuDefinition();
115  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
116}
117
118void RichTbPhysicsList::ConstructMesons()
119{
120 //  mesons
121  G4PionPlus::PionPlusDefinition();
122  G4PionMinus::PionMinusDefinition();
123  G4PionZero::PionZeroDefinition();
124}
125
126void RichTbPhysicsList::ConstructBaryons()
127{
128//  barions
129  G4Proton::ProtonDefinition();
130  G4AntiProton::AntiProtonDefinition();
131  G4Neutron::NeutronDefinition();
132  G4AntiNeutron::AntiNeutronDefinition();
133}
134
135void RichTbPhysicsList::ConstructProcess()
136{
137  AddTransportation();
138  ConstructGeneral();
139  ConstructEM();
140  ConstructOp();
141}
142
143#include "G4Decay.hh"
144
145void RichTbPhysicsList::ConstructGeneral()
146{
147  G4Decay* theDecayProcess = new G4Decay();
148  theParticleIterator->reset();
149
150  while( (*theParticleIterator)() ){
151    G4ParticleDefinition* particle = theParticleIterator->value();
152    G4ProcessManager* pmanager = particle->GetProcessManager();
153    if (theDecayProcess->IsApplicable(*particle)) {
154      pmanager->AddDiscreteProcess(theDecayProcess);
155    }
156  }
157}
158
159#include "G4ComptonScattering.hh"
160#include "G4GammaConversion.hh"
161#include "G4PhotoElectricEffect.hh"
162
163#include "G4MultipleScattering.hh"
164
165#include "G4eIonisation.hh"
166#include "G4eBremsstrahlung.hh"
167#include "G4eplusAnnihilation.hh"
168
169#include "G4MuIonisation.hh"
170#include "G4MuBremsstrahlung.hh"
171#include "G4MuPairProduction.hh"
172
173#include "G4hIonisation.hh"
174#include "HpdSiEnergyLoss.hh"
175void RichTbPhysicsList::ConstructEM()
176{
177  theParticleIterator->reset();
178  G4cout<<" Now creating EM processes"<<G4endl;
179  while( (*theParticleIterator)() ){
180    G4ParticleDefinition* particle = theParticleIterator->value();
181    G4ProcessManager* pmanager = particle->GetProcessManager();
182    G4String particleName = particle->GetParticleName();
183    HpdSiEnergyLoss* HpdSiEnergyLossProcess = 
184
185      new HpdSiEnergyLoss("Silicon","HpdSiEnergyLoss");
186    pmanager->AddProcess( HpdSiEnergyLossProcess ,-1,2,2);
187
188
189    if (particleName == "gamma") {
190    // gamma
191      // Construct processes for gamma
192      pmanager->AddDiscreteProcess(new G4GammaConversion());
193      pmanager->AddDiscreteProcess(new G4ComptonScattering());
194      pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
195
196    } else if (particleName == "e-") {
197    //electron
198      //Construct processes for electron
199      pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
200      pmanager->AddProcess(new G4eIonisation(),-1,2,2);
201      pmanager->AddProcess(new G4eBremsstrahlung(),-1,-1,3);
202
203    } else if (particleName == "e+") {
204    //positron
205      // Construct processes for positron
206      pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
207      pmanager->AddProcess(new G4eIonisation(),-1,2,2);
208       pmanager->AddProcess(new G4eBremsstrahlung(),-1,-1,3);
209       pmanager->AddProcess(new G4eplusAnnihilation(),0,-1,4);
210
211    } else if( particleName == "mu+" ||
212               particleName == "mu-"    ) {
213    //muon
214     // Construct processes for muon
215      pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
216      pmanager->AddProcess(new G4MuIonisation(),-1,2,2);
217      pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
218      pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
219
220    } else {
221      if ((particle->GetPDGCharge() != 0.0) &&
222          (particle->GetParticleName() != "chargedgeantino")) {
223     // all others charged particles except geantino
224        pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
225        pmanager->AddProcess(new G4hIonisation(),-1,2,2);
226     }
227    }
228  }
229}
230
231#include "G4Cerenkov.hh"
232#include "G4OpAbsorption.hh"
233#include "G4OpRayleigh.hh"
234#include "G4OpBoundaryProcess.hh"
235#include "PadHpdPhotoElectricEffect.hh"
236#include "RichTbMaterialParameters.hh"
237
238void RichTbPhysicsList::ConstructOp()
239{
240  G4cout<<"Now creating Optical processes"<<G4endl;
241  G4Cerenkov*   theCerenkovProcess = new G4Cerenkov("Cerenkov");
242  G4OpAbsorption* theAbsorptionProcess = new G4OpAbsorption();
243  G4cout<<"Now creating the Rayleigh scattering process "<<G4endl;
244  G4OpRayleigh*   theRayleighScatteringProcess = new G4OpRayleigh();
245  G4cout<<"Now creating the boundary process "<<G4endl;
246  G4OpBoundaryProcess* theBoundaryProcess = new G4OpBoundaryProcess();
247
248  PadHpdPhotoElectricEffect* theHpdPhotoElectricProcess= 
249    new PadHpdPhotoElectricEffect("PadHpdPhot",rConfigPh);
250
251  theCerenkovProcess->SetVerboseLevel(0);
252  theAbsorptionProcess->SetVerboseLevel(0);
253  theRayleighScatteringProcess->SetVerboseLevel(0);
254  theBoundaryProcess->SetVerboseLevel(0);
255
256   G4int MaxNumPhotons = 300;
257
258  theCerenkovProcess->SetTrackSecondariesFirst(true);
259  theCerenkovProcess->SetMaxNumPhotonsPerStep(MaxNumPhotons);
260
261  G4OpticalSurfaceModel themodel = unified;
262  theBoundaryProcess->SetModel(themodel);
263
264  theParticleIterator->reset();
265  while( (*theParticleIterator)() ){
266    G4ParticleDefinition* particle = theParticleIterator->value();
267    G4ProcessManager* pmanager = particle->GetProcessManager();
268    G4String particleName = particle->GetParticleName();
269    if (theCerenkovProcess->IsApplicable(*particle)) {
270      pmanager->AddProcess(theCerenkovProcess);
271      pmanager->SetProcessOrdering(theCerenkovProcess,idxPostStep);
272    }
273    if (particleName == "opticalphoton") {
274      G4cout << " AddDiscreteProcess to OpticalPhoton " << G4endl;
275      pmanager->AddDiscreteProcess(theAbsorptionProcess);
276      pmanager->AddDiscreteProcess(theRayleighScatteringProcess);
277      pmanager->AddDiscreteProcess(theBoundaryProcess);
278      pmanager->AddDiscreteProcess(theHpdPhotoElectricProcess);
279    }
280  }
281}
282
283void RichTbPhysicsList::SetCuts()
284{
285  if (verboseLevel >1){
286    G4cout << "RichTbPhysicsList::SetCuts:";
287  } 
288  //  " G4VUserPhysicsList::SetCutsWithDefault" method sets
289  //   the default cut value for all particle types
290   SetCutsWithDefault();   
291}
292
293
294
295
296
297
Note: See TracBrowser for help on using the repository browser.