Belle II Software development
|
Public Member Functions | |
def | __init__ (self, run_class, use_jupyter=True) |
def | train (self) |
def | evaluate_tracking (self) |
def | evaluate_classification (self) |
Public Attributes | |
run_class | |
cached copy of the run class | |
use_jupyter | |
cached flag to use jupyter notebook | |
recording_file_name | |
cached name of the output file | |
training_file_name | |
cached path without extension of the output file | |
test_file_name | |
cached path with extension of the testing-output file | |
identifier_name | |
cached identifier | |
evaluation_file_name | |
cached name of the output PDF file | |
expert_file_name | |
cached path with extension of the testing-export file | |
weight_data_location | |
cached path of the weight input data | |
Protected Member Functions | |
def | _call_training_routine (self) |
def | _write_train_and_test_files (self) |
def | _create_records_file (self) |
def | _call_expert_routine (self) |
def | _call_evaluation_routine (self) |
Class for training and analysing a tracking module, which has a MVA filter in it. Works best, if you are on a jupyter ntoebook. You need to supply a run_class, which includes all needed settings, on how to train and execute the module. This class will be mixed in with the normal trackfindingcdc run classes, so you can add the setting (e.g. tracking_coverage etc.) as normal. One examples is: class TestClass: # This module will be trained recording_module = "FilterBasedVXDCDCTrackMerger" # This is the name of the parameter of this module, which will be set to "mva" etc. recording_parameter = "filter" # These mva cuts will be tested during evaluation. evaluation_cuts = [0.1, 0.2, ...] tracking_coverage = { 'UsePXDHits': True, 'UseSVDHits': True, 'UseCDCHits': True, } # Some options, which will control the run classes fit_tracks = False generator_module = "EvtGenInput" # This will be added to the "normal" path, to record the training data (you do not have to set the module to # recording, as this is done automatically). def add_recording_modules(self, path): mctrackfinder = path.add_module('TrackFinderMCTruthRecoTracks', RecoTracksStoreArrayName='MCRecoTracks', WhichParticles=[]) path.add_module('MCRecoTracksMatcher', mcRecoTracksStoreArrayName="MCRecoTracks", prRecoTracksStoreArrayName="CDCRecoTracks", UseCDCHits=True, UsePXDHits=False, UseSVDHits=False) path.add_module('MCRecoTracksMatcher', mcRecoTracksStoreArrayName="MCRecoTracks", prRecoTracksStoreArrayName="VXDRecoTracks", UseCDCHits=False, UsePXDHits=True, UseSVDHits=True) # Merge CDC and CXD tracks path.add_module('FilterBasedVXDCDCTrackMerger', extrapolate=False, CDCRecoTrackStoreArrayName="CDCRecoTracks", VXDRecoTrackStoreArrayName="VXDRecoTracks", MergedRecoTrackStoreArrayName="RecoTracks") return path # This will be added to the "normal" path, to evaluate the mva cuts. In most cases, this is the same as the # add_recording_modules (as the module parameters will be set automatically), but maybe you need # more here... def add_validation_modules(self, path): mctrackfinder = path.add_module('TrackFinderMCTruthRecoTracks', RecoTracksStoreArrayName='MCRecoTracks', WhichParticles=[]) # Merge CDC and CXD tracks path.add_module('FilterBasedVXDCDCTrackMerger', extrapolate=True, CDCRecoTrackStoreArrayName="CDCRecoTracks", VXDRecoTrackStoreArrayName="VXDRecoTracks", MergedRecoTrackStoreArrayName="PrefitRecoTracks") path.add_module("SetupGenfitExtrapolation") path.add_module("DAFRecoFitter", recoTracksStoreArrayName="PrefitRecoTracks") path.add_module("TrackCreator", recoTrackColName="PrefitRecoTracks") path.add_module("FittedTracksStorer", inputRecoTracksStoreArrayName="PrefitRecoTracks", outputRecoTracksStoreArrayName="RecoTracks") # We need to include the matching ourselves, as we have already a matching algorithm in place path.add_module('MCRecoTracksMatcher', mcRecoTracksStoreArrayName="MCRecoTracks", prRecoTracksStoreArrayName="RecoTracks", UseCDCHits=True, UsePXDHits=True, UseSVDHits=True) return path
Definition at line 49 of file analyse.py.
def __init__ | ( | self, | |
run_class, | |||
use_jupyter = True |
|||
) |
Constructor
Definition at line 132 of file analyse.py.
|
protected |
Call the mva evaluation routine
Definition at line 301 of file analyse.py.
|
protected |
Call the mva expert
Definition at line 290 of file analyse.py.
|
protected |
Call the mva training routine in the train file
Definition at line 238 of file analyse.py.
|
protected |
Create a path using the settings of the run_class and process it. This will create a ROOT file with the recorded data.
Definition at line 258 of file analyse.py.
|
protected |
Split the recorded file into two halves: training and test file and write it back
Definition at line 245 of file analyse.py.
def evaluate_classification | ( | self | ) |
Evaluate the classification power on the test data set and produce a PDF.
Definition at line 215 of file analyse.py.
def evaluate_tracking | ( | self | ) |
Use the trained weight file and call the path again using different mva cuts. Validation using the normal tracking validation modules.
Definition at line 173 of file analyse.py.
def train | ( | self | ) |
Record a training file, split it in two parts and call the training method of the mva package
Definition at line 163 of file analyse.py.
evaluation_file_name |
cached name of the output PDF file
Definition at line 154 of file analyse.py.
expert_file_name |
cached path with extension of the testing-export file
Definition at line 157 of file analyse.py.
identifier_name |
cached identifier
Definition at line 152 of file analyse.py.
recording_file_name |
cached name of the output file
Definition at line 141 of file analyse.py.
run_class |
cached copy of the run class
Definition at line 136 of file analyse.py.
test_file_name |
cached path with extension of the testing-output file
Definition at line 149 of file analyse.py.
training_file_name |
cached path without extension of the output file
cached path with extension of the training-output file
Definition at line 147 of file analyse.py.
use_jupyter |
cached flag to use jupyter notebook
Definition at line 138 of file analyse.py.
weight_data_location |
cached path of the weight input data
Definition at line 160 of file analyse.py.