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