Belle II Software development
SegmentFitValidationRun Class Reference
Inheritance diagram for SegmentFitValidationRun:
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 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 = "low_gun"
 use the low-momentum particle gun event generator
 
str root_input_file = "low_gun.root"
 read generated/simulated/reconstructed events from this ROOT file
 
str monte_carlo = "no"
 do not generate new events
 
bool karimaki_fit = False
 use the Riemann fit instead of the Karimaki fit
 
str flight_time_estimation = "none"
 do not estimate the flight time
 
bool flight_time_reestimation = False
 do not re-estimate the flight time
 
bool use_alpha_in_drift_length = True
 use the alpha parameter for drift length
 
float flight_time_mass_scale = float("nan")
 assume a very heavy particle for flight time calculation
 
str fit_positions = "recoPos"
 fit the reconstructed hit position for the segment fit
 
str fit_variance = "proper"
 use the drift-length variance in the segment fit
 

Detailed Description

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

Definition at line 34 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 83 of file record.py.

83 def create_argument_parser(self, **kwds):
84 """Convert command-line arguments to basf2 argument list"""
85 argument_parser = super().create_argument_parser(**kwds)
86
87 argument_parser.add_argument(
88 '-m',
89 '--monte-carlo',
90 choices=["no", "medium", "full"],
91 default=self.monte_carlo,
92 dest='monte_carlo',
93 help='Amount of monte carlo information to be used in the segment generation.',
94 )
95
96 argument_parser.add_argument(
97 "-k",
98 "--karimaki",
99 dest="karimaki_fit",
100 action="store_true",
101 help='Use Karimaki fit instead of Riemann fit'
102 )
103
104 argument_parser.add_argument(
105 "-fp",
106 "--fit-pos",
107 choices=["recoPos", "rlDriftCircle", "wirePos"],
108 default=self.fit_positions,
109 dest="fit_positions",
110 help=("Choose which positional information the segment fit should be used. \n"
111 "* 'wirePos' means only the wire position\n"
112 "* 'recoPos' means only the reconstructed position\n"
113 "* 'rlDriftCircle' means only the drift circle with the right left passage\n")
114 )
115
116 argument_parser.add_argument(
117 "-fv",
118 "--fit-var",
119 choices=["unit", "driftLength", "pseudo", "proper"],
120 default=self.fit_variance,
121 dest="fit_variance",
122 help=("Choose which variance information the segment fit should be used. \n"
123 "* 'unit' means equal variance of 1\n"
124 "* 'driftLength' means inserting the drift length as variance, very improper because dimension mismatch\n"
125 "* 'pseudo' means the squared dirft length + plus the drift length variance "
126 "(correct dimension, proper lower bound)\n"
127 "* 'proper' means only the drift length variance\n")
128 )
129
130 argument_parser.add_argument(
131 "-ft",
132 "--flight-time-estimation",
133 choices=["none", "outwards", "downwards"],
134 default=self.flight_time_estimation,
135 dest="flight_time_estimation",
136 help=("Choose which estimation method for the time of flight should be use. \n"
137 "* 'none' no time of flight corrections\n"
138 "* 'outwards' means the minimal time needed to travel to the wire from the interaction point \n"
139 "* 'downwards' means the minimal time needed to travel to the wire from the y = 0 plane downwards \n")
140 )
141
142 argument_parser.add_argument(
143 "-fr",
144 "--flight-time-reestimation",
145 action="store_true",
146 dest="flight_time_reestimation",
147 help=("Switch to reestimate drift length before fitting.")
148 )
149
150 argument_parser.add_argument(
151 "-fa",
152 "--use-alpha-in-drift-length",
153 action="store_true",
154 dest="use_alpha_in_drift_length",
155 help=("Switch to serve the alpha angle to the drift length translator.")
156 )
157
158 argument_parser.add_argument(
159 "-fm",
160 "--flight-time-mass-scale",
161 type=float,
162 dest="flight_time_mass_scale",
163 help=("Mass parameter to estimate the velocity in the time of flight estimation")
164 )
165
166 return argument_parser
167

◆ 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 168 of file record.py.

168 def create_path(self):
169 """
170 Sets up a path that plays back pregenerated events or generates events
171 based on the properties in the base class.
172 """
173 path = super().create_path()
174
175 path.add_module("TFCDC_WireHitPreparer",
176 flightTimeEstimation=self.flight_time_estimation,
177 UseNLoops=1
178 )
179
180 path.add_module("TFCDC_ClusterPreparer")
181
182
183 if self.monte_carlo == "no":
184 # MC free - default
185 path.add_module(
186 "TFCDC_SegmentFinderFacetAutomaton",
187 # investigate=[],
188 SegmentOrientation="none",
189 )
190
191 elif self.monte_carlo == "medium":
192 # Medium MC - proper generation logic, but true facets and facet relations
193 path.add_module("TFCDC_SegmentFinderFacetAutomaton",
194 FacetFilter="truth",
195 FacetRelationFilter="truth",
196 SegmentOrientation="none",
197 # SegmentOrientation="outwards"
198 )
199
200 elif self.monte_carlo == "full":
201 # Only true monte carlo segments, but make the positions realistic
202 path.add_module("TFCDC_SegmentCreatorMCTruth",
203 reconstructedDriftLength=False,
204 reconstructedPositions=True)
205
206 else:
207 raise ValueError("Invalid degree of Monte Carlo information")
208
209 path.add_module("TFCDC_SegmentFitter",
210 inputSegments="CDCSegment2DVector",
211 karimakiFit=self.karimaki_fit,
212 fitPos=self.fit_positions,
213 fitVariance=self.fit_variance,
214 updateDriftLength=self.flight_time_reestimation,
215 useAlphaInDriftLength=self.use_alpha_in_drift_length,
216 tofMassScale=self.flight_time_mass_scale)
217
218 return path
219
220

◆ harvesting_module()

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

Reimplemented from HarvestingRunMixin.

Definition at line 76 of file record.py.

76 def harvesting_module(self, path=None):
77 """Harvest and post-process the MC events"""
78 harvesting_module = SegmentFitValidationModule(self.output_file_name)
79 if path:
80 path.add_module(harvesting_module)
81 return harvesting_module
82

◆ output_file_name()

def output_file_name (   self)
Get the output ROOT filename

Reimplemented from HarvestingRunMixin.

Definition at line 63 of file record.py.

63 def output_file_name(self):
64 """Get the output ROOT filename"""
65 file_name = "karimaki" if self.karimaki_fit else "riemann"
66 file_name += "-mc-" + self.monte_carlo
67 if self.flight_time_reestimation:
68 file_name += "-re"
69 if self.root_input_file:
70 file_name += "-" + os.path.split(self.root_input_file)[1]
71 else:
72 file_name += ".root"
73
74 return file_name
75

Member Data Documentation

◆ fit_positions

str fit_positions = "recoPos"
static

fit the reconstructed hit position for the segment fit

Definition at line 58 of file record.py.

◆ fit_variance

str fit_variance = "proper"
static

use the drift-length variance in the segment fit

Definition at line 60 of file record.py.

◆ flight_time_estimation

str flight_time_estimation = "none"
static

do not estimate the flight time

Definition at line 49 of file record.py.

◆ flight_time_mass_scale

float flight_time_mass_scale = float("nan")
static

assume a very heavy particle for flight time calculation

Definition at line 55 of file record.py.

◆ flight_time_reestimation

bool flight_time_reestimation = False
static

do not re-estimate the flight time

Definition at line 51 of file record.py.

◆ generator_module

str generator_module = "low_gun"
static

use the low-momentum particle gun event generator

Definition at line 40 of file record.py.

◆ karimaki_fit

bool karimaki_fit = False
static

use the Riemann fit instead of the Karimaki fit

Definition at line 47 of file record.py.

◆ monte_carlo [1/2]

str monte_carlo = "no"
static

do not generate new events

Definition at line 45 of file record.py.

◆ monte_carlo [2/2]

monte_carlo

Degree of refinement of the segment generation.

Definition at line 183 of file record.py.

◆ n_events

int n_events = 10000
static

number of events to generate

Definition at line 38 of file record.py.

◆ root_input_file

str root_input_file = "low_gun.root"
static

read generated/simulated/reconstructed events from this ROOT file

Definition at line 42 of file record.py.

◆ use_alpha_in_drift_length

bool use_alpha_in_drift_length = True
static

use the alpha parameter for drift length

Definition at line 53 of file record.py.


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