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