CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SingleHitTrack Class Reference

#include <SingleHitTrack.h>

Public Member Functions

void configure (int verbose, int endcap, int sector, int bx, int maxTracks, bool useSingleHits)
 
void process (const EMTFHitCollection &conv_hits, EMTFTrackCollection &best_tracks) const
 

Private Attributes

int bx_
 
int endcap_
 
int maxTracks_
 
int sector_
 
bool useSingleHits_
 
int verbose_
 

Detailed Description

Definition at line 7 of file SingleHitTrack.h.

Member Function Documentation

void SingleHitTrack::configure ( int  verbose,
int  endcap,
int  sector,
int  bx,
int  maxTracks,
bool  useSingleHits 
)
void SingleHitTrack::process ( const EMTFHitCollection conv_hits,
EMTFTrackCollection best_tracks 
) const

Definition at line 18 of file SingleHitTrack.cc.

References l1t::EMTFHit::BX(), bx_, endcap_, maxTracks_, l1t::EMTFHit::PC_chamber(), l1t::EMTFHit::PC_station(), l1t::EMTFTrack::push_Hit(), l1t::EMTFHit::Ring(), sector_, l1t::EMTFTrack::set_bx(), l1t::EMTFTrack::set_endcap(), l1t::EMTFTrack::set_eta(), l1t::EMTFTrack::set_first_bx(), l1t::EMTFTrack::set_mode(), l1t::EMTFTrack::set_mode_inv(), l1t::EMTFTrack::set_ph_num(), l1t::EMTFTrack::set_ph_q(), l1t::EMTFTrack::set_phi_fp(), l1t::EMTFTrack::set_phi_glob(), l1t::EMTFTrack::set_phi_loc(), l1t::EMTFTrack::set_PtLUT(), l1t::EMTFTrack::set_rank(), l1t::EMTFTrack::set_second_bx(), l1t::EMTFTrack::set_sector(), l1t::EMTFTrack::set_sector_idx(), l1t::EMTFTrack::set_theta(), l1t::EMTFTrack::set_theta_fp(), l1t::EMTFTrack::set_track_num(), l1t::EMTFTrack::set_winner(), l1t::EMTFTrack::set_zone(), l1t::EMTFHit::Strip(), l1t::EMTFHit::Subsystem(), useSingleHits_, and l1t::EMTFHit::Zone_code().

Referenced by SectorProcessor::process_single_bx().

21  {
22 
23  if (conv_hits.empty())
24  return;
25 
26  if (!useSingleHits_)
27  return;
28 
29  if (int(best_tracks.size()) >= maxTracks_)
30  return;
31 
32  // New collection to contain single-hit tracks
33  EMTFTrackCollection one_hit_trks;
34 
35  // Loop over [subsector, CSC ID] pairs in order: [2,3], [2,2], [2,1], [1,3], [1,2], [1,1]
36  for (int sub_ID = 5; sub_ID >= 0; sub_ID--) {
37  int subsector = 1 + (sub_ID / 3);
38  int CSC_ID = 1 + (sub_ID % 3);
39 
40  // Loop over all the hits in a given BX
41  for (const auto & conv_hits_it : conv_hits) {
42 
43  // Require subsector and CSC ID to match
44  if (conv_hits_it.Subsector() != subsector || conv_hits_it.CSC_ID() != CSC_ID)
45  continue;
46 
47  // Only consider CSC LCTs
48  if (conv_hits_it.Is_CSC() != 1)
49  continue;
50 
51  // Only consider hits in station 1, ring 1
52  if (conv_hits_it.Station() != 1 || (conv_hits_it.Ring() % 3) != 1)
53  continue;
54 
55  // Only consider hits in the same sector (not neighbor hits)
56  if ( (conv_hits_it.Endcap() == 1) != (endcap_ == 1) || conv_hits_it.Sector() != sector_ )
57  continue;
58 
59  // Check if a hit has already been used in a track
60  bool already_used = false;
61 
62  // Loop over existing multi-hit tracks
63  for (const auto & best_tracks_it : best_tracks) {
64 
65  // Only consider tracks with a hit in station 1
66  if (best_tracks_it.Mode() < 8)
67  continue;
68 
69  // Check if hit in track is identical
70  // "Duplicate" hits (with same strip but different wire) are considered identical
71  // const EMTFHit& conv_hit_i = *conv_hits_it;
72  const EMTFHit& conv_hit_j = best_tracks_it.Hits().front();
73 
74  if (
75  (conv_hits_it.Subsystem() == conv_hit_j.Subsystem()) &&
76  (conv_hits_it.PC_station() == conv_hit_j.PC_station()) &&
77  (conv_hits_it.PC_chamber() == conv_hit_j.PC_chamber()) &&
78  ((conv_hits_it.Ring() % 3) == (conv_hit_j.Ring() % 3)) && // because of ME1/1
79  (conv_hits_it.Strip() == conv_hit_j.Strip()) &&
80  // (conv_hits_it.Wire() == conv_hit_j.Wire()) &&
81  (conv_hits_it.BX() == conv_hit_j.BX()) &&
82  true
83  ) {
84  already_used = true;
85  break;
86  }
87  } // End loop: for (const auto & best_tracks_it : best_tracks)
88 
89  // Only use hits that have not been used in a track
90  if (already_used)
91  continue;
92 
93  int zone = -1;
94  int zone_code = conv_hits_it.Zone_code();
95  if (zone_code & 0b1000) zone = 4;
96  else if (zone_code & 0b0100) zone = 3;
97  else if (zone_code & 0b0010) zone = 2;
98  else if (zone_code & 0b0001) zone = 1;
99  else {
100  edm::LogError("L1T") << "EMTF SingleHitTrack.cc - bizzare case where zone_code = " << zone_code; return;
101  }
102 
103  EMTFTrack new_trk;
104  new_trk.push_Hit ( conv_hits_it );
105 
106  EMTFPtLUT empty_LUT = {};
107  new_trk.set_PtLUT ( empty_LUT );
108 
109  new_trk.set_endcap ( conv_hits_it.Endcap() );
110  new_trk.set_sector ( conv_hits_it.Sector() );
111  new_trk.set_sector_idx ( conv_hits_it.Sector_idx() );
112  new_trk.set_mode ( 1 ); // Set "mode" to 1
113  new_trk.set_mode_inv ( 0 );
114  new_trk.set_rank ( 0b0100000 ); // Station 1 hit, straightness 0 (see "rank" in AngleCalculation.cc)
115  new_trk.set_winner ( maxTracks_ - 1 ); // Always set to the last / lowest track
116  new_trk.set_bx ( bx_ );
117  new_trk.set_first_bx ( bx_ );
118  new_trk.set_second_bx ( bx_ );
119  new_trk.set_zone ( zone );
120  new_trk.set_ph_num ( conv_hits_it.Zone_hit() );
121  new_trk.set_ph_q ( 0b010000 ); // Original "quality_code" from PatternRecognition.cc
122  new_trk.set_theta_fp ( conv_hits_it.Theta_fp() );
123  new_trk.set_theta ( conv_hits_it.Theta() );
124  new_trk.set_eta ( conv_hits_it.Eta() );
125  new_trk.set_phi_fp ( conv_hits_it.Phi_fp() );
126  new_trk.set_phi_loc ( conv_hits_it.Phi_loc() );
127  new_trk.set_phi_glob ( conv_hits_it.Phi_glob() );
128  new_trk.set_track_num ( maxTracks_ - 1 );
129 
130  one_hit_trks.push_back( new_trk );
131 
132  if (int(best_tracks.size()) + int(one_hit_trks.size()) >= maxTracks_)
133  break;
134 
135  // Firmware only sends one single-hit track per sector
136  if (!one_hit_trks.empty())
137  break;
138 
139  } // End loop: for (const auto & conv_hits_it : conv_hits)
140 
141  if (!one_hit_trks.empty())
142  break;
143 
144  } // End loop: for (int sub_ID = 5; sub_ID > 0; sub_ID--) {
145 
146 
147  best_tracks.insert(best_tracks.end(), one_hit_trks.begin(), one_hit_trks.end());
148 }
void set_mode(int bits)
Definition: EMTFTrack.h:95
int Subsystem() const
Definition: EMTFHit.h:200
void set_bx(int bits)
Definition: EMTFTrack.h:100
void set_second_bx(int bits)
Definition: EMTFTrack.h:102
int Strip() const
Definition: EMTFHit.h:163
void set_sector(int bits)
Definition: EMTFTrack.h:93
void set_phi_fp(int bits)
Definition: EMTFTrack.h:111
void set_first_bx(int bits)
Definition: EMTFTrack.h:101
void set_ph_num(int bits)
Definition: EMTFTrack.h:106
void set_PtLUT(EMTFPtLUT bits)
Definition: EMTFTrack.h:89
void set_sector_idx(int bits)
Definition: EMTFTrack.h:94
l1t::EMTFTrackCollection EMTFTrackCollection
Definition: Common.h:29
int PC_station() const
Definition: EMTFHit.h:159
int BX() const
Definition: EMTFHit.h:173
void set_zone(int bits)
Definition: EMTFTrack.h:105
void set_track_num(int bits)
Definition: EMTFTrack.h:120
int Ring() const
Definition: EMTFHit.h:146
void set_rank(int bits)
Definition: EMTFTrack.h:97
void set_theta_fp(int bits)
Definition: EMTFTrack.h:108
int PC_chamber() const
Definition: EMTFHit.h:160
void set_eta(float val)
Definition: EMTFTrack.h:110
void set_winner(int bits)
Definition: EMTFTrack.h:98
void set_theta(float val)
Definition: EMTFTrack.h:109
void set_endcap(int bits)
Definition: EMTFTrack.h:92
void set_ph_q(int bits)
Definition: EMTFTrack.h:107
void push_Hit(const EMTFHit &hit)
Definition: EMTFTrack.h:62
void set_phi_loc(float val)
Definition: EMTFTrack.h:112
int Zone_code() const
Definition: EMTFHit.h:180
void set_phi_glob(float val)
Definition: EMTFTrack.h:113
void set_mode_inv(int bits)
Definition: EMTFTrack.h:96

Member Data Documentation

int SingleHitTrack::bx_
private

Definition at line 22 of file SingleHitTrack.h.

Referenced by configure(), and process().

int SingleHitTrack::endcap_
private

Definition at line 22 of file SingleHitTrack.h.

Referenced by configure(), and process().

int SingleHitTrack::maxTracks_
private

Definition at line 23 of file SingleHitTrack.h.

Referenced by configure(), and process().

int SingleHitTrack::sector_
private

Definition at line 22 of file SingleHitTrack.h.

Referenced by configure(), and process().

bool SingleHitTrack::useSingleHits_
private

Definition at line 24 of file SingleHitTrack.h.

Referenced by configure(), and process().

int SingleHitTrack::verbose_
private

Definition at line 22 of file SingleHitTrack.h.

Referenced by configure().