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
13using namespace Belle2;
14using namespace TrackFindingCDC;
15
16TrackFindingCDC::Weight
17DistanceSVDPairFilter::operator()(const std::pair<const CKFToSVDState*, const CKFToSVDState*>& relation)
18{
19 const CKFToSVDState& fromState = *(relation.first);
20 const CKFToSVDState& toState = *(relation.second);
21
22 const CKFToSVDState::stateCache& fromStateCache = fromState.getStateCache();
23 const CKFToSVDState::stateCache& toStateCache = toState.getStateCache();
24
25 B2ASSERT("You have filled the wrong states into this!", toStateCache.isHitState);
26
27 float phiDiff = fromStateCache.phi - toStateCache.phi;
28 while (phiDiff > M_PI) phiDiff -= 2. * M_PI;
29 while (phiDiff < -M_PI) phiDiff += 2. * M_PI;
30
31 if (not fromStateCache.isHitState) {
32 // We are coming from a CDC track, so we can use its position to only look for matching ladders
33 if (fabs(phiDiff) < 0.2f and fabs(fromStateCache.theta - toStateCache.theta) < 0.2f) {
34 return 1.0;
35 }
36 // If the current state (fromState) is a RecoTrack-based state, but no relations could be created
37 // don't proceed but return
38 return NAN;
39 }
40
41 if (fromStateCache.geoLayer == toStateCache.geoLayer and
42 fromStateCache.sensorID.getSensorNumber() == toStateCache.sensorID.getSensorNumber()) {
43 // TODO: Checking for equality of sensor numbers seems not to harm the hit efficiency,
44 // but maybe it's safer to allow for a sensor number difference of 1?
45 return 1.0;
46 }
47
48 if (abs(phiDiff) < 0.2f) {
49 return 1.0;
50 }
51
52 return NAN;
53}
Specialized CKF State for extrapolating into the SVD.
Definition: CKFToSVDState.h:27
const struct stateCache & getStateCache() const
Get the cached data of this state.
Definition: CKFToSVDState.h:54
TrackFindingCDC::Weight operator()(const std::pair< const CKFToSVDState *, const CKFToSVDState * > &relation) override
Return the weight based on azimuthal-angle separation.
Abstract base class for different kinds of events.