2 \namespace xboa::examples::Example_3
4 Example code to read a file, make some cuts and then plot
6 \include xboa/examples/Example_3.py
26 print '========= XBOA example 3 ========='
29 print "This example shows how to make cuts"
30 print "Loading file... "
31 bunch_list = Bunch.new_list_from_read_builtin(
'icool_for009', sys.prefix+
'/share/xboa/data/for009.dat')
35 bunch_list[0].root_histogram(
'px',
'MeV/c')
39 bunch_list[0].cut({
'px':30.}, operator.ge)
41 bunch_list[0].cut({
'px':-30.}, operator.le)
43 bunch_list[0].root_histogram(
'px',
'MeV/c')
47 bunch_list[0].clear_weights()
50 bunch_list[0].cut({
'amplitude x y':30.}, operator.ge, global_cut=
True)
51 n_stations = len(bunch_list)
56 bunch_list[0].root_histogram(
'amplitude x y',
'mm')
59 bunch_list[n_stations/3].root_histogram(
'amplitude x y',
'mm')
60 bunch_list[2*n_stations/3].root_histogram(
'amplitude x y',
'mm')
61 bunch_list[-1].root_histogram(
'amplitude x y',
'mm')
64 for bunch
in bunch_list:
68 Bunch.root_graph(bunch_list,
'mean', [
'z'],
'bunch_weight',
'')
73 bunch_list[0].transmission_cut(bunch_list[-1], global_cut=
True)
75 Bunch.root_graph(bunch_list,
'mean', [
'z'],
'bunch_weight',
'')
78 print 'Press <return> key to finish'
80 Bunch.clear_global_weights()
Implemented within this module:
Implemented within this module: