File indexing completed on 2025-01-18 09:58:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 inline
0032 G4FieldTrack::G4FieldTrack( const G4FieldTrack& rStVec )
0033 : fDistanceAlongCurve( rStVec.fDistanceAlongCurve),
0034 fKineticEnergy( rStVec.fKineticEnergy ),
0035 fRestMass_c2( rStVec.fRestMass_c2),
0036 fLabTimeOfFlight( rStVec.fLabTimeOfFlight ),
0037 fProperTimeOfFlight( rStVec.fProperTimeOfFlight ),
0038
0039 fPolarization( rStVec.fPolarization ),
0040 fMomentumDir( rStVec.fMomentumDir ),
0041 fChargeState( rStVec.fChargeState )
0042 {
0043 SixVector[0]= rStVec.SixVector[0];
0044 SixVector[1]= rStVec.SixVector[1];
0045 SixVector[2]= rStVec.SixVector[2];
0046 SixVector[3]= rStVec.SixVector[3];
0047 SixVector[4]= rStVec.SixVector[4];
0048 SixVector[5]= rStVec.SixVector[5];
0049
0050
0051
0052
0053 }
0054
0055 inline
0056 G4FieldTrack& G4FieldTrack::operator= ( const G4FieldTrack& rStVec )
0057 {
0058 if (&rStVec == this) { return *this; }
0059
0060 SixVector[0]= rStVec.SixVector[0];
0061 SixVector[1]= rStVec.SixVector[1];
0062 SixVector[2]= rStVec.SixVector[2];
0063 SixVector[3]= rStVec.SixVector[3];
0064 SixVector[4]= rStVec.SixVector[4];
0065 SixVector[5]= rStVec.SixVector[5];
0066 SetCurveLength( rStVec.GetCurveLength() );
0067
0068 fKineticEnergy= rStVec.fKineticEnergy;
0069 fRestMass_c2= rStVec.fRestMass_c2;
0070 SetLabTimeOfFlight( rStVec.GetLabTimeOfFlight() );
0071 SetProperTimeOfFlight( rStVec.GetProperTimeOfFlight() );
0072 SetPolarization( rStVec.GetPolarization() );
0073 fMomentumDir= rStVec.fMomentumDir;
0074
0075 fChargeState= rStVec.fChargeState;
0076
0077
0078 return *this;
0079 }
0080
0081 inline
0082 G4FieldTrack::G4FieldTrack(G4FieldTrack&& from) noexcept
0083 : fDistanceAlongCurve( from.fDistanceAlongCurve),
0084 fKineticEnergy( from.fKineticEnergy ),
0085 fRestMass_c2( from.fRestMass_c2),
0086 fLabTimeOfFlight( from.fLabTimeOfFlight ),
0087 fProperTimeOfFlight( from.fProperTimeOfFlight ),
0088 fChargeState( from.fChargeState )
0089 {
0090 SixVector[0]= from.SixVector[0];
0091 SixVector[1]= from.SixVector[1];
0092 SixVector[2]= from.SixVector[2];
0093 SixVector[3]= from.SixVector[3];
0094 SixVector[4]= from.SixVector[4];
0095 SixVector[5]= from.SixVector[5];
0096
0097 fPolarization = std::move( from.fPolarization );
0098 fMomentumDir = std::move( from.fMomentumDir );
0099 }
0100
0101 inline
0102 G4FieldTrack& G4FieldTrack::operator=(G4FieldTrack&& from) noexcept
0103 {
0104 if (&from == this) { return *this;
0105 }
0106
0107 SixVector[0]= from.SixVector[0];
0108 SixVector[1]= from.SixVector[1];
0109 SixVector[2]= from.SixVector[2];
0110 SixVector[3]= from.SixVector[3];
0111 SixVector[4]= from.SixVector[4];
0112 SixVector[5]= from.SixVector[5];
0113
0114 fDistanceAlongCurve = from.fDistanceAlongCurve;
0115 fKineticEnergy = from.fKineticEnergy;
0116 fRestMass_c2 = from.fRestMass_c2;
0117 fLabTimeOfFlight = from.fLabTimeOfFlight;
0118 fProperTimeOfFlight = from.fProperTimeOfFlight;
0119 fChargeState = from.fChargeState;
0120
0121 fPolarization = std::move( from.fPolarization );
0122 fMomentumDir = std::move( from.fMomentumDir );
0123
0124 return *this;
0125 }
0126
0127 inline
0128 G4FieldTrack::~G4FieldTrack()
0129 {
0130
0131 }
0132
0133 inline G4FieldTrack&
0134 G4FieldTrack::SetCurvePnt(const G4ThreeVector& pPosition,
0135 const G4ThreeVector& pMomentum,
0136 G4double s_curve )
0137 {
0138 SixVector[0] = pPosition.x();
0139 SixVector[1] = pPosition.y();
0140 SixVector[2] = pPosition.z();
0141
0142 SixVector[3] = pMomentum.x();
0143 SixVector[4] = pMomentum.y();
0144 SixVector[5] = pMomentum.z();
0145
0146 fMomentumDir = (pMomentum.mag2() > 0.0)
0147 ? pMomentum.unit() : G4ThreeVector( 0.0, 0.0, 0.0 );
0148
0149 fDistanceAlongCurve = s_curve;
0150
0151 return *this;
0152 }
0153
0154 inline
0155 void G4FieldTrack::SetPDGSpin(G4double pdgSpin)
0156 {
0157 fChargeState.SetPDGSpin(pdgSpin);
0158 }
0159
0160 inline
0161 G4double G4FieldTrack::GetPDGSpin()
0162 {
0163 return fChargeState.GetPDGSpin();
0164 }
0165
0166 inline
0167 G4ThreeVector G4FieldTrack::GetPosition() const
0168 {
0169 G4ThreeVector myPosition( SixVector[0], SixVector[1], SixVector[2] );
0170 return myPosition;
0171 }
0172
0173 inline
0174 void G4FieldTrack::SetPosition( const G4ThreeVector& pPosition)
0175 {
0176 SixVector[0] = pPosition.x();
0177 SixVector[1] = pPosition.y();
0178 SixVector[2] = pPosition.z();
0179 }
0180
0181 inline
0182 const G4ThreeVector& G4FieldTrack::GetMomentumDir() const
0183 {
0184
0185
0186 return fMomentumDir;
0187 }
0188
0189 inline
0190 G4ThreeVector G4FieldTrack::GetMomentumDirection() const
0191 {
0192 return fMomentumDir;
0193 }
0194
0195 inline
0196 G4double G4FieldTrack::GetCurveLength() const
0197 {
0198 return fDistanceAlongCurve;
0199 }
0200
0201 inline
0202 void G4FieldTrack::SetCurveLength(G4double nCurve_s)
0203 {
0204 fDistanceAlongCurve = nCurve_s;
0205 }
0206
0207 inline
0208 G4double G4FieldTrack::GetKineticEnergy() const
0209 {
0210 return fKineticEnergy;
0211 }
0212
0213 inline
0214 void G4FieldTrack::SetKineticEnergy(G4double newKinEnergy)
0215 {
0216 fKineticEnergy = newKinEnergy;
0217 }
0218
0219 inline
0220 G4ThreeVector G4FieldTrack::GetPolarization() const
0221 {
0222 return fPolarization;
0223 }
0224
0225 inline
0226 void G4FieldTrack::SetPolarization(const G4ThreeVector& vecPlz)
0227 {
0228 fPolarization = vecPlz;
0229 }
0230
0231 inline
0232 const G4ChargeState* G4FieldTrack::GetChargeState() const
0233 {
0234 return &fChargeState;
0235 }
0236
0237 inline
0238 G4double G4FieldTrack::GetLabTimeOfFlight() const
0239 {
0240 return fLabTimeOfFlight;
0241 }
0242
0243 inline
0244 void G4FieldTrack::SetLabTimeOfFlight(G4double nTOF)
0245 {
0246 fLabTimeOfFlight = nTOF;
0247 }
0248
0249 inline
0250 G4double G4FieldTrack::GetProperTimeOfFlight() const
0251 {
0252 return fProperTimeOfFlight;
0253 }
0254
0255 inline
0256 void G4FieldTrack::SetProperTimeOfFlight(G4double nTOF)
0257 {
0258 fProperTimeOfFlight = nTOF;
0259 }
0260
0261 inline
0262 void G4FieldTrack::SetMomentumDir(const G4ThreeVector& newMomDir)
0263 {
0264 fMomentumDir = newMomDir;
0265 }
0266
0267 inline
0268 G4ThreeVector G4FieldTrack::GetMomentum() const
0269 {
0270 return { SixVector[3], SixVector[4], SixVector[5] };
0271 }
0272
0273 inline
0274 void G4FieldTrack::SetMomentum(const G4ThreeVector& pMomentum)
0275 {
0276 SixVector[3] = pMomentum.x();
0277 SixVector[4] = pMomentum.y();
0278 SixVector[5] = pMomentum.z();
0279
0280 if( pMomentum.mag2() > 0.0 ) { fMomentumDir = pMomentum.unit(); }
0281 else { fMomentumDir = G4ThreeVector( 0.0, 0.0, 0.0 ); }
0282 }
0283
0284 inline
0285 G4double G4FieldTrack::GetCharge() const
0286 {
0287 return fChargeState.GetCharge();
0288 }
0289
0290 inline
0291 G4double G4FieldTrack::GetRestMass() const
0292 {
0293 return fRestMass_c2;
0294 }
0295
0296 inline
0297 void G4FieldTrack::SetRestMass(G4double Mass_c2)
0298 {
0299 fRestMass_c2 = Mass_c2;
0300 }
0301
0302
0303
0304
0305
0306 inline
0307 void G4FieldTrack::DumpToArray(G4double valArr[ncompSVEC] ) const
0308 {
0309 valArr[0]=SixVector[0];
0310 valArr[1]=SixVector[1];
0311 valArr[2]=SixVector[2];
0312 valArr[3]=SixVector[3];
0313 valArr[4]=SixVector[4];
0314 valArr[5]=SixVector[5];
0315
0316 G4ThreeVector Momentum(valArr[3],valArr[4],valArr[5]);
0317
0318
0319
0320
0321
0322
0323
0324 valArr[6]= fKineticEnergy;
0325
0326
0327 valArr[7]=fLabTimeOfFlight;
0328 valArr[8]=fProperTimeOfFlight;
0329 valArr[9]=fPolarization.x();
0330 valArr[10]=fPolarization.y();
0331 valArr[11]=fPolarization.z();
0332
0333
0334
0335
0336 }
0337
0338 inline
0339 void G4FieldTrack::UpdateFourMomentum( G4double kineticEnergy,
0340 const G4ThreeVector& momentumDirection )
0341 {
0342 G4double momentum_mag = std::sqrt(kineticEnergy*kineticEnergy
0343 +2.0*fRestMass_c2*kineticEnergy);
0344 G4ThreeVector momentumVector = momentum_mag * momentumDirection;
0345
0346
0347
0348 SixVector[3] = momentumVector.x();
0349 SixVector[4] = momentumVector.y();
0350 SixVector[5] = momentumVector.z();
0351
0352 fMomentumDir= momentumDirection;
0353 fKineticEnergy= kineticEnergy;
0354 }
0355
0356 inline
0357 void G4FieldTrack::UpdateState( const G4ThreeVector& position,
0358 G4double laboratoryTimeOfFlight,
0359 const G4ThreeVector& momentumDirection,
0360 G4double kineticEnergy )
0361 {
0362
0363 SetPosition( position);
0364 fLabTimeOfFlight = laboratoryTimeOfFlight;
0365 fDistanceAlongCurve = 0.0;
0366
0367 UpdateFourMomentum( kineticEnergy, momentumDirection);
0368 }
0369
0370 inline
0371 void G4FieldTrack::InitialiseSpin( const G4ThreeVector& vecPolarization )
0372 {
0373 SetPolarization( vecPolarization );
0374 }
0375
0376 inline G4ThreeVector G4FieldTrack::GetSpin() const
0377 {
0378 return GetPolarization();
0379 }
0380
0381 inline
0382 void G4FieldTrack::SetSpin(const G4ThreeVector& vSpin)
0383 {
0384 SetPolarization(vSpin);
0385 }