| Message: Do user trajectories work? | Not Logged In (login) |
|
I'm writing code to try and install both custom track information and a custom trajectory. I install these in my TrackingAction code:
void
BS_TrackingAction::PreUserTrackingAction (const G4Track * aTrack)
{
#ifdef G4_BS_INSTALL_USER_TRACK_INFORMATION
// Attach some additional information to the track
if (aTrack->GetUserInformation () == 0)
{
G4cout
<< "BS_TrackingAction::PreUserTrackingAction "
<< "BS_TrackInformation attached." << G4endl;
BS_TrackInformation *infoNew = new BS_TrackInformation ();
((G4Track *) aTrack)->
SetUserInformation ((G4VUserTrackInformation *) infoNew);
}
#endif
// Also install a custom trajectory object
#ifdef G4_BS_INSTALL_CUSTOM_TRAJECTORY G4VTrajectory *trj; trj = new BS_Trajectory( aTrack ); fpTrackingManager->SetTrajectory ((G4VTrajectory *)trj); #endif fpTrackingManager->SetStoreTrajectory (1); } However, I don't see any evidence that my custom trajectory is being installed. Furthermore, digging into the GEANT library source code, I don't see how a custom trajectory can ever be used. Note how in the G4TrackingManager::ProcessOneTrack code, the fpTrajectory pointer is zeroed out prior to the case statement assigning one of the standard trajectories. //////////////////////////////////////////////////////////////// void G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track) //////////////////////////////////////////////////////////////// {
// Receiving a G4Track from the EventManager, this funciton has the // responsibility to trace the track till it stops. fpTrack = apValueG4Track; EventIsAborted = false;
// Clear 2ndary particle vector
// GimmeSecondaries()->clearAndDestroy();
// std::vector<G4Track*>::iterator itr;
size_t itr;
// for(itr=GimmeSecondaries()->begin();itr=GimmeSecondaries()->end();itr++){
for(itr=0;itr<GimmeSecondaries()->size();itr++){
delete (*GimmeSecondaries())[itr];
}
GimmeSecondaries()->clear();
if(verboseLevel>0 && (G4VSteppingVerbose::GetSilent()!=1) ) TrackBanner();
// Give SteppingManger the pointer to the track which will be tracked fpSteppingManager->SetInitialStep(fpTrack);
// Pre tracking user intervention process.
fpTrajectory = 0;
if( fpUserTrackingAction != NULL ) {
fpUserTrackingAction->PreUserTrackingAction(fpTrack);
}
#ifdef G4_STORE_TRAJECTORY
// Construct a trajectory if it is requested
if(StoreTrajectory&&(!fpTrajectory)) {
// default trajectory concrete class object
switch (StoreTrajectory) {
default:
case 1: fpTrajectory = new G4Trajectory(fpTrack); break;
case 2: fpTrajectory = new G4SmoothTrajectory(fpTrack); break;
case 3: fpTrajectory = new G4RichTrajectory(fpTrack); break;
}
}
#endif
...
Am I missing something? If a custom trajectory is installed does this section of code get bypassed somehow? For reference, I'm running Geant 4.9.2-r2 under Gentoo. Thanks, -Rob
|
| Inline Depth: | Outline Depth: | Add message: |
|
to: |