MCPcopy Create free account
hub / github.com/Geant4/geant4 / LoadFromArray

Method LoadFromArray

source/geometry/magneticfield/src/G4FieldTrack.cc:170–213  ·  view source on GitHub ↗

Load values from array Note that momentum direction must-be/is normalised

Source from the content-addressed store, hash-verified

168// Note that momentum direction must-be/is normalised
169//
170void G4FieldTrack::LoadFromArray(const G4double valArrIn[ncompSVEC],
171 G4int noVarsIntegrated)
172{
173 // Fill the variables not integrated with zero -- so it's clear !!
174 //
175 G4double valArr[ncompSVEC];
176 for(G4int i=0; i<noVarsIntegrated; ++i)
177 {
178 valArr[i] = valArrIn[i];
179 }
180 for(G4int i=noVarsIntegrated; i<ncompSVEC; ++i)
181 {
182 valArr[i] = 0.0;
183 }
184
185 SixVector[0] = valArr[0];
186 SixVector[1] = valArr[1];
187 SixVector[2] = valArr[2];
188 SixVector[3] = valArr[3];
189 SixVector[4] = valArr[4];
190 SixVector[5] = valArr[5];
191
192 G4ThreeVector Momentum(valArr[3],valArr[4],valArr[5]);
193
194 G4double momentum_square= Momentum.mag2();
195 fMomentumDir= Momentum.unit();
196
197 fKineticEnergy = momentum_square
198 / (std::sqrt(momentum_square+fRestMass_c2*fRestMass_c2)
199 + fRestMass_c2 );
200 // The above equation is stable for small and large momenta
201
202 // The following components may or may not be
203 // integrated over -- integration is optional
204 // fKineticEnergy = valArr[6];
205
206 fLabTimeOfFlight = valArr[7];
207 fProperTimeOfFlight = valArr[8];
208 G4ThreeVector vecPolarization= G4ThreeVector(valArr[9],valArr[10],valArr[11]);
209 SetPolarization( vecPolarization );
210
211 // fMomentumDir=G4ThreeVector(valArr[13],valArr[14],valArr[15]);
212 // fDistanceAlongCurve= valArr[];
213}

Callers 9

PrintStatusMethod · 0.80
AccurateAdvanceMethod · 0.80
QuickAdvanceMethod · 0.80
PrintStatusMethod · 0.80
AccurateAdvanceMethod · 0.80
QuickAdvanceMethod · 0.80
AccurateAdvanceMethod · 0.80
QuickAdvanceMethod · 0.80
PrintStatusMethod · 0.80

Calls 2

unitMethod · 0.80
mag2Method · 0.45

Tested by

no test coverage detected