ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Extensions
Quirks
src
HyperbolaStepper.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "G4Track.hh"
6
#include "G4DynamicParticle.hh"
7
#include "G4Field.hh"
8
9
#include "
DummyEquation.h
"
10
#include "
HyperbolaStepper.h
"
11
12
HyperbolaStepper::HyperbolaStepper
(
13
InfracolorForce
&
string
,
14
const
G4Track& track,
15
const
G4Field* field
16
) :
17
// 9 "integration" variables:
18
// x, y, z, px, py, pz, KE, t_lab, steplength (in place of t_proper)
19
G4MagIntegratorStepper(new
DummyEquation
(),
m_NUM_VARS
),
20
m_string
(
string
),
21
// G4Field, not G4ElectroMagneticField: since Geant4 10.6 G4MagneticField
22
// derives directly from G4Field, so the old dynamic_cast rejected the
23
// ATLAS field. Only G4Field::GetFieldValue() is used.
24
m_field
(field),
25
m_mass
(track.GetDynamicParticle()->
GetMass
()),
26
m_charge
(track.GetDynamicParticle()->
GetCharge
()),
27
m_startMomentum
(track.GetDynamicParticle()->Get4Momentum()),
28
m_maxExpRapidity
(
string
.
GetMaxExpRapidity
()),
29
m_steps
(),
30
m_currStep
(this,
string
, track),
31
m_nPrevSteps
(0),
32
m_debug
(false)
33
{
34
// Precompute steps
35
m_currStep
.PrepareNextStep();
36
m_steps
.push_back(
m_currStep
);
37
m_currStep
.Step(
m_currStep
.GetMaxLength());
38
while
(
m_currStep
.GetStringPtr() !=
string
.GetStringVectors().end()) {
39
HyperbolaStep next = m_currStep;
40
next.PrepareNextStep();
41
if (next.IsBoostLimited()) break;
// don't allow 2nd+ step if it would be cut by boost limit
42
m_steps.push_back(next);
43
m_currStep = next;
44
m_currStep.Step(m_currStep.GetMaxLength());
45
}
46
m_nPrevSteps
=
m_steps
.size() - 1;
47
}
48
49
HyperbolaStepper::~HyperbolaStepper
() {
50
delete
GetEquationOfMotion();
51
}
52
53
void
HyperbolaStepper::SetCurrStep
(G4double
length
) {
54
if
(
m_currStep
.GetLength() ==
length
)
return
;
55
std::vector<HyperbolaStep>::size_type i = 0;
56
while
(i+1 <
m_steps
.size() &&
m_steps
[i+1].GetLength() <
length
) i++;
57
m_currStep
=
m_steps
[i];
58
m_currStep
.Step(
length
);
59
m_nPrevSteps
= i;
60
}
61
62
void
HyperbolaStepper::Stepper
(
63
const
G4double
y
[],
64
const
G4double[],
//dydx
65
G4double
h
,
66
G4double yout[],
67
G4double yerr[]
68
) {
69
G4int maxvar = GetNumberOfStateVariables();
70
for
(G4int i = 0; i < maxvar; i++) yout[i] =
y
[i];
71
72
if
(
m_debug
) G4cout <<
"HyperbolaStepper: asked to move "
<<
h
<< G4endl;
73
if
(
m_debug
) G4cout <<
"HyperbolaStepper: start = "
<<
y
[0] <<
", "
<<
y
[1] <<
", "
<<
y
[2] <<
" ["
<<
y
[8] <<
"]"
<< G4endl;
74
75
SetCurrStep
(
y
[8] +
h
);
76
m_currStep
.Dump(yout);
77
78
if
(
m_debug
) G4cout <<
"HyperbolaStepper: end = "
<< yout[0] <<
", "
<< yout[1] <<
", "
<< yout[2] <<
" ["
<< yout[8] <<
"]"
<< G4endl;
79
80
// TODO: Errors
81
for
(G4int i = 0; i <
m_NUM_VARS
; i++) yerr[i] = 0;
82
}
83
84
G4double
HyperbolaStepper::DistChord
()
const
{
85
// TODO
86
return
0;
87
}
88
89
void
HyperbolaStepper::Update
(G4FieldTrack& fieldTrack, G4bool forceStep) {
90
if
(forceStep) {
91
// Propagator refused to take step through detector geometry because length too short;
92
// take step ourselves and update string state and quirk 4-momentum only (don't change position)
93
m_currStep
=
m_steps
.back();
94
m_currStep
.Step(
m_currStep
.GetMaxLength());
95
m_nPrevSteps
=
m_steps
.size() - 1;
96
G4LorentzVector p =
m_currStep
.GetMomentum();
97
fieldTrack.UpdateFourMomentum(p.t() -
m_mass
, p.vect().unit());
98
}
else
{
99
SetCurrStep
(fieldTrack.GetProperTimeOfFlight());
100
}
101
102
// Update string vectors
103
m_string
.PopTo(
m_currStep
.GetStringPtr(),
m_currStep
.GetFracLeft());
104
for
(std::vector<HyperbolaStep>::size_type i = 0; i <
m_nPrevSteps
; i++) {
105
if
(
m_debug
) G4cout <<
"HyperbolaStepper: pushing vector "
<<
m_steps
[i].GetStringOut().lv() << G4endl;
106
m_string
.GetReactionForce()->PushStringVector(
m_steps
[i].GetStringOut());
107
}
108
if
(
m_debug
) G4cout <<
"HyperbolaStepper: pushing vector "
<<
m_currStep
.GetStringOut().lv() << G4endl;
109
m_string
.GetReactionForce()->PushStringVector(
m_currStep
.GetStringOut());
110
}
DummyEquation.h
length
double length(const pvec &v)
Definition
FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
HyperbolaStepper.h
y
#define y
h
Header file for AthHistogramAlgorithm.
DummyEquation
Definition
DummyEquation.h:14
HyperbolaStepper::m_charge
const G4double m_charge
Definition
HyperbolaStepper.h:56
HyperbolaStepper::GetMass
G4double GetMass() const
Definition
HyperbolaStepper.h:71
HyperbolaStepper::HyperbolaStepper
HyperbolaStepper(InfracolorForce &string, const G4Track &track, const G4Field *field=0)
Definition
HyperbolaStepper.cxx:12
HyperbolaStepper::DistChord
virtual G4double DistChord() const
Definition
HyperbolaStepper.cxx:84
HyperbolaStepper::SetCurrStep
void SetCurrStep(G4double length)
Definition
HyperbolaStepper.cxx:53
HyperbolaStepper::GetCharge
G4double GetCharge() const
Definition
HyperbolaStepper.h:72
HyperbolaStepper::m_string
InfracolorForce & m_string
Definition
HyperbolaStepper.h:53
HyperbolaStepper::m_maxExpRapidity
const G4double m_maxExpRapidity
Definition
HyperbolaStepper.h:58
HyperbolaStepper::Stepper
virtual void Stepper(const G4double y[], const G4double[], G4double h, G4double yout[], G4double yerr[])
Definition
HyperbolaStepper.cxx:62
HyperbolaStepper::m_mass
const G4double m_mass
Definition
HyperbolaStepper.h:55
HyperbolaStepper::GetMaxExpRapidity
G4double GetMaxExpRapidity() const
Definition
HyperbolaStepper.h:74
HyperbolaStepper::m_NUM_VARS
static const G4int m_NUM_VARS
Definition
HyperbolaStepper.h:51
HyperbolaStepper::~HyperbolaStepper
virtual ~HyperbolaStepper()
Definition
HyperbolaStepper.cxx:49
HyperbolaStepper::m_debug
G4bool m_debug
Definition
HyperbolaStepper.h:64
HyperbolaStepper::m_field
const G4Field *const m_field
Definition
HyperbolaStepper.h:54
HyperbolaStepper::Update
void Update(G4FieldTrack &fieldTrack, G4bool forceStep)
Definition
HyperbolaStepper.cxx:89
HyperbolaStepper::m_nPrevSteps
std::vector< HyperbolaStep >::size_type m_nPrevSteps
Definition
HyperbolaStepper.h:62
HyperbolaStepper::m_steps
std::vector< HyperbolaStep > m_steps
Definition
HyperbolaStepper.h:60
HyperbolaStepper::m_currStep
HyperbolaStep m_currStep
Definition
HyperbolaStepper.h:61
HyperbolaStepper::m_startMomentum
const G4LorentzVector m_startMomentum
Definition
HyperbolaStepper.h:57
InfracolorForce
Definition
InfracolorForce.h:14
string
STL class.
while
while((inf=(TStreamerInfo *) nextinfo()) !=0)
Definition
liststreamerinfos.cxx:13
Generated on
for ATLAS Offline Software by
1.17.0