Belle II Software development
B_generic_train.py
1#!/usr/bin/env python3
2
3
10
11import fei
12import basf2 as b2
13import modularAnalysis as ma
14import pickle
15
16# create path
17path = b2.create_path()
18
19# Load input ROOT file
20ma.inputMdst(filename=b2.find_file('mdst16.root', 'validation', False),
21 path=path)
22
23# Get FEI default channels.
24# Utilise the arguments to toggle on and off certain channels
25particles = fei.get_default_channels()
26
27# Set up FEI configuration specifying the FEI prefix
28configuration = fei.config.FeiConfiguration(prefix='FEI_TEST', training=True)
29
30# Get FEI path
31feistate = fei.get_path(particles, configuration)
32
33# Add FEI path to the path to be processed
34path.add_path(feistate.path)
35
36# Add RootOutput to save particles reconstructing during the training stage
37output = b2.register_module('RootOutput')
38if pickle.load(open('Summary.pickle', 'rb'))[1].roundMode == 3: # this is necessary for the retraining mode
39 output.param('excludeBranchNames', feistate.excludelists)
40path.add_module(output)
41
42
43# Process 100 events
44b2.process(path, max_event=100)