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