Print

Print


Commit in slic/src on MAIN
LcioMcpFactory.cc+29-111.17 -> 1.18
change LCIO MCParticle output to use G4 calculated PDG mass for SM particles; extended or susy particles use StdHep mass as the table mass is wrong

slic/src
LcioMcpFactory.cc 1.17 -> 1.18
diff -u -r1.17 -r1.18
--- LcioMcpFactory.cc	8 Apr 2011 20:50:24 -0000	1.17
+++ LcioMcpFactory.cc	27 Apr 2011 20:21:25 -0000	1.18
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpFactory.cc,v 1.17 2011/04/08 20:50:24 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpFactory.cc,v 1.18 2011/04/27 20:21:25 jeremy Exp $
 #include "LcioMcpFactory.hh"
 
 // slic
@@ -80,23 +80,41 @@
         float fmom[3] = { mom.x(), mom.y(), mom.z() };
         mcp->setMomentum( fmom );
 
-        //G4int trackID = trj->GetTrackID();
+        // Get particle def.
+        const G4ParticleDefinition* pdef = trj->GetParticleDefinition();
 
-        // DEBUG stuff
+        // To store mass for new particle.
+        G4double m = 0;
 
+        /* 
+         * For particles from extended particle table supplied by slic, use the StdHep mass instead.
+         * Also, use the StdHep mass for PDG codes Geant4 doesn't know that aren't in particle.tbl.
+         */
+        if (pdef == 0 || (pdef->GetParticleType().compare("extended") == 0 || pdef->GetParticleType().compare("susy") == 0))
+        {
+            // Get the primary particle from the LCIO data map.
+            MCParticle* primaryMcp = LcioMcpManager::instance()->getMaps()->findPrimaryInitialMcpFromTrajectory(trj);
 
-        G4double m = trj->GetParticleDefinition()->GetPDGMass() / GeV;
-
+            // Require that this particle have a matching primary MCParticle to get mass.
+            if (primaryMcp != 0)
+            {
+                m = primaryMcp->getMass();
 #ifdef SLIC_LOG
-        log() << "mass from pdef: " << m << LOG::endl;
+                log() << "mass from primary: " << m << LOG::endl;
 #endif
-
-        MCParticle* primaryMcp = LcioMcpManager::instance()->getMaps()->findPrimaryInitialMcpFromTrajectory(trj);
-        if (primaryMcp != 0)
+            }
+            // Need a primary particle to get mass.
+            else
+            {
+                G4Exception("Could not find required LCIO primary particle.");
+            }
+        }
+        // Use Geant4's mass from the particle definition, which is appropriate for SM particles.
+        else
         {
-            m = primaryMcp->getMass();
+            m = trj->GetParticleDefinition()->GetPDGMass() / GeV;
 #ifdef SLIC_LOG
-            log() << "mass from primary MCP: " << m << LOG::endl;
+            log() << "mass from pdef: " << m << LOG::endl;
 #endif
         }
 
CVSspam 0.2.8