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.
00093 : 00094 BLManager::SteppingAction() 00095 { time = _time; 00096 require = _require; 00097 coordinateType = _coordinateType; 00098 ntuple = BLTrackNTuple::create(format,"TimeNTuple",_name, 00099 filename,coordinateType,require); 00100 }
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.
00203 { 00204 if(BLManager::getObject()->getState() == SPECIAL) return; 00205 00206 // only use reference coordinates when they are valid 00207 BLManagerState state = BLManager::getObject()->getState(); 00208 if(coordinateType == BLCOORD_REFERENCE && state != BEAM) return; 00209 00210 G4Track *track = step->GetTrack(); 00211 00212 // get basic physical-volume info 00213 G4StepPoint *prePoint = step->GetPreStepPoint(); 00214 if(!prePoint) return; 00215 G4StepPoint *postPoint = step->GetPostStepPoint(); 00216 if(!postPoint) return; 00217 00218 // make a row only if the pre- and post-step times bracket desired time 00219 // and protect against ntuple==null 00220 G4double preTime = prePoint->GetGlobalTime(); 00221 G4double postTime = postPoint->GetGlobalTime(); 00222 if(preTime > time || postTime < time || !ntuple) return; 00223 00224 G4ThreeVector position = track->GetPosition(); 00225 G4double time = track->GetGlobalTime(); 00226 G4ThreeVector momentum = track->GetMomentum(); 00227 00228 // Linear interpolation 00229 G4double dt = step->GetDeltaTime(); 00230 G4double err = this->time - time; 00231 G4double properTime = track->GetProperTime(); 00232 G4double trackLength = track->GetTrackLength(); 00233 if(dt > 0.001*ns && fabs(err) <= dt*1.5) { 00234 time += err; 00235 position += (err/dt)*step->GetDeltaPosition(); 00236 momentum += (err/dt)*step->GetDeltaMomentum(); 00237 double delta_t = track->GetGlobalTime() - time; 00238 properTime -= delta_t*track->GetDefinition()->GetPDGMass() / 00239 track->GetTotalEnergy(); 00240 trackLength -= delta_t*track->GetVelocity(); 00241 } 00242 00243 ntuple->appendTrack(track,time,position,momentum,properTime, 00244 trackLength); 00245 }
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().