Belle II Software  release-05-01-25
VxdCdcMergerHarvesterMCSide Class Reference
Inheritance diagram for VxdCdcMergerHarvesterMCSide:
Collaboration diagram for VxdCdcMergerHarvesterMCSide:

Public Member Functions

def __init__ (self, output_file_name)
 
def pick (self, mc_particle)
 
def peel (self, mc_particle)
 
def id (self)
 
def initialize (self)
 
def event (self)
 
def terminate (self)
 
def barn (self)
 
def gather (self)
 
def prepare (self)
 
def refine (self, crops)
 

Static Public Member Functions

def create_crop_part_collection ()
 
def iter_store_obj (store_obj)
 

Public Attributes

 mc_track_matcher_cdc
 matcher used for the MCTracks from the CDC
 
 mc_track_matcher_vxd
 matcher used for the MCTracks from the VXD
 
 foreach
 Name of the StoreArray or iterable StoreObjPtr that contains the objects to be harvested.
 
 output_file_name
 Name of the ROOT output file to be generated.
 
 title
 Name of this harvest. More...
 
 contact
 Contact email address to be displayed on the validation page.
 
 expert_level
 Integer expert level that controlls to detail of plots to be generated.
 
 refiners
 A list of additional refiner instances to be executed on top of the refiner methods that are members of this class.
 
 show_results
 Switch to show the result ROOT file in a TBrowser on terminate.
 
 stash
 stash of the harvested crops (start with those in the barn)
 
 raw_crops
 the dictionaries from peel as a numpy.array of doubles
 
 crops
 the dictionaries from peel
 

Static Public Attributes

 save_tree = refiners.SaveTreeRefiner()
 Save the results dictionary to the output ROOT file.
 
int default_expert_level = 1
 The default value of expert_level if not specified explicitly by the caller.
 

Detailed Description

Gather the MC VXD-CDC-merger results into ROOT file

Definition at line 9 of file validation.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  output_file_name 
)
Init harvester
Arguments:
    output_file_name (str): name of the output ROOT file

Definition at line 12 of file validation.py.

12  def __init__(self, output_file_name):
13  """
14  Init harvester
15  Arguments:
16  output_file_name (str): name of the output ROOT file
17  """
18  HarvestingModule.__init__(self, foreach="MCParticles", output_file_name=output_file_name)
19 
20 
21  self.mc_track_matcher_cdc = Belle2.TrackMatchLookUp("MCRecoTracks", "CDCRecoTracks")
22 
23  self.mc_track_matcher_vxd = Belle2.TrackMatchLookUp("MCRecoTracks", "SVDRecoTracks")
24 

Member Function Documentation

◆ barn()

def barn (   self)
inherited
Coroutine that receives the dictionaries of names and values from peel and store them.

Reimplemented in PickleHarvestingModule.

Definition at line 280 of file harvesting.py.

280  def barn(self):
281  """Coroutine that receives the dictionaries of names and values from peel and store them."""
282  crop = (yield)
283  raw_crops = copy.copy(crop)
284  crops = copy.copy(crop)
285 
286  if isinstance(crop, numbers.Number):
287  raw_crops = self.create_crop_part_collection()
288  try:
289  while True:
290  raw_crops.append(crop)
291  # next crop
292  crop = (yield)
293  except GeneratorExit:
294  crops = np.array(raw_crops)
295 
296  elif isinstance(crop, collections.MutableMapping):
297  for part_name in crop:
298  raw_crops[part_name] = self.create_crop_part_collection()
299 
300  try:
301  while True:
302  for part_name, parts in list(raw_crops.items()):
303  if part_name in crop:
304  parts.append(crop[part_name])
305  else:
306  parts.append(np.NaN)
307  # next crop
308  crop = (yield)
309  except GeneratorExit:
310  for part_name, parts in list(raw_crops.items()):
311  crops[part_name] = np.array(parts)
312 
313  else:
314  msg = "Unrecognised crop {} of type {}".format(
315  crop,
316  type(crop)
317  )
318  raise ValueError(msg)
319 
320 
321  self.raw_crops = raw_crops
322 
323  self.crops = crops
324 

◆ create_crop_part_collection()

def create_crop_part_collection ( )
staticinherited
Create the storing objects for the crop values

Currently a numpy.array of doubles is used to store all values in memory.

Definition at line 272 of file harvesting.py.

◆ event()

def event (   self)
inherited
Event method of the module

* Does invoke the prepare method before the iteration starts.
* In each event fetch the StoreArray / iterable StoreObjPtr,
* Iterate through all instances
* Feed each instance to the pick method to deside it the instance is relevant
* Forward it to the peel method that should generated a dictionary of values
* Store each dictionary of values

Definition at line 232 of file harvesting.py.

◆ gather()

def gather (   self)
inherited
Iterator that yield the instances form the StoreArray / iterable StoreObj.

Yields
------
Object instances from the StoreArray, iterable StoreObj or the StoreObj itself
in case it is not iterable.

Definition at line 325 of file harvesting.py.

◆ id()

def id (   self)
inherited
Working around that name() is a method.

Exposing the name as a property using a different name

Definition at line 217 of file harvesting.py.

◆ initialize()

def initialize (   self)
inherited
Initialisation method of the module.

Prepares the receiver stash of objects to be harvestered.

Definition at line 224 of file harvesting.py.

◆ iter_store_obj()

def iter_store_obj (   store_obj)
staticinherited
Obtain a iterator from a StoreObj

Repeatly calls iter(store_obj) or store_obj.__iter__()
until the final iterator returns itself

Returns
-------
iterator of the StoreObj

Definition at line 443 of file harvesting.py.

◆ peel()

def peel (   self,
  mc_particle 
)
Collect information related to the MCParticle into a dictionary

Reimplemented from HarvestingModule.

Definition at line 35 of file validation.py.

◆ pick()

def pick (   self,
  mc_particle 
)
Return true if the MCParticle has a related MCRecoTrack

Reimplemented from HarvestingModule.

Definition at line 25 of file validation.py.

◆ prepare()

def prepare (   self)
inherited
Default implementation of prepare.

Can be overridden by subclasses.

Reimplemented in SegmentFakeRatesModule, and FitValidationModule.

Definition at line 364 of file harvesting.py.

◆ refine()

def refine (   self,
  crops 
)
inherited
Receive the gathered crops and forward them to the refiners.

Reimplemented in PickleHarvestingModule.

Definition at line 398 of file harvesting.py.

◆ terminate()

def terminate (   self)
inherited
Termination method of the module.

Finalize the collected crops.
Start the refinement.

Definition at line 256 of file harvesting.py.

Member Data Documentation

◆ title

title
inherited

Name of this harvest.

Title particle of this harvest

Definition at line 194 of file harvesting.py.


The documentation for this class was generated from the following file:
Belle2::TrackMatchLookUp
Class to provide convenient methods to look up matching information between pattern recognition and M...
Definition: TrackMatchLookUp.h:43