Belle II Software  release-08-01-10
DistancePXDPairFilter.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/pxd/filters/relations/DistancePXDPairFilter.h>
9 #include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
10 
11 #include <tracking/spacePointCreation/SpacePoint.h>
12 
13 using namespace Belle2;
14 using namespace TrackFindingCDC;
15 
16 TrackFindingCDC::Weight
17 DistancePXDPairFilter::operator()(const std::pair<const CKFToPXDState*, const CKFToPXDState*>& relation)
18 {
19  const CKFToPXDState& fromState = *(relation.first);
20  const CKFToPXDState& toState = *(relation.second);
21 
22  const CKFToPXDState::stateCache& fromStateCache = fromState.getStateCache();
23  const CKFToPXDState::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 an SVD track, so we can use its position to only look for matching ladders
33  if (abs(phiDiff) < 0.2f) {
34  return 1.0;
35  }
36 
37  return NAN;
38  }
39 
40  if (fromStateCache.geoLayer == toStateCache.geoLayer and
41  fromStateCache.sensorID.getSensorNumber() == toStateCache.sensorID.getSensorNumber()) {
42  // TODO: Checking for equality of sensor numbers seems not to harm the hit efficiency,
43  // but maybe it's safer to allow for a sensor number difference of 1?
44  return 1.0;
45  }
46 
47  if (abs(phiDiff) < 0.05f) {
48  return 1.0;
49  }
50 
51  return NAN;
52 }
Specialized CKF State for extrapolating into the PXD.
Definition: CKFToPXDState.h:27
const struct stateCache & getStateCache() const
Get the cached data of this state.
Definition: CKFToPXDState.h:48
TrackFindingCDC::Weight operator()(const std::pair< const CKFToPXDState *, const CKFToPXDState * > &relation) override
Return the weight based on azimuthal-angle separation.
Abstract base class for different kinds of events.