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

Public Member Functions

def __init__ (self, output_file_name)
 
def pick (self, mc_particle)
 
def peel (self, mc_particle)
 

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
 

Static Public Attributes

refiners save_tree = refiners.SaveTreeRefiner()
 Save the results dictionary to the output ROOT file.
 

Detailed Description

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

Definition at line 17 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

Reimplemented from HarvestingModule.

Definition at line 20 of file validation.py.

20 def __init__(self, output_file_name):
21 """
22 Init harvester
23 Arguments:
24 output_file_name (str): name of the output ROOT file
25 """
26 HarvestingModule.__init__(self, foreach="MCParticles", output_file_name=output_file_name)
27
28
29 self.mc_track_matcher_cdc = Belle2.TrackMatchLookUp("MCRecoTracks", "CDCRecoTracks")
30
31 self.mc_track_matcher_vxd = Belle2.TrackMatchLookUp("MCRecoTracks", "SVDRecoTracks")
32
Class to provide convenient methods to look up matching information between pattern recognition and M...

Member Function Documentation

◆ peel()

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

Reimplemented from HarvestingModule.

Definition at line 43 of file validation.py.

43 def peel(self, mc_particle):
44 """Collect information related to the MCParticle into a dictionary"""
45 mc_track = mc_particle.getRelatedFrom("MCRecoTracks")
46
47 event_info = Belle2.PyStoreObj("EventMetaData")
48
49 result = peelers.peel_mc_particle(mc_particle)
50 result.update(peelers.peel_reco_track_hit_content(mc_track))
51 result.update(peelers.peel_event_info(event_info))
52
53 result["mc_store_array_number"] = mc_track.getArrayIndex()
54
55 this_best_track_cdc = self.mc_track_matcher_cdc.getAnyChargeMatchedPRRecoTrack(mc_track)
56 this_best_track_vxd = self.mc_track_matcher_vxd.getAnyChargeMatchedPRRecoTrack(mc_track)
57
58 result.update(peelers.peel_reco_track_hit_content(this_best_track_cdc, key="cdc_{part_name}"))
59 result.update(peelers.peel_reco_track_seed(this_best_track_cdc, key="cdc_{part_name}"))
60 if this_best_track_cdc:
61 result["cdc_store_array_number"] = this_best_track_cdc.getArrayIndex()
62 result["cdc_was_fitted"] = this_best_track_cdc.wasFitSuccessful()
63 else:
64 result["cdc_store_array_number"] = -1
65 result["cdc_was_fitted"] = -1
66
67 result.update(peelers.peel_reco_track_hit_content(this_best_track_vxd, key="vxd_{part_name}"))
68 result.update(peelers.peel_reco_track_seed(this_best_track_vxd, key="vxd_{part_name}"))
69 if this_best_track_vxd:
70 result["vxd_store_array_number"] = this_best_track_vxd.getArrayIndex()
71 result["vxd_was_fitted"] = this_best_track_vxd.wasFitSuccessful()
72 else:
73 result["vxd_store_array_number"] = -1
74 result["vxd_was_fitted"] = -1
75
76 if this_best_track_cdc:
77 merged_vxd_track = this_best_track_cdc.getRelated("SVDRecoTracks")
78 else:
79 merged_vxd_track = None
80 if this_best_track_vxd:
81 merged_cdc_track = this_best_track_vxd.getRelated("CDCRecoTracks")
82 else:
83 merged_cdc_track = None
84
85 flag_incorrect_not_merged = False
86 flag_correct_merged = False
87 flag_not_found = False
88 flag_correct_not_merged_cdcmissing = False
89 flag_incorrect_merged_cdcwrong_although_not_there = False
90 flag_correct_not_merged_vxdmissing = False
91 flag_incorrect_merged_vxdwrong_although_not_there = False
92
93 flag_incorrect_merged = False
94
95 # Separate out *all* different cases!
96
97 # No tracks exists at all --> Problem of Trackfinder
98 if not this_best_track_cdc and not this_best_track_vxd:
99 # Case 7
100 flag_not_found = True
101
102 # CDC track not existing
103 elif not this_best_track_cdc:
104 # Cross-check: merged track == best track !!
105 if not merged_cdc_track:
106 # Case 4
107 flag_correct_not_merged_cdcmissing = True
108 # If merged track is not empty, merger made a mistake
109 else:
110 # Case 2 !!
111 flag_incorrect_merged_cdcwrong_although_not_there = True
112
113 # VXD track not existing
114 elif not this_best_track_vxd:
115 # Cross check> merged track == best track!!
116 if not merged_vxd_track:
117 # Case 5
118 flag_correct_not_merged_vxdmissing = True
119 # If merged track i is not empty, merger made a mistake
120 else:
121 # Case 3 !!
122 flag_incorrect_merged_vxdwrong_although_not_there = True
123
124 # Both tracks exists but have not been merged, although they should have
125 elif not merged_vxd_track and not merged_cdc_track:
126 # Case 6
127 flag_incorrect_not_merged = True
128
129 # Tracks are merged correctly
130 elif this_best_track_cdc == merged_cdc_track and this_best_track_vxd == merged_vxd_track:
131 # Case 1
132 flag_correct_merged = True
133
134 # If all operations above have failed than the merger failed
135 else:
136 # Case 2 + 3 !!
137 if merged_cdc_track != this_best_track_cdc:
138 flag_incorrect_merged = True
139 # The other combinations must then also be false
140
141 # We miss the unmatched cdc/vxd reco tracks which are fakes!!!
142
143 result.update({
144 "flag_correct_not_merged_cdcmissing": flag_correct_not_merged_cdcmissing,
145 "flag_correct_not_merged_vxdmissing": flag_correct_not_merged_vxdmissing,
146 "flag_correct_merged": flag_correct_merged,
147 "flag_incorrect_not_merged": flag_incorrect_not_merged,
148 "flag_incorrect_merged": flag_incorrect_merged,
149 "flag_incorrect_merged_cdcwrong_although_not_there": flag_incorrect_merged_cdcwrong_although_not_there,
150 "flag_incorrect_merged_vxdwrong_although_not_there": flag_incorrect_merged_vxdwrong_although_not_there,
151 "flag_not_found": flag_not_found,
152 })
153
154 return result
155
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:67

◆ pick()

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

Reimplemented from HarvestingModule.

Definition at line 33 of file validation.py.

33 def pick(self, mc_particle):
34 """Return true if the MCParticle has a related MCRecoTrack"""
35 # mc_track = mc_particle.getRelated("MCRecoTracks")
36 # return mc_track != None
37 mc_track = mc_particle.getRelatedFrom("MCRecoTracks")
38 if mc_track:
39 return True
40 else:
41 return False
42

Member Data Documentation

◆ mc_track_matcher_cdc

mc_track_matcher_cdc

matcher used for the MCTracks from the CDC

Definition at line 29 of file validation.py.

◆ mc_track_matcher_vxd

mc_track_matcher_vxd

matcher used for the MCTracks from the VXD

Definition at line 31 of file validation.py.

◆ save_tree

refiners save_tree = refiners.SaveTreeRefiner()
static

Save the results dictionary to the output ROOT file.

Definition at line 157 of file validation.py.


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