CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SaveSimTrack.cc
Go to the documentation of this file.
2 
5 
7 
8 #include "G4Track.hh"
9 #include "G4PhysicalConstants.hh"
10 #include "G4SystemOfUnits.hh"
11 
13 
14  pdgMin = p.getUntrackedParameter<int>("MinimumPDGCode", 1000000);
15  pdgMax = p.getUntrackedParameter<int>("MaximumPDGCode", 2000000);
16 
17  edm::LogInfo("SaveSimTrack") << "SaveSimTrack:: Save Sim Track if PDG code "
18  << "lies between " << pdgMin << " and "
19  << pdgMax;
20 }
21 
23 
25 
26  G4Track* theTrack = (G4Track*)((*trk)());
27  TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
28  if (trkInfo) {
29  int pdg = std::abs(theTrack->GetDefinition()->GetPDGEncoding());
30  if (pdg >= pdgMin && pdg <= pdgMax) {
31  trkInfo->storeTrack(true);
32  LogDebug("SaveSimTrack") << "Save SimTrack the Track "
33  << theTrack->GetTrackID() << " Type "
34  << theTrack->GetDefinition()->GetParticleName()
35  << " Momentum " << theTrack->GetMomentum()/MeV
36  << " MeV/c";
37  }
38  }
39 }
40 
#define LogDebug(id)
T getUntrackedParameter(std::string const &, T const &) const
bool storeTrack() const
void update(const BeginOfTrack *trk)
This routine will be called when the appropriate signal arrives.
Definition: SaveSimTrack.cc:24
SaveSimTrack(edm::ParameterSet const &p)
Definition: SaveSimTrack.cc:12
Abs< T >::type abs(const T &t)
Definition: Abs.h:22