CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
l1t::MicroGMTIsolationUnit Class Reference

#include <MicroGMTIsolationUnit.h>

Public Member Functions

void calculate5by1Sums (const MicroGMTConfiguration::CaloInputCollection &, int bx)
 
int calculate5by5Sum (unsigned index) const
 
void extrapolateMuons (MicroGMTConfiguration::InterMuonList &) const
 
int getCaloIndex (MicroGMTConfiguration::InterMuon &) const
 
void initialise (L1TMuonGlobalParamsHelper *)
 Initialisation from ES record. More...
 
void isolate (MicroGMTConfiguration::InterMuonList &) const
 
void isolatePreSummed (MicroGMTConfiguration::InterMuonList &muons) const
 
 MicroGMTIsolationUnit ()
 
void setTowerSums (const MicroGMTConfiguration::CaloInputCollection &inputs, int bx)
 
virtual ~MicroGMTIsolationUnit ()
 

Private Attributes

std::vector< int > m_5by1TowerSums
 
std::shared_ptr< MicroGMTAbsoluteIsolationCheckLUTm_AbsIsoCheckMem
 
std::shared_ptr< MicroGMTExtrapolationLUTm_BEtaExtrapolation
 
std::shared_ptr< MicroGMTExtrapolationLUTm_BPhiExtrapolation
 
std::bitset< 28 > m_caloInputsToDisable
 
std::map< tftype, std::shared_ptr< MicroGMTExtrapolationLUT > > m_etaExtrapolationLUTs
 
std::shared_ptr< MicroGMTExtrapolationLUTm_FEtaExtrapolation
 
std::shared_ptr< MicroGMTExtrapolationLUTm_FPhiExtrapolation
 
int m_fwVersion
 
std::shared_ptr< MicroGMTCaloIndexSelectionLUTm_IdxSelMemEta
 
std::shared_ptr< MicroGMTCaloIndexSelectionLUTm_IdxSelMemPhi
 
bool m_initialSums
 
std::bitset< 28 > m_maskedCaloInputs
 
std::shared_ptr< MicroGMTExtrapolationLUTm_OEtaExtrapolation
 
std::shared_ptr< MicroGMTExtrapolationLUTm_OPhiExtrapolation
 
std::map< tftype, std::shared_ptr< MicroGMTExtrapolationLUT > > m_phiExtrapolationLUTs
 
std::shared_ptr< MicroGMTRelativeIsolationCheckLUTm_RelIsoCheckMem
 
std::map< int, int > m_towerEnergies
 

Detailed Description

Definition at line 14 of file MicroGMTIsolationUnit.h.

Constructor & Destructor Documentation

◆ MicroGMTIsolationUnit()

l1t::MicroGMTIsolationUnit::MicroGMTIsolationUnit ( )

◆ ~MicroGMTIsolationUnit()

l1t::MicroGMTIsolationUnit::~MicroGMTIsolationUnit ( )
virtual

Definition at line 10 of file MicroGMTIsolationUnit.cc.

10 {}

Member Function Documentation

◆ calculate5by1Sums()

void l1t::MicroGMTIsolationUnit::calculate5by1Sums ( const MicroGMTConfiguration::CaloInputCollection inputs,
int  bx 
)

Definition at line 107 of file MicroGMTIsolationUnit.cc.

References simKBmtfDigis_cfi::bx, LEDCalibrationChannels::ieta, PixelMapPlotter::inputs, and LEDCalibrationChannels::iphi.

107  {
108  m_5by1TowerSums.clear();
109  if (inputs.size(bx) == 0)
110  return;
111 
112  for (int iphi = 0; iphi < 36; ++iphi) {
113  int iphiIndexOffset = iphi * 28;
114  // ieta = 0 (tower -28) and ieta = 1 (tower 27)
115  // 3by1 and 4by1 sums
116  for (int ieta = 0; ieta < 2; ++ieta) {
117  int sum = 0;
118  for (int dIEta = 0 - ieta; dIEta <= 2; ++dIEta) {
119  if (m_caloInputsToDisable.test(ieta + dIEta) || m_maskedCaloInputs.test(ieta + dIEta))
120  continue; // only process if input link is enabled and not masked
121  sum += inputs.at(bx, iphiIndexOffset + dIEta).etBits();
122  }
123  m_5by1TowerSums.push_back(sum);
124  }
125  // 5by1 sums
126  for (int ieta = 2; ieta < 26; ++ieta) {
127  int sum = 0;
128  for (int dIEta = -2; dIEta <= 2; ++dIEta) {
129  if (m_caloInputsToDisable.test(ieta + dIEta) || m_maskedCaloInputs.test(ieta + dIEta))
130  continue; // only process if input link is enabled and not masked
131  sum += inputs.at(bx, iphiIndexOffset + dIEta).etBits();
132  }
133  m_5by1TowerSums.push_back(sum);
134  }
135  // ieta = 26 (tower 27) and ieta = 27 (tower 28)
136  // 4by1 and 3by1 sums
137  for (int ieta = 26; ieta < 28; ++ieta) {
138  int sum = 0;
139  for (int dIEta = -2; dIEta <= 27 - ieta; ++dIEta) {
140  if (m_caloInputsToDisable.test(ieta + dIEta) || m_maskedCaloInputs.test(ieta + dIEta))
141  continue; // only process if input link is enabled and not masked
142  sum += inputs.at(bx, iphiIndexOffset + dIEta).etBits();
143  }
144  m_5by1TowerSums.push_back(sum);
145  }
146  }
147 
148  m_initialSums = true;
149 }
std::bitset< 28 > m_caloInputsToDisable
std::bitset< 28 > m_maskedCaloInputs
std::vector< int > m_5by1TowerSums

◆ calculate5by5Sum()

int l1t::MicroGMTIsolationUnit::calculate5by5Sum ( unsigned  index) const

Definition at line 151 of file MicroGMTIsolationUnit.cc.

References SiStripPI::min.

151  {
152  if (index > m_5by1TowerSums.size()) {
153  edm::LogWarning("energysum out of bounds!");
154  return 0;
155  }
156  // phi wrap around:
157  int returnSum = 0;
158  for (int dIPhi = -2; dIPhi <= 2; ++dIPhi) {
159  int currIndex = (index + dIPhi * 28) % 1008; // wrap-around at top
160  if (currIndex < 0)
161  currIndex = 1008 + currIndex;
162  if ((unsigned)currIndex < m_5by1TowerSums.size()) {
163  returnSum += m_5by1TowerSums[currIndex];
164  } else {
165  edm::LogWarning("energysum out of bounds!");
166  }
167  }
168  return std::min(31, returnSum);
169 }
Log< level::Warning, false > LogWarning
std::vector< int > m_5by1TowerSums

◆ extrapolateMuons()

void l1t::MicroGMTIsolationUnit::extrapolateMuons ( MicroGMTConfiguration::InterMuonList inputmuons) const

Definition at line 67 of file MicroGMTIsolationUnit.cc.

References funct::abs(), spr::deltaEta, SiPixelRawToDigiRegional_cfi::deltaPhi, amptDefaultParameters_cff::mu, and Validation_hcalonly_cfi::sign.

Referenced by L1TMuonProducer::produce().

67  {
68  int outputShiftPhi = 3;
69  int outputShiftEta = 3;
70  if (m_fwVersion >= 0x4010000) {
71  outputShiftPhi = 2;
72  outputShiftEta = 0;
73  }
74 
75  for (auto& mu : inputmuons) {
76  // get input format
77  std::shared_ptr<MicroGMTExtrapolationLUT> phiExtrapolationLUT = m_phiExtrapolationLUTs.at(mu->trackFinderType());
78  int ptRedInWidth = phiExtrapolationLUT->getPtRedInWidth();
79  int ptMask = (1 << ptRedInWidth) - 1;
80  int etaRedInWidth = phiExtrapolationLUT->getEtaRedInWidth();
81  int redEtaShift = 8 - etaRedInWidth;
82 
83  // only use LSBs of pt:
84  int ptRed = mu->hwPt() & ptMask;
85  // here we drop the LSBs and mask the MSB
86  int etaAbsRed = (std::abs(mu->hwEta()) >> redEtaShift) & ((1 << etaRedInWidth) - 1);
87 
88  int deltaPhi = 0;
89  int deltaEta = 0;
90 
91  if (mu->hwPt() < (1 << ptRedInWidth)) { // extrapolation only for "low" pT muons
92  int sign = 1;
93  if (mu->hwSign() == 1) {
94  sign = -1;
95  }
96  deltaPhi = (phiExtrapolationLUT->lookup(etaAbsRed, ptRed) << outputShiftPhi) * sign;
97  deltaEta = (m_etaExtrapolationLUTs.at(mu->trackFinderType())->lookup(etaAbsRed, ptRed) << outputShiftEta);
98  if (mu->hwEta() > 0) {
99  deltaEta *= -1;
100  }
101  }
102 
103  mu->setExtrapolation(deltaEta, deltaPhi);
104  }
105 }
std::map< tftype, std::shared_ptr< MicroGMTExtrapolationLUT > > m_etaExtrapolationLUTs
static const double deltaEta
Definition: CaloConstants.h:8
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::map< tftype, std::shared_ptr< MicroGMTExtrapolationLUT > > m_phiExtrapolationLUTs

◆ getCaloIndex()

int l1t::MicroGMTIsolationUnit::getCaloIndex ( MicroGMTConfiguration::InterMuon mu) const

Definition at line 50 of file MicroGMTIsolationUnit.cc.

References PVValHelper::eta, l1t::MicroGMTConfiguration::getTwosComp(), and amptDefaultParameters_cff::mu.

50  {
51  // handle the wrap-around of phi:
52  int phi = (mu.hwGlobalPhi() + mu.hwDPhi()) % 576;
53  if (phi < 0) {
54  phi = 576 + phi;
55  }
56 
57  int phiIndex = m_IdxSelMemPhi->lookup(phi);
58  int eta = mu.hwEta() + mu.hwDEta();
60  int etaIndex = m_IdxSelMemEta->lookup(eta);
61  mu.setHwCaloEta(etaIndex);
62  mu.setHwCaloPhi(phiIndex);
63 
64  return phiIndex + etaIndex * 36;
65 }
static unsigned getTwosComp(const int signedInt, const int width)
std::shared_ptr< MicroGMTCaloIndexSelectionLUT > m_IdxSelMemEta
std::shared_ptr< MicroGMTCaloIndexSelectionLUT > m_IdxSelMemPhi

◆ initialise()

void l1t::MicroGMTIsolationUnit::initialise ( L1TMuonGlobalParamsHelper microGMTParamsHelper)

Initialisation from ES record.

Definition at line 12 of file MicroGMTIsolationUnit.cc.

References L1TMuonGlobalParamsHelper::absIsoCheckMemLUT(), L1TMuonGlobalParamsHelper::bEtaExtrapolationLUT(), l1t::bmtf, L1TMuonGlobalParamsHelper::bPhiExtrapolationLUT(), L1TMuonGlobalParamsHelper::caloInputsToDisable(), l1t::MicroGMTExtrapolationLUTFactory::create(), l1t::MicroGMTCaloIndexSelectionLUTFactory::create(), l1t::MicroGMTAbsoluteIsolationCheckLUTFactory::create(), l1t::MicroGMTRelativeIsolationCheckLUTFactory::create(), l1t::emtf_neg, l1t::emtf_pos, l1t::MicroGMTConfiguration::ETA, l1t::MicroGMTConfiguration::ETA_OUT, L1TMuonGlobalParamsHelper::fEtaExtrapolationLUT(), L1TMuonGlobalParamsHelper::fPhiExtrapolationLUT(), L1TMuonGlobalParamsHelper::fwVersion(), L1TMuonGlobalParamsHelper::idxSelMemEtaLUT(), L1TMuonGlobalParamsHelper::idxSelMemPhiLUT(), L1TMuonGlobalParamsHelper::maskedCaloInputs(), L1TMuonGlobalParamsHelper::oEtaExtrapolationLUT(), l1t::omtf_neg, l1t::omtf_pos, L1TMuonGlobalParamsHelper::oPhiExtrapolationLUT(), l1t::MicroGMTConfiguration::PHI, l1t::MicroGMTConfiguration::PHI_OUT, and L1TMuonGlobalParamsHelper::relIsoCheckMemLUT().

Referenced by L1TMuonProducer::beginRun().

12  {
13  m_fwVersion = microGMTParamsHelper->fwVersion();
27  microGMTParamsHelper->idxSelMemEtaLUT(), MicroGMTConfiguration::ETA, m_fwVersion);
29  microGMTParamsHelper->idxSelMemPhiLUT(), MicroGMTConfiguration::PHI, m_fwVersion);
34 
45 
46  m_caloInputsToDisable = microGMTParamsHelper->caloInputsToDisable();
47  m_maskedCaloInputs = microGMTParamsHelper->maskedCaloInputs();
48 }
std::shared_ptr< MicroGMTCaloIndexSelectionLUT > m_IdxSelMemEta
std::shared_ptr< MicroGMTExtrapolationLUT > m_OPhiExtrapolation
std::shared_ptr< MicroGMTAbsoluteIsolationCheckLUT > m_AbsIsoCheckMem
std::map< tftype, std::shared_ptr< MicroGMTExtrapolationLUT > > m_etaExtrapolationLUTs
static ReturnType create(const std::string &filename, const int fwVersion)
std::shared_ptr< MicroGMTRelativeIsolationCheckLUT > m_RelIsoCheckMem
std::bitset< 28 > m_caloInputsToDisable
static ReturnType create(const std::string &filename, const int type, const int fwVersion)
static ReturnType create(const std::string &filename, const int fwVersion)
std::shared_ptr< MicroGMTExtrapolationLUT > m_FEtaExtrapolation
std::shared_ptr< MicroGMTExtrapolationLUT > m_BPhiExtrapolation
std::shared_ptr< MicroGMTExtrapolationLUT > m_OEtaExtrapolation
std::shared_ptr< MicroGMTExtrapolationLUT > m_FPhiExtrapolation
std::shared_ptr< MicroGMTCaloIndexSelectionLUT > m_IdxSelMemPhi
std::bitset< 28 > maskedCaloInputs() const
std::shared_ptr< MicroGMTExtrapolationLUT > m_BEtaExtrapolation
std::bitset< 28 > m_maskedCaloInputs
std::map< tftype, std::shared_ptr< MicroGMTExtrapolationLUT > > m_phiExtrapolationLUTs
static ReturnType create(const std::string &filename, const int type, const int fwVersion)
std::bitset< 28 > caloInputsToDisable() const

◆ isolate()

void l1t::MicroGMTIsolationUnit::isolate ( MicroGMTConfiguration::InterMuonList muons) const

Definition at line 171 of file MicroGMTIsolationUnit.cc.

References objects.autophobj::absIso, CastorDataFrameFilter_impl::energySum(), amptDefaultParameters_cff::mu, PDWG_BPHSkim_cff::muons, and objects.autophobj::relIso.

171  {
172  for (auto& mu : muons) {
173  int caloIndex = getCaloIndex(*mu);
174  int energySum = calculate5by5Sum(caloIndex);
175  mu->setHwIsoSum(energySum);
176 
177  int absIso = m_AbsIsoCheckMem->lookup(energySum);
178  int relIso = m_RelIsoCheckMem->lookup(energySum, mu->hwPt());
179 
180  mu->setHwRelIso(relIso);
181  mu->setHwAbsIso(absIso);
182  }
183 }
std::shared_ptr< MicroGMTAbsoluteIsolationCheckLUT > m_AbsIsoCheckMem
std::shared_ptr< MicroGMTRelativeIsolationCheckLUT > m_RelIsoCheckMem
int calculate5by5Sum(unsigned index) const
double energySum(const DataFrame &df, int fs, int ls)
int getCaloIndex(MicroGMTConfiguration::InterMuon &) const

◆ isolatePreSummed()

void l1t::MicroGMTIsolationUnit::isolatePreSummed ( MicroGMTConfiguration::InterMuonList muons) const

Definition at line 203 of file MicroGMTIsolationUnit.cc.

References objects.autophobj::absIso, CastorDataFrameFilter_impl::energySum(), amptDefaultParameters_cff::mu, PDWG_BPHSkim_cff::muons, and objects.autophobj::relIso.

Referenced by L1TMuonProducer::produce().

203  {
204  for (const auto& mu : muons) {
205  int caloIndex = getCaloIndex(*mu);
206  int energySum = 0;
207  if (m_towerEnergies.count(caloIndex) == 1) {
208  energySum = m_towerEnergies.at(caloIndex);
209  }
210 
211  mu->setHwIsoSum(energySum);
212 
213  int absIso = m_AbsIsoCheckMem->lookup(energySum);
214  int relIso = m_RelIsoCheckMem->lookup(energySum, mu->hwPt());
215 
216  mu->setHwRelIso(relIso);
217  mu->setHwAbsIso(absIso);
218  }
219 }
std::shared_ptr< MicroGMTAbsoluteIsolationCheckLUT > m_AbsIsoCheckMem
std::map< int, int > m_towerEnergies
std::shared_ptr< MicroGMTRelativeIsolationCheckLUT > m_RelIsoCheckMem
double energySum(const DataFrame &df, int fs, int ls)
int getCaloIndex(MicroGMTConfiguration::InterMuon &) const

◆ setTowerSums()

void l1t::MicroGMTIsolationUnit::setTowerSums ( const MicroGMTConfiguration::CaloInputCollection inputs,
int  bx 
)

Definition at line 185 of file MicroGMTIsolationUnit.cc.

References simKBmtfDigis_cfi::bx, input, and PixelMapPlotter::inputs.

Referenced by L1TMuonProducer::produce().

185  {
186  m_towerEnergies.clear();
187  if (bx < inputs.getFirstBX() || bx > inputs.getLastBX())
188  return;
189  if (inputs.size(bx) == 0)
190  return;
191  for (auto input = inputs.begin(bx); input != inputs.end(bx); ++input) {
192  if (m_caloInputsToDisable.test(input->hwEta()) || m_maskedCaloInputs.test(input->hwEta())) {
193  continue; // only process if input link is enabled and not masked
194  }
195  if (input->etBits() != 0) {
196  m_towerEnergies[input->hwEta() * 36 + input->hwPhi()] = input->etBits();
197  }
198  }
199 
200  m_initialSums = true;
201 }
std::map< int, int > m_towerEnergies
std::bitset< 28 > m_caloInputsToDisable
static std::string const input
Definition: EdmProvDump.cc:47
std::bitset< 28 > m_maskedCaloInputs

Member Data Documentation

◆ m_5by1TowerSums

std::vector<int> l1t::MicroGMTIsolationUnit::m_5by1TowerSums
private

Definition at line 59 of file MicroGMTIsolationUnit.h.

◆ m_AbsIsoCheckMem

std::shared_ptr<MicroGMTAbsoluteIsolationCheckLUT> l1t::MicroGMTIsolationUnit::m_AbsIsoCheckMem
private

Definition at line 54 of file MicroGMTIsolationUnit.h.

◆ m_BEtaExtrapolation

std::shared_ptr<MicroGMTExtrapolationLUT> l1t::MicroGMTIsolationUnit::m_BEtaExtrapolation
private

Definition at line 40 of file MicroGMTIsolationUnit.h.

◆ m_BPhiExtrapolation

std::shared_ptr<MicroGMTExtrapolationLUT> l1t::MicroGMTIsolationUnit::m_BPhiExtrapolation
private

Definition at line 41 of file MicroGMTIsolationUnit.h.

◆ m_caloInputsToDisable

std::bitset<28> l1t::MicroGMTIsolationUnit::m_caloInputsToDisable
private

Definition at line 56 of file MicroGMTIsolationUnit.h.

◆ m_etaExtrapolationLUTs

std::map<tftype, std::shared_ptr<MicroGMTExtrapolationLUT> > l1t::MicroGMTIsolationUnit::m_etaExtrapolationLUTs
private

Definition at line 48 of file MicroGMTIsolationUnit.h.

◆ m_FEtaExtrapolation

std::shared_ptr<MicroGMTExtrapolationLUT> l1t::MicroGMTIsolationUnit::m_FEtaExtrapolation
private

Definition at line 44 of file MicroGMTIsolationUnit.h.

◆ m_FPhiExtrapolation

std::shared_ptr<MicroGMTExtrapolationLUT> l1t::MicroGMTIsolationUnit::m_FPhiExtrapolation
private

Definition at line 45 of file MicroGMTIsolationUnit.h.

◆ m_fwVersion

int l1t::MicroGMTIsolationUnit::m_fwVersion
private

Definition at line 38 of file MicroGMTIsolationUnit.h.

◆ m_IdxSelMemEta

std::shared_ptr<MicroGMTCaloIndexSelectionLUT> l1t::MicroGMTIsolationUnit::m_IdxSelMemEta
private

Definition at line 50 of file MicroGMTIsolationUnit.h.

◆ m_IdxSelMemPhi

std::shared_ptr<MicroGMTCaloIndexSelectionLUT> l1t::MicroGMTIsolationUnit::m_IdxSelMemPhi
private

Definition at line 51 of file MicroGMTIsolationUnit.h.

◆ m_initialSums

bool l1t::MicroGMTIsolationUnit::m_initialSums
private

Definition at line 61 of file MicroGMTIsolationUnit.h.

◆ m_maskedCaloInputs

std::bitset<28> l1t::MicroGMTIsolationUnit::m_maskedCaloInputs
private

Definition at line 57 of file MicroGMTIsolationUnit.h.

◆ m_OEtaExtrapolation

std::shared_ptr<MicroGMTExtrapolationLUT> l1t::MicroGMTIsolationUnit::m_OEtaExtrapolation
private

Definition at line 42 of file MicroGMTIsolationUnit.h.

◆ m_OPhiExtrapolation

std::shared_ptr<MicroGMTExtrapolationLUT> l1t::MicroGMTIsolationUnit::m_OPhiExtrapolation
private

Definition at line 43 of file MicroGMTIsolationUnit.h.

◆ m_phiExtrapolationLUTs

std::map<tftype, std::shared_ptr<MicroGMTExtrapolationLUT> > l1t::MicroGMTIsolationUnit::m_phiExtrapolationLUTs
private

Definition at line 47 of file MicroGMTIsolationUnit.h.

◆ m_RelIsoCheckMem

std::shared_ptr<MicroGMTRelativeIsolationCheckLUT> l1t::MicroGMTIsolationUnit::m_RelIsoCheckMem
private

Definition at line 53 of file MicroGMTIsolationUnit.h.

◆ m_towerEnergies

std::map<int, int> l1t::MicroGMTIsolationUnit::m_towerEnergies
private

Definition at line 60 of file MicroGMTIsolationUnit.h.