Belle II Software development
DriftLengthEstimator Struct Reference

Helper construct implementing the (re)estimation of the drift length for various hit objects. More...

#include <DriftLengthEstimator.h>

Public Member Functions

void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix)
 Add the parameters of the estimator to the module.
 
double updateDriftLength (CDCRecoHit2D &recoHit2D)
 Update the drift length of the reconstructed hit in place.
 
double updateDriftLength (CDCRecoHit3D &recoHit3D, double tanLambda)
 Update the drift length of the reconstructed hit in place.
 
void updateDriftLength (CDCFacet &facet)
 Re-estimate the drift length of all three contained drift circles.
 
void updateDriftLength (CDCSegment2D &segment)
 Update the drift length of the contained reconstructed hit in place.
 
void updateDriftLength (CDCSegment3D &segment, double tanLambda)
 Update the drift length of the contained reconstructed hit in place.
 
void updateDriftLength (CDCTrack &track, double tanLambda)
 Update the drift length of the contained reconstructed hit in place.
 

Public Attributes

bool m_param_useAlphaInDriftLength = true
 Parameter : Switch to serve the alpha angle to the drift length translator.
 
double m_param_tofMassScale = NAN
 Parameter : Mass to estimate the velocity in the flight time to the hit.
 

Detailed Description

Helper construct implementing the (re)estimation of the drift length for various hit objects.

Definition at line 36 of file DriftLengthEstimator.h.

Member Function Documentation

◆ exposeParameters()

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

Add the parameters of the estimator to the module.

Definition at line 43 of file DriftLengthEstimator.cc.

44{
45 moduleParamList->addParameter(prefixed(prefix, "useAlphaInDriftLength"),
47 "Switch to serve the alpha angle to the drift length translator",
49
50 moduleParamList->addParameter(prefixed(prefix, "tofMassScale"),
52 "Mass to estimate the velocity in the flight time to the hit",
54}
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
double m_param_tofMassScale
Parameter : Mass to estimate the velocity in the flight time to the hit.
bool m_param_useAlphaInDriftLength
Parameter : Switch to serve the alpha angle to the drift length translator.

◆ updateDriftLength() [1/6]

void updateDriftLength ( CDCFacet facet)

Re-estimate the drift length of all three contained drift circles.

Using the additional flight direction information the accuracy of the drift length can be increased a lot helping the filters following this step

Definition at line 87 of file DriftLengthEstimator.cc.

88{
89 CDC::RealisticTDCCountTranslator tdcCountTranslator;
90
91 const UncertainParameterLine2D& line = facet.getFitLine();
92 Vector2D flightDirection = line->tangential();
93 Vector2D centralPos2D = line->closest(facet.getMiddleWire().getRefPos2D());
94 double alpha = centralPos2D.angleWith(flightDirection);
96 alpha = 0;
97 }
98
99 auto doUpdate = [&](CDCRLWireHit & rlWireHit, Vector2D recoPos2D) {
100 const CDCWire& wire = rlWireHit.getWire();
101 const CDCHit* hit = rlWireHit.getWireHit().getHit();
102 const bool rl = rlWireHit.getRLInfo() == ERightLeft::c_Right;
103 const double beta = 1;
104 double flightTimeEstimate = FlightTimeEstimator::instance().getFlightTime2D(recoPos2D, alpha, beta);
105 double driftLength = tdcCountTranslator.getDriftLength(hit->getTDCCount(),
106 wire.getWireID(),
107 flightTimeEstimate,
108 rl,
109 wire.getRefZ(),
110 alpha);
111 rlWireHit.setRefDriftLength(driftLength);
112 };
113
114 doUpdate(facet.getStartRLWireHit(), facet.getStartRecoPos2D());
115 doUpdate(facet.getMiddleRLWireHit(), facet.getMiddleRecoPos2D());
116 doUpdate(facet.getEndRLWireHit(), facet.getEndRecoPos2D());
117
118 // More accurate implementation
119 // double startDriftLength = updateDriftLength(facet.getStartRecoHit2D());
120 // facet.getStartRLWireHit().setRefDriftLength(startDriftLength);
121
122 // double middleDriftLength = updateDriftLength(facet.getMiddleRecoHit2D());
123 // facet.getMiddleRLWireHit().setRefDriftLength(middleDriftLength);
124
125 // double endDriftLength = updateDriftLength(facet.getEndRecoHit2D());
126 // facet.getEndRLWireHit().setRefDriftLength(endDriftLength);
127}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
Translator mirroring the realistic Digitization.
double getDriftLength(unsigned short tdcCount, const WireID &wireID=WireID(), double timeOfFlightEstimator=0, bool leftRight=false, double z=0, double alpha=0, double theta=static_cast< double >(TMath::Pi()/2.), unsigned short adcCount=0) override
Get Drift length.
Vector2D getEndRecoPos2D() const
Getter for the reconstructed position at the third hit on the fit line.
Definition: CDCFacet.cc:81
const UncertainParameterLine2D & getFitLine() const
Getter for the contained line fit information.
Definition: CDCFacet.h:61
Vector2D getMiddleRecoPos2D() const
Getter for the reconstructed position at the second hit on the fit line.
Definition: CDCFacet.cc:76
Vector2D getStartRecoPos2D() const
Getter for the reconstructed position at the first hit on the fit line.
Definition: CDCFacet.cc:71
const CDCWire & getMiddleWire() const
Getter for the wire the second oriented wire hit is based on.
CDCRLWireHit & getStartRLWireHit()
Getter for the first oriented wire hit.
CDCRLWireHit & getEndRLWireHit()
Getter for the third oriented wire hit.
CDCRLWireHit & getMiddleRLWireHit()
Getter for the second oriented wire hit.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:41
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
Definition: CDCRLWireHit.h:192
void setRefDriftLength(double driftLength)
Setter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:210
const CDCWire & getWire() const
Getter for the wire the oriented hit associated to.
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRLWireHit.h:234
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition: CDCWireHit.h:159
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:58
const WireID & getWireID() const
Getter for the wire id.
Definition: CDCWire.h:122
const Vector2D & getRefPos2D() const
Getter for the wire reference position for 2D tracking Gives the wire's reference position projected ...
Definition: CDCWire.h:229
double getRefZ() const
Getter for the wire reference z coordinate Gives the wire's reference z coordinate.
Definition: CDCWire.h:236
static const FlightTimeEstimator & instance(std::unique_ptr< FlightTimeEstimator > replacement=nullptr)
Getter for the instance.
virtual double getFlightTime2D(const Vector2D &, double, double=1) const
Default estimator for the flight time.
A parameter line including including an line covariance matrix which is interpreted as located in the...
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition: Vector2D.h:32
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition: Vector2D.h:197

◆ updateDriftLength() [2/6]

double updateDriftLength ( CDCRecoHit2D recoHit2D)

Update the drift length of the reconstructed hit in place.

Definition at line 56 of file DriftLengthEstimator.cc.

57{
58 CDC::RealisticTDCCountTranslator tdcCountTranslator;
59
60 Vector2D flightDirection = recoHit2D.getFlightDirection2D();
61 Vector2D recoPos2D = recoHit2D.getRecoPos2D();
62 double alpha = recoPos2D.angleWith(flightDirection);
63 const double beta = 1;
64 double flightTimeEstimate = FlightTimeEstimator::instance().getFlightTime2D(recoPos2D, alpha, beta);
65
66 const CDCWire& wire = recoHit2D.getWire();
67 const CDCHit* hit = recoHit2D.getWireHit().getHit();
68 const bool rl = recoHit2D.getRLInfo() == ERightLeft::c_Right;
69
71 alpha = 0;
72 }
73
74 double driftLength = tdcCountTranslator.getDriftLength(hit->getTDCCount(),
75 wire.getWireID(),
76 flightTimeEstimate,
77 rl,
78 wire.getRefZ(),
79 alpha);
80 if (driftLength > -2 and driftLength < 16) {
81 bool snapRecoPos = true;
82 recoHit2D.setRefDriftLength(driftLength, snapRecoPos);
83 }
84 return driftLength;
85}
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the reconstructed hit.
Definition: CDCRecoHit2D.h:193
void setRefDriftLength(double driftLength, bool snapRecoPos)
Setter for the drift length at the wire reference position.
const CDCWire & getWire() const
Getter for the wire the reconstructed hit associated to.
Definition: CDCRecoHit2D.h:175
Vector2D getFlightDirection2D() const
Getter for the direction of flight.
Definition: CDCRecoHit2D.h:256
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
Definition: CDCRecoHit2D.h:238
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRecoHit2D.h:205

◆ updateDriftLength() [3/6]

double updateDriftLength ( CDCRecoHit3D recoHit3D,
double  tanLambda 
)

Update the drift length of the reconstructed hit in place.

Definition at line 136 of file DriftLengthEstimator.cc.

138{
139 CDC::RealisticTDCCountTranslator tdcCountTranslator;
140
141 Vector2D flightDirection = recoHit3D.getFlightDirection2D();
142 const Vector3D& recoPos3D = recoHit3D.getRecoPos3D();
143 const Vector2D& recoPos2D = recoPos3D.xy();
144 double alpha = recoPos2D.angleWith(flightDirection);
145 const double beta = 1;
146 double flightTimeEstimate = FlightTimeEstimator::instance().getFlightTime2D(recoPos2D, alpha, beta);
147
148 if (std::isnan(tanLambda)) {
149 tanLambda = recoPos3D.z() / recoPos3D.cylindricalR();
150 }
151 const double theta = M_PI / 2 - std::atan(tanLambda);
152 flightTimeEstimate *= hypot2(1, tanLambda);
153
154 const CDCWire& wire = recoHit3D.getWire();
155 const CDCHit* hit = recoHit3D.getWireHit().getHit();
156 const bool rl = recoHit3D.getRLInfo() == ERightLeft::c_Right;
157 double driftLength =
158 tdcCountTranslator.getDriftLength(hit->getTDCCount(),
159 wire.getWireID(),
160 flightTimeEstimate,
161 rl,
162 recoPos3D.z(),
163 alpha,
164 theta,
165 hit->getADCCount());
166 if (driftLength > -2 and driftLength < 16) {
167 bool snapRecoPos = true;
168 recoHit3D.setRecoDriftLength(driftLength, snapRecoPos);
169 }
170 return driftLength;
171}
const CDCWireHit & getWireHit() const
Getter for the wire hit.
Definition: CDCRecoHit3D.h:238
const Vector3D & getRecoPos3D() const
Getter for the 3d position of the hit.
Definition: CDCRecoHit3D.h:285
const CDCWire & getWire() const
Getter for the wire.
Definition: CDCRecoHit3D.h:226
Vector2D getFlightDirection2D() const
Getter for the direction of flight.
Definition: CDCRecoHit3D.h:312
void setRecoDriftLength(double driftLength, bool snapRecoPos)
Setter to update the drift length of the hit.
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRecoHit3D.h:267
A three dimensional vector.
Definition: Vector3D.h:33
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition: Vector3D.h:508
double cylindricalR() const
Getter for the cylindrical radius ( xy projected norm )
Definition: Vector3D.h:534
double z() const
Getter for the z coordinate.
Definition: Vector3D.h:496

◆ updateDriftLength() [4/6]

void updateDriftLength ( CDCSegment2D segment)

Update the drift length of the contained reconstructed hit in place.

Definition at line 129 of file DriftLengthEstimator.cc.

130{
131 for (CDCRecoHit2D& recoHit2D : segment) {
132 updateDriftLength(recoHit2D);
133 }
134}
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:47
double updateDriftLength(CDCRecoHit2D &recoHit2D)
Update the drift length of the reconstructed hit in place.

◆ updateDriftLength() [5/6]

void updateDriftLength ( CDCSegment3D segment,
double  tanLambda 
)

Update the drift length of the contained reconstructed hit in place.

Definition at line 174 of file DriftLengthEstimator.cc.

176{
177 for (CDCRecoHit3D& recoHit3D : segment3D) {
178 updateDriftLength(recoHit3D, tanLambda);
179 }
180}
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:52

◆ updateDriftLength() [6/6]

void updateDriftLength ( CDCTrack track,
double  tanLambda 
)

Update the drift length of the contained reconstructed hit in place.

Definition at line 182 of file DriftLengthEstimator.cc.

184{
185 for (CDCRecoHit3D& recoHit3D : track) {
186 updateDriftLength(recoHit3D, tanLambda);
187 }
188}

Member Data Documentation

◆ m_param_tofMassScale

double m_param_tofMassScale = NAN

Parameter : Mass to estimate the velocity in the flight time to the hit.

Definition at line 67 of file DriftLengthEstimator.h.

◆ m_param_useAlphaInDriftLength

bool m_param_useAlphaInDriftLength = true

Parameter : Switch to serve the alpha angle to the drift length translator.

Definition at line 64 of file DriftLengthEstimator.h.


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