Belle II Software development
SVDStateVarSet Class Reference

Var set used in the VXD-CDC-Merger for calculating the probability of a VXD-CDC-track match. More...

#include <SVDStateVarSet.h>

Inheritance diagram for SVDStateVarSet:
VarSet< SVDStateVarNames > BaseVarSet< SVDStateVarNames::Object > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using Object
 Type from which variables should be extracted.
 

Public Member Functions

virtual bool extract (const BaseSVDStateFilter::Object *object) override
 Generate and assign the variables from the VXD-CDC object.
 
std::vector< Named< Float_t * > > getNamedVariables (const std::string &prefix) override
 Getter for the named references to the individual variables Base implementation returns empty vector.
 
std::vector< Named< Float_t * > > getNamedVariables ()
 Getter for the named references to the individual variables.
 
MayBePtr< Float_t > find (const std::string &varName) override
 Pointer to the variable with the given name.
 
virtual bool extract (const Object *obj)
 Main method that extracts the variable values from the complex object.
 
bool extract (const Object &obj)
 Method for extraction from an object instead of a pointer.
 
std::map< std::string, Float_t > getNamedValues (const std::string &prefix) const
 Getter for a map of names to float values.
 
std::map< std::string, Float_t > getNamedValues () const
 Getter for a map of names to float values.
 
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.
 
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.
 
virtual void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix)
 Expose the set of parameters of the filter to the module parameter list.
 

Protected Member Functions

Float_t get () const
 Getter for the value of the ith variable. Static version.
 
Float_t & var ()
 Reference getter for the value of the ith variable. Static version.
 
AssignFinite< Float_t > finitevar ()
 Reference getter for the value of the ith variable. Transforms non-finite values to finite value.
 
void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 

Static Protected Member Functions

static constexpr int named (const char *name)
 Getter for the index from the name.
 

Private Types

using Super
 Type of the super class.
 

Private Attributes

QualityEstimatorCircleFit m_qualityCircle
 Instance of the circle-fit class.
 
QualityEstimatorRiemannHelixFit m_qualityHelix
 Instance of the Riemann helix-fit class.
 
QualityEstimatorTripletFit m_qualityTriplet
 Instance of the triplet-fit class.
 
FixedSizeNamedFloatTuple< SVDStateVarNamesm_variables
 Memory for nVars floating point values.
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized
 Flag to keep track whether initialization happened before.
 
bool m_terminated
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Static Private Attributes

static const size_t nVars
 Number of floating point values represented by this class.
 

Detailed Description

Var set used in the VXD-CDC-Merger for calculating the probability of a VXD-CDC-track match.

Definition at line 86 of file SVDStateVarSet.h.

Member Typedef Documentation

◆ Object

using Object
inherited

Type from which variables should be extracted.

Definition at line 44 of file VarSet.h.

◆ Super

using Super
privateinherited

Type of the super class.

Definition at line 40 of file VarSet.h.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener * psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 53 of file CompositeProcessingSignalListener.cc.

56{
58}
Generic class that generates some named float values from a given object.
Definition BaseVarSet.h:34

◆ beginEvent()

void beginEvent ( )
overrideinherited

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

Definition at line 36 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
void beginEvent() override
Receive and dispatch signal for the start of a new event.
virtual void beginEvent()
Receive signal for the start of a new event.

◆ beginRun()

void beginRun ( )
overrideinherited

Receive and dispatch signal for the beginning of a new run.

Definition at line 33 of file CompositeProcessingSignalListener.cc.

24{
27 psl->beginRun();
28 }
29}
void beginRun() override
Receive and dispatch signal for the beginning of a new run.
virtual void beginRun()
Receive signal for the beginning of a new run.

◆ endRun()

void endRun ( )
overrideinherited

Receive and dispatch signal for the end of the run.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

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

◆ exposeParameters()

virtual void exposeParameters ( ModuleParamList * moduleParamList,
const std::string & prefix )
inlinevirtualinherited

Expose the set of parameters of the filter to the module parameter list.

Parameters
moduleParamListModule parameter list to add the new parameters to
prefixPrefix (or sometimes postfix) to be added to all nely added parameters.

Definition at line 47 of file CompositeProcessingSignalListener.h.

49 {};

◆ extract() [1/3]

bool extract ( const BaseSVDStateFilter::Object * object)
overridevirtual

Generate and assign the variables from the VXD-CDC object.

Definition at line 89 of file SVDStateVarSet.cc.

90{
91 const std::vector<TrackFindingCDC::WithWeight<const CKFToSVDState*>>& previousStates = pair->first;
92 CKFToSVDState* state = pair->second;
93
94 const RecoTrack* cdcTrack = previousStates.front()->getSeed();
95 B2ASSERT("Path without seed?", cdcTrack);
96
97 const SpacePoint* spacePoint = state->getHit();
98 B2ASSERT("Path without hit?", spacePoint);
99
100 std::vector<TrackFindingCDC::WithWeight<const CKFToSVDState*>> allStates = previousStates;
101 allStates.emplace_back(state, 0);
102
103 const std::vector<CDCHit*>& cdcHits = cdcTrack->getSortedCDCHitList();
104
105 var<named("seed_cdc_hits")>() = cdcHits.size();
106 var<named("seed_lowest_cdc_layer")>() = cdcHits.front()->getICLayer();
107
108 genfit::MeasuredStateOnPlane firstMeasurement;
109 if (state->mSoPSet()) {
110 firstMeasurement = state->getMeasuredStateOnPlane();
111 } else {
112 B2ASSERT("Previous state was not fitted?", previousStates.back()->mSoPSet());
113 firstMeasurement = previousStates.back()->getMeasuredStateOnPlane();
114 }
115
116 Vector3D position = Vector3D(firstMeasurement.getPos());
117 Vector3D momentum = Vector3D(firstMeasurement.getMom());
118
119 const CDCTrajectory3D trajectory(position, 0, momentum, cdcTrack->getChargeSeed());
120
121 const Vector3D& hitPosition = static_cast<Vector3D>(spacePoint->getPosition());
122
123 const double arcLength = trajectory.calcArcLength2D(hitPosition);
124 const Vector2D& trackPositionAtHit2D = trajectory.getTrajectory2D().getPos2DAtArcLength2D(arcLength);
125 const double trackPositionAtHitZ = trajectory.getTrajectorySZ().mapSToZ(arcLength);
126
127 Vector3D trackPositionAtHit(trackPositionAtHit2D, trackPositionAtHitZ);
128
129 const auto calculateCharge = [](const auto & s) {
130 return s.getCharge();
131 };
132 const auto calculateSeedCharge = [](const auto & s) {
133 return s.getSeedCharge();
134 };
135 const auto calculateSize = [](const auto & s) {
136 return s.getSize();
137 };
138 const auto calculateSNR = [](const auto & s) {
139 return s.getSNR();
140 };
141 const auto calculateChargeSizeRatio = [](const auto & s) {
142 return s.getCharge() / s.getSize();
143 };
144
145 if (spacePoint->getType() == VXD::SensorInfoBase::SensorType::SVD) {
146 const auto& clusters = spacePoint->getRelationsTo<SVDCluster>();
147
148 B2ASSERT("Must be related to exactly 2 clusters", clusters.size() == 2);
149 const SVDCluster* firstCluster = clusters[0];
150 const SVDCluster* secondCluster = clusters[1];
151
152 var<named("cluster_1_charge")>() = calculateCharge(*firstCluster);
153 var<named("cluster_2_charge")>() = calculateCharge(*secondCluster);
154 var<named("mean_rest_cluster_charge")>() = meanOver(allStates, calculateCharge);
155 var<named("min_rest_cluster_charge")>() = minOver(allStates, calculateCharge);
156 var<named("std_rest_cluster_charge")>() = stdOver(allStates, calculateCharge);
157
158 var<named("cluster_1_seed_charge")>() = calculateSeedCharge(*firstCluster);
159 var<named("cluster_2_seed_charge")>() = calculateSeedCharge(*secondCluster);
160 var<named("mean_rest_cluster_seed_charge")>() = meanOver(allStates, calculateSeedCharge);
161 var<named("min_rest_cluster_seed_charge")>() = minOver(allStates, calculateSeedCharge);
162 var<named("std_rest_cluster_seed_charge")>() = stdOver(allStates, calculateSeedCharge);
163
164 var<named("cluster_1_size")>() = calculateSize(*firstCluster);
165 var<named("cluster_2_size")>() = calculateSize(*secondCluster);
166 var<named("mean_rest_cluster_size")>() = meanOver(allStates, calculateSize);
167 var<named("min_rest_cluster_size")>() = minOver(allStates, calculateSize);
168 var<named("std_rest_cluster_size")>() = stdOver(allStates, calculateSize);
169
170 var<named("cluster_1_snr")>() = calculateSNR(*firstCluster);
171 var<named("cluster_2_snr")>() = calculateSNR(*secondCluster);
172 var<named("mean_rest_cluster_snr")>() = meanOver(allStates, calculateSNR);
173 var<named("min_rest_cluster_snr")>() = minOver(allStates, calculateSNR);
174 var<named("std_rest_cluster_snr")>() = stdOver(allStates, calculateSNR);
175
176 var<named("cluster_1_charge_over_size")>() = calculateChargeSizeRatio(*firstCluster);
177 var<named("cluster_2_charge_over_size")>() = calculateChargeSizeRatio(*secondCluster);
178 var<named("mean_rest_cluster_charge_over_size")>() = meanOver(allStates, calculateChargeSizeRatio);
179 var<named("min_rest_cluster_charge_over_size")>() = minOver(allStates, calculateChargeSizeRatio);
180 var<named("std_rest_cluster_charge_over_size")>() = stdOver(allStates, calculateChargeSizeRatio);
181 }
182
183 std::vector<const SpacePoint*> spacePoints;
184 for (const CKFToSVDState* walkState : allStates) {
185 const SpacePoint* sp = walkState->getHit();
186 if (sp) {
187 spacePoints.push_back(sp);
188 }
189 }
190
191 if (spacePoints.size() >= 3) {
192 var<named("quality_index_triplet")>() = m_qualityTriplet.estimateQuality(spacePoints);
193 var<named("quality_index_circle")>() = m_qualityCircle.estimateQuality(spacePoints);
194 var<named("quality_index_helix")>() = m_qualityHelix.estimateQuality(spacePoints);
195 } else {
196 var<named("quality_index_triplet")>() = 0;
197 var<named("quality_index_circle")>() = 0;
198 var<named("quality_index_helix")>() = 0;
199 }
200
201 return true;
202}
std::vector< Belle2::RecoTrack::UsedCDCHit * > getSortedCDCHitList() const
Return a sorted list of cdc hits. Sorted by the sortingParameter.
Definition RecoTrack.h:470
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
Definition RecoTrack.h:508
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
QualityEstimatorRiemannHelixFit m_qualityHelix
Instance of the Riemann helix-fit class.
QualityEstimatorTripletFit m_qualityTriplet
Instance of the triplet-fit class.
QualityEstimatorCircleFit m_qualityCircle
Instance of the circle-fit class.
Belle2::VXD::SensorInfoBase::SensorType getType() const
Return SensorType (PXD, SVD, ...) on which the SpacePoint lives.
Definition SpacePoint.h:145
const B2Vector3D & getPosition() const
return the position vector in global coordinates
Definition SpacePoint.h:138
static constexpr int named(const char *name)
Definition VarSet.h:78
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition Cell.h:34

◆ extract() [2/3]

bool extract ( const Object & obj)
inlineinherited

Method for extraction from an object instead of a pointer.

Definition at line 57 of file BaseVarSet.h.

58 {
59 return extract(&obj);
60 }

◆ extract() [3/3]

virtual bool extract ( const Object * obj)
inlinevirtualinherited

Main method that extracts the variable values from the complex object.

Returns indication whether the extraction could be completed successfully. Base implementation returns always true.

Parameters
objdummy object not used
Returns
: always true for the base implementation

Definition at line 51 of file BaseVarSet.h.

52 {
53 return true;
54 }

◆ find()

MayBePtr< Float_t > find ( const std::string & varName)
inlineoverridevirtualinherited

Pointer to the variable with the given name.

Returns nullptr if not found.

Reimplemented from BaseVarSet< SVDStateVarNames::Object >.

Definition at line 64 of file VarSet.h.

65 {
66 return m_variables.find(varName);
67 }

◆ finitevar()

AssignFinite< Float_t > finitevar ( )
inlineprotectedinherited

Reference getter for the value of the ith variable. Transforms non-finite values to finite value.

Definition at line 130 of file VarSet.h.

131 {
132 static_assert(I < nVars, "Requested variable index exceeds number of variables.");
133 return AssignFinite<Float_t>(m_variables[I]);
134 }

◆ get()

Float_t get ( ) const
inlineprotectedinherited

Getter for the value of the ith variable. Static version.

Definition at line 85 of file VarSet.h.

86 {
87 static_assert(I < nVars, "Requested variable index exceeds number of variables.");
88 return m_variables.get(I);
89 }

◆ getNamedValues() [1/2]

std::map< std::string, Float_t > getNamedValues ( ) const
inlineinherited

Getter for a map of names to float values.

Definition at line 96 of file BaseVarSet.h.

97 {
98 const std::string prefix = "";
99 return this->getNamedValues(prefix);
100 }

◆ getNamedValues() [2/2]

std::map< std::string, Float_t > getNamedValues ( const std::string & prefix) const
inlineinherited

Getter for a map of names to float values.

Parameters
prefixName prefix to apply to all variable names.

Definition at line 84 of file BaseVarSet.h.

85 {
86 std::map<std::string, Float_t> result;
87 std::vector<Named<Float_t*> > namedVariables = this->getNamedVariables(prefix);
88 for (const Named<Float_t*>& namedVariable : namedVariables) {
89 Float_t* variable = namedVariable;
90 result[namedVariable.getName()] = *variable;
91 }
92 return result;
93 }

◆ getNamedVariables() [1/2]

std::vector< Named< Float_t * > > getNamedVariables ( )
inlineinherited

Getter for the named references to the individual variables.

Definition at line 74 of file BaseVarSet.h.

75 {
76 const std::string prefix = "";
77 return this->getNamedVariables(prefix);
78 }

◆ getNamedVariables() [2/2]

std::vector< Named< Float_t * > > getNamedVariables ( const std::string & prefix)
inlineoverridevirtualinherited

Getter for the named references to the individual variables Base implementation returns empty vector.

Reimplemented from BaseVarSet< SVDStateVarNames::Object >.

Definition at line 55 of file VarSet.h.

56 {
57 return m_variables.getNamedVariables(prefix);
58 }

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 56 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
overrideinherited

Receive and dispatch signal before the start of the event processing.

Definition at line 30 of file CompositeProcessingSignalListener.cc.

16{
19 psl->initialize();
20 }
21}
void initialize() override
Receive and dispatch signal before the start of the event processing.
virtual void initialize()
Receive signal before the start of the event processing.

◆ named()

static constexpr int named ( const char * name)
inlinestaticconstexprprotectedinherited

Getter for the index from the name.

Looks through the associated names and returns the right index if found Returns nVars (one after the last element) if not found.

Parameters
nameName of the sought variable
Returns
Index of the name, nVars if not found.

Definition at line 78 of file VarSet.h.

79 {
80 return index<nVars>(AVarNames::getName, name);
81 }

◆ terminate()

void terminate ( )
overrideinherited

Receive and dispatch Signal for termination of the event processing.

Definition at line 42 of file CompositeProcessingSignalListener.cc.

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

◆ var()

Float_t & var ( )
inlineprotectedinherited

Reference getter for the value of the ith variable. Static version.

Definition at line 93 of file VarSet.h.

94 {
95 static_assert(I < nVars, "Requested variable index exceeds number of variables.");
96 return m_variables[I];
97 }

Member Data Documentation

◆ m_initialized

bool m_initialized
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_qualityCircle

QualityEstimatorCircleFit m_qualityCircle
private

Instance of the circle-fit class.

Definition at line 94 of file SVDStateVarSet.h.

◆ m_qualityHelix

QualityEstimatorRiemannHelixFit m_qualityHelix
private

Instance of the Riemann helix-fit class.

Definition at line 96 of file SVDStateVarSet.h.

◆ m_qualityTriplet

QualityEstimatorTripletFit m_qualityTriplet
private

Instance of the triplet-fit class.

Definition at line 98 of file SVDStateVarSet.h.

◆ m_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 60 of file CompositeProcessingSignalListener.h.

◆ m_terminated

bool m_terminated
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.

◆ m_variables

FixedSizeNamedFloatTuple<SVDStateVarNames> m_variables
privateinherited

Memory for nVars floating point values.

Definition at line 138 of file VarSet.h.

◆ nVars

const size_t nVars
staticprivateinherited

Number of floating point values represented by this class.

Definition at line 48 of file VarSet.h.


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