CMS 3D CMS Logo

NewTrackAction Class Reference

SimG4Core Action for new G4tracks. More...

#include <SimG4Core/Notification/interface/NewTrackAction.h>

List of all members.

Public Member Functions

 NewTrackAction ()
void primary (G4Track *aSecondary) const
void primary (const G4Track *aSecondary) const
void secondary (G4Track *aSecondary, const G4Track &mother, int) const
void secondary (const G4Track *aSecondary, const G4Track &mother, int) const

Private Member Functions

void addUserInfoToPrimary (G4Track *aTrack) const
void addUserInfoToSecondary (G4Track *aTrack, const TrackInformation &motherInfo, int) const


Detailed Description

SimG4Core Action for new G4tracks.

This action is called each time a new G4Track is formed. Since formation (i.e. filling of data members) is done gradually, the best moment to call NewTrackAction is not very clear. Currently done from StackingAction...

Definition at line 14 of file NewTrackAction.h.


Constructor & Destructor Documentation

NewTrackAction::NewTrackAction (  ) 

Definition at line 10 of file NewTrackAction.cc.

00010 {}


Member Function Documentation

void NewTrackAction::addUserInfoToPrimary ( G4Track *  aTrack  )  const [private]

Definition at line 32 of file NewTrackAction.cc.

References TrackInformation::isPrimary(), TrackInformation::putInHistory(), and TrackInformation::storeTrack().

Referenced by primary().

00032                                                                 {
00033   TrackInformation * trkInfo = new TrackInformation();
00034   trkInfo->isPrimary(true);
00035   trkInfo->storeTrack(true);
00036   trkInfo->putInHistory();
00037   aTrack->SetUserInformation(trkInfo);  
00038 }

void NewTrackAction::addUserInfoToSecondary ( G4Track *  aTrack,
const TrackInformation motherInfo,
int  flag 
) const [private]

Definition at line 40 of file NewTrackAction.cc.

References TrackInformation::getIDCaloVolume(), TrackInformation::getIDLastVolume(), TrackInformation::getIDonCaloSurface(), TrackInformation::isPrimary(), LogDebug, TrackInformation::putInHistory(), TrackInformation::setIDonCaloSurface(), and TrackInformation::storeTrack().

Referenced by secondary().

00040                                                                                                                 {
00041 
00042   TrackInformation * trkInfo = new TrackInformation();
00043   LogDebug("SimG4CoreApplication") << "NewTrackAction called for "
00044                                    << aTrack->GetTrackID()
00045                                    << " mother " << motherInfo.isPrimary()
00046                                    << " flag " << flag;
00047   
00048   // Take care of cascade decays
00049   if (flag == 1)
00050     trkInfo->isPrimary(true);
00051 
00052   // Store if decay or conversion
00053   if (flag > 0) {
00054     trkInfo->storeTrack(true);
00055     trkInfo->putInHistory();
00056     trkInfo->setIDonCaloSurface(aTrack->GetTrackID(),
00057                                 motherInfo.getIDCaloVolume(),
00058                                 motherInfo.getIDLastVolume());
00059   } else {
00060     // transfer calo ID from mother (to be checked in TrackingAction)
00061     trkInfo->setIDonCaloSurface(motherInfo.getIDonCaloSurface(),
00062                                 motherInfo.getIDCaloVolume(),
00063                                 motherInfo.getIDLastVolume());
00064   }
00065   aTrack->SetUserInformation(trkInfo);  
00066 }

void NewTrackAction::primary ( G4Track *  aSecondary  )  const

Definition at line 16 of file NewTrackAction.cc.

References addUserInfoToPrimary().

00016                                                    {
00017   addUserInfoToPrimary(aTrack);
00018 }

void NewTrackAction::primary ( const G4Track *  aSecondary  )  const

Definition at line 12 of file NewTrackAction.cc.

Referenced by StackingAction::ClassifyNewTrack(), and KillSecondariesStackingAction::ClassifyNewTrack().

00012                                                          {
00013   primary(const_cast<G4Track *>(aTrack)); 
00014 }

void NewTrackAction::secondary ( G4Track *  aSecondary,
const G4Track &  mother,
int  flag 
) const

Definition at line 24 of file NewTrackAction.cc.

References addUserInfoToSecondary().

00024                                                                                           {
00025   if (aSecondary->GetParentID() != mother.GetTrackID()) 
00026     throw SimG4Exception("NewTrackAction: secondary parent ID does not match mother id");
00027   TrackInformationExtractor extractor;
00028   const TrackInformation & motherInfo(extractor(mother));
00029   addUserInfoToSecondary(aSecondary,motherInfo,flag);
00030 }

void NewTrackAction::secondary ( const G4Track *  aSecondary,
const G4Track &  mother,
int  flag 
) const

Definition at line 20 of file NewTrackAction.cc.

Referenced by StackingAction::ClassifyNewTrack(), and KillSecondariesStackingAction::ClassifyNewTrack().

00020                                                                                                 {
00021   secondary(const_cast<G4Track *>(aSecondary),mother,flag); 
00022 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:28:59 2009 for CMSSW by  doxygen 1.5.4