Skip to content

Commit

Permalink
Merge pull request #974 in B2/basf2 from feature/BII-9349-speed-up-ec…
Browse files Browse the repository at this point in the history
…l-calibrations-rel-06-00 to release/06-00

* commit 'e5e2f62861b19bed97041a6a05e8696e2f07ef5d':
  fix user name
  remove PXD ARICH TOP TRG from reconstruction
  remove unneeded parts of ECL reconstruction
  • Loading branch information
GiacomoXT committed May 4, 2022
2 parents 34e33e2 + e5e2f62 commit 8601fda
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 10 deletions.
65 changes: 65 additions & 0 deletions calibration/scripts/prompt/calibrations/caf_ecl_E.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,55 @@
depends_on=[],
expert_config={"ee5x5_min_entries": 100})

# --------------------------------------------------------------
# ..Raise clustering seed threshold in ECLCRFinder


def touch_CRFinder(path, new_seed):
import basf2
"""
Speed up ECL clustering by increasing seed threshold
"""
new_path = basf2.create_path()
found = False
for m in path.modules():
if str(m) != "ECLCRFinder": # search module by name
new_path.add_module(m)
else:
crfinder = basf2.register_module('ECLCRFinder')
crfinder.param('energyCut0', new_seed)
crfinder.param('energyCutBkgd0', new_seed)
basf2.print_params(crfinder)
new_path.add_module(crfinder)
found = True
if not found:
raise KeyError("Could not find ECLCRFinder in path")
return new_path

# --------------------------------------------------------------
# ..Raise threshold in ECLWaveformFit


def touch_WaveformFit(path, energy_threshold):
import basf2
"""
Speed up ECL reconstruction by increasing energy threshold
"""
new_path = basf2.create_path()
found = False
for m in path.modules():
if str(m) != "ECLWaveformFit": # search module by name
new_path.add_module(m)
else:
waveformfit = basf2.register_module('ECLWaveformFit')
waveformfit.param('EnergyThreshold', energy_threshold)
basf2.print_params(waveformfit)
new_path.add_module(waveformfit)
found = True
if not found:
raise KeyError("Could not find ECLWaveformFit in path")
return new_path

# --------------------------------------------------------------
# ..The calibration functions

Expand Down Expand Up @@ -87,6 +136,10 @@ def get_calibrations(input_data, **kwargs):
# ..Add prepare_cdst_analysis to pre_collector_path
ee5x5_pre_path = basf2.create_path()
prepare_cdst_analysis(ee5x5_pre_path, components=['ECL'])
new_threshold = 1.0 # GeV
ee5x5_pre_path = touch_CRFinder(ee5x5_pre_path, new_threshold)
waveform_threshold = 99. # GeV
ee5x5_pre_path = touch_WaveformFit(ee5x5_pre_path, waveform_threshold)
cal_ecl_ee5x5.pre_collector_path = ee5x5_pre_path

# --------------------------------------------------------------
Expand Down Expand Up @@ -131,6 +184,10 @@ def get_calibrations(input_data, **kwargs):
# ..Add prepare_cdst_analysis to pre_collector_path
gamma_gamma_pre_path = basf2.create_path()
prepare_cdst_analysis(gamma_gamma_pre_path, components=['ECL'])
new_threshold = 1.0 # GeV
gamma_gamma_pre_path = touch_CRFinder(gamma_gamma_pre_path, new_threshold)
waveform_threshold = 99. # GeV
gamma_gamma_pre_path = touch_WaveformFit(gamma_gamma_pre_path, waveform_threshold)
cal_ecl_gamma_gamma.pre_collector_path = gamma_gamma_pre_path

# --------------------------------------------------------------
Expand Down Expand Up @@ -169,6 +226,10 @@ def get_calibrations(input_data, **kwargs):
ext_path = basf2.create_path()
prepare_cdst_analysis(ext_path, components=['ECL'])
ext_path.add_module("Ext", pdgCodes=[13])
new_threshold = 0.1 # GeV
ext_path = touch_CRFinder(ext_path, new_threshold)
waveform_threshold = 99. # GeV
ext_path = touch_WaveformFit(ext_path, waveform_threshold)
cal_ecl_mu_mu.pre_collector_path = ext_path

# --------------------------------------------------------------
Expand All @@ -191,6 +252,10 @@ def get_calibrations(input_data, **kwargs):
# ..Uses cdst data so it requires prepare_cdst_analysis
ecl_merge_pre_path = basf2.create_path()
prepare_cdst_analysis(ecl_merge_pre_path, components=['ECL'])
new_threshold = 0.15 # GeV
ecl_merge_pre_path = touch_CRFinder(ecl_merge_pre_path, new_threshold)
waveform_threshold = 99. # GeV
ecl_merge_pre_path = touch_WaveformFit(ecl_merge_pre_path, waveform_threshold)
ecl_merge_pre_path.pre_collector_path = ecl_merge_pre_path

# --------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# the hadron skim for validations.
settings = CalibrationSettings(
name="ECL crystal and crate time calibrations and validations",
expert_username="ehill",
expert_username="hearty",
description=__doc__,
input_data_formats=["cdst"],
input_data_names=["bhabha_all_calib", "hadron_calib"],
Expand Down Expand Up @@ -207,9 +207,7 @@ def get_calibrations(input_data, **kwargs):

###################################################
from basf2 import register_module, create_path
import ROOT
from ROOT import Belle2
from ROOT.Belle2 import TestCalibrationAlgorithm
from caf.framework import Collection

###################################################
Expand All @@ -224,7 +222,7 @@ def get_calibrations(input_data, **kwargs):
if 'Geometry' not in rec_path_bhabha:
rec_path_bhabha.add_module('Geometry', useDB=True)

prepare_cdst_analysis(rec_path_bhabha) # for new 2020 cdst format
prepare_cdst_analysis(rec_path_bhabha, components=['SVD', 'CDC', 'ECL', 'KLM'])

# ====================================================
# t0BiasCorrection = -0.9 # Correct for the CDC t0 bias in ns
Expand Down Expand Up @@ -390,7 +388,7 @@ def get_calibrations(input_data, **kwargs):

cal_ecl_merge_i.save_payloads = False
ecl_merge_pre_path_i = basf2.create_path()
prepare_cdst_analysis(ecl_merge_pre_path_i)
prepare_cdst_analysis(ecl_merge_pre_path_i, components=['SVD', 'CDC', 'ECL', 'KLM'])
ecl_merge_pre_path_i.pre_collector_path = ecl_merge_pre_path_i

# If payload boundaries are set use SequentialBoundaries
Expand Down Expand Up @@ -476,8 +474,8 @@ def get_calibrations(input_data, **kwargs):
if 'Geometry' not in rec_path_bhabha_val:
rec_path_bhabha_val.add_module('Geometry', useDB=True)

prepare_user_cdst_analysis(rec_path_bhabha_val) # for new 2020 cdst format

# exclude PXD and PID, so only CDC and ECL used for eventT0
prepare_user_cdst_analysis(rec_path_bhabha_val, components=['SVD', 'CDC', 'ECL', 'KLM'])
col_bhabha_val = register_module('eclBhabhaTimeCalibrationValidationCollector')
col_bhabha_val.param('timeAbsMax', 70)
col_bhabha_val.param('saveTree', False)
Expand Down Expand Up @@ -552,8 +550,8 @@ def get_calibrations(input_data, **kwargs):
if 'Geometry' not in rec_path_hadron_val:
rec_path_hadron_val.add_module('Geometry', useDB=True)

prepare_user_cdst_analysis(rec_path_hadron_val) # for new 2020 cdst format

# exclude PXD and PID, so only CDC and ECL used for eventT0
prepare_user_cdst_analysis(rec_path_hadron_val, components=['SVD', 'CDC', 'ECL', 'KLM'])
col_hadron_val = register_module('eclHadronTimeCalibrationValidationCollector')
col_hadron_val.param('timeAbsMax', 70)
col_hadron_val.param('saveTree', False)
Expand Down Expand Up @@ -632,7 +630,7 @@ def get_calibrations(input_data, **kwargs):
if 'Geometry' not in rec_path_bhabha_plotting:
rec_path_bhabha_plotting.add_module('Geometry', useDB=True)

prepare_cdst_analysis(rec_path_bhabha_plotting) # for new 2020 cdst format
prepare_cdst_analysis(rec_path_bhabha_plotting, components=['SVD', 'CDC', 'ECL', 'KLM'])

col_bhabha_plotting = register_module('eclTimeShiftsPlottingCollector')
eclTCol = Collection(collector=col_bhabha_plotting,
Expand Down

0 comments on commit 8601fda

Please sign in to comment.