Belle II Software development
TwoHitVirtualIPQIFilter Class Reference

Filter for two hits plus a virtual IP using QualityEstimators. More...

#include <TwoHitVirtualIPQIFilter.h>

Inheritance diagram for TwoHitVirtualIPQIFilter:
Filter< AObject > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using Object = AObject
 Type of the object to be analysed.
 
using Interface = Filter< AObject >
 Mark this class as the basic interface.
 

Public Member Functions

TrackFindingCDC::Weight operator() (const BasePathFilter::Object &pair) override
 Return the weight based on the quality estimator.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) override
 Expose the parameters.
 
void initialize () override
 initialize quality estimator
 
void beginRun () override
 set BField value for estimator
 
virtual bool needsTruthInformation ()
 Indicates if the filter requires Monte Carlo information.
 
Weight operator() (const Object *obj)
 Function to evaluate the object.
 
virtual std::vector< float > operator() (const std::vector< Object * > &objs)
 Function to evaluate a vector of objects Base implementation applies the function to each object.
 
void beginEvent () override
 Receive and dispatch signal for the start of a new event.
 
void endRun () override
 Receive and dispatch signal for the end of the run.
 
void terminate () override
 Receive and dispatch Signal for termination of the event processing.
 

Protected Member Functions

void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 

Private Types

using Super = ProcessingSignalListener
 Type of the base class.
 

Private Attributes

SpacePoint m_virtualIPSpacePoint
 virtual IP SpacePoint
 
std::string m_EstimationMethod = "helixFit"
 Identifier which estimation methsod to use.
 
std::string m_MCRecoTracksStoreArrayName = "MCRecoTracks"
 sets the name of the expected StoreArray containing MCRecoTracks. Only required for MCInfo method
 
bool m_MCStrictQualityEstimator = true
 Only required for MCInfo method.
 
std::unique_ptr< QualityEstimatorBasem_estimator
 pointer to the selected QualityEstimator
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized = false
 Flag to keep track whether initialization happened before.
 
bool m_terminated = false
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Filter for two hits plus a virtual IP using QualityEstimators.

Definition at line 22 of file TwoHitVirtualIPQIFilter.h.

Member Typedef Documentation

◆ Interface

using Interface = Filter<AObject>
inherited

Mark this class as the basic interface.

Definition at line 38 of file Filter.dcl.h.

◆ Object

using Object = AObject
inherited

Type of the object to be analysed.

Definition at line 35 of file Filter.dcl.h.

◆ Super

using Super = ProcessingSignalListener
privateinherited

Type of the base class.

Definition at line 25 of file CompositeProcessingSignalListener.h.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 55 of file CompositeProcessingSignalListener.cc.

56{
58}
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
References to subordinary signal processing listener contained in this findlet.

◆ beginEvent()

void beginEvent ( )
overridevirtualinherited

Receive and dispatch signal for the start of a new event.

Reimplemented from ProcessingSignalListener.

Reimplemented in SpacePointTagger< Belle2::CKFToPXDResult, Belle2::PXDCluster >, SpacePointTagger< Belle2::CKFToSVDResult, Belle2::SVDCluster >, BaseEventTimeExtractor< RecoTrack * >, BaseEventTimeExtractor< TrackFindingCDC::CDCWireHit & >, SharingHitsMatcher< Belle2::TrackFindingCDC::CDCTrack, Belle2::TrackFindingCDC::CDCSegment2D >, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCFacet >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCWireHit, true >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegment2D >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCTrack >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentPair >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentTriple >, RecoTrackStorer, ROIFinder, and SVDHoughTracking.

Definition at line 31 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
Interface for an algorithm part that needs to receive the module processing signals.
virtual void beginEvent()
Receive signal for the start of a new event.

◆ beginRun()

void beginRun ( )
overridevirtual

set BField value for estimator

BeamSpot from DB

Reimplemented from CompositeProcessingSignalListener.

Definition at line 36 of file TwoHitVirtualIPQIFilter.cc.

37{
38 const double bFieldZ = BFieldManager::getField(0, 0, 0).Z() / Unit::T;
39 m_estimator->setMagneticFieldStrength(bFieldZ);
40
41 if (m_EstimationMethod == "mcInfo") {
42 QualityEstimatorMC* MCestimator = static_cast<QualityEstimatorMC*>(m_estimator.get());
43 MCestimator->forceUpdateClusterNames();
44 }
45
46
48 DBObjPtr<BeamSpot> beamSpotDB;
49 if (beamSpotDB.isValid()) {
50 const B2Vector3D& BeamSpotPosition = (*beamSpotDB).getIPPosition();
51 const TMatrixDSym posErr = (*beamSpotDB).getIPPositionCovMatrix();
52 const B2Vector3D BeamSpotPositionError(sqrt(posErr[0][0]), sqrt(posErr[1][1]), sqrt(posErr[2][2]));
53 m_virtualIPSpacePoint = SpacePoint(BeamSpotPosition, BeamSpotPositionError, {0.5, 0.5}, {false, false}, VxdID(0),
55 } else {
56 m_virtualIPSpacePoint = SpacePoint(B2Vector3D(0., 0., 0.), B2Vector3D(0.1, 0.1, 0.5), {0.5, 0.5}, {false, false}, VxdID(0),
58 }
59
60}
bool isValid() const
Check whether a valid object was obtained from the database.
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Class implementing the algorithm used for the MC based quality estimation.
void forceUpdateClusterNames()
Setter to force the class to update its cluster names.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:42
static const double T
[tesla]
Definition: Unit.h:120
@ VXD
Any type of VXD Sensor.
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
std::string m_EstimationMethod
Identifier which estimation methsod to use.
std::unique_ptr< QualityEstimatorBase > m_estimator
pointer to the selected QualityEstimator
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.
Definition: BFieldManager.h:91
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

◆ endRun()

void endRun ( )
overridevirtualinherited

Receive and dispatch signal for the end of the run.

Reimplemented from ProcessingSignalListener.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

40{
42 psl->endRun();
43 }
45}
virtual void endRun()
Receive signal for the end of the run.

◆ exposeParameters()

void exposeParameters ( ModuleParamList moduleParamList,
const std::string &  prefix 
)
overridevirtual

Expose the parameters.

Reimplemented from Filter< AObject >.

Definition at line 23 of file TwoHitVirtualIPQIFilter.cc.

24{
25 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "trackQualityEstimationMethod"), m_EstimationMethod,
26 "Identifier which estimation method to use. Valid identifiers are: [mcInfo, tripletFit, helixFit]",
28 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "MCRecoTracksStoreArrayName"), m_MCRecoTracksStoreArrayName,
29 "Only required for MCInfo method. Name of StoreArray containing MCRecoTracks.",
31 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "MCStrictQualityEstimator"), m_MCStrictQualityEstimator,
32 "Only required for MCInfo method. If false combining several MCTracks is allowed.",
34}
bool m_MCStrictQualityEstimator
Only required for MCInfo method.
std::string m_MCRecoTracksStoreArrayName
sets the name of the expected StoreArray containing MCRecoTracks. Only required for MCInfo method
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 60 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
overridevirtual

initialize quality estimator

Reimplemented from CompositeProcessingSignalListener.

Definition at line 62 of file TwoHitVirtualIPQIFilter.cc.

63{
64 // create pointer to chosen estimator
65 if (m_EstimationMethod == "mcInfo") {
66 StoreArray<RecoTrack> mcRecoTracks;
68 m_estimator = std::make_unique<QualityEstimatorMC>(m_MCRecoTracksStoreArrayName, m_MCStrictQualityEstimator);
69 } else if (m_EstimationMethod == "tripletFit") {
70 m_estimator = std::make_unique<QualityEstimatorTripletFit>();
71 } else if (m_EstimationMethod == "helixFit") {
72 m_estimator = std::make_unique<QualityEstimatorRiemannHelixFit>();
73 }
74 B2ASSERT("QualityEstimator could not be initialized with method: " << m_EstimationMethod, m_estimator);
75}
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113

◆ needsTruthInformation()

◆ operator()() [1/3]

TrackFindingCDC::Weight operator() ( const BasePathFilter::Object pair)
overridevirtual

Return the weight based on the quality estimator.

Returns the QI value obtained from the fit with the chosen QualityEstimator

Reimplemented from Filter< AObject >.

Definition at line 78 of file TwoHitVirtualIPQIFilter.cc.

79{
80 const std::vector<TrackFindingCDC::WithWeight<const VXDHoughState*>>& previousHits = pair.first;
81
82 // Do nothing if path is too short or too long
83 if (previousHits.size() != 1) {
84 return NAN;
85 }
86
87 std::vector<const SpacePoint*> spacePointsVirtIP;
88 spacePointsVirtIP.reserve(previousHits.size() + 2);
89 // Note that the path is always created outside-in.
90 // The tripletFit only works with hits being ordered inside-out, so add the hits in that direction.
91 // First the virtual IP, then the hit that is currently checked, and last the single hit in the path.
92 spacePointsVirtIP.emplace_back(&m_virtualIPSpacePoint);
93 spacePointsVirtIP.emplace_back(pair.second->getHit());
94 spacePointsVirtIP.emplace_back(previousHits.at(0)->getHit());
95 const auto& estimatorResultVirtIP = m_estimator->estimateQualityAndProperties(spacePointsVirtIP);
96
97 return estimatorResultVirtIP.qualityIndicator;
98}

◆ operator()() [2/3]

Weight operator() ( const Object obj)
inherited

Function to evaluate the object.

Base implementation accepts all objects, except nullptr.

Parameters
objThe object to be accepted or rejected.
Returns
A finit float value if the object is accepted. NAN if the object is rejected. Nullptr is always rejected.

Definition at line 58 of file Filter.icc.h.

59 {
60 return obj ? operator()(*obj) : NAN;
61 }
virtual Weight operator()(const Object &obj)
Function to evaluate the object.
Definition: Filter.icc.h:52

◆ operator()() [3/3]

std::vector< float > operator() ( const std::vector< Object * > &  objs)
virtualinherited

Function to evaluate a vector of objects Base implementation applies the function to each object.

Can be optimized for MVA filters

Parameters
objsA vector of pointers to objects
Returns
A vector of float or NAN values. See above

Definition at line 64 of file Filter.icc.h.

65 {
66 std::vector<float> out;
67 for (const auto& obj : objs) {
68 out.push_back(operator()(obj));
69 }
70 return out;
71 }

◆ terminate()

void terminate ( )
overridevirtualinherited

Receive and dispatch Signal for termination of the event processing.

Reimplemented from ProcessingSignalListener.

Reimplemented in StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::HyperHough >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::QuadraticLegendre >, and StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::Z0TanLambdaLegendre >.

Definition at line 47 of file CompositeProcessingSignalListener.cc.

48{
50 psl->terminate();
51 }
53}
virtual void terminate()
Receive Signal for termination of the event processing.

Member Data Documentation

◆ m_EstimationMethod

std::string m_EstimationMethod = "helixFit"
private

Identifier which estimation methsod to use.

Valid identifiers are: mcInfo, tripletFit, helixFit

Definition at line 41 of file TwoHitVirtualIPQIFilter.h.

◆ m_estimator

std::unique_ptr<QualityEstimatorBase> m_estimator
private

pointer to the selected QualityEstimator

Definition at line 47 of file TwoHitVirtualIPQIFilter.h.

◆ m_initialized

bool m_initialized = false
privateinherited

Flag to keep track whether initialization happened before.

Definition at line 52 of file ProcessingSignalListener.h.

◆ m_initializedAs

std::string m_initializedAs
privateinherited

Name of the type during initialisation.

Definition at line 58 of file ProcessingSignalListener.h.

◆ m_MCRecoTracksStoreArrayName

std::string m_MCRecoTracksStoreArrayName = "MCRecoTracks"
private

sets the name of the expected StoreArray containing MCRecoTracks. Only required for MCInfo method

Definition at line 43 of file TwoHitVirtualIPQIFilter.h.

◆ m_MCStrictQualityEstimator

bool m_MCStrictQualityEstimator = true
private

Only required for MCInfo method.

Definition at line 45 of file TwoHitVirtualIPQIFilter.h.

◆ m_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 52 of file CompositeProcessingSignalListener.h.

◆ m_terminated

bool m_terminated = false
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.

◆ m_virtualIPSpacePoint

SpacePoint m_virtualIPSpacePoint
private

virtual IP SpacePoint

Definition at line 37 of file TwoHitVirtualIPQIFilter.h.


The documentation for this class was generated from the following files: