ATLAS Offline Software
|
Public Member Functions | |
def | __init__ (self, root_file_name='ISF_HitAnalysispion.root', base_output_folder='RegressionOutput') |
def | initialize_cumulative_trees (self) |
def | fill_regression_tree (self, cumulative_histogram) |
def | run_regression (self) |
def | run (self) |
def | process_entry (self, chain, event_number) |
def | take_event_into_account (self, chain, event_number) |
def | create_output (self) |
def | check_output_folders (self) |
def | obtain_output_names (self) |
def | create_eta_phi_histogram (self, name, title) |
def | shower_test_plot_getrandom2 (self, histogram) |
def | shower_test_plot_tmva (self, reference, randomize_pos=True) |
def | plot_regression_control_plots (self, file_name=None, show_target=False, compare_to_train=False) |
def | difference_to_reference (self, reference, histogram, output_name, x_label, y_label, inverted_ratio=False) |
def | get_layer_name (self, layer_id) |
Static Public Member Functions | |
def | check_folder (folder) |
def | plot_root_hist2d (histogram, file_name='root_hist2d.pdf', x_label='X-Axis', y_label='Y-Axis', z_label='Probability', logscale=False, normalize=False, root_file=None) |
def | phi_mpi_pi (phi) |
Definition at line 6 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.__init__ | ( | self, | |
root_file_name = 'ISF_HitAnalysispion.root' , |
|||
base_output_folder = 'RegressionOutput' |
|||
) |
Most of the important settings are configured/set within this function. TODO: Make these options configurable via an external options file to ease the use of the script. TODO: Make remaining hardcoded options configurable here.
Definition at line 7 of file ShowerShapeRegression.py.
|
static |
Definition at line 350 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.check_output_folders | ( | self | ) |
Definition at line 361 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.create_eta_phi_histogram | ( | self, | |
name, | |||
title | |||
) |
This is a helper function to create the eta phi histograms either with equidistant or non-equidistant binning depending on the settings. Please use this function to avoid code duplication.
Definition at line 389 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.create_output | ( | self | ) |
This function creates the average shower shape from all the energy fraction distributions and plots it. In case self.do_regression is set to True, it will initialize the input trees used by TMVA (using self.initialize_cumulative_trees), it will fill them (using self.fill_regression_tree) and run the regression by calling self.run_regression. Once TMVA finished, regression test/control plots and our shower shape control plots will be created.
Definition at line 259 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.difference_to_reference | ( | self, | |
reference, | |||
histogram, | |||
output_name, | |||
x_label, | |||
y_label, | |||
inverted_ratio = False |
|||
) |
Definition at line 685 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.fill_regression_tree | ( | self, | |
cumulative_histogram | |||
) |
Uses the supplied histogram to fill the regression tree with values. Depending on self.log_efrac the trees are either filled with the logarithm of the energy fraction or with just the energy fraction.
Definition at line 89 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.get_layer_name | ( | self, | |
layer_id | |||
) |
Definition at line 705 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.initialize_cumulative_trees | ( | self | ) |
Definition at line 77 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.obtain_output_names | ( | self | ) |
Definition at line 367 of file ShowerShapeRegression.py.
|
static |
Definition at line 712 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.plot_regression_control_plots | ( | self, | |
file_name = None , |
|||
show_target = False , |
|||
compare_to_train = False |
|||
) |
This is a pythonic translation of the deviations function found in the TMVA examples.
Definition at line 541 of file ShowerShapeRegression.py.
|
static |
Definition at line 634 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.process_entry | ( | self, | |
chain, | |||
event_number | |||
) |
This processes a single event in the chain. It first checks whether this event should be processed by calling the take_event_into_account function. If this function returns true processing of this event continues else the event will be skipped. Only a single layer (self.selected_layer) will be processed. A histogram will be filled with the energy distribution vs eta and phi. Corrections by the track to calo extrapolator will be applied here. Once all events have been finished the histogram will be divided by its integral. Once the desired number of events (self.cumulated_events_threshold) has been reached the self.create_output() function will be called.
Definition at line 190 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.run | ( | self | ) |
This function iterates over all events and calls for each event the process_entry function. The event loop breaks either once process_entry returns false or once all events in the input file have been processed.
Definition at line 153 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.run_regression | ( | self | ) |
Definition at line 121 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.shower_test_plot_getrandom2 | ( | self, | |
histogram | |||
) |
This function uses the input histogram's GetRandom2 function to draw random numbers according to the distribution found in the input histogram and fills 50000 entries into a new histogram and in the end prints it to a file.
Definition at line 413 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.shower_test_plot_tmva | ( | self, | |
reference, | |||
randomize_pos = True |
|||
) |
This function uses the NN obtained by TMVA to plot the fitted shower shape and the ratio to the reference. In case randomize_pos is set to true (which is the default), random positions (flat distributed) in the eta-phi plane will drawn. The NN will be evaluated there and the value will be filled into the output histogram. This method is faster than drawing a third random number and accepting the point based on whether this rnd number is greater than the NN at this point or not. If randomize_pos is set to false, a histogram will be filled by evaluating the NN at each point and filling the value into the histogram.
Definition at line 452 of file ShowerShapeRegression.py.
def ShowerShapeRegression.ShowerShapeRegressor.take_event_into_account | ( | self, | |
chain, | |||
event_number | |||
) |
ShowerShapeRegression.ShowerShapeRegressor.base_file_name |
Definition at line 71 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.base_output_folder |
Definition at line 20 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.cum_distribution_trees |
Definition at line 60 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.cum_efrac_array |
Definition at line 66 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.cum_eta_array |
Definition at line 63 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.cum_phi_array |
Definition at line 64 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.cum_r_array |
Definition at line 65 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.cumulated_events |
Definition at line 46 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.cumulated_events_threshold |
Definition at line 47 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.cumulative_etaphi_nbins |
Definition at line 30 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.cumulative_etaphi_xrange |
Definition at line 31 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.cumulative_etaphi_yrange |
Definition at line 32 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.do_regression |
Definition at line 75 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.equidistant_binning |
Definition at line 34 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.eta_phi_efrac_hists |
Definition at line 44 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.etaphi_nbins |
Definition at line 26 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.etaphi_xrange |
Definition at line 27 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.etaphi_yrange |
Definition at line 28 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.layer_names |
Definition at line 49 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.log_efrac |
Definition at line 16 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.mlp_base_file_name |
Definition at line 72 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.neuron_type |
Definition at line 14 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.num_neurons |
Definition at line 18 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.regression_method |
Definition at line 68 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.root_file_name |
Definition at line 19 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.selected_layer |
Definition at line 57 of file ShowerShapeRegression.py.
ShowerShapeRegression.ShowerShapeRegressor.truth_energy_threshold |
Definition at line 22 of file ShowerShapeRegression.py.