Belle II Software  release-08-01-10
PackUnpackFile.py
1 #!/usr/bin/env python3
2 
3 
10 
11 import basf2 as b2
12 
13 # suppress messages and warnings during processing:
14 b2.set_log_level(b2.LogLevel.INFO)
15 
16 input = b2.register_module('RootInput')
17 input.param('inputFileName', 'PXDRawHit.root')
18 
19 input.param('branchNames', ['EventMetaData', 'PXDDigits', 'PXDDigit'])
20 # 'RawPXDs',
21 
22 # to run the framework the used modules need to be registered
23 # eventinfosetter = register_module('EventInfoSetter')
24 # Setting the option for all non-hepevt reader modules:
25 # eventinfosetter.param('evtNumList', [10]) # we want to process 100 events
26 # eventinfosetter.param('runList', [1]) # from run number 1
27 # eventinfosetter.param('expList', [1]) # and experiment number 1
28 
29 histoman = b2.register_module('HistoManager')
30 histoman.param('histoFileName', 'your_histo_file.root')
31 
32 packer = b2.register_module('PXDPacker')
33 # [[dhhc1, dhh1, dhh2, dhh3, dhh4, dhh5] [ ... ]]
34 # -1 is disable port
35 packer.param('dhe_to_dhc', [
36  [0, 2, 4, 34, 36, 38],
37  [1, 6, 8, 40, 42, 44],
38  [2, 10, 12, 46, 48, 50],
39  [3, 14, 16, 52, 54, 56],
40  [4, 3, 5, 35, 37, 39],
41  [5, 7, 9, 41, 43, 45],
42  [6, 11, 13, 47, 49, 51],
43  [7, 15, 17, 53, 55, 57],
44 ])
45 
46 # packer.param('dhh_to_dhhc', [
47 # [ 1, 1, 2, 3, -1, 5, ],
48 # [ 2, 10, 11, 12, 13, 14, ],
49 # [ 3, -1, 16 ],
50 # [ 4 ],
51 # [ 5, 35 ]
52 # ])
53 
54 unpacker = b2.register_module('PXDUnpacker')
55 
56 simpleoutput = b2.register_module('RootOutput')
57 simpleoutput.param('outputFileName', 'Output.root')
58 
59 # creating the path for the processing
60 main = b2.create_path()
61 main.add_module(input)
62 # main.add_module(eventinfosetter)
63 # main.add_module(paramloader)
64 # main.add_module(geobuilder)
65 main.add_module(histoman)
66 main.add_module(packer)
67 main.add_module(unpacker)
68 main.add_module('PXDRawDQM')
69 main.add_module('PXDROIDQM')
70 main.add_module('Progress')
71 main.add_module(simpleoutput)
72 
73 # Process the events
74 b2.process(main)
75 # if there are less events in the input file the processing will be stopped at
76 # EOF.