Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-04 22:55:05

0001 #include "SimG4Core/Notification/interface/GenParticleInfoExtractor.h"
0002 #include "G4PrimaryParticle.hh"
0003 
0004 const GenParticleInfo &GenParticleInfoExtractor::operator()(const G4PrimaryParticle *p) const {
0005   G4VUserPrimaryParticleInformation *up = p->GetUserInformation();
0006   GenParticleInfo *gpi = dynamic_cast<GenParticleInfo *>(up);
0007   if (up == nullptr) {
0008     G4Exception("SimG4Core/Notification",
0009                 "mc001",
0010                 FatalException,
0011                 "GenParticleInfoExtractor: G4PrimaryParticle has no user information");
0012   } else if (gpi == nullptr) {
0013     G4Exception("SimG4Core/Notification",
0014                 "mc001",
0015                 FatalException,
0016                 "GenParticleInfoExtractor: user information in G4PrimaryParticle is not of GenParticleInfo type");
0017   }
0018   // Silence Clang analyzer warning: G4Exception will be thrown if gpi is null
0019   [[clang::suppress]] return *gpi;
0020 }