CMS 3D CMS Logo

SingleHitTrack.cc
Go to the documentation of this file.
2 
4  int verbose, int endcap, int sector, int bx,
5  int maxTracks,
6  bool useSingleHits
7 ) {
9  endcap_ = endcap;
10  sector_ = sector;
11  bx_ = bx;
12 
14 
15  useSingleHits_ = useSingleHits;
16 }
17 
19  const EMTFHitCollection& conv_hits,
20  EMTFTrackCollection& best_tracks
21 ) const {
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 }
149 
void set_mode(int bits)
Definition: EMTFTrack.h:91
int Subsystem() const
Definition: EMTFHit.h:173
void set_bx(int bits)
Definition: EMTFTrack.h:96
void set_second_bx(int bits)
Definition: EMTFTrack.h:98
int Strip() const
Definition: EMTFHit.h:141
void set_sector(int bits)
Definition: EMTFTrack.h:89
bool verbose
void set_phi_fp(int bits)
Definition: EMTFTrack.h:107
void set_first_bx(int bits)
Definition: EMTFTrack.h:97
void set_ph_num(int bits)
Definition: EMTFTrack.h:102
void process(const EMTFHitCollection &conv_hits, EMTFTrackCollection &best_tracks) const
void set_PtLUT(EMTFPtLUT bits)
Definition: EMTFTrack.h:85
void set_sector_idx(int bits)
Definition: EMTFTrack.h:90
l1t::EMTFTrackCollection EMTFTrackCollection
Definition: Common.h:25
int PC_station() const
Definition: EMTFHit.h:137
int BX() const
Definition: EMTFHit.h:151
void set_zone(int bits)
Definition: EMTFTrack.h:101
void set_track_num(int bits)
Definition: EMTFTrack.h:116
l1t::EMTFHitCollection EMTFHitCollection
Definition: Common.h:21
int Ring() const
Definition: EMTFHit.h:124
void set_rank(int bits)
Definition: EMTFTrack.h:93
void set_theta_fp(int bits)
Definition: EMTFTrack.h:104
int PC_chamber() const
Definition: EMTFHit.h:138
void set_eta(float val)
Definition: EMTFTrack.h:106
void set_winner(int bits)
Definition: EMTFTrack.h:94
void set_theta(float val)
Definition: EMTFTrack.h:105
void set_endcap(int bits)
Definition: EMTFTrack.h:88
void set_ph_q(int bits)
Definition: EMTFTrack.h:103
void push_Hit(const EMTFHit &hit)
Definition: EMTFTrack.h:59
void set_phi_loc(float val)
Definition: EMTFTrack.h:108
void configure(int verbose, int endcap, int sector, int bx, int maxTracks, bool useSingleHits)
int Zone_code() const
Definition: EMTFHit.h:158
void set_phi_glob(float val)
Definition: EMTFTrack.h:109
void set_mode_inv(int bits)
Definition: EMTFTrack.h:92