#include <SimG4Core/Notification/interface/TrackInformationExtractor.h>
Public Member Functions | |
TrackInformation & | operator() (G4Track *gtk) const |
TrackInformation & | operator() (G4Track >k) const |
for a non-const G4Track pointer/reference the TrackInformation& is also non-const. | |
const TrackInformation & | operator() (const G4Track *gtk) const |
const TrackInformation & | operator() (const G4Track >k) const |
for a const G4Track pointer/reference a const TrackInformation& is returned. | |
Private Member Functions | |
void | missing (const G4Track >k) const |
void | wrongType () const |
If the G4Track pointer/reference is const, a const reference to the TrackInformation is returned, else a non-const reference is returned. The TrackInformationExtractor checks for the existance of TrackInformation and for the validity of the dynamic_cast; It will throw an excepton if it is not possible to return TrackInformation, but it will do it's best to satisfy the request (in some cases it may even create the TrackInformation on-the-fly).
Definition at line 20 of file TrackInformationExtractor.h.
void TrackInformationExtractor::missing | ( | const G4Track & | gtk | ) | const [inline, private] |
Definition at line 34 of file TrackInformationExtractor.h.
Referenced by operator()().
00035 { throw SimG4Exception("TrackInformationExtractor: G4Track has no TrackInformation"); }
TrackInformation& TrackInformationExtractor::operator() | ( | G4Track * | gtk | ) | const [inline] |
Definition at line 32 of file TrackInformationExtractor.h.
References operator()().
00032 { return operator()(*gtk); }
TrackInformation & TrackInformationExtractor::operator() | ( | G4Track & | gtk | ) | const |
for a non-const G4Track pointer/reference the TrackInformation& is also non-const.
Definition at line 16 of file TrackInformationExtractor.cc.
References missing(), and wrongType().
00017 { 00018 G4VUserTrackInformation * gui = gtk.GetUserInformation(); 00019 if (gui == 0) missing(gtk); 00020 TrackInformation * tkInfo = dynamic_cast<TrackInformation *>(gui); 00021 if (tkInfo == 0) wrongType(); 00022 return * tkInfo; 00023 }
const TrackInformation& TrackInformationExtractor::operator() | ( | const G4Track * | gtk | ) | const [inline] |
Definition at line 27 of file TrackInformationExtractor.h.
References operator()().
00027 { return operator()(*gtk); }
const TrackInformation & TrackInformationExtractor::operator() | ( | const G4Track & | gtk | ) | const |
for a const G4Track pointer/reference a const TrackInformation& is returned.
Definition at line 6 of file TrackInformationExtractor.cc.
References missing(), and wrongType().
Referenced by operator()().
00007 { 00008 G4VUserTrackInformation * gui = gtk.GetUserInformation(); 00009 if (gui == 0) missing(gtk); 00010 const TrackInformation * tkInfo = dynamic_cast<const TrackInformation *>(gui); 00011 if (tkInfo == 0) wrongType(); 00012 return * tkInfo; 00013 }
void TrackInformationExtractor::wrongType | ( | ) | const [inline, private] |
Definition at line 36 of file TrackInformationExtractor.h.
Referenced by operator()().
00037 { throw SimG4Exception("User information in G4Track is not of TrackInformation type"); }