slic/src
diff -u -r1.20 -r1.21
--- StdHepToLcioConvertor.cc 23 Aug 2005 00:51:59 -0000 1.20
+++ StdHepToLcioConvertor.cc 13 Sep 2005 19:02:54 -0000 1.21
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/StdHepToLcioConvertor.cc,v 1.20 2005/08/23 00:51:59 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/StdHepToLcioConvertor.cc,v 1.21 2005/09/13 19:02:54 jeremy Exp $
#include "StdHepToLcioConvertor.hh"
// LCIO
@@ -8,6 +8,11 @@
// stl
#include <iostream>
#include <assert.h>
+#include <cmath>
+
+// G4
+#include "G4ParticleDefinition.hh"
+#include "G4ParticleTable.hh"
// using
using std::cerr;
@@ -134,7 +139,28 @@
assert( rdr );
// PDG
- mcp->setPDG( rdr->pid( ihep ) );
+ int pdgid = rdr->pid( ihep );
+ mcp->setPDG(pdgid);
+
+ G4ParticleDefinition* pdef = G4ParticleTable::GetParticleTable()->FindParticle(pdgid);
+
+#ifdef SLIC_VERBOSE
+ if ( verbose() > 3 ) {
+ if ( pdef != 0 ) {
+ cout << "found pdef for particle <" << pdef->GetParticleName() << "> with pdgid <" << pdgid << ">" << endl;
+ }
+ else {
+ cout << "no pdef for pdgid <" << pdgid << ">" << endl;
+ }
+ }
+#endif
+
+ if ( pdef != 0 ) {
+ mcp->setCharge( pdef->GetPDGCharge() );
+ }
+ else {
+ mcp->setCharge( NAN );
+ }
// momentum vec
float p[3] = { rdr->Px( ihep ),