CMS 3D CMS Logo

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 #include <algorithm>
12 
14 
15  edm::ParameterSet ps = p.getParameter<edm::ParameterSet>("SaveSimTrack");
16  pdgs_ = ps.getUntrackedParameter<std::vector<int>>("PDGCodes");
17 
18  edm::LogInfo("SaveSimTrack") << "SaveSimTrack:: Save Sim Track if PDG code "
19  << "is one from the list of " << pdgs_.size()
20  << " items";
21  for (unsigned int k=0; k<pdgs_.size(); ++k)
22  edm::LogInfo("SaveSimTrack") << "[" << k << "] " << pdgs_[k];
23 }
24 
26 
28 
29  G4Track* theTrack = (G4Track*)((*trk)());
30  TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
31  if (trkInfo) {
32  int pdg = theTrack->GetDefinition()->GetPDGEncoding();
33  if (std::find(pdgs_.begin(),pdgs_.end(),pdg) != pdgs_.end()) {
34  trkInfo->storeTrack(true);
35  LogDebug("SaveSimTrack") << "Save SimTrack the Track "
36  << theTrack->GetTrackID() << " Type "
37  << theTrack->GetDefinition()->GetParticleName()
38  << " Momentum " << theTrack->GetMomentum()/MeV
39  << " MeV/c";
40  }
41  }
42 }
43 
#define LogDebug(id)
T getParameter(std::string const &) const
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:27
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const double MeV
std::vector< int > pdgs_
Definition: SaveSimTrack.h:20
SaveSimTrack(edm::ParameterSet const &p)
Definition: SaveSimTrack.cc:13
int k[5][pyjets_maxn]