CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Static Public Member Functions | Static Public Attributes
l1t::MuonRawDigiTranslator Class Reference

#include <MuonRawDigiTranslator.h>

Static Public Member Functions

static void fillMuon (Muon &, uint32_t, uint32_t)
 
static void fillMuon (Muon &, uint64_t)
 
static uint64_t generate64bitDataWord (const Muon &)
 
static void generatePackedDataWords (const Muon &, uint32_t &, uint32_t &)
 

Static Public Attributes

static const unsigned absEtaMask_ = 0xFF
 
static const unsigned absEtaShift_ = 23
 
static const unsigned chargeShift_ = 2
 
static const unsigned chargeValidShift_ = 3
 
static const unsigned etaSignShift_ = 31
 
static const unsigned isoMask_ = 0x3
 
static const unsigned isoShift_ = 0
 
static const unsigned phiMask_ = 0x3FF
 
static const unsigned phiShift_ = 0
 
static const unsigned ptMask_ = 0x1FF
 
static const unsigned ptShift_ = 10
 
static const unsigned qualMask_ = 0xF
 
static const unsigned qualShift_ = 19
 
static const unsigned tfMuonIndexMask_ = 0x7F
 
static const unsigned tfMuonIndexShift_ = 4
 

Detailed Description

Definition at line 7 of file MuonRawDigiTranslator.h.

Member Function Documentation

void l1t::MuonRawDigiTranslator::fillMuon ( Muon mu,
uint32_t  raw_data_00_31,
uint32_t  raw_data_32_63 
)
static

Definition at line 5 of file MuonRawDigiTranslator.cc.

References absEtaMask_, absEtaShift_, chargeShift_, chargeValidShift_, etaSignShift_, l1t::Muon::hwCharge(), l1t::Muon::hwChargeValid(), l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), isoMask_, isoShift_, phiMask_, phiShift_, ptMask_, ptShift_, qualMask_, qualShift_, reco::LeafCandidate::setCharge(), l1t::Muon::setHwCharge(), l1t::Muon::setHwChargeValid(), l1t::L1Candidate::setHwEta(), l1t::L1Candidate::setHwIso(), l1t::L1Candidate::setHwPhi(), l1t::L1Candidate::setHwPt(), l1t::L1Candidate::setHwQual(), reco::LeafCandidate::setP4(), l1t::Muon::setTfMuonIndex(), tfMuonIndexMask_, and tfMuonIndexShift_.

Referenced by l1t::stage2::IntermediateMuonUnpacker::unpack(), and l1t::stage2::MuonUnpacker::unpack().

6 {
7  mu.setHwPt((raw_data_00_31 >> ptShift_) & ptMask_);
8  mu.setHwQual((raw_data_00_31 >> qualShift_) & qualMask_);
9 
10  // eta is coded as two's complement
11  int abs_eta = (raw_data_00_31 >> absEtaShift_) & absEtaMask_;
12  if ((raw_data_00_31 >> etaSignShift_) & 0x1) {
13  mu.setHwEta(abs_eta - (1 << (etaSignShift_ - absEtaShift_)));
14  } else {
15  mu.setHwEta(abs_eta);
16  }
17 
18  mu.setHwPhi((raw_data_00_31 >> phiShift_) & phiMask_);
19  mu.setHwIso((raw_data_32_63 >> isoShift_) & isoMask_);
20  // charge is coded as -1^chargeBit
21  mu.setHwCharge((raw_data_32_63 >> chargeShift_) & 0x1);
22  mu.setHwChargeValid((raw_data_32_63 >> chargeValidShift_) & 0x1);
23  mu.setTfMuonIndex((raw_data_32_63 >> tfMuonIndexShift_) & tfMuonIndexMask_);
24 
25  if (mu.hwPt() > 0) {
26  math::PtEtaPhiMLorentzVector vec{(mu.hwPt()-1)*0.5, mu.hwEta()*0.010875, mu.hwPhi()*0.010908, 0.0};
27  mu.setP4(vec);
28  if (mu.hwChargeValid()) {
29  mu.setCharge(1 - 2 * mu.hwCharge());
30  } else {
31  mu.setCharge(0);
32  }
33  }
34 }
static const unsigned tfMuonIndexShift_
static const unsigned phiMask_
static const unsigned isoShift_
static const unsigned etaSignShift_
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
static const unsigned qualShift_
static const unsigned tfMuonIndexMask_
static const unsigned absEtaShift_
static const unsigned phiShift_
const int mu
Definition: Constants.h:22
static const unsigned chargeValidShift_
static const unsigned absEtaMask_
static const unsigned ptShift_
static const unsigned isoMask_
static const unsigned chargeShift_
static const unsigned qualMask_
static const unsigned ptMask_
void l1t::MuonRawDigiTranslator::fillMuon ( Muon mu,
uint64_t  dataword 
)
static

Definition at line 37 of file MuonRawDigiTranslator.cc.

38 {
39  fillMuon(mu, (uint32_t)(dataword & 0xFFFFFFFF), (uint32_t)((dataword >> 32) & 0xFFFFFFFF));
40 }
static void fillMuon(Muon &, uint32_t, uint32_t)
const int mu
Definition: Constants.h:22
uint64_t l1t::MuonRawDigiTranslator::generate64bitDataWord ( const Muon mu)
static

Definition at line 62 of file MuonRawDigiTranslator.cc.

63 {
64  uint32_t lsw;
65  uint32_t msw;
66 
67  generatePackedDataWords(mu, lsw, msw);
68  return (((uint64_t)msw) << 32) + lsw;
69 }
const int mu
Definition: Constants.h:22
unsigned long long uint64_t
Definition: Time.h:15
static void generatePackedDataWords(const Muon &, uint32_t &, uint32_t &)
void l1t::MuonRawDigiTranslator::generatePackedDataWords ( const Muon mu,
uint32_t &  raw_data_00_31,
uint32_t &  raw_data_32_63 
)
static

Definition at line 43 of file MuonRawDigiTranslator.cc.

References l1t::Muon::hwCharge(), l1t::Muon::hwChargeValid(), l1t::L1Candidate::hwEta(), l1t::L1Candidate::hwIso(), l1t::L1Candidate::hwPhi(), l1t::L1Candidate::hwPt(), l1t::L1Candidate::hwQual(), and l1t::Muon::tfMuonIndex().

Referenced by l1t::stage2::MuonPacker::pack().

44 {
45  int abs_eta = mu.hwEta();
46  if (abs_eta < 0) {
47  abs_eta += (1 << (etaSignShift_ - absEtaShift_));
48  }
49  raw_data_00_31 = (mu.hwPt() & ptMask_) << ptShift_
50  | (mu.hwQual() & qualMask_) << qualShift_
51  | (abs_eta & absEtaMask_) << absEtaShift_
52  | (mu.hwEta() < 0) << etaSignShift_
53  | (mu.hwPhi() & phiMask_) << phiShift_;
54 
55  raw_data_32_63 = mu.hwCharge() << chargeShift_
56  | mu.hwChargeValid() << chargeValidShift_
57  | (mu.tfMuonIndex() & tfMuonIndexMask_) << tfMuonIndexShift_
58  | (mu.hwIso() & isoMask_) << isoShift_;
59 }
static const unsigned tfMuonIndexShift_
static const unsigned phiMask_
static const unsigned isoShift_
static const unsigned etaSignShift_
static const unsigned qualShift_
static const unsigned tfMuonIndexMask_
static const unsigned absEtaShift_
static const unsigned phiShift_
const int mu
Definition: Constants.h:22
static const unsigned chargeValidShift_
static const unsigned absEtaMask_
static const unsigned ptShift_
static const unsigned isoMask_
static const unsigned chargeShift_
static const unsigned qualMask_
static const unsigned ptMask_

Member Data Documentation

const unsigned l1t::MuonRawDigiTranslator::absEtaMask_ = 0xFF
static

Definition at line 18 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

const unsigned l1t::MuonRawDigiTranslator::absEtaShift_ = 23
static

Definition at line 19 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

const unsigned l1t::MuonRawDigiTranslator::chargeShift_ = 2
static

Definition at line 23 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

const unsigned l1t::MuonRawDigiTranslator::chargeValidShift_ = 3
static

Definition at line 24 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

const unsigned l1t::MuonRawDigiTranslator::etaSignShift_ = 31
static

Definition at line 20 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

const unsigned l1t::MuonRawDigiTranslator::isoMask_ = 0x3
static

Definition at line 27 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

const unsigned l1t::MuonRawDigiTranslator::isoShift_ = 0
static

Definition at line 28 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

const unsigned l1t::MuonRawDigiTranslator::phiMask_ = 0x3FF
static

Definition at line 21 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

const unsigned l1t::MuonRawDigiTranslator::phiShift_ = 0
static

Definition at line 22 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

const unsigned l1t::MuonRawDigiTranslator::ptMask_ = 0x1FF
static
const unsigned l1t::MuonRawDigiTranslator::ptShift_ = 10
static
const unsigned l1t::MuonRawDigiTranslator::qualMask_ = 0xF
static

Definition at line 16 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

const unsigned l1t::MuonRawDigiTranslator::qualShift_ = 19
static

Definition at line 17 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

const unsigned l1t::MuonRawDigiTranslator::tfMuonIndexMask_ = 0x7F
static

Definition at line 25 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

const unsigned l1t::MuonRawDigiTranslator::tfMuonIndexShift_ = 4
static

Definition at line 26 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().