00001 // $Header: /cvs/lcd/slic/src/LcioMcpStatusSetter.cc,v 1.5 2008/09/10 00:04:58 jeremy Exp $ 00002 #include "LcioMcpStatusSetter.hh" 00003 00004 // slic 00005 #include "Trajectory.hh" 00006 #include "EventSourceManager.hh" 00007 00008 using IMPL::MCParticleImpl; 00009 using EVENT::MCParticle; 00010 00011 namespace slic 00012 { 00013 IMPL::MCParticleImpl* LcioMcpStatusSetter::setMcpStatusCodesFromTrajectory(Trajectory* trj, 00014 MCParticleImpl* mcp) 00015 { 00016 // set vertexIsNotEndOfParent flag 00017 LcioMcpStatusSetter::setVertexIsNotEndpointOfParentFlag( trj, mcp ); 00018 00019 // set final status flags 00020 LcioMcpStatusSetter::setFinalStatusFlags( trj, mcp ); 00021 00022 // set backscatter flag 00023 LcioMcpStatusSetter::setBackscatterFlag( trj, mcp ); 00024 00025 // For GPS source, set generator status to FS for trajectories without parents, 00026 // i.e. the parent track ID is 0. 00027 if (EventSourceManager::instance()->getCurrentSourceType() == 00028 EventSourceManager::eGPS) { 00029 if (trj->GetParentID() == 0) { 00030 mcp->setGeneratorStatus(1); 00031 } 00032 } 00033 00034 // return the MCP 00035 return mcp; 00036 } 00037 00038 void LcioMcpStatusSetter::setBackscatterFlag(Trajectory* trj, 00039 IMPL::MCParticleImpl* mcp) 00040 { 00041 if ( trj->getBackscatter() ) { 00042 mcp->setBackscatter( true ); 00043 } 00044 } 00045 00046 void LcioMcpStatusSetter::setVertexIsNotEndpointOfParentFlag(Trajectory* trj, 00047 MCParticleImpl* mcp) 00048 { 00049 mcp->setVertexIsNotEndpointOfParent( trj->getVertexIsNotEndpointOfParent() ); 00050 } 00051 00052 void LcioMcpStatusSetter::setCreatedInSimulationFlag(Trajectory* trj, 00053 IMPL::MCParticleImpl* mcp) 00054 { 00055 if ( trj->getCreatedInSimulation() ) { 00056 mcp->setGeneratorStatus( 0 ); 00057 mcp->setCreatedInSimulation( true ); 00058 } 00059 else { 00060 mcp->setCreatedInSimulation( false ); 00061 } 00062 } 00063 00064 void LcioMcpStatusSetter::setFinalStatusFlags(Trajectory* trj, 00065 IMPL::MCParticleImpl* mcp) 00066 { 00067 // set final status flags 00068 Trajectory::EFinalStatus trjFinalStatus = trj->getFinalStatus(); 00069 switch ( trjFinalStatus ) { 00070 00071 case Trajectory::eDecayedInTracker: 00072 mcp->setDecayedInTracker( true ); 00073 break; 00074 00075 case Trajectory::eLeftDetector: 00076 mcp->setHasLeftDetector( true ); 00077 break; 00078 00079 case Trajectory::eStopped: 00080 mcp->setStopped( true ); 00081 break; 00082 00083 case Trajectory::eDecayedInCalorimeter: 00084 mcp->setDecayedInCalorimeter( true ); 00085 break; 00086 00087 case Trajectory::eUnset: 00088 break; 00089 00090 default: 00091 break; 00092 } 00093 } 00094 00095 void LcioMcpStatusSetter::setGeneratorStatus(MCParticle* mcpInit, MCParticleImpl* mcp) 00096 { 00097 // set generator status if initial exists 00098 if ( mcpInit ) { 00099 00100 // if init particle, this was not created in sim 00101 mcp->setCreatedInSimulation( false ); 00102 00103 // copy gen status from initial 00104 mcp->setGeneratorStatus( mcpInit->getGeneratorStatus() ); 00105 } 00106 // no initial -> created in sim 00107 else { 00108 mcp->setCreatedInSimulation( true ); 00109 mcp->setGeneratorStatus( 0 ); 00110 } 00111 } 00112 }
1.5.4