Print

Print


Commit in slic/src on MAIN
LcioMcpFactory.cc+11-31.5 -> 1.6
Add check for invalid charge to function that creates MCParticle from primary.

slic/src
LcioMcpFactory.cc 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- LcioMcpFactory.cc	21 Sep 2005 22:54:19 -0000	1.5
+++ LcioMcpFactory.cc	7 Oct 2005 21:08:51 -0000	1.6
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpFactory.cc,v 1.5 2005/09/21 22:54:19 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpFactory.cc,v 1.6 2005/10/07 21:08:51 jeremy Exp $
 #include "LcioMcpFactory.hh"
 
 // slic
@@ -26,6 +26,8 @@
 using EVENT::MCParticle;
 using IMPL::MCParticleImpl;
 
+#include <iostream>
+
 namespace slic
 {
 
@@ -296,8 +298,14 @@
     // mass
     mcp->setMass( primary->GetMass() / GeV );
 
-    // charge
-    mcp->setCharge( primary->GetCharge() );
+    /* Invalid charge from primary? --> Set to NaN in MCParticle. */
+    if ( std::isinf( primary->GetCharge() )) {
+      mcp->setCharge( LcioMcpManager::NO_CHARGE_FLAG );
+    }
+    /* Otherwise, the primary itself has a valid charge.  (Can this happen???) */
+    else {
+      mcp->setCharge( primary->GetCharge() );
+    }
 
     return mcp;
   }
CVSspam 0.2.8