Belle II Software development
runCDCdEdxValidation.py
1
8
9# Example script to run dEdx validation module for bhabha or radbhabha or hadron skims
10# configure destination of file and set variable --> var
11
12
13import basf2
14import os
15import ROOT
16
17basf2.reset_database()
18basf2.use_database_chain()
19basf2.use_central_database("data_reprocessing_preproc8b")
20# basf2.use_local_database("localDB/database.txt", "localDB")
21
22ROOT.gROOT.SetBatch(True)
23
24
25var = 'bhabha' # bhabha or radbhabha or hadron
26
27if var == 'bhabha':
28 input_files = [os.path.abspath(
29 '/mnt/data/BelleIICalibration/data/preprod8b/electron/bhabha/cdst/skinny_cdst.preprod8b.*18*.root')]
30elif var == 'radbhabha':
31 input_files = [os.path.abspath(
32 '/mnt/data/BelleIICalibration/data/preprod8b/electron/radbhabha/cdst/skinny_cdst.preprod8b.*18*.root')]
33elif var == 'hadron':
34 input_files = [os.path.abspath('/mnt/data/BelleIICalibration/data/preprod8b/hadron/cdst/skinny_cdst.preprod8b.*18*.root')]
35else:
36 print("Only (rad)bhabha or hadron input files are compatible")
37 exit()
38
39mypath = basf2.Path() # create your own path (call it what you like)
40
41
42moduleA = basf2.register_module("RootInput")
43moduleA.param("inputFileNames", input_files)
44mypath.add_module(moduleA)
45
46
47moduleB = basf2.register_module("CDCDedxValidation")
48moduleB.param("fnRuns", 50)
49if var == 'bhabha':
50 moduleB.param("SampleType", "bhabha")
51 moduleB.param("outputFileName", "bhabha_outfile.root")
52elif var == 'radbhabha':
53 moduleB.param("SampleType", "radbhabha")
54 moduleB.param("outputFileName", "radbhabha_outfile.root")
55elif var == 'hadron':
56 moduleB.param("SampleType", "hadron")
57 moduleB.param("outputFileName", "hadron_outfile.root")
58else:
59 print("Only (rad)bhabha or hadron input files are compatible")
60 exit()
61
62mypath.add_module(moduleB)
63
64basf2.process(mypath)
65
66print(basf2.statistics)