Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XGBoost producer bugfix and unit test fix for non-x86_64 (14_0_X) #44532

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PhotonXGBoostEstimator {
float sigmaIEtaIEtaIn,
float etaWidthIn,
float phiWidthIn,
float e2x2In,
float s4In,
float etaIn,
float hOvrEIn,
float ecalPFIsoIn) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ void PhotonXGBoostProducer::produce(edm::StreamID, edm::Event& event, edm::Event
float hoe = (*hoEMap).find(ref)->val / scEnergy;
float siEtaiEta = (*sigmaiEtaiEtaMap).find(ref)->val;
float e2x2 = (*e2x2Map).find(ref)->val;
float s4 = e2x2 / scEnergy;
float iso = (*isoMap).find(ref)->val;

float rawEnergy = ref->superCluster()->rawEnergy();
Expand All @@ -124,9 +125,9 @@ void PhotonXGBoostProducer::produce(edm::StreamID, edm::Event& event, edm::Event
//compute only above threshold used for training and cand filter, else store negative value into the association map.
if (scEt >= mvaThresholdEt_) {
if (std::abs(etaSC) < 1.5)
xgbScore = mvaEstimatorB_->computeMva(rawEnergy, r9, siEtaiEta, etaW, phiW, e2x2, etaSC, hoe, iso);
xgbScore = mvaEstimatorB_->computeMva(rawEnergy, r9, siEtaiEta, etaW, phiW, s4, etaSC, hoe, iso);
else
xgbScore = mvaEstimatorE_->computeMva(rawEnergy, r9, siEtaiEta, etaW, phiW, e2x2, etaSC, hoe, iso);
xgbScore = mvaEstimatorE_->computeMva(rawEnergy, r9, siEtaiEta, etaW, phiW, s4, etaSC, hoe, iso);
}
mvaScoreMap.insert(ref, xgbScore);
}
Expand Down
6 changes: 3 additions & 3 deletions RecoEgamma/PhotonIdentification/src/PhotonXGBoostEstimator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace {
sigmaIEtaIEta = 2, // 2
etaWidth = 3, // 3
phiWidth = 4, // 4
e2x2 = 5, // 5
s4 = 5, // 5
eta = 6, // 6
hOvrE = 7, // 7
ecalPFIso = 8, // 8
Expand All @@ -33,7 +33,7 @@ float PhotonXGBoostEstimator::computeMva(float rawEnergyIn,
float sigmaIEtaIEtaIn,
float etaWidthIn,
float phiWidthIn,
float e2x2In,
float s4In,
float etaIn,
float hOvrEIn,
float ecalPFIsoIn) const {
Expand All @@ -43,7 +43,7 @@ float PhotonXGBoostEstimator::computeMva(float rawEnergyIn,
var[sigmaIEtaIEta] = sigmaIEtaIEtaIn;
var[etaWidth] = etaWidthIn;
var[phiWidth] = phiWidthIn;
var[e2x2] = e2x2In;
var[s4] = s4In;
var[eta] = etaIn;
var[hOvrE] = hOvrEIn;
var[ecalPFIso] = ecalPFIsoIn;
Expand Down
2 changes: 1 addition & 1 deletion RecoEgamma/PhotonIdentification/test/test_PhotonMvaXgb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST_CASE("RecoEgamma/PhotonIdentification testXGBPhoton", "[TestPhotonMvaXgb]")
float xgbScore;
const float *v = vars_in[i];
float etaSC = v[6];
if (abs(etaSC) < 1.5)
if (std::abs(etaSC) < 1.5)
xgbScore = mvaEstimatorB->computeMva(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8]);
else
xgbScore = mvaEstimatorE->computeMva(v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8]);
Expand Down