test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
< MicroGMTAbsoluteIsolationCheckLUT
m_AbsIsoCheckMem
 
std::shared_ptr
< MicroGMTExtrapolationLUT
m_BEtaExtrapolation
 
std::shared_ptr
< MicroGMTExtrapolationLUT
m_BPhiExtrapolation
 
std::map< tftype,
std::shared_ptr
< MicroGMTExtrapolationLUT > > 
m_etaExtrapolationLUTs
 
std::shared_ptr
< MicroGMTExtrapolationLUT
m_FEtaExtrapolation
 
std::shared_ptr
< MicroGMTExtrapolationLUT
m_FPhiExtrapolation
 
std::shared_ptr
< MicroGMTCaloIndexSelectionLUT
m_IdxSelMemEta
 
std::shared_ptr
< MicroGMTCaloIndexSelectionLUT
m_IdxSelMemPhi
 
bool m_initialSums
 
std::shared_ptr
< MicroGMTExtrapolationLUT
m_OEtaExtrapolation
 
std::shared_ptr
< MicroGMTExtrapolationLUT
m_OPhiExtrapolation
 
std::map< tftype,
std::shared_ptr
< MicroGMTExtrapolationLUT > > 
m_phiExtrapolationLUTs
 
std::shared_ptr
< MicroGMTRelativeIsolationCheckLUT
m_RelIsoCheckMem
 
std::map< int, int > m_towerEnergies
 

Detailed Description

Definition at line 14 of file MicroGMTIsolationUnit.h.

Constructor & Destructor Documentation

l1t::MicroGMTIsolationUnit::MicroGMTIsolationUnit ( )

Definition at line 9 of file MicroGMTIsolationUnit.cc.

9  : m_initialSums(false)
10 {
11 }
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 87 of file MicroGMTIsolationUnit.cc.

References BXVector< T >::at(), and BXVector< T >::size().

88 {
89  m_5by1TowerSums.clear();
90  if (inputs.size(bx) == 0) return;
91 
92  for (int iphi = 0; iphi < 36; ++iphi) {
93  int iphiIndexOffset = iphi*28;
94  m_5by1TowerSums.push_back(inputs.at(bx, iphiIndexOffset).etBits()+inputs.at(bx, iphiIndexOffset+1).etBits()+inputs.at(bx, iphiIndexOffset+2).etBits());//ieta = 0 (tower -28)
95  m_5by1TowerSums.push_back(inputs.at(bx, iphiIndexOffset-1).etBits()+inputs.at(bx, iphiIndexOffset).etBits()+inputs.at(bx, iphiIndexOffset+1).etBits()+inputs.at(bx, iphiIndexOffset+2).etBits()); //
96  for (int ieta = 2; ieta < 26; ++ieta) {
97  int sum = 0;
98  for (int dIEta = -2; dIEta <= 2; ++dIEta) {
99  sum += inputs.at(bx, iphiIndexOffset+dIEta).etBits();
100  }
101  m_5by1TowerSums.push_back(sum);
102  }
103  m_5by1TowerSums.push_back(inputs.at(bx, iphiIndexOffset+1).etBits()+inputs.at(bx, iphiIndexOffset).etBits()+inputs.at(bx, iphiIndexOffset-1).etBits()+inputs.at(bx, iphiIndexOffset-2).etBits());
104  m_5by1TowerSums.push_back(inputs.at(bx, iphiIndexOffset).etBits()+inputs.at(bx, iphiIndexOffset-1).etBits()+inputs.at(bx, iphiIndexOffset-2).etBits());//ieta = 0 (tower 28)
105  }
106 
107  m_initialSums = true;
108 }
std::vector< int > m_5by1TowerSums
int l1t::MicroGMTIsolationUnit::calculate5by5Sum ( unsigned  index) const

Definition at line 112 of file MicroGMTIsolationUnit.cc.

References min().

113 {
114  if (index > m_5by1TowerSums.size()) {
115  edm::LogWarning("energysum out of bounds!");
116  return 0;
117  }
118  // phi wrap around:
119  int returnSum = 0;
120  for (int dIPhi = -2; dIPhi <= 2; ++dIPhi) {
121  int currIndex = (index + dIPhi*28)%1008; // wrap-around at top
122  if (currIndex < 0) currIndex = 1008+currIndex;
123  if ((unsigned)currIndex < m_5by1TowerSums.size()) {
124  returnSum += m_5by1TowerSums[currIndex];
125  } else {
126  edm::LogWarning("energysum out of bounds!");
127  }
128  }
129  return std::min(31, returnSum);
130 }
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 63 of file MicroGMTIsolationUnit.cc.

References funct::abs(), spr::deltaEta, SiPixelRawToDigiRegional_cfi::deltaPhi, RPCpg::mu, and jetcorrextractor::sign().

Referenced by L1TMuonProducer::produce().

63  {
64  for (auto &mu : inputmuons) {
65  // only use 6 LSBs of pt:
66  int ptRed = mu->hwPt() & 0b111111;
67  // here we drop the two LSBs and masking the MSB
68  int etaAbsRed = (std::abs(mu->hwEta()) >> 2) & ((1 << 6) - 1);
69 
70  int deltaPhi = 0;
71  int deltaEta = 0;
72 
73  if (mu->hwPt() < 64) { // extrapolation only for "low" pT muons
74  int sign = 1;
75  if (mu->hwSign() == 1) {
76  sign = -1;
77  }
78  deltaPhi = (m_phiExtrapolationLUTs.at(mu->trackFinderType())->lookup(etaAbsRed, ptRed) << 3) * sign;
79  deltaEta = (m_etaExtrapolationLUTs.at(mu->trackFinderType())->lookup(etaAbsRed, ptRed) << 3);
80  }
81 
82  mu->setExtrapolation(deltaEta, deltaPhi);
83  }
84 }
double sign(double x)
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 44 of file MicroGMTIsolationUnit.cc.

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

45 {
46  // handle the wrap-around of phi:
47  int phi = (mu.hwGlobalPhi() + mu.hwDPhi())%576;
48  if (phi < 0) {
49  phi = 576+phi;
50  }
51 
52  int phiIndex = m_IdxSelMemPhi->lookup(phi);
53  int eta = mu.hwEta()+mu.hwDEta();
55  int etaIndex = m_IdxSelMemEta->lookup(eta);
56  mu.setHwCaloEta(etaIndex);
57  mu.setHwCaloPhi(phiIndex);
58 
59  return phiIndex + etaIndex*36;
60 }
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(), 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(), stage2BMTFBufferRaw_cfi::fwVersion, L1TMuonGlobalParamsHelper::fwVersion(), L1TMuonGlobalParamsHelper::idxSelMemEtaLUT(), L1TMuonGlobalParamsHelper::idxSelMemPhiLUT(), 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  int 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 }
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
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::map< tftype, std::shared_ptr< MicroGMTExtrapolationLUT > > m_phiExtrapolationLUTs
static ReturnType create(const std::string &filename, const int type, const int fwVersion)
void l1t::MicroGMTIsolationUnit::isolate ( MicroGMTConfiguration::InterMuonList muons) const

Definition at line 133 of file MicroGMTIsolationUnit.cc.

References CastorDataFrameFilter_impl::energySum(), RPCpg::mu, and objects.IsoTrackAnalyzer::relIso.

134 {
135  for (auto& mu : muons) {
136  int caloIndex = getCaloIndex(*mu);
137  int energySum = calculate5by5Sum(caloIndex);
138  mu->setHwIsoSum(energySum);
139 
140  int absIso = m_AbsIsoCheckMem->lookup(energySum);
141  int relIso = m_RelIsoCheckMem->lookup(energySum, mu->hwPt());
142 
143  mu->setHwRelIso(relIso);
144  mu->setHwAbsIso(absIso);
145  }
146 }
std::shared_ptr< MicroGMTAbsoluteIsolationCheckLUT > m_AbsIsoCheckMem
std::shared_ptr< MicroGMTRelativeIsolationCheckLUT > m_RelIsoCheckMem
const int mu
Definition: Constants.h:22
int getCaloIndex(MicroGMTConfiguration::InterMuon &) const
tuple muons
Definition: patZpeak.py:38
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 162 of file MicroGMTIsolationUnit.cc.

References CastorDataFrameFilter_impl::energySum(), RPCpg::mu, and objects.IsoTrackAnalyzer::relIso.

Referenced by L1TMuonProducer::produce().

163 {
164  for (auto mu : muons) {
165  int caloIndex = getCaloIndex(*mu);
166  int energySum = 0;
167  if (m_towerEnergies.count(caloIndex) == 1) {
168  energySum = m_towerEnergies.at(caloIndex);
169  }
170 
171  mu->setHwIsoSum(energySum);
172 
173  int absIso = m_AbsIsoCheckMem->lookup(energySum);
174  int relIso = m_RelIsoCheckMem->lookup(energySum, mu->hwPt());
175 
176  mu->setHwRelIso(relIso);
177  mu->setHwAbsIso(absIso);
178  }
179 
180 }
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
tuple muons
Definition: patZpeak.py:38
double energySum(const DataFrame &df, int fs, int ls)
void l1t::MicroGMTIsolationUnit::setTowerSums ( const MicroGMTConfiguration::CaloInputCollection inputs,
int  bx 
)

Definition at line 148 of file MicroGMTIsolationUnit.cc.

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

Referenced by L1TMuonProducer::produce().

148  {
149  m_towerEnergies.clear();
150  if (bx < inputs.getFirstBX() || bx > inputs.getLastBX()) return;
151  if (inputs.size(bx) == 0) return;
152  for (auto input = inputs.begin(bx); input != inputs.end(bx); ++input) {
153  if ( input->etBits() != 0 ) {
154  m_towerEnergies[input->hwEta()*36+input->hwPhi()] = input->etBits();
155  }
156  }
157 
158  m_initialSums = true;
159 
160 }
std::map< int, int > m_towerEnergies
static std::string const input
Definition: EdmProvDump.cc:44

Member Data Documentation

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

Definition at line 54 of file MicroGMTIsolationUnit.h.

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

Definition at line 52 of file MicroGMTIsolationUnit.h.

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

Definition at line 38 of file MicroGMTIsolationUnit.h.

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

Definition at line 39 of file MicroGMTIsolationUnit.h.

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

Definition at line 46 of file MicroGMTIsolationUnit.h.

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

Definition at line 42 of file MicroGMTIsolationUnit.h.

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

Definition at line 43 of file MicroGMTIsolationUnit.h.

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

Definition at line 48 of file MicroGMTIsolationUnit.h.

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

Definition at line 49 of file MicroGMTIsolationUnit.h.

bool l1t::MicroGMTIsolationUnit::m_initialSums
private

Definition at line 56 of file MicroGMTIsolationUnit.h.

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

Definition at line 40 of file MicroGMTIsolationUnit.h.

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

Definition at line 41 of file MicroGMTIsolationUnit.h.

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

Definition at line 45 of file MicroGMTIsolationUnit.h.

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

Definition at line 51 of file MicroGMTIsolationUnit.h.

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

Definition at line 55 of file MicroGMTIsolationUnit.h.