Message: Do user trajectories work? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Do user trajectories work? 

Forum: Event and Track Management
Date: 25 Aug, 2009
From: Robert Penny <Robert Penny>

I'm writing code to try and install both custom track information and a custom trajectory. I install these in my TrackingAction code:

BS_TrackingAction::PreUserTrackingAction (const G4Track * aTrack)
  // Attach some additional information to the track
  if (aTrack->GetUserInformation () == 0)
	<< "BS_TrackingAction::PreUserTrackingAction "
	<< "BS_TrackInformation attached." << G4endl;

      BS_TrackInformation *infoNew = new BS_TrackInformation ();
      ((G4Track *) aTrack)->
	SetUserInformation ((G4VUserTrackInformation *) infoNew);

  // Also install a custom trajectory object

  G4VTrajectory *trj;
  trj = new BS_Trajectory( aTrack );
  fpTrackingManager->SetTrajectory ((G4VTrajectory *)trj);
  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++){ 
     delete (*GimmeSecondaries())[itr];

  if(verboseLevel>0 && (G4VSteppingVerbose::GetSilent()!=1) ) TrackBanner();

  // Give SteppingManger the pointer to the track which will be tracked 

  // Pre tracking user intervention process.
  fpTrajectory = 0;
  if( fpUserTrackingAction != NULL ) {
  // Construct a trajectory if it is requested
  if(StoreTrajectory&&(!fpTrajectory)) { 
    // default trajectory concrete class object
    switch (StoreTrajectory) {
    case 1: fpTrajectory = new G4Trajectory(fpTrack); break;
    case 2: fpTrajectory = new G4SmoothTrajectory(fpTrack); break;
    case 3: fpTrajectory = new G4RichTrajectory(fpTrack); break;

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.



Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Do user trajectories work?   (Robert Penny - 25 Aug, 2009)
 Add Message Add Message
to: "Do user trajectories work?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]