Belle II Software  release-05-01-25
DistanceSVDPairFilter.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun, Christian Wessel *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/ckf/svd/filters/relations/DistanceSVDPairFilter.h>
11 #include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
12 
13 #include <tracking/spacePointCreation/SpacePoint.h>
14 
15 using namespace Belle2;
16 using namespace TrackFindingCDC;
17 
18 TrackFindingCDC::Weight
19 DistanceSVDPairFilter::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  double 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 (fabs(phiDiff) < 0.2 and fabs(fromStateCache.theta - toStateCache.theta) < 0.2) {
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 (abs(phiDiff) < 0.2) {
51  return 1.0;
52  }
53 
54  return NAN;
55 }
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::CKFToSVDState::getStateCache
const struct stateCache & getStateCache() const
Get the cached data of this state.
Definition: CKFToSVDState.h:56
Belle2::CKFToSVDState
Specialized CKF State for extrapolating into the SVD.
Definition: CKFToSVDState.h:29
Belle2::DistanceSVDPairFilter::operator()
TrackFindingCDC::Weight operator()(const std::pair< const CKFToSVDState *, const CKFToSVDState * > &relation) override
Return the weight based on azimuthal-angle separation.
Definition: DistanceSVDPairFilter.cc:19