Belle II Software development
ThreeHitFilter.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/vxdHoughTracking/filters/pathFilters/ThreeHitFilter.h>
9#include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
10#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
11#include <framework/core/ModuleParamList.templateDetails.h>
12#include <framework/geometry/BFieldManager.h>
13
14using namespace Belle2;
15using namespace TrackFindingCDC;
16using namespace vxdHoughTracking;
17
18void ThreeHitFilter::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
19{
20 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "cosRZCut"), m_cosRZCut,
21 "Cut on the absolute value of cosine between the vectors (oHit - cHit) and (cHit - iHit).",
23 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "circleIPDistanceCut"), m_circleIPDistanceCut,
24 "Cut on the difference between circle radius and circle center to check whether the circle is compatible with passing through the IP.",
26}
27
29{
30 const double bFieldZ = BFieldManager::getField(0, 0, 0).Z() / Unit::T;
31 m_threeHitVariables.setBFieldZ(bFieldZ);
32}
33
34TrackFindingCDC::Weight
36{
37 const std::vector<TrackFindingCDC::WithWeight<const VXDHoughState*>>& previousHits = pair.first;
38
39 // Do nothing if path is too short or too long
40 if (previousHits.size() != 2) {
41 return NAN;
42 }
43
44 const B2Vector3D& firstHitPos = previousHits.at(0)->getHit()->getPosition();
45 const B2Vector3D& secondHitPos = previousHits.at(1)->getHit()->getPosition();
46 const B2Vector3D& currentHitPos = pair.second->getHit()->getPosition();
47
48 m_threeHitVariables.setHits(firstHitPos, secondHitPos, currentHitPos);
49
50 if (m_threeHitVariables.getCosAngleRZSimple() < m_cosRZCut) {
51 return NAN;
52 }
53
54 const double circleDistanceIP = m_threeHitVariables.getCircleDistanceIP();
55
56 if (circleDistanceIP > m_circleIPDistanceCut) {
57 return NAN;
58 }
59
60 return fabs(1.0 / circleDistanceIP);
61}
The Module parameter list class.
std::pair< const std::vector< TrackFindingCDC::WithWeight< const VXDHoughState * > >, VXDHoughState * > Object
Definition Filter.dcl.h:35
static const double T
[tesla]
Definition Unit.h:120
TrackFindingCDC::Weight operator()(const BasePathFilter::Object &pair) override
Return the weight based on the ThreeHitVariables.
ThreeHitVariables m_threeHitVariables
Construct empty ThreeHitVariables instance.
void beginRun() override
set BField value for estimator
double m_cosRZCut
cut for cosine in RZ between the two vectors (oHit - cHit) and (cHit - iHit)
double m_circleIPDistanceCut
cut on the difference between circle radius and circle center position in the x-y plane to check if t...
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters.
STL class.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition B2Vector3.h:516
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Abstract base class for different kinds of events.