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