xboa
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Hit Class Reference

Represents a particle at a point in some phase space. More...

Inherits object.

Public Member Functions

def __init__
 Initialise to an empty event. More...
 
def __repr__
 Formatting for print command. More...
 
def __copy__
 Shallow copy i.e. More...
 
def __deepcopy__
 Deep copy i.e. More...
 
def __eq__
 Test for equality of data values between self and target. More...
 
def __ne__
 Test for inequality of data values between self and target. More...
 
def __getitem__
 Mimic some aspects of dict. More...
 
def __setitem__
 Mimic some aspects of dict. More...
 
def __del__
 Clean up. More...
 
def new_from_dict
 Static function returns a new hit object, setting data using string:value dict. More...
 
def new_from_read_builtin
 Static function returns a new hit object, read from filehandle with a built-in format. More...
 
def new_from_read_user
 Static function returns a new hit object sets data using string/value pairs from set_dict and forces E^2=p^2+m^2 by changing mass_shell_string. More...
 
def new_list_from_maus_root
 Static function returns a list of hit objects found in the spill. More...
 
def new_list_from_maus_json
 Static function returns a list of hit objects found in the spill. More...
 
def copy
 Return a shallow copy of self (copying data as references) More...
 
def deepcopy
 Return a deep copy of target (deep copying target's data to self as well) More...
 
def get_vector
 Return a numpy vector of data values taking data from get_variable_list, relative to some origin. More...
 
def translate
 Iterate over translation_dict and add the value in the dict to the value stored in Hit. More...
 
def abelian_transformation
 Perform an abelian transformation about the origin, i.e. More...
 
def mass_shell_condition
 Change variable represented by variable_string to force E^2 = p^2 + m^2. More...
 
def get
 Return the value referenced by key. More...
 
def set
 Set the value referenced by key. More...
 
def check
 Return True if mass shell condition is obeyed and pid is correct for the mass else return False. More...
 
def dict_from_hit
 Return a dict that uniquely defines the hit, so that new_from_dict(dict_from_hit(hit)) returns a copy of hit. More...
 
def write_builtin_formatted
 Write to a file formatted according to built-in file_type format. More...
 
def write_list_builtin_formatted
 Write a list of hits to a file formatted according to built-in file_type format. More...
 
def open_filehandle_for_writing
 Open a file handle of the specified type for writing. More...
 
def file_header
 Return the file_header for the given file_type. More...
 
def write_user_formatted
 Write to a file formatted according to built-in file_type format. More...
 
def file_types
 Static function returns a list of available file types. More...
 
def get_maus_dict
 Convert from hit to a maus dict for MAUS IO. More...
 
def get_maus_tree
 Convert from list of hits to a tree of maus objects. More...
 
def mass_shell_variables
 Static function returns a list of variables suitable for mass_shell_condition calls. More...
 
def get_variables
 Static function returns a list of variable suitable for get calls. More...
 
def set_variables
 Static function returns a list of variable suitable for set calls. More...
 
def get_p
 Returns total momentum of the hit. More...
 
def get_r
 Returns transverse distance (i.e. More...
 
def get_phi
 Returns transverse angle (i.e. More...
 
def get_pt
 Returns transverse momentum of the hit. More...
 
def get_pphi
 Returns transverse angle of momentum (i.e. More...
 
def get_r_squared
 Returns x divergence i.e. More...
 
def get_xP
 Returns x divergence i.e. More...
 
def get_yP
 Returns y divergence i.e. More...
 
def get_tP
 Returns t \'divergence\' i.e. More...
 
def get_rP
 Returns dr/dz = pt/pz of the hit. More...
 
def get_spin
 Returns absolute value of the spin. More...
 
def get_ct
 Returns speed_of_light*t of the hit. More...
 
def get_ek
 Returns total energy - mass, ie kinetic energy of the hit. More...
 
def set_ek
 Sets kinetic energy = total energy - mass of the hit. More...
 
def get_l_kin
 Returns kinetic angular momentum about the z-axis. More...
 
def set_ct
 Sets t = value_float/c_light. More...
 
def set_p
 Set p to value_float keeping momentum direction constant. More...
 
def set_xP
 Set x\' to value_float keeping pz constant. More...
 
def set_yP
 Set y\' to value_float keeping pz constant. More...
 
def set_tP
 Set t\' (dt/dz=-E/pz) to value_float keeping pz constant; note sign of pz may change. More...
 
def get_weight
 Returns total weight for this Hit. More...
 
def clear_global_weights
 Set all global weights to 1. More...
 
def delete_global_weights
 Clear memory allocated to global weights - also resets global weights to 1. More...
 
def get_local_weight
 Returns local weight for this Hit. More...
 
def set_local_weight
 Set local weight for this Hit to be value. More...
 
def get_global_weight
 Returns global weight for this Hit. More...
 
def set_global_weight
 Set global weight for this Hit to be value. More...
 
def set_g4bl_unit
 g4beamline_track_file can take different units for length - set the unit here More...
 
def hit_overview_doc
 Creates some summary documentation for the Hit class. More...
 

Static Public Attributes

tuple new_from_dict = staticmethod(new_from_dict)
 
tuple new_from_read_builtin = staticmethod(new_from_read_builtin)
 
tuple new_from_read_user = staticmethod(new_from_read_user)
 
tuple write_list_builtin_formatted = staticmethod(write_list_builtin_formatted)
 
tuple open_filehandle_for_writing = staticmethod(open_filehandle_for_writing)
 
tuple file_header = staticmethod(file_header)
 
tuple file_types = staticmethod(file_types)
 
tuple get_maus_tree = staticmethod(get_maus_tree)
 
tuple mass_shell_variables = staticmethod(mass_shell_variables)
 
tuple get_variables = staticmethod(get_variables)
 
tuple set_variables = staticmethod(set_variables)
 
tuple clear_global_weights = staticmethod(clear_global_weights)
 
tuple delete_global_weights = staticmethod(delete_global_weights)
 
tuple set_g4bl_unit = staticmethod(set_g4bl_unit)
 
tuple hit_overview_doc = staticmethod(hit_overview_doc)
 

Private Member Functions

def __write_formatted
 
def __get_maus_root_virtual_hits
 
def __get_maus_root_primary_hits
 
def __split_list_by_equality
 
def __get_maus_tree_recursive
 
def __split_list_by_equality
 
def __return_one
 
def __do_nothing
 
def __event_cmp
 
def __station_cmp
 

Private Attributes

 __hitcore
 

Static Private Attributes

list __slots__ = ['__hitcore']
 
tuple __get_maus_root_virtual_hits = staticmethod(__get_maus_root_virtual_hits)
 
tuple __get_maus_root_primary_hits = staticmethod(__get_maus_root_primary_hits)
 
tuple __split_list_by_equality = staticmethod(__split_list_by_equality)
 
tuple __get_maus_tree_recursive = staticmethod(__get_maus_tree_recursive)
 
list __file_types = ['icool_for009', 'icool_for003', 'g4beamline_bl_track_file', 'mars_1']
 
list __mass_shell_variables = ['', 'p', 'px', 'py', 'pz', 'energy']
 
dictionary __get_variables
 
dictionary __set_variables = {'p':set_p,'x\'':set_xP,'y\'':set_yP,'t\'':set_tP,'ct':set_ct,'kinetic_energy':set_ek,'':__do_nothing}
 
dictionary _default_var_types
 
list __get_keys = []
 
list __set_keys = []
 
dictionary __maus_three_vec_conversions
 
dictionary __maus_variable_conversions
 
dictionary __maus_paths
 
dictionary __maus_root_mc_types
 
dictionary __maus_root_recon_types = {}
 
dictionary __file_formats
 
dictionary __file_units
 
dictionary __file_headers
 
string __default_user_string = 'File generated by X_BOA'
 
tuple __event_cmp = staticmethod(__event_cmp)
 
tuple __station_cmp = staticmethod(__station_cmp)
 
dictionary __hit_sort_comparator
 
tuple __angular_momentum_centroid = (0.,0.,0.)
 
tuple __angular_momentum_vector = (0.,0.,1.)
 
list __bad_pids = []
 
list __opal_ignore_probes = ["RING"]
 
dictionary __opal_probes = {}
 
int __opal_pid = 0
 

Detailed Description

Represents a particle at a point in some phase space.

Hit contains functions for i/o, as well as accessors for rectangular or cylindrical coordinate systems and functions to perform translations, abelian transformations etc.

Hit has the following variables (stored for real in C struct Hitcore)

Additionally,

Definition at line 93 of file _hit.py.

Constructor & Destructor Documentation

def __init__ (   self)

Initialise to an empty event.

Alternatively use static initialisers defined below - I prefer static initialisers

Definition at line 99 of file _hit.py.

def __del__ (   self)

Clean up.

Definition at line 144 of file _hit.py.

References Hit.__hitcore.

Member Function Documentation

def __repr__ (   self)

Formatting for print command.

Definition at line 104 of file _hit.py.

References Hit.dict_from_hit().

def __copy__ (   self)

Shallow copy i.e.

copy as reference

Definition at line 109 of file _hit.py.

Referenced by Hit.copy().

def __deepcopy__ (   self,
  target 
)

Deep copy i.e.

copy as data

Definition at line 115 of file _hit.py.

References Hit.dict_from_hit().

def __eq__ (   self,
  target,
  float_tolerance = Common.float_tolerance 
)

Test for equality of data values between self and target.

Definition at line 121 of file _hit.py.

Referenced by Hit.__ne__().

def __ne__ (   self,
  target,
  float_tolerance = Common.float_tolerance 
)

Test for inequality of data values between self and target.

Definition at line 129 of file _hit.py.

References Hit.__eq__(), and Bunch.__eq__().

def __getitem__ (   self,
  variable 
)

Mimic some aspects of dict.

Definition at line 134 of file _hit.py.

References Hit.get(), and Bunch.get().

def __setitem__ (   self,
  variable,
  value 
)

Mimic some aspects of dict.

Definition at line 139 of file _hit.py.

References Hit.set().

def new_from_dict (   set_dict,
  mass_shell_string = '' 
)

Static function returns a new hit object, setting data using string:value dict.

Then forces E^2=p^2+m^2 by changing mass_shell_string.

- set_dict = dict of string:value pairs where strings are from set_variables()
- mass_shell_string = string from list mass_shell_variables that references the value that will be changed to force E^2=p^2+m^2

e.g. myHit = Hit.new_from_dict({'x':5, 'y':0, 'z':100, 'px':0, 'py':5, 'pz':200, 'pid':-13}, 'energy' )

Definition at line 157 of file _hit.py.

References Hit.new_from_dict.

def new_from_read_builtin (   format,
  filehandle 
)

Static function returns a new hit object, read from filehandle with a built-in format.

  • format = string from the list file_types() that defines the format of the input
  • filehandle = filehandle from which the hit object will be read

e.g. myHit = Hit.new_from_read_builtin('zgoubi', myfile) Note that this will read one event, typically corresponding to one line in <filehandle>

Definition at line 176 of file _hit.py.

References Hit.new_from_read_builtin.

def new_from_read_user (   format_list,
  format_units_dict,
  filehandle,
  mass_shell_condition = '' 
)

Static function returns a new hit object sets data using string/value pairs from set_dict and forces E^2=p^2+m^2 by changing mass_shell_string.

  • format_list = ordered list of variables from get_variables() that contains the particle variables on each line of your input file
  • format_units_dict = dict of variables:units that are used to transform to internal system of units
  • filehandle = file handle, created using e.g. filehandle = open('for009.dat')

e.g. myHit = Hit.new_from_read_user(['x','y','z','px','py','pz'], {'x':'mm', 'y':'mm', 'z':'mm', 'px':'MeV/c', 'py':'MeV/c', 'pz':'MeV/c'}, my_input_file)

Definition at line 195 of file _hit.py.

References Hit.new_from_read_user.

def new_list_from_maus_root (   cls,
  format,
  root_tree,
  entry_number = 0 
)

Static function returns a list of hit objects found in the spill.

  • format = type to take from the maus file.
  • root_tree = TTree containing maus spill data, of type ROOT.TTree
  • entry_number = index of the spill entry in the TTree

Returns a list of hit objects. Station number will be taken from the relevant maus_type. event_number will be given by the spill_number. track_number will be given by the index on mc_events or recon_events

Definition at line 216 of file _hit.py.

def new_list_from_maus_json (   cls,
  format,
  filehandle 
)

Static function returns a list of hit objects found in the spill.

  • format = type to take from the maus file.
  • filehandle = filehandle containing json formatted data

Returns a list of hit objects. Station number will be taken from the relevant maus_type. event_number will be given by the spill_number. track_number will be given by the index on mc_events or recon_events.

Definition at line 233 of file _hit.py.

def copy (   self)

Return a shallow copy of self (copying data as references)

Definition at line 240 of file _hit.py.

References Bunch.__copy__(), and Hit.__copy__().

def deepcopy (   self)

Return a deep copy of target (deep copying target's data to self as well)

Definition at line 245 of file _hit.py.

def get_vector (   self,
  get_variable_list,
  origin_dict = {} 
)

Return a numpy vector of data values taking data from get_variable_list, relative to some origin.

  • get_variable_list = list of variable strings from get_variables()
  • origin_dict = dict of variable strings to origin value; if not set, assumes 0

e.g. transverse_vector = myHit.get_vector(['x', 'y', 'px', 'py'])

Definition at line 260 of file _hit.py.

References Hit.get(), and Bunch.get().

Referenced by Hit.abelian_transformation().

def translate (   self,
  translation_dict,
  mass_shell_string 
)

Iterate over translation_dict and add the value in the dict to the value stored in Hit.

Then force E^2 = p^2 + m^2

- translation_dict = dict of strings from list set_variables() to floats
- mass_shell_string = string from list mass_shell_variables()

Definition at line 276 of file _hit.py.

References Hit.get(), Bunch.get(), UserHitFactory.mass_shell_condition, Hit.mass_shell_condition(), and Hit.set().

def abelian_transformation (   self,
  rotation_list,
  rotation_matrix,
  translation_dict = {},
  origin_dict = {},
  mass_shell_variable = '' 
)

Perform an abelian transformation about the origin, i.e.

V_out - O = R*(V_in-O) + T. Then force E^2 = p^2 + m^2

  • rotation_list = list of variables to be rotated
  • rotation_matrix = matrix R
  • translation_dict = dict of strings from set_variables() to floats. Becomes O
  • mass_shell_variable = string from list mass_shell_variables()
  • origin_dict = dict of strings from set_variables() to floats. Becomes t

e.g. hit.abelian_transformation(['x','px'], array[[1,0.5],[0,1]],{'x':10},'energy') will look like a drift space plus a translation

Definition at line 295 of file _hit.py.

References Hit.get_vector(), UserHitFactory.mass_shell_condition, Hit.mass_shell_condition(), and Hit.set().

def mass_shell_condition (   self,
  variable_string,
  float_tolerance = 1.e-6 
)

Change variable represented by variable_string to force E^2 = p^2 + m^2.

Definition at line 316 of file _hit.py.

References Hit.__mass_shell_variables, Hit.get(), Bunch.get(), and Hit.set().

Referenced by Hit.abelian_transformation(), and Hit.translate().

def get (   self,
  key 
)
def set (   self,
  key,
  value 
)

Set the value referenced by key.

  • key = string which should be one of the list get_variables()
  • value = float

Definition at line 368 of file _hit.py.

References Hit.__set_variables.

Referenced by Hit.__setitem__(), Hit.abelian_transformation(), Hit.mass_shell_condition(), Hit.set_global_weight(), Hit.set_local_weight(), Hit.set_p(), Hit.translate(), and Hit.write_builtin_formatted().

def check (   self,
  tolerance_float = 1e-3 
)

Return True if mass shell condition is obeyed and pid is correct for the mass else return False.

Definition at line 380 of file _hit.py.

References Hit.get(), and Bunch.get().

def dict_from_hit (   self)

Return a dict that uniquely defines the hit, so that new_from_dict(dict_from_hit(hit)) returns a copy of hit.

Definition at line 397 of file _hit.py.

Referenced by Hit.__deepcopy__(), and Hit.__repr__().

def write_builtin_formatted (   self,
  format,
  file_handle 
)

Write to a file formatted according to built-in file_type format.

  • format = string from file_types
  • file_handle = file handle made using e.g. open() command

e.g. aHit.write_builtin_formatted('icool_for009', for009_dat) would write aHit in icool_for009 format to for009_dat

Definition at line 414 of file _hit.py.

References Hit.__file_formats, Hit.__file_units, Hit.__write_formatted(), Hit.get(), Bunch.get(), and Hit.set().

def write_list_builtin_formatted (   list_of_hits,
  file_type_string,
  file_name,
  user_comment = None 
)

Write a list of hits to a file formatted according to built-in file_type format.

  • format = string from file_types
  • file_handle = file handle made using e.g. open() command
  • user_comment = comment included in some output formats (e.g. problem title, etc)

For example, aHit.write_list_builtin_formatted([hit1, hit2] 'icool_for009', 'for009_dat') would write hit1, hit2 in icool_for009 format to for009_dat

Definition at line 439 of file _hit.py.

References Hit.write_list_builtin_formatted.

def open_filehandle_for_writing (   file_type_string,
  file_name,
  user_comment = None 
)

Open a file handle of the specified type for writing.

Some filehandles need special care, e.g. some are gzipped etc

- file_type_string = open filehandle for this file type
- file_name        = string name of the file

Definition at line 480 of file _hit.py.

References Hit.open_filehandle_for_writing.

def file_header (   file_type_string,
  user_comment = None 
)

Return the file_header for the given file_type.

Optionally, can add a user comment

- file_type_string = header returned for this file type. Select from file_types()
- user_comment     = add a user comment - default is 'File generated by xboa'

e.g. Hit.file_header('icool_for009', 'This is my for009 file') would set 'This is my for009 file' 
as a user comment and return the header string

Definition at line 497 of file _hit.py.

References Hit.file_header.

def write_user_formatted (   self,
  format_list,
  format_units_dict,
  file_handle,
  separator = ' ' 
)

Write to a file formatted according to built-in file_type format.

  • format_list = ordered list of strings from get_variables()
  • format_units_dict = dict of formats from format_list to units
  • file_handle = file handle made using e.g. open() command

e.g. aHit.write_user_formatted(['x','px','y','py'], ['x':'m','y':'m','px':'MeV/c','py':'MeV/c'], some_file, '@') would make output like 0.001.nosp@m.@0.0.nosp@m.02@0.001.nosp@m.@0.0.nosp@m.02 in some_file

Definition at line 514 of file _hit.py.

References Hit.__write_formatted().

def file_types ( )

Static function returns a list of available file types.

Definition at line 519 of file _hit.py.

Referenced by MausJsonHitFactory.__init__(), and MausRootHitFactory.__init__().

def get_maus_dict (   self,
  type_name 
)

Convert from hit to a maus dict for MAUS IO.

  • type_name = name of the maus type to generate

Returns a tuple of (maus_dict, spill_number)

Definition at line 531 of file _hit.py.

Referenced by Hit.__get_maus_tree_recursive().

def get_maus_tree (   list_of_hits,
  type_name 
)

Convert from list of hits to a tree of maus objects.

  • list_of_hits = list of hits to be converted
  • type_name = maus type, used to define position in the maus tree

Return value is a list of maus spills (each of which is a data tree)

Definition at line 555 of file _hit.py.

References Hit.get_maus_tree.

def mass_shell_variables ( )

Static function returns a list of variables suitable for mass_shell_condition calls.

Definition at line 566 of file _hit.py.

def get_variables ( )

Static function returns a list of variable suitable for get calls.

Definition at line 572 of file _hit.py.

def set_variables ( )

Static function returns a list of variable suitable for set calls.

Definition at line 578 of file _hit.py.

def get_p (   self)

Returns total momentum of the hit.

Definition at line 586 of file _hit.py.

References Hit.get(), and Bunch.get().

Referenced by Hit.set_p().

def get_r (   self)

Returns transverse distance (i.e.

in x,y space) from 0,0

Definition at line 591 of file _hit.py.

References Hit.get(), and Bunch.get().

def get_phi (   self)

Returns transverse angle (i.e.

in x,y space) in range (-pi, pi); phi = 0. is positive y and phi = pi/2 is positive x

Definition at line 596 of file _hit.py.

def get_pt (   self)

Returns transverse momentum of the hit.

Definition at line 601 of file _hit.py.

def get_pphi (   self)

Returns transverse angle of momentum (i.e.

in px,py space) in range (-pi, pi); phi = 0. is positive py and phi = pi/2 is positive px

Definition at line 606 of file _hit.py.

def get_r_squared (   self)

Returns x divergence i.e.

px/pz of the hit

Definition at line 611 of file _hit.py.

def get_xP (   self)

Returns x divergence i.e.

px/pz of the hit

Definition at line 616 of file _hit.py.

def get_yP (   self)

Returns y divergence i.e.

py/pz of the hit

Definition at line 621 of file _hit.py.

def get_tP (   self)

Returns t \'divergence\' i.e.

E/pz of the hit

Definition at line 626 of file _hit.py.

def get_rP (   self)

Returns dr/dz = pt/pz of the hit.

Definition at line 631 of file _hit.py.

References Hit.get(), and Bunch.get().

def get_spin (   self)

Returns absolute value of the spin.

Definition at line 636 of file _hit.py.

References Hit.get(), and Bunch.get().

def get_ct (   self)

Returns speed_of_light*t of the hit.

Definition at line 641 of file _hit.py.

def get_ek (   self)

Returns total energy - mass, ie kinetic energy of the hit.

Definition at line 646 of file _hit.py.

References Hit.get(), and Bunch.get().

def set_ek (   self,
  value_float 
)

Sets kinetic energy = total energy - mass of the hit.

Definition at line 651 of file _hit.py.

References Hit.get(), and Bunch.get().

def get_l_kin (   self)

Returns kinetic angular momentum about the z-axis.

To use a different axis, you will have to perform your own transformation

Definition at line 657 of file _hit.py.

def set_ct (   self,
  value_float 
)

Sets t = value_float/c_light.

Definition at line 662 of file _hit.py.

def set_p (   self,
  value_float 
)

Set p to value_float keeping momentum direction constant.

Definition at line 667 of file _hit.py.

References Hit.get_p(), and Hit.set().

def set_xP (   self,
  value_float 
)

Set x\' to value_float keeping pz constant.

Definition at line 678 of file _hit.py.

def set_yP (   self,
  value_float 
)

Set y\' to value_float keeping pz constant.

Definition at line 684 of file _hit.py.

def set_tP (   self,
  value_float 
)

Set t\' (dt/dz=-E/pz) to value_float keeping pz constant; note sign of pz may change.

Definition at line 690 of file _hit.py.

References Hit.get(), and Bunch.get().

def get_weight (   self)

Returns total weight for this Hit.

Definition at line 700 of file _hit.py.

References Hit.get(), and Bunch.get().

def clear_global_weights ( )

Set all global weights to 1.

Definition at line 705 of file _hit.py.

def delete_global_weights ( )

Clear memory allocated to global weights - also resets global weights to 1.

Definition at line 711 of file _hit.py.

def get_local_weight (   self)

Returns local weight for this Hit.

Definition at line 717 of file _hit.py.

References Hit.get(), and Bunch.get().

def set_local_weight (   self,
  value 
)

Set local weight for this Hit to be value.

Definition at line 722 of file _hit.py.

References Hit.set().

def get_global_weight (   self)

Returns global weight for this Hit.

Definition at line 727 of file _hit.py.

References Hit.get(), and Bunch.get().

def set_global_weight (   self,
  value 
)

Set global weight for this Hit to be value.

Definition at line 732 of file _hit.py.

References Hit.set().

def set_g4bl_unit (   unit)

g4beamline_track_file can take different units for length - set the unit here

  • unit = string that is a unit of length

e.g. set_g4bl_unit('m') would set the length unit to metres

Definition at line 743 of file _hit.py.

References Hit.set_g4bl_unit.

def __write_formatted (   self,
  format_list,
  format_units_dict,
  file_handle,
  separator = ' ' 
)
private

Definition at line 750 of file _hit.py.

References Hit.get(), and Bunch.get().

Referenced by Hit.write_builtin_formatted(), and Hit.write_user_formatted().

def __get_maus_root_virtual_hits (   mc_event,
  track_number 
)
private

Definition at line 758 of file _hit.py.

References Hit.__get_maus_root_virtual_hits.

def __get_maus_root_primary_hits (   mc_event,
  track_number 
)
private

Definition at line 778 of file _hit.py.

References Hit.__get_maus_root_primary_hits.

def __split_list_by_equality (   a_list,
  sort_attribute 
)
private

Definition at line 791 of file _hit.py.

References Hit.__split_list_by_equality.

def __get_maus_tree_recursive (   list_of_hits,
  maus_path,
  format 
)
private

Definition at line 801 of file _hit.py.

References Hit.__get_maus_tree_recursive, and Hit.get_maus_dict().

def __split_list_by_equality (   a_list,
  sort_attribute 
)
private

Definition at line 824 of file _hit.py.

References Hit.__split_list_by_equality.

def __return_one (   self,
  value = '' 
)
private

Definition at line 833 of file _hit.py.

def __do_nothing (   self,
  value = '' 
)
private

Definition at line 836 of file _hit.py.

def __event_cmp (   lhs,
  rhs 
)
private

Definition at line 936 of file _hit.py.

References Hit.__event_cmp.

def __station_cmp (   lhs,
  rhs 
)
private

Definition at line 940 of file _hit.py.

References Hit.__station_cmp.

def hit_overview_doc (   verbose = False)

Creates some summary documentation for the Hit class.

If verbose is True then will also print any functions or data not included in summary

Definition at line 973 of file _hit.py.

References Hit.hit_overview_doc.

Member Data Documentation

list __slots__ = ['__hitcore']
staticprivate

Definition at line 95 of file _hit.py.

tuple new_from_dict = staticmethod(new_from_dict)
static

Definition at line 164 of file _hit.py.

Referenced by Hit.new_from_dict().

tuple new_from_read_builtin = staticmethod(new_from_read_builtin)
static

Definition at line 183 of file _hit.py.

Referenced by Hit.new_from_read_builtin().

tuple new_from_read_user = staticmethod(new_from_read_user)
static

Definition at line 202 of file _hit.py.

Referenced by Hit.new_from_read_user().

tuple write_list_builtin_formatted = staticmethod(write_list_builtin_formatted)
static

Definition at line 471 of file _hit.py.

Referenced by Hit.write_list_builtin_formatted().

tuple open_filehandle_for_writing = staticmethod(open_filehandle_for_writing)
static

Definition at line 485 of file _hit.py.

Referenced by Hit.open_filehandle_for_writing().

tuple file_header = staticmethod(file_header)
static

Definition at line 501 of file _hit.py.

Referenced by Hit.file_header().

tuple file_types = staticmethod(file_types)
static

Definition at line 521 of file _hit.py.

Referenced by MausJsonHitFactory.__init__(), and MausRootHitFactory.__init__().

tuple get_maus_tree = staticmethod(get_maus_tree)
static

Definition at line 560 of file _hit.py.

Referenced by Hit.get_maus_tree().

tuple mass_shell_variables = staticmethod(mass_shell_variables)
static

Definition at line 568 of file _hit.py.

tuple get_variables = staticmethod(get_variables)
static

Definition at line 574 of file _hit.py.

tuple set_variables = staticmethod(set_variables)
static

Definition at line 580 of file _hit.py.

tuple clear_global_weights = staticmethod(clear_global_weights)
static

Definition at line 707 of file _hit.py.

tuple delete_global_weights = staticmethod(delete_global_weights)
static

Definition at line 713 of file _hit.py.

tuple set_g4bl_unit = staticmethod(set_g4bl_unit)
static

Definition at line 747 of file _hit.py.

Referenced by Hit.set_g4bl_unit().

tuple __get_maus_root_virtual_hits = staticmethod(__get_maus_root_virtual_hits)
staticprivate

Definition at line 776 of file _hit.py.

Referenced by Hit.__get_maus_root_virtual_hits().

tuple __get_maus_root_primary_hits = staticmethod(__get_maus_root_primary_hits)
staticprivate

Definition at line 788 of file _hit.py.

Referenced by Hit.__get_maus_root_primary_hits().

tuple __split_list_by_equality = staticmethod(__split_list_by_equality)
staticprivate

Definition at line 798 of file _hit.py.

Referenced by Hit.__split_list_by_equality().

tuple __get_maus_tree_recursive = staticmethod(__get_maus_tree_recursive)
staticprivate

Definition at line 821 of file _hit.py.

Referenced by Hit.__get_maus_tree_recursive().

list __file_types = ['icool_for009', 'icool_for003', 'g4beamline_bl_track_file', 'mars_1']
staticprivate

Definition at line 841 of file _hit.py.

list __mass_shell_variables = ['', 'p', 'px', 'py', 'pz', 'energy']
staticprivate

Definition at line 853 of file _hit.py.

Referenced by Hit.mass_shell_condition().

dictionary __get_variables
staticprivate
Initial value:
1 = {'p':get_p,'r':get_r,'phi':get_phi,'pt':get_pt,'pphi':get_pphi,'x\'':get_xP,'y\'':get_yP,'t\'':get_tP, 'ct\'':get_tP,'r\'':get_rP,'spin':get_spin,
2  'weight':get_weight,'ct':get_ct,'r_squared':get_r_squared,'z\'':__return_one,'kinetic_energy':get_ek,
3  'l_kin':get_l_kin,'':__do_nothing}

Definition at line 854 of file _hit.py.

Referenced by Hit.get().

dictionary __set_variables = {'p':set_p,'x\'':set_xP,'y\'':set_yP,'t\'':set_tP,'ct':set_ct,'kinetic_energy':set_ek,'':__do_nothing}
staticprivate

Definition at line 857 of file _hit.py.

Referenced by Hit.set().

dictionary _default_var_types
staticprivate
Initial value:
1 = {'x':float,'y':float,'z':float,'t':float,'px':float,'py':float,'pz':float,'energy':float,'bx':float,'by':float,'bz':float,
2  'ex':float,'ey':float,'ez':float,'eventNumber':int, 'event_number':int, 'particleNumber':int, 'particle_number':int, 'pid':int,'status':int,'station':int,'local_weight':float,
3  'sx':float,'sy':float,'sz':float,'mass':float,'path_length':float,'proper_time':float,'e_dep':float, 'charge':float}

Definition at line 858 of file _hit.py.

list __get_keys = []
staticprivate

Definition at line 862 of file _hit.py.

list __set_keys = []
staticprivate

Definition at line 863 of file _hit.py.

dictionary __maus_three_vec_conversions
staticprivate
Initial value:
1 = { # maus three vectors are sub-dicts of virtual_hit
2  "maus_json_virtual_hit":{"position":"", "momentum":"p", "b_field":"b", "e_field":"e"},
3  "maus_json_primary":{"position":"", "momentum":"p"}
4  }

Definition at line 877 of file _hit.py.

dictionary __maus_variable_conversions
staticprivate
Initial value:
1 = {
2  "maus_json_virtual_hit":{"station_id":"station", "particle_id":"pid", "track_id":"particle_number", "time":"t", "mass":"mass", "charge":"charge", "proper_time":"proper_time", "path_length":"path_length"},
3  "maus_json_primary":{"particle_id":"pid", "time":"t", "energy":"energy"} # we also force "mass" from "pid"
4  }

Definition at line 882 of file _hit.py.

dictionary __maus_paths
staticprivate
Initial value:
1 = {
2  "maus_json_virtual_hit":["mc_events", ["particle_number"], "virtual_hits", ["station"]],
3  "maus_json_primary":["mc_events", ["particle_number"], "primary"],
4  }

Definition at line 887 of file _hit.py.

dictionary __maus_root_mc_types
staticprivate
Initial value:
1 = {
2  "maus_root_virtual_hit": lambda x, y: Hit.__get_maus_root_virtual_hits(x, y),
3  "maus_root_primary": lambda x, y: Hit.__get_maus_root_primary_hits(x, y)
4  }

Definition at line 892 of file _hit.py.

dictionary __maus_root_recon_types = {}
staticprivate

Definition at line 896 of file _hit.py.

dictionary __file_formats
staticprivate
Initial value:
1 = {
2  'icool_for009' : ['eventNumber', 'particleNumber', 'pid', 'status', 'station', 't', 'x', 'y', 'z', 'px', 'py', 'pz', 'bx', 'by', 'bz', 'local_weight',
3  'ex', 'ey', 'ez', '', 'sx', 'sy', 'sz'],
4  'icool_for003' : ['eventNumber', 'particleNumber', 'pid', 'status', 't', 'local_weight', 'x', 'y', 'z', 'px', 'py', 'pz', 'sx', 'sy', 'sz'],
5  'g4beamline_bl_track_file' : ['x','y','z','px','py','pz','t','pid','eventNumber','particleNumber', '','local_weight'],
6  'ZGoubi' : [],
7  'Turtle' : [],
8  'MadX' : [],
9  'mars_1' : ['eventNumber','pid','x','y','z','px','py','pz','energy','ct','local_weight']
10  }

Definition at line 899 of file _hit.py.

Referenced by Hit.write_builtin_formatted().

dictionary __file_units
staticprivate
Initial value:
1 = {
2  'icool_for009' : {'eventNumber':'', 'particleNumber':'', 'pid':'', 'status':'', 'station':'', 't':'s', 'x':'m', 'y':'m', 'z':'m', 'px':'GeV/c', 'py':'GeV/c',
3  'pz':'GeV/c', 'bx':'T', 'by':'T', 'bz':'T', 'local_weight':'',
4  'ex':'GV/m', 'ey':'GV/m', 'ez':'GV/m', 'sx':'', 'sy':'', 'sz':'', '':''},
5  'icool_for003' : {'eventNumber':'', 'particleNumber':'', 'pid':'', 'status':'', 't':'s', 'local_weight':'', 'x':'m', 'y':'m', 'z':'m', 'px':'GeV/c', 'py':'GeV/c', 'pz':'GeV/c', 'sx':'', 'sy':'', 'sz':''},
6  'g4beamline_bl_track_file' : {'x':'mm','y':'mm','z':'mm','px':'MeV/c','py':'MeV/c','pz':'MeV/c','t':'ns','pid':'','eventNumber':'','station':'','local_weight':'', 'particleNumber':''},
7  'ZGoubi' : {},
8  'Turtle' : {},
9  'MadX' : {},
10  'mars_1' : {'eventNumber':'','pid':'','x':'mm','y':'mm','z':'mm','px':'GeV/c','py':'GeV/c','pz':'GeV/c','energy':'GeV','ct':'cm','local_weight':''},
11  'maus_json_virtual_hit': {},
12  'maus_json_primary': {},
13  }

Definition at line 909 of file _hit.py.

Referenced by Hit.write_builtin_formatted().

dictionary __file_headers
staticprivate
Initial value:
1 = {
2  'icool_for003':'<user>\n0. 0. 0. 0. 0. 0. 0. 0.\n',
3  'icool_for009':'#<user>\n# units = [s] [m] [GeV/c] [T] [V/m]\nevt par typ flg reg time x y z Px Py Pz Bx By Bz wt Ex Ey Ez arclength polX polY polZ\n',
4  'g4beamline_bl_track_file':'#BLTrackFile <user>\n#x y z Px Py Pz t PDGid EvNum TrkId Parent weight\n',
5  'ZGoubi':'',
6  'Turtle':'',
7  'MadX':'',
8  'mars_1':'',
9  'maus_json_virtual_hit':'',
10  'maus_json_primary':'',
11  }

Definition at line 923 of file _hit.py.

string __default_user_string = 'File generated by X_BOA'
staticprivate

Definition at line 934 of file _hit.py.

tuple __event_cmp = staticmethod(__event_cmp)
staticprivate

Definition at line 938 of file _hit.py.

Referenced by Hit.__event_cmp().

tuple __station_cmp = staticmethod(__station_cmp)
staticprivate

Definition at line 942 of file _hit.py.

Referenced by Hit.__station_cmp().

dictionary __hit_sort_comparator
staticprivate
Initial value:
1 = {
2  'icool_for009': __event_cmp,
3  'icool_for003': __event_cmp,
4  'g4beamline_bl_track_file': __event_cmp,
5  'ZGoubi': __event_cmp,
6  'Turtle': __event_cmp,
7  'MadX': __event_cmp,
8  'maus_json_virtual_hit': __event_cmp,
9  'maus_json_primary': __event_cmp,
10  'mars_1': __event_cmp,
11  }

Definition at line 945 of file _hit.py.

tuple __angular_momentum_centroid = (0.,0.,0.)
staticprivate

Definition at line 957 of file _hit.py.

tuple __angular_momentum_vector = (0.,0.,1.)
staticprivate

Definition at line 958 of file _hit.py.

list __bad_pids = []
staticprivate

Definition at line 959 of file _hit.py.

list __opal_ignore_probes = ["RING"]
staticprivate

Definition at line 967 of file _hit.py.

dictionary __opal_probes = {}
staticprivate

Definition at line 968 of file _hit.py.

int __opal_pid = 0
staticprivate

Definition at line 969 of file _hit.py.

tuple hit_overview_doc = staticmethod(hit_overview_doc)
static

Definition at line 1016 of file _hit.py.

Referenced by Hit.hit_overview_doc().

__hitcore
private

Definition at line 100 of file _hit.py.

Referenced by Hit.__del__().


The documentation for this class was generated from the following file: