Belle II Software development
ROIFinder Class Referenceabstract

Findlet for performing the simple SVDHoughTracking ROI calculation. More...

#include <ROIFinder.h>

Inheritance diagram for ROIFinder:
Findlet< const SpacePointTrackCand > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using IOTypes
 Types that should be served to apply on invocation.
 
using IOVectors
 Vector types that should be served to apply on invocation.
 

Public Member Functions

 ROIFinder ()
 Constructor for adding the subfindlets.
 
 ~ROIFinder ()
 Default destructor.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) override
 Expose the parameters of the sub findlets.
 
void apply (const std::vector< SpacePointTrackCand > &finalTracks) override
 Function to call all the sub-findlets.
 
void initialize () override
 Initialize the StoreArrays.
 
void beginRun () override
 Initialize the BField.
 
void beginEvent () override
 Clear the object pools.
 
virtual std::string getDescription ()
 Brief description of the purpose of the concrete findlet.
 
virtual std::string getDescription ()
 Brief description of the purpose of the concrete findlet.
 
virtual void apply (ToVector< AIOTypes > &... ioVectors)=0
 Main function executing the algorithm.
 
void endRun () override
 Receive and dispatch signal for the end of the run.
 
void terminate () override
 Receive and dispatch Signal for termination of the event processing.
 

Protected Types

using ToVector
 Short hand for ToRangeImpl.
 

Protected Member Functions

void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 

Private Types

using Super = TrackFindingCDC::Findlet<const SpacePointTrackCand>
 Parent class.
 

Private Attributes

bool m_calculateROI = false
 Calculate ROI in this findlet?
 
std::string m_storePXDInterceptsName = "SVDHoughPXDIntercepts"
 Name of the PXDIntercepts StoreArray.
 
std::string m_storeROIsName = "SVDHoughROIs"
 Name of the ROIs StoreArray.
 
StoreArray< PXDInterceptm_storePXDIntercepts
 PXDIntercepts StoreArray.
 
StoreArray< ROIidm_storeROIs
 ROIs StoreArray.
 
bool m_refit = true
 Refit the tracks with m_ROIFitMethod.
 
bool m_addVirtualIP = true
 Add a virtual IP for the refit?
 
std::string m_ROIFitMethod = "helixFit"
 Refit with this estimator, options are circleFit, tripletFit, helixFit.
 
std::unique_ptr< QualityEstimatorBasem_estimator
 pointer to the selected QualityEstimator
 
double m_tolerancePhi = 0.15
 Allowed tolerance (in radians) phi to create intercepts per sensor.
 
double m_toleranceZ = 0.5
 Allowed tolerance (in cm) in z to create intercepts per sensor.
 
double m_radiusCorrectionFactorL1 = -2.0
 Correction factor for radial bias for L1: factor * charge / radius.
 
double m_radiusCorrectionFactorL2 = -5.0
 Correction factor for radial bias for L2: factor * charge / radius.
 
double m_sinPhiCorrectionFactor = 0.0
 Correction factor for the sin(phi) modulation.
 
double m_cosPhiCorrectionFactor = 0.0
 Correction factor for the cos(phi) modulation.
 
double m_zPositionCorrectionFactor = 1.0
 Correction factor for the z position.
 
double m_minimumROISizeUL1 = 40
 Minimum size of ROI in u-direction on L1 in pixel.
 
double m_minimumROISizeVL1 = 40
 Minimum size of ROI in v-direction on L1 in pixel.
 
double m_minimumROISizeUL2 = 35
 Minimum size of ROI in u-direction on L2 in pixel.
 
double m_minimumROISizeVL2 = 30
 Minimum size of ROI in v-direction on L2 in pixel.
 
double m_multiplierUL1 = 500
 Multiplier term in ROI size estimation For u: size = multiplier * 1/R + minimumROISize For v: size = (1 + abs(tan(lambda)) * multiplier) + minimumROISize Multiplier term for u-direction on L1.
 
double m_multiplierUL2 = 600
 Multiplier term for u-direction on L2.
 
double m_multiplierVL1 = 0.8
 Multiplier term for v-direction on L1.
 
double m_multiplierVL2 = 0.8
 Multiplier term for v-direction on L2.
 
unsigned short m_maximumROISizeU = 100
 maximum ROI size in u in pixel
 
unsigned short m_maximumROISizeV = 100
 maximum ROI size in v in pixel
 
const double c_centerZShiftLayer1 [2] = {3.68255, -0.88255}
 Shift of the center of the active area of each sensor in a ladder of layer 1 For use of mhp_z > (length/-2)+shiftZ && mhp_z < (length/2)+shiftZ.
 
const double c_centerZShiftLayer2 [2] = {5.01455, -1.21455}
 Shift of the center of the active area of each sensor in a ladder of layer 2 For use of mhp_z > (length/-2)+shiftZ && mhp_z < (length/2)+shiftZ.
 
const double c_sensorMinY = -0.36
 PXD is shifted to create the windmill structure.
 
const double c_sensorMaxY = 0.89
 Maximum y coordinate if x-axis is perpendicular to the sensor:
 
const double c_activeSensorWidth = (c_sensorMaxY - c_sensorMinY)
 PXD sensors in L1 and L2 have the same size in u direction (=width):
 
const double c_shiftY = (c_sensorMaxY + c_sensorMinY) / 2.0
 Shift of the center position in y if the x-axis is perpendicular to the sensor:
 
const double c_layerRadius [2] = {1.42854, 2.21218}
 Radius of the two layers.
 
const double c_activeSensorLength [2] = {4.48, 6.144}
 Length of the active region for L1 and L2.
 
const double c_ladderPhiL1 [8] = {0., 0.25 * M_PI, M_PI_2, 0.75 * M_PI, M_PI, -0.75 * M_PI, -M_PI_2, -0.25 * M_PI}
 Phi values of the ladders of L1.
 
const double c_ladderPhiL2 [12] = {0., 1. / 6. * M_PI, 1. / 3. * M_PI, M_PI_2, 2. / 3. * M_PI, 5. / 6. * M_PI, M_PI, -5. / 6. * M_PI, -2. / 3. * M_PI, -M_PI_2, -1. / 3. * M_PI, -1. / 6. * M_PI}
 Phi values of the ladders of L2.
 
double m_bFieldZ = 1.5
 BField in Tesla.
 
B2Vector3D m_BeamSpotPosition
 B2Vector3D actually containing the BeamSpot position. This will be used as the starting point of the extrapolation.
 
B2Vector3D m_BeamSpotPositionError
 B2Vector3D actually containing the BeamSpot position error.
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized
 Flag to keep track whether initialization happened before.
 
bool m_terminated
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Findlet for performing the simple SVDHoughTracking ROI calculation.

Definition at line 30 of file ROIFinder.h.

Member Typedef Documentation

◆ IOTypes

using IOTypes
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOVectors

using IOVectors
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ Super

Parent class.

Definition at line 32 of file ROIFinder.h.

◆ ToVector

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Constructor & Destructor Documentation

◆ ROIFinder()

ROIFinder ( )

Constructor for adding the subfindlets.

Definition at line 30 of file ROIFinder.cc.

31{
32}

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener * psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 53 of file CompositeProcessingSignalListener.cc.

56{
58}
Interface for a minimal algorithm part that wants to expose some parameters to a module.
Definition Findlet.h:26

◆ apply()

void apply ( const std::vector< SpacePointTrackCand > & finalTracks)
override

Function to call all the sub-findlets.

Loop over both PXD layer

Loop over all ladders of layer

Loop over both modules of a ladder

Lower left corner

Upper right corner

Definition at line 180 of file ROIFinder.cc.

181{
182 // If no ROIs shall be calculated, return rightaway and don't do anything
183 if (not m_calculateROI) {
184 return;
185 }
186
187 for (auto& track : finalTracks) {
188 // do nothing if the SpacePointTrackCand is not active
189 if (!track.hasRefereeStatus(SpacePointTrackCand::c_isActive)) {
190 continue;
191 }
192
193 QualityEstimationResults refittedTrackEstimate;
194 if (m_refit) {
195 auto sortedHits = track.getSortedHits();
196
197 if (m_addVirtualIP) {
198 SpacePoint virtualIPSpacePoint = SpacePoint(m_BeamSpotPosition, m_BeamSpotPositionError, {0.5, 0.5}, {false, false},
200 sortedHits.push_back(&virtualIPSpacePoint);
201 }
202
203 std::sort(sortedHits.begin(), sortedHits.end(),
204 [](const SpacePoint * a, const SpacePoint * b) {return a->getPosition().Perp() < b->getPosition().Perp(); });
205
206 refittedTrackEstimate = m_estimator->estimateQualityAndProperties(sortedHits);
207 }
208
209 std::vector<PXDIntercept> thisTracksIntercepts;
210 thisTracksIntercepts.reserve(8);
211
212 B2Vector3D momentumEstimate = track.getMomSeed();
213 if (m_refit) {
214 momentumEstimate = *refittedTrackEstimate.p;
215 }
216
217 const double trackPhi = momentumEstimate.Phi();
218 const double trackTheta = momentumEstimate.Theta();
219 const double tanTrackLambda = tan(M_PI_2 - trackTheta);
220 const double trackRadius = momentumEstimate.Perp() / (0.00299792458 * m_bFieldZ) ;
221 const double trackCharge = track.getChargeSeed();
222
224 for (int layer = 1; layer <= 2; layer++) {
225 const double sensorPerpRadius = c_layerRadius[layer - 1];
226
228 for (int ladder = 1; ladder <= (layer == 1 ? 8 : 12); ladder++) {
229 const double sensorPhi = (layer == 1) ? c_ladderPhiL1[ladder - 1] : c_ladderPhiL2[ladder - 1];
230 const double rotatedBeamSpotX = m_BeamSpotPosition.X() * cos(sensorPhi) + m_BeamSpotPosition.Y() * sin(sensorPhi);
231 const double rotatedBeamSpotY = -m_BeamSpotPosition.X() * sin(sensorPhi) + m_BeamSpotPosition.Y() * cos(sensorPhi);
232
233 // in the rotated coordinate the sensor is perpendicular to the x axis at position sensorLocalX
234 const double sensorLocalX = sensorPerpRadius - rotatedBeamSpotX;
235
236 double phiDiff = trackPhi - sensorPhi;
237 if (phiDiff < -M_PI) {
238 phiDiff += 2. * M_PI;
239 }
240 if (phiDiff > M_PI) {
241 phiDiff -= 2. * M_PI;
242 }
243
244 // Don't try to extrapolate if track direction and sensor are too different (in phi)
245 // this should speed up the calculation as wrong combinations are not checked at all.
246 // Two values to check both the outgoing (0.3) and incoming (0.8) arm.
247 if (fabs(phiDiff) > 0.25 * M_PI and fabs(phiDiff) < 0.75 * M_PI) {
248 continue;
249 }
250 if (fabs(phiDiff) > 0.75 * M_PI and fabs(tanTrackLambda) > 0.2 /*and fabs(trackRadius) > 20*/) {
251 continue;
252 }
253
254
255 // relative phi value of the track center compared to the rotated
256 // coordinate system defined by the (rotated) line perpendicular
257 // to the sensor (with length sensorPerpRadius)
258 double relTrackCenterPhi = 0;
259 if (trackCharge < 0) {
260 relTrackCenterPhi = trackPhi - M_PI_2 - sensorPhi;
261 } else if (trackCharge > 0) {
262 relTrackCenterPhi = trackPhi + M_PI_2 - sensorPhi;
263 }
264 const double xCenter = trackRadius * cos(relTrackCenterPhi);
265 const double yCenter = trackRadius * sin(relTrackCenterPhi);
266
267 // continue if radicant of sqrt is negative
268 if ((trackRadius * trackRadius - (sensorLocalX - xCenter) * (sensorLocalX - xCenter)) < 0) {
269 continue;
270 }
271 const double ytmp = sqrt(trackRadius * trackRadius - (sensorLocalX - xCenter) * (sensorLocalX - xCenter));
272 const double yplus = yCenter + ytmp + rotatedBeamSpotY;
273 const double yminus = yCenter - ytmp + rotatedBeamSpotY;
274
275 const double correctionterm = ((layer == 1 ? m_radiusCorrectionFactorL1 : m_radiusCorrectionFactorL2) * trackCharge /
276 trackRadius) +
277 m_sinPhiCorrectionFactor * sin(trackPhi) +
278 m_cosPhiCorrectionFactor * cos(trackPhi);
279
280 const double localUPositionPlus = yplus - c_shiftY + correctionterm;
281 const double localUPositionMinus = yminus - c_shiftY + correctionterm;
282 const double toleranceRPhi = m_tolerancePhi * sensorLocalX;
283
284 // if the hit for sure is out of reach of the current ladder, continue
285 if (not(yplus >= c_sensorMinY - toleranceRPhi and yplus <= c_sensorMaxY + toleranceRPhi) and
286 not(yminus >= c_sensorMinY - toleranceRPhi and yminus <= c_sensorMaxY + toleranceRPhi)) {
287 continue;
288 }
289
290 // estimate the z coordinate of the extrapolation on this layer
291 const double z = sensorLocalX * tanTrackLambda - m_BeamSpotPosition.Z();
292 const double zPlus = sqrt(sensorLocalX * sensorLocalX + yplus * yplus) * tanTrackLambda * m_zPositionCorrectionFactor -
294 const double zMinus = sqrt(sensorLocalX * sensorLocalX + yminus * yminus) * tanTrackLambda * m_zPositionCorrectionFactor -
296
298 for (int sensor = 1; sensor <= 2; sensor++) {
299
300 const double shiftZ = (layer == 1) ? c_centerZShiftLayer1[sensor - 1] : c_centerZShiftLayer2[sensor - 1];
301
302 double localVPosition = z - shiftZ;
303 double localVPositionPlus = zPlus - shiftZ;
304 double localVPositionMinus = zMinus - shiftZ;
305 // check whether z intersection possibly is on sensor to be checked, only continue with the rest of calculations if that's the case
306 if (localVPosition >= ((-c_activeSensorLength[layer - 1] / 2.0) - m_toleranceZ) and
307 localVPosition <= ((c_activeSensorLength[layer - 1] / 2.0) + m_toleranceZ)) {
308
309 const VxdID sensorID = VxdID(layer, ladder, sensor);
310
311 // check for first option of the intersection
312 if (localUPositionPlus >= -c_activeSensorWidth / 2.0 - toleranceRPhi and
313 localUPositionPlus <= c_activeSensorWidth / 2.0 + toleranceRPhi) {
314 PXDIntercept intercept;
315 intercept.setCoorU(localUPositionPlus);
316 intercept.setCoorV(localVPositionPlus);
317 intercept.setVxdID(sensorID);
318 m_storePXDIntercepts.appendNew(intercept);
319 thisTracksIntercepts.push_back(intercept);
320 }
321 // check for second option of the intersection
322 if (localUPositionMinus >= -c_activeSensorWidth / 2.0 - toleranceRPhi and
323 localUPositionMinus <= c_activeSensorWidth / 2.0 + toleranceRPhi) {
324 PXDIntercept intercept;
325 intercept.setCoorU(localUPositionMinus);
326 intercept.setCoorV(localVPositionMinus);
327 intercept.setVxdID(sensorID);
328 m_storePXDIntercepts.appendNew(intercept);
329 thisTracksIntercepts.push_back(intercept);
330 }
331 }
332 }
333 }
334 }
335
336 const double omega = 1. / trackRadius;
337 unsigned short uSizeL1 = (unsigned short)(m_multiplierUL1 * omega + m_minimumROISizeUL1);
338 unsigned short uSizeL2 = (unsigned short)(m_multiplierUL2 * omega + m_minimumROISizeUL2);
339 unsigned short vSizeL1 = (unsigned short)((1. + fabs(tanTrackLambda) * m_multiplierVL1) * m_minimumROISizeVL1);
340 unsigned short vSizeL2 = (unsigned short)((1. + fabs(tanTrackLambda) * m_multiplierVL2) * m_minimumROISizeVL2);
341 for (auto& intercept : thisTracksIntercepts) {
342 const VxdID& interceptSensorID = intercept.getSensorID();
343
344 double uCoordinate = intercept.getCoorU();
345 double vCoordinate = intercept.getCoorV();
346
347 const PXD::SensorInfo* currentSensor = dynamic_cast<const PXD::SensorInfo*>(&VXD::GeoCache::getInstance().getSensorInfo(
348 interceptSensorID));
349
350 int interceptUCell = currentSensor->getUCellID(uCoordinate, vCoordinate, false);
351 int interceptVCell = currentSensor->getVCellID(vCoordinate, false);
352 int nUCells = currentSensor->getUCells();
353 int nVCells = currentSensor->getVCells();
354
355 unsigned short uSize = (interceptSensorID.getLayerNumber() == 1 ? uSizeL1 : uSizeL2);
356 unsigned short vSize = (interceptSensorID.getLayerNumber() == 1 ? vSizeL1 : vSizeL2);
357 if (uSize > m_maximumROISizeU) {
358 uSize = m_maximumROISizeU;
359 }
360 if (vSize > m_maximumROISizeV) {
361 vSize = m_maximumROISizeV;
362 }
363
365 short uCellDownLeft = interceptUCell - uSize / 2;
366 short vCellDownLeft = interceptVCell - vSize / 2;
367
369 short uCellUpRight = interceptUCell + uSize / 2;
370 short vCellUpRight = interceptVCell + vSize / 2;
371
372 if (uCellDownLeft >= nUCells or vCellDownLeft >= nVCells or uCellUpRight < 0 or vCellUpRight < 0) {
373 continue;
374 }
375
376 if (uCellDownLeft < 0) {
377 uCellDownLeft = 0;
378 }
379 if (vCellDownLeft < 0) {
380 vCellDownLeft = 0;
381 }
382
383 // minimum cell id is 0, maximum is nCells - 1
384 if (uCellUpRight >= nUCells) {
385 uCellUpRight = nUCells - 1;
386 }
387 if (vCellUpRight >= nVCells) {
388 vCellUpRight = nVCells - 1;
389 }
390
391 m_storeROIs.appendNew(ROIid(uCellDownLeft, uCellUpRight, vCellDownLeft, vCellUpRight, interceptSensorID));
392 }
393
394 }
395}
DataType Phi() const
The azimuth angle.
Definition B2Vector3.h:151
DataType Theta() const
The polar angle.
Definition B2Vector3.h:153
DataType Perp() const
The transverse component (R in cylindrical coordinate system).
Definition B2Vector3.h:200
@ c_isActive
bit 11: SPTC is active (i.e.
void setVxdID(VxdID::baseType user_vxdID)
set the sensor ID
void setCoorU(double user_coorU)
set the U coordinate of the intercept
void setCoorV(double user_coorV)
set the V coordinate of the intercept
double getCoorV() const
return the V coordinate of the intercept
VxdID::baseType getSensorID() const
return the sensor ID
double getCoorU() const
return the U coordinate of the intercept
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a reference to the SensorInfo of a given SensorID.
Definition GeoCache.cc:67
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition GeoCache.cc:214
int getVCells() const
Return number of pixel/strips in v direction.
@ VXD
Any type of VXD Sensor.
int getUCells() const
Return number of pixel/strips in u direction.
int getVCellID(double v, bool clamp=false) const
Return the corresponding pixel/strip ID of a given v coordinate.
int getUCellID(double u, double v=0, bool clamp=false) const
Return the corresponding pixel/strip ID of a given u coordinate.
baseType getLayerNumber() const
Get the layer id.
Definition VxdID.h:95
double m_radiusCorrectionFactorL2
Correction factor for radial bias for L2: factor * charge / radius.
Definition ROIFinder.h:95
unsigned short m_maximumROISizeV
maximum ROI size in v in pixel
Definition ROIFinder.h:130
double m_minimumROISizeUL1
Minimum size of ROI in u-direction on L1 in pixel.
Definition ROIFinder.h:107
const double c_ladderPhiL2[12]
Phi values of the ladders of L2.
Definition ROIFinder.h:156
B2Vector3D m_BeamSpotPosition
B2Vector3D actually containing the BeamSpot position. This will be used as the starting point of the ...
Definition ROIFinder.h:163
bool m_calculateROI
Calculate ROI in this findlet?
Definition ROIFinder.h:58
double m_multiplierVL1
Multiplier term for v-direction on L1.
Definition ROIFinder.h:123
double m_radiusCorrectionFactorL1
Correction factor for radial bias for L1: factor * charge / radius.
Definition ROIFinder.h:93
const double c_centerZShiftLayer2[2]
Shift of the center of the active area of each sensor in a ladder of layer 2 For use of mhp_z > (leng...
Definition ROIFinder.h:139
double m_minimumROISizeVL2
Minimum size of ROI in v-direction on L2 in pixel.
Definition ROIFinder.h:113
double m_multiplierUL2
Multiplier term for u-direction on L2.
Definition ROIFinder.h:121
const double c_centerZShiftLayer1[2]
Shift of the center of the active area of each sensor in a ladder of layer 1 For use of mhp_z > (leng...
Definition ROIFinder.h:136
double m_multiplierVL2
Multiplier term for v-direction on L2.
Definition ROIFinder.h:125
StoreArray< ROIid > m_storeROIs
ROIs StoreArray.
Definition ROIFinder.h:68
double m_sinPhiCorrectionFactor
Correction factor for the sin(phi) modulation.
Definition ROIFinder.h:97
const double c_activeSensorLength[2]
Length of the active region for L1 and L2.
Definition ROIFinder.h:152
const double c_sensorMaxY
Maximum y coordinate if x-axis is perpendicular to the sensor:
Definition ROIFinder.h:144
const double c_ladderPhiL1[8]
Phi values of the ladders of L1.
Definition ROIFinder.h:154
double m_tolerancePhi
Allowed tolerance (in radians) phi to create intercepts per sensor.
Definition ROIFinder.h:84
const double c_layerRadius[2]
Radius of the two layers.
Definition ROIFinder.h:150
bool m_addVirtualIP
Add a virtual IP for the refit?
Definition ROIFinder.h:74
StoreArray< PXDIntercept > m_storePXDIntercepts
PXDIntercepts StoreArray.
Definition ROIFinder.h:66
B2Vector3D m_BeamSpotPositionError
B2Vector3D actually containing the BeamSpot position error.
Definition ROIFinder.h:165
bool m_refit
Refit the tracks with m_ROIFitMethod.
Definition ROIFinder.h:72
double m_zPositionCorrectionFactor
Correction factor for the z position.
Definition ROIFinder.h:102
double m_cosPhiCorrectionFactor
Correction factor for the cos(phi) modulation.
Definition ROIFinder.h:99
std::unique_ptr< QualityEstimatorBase > m_estimator
pointer to the selected QualityEstimator
Definition ROIFinder.h:79
double m_bFieldZ
BField in Tesla.
Definition ROIFinder.h:159
double m_minimumROISizeVL1
Minimum size of ROI in v-direction on L1 in pixel.
Definition ROIFinder.h:109
const double c_shiftY
Shift of the center position in y if the x-axis is perpendicular to the sensor:
Definition ROIFinder.h:148
const double c_sensorMinY
PXD is shifted to create the windmill structure.
Definition ROIFinder.h:142
double m_minimumROISizeUL2
Minimum size of ROI in u-direction on L2 in pixel.
Definition ROIFinder.h:111
unsigned short m_maximumROISizeU
maximum ROI size in u in pixel
Definition ROIFinder.h:128
double m_multiplierUL1
Multiplier term in ROI size estimation For u: size = multiplier * 1/R + minimumROISize For v: size = ...
Definition ROIFinder.h:119
double m_toleranceZ
Allowed tolerance (in cm) in z to create intercepts per sensor.
Definition ROIFinder.h:86
const double c_activeSensorWidth
PXD sensors in L1 and L2 have the same size in u direction (=width):
Definition ROIFinder.h:146
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition B2Vector3.h:516
double tan(double a)
tan for double
Definition beamHelpers.h:31
double sqrt(double a)
sqrt for double
Definition beamHelpers.h:28
std::optional< B2Vector3D > p
momentum vector estimate from the QE

◆ beginEvent()

void beginEvent ( )
overridevirtual

Clear the object pools.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 170 of file ROIFinder.cc.

171{
172 // If no ROIs shall be calculated, return rightaway and don't do anything
173 if (not m_calculateROI) {
174 return;
175 }
176
178}

◆ beginRun()

void beginRun ( )
overridevirtual

Initialize the BField.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 146 of file ROIFinder.cc.

147{
148 // If no ROIs shall be calculated, return rightaway and don't do anything
149 if (not m_calculateROI) {
150 return;
151 }
152
154
156 m_estimator->setMagneticFieldStrength(m_bFieldZ);
157
158 DBObjPtr<BeamSpot> beamSpotDB;
159 if (beamSpotDB.isValid()) {
160 m_BeamSpotPosition = (*beamSpotDB).getIPPosition();
161 const TMatrixDSym posErr = (*beamSpotDB).getIPPositionCovMatrix();
162 m_BeamSpotPositionError.SetXYZ(sqrt(posErr[0][0]), sqrt(posErr[1][1]), sqrt(posErr[2][2]));
163 } else {
164 m_BeamSpotPosition.SetXYZ(0., 0., 0.);
165 m_BeamSpotPositionError.SetXYZ(0., 0., 0.);
166 }
167}
bool isValid() const
Check whether a valid object was obtained from the database.
static const double T
[tesla]
Definition Unit.h:120
static void getField(const double *pos, double *field)
return the magnetic field at a given position.

◆ endRun()

void endRun ( )
overrideinherited

Receive and dispatch signal for the end of the run.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

40{
42 psl->endRun();
43 }
45}
void endRun() override
Receive and dispatch signal for the end of the run.
virtual void endRun()
Receive signal for the end of the run.

◆ exposeParameters()

void exposeParameters ( ModuleParamList * moduleParamList,
const std::string & prefix )
overridevirtual

Expose the parameters of the sub findlets.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 34 of file ROIFinder.cc.

35{
36 Super::exposeParameters(moduleParamList, prefix);
37
38 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "calculateROI"), m_calculateROI,
39 "Calculate PXDIntercepts and ROIs in this findlet based on a simple circle extrapolation (r-phi) and straight line extrapolation (z, theta)?",
41
42 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "storePXDInterceptsName"), m_storePXDInterceptsName,
43 "Name of the PXDIntercepts StoreArray produced by SVDHoughTracking using a simple circle extrapolation in r-phi and a straight line extrapolation in theta.",
45
46 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "storeROIsName"), m_storeROIsName,
47 "Name of the ROIs StoreArray produced by SVDHoughTracking using a simple circle extrapolation in r-phi and a straight line extrapolation in theta.",
49
50 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "tolerancePhi"), m_tolerancePhi,
51 "Allowed tolerance in phi (in radians) (for ROI calculation in u direction). If the intercept is within this range of the active region, an intercept is created.",
53 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "toleranceZ"), m_toleranceZ,
54 "Allowed tolerance in z (in cm) (for ROI calculation in v direction). If the intercept is within this range of the active region of a sensor, an intercept is created.",
56
57 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "radiusCorrectionFactorL1"), m_radiusCorrectionFactorL1,
58 "Correct charge-dependent bias of the extrapolated hit on L1 with radiusCorrectionFactor * trackCharge / trackRadius.",
60 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "radiusCorrectionFactorL2"), m_radiusCorrectionFactorL2,
61 "Correct charge-dependent bias of the extrapolated hit on L2 with radiusCorrectionFactor * trackCharge / trackRadius.",
63 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "sinPhiCorrectionFactor"), m_sinPhiCorrectionFactor,
64 "Correct sin(trackPhi) dependent bias with sinPhiCorrectionFactor * sin(trackPhi).",
66 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "cosPhiCorrectionFactor"), m_cosPhiCorrectionFactor,
67 "Correct cos(trackPhi) dependent bias with cosPhiCorrectionFactor * cos(trackPhi).",
69
70 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "zPositionCorrectionFactor"), m_zPositionCorrectionFactor,
71 "Correction factor for the extrapolated z position.",
73
74 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minimumROISizeUL1"), m_minimumROISizeUL1,
75 "Minimum ROI size (in pixel) in u direction on L1.", m_minimumROISizeUL1);
76 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minimumROISizeVL1"), m_minimumROISizeVL1,
77 "Minimum ROI size (in pixel) in v direction on L1.", m_minimumROISizeVL1);
78 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minimumROISizeUL2"), m_minimumROISizeUL2,
79 "Minimum ROI size (in pixel) in u direction on L2.", m_minimumROISizeUL2);
80 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minimumROISizeVL2"), m_minimumROISizeVL2,
81 "Minimum ROI size (in pixel) in v direction on L2.", m_minimumROISizeVL2);
82
83 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "multiplierUL1"), m_multiplierUL1,
84 "Multiplier term for ROI size estimation for L1 u direction. Usage: multiplierUL1 * 1/R + minimumROISizeUL1, with R in cm.",
86 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "multiplierUL2"), m_multiplierUL2,
87 "Multiplier term for ROI size estimation for L2 u direction. Usage: multiplierUL2 * 1/R + minimumROISizeUL2, with R in cm.",
89 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "multiplierVL1"), m_multiplierVL1,
90 "Multiplier term for ROI size estimation for L1 v direction. Usage: (1 + abs(tan(lambda)) * multiplierVL1) + minimumROISizeVL1.",
92 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "multiplierVL2"), m_multiplierVL2,
93 "Multiplier term for ROI size estimation for L2 v direction. Usage: (1 + abs(tan(lambda)) * multiplierVL2) + minimumROISizeVL2.",
95
96 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "maximumROISizeU"), m_maximumROISizeU,
97 "Maximum ROI size in u.", m_maximumROISizeU);
98 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "maximumROISizeV"), m_maximumROISizeV,
99 "Maximum ROI size in v.", m_maximumROISizeV);
100
101
102 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "refit"), m_refit,
103 "Refit the track with trackQualityEstimationMethod?", m_refit);
104 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "addVirtualIP"), m_addVirtualIP,
105 "Add virtual IP to fit the tracks again for ROI creation?", m_addVirtualIP);
106 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "ROIFitMethod"), m_ROIFitMethod,
107 "Identifier which fit method to use. Valid identifiers are: [circleFit, tripletFit, helixFit]",
109
110}
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
std::string m_ROIFitMethod
Refit with this estimator, options are circleFit, tripletFit, helixFit.
Definition ROIFinder.h:76
std::string m_storeROIsName
Name of the ROIs StoreArray.
Definition ROIFinder.h:64
std::string m_storePXDInterceptsName
Name of the PXDIntercepts StoreArray.
Definition ROIFinder.h:62
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.

◆ getDescription() [1/2]

virtual std::string getDescription ( )
inlinevirtualinherited

Brief description of the purpose of the concrete findlet.

Definition at line 60 of file Findlet.h.

61 {
62 return "(no description)";
63 }

◆ getDescription() [2/2]

virtual std::string getDescription ( )
inlinevirtualinherited

Brief description of the purpose of the concrete findlet.

Definition at line 60 of file Findlet.h.

61 {
62 return "(no description)";
63 }

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 56 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
overridevirtual

Initialize the StoreArrays.

Create the store arrays.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 113 of file ROIFinder.cc.

114{
115 // If no ROIs shall be calculated, return rightaway and don't do anything
116 if (not m_calculateROI) {
117 return;
118 }
119
121
123 m_storeROIs.registerInDataStore(m_storeROIsName);
124
127 m_multiplierUL1 < 0 or m_multiplierUL2 < 0 or
128 m_multiplierVL1 < 0 or m_multiplierVL2 < 0 or
129 m_tolerancePhi < 0 or m_toleranceZ < 0) {
130 B2ERROR("Please check the ROI size parameters. "
131 "None of minimumROISizeUL1, minimumROISizeUL2, minimumROISizeVL1, minimumROISizeVL2, "
132 "multiplierUL1, multiplierUL2, multiplierVL1, multiplierVL2, overlapU, overlapV must be < 0!");
133 }
134
135 if (m_ROIFitMethod == "tripletFit") {
136 m_estimator = std::make_unique<QualityEstimatorTripletFit>();
137 } else if (m_ROIFitMethod == "circleFit") {
138 m_estimator = std::make_unique<QualityEstimatorCircleFit>();
139 } else if (m_ROIFitMethod == "helixFit") {
140 m_estimator = std::make_unique<QualityEstimatorRiemannHelixFit>();
141 }
142 B2ASSERT("QualityEstimator could not be initialized with method: " << m_ROIFitMethod, m_estimator);
143
144};

◆ terminate()

void terminate ( )
overrideinherited

Receive and dispatch Signal for termination of the event processing.

Definition at line 42 of file CompositeProcessingSignalListener.cc.

48{
50 psl->terminate();
51 }
53}
void terminate() override
Receive and dispatch Signal for termination of the event processing.
virtual void terminate()
Receive Signal for termination of the event processing.

Member Data Documentation

◆ c_activeSensorLength

const double c_activeSensorLength[2] = {4.48, 6.144}
private

Length of the active region for L1 and L2.

Definition at line 152 of file ROIFinder.h.

152{4.48, 6.144};

◆ c_activeSensorWidth

const double c_activeSensorWidth = (c_sensorMaxY - c_sensorMinY)
private

PXD sensors in L1 and L2 have the same size in u direction (=width):

Definition at line 146 of file ROIFinder.h.

◆ c_centerZShiftLayer1

const double c_centerZShiftLayer1[2] = {3.68255, -0.88255}
private

Shift of the center of the active area of each sensor in a ladder of layer 1 For use of mhp_z > (length/-2)+shiftZ && mhp_z < (length/2)+shiftZ.

Definition at line 136 of file ROIFinder.h.

136{3.68255, -0.88255};

◆ c_centerZShiftLayer2

const double c_centerZShiftLayer2[2] = {5.01455, -1.21455}
private

Shift of the center of the active area of each sensor in a ladder of layer 2 For use of mhp_z > (length/-2)+shiftZ && mhp_z < (length/2)+shiftZ.

Definition at line 139 of file ROIFinder.h.

139{5.01455, -1.21455};

◆ c_ladderPhiL1

const double c_ladderPhiL1[8] = {0., 0.25 * M_PI, M_PI_2, 0.75 * M_PI, M_PI, -0.75 * M_PI, -M_PI_2, -0.25 * M_PI}
private

Phi values of the ladders of L1.

Definition at line 154 of file ROIFinder.h.

154{0., 0.25 * M_PI, M_PI_2, 0.75 * M_PI, M_PI, -0.75 * M_PI, -M_PI_2, -0.25 * M_PI};

◆ c_ladderPhiL2

const double c_ladderPhiL2[12] = {0., 1. / 6. * M_PI, 1. / 3. * M_PI, M_PI_2, 2. / 3. * M_PI, 5. / 6. * M_PI, M_PI, -5. / 6. * M_PI, -2. / 3. * M_PI, -M_PI_2, -1. / 3. * M_PI, -1. / 6. * M_PI}
private

Phi values of the ladders of L2.

Definition at line 156 of file ROIFinder.h.

156{0., 1. / 6. * M_PI, 1. / 3. * M_PI, M_PI_2, 2. / 3. * M_PI, 5. / 6. * M_PI, M_PI, -5. / 6. * M_PI, -2. / 3. * M_PI, -M_PI_2, -1. / 3. * M_PI, -1. / 6. * M_PI};

◆ c_layerRadius

const double c_layerRadius[2] = {1.42854, 2.21218}
private

Radius of the two layers.

Definition at line 150 of file ROIFinder.h.

150{1.42854, 2.21218};

◆ c_sensorMaxY

const double c_sensorMaxY = 0.89
private

Maximum y coordinate if x-axis is perpendicular to the sensor:

Definition at line 144 of file ROIFinder.h.

◆ c_sensorMinY

const double c_sensorMinY = -0.36
private

PXD is shifted to create the windmill structure.

Minimum y coordinate if x-axis is perpendicular to the sensor:

Definition at line 142 of file ROIFinder.h.

◆ c_shiftY

const double c_shiftY = (c_sensorMaxY + c_sensorMinY) / 2.0
private

Shift of the center position in y if the x-axis is perpendicular to the sensor:

Definition at line 148 of file ROIFinder.h.

◆ m_addVirtualIP

bool m_addVirtualIP = true
private

Add a virtual IP for the refit?

Definition at line 74 of file ROIFinder.h.

◆ m_BeamSpotPosition

B2Vector3D m_BeamSpotPosition
private

B2Vector3D actually containing the BeamSpot position. This will be used as the starting point of the extrapolation.

Definition at line 163 of file ROIFinder.h.

◆ m_BeamSpotPositionError

B2Vector3D m_BeamSpotPositionError
private

B2Vector3D actually containing the BeamSpot position error.

Definition at line 165 of file ROIFinder.h.

◆ m_bFieldZ

double m_bFieldZ = 1.5
private

BField in Tesla.

Definition at line 159 of file ROIFinder.h.

◆ m_calculateROI

bool m_calculateROI = false
private

Calculate ROI in this findlet?

Definition at line 58 of file ROIFinder.h.

◆ m_cosPhiCorrectionFactor

double m_cosPhiCorrectionFactor = 0.0
private

Correction factor for the cos(phi) modulation.

Definition at line 99 of file ROIFinder.h.

◆ m_estimator

std::unique_ptr<QualityEstimatorBase> m_estimator
private

pointer to the selected QualityEstimator

Definition at line 79 of file ROIFinder.h.

◆ m_initialized

bool m_initialized
privateinherited

Flag to keep track whether initialization happened before.

Definition at line 52 of file ProcessingSignalListener.h.

◆ m_initializedAs

std::string m_initializedAs
privateinherited

Name of the type during initialisation.

Definition at line 58 of file ProcessingSignalListener.h.

◆ m_maximumROISizeU

unsigned short m_maximumROISizeU = 100
private

maximum ROI size in u in pixel

Definition at line 128 of file ROIFinder.h.

◆ m_maximumROISizeV

unsigned short m_maximumROISizeV = 100
private

maximum ROI size in v in pixel

Definition at line 130 of file ROIFinder.h.

◆ m_minimumROISizeUL1

double m_minimumROISizeUL1 = 40
private

Minimum size of ROI in u-direction on L1 in pixel.

Definition at line 107 of file ROIFinder.h.

◆ m_minimumROISizeUL2

double m_minimumROISizeUL2 = 35
private

Minimum size of ROI in u-direction on L2 in pixel.

Definition at line 111 of file ROIFinder.h.

◆ m_minimumROISizeVL1

double m_minimumROISizeVL1 = 40
private

Minimum size of ROI in v-direction on L1 in pixel.

Definition at line 109 of file ROIFinder.h.

◆ m_minimumROISizeVL2

double m_minimumROISizeVL2 = 30
private

Minimum size of ROI in v-direction on L2 in pixel.

Definition at line 113 of file ROIFinder.h.

◆ m_multiplierUL1

double m_multiplierUL1 = 500
private

Multiplier term in ROI size estimation For u: size = multiplier * 1/R + minimumROISize For v: size = (1 + abs(tan(lambda)) * multiplier) + minimumROISize Multiplier term for u-direction on L1.

Definition at line 119 of file ROIFinder.h.

◆ m_multiplierUL2

double m_multiplierUL2 = 600
private

Multiplier term for u-direction on L2.

Definition at line 121 of file ROIFinder.h.

◆ m_multiplierVL1

double m_multiplierVL1 = 0.8
private

Multiplier term for v-direction on L1.

Definition at line 123 of file ROIFinder.h.

◆ m_multiplierVL2

double m_multiplierVL2 = 0.8
private

Multiplier term for v-direction on L2.

Definition at line 125 of file ROIFinder.h.

◆ m_radiusCorrectionFactorL1

double m_radiusCorrectionFactorL1 = -2.0
private

Correction factor for radial bias for L1: factor * charge / radius.

Definition at line 93 of file ROIFinder.h.

◆ m_radiusCorrectionFactorL2

double m_radiusCorrectionFactorL2 = -5.0
private

Correction factor for radial bias for L2: factor * charge / radius.

Definition at line 95 of file ROIFinder.h.

◆ m_refit

bool m_refit = true
private

Refit the tracks with m_ROIFitMethod.

Definition at line 72 of file ROIFinder.h.

◆ m_ROIFitMethod

std::string m_ROIFitMethod = "helixFit"
private

Refit with this estimator, options are circleFit, tripletFit, helixFit.

Definition at line 76 of file ROIFinder.h.

◆ m_sinPhiCorrectionFactor

double m_sinPhiCorrectionFactor = 0.0
private

Correction factor for the sin(phi) modulation.

Definition at line 97 of file ROIFinder.h.

◆ m_storePXDIntercepts

StoreArray<PXDIntercept> m_storePXDIntercepts
private

PXDIntercepts StoreArray.

Definition at line 66 of file ROIFinder.h.

◆ m_storePXDInterceptsName

std::string m_storePXDInterceptsName = "SVDHoughPXDIntercepts"
private

Name of the PXDIntercepts StoreArray.

Definition at line 62 of file ROIFinder.h.

◆ m_storeROIs

StoreArray<ROIid> m_storeROIs
private

ROIs StoreArray.

Definition at line 68 of file ROIFinder.h.

◆ m_storeROIsName

std::string m_storeROIsName = "SVDHoughROIs"
private

Name of the ROIs StoreArray.

Definition at line 64 of file ROIFinder.h.

◆ m_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 60 of file CompositeProcessingSignalListener.h.

◆ m_terminated

bool m_terminated
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.

◆ m_tolerancePhi

double m_tolerancePhi = 0.15
private

Allowed tolerance (in radians) phi to create intercepts per sensor.

Definition at line 84 of file ROIFinder.h.

◆ m_toleranceZ

double m_toleranceZ = 0.5
private

Allowed tolerance (in cm) in z to create intercepts per sensor.

Definition at line 86 of file ROIFinder.h.

◆ m_zPositionCorrectionFactor

double m_zPositionCorrectionFactor = 1.0
private

Correction factor for the z position.

Definition at line 102 of file ROIFinder.h.


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