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