Public Member Functions | |
TimeNTuple (G4String _name, G4double _time, G4String format, G4String filename, G4String _require, BLCoordinateType _coordinateType) | |
constructor. | |
void | UserSteppingAction (const G4Step *step) |
UserSteppingAction() from BLManager::SteppingAction. | |
Private Attributes | |
G4double | time |
BLTrackNTuple * | ntuple |
G4String | require |
BLCoordinateType | coordinateType |
TimeNTuple::TimeNTuple | ( | G4String | _name, | |
G4double | _time, | |||
G4String | format, | |||
G4String | filename, | |||
G4String | _require, | |||
BLCoordinateType | _coordinateType | |||
) | [inline] |
constructor.
References coordinateType, BLTrackNTuple::create(), ntuple, require, and time.
00094 : 00095 BLManager::SteppingAction() 00096 { time = _time; 00097 require = _require; 00098 coordinateType = _coordinateType; 00099 ntuple = BLTrackNTuple::create(format,"TimeNTuple",_name, 00100 filename,coordinateType,require); 00101 }
void TimeNTuple::UserSteppingAction | ( | const G4Step * | step | ) | [virtual] |
UserSteppingAction() from BLManager::SteppingAction.
Implements BLManager::SteppingAction.
References BLTrackNTuple::appendTrack(), BEAM, BLCOORD_REFERENCE, coordinateType, BLManager::getObject(), BLManager::getState(), ntuple, SPECIAL, and time.
00209 { 00210 if(BLManager::getObject()->getState() == SPECIAL) return; 00211 00212 // only use reference coordinates when they are valid 00213 BLManagerState state = BLManager::getObject()->getState(); 00214 if(coordinateType == BLCOORD_REFERENCE && state != BEAM) return; 00215 00216 G4Track *track = step->GetTrack(); 00217 00218 // get basic physical-volume info 00219 G4StepPoint *prePoint = step->GetPreStepPoint(); 00220 if(!prePoint) return; 00221 G4StepPoint *postPoint = step->GetPostStepPoint(); 00222 if(!postPoint) return; 00223 00224 // make a row only if the pre- and post-step times bracket desired time 00225 // and protect against ntuple==null 00226 G4double preTime = prePoint->GetGlobalTime(); 00227 G4double postTime = postPoint->GetGlobalTime(); 00228 if(preTime > time || postTime < time || !ntuple) return; 00229 00230 G4ThreeVector position = track->GetPosition(); 00231 G4double time = track->GetGlobalTime(); 00232 G4ThreeVector momentum = track->GetMomentum(); 00233 00234 // Linear interpolation 00235 G4double dt = step->GetDeltaTime(); 00236 G4double err = this->time - time; 00237 G4double properTime = track->GetProperTime(); 00238 G4double trackLength = track->GetTrackLength(); 00239 if(dt > 0.001*ns && fabs(err) <= dt*1.5) { 00240 time += err; 00241 position += (err/dt)*step->GetDeltaPosition(); 00242 momentum += (err/dt)*(postPoint->GetMomentum()- 00243 prePoint->GetMomentum()); 00244 double delta_t = track->GetGlobalTime() - time; 00245 properTime -= delta_t*track->GetDefinition()->GetPDGMass() / 00246 track->GetTotalEnergy(); 00247 trackLength -= delta_t*track->GetVelocity(); 00248 } 00249 00250 ntuple->appendTrack(track,time,position,momentum,properTime, 00251 trackLength); 00252 }
G4double TimeNTuple::time [private] |
Referenced by TimeNTuple(), and UserSteppingAction().
BLTrackNTuple* TimeNTuple::ntuple [private] |
Referenced by TimeNTuple(), and UserSteppingAction().
G4String TimeNTuple::require [private] |
Referenced by TimeNTuple().
BLCoordinateType TimeNTuple::coordinateType [private] |
Referenced by TimeNTuple(), and UserSteppingAction().