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 37 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 86 of file record.py.

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

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

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

◆ harvesting_module()

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

Reimplemented from HarvestingRunMixin.

Definition at line 79 of file record.py.

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

◆ output_file_name()

def output_file_name (   self)
Get the output ROOT filename

Reimplemented from HarvestingRunMixin.

Definition at line 66 of file record.py.

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

Member Data Documentation

◆ fit_positions

str fit_positions = "recoPos"
static

fit the reconstructed hit position for the segment fit

Definition at line 61 of file record.py.

◆ fit_variance

str fit_variance = "proper"
static

use the drift-length variance in the segment fit

Definition at line 63 of file record.py.

◆ flight_time_estimation

str flight_time_estimation = "none"
static

do not estimate the flight time

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

◆ flight_time_reestimation

bool flight_time_reestimation = False
static

do not re-estimate the flight time

Definition at line 54 of file record.py.

◆ generator_module

str generator_module = "low_gun"
static

use the low-momentum particle gun event generator

Definition at line 43 of file record.py.

◆ karimaki_fit

bool karimaki_fit = False
static

use the Riemann fit instead of the Karimaki fit

Definition at line 50 of file record.py.

◆ monte_carlo [1/2]

str monte_carlo = "no"
static

do not generate new events

Definition at line 48 of file record.py.

◆ monte_carlo [2/2]

monte_carlo

Degree of refinement of the segment generation.

Definition at line 186 of file record.py.

◆ n_events

int n_events = 10000
static

number of events to generate

Definition at line 41 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 45 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 56 of file record.py.


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