3 #ifndef PHASE2GMT_SAFWDMUONTRANSLATOR 4 #define PHASE2GMT_SAFWDMUONTRANSLATOR 64 produces<std::vector<l1t::SAMuon> >(
"prompt").setBranchAlias(
"prompt");
65 produces<std::vector<l1t::SAMuon> >(
"displaced").setBranchAlias(
"displaced");
84 for (
uint i = 0;
i < stubHandle->size(); ++
i) {
87 if (stub->bxNum() == 0)
88 stubs.push_back(stub);
92 std::vector<SAMuon> prompt;
98 for (
unsigned int i = 0;
i < omtf_tracks->
size(0); ++
i) {
107 prompt.push_back(samuon);
109 if (
mu.hwPtUnconstrained() > 0) {
118 for (
unsigned int track_id = 0; track_id < emtf_tracks->size(); ++track_id) {
119 const auto&
track = emtf_tracks->at(track_id);
122 if ((
track.valid() == 0) || (
track.bx() != 0)) {
127 if (
track.emtfQuality() <= 3) {
132 if (
track.emtfRels() != 127) {
142 if (
track.unconstrained()) {
145 prompt.push_back(samuon);
150 std::unique_ptr<std::vector<l1t::SAMuon> > prompt_ptr = std::make_unique<std::vector<l1t::SAMuon> >(prompt);
151 std::unique_ptr<std::vector<l1t::SAMuon> > displaced_ptr = std::make_unique<std::vector<l1t::SAMuon> >(
displaced);
161 ap_uint<BITSSAQUAL> qual =
mu.hwQual();
164 ap_uint<BITSGTPT>
pt = 0;
165 if (!isDisplaced &&
mu.hwPt() > 0)
167 if (isDisplaced &&
mu.hwPtUnconstrained() > 0)
168 pt = round(
mu.hwPtUnconstrained() * 1.0 /
LSBpt);
174 int globPhi =
mu.processor() * 192 +
mu.hwPhi();
176 globPhi = (globPhi + 600) % 576;
177 ap_int<BITSGTPHI>
phi = round(globPhi * p1phiLSB /
LSBphi);
178 ap_int<BITSGTETA>
eta = round(
mu.hwEta() * 0.010875 /
LSBeta);
182 ap_int<BITSSAZ0>
z0 = 0;
184 ap_int<BITSSAD0>
d0 =
mu.hwDXY();
189 bstart = wordconcat<wordtype>(
word, bstart, 1, 1);
190 bstart = wordconcat<wordtype>(
word, bstart,
charge, 1);
191 bstart = wordconcat<wordtype>(
word, bstart,
pt,
BITSPT);
196 bstart = wordconcat<wordtype>(
197 word, bstart, qual, 8);
202 samuon.
setTF(
mu.trackFinderType());
203 samuon.setWord(
word);
212 for (
const auto& stub :
all) {
213 if (stub->bxNum() ==
bx && stub->tfLayer() ==
layer)
222 int bestStubINT = -1;
224 for (
uint i = 0;
i < selectedStubs.size(); ++
i) {
227 (stub->quality() & 0x1) ? stub->offline_coord1() -
mu.p4().phi() : stub->offline_coord2() -
mu.p4().phi();
233 float deltaEta = (stub->etaQuality() == 0 || (stub->etaQuality() & 0x1))
234 ? fabs(stub->offline_eta1() -
mu.p4().eta())
235 : fabs(stub->offline_eta2() -
mu.p4().eta());
241 if (bestStubINT >= 0) {
242 mu.addStub(selectedStubs[bestStubINT]);
254 track_theta *=
track.endcap();
255 track_eta *=
track.endcap();
262 ap_uint<BITSSAQUAL> qual =
track.emtfQuality();
264 ap_uint<BITSGTPT>
pt =
track.emtfPt();
266 ap_int<BITSGTETA>
eta = round(track_eta /
LSBeta);
267 ap_int<BITSSAZ0>
z0 =
track.emtfZ0();
268 ap_int<BITSSAD0>
d0 =
track.emtfD0();
273 bstart = wordconcat<wordtype>(
word, bstart, 1, 1);
274 bstart = wordconcat<wordtype>(
word, bstart,
charge, 1);
275 bstart = wordconcat<wordtype>(
word, bstart,
pt,
BITSPT);
280 bstart = wordconcat<wordtype>(
281 word, bstart, qual, 8);
286 if (
track.endcap() == 1)
291 samuon.setWord(
word);
308 descriptions.
add(
"Phase2L1TGMTFwdMuonTranslator",
desc);
l1t::MuonStubRefVector selectLayerBX(const l1t::MuonStubRefVector &all, int bx, uint layer)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< l1t::MuonStubCollection > stubToken_
float calcPhiLocRadFromInt(int)
static const double deltaEta
std::vector< edm::Ref< MuonStubCollection > > MuonStubRefVector
unsigned size(int bx) const
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
l1t::SAMuon ConvertEMTFTrack(const l1t::phase2::EMTFTrack &track, const int bx_)
void produce(edm::Event &, const edm::EventSetup &) override
Tan< T >::type tan(const T &t)
#define DEFINE_FWK_MODULE(type)
const T & at(int bx, unsigned i) const
std::vector< MuonStub > MuonStubCollection
float calcThetaRadFromInt(int)
static constexpr float d0
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void associateStubs(l1t::SAMuon &, const l1t::MuonStubRefVector &)
l1t::SAMuon Convertl1tMuon(const l1t::RegionalMuonCand &mu, const int bx_, bool isDisplaced=false)
edm::EDGetTokenT< l1t::phase2::EMTFTrackCollection > emtfTrackToken_
std::vector< EMTFTrack > EMTFTrackCollection
float calcPhiGlobRadFromLoc(int, float)
Phase2L1TGMTFwdMuonTranslator(const edm::ParameterSet &)
edm::EDGetTokenT< l1t::RegionalMuonCandBxCollection > omtfTrackToken_