Belle II Software development
VXDMomentumEnergyEstimator Class Reference

Static Public Member Functions

def do_for_each_hit_type (cluster, svd_function, pxd_function)
 
def calculate_charges_and_path_lengths_for_one_type (clusters, mc_particle)
 
def generate_truncated (charge_list)
 

Detailed Description

 The base class with all static methods to use. 

Definition at line 18 of file harvester.py.

Member Function Documentation

◆ calculate_charges_and_path_lengths_for_one_type()

def calculate_charges_and_path_lengths_for_one_type (   clusters,
  mc_particle 
)
static
Return lists of charges and path lengths for the clusters associated with an MCParticle

Definition at line 34 of file harvester.py.

34 def calculate_charges_and_path_lengths_for_one_type(clusters, mc_particle):
35 """Return lists of charges and path lengths for the clusters associated with an MCParticle"""
36 charge_list = []
37 path_length_list = []
38
39 tools = Belle2.VXDMomentumEstimationTools(clusters[0].__class__.__name__).getInstance()
40
41 momentum = mc_particle.getMomentum()
42 position = mc_particle.getProductionVertex()
43 charge = mc_particle.getCharge()
44 b_field = Belle2.BFieldManager.getField(position).Z() / Belle2.Unit.T
45 helix = Belle2.Helix(position, momentum, charge, b_field)
46
47 for cluster in clusters:
48
49 calibrated_charge = tools.getCalibratedCharge(cluster)
50 path_length = tools.getPathLength(cluster, helix)
51
52 charge_list.append(calibrated_charge)
53 path_length_list.append(path_length)
54
55 return charge_list, path_length_list, list(np.divide(charge_list, path_length_list))
56
Helix parameter class.
Definition: Helix.h:48
Tools needed for the VXD momentum estimation to, e.g.
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Definition: BFieldManager.h:91

◆ do_for_each_hit_type()

def do_for_each_hit_type (   cluster,
  svd_function,
  pxd_function 
)
static
Apply a PXD selection to a PXDCluster or an SVD selection to an SVDCluster

Definition at line 23 of file harvester.py.

23 def do_for_each_hit_type(cluster, svd_function, pxd_function):
24 """Apply a PXD selection to a PXDCluster or an SVD selection to an SVDCluster"""
25 cluster_type = cluster.__class__.__name__
26 if cluster_type == "Belle2::PXDCluster":
27 return pxd_function(cluster)
28 elif cluster_type == "Belle2::SVDCluster":
29 return svd_function(cluster)
30 else:
31 raise TypeError("Unknown hit type")
32

◆ generate_truncated()

def generate_truncated (   charge_list)
static
Sort then truncate a list to all but the last 2 entries or the first 4 entries or the first 6 entries

Definition at line 58 of file harvester.py.

58 def generate_truncated(charge_list):
59 """Sort then truncate a list to all but the last 2 entries or the first 4 entries or the first 6 entries"""
60 sorted_list = sorted(charge_list)
61 if len(sorted_list) > 2:
62 return sorted_list[:-2], sorted_list[:4], sorted_list[:6]
63 else:
64 return sorted_list, sorted_list[:4], sorted_list[:6]
65
66

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