130 {
132 if (!cache.candidate->getCaloExtension()) {
133 if (!cache.extensionContainer) {
134 std::unique_ptr<Trk::CaloExtension> caloExtension =
136 if (!caloExtension || !caloExtension->muonEntryLayerIntersection()) {
137 ATH_MSG_VERBOSE(
"Failed to create the calo extension for "<<cache.candidate->toString());
138 return false;
139 }
140 cache.candidate->setExtension(caloExtension);
141 } else {
142 const Trk::CaloExtension* caloExtension =
m_caloExtensionTool->caloExtension(cache.candidate->indetTrackParticle(),
143 *cache.extensionContainer);
145 ATH_MSG_VERBOSE(
"Failed to create the calo extension for "<<cache.candidate->toString());
146 return false;
147 }
148 cache.candidate->setExtension(caloExtension);
149 }
150 }
151
152 if (!cache.createSystemExtension) {
153 ATH_MSG_VERBOSE(
"No system extension is required for "<<cache.candidate->toString());
154 return true;
155 }
156
157 const Trk::TrackParameters* currentPars = cache.candidate->getCaloExtension()->muonEntryLayerIntersection();
158
159
162
163
164 std::vector<MuonSystemExtension::Intersection> intersections;
165
166
167 std::vector<std::shared_ptr<Trk::TrackParameters> > trackParametersVec;
168
169
170 for (const MuonLayerSurface& it : surfaces) {
171
172 const Trk::Surface& surface = *
it.surfacePtr;
176 <<
" r " << surface.
center().perp() <<
" z " << surface.
center().z());
177
178 std::unique_ptr<Trk::TrackParameters> exPars{
m_extrapolator->extrapolate(ctx, *currentPars, surface,
180 if (!exPars) {
182 continue;
183 }
184 ATH_MSG_DEBUG(
"Extrapolated in event "<<ctx.eventID().event_number()<<
" track @ "<<
m_printer->print(*exPars));
185
186
191 continue;
192 }
193
194
195 std::shared_ptr<Trk::TrackParameters> sharedPtr{std::move(exPars)};
196 trackParametersVec.emplace_back(sharedPtr);
197
198 intersections.emplace_back(sharedPtr, it);
199 constexpr double TenCm = 10. * Gaudi::Units::cm;
200 if(std::hypot(sigma_lx, sigma_ly) < std::max(TenCm, 10. * std::hypot(
Amg::error(*currentPars->covariance(),
Trk::locX),
202
203 currentPars = sharedPtr.get();
204 } else {
205 ATH_MSG_DEBUG(
"Extrapolation reached at "<<
m_printer->print(*sharedPtr)<<
" has larger uncertainties than "<<
207 }
208 }
209 ATH_MSG_DEBUG(
"Completed extrapolation: destinations " << surfaces.size() <<
" intersections " << intersections.size());
210 if (intersections.empty()){
211 ATH_MSG_DEBUG(
"No system extensions are made for "<<cache.candidate->toString()
212 <<" will accept the candidate: "<< (!cache.requireSystemExtension ? "si": "no"));
213 return !cache.requireSystemExtension;
214 }
215 cache.candidate->setExtension(std::make_unique<MuonSystemExtension>(cache.candidate->getCaloExtension()->muonEntryLayerIntersection(),
216 std::move(intersections)));
217 return true;
218 }
const TrackParameters * muonEntryLayerIntersection() const
access to intersection with the muon entry layer return nullptr if the intersection failed
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
bool hasPositiveDiagElems(const AmgSymMatrix(N) &mat)
Returns true if all diagonal elements of the covariance matrix are finite aka sane in the above defin...