Belle II Software development
DistanceSVDPairFilter.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <tracking/ckf/svd/filters/relations/DistanceSVDPairFilter.h>
9#include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
10
11#include <tracking/spacePointCreation/SpacePoint.h>
12
13#include <cmath>
14
15using namespace Belle2;
16using namespace TrackFindingCDC;
17
18TrackFindingCDC::Weight
19DistanceSVDPairFilter::operator()(const std::pair<const CKFToSVDState*, const CKFToSVDState*>& relation)
20{
21 const CKFToSVDState& fromState = *(relation.first);
22 const CKFToSVDState& toState = *(relation.second);
23
24 const CKFToSVDState::stateCache& fromStateCache = fromState.getStateCache();
25 const CKFToSVDState::stateCache& toStateCache = toState.getStateCache();
26
27 B2ASSERT("You have filled the wrong states into this!", toStateCache.isHitState);
28
29 float phiDiff = fromStateCache.phi - toStateCache.phi;
30 while (phiDiff > M_PI) phiDiff -= 2. * M_PI;
31 while (phiDiff < -M_PI) phiDiff += 2. * M_PI;
32
33 if (not fromStateCache.isHitState) {
34 // We are coming from a CDC track, so we can use its position to only look for matching ladders
35 if (std::abs(phiDiff) < 0.2f and std::abs(fromStateCache.theta - toStateCache.theta) < 0.2f) {
36 return 1.0;
37 }
38 // If the current state (fromState) is a RecoTrack-based state, but no relations could be created
39 // don't proceed but return
40 return NAN;
41 }
42
43 if (fromStateCache.geoLayer == toStateCache.geoLayer and
44 fromStateCache.sensorID.getSensorNumber() == toStateCache.sensorID.getSensorNumber()) {
45 // TODO: Checking for equality of sensor numbers seems not to harm the hit efficiency,
46 // but maybe it's safer to allow for a sensor number difference of 1?
47 return 1.0;
48 }
49
50 if (std::abs(phiDiff) < 0.2f) {
51 return 1.0;
52 }
53
54 return NAN;
55}
Specialized CKF State for extrapolating into the SVD.
const struct stateCache & getStateCache() const
Get the cached data of this state.
TrackFindingCDC::Weight operator()(const std::pair< const CKFToSVDState *, const CKFToSVDState * > &relation) override
Return the weight based on azimuthal-angle separation.
baseType getSensorNumber() const
Get the sensor id.
Definition VxdID.h:100
Abstract base class for different kinds of events.