Belle II Software development
SegmentPairFitValidationRun Class Reference
Inheritance diagram for SegmentPairFitValidationRun:
HarvestingRun HarvestingRunMixin StandardEventGenerationRun BrowseTFileOnTerminateRunMixin PostProcessingRunMixin ReadOrGenerateEventsRun PostProcessingRunMixin EmptyRun MinimalRun EmptyRun EmptyRun

Public Member Functions

def output_file_name (self)
 
def harvesting_module (self, path=None)
 
def create_argument_parser (self, **kwds)
 
def get_fit_method (self)
 
def create_path (self)
 

Public Attributes

 monte_carlo
 Degree of refinement of the segment generation.
 

Static Public Attributes

int n_events = 10000
 number of events to generate
 
str generator_module = "simple_gun"
 use the low-momentum particle gun event generator
 
str monte_carlo = "no"
 do not generate new events
 
str segment_orientation = "outwards"
 ordering of the segments in the pair
 
str fit_method_name = "fuse-sz"
 use the Kalmanesk fuse of the two trajectory fits
 

Detailed Description

Harvester to generate, postprocess and inspect MC events for track-segment-pair fit validation

Definition at line 33 of file record.py.

Member Function Documentation

◆ create_argument_parser()

def create_argument_parser (   self,
**  kwds 
)
Convert command-line arguments to basf2 argument list

Reimplemented from HarvestingRunMixin.

Definition at line 68 of file record.py.

68 def create_argument_parser(self, **kwds):
69 """Convert command-line arguments to basf2 argument list"""
70 argument_parser = super().create_argument_parser(**kwds)
71
72 argument_parser.add_argument(
73 '-m',
74 '--monte-carlo',
75 choices=["no", "medium", "full"],
76 default=self.monte_carlo,
77 dest='monte_carlo',
78 help='Amount of monte carlo information to be used in the segment generation.',
79 )
80
81 argument_parser.add_argument(
82 "--fit",
83 choices=["zreco", "fuse-pre", "fuse-sz", "fuse-sz-re"],
84 default=self.fit_method_name,
85 dest="fit_method_name",
86 help=("Choose which fit positional information of the segment should be used. \n"
87 "* 'zreco' means the z coordinate is reconstructed and a linear sz fit is made. "
88 "No covariance between the circle and the linear sz part can be made.\n"
89 "* 'fuse-sz' means the Kalmanesk fuse of the two trajectory fits.\n"
90 "* 'fuse-sz-re' means the Kalmanesk fuse of the two trajectory fits but reestimate the drift length."
91 )
92 )
93
94 return argument_parser
95

◆ create_path()

def create_path (   self)
Sets up a path that plays back pregenerated events or generates events
based on the properties in the base class.

Reimplemented from ReadOrGenerateEventsRun.

Definition at line 161 of file record.py.

161 def create_path(self):
162 """
163 Sets up a path that plays back pregenerated events or generates events
164 based on the properties in the base class.
165 """
166 path = super().create_path()
167
168 path.add_module("TFCDC_WireHitPreparer",
169 flightTimeEstimation="outwards",
170 UseNLoops=0.5
171 )
172
173 path.add_module("TFCDC_ClusterPreparer")
174
175
176 if self.monte_carlo == "no":
177 # MC free - default
178 path.add_module("TFCDC_SegmentFinderFacetAutomaton",
179 SegmentOrientation="outwards"
180 )
181
182 path.add_module("TFCDC_SegmentFitter",
183 inputSegments="CDCSegment2DVector",
184 updateDriftLength=True,
185 useAlphaInDriftLength=True,
186 )
187
188 elif self.monte_carlo == "medium":
189 # Medium MC - proper generation logic, but true facets and facet relations
190 path.add_module("TFCDC_SegmentFinderFacetAutomaton",
191 FacetFilter="truth",
192 FacetRelationFilter="truth",
193 SegmentOrientation="outwards"
194 )
195
196 path.add_module("TFCDC_SegmentFitter",
197 inputSegments="CDCSegment2DVector",
198 updateDriftLength=True,
199 useAlphaInDriftLength=True,
200 )
201
202 elif self.monte_carlo == "full":
203 # Only true monte carlo segments
204 # make the positions realistic but keep the true drift length
205 path.add_module("TFCDC_SegmentCreatorMCTruth",
206 reconstructedDriftLength=False,
207 reconstructedPositions=True,
208 # segments="MCSegments"
209 )
210
211 path.add_module("TFCDC_SegmentFitter",
212 inputSegments="CDCSegment2DVector",
213 updateDriftLength=False,
214 # useAlphaInDriftLength=True,
215 )
216
217 else:
218 raise ValueError("Invalid degree of Monte Carlo information")
219
220 path.add_module("TFCDC_SegmentOrienter",
221 SegmentOrientation="outwards",
222 # SegmentOrientation="none",
223 inputSegments="CDCSegment2DVector",
224 segments="CDCSegment2DVectorOriented"
225 )
226
227 path.add_module("TFCDC_TrackFinderSegmentPairAutomaton",
228 inputSegments="CDCSegment2DVectorOriented",
229 WriteSegmentPairs=True,
230 SegmentPairFilter="truth",
231 SegmentPairFilterParameters={"allowReverse": True},
232 SegmentPairRelationFilter="none"
233 )
234
235 path.add_module(AxialStereoPairFitterModule(fit_method=self.get_fit_method()))
236 return path
237
238

◆ get_fit_method()

def get_fit_method (   self)
Determine which track-segment-pair fitter to use

Definition at line 96 of file record.py.

96 def get_fit_method(self):
97 """Determine which track-segment-pair fitter to use"""
98 fit_method_name = self.fit_method_name
99
100 if fit_method_name == 'zreco':
102
103 def z_reconstruction_fit(pair):
104 return sz_fitter.update(pair)
105 return z_reconstruction_fit
106
107 elif fit_method_name.startswith('fuse-pre'):
110 fusionFit = CDCAxialStereoFusion()
111
112 def sz_segment_pair_preliminary_fit(pair):
113 fusionFit.fusePreliminary(pair)
114 return sz_segment_pair_preliminary_fit
115
116 elif fit_method_name.startswith('fuse-sz'):
119 reestimateDriftLength = fit_method_name.endswith("re")
120 fusionFit = CDCAxialStereoFusion(reestimateDriftLength)
121
122 def sz_segment_pair_fusion_fit(pair):
123 fusionFit.reconstructFuseTrajectories(pair)
124 return
125
126 trajectory3D = pair.getTrajectory3D()
127 revFromSegment = pair.getFromSegment().reversed()
128 revToSegment = pair.getToSegment().reversed()
129 revPair = CDCSegmentPair(revToSegment, revFromSegment)
130
131 CDCAxialStereoFusion.reconstructFuseTrajectories(revPair)
132 revTrajectory3D = revPair.getTrajectory3D().reversed()
133
134 # print("One origin x", trajectory3D.getLocalOrigin().x())
135 # print("One origin y", trajectory3D.getLocalOrigin().y())
136 # print("One origin z", trajectory3D.getLocalOrigin().z())
137
138 # print("Rev origin x", revTrajectory3D.getLocalOrigin().x())
139 # print("Rev origin y", revTrajectory3D.getLocalOrigin().y())
140 # print("Rev origin z", revTrajectory3D.getLocalOrigin().z())
141
142 print("One parameters", [trajectory3D.getLocalHelix().parameters()[i] for i in range(5)])
143 print("Rev parameters", [revTrajectory3D.getLocalHelix().parameters()[i] for i in range(5)])
144
145 print("One covariance")
146 for j in range(5):
147 print([trajectory3D.getLocalHelix().helixCovariance()(i, j) for i in range(5)])
148
149 print("Rev covariance")
150 for j in range(5):
151 print([revTrajectory3D.getLocalHelix().helixCovariance()(i, j) for i in range(5)])
152
153 # return revTrajectory3D
154 # return trajectory3D
155
156 return sz_segment_pair_fusion_fit
157
158 else:
159 raise ValueError(f"Unexpected fit_positions {fit_method_name}")
160
Utility class implementing the Kalmanesk combination of to two dimensional trajectories to one three ...
static const CDCSZFitter & getFitter()
Getter for a standard sz line fitter instance.
Definition: CDCSZFitter.cc:36
Class representing a pair of one reconstructed axial segment and one stereo segment in adjacent super...

◆ harvesting_module()

def harvesting_module (   self,
  path = None 
)
Harvest and post-process the MC events

Reimplemented from HarvestingRunMixin.

Definition at line 61 of file record.py.

61 def harvesting_module(self, path=None):
62 """Harvest and post-process the MC events"""
63 harvesting_module = SegmentPairFitValidationModule(self.output_file_name)
64 if path:
65 path.add_module(harvesting_module)
66 return harvesting_module
67

◆ output_file_name()

def output_file_name (   self)
Get the output ROOT filename

Reimplemented from HarvestingRunMixin.

Definition at line 49 of file record.py.

49 def output_file_name(self):
50 """Get the output ROOT filename"""
51 file_name = self.fit_method_name
52 file_name += "-mc-" + self.monte_carlo
53
54 if self.root_input_file:
55 file_name += "-" + os.path.split(self.root_input_file)[1]
56 else:
57 file_name += ".root"
58
59 return file_name
60

Member Data Documentation

◆ fit_method_name

str fit_method_name = "fuse-sz"
static

use the Kalmanesk fuse of the two trajectory fits

Definition at line 46 of file record.py.

◆ generator_module

str generator_module = "simple_gun"
static

use the low-momentum particle gun event generator

Definition at line 38 of file record.py.

◆ monte_carlo [1/2]

str monte_carlo = "no"
static

do not generate new events

Definition at line 41 of file record.py.

◆ monte_carlo [2/2]

monte_carlo

Degree of refinement of the segment generation.

Definition at line 176 of file record.py.

◆ n_events

int n_events = 10000
static

number of events to generate

Definition at line 36 of file record.py.

◆ segment_orientation

str segment_orientation = "outwards"
static

ordering of the segments in the pair

Definition at line 43 of file record.py.


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