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 6 of file SingleHitTrack.h.

Member Function Documentation

◆ configure()

void SingleHitTrack::configure ( int  verbose,
int  endcap,
int  sector,
int  bx,
int  maxTracks,
bool  useSingleHits 
)

◆ process()

void SingleHitTrack::process ( const EMTFHitCollection conv_hits,
EMTFTrackCollection best_tracks 
) const

Definition at line 14 of file SingleHitTrack.cc.

References bx_, emtf_assert, endcap_, maxTracks_, l1t::EMTFTrack::push_Hit(), 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(), and useSingleHits_.

Referenced by SectorProcessor::process_single_bx().

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

Member Data Documentation

◆ bx_

int SingleHitTrack::bx_
private

Definition at line 13 of file SingleHitTrack.h.

Referenced by configure(), and process().

◆ endcap_

int SingleHitTrack::endcap_
private

Definition at line 13 of file SingleHitTrack.h.

Referenced by configure(), and process().

◆ maxTracks_

int SingleHitTrack::maxTracks_
private

Definition at line 14 of file SingleHitTrack.h.

Referenced by configure(), and process().

◆ sector_

int SingleHitTrack::sector_
private

Definition at line 13 of file SingleHitTrack.h.

Referenced by configure(), and process().

◆ useSingleHits_

bool SingleHitTrack::useSingleHits_
private

Definition at line 15 of file SingleHitTrack.h.

Referenced by configure(), and process().

◆ verbose_

int SingleHitTrack::verbose_
private

Definition at line 13 of file SingleHitTrack.h.

Referenced by configure().