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 isolate (MicroGMTConfiguration::InterMuonList &) const
 
void isolatePreSummed (MicroGMTConfiguration::InterMuonList &muons) const
 
 MicroGMTIsolationUnit (const edm::ParameterSet &)
 
void setTowerSums (const MicroGMTConfiguration::CaloInputCollection &inputs, int bx)
 
virtual ~MicroGMTIsolationUnit ()
 

Private Attributes

std::vector< int > m_5by1TowerSums
 
MicroGMTAbsoluteIsolationCheckLUT m_AbsIsoCheckMem
 
MicroGMTExtrapolationLUT m_BEtaExtrapolation
 
MicroGMTExtrapolationLUT m_BPhiExtrapolation
 
std::map< tftype,
MicroGMTExtrapolationLUT * > 
m_etaExtrapolationLUTs
 
MicroGMTExtrapolationLUT m_FEtaExtrapolation
 
MicroGMTExtrapolationLUT m_FPhiExtrapolation
 
MicroGMTCaloIndexSelectionLUT m_IdxSelMemEta
 
MicroGMTCaloIndexSelectionLUT m_IdxSelMemPhi
 
bool m_initialSums
 
MicroGMTExtrapolationLUT m_OEtaExtrapolation
 
MicroGMTExtrapolationLUT m_OPhiExtrapolation
 
std::map< tftype,
MicroGMTExtrapolationLUT * > 
m_phiExtrapolationLUTs
 
MicroGMTRelativeIsolationCheckLUT m_RelIsoCheckMem
 
std::map< int, int > m_towerEnergies
 

Detailed Description

Definition at line 12 of file MicroGMTIsolationUnit.h.

Constructor & Destructor Documentation

l1t::MicroGMTIsolationUnit::MicroGMTIsolationUnit ( const edm::ParameterSet iConfig)
explicit

Definition at line 9 of file MicroGMTIsolationUnit.cc.

References l1t::bmtf, l1t::emtf_neg, l1t::emtf_pos, m_BEtaExtrapolation, m_BPhiExtrapolation, m_etaExtrapolationLUTs, m_FEtaExtrapolation, m_FPhiExtrapolation, m_OEtaExtrapolation, m_OPhiExtrapolation, m_phiExtrapolationLUTs, l1t::omtf_neg, and l1t::omtf_pos.

9  :
10  m_BEtaExtrapolation(iConfig, "BEtaExtrapolationLUTSettings", 0), m_BPhiExtrapolation(iConfig, "BPhiExtrapolationLUTSettings", 1), m_OEtaExtrapolation(iConfig, "OEtaExtrapolationLUTSettings", 0),
11  m_OPhiExtrapolation(iConfig, "OPhiExtrapolationLUTSettings", 1), m_FEtaExtrapolation(iConfig, "FEtaExtrapolationLUTSettings", 0), m_FPhiExtrapolation(iConfig, "FPhiExtrapolationLUTSettings", 1),
12  m_IdxSelMemEta(iConfig, "IdxSelMemEtaLUTSettings", 0), m_IdxSelMemPhi(iConfig, "IdxSelMemPhiLUTSettings", 1), m_RelIsoCheckMem(iConfig, "RelIsoCheckMemLUTSettings"),
13  m_AbsIsoCheckMem(iConfig, "AbsIsoCheckMemLUTSettings"), m_initialSums(false)
14 {
25 }
std::map< tftype, MicroGMTExtrapolationLUT * > m_etaExtrapolationLUTs
MicroGMTExtrapolationLUT m_BEtaExtrapolation
MicroGMTExtrapolationLUT m_OEtaExtrapolation
MicroGMTExtrapolationLUT m_FEtaExtrapolation
std::map< tftype, MicroGMTExtrapolationLUT * > m_phiExtrapolationLUTs
MicroGMTExtrapolationLUT m_FPhiExtrapolation
MicroGMTRelativeIsolationCheckLUT m_RelIsoCheckMem
MicroGMTCaloIndexSelectionLUT m_IdxSelMemPhi
MicroGMTExtrapolationLUT m_BPhiExtrapolation
MicroGMTExtrapolationLUT m_OPhiExtrapolation
MicroGMTCaloIndexSelectionLUT m_IdxSelMemEta
MicroGMTAbsoluteIsolationCheckLUT m_AbsIsoCheckMem
l1t::MicroGMTIsolationUnit::~MicroGMTIsolationUnit ( )
virtual

Definition at line 27 of file MicroGMTIsolationUnit.cc.

28 {
29 }

Member Function Documentation

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

Definition at line 75 of file MicroGMTIsolationUnit.cc.

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

76 {
77  m_5by1TowerSums.clear();
78  if (inputs.size(bx) == 0) return;
79 
80  for (int iphi = 0; iphi < 36; ++iphi) {
81  int iphiIndexOffset = iphi*28;
82  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)
83  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()); //
84  for (int ieta = 2; ieta < 26; ++ieta) {
85  int sum = 0;
86  for (int dIEta = -2; dIEta <= 2; ++dIEta) {
87  sum += inputs.at(bx, iphiIndexOffset+dIEta).etBits();
88  }
89  m_5by1TowerSums.push_back(sum);
90  }
91  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());
92  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)
93  }
94 
95  m_initialSums = true;
96 }
std::vector< int > m_5by1TowerSums
int l1t::MicroGMTIsolationUnit::calculate5by5Sum ( unsigned  index) const

Definition at line 100 of file MicroGMTIsolationUnit.cc.

References min().

101 {
102  if (index > m_5by1TowerSums.size()) {
103  edm::LogWarning("energysum out of bounds!");
104  return 0;
105  }
106  // phi wrap around:
107  int returnSum = 0;
108  for (int dIPhi = -2; dIPhi <= 2; ++dIPhi) {
109  int currIndex = (index + dIPhi*28)%1008; // wrap-around at top
110  if (currIndex < 0) currIndex = 1008+currIndex;
111  if ((unsigned)currIndex < m_5by1TowerSums.size()) {
112  returnSum += m_5by1TowerSums[currIndex];
113  } else {
114  edm::LogWarning("energysum out of bounds!");
115  }
116  }
117  return std::min(31, returnSum);
118 }
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 51 of file MicroGMTIsolationUnit.cc.

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

Referenced by L1TMicroGMTProducer::produce().

51  {
52  for (auto &mu : inputmuons) {
53  // only use 6 LSBs of pt:
54  int ptRed = mu->hwPt() & 0b111111;
55  // here we drop the two LSBs and masking the MSB
56  int etaAbsRed = (std::abs(mu->hwEta()) >> 2) & ((1 << 6) - 1);
57 
58  int deltaPhi = 0;
59  int deltaEta = 0;
60 
61  if (mu->hwPt() < 64) { // extrapolation only for "low" pT muons
62  int sign = 1;
63  if (mu->hwSign() == 0) {
64  sign = -1;
65  }
66  deltaPhi = (m_phiExtrapolationLUTs.at(mu->trackFinderType())->lookup(etaAbsRed, ptRed) << 3) * sign;
67  deltaEta = (m_etaExtrapolationLUTs.at(mu->trackFinderType())->lookup(etaAbsRed, ptRed) << 3);
68  }
69 
70  mu->setExtrapolation(deltaEta, deltaPhi);
71  }
72 }
std::map< tftype, MicroGMTExtrapolationLUT * > m_etaExtrapolationLUTs
double sign(double x)
std::map< tftype, MicroGMTExtrapolationLUT * > m_phiExtrapolationLUTs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const int mu
Definition: Constants.h:22
int l1t::MicroGMTIsolationUnit::getCaloIndex ( MicroGMTConfiguration::InterMuon mu) const

Definition at line 32 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().

33 {
34  // handle the wrap-around of phi:
35  int phi = (mu.hwGlobalPhi() + mu.hwDPhi())%576;
36  if (phi < 0) {
37  phi = 576+phi;
38  }
39 
40  int phiIndex = m_IdxSelMemPhi.lookup(phi);
41  int eta = mu.hwEta()+mu.hwDEta();
43  int etaIndex = m_IdxSelMemEta.lookup(eta);
44  mu.setHwCaloEta(etaIndex);
45  mu.setHwCaloPhi(phiIndex);
46 
47  return phiIndex + etaIndex*36;
48 }
static unsigned getTwosComp(const int signedInt, const int width)
const int mu
Definition: Constants.h:22
MicroGMTCaloIndexSelectionLUT m_IdxSelMemPhi
MicroGMTCaloIndexSelectionLUT m_IdxSelMemEta
void l1t::MicroGMTIsolationUnit::isolate ( MicroGMTConfiguration::InterMuonList muons) const

Definition at line 121 of file MicroGMTIsolationUnit.cc.

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

122 {
123  for (auto& mu : muons) {
124  int caloIndex = getCaloIndex(*mu);
125  int energySum = calculate5by5Sum(caloIndex);
126  mu->setHwIsoSum(energySum);
127 
128  int absIso = m_AbsIsoCheckMem.lookup(energySum);
129  int relIso = m_RelIsoCheckMem.lookup(energySum, mu->hwPt());
130 
131  mu->setHwRelIso(relIso);
132  mu->setHwAbsIso(absIso);
133  }
134 }
const int mu
Definition: Constants.h:22
MicroGMTRelativeIsolationCheckLUT m_RelIsoCheckMem
int getCaloIndex(MicroGMTConfiguration::InterMuon &) const
tuple muons
Definition: patZpeak.py:38
double energySum(const DataFrame &df, int fs, int ls)
MicroGMTAbsoluteIsolationCheckLUT m_AbsIsoCheckMem
int calculate5by5Sum(unsigned index) const
void l1t::MicroGMTIsolationUnit::isolatePreSummed ( MicroGMTConfiguration::InterMuonList muons) const

Definition at line 149 of file MicroGMTIsolationUnit.cc.

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

Referenced by L1TMicroGMTProducer::produce().

150 {
151  for (auto mu : muons) {
152  int caloIndex = getCaloIndex(*mu);
153  int energySum = 0;
154  if (m_towerEnergies.count(caloIndex) == 1) {
155  energySum = m_towerEnergies.at(caloIndex);
156  }
157 
158  mu->setHwIsoSum(energySum);
159 
160  int absIso = m_AbsIsoCheckMem.lookup(energySum);
161  int relIso = m_RelIsoCheckMem.lookup(energySum, mu->hwPt());
162 
163  mu->setHwRelIso(relIso);
164  mu->setHwAbsIso(absIso);
165  }
166 
167 }
std::map< int, int > m_towerEnergies
const int mu
Definition: Constants.h:22
MicroGMTRelativeIsolationCheckLUT m_RelIsoCheckMem
int getCaloIndex(MicroGMTConfiguration::InterMuon &) const
tuple muons
Definition: patZpeak.py:38
double energySum(const DataFrame &df, int fs, int ls)
MicroGMTAbsoluteIsolationCheckLUT m_AbsIsoCheckMem
void l1t::MicroGMTIsolationUnit::setTowerSums ( const MicroGMTConfiguration::CaloInputCollection inputs,
int  bx 
)

Definition at line 136 of file MicroGMTIsolationUnit.cc.

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

Referenced by L1TMicroGMTProducer::produce().

136  {
137  m_towerEnergies.clear();
138  if (inputs.size(bx) == 0) return;
139  for (auto input = inputs.begin(bx); input != inputs.end(bx); ++input) {
140  if ( input->etBits() != 0 ) {
141  m_towerEnergies[input->hwEta()*36+input->hwPhi()] = input->etBits();
142  }
143  }
144 
145  m_initialSums = true;
146 
147 }
std::map< int, int > m_towerEnergies
static std::string const input
Definition: EdmProvDump.cc:43

Member Data Documentation

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

Definition at line 50 of file MicroGMTIsolationUnit.h.

MicroGMTAbsoluteIsolationCheckLUT l1t::MicroGMTIsolationUnit::m_AbsIsoCheckMem
private

Definition at line 48 of file MicroGMTIsolationUnit.h.

MicroGMTExtrapolationLUT l1t::MicroGMTIsolationUnit::m_BEtaExtrapolation
private

Definition at line 34 of file MicroGMTIsolationUnit.h.

Referenced by MicroGMTIsolationUnit().

MicroGMTExtrapolationLUT l1t::MicroGMTIsolationUnit::m_BPhiExtrapolation
private

Definition at line 35 of file MicroGMTIsolationUnit.h.

Referenced by MicroGMTIsolationUnit().

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

Definition at line 42 of file MicroGMTIsolationUnit.h.

Referenced by MicroGMTIsolationUnit().

MicroGMTExtrapolationLUT l1t::MicroGMTIsolationUnit::m_FEtaExtrapolation
private

Definition at line 38 of file MicroGMTIsolationUnit.h.

Referenced by MicroGMTIsolationUnit().

MicroGMTExtrapolationLUT l1t::MicroGMTIsolationUnit::m_FPhiExtrapolation
private

Definition at line 39 of file MicroGMTIsolationUnit.h.

Referenced by MicroGMTIsolationUnit().

MicroGMTCaloIndexSelectionLUT l1t::MicroGMTIsolationUnit::m_IdxSelMemEta
private

Definition at line 44 of file MicroGMTIsolationUnit.h.

MicroGMTCaloIndexSelectionLUT l1t::MicroGMTIsolationUnit::m_IdxSelMemPhi
private

Definition at line 45 of file MicroGMTIsolationUnit.h.

bool l1t::MicroGMTIsolationUnit::m_initialSums
private

Definition at line 52 of file MicroGMTIsolationUnit.h.

MicroGMTExtrapolationLUT l1t::MicroGMTIsolationUnit::m_OEtaExtrapolation
private

Definition at line 36 of file MicroGMTIsolationUnit.h.

Referenced by MicroGMTIsolationUnit().

MicroGMTExtrapolationLUT l1t::MicroGMTIsolationUnit::m_OPhiExtrapolation
private

Definition at line 37 of file MicroGMTIsolationUnit.h.

Referenced by MicroGMTIsolationUnit().

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

Definition at line 41 of file MicroGMTIsolationUnit.h.

Referenced by MicroGMTIsolationUnit().

MicroGMTRelativeIsolationCheckLUT l1t::MicroGMTIsolationUnit::m_RelIsoCheckMem
private

Definition at line 47 of file MicroGMTIsolationUnit.h.

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

Definition at line 51 of file MicroGMTIsolationUnit.h.