CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
emtf::phase2::GEMTPConverter Class Reference

#include <GEMTPConverter.h>

Inheritance diagram for emtf::phase2::GEMTPConverter:
emtf::phase2::TPConverter

Public Member Functions

void convert (const TriggerPrimitive &, const TPInfo &, EMTFHit &) const final
 
 GEMTPConverter (const EMTFContext &, const int &, const int &)
 
 ~GEMTPConverter () override=default
 
- Public Member Functions inherited from emtf::phase2::TPConverter
 TPConverter ()=default
 
virtual ~TPConverter ()=default
 

Private Attributes

const EMTFContextcontext_
 
int endcap_
 
int sector_
 

Detailed Description

Definition at line 11 of file GEMTPConverter.h.

Constructor & Destructor Documentation

◆ GEMTPConverter()

GEMTPConverter::GEMTPConverter ( const EMTFContext context,
const int &  endcap,
const int &  sector 
)
explicit

◆ ~GEMTPConverter()

emtf::phase2::GEMTPConverter::~GEMTPConverter ( )
overridedefault

Member Function Documentation

◆ convert()

void GEMTPConverter::convert ( const TriggerPrimitive tp,
const TPInfo tp_info,
EMTFHit hit 
) const
finalvirtual

Implements emtf::phase2::TPConverter.

Definition at line 21 of file GEMTPConverter.cc.

References emtf::phase2::TPInfo::bx, emtf::phase2::tp::calcPhiInt(), emtf::phase2::tp::calcThetaInt(), emtf::phase2::TPInfo::chamber, context_, emtf::phase2::TPInfo::csc_facing, emtf::phase2::TPInfo::csc_id, emtf_assert, emtf::phase2::TPInfo::endcap_pm, emtf::phase2::TPInfo::flag_substitute, emtf::phase2::EMTFContext::geometry_translator_, L1TMuon::GeometryTranslator::getGlobalPoint(), emtf::phase2::data::ZoneLut::getZones(), emtf::phase2::TPInfo::hit_id, emtf::phase2::EMTFContext::host_lut_, emtf::phase2::TPInfo::ilink, L1TMuon::kGEM, emtf::phase2::kNeighbor, emtf::phase2::csc::kRear, emtf::phase2::TPInfo::layer, emtf::phase2::data::HostLut::lookup(), emtf::phase2::data::SiteLut::lookup(), emtf::phase2::tp::radToDeg(), emtf::phase2::TPInfo::ring, emtf::phase2::TPInfo::roll, sector_, emtf::phase2::TPInfo::segment_id, emtf::phase2::TPInfo::selection, emtf::phase2::EMTFContext::site_lut_, emtf::phase2::TPInfo::station, emtf::phase2::TPInfo::subsector, cmsswSequenceInfo::tp, and emtf::phase2::EMTFContext::zone_lut_.

21  {
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
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
GeometryTranslator geometry_translator_
Definition: EMTFContext.h:36

Member Data Documentation

◆ context_

const EMTFContext& emtf::phase2::GEMTPConverter::context_
private

Definition at line 20 of file GEMTPConverter.h.

Referenced by convert().

◆ endcap_

int emtf::phase2::GEMTPConverter::endcap_
private

Definition at line 22 of file GEMTPConverter.h.

◆ sector_

int emtf::phase2::GEMTPConverter::sector_
private

Definition at line 22 of file GEMTPConverter.h.

Referenced by convert().