CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/SimG4Core/Notification/src/GenParticleInfoExtractor.cc

Go to the documentation of this file.
00001 #include "SimG4Core/Notification/interface/GenParticleInfoExtractor.h"
00002 #include "SimG4Core/Notification/interface/SimG4Exception.h"
00003 
00004 #include "G4PrimaryParticle.hh"
00005 
00006 const GenParticleInfo & 
00007 GenParticleInfoExtractor::operator()(const G4PrimaryParticle * p) const
00008 {
00009     G4VUserPrimaryParticleInformation * up = p->GetUserInformation();
00010     if (up == 0) throw SimG4Exception
00011        ("GenParticleInfoExtractor: G4PrimaryParticle has no user information");
00012     GenParticleInfo * gpi = dynamic_cast<GenParticleInfo *>(up);
00013     if (gpi == 0) throw SimG4Exception
00014        ("User information in G4PrimaryParticle is not of GenParticleInfo type");
00015     return * gpi;
00016 }