Belle II Software development
TwoHitVirtualIPFilter.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/TwoHitVirtualIPFilter.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#include <framework/database/DBObjPtr.h>
14#include <mdst/dbobjects/BeamSpot.h>
15
16using namespace Belle2;
17using namespace TrackFindingCDC;
18using namespace vxdHoughTracking;
19
20void TwoHitVirtualIPFilter::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
21{
22 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "cosRZCut"), m_cosRZCut,
23 "Cut on the absolute value of cosine between the vectors (oHit - cHit) and (cHit - iHit).",
25 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "circleIPDistanceCut"), m_circleIPDistanceCut,
26 "Cut on the difference between circle radius and circle center to check whether the circle is compatible with passing through the IP.",
28}
29
31{
32 const double bFieldZ = BFieldManager::getField(0, 0, 0).Z() / Unit::T;
34
36 DBObjPtr<BeamSpot> beamSpotDB;
37 if (beamSpotDB.isValid()) {
38 const B2Vector3D& BeamSpotPosition = (*beamSpotDB).getIPPosition();
39 m_virtualIPPosition.SetXYZ(BeamSpotPosition.X(), BeamSpotPosition.Y(), BeamSpotPosition.Z());
40 } else {
41 m_virtualIPPosition.SetXYZ(0., 0., 0.);
42 }
43}
44
45
46TrackFindingCDC::Weight
48{
49 const std::vector<TrackFindingCDC::WithWeight<const VXDHoughState*>>& previousHits = pair.first;
50
51 // Do nothing if path is too short or too long
52 if (previousHits.size() != 1) {
53 return NAN;
54 }
55
56 const B2Vector3D& lastHitPos = previousHits.at(0)->getHit()->getPosition();
57 const B2Vector3D& currentHitPos = pair.second->getHit()->getPosition();
58
59 // filter expects hits from outer to inner
60 m_threeHitVariables.setHits(lastHitPos, currentHitPos, m_virtualIPPosition);
61
63 return NAN;
64 }
65
66 const double circleDistanceIP = m_threeHitVariables.getCircleDistanceIP();
67
68 if (circleDistanceIP > m_circleIPDistanceCut) {
69 return NAN;
70 }
71
72 return fabs(1.0 / circleDistanceIP);
73}
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:435
DataType X() const
access variable X (= .at(0) without boundary check)
Definition: B2Vector3.h:431
DataType Y() const
access variable Y (= .at(1) without boundary check)
Definition: B2Vector3.h:433
void SetXYZ(DataType x, DataType y, DataType z)
set all coordinates using data type
Definition: B2Vector3.h:464
bool isValid() const
Check whether a valid object was obtained from the database.
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
The Module parameter list class.
AObject Object
Type of the object to be analysed.
Definition: Filter.dcl.h:35
static const double T
[tesla]
Definition: Unit.h:120
double getCosAngleRZSimple()
calculates the cosine of the angle between the hits/vectors (RZ), returning unit: none (calculation f...
void setBFieldZ(const double bfieldZ=1.5)
Set the B-Field value used for pT calculations.
void setHits(const B2Vector3D &oHit, const B2Vector3D &cHit, const B2Vector3D &iHit)
Set hits if not given in constructor of if they need to be changed.
double getCircleDistanceIP()
calculates the distance of the point of closest approach of circle to the IP, returning unit: cm
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.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
DataType at(unsigned i) const
safe member access (with boundary check!)
Definition: B2Vector3.h:751
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Definition: BFieldManager.h:91
Abstract base class for different kinds of events.