ATLAS Offline Software
Loading...
Searching...
No Matches
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 "G4ElectroMagneticField.hh"
8
9#include "DummyEquation.h"
10#include "HyperbolaStepper.h"
11
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),
21 m_field(dynamic_cast<const G4ElectroMagneticField*>(field)),
22 m_mass(track.GetDynamicParticle()->GetMass()),
23 m_charge(track.GetDynamicParticle()->GetCharge()),
24 m_startMomentum(track.GetDynamicParticle()->Get4Momentum()),
26 m_steps(),
27 m_currStep(this, string, track),
28 m_nPrevSteps(0),
29 m_debug(false)
30{
31 if (field != 0 && m_field == 0) {
32 G4Exception("HyperbolaStepper::HyperbolaStepper", "QuirkNonEM", FatalErrorInArgument, "Non-EM fields not supported");
33 }
34
35 // Precompute steps
36 m_currStep.PrepareNextStep();
37 m_steps.push_back(m_currStep);
38 m_currStep.Step(m_currStep.GetMaxLength());
39 while (m_currStep.GetStringPtr() != string.GetStringVectors().end()) {
40 HyperbolaStep next = m_currStep;
41 next.PrepareNextStep();
42 if (next.IsBoostLimited()) break; // don't allow 2nd+ step if it would be cut by boost limit
43 m_steps.push_back(next);
44 m_currStep = next;
45 m_currStep.Step(m_currStep.GetMaxLength());
46 }
47 m_nPrevSteps = m_steps.size() - 1;
48}
49
51 delete GetEquationOfMotion();
52}
53
55 if (m_currStep.GetLength() == length) return;
56 std::vector<HyperbolaStep>::size_type i = 0;
57 while (i+1 < m_steps.size() && m_steps[i+1].GetLength() < length) i++;
59 m_currStep.Step(length);
60 m_nPrevSteps = i;
61}
62
64 const G4double y[],
65 const G4double[], //dydx
66 G4double h,
67 G4double yout[],
68 G4double yerr[]
69) {
70 G4int maxvar = GetNumberOfStateVariables();
71 for (G4int i = 0; i < maxvar; i++) yout[i] = y[i];
72
73 if (m_debug) G4cout << "HyperbolaStepper: asked to move " << h << G4endl;
74 if (m_debug) G4cout << "HyperbolaStepper: start = " << y[0] << ", " << y[1] << ", " << y[2] << " [" << y[8] << "]" << G4endl;
75
76 SetCurrStep(y[8] + h);
77 m_currStep.Dump(yout);
78
79 if (m_debug) G4cout << "HyperbolaStepper: end = " << yout[0] << ", " << yout[1] << ", " << yout[2] << " [" << yout[8] << "]" << G4endl;
80
81 // TODO: Errors
82 for (G4int i = 0; i < m_NUM_VARS; i++) yerr[i] = 0;
83}
84
86 // TODO
87 return 0;
88}
89
90void HyperbolaStepper::Update(G4FieldTrack& fieldTrack, G4bool forceStep) {
91 if (forceStep) {
92 // Propagator refused to take step through detector geometry because length too short;
93 // take step ourselves and update string state and quirk 4-momentum only (don't change position)
94 m_currStep = m_steps.back();
95 m_currStep.Step(m_currStep.GetMaxLength());
96 m_nPrevSteps = m_steps.size() - 1;
97 G4LorentzVector p = m_currStep.GetMomentum();
98 fieldTrack.UpdateFourMomentum(p.t() - m_mass, p.vect().unit());
99 } else {
100 SetCurrStep(fieldTrack.GetProperTimeOfFlight());
101 }
102
103 // Update string vectors
104 m_string.PopTo(m_currStep.GetStringPtr(), m_currStep.GetFracLeft());
105 for (std::vector<HyperbolaStep>::size_type i = 0; i < m_nPrevSteps; i++) {
106 if (m_debug) G4cout << "HyperbolaStepper: pushing vector " << m_steps[i].GetStringOut().lv() << G4endl;
107 m_string.GetReactionForce()->PushStringVector(m_steps[i].GetStringOut());
108 }
109 if (m_debug) G4cout << "HyperbolaStepper: pushing vector " << m_currStep.GetStringOut().lv() << G4endl;
110 m_string.GetReactionForce()->PushStringVector(m_currStep.GetStringOut());
111}
double length(const pvec &v)
#define y
Header file for AthHistogramAlgorithm.
const G4double m_charge
G4double GetMass() const
HyperbolaStepper(InfracolorForce &string, const G4Track &track, const G4Field *field=0)
virtual G4double DistChord() const
void SetCurrStep(G4double length)
G4double GetCharge() const
InfracolorForce & m_string
const G4double m_maxExpRapidity
virtual void Stepper(const G4double y[], const G4double[], G4double h, G4double yout[], G4double yerr[])
const G4double m_mass
const G4ElectroMagneticField *const m_field
G4double GetMaxExpRapidity() const
static const G4int m_NUM_VARS
void Update(G4FieldTrack &fieldTrack, G4bool forceStep)
std::vector< HyperbolaStep >::size_type m_nPrevSteps
std::vector< HyperbolaStep > m_steps
HyperbolaStep m_currStep
const G4LorentzVector m_startMomentum
STL class.
while((inf=(TStreamerInfo *) nextinfo()) !=0)