8#include <tracking/ckf/pxd/filters/relations/LayerPXDRelationFilter.dcl.h>
9#include <tracking/trackFindingCDC/filters/base/RelationFilter.icc.h>
11#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
13#include <tracking/spacePointCreation/SpacePoint.h>
14#include <framework/core/ModuleParamList.templateDetails.h>
15#include <vxd/geometry/GeoCache.h>
23 template <
class AFilter,
class APrefilter>
30 template <
class AFilter,
class APrefilter>
33 template <
class AFilter,
class APrefilter>
37 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"hitJumping"), m_param_hitJumping,
38 "Make it possible to jump over N layers.", m_param_hitJumping);
40 m_filter.exposeParameters(moduleParamList, prefix);
41 m_prefilter.exposeParameters(moduleParamList, TrackFindingCDC::prefixed(
"pre", prefix));
46 template <
class AFilter,
class APrefilter>
51 if (m_prefix ==
"seed") {
52 m_ckfParameters = std::make_unique<OptionalDBObjPtr<CKFParameters>>(
"PXDCKFSeedHitParameters");
53 }
else if (m_prefix ==
"hit") {
54 m_ckfParameters = std::make_unique<OptionalDBObjPtr<CKFParameters>>(
"PXDCKFHitHitParameters");
56 B2ERROR(
"Unknown prefix. Apparently, some non-trivial changes to code were done.");
60 template <
class AFilter,
class APrefilter>
66 if (m_param_hitJumping == -1) {
67 if (m_ckfParameters->isValid()) {
68 m_layerJumpPtThreshold = (*m_ckfParameters)->getLayerJumpPtThreshold();
69 m_layerJumpLowPt = (*m_ckfParameters)->getLayerJumpLowPt();
70 m_layerJumpHighPt = (*m_ckfParameters)->getLayerJumpHighPt();
71 if (m_prefix ==
"hit" && m_layerJumpPtThreshold > 0.) {
74 B2FATAL(
"pt dependence of layerJump parameter currently not implemented for hit->hit extrapolation.");
77 B2FATAL(
"Trying to read layerJump parameter from DB but payload '" << m_ckfParameters->getName() <<
"' not found.");
81 m_layerJumpPtThreshold = -1;
82 m_layerJumpLowPt = m_param_hitJumping;
83 m_layerJumpHighPt = m_param_hitJumping;
87 template <
class AFilter,
class APrefilter>
88 std::vector<CKFToPXDState*>
90 const std::vector<CKFToPXDState*>& states)
const
92 std::vector<CKFToPXDState*> possibleNextStates;
94 const CKFToPXDState::stateCache& currentStateCache = currentState->
getStateCache();
95 const unsigned int& currentLayer = currentStateCache.geoLayer;
98 int m_hitJump = m_param_hitJumping;
100 if (m_hitJump == -1) {
101 m_hitJump = currentStateCache.ptSeed < m_layerJumpPtThreshold ? m_layerJumpLowPt : m_layerJumpHighPt;
104 const unsigned int& nextPossibleLayer = std::max(
static_cast<int>(currentLayer) - 1 - m_hitJump, 0);
109 int numberOfLaddersForLayer[2] = {8, 12};
112 const CKFToPXDState::stateCache& nextStateCache = nextState->getStateCache();
113 const unsigned int nextLayer = nextStateCache.geoLayer;
114 if (nextLayer < std::min(currentLayer, nextPossibleLayer) or std::max(currentLayer, nextPossibleLayer) < nextLayer) {
118 if (currentLayer == nextLayer) {
121 const unsigned int fromLadderNumber = currentStateCache.ladder;
122 const unsigned int maximumLadderNumber = numberOfLaddersForLayer[currentLayer - 1];
129 const int direction = 1;
130 const unsigned int overlappingLadder =
131 ((fromLadderNumber + maximumLadderNumber - 1) + direction) % maximumLadderNumber + 1;
133 if (nextStateCache.ladder != overlappingLadder) {
148 if (currentStateCache.localNormalizedu <= 0.8f) {
152 if (nextStateCache.localNormalizedu > 0.2f) {
158 TrackFindingCDC::Weight weight = m_prefilter(std::make_pair(currentState, nextState));
159 if (std::isnan(weight)) {
163 possibleNextStates.push_back(nextState);
166 return possibleNextStates;
169 template <
class AFilter,
class APrefilter>
172 return m_filter(std::make_pair(&from, &to));
Specialized CKF State for extrapolating into the PXD.
const struct stateCache & getStateCache() const
Get the cached data of this state.
APrefilter m_prefilter
Loose pre-filter to reject possibleTos.
AFilter m_filter
Filter for rejecting the states.
The Module parameter list class.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
TrackFindingCDC::Weight operator()(const CKFToPXDState &from, const CKFToPXDState &to) override
Give a final weight to the possibilities by asking the filter.
void initialize() override
Receive signal before the start of the event processing.
LayerPXDRelationFilter()
Add the filter as listener.
void beginRun() override
Receive signal for the beginning of a new run.
std::vector< CKFToPXDState * > getPossibleTos(CKFToPXDState *from, const std::vector< CKFToPXDState * > &states) const override
Return all states the given state is possible related to.
~LayerPXDRelationFilter()
Default destructor.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the filter.
Abstract base class for different kinds of events.