Belle II Software development
MCParticleHarvester Class Reference
Inheritance diagram for MCParticleHarvester:
HarvestingModule

Public Member Functions

def __init__ (self)
 
def pick (self, mc_particle)
 
def generate_cluster_dicts (self, charge_list, path_length_list, normalized_charge_list, name)
 
def peel (self, mc_particle)
 

Static Public Attributes

refiners save_tree = refiners.SaveTreeRefiner()
 Refiners to be executed at the end of the harvesting / termination of the module Save a tree of all collected variables in a sub folder.
 

Detailed Description

 A harvester to redo parts of the analysis in the Belle II Paper by Robert 

Definition at line 85 of file harvester.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)
Constructor

Reimplemented from HarvestingModule.

Definition at line 89 of file harvester.py.

89 def __init__(self):
90 """Constructor"""
91 HarvestingModule.__init__(self, foreach="MCParticles", output_file_name="mc_particle.root")
92

Member Function Documentation

◆ generate_cluster_dicts()

def generate_cluster_dicts (   self,
  charge_list,
  path_length_list,
  normalized_charge_list,
  name 
)
Create a dictionary from the lists of charges, normalized charges, and path lengths of the
   clusters associated with an MCParticle

Definition at line 101 of file harvester.py.

101 def generate_cluster_dicts(self, charge_list, path_length_list, normalized_charge_list, name):
102 """Create a dictionary from the lists of charges, normalized charges, and path lengths of the
103 clusters associated with an MCParticle"""
104 result = dict()
105
106 truncated, first4, first6 = VXDMomentumEnergyEstimator.generate_truncated(normalized_charge_list)
107
108 result.update({f"sum_{name}_charges": sum(charge_list)})
109 result.update({f"mean_{name}_charges": np.mean(charge_list)})
110 result.update({f"sum_{name}_normalized_charges": sum(normalized_charge_list)})
111 result.update({f"mean_{name}_normalized_charges": np.mean(normalized_charge_list)})
112
113 result.update({f"sum_{name}_normalized_charges_truncated": sum(truncated)})
114 result.update({f"mean_{name}_normalized_charges_truncated": np.mean(truncated)})
115 result.update({f"sum_{name}_normalized_charges_first4": sum(first4)})
116 result.update({f"mean_{name}_normalized_charges_first4": np.mean(first4)})
117 result.update({f"sum_{name}_normalized_charges_first6": sum(first6)})
118 result.update({f"mean_{name}_normalized_charges_first6": np.mean(first6)})
119
120 return result
121

◆ peel()

def peel (   self,
  mc_particle 
)
Aggregate the PXD and SVD cluster information for an MCParticle

Reimplemented from HarvestingModule.

Definition at line 122 of file harvester.py.

122 def peel(self, mc_particle):
123 """Aggregate the PXD and SVD cluster information for an MCParticle"""
124 result = dict()
125
126 pxd_clusters = mc_particle.getRelationsFrom("PXDClusters")
127 svd_clusters = mc_particle.getRelationsFrom("SVDClusters")
128
129 pxd_results = VXDMomentumEnergyEstimator.calculate_charges_and_path_lengths_for_one_type(pxd_clusters, mc_particle)
130 svd_results = VXDMomentumEnergyEstimator.calculate_charges_and_path_lengths_for_one_type(svd_clusters, mc_particle)
131
132 pxd_cluster_dicts = self.generate_cluster_dicts(*pxd_results, name="pxd")
133 pxd_charges, pxd_path_length, pxd_normalized_charges = pxd_results
134
135 svd_charges, svd_path_length, svd_normalized_charges = svd_results
136 svd_cluster_dicts = self.generate_cluster_dicts(*svd_results, name="svd")
137
138 combined_cluster_dicts = self.generate_cluster_dicts(pxd_charges + svd_charges,
139 pxd_path_length + svd_path_length,
140 pxd_normalized_charges + svd_normalized_charges,
141 name="combined")
142
143 result.update(pxd_cluster_dicts)
144 result.update(svd_cluster_dicts)
145 result.update(combined_cluster_dicts)
146
147 return result
148

◆ pick()

def pick (   self,
  mc_particle 
)
Select the MCParticle if it is a primary pion and has some PXD and/or SVD clusters

Reimplemented from HarvestingModule.

Definition at line 93 of file harvester.py.

93 def pick(self, mc_particle):
94 """Select the MCParticle if it is a primary pion and has some PXD and/or SVD clusters"""
95 pxd_clusters = mc_particle.getRelationsFrom("PXDClusters")
96 svd_clusters = mc_particle.getRelationsFrom("SVDClusters")
97 return (mc_particle.hasStatus(Belle2.MCParticle.c_PrimaryParticle) and
98 abs(mc_particle.getPDG()) == 211 and
99 len(pxd_clusters) + len(svd_clusters) > 0)
100

Member Data Documentation

◆ save_tree

refiners save_tree = refiners.SaveTreeRefiner()
static

Refiners to be executed at the end of the harvesting / termination of the module Save a tree of all collected variables in a sub folder.

Definition at line 151 of file harvester.py.


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