From 638d7c59520864d50529ca72ebbd219b07d56f52 Mon Sep 17 00:00:00 2001 From: Apurva Narde <58493193+Steepspace@users.noreply.github.com> Date: Mon, 22 Jun 2026 15:47:16 -0500 Subject: [PATCH 1/2] CaloTowerStatus: Z-Score Patch - Modified `CaloTowerStatus::LoadCalib` to calculate `need_z_score` based on whether `z_score_threshold` deviates from its default. - Wrapped the `GetFloatValue` call for the z_score field in a conditional check, eliminating the slowdowns for EMCal Hot Map CDB TTree that do not have the "CEMC_sigma" field. --- offline/packages/CaloReco/CaloTowerStatus.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/offline/packages/CaloReco/CaloTowerStatus.cc b/offline/packages/CaloReco/CaloTowerStatus.cc index 795ee97c3f..277e5efc6b 100644 --- a/offline/packages/CaloReco/CaloTowerStatus.cc +++ b/offline/packages/CaloReco/CaloTowerStatus.cc @@ -154,6 +154,9 @@ void CaloTowerStatus::LoadCalib(CDBTTree *cdbttree_chi2, CDBTTree *cdbttree_hotM unsigned int ntowers = m_raw_towers->size(); m_cdbInfo_vec.resize(ntowers); + // Check if we actually need to evaluate the z_score + bool need_z_score = (z_score_threshold != z_score_threshold_default); + for (unsigned int channel = 0; channel < ntowers; channel++) { unsigned int key = m_raw_towers->encode_key(channel); @@ -165,7 +168,12 @@ void CaloTowerStatus::LoadCalib(CDBTTree *cdbttree_chi2, CDBTTree *cdbttree_hotM if (m_doHotMap && cdbttree_hotMap) { m_cdbInfo_vec[channel].hotMap_val = cdbttree_hotMap->GetIntValue(key, m_fieldname_hotMap); - m_cdbInfo_vec[channel].z_score = cdbttree_hotMap->GetFloatValue(key, m_fieldname_z_score); + + // Only fetch the z_score field if the custom threshold requires it + if (need_z_score) + { + m_cdbInfo_vec[channel].z_score = cdbttree_hotMap->GetFloatValue(key, m_fieldname_z_score); + } } } } From 95f03f62fa98103cd65afea377eca0033773bc75 Mon Sep 17 00:00:00 2001 From: Chris Pinkenburg Date: Wed, 24 Jun 2026 11:13:40 -0400 Subject: [PATCH 2/2] replace boolean by direct comparison --- offline/packages/CaloReco/CaloTowerStatus.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/offline/packages/CaloReco/CaloTowerStatus.cc b/offline/packages/CaloReco/CaloTowerStatus.cc index 277e5efc6b..d50a792adf 100644 --- a/offline/packages/CaloReco/CaloTowerStatus.cc +++ b/offline/packages/CaloReco/CaloTowerStatus.cc @@ -154,9 +154,6 @@ void CaloTowerStatus::LoadCalib(CDBTTree *cdbttree_chi2, CDBTTree *cdbttree_hotM unsigned int ntowers = m_raw_towers->size(); m_cdbInfo_vec.resize(ntowers); - // Check if we actually need to evaluate the z_score - bool need_z_score = (z_score_threshold != z_score_threshold_default); - for (unsigned int channel = 0; channel < ntowers; channel++) { unsigned int key = m_raw_towers->encode_key(channel); @@ -170,7 +167,7 @@ void CaloTowerStatus::LoadCalib(CDBTTree *cdbttree_chi2, CDBTTree *cdbttree_hotM m_cdbInfo_vec[channel].hotMap_val = cdbttree_hotMap->GetIntValue(key, m_fieldname_hotMap); // Only fetch the z_score field if the custom threshold requires it - if (need_z_score) + if (z_score_threshold != z_score_threshold_default) { m_cdbInfo_vec[channel].z_score = cdbttree_hotMap->GetFloatValue(key, m_fieldname_z_score); }