Belle II Software  release-08-01-10
SensorPXDPairFilter.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/SensorPXDPairFilter.h>
9 #include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
10 
11 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
12 #include <framework/core/ModuleParamList.templateDetails.h>
13 
14 #include <vxd/geometry/GeoCache.h>
15 
16 using namespace Belle2;
17 using namespace TrackFindingCDC;
18 
19 TrackFindingCDC::Weight
20 SensorPXDPairFilter::operator()(const std::pair<const CKFToPXDState*, const CKFToPXDState*>& relation)
21 {
22  const CKFToPXDState& fromState = *(relation.first);
23  const CKFToPXDState& toState = *(relation.second);
24 
25  const CKFToPXDState::stateCache& fromStateCache = fromState.getStateCache();
26  const CKFToPXDState::stateCache& toStateCache = toState.getStateCache();
27 
28  B2ASSERT("You have filled the wrong states into this!", toStateCache.isHitState);
29 
30  if (not fromStateCache.isHitState) {
31  // We are coming from a SVD-CDC track, so we can use its position to only look for matching ladders
32  // This is done with the sensorCenterPhi, using the state's phi (and/or theta) wouldn't be a SensorFilter anymore.
33  float phiDiff = fromStateCache.phi - toStateCache.sensorCenterPhi;
34  while (phiDiff > M_PI) phiDiff -= 2. * M_PI;
35  while (phiDiff < -M_PI) phiDiff += 2. * M_PI;
36 
37  if (fabs(phiDiff) < m_param_PhiRecoTrackToHitCut) {
38  return 1.0;
39  }
40  // If the current state (fromState) is a RecoTrack-based state, but no relations could be created
41  // don't proceed but return
42  return NAN;
43  }
44 
45  // On same layer we already know from LayerPXDRelationFilter, that we only deal with overlaps in r-phi.
46  // So it's sufficient here to check for same layer number to accept states in the overlap region.
47  if (fromStateCache.geoLayer == toStateCache.geoLayer and
48  fromStateCache.sensorID.getSensorNumber() == toStateCache.sensorID.getSensorNumber()) {
49  return 1.0;
50  }
51 
52  // Next layer and sensor is not an overlap one, so we can just return all hits of the next layer
53  // that are close enough in phi. No cut in theta here since this is the SensorPXDPairFilter,
54  // a cut in theta is used in the DistancePXDPairFilter
55  float phiDiff = fromStateCache.sensorCenterPhi - toStateCache.sensorCenterPhi;
56  while (phiDiff > M_PI) phiDiff -= 2. * M_PI;
57  while (phiDiff < -M_PI) phiDiff += 2. * M_PI;
58 
59  if (fabs(phiDiff) < m_param_PhiHitHitCut) {
60  return 1.0;
61  }
62 
63  return NAN;
64 }
65 
66 void SensorPXDPairFilter::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
67 {
68  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "phiRecoTrackToHitCut"), m_param_PhiRecoTrackToHitCut,
69  "Cut in phi for the difference between RecoTrack (seed) mSoP and current hit-based state.", m_param_PhiRecoTrackToHitCut);
70  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "phiHitHitCut"), m_param_PhiHitHitCut,
71  "Cut in phi between two hit-based states.", m_param_PhiHitHitCut);
72 }
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
The Module parameter list class.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters.
TrackFindingCDC::Weight operator()(const std::pair< const CKFToPXDState *, const CKFToPXDState * > &relation) override
Return the weight based on layer.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.