Belle II Software development
CDCPathBasicVarSet Class Reference

Var set to store basic quantities related to CDC CKF. More...

#include <CDCPathBasicVarSet.h>

Inheritance diagram for CDCPathBasicVarSet:
VarSet< CDCPathBasicVarNames > BaseVarSet< CDCPathBasicVarNames::Object > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using Object
 Type from which variables should be extracted.
 

Public Member Functions

virtual bool extract (const BaseCDCPathFilter::Object *path) override
 Generate and assign the variables from the 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

StoreObjPtr< EventMetaDatam_eventMetaData
 use this to get the eventNumber
 
FixedSizeNamedFloatTuple< CDCPathBasicVarNamesm_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 to store basic quantities related to CDC CKF.

Definition at line 104 of file CDCPathBasicVarSet.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 BaseCDCPathFilter::Object * path)
overridevirtual

Generate and assign the variables from the object.

Definition at line 21 of file CDCPathBasicVarSet.cc.

22{
23 // check if hit belongs to same seed
24 const auto& seed = path->front();
25 const auto* seedRecoTrack = seed.getSeed();
26
27 double arcLength_total = 0.;
28 std::vector<double> arcLengths;
29 arcLengths.reserve(path->size() - 1);
30 std::vector<double> hitDistances;
31 hitDistances.reserve(path->size() - 1);
32 std::vector<double> flipPos(8, 0);
33
34 unsigned int chargeFlip = 0;
35 int lastCharge = seedRecoTrack->getChargeSeed();
36
37 for (auto const& state : *path) {
38 if (state.isSeed()) {
39 continue;
40 }
41
42 arcLengths.push_back(state.getArcLength() - arcLength_total);
43 arcLength_total = state.getArcLength();
44
45 hitDistances.push_back(state.getHitDistance());
46
47
48 // check how many times genfit changed the charge and where it occurred
49 genfit::MeasuredStateOnPlane trackState = state.getTrackState();
50 int stateCharge = trackState.getCharge();
51 if (lastCharge != stateCharge) {
52 if (chargeFlip < flipPos.size()) {
53 flipPos[chargeFlip] = state.getWireHit()->getWire().getICLayer();
54 }
55
56 chargeFlip += 1;
57 lastCharge = stateCharge;
58 }
59 }
60
61 // general stuff
62 var<named("eventNumber")>() = m_eventMetaData->getEvent();
63
64 // track properties
65 var<named("totalHits")>() = path->size() - 1;
66 var<named("chargeFlip")>() = chargeFlip;
67
68 bool reachedEnd = false;
69 if (path->size() > 1) {
70 if (path->back().getWireHit()->getWire().getICLayer() == 0) {
71 reachedEnd = true;
72 }
73 }
74 var<named("reachedEnd")>() = reachedEnd;
75
76 var<named("flipPos0")>() = flipPos[0];
77 var<named("flipPos1")>() = flipPos[1];
78 var<named("flipPos2")>() = flipPos[2];
79 var<named("flipPos3")>() = flipPos[3];
80
81 // seed properties
82 ROOT::Math::XYZVector seedPos = seedRecoTrack->getPositionSeed();
83 ROOT::Math::XYZVector seedMom = seedRecoTrack->getMomentumSeed();
84 var<named("seed_r")>() = seedPos.Rho();
85 var<named("seed_z")>() = seedPos.Z();
86 var<named("seed_x")>() = seedPos.X();
87 var<named("seed_y")>() = seedPos.Y();
88 var<named("seed_p")>() = seedMom.R();
89 var<named("seed_theta")>() = seedMom.Theta() * 180. / M_PI;
90 var<named("seed_pt")>() = seedMom.Rho();
91 var<named("seed_pz")>() = seedMom.Z();
92 var<named("seed_px")>() = seedMom.X();
93 var<named("seed_py")>() = seedMom.Y();
94 var<named("seed_charge")>() = seedRecoTrack->getChargeSeed();
95
96 var<named("totalHitsSeedTrack")>() = seedRecoTrack->getNumberOfCDCHits();
97
98 // get ICLayer assigned to seed (only really defined for ECL seeds)
99 const auto& wireTopology = CDC::CDCWireTopology::getInstance();
100 const auto& wires = wireTopology.getWires();
101 const float maxForwardZ = wires.back().getForwardZ(); // 157.615
102 const float maxBackwardZ = wires.back().getBackwardZ(); // -72.0916
103
104 int seedICLayer = -1;
105 const float seedPosZ = seedPos.z();
106 if (seedPosZ < maxForwardZ && seedPosZ > maxBackwardZ) {
107 seedICLayer = 56;
108 } else {
109 // do straight extrapolation of seed momentum to CDC outer walls
110 ROOT::Math::XYZVector seedMomZOne(seedMom * (1. / seedMom.Z()));
111
112 // find closest iCLayer
113 float minDist = 99999;
114 for (const auto& wire : wires) {
115 const float maxZ = seedPosZ > 0 ? wire.getForwardZ() : wire.getBackwardZ();
116
117 const auto distance = wire.getDistance(ROOT::Math::XYZVector(seedPos - seedMomZOne * (seedPosZ - maxZ)));
118 if (distance < minDist) {
119 minDist = distance;
120 seedICLayer = wire.getICLayer();
121 }
122 }
123 }
124 var<named("seedICLayer")>() = seedICLayer;
125
126
127 // track representation
128 ROOT::Math::XYZVector trackMom(0, 0, 0);
129 int trackCharge = 0;
130 float firstChi2 = 0;
131 float lastChi2 = 0;
132 float firstICLayer = 0;
133 float lastICLayer = 0;
134 if (path->size() > 1) {
135 genfit::MeasuredStateOnPlane trackState = path->back().getTrackState();
136
137 trackMom = trackState.getMom();
138 trackCharge = trackState.getCharge();
139
140 firstChi2 = path->at(1).getChi2();
141 lastChi2 = path->back().getChi2();
142
143 firstICLayer = path->at(1).getWireHit()->getWire().getICLayer();
144 lastICLayer = path->back().getWireHit()->getWire().getICLayer();
145 }
146 var<named("track_theta")>() = trackMom.Theta() * 180. / M_PI;
147 var<named("track_p")>() = trackMom.R();
148 var<named("track_pt")>() = trackMom.Rho();
149 var<named("track_pz")>() = trackMom.Z();
150 var<named("track_px")>() = trackMom.X();
151 var<named("track_py")>() = trackMom.Y();
152 var<named("track_charge")>() = trackCharge;
153
154 var<named("firstChi2")>() = firstChi2;
155 var<named("lastChi2")>() = lastChi2;
156
157 var<named("firstICLayer")>() = firstICLayer;
158 var<named("lastICLayer")>() = lastICLayer;
159
160 if (path->size() > 3) {
161 int lastN = path->size() - 1;
162 var<named("ICLayerLast0")>() = path->at(lastN).getWireHit()->getWire().getICLayer();
163 var<named("ICLayerLast1")>() = path->at(lastN - 1).getWireHit()->getWire().getICLayer();
164 var<named("ICLayerLast2")>() = path->at(lastN - 2).getWireHit()->getWire().getICLayer();
165 var<named("IWireLast0")>() = path->at(lastN).getWireHit()->getWire().getIWire();
166 var<named("IWireLast1")>() = path->at(lastN - 1).getWireHit()->getWire().getIWire();
167 var<named("IWireLast2")>() = path->at(lastN - 2).getWireHit()->getWire().getIWire();
168 } else {
169 var<named("ICLayerLast0")>() = -1;
170 var<named("ICLayerLast1")>() = -1;
171 var<named("ICLayerLast2")>() = -1;
172 var<named("IWireLast0")>() = -1;
173 var<named("IWireLast1")>() = -1;
174 var<named("IWireLast2")>() = -1;
175 }
176
177 if (path->size() > 10) {
178 var<named("hitDistance0")>() = hitDistances[0];
179 var<named("hitDistance1")>() = hitDistances[1];
180 var<named("hitDistance2")>() = hitDistances[2];
181 var<named("hitDistance3")>() = hitDistances[3];
182 var<named("hitDistance4")>() = hitDistances[4];
183 var<named("hitDistance5")>() = hitDistances[5];
184 var<named("hitDistance6")>() = hitDistances[6];
185 var<named("hitDistance7")>() = hitDistances[7];
186 var<named("hitDistance8")>() = hitDistances[8];
187 var<named("hitDistance9")>() = hitDistances[9];
188 var<named("arcLength0")>() = arcLengths[0];
189 var<named("arcLength1")>() = arcLengths[1];
190 var<named("arcLength2")>() = arcLengths[2];
191 var<named("arcLength3")>() = arcLengths[3];
192 var<named("arcLength4")>() = arcLengths[4];
193 var<named("arcLength5")>() = arcLengths[5];
194 var<named("arcLength6")>() = arcLengths[6];
195 var<named("arcLength7")>() = arcLengths[7];
196 var<named("arcLength8")>() = arcLengths[8];
197 var<named("arcLength9")>() = arcLengths[9];
198 } else {
199 var<named("hitDistance0")>() = -1;
200 var<named("hitDistance1")>() = -1;
201 var<named("hitDistance2")>() = -1;
202 var<named("hitDistance3")>() = -1;
203 var<named("hitDistance4")>() = -1;
204 var<named("hitDistance5")>() = -1;
205 var<named("hitDistance6")>() = -1;
206 var<named("hitDistance7")>() = -1;
207 var<named("hitDistance8")>() = -1;
208 var<named("hitDistance9")>() = -1;
209 var<named("arcLength0")>() = -1;
210 var<named("arcLength1")>() = -1;
211 var<named("arcLength2")>() = -1;
212 var<named("arcLength3")>() = -1;
213 var<named("arcLength4")>() = -1;
214 var<named("arcLength5")>() = -1;
215 var<named("arcLength6")>() = -1;
216 var<named("arcLength7")>() = -1;
217 var<named("arcLength8")>() = -1;
218 var<named("arcLength9")>() = -1;
219 }
220
221 return true;
222}
StoreObjPtr< EventMetaData > m_eventMetaData
use this to get the eventNumber
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
static constexpr int named(const char *name)
Definition VarSet.h:78

◆ 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< CDCPathBasicVarNames::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 const 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< CDCPathBasicVarNames::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_eventMetaData

StoreObjPtr<EventMetaData> m_eventMetaData
private

use this to get the eventNumber

Definition at line 112 of file CDCPathBasicVarSet.h.

◆ 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<CDCPathBasicVarNames> 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: