11 import multiprocessing
14 from ROOT
import Belle2
15 from ROOT.Belle2
import BeamSpotAlgorithm
17 from caf.framework
import Calibration, CAF, Collection, LocalDatabase, CentralDatabase
18 from caf
import backends
19 from caf
import strategies
21 import modularAnalysis
as ana
23 basf2.set_log_level(basf2.LogLevel.INFO)
26 def BeamSpotCalibration(files, tags):
28 Function to get the BeamSpot calibration object.
29 Takes list of files and list of GTs as arguments.
32 path = basf2.create_path()
33 path.add_module(
'Progress')
34 path.add_module(
'RootInput')
37 muSelection =
'[p>1.0]'
38 muSelection +=
' and abs(dz)<2.0 and abs(dr)<0.5'
39 muSelection +=
' and nPXDHits >=1 and nSVDHits >= 8 and nCDCHits >= 20'
40 ana.fillParticleList(
'mu+:BS', muSelection, path=path)
41 ana.reconstructDecay(
'Upsilon(4S):BS -> mu+:BS mu-:BS',
'9.5<M<11.5', path=path)
44 collector = basf2.register_module(
'BeamSpotCollector', Y4SPListName=
'Upsilon(4S):BS')
45 algorithm = BeamSpotAlgorithm()
51 pre_collector_path=path,
52 database_chain=[CentralDatabase(tag)
for tag
in tags],
54 max_files_per_collector_job=1,
64 if __name__ ==
"__main__":
67 if not len(input_files):
68 print(
"You have to specify some input file(s) (raw data or di - muon skim with raw objects)\n"
69 "using the standard basf2 command line option - i")
70 print(
"See: basf2 -h")
73 beamspot = BeamSpotCalibration(input_files, [
'data_reprocessing_prompt',
'online_bucket9'])
76 cal_fw.add_calibration(beamspot)
80 if multiprocessing.cpu_count() < 10: