Belle II Software development
G4MonopoleFieldSetup.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// modified from GEANT4 exoticphysics/monopole/*
10
11#include <simulation/monopoles/G4MonopoleFieldSetup.h>
12#include <simulation/monopoles/G4MonopoleEquation.h>
13
14#include <G4MagneticField.hh>
15#include <G4FieldManager.hh>
16#include <G4TransportationManager.hh>
17#include <G4MagIntegratorStepper.hh>
18#include <G4ChordFinder.hh>
19
20#include <G4ClassicalRK4.hh>
21
22#include <CLHEP/Units/SystemOfUnits.h>
23
24using namespace std;
25using namespace Belle2;
26using namespace Belle2::Monopoles;
27using namespace CLHEP;
28
30
32{
33 //Take existing setup from basf2
34 fFieldManager = G4TransportationManager::GetTransportationManager()->GetFieldManager();
35 fbasf2ChordFinder = fFieldManager->GetChordFinder();
36 fMagneticField = (G4MagneticField*)fFieldManager->GetDetectorField();
38 fMinStep = 0.01 * mm ; // minimal step of 1 mm is default
39 fMonopoleStepper = new G4ClassicalRK4(fMonopoleEquation, 8); // for time information..
41}
42
44{
45 if (0 == fMonopoleFieldSetup) {
46 static G4MonopoleFieldSetup theInstance;
47 fMonopoleFieldSetup = &theInstance;
48 }
49
51}
52
54{
58}
59
61{
62 switch (val) {
63 case 0:
64 fFieldManager->SetChordFinder(fbasf2ChordFinder);
65 break;
66 case 1:
67 fFieldManager->SetChordFinder(fMonopoleChordFinder);
68 break;
69 }
70}
Monopole equation of motion class.
Monopole field setup singleton class, that takes care of switching between conventional particle tran...
void SwitchChordFinder(G4int val)
Switches chord finder between 1 - basf2 FullSim chord finder 2 - monopole chord finder Since monopole...
G4FieldManager * fFieldManager
Field manager that holds current chord finder.
G4ChordFinder * fMonopoleChordFinder
Chord finder for monopoles.
G4MagneticField * fMagneticField
Magnetic field of basf2.
static G4MonopoleFieldSetup * fMonopoleFieldSetup
The instance of this class.
G4MagIntegratorStepper * fMonopoleStepper
Stepper for monopoles.
G4MonopoleEquation * fMonopoleEquation
Monopole equation of motion.
G4ChordFinder * fbasf2ChordFinder
Chord finder taken from FullSim of basf2.
static G4MonopoleFieldSetup * GetMonopoleFieldSetup()
Returns G4MonopoleFieldSetup instance.
Abstract base class for different kinds of events.
STL namespace.