CMS 3D CMS Logo

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