8 #include <tracking/vxdHoughTracking/filters/pathFilters/TwoHitVirtualIPQIFilter.h>
9 #include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
10 #include <tracking/trackFindingVXD/trackQualityEstimators/QualityEstimatorMC.h>
11 #include <tracking/trackFindingVXD/trackQualityEstimators/QualityEstimatorRiemannHelixFit.h>
12 #include <tracking/trackFindingVXD/trackQualityEstimators/QualityEstimatorTripletFit.h>
13 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
14 #include <framework/core/ModuleParamList.templateDetails.h>
15 #include <framework/geometry/BFieldManager.h>
16 #include <framework/database/DBObjPtr.h>
17 #include <mdst/dbobjects/BeamSpot.h>
20 using namespace TrackFindingCDC;
21 using namespace vxdHoughTracking;
23 void TwoHitVirtualIPQIFilter::exposeParameters(
ModuleParamList* moduleParamList,
const std::string& prefix)
25 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"trackQualityEstimationMethod"), m_param_EstimationMethod,
26 "Identifier which estimation method to use. Valid identifiers are: [mcInfo, tripletFit, helixFit]",
27 m_param_EstimationMethod);
28 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"MCRecoTracksStoreArrayName"), m_param_MCRecoTracksStoreArrayName,
29 "Only required for MCInfo method. Name of StoreArray containing MCRecoTracks.",
30 m_param_MCRecoTracksStoreArrayName);
31 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"MCStrictQualityEstimator"), m_param_MCStrictQualityEstimator,
32 "Only required for MCInfo method. If false combining several MCTracks is allowed.",
33 m_param_MCStrictQualityEstimator);
36 void TwoHitVirtualIPQIFilter::beginRun()
39 m_estimator->setMagneticFieldStrength(bFieldZ);
41 if (m_param_EstimationMethod ==
"mcInfo") {
43 mcRecoTracks.
isRequired(m_param_MCRecoTracksStoreArrayName);
44 std::string svdClustersName =
""; std::string pxdClustersName =
"";
47 svdClustersName = mcRecoTracks[0]->getStoreArrayNameOfSVDHits();
48 pxdClustersName = mcRecoTracks[0]->getStoreArrayNameOfPXDHits();
50 B2WARNING(
"No Entries in mcRecoTracksStoreArray: using empty cluster name for svd and pxd");
61 const B2Vector3D& BeamSpotPosition = (*beamSpotDB).getIPPosition();
62 const TMatrixDSym posErr = (*beamSpotDB).getIPPositionCovMatrix();
63 const B2Vector3D BeamSpotPositionError(sqrt(posErr[0][0]), sqrt(posErr[1][1]), sqrt(posErr[2][2]));
64 m_virtualIPSpacePoint =
SpacePoint(BeamSpotPosition, BeamSpotPositionError, {0.5, 0.5}, {
false,
false},
VxdID(0),
67 m_virtualIPSpacePoint =
SpacePoint(
B2Vector3D(0., 0., 0.),
B2Vector3D(0.1, 0.1, 0.5), {0.5, 0.5}, {
false,
false},
VxdID(0),
73 void TwoHitVirtualIPQIFilter::initialize()
76 if (m_param_EstimationMethod ==
"mcInfo") {
77 m_estimator = std::make_unique<QualityEstimatorMC>(m_param_MCRecoTracksStoreArrayName, m_param_MCStrictQualityEstimator);
78 }
else if (m_param_EstimationMethod ==
"tripletFit") {
79 m_estimator = std::make_unique<QualityEstimatorTripletFit>();
80 }
else if (m_param_EstimationMethod ==
"helixFit") {
81 m_estimator = std::make_unique<QualityEstimatorRiemannHelixFit>();
83 B2ASSERT(
"QualityEstimator could not be initialized with method: " << m_param_EstimationMethod, m_estimator);
86 TrackFindingCDC::Weight
89 const std::vector<TrackFindingCDC::WithWeight<const VXDHoughState*>>& previousHits = pair.first;
92 if (previousHits.size() != 1) {
96 std::vector<const SpacePoint*> spacePointsVirtIP;
97 spacePointsVirtIP.reserve(previousHits.size() + 2);
101 spacePointsVirtIP.emplace_back(&m_virtualIPSpacePoint);
102 spacePointsVirtIP.emplace_back(pair.second->getHit());
103 spacePointsVirtIP.emplace_back(previousHits.at(0)->getHit());
104 const auto& estimatorResultVirtIP = m_estimator->estimateQualityAndProperties(spacePointsVirtIP);
106 return estimatorResultVirtIP.qualityIndicator;
bool isValid() const
Check whether a valid object was obtained from the database.
Class for accessing objects in the database.
The Module parameter list class.
Class implementing the algorithm used for the MC based quality estimation.
void setClustersNames(const std::string &svdClustersName, const std::string &pxdClustersName)
Setter for StoreArray names of SVD and PXD clusters.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
AObject Object
Type of the object to be analysed.
static const double T
[tesla]
@ VXD
Any type of VXD Sensor.
Class to uniquely identify a any structure of the PXD and SVD.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
B2Vector3< double > B2Vector3D
typedef for common usage with double
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Abstract base class for different kinds of events.