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