#include <TrackMCTools/TrackSelector.h>
Inheritance diagram for TrackSelector:
Public Member Functions | |
TrackSelector (const std::string &type, const std::string &name, const IInterface *parent) | |
Constructor. | |
virtual | ~TrackSelector () |
Destructor. | |
virtual StatusCode | initialize () |
Tool initialization. | |
virtual bool | select (Track *track) const |
virtual bool | select (MCParticle *mcParticle) |
virtual bool | selectByTrackType (Track *track) const |
virtual bool | selectByTrackType (MCParticle *mcParticle) |
virtual unsigned int | trackType (MCParticle *mcPart) |
virtual StatusCode | setTrackType (MCParticle *mcPart, Track *&track) |
Private Attributes | |
ITrackReconstructible * | m_mcParticleJudge |
Pointer to MCParticle judge. | |
unsigned int | m_previousTrackType |
Previous track type identifier. | |
MCParticle * | m_previousMCParticle |
Previously requested MCParticle. | |
bool | m_uniqueFlag |
To monitor unique tracks only. | |
bool | m_validFlag |
To monitor only correctly fitted tracks. | |
double | m_minP |
minimum momentum for the tracks | |
double | m_maxP |
maximum momentum for the tracks | |
std::vector< int > | m_tracktypes |
std::string | m_mcParticleJudgeName |
Name of the tool to decide which MCParticles should have been found. |
2005-05-04 : Eduardo Rodrigues (adaptations to new track event model)
Definition at line 40 of file TrackSelector.h.
|
Constructor.
Definition at line 30 of file TrackSelector.cpp. References m_maxP, m_mcParticleJudgeName, m_minP, m_tracktypes, m_uniqueFlag, and m_validFlag. 00033 : GaudiTool ( type, name , parent ) 00034 , m_mcParticleJudge( 0 ) 00035 , m_previousTrackType( TrackKeys::TypeUnknown ) 00036 , m_previousMCParticle( 0 ) 00037 { 00038 // interfaces 00039 declareInterface<ITrackSelector>(this); 00040 // job options 00041 declareProperty( "UniqueFlag", m_uniqueFlag = true ); 00042 declareProperty( "ValidFlag", m_validFlag = true ); 00043 declareProperty( "MinP", m_minP = 0.0*GeV ); 00044 declareProperty( "MaxP", m_maxP = 100.0*TeV ); 00045 declareProperty( "TrackTypes", m_tracktypes ); 00046 declareProperty( "MCParticles", m_mcParticleJudgeName = "TrackAcceptance" ); 00047 }
|
|
Destructor.
Definition at line 52 of file TrackSelector.cpp. 00052 {};
|
|
Tool initialization.
Definition at line 57 of file TrackSelector.cpp. References m_mcParticleJudge, and m_mcParticleJudgeName. 00058 { 00059 StatusCode sc = GaudiTool::initialize(); // must be executed first 00060 if ( sc.isFailure() ) return sc; 00061 00062 debug() << "==> Initialize" << endreq; 00063 00064 // Retrieve the reconstructibility tool 00065 m_mcParticleJudge = tool<ITrackReconstructible>( m_mcParticleJudgeName ); 00066 00067 return StatusCode::SUCCESS; 00068 }
|
|
Select the MCParticle.
Implements ITrackSelector. Definition at line 93 of file TrackSelector.cpp. References m_maxP, and selectByTrackType(). 00094 { 00095 bool selected = true; 00096 00097 // Check the momentum of MCParticle 00098 double momentum = mcParticle -> momentum().vect().mag(); 00099 if ( momentum < m_minP || momentum > m_maxP ) selected = false; 00100 00101 // Check if the MCParticle is of the requested type 00102 if ( !selectByTrackType( mcParticle ) ) selected = false; 00103 00104 return selected; 00105 }
|
|
Select the Track.
Implements ITrackSelector. Definition at line 73 of file TrackSelector.cpp. References m_maxP, selectByTrackType(), and str::states(). 00074 { 00075 bool selected = true; 00076 00077 // Check the momentum of track (at first state) 00078 State* firstState = *( track -> states().begin() ); 00079 if ( firstState ) { 00080 double momentum = firstState -> p(); 00081 if ( momentum < m_minP || momentum > m_maxP ) selected = false; 00082 } 00083 00084 // Check if the track is of the requested type 00085 if ( !selectByTrackType( track ) ) selected = false; 00086 00087 return selected; 00088 }
|
|
Select the MCParticle only by track type.
Implements ITrackSelector. Definition at line 135 of file TrackSelector.cpp. References m_tracktypes, and trackType(). 00136 { 00137 bool selected = true; 00138 00139 // Check if the MCParticle is of the requested type 00140 int tracktype = trackType( mcParticle ); 00141 if ( tracktype == TrackKeys::TypeUnknown || 00142 ( !m_tracktypes.empty() && 00143 std::find( m_tracktypes.begin(), m_tracktypes.end(), 00144 tracktype ) == m_tracktypes.end() ) ) selected = false; 00145 00146 return selected; 00147 }
|
|
Select the Track only by track type, unique- and valid-flag .
Implements ITrackSelector. Definition at line 110 of file TrackSelector.cpp. References m_tracktypes, m_uniqueFlag, and m_validFlag. Referenced by select(). 00111 { 00112 bool selected = true; 00113 00114 // Check the Unique flag 00115 if ( m_uniqueFlag && !( track->checkFlag( TrackKeys::Unique ) ) ) 00116 selected = false; 00117 00118 // Check the validity flag 00119 if ( m_validFlag && !( track->checkFlag( TrackKeys::Valid ) ) ) 00120 selected = false; 00121 00122 // Check if the track is of the requested type 00123 int tracktype = track -> type(); 00124 if ( tracktype == TrackKeys::TypeUnknown || 00125 ( !m_tracktypes.empty() && 00126 std::find( m_tracktypes.begin(), m_tracktypes.end(), 00127 tracktype ) == m_tracktypes.end() ) ) selected = false; 00128 00129 return selected; 00130 }
|
|
Set the track type of a Track with an MCParticle's type.
Implements ITrackSelector. Definition at line 183 of file TrackSelector.cpp. References m_previousMCParticle, m_previousTrackType, and trackType(). 00185 { 00186 unsigned int tracktype = TrackKeys::TypeUnknown; 00187 00188 if ( mcPart == m_previousMCParticle ) { 00189 tracktype = m_previousTrackType; 00190 } 00191 else { 00192 tracktype = trackType( mcPart ); 00193 } 00194 00195 track -> setType ( tracktype ); 00196 if ( TrackKeys::TypeUnknown == tracktype ) return StatusCode::FAILURE; 00197 else return StatusCode::SUCCESS; 00198 }
|
|
Get the track type identifyer of the MCParticle.
Implements ITrackSelector. Definition at line 152 of file TrackSelector.cpp. References m_mcParticleJudge, m_previousMCParticle, and m_previousTrackType. Referenced by selectByTrackType(), and setTrackType(). 00153 { 00154 bool hasVelo = m_mcParticleJudge -> hasVelo( mcPart ); 00155 bool hasSeed = m_mcParticleJudge -> hasSeed( mcPart ); 00156 bool hasTT = m_mcParticleJudge -> hasTT( mcPart ); 00157 00158 const HepLorentzVector fourMom = mcPart->momentum(); 00159 00160 unsigned int tracktype = TrackKeys::TypeUnknown; 00161 00162 if ( hasVelo && hasSeed ) { // long track 00163 tracktype = TrackKeys::Long; 00164 } else if ( hasVelo && hasTT ) { // upstream track 00165 tracktype = TrackKeys::Upstream; 00166 } else if ( hasSeed && hasTT ) { // downstream track 00167 tracktype = TrackKeys::Downstream; 00168 } else if ( hasVelo ) { // velo track 00169 tracktype = TrackKeys::Velo; 00170 } else if ( hasSeed ) { // seed track 00171 tracktype = TrackKeys::Ttrack; 00172 } 00173 00174 m_previousTrackType = tracktype; 00175 m_previousMCParticle = mcPart; 00176 00177 return tracktype; 00178 }
|
|
maximum momentum for the tracks
Definition at line 107 of file TrackSelector.h. Referenced by select(), and TrackSelector(). |
|
Pointer to MCParticle judge.
Definition at line 97 of file TrackSelector.h. Referenced by initialize(), and trackType(). |
|
Name of the tool to decide which MCParticles should have been found.
Definition at line 110 of file TrackSelector.h. Referenced by initialize(), and TrackSelector(). |
|
minimum momentum for the tracks
Definition at line 106 of file TrackSelector.h. Referenced by TrackSelector(). |
|
Previously requested MCParticle.
Definition at line 101 of file TrackSelector.h. Referenced by setTrackType(), and trackType(). |
|
Previous track type identifier.
Definition at line 100 of file TrackSelector.h. Referenced by setTrackType(), and trackType(). |
|
Track types of the monitored tracks Definition at line 108 of file TrackSelector.h. Referenced by selectByTrackType(), and TrackSelector(). |
|
To monitor unique tracks only.
Definition at line 104 of file TrackSelector.h. Referenced by selectByTrackType(), and TrackSelector(). |
|
To monitor only correctly fitted tracks.
Definition at line 105 of file TrackSelector.h. Referenced by selectByTrackType(), and TrackSelector(). |