520 l1Hit.ecalTowerEt =
hit.ecalTowerEt();
521 l1Hit.hcalTowerEt =
hit.hcalTowerEt();
522 l1Hit.l1egTowerEt =
hit.l1egTowerEt();
525 l1Hit.ecalTowerEt = 0.0;
527 l1Hit.hcalTowerEt = 0.0;
528 l1Hit.total_tower_et = l1Hit.ecalTowerEt + l1Hit.hcalTowerEt + l1Hit.l1egTowerEt;
529 l1Hit.towerIEta =
hit.towerIEta();
530 l1Hit.towerIPhi =
hit.towerIPhi();
531 l1Hit.nL1eg =
hit.nL1eg();
532 l1Hit.l1egTrkSS =
hit.l1egTrkSS();
533 l1Hit.l1egTrkIso =
hit.l1egTrkIso();
534 l1Hit.l1egStandaloneSS =
hit.l1egStandaloneSS();
535 l1Hit.l1egStandaloneIso =
hit.l1egStandaloneIso();
536 l1Hit.isBarrel =
hit.isBarrel();
542 if ((
int)l1Hit.towerIEta == -1016 && (
int)l1Hit.towerIPhi == -962)
545 l1Hit.towerEta =
hit.towerEta();
546 l1Hit.towerPhi =
hit.towerPhi();
549 LogDebug(
"L1CaloJetProducer") <<
" Tower iEta " << (
int)l1Hit.towerIEta <<
" iPhi " << (
int)l1Hit.towerIPhi
550 <<
" eta " << l1Hit.towerEta <<
" phi " << l1Hit.towerPhi <<
" ecal_et "
551 << l1Hit.ecalTowerEt <<
" hacl_et " << l1Hit.hcalTowerEt <<
" total_et "
552 << l1Hit.total_tower_et <<
"\n";
558 return a.total_tower_et >
b.total_tower_et;
570 std::map<std::string, float>
params;
572 std::vector<l1CaloJetObj> l1CaloJetObjs;
578 bool caloJetClusteringFinished =
false;
579 while (!caloJetClusteringFinished && n_towers != n_stale) {
580 l1CaloJetObj caloJetObj;
587 if (l1CaloTower.stale)
590 if (caloJetObj.jetClusterET == 0.0)
595 caloJetClusteringFinished =
true;
598 l1CaloTower.stale =
true;
602 if (l1CaloTower.isBarrel)
603 caloJetObj.barrelSeeded =
true;
605 caloJetObj.barrelSeeded =
false;
609 l1CaloTower.hcalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.);
611 l1CaloTower.ecalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.);
613 l1CaloTower.l1egTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.);
615 l1CaloTower.total_tower_et, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.);
617 if (hcalP4.pt() > 0) {
618 caloJetObj.hcal_nHits++;
619 caloJetObj.hcalJetCluster += hcalP4;
620 caloJetObj.hcalJetClusterET += l1CaloTower.hcalTowerEt;
622 if (ecalP4.pt() > 0) {
623 caloJetObj.ecal_nHits++;
624 caloJetObj.ecalJetCluster += ecalP4;
625 caloJetObj.ecalJetClusterET += l1CaloTower.ecalTowerEt;
627 if (l1egP4.pt() > 0) {
628 caloJetObj.l1eg_nHits++;
629 caloJetObj.l1egJetCluster += l1egP4;
630 caloJetObj.l1egJetClusterET += l1CaloTower.l1egTowerEt;
631 caloJetObj.l1eg_nL1EGs += l1CaloTower.nL1eg;
633 caloJetObj.l1eg_nL1EGs_standaloneSS += l1CaloTower.l1egStandaloneSS;
634 caloJetObj.l1eg_nL1EGs_standaloneIso += l1CaloTower.l1egStandaloneIso;
635 caloJetObj.l1eg_nL1EGs_trkMatchSS += l1CaloTower.l1egTrkSS;
636 caloJetObj.l1eg_nL1EGs_trkMatchIso += l1CaloTower.l1egTrkIso;
638 if (l1CaloTower.isBarrel) {
642 std::vector<float> l1EG_info = {
float(l1egP4.pt()),
647 float(l1CaloTower.l1egTrkSS),
648 float(l1CaloTower.l1egTrkIso),
649 float(l1CaloTower.l1egStandaloneSS),
650 float(l1CaloTower.l1egStandaloneIso)};
651 if (l1EG_info[1] / (l1EG_info[0] + l1EG_info[2]) < 0.25) {
652 caloJetObj.n_l1eg_HoverE_LessThreshold++;
654 caloJetObj.associated_l1EGs_.push_back(l1EG_info);
657 if (totalP4.pt() > 0) {
658 caloJetObj.total_nHits++;
659 caloJetObj.jetCluster += totalP4;
660 caloJetObj.jetClusterET += l1CaloTower.total_tower_et;
661 caloJetObj.seedTower += totalP4;
662 caloJetObj.seedTowerET += l1CaloTower.total_tower_et;
665 caloJetObj.seed_iEta = l1CaloTower.towerIEta;
666 caloJetObj.seed_iPhi = l1CaloTower.towerIPhi;
669 LogDebug(
"L1CaloJetProducer") <<
" -- hit " << cnt <<
" , seeding input p4 pt "
670 << l1CaloTower.total_tower_et <<
" eta " << l1CaloTower.towerEta <<
" phi "
671 << l1CaloTower.towerPhi <<
"\n";
672 LogDebug(
"L1CaloJetProducer") <<
" -- hit " << cnt <<
" , seeding input2 p4 pt " << totalP4.pt() <<
" eta "
673 << totalP4.eta() <<
" phi " << totalP4.phi() <<
"\n";
674 LogDebug(
"L1CaloJetProducer") <<
" -- hit " << cnt <<
" seeding reslt tot p4 pt " << caloJetObj.jetClusterET
675 <<
" eta " << caloJetObj.jetCluster.eta() <<
" phi "
676 << caloJetObj.jetCluster.phi() <<
"\n";
680 caloJetObj.hcal_seed += hcalP4.pt();
682 caloJetObj.hcal_3x5 += hcalP4.pt();
685 caloJetObj.hcal_7x7 += hcalP4.pt();
686 caloJetObj.ecal_seed += ecalP4.pt();
688 caloJetObj.ecal_3x5 += ecalP4.pt();
691 caloJetObj.ecal_7x7 += ecalP4.pt();
692 caloJetObj.l1eg_seed += l1egP4.pt();
694 caloJetObj.l1eg_3x5 += l1egP4.pt();
697 caloJetObj.l1eg_7x7 += l1egP4.pt();
698 caloJetObj.total_seed += totalP4.pt();
700 caloJetObj.total_3x5 += totalP4.pt();
703 caloJetObj.total_7x7 += totalP4.pt();
750 if (caloJetObj.barrelSeeded && l1CaloTower.isBarrel)
752 hit_iPhi = l1CaloTower.towerIPhi;
753 d_iEta =
tower_diEta(caloJetObj.seed_iEta, l1CaloTower.towerIEta);
754 d_iPhi =
tower_diPhi(caloJetObj.seed_iPhi, hit_iPhi);
757 d_eta = caloJetObj.seedTower.eta() - l1CaloTower.towerEta;
758 d_phi =
reco::deltaPhi(caloJetObj.seedTower.phi(), l1CaloTower.towerPhi);
764 if ((
abs(d_iEta) <= 3 &&
abs(d_iPhi) <= 3) || (fabs(d_eta) < 0.3 && fabs(d_phi) < 0.3)) {
765 l1CaloTower.stale =
true;
770 l1CaloTower.hcalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.);
772 l1CaloTower.ecalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.);
774 l1CaloTower.l1egTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.);
776 l1CaloTower.total_tower_et, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.);
778 if (hcalP4.pt() > 0) {
779 caloJetObj.hcal_nHits++;
780 caloJetObj.hcalJetCluster += hcalP4;
781 caloJetObj.hcalJetClusterET += l1CaloTower.hcalTowerEt;
783 if (ecalP4.pt() > 0) {
784 caloJetObj.ecal_nHits++;
785 caloJetObj.ecalJetCluster += ecalP4;
786 caloJetObj.ecalJetClusterET += l1CaloTower.ecalTowerEt;
788 if (l1egP4.pt() > 0) {
789 caloJetObj.l1eg_nHits++;
790 caloJetObj.l1egJetCluster += l1egP4;
791 caloJetObj.l1egJetClusterET += l1CaloTower.l1egTowerEt;
792 caloJetObj.l1eg_nL1EGs += l1CaloTower.nL1eg;
794 if (totalP4.pt() > 0) {
795 caloJetObj.total_nHits++;
796 caloJetObj.jetCluster += totalP4;
797 caloJetObj.jetClusterET += l1CaloTower.total_tower_et;
801 LogDebug(
"L1CaloJetProducer") <<
" ---- hit " << cnt <<
" input p4 pt " << totalP4.pt() <<
" eta "
802 << totalP4.eta() <<
" phi " << totalP4.phi() <<
"\n";
803 LogDebug(
"L1CaloJetProducer") <<
" ---- hit " << cnt <<
" resulting p4 pt " << caloJetObj.jetClusterET
804 <<
" eta " << caloJetObj.jetCluster.eta() <<
" phi "
805 << caloJetObj.jetCluster.phi() <<
"\n";
808 if ((
abs(d_iEta) == 0 &&
abs(d_iPhi) == 0) || (fabs(d_eta) < 0.043 && fabs(d_phi) < 0.043)) {
809 caloJetObj.hcal_seed += hcalP4.pt();
810 caloJetObj.ecal_seed += ecalP4.pt();
811 caloJetObj.l1eg_seed += l1egP4.pt();
812 caloJetObj.total_seed += totalP4.pt();
822 if ((
abs(d_iEta) <= 1 &&
abs(d_iPhi) <= 2) || (fabs(d_eta) < 0.13 && fabs(d_phi) < 0.22)) {
823 caloJetObj.hcal_3x5 += hcalP4.pt();
824 caloJetObj.ecal_3x5 += ecalP4.pt();
825 caloJetObj.l1eg_3x5 += l1egP4.pt();
826 caloJetObj.total_3x5 += totalP4.pt();
829 if (l1egP4.pt() > 0) {
830 caloJetObj.l1eg_nL1EGs_standaloneSS += l1CaloTower.l1egStandaloneSS;
831 caloJetObj.l1eg_nL1EGs_standaloneIso += l1CaloTower.l1egStandaloneIso;
832 caloJetObj.l1eg_nL1EGs_trkMatchSS += l1CaloTower.l1egTrkSS;
833 caloJetObj.l1eg_nL1EGs_trkMatchIso += l1CaloTower.l1egTrkIso;
838 std::vector<float> l1EG_info = {
float(l1egP4.pt()),
843 float(l1CaloTower.l1egTrkSS),
844 float(l1CaloTower.l1egTrkIso),
845 float(l1CaloTower.l1egStandaloneSS),
846 float(l1CaloTower.l1egStandaloneIso)};
847 if (l1EG_info[1] / (l1EG_info[0] + l1EG_info[2]) < 0.25) {
848 caloJetObj.n_l1eg_HoverE_LessThreshold++;
850 caloJetObj.associated_l1EGs_.push_back(l1EG_info);
869 if ((
abs(d_iEta) <= 3 &&
abs(d_iPhi) <= 3) || (fabs(d_eta) < 0.3 && fabs(d_phi) < 0.3)) {
870 caloJetObj.hcal_7x7 += hcalP4.pt();
871 caloJetObj.ecal_7x7 += ecalP4.pt();
872 caloJetObj.l1eg_7x7 += l1egP4.pt();
873 caloJetObj.total_7x7 += totalP4.pt();
941 if (caloJetObj.jetClusterET > 0.0) {
942 l1CaloJetObjs.push_back(caloJetObj);
948 std::sort(begin(l1CaloJetObjs),
end(l1CaloJetObjs), [](
const l1CaloJetObj &
a,
const l1CaloJetObj &
b) {
949 return a.jetClusterET >
b.jetClusterET;
960 for (
auto &caloJetObj : l1CaloJetObjs) {
961 params[
"seed_pt"] = caloJetObj.seedTowerET;
962 params[
"seed_eta"] = caloJetObj.seedTower.eta();
963 params[
"seed_phi"] = caloJetObj.seedTower.phi();
964 params[
"seed_iEta"] = caloJetObj.seed_iEta;
965 params[
"seed_iPhi"] = caloJetObj.seed_iPhi;
966 params[
"seed_energy"] = caloJetObj.seedTower.energy();
968 params[
"hcal_pt"] = caloJetObj.hcalJetClusterET;
969 params[
"hcal_seed"] = caloJetObj.hcal_seed;
971 params[
"hcal_3x5"] = caloJetObj.hcal_3x5;
974 params[
"hcal_7x7"] = caloJetObj.hcal_7x7;
977 params[
"hcal_nHits"] = caloJetObj.hcal_nHits;
979 params[
"ecal_pt"] = caloJetObj.ecalJetClusterET;
980 params[
"ecal_seed"] = caloJetObj.ecal_seed;
982 params[
"ecal_3x5"] = caloJetObj.ecal_3x5;
985 params[
"ecal_7x7"] = caloJetObj.ecal_7x7;
988 params[
"ecal_nHits"] = caloJetObj.ecal_nHits;
990 params[
"l1eg_pt"] = caloJetObj.l1egJetClusterET;
991 params[
"l1eg_seed"] = caloJetObj.l1eg_seed;
993 params[
"l1eg_3x5"] = caloJetObj.l1eg_3x5;
996 params[
"l1eg_7x7"] = caloJetObj.l1eg_7x7;
999 params[
"l1eg_nHits"] = caloJetObj.l1eg_nHits;
1000 params[
"l1eg_nL1EGs"] = caloJetObj.l1eg_nL1EGs;
1001 params[
"l1eg_nL1EGs_standaloneSS"] = caloJetObj.l1eg_nL1EGs_standaloneSS;
1002 params[
"l1eg_nL1EGs_standaloneIso"] = caloJetObj.l1eg_nL1EGs_standaloneIso;
1003 params[
"l1eg_nL1EGs_trkMatchSS"] = caloJetObj.l1eg_nL1EGs_trkMatchSS;
1004 params[
"l1eg_nL1EGs_trkMatchIso"] = caloJetObj.l1eg_nL1EGs_trkMatchIso;
1006 params[
"total_et"] = caloJetObj.jetClusterET;
1007 params[
"total_seed"] = caloJetObj.total_seed;
1009 params[
"total_3x5"] = caloJetObj.total_3x5;
1012 params[
"total_7x7"] = caloJetObj.total_7x7;
1015 params[
"total_nHits"] = caloJetObj.total_nHits;
1020 if (caloJetObj.ecalJetClusterET > 0.0) {
1021 hovere = caloJetObj.hcalJetClusterET / (caloJetObj.ecalJetClusterET + caloJetObj.l1egJetClusterET);
1024 params[
"jet_pt"] = caloJetObj.jetClusterET;
1025 params[
"jet_eta"] = caloJetObj.jetCluster.eta();
1026 params[
"jet_phi"] = caloJetObj.jetCluster.phi();
1027 params[
"jet_mass"] = caloJetObj.jetCluster.mass();
1028 params[
"jet_energy"] = caloJetObj.jetCluster.energy();
1031 params[
"hcal_calibration"] =
1042 caloJetObj.n_l1eg_HoverE_LessThreshold,
1045 params[
"n_l1eg_HoverE_LessThreshold"] = caloJetObj.n_l1eg_HoverE_LessThreshold;
1053 float calibratedPt = -1;
1054 float ECalIsolation = -1;
1055 float totalPtPUcorr = -1;
1056 l1tp2::CaloJet caloJet(caloJetObj.jetCluster, calibratedPt, hovere, ECalIsolation, totalPtPUcorr);
1057 caloJet.setExperimentalParams(
params);
1058 caloJet.setAssociated_l1EGs(caloJetObj.associated_l1EGs_);
1062 L1CaloJetsNoCuts->push_back(caloJet);
1065 params[
"jet_pt_calibration"], caloJet.p4().eta(), caloJet.p4().phi(), caloJet.p4().M());
1066 L1CaloJetCollectionBXV->push_back(0,
l1t::Jet(jet_p4));
1069 LogDebug(
"L1CaloJetProducer") <<
" Made a Jet, eta " << caloJetObj.jetCluster.eta() <<
" phi "
1070 << caloJetObj.jetCluster.phi() <<
" pt " << caloJetObj.jetClusterET
1071 <<
" calibrated pt " <<
params[
"jet_pt_calibration"] <<
"\n";
1076 short int tau_ieta = caloJetObj.seed_iEta;
1077 short int tau_iphi = caloJetObj.seed_iPhi;
1078 short int raw_et =
params[
"total_3x5"];
1079 short int iso_et =
params[
"tau_iso_et"];
1081 if (
params[
"l1eg_3x5"] > 0. ||
params[
"ecal_3x5"] > 0.) {
1084 int tau_qual =
int(
params[
"loose_iso_tau_wp"]);
1087 params[
"tau_pt"], caloJet.p4().eta(), caloJet.p4().phi(), caloJet.p4().M());
1089 l1Tau.setTowerIEta(tau_ieta);
1090 l1Tau.setTowerIPhi(tau_iphi);
1091 l1Tau.setRawEt(raw_et);
1092 l1Tau.setIsoEt(iso_et);
1093 l1Tau.setHasEM(hasEM);
1094 l1Tau.setIsMerged(
false);
1095 L1CaloTauCollectionBXV->push_back(0,
l1Tau);
1098 LogDebug(
"L1CaloJetProducer") <<
" Made a Jet, eta " <<
l1Tau.eta() <<
" phi " <<
l1Tau.phi() <<
" pt "
1099 <<
l1Tau.rawEt() <<
" calibrated pt " <<
l1Tau.pt() <<
"\n";
1108 iEvent.put(
std::move(L1CaloJetCollectionBXV),
"L1CaloJetCollectionBXV");