10Airflow script to perform BoostVector calibration.
13from prompt
import CalibrationSettings, INPUT_DATA_FILTERS
14from prompt.calibrations.caf_beamspot
import settings
as beamspot
17settings = CalibrationSettings(
18 name=
"BoostVector Calibrations",
19 expert_username=
"zlebcr",
21 input_data_formats=[
"cdst"],
22 input_data_names=[
"mumu_tight_or_highm_calib"],
24 "mumu_tight_or_highm_calib": [
25 INPUT_DATA_FILTERS[
"Data Tag"][
"mumu_tight_or_highm_calib"],
26 INPUT_DATA_FILTERS[
"Run Type"][
"physics"],
27 INPUT_DATA_FILTERS[
"Data Quality Tag"][
"Good Or Recoverable"],
28 INPUT_DATA_FILTERS[
"Magnet"][
"On"]]},
30 "outerLoss":
"pow(rawTime - 8.0, 2) + 10 * pow(maxGap, 2)",
31 "innerLoss":
"pow(rawTime - 8.0, 2) + 10 * pow(maxGap, 2)"},
32 depends_on=[beamspot])
37def get_calibrations(input_data, **kwargs):
40 input_data (dict): Should contain every name from the
'input_data_names' variable
as a key.
41 Each value
is a dictionary
with {
"/path/to/file_e1_r5.root": IoV(1,5,1,5), ...}. Useful
for
42 assigning to calibration.files_to_iov
44 **kwargs: Configuration options to be sent
in. Since this may change we use kwargs
as a way to help prevent
45 backwards compatibility problems. But you could use the correct arguments
in b2caf-prompt-run
for this
46 release explicitly
if you want to.
48 Currently only kwargs[
"output_iov"]
is used. This
is the output IoV range that your payloads should
49 correspond to. Generally your highest ExpRun payload should be open ended e.g. IoV(3,4,-1,-1)
52 list(caf.framework.Calibration): All of the calibration objects we want to assign to the CAF process
59 file_to_iov_physics = input_data[
"mumu_tight_or_highm_calib"]
64 max_files_per_run = 1000000
70 reduced_file_to_iov_physics = filter_by_max_files_per_run(file_to_iov_physics, max_files_per_run)
71 input_files_physics = list(reduced_file_to_iov_physics.keys())
72 basf2.B2INFO(f
"Total number of files actually used as input = {len(input_files_physics)}")
76 requested_iov = kwargs.get(
"requested_iov",
None)
78 from caf.utils
import IoV
80 output_iov = IoV(requested_iov.exp_low, requested_iov.run_low, -1, -1)
85 from ROOT
import Belle2
86 from ROOT.Belle2
import BoostVectorAlgorithm
87 from basf2
import create_path, register_module
88 import modularAnalysis
as ana
94 from caf.framework
import Calibration
95 from caf.strategies
import SingleIOV
96 from reconstruction
import prepare_cdst_analysis
99 rec_path_1 = create_path()
100 prepare_cdst_analysis(path=rec_path_1, components=[
'CDC',
'ECL',
'KLM'])
102 muSelection =
'[p>1.0]'
103 muSelection +=
' and abs(dz)<2.0 and abs(dr)<0.5'
104 muSelection +=
' and nPXDHits >=1 and nSVDHits >= 8 and nCDCHits >= 20'
105 ana.fillParticleList(
'mu+:BV', muSelection, path=rec_path_1)
106 ana.reconstructDecay(
'Upsilon(4S):BV -> mu+:BV mu-:BV',
'9.5<M<11.5', path=rec_path_1)
107 vertex.treeFit(
'Upsilon(4S):BV', updateAllDaughters=
True, ipConstraint=
True, path=rec_path_1)
109 collector_bv = register_module(
'BoostVectorCollector', Y4SPListName=
'Upsilon(4S):BV')
110 algorithm_bv = BoostVectorAlgorithm()
111 algorithm_bv.setOuterLoss(kwargs[
'expert_config'][
'outerLoss'])
112 algorithm_bv.setInnerLoss(kwargs[
'expert_config'][
'innerLoss'])
115 collector=collector_bv,
116 algorithms=algorithm_bv,
117 input_files=input_files_physics,
118 pre_collector_path=rec_path_1)
120 calibration_bv.strategies = SingleIOV
124 for algorithm
in calibration_bv.algorithms:
125 algorithm.params = {
"iov_coverage": output_iov}
131 return [calibration_bv]
def treeFit(list_name, conf_level=0.001, massConstraint=[], ipConstraint=False, updateAllDaughters=False, customOriginConstraint=False, customOriginVertex=[0.001, 0, 0.0116], customOriginCovariance=[0.0048, 0, 0, 0, 0.003567, 0, 0, 0, 0.0400], originDimension=3, treatAsInvisible='', ignoreFromVertexFit='', path=None)