65 float get_hcal_calibration(
float &jet_pt,
float &ecal_pt,
float &ecal_L1EG_jet_pt,
float &jet_eta)
const;
117 TF1
isoTauBarrel = TF1(
"isoTauBarrelFunction",
"([0] + [1]*TMath::Exp(-[2]*x))");
118 TF1
isoTauHGCal = TF1(
"isoTauHGCalFunction",
"([0] + [1]*TMath::Exp(-[2]*x))");
223 this->jetCluster.SetPt(
pt);
224 this->jetCluster.SetEta(
eta);
225 this->jetCluster.SetPhi(
phi);
226 this->jetCluster.SetM(
mass);
229 this->hcalJetCluster.SetPt(
pt);
230 this->hcalJetCluster.SetEta(
eta);
231 this->hcalJetCluster.SetPhi(
phi);
232 this->hcalJetCluster.SetM(
mass);
235 this->ecalJetCluster.SetPt(
pt);
236 this->ecalJetCluster.SetEta(
eta);
237 this->ecalJetCluster.SetPhi(
phi);
238 this->ecalJetCluster.SetM(
mass);
241 this->seedTower.SetPt(
pt);
242 this->seedTower.SetEta(
eta);
243 this->seedTower.SetPhi(
phi);
244 this->seedTower.SetM(
mass);
254 this->l1egJetCluster.SetPt(
pt);
255 this->l1egJetCluster.SetEta(
eta);
256 this->l1egJetCluster.SetPhi(
phi);
257 this->l1egJetCluster.SetM(
mass);
274 this->p4.SetEta(
eta);
275 this->p4.SetPhi(
phi);
278 inline float pt()
const {
return p4.pt(); };
279 inline float eta()
const {
return p4.eta(); };
280 inline float phi()
const {
return p4.phi(); };
281 inline float M()
const {
return p4.M(); };
309 :
HcalTpEtMin(iConfig.getParameter<double>(
"HcalTpEtMin")),
310 EcalTpEtMin(iConfig.getParameter<double>(
"EcalTpEtMin")),
313 HFTpEtMin(iConfig.getParameter<double>(
"HFTpEtMin")),
334 debug(iConfig.getParameter<
bool>(
"debug")),
338 produces<l1tp2::CaloJetsCollection>(
"L1CaloJetsNoCuts");
341 produces<BXVector<l1t::Jet>>(
"L1CaloJetCollectionBXV");
342 produces<BXVector<l1t::Tau>>(
"L1CaloTauCollectionBXV");
356 for (
unsigned int abs_eta = 0; abs_eta <
absEtaBinsBarrel.size() - 1; abs_eta++) {
357 std::vector<std::vector<double>> em_bins;
359 std::vector<double> pt_bin_calibs;
364 em_bins.push_back(pt_bin_calibs);
369 LogDebug(
"L1CaloJetProducer") <<
" Loading Barrel calibrations: Loaded " <<
index
370 <<
" values vs. size() of input calibration file: "
376 for (
unsigned int abs_eta = 0; abs_eta <
absEtaBinsHGCal.size() - 1; abs_eta++) {
377 std::vector<std::vector<double>> em_bins;
379 std::vector<double> pt_bin_calibs;
384 em_bins.push_back(pt_bin_calibs);
389 LogDebug(
"L1CaloJetProducer") <<
" Loading HGCal calibrations: Loaded " <<
index
390 <<
" values vs. size() of input calibration file: "
396 for (
unsigned int abs_eta = 0; abs_eta <
absEtaBinsHF.size() - 1; abs_eta++) {
397 std::vector<std::vector<double>> em_bins;
398 for (
unsigned int em_frac = 0; em_frac <
emFractionBinsHF.size() - 1; em_frac++) {
399 std::vector<double> pt_bin_calibs;
404 em_bins.push_back(pt_bin_calibs);
409 LogDebug(
"L1CaloJetProducer") <<
" Loading HF calibrations: Loaded " <<
index
417 LogDebug(
"L1CaloJetProducer") <<
" barrel l1egCount = " <<
first.getParameter<
double>(
"l1egCount") <<
"\n";
418 for (
auto &em_frac :
first.getParameter<std::vector<double>>(
"l1egEmFractions")) {
419 LogDebug(
"L1CaloJetProducer") <<
" - EM = " << em_frac <<
"\n";
423 std::vector<double>
l1egEmFractions =
first.getParameter<std::vector<double>>(
"l1egEmFractions");
430 LogDebug(
"L1CaloJetProducer") <<
" hgcal l1egCount = " <<
first.getParameter<
double>(
"l1egCount") <<
"\n";
431 for (
auto &em_frac :
first.getParameter<std::vector<double>>(
"l1egEmFractions")) {
432 LogDebug(
"L1CaloJetProducer") <<
" - EM = " << em_frac <<
"\n";
436 std::vector<double>
l1egEmFractions =
first.getParameter<std::vector<double>>(
"l1egEmFractions");
454 std::vector<std::vector<std::vector<double>>> l1eg_bins;
456 std::vector<std::vector<double>> em_bins;
457 for (
unsigned int em_frac = 0; em_frac < l1eg_info.second.size() - 1; em_frac++) {
458 std::vector<double> pt_bin_calibs;
463 em_bins.push_back(pt_bin_calibs);
465 l1eg_bins.push_back(em_bins);
470 LogDebug(
"L1CaloJetProducer") <<
" Loading Barrel calibrations: Loaded " <<
index
471 <<
" values vs. size() of input calibration file: "
477 std::vector<std::vector<std::vector<double>>> l1eg_bins;
479 std::vector<std::vector<double>> em_bins;
480 for (
unsigned int em_frac = 0; em_frac < l1eg_info.second.size() - 1; em_frac++) {
481 std::vector<double> pt_bin_calibs;
486 em_bins.push_back(pt_bin_calibs);
488 l1eg_bins.push_back(em_bins);
493 LogDebug(
"L1CaloJetProducer") <<
" Loading HGCal calibrations: Loaded " <<
index
494 <<
" values vs. size() of input calibration file: "
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) {
587 if (l1CaloTower.stale)
595 caloJetClusteringFinished =
true;
598 l1CaloTower.stale =
true;
602 if (l1CaloTower.isBarrel)
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) {
622 if (ecalP4.pt() > 0) {
627 if (l1egP4.pt() > 0) {
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) {
657 if (totalP4.pt() > 0) {
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 "
752 hit_iPhi = l1CaloTower.towerIPhi;
757 d_eta = caloJetObj.
seedTower.eta() - l1CaloTower.towerEta;
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) {
783 if (ecalP4.pt() > 0) {
788 if (l1egP4.pt() > 0) {
794 if (totalP4.pt() > 0) {
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 "
808 if ((
abs(d_iEta) == 0 &&
abs(d_iPhi) == 0) || (fabs(d_eta) < 0.043 && fabs(d_phi) < 0.043)) {
822 if ((
abs(d_iEta) <= 1 &&
abs(d_iPhi) <= 2) || (fabs(d_eta) < 0.13 && fabs(d_phi) < 0.22)) {
829 if (l1egP4.pt() > 0) {
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) {
869 if ((
abs(d_iEta) <= 3 &&
abs(d_iPhi) <= 3) || (fabs(d_eta) < 0.3 && fabs(d_phi) < 0.3)) {
942 l1CaloJetObjs.push_back(caloJetObj);
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);
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");
1109 iEvent.put(
std::move(L1CaloTauCollectionBXV),
"L1CaloTauCollectionBXV");
1115 int result = iPhi_1 - iPhi_2;
1126 if (iEta_1 * iEta_2 > 0)
1127 return iEta_1 - iEta_2;
1129 return iEta_1 - iEta_2 - 1;
1135 if (p4_1.pt() > 0 && p4_2.pt() > 0) {
1144 float &ecal_L1EG_jet_pt,
1145 float &jet_eta)
const {
1146 float em_frac = (ecal_L1EG_jet_pt + ecal_pt) / jet_pt;
1147 float abs_eta = fabs(jet_eta);
1148 float tmp_jet_pt = jet_pt;
1149 if (tmp_jet_pt > 499)
1154 size_t em_index = 0;
1155 size_t eta_index = 0;
1156 size_t pt_index = 0;
1158 if (abs_eta <= 1.5) {
1181 else if (abs_eta <= 3.0)
1235 float &
tau_pt,
float &ecal_pt,
float &l1EG_pt,
float &n_L1EGs,
float &
tau_eta)
const {
1236 float em_frac = (l1EG_pt + ecal_pt) /
tau_pt;
1237 float abs_eta = fabs(
tau_eta);
1238 float tmp_tau_pt =
tau_pt;
1239 if (tmp_tau_pt > 199)
1244 size_t em_index = 0;
1245 size_t eta_index = 0;
1246 size_t n_L1EG_index = 0;
1247 size_t pt_index = 0;
1250 if (abs_eta <= 1.5) {
1262 if (l1eg_info.first !=
double(n_L1EG_index))
1265 for (
unsigned int i = 1;
i < l1eg_info.second.size();
i++) {
1266 if (em_frac <= l1eg_info.second.at(
i))
1287 else if (abs_eta <= 3.0)
1300 if (l1eg_info.first !=
double(n_L1EG_index))
1303 for (
unsigned int i = 1;
i < l1eg_info.second.size();
i++) {
1304 if (em_frac <= l1eg_info.second.at(
i))