8#include <tracking/vxdHoughTracking/findlets/RecoTrackStorer.h>
9#include <framework/core/ModuleParamList.h>
10#include <framework/core/ModuleParamList.templateDetails.h>
11#include <framework/geometry/BFieldManager.h>
12#include <tracking/dataobjects/RecoTrack.h>
13#include <svd/dataobjects/SVDCluster.h>
14#include <tracking/spacePointCreation/SpacePoint.h>
15#include <tracking/spacePointCreation/SpacePointTrackCand.h>
16#include <tracking/trackFindingVXD/trackQualityEstimators/QualityEstimatorCircleFit.h>
17#include <tracking/trackFindingVXD/trackQualityEstimators/QualityEstimatorMC.h>
18#include <tracking/trackFindingVXD/trackQualityEstimators/QualityEstimatorRiemannHelixFit.h>
19#include <tracking/trackFindingVXD/trackQualityEstimators/QualityEstimatorTripletFit.h>
20#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
21#include <tracking/trackFindingCDC/utilities/Algorithms.h>
22#include <tracking/trackFindingCDC/utilities/WeightedRelation.h>
25using namespace TrackFindingCDC;
26using namespace vxdHoughTracking;
44 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"SVDSpacePointTrackCandsStoreArrayName"),
49 "Identifier which estimation method to use. Valid identifiers are: [mcInfo, circleFit, tripletFit, helixFit].",
52 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"ResultStorerMCRecoTracksStoreArrayName"),
54 "Only required for MCInfo method. Name of StoreArray containing MCRecoTracks.",
57 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"ResultStorerMCStrictQualityEstimator"),
59 "Only required for MCInfo method. If false combining several MCTracks is allowed.",
79 m_estimator = std::make_unique<QualityEstimatorTripletFit>();
81 m_estimator = std::make_unique<QualityEstimatorCircleFit>();
83 m_estimator = std::make_unique<QualityEstimatorRiemannHelixFit>();
111 const std::vector<const SpacePoint*>& spacePoints)
113 for (
auto& thisSPTC : finishedResults) {
119 auto sortedHits = thisSPTC.getSortedHits();
120 const auto& estimatorResult =
m_estimator->estimateQualityAndProperties(sortedHits);
122 const ROOT::Math::XYZVector trackPosition(sortedHits.front()->X(), sortedHits.front()->Y(), sortedHits.front()->Z());
123 const ROOT::Math::XYZVector& trackMomentum = *estimatorResult.p;
124 const short& trackChargeSeed = estimatorResult.curvatureSign ? -1 * (*(estimatorResult.curvatureSign)) : 0;
125 const double qi = estimatorResult.qualityIndicator;
132 TVectorD stateSeed(6);
133 TMatrixDSym covSeed(6);
134 covSeed(0, 0) = 0.01 ; covSeed(1, 1) = 0.01 ; covSeed(2, 2) = 0.04 ;
135 covSeed(3, 3) = 0.01 ; covSeed(4, 4) = 0.01 ; covSeed(5, 5) = 0.04 ;
137 stateSeed(0) = (sortedHits.front()->X());
138 stateSeed(1) = (sortedHits.front()->Y());
139 stateSeed(2) = (sortedHits.front()->Z());
140 if (estimatorResult.p) {
141 auto momentumSeed = *(estimatorResult.p);
142 stateSeed(3) = momentumSeed.X();
143 stateSeed(4) = momentumSeed.Y();
144 stateSeed(5) = momentumSeed.Z();
151 thisSPTC.set6DSeed(stateSeed);
152 thisSPTC.setCovSeed(covSeed);
153 thisSPTC.setChargeSeed(trackChargeSeed);
167 unsigned int sortingParameter = 0;
168 for (
const SpacePoint* spacePoint : sortedHits) {
172 for (
const SVDCluster& relatedCluster : relatedClusters) {
174 newRecoTrack->
addSVDHit(&relatedCluster, sortingParameter, Belle2::RecoHitInformation::c_SVDHough);
180 for (
const SpacePoint* spacePoint : spacePoints) {
182 spacePoint->setAssignmentState(
true);
187 for (
const SVDCluster& relatedCluster : relatedClusters) {
189 spacePoint->setAssignmentState(
true);
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
The Module parameter list class.
Class implementing the algorithm used for the MC based quality estimation.
void forceUpdateClusterNames()
Setter to force the class to update its cluster names.
This is the Reconstruction Event-Data Model Track.
void setSeedCovariance(const TMatrixDSym &seedCovariance)
Set the covariance of the seed. ATTENTION: This is not the fitted covariance.
void setQualityIndicator(const float qualityIndicator)
Set the quality index attached to this RecoTrack. 0 means likely fake.
static void registerRequiredRelations(StoreArray< RecoTrack > &recoTracks, std::string const &pxdHitsStoreArrayName="", std::string const &svdHitsStoreArrayName="", std::string const &cdcHitsStoreArrayName="", std::string const &bklmHitsStoreArrayName="", std::string const &eklmHitsStoreArrayName="", std::string const &recoHitInformationStoreArrayName="")
Convenience method which registers all relations required to fully use a RecoTrack.
bool addSVDHit(const UsedSVDHit *svdHit, const unsigned int sortingParameter, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
Adds a svd hit with the given information to the reco track.
Class for type safe access to objects that are referred to in relations.
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Storage for (VXD) SpacePoint-based track candidates.
@ c_isActive
bit 11: SPTC is active (i.e.
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.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
void initialize() override
Receive and dispatch signal before the start of the event processing.
void beginRun() override
Receive and dispatch signal for the beginning of a new run.
void beginEvent() override
Receive and dispatch signal for the start of a new event.
Interface for a minimal algorithm part that wants to expose some parameters to a module.
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Forward prefixed parameters of this findlet to the module parameter list.
static const double T
[tesla]
void apply(std::vector< SpacePointTrackCand > &finishedResults, const std::vector< const SpacePoint * > &spacePoints) override
Store the finishey SpacePointTrackCands into RecoTracks and tag the SpacePoints.
~RecoTrackStorer()
Default destructor.
bool m_MCStrictQualityEstimator
Only required for MCInfo method.
void initialize() override
Create the store arrays.
std::string m_SVDSpacePointTrackCandsStoreArrayName
StoreArray name of the SpacePointTrackCandidate StoreArray.
std::string m_EstimationMethod
Identifier which estimation method to use.
std::string m_SVDClustersStoreArrayName
StoreArray name of the SVDCluster StoreArray.
std::set< const SVDCluster * > m_usedClusters
Store the used clusters in the results.
RecoTrackStorer()
Constructor.
StoreArray< SpacePointTrackCand > m_storeSpacePointTrackCands
Output SpacePointTrackCand Store Array.
void beginRun() override
Begin run.
std::string m_MCRecoTracksStoreArrayName
sets the name of the expected StoreArray containing MCRecoTracks. Only required for MCInfo method
void beginEvent() override
Reset internal vectors.
std::unique_ptr< QualityEstimatorBase > m_estimator
pointer to the selected QualityEstimator
StoreArray< RecoTrack > m_storeRecoTracks
Output RecoTracks Store Array.
std::set< const SpacePoint * > m_usedSpacePoints
Store the used space points in the results.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
std::string m_RecoTracksStoreArrayName
StoreArray name of the output Track StoreArray.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Abstract base class for different kinds of events.