Belle II Software  release-05-01-25
PhysicsList.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010-2011 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Luka Santelj, Andreas Moll *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <simulation/kernel/PhysicsList.h>
12 #include <framework/logging/Logger.h>
13 #include <framework/gearbox/Unit.h>
14 
15 #include <CLHEP/Units/SystemOfUnits.h>
16 
17 #include <G4UnitsTable.hh>
18 #include <G4OpticalPhysics.hh>
19 #include <G4PhysListFactory.hh>
20 // LEP: includes for geant4e track extrapolation
21 #include <simulation/kernel/ExtPhysicsConstructor.h>
22 #include <G4ParticleTable.hh>
23 #include <G4ParticleDefinition.hh>
24 
25 using namespace std;
26 using namespace Belle2;
27 using namespace Simulation;
28 
29 
30 PhysicsList::PhysicsList(const string& physicsListName) : G4VModularPhysicsList()
31 {
32  defaultCutValue = 0.7 * CLHEP::mm; //Default production cut value. Unit given in Geant4 units.
33 
34  //First register the physics form Geant4 predefined PhysicsList.
35  G4PhysListFactory physListFactory;
36  G4VModularPhysicsList* physList = NULL;
37 
38  if (physListFactory.IsReferencePhysList(physicsListName)) physList = physListFactory.GetReferencePhysList(physicsListName);
39  if (physList == NULL) B2FATAL("Could not load the physics list " << physicsListName);
40 
41  int iPhysList = 1;
42  G4VPhysicsConstructor* regPhys = const_cast<G4VPhysicsConstructor*>(physList->GetPhysics(0));
43  while (regPhys != NULL) {
44  B2DEBUG(10, "RegisterPhysics: " << regPhys->GetPhysicsName());
45  RegisterPhysics(regPhys);
46  regPhys = const_cast<G4VPhysicsConstructor*>(physList->GetPhysics(iPhysList++));
47  }
48  // LEP: Append the geant4e-specific physics constructor to the list
49  RegisterPhysics(new ExtPhysicsConstructor);
50 }
51 
52 
54 {
55 
56 }
57 
58 
60 {
61  B2INFO("B4PhysicsList::SetCuts, CutLength: " << G4BestUnit(defaultCutValue, "Length"));
62 
63  // Set cuts to the defaultCutValue.
64  SetCutsWithDefault();
65  // LEP: For geant4e-specific particles, set a big step so that AlongStep computes
66  // all the energy (as is done in G4ErrorPhysicsList)
67  G4ParticleTable* myParticleTable = G4ParticleTable::GetParticleTable();
68  // theParticleIterator is a Geant4 macro since version 10.
69  G4ParticleTable::G4PTblDicIterator* myParticleIterator = myParticleTable->GetIterator();
70  myParticleIterator->reset();
71  while ((*myParticleIterator)()) {
72  G4ParticleDefinition* particle = myParticleIterator->value();
73  if (particle->GetParticleName().substr(0, 4) == "g4e_") {
74  SetParticleCuts(1.0E+9 * CLHEP::cm, particle);
75  }
76  }
77 
78  if (LogSystem::Instance().getCurrentLogLevel() == LogConfig::c_Debug) DumpCutValuesTable();
79 }
80 
81 
82 void PhysicsList::setProductionCutValue(double productionCut)
83 {
84  defaultCutValue = (productionCut / Unit::mm) * CLHEP::mm;
85 }
86 
87 
89 {
90  RegisterPhysics(new G4OpticalPhysics());
91 }
92 
Belle2::Simulation::ExtPhysicsConstructor
Define geant4e-specific physics.
Definition: ExtPhysicsConstructor.h:41
Belle2::Simulation::PhysicsList::SetCuts
void SetCuts()
Sets the Cuts on the physics list.
Definition: PhysicsList.cc:59
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::LogSystem::Instance
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition: LogSystem.cc:33
Belle2::Unit::mm
static const double mm
[millimeters]
Definition: Unit.h:80
Belle2::Simulation::PhysicsList::~PhysicsList
virtual ~PhysicsList()
The PhysicsList destructor.
Definition: PhysicsList.cc:53
Belle2::LogConfig::c_Debug
@ c_Debug
Debug: for code development.
Definition: LogConfig.h:36
Belle2::Simulation::PhysicsList::setProductionCutValue
void setProductionCutValue(double productionCut)
Sets the production cut value.
Definition: PhysicsList.cc:82
Belle2::Simulation::PhysicsList::registerOpticalPhysicsList
void registerOpticalPhysicsList()
Registers the optical physics list.
Definition: PhysicsList.cc:88