Belle II Software  release-05-01-25
LoosePXDPairFilter.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Simon Kurz, Christian Wessel *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/ckf/pxd/filters/relations/LoosePXDPairFilter.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 using namespace Belle2;
17 using namespace TrackFindingCDC;
18 
19 TrackFindingCDC::Weight
20 LoosePXDPairFilter::operator()(const std::pair<const CKFToPXDState*, const CKFToPXDState*>& relation)
21 {
22  const CKFToPXDState::stateCache& currentStateCache = relation.first->getStateCache();
23  const CKFToPXDState::stateCache& nextStateCache = relation.second->getStateCache();
24 
25  // if the connection is possible in u, it should also be possible in v
26  // but as there could in principle be a chance between sensors (X.X.1 -> X.(X+-1).2 or X.X.2 -> X.(X+-1).1)
27  // check for a similar theta value instead of v
28  if (currentStateCache.geoLayer == nextStateCache.geoLayer) {
29  if (fabs(currentStateCache.theta - nextStateCache.theta) > m_param_ThetaOverlayRegionPrecut) {
30  return NAN;
31  }
32  }
33 
34  double phiDiff = currentStateCache.phi - nextStateCache.phi;
35  while (phiDiff > M_PI) phiDiff -= 2. * M_PI;
36  while (phiDiff < -M_PI) phiDiff += 2. * M_PI;
37 
38  if (not currentStateCache.isHitState) {
39  if (fabs(phiDiff) > m_param_PhiSeedHitPrecut) {
40  return NAN;
41  }
42  } else if (!(fabs(phiDiff) < m_param_PhiHitHitPrecut and
43  fabs(currentStateCache.theta - nextStateCache.theta) < m_param_ThetaHitHitPrecut)) {
44  return NAN;
45  }
46 
47  return 1.0;
48 }
49 
50 void LoosePXDPairFilter::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
51 {
52  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "thetaOverlayRegionCut"), m_param_ThetaOverlayRegionPrecut,
53  "Pre-cut in theta for the overlay region.", m_param_ThetaOverlayRegionPrecut);
54  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "phiSeedHitCut"), m_param_PhiSeedHitPrecut,
55  "Pre-cut in phi for relations between seed states and hit states.", m_param_PhiSeedHitPrecut);
56  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "phiHitHitCut"), m_param_PhiHitHitPrecut,
57  "Pre-cut in phi for relations between hit states.", m_param_PhiHitHitPrecut);
58  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "thetaHitHitCut"), m_param_ThetaHitHitPrecut,
59  "Pre-cut in theta for relations between hit states.", m_param_ThetaHitHitPrecut);
60 }
Belle2::LoosePXDPairFilter::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters.
Definition: LoosePXDPairFilter.cc:50
Belle2::LoosePXDPairFilter::operator()
TrackFindingCDC::Weight operator()(const std::pair< const CKFToPXDState *, const CKFToPXDState * > &relation) override
Return the weight based on azimuthal-angle separation.
Definition: LoosePXDPairFilter.cc:20
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
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ModuleParamList
The Module parameter list class.
Definition: ModuleParamList.h:46