CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TTUTrackingAlg Class Reference

#include <TTUTrackingAlg.h>

Inheritance diagram for TTUTrackingAlg:
TTULogic

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. More...
 
virtual ~TTUTrackingAlg ()
 Destructor. More...
 
- Public Member Functions inherited from TTULogic
virtual void setOption (int option)
 
virtual ~TTULogic ()
 

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
 

Additional Inherited Members

- Public Attributes inherited from TTULogic
int m_option
 
bool m_triggersignal
 

Detailed Description

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

Author
Andres Osorio

email: aosor.nosp@m.io@u.nosp@m.niand.nosp@m.es.e.nosp@m.du.co

Date
2008-10-18

Definition at line 25 of file TTUTrackingAlg.h.

Member Typedef Documentation

typedef std::vector<Seed*>::iterator TTUTrackingAlg::SeedsItr

Definition at line 118 of file TTUTrackingAlg.h.

typedef std::vector<Track*>::iterator TTUTrackingAlg::TracksItr

Definition at line 119 of file TTUTrackingAlg.h.

Constructor & Destructor Documentation

TTUTrackingAlg::TTUTrackingAlg ( )

Standard constructor.

Definition at line 18 of file TTUTrackingAlg.cc.

References i, m_debug, m_mintrklength, m_SEscanorder, m_STscanorder, and TTULogic::m_triggersignal.

18  {
19 
20  int StOrder[6]={6,5,4,3,2,1};
21  int SeOrder[12]={4,5,3,6,2,7,1,8,12,9,11,10};
22 
23  for(int i=0; i < 6; ++i)
24  {
25  m_STscanorder[i] = StOrder[i];
26  m_SEscanorder[i*2] = SeOrder[i*2];
27  m_SEscanorder[(i*2)+1] = SeOrder[(i*2)+1];
28  }
29 
30  m_triggersignal = false;
31  m_mintrklength = 4;
32 
33  m_debug = false;
34 
35 }
int i
Definition: DBlmapReader.cc:9
int m_SEscanorder[12]
bool m_triggersignal
Definition: TTULogic.h:34
TTUTrackingAlg::~TTUTrackingAlg ( )
virtual

Destructor.

Definition at line 40 of file TTUTrackingAlg.cc.

References m_initialseeds, and m_tracks.

40  {
41 
42  TracksItr itr1;
43  for (itr1=m_tracks.begin(); itr1!=m_tracks.end(); ++itr1)
44  delete (*itr1);
45 
46  SeedsItr itr2;
47  for (itr2=m_initialseeds.begin(); itr2!=m_initialseeds.end(); ++itr2)
48  delete (*itr2);
49 
50  //m_tracks.clear();
51  //m_initialseeds.clear();
52 
53 }
std::vector< Seed * > m_initialseeds
std::vector< Seed * >::iterator SeedsItr
std::vector< Track * >::iterator TracksItr
std::vector< Track * > m_tracks

Member Function Documentation

void TTUTrackingAlg::alignTracks ( )
private

Definition at line 291 of file TTUTrackingAlg.cc.

References compare(), gather_cfg::cout, m_debug, m_tracks, and python.multivaluedict::sort().

Referenced by process().

292 {
293 
294  TracksItr itr;
295  CompareMechanism<Track> compare;
296 
297  std::sort( m_tracks.begin(), m_tracks.end(), compare );
298  std::reverse( m_tracks.begin(), m_tracks.end() );
299 
300  if( m_debug ) {
301  for( itr = m_tracks.begin(); itr != m_tracks.end(); ++itr )
302  std::cout << "Align tracks> trk len: " << (*itr)->length() << " ";
303  std::cout << std::endl;
304  }
305 
306 }
void compare(std::vector< std::string > const &old_files, std::string const &old_process, std::vector< std::string > const &new_files, std::string const &new_process, unsigned int max_events, bool ignore_prescales, int verbose)
Definition: hltDiff.cc:506
tuple cout
Definition: gather_cfg.py:121
std::vector< Track * >::iterator TracksItr
std::vector< Track * > m_tracks
void TTUTrackingAlg::cleanUp ( )
private

Definition at line 308 of file TTUTrackingAlg.cc.

References m_initialseeds, and m_tracks.

Referenced by process().

309 {
310 
311  TracksItr itr1;
312  for (itr1=m_tracks.begin(); itr1!=m_tracks.end(); ++itr1)
313  delete (*itr1);
314 
315  SeedsItr itr2;
316  for (itr2=m_initialseeds.begin(); itr2!=m_initialseeds.end(); ++itr2)
317  delete (*itr2);
318 
319  m_tracks.clear();
320  m_initialseeds.clear();
321 
322 }
std::vector< Seed * > m_initialseeds
std::vector< Seed * >::iterator SeedsItr
std::vector< Track * >::iterator TracksItr
std::vector< Track * > m_tracks
int TTUTrackingAlg::executeTracker ( Track _trk,
std::vector< Seed * > &  neighbors 
)
private

Definition at line 180 of file TTUTrackingAlg.cc.

References TTUTrackingAlg::Track::add(), gather_cfg::cout, filter(), findNeighbors(), and m_debug.

Referenced by process().

181 {
182 
183  if ( m_debug ) std::cout << "executeTracker: " << neighbors.size() << std::endl;
184 
185  //...
186 
187  SeedsItr _itr = neighbors.begin();
188 
189  while( _itr != neighbors.end() ) {
190 
191  _trk->add( (*_itr) );
192 
193  std::vector<Seed*> _nextneighbors;
194 
195  findNeighbors( (*_itr) , _nextneighbors );
196 
197  filter( _trk, _nextneighbors );
198 
199  if ( _nextneighbors.size() == 1 )
200  executeTracker( _trk, _nextneighbors );
201 
202  //... bifurcation not considered at the moment
203 
204  ++_itr;
205 
206  }
207 
208  //...
209 
210 
211 
212  return 1;
213 
214 }
void findNeighbors(Seed *, std::vector< Seed * > &)
std::vector< Seed * >::iterator SeedsItr
void filter(Track *, std::vector< Seed * > &)
int executeTracker(Track *, std::vector< Seed * > &)
tuple cout
Definition: gather_cfg.py:121
void TTUTrackingAlg::filter ( Track _trk,
std::vector< Seed * > &  _nbrs 
)
private

Definition at line 250 of file TTUTrackingAlg.cc.

References gather_cfg::cout, spr::find(), m_debug, and TTUTrackingAlg::Track::m_seeds.

Referenced by executeTracker(), and process().

252 {
253 
254  //... filter: removes from neighbors list, seeds already present
255  //... in tracks
256 
257  SeedsItr _itr;
258 
259  for( _itr = _trk->m_seeds.begin();_itr != _trk->m_seeds.end(); ++_itr)
260  {
261  SeedsItr _isalready = std::find( _nbrs.begin(),_nbrs.end(), (*_itr) );
262 
263  if( _isalready != _nbrs.end() ) {
264  _nbrs.erase( _isalready );
265  if( m_debug ) std::cout << "removing ..." << std::endl;
266  }
267 
268 
269  }
270 
271 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< Seed * >::iterator SeedsItr
tuple cout
Definition: gather_cfg.py:121
void TTUTrackingAlg::findNeighbors ( Seed _seed,
std::vector< Seed * > &  neighbors 
)
private

Definition at line 216 of file TTUTrackingAlg.cc.

References funct::abs(), gather_cfg::cout, m_debug, m_initialseeds, TTUTrackingAlg::Seed::m_sectorId, and TTUTrackingAlg::Seed::m_stationId.

Referenced by executeTracker(), and process().

217 {
218 
219  neighbors.clear();
220 
221  int _xo = _seed->m_sectorId;
222  int _yo = _seed->m_stationId;
223 
224  if( m_debug ) std::cout << "X: " << _xo+1 << " Y: " << _yo+1 << std::endl;
225 
226  SeedsItr _itr = m_initialseeds.begin();
227 
228  while( _itr != m_initialseeds.end() ) {
229 
230  int _difx = std::abs( _xo - (*_itr)->m_sectorId );
231  int _dify = std::abs( _yo - (*_itr)->m_stationId );
232 
233  if (m_debug) std::cout << "difference (x,y): " << _difx << "," << _dify << "\t";
234 
235  if ( _difx == 11 ) _difx = 1;
236 
237  if ( ((_difx == 1) && (_dify == 1)) ||
238  ((_difx == 1) && (_dify == 0)) ||
239  ((_difx == 0) && (_dify == 1)) )
240 
241  neighbors.push_back( (*_itr) );
242 
243  ++_itr;
244  }
245 
246  if (m_debug) std::cout << std::endl;
247 
248 }
std::vector< Seed * > m_initialseeds
std::vector< Seed * >::iterator SeedsItr
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
void TTUTrackingAlg::ghostBuster ( Track currentTrk)
private

Definition at line 273 of file TTUTrackingAlg.cc.

References TTUTrackingAlg::Track::m_seeds, python.multivaluedict::sort(), and TTUTrackingAlg::Track::updateTrkLength().

Referenced by process().

274 {
275 
276  //...do a final check to make sure there are no repeated seeds in track
277 
278  std::vector<Seed*>::iterator seedItr;
279 
280  std::sort( currentTrk->m_seeds.begin(), currentTrk->m_seeds.end(), SortBySector() );
281  std::sort( currentTrk->m_seeds.begin(), currentTrk->m_seeds.end(), SortByLayer() );
282 
283  seedItr = std::unique (currentTrk->m_seeds.begin(), currentTrk->m_seeds.end(), CompareSeeds() );
284 
285  currentTrk->m_seeds.resize(seedItr - currentTrk->m_seeds.begin());
286 
287  currentTrk->updateTrkLength();
288 
289 }
void TTUTrackingAlg::print ( const std::vector< Seed * > &  seeds)
inlineprivate

Definition at line 186 of file TTUTrackingAlg.h.

References gather_cfg::cout.

187  {
188  std::vector<Seed*>::const_iterator itr;
189  for( itr = seeds.begin(); itr != seeds.end(); ++itr)
190  std::cout << (*itr) << '\t';
191  std::cout << '\n';
192  };
tuple cout
Definition: gather_cfg.py:121
bool TTUTrackingAlg::process ( const TTUInput inmap)
virtual

Implements TTULogic.

Definition at line 63 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 ConfigBuilder.ConfigBuilder::addExtraStream(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_PATFILTER(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), TTUTwoORLogic::process(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

64 {
65 
66  if( m_debug) std::cout << "TTUTrackingAlg>process() starts + bx= " << inmap.m_bx << std::endl;
67 
68  m_triggersignal = false;
69 
70  Track * initTrk = new Track();
71 
72  //.
73  runSeedBuster( inmap );
74 
75  if ( m_initialseeds.size() > 0 && m_initialseeds.size() < 20 ) // if too much hits, then cannot process
76  initTrk->add( m_initialseeds[0] );
77  else {
78  initTrk->addnone();
79  if( m_debug) std::cout << "TTUTrackingAlg>process() ends: no initialseeds" << std::endl;
80  return false;
81  }
82 
83 
84 
85 
86 
87  m_tracks.push_back( initTrk );
88 
89  //..
90  SeedsItr _seed = m_initialseeds.begin();
91  std::vector<Seed*> neighbors;
92 
93  while ( _seed != m_initialseeds.end() ) {
94 
95  findNeighbors( (*_seed) , neighbors );
96  filter( initTrk, neighbors );
97  executeTracker( initTrk, neighbors );
98  ghostBuster( initTrk );
99 
100  ++_seed;
101 
102  if ( _seed != m_initialseeds.end() ) {
103  initTrk = new Track();
104  initTrk->add((*_seed));
105  m_tracks.push_back( initTrk );
106 
107  }
108 
109  }
110 
111  TracksItr itr;
112 
113  if( m_debug) {
114  std::cout << "Total tracks: " << m_tracks.size() << std::endl;
115  for( itr = m_tracks.begin(); itr != m_tracks.end(); ++itr)
116  std::cout << "length: " << (*itr)->length() << '\t';
117  std::cout << std::endl;
118  }
119 
120  //...
121  alignTracks();
122 
123  //.... Look at the first track and compare its track length
124 
125  int tracklen(0);
126  itr = m_tracks.begin();
127  if ( itr != m_tracks.end() ) tracklen = (*itr)->length();
128 
129  if ( tracklen >= m_mintrklength )
130  m_triggersignal = true;
131 
132  if( m_debug ) {
133  std::cout << "TTUTrackingAlg> trk len= "
134  << tracklen << '\t' << "triggered: "
135  << m_triggersignal << std::endl;
136  }
137 
138  //..... Clean up for next run
139 
140  cleanUp();
141 
142  //.......................................................
143 
144  if( m_debug ) std::cout << "TTUTrackingAlg>process ends" << std::endl;
145 
146  return true;
147 
148 }
int m_bx
Definition: TTUInput.h:52
void findNeighbors(Seed *, std::vector< Seed * > &)
std::vector< Seed * > m_initialseeds
void ghostBuster(Track *)
std::vector< Seed * >::iterator SeedsItr
void filter(Track *, std::vector< Seed * > &)
int executeTracker(Track *, std::vector< Seed * > &)
bool m_triggersignal
Definition: TTULogic.h:34
void runSeedBuster(const TTUInput &)
tuple cout
Definition: gather_cfg.py:121
std::vector< Track * >::iterator TracksItr
std::vector< Track * > m_tracks
void TTUTrackingAlg::runSeedBuster ( const TTUInput inmap)
private

Definition at line 150 of file TTUTrackingAlg.cc.

References gather_cfg::cout, i, customizeTrackingMonitorSeedNumber::idx, TTUInput::input_sec, relval_steps::k, m_debug, m_initialseeds, m_SEscanorder, m_STscanorder, and relativeConstraints::station.

Referenced by process().

151 {
152 
153  int idx(0);
154  int idy(0);
155 
156  for(int i=0; i < 12; ++i)
157  {
158  idx = (m_SEscanorder[i] - 1);
159  std::bitset<6> station = inmap.input_sec[idx];
160 
161  if ( ! station.any() ) continue;
162 
163  for(int k=0; k < 6; ++k ) {
164 
165  idy = (m_STscanorder[k] - 1);
166  bool _hit = station[idy];
167 
168  if ( _hit ) {
169  Seed *_seed = new Seed( idx, idy, 0 );
170  m_initialseeds.push_back(_seed);
171  }
172  }
173  }
174 
175  //...
176  if ( m_debug ) std::cout << "SeedBuster: " << m_initialseeds.size() << std::endl;
177 
178 }
int i
Definition: DBlmapReader.cc:9
int m_SEscanorder[12]
std::vector< Seed * > m_initialseeds
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
tuple cout
Definition: gather_cfg.py:121
std::bitset< 6 > * input_sec
Definition: TTUInput.h:58
void TTUTrackingAlg::setBoardSpecs ( const TTUBoardSpecs::TTUBoardConfig boardspecs)
virtual

Implements TTULogic.

Definition at line 56 of file TTUTrackingAlg.cc.

References m_mintrklength, and TTUBoardSpecs::TTUBoardConfig::m_TrackLength.

Referenced by TTUTwoORLogic::setBoardSpecs().

57 {
58 
59  m_mintrklength = boardspecs.m_TrackLength;
60 
61 }
void TTUTrackingAlg::setMinTrkLength ( int  val)
inline

Definition at line 121 of file TTUTrackingAlg.h.

References m_mintrklength.

122  {
123  m_mintrklength = val;
124  };

Member Data Documentation

bool TTUTrackingAlg::m_debug
private
std::vector<Seed*> TTUTrackingAlg::m_initialseeds
private

Definition at line 158 of file TTUTrackingAlg.h.

Referenced by cleanUp(), findNeighbors(), process(), runSeedBuster(), and ~TTUTrackingAlg().

int TTUTrackingAlg::m_mintrklength
private

Definition at line 154 of file TTUTrackingAlg.h.

Referenced by process(), setBoardSpecs(), setMinTrkLength(), and TTUTrackingAlg().

int TTUTrackingAlg::m_SEscanorder[12]
private

Definition at line 152 of file TTUTrackingAlg.h.

Referenced by runSeedBuster(), and TTUTrackingAlg().

int TTUTrackingAlg::m_STscanorder[6]
private

Definition at line 150 of file TTUTrackingAlg.h.

Referenced by runSeedBuster(), and TTUTrackingAlg().

std::vector<Track*> TTUTrackingAlg::m_tracks
private

Definition at line 156 of file TTUTrackingAlg.h.

Referenced by alignTracks(), cleanUp(), process(), and ~TTUTrackingAlg().