Belle II Software development
XHitFilterFactory< PointType > Class Template Reference

The factory serves as an interface between all x-hit-filters and a user only knowing their name (in string), but not their type. More...

#include <XHitFilterFactory.h>

Public Types

typedef FilterID::filterTypes XHitFilterType
 constructor where nothing has been passed
 
using TwoHitFunction = typename std::function< double(const PointType &, const PointType &)>
 typedef for more readable function-type - to be used for 2-hit-selectionVariables.
 
using ThreeHitFunction = typename std::function< double(const PointType &, const PointType &, const PointType &)>
 typedef for more readable function-type - to be used for 3-hit-selectionVariables.
 
using FourHitFunction = typename std::function< double(const PointType &, const PointType &, const PointType &, const PointType &)>
 typedef for more readable function-type - to be used for 4-hit-selectionVariables.
 

Public Member Functions

 XHitFilterFactory (double x=0, double y=0, double z=0, double mField=1.5)
 constructor where virtual IP has been passed
 
TwoHitFunction get2HitInterface (std::string variableName)
 For given name of a variableType a function for the corresponding Filter is returned.
 
TwoHitFunction get2HitInterface (XHitFilterType variableType)
 For given name of a variableType a function for the corresponding Filter is returned.
 
ThreeHitFunction get3HitInterface (std::string variableName)
 For given name of a variableType a function for the corresponding Filter is returned.
 
ThreeHitFunction get3HitInterface (XHitFilterType variableType)
 For given name of a variableType a function for the corresponding Filter is returned.
 
FourHitFunction get4HitInterface (std::string variableName)
 For given name of a variableType a function for the corresponding Filter is returned.
 
FourHitFunction get4HitInterface (XHitFilterType variableType)
 For given name of a variableType a function for the corresponding Filter is returned.
 

Protected Attributes

TwoHitFilters m_twoHit
 contains all 2-hit-filters.
 
ThreeHitFilters m_threeHit
 contains all 3-hit-filters.
 
FourHitFilters m_fourHit
 contains all 4-hit-filters.
 
B2Vector3D m_virtualIP
 contains global coordinates of virtual interaction point.
 

Detailed Description

template<class PointType>
class Belle2::XHitFilterFactory< PointType >

The factory serves as an interface between all x-hit-filters and a user only knowing their name (in string), but not their type.

Definition at line 36 of file XHitFilterFactory.h.

Member Typedef Documentation

◆ FourHitFunction

using FourHitFunction = typename std::function<double(const PointType&, const PointType&, const PointType&, const PointType&)>

typedef for more readable function-type - to be used for 4-hit-selectionVariables.

Definition at line 64 of file XHitFilterFactory.h.

◆ ThreeHitFunction

using ThreeHitFunction = typename std::function<double(const PointType&, const PointType&, const PointType&)>

typedef for more readable function-type - to be used for 3-hit-selectionVariables.

Definition at line 61 of file XHitFilterFactory.h.

◆ TwoHitFunction

using TwoHitFunction = typename std::function<double(const PointType&, const PointType&)>

typedef for more readable function-type - to be used for 2-hit-selectionVariables.

Definition at line 58 of file XHitFilterFactory.h.

◆ XHitFilterType

constructor where nothing has been passed

shortCut for better readability.

Definition at line 55 of file XHitFilterFactory.h.

Constructor & Destructor Documentation

◆ XHitFilterFactory()

XHitFilterFactory ( double  x = 0,
double  y = 0,
double  z = 0,
double  mField = 1.5 
)
inline

constructor where virtual IP has been passed

Definition at line 40 of file XHitFilterFactory.h.

40 :
41 m_virtualIP(x, y, z)
42 {
45 }
void resetMagneticField(const double magneticFieldStrength=1.5)
Overrides Constructor-Setup for magnetic field.
void resetMagneticField(const double magneticFieldStrength=1.5)
Overrides Constructor-Setup for magnetic field.
B2Vector3D m_virtualIP
contains global coordinates of virtual interaction point.
FourHitFilters m_fourHit
contains all 4-hit-filters.
ThreeHitFilters m_threeHit
contains all 3-hit-filters.

Member Function Documentation

◆ get2HitInterface() [1/2]

TwoHitFunction get2HitInterface ( std::string  variableName)
inline

For given name of a variableType a function for the corresponding Filter is returned.

Definition at line 69 of file XHitFilterFactory.h.

70 {
71 XHitFilterType varType = FilterID::getTypeEnum(variableName);
72 return get2HitInterface(varType);
73 }
static filterTypes getTypeEnum(const std::string &filterString)
returns type of given name, needed for compatibility with other modules.
Definition: FilterID.h:240
TwoHitFunction get2HitInterface(std::string variableName)
For given name of a variableType a function for the corresponding Filter is returned.
FilterID::filterTypes XHitFilterType
constructor where nothing has been passed

◆ get2HitInterface() [2/2]

TwoHitFunction get2HitInterface ( XHitFilterType  variableType)
inline

For given name of a variableType a function for the corresponding Filter is returned.

2-hit:

2+1-hit:

Definition at line 78 of file XHitFilterFactory.h.

79 {
80 // prepare stuff for 2-hit-filters:
81 auto prepareStuff = [ = ](const PointType & outerHit, const PointType & innerHit) -> void {
82 B2Vector3D tOuterHit(outerHit.X(), outerHit.Y(), outerHit.Z());
83 B2Vector3D tInnerHit(innerHit.X(), innerHit.Y(), innerHit.Z());
84 m_twoHit.resetValues(tOuterHit, tInnerHit);
85 };
86
88 if (variableType == FilterID::distance3D) {
89 return [ = ](const PointType & outerHit, const PointType & innerHit) -> double {
90 prepareStuff(outerHit, innerHit);
91 return m_twoHit.calcDist3D();
92 };
93 }
94
95 if (variableType == FilterID::distanceXY) {
96 return [ = ](const PointType & outerHit, const PointType & innerHit) -> double {
97 prepareStuff(outerHit, innerHit);
98 return m_twoHit.calcDistXY();
99 };
100 }
101
102 if (variableType == FilterID::distanceZ) {
103 return [ = ](const PointType & outerHit, const PointType & innerHit) -> double {
104 prepareStuff(outerHit, innerHit);
105 return m_twoHit.calcDistZ();
106 };
107 }
108
109 if (variableType == FilterID::slopeRZ) {
110 return [ = ](const PointType & outerHit, const PointType & innerHit) -> double {
111 prepareStuff(outerHit, innerHit);
112 return m_twoHit.calcSlopeRZ();
113 };
114 }
115
116 if (variableType == FilterID::normedDistance3D) {
117 return [ = ](const PointType & outerHit, const PointType & innerHit) -> double {
118 prepareStuff(outerHit, innerHit);
119 return m_twoHit.calcNormedDist3D();
120 };
121 }
122
123 // prepare stuff for 2+1-hit-filters
124 auto prepareStuffHiOc = [ = ](const PointType & outerHit, const PointType & innerHit) -> void {
125 B2Vector3D tOuterHit(outerHit.X(), outerHit.Y(), outerHit.Z());
126 B2Vector3D tInnerHit(innerHit.X(), innerHit.Y(), innerHit.Z());
127 m_threeHit.resetValues(tOuterHit, tInnerHit, m_virtualIP);
128 };
129
130
132 if (variableType == FilterID::anglesHighOccupancy3D) {
133 return [ = ](const PointType & outerHit, const PointType & innerHit) -> double {
134 prepareStuffHiOc(outerHit, innerHit);
135 return m_threeHit.calcAngle3D();
136 };
137 }
138
139 if (variableType == FilterID::anglesHighOccupancyXY) {
140 return [ = ](const PointType & outerHit, const PointType & innerHit) -> double {
141 prepareStuffHiOc(outerHit, innerHit);
142 return m_threeHit.calcAngleXY();
143 };
144 }
145
146 if (variableType == FilterID::anglesHighOccupancyRZ) {
147 return [ = ](const PointType & outerHit, const PointType & innerHit) -> double {
148 prepareStuffHiOc(outerHit, innerHit);
149 return m_threeHit.calcAngleRZ();
150 };
151 }
152
153 if (variableType == FilterID::distanceHighOccupancy2IP) {
154 return [ = ](const PointType & outerHit, const PointType & innerHit) -> double {
155 prepareStuffHiOc(outerHit, innerHit);
157 };
158 }
159
160 if (variableType == FilterID::deltaSlopeHighOccupancyRZ) {
161 return [ = ](const PointType & outerHit, const PointType & innerHit) -> double {
162 prepareStuffHiOc(outerHit, innerHit);
164 };
165 }
166
167 if (variableType == FilterID::pTHighOccupancy) {
168 return [ = ](const PointType & outerHit, const PointType & innerHit) -> double {
169 prepareStuffHiOc(outerHit, innerHit);
170 return m_threeHit.calcPt();
171 };
172 }
173
174 if (variableType == FilterID::helixParameterHighOccupancyFit) {
175 return [ = ](const PointType & outerHit, const PointType & innerHit) -> double {
176 prepareStuffHiOc(outerHit, innerHit);
178 };
179 }
180
181
182
183 B2ERROR(" XHitFilterAdapter-2Hit: given name (raw/full): " << variableType <<
184 "/" << FilterID::getTypeName(variableType) <<
185 " is not known, returning dummy function with 0.0 as a result instead!");
186
187 return [&](const PointType&, const PointType&) -> double { return 0.0; };
188 }
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:435
DataType X() const
access variable X (= .at(0) without boundary check)
Definition: B2Vector3.h:431
DataType Y() const
access variable Y (= .at(1) without boundary check)
Definition: B2Vector3.h:433
static std::string getTypeName(filterTypes filterType)
returns name of given type, needed for compatibility with other modules
Definition: FilterID.cc:434
@ distanceHighOccupancy2IP
string name of filter d2IP high occupancy
Definition: FilterID.h:44
@ deltaSlopeHighOccupancyRZ
string name of filter dslopeRZ high occupancy
Definition: FilterID.h:45
@ anglesHighOccupancy3D
string name of filter a3D high occupancy
Definition: FilterID.h:41
@ distanceXY
string name of filter dXY
Definition: FilterID.h:34
@ normedDistance3D
string name of filter nd3D
Definition: FilterID.h:37
@ slopeRZ
string name of filter slopeRZ
Definition: FilterID.h:36
@ distance3D
string name of filter d3D
Definition: FilterID.h:33
@ anglesHighOccupancyXY
string name of filter aXY high occupancy
Definition: FilterID.h:42
@ helixParameterHighOccupancyFit
string name of filter hFit high occupancy
Definition: FilterID.h:47
@ pTHighOccupancy
string name of filter pT high occupancy
Definition: FilterID.h:46
@ distanceZ
string name of filter dZ
Definition: FilterID.h:35
@ anglesHighOccupancyRZ
string name of filter aRZ high occupancy
Definition: FilterID.h:43
double calcAngle3D()
calculates the angle between the hits/vectors (3D), returning unit: none (calculation for degrees is ...
void resetValues(const B2Vector3D &outerHit, const B2Vector3D &centerHit, const B2Vector3D &innerHit)
Overrides Constructor-Setup.
double calcPt()
calculates the estimation of the transverse momentum of the 3-hit-tracklet, returning unit: GeV/c
double calcDeltaSlopeRZ()
calculates deviations in the slope of the inner segment and the outer segment, returning unit: none
double calcAngleRZ()
calculates the angle between the hits/vectors (RZ), returning unit: none (calculation for degrees is ...
double calcCircleDist2IP()
calculates the distance of the point of closest approach of circle to the IP, returning unit: cm
double calcHelixParameterFit()
calculates the helixparameter describing the deviation in z per unit angle, returning unit: none
double calcAngleXY()
calculates the angle between the hits/vectors (XY), returning unit: none (calculation for degrees is ...
double calcNormedDist3D() const
calculates the normed distance between the hits (3D), return unit: none
Definition: TwoHitFilters.h:81
double calcDist3D() const
calculates the distance between the hits (3D), returning unit: cm^2 for speed optimization
Definition: TwoHitFilters.h:55
double calcDistXY() const
calculates the distance between the hits (XY), returning unit: cm^2 for speed optimization
Definition: TwoHitFilters.h:61
double calcSlopeRZ() const
calculates the angle of the slope of the hits in RZ, returnValue = theta = atan(r/z)
Definition: TwoHitFilters.h:70
double calcDistZ() const
calculates the distance between the hits (Z only), returning unit: cm
Definition: TwoHitFilters.h:67
void resetValues(const B2Vector3D &outerHit, const B2Vector3D &innerHit)
Overrides Constructor-Setup.
Definition: TwoHitFilters.h:46
TwoHitFilters m_twoHit
contains all 2-hit-filters.
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition: B2Vector3.h:516
B2Vector3D outerHit(0, 0, 0)
testing out of range behavior

◆ get3HitInterface() [1/2]

ThreeHitFunction get3HitInterface ( std::string  variableName)
inline

For given name of a variableType a function for the corresponding Filter is returned.

Definition at line 193 of file XHitFilterFactory.h.

194 {
195 XHitFilterType varType = FilterID::getTypeEnum(variableName);
196 return get3HitInterface(varType);
197 }
ThreeHitFunction get3HitInterface(std::string variableName)
For given name of a variableType a function for the corresponding Filter is returned.

◆ get3HitInterface() [2/2]

ThreeHitFunction get3HitInterface ( XHitFilterType  variableType)
inline

For given name of a variableType a function for the corresponding Filter is returned.

3-hit:

3+1hit:

Definition at line 202 of file XHitFilterFactory.h.

203 {
204 // prepare stuff for 3-hit-filters
205 auto prepareStuff3Hit = [ = ](const PointType & outerHit, const PointType & centerHit, const PointType & innerHit) -> void {
206 B2Vector3D tOuterHit(outerHit.X(), outerHit.Y(), outerHit.Z());
207 B2Vector3D tCenterHit(centerHit.X(), centerHit.Y(), centerHit.Z());
208 B2Vector3D tInnerHit(innerHit.X(), innerHit.Y(), innerHit.Z());
209 m_threeHit.resetValues(tOuterHit, tCenterHit, tInnerHit);
210 };
211
213 if (variableType == FilterID::angles3D) {
214 return [ = ](const PointType & outerHit, const PointType & centerHit, const PointType & innerHit) -> double {
215 prepareStuff3Hit(outerHit, centerHit, innerHit);
216 return m_threeHit.calcAngle3D();
217 };
218 }
219
220 if (variableType == FilterID::anglesRZ) {
221 return [ = ](const PointType & outerHit, const PointType & centerHit, const PointType & innerHit) -> double {
222 prepareStuff3Hit(outerHit, centerHit, innerHit);
223 return m_threeHit.calcAngleRZ();
224 };
225 }
226
227 if (variableType == FilterID::anglesXY) {
228 return [ = ](const PointType & outerHit, const PointType & centerHit, const PointType & innerHit) -> double {
229 prepareStuff3Hit(outerHit, centerHit, innerHit);
230 return m_threeHit.calcAngleXY();
231 };
232 }
233
234 if (variableType == FilterID::deltaSlopeRZ) {
235 return [ = ](const PointType & outerHit, const PointType & centerHit, const PointType & innerHit) -> double {
236 prepareStuff3Hit(outerHit, centerHit, innerHit);
238 };
239 }
240
241 if (variableType == FilterID::pT) {
242 return [ = ](const PointType & outerHit, const PointType & centerHit, const PointType & innerHit) -> double {
243 prepareStuff3Hit(outerHit, centerHit, innerHit);
244 return m_threeHit.calcPt();
245 };
246 }
247
248 if (variableType == FilterID::distance2IP) {
249 return [ = ](const PointType & outerHit, const PointType & centerHit, const PointType & innerHit) -> double {
250 prepareStuff3Hit(outerHit, centerHit, innerHit);
252 };
253 }
254
255 if (variableType == FilterID::helixParameterFit) {
256 return [ = ](const PointType & outerHit, const PointType & centerHit, const PointType & innerHit) -> double {
257 prepareStuff3Hit(outerHit, centerHit, innerHit);
259 };
260 }
261
262 if (variableType == FilterID::deltaSOverZ) {
263 return [ = ](const PointType & outerHit, const PointType & centerHit, const PointType & innerHit) -> double {
264 prepareStuff3Hit(outerHit, centerHit, innerHit);
266 };
267 }
268
269 if (variableType == FilterID::deltaSlopeZOverS) {
270 return [ = ](const PointType & outerHit, const PointType & centerHit, const PointType & innerHit) -> double {
271 prepareStuff3Hit(outerHit, centerHit, innerHit);
273 };
274 }
275
276
277 // prepare stuff for 3+1-hit-filters
278 auto prepareStuff4Hit = [ = ](const PointType & outerHit, const PointType & centerHit,
279 const PointType & innerHit) -> void {
280 B2Vector3D tOuterHit(outerHit.X(), outerHit.Y(), outerHit.Z());
281 B2Vector3D tCenterHit(centerHit.X(), centerHit.Y(), centerHit.Z());
282 B2Vector3D tInnerHit(innerHit.X(), innerHit.Y(), innerHit.Z());
283 m_fourHit.resetValues(tOuterHit, tCenterHit, tInnerHit, m_virtualIP);
284 };
285
287 if (variableType == FilterID::deltapTHighOccupancy) {
288 return [ = ](const PointType & outerHit, const PointType & centerHit, const PointType & innerHit) -> double {
289 prepareStuff4Hit(outerHit, centerHit, innerHit);
290 return m_fourHit.calcDeltapT();
291 };
292 }
293
294 if (variableType == FilterID::deltaDistanceHighOccupancy2IP) {
295 return [ = ](const PointType & outerHit, const PointType & centerHit, const PointType & innerHit) -> double {
296 prepareStuff4Hit(outerHit, centerHit, innerHit);
298 };
299 }
300
301
302 B2ERROR(" XHitFilterAdapter-3Hit: given name (raw/full): " << variableType <<
303 "/" << FilterID::getTypeName(variableType) <<
304 " is not known, returning dummy function with 0.0 as a result instead!");
305
306 return [&](const PointType&, const PointType&, const PointType&) -> double { return 0.0; };
307 }
@ distance2IP
string name of filter d2IP
Definition: FilterID.h:56
@ anglesXY
string name of filter aXY
Definition: FilterID.h:53
@ helixParameterFit
string name of filter helix Paramater Fit
Definition: FilterID.h:57
@ deltaSlopeRZ
string name of filter dslopeRZ
Definition: FilterID.h:54
@ deltaDistanceHighOccupancy2IP
string name of filter dd2IP high occupancy
Definition: FilterID.h:64
@ deltapTHighOccupancy
string name of filter dPt high occupancy
Definition: FilterID.h:63
@ angles3D
string name of filter a3D
Definition: FilterID.h:51
@ anglesRZ
string name of filter aRZ
Definition: FilterID.h:52
@ deltaSlopeZOverS
deltaSlopeZOverS Filter
Definition: FilterID.h:59
@ deltaSOverZ
deltaSOverZ Filter
Definition: FilterID.h:58
@ pT
string name of filter pT
Definition: FilterID.h:55
double calcDeltaDistCircleCenter()
calculates ddist2IP-value directly (ddist2IP= difference in magnitude of the points of closest approa...
double calcDeltapT()
calculates dpt-value (dpt= difference in transverse momentum of 2 subsets of the hits),...
void resetValues(const B2Vector3D &outer, const B2Vector3D &outerCenter, const B2Vector3D &innerCenter, const B2Vector3D &inner)
Overrides Constructor-Setup.
double calcDeltaSOverZ()
calculates the helixparameter describing the deviation in arc length per unit in z.
double calcDeltaSlopeZOverS()
compares the "slopes" z over arc length.

◆ get4HitInterface() [1/2]

FourHitFunction get4HitInterface ( std::string  variableName)
inline

For given name of a variableType a function for the corresponding Filter is returned.

Definition at line 312 of file XHitFilterFactory.h.

313 {
314 XHitFilterType varType = FilterID::getTypeEnum(variableName);
315 return get4HitInterface(varType);
316 }
FourHitFunction get4HitInterface(std::string variableName)
For given name of a variableType a function for the corresponding Filter is returned.

◆ get4HitInterface() [2/2]

FourHitFunction get4HitInterface ( XHitFilterType  variableType)
inline

For given name of a variableType a function for the corresponding Filter is returned.

4-hit:

Definition at line 321 of file XHitFilterFactory.h.

322 {
323
324 // prepare stuff for 4-hit-filters
325 auto prepareStuff4Hit = [ = ](const PointType & outerHit, const PointType & outerCenterHit,
326 const PointType & innerCenterHit, const PointType & innerHit) -> void {
327 B2Vector3D tOuterHit(outerHit.X(), outerHit.Y(), outerHit.Z());
328 B2Vector3D tOuterCenterHit(outerCenterHit.X(), outerCenterHit.Y(), outerCenterHit.Z());
329 B2Vector3D tInnerCenterHit(innerCenterHit.X(), innerCenterHit.Y(), innerCenterHit.Z());
330 B2Vector3D tInnerHit(innerHit.X(), innerHit.Y(), innerHit.Z());
331 m_fourHit.resetValues(tOuterHit, tOuterCenterHit, tInnerCenterHit, tInnerHit);
332 };
333
335 if (variableType == FilterID::deltapT) {
336 return [ = ](const PointType & outerHit, const PointType & outerCenterHit,
337 const PointType & innerCenterHit, const PointType & innerHit) -> double {
338 prepareStuff4Hit(outerHit, outerCenterHit, innerCenterHit, innerHit);
339 return m_fourHit.calcDeltapT();
340 };
341 }
342
343 if (variableType == FilterID::deltaDistance2IP) {
344 return [ = ](const PointType & outerHit, const PointType & outerCenterHit,
345 const PointType & innerCenterHit, const PointType & innerHit) -> double {
346 prepareStuff4Hit(outerHit, outerCenterHit, innerCenterHit, innerHit);
348 };
349 }
350
351
352 B2ERROR(" XHitFilterAdapter-4Hit: given name (raw/full): " << variableType <<
353 "/" << FilterID::getTypeName(variableType) <<
354 " is not known, returning dummy function with 0.0 as a result instead!");
355
356 return [&](const PointType&, const PointType&, const PointType&, const PointType&) -> double { return 0.0; };
357 }
@ deltaDistance2IP
string name of filter dd2IP
Definition: FilterID.h:69
@ deltapT
string name of filter dPt
Definition: FilterID.h:68

Member Data Documentation

◆ m_fourHit

FourHitFilters m_fourHit
protected

contains all 4-hit-filters.

Definition at line 365 of file XHitFilterFactory.h.

◆ m_threeHit

ThreeHitFilters m_threeHit
protected

contains all 3-hit-filters.

Definition at line 364 of file XHitFilterFactory.h.

◆ m_twoHit

TwoHitFilters m_twoHit
protected

contains all 2-hit-filters.

Definition at line 363 of file XHitFilterFactory.h.

◆ m_virtualIP

B2Vector3D m_virtualIP
protected

contains global coordinates of virtual interaction point.

Definition at line 367 of file XHitFilterFactory.h.


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