5 An example script to reconstruct osmics events with standalone CDC.
7 basf2 runReconstruction.py <input> <output>
8 input: Input root file (Raw data)
9 GCR1 (RAW) /hsm/belle2/bdata/Data/Raw/e0001/
10 GCR2 (RAW) /hsm/belle2/bdata/Data/Raw/e0002/
12 output : Output root file, which contains helix parameters.
13 N.B. this is not the basf2 root file!
14 To see the helix parameters.
15 Please use compare2Tracks.C for example.
24 from reconstruction
import add_cosmics_reconstruction
25 from ROOT
import Belle2
31 use_central_database(
"332_COPY-OF_GT_gen_prod_004.11_Master-20171213-230000", LogLevel.INFO)
32 use_central_database(
"MagneticFieldPhase2QCSoff")
36 def rec(input, output, topInCounter=False, magneticField=True,
37 unpacking=True, fieldMapper=False):
38 main_path = basf2.create_path()
39 logging.log_level = LogLevel.INFO
42 exp_number, run_number = getExpRunNumber(input)
45 data_period = getDataPeriod(exp=exp_number,
48 mapperAngle = getMapperAngle(exp=exp_number,
52 if os.path.exists(
'output')
is False:
56 main_path.add_module(
'RootInput',
60 main_path.add_module(
'CDCUnpacker')
62 if data_period ==
'gcr2017':
63 gearbox = register_module(
'Gearbox',
64 fileName=
"/geometry/GCR_Summer2017.xml",
65 override=[(
"/Global/length",
"8.",
"m"),
66 (
"/Global/width",
"8.",
"m"),
67 (
"/Global/height",
"8.",
"m"),
69 main_path.add_module(gearbox)
71 main_path.add_module(
'Gearbox')
73 if fieldMapper
is True:
74 main_path.add_module(
'CDCJobCntlParModifier',
76 MapperPhiAngle=mapperAngle)
78 if magneticField
is True:
79 main_path.add_module(
'Geometry', useDB=
True)
81 main_path.add_module(
'Geometry',
82 components=[
'CDC',
'ECL'])
84 main_path.add_module(
'Progress')
87 set_cdc_cr_parameters(data_period)
88 add_cdc_cr_reconstruction(main_path)
94 output =
"/".join([
'output', output])
95 main_path.add_module(
'CDCCosmicAnalysis',
96 noBFit=
not magneticField,
100 basf2.print_path(main_path)
102 print(basf2.statistics)
105 if __name__ ==
"__main__":
107 parser = argparse.ArgumentParser()
108 parser.add_argument(
'input', help=
'Input file to be processed (unpacked CDC data).')
109 parser.add_argument(
'output', help=
'Output file you want to store the results.')
110 args = parser.parse_args()
111 rec(args.input, args.output, topInCounter=
False, magneticField=
True,
112 unpacking=
True, fieldMapper=
False)