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
14using namespace Belle2;
15using namespace TrackFindingCDC;
16
17TrackFindingCDC::Weight
18AngularDistancePXDPairFilter::operator()(const std::pair<const CKFToPXDState*, const CKFToPXDState*>& relation)
19{
20 const CKFToPXDState& fromState = *(relation.first);
21 const CKFToPXDState& toState = *(relation.second);
22
23 const CKFToPXDState::stateCache& fromStateCache = fromState.getStateCache();
24 const CKFToPXDState::stateCache& toStateCache = toState.getStateCache();
25
26 B2ASSERT("You have filled the wrong states into this!", toStateCache.isHitState);
27
28 float phiDiff = fromStateCache.phi - toStateCache.phi;
29 while (phiDiff > M_PI) phiDiff -= 2. * M_PI;
30 while (phiDiff < -M_PI) phiDiff += 2. * M_PI;
31
32 if (not fromStateCache.isHitState) {
33 // We are coming from an SVD / CDC-SVD track, so we can use its position to only look for matching ladders
34 if (abs(phiDiff) < static_cast<float>(m_param_PhiRecoTrackToHitCut)) {
35 return 1.0;
36 }
37 return NAN;
38 }
39
40 // On same layer we already know from LayerPXDRelationFilter, that we only deal with overlaps in r-phi.
41 // So it's sufficient here to check for same layer number to accept states in the overlap region.
42 if (fromStateCache.geoLayer == toStateCache.geoLayer and
43 fromStateCache.sensorID.getSensorNumber() == toStateCache.sensorID.getSensorNumber()) {
44 // TODO: Checking for equality of sensor numbers seems not to harm the hit efficiency,
45 // but maybe it's safer to allow for a sensor number difference of 1?
46 return 1.0;
47 }
48
49 if (abs(phiDiff) < static_cast<float>(m_param_PhiHitHitCut)) {
50 return 1.0;
51 }
52
53 return NAN;
54}
55
56void AngularDistancePXDPairFilter::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
57{
58 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "phiRecoTrackToHitCut"), m_param_PhiRecoTrackToHitCut,
59 "Cut in phi for the difference between RecoTrack (seed) mSoP.getPos() and current hit-based state.", m_param_PhiRecoTrackToHitCut);
60 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "phiHitHitCut"), m_param_PhiHitHitCut,
61 "Cut in phi between two hit-based states.", m_param_PhiHitHitCut);
62}
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.
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 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.