CMS 3D CMS Logo

GEMTPConverter.cc
Go to the documentation of this file.
2 
13 
15 
16 using namespace emtf::phase2;
17 
19  : context_(context), endcap_(endcap), sector_(sector) {}
20 
21 void GEMTPConverter::convert(const TriggerPrimitive& tp, const TPInfo& tp_info, EMTFHit& hit) const {
22  // Unpack Id
23  const auto& tp_hit_id = tp_info.hit_id;
24  const auto& tp_segment_id = tp_info.segment_id;
25 
26  // Unpack trigger primitive
27  const auto& tp_det_id = tp.detId<GEMDetId>();
28  const auto& tp_data = tp.getGEMData();
29 
30  // Unpack detector info
31  const auto tp_subsystem = L1TMuon::kGEM;
32 
33  const int tp_raw_id = tp_det_id.rawId();
34 
35  const int tp_endcap_pm = tp_info.endcap_pm;
36  const int tp_subsector = tp_info.subsector;
37  const int tp_station = tp_info.station;
38  const int tp_ring = tp_info.ring;
39  const int tp_roll = tp_info.roll;
40  const int tp_layer = tp_info.layer;
41  const int tp_chamber = tp_info.chamber;
42 
43  const auto tp_csc_facing = tp_info.csc_facing;
44  const int tp_csc_id = tp_info.csc_id;
45 
46  // Unpack data
47  const int tp_pad_lo = tp_data.pad_low;
48  const int tp_pad_hi = tp_data.pad_hi;
49  const int tp_pad = (tp_pad_lo + tp_pad_hi) / 2;
50  const int tp_clus_width = (tp_pad_hi - tp_pad_lo + 1);
51 
52  const int tp_bend = 0; // not applicable
53 
54  const int tp_bx = tp_info.bx;
55  const int tp_subbx = 0; // no fine resolution timing
56  const float tp_time = 0; // no fine resolution timing. Note: Check with Efe, Jia Fu gets this from digi directly.
57 
58  const auto tp_selection = tp_info.selection;
59 
60  // Use cluster width as quality. GE2/1 strip pitch is the same as GE1/1 strip pitch.
61  const int tp_quality = tp_clus_width;
62 
63  // ID scheme used in FW
64  const int tp_ilink = tp_info.ilink;
65 
66  // Get Global Coordinates
67  // const GlobalPoint& gp = get_global_point(detgeom, detid, digi);
69  const float glob_phi = tp::radToDeg(gp.phi().value());
70  const float glob_theta = tp::radToDeg(gp.theta().value());
71  const double glob_rho = gp.perp();
72  const double glob_z = gp.z();
73 
74  // Calculate EMTF Values
75  const int emtf_phi = tp::calcPhiInt(sector_, glob_phi);
76  const int emtf_bend = 0;
77  const int emtf_theta = tp::calcThetaInt(tp_endcap_pm, glob_theta);
78  const int emtf_qual = 0;
79  const int emtf_site = context_.site_lut_.lookup({tp_subsystem, tp_station, tp_ring});
80  const int emtf_host = context_.host_lut_.lookup({tp_subsystem, tp_station, tp_ring});
81  const int emtf_zones = context_.zone_lut_.getZones(emtf_host, emtf_theta);
82 
83  emtf_assert((0 <= emtf_phi) and (emtf_phi < 5040));
84  emtf_assert((1 <= emtf_theta) and (emtf_theta < 128));
85 
86  // Get flags
87  const bool tp_flag_neighbor = (tp_selection == TPSelection::kNeighbor);
88  const bool tp_flag_substitute = tp_info.flag_substitute;
89  const bool tp_flag_valid = true; // given by digi, not trigger_primitive
90 
91  // Set properties
92  hit.setId(tp_hit_id);
93 
94  hit.setRawDetId(tp_raw_id);
95  hit.setSubsystem(L1TMuon::kGEM);
96  hit.setEndcap(tp_endcap_pm);
97  hit.setSector(sector_);
98  hit.setSubsector(tp_subsector);
99  hit.setStation(tp_station);
100  hit.setRing(tp_ring);
101  hit.setLayer(tp_layer);
102  hit.setChamber(tp_chamber);
103 
104  hit.setCscId(tp_csc_id);
105  hit.setCscFR(tp_csc_facing == csc::Facing::kRear);
106 
107  hit.setStrip(tp_pad);
108  hit.setStripLo(tp_pad_lo);
109  hit.setStripHi(tp_pad_hi);
110 
111  hit.setWire1(tp_roll);
112  hit.setWire2(0);
113 
114  hit.setBend(tp_bend);
115 
116  hit.setBx(tp_bx);
117  hit.setSubbx(tp_subbx);
118 
119  hit.setQuality(tp_quality);
120  hit.setPattern(0);
121 
122  hit.setGlobPhi(glob_phi);
123  hit.setGlobTheta(glob_theta);
124  hit.setGlobPerp(glob_rho);
125  hit.setGlobZ(glob_z);
126  hit.setGlobTime(tp_time);
127 
128  hit.setEmtfChamber(tp_ilink);
129  hit.setEmtfSegment(tp_segment_id);
130  hit.setEmtfPhi(emtf_phi);
131  hit.setEmtfBend(emtf_bend);
132  hit.setEmtfTheta1(emtf_theta);
133  hit.setEmtfTheta2(0);
134  hit.setEmtfQual1(emtf_qual);
135  hit.setEmtfQual2(0);
136  hit.setEmtfSite(emtf_site);
137  hit.setEmtfHost(emtf_host);
138  hit.setEmtfZones(emtf_zones);
139 
140  hit.setFlagNeighbor(tp_flag_neighbor);
141  hit.setFlagSubstitute(tp_flag_substitute);
142  hit.setFlagValid(tp_flag_valid);
143 }
const EMTFContext & context_
GlobalPoint getGlobalPoint(const TriggerPrimitive &) const
csc::Facing csc_facing
Definition: TPrimitives.h:39
const int & lookup(const std::tuple< int, int, int > &) const
Definition: SiteLut.cc:45
int calcThetaInt(int, float)
Definition: TPUtils.cc:64
TPSelection selection
Definition: TPrimitives.h:21
int calcPhiInt(int, float)
Definition: TPUtils.cc:113
data::HostLut host_lut_
Definition: EMTFContext.h:52
GEMTPConverter(const EMTFContext &, const int &, const int &)
int getZones(const int &, const int &) const
Definition: ZoneLut.cc:55
float radToDeg(float rad)
Definition: TPUtils.cc:14
data::ZoneLut zone_lut_
Definition: EMTFContext.h:53
const int & lookup(const std::tuple< int, int, int > &) const
Definition: HostLut.cc:45
#define emtf_assert(expr)
Definition: DebugTools.h:18
data::SiteLut site_lut_
Definition: EMTFContext.h:51
void convert(const TriggerPrimitive &, const TPInfo &, EMTFHit &) const final
GeometryTranslator geometry_translator_
Definition: EMTFContext.h:36