27 declareInterface<MuPatHitTool>(
this);
41 return StatusCode::SUCCESS;
48 double momentum{1.e8},
charge{0.};
49 std::unique_ptr<const Trk::TrackParameters> pars{
m_edmHelperSvc->createTrackParameters(seg, momentum,
charge)};
59 const std::vector<const Trk::MeasurementBase*>& measVec,
MuPatHitList& hitList)
const {
78 std::unique_ptr<const Trk::TrackParameters> exPars;
79 if (pars.associatedSurface() == broadMeas->associatedSurface()) {
80 exPars = pars.uniqueClone();
81 ATH_MSG_VERBOSE(
" start parameters and measurement expressed at same surface, cloning parameters ");
84 if (!exPars) {
continue; }
89 std::unique_ptr<MuPatHit> hit = std::make_unique<MuPatHit>(std::move(exPars), meas->uniqueClone(), std::move(broadMeas), hitInfo);
90 hitList.push_back(std::move(hit));
133 std::unique_ptr<MuPatHit> hit = std::make_unique<MuPatHit>(pars->uniqueClone(), meas->
uniqueClone(), std::move(broadMeas), hitInfo);
135 double residual{0.}, pull{0.};
137 hit->setResidual(residual,pull);
138 hitList.push_back(std::move(hit));
151 tmpList.reserve(hitList1.size() + hitList2.size());
153 if (!hitList1.empty()) {
156 std::merge(hitList1.begin(), hitList1.end(), hitList2.begin(), hitList2.end(),
157 std::back_inserter(tmpList), isLargerCal);
162 outList.reserve(tmpList.size());
163 std::set<Identifier> used_hits{};
165 std::copy_if(std::make_move_iterator(tmpList.begin()), std::make_move_iterator(tmpList.end()), std::back_inserter(outList),
166 [&used_hits](
const MuPatHitPtr& pathit) { return used_hits.insert(pathit->info().id).second; });
174 measVec.reserve(hitList.size());
179 const Trk::MeasurementBase* meas = usePreciseHits ? &hit->preciseMeasurement() : &hit->broadMeasurement();
180 measVec.push_back(meas);
187 MuPatHitIt lit = hitList.begin(), lit_end = hitList.end();
188 for (; lit != lit_end; ++lit) {
190 if (hit.
info().
id ==
id) {
202 MuPatHitIt lit = hitList.begin(), lit_end = hitList.end();
203 for (; lit != lit_end; ++lit) {
257 ATH_MSG_WARNING(
" found hit with a MDT Identifier that is not a MdtDriftCircleOnTrack "
263 return std::unique_ptr<const Trk::MeasurementBase>(
m_mdtRotCreator->updateError(*mdt));
277 return std::unique_ptr<const Trk::MeasurementBase>(
287 if (!measurements)
return false;
289 std::set<Identifier> ids;
293 for (; mit != mit_end; ++mit) {
295 if (!
id.is_valid())
continue;
303 MuPatHitIt lit = hitList.begin(), lit_end = hitList.end();
304 for (; lit != lit_end; ++lit) {
306 if (!ids.count(hit.
info().
id)) {
315 std::ostringstream sout;
319 std::vector<std::string> idStrings;
320 std::vector<std::string> dataStrings;
321 idStrings.reserve(hitList.size());
322 unsigned int idWidth = 0;
323 std::string
result =
"first ";
324 bool isLarger =
true;
333 if (itNext != it_end) ++itNext;
334 for (; it != it_end; ++it, ++itNext) {
337 std::string idStr =
id.is_valid() ?
m_idHelperSvc->toString(
id) :
"pseudo-measurement";
338 idStrings.push_back(idStr);
339 if (idStr.length() > idWidth) idWidth = idStr.length();
341 std::ostringstream dataOss;
343 dataOss <<
"r " << std::fixed << std::setprecision(0) << std::setw(5) << pars.position().perp() <<
" z " << std::fixed
344 << std::setprecision(0) << std::setw(6) << pars.position().z();
347 dataOss <<
" theta " << std::fixed << std::setprecision(5) << std::setw(7) << pars.momentum().theta() <<
" phi "
348 << std::fixed << std::setprecision(3) << std::setw(6) << pars.momentum().phi();
351 dataOss <<
" q*p(GeV) " << std::scientific << std::setprecision(3) << std::setw(10)
352 << pars.momentum().mag() * pars.charge() / 1000.;
356 dataOss <<
" " <<
result <<
" dist " << distance;
357 dataStrings.push_back(dataOss.str());
358 if (itNext != it_end) {
359 isLarger = isLargerCal(*it, *itNext);
361 distance = distCal(*it, *itNext);
362 result = isLarger ?
"larger " :
"smaller";
364 if (isLarger == isLargerCal(*itNext, *it)) {
366 }
else if (!isLarger) {
367 result +=
" sorting problem ";
373 unsigned int n = idStrings.size();
374 for (
unsigned int i = 0; i < n; ++i) {
375 sout <<
" " << std::left << std::setw(idWidth) << idStrings[i] << std::right <<
" " << dataStrings[i];
376 if (i != n - 1) sout << std::endl;
385 if (itNext != it_end) ++itNext;
386 bool isLarger =
true;
389 for (; itNext != it_end; ++it, ++itNext) {
390 isLarger = isLargerCal(*it, *itNext);
391 bool sameSurface = (isLarger == isLargerCal(*it, *itNext));
392 if (!isLarger && !sameSurface)
return false;
393 if (sameSurface)
return false;
398 double& residualPull)
const {
399 std::optional<Trk::ResidualPull> resPull(
402 residual = resPull->residual().front();
403 residualPull = resPull->pull().front();
405 residual = residualPull = -999;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
double charge(const T &p)
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
bool is_valid() const
Check if id is in a valid state.
Class to represent the calibrated clusters created from CSC strips.
virtual const CscPrepData * prepRawData() const override final
Returns the CscPrepData - is a CscPrepData in this scope.
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
const Trk::MeasurementBase & broadMeasurement() const
returns broad measurement
const Trk::MeasurementBase & preciseMeasurement() const
returns precise measurement
const Info & info() const
returns a reference to the hit info
virtual const Amg::Vector3D & globalPosition() const override
Returns global position.
This is the common class for 3D segments used in the muon spectrometer.
Default for both collision and cosmic parameter sorting.
This class is the pure abstract base class for all fittable tracking measurements.
std::unique_ptr< MeasurementBase > uniqueClone() const
NVI Clone giving up unique pointer.
@ Unbiased
RP with track state that has measurement not included.
const std::vector< const Trk::MeasurementBase * > & containedMeasurements() const
returns the vector of Trk::MeasurementBase objects
represents the track state (measurement, material, fit parameters and quality) at a surface.
const MeasurementBase * measurementOnTrack() const
returns MeasurementBase const overload
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
@ Scatterer
This represents a scattering point on the track, and so will contain TrackParameters and MaterialEffe...
@ Hole
A hole on the track - this is defined in the following way.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
std::vector< MuPatHitPtr > MuPatHitList
std::shared_ptr< MuPatHit > MuPatHitPtr
MuPatHitList::iterator MuPatHitIt
MuPatHitList::const_iterator MuPatHitCit
ParametersBase< TrackParametersDim, Charged > TrackParameters
void stable_sort(DataModel_detail::iterator< DVL > beg, DataModel_detail::iterator< DVL > end)
Specialization of stable_sort for DataVector/List.
Identifier id
Identifier of the measurement. Is invalid in cases of pseudo measurements.
bool isEndcap
Hit in the endcap?
MuonStationIndex::StIndex stIdx
Station index of the Identifier BI.
bool measuresPhi
Does the hit constrain phi?
Type type
Measurement type as defined above.
Status status
Flag whether the hit is on Tack or not.
bool isSmall
Small or large sector?