If you want an additional constraint can be taken into account.
95 {
96
97 bool useCutOnDistance=false;
99 {
100 useCutOnDistance=true;
101 }
102
103
104
105
106
108 weightMatrixPositionConstraint.setIdentity();
109 if (constraint !=
nullptr) {
110 weightMatrixPositionConstraint = constraint->covariancePosition().inverse();
111 }
112
113
114 std::vector<PositionAndWeight> CrossingPointsAndWeights;
115 std::vector<Amg::Vector3D> CrossingPoints;
116
117
118 const std::vector<const Trk::TrackParameters*>::const_iterator
begin=perigeeList.begin();
119 const std::vector<const Trk::TrackParameters*>::const_iterator
end=perigeeList.end();
120
121 for (std::vector<const Trk::TrackParameters*>::const_iterator i=begin;
i!=
end-1;++
i) {
122
124 if (MyI==nullptr) {
125 ATH_MSG_WARNING(
"Neutrals not supported for seeding. Rejecting this track..." );
126 continue;
127 }
128
129 for (std::vector<const Trk::TrackParameters*>::const_iterator j=i+1;j!=
end;++j) {
130
132 if (MyJ==nullptr) {
133 ATH_MSG_WARNING(
"Neutrals not supported for seeding. Rejecting this track..." );
134 continue;
135 }
136
137#ifdef CROSSDISTANCESSEEDFINDER_DEBUG
138
141#endif
142
143 try {
144
145 std::optional<ITrkDistanceFinder::TwoPoints>
result
147 if (!result) {
ATH_MSG_DEBUG(
"Problem with distance finder: THIS POINT WILL BE SKIPPED!" );
148 }
149 else
150 {
151
153#ifdef CROSSDISTANCESSEEDFINDER_DEBUG
155 " y: " <<
result->first.y() <<
156 " z: " <<
result->first.z() );
158 " y: " <<
result->second.y() <<
159 " z: " <<
result->second.z() );
161#endif
162
164
166 {
169
171
172 if (constraint!=nullptr) {
173
176 ATH_MSG_DEBUG(
"position x: " << DeltaP.x() <<
"position y: " << DeltaP.y() <<
"position z: " << DeltaP.z() );
177 DeltaPConv[0]=DeltaP.x();
178 DeltaPConv[1]=DeltaP.y();
179 DeltaPConv[2]=DeltaP.z();
180
181
182 double chi2=DeltaPConv.transpose()*weightMatrixPositionConstraint*DeltaPConv;
183
186
188
189 }
191 {
192 CrossingPointsAndWeights.push_back(thispoint);
193 }
194 }
195 else
196 {
199 {
200 CrossingPoints.push_back(thispoint);
201 }
202 }
203 }
204 } catch (...) {
205 ATH_MSG_ERROR(
"Something wrong in distance calculation: please report..." );
206 }
207 }
208
209 }
210
211
212
213
214 if (CrossingPoints.empty() && CrossingPointsAndWeights.empty())
215 {
217 }
218
220
222 {
224 }
225 else
226 {
228 }
229
230#ifdef CROSSDISTANCESSEEDFINDER_DEBUG
231 ATH_MSG_INFO(
"Resulting mean POINT FOUND: x: " << myresult.x() <<
232 " y: " << myresult.y() <<
233 " z: " << myresult.z() );
234#endif
235
236
237 return myresult;
238
239
240
241
242 }
#define AmgSymMatrix(dim)
constexpr int pow(int base, int exp) noexcept
ToolHandle< ITrkDistanceFinder > m_distancefinder
ToolHandle< IMode3dFinder > m_mode3dfinder
const Amg::Vector3D & position() const
Returns the 3-pos.
double chi2(TH1 *h0, TH1 *h1)
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
std::pair< Amg::Vector3D, double > PositionAndWeight
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee