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

l1t::MicroGMTIsolationUnit::MicroGMTIsolationUnit ( )
l1t::MicroGMTIsolationUnit::~MicroGMTIsolationUnit ( )
virtual

Definition at line 13 of file MicroGMTIsolationUnit.cc.

14 {
15 }

Member Function Documentation

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

Definition at line 107 of file MicroGMTIsolationUnit.cc.

References BXVector< T >::at(), m_5by1TowerSums, m_caloInputsToDisable, m_initialSums, m_maskedCaloInputs, and BXVector< T >::size().

108 {
109  m_5by1TowerSums.clear();
110  if (inputs.size(bx) == 0) 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)) continue; // only process if input link is enabled and not masked
120  sum += inputs.at(bx, iphiIndexOffset+dIEta).etBits();
121  }
122  m_5by1TowerSums.push_back(sum);
123  }
124  // 5by1 sums
125  for (int ieta = 2; ieta < 26; ++ieta) {
126  int sum = 0;
127  for (int dIEta = -2; dIEta <= 2; ++dIEta) {
128  if (m_caloInputsToDisable.test(ieta+dIEta) || m_maskedCaloInputs.test(ieta+dIEta)) continue; // only process if input link is enabled and not masked
129  sum += inputs.at(bx, iphiIndexOffset+dIEta).etBits();
130  }
131  m_5by1TowerSums.push_back(sum);
132  }
133  // ieta = 26 (tower 27) and ieta = 27 (tower 28)
134  // 4by1 and 3by1 sums
135  for (int ieta = 26; ieta < 28; ++ieta) {
136  int sum = 0;
137  for (int dIEta = -2; dIEta <= 27-ieta; ++dIEta) {
138  if (m_caloInputsToDisable.test(ieta+dIEta) || m_maskedCaloInputs.test(ieta+dIEta)) continue; // only process if input link is enabled and not masked
139  sum += inputs.at(bx, iphiIndexOffset+dIEta).etBits();
140  }
141  m_5by1TowerSums.push_back(sum);
142  }
143  }
144 
145  m_initialSums = true;
146 }
std::bitset< 28 > m_caloInputsToDisable
std::bitset< 28 > m_maskedCaloInputs
std::vector< int > m_5by1TowerSums
int l1t::MicroGMTIsolationUnit::calculate5by5Sum ( unsigned  index) const

Definition at line 150 of file MicroGMTIsolationUnit.cc.

References m_5by1TowerSums, and min().

Referenced by isolate().

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) currIndex = 1008+currIndex;
161  if ((unsigned)currIndex < m_5by1TowerSums.size()) {
162  returnSum += m_5by1TowerSums[currIndex];
163  } else {
164  edm::LogWarning("energysum out of bounds!");
165  }
166  }
167  return std::min(31, returnSum);
168 }
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< int > m_5by1TowerSums
void l1t::MicroGMTIsolationUnit::extrapolateMuons ( MicroGMTConfiguration::InterMuonList inputmuons) const

Definition at line 66 of file MicroGMTIsolationUnit.cc.

References funct::abs(), spr::deltaEta, hiPixelPairStep_cff::deltaPhi, m_etaExtrapolationLUTs, m_fwVersion, m_phiExtrapolationLUTs, RPCpg::mu, and Validation_hcalonly_cfi::sign.

Referenced by L1TMuonProducer::produce().

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

Definition at line 47 of file MicroGMTIsolationUnit.cc.

References PVValHelper::eta, l1t::MicroGMTConfiguration::getTwosComp(), l1t::GMTInternalMuon::hwDEta(), l1t::GMTInternalMuon::hwDPhi(), l1t::GMTInternalMuon::hwEta(), l1t::GMTInternalMuon::hwGlobalPhi(), m_IdxSelMemEta, m_IdxSelMemPhi, l1t::GMTInternalMuon::setHwCaloEta(), and l1t::GMTInternalMuon::setHwCaloPhi().

Referenced by isolate(), and isolatePreSummed().

48 {
49  // handle the wrap-around of phi:
50  int phi = (mu.hwGlobalPhi() + mu.hwDPhi())%576;
51  if (phi < 0) {
52  phi = 576+phi;
53  }
54 
55  int phiIndex = m_IdxSelMemPhi->lookup(phi);
56  int eta = mu.hwEta()+mu.hwDEta();
58  int etaIndex = m_IdxSelMemEta->lookup(eta);
59  mu.setHwCaloEta(etaIndex);
60  mu.setHwCaloPhi(phiIndex);
61 
62  return phiIndex + etaIndex*36;
63 }
static unsigned getTwosComp(const int signedInt, const int width)
std::shared_ptr< MicroGMTCaloIndexSelectionLUT > m_IdxSelMemEta
const int mu
Definition: Constants.h:22
std::shared_ptr< MicroGMTCaloIndexSelectionLUT > m_IdxSelMemPhi
void l1t::MicroGMTIsolationUnit::initialise ( L1TMuonGlobalParamsHelper microGMTParamsHelper)

Initialisation from ES record.

Definition at line 18 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(), m_AbsIsoCheckMem, m_BEtaExtrapolation, m_BPhiExtrapolation, m_caloInputsToDisable, m_etaExtrapolationLUTs, m_FEtaExtrapolation, m_FPhiExtrapolation, m_fwVersion, m_IdxSelMemEta, m_IdxSelMemPhi, m_maskedCaloInputs, m_OEtaExtrapolation, m_OPhiExtrapolation, m_phiExtrapolationLUTs, m_RelIsoCheckMem, 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().

18  {
19  m_fwVersion = microGMTParamsHelper->fwVersion();
30 
33  m_etaExtrapolationLUTs[tftype::omtf_pos] = m_OEtaExtrapolation;
34  m_etaExtrapolationLUTs[tftype::omtf_neg] = m_OEtaExtrapolation;
37  m_etaExtrapolationLUTs[tftype::emtf_pos] = m_FEtaExtrapolation;
38  m_etaExtrapolationLUTs[tftype::emtf_neg] = m_FEtaExtrapolation;
41 
42  m_caloInputsToDisable = microGMTParamsHelper->caloInputsToDisable();
43  m_maskedCaloInputs = microGMTParamsHelper->maskedCaloInputs();
44 }
std::shared_ptr< MicroGMTCaloIndexSelectionLUT > m_IdxSelMemEta
std::shared_ptr< MicroGMTExtrapolationLUT > m_OPhiExtrapolation
std::bitset< 28 > caloInputsToDisable() const
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::shared_ptr< MicroGMTExtrapolationLUT > m_BEtaExtrapolation
std::bitset< 28 > m_maskedCaloInputs
std::map< tftype, std::shared_ptr< MicroGMTExtrapolationLUT > > m_phiExtrapolationLUTs
std::bitset< 28 > maskedCaloInputs() const
static ReturnType create(const std::string &filename, const int type, const int fwVersion)
void l1t::MicroGMTIsolationUnit::isolate ( MicroGMTConfiguration::InterMuonList muons) const

Definition at line 171 of file MicroGMTIsolationUnit.cc.

References objects.autophobj::absIso, calculate5by5Sum(), CastorDataFrameFilter_impl::energySum(), getCaloIndex(), m_AbsIsoCheckMem, m_RelIsoCheckMem, RPCpg::mu, and objects.autophobj::relIso.

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

Definition at line 203 of file MicroGMTIsolationUnit.cc.

References objects.autophobj::absIso, CastorDataFrameFilter_impl::energySum(), getCaloIndex(), m_AbsIsoCheckMem, m_RelIsoCheckMem, m_towerEnergies, RPCpg::mu, and objects.autophobj::relIso.

Referenced by L1TMuonProducer::produce().

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

Definition at line 186 of file MicroGMTIsolationUnit.cc.

References BXVector< T >::begin(), BXVector< T >::end(), BXVector< T >::getFirstBX(), BXVector< T >::getLastBX(), input, m_caloInputsToDisable, m_initialSums, m_maskedCaloInputs, m_towerEnergies, and BXVector< T >::size().

Referenced by L1TMuonProducer::produce().

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

Member Data Documentation

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

Definition at line 59 of file MicroGMTIsolationUnit.h.

Referenced by calculate5by1Sums(), and calculate5by5Sum().

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

Definition at line 54 of file MicroGMTIsolationUnit.h.

Referenced by initialise(), isolate(), and isolatePreSummed().

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

Definition at line 40 of file MicroGMTIsolationUnit.h.

Referenced by initialise().

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

Definition at line 41 of file MicroGMTIsolationUnit.h.

Referenced by initialise().

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

Definition at line 56 of file MicroGMTIsolationUnit.h.

Referenced by calculate5by1Sums(), initialise(), and setTowerSums().

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

Definition at line 48 of file MicroGMTIsolationUnit.h.

Referenced by extrapolateMuons(), and initialise().

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

Definition at line 44 of file MicroGMTIsolationUnit.h.

Referenced by initialise().

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

Definition at line 45 of file MicroGMTIsolationUnit.h.

Referenced by initialise().

int l1t::MicroGMTIsolationUnit::m_fwVersion
private

Definition at line 38 of file MicroGMTIsolationUnit.h.

Referenced by extrapolateMuons(), and initialise().

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

Definition at line 50 of file MicroGMTIsolationUnit.h.

Referenced by getCaloIndex(), and initialise().

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

Definition at line 51 of file MicroGMTIsolationUnit.h.

Referenced by getCaloIndex(), and initialise().

bool l1t::MicroGMTIsolationUnit::m_initialSums
private

Definition at line 61 of file MicroGMTIsolationUnit.h.

Referenced by calculate5by1Sums(), and setTowerSums().

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

Definition at line 57 of file MicroGMTIsolationUnit.h.

Referenced by calculate5by1Sums(), initialise(), and setTowerSums().

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

Definition at line 42 of file MicroGMTIsolationUnit.h.

Referenced by initialise().

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

Definition at line 43 of file MicroGMTIsolationUnit.h.

Referenced by initialise().

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

Definition at line 47 of file MicroGMTIsolationUnit.h.

Referenced by extrapolateMuons(), and initialise().

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

Definition at line 53 of file MicroGMTIsolationUnit.h.

Referenced by initialise(), isolate(), and isolatePreSummed().

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

Definition at line 60 of file MicroGMTIsolationUnit.h.

Referenced by isolatePreSummed(), and setTowerSums().