Belle II Software development
produceSample_releaseValidation.py
1#!/usr/bin/env python3
2
3from ROOT import Belle2
4
5import basf2
6import logging
7
8import reconstruction as re
9
10
11def main():
12 """Only execute the code if the script is run but not when it's imported."""
13 basf2.set_random_seed(1234)
14
15 path = basf2.create_path()
16
17 environment = Belle2.Environment.Instance()
18 environment.setNumberEventsOverride(10000)
19
20 # Simulate events first (e.g. sample produced by validation/validation/EvtGenSim.py)
21 path.add_module('RootInput', inputFileName='./EvtGenSim.root')
22
23 # Some default modules
24 path.add_module('Progress')
25
26 path.add_module("Gearbox")
27 path.add_module("Geometry")
28
29 # Do not prune the tracks (usually all but first and last hit are removed)
30 re.add_reconstruction(path, pruneTracks=False, reconstruct_cdst="rawFormat")
31
32 # Set a few options of modules that we need for the studies
33 for module in path.modules():
34 if 'TrackFinderMCTruthRecoTracks' in module.name():
35 module.param({"UseReassignedHits": True, 'UseNLoops': 1})
36 if 'V0Finder' in module.name():
37 module.param("Validation", True)
38
39 # Add MC information for V0s
40 path.add_module('MCV0Matcher', V0ColName='V0ValidationVertexs')
41
42 # Add a bunch of branches that we need (on top of cdst)
43 re.add_cdst_output(
44 path,
45 mc=True,
46 filename='./validationSample.root',
47 additionalBranches=[
48 'SVDClusters',
49 'PXDClusters',
50 'CDCSimHits',
51 'CDCSimHitsToCDCHits',
52 'MCRecoTracks',
53 'RecoHitInformations',
54 'RecoTracksToRecoHitInformations',
55 'MCRecoTracksToRecoHitInformations',
56 'MCRecoTracksToMCParticles',
57 'MCRecoTracksToRecoTracks',
58 'RecoTracksToMCParticles',
59 'RecoTracksToMCRecoTracks',
60 'V0ValidationVertexs',
61 'V0ValidationVertexsToMCParticles',
62 'V0sToV0ValidationVertexs',
63 'TracksToRecoTracks',
64 'TracksToMCParticles'])
65
66 basf2.print_path(path)
67 basf2.process(path)
68
69 logging.basicConfig(level=logging.INFO)
70
71 print(basf2.statistics)
72
73
74if __name__ == "__main__":
75 main()
static Environment & Instance()
Static method to get a reference to the Environment instance.
Definition: Environment.cc:28
Definition: main.py:1