Belle II Software development
PackUnpackFile.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12
13# suppress messages and warnings during processing:
14b2.set_log_level(b2.LogLevel.INFO)
15
16input = b2.register_module('RootInput')
17input.param('inputFileName', 'PXDRawHit.root')
18
19input.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
29histoman = b2.register_module('HistoManager')
30histoman.param('histoFileName', 'your_histo_file.root')
31
32packer = b2.register_module('PXDPacker')
33# [[dhhc1, dhh1, dhh2, dhh3, dhh4, dhh5] [ ... ]]
34# -1 is disable port
35packer.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
54unpacker = b2.register_module('PXDUnpacker')
55
56simpleoutput = b2.register_module('RootOutput')
57simpleoutput.param('outputFileName', 'Output.root')
58
59# creating the path for the processing
60main = b2.create_path()
61main.add_module(input)
62# main.add_module(eventinfosetter)
63# main.add_module(paramloader)
64# main.add_module(geobuilder)
65main.add_module(histoman)
66main.add_module(packer)
67main.add_module(unpacker)
68main.add_module('PXDRawDQM')
69main.add_module('PXDROIDQM')
70main.add_module('Progress')
71main.add_module(simpleoutput)
72
73# Process the events
74b2.process(main)
75# if there are less events in the input file the processing will be stopped at
76# EOF.