Print

Print


Commit in slic on MAIN
include/LcioMcpStatusSetter.hh+30added 1.1
       /LcioMcpManager.hh-101.35 -> 1.36
src/LcioMcpStatusSetter.cc+101added 1.1
   /LcioMcpManager.cc+6-961.48 -> 1.49
+137-106
2 added + 2 modified, total 4 files
Refactored setting of MCP statuses into separate class.

slic/include
LcioMcpStatusSetter.hh added at 1.1
diff -N LcioMcpStatusSetter.hh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LcioMcpStatusSetter.hh	14 Sep 2005 18:03:06 -0000	1.1
@@ -0,0 +1,30 @@
+#ifndef LcioMcpStatusSetter_h
+#define LcioMcpStatusSetter_h 1
+
+#include "EVENT/MCParticle.h"
+#include "IMPL/MCParticleImpl.h"
+
+namespace slic
+{
+  class Trajectory;
+
+  class LcioMcpStatusSetter
+  {
+  private:
+    LcioMcpStatusSetter() {}
+
+  public:
+    // set Mcp status codes from trajectory
+    static IMPL::MCParticleImpl* setMcpStatusCodesFromTrajectory( Trajectory*, IMPL::MCParticleImpl* );
+    static void setGeneratorStatus(EVENT::MCParticle* mcpInit, IMPL::MCParticleImpl* mcp);
+
+  private:
+    // check and set MCP flags
+    static void setVertexIsNotEndpointOfParentFlag( Trajectory*, IMPL::MCParticleImpl* );
+    static void setFinalStatusFlags( Trajectory*, IMPL::MCParticleImpl* );
+    static void setCreatedInSimulationFlag( Trajectory*, IMPL::MCParticleImpl* );
+    static void setBackscatterFlag( Trajectory*, IMPL::MCParticleImpl* );
+  };
+}
+
+#endif

slic/include
LcioMcpManager.hh 1.35 -> 1.36
diff -u -r1.35 -r1.36
--- LcioMcpManager.hh	27 Jun 2005 19:17:37 -0000	1.35
+++ LcioMcpManager.hh	14 Sep 2005 18:03:06 -0000	1.36
@@ -130,9 +130,6 @@
     // convert to CLHEP vector and return vertex.isNear(parEndpoint)
     G4bool isNear(const double* vertex, const double* parEndpoint);
 
-    // set Mcp status codes from trajectory
-    IMPL::MCParticleImpl* setMcpStatusCodesFromTrajectory( Trajectory*, IMPL::MCParticleImpl* );
-
     // find a dau Mcp given a G4PrimaryParticle dau
     EVENT::MCParticle* findDaughterMcpFromPrimary(EVENT::MCParticle* mcpInit,
 						  G4PrimaryParticle* primary);
@@ -193,13 +190,6 @@
     // add daughters to a MCP based on associated intial MCP from StdHep
     void addMcpDaughtersFromInitial( IMPL::MCParticleImpl* mcpNew, EVENT::MCParticle* mcpInit );
 
-    // check and set MCP flags
-    void setVertexIsNotEndpointOfParentFlag( Trajectory*, IMPL::MCParticleImpl* );
-    void setFinalStatusFlags( Trajectory*, IMPL::MCParticleImpl* );
-    void setCreatedInSimulationFlag( Trajectory*, IMPL::MCParticleImpl* );
-    void setBackscatterFlag( Trajectory*, IMPL::MCParticleImpl* );
-    void setGeneratorStatus(EVENT::MCParticle* mcpInit, IMPL::MCParticleImpl* mcp);
-
     // clear the maps
     void clearMaps();
 

slic/src
LcioMcpStatusSetter.cc added at 1.1
diff -N LcioMcpStatusSetter.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LcioMcpStatusSetter.cc	14 Sep 2005 18:03:07 -0000	1.1
@@ -0,0 +1,101 @@
+// $Header: /cvs/lcd/slic/src/LcioMcpStatusSetter.cc,v 1.1 2005/09/14 18:03:07 jeremy Exp $
+#include "LcioMcpStatusSetter.hh"
+
+#include "Trajectory.hh"
+
+using IMPL::MCParticleImpl;
+using EVENT::MCParticle;
+
+namespace slic
+{
+  IMPL::MCParticleImpl* LcioMcpStatusSetter::setMcpStatusCodesFromTrajectory(Trajectory* trj,
+									 MCParticleImpl* mcp)
+  {
+    // set vertexIsNotEndOfParent flag
+    LcioMcpStatusSetter::setVertexIsNotEndpointOfParentFlag( trj, mcp );
+
+    // set final status flags
+    LcioMcpStatusSetter::setFinalStatusFlags( trj, mcp );
+
+    // set backscatter flag
+    LcioMcpStatusSetter::setBackscatterFlag( trj, mcp );
+
+    // return the MCP
+    return mcp;
+  }
+
+  void LcioMcpStatusSetter::setBackscatterFlag(Trajectory* trj,
+					   IMPL::MCParticleImpl* mcp)
+  {
+    if ( trj->getBackscatter() ) {
+      mcp->setBackscatter( true );
+    }
+  }
+
+  void LcioMcpStatusSetter::setVertexIsNotEndpointOfParentFlag(Trajectory* trj,
+							   MCParticleImpl* mcp)
+  {
+    mcp->setVertexIsNotEndpointOfParent( trj->getVertexIsNotEndpointOfParent() );
+  }
+
+  void LcioMcpStatusSetter::setCreatedInSimulationFlag(Trajectory* trj,
+						   IMPL::MCParticleImpl* mcp)
+  {
+    if ( trj->getCreatedInSimulation() ) {
+      mcp->setGeneratorStatus( 0 );
+      mcp->setCreatedInSimulation( true );
+    }
+    else {
+      mcp->setCreatedInSimulation( false );
+    }
+  }
+
+  void LcioMcpStatusSetter::setFinalStatusFlags(Trajectory* trj,
+					    IMPL::MCParticleImpl* mcp)
+  {
+    // set final status flags
+    Trajectory::EFinalStatus trjFinalStatus = trj->getFinalStatus();
+    switch ( trjFinalStatus ) {
+
+    case Trajectory::eDecayedInTracker:
+      mcp->setDecayedInTracker( true );
+      break;
+
+    case Trajectory::eLeftDetector:
+      mcp->setHasLeftDetector( true );
+      break;
+
+    case Trajectory::eStopped:
+      mcp->setStopped( true );
+      break;
+
+    case Trajectory::eDecayedInCalorimeter:
+      mcp->setDecayedInCalorimeter( true );
+      break;
+
+    case Trajectory::eUnset:
+      break;
+
+    default:
+      break;
+    }
+  }
+
+  void LcioMcpStatusSetter::setGeneratorStatus(MCParticle* mcpInit, MCParticleImpl* mcp)
+  {
+    // set generator status if initial exists
+    if ( mcpInit ) {
+
+      // if init particle, this was not created in sim
+      mcp->setCreatedInSimulation( false );
+
+      // copy gen status from initial
+      mcp->setGeneratorStatus( mcpInit->getGeneratorStatus() );
+    }
+    // no initial -> created in sim
+    else {
+      mcp->setCreatedInSimulation( true );
+      mcp->setGeneratorStatus( 0 );
+    }
+  }
+}

slic/src
LcioMcpManager.cc 1.48 -> 1.49
diff -u -r1.48 -r1.49
--- LcioMcpManager.cc	27 May 2005 22:46:59 -0000	1.48
+++ LcioMcpManager.cc	14 Sep 2005 18:03:06 -0000	1.49
@@ -1,11 +1,12 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpManager.cc,v 1.48 2005/05/27 22:46:59 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpManager.cc,v 1.49 2005/09/14 18:03:06 jeremy Exp $
 #include "LcioMcpManager.hh"
 
 // SLIC
-#include "TrajectoryManager.hh"
-#include "PrimaryGeneratorAction.hh"
 #include "LcioMcpMessenger.hh"
 #include "LcioManager.hh"
+#include "LcioMcpStatusSetter.hh"
+#include "TrajectoryManager.hh"
+#include "PrimaryGeneratorAction.hh"
 #include "EventSourceManager.hh"
 
 // LCDD
@@ -227,102 +228,11 @@
     addTrackIDToMcpLink( trj->GetTrackID(), mcp );
 
     // set status codes from trajectory info (with no dep on any associated Mcps)
-    setMcpStatusCodesFromTrajectory( trj, mcp );
-
-    return mcp;
-  }
-
-  IMPL::MCParticleImpl* LcioMcpManager::setMcpStatusCodesFromTrajectory(Trajectory* trj,
-									MCParticleImpl* mcp)
-  {
-    // set vertexIsNotEndOfParent flag
-    setVertexIsNotEndpointOfParentFlag( trj, mcp );
-
-    // set final status flags
-    setFinalStatusFlags( trj, mcp );
-
-    // set backscatter flag
-    setBackscatterFlag( trj, mcp );
+    LcioMcpStatusSetter::setMcpStatusCodesFromTrajectory( trj, mcp );
 
-    // return the MCP
     return mcp;
   }
 
-  void LcioMcpManager::setBackscatterFlag(Trajectory* trj,
-					  IMPL::MCParticleImpl* mcp)
-  {
-    if ( trj->getBackscatter() ) {
-      mcp->setBackscatter( true );
-    }
-  }
-
-  void LcioMcpManager::setCreatedInSimulationFlag(Trajectory* trj,
-						  IMPL::MCParticleImpl* mcp)
-  {
-    if ( trj->getCreatedInSimulation() ) {
-      mcp->setGeneratorStatus( 0 );
-      mcp->setCreatedInSimulation( true );
-    }
-    else {
-      mcp->setCreatedInSimulation( false );
-    }
-  }
-
-  void LcioMcpManager::setFinalStatusFlags(Trajectory* trj,
-					   IMPL::MCParticleImpl* mcp)
-  {
-    // set final status flags
-    Trajectory::EFinalStatus trjFinalStatus = trj->getFinalStatus();
-    switch ( trjFinalStatus ) {
-
-    case Trajectory::eDecayedInTracker:
-      mcp->setDecayedInTracker( true );
-      break;
-
-    case Trajectory::eLeftDetector:
-      mcp->setHasLeftDetector( true );
-      break;
-
-    case Trajectory::eStopped:
-      mcp->setStopped( true );
-      break;
-
-    case Trajectory::eDecayedInCalorimeter:
-      mcp->setDecayedInCalorimeter( true );
-      break;
-
-    case Trajectory::eUnset:
-      break;
-
-    default:
-      break;
-    }
-  }
-
-  void LcioMcpManager::setVertexIsNotEndpointOfParentFlag(Trajectory* trj,
-							  MCParticleImpl* mcp)
-  {
-    mcp->setVertexIsNotEndpointOfParent( trj->getVertexIsNotEndpointOfParent() );
-  }
-
-  void LcioMcpManager::setGeneratorStatus(MCParticle* mcpInit, MCParticleImpl* mcp)
-  {
-    // set generator status if initial exists
-    if ( mcpInit ) {
-
-      // if init particle, this was not created in sim
-      mcp->setCreatedInSimulation( false );
-
-      // copy gen status from initial
-      mcp->setGeneratorStatus( mcpInit->getGeneratorStatus() );
-    }
-    // no initial -> created in sim
-    else {
-      mcp->setCreatedInSimulation( true );
-      mcp->setGeneratorStatus( 0 );
-    }
-  }
-
   G4bool LcioMcpManager::isNear(const double* vertex, const double* parEndpoint)
   {
     G4ThreeVector vtx( vertex[0], vertex[1], vertex[2] );
@@ -517,7 +427,7 @@
     IMPL::MCParticleImpl* mcp = createMcpFromTrajectory( trj );
 
     // set generator status and created in sim flag
-    setGeneratorStatus( mcpInit, mcp );
+    LcioMcpStatusSetter::setGeneratorStatus( mcpInit, mcp );
 
     // loop over all trajectories to find trajectory daughter
     G4TrajectoryContainer* trjCont = m_currentG4Event->GetTrajectoryContainer();
CVSspam 0.2.8