Belle II Software  release-08-01-10
printExtraInfo.py
1 #!/usr/bin/env python3
2 
3 
10 
11 import basf2
12 import modularAnalysis as ma
13 
14 main = basf2.create_path()
15 ma.inputMdst(basf2.find_file("analysis/tests/mdst.root"), path=main)
16 
17 # load the pions and write a something to extra info
18 ma.fillParticleList('pi+:example', '', path=main)
19 ma.variablesToExtraInfo("pi+:example", {"random": "someOtherExtraInfoName"}, path=main)
20 
21 # print the extra info associated to the pions
22 particleWisePrinter = basf2.register_module("ExtraInfoPrinter")
23 particleWisePrinter.set_name("ExtraInfoPrinter_Particles")
24 particleWisePrinter.param("particleList", 'pi+:example')
25 main.add_module(particleWisePrinter)
26 
27 # make some nonsense cuts just to write something to EventExtraInfo
28 # (eventrandom writes to EventExtraInfo)
29 ma.cutAndCopyList("pi+:filtered", "pi+:example", "eventRandom > 0.5", path=main)
30 
31 # print the extra info associated to this event
32 eventWisePrinter = basf2.register_module("ExtraInfoPrinter")
33 eventWisePrinter.set_name("ExtraInfoPrinter_Event")
34 eventWisePrinter.param('particleList', '')
35 main.add_module(eventWisePrinter)
36 
37 basf2.process(main)
38 print(basf2.statistics)