CMS 3D CMS Logo

GenParticleInfoExtractor.cc
Go to the documentation of this file.
3 
4 #include "G4PrimaryParticle.hh"
5 
6 const GenParticleInfo &
7 GenParticleInfoExtractor::operator()(const G4PrimaryParticle * p) const
8 {
9  G4VUserPrimaryParticleInformation * up = p->GetUserInformation();
10  if (up == nullptr) throw SimG4Exception
11  ("GenParticleInfoExtractor: G4PrimaryParticle has no user information");
12  GenParticleInfo * gpi = dynamic_cast<GenParticleInfo *>(up);
13  if (gpi == nullptr) throw SimG4Exception
14  ("User information in G4PrimaryParticle is not of GenParticleInfo type");
15  return * gpi;
16 }
Definition: BitonicSort.h:8
const GenParticleInfo & operator()(const G4PrimaryParticle *p) const