#include <TTUTrackingAlg.h>
Classes | |
struct | CompareMechanism |
struct | CompareSeeds |
class | Seed |
struct | SortByLayer |
struct | SortBySector |
class | Track |
Public Types | |
typedef std::vector< Seed * > ::iterator | SeedsItr |
typedef std::vector< Track * > ::iterator | TracksItr |
Public Member Functions | |
bool | process (const TTUInput &) |
void | setBoardSpecs (const TTUBoardSpecs::TTUBoardConfig &) |
void | setMinTrkLength (int val) |
TTUTrackingAlg () | |
Standard constructor. | |
virtual | ~TTUTrackingAlg () |
Destructor. | |
Private Member Functions | |
void | alignTracks () |
void | cleanUp () |
int | executeTracker (Track *, std::vector< Seed * > &) |
void | filter (Track *, std::vector< Seed * > &) |
void | findNeighbors (Seed *, std::vector< Seed * > &) |
void | ghostBuster (Track *) |
void | print (const std::vector< Seed * > &seeds) |
void | runSeedBuster (const TTUInput &) |
Private Attributes | |
bool | m_debug |
std::vector< Seed * > | m_initialseeds |
int | m_mintrklength |
int | m_SEscanorder [12] |
int | m_STscanorder [6] |
std::vector< Track * > | m_tracks |
Tracking Algorithm [ref 2]
ref 2: "A configurable Tracking Algorithm to detect cosmic muon tracks for the CMS-RPC based Technical Trigger", R.T.Rajan et al
email: aosorio@uniandes.edu.co
Definition at line 26 of file TTUTrackingAlg.h.
typedef std::vector<Seed*>::iterator TTUTrackingAlg::SeedsItr |
Definition at line 119 of file TTUTrackingAlg.h.
typedef std::vector<Track*>::iterator TTUTrackingAlg::TracksItr |
Definition at line 120 of file TTUTrackingAlg.h.
TTUTrackingAlg::TTUTrackingAlg | ( | ) |
Standard constructor.
Definition at line 19 of file TTUTrackingAlg.cc.
References i, m_debug, m_mintrklength, m_SEscanorder, m_STscanorder, and TTULogic::m_triggersignal.
{ int StOrder[6]={6,5,4,3,2,1}; int SeOrder[12]={4,5,3,6,2,7,1,8,12,9,11,10}; for(int i=0; i < 6; ++i) { m_STscanorder[i] = StOrder[i]; m_SEscanorder[i*2] = SeOrder[i*2]; m_SEscanorder[(i*2)+1] = SeOrder[(i*2)+1]; } m_triggersignal = false; m_mintrklength = 4; m_debug = false; }
TTUTrackingAlg::~TTUTrackingAlg | ( | ) | [virtual] |
Destructor.
Definition at line 41 of file TTUTrackingAlg.cc.
References m_initialseeds, and m_tracks.
{ TracksItr itr1; for (itr1=m_tracks.begin(); itr1!=m_tracks.end(); ++itr1) delete (*itr1); SeedsItr itr2; for (itr2=m_initialseeds.begin(); itr2!=m_initialseeds.end(); ++itr2) delete (*itr2); //m_tracks.clear(); //m_initialseeds.clear(); }
void TTUTrackingAlg::alignTracks | ( | ) | [private] |
Definition at line 292 of file TTUTrackingAlg.cc.
References compare_using_db::compare, gather_cfg::cout, m_debug, m_tracks, and python::multivaluedict::sort().
Referenced by process().
{ TracksItr itr; CompareMechanism<Track> compare; std::sort( m_tracks.begin(), m_tracks.end(), compare ); std::reverse( m_tracks.begin(), m_tracks.end() ); if( m_debug ) { for( itr = m_tracks.begin(); itr != m_tracks.end(); ++itr ) std::cout << "Align tracks> trk len: " << (*itr)->length() << " "; std::cout << std::endl; } }
void TTUTrackingAlg::cleanUp | ( | ) | [private] |
Definition at line 309 of file TTUTrackingAlg.cc.
References m_initialseeds, and m_tracks.
Referenced by process().
{ TracksItr itr1; for (itr1=m_tracks.begin(); itr1!=m_tracks.end(); ++itr1) delete (*itr1); SeedsItr itr2; for (itr2=m_initialseeds.begin(); itr2!=m_initialseeds.end(); ++itr2) delete (*itr2); m_tracks.clear(); m_initialseeds.clear(); }
Definition at line 181 of file TTUTrackingAlg.cc.
References TTUTrackingAlg::Track::add(), gather_cfg::cout, filter(), findNeighbors(), and m_debug.
Referenced by process().
{ if ( m_debug ) std::cout << "executeTracker: " << neighbors.size() << std::endl; //... SeedsItr _itr = neighbors.begin(); while( _itr != neighbors.end() ) { _trk->add( (*_itr) ); std::vector<Seed*> _nextneighbors; findNeighbors( (*_itr) , _nextneighbors ); filter( _trk, _nextneighbors ); if ( _nextneighbors.size() == 1 ) executeTracker( _trk, _nextneighbors ); //... bifurcation not considered at the moment ++_itr; } //... return 1; }
Definition at line 251 of file TTUTrackingAlg.cc.
References gather_cfg::cout, spr::find(), m_debug, and TTUTrackingAlg::Track::m_seeds.
Referenced by executeTracker(), and process().
{ //... filter: removes from neighbors list, seeds already present //... in tracks SeedsItr _itr; for( _itr = _trk->m_seeds.begin();_itr != _trk->m_seeds.end(); ++_itr) { SeedsItr _isalready = std::find( _nbrs.begin(),_nbrs.end(), (*_itr) ); if( _isalready != _nbrs.end() ) { _nbrs.erase( _isalready ); if( m_debug ) std::cout << "removing ..." << std::endl; } } }
Definition at line 217 of file TTUTrackingAlg.cc.
References abs, gather_cfg::cout, m_debug, m_initialseeds, TTUTrackingAlg::Seed::m_sectorId, and TTUTrackingAlg::Seed::m_stationId.
Referenced by executeTracker(), and process().
{ neighbors.clear(); int _xo = _seed->m_sectorId; int _yo = _seed->m_stationId; if( m_debug ) std::cout << "X: " << _xo+1 << " Y: " << _yo+1 << std::endl; SeedsItr _itr = m_initialseeds.begin(); while( _itr != m_initialseeds.end() ) { int _difx = std::abs( _xo - (*_itr)->m_sectorId ); int _dify = std::abs( _yo - (*_itr)->m_stationId ); if (m_debug) std::cout << "difference (x,y): " << _difx << "," << _dify << "\t"; if ( _difx == 11 ) _difx = 1; if ( ((_difx == 1) && (_dify == 1)) || ((_difx == 1) && (_dify == 0)) || ((_difx == 0) && (_dify == 1)) ) neighbors.push_back( (*_itr) ); ++_itr; } if (m_debug) std::cout << std::endl; }
void TTUTrackingAlg::ghostBuster | ( | Track * | currentTrk | ) | [private] |
Definition at line 274 of file TTUTrackingAlg.cc.
References TTUTrackingAlg::Track::m_seeds, python::multivaluedict::sort(), and TTUTrackingAlg::Track::updateTrkLength().
Referenced by process().
{ //...do a final check to make sure there are no repeated seeds in track std::vector<Seed*>::iterator seedItr; std::sort( currentTrk->m_seeds.begin(), currentTrk->m_seeds.end(), SortBySector() ); std::sort( currentTrk->m_seeds.begin(), currentTrk->m_seeds.end(), SortByLayer() ); seedItr = std::unique (currentTrk->m_seeds.begin(), currentTrk->m_seeds.end(), CompareSeeds() ); currentTrk->m_seeds.resize(seedItr - currentTrk->m_seeds.begin()); currentTrk->updateTrkLength(); }
void TTUTrackingAlg::print | ( | const std::vector< Seed * > & | seeds | ) | [inline, private] |
Definition at line 187 of file TTUTrackingAlg.h.
References gather_cfg::cout.
bool TTUTrackingAlg::process | ( | const TTUInput & | inmap | ) | [virtual] |
Implements TTULogic.
Definition at line 64 of file TTUTrackingAlg.cc.
References TTUTrackingAlg::Track::add(), TTUTrackingAlg::Track::addnone(), alignTracks(), cleanUp(), gather_cfg::cout, executeTracker(), filter(), findNeighbors(), ghostBuster(), TTUInput::m_bx, m_debug, m_initialseeds, m_mintrklength, m_tracks, TTULogic::m_triggersignal, and runSeedBuster().
Referenced by TTUTwoORLogic::process().
{ if( m_debug) std::cout << "TTUTrackingAlg>process() starts + bx= " << inmap.m_bx << std::endl; m_triggersignal = false; Track * initTrk = new Track(); //. runSeedBuster( inmap ); if ( m_initialseeds.size() > 0 && m_initialseeds.size() < 20 ) // if too much hits, then cannot process initTrk->add( m_initialseeds[0] ); else { initTrk->addnone(); if( m_debug) std::cout << "TTUTrackingAlg>process() ends: no initialseeds" << std::endl; return false; } m_tracks.push_back( initTrk ); //.. SeedsItr _seed = m_initialseeds.begin(); std::vector<Seed*> neighbors; while ( _seed != m_initialseeds.end() ) { findNeighbors( (*_seed) , neighbors ); filter( initTrk, neighbors ); executeTracker( initTrk, neighbors ); ghostBuster( initTrk ); ++_seed; if ( _seed != m_initialseeds.end() ) { initTrk = new Track(); initTrk->add((*_seed)); m_tracks.push_back( initTrk ); } } TracksItr itr; if( m_debug) { std::cout << "Total tracks: " << m_tracks.size() << std::endl; for( itr = m_tracks.begin(); itr != m_tracks.end(); ++itr) std::cout << "length: " << (*itr)->length() << '\t'; std::cout << std::endl; } //... alignTracks(); //.... Look at the first track and compare its track length int tracklen(0); itr = m_tracks.begin(); if ( itr != m_tracks.end() ) tracklen = (*itr)->length(); if ( tracklen >= m_mintrklength ) m_triggersignal = true; if( m_debug ) { std::cout << "TTUTrackingAlg> trk len= " << tracklen << '\t' << "triggered: " << m_triggersignal << std::endl; } //..... Clean up for next run cleanUp(); //....................................................... if( m_debug ) std::cout << "TTUTrackingAlg>process ends" << std::endl; return true; }
void TTUTrackingAlg::runSeedBuster | ( | const TTUInput & | inmap | ) | [private] |
Definition at line 151 of file TTUTrackingAlg.cc.
References gather_cfg::cout, i, UserOptions_cff::idx, TTUInput::input_sec, gen::k, m_debug, m_initialseeds, m_SEscanorder, m_STscanorder, and relativeConstraints::station.
Referenced by process().
{ int idx(0); int idy(0); for(int i=0; i < 12; ++i) { idx = (m_SEscanorder[i] - 1); std::bitset<6> station = inmap.input_sec[idx]; if ( ! station.any() ) continue; for(int k=0; k < 6; ++k ) { idy = (m_STscanorder[k] - 1); bool _hit = station[idy]; if ( _hit ) { Seed *_seed = new Seed( idx, idy, 0 ); m_initialseeds.push_back(_seed); } } } //... if ( m_debug ) std::cout << "SeedBuster: " << m_initialseeds.size() << std::endl; }
void TTUTrackingAlg::setBoardSpecs | ( | const TTUBoardSpecs::TTUBoardConfig & | boardspecs | ) | [virtual] |
Implements TTULogic.
Definition at line 57 of file TTUTrackingAlg.cc.
References m_mintrklength, and TTUBoardSpecs::TTUBoardConfig::m_TrackLength.
Referenced by TTUTwoORLogic::setBoardSpecs().
{ m_mintrklength = boardspecs.m_TrackLength; }
void TTUTrackingAlg::setMinTrkLength | ( | int | val | ) | [inline] |
Definition at line 122 of file TTUTrackingAlg.h.
References m_mintrklength.
{ m_mintrklength = val; };
bool TTUTrackingAlg::m_debug [private] |
Definition at line 193 of file TTUTrackingAlg.h.
Referenced by alignTracks(), executeTracker(), filter(), findNeighbors(), process(), runSeedBuster(), and TTUTrackingAlg().
std::vector<Seed*> TTUTrackingAlg::m_initialseeds [private] |
Definition at line 159 of file TTUTrackingAlg.h.
Referenced by cleanUp(), findNeighbors(), process(), runSeedBuster(), and ~TTUTrackingAlg().
int TTUTrackingAlg::m_mintrklength [private] |
Definition at line 155 of file TTUTrackingAlg.h.
Referenced by process(), setBoardSpecs(), setMinTrkLength(), and TTUTrackingAlg().
int TTUTrackingAlg::m_SEscanorder[12] [private] |
Definition at line 153 of file TTUTrackingAlg.h.
Referenced by runSeedBuster(), and TTUTrackingAlg().
int TTUTrackingAlg::m_STscanorder[6] [private] |
Definition at line 151 of file TTUTrackingAlg.h.
Referenced by runSeedBuster(), and TTUTrackingAlg().
std::vector<Track*> TTUTrackingAlg::m_tracks [private] |
Definition at line 157 of file TTUTrackingAlg.h.
Referenced by alignTracks(), cleanUp(), process(), and ~TTUTrackingAlg().