19 import multiprocessing
21 from ROOT
import Belle2
22 from ROOT.Belle2
import BeamSpotAlgorithm
24 from caf.framework
import CAF, Calibration, CentralDatabase
25 from caf
import backends
26 from caf
import strategies
28 import modularAnalysis
as ana
30 basf2.set_log_level(basf2.LogLevel.INFO)
33 def BeamSpotCalibration(files, tags):
35 Function to get the BeamSpot calibration object.
36 Takes list of files and list of GTs as arguments.
39 path = basf2.create_path()
40 path.add_module(
'Progress')
41 path.add_module(
'RootInput')
44 muSelection =
'[p>1.0]'
45 muSelection +=
' and abs(dz)<2.0 and abs(dr)<0.5'
46 muSelection +=
' and nPXDHits >=1 and nSVDHits >= 8 and nCDCHits >= 20'
47 ana.fillParticleList(
'mu+:BS', muSelection, path=path)
48 ana.reconstructDecay(
'Upsilon(4S):BS -> mu+:BS mu-:BS',
'9.5<M<11.5', path=path)
51 collector = basf2.register_module(
'BeamSpotCollector', Y4SPListName=
'Upsilon(4S):BS')
52 algorithm = BeamSpotAlgorithm()
58 pre_collector_path=path,
59 database_chain=[CentralDatabase(tag)
for tag
in tags],
61 max_files_per_collector_job=1,
66 calibration.strategies = strategies.SingleIOV
71 if __name__ ==
"__main__":
74 if not len(input_files):
75 print(
"You have to specify some input file(s) (raw data or di - muon skim with raw objects)\n"
76 "using the standard basf2 command line option - i")
77 print(
"See: basf2 -h")
80 beamspot = BeamSpotCalibration(input_files, [
'data_reprocessing_prompt',
'online_bucket9'])
83 cal_fw.add_calibration(beamspot)
84 cal_fw.backend = backends.LSF()
87 if multiprocessing.cpu_count() < 10:
88 cal_fw.backend = backends.Local(8)
static Environment & Instance()
Static method to get a reference to the Environment instance.