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