Belle II Software development
StereoHitVarSet Class Reference

Class to compute floating point variables from a stereo hit to track match which can be recorded as a flat TNtuple or serve as input to a MVA method. More...

#include <StereoHitVarSet.h>

Inheritance diagram for StereoHitVarSet:
VarSet< StereoHitVarNames > BaseVarSet< StereoHitVarNames::Object > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using Object
 Type from which variables should be extracted.
 

Public Member Functions

bool extract (const BaseStereoHitFilter::Object *testPair) override
 Generate and assign the contained variables.
 
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

FixedSizeNamedFloatTuple< StereoHitVarNamesm_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

Class to compute floating point variables from a stereo hit to track match which can be recorded as a flat TNtuple or serve as input to a MVA method.

Definition at line 64 of file StereoHitVarSet.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 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() [2/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 }

◆ extract() [3/3]

bool extract ( const BaseStereoHitFilter::Object * testPair)
override

Generate and assign the contained variables.

Definition at line 27 of file StereoHitVarSet.cc.

28{
29 const CDCRLWireHit* rlWireHit = testPair->getTo();
30 const CDCTrack* track = testPair->getFrom();
31
32 if (not testPair or not rlWireHit or not track) return false;
33
34
35 const CDCTrajectory2D& trajectory2D = track->getStartTrajectory3D().getTrajectory2D();
36
37 const CDCRecoHit3D& recoHit3D = CDCRecoHit3D::reconstruct(*rlWireHit, trajectory2D);
38
39 const Vector2D& startMomentum = trajectory2D.getMom2DAtSupport();
40 const double radius = trajectory2D.getLocalCircle()->radius();
41 const double size = track->size();
42 const Vector3D& reconstructedPosition = recoHit3D.getRecoPos3D();
43 const double reconstructedDriftLength = recoHit3D.getSignedRecoDriftLength();
44 const double reconstructedS = recoHit3D.getArcLength2D();
45 const unsigned short int adcCount = rlWireHit->getWireHit().getHit()->getADCCount();
46 const ERightLeft rlInformation = rlWireHit->getRLInfo();
47 const double backArcLength2D = track->back().getArcLength2D();
48 const double frontArcLength2D = track->front().getArcLength2D();
49 const double arcLength2DSum = std::accumulate(track->begin(), track->end(), 0.0, [](const double sum,
50 const CDCRecoHit3D & listRecoHit) { return sum + listRecoHit.getArcLength2D();});
51
52 const CDCWire& wire = rlWireHit->getWire();
53 Vector2D wirePos = wire.getWirePos2DAtZ(reconstructedPosition.z());
54 Vector2D disp2D = reconstructedPosition.xy() - wirePos;
55 const double xyDistance = disp2D.norm();
56
57 const auto nearestAxialHit = std::min_element(track->begin(), track->end(), [&reconstructedS](const CDCRecoHit3D & lhs,
58 const CDCRecoHit3D & rhs) {
59 return std::abs(lhs.getArcLength2D() - reconstructedS) < std::abs(rhs.getArcLength2D() - reconstructedS);
60 });
61
62 var<named("track_size")>() = size;
63 var<named("pt")>() = toFinite(trajectory2D.getAbsMom2D(), 0);
64 var<named("reco_s")>() = toFinite(reconstructedS, 0);
65 var<named("reco_z")>() = toFinite(reconstructedPosition.z(), 0);
66 var<named("phi_track")>() = toFinite(startMomentum.phi(), 0);
67 var<named("phi_hit")>() = reconstructedPosition.phi();
68 var<named("theta_hit")>() = reconstructedPosition.theta();
69 var<named("drift_length")>() = reconstructedDriftLength;
70 var<named("adc_count")>() = adcCount;
71 var<named("xy_distance_zero_z")>() = toFinite(xyDistance, 0);
72 var<named("right_hit")>() = rlInformation == ERightLeft::c_Right;
73 var<named("track_back_s")>() = toFinite(backArcLength2D, 0);
74 var<named("track_front_s")>() = toFinite(frontArcLength2D, 0);
75 var<named("track_mean_s")>() = toFinite(arcLength2DSum / size, 0);
76 var<named("s_distance")>() = toFinite(nearestAxialHit->getArcLength2D() - reconstructedS, 0);
77 var<named("track_radius")>() = toFinite(radius, 0);
78 var<named("superlayer_id")>() = rlWireHit->getISuperLayer();
79 return true;
80}
unsigned short getADCCount() const
Getter for integrated charge.
Definition CDCHit.h:230
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
ISuperLayer getISuperLayer() const
Getter for the superlayer id.
const CDCWire & getWire() const
Getter for the wire the oriented hit associated to.
ERightLeft getRLInfo() const
Getter for the right left passage information.
const Vector3D & getRecoPos3D() const
Getter for the 3d position of the hit.
double getSignedRecoDriftLength() const
Returns the drift length next to the reconstructed position.
static CDCRecoHit3D reconstruct(const CDCRecoHit2D &recoHit2D, const CDCTrajectory2D &trajectory2D)
Reconstructs the three dimensional hit from the two dimensional and the two dimensional trajectory.
double getArcLength2D() const
Getter for the travel distance in the xy projection.
Vector2D getMom2DAtSupport(const double bZ) const
Get the momentum at the support point of the trajectory.
double getAbsMom2D(double bZ) const
Get the estimation for the absolute value of the transvers momentum.
const UncertainPerigeeCircle & getLocalCircle() const
Getter for the circle in local coordinates.
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition CDCWireHit.h:159
Vector2D getWirePos2DAtZ(const double z) const
Gives the xy projected position of the wire at the given z coordinate.
Definition CDCWire.h:192
double radius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
static constexpr int named(const char *name)
Definition VarSet.h:78
double phi() const
Gives the azimuth angle being the angle to the x axes ( range -M_PI to M_PI )
Definition Vector2D.h:569
double norm() const
Calculates the length of the vector.
Definition Vector2D.h:175
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition Vector3D.h:508
double phi() const
Getter for the azimuth angle.
Definition Vector3D.h:540
double z() const
Getter for the z coordinate.
Definition Vector3D.h:496
double theta() const
Getter for the polar angle.
Definition Vector3D.h:546
From * getFrom() const
Getter for the pointer to the from side object.
To * getTo() const
Getter for the pointer to the to side object.
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition Cell.h:34
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition ERightLeft.h:25

◆ 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< StereoHitVarNames::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< StereoHitVarNames::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_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<StereoHitVarNames> 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: