CMS 3D CMS Logo

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

#include <ME0TPConverter.h>

Inheritance diagram for emtf::phase2::ME0TPConverter:
emtf::phase2::TPConverter

Public Member Functions

void convert (const TriggerPrimitive &, const TPInfo &, EMTFHit &) const final
 
 ME0TPConverter (const EMTFContext &, const int &, const int &)
 
 ~ME0TPConverter () 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 ME0TPConverter.h.

Constructor & Destructor Documentation

◆ ME0TPConverter()

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

◆ ~ME0TPConverter()

emtf::phase2::ME0TPConverter::~ME0TPConverter ( )
overridedefault

Member Function Documentation

◆ convert()

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

Implements emtf::phase2::TPConverter.

Definition at line 21 of file ME0TPConverter.cc.

References emtf::phase2::TPInfo::bx, emtf::phase2::tp::calcPhiInt(), emtf::phase2::tp::calcThetaInt(), 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, emtf::phase2::kME0, 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, 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 int tp_segment_id = tp_info.segment_id;
25 
26  // Unpack trigger primitive
27  const auto& tp_det_id = tp.detId<ME0DetId>();
28  const auto& tp_data = tp.getME0Data();
29 
30  // Unpack detector info
31  const auto tp_subsystem = L1TMuon::kME0;
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_layer = tp_info.layer;
40  // const int tp_chamber = tp_info.chamber;
41 
42  const int tp_csc_id = tp_info.csc_id;
43  const auto tp_csc_facing = tp_info.csc_facing;
44 
45  // Unpack data
46  const int tp_phiposition = tp_data.phiposition; // in half-strip unit
47  const int tp_partition = tp_data.partition; // in half-roll unit
48 
49  const int tp_bend = static_cast<int>(tp_data.deltaphi) * (tp_data.bend == 0 ? 1 : -1);
50 
51  const int tp_bx = tp_info.bx;
52  const int tp_subbx = 0; // no fine resolution timing
53  const float tp_time = 0; // no fine resolution timing.
54 
55  const auto tp_selection = tp_info.selection;
56 
57  const int tp_quality = tp_data.quality;
58 
59  // ID scheme used in FW
60  const int tp_ilink = tp_info.ilink;
61 
62  // Get Global Coordinates
64  const float glob_phi = tp::radToDeg(gp.phi().value());
65  const float glob_theta = tp::radToDeg(gp.theta().value());
66  const double glob_rho = gp.perp();
67  const double glob_z = gp.z();
68 
69  // Calculate EMTF Values
70  const int emtf_phi = tp::calcPhiInt(sector_, glob_phi);
71  const int emtf_bend = std::clamp(tp_bend / 2, -64, 63); // 7-bit, signed
72  const int emtf_theta = tp::calcThetaInt(tp_endcap_pm, glob_theta);
73  const int emtf_qual = std::clamp(tp_quality, 0, 15); // 4-bit, unsigned
74  const int emtf_site = context_.site_lut_.lookup({tp_subsystem, tp_station, tp_ring});
75  const int emtf_host = context_.host_lut_.lookup({tp_subsystem, tp_station, tp_ring});
76  const int emtf_zones = context_.zone_lut_.getZones(emtf_host, emtf_theta);
77 
78  emtf_assert((0 <= emtf_phi) and (emtf_phi < 5040));
79  emtf_assert((1 <= emtf_theta) and (emtf_theta < 128));
80 
81  // Get flags
82  const bool tp_flag_neighbor = (tp_selection == TPSelection::kNeighbor);
83  const bool tp_flag_substitute = tp_info.flag_substitute;
84  const bool tp_flag_valid = true; // given by digi, not trigger_primitive :(
85 
86  // Set properties
87  hit.setId(tp_hit_id);
88 
89  hit.setRawDetId(tp_raw_id);
90  hit.setSubsystem(L1TMuon::kME0);
91  hit.setEndcap(tp_endcap_pm);
92  hit.setSector(sector_);
93  hit.setSubsector(tp_subsector);
94  hit.setStation(tp_station);
95  hit.setRing(tp_ring);
96  hit.setLayer(tp_layer);
97  hit.setChamber(tp_det_id.chamber()); // Save original chamber
98 
99  hit.setCscId(tp_csc_id);
100  hit.setCscFR(tp_csc_facing == csc::Facing::kRear);
101 
102  hit.setStrip(tp_phiposition);
103  hit.setStripLo(tp_phiposition);
104  hit.setStripHi(tp_phiposition);
105 
106  hit.setWire1(tp_partition);
107  hit.setWire2(0);
108 
109  hit.setBend(tp_bend);
110 
111  hit.setBx(tp_bx);
112  hit.setSubbx(tp_subbx);
113 
114  hit.setQuality(tp_quality);
115  hit.setPattern(0);
116 
117  hit.setGlobPhi(glob_phi);
118  hit.setGlobTheta(glob_theta);
119  hit.setGlobPerp(glob_rho);
120  hit.setGlobZ(glob_z);
121  hit.setGlobTime(tp_time);
122 
123  hit.setEmtfChamber(tp_ilink);
124  hit.setEmtfSegment(tp_segment_id);
125  hit.setEmtfPhi(emtf_phi);
126  hit.setEmtfBend(emtf_bend);
127  hit.setEmtfTheta1(emtf_theta);
128  hit.setEmtfTheta2(0);
129  hit.setEmtfQual1(emtf_qual);
130  hit.setEmtfQual2(0);
131  hit.setEmtfSite(emtf_site);
132  hit.setEmtfHost(emtf_host);
133  hit.setEmtfZones(emtf_zones);
134 
135  hit.setFlagNeighbor(tp_flag_neighbor);
136  hit.setFlagSubstitute(tp_flag_substitute);
137  hit.setFlagValid(tp_flag_valid);
138 }
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::ME0TPConverter::context_
private

Definition at line 20 of file ME0TPConverter.h.

Referenced by convert().

◆ endcap_

int emtf::phase2::ME0TPConverter::endcap_
private

Definition at line 22 of file ME0TPConverter.h.

◆ sector_

int emtf::phase2::ME0TPConverter::sector_
private

Definition at line 22 of file ME0TPConverter.h.

Referenced by convert().