92 std::unique_ptr<l1tp2::Phase2L1CaloJetCollection> jetCands(make_unique<l1tp2::Phase2L1CaloJetCollection>());
97 edm::LogError(
"Phase2L1CaloJetEmulator") <<
"Failed to get towers from caloTowerCollection!";
104 int ieta =
i.towerIEta();
105 int iphi =
i.towerIPhi();
106 if (
i.ecalTowerEt() > 1.)
107 GCTintTowers[
ieta][
iphi] =
i.ecalTowerEt();
119 edm::LogError(
"Phase2L1CaloJetEmulator") <<
"Failed to get towers from hgcalTowerCollection!";
122 hgcalTowerColl = (*hgcalTowerCollection.
product());
138 for (
auto it = hgcalTowerColl.
begin(0); it != hgcalTowerColl.
end(0); it++) {
139 float eta = it->eta();
142 ieta = 19 - it->id().iEta();
144 ieta = 20 + it->id().iEta();
147 int iphi = it->id().iPhi();
148 if ((it->etEm() + it->etHad() > 1.) &&
abs(
eta) > 1.479)
157 edm::LogError(
"Phase2L1CaloJetEmulator") <<
"Failed to get HcalTrigPrimDigi for HF!";
178 double et = decoder.hcaletValue(
hit.
id(),
hit.t0());
204 vector<l1tp2::Phase2L1CaloJet> halfBarrelJets, halfHgcalJets, halfHfJets;
205 halfBarrelJets.clear();
206 halfHgcalJets.clear();
208 vector<l1tp2::Phase2L1CaloJet>
allJets;
211 for (
int k = 0;
k < 2;
k++) {
212 halfBarrelJets.clear();
213 halfHgcalJets.clear();
235 int gctjeteta =
jet[
i].etaCenter;
236 int gctjetphi =
jet[
i].phiCenter;
239 float jeteta = realEta[gctjeteta +
k *
nBarrelEta / 2][gctjetphi];
240 float jetphi = realPhi[gctjeteta +
k *
nBarrelEta / 2][gctjetphi];
244 int gcttowereta =
jet[
i].etaMax;
245 int gcttowerphi =
jet[
i].phiMax;
248 float towereta = realEta[gcttowereta +
k *
nBarrelEta / 2][gcttowerphi];
249 float towerphi = realPhi[gcttowereta +
k *
nBarrelEta / 2][gcttowerphi];
253 tempJetp4.SetPt(tempJet.
jetEt());
254 tempJetp4.SetEta(tempJet.
jetEta());
255 tempJetp4.SetPhi(tempJet.
jetPhi());
257 tempJet.
setP4(tempJetp4);
260 halfBarrelJets.push_back(tempJet);
280 int hgcaljeteta =
jet[
i].etaCenter;
281 int hgcaljetphi =
jet[
i].phiCenter;
284 float jeteta = hgcalEta[hgcaljeteta +
k *
nHgcalEta / 2][hgcaljetphi];
285 float jetphi = hgcalPhi[hgcaljeteta +
k *
nHgcalEta / 2][hgcaljetphi];
289 int hgcaltowereta =
jet[
i].etaMax;
290 int hgcaltowerphi =
jet[
i].phiMax;
293 float towereta = hgcalEta[hgcaltowereta +
k *
nHgcalEta / 2][hgcaltowerphi];
294 float towerphi = hgcalPhi[hgcaltowereta +
k *
nHgcalEta / 2][hgcaltowerphi];
298 tempJetp4.SetPt(tempJet.
jetEt());
299 tempJetp4.SetEta(tempJet.
jetEta());
300 tempJetp4.SetPhi(tempJet.
jetPhi());
302 tempJet.
setP4(tempJetp4);
305 halfHgcalJets.push_back(tempJet);
325 int hfjeteta =
jet[
i].etaCenter;
326 int hfjetphi =
jet[
i].phiCenter;
329 float jeteta = hfEta[hfjeteta +
k *
nHfEta / 2][hfjetphi];
330 float jetphi = hfPhi[hfjeteta +
k *
nHfEta / 2][hfjetphi];
334 int hftowereta =
jet[
i].etaMax;
335 int hftowerphi =
jet[
i].phiMax;
338 float towereta = hfEta[hftowereta +
k *
nHfEta / 2][hftowerphi];
339 float towerphi = hfPhi[hftowereta +
k *
nHfEta / 2][hftowerphi];
343 tempJetp4.SetPt(tempJet.
jetEt());
344 tempJetp4.SetEta(tempJet.
jetEta());
345 tempJetp4.SetPhi(tempJet.
jetPhi());
347 tempJet.
setP4(tempJetp4);
350 halfHfJets.push_back(tempJet);
358 for (
size_t i = 0;
i < halfHgcalJets.size();
i++) {
359 if (halfHgcalJets.at(
i).jetIEta() >= (
nHgcalEta / 2 - 2) && halfHgcalJets.at(
i).jetIEta() < (
nHgcalEta / 2 + 2)) {
360 float hgcal_ieta =
k *
nBarrelEta + halfHgcalJets.at(
i).jetIEta();
361 for (
size_t j = 0;
j < halfBarrelJets.size();
j++) {
362 float barrel_ieta =
nHgcalEta / 2 + halfBarrelJets.at(
j).jetIEta();
363 if (
abs(barrel_ieta - hgcal_ieta) <= 2 &&
364 abs(halfBarrelJets.at(
j).jetIPhi() - halfHgcalJets.at(
i).jetIPhi()) <= 2) {
365 float totalet = halfBarrelJets.at(
j).jetEt() + halfHgcalJets.at(
i).jetEt();
366 float totalTauEt = halfBarrelJets.at(
j).tauEt() + halfHgcalJets.at(
i).tauEt();
367 if (halfBarrelJets.at(
j).jetEt() > halfHgcalJets.at(
i).jetEt()) {
368 halfHgcalJets.at(
i).setJetEt(0.);
369 halfHgcalJets.at(
i).setTauEt(0.);
370 halfBarrelJets.at(
j).setJetEt(totalet);
371 halfBarrelJets.at(
j).setTauEt(totalTauEt);
373 tempJetp4.SetPt(totalet);
374 tempJetp4.SetEta(halfBarrelJets.at(
j).jetEta());
375 tempJetp4.SetPhi(halfBarrelJets.at(
j).jetPhi());
377 halfBarrelJets.at(
j).setP4(tempJetp4);
379 halfHgcalJets.at(
i).setJetEt(totalet);
380 halfHgcalJets.at(
i).setTauEt(totalTauEt);
381 halfBarrelJets.at(
j).setJetEt(0.);
382 halfBarrelJets.at(
j).setTauEt(0.);
384 tempJetp4.SetPt(totalet);
385 tempJetp4.SetEta(halfHgcalJets.at(
i).jetEta());
386 tempJetp4.SetPhi(halfHgcalJets.at(
i).jetPhi());
388 halfHgcalJets.at(
i).setP4(tempJetp4);
392 }
else if (halfHgcalJets.at(
i).jetIEta() < 2 || halfHgcalJets.at(
i).jetIEta() >= (
nHgcalEta - 2)) {
394 for (
size_t j = 0;
j < halfHfJets.size();
j++) {
396 if (
abs(hgcal_ieta - hf_ieta) < 3 &&
abs(halfHfJets.at(
j).jetIPhi() - halfHgcalJets.at(
i).jetIPhi()) < 3) {
397 float totalet = halfHfJets.at(
j).jetEt() + halfHgcalJets.at(
i).jetEt();
398 float totalTauEt = halfHfJets.at(
j).tauEt() + halfHgcalJets.at(
i).tauEt();
399 if (halfHfJets.at(
j).jetEt() > halfHgcalJets.at(
i).jetEt()) {
400 halfHgcalJets.at(
i).setJetEt(0.);
401 halfHgcalJets.at(
i).setTauEt(0.);
402 halfHfJets.at(
j).setJetEt(totalet);
403 halfHfJets.at(
j).setTauEt(totalTauEt);
405 tempJetp4.SetPt(totalet);
406 tempJetp4.SetEta(halfHfJets.at(
j).jetEta());
407 tempJetp4.SetPhi(halfHfJets.at(
j).jetPhi());
409 halfHfJets.at(
j).setP4(tempJetp4);
411 halfHgcalJets.at(
i).setJetEt(totalet);
412 halfHgcalJets.at(
i).setTauEt(totalTauEt);
413 halfHfJets.at(
j).setJetEt(0.);
414 halfHfJets.at(
j).setTauEt(0.);
416 tempJetp4.SetPt(totalet);
417 tempJetp4.SetEta(halfHgcalJets.at(
i).jetEta());
418 tempJetp4.SetPhi(halfHgcalJets.at(
i).jetPhi());
420 halfHgcalJets.at(
i).setP4(tempJetp4);
430 for (
size_t i = 0;
i < halfBarrelJets.size();
i++) {
431 if (halfBarrelJets.at(
i).jetEt() > 0. &&
i < 6)
432 allJets.push_back(halfBarrelJets.at(
i));
436 for (
size_t i = 0;
i < halfHgcalJets.size();
i++) {
437 if (halfHgcalJets.at(
i).jetEt() > 0. &&
i < 6)
438 allJets.push_back(halfHgcalJets.at(
i));
442 for (
size_t i = 0;
i < halfHfJets.size();
i++) {
443 if (halfHfJets.at(
i).jetEt() > 0. &&
i < 6)
444 allJets.push_back(halfHfJets.at(
i));
std::vector< reco::JetBaseRef > allJets(const Container &)
fill list of all jets associated with values. Return # of jets in the list
static constexpr int nBarrelPhi
void setTowerEt(float towerEtIn)
void setTowerIEta(int towerIEtaIn)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
static constexpr int nSTEta
T const * product() const
static constexpr int nHgcalEta
static constexpr int nJets
edm::EDGetTokenT< l1t::HGCalTowerBxCollection > hgcalTowerToken_
const_iterator begin(int bx) const
static constexpr int nHfPhi
void makeST_hf(const float hfTowers[nHfEta/2][nHfPhi], GCTsupertower_t supertower_return[nSTEta][nSTPhi])
static constexpr int nSTPhi
Abs< T >::type abs(const T &t)
void setTauEt(float tauEtIn)
void setTowerPhi(float towerPhiIn)
void setJetIPhi(int jetIPhiIn)
edm::ESGetToken< CaloTPGTranscoder, CaloTPGRecord > decoderTag_
void makeST(const float GCTintTowers[nBarrelEta/2][nBarrelPhi], GCTsupertower_t supertower_return[nSTEta][nSTPhi])
jetInfo getRegion(GCTsupertower_t temp[nSTEta][nSTPhi])
static constexpr int nHgcalPhi
void setTowerEta(float towerEtaIn)
const_iterator end(int bx) const
void makeST_hgcal(const float hgcalTowers[nHgcalEta/2][nHgcalPhi], GCTsupertower_t supertower_return[nSTEta][nSTPhi])
edm::EDGetTokenT< HcalTrigPrimDigiCollection > hfToken_
static constexpr int nBarrelEta
static constexpr int nHfEta
void setTowerIPhi(int towerIPhiIn)
void setJetEt(float jetEtIn)
void setJetIEta(int jetIEtaIn)
edm::EDGetTokenT< l1tp2::CaloTowerCollection > caloTowerToken_
bool compareByEt(l1tp2::Phase2L1CaloJet i, l1tp2::Phase2L1CaloJet j)
void setP4(const LorentzVector &p4) final
set 4-momentum
void setJetPhi(float jetPhiIn)
void setJetEta(float jetEtaIn)
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.