Belle II Software development
AngularDistancePXDPairFilter.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/AngularDistancePXDPairFilter.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 <cmath>
15
16using namespace Belle2;
17using namespace TrackFindingCDC;
18
19TrackFindingCDC::Weight
20AngularDistancePXDPairFilter::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 float phiDiff = fromStateCache.phi - toStateCache.phi;
31 while (phiDiff > M_PI) phiDiff -= 2. * M_PI;
32 while (phiDiff < -M_PI) phiDiff += 2. * M_PI;
33
34 if (not fromStateCache.isHitState) {
35 // We are coming from an SVD / CDC-SVD track, so we can use its position to only look for matching ladders
36 if (std::abs(phiDiff) < static_cast<float>(m_param_PhiRecoTrackToHitCut)) {
37 return 1.0;
38 }
39 return NAN;
40 }
41
42 // On same layer we already know from LayerPXDRelationFilter, that we only deal with overlaps in r-phi.
43 // So it's sufficient here to check for same layer number to accept states in the overlap region.
44 if (fromStateCache.geoLayer == toStateCache.geoLayer and
45 fromStateCache.sensorID.getSensorNumber() == toStateCache.sensorID.getSensorNumber()) {
46 // TODO: Checking for equality of sensor numbers seems not to harm the hit efficiency,
47 // but maybe it's safer to allow for a sensor number difference of 1?
48 return 1.0;
49 }
50
51 if (std::abs(phiDiff) < static_cast<float>(m_param_PhiHitHitCut)) {
52 return 1.0;
53 }
54
55 return NAN;
56}
57
58void AngularDistancePXDPairFilter::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
59{
60 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "phiRecoTrackToHitCut"), m_param_PhiRecoTrackToHitCut,
61 "Cut in phi for the difference between RecoTrack (seed) mSoP.getPos() and current hit-based state.", m_param_PhiRecoTrackToHitCut);
62 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "phiHitHitCut"), m_param_PhiHitHitCut,
63 "Cut in phi between two hit-based states.", m_param_PhiHitHitCut);
64}
double m_param_PhiHitHitCut
Filter potential relations in phi between hit states.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters.
double m_param_PhiRecoTrackToHitCut
Filter potential relations in phi between seed states and hit states.
TrackFindingCDC::Weight operator()(const std::pair< const CKFToPXDState *, const CKFToPXDState * > &relation) override
Return the weight based on azimuthal-angle separation.
Specialized CKF State for extrapolating into the PXD.
const struct stateCache & getStateCache() const
Get the cached data of this state.
The Module parameter list class.
baseType getSensorNumber() const
Get the sensor id.
Definition VxdID.h:100
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.