ATLAS Offline Software
Loading...
Searching...
No Matches
HyperbolaStep Class Reference

#include <HyperbolaStep.h>

Collaboration diagram for HyperbolaStep:

Public Member Functions

 HyperbolaStep (const HyperbolaStepper *stepper, InfracolorForce &string, const G4Track &track)
 ~HyperbolaStep ()
void PrepareNextStep ()
void Step (G4double length)
void Dump (G4double y[])
HyperbolaStepGetPrev () const
std::deque< StringVector >::const_iterator GetStringPtr () const
G4double GetFracLeft () const
G4bool IsBoostLimited () const
G4double GetMaxLength () const
G4double GetLength () const
const StringVectorGetStringOut () const
const G4LorentzVector & GetMomentum () const

Private Attributes

const HyperbolaStepperm_stepper
std::deque< StringVector >::const_iterator m_stringPtr
std::deque< StringVector >::const_iterator m_stringEnd
G4double m_fracLeft
G4ThreeVector m_position
G4double m_time
G4LorentzVector m_momentum
StringVector m_stringIn
G4double m_maxFracTaken
StringVector m_stringOut
G4double m_maxLength
G4double m_length

Detailed Description

Definition at line 17 of file HyperbolaStep.h.

Constructor & Destructor Documentation

◆ HyperbolaStep()

HyperbolaStep::HyperbolaStep ( const HyperbolaStepper * stepper,
InfracolorForce & string,
const G4Track & track )

Definition at line 14 of file HyperbolaStep.cxx.

14 :
15 m_stepper(stepper),
16 m_stringPtr(string.GetStringVectors().begin()),
17 m_stringEnd(string.GetStringVectors().end()),
18 m_fracLeft(1.0),
19 m_position(track.GetPosition()),
20 m_time(track.GetGlobalTime()),
21 m_momentum(track.GetDynamicParticle()->Get4Momentum()),
22 m_stringIn(0,0,0,0),
23 m_maxFracTaken(1.0),
24 m_stringOut(0,0,0,0),
25 m_maxLength(0.0),
26 m_length(0.0)
27{}
G4LorentzVector m_momentum
StringVector m_stringOut
std::deque< StringVector >::const_iterator m_stringEnd
G4double m_maxLength
G4ThreeVector m_position
std::deque< StringVector >::const_iterator m_stringPtr
G4double m_maxFracTaken
G4double m_time
G4double m_length
StringVector m_stringIn
const HyperbolaStepper * m_stepper
G4double m_fracLeft

◆ ~HyperbolaStep()

HyperbolaStep::~HyperbolaStep ( )

Definition at line 29 of file HyperbolaStep.cxx.

29{}

Member Function Documentation

◆ Dump()

void HyperbolaStep::Dump ( G4double y[])

Definition at line 121 of file HyperbolaStep.cxx.

121 {
122 y[0] = m_position.x();
123 y[1] = m_position.y();
124 y[2] = m_position.z();
125 y[3] = m_momentum.x();
126 y[4] = m_momentum.y();
127 y[5] = m_momentum.z();
128 y[6] = m_momentum.t() - m_stepper->GetMass();
129 y[7] = m_time;
130 y[8] = m_length;
131}
#define y

◆ GetFracLeft()

G4double HyperbolaStep::GetFracLeft ( ) const
inline

Definition at line 53 of file HyperbolaStep.h.

53{return m_fracLeft;}

◆ GetLength()

G4double HyperbolaStep::GetLength ( ) const
inline

Definition at line 56 of file HyperbolaStep.h.

56{return m_length;}

◆ GetMaxLength()

G4double HyperbolaStep::GetMaxLength ( ) const
inline

Definition at line 55 of file HyperbolaStep.h.

55{return m_maxLength;}

◆ GetMomentum()

const G4LorentzVector & HyperbolaStep::GetMomentum ( ) const
inline

Definition at line 58 of file HyperbolaStep.h.

58{return m_momentum;}

◆ GetPrev()

HyperbolaStep * HyperbolaStep::GetPrev ( ) const

◆ GetStringOut()

const StringVector & HyperbolaStep::GetStringOut ( ) const
inline

Definition at line 57 of file HyperbolaStep.h.

57{return m_stringOut;}

◆ GetStringPtr()

std::deque< StringVector >::const_iterator HyperbolaStep::GetStringPtr ( ) const
inline

Definition at line 52 of file HyperbolaStep.h.

52{return m_stringPtr;}

◆ IsBoostLimited()

G4bool HyperbolaStep::IsBoostLimited ( ) const
inline

Definition at line 54 of file HyperbolaStep.h.

54{return m_maxFracTaken != 1.0;}

◆ PrepareNextStep()

void HyperbolaStep::PrepareNextStep ( )

Definition at line 31 of file HyperbolaStep.cxx.

31 {
32 if (m_stringPtr == m_stringEnd) {
33 // End of string vectors
34 m_stringIn.set(0,0,0,0);
35 m_stringOut.set(0,0,0,0);
37 } else {
38 G4double force = m_stepper->GetForce();
39 G4double mass = m_stepper->GetMass();
40
41 // Get incoming string vector
42 m_stringIn = (*m_stringPtr) * m_fracLeft;
43 m_maxFracTaken = 1.0;
44
45 // Find maximum remaining boost allowed for this step
46 G4double gamma0 = std::max(m_momentum * m_stepper->GetStartMomentum() / sqr(mass), 1.0);
47 G4double expRapidity0 = gamma0 + std::sqrt(sqr(gamma0) - 1);
48 G4double maxExpRapidity = std::max(m_stepper->GetMaxExpRapidity() / expRapidity0, 1.0);
49
50 // Reduce string vector if boost too large
51 G4double tmp = 2 * force * m_stringIn.lv() * m_momentum / sqr(mass);
52 if (tmp > maxExpRapidity - 1) {
53 m_maxFracTaken = (maxExpRapidity - 1) / tmp;
55 }
56
57 // Reflect string vector and compute maximum step length
58 m_stringOut = m_stringIn.reflect(m_momentum + force * m_stringIn.lv());
59 m_maxLength = m_length + (m_stringIn.lv() + m_stringOut.lv()).rho();
60 }
61}
#define sqr(t)
bool force
Definition calibdata.py:18

◆ Step()

void HyperbolaStep::Step ( G4double length)

Definition at line 63 of file HyperbolaStep.cxx.

63 {
64 //G4cout << "steplength/maxlength: " << length << " / " << m_maxLength << G4endl;
65 G4double force = m_stepper->GetForce();
66 G4double mass = m_stepper->GetMass();
67
68 // Cut step to proper length
69 G4double fracTaken = m_maxFracTaken;
70 if (length < m_maxLength) {
71 if (length > m_length) {
72 // Calculate fraction of string vector to next-to-leading order in step length
73 G4double currMaxLength = m_maxLength - m_length;
74 for (G4int i = 0; i < 2 && currMaxLength > 0; i++) {
75 G4double r = (length - m_length) / currMaxLength;
76 m_stringIn *= r;
77 m_stringOut = m_stringIn.reflect(m_momentum + force * m_stringIn.lv());
78 fracTaken *= r;
79 currMaxLength = (m_stringIn.lv() + m_stringOut.lv()).rho();
80 }
81 } else {
82 m_stringIn.set(0,0,0,0);
83 m_stringOut.set(0,0,0,0);
84 fracTaken = 0.0;
85 }
86 }
88
89 // Advance string pointer
90 m_fracLeft *= (1 - fracTaken);
91 if (m_fracLeft <= 0.0) {
93 m_fracLeft = 1.0;
94 }
95
96 // Update position, momentum
97 G4LorentzVector dPosition = m_stringIn.lv() + m_stringOut.lv();
98 m_position += dPosition.vect();
99 G4double dTime = dPosition.t() / CLHEP::c_light;
100 m_time += dTime;
101 m_momentum += force * (m_stringIn.lv() - m_stringOut.lv());
102
103 // Field
104 if (m_stepper->GetField() != 0) {
105 G4ThreeVector p = m_position - dPosition.vect()/2;
106 G4double point[4] = {p.x(), p.y(), p.z(), m_time - dTime/2};
107 G4double field[6] = {0};
108 m_stepper->GetField()->GetFieldValue(point, field);
109 G4ThreeVector B(field[0], field[1], field[2]);
110 G4ThreeVector E(field[3], field[4], field[5]);
111 G4double charge = m_stepper->GetCharge();
112 G4ThreeVector dMomField = E * dTime + dPosition.vect().cross(B);
113 m_momentum += charge * G4LorentzVector(CLHEP::c_light * dMomField, E * dPosition.vect());
114 }
115
116 // Renormalize 4-momentum (TODO: address possible instability)
117 m_momentum *= mass / m_momentum.m();
118}
double charge(const T &p)
Definition AtlasPID.h:997
double length(const pvec &v)
int r
Definition globals.cxx:22

Member Data Documentation

◆ m_fracLeft

G4double HyperbolaStep::m_fracLeft
private

Definition at line 40 of file HyperbolaStep.h.

◆ m_length

G4double HyperbolaStep::m_length
private

Definition at line 49 of file HyperbolaStep.h.

◆ m_maxFracTaken

G4double HyperbolaStep::m_maxFracTaken
private

Definition at line 46 of file HyperbolaStep.h.

◆ m_maxLength

G4double HyperbolaStep::m_maxLength
private

Definition at line 48 of file HyperbolaStep.h.

◆ m_momentum

G4LorentzVector HyperbolaStep::m_momentum
private

Definition at line 43 of file HyperbolaStep.h.

◆ m_position

G4ThreeVector HyperbolaStep::m_position
private

Definition at line 41 of file HyperbolaStep.h.

◆ m_stepper

const HyperbolaStepper* HyperbolaStep::m_stepper
private

Definition at line 36 of file HyperbolaStep.h.

◆ m_stringEnd

std::deque<StringVector>::const_iterator HyperbolaStep::m_stringEnd
private

Definition at line 39 of file HyperbolaStep.h.

◆ m_stringIn

StringVector HyperbolaStep::m_stringIn
private

Definition at line 45 of file HyperbolaStep.h.

◆ m_stringOut

StringVector HyperbolaStep::m_stringOut
private

Definition at line 47 of file HyperbolaStep.h.

◆ m_stringPtr

std::deque<StringVector>::const_iterator HyperbolaStep::m_stringPtr
private

Definition at line 38 of file HyperbolaStep.h.

◆ m_time

G4double HyperbolaStep::m_time
private

Definition at line 42 of file HyperbolaStep.h.


The documentation for this class was generated from the following files: