Belle II Software development
FourHitFilter.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/FourHitFilter.h>
9#include <tracking/trackingUtilities/filters/base/Filter.icc.h>
10#include <tracking/trackingUtilities/utilities/StringManipulation.h>
11#include <tracking/vxdHoughTracking/entities/VXDHoughState.h>
12#include <framework/core/ModuleParamList.templateDetails.h>
13#include <framework/geometry/BFieldManager.h>
14
15using namespace Belle2;
16using namespace TrackingUtilities;
17using namespace vxdHoughTracking;
18
19void FourHitFilter::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
20{
21 moduleParamList->addParameter(TrackingUtilities::prefixed(prefix, "circleRadiusDifferenceCut"), m_CircleRadiusDifferenceCut,
22 "Cut on the difference of the radii of the two circles that can be defined by two hit triplets.",
24
25 moduleParamList->addParameter(TrackingUtilities::prefixed(prefix, "circleCenterPositionDifferenceCut"),
27 "Cut on the difference between the center positions of the two circles that can be defined by two hit triplets.",
29}
30
32{
33 const double bFieldZ = BFieldManager::getField(0, 0, 0).Z() / Unit::T;
34 m_fourHitVariables.setBFieldZ(bFieldZ);
35}
36
37TrackingUtilities::Weight
39{
40 const std::vector<TrackingUtilities::WithWeight<const VXDHoughState*>>& previousHits = pair.first;
41
42 // Do nothing if path is too short or too long
43 if (previousHits.size() != 3) {
44 return NAN;
45 }
46
47 const B2Vector3D& firstHitPos = previousHits.at(0)->getHit()->getPosition();
48 const B2Vector3D& secondHitPos = previousHits.at(1)->getHit()->getPosition();
49 const B2Vector3D& thirdHitPos = previousHits.at(2)->getHit()->getPosition();
50 const B2Vector3D& currentHitPos = pair.second->getHit()->getPosition();
51
52 m_fourHitVariables.setHits(firstHitPos, secondHitPos, thirdHitPos, currentHitPos);
53
54 if (m_fourHitVariables.getCircleRadiusDifference() > m_CircleRadiusDifferenceCut) {
55 return NAN;
56 }
57 if (m_fourHitVariables.getCircleCenterPositionDifference() > m_CircleCenterPositionDifferenceCut) {
58 return NAN;
59 }
60
61 return fabs(1.0 / m_fourHitVariables.getCircleRadiusDifference());
62}
The Module parameter list class.
std::pair< const std::vector< TrackingUtilities::WithWeight< const VXDHoughState * > >, VXDHoughState * > Object
Definition Filter.dcl.h:35
static const double T
[tesla]
Definition Unit.h:120
double m_CircleRadiusDifferenceCut
Cut on difference of the two circle radii estimated from two triplets.
double m_CircleCenterPositionDifferenceCut
Cut on difference of the two circle center estimated from two triplets.
TrackingUtilities::Weight operator()(const BasePathFilter::Object &pair) override
Return the weight based on the ThreeHitVariables.
void beginRun() override
set BField value for estimator
FourHitVariables m_fourHitVariables
Construct empty ThreeHitVariables instance.
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.