ATLAS Offline Software
MuonRefitTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MuonRefitTool.h"
6 
21 #include "TrkSurfaces/Surface.h"
23 #include "TrkTrack/Track.h"
27 
28 namespace Muon {
29 
30  MuonRefitTool::MuonRefitTool(const std::string& ty, const std::string& na, const IInterface* pa) :
31  AthAlgTool(ty, na, pa),
32  m_errorStrategyBEE(MuonDriftCircleErrorStrategyInput()),
33  m_errorStrategyEE(MuonDriftCircleErrorStrategyInput()),
34  m_errorStrategyBIS78(MuonDriftCircleErrorStrategyInput()),
35  m_errorStrategyBXE(MuonDriftCircleErrorStrategyInput()),
36  m_errorStrategyEEL1C05(MuonDriftCircleErrorStrategyInput()),
37  m_errorStrategyBarEnd(MuonDriftCircleErrorStrategyInput()),
38  m_errorStrategySL(MuonDriftCircleErrorStrategyInput()),
39  m_errorStrategyTwoStations(MuonDriftCircleErrorStrategyInput()),
40  m_errorStrategy(MuonDriftCircleErrorStrategyInput()),
41  m_muonErrorStrategy(MuonDriftCircleErrorStrategyInput()) {
42  declareInterface<IMuonRefitTool>(this);
43  }
44 
46  ATH_MSG_INFO("Initializing MuonRefitTool " << name());
47 
48  ATH_CHECK(m_printer.retrieve());
49  ATH_CHECK(m_edmHelperSvc.retrieve());
50  ATH_CHECK(m_idHelperSvc.retrieve());
51  m_BME_station = m_idHelperSvc->mdtIdHelper().stationNameIndex("BME");
52 
53  if (m_alignmentErrors) {
54  if (!m_alignErrorTool.empty()) ATH_CHECK(m_alignErrorTool.retrieve());
55  } else {
56  m_alignErrorTool.disable();
57  }
58  ATH_CHECK(m_muonExtrapolator.retrieve());
59  ATH_CHECK(m_trackFitter.retrieve());
60 
61  ATH_MSG_INFO("Retrieved " << m_trackFitter);
62 
63  ATH_CHECK(m_mdtRotCreator.retrieve());
64  if (!m_compClusterCreator.empty()) ATH_CHECK(m_compClusterCreator.retrieve());
65 
66  if (!m_t0Fitter.empty()) {
67  ATH_CHECK(m_t0Fitter.retrieve());
68  ATH_MSG_INFO("Retrieved " << m_t0Fitter);
69  }
70 
72 
91 
94 
97 
100 
103 
106 
109 
113 
117 
121 
125 
126  ATH_MSG_INFO("Options:");
127  if (m_deweightBEE) ATH_MSG_INFO(" Deweight BEE");
128  if (m_deweightEE) ATH_MSG_INFO(" Deweight EE");
129  if (m_deweightBIS78) ATH_MSG_INFO(" Deweight BIS78");
130  if (m_deweightBME) ATH_MSG_INFO(" Deweight BME");
131  if (m_deweightBOE) ATH_MSG_INFO(" Deweight BOE");
132  if (m_deweightEEL1C05) ATH_MSG_INFO(" Deweight EEL1C05");
133  if (m_deweightTwoStationTracks) ATH_MSG_INFO(" Deweight Two stations");
134  return StatusCode::SUCCESS;
135  }
136 
138  double scaleRefit = m_nrefits != 0 ? 1. / (double)m_nrefits : 1.;
139  ATH_MSG_INFO("Number of refits "
140  << m_nrefits << std::endl
141  << "Good " << scaleRefit * m_ngoodRefits << std::endl
142  << "Failed Outlier removal " << scaleRefit * m_failedOutlierRemoval << std::endl
143  << "Failed Error Update " << scaleRefit * m_failedErrorUpdate << std::endl
144  << "Failed Refit " << scaleRefit * m_failedRefit << std::endl
145  << "Failed Extrapolation to Muon Entry " << scaleRefit * m_failedExtrapolationMuonEntry);
146  return StatusCode::SUCCESS;
147  }
148  std::unique_ptr<Trk::Track> MuonRefitTool::refit(const Trk::Track& track, const EventContext& ctx,
149  const IMuonRefitTool::Settings* set) const {
150  const IMuonRefitTool::Settings& settings = set ? *set : m_defaultSettings;
151 
152  // to keep track of the latest track
153  std::unique_ptr<Trk::Track> newTrack;
154  ++m_nrefits;
155  if (settings.removeOutliers) {
156  std::unique_ptr<Trk::Track> cleanedTrack = removeOutliers(track, settings);
157  if (!cleanedTrack) {
158  ATH_MSG_DEBUG("Track lost during outlier removal");
160  return std::make_unique<Trk::Track>(track);
161  }
162  if (cleanedTrack->perigeeParameters() != track.perigeeParameters()) {
163  ATH_MSG_DEBUG("Outlier removal removed hits from track");
164  }
165  newTrack.swap(cleanedTrack);
166  } else
167  newTrack = std::make_unique<Trk::Track>(track);
168 
169  if (settings.updateErrors) {
170  ATH_MSG_DEBUG("track hits before error updating: " << m_printer->printMeasurements(*newTrack));
171  std::unique_ptr<Trk::Track> updateErrorTrack =
172  m_alignmentErrors ? updateAlignmentErrors(*newTrack, ctx, settings) : updateErrors(*newTrack, ctx, settings);
173  if (!updateErrorTrack) {
174  ATH_MSG_WARNING("Failed to update errors");
176  return newTrack;
177  }
178  newTrack.swap(updateErrorTrack);
179  }
180 
181  if (settings.refit) {
182  ATH_MSG_DEBUG("Original track" << m_printer->print(track));
183 
184  // do not put AEOTs on extremely bad chi2 tracks and do not refit them
185 
186  std::unique_ptr<Trk::Track> refittedTrack;
187  if (track.fitQuality() && track.fitQuality()->chiSquared() < 10000 * track.fitQuality()->numberDoF())
188  refittedTrack = std::unique_ptr<Trk::Track>(m_trackFitter->fit(ctx, *newTrack, false, Trk::muon));
189  if (!refittedTrack) {
190  ATH_MSG_DEBUG("Failed to refit track");
191  ++m_failedRefit;
192  // BUG fix Peter
193  return std::make_unique<Trk::Track>(track);
194  }
195  ATH_MSG_DEBUG("Refitted track" << m_printer->print(*refittedTrack));
196  ATH_MSG_DEBUG("Refitted track" << m_printer->printMeasurements(*refittedTrack));
197  newTrack.swap(refittedTrack);
198  }
199 
200  if (settings.extrapolateToMuonEntry) {
201  std::unique_ptr<Trk::Track> extrapolatedTrack(m_muonEntryTrackExtrapolator->extrapolate(*newTrack, ctx));
202  if (!extrapolatedTrack) {
203  ATH_MSG_WARNING("Failed to back-extrapolate track");
205  return newTrack;
206  }
207  ATH_MSG_DEBUG("Entry track " << m_printer->print(*extrapolatedTrack));
208  newTrack.swap(extrapolatedTrack);
209  }
210  ++m_ngoodRefits;
211 
212  return newTrack;
213  }
214  std::vector<std::unique_ptr<Trk::Track>> MuonRefitTool::refit(const std::vector<Trk::Track*>& tracks, const EventContext& ctx,
215  const IMuonRefitTool::Settings* set) const {
216  std::vector<std::unique_ptr<Trk::Track>> refittedTracks;
217  refittedTracks.reserve(tracks.size());
218  for (const Trk::Track* it : tracks) { refittedTracks.emplace_back(refit(*it, ctx, set)); }
219 
220  return refittedTracks;
221  }
222 
223  std::unique_ptr<Trk::Track> MuonRefitTool::updateAlignmentErrors(const Trk::Track& track, const EventContext& ctx,
224  const IMuonRefitTool::Settings& settings) const {
225  // first scale the Mdt errors
226 
227  std::unique_ptr<Trk::Track> updatedTrack = updateMdtErrors(track, ctx, settings);
228 
229  std::unique_ptr<Trk::Track> updatedAEOTsTrack = m_simpleAEOTs ? makeSimpleAEOTs(*updatedTrack) : makeAEOTs(*updatedTrack);
230 
231  return updatedAEOTsTrack;
232  }
233 
234  std::unique_ptr<Trk::Track> MuonRefitTool::makeAEOTs(const Trk::Track& track) const {
235  //
236  // use the new AlignmentEffectsOnTrack class and alignmentErrorTool
237  //
238  if (m_alignErrorTool.empty()) { return std::make_unique<Trk::Track>(track); }
239  //
240  // Use the alignmentErrorTool and store a list of hits with error on position and angle
241  //
242  std::map<std::vector<Identifier>, std::pair<double, double>> alignerrmap;
243 
244  std::vector<Trk::AlignmentDeviation*> align_deviations;
245  m_alignErrorTool->makeAlignmentDeviations(track, align_deviations);
246 
247  int iok = 0;
248  bool isSmallChamber = false;
249  bool isLargeChamber = false;
250  bool isEndcap = false;
251  bool isBarrel = false;
252  std::vector<int> usedRotations;
253 
254  // loop on deviations
255  for (Trk::AlignmentDeviation* it : align_deviations) {
256  double angleError = 0.;
257  double translationError = 0.;
258  bool differentChambers = false;
259  int jdifferent = -1;
260  isSmallChamber = false;
261  isLargeChamber = false;
262  isEndcap = false;
263  isBarrel = false;
264 
265  if (dynamic_cast<MuonAlign::AlignmentTranslationDeviation*>(it)) {
266  translationError = std::sqrt(it->getCovariance(0, 0));
267  // vector to store hit id
268  std::vector<Identifier> hitids;
269  const auto& vec_riowithdev = it->getListOfHits();
270  // bool to decide if deviation should be skipped (if it's for more than 1 station)
271  for (const Trk::RIO_OnTrack* riowithdev : vec_riowithdev) {
272  const Identifier id_riowithdev = riowithdev->identify();
273  if (m_idHelperSvc->isEndcap(id_riowithdev)) {
274  isEndcap = true;
275  } else {
276  isBarrel = true;
277  }
278  if (m_idHelperSvc->isSmallChamber(id_riowithdev)) {
279  isSmallChamber = true;
280  } else {
281  isLargeChamber = true;
282  }
283  hitids.push_back(id_riowithdev);
284  if (hitids.size() > 1 && m_idHelperSvc->chamberId(id_riowithdev) != m_idHelperSvc->chamberId(hitids[0])) {
285  differentChambers = true;
286  jdifferent = hitids.size() - 1;
287  }
288  }
289  bool matchFound = false;
290  if (!hitids.empty()) {
291  int iRot = -1;
292  for (Trk::AlignmentDeviation* itRot : align_deviations) {
293  ++iRot;
294  if (dynamic_cast<MuonAlign::AlignmentRotationDeviation*>(itRot)) {
295  if (itRot->hasValidHashOfHits() && it->hasValidHashOfHits()) {
296  if (itRot->getHashOfHits() == it->getHashOfHits()) {
297  angleError = std::sqrt(itRot->getCovariance(0, 0));
298  matchFound = true;
299  usedRotations.push_back(iRot);
300  }
301  } else {
302  ATH_MSG_ERROR("One of the alignment deviations has an invalid hash created from the hits.");
303  }
304  }
305  if (matchFound) break;
306  }
307  }
308  // if deviation is accepted (i.e. only on one station) store the hit IDs associated with the deviation and the error
309 
310  // store (all) translationError with or without a matched angleError
311  iok++;
312  alignerrmap.insert(std::pair<std::vector<Identifier>, std::pair<double, double>>(
313  hitids, std::pair<double, double>(translationError, angleError)));
314 
315  if (matchFound)
316  ATH_MSG_DEBUG(" AlignmentMap entry " << iok << " filled with nr hitids " << hitids.size() << " "
317  << m_idHelperSvc->toString(hitids[0]) << " translationError " << translationError
318  << " angleError " << angleError);
319  if (!matchFound)
320  ATH_MSG_DEBUG(" AlignmentMap entry No angleError" << iok << " filled with nr hitids " << hitids.size() << " "
321  << m_idHelperSvc->toString(hitids[0]) << " translationError "
322  << translationError << " angleError " << angleError);
323  if (isEndcap) ATH_MSG_DEBUG(" AlignmentMap Endcap Chamber ");
324  if (isBarrel) ATH_MSG_DEBUG(" AlignmentMap Barrel Chamber ");
325  if (isSmallChamber) ATH_MSG_DEBUG(" AlignmentMap Small Chamber ");
326  if (isLargeChamber) ATH_MSG_DEBUG(" AlignmentMap Large Chamber ");
327  if (differentChambers)
328  ATH_MSG_DEBUG(" AlignmentMap entry " << iok << " for different Chamber "
329  << m_idHelperSvc->toString(hitids[jdifferent]));
330  }
331  }
332 
333  // now add the angleErrors that were NOT matched to a translationError
334 
335  int iRot = -1;
336  for (Trk::AlignmentDeviation* itRot : align_deviations) {
337  ++iRot;
338  isSmallChamber = false;
339  isLargeChamber = false;
340  isEndcap = false;
341  isBarrel = false;
342  if (dynamic_cast<MuonAlign::AlignmentRotationDeviation*>(itRot)) {
343  bool used = std::find(usedRotations.begin(), usedRotations.end(), iRot) != usedRotations.end();
344  if (used) continue;
345  ATH_MSG_ERROR("This following code should not be reached anymore!");
346  const auto& vec_riowithdev = itRot->getListOfHits();
347 
348  std::vector<Identifier> hitids;
349  // bool to decide if deviation should be skipped (if it's for more than 1 station)
350  for (const Trk::RIO_OnTrack* riowithdev : vec_riowithdev) {
351  Identifier id_riowithdev = riowithdev->identify();
352  if (m_idHelperSvc->isEndcap(id_riowithdev)) {
353  isEndcap = true;
354  } else {
355  isBarrel = true;
356  }
357  if (m_idHelperSvc->isSmallChamber(id_riowithdev)) {
358  isSmallChamber = true;
359  } else {
360  isLargeChamber = true;
361  }
362  hitids.push_back(id_riowithdev);
363  }
364 
365  double translationError = 0.;
366  double angleError = std::sqrt(itRot->getCovariance(0, 0));
367 
368  iok++;
369  alignerrmap.insert(std::pair<std::vector<Identifier>, std::pair<double, double>>(
370  hitids, std::pair<double, double>(translationError, angleError)));
371  ATH_MSG_DEBUG(" AlignmentMap entry No Translation Error " << iok << " filled with nr hitids " << hitids.size() << " "
372  << m_idHelperSvc->toString(hitids[0]) << " translationError "
373  << translationError << " angleError " << angleError);
374  if (isEndcap) ATH_MSG_DEBUG(" AlignmentMap Endcap Chamber");
375  if (isBarrel) ATH_MSG_DEBUG(" AlignmentMap Barrel Chamber");
376  if (isSmallChamber) ATH_MSG_DEBUG(" AlignmentMap Small Chamber ");
377  if (isLargeChamber) ATH_MSG_DEBUG(" AlignmentMap Large Chamber ");
378  }
379  }
380 
381  // clean-up of alignment deviations
382  for (auto* it : align_deviations) delete it;
383  align_deviations.clear();
384 
385  const Trk::TrackStates* states = track.trackStateOnSurfaces();
386  if (!states) {
387  ATH_MSG_WARNING(" track without states, discarding track ");
388  return nullptr;
389  }
390 
391  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0);
392  typePattern.set(Trk::TrackStateOnSurface::Alignment);
393 
394  std::vector<int> indexAEOTs;
395  std::vector<std::unique_ptr<Trk::TrackStateOnSurface>> tsosAEOTs;
396 
397  ATH_MSG_DEBUG(" AlignmentMap size " << alignerrmap.size());
398 
399  std::set<MuonStationIndex::ChIndex> stationIds;
400 
401  for (const auto& itAli : alignerrmap) {
402  unsigned int imiddle = (itAli.first.size()) / 2;
403  Identifier idMiddle = itAli.first[imiddle];
404  int index = -1;
405  bool found = false;
406  for (const Trk::TrackStateOnSurface* tsit : *states) {
407  index++;
408  const Trk::MeasurementBase* meas = tsit->measurementOnTrack();
409  if (!meas) { continue; }
410  Identifier id = m_edmHelperSvc->getIdentifier(*meas);
411  if (!id.is_valid()) continue;
412 
413  if (m_idHelperSvc->isMdt(id)) stationIds.insert(m_idHelperSvc->chamberIndex(id));
414 
415  // make Alignment Effect using the surface of the TSOS
416 
417  if (idMiddle == id) {
419  const double deltaError = std::max(itAli.second.first, 0.01);
420  const double angleError = std::max(itAli.second.second, 0.000001);
421  auto aEOT = std::make_unique<Trk::AlignmentEffectsOnTrack>(
422  0.,
423  deltaError,
424  0.,
425  angleError,
426  itAli.first,
427  tsit->measurementOnTrack()->associatedSurface());
428  std::unique_ptr<Trk::TrackStateOnSurface> tsosAEOT =
429  std::make_unique<Trk::TrackStateOnSurface>(
430  nullptr,
431  tsit->trackParameters()->uniqueClone(),
432  nullptr,
433  typePattern,
434  std::move(aEOT));
435  indexAEOTs.push_back(index);
436  tsosAEOTs.emplace_back(std::move(tsosAEOT));
437  found = true;
438  break;
439  }
440  }
441  if (!found) ATH_MSG_WARNING(" This should not happen Identifier from AlignmentErrorTool is not found");
442  }
443 
444  //
445  // clone the TSOSs and add the tsosAEOTs
446  //
447  auto trackStateOnSurfaces = std::make_unique<Trk::TrackStates>();
448  trackStateOnSurfaces->reserve(states->size() + indexAEOTs.size());
449  int index = -1;
450  for (const Trk::TrackStateOnSurface* tsit : *states) {
451  index++;
452  for (unsigned int i = 0; i < indexAEOTs.size(); i++) {
453  if (index == indexAEOTs[i]) {
454  if (tsosAEOTs[i])
455  trackStateOnSurfaces->push_back(std::move(tsosAEOTs[i]));
456  else {
457  ATH_MSG_WARNING("There's a trial to push back the same AEOT twice to the track...");
458  }
459  }
460  }
461 
462  // Skip AEOTs that are already present, as they will be added above already
463  if (tsit->alignmentEffectsOnTrack()) {
464  ATH_MSG_DEBUG("makeAEOTs: Skipping insertion of old AEOT!");
465  continue;
466  }
467  trackStateOnSurfaces->push_back(tsit->clone());
468  }
469 
470  if (indexAEOTs.empty() && stationIds.size() > 1) ATH_MSG_WARNING(" Track without AEOT ");
471 
472  std::unique_ptr<Trk::Track> newTrack = std::make_unique<Trk::Track>(track.info(), std::move(trackStateOnSurfaces),
473  track.fitQuality() ? track.fitQuality()->uniqueClone() : nullptr);
474 
475  ATH_MSG_DEBUG(m_printer->print(*newTrack));
476  ATH_MSG_DEBUG(m_printer->printMeasurements(*newTrack));
477 
478  return newTrack;
479  }
480 
481  std::unique_ptr<Trk::Track> MuonRefitTool::makeSimpleAEOTs(const Trk::Track& track) const {
482  // use the new AlignmentEffectsOnTrack class
483 
484  const Trk::TrackStates* states = track.trackStateOnSurfaces();
485  if (!states) {
486  ATH_MSG_WARNING(" track without states, discarding track ");
487  return nullptr;
488  }
489 
490  //
491  // first clone the TSOSs
492  //
493  auto trackStateOnSurfaces = std::make_unique<Trk::TrackStates>();
494  trackStateOnSurfaces->reserve(states->size() + 1);
495  for (const Trk::TrackStateOnSurface* tsit : *states) { trackStateOnSurfaces->push_back(tsit->clone()); }
496 
497  // loop over TSOSs and look for EM or BM chambers
498  std::vector<const Trk::TrackStateOnSurface*> indicesOfAffectedTSOS;
499  std::vector<const Trk::TrackStateOnSurface*> indicesOfAffectedTSOSInner;
500  std::vector<Identifier> indicesOfAffectedIds;
501  std::vector<Identifier> indicesOfAffectedIdsInner;
502  int index {-1}, indexFirst {-1}, indexFirstInner {-1};
503  for (const Trk::TrackStateOnSurface* tsit : *trackStateOnSurfaces) {
504  ++index;
505  if (!tsit) continue; // sanity check
506 
507  const Trk::TrackParameters* pars = tsit->trackParameters();
508  if (!pars) continue;
509 
510  // check whether state is a measurement
511  const Trk::MeasurementBase* meas = tsit->measurementOnTrack();
512  if (!meas) { continue; }
513 
514  // skip outliers
515  if (tsit->type(Trk::TrackStateOnSurface::Outlier)) continue;
516  if (tsit->alignmentEffectsOnTrack()) {
517  ATH_MSG_WARNING(" AlignmentEffectOnTrack is already on track skip it");
518  continue;
519  }
520  Identifier id = m_edmHelperSvc->getIdentifier(*meas);
521  // Not a ROT, else it would have had an identifier. Keep the TSOS.
522  if (!id.is_valid() || !m_idHelperSvc->isMuon(id)) continue;
523  MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(id);
524  // skip phi measurements
525  if ((m_idHelperSvc->isTrigger(id) && m_idHelperSvc->measuresPhi(id)) ||
526  (m_idHelperSvc->isCsc(id) && m_idHelperSvc->measuresPhi(id)))
527  continue;
528  if (m_addAll) {
529  // skip RPC and TGC eta (to avoid code crashes)
530  if (m_idHelperSvc->isTrigger(id)) continue;
531  if (indexFirst == -1) indexFirst = index;
532  indicesOfAffectedTSOS.push_back(tsit);
533  indicesOfAffectedIds.push_back(id);
534  } else {
535  // skip trigger hits and CSC phi measurements and select precision hits
536  if (m_idHelperSvc->isTrigger(id)) continue;
537  if (stIndex == MuonStationIndex::BM || stIndex == MuonStationIndex::EM) {
538  if (indexFirst == -1) indexFirst = index;
539  indicesOfAffectedTSOS.push_back(tsit);
540  indicesOfAffectedIds.push_back(id);
541  // two alignment discontinuities
542  if (m_addTwo) {
543  if (indexFirstInner == -1) indexFirstInner = index;
544  indicesOfAffectedTSOSInner.push_back(tsit);
545  indicesOfAffectedIdsInner.push_back(id);
546  }
547  }
548  if (stIndex == MuonStationIndex::BI || stIndex == MuonStationIndex::EI) {
549  if (indexFirstInner == -1) indexFirstInner = index;
550  indicesOfAffectedTSOSInner.push_back(tsit);
551  indicesOfAffectedIdsInner.push_back(id);
552  }
553  }
554  }
555 
556  if (indicesOfAffectedTSOS.empty() && indicesOfAffectedTSOSInner.empty()) {
557  std::unique_ptr<Trk::Track> newTrack = std::make_unique<Trk::Track>(track.info(), std::move(trackStateOnSurfaces),
558  track.fitQuality() ? track.fitQuality()->uniqueClone() : nullptr);
559  return newTrack;
560  }
561 
562  std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0);
563  typePattern.set(Trk::TrackStateOnSurface::Alignment);
564 
565  std::unique_ptr<Trk::TrackStateOnSurface> tsosAEOT;
566  if (!indicesOfAffectedTSOS.empty() && (m_addMiddle || m_addAll)) {
567  int middle = indicesOfAffectedTSOS.size() / 2;
568  const Trk::TrackStateOnSurface* tsos = indicesOfAffectedTSOS[middle];
569  auto aEOT = std::make_unique<Trk::AlignmentEffectsOnTrack>(
574  indicesOfAffectedIds,
576  ATH_MSG_DEBUG(" AlignmentEffectsOnTrack on surface "
577  << aEOT->associatedSurface()
578  << " nr of tsos affected "
579  << indicesOfAffectedTSOS.size());
580  tsosAEOT = std::make_unique<Trk::TrackStateOnSurface>(
581  nullptr,
582  tsos->trackParameters()->uniqueClone(),
583  nullptr,
584  typePattern,
585  std::move(aEOT));
586  }
587 
588  std::unique_ptr<Trk::TrackStateOnSurface> tsosAEOTInner;
589  if (!indicesOfAffectedTSOSInner.empty() && (m_addInner || m_addTwo)) {
590  int middle = indicesOfAffectedTSOSInner.size() / 2;
591  const Trk::TrackStateOnSurface* tsosInner = indicesOfAffectedTSOSInner[middle];
592  auto aEOTInner = std::make_unique<Trk::AlignmentEffectsOnTrack>(
597  indicesOfAffectedIdsInner,
598  tsosInner->measurementOnTrack()->associatedSurface());
599  tsosAEOTInner = std::make_unique<Trk::TrackStateOnSurface>(
600  nullptr,
601  tsosInner->trackParameters()->uniqueClone(),
602  nullptr,
603  typePattern,
604  std::move(aEOTInner));
605  }
606 
607  auto trackStateOnSurfacesAEOT = std::make_unique<Trk::TrackStates>();
608  trackStateOnSurfacesAEOT->reserve(states->size() + 2);
609  index = -1;
610  for (const Trk::TrackStateOnSurface* tsit : *trackStateOnSurfaces) {
611  index++;
612  if (index == indexFirst && tsosAEOT) {
613  trackStateOnSurfacesAEOT->push_back(std::move(tsosAEOT));
614  if (!m_addAll) ATH_MSG_DEBUG(" AlignmentEffectsOnTrack for Middle added to trackStateOnSurfacesAEOT ");
615  if (m_addAll) ATH_MSG_DEBUG(" AlignmentEffectsOnTrack for All stations added to trackStateOnSurfacesAEOT ");
616  }
617  if (index == indexFirstInner && tsosAEOTInner) {
618  trackStateOnSurfacesAEOT->push_back(std::move(tsosAEOTInner));
619  ATH_MSG_DEBUG(" AlignmentEffectsOnTrack for Inner added to trackStateOnSurfacesAEOT ");
620  if (m_addTwo) ATH_MSG_DEBUG(" also AlignmentEffectsOnTrack for Middle added to trackStateOnSurfacesAEOT ");
621  }
622  trackStateOnSurfacesAEOT->push_back(tsit);
623  }
624  std::unique_ptr<Trk::Track> newTrack = std::make_unique<Trk::Track>(track.info(), std::move(trackStateOnSurfacesAEOT),
625  track.fitQuality() ? track.fitQuality()->uniqueClone() : nullptr);
626  ATH_MSG_DEBUG(m_printer->print(*newTrack));
627  ATH_MSG_DEBUG(m_printer->printMeasurements(*newTrack));
628 
629  return newTrack;
630  }
631 
632  std::unique_ptr<Trk::Track> MuonRefitTool::updateErrors(const Trk::Track& track, const EventContext& ctx,
633  const IMuonRefitTool::Settings& settings) const {
634  // loop over track and calculate residuals
635  const Trk::TrackStates* states = track.trackStateOnSurfaces();
636  if (!states) {
637  ATH_MSG_WARNING(" track without states, discarding track ");
638  return nullptr;
639  }
640 
641  // vector to store states, the boolean indicated whether the state was create in this routine (true) or belongs to the track (false)
642  // If any new state is created, all states will be cloned and a new track will beformed from them.
643  std::vector<std::unique_ptr<Trk::TrackStateOnSurface>> newStates;
644  newStates.reserve(states->size() + 5);
645 
646  const Trk::TrackParameters* startPars = nullptr;
647  std::map<int, std::set<MuonStationIndex::StIndex>> stationsPerSector;
648 
649  // loop over TSOSs and find start parameters
650  for (const Trk::TrackStateOnSurface* tsit : *states) {
651 
652  if (!tsit) continue; // sanity check
653 
654  const Trk::TrackParameters* pars = tsit->trackParameters();
655  if (!pars) continue;
656 
657  if (tsit->type(Trk::TrackStateOnSurface::Perigee)) {
658  if (!dynamic_cast<const Trk::Perigee*>(pars)) {
659  if (!startPars) {
660  startPars = pars;
661  } else {
662  ATH_MSG_WARNING("Track with two fit starting parameters!!!");
663  }
664  }
665  }
666 
667  // check whether state is a measurement
668  const Trk::MeasurementBase* meas = tsit->measurementOnTrack();
669  if (!meas) { continue; }
670 
671  // skip outliers
672  if (tsit->type(Trk::TrackStateOnSurface::Outlier)) continue;
673 
674  Identifier id = m_edmHelperSvc->getIdentifier(*meas);
675  // Not a ROT, else it would have had an identifier. Keep the TSOS.
676  if (!id.is_valid() || !m_idHelperSvc->isMuon(id)) continue;
677  if (m_idHelperSvc->isTrigger(id) || (m_idHelperSvc->isCsc(id) && m_idHelperSvc->measuresPhi(id))) continue;
678  MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(id);
679  int sector = m_idHelperSvc->sector(id);
680  stationsPerSector[sector].insert(stIndex);
681  }
682 
683  if (!startPars) {
684  if (!track.trackParameters() || track.trackParameters()->empty()) {
685  ATH_MSG_WARNING("Track without parameters, cannot update errors");
686  return nullptr;
687  }
688  startPars = track.trackParameters()->front();
689  ATH_MSG_VERBOSE("Did not find fit starting parameters, using first parameters " << m_printer->print(*startPars));
690  }
691 
692  // loop over sectors and select the one with most layers
693  std::vector<int> sectorsWithMostStations;
694  unsigned int nmaxStations = 0;
695  std::map<int, std::set<MuonStationIndex::StIndex>>::iterator stit = stationsPerSector.begin();
696  std::map<int, std::set<MuonStationIndex::StIndex>>::iterator stit_end = stationsPerSector.end();
697  for (; stit != stit_end; ++stit) {
698  if (msgLvl(MSG::VERBOSE)) {
699  ATH_MSG_VERBOSE(" sector " << stit->first);
700  for (std::set<MuonStationIndex::StIndex>::iterator ssit = stit->second.begin(); ssit != stit->second.end(); ++ssit) {
702  }
703  }
704  if (stit->second.size() > nmaxStations) {
705  nmaxStations = stit->second.size();
706  sectorsWithMostStations.clear();
707  sectorsWithMostStations.push_back(stit->first);
708  } else if (stit->second.size() == nmaxStations) {
709  sectorsWithMostStations.push_back(stit->first);
710  }
711  }
712  int selectedSector = -1;
713  if (sectorsWithMostStations.empty()) {
714  ATH_MSG_WARNING("No sector selected");
715  } else if (sectorsWithMostStations.size() == 1) {
716  selectedSector = sectorsWithMostStations.front();
717  } else {
718  ATH_MSG_DEBUG("Found track with special sector configuration " << sectorsWithMostStations.size() << " ch per sector "
719  << nmaxStations << " using first sector");
720  selectedSector = sectorsWithMostStations.front();
721  if (selectedSector % 2 == 1 && sectorsWithMostStations.back() % 2 != 1) {
722  ATH_MSG_DEBUG("Revising sector choice, picking small sector ");
723  selectedSector = sectorsWithMostStations.back();
724  }
725  }
726 
727  // no check whether we have a barrel/endcap overlap
728 
729  static constexpr std::array<MuonStationIndex::StIndex, 3> barel_stations{MuonStationIndex::BI, MuonStationIndex::BM, MuonStationIndex::BO};
730  static constexpr std::array<MuonStationIndex::StIndex, 5> endcap_stations{MuonStationIndex::EI,MuonStationIndex::EM, MuonStationIndex::EO, MuonStationIndex::EE, MuonStationIndex::BE};
731  const std::set<MuonStationIndex::StIndex>& selected_set = stationsPerSector[selectedSector];
732  const int nbarrel = std::accumulate(barel_stations.begin(),barel_stations.end(),0, [&selected_set](int n, const MuonStationIndex::StIndex& idx){
733  return (selected_set.count(idx) > 0) + n;
734  });
735  const int nendcap = std::accumulate(endcap_stations.begin(),endcap_stations.end(),0, [&selected_set](int n, const MuonStationIndex::StIndex& idx){
736  return (selected_set.count(idx) > 0) + n;
737  });
738  bool barrelEndcap {false}, deweightBarrel{false}, deweightEndcap{false};
739  if (nbarrel > 0 && nendcap > 0) {
740  if (nbarrel < nendcap)
741  deweightBarrel = true;
742  else
743  deweightEndcap = true;
744  barrelEndcap = true;
745  }
746  if (msgLvl(MSG::DEBUG)) {
747  ATH_MSG_DEBUG(" Selected sector " << selectedSector << " nstations " << nmaxStations << " barrel " << nbarrel << " endcap "
748  << nendcap);
749  if (barrelEndcap) {
750  ATH_MSG_DEBUG(" barrel/endcap overlap ");
751  if (deweightEndcap) ATH_MSG_DEBUG(" deweight endcap ");
752  if (deweightBarrel) ATH_MSG_DEBUG(" deweight barrel ");
753  }
754  }
755 
756  unsigned int deweightHits = 0;
757  unsigned int removedSectorHits = 0;
758  bool addedPerigee = false;
759  // loop over TSOSs
760  for (const Trk::TrackStateOnSurface* tsos : * states) {
761  if (!tsos) continue; // sanity check
762 
763  // check whether state is a measurement, if not add it, except if we haven't added the perigee surface yet
764  const Trk::TrackParameters* pars = tsos->trackParameters();
765  if (settings.prepareForFit && !pars) {
766  if (addedPerigee) {
767  newStates.emplace_back(tsos->clone());
768  } else {
769  ATH_MSG_DEBUG("Dropping TSOS before perigee surface");
770  }
771  continue;
772  }
773 
774  // if preparing for fit and not recreating the starting parameters, add the original perigee before back extrapolation to MS
775  // entry
776  if (settings.prepareForFit && !settings.recreateStartingParameters && tsos->type(Trk::TrackStateOnSurface::Perigee)) {
777  if (pars == startPars) {
778  ATH_MSG_DEBUG("Found fit starting parameters " << m_printer->print(*pars));
779  std::unique_ptr<Trk::Perigee> perigee = createPerigee(*pars, ctx);
780  newStates.emplace_back(MuonTSOSHelper::createPerigeeTSOS(std::move(perigee)));
781  addedPerigee = true;
782  continue;
783  } else {
784  ATH_MSG_DEBUG("Removing perigee");
785  }
786  }
787 
788  // check whether state is a measurement
789  const Trk::MeasurementBase* meas = tsos->measurementOnTrack();
790  if (!meas) {
791  newStates.emplace_back(tsos->clone());
792  continue;
793  }
794 
795  if (settings.prepareForFit && settings.recreateStartingParameters && !addedPerigee) {
796  // small shift towards the ip
797  double sign = pars->position().dot(pars->momentum()) > 0 ? 1. : -1.;
798  Amg::Vector3D perpos = pars->position() - 100. * sign * pars->momentum().unit();
799 
800  // create perigee
801  double phi = pars->momentum().phi();
802  double theta = pars->momentum().theta();
803  double qoverp = pars->charge() / pars->momentum().mag();
804  Trk::PerigeeSurface persurf(perpos);
805  std::unique_ptr<Trk::Perigee> perigee = std::make_unique<Trk::Perigee>(0, 0, phi, theta, qoverp, persurf);
806  newStates.emplace_back(MuonTSOSHelper::createPerigeeTSOS(std::move(perigee)));
807  addedPerigee = true;
808  ATH_MSG_DEBUG("Adding perigee in front of first measurement");
809  }
810 
811  Identifier id = m_edmHelperSvc->getIdentifier(*meas);
812 
813  // Not a ROT, else it would have had an identifier. Keep the TSOS.
814  if (!id.is_valid() || !m_idHelperSvc->isMuon(id)) {
815  newStates.emplace_back(tsos->clone());
816  continue;
817  }
818 
819  if (!settings.updateErrors) {
820  newStates.emplace_back(tsos->clone());
821  } else {
822  Identifier chId = m_idHelperSvc->chamberId(id);
823  MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(id);
824  if (m_idHelperSvc->isMdt(id)) {
825  const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(meas);
826  if (!mdt) {
827  ATH_MSG_WARNING(" Measurement with MDT identifier that is not a MdtDriftCircleOnTrack ");
828  continue;
829  }
830 
831  bool hasT0Fit = false;
833 
834  std::unique_ptr<MdtDriftCircleOnTrack> rot{};
835  int sector = m_idHelperSvc->sector(id);
839 
840  stIndex = m_idHelperSvc->stationIndex(id);
841 
842  // error update for three stations with barrel-endcap and shared sectors
843  if (!m_deweightTwoStationTracks || nmaxStations > 2) {
844  if (m_deweightEEL1C05 && stIndex == MuonStationIndex::EE &&
845  m_idHelperSvc->chamberIndex(id) == MuonStationIndex::EEL && m_idHelperSvc->stationEta(id) < 0 &&
846  m_idHelperSvc->stationPhi(id) == 3) {
847  // for this chamber the errors are enormous (for a period of time)
848  rot.reset(m_mdtRotCreator->updateError(*mdt, pars, &m_errorStrategyEEL1C05));
849 
850  } else if (deweightBarrel &&
851  std::find(barel_stations.begin(),barel_stations.end(),stIndex) != barel_stations.end()) {
852  rot.reset(m_mdtRotCreator->updateError(*mdt, pars, &m_errorStrategyBarEnd));
854 
855  } else if (deweightEndcap &&
856  std::find(endcap_stations.begin(), endcap_stations.end(), stIndex) != endcap_stations.end()) { // BEE chambers enter the endcap alignment system!
857  rot.reset(m_mdtRotCreator->updateError(*mdt, pars, &m_errorStrategyBarEnd));
859 
860  } else if (settings.deweightOtherSectors && sector != selectedSector) {
861  ++deweightHits;
862  rot.reset(m_mdtRotCreator->updateError(*mdt, pars, &m_errorStrategySL));
863 
864  } else if (m_deweightBEE && stIndex == MuonStationIndex::BE) {
865  rot.reset(m_mdtRotCreator->updateError(*mdt, pars, &m_errorStrategyBEE));
867 
868  } else if (m_deweightEE && stIndex == MuonStationIndex::EE) {
869  rot.reset(m_mdtRotCreator->updateError(*mdt, pars, &m_errorStrategyEE));
870 
871  } else if (m_deweightBIS78 && stIndex == MuonStationIndex::BI &&
872  m_idHelperSvc->chamberIndex(id) == MuonStationIndex::BIS && abs(m_idHelperSvc->stationEta(id)) > 6) {
873  rot.reset(m_mdtRotCreator->updateError(*mdt, pars, &m_errorStrategyBIS78));
874 
875  } else if (m_deweightBME && stIndex == MuonStationIndex::BM && m_idHelperSvc->stationPhi(id) == 7 &&
876  (m_idHelperSvc->mdtIdHelper()).stationName(id) == m_BME_station) {
877  rot.reset(m_mdtRotCreator->updateError(*mdt, pars, &m_errorStrategyBXE));
878 
879  } else if (m_deweightBOE && stIndex == MuonStationIndex::BO &&
880  m_idHelperSvc->chamberIndex(id) == MuonStationIndex::BOL && abs(m_idHelperSvc->stationEta(id)) == 7 &&
881  m_idHelperSvc->stationPhi(id) == 7) {
882  rot.reset(m_mdtRotCreator->updateError(*mdt, pars, &m_errorStrategyBXE));
883 
884  } else {
887  if (hasT0Fit) strat.setParameter(MuonDriftCircleErrorStrategy::T0Refit, true);
889  rot.reset( m_mdtRotCreator->updateError(*mdt, pars, &strat));
890  }
891  } else {
892  rot.reset(m_mdtRotCreator->updateError(*mdt, pars, &m_errorStrategyTwoStations));
893  }
894 
895 
896 
897  if (!rot) {
898  rot.reset(mdt->clone());
900  }
901  if (settings.removeOtherSectors) {
902  if (sector != selectedSector) {
903  ++removedSectorHits;
905  }
906  }
907  if (settings.chambersToBeremoved.count(chId) || settings.precisionLayersToBeremoved.count(stIndex)) {
909  }
910 
911  if (msgLvl(MSG::DEBUG)) {
912  ATH_MSG_DEBUG(m_idHelperSvc->toString(rot->identify())
913  << " radius " << rot->driftRadius() << " new err "
914  << Amg::error(rot->localCovariance(), Trk::locR) << " old err "
915  << Amg::error(mdt->localCovariance(), Trk::locR));
916  if (hasT0Fit)
917  ATH_MSG_DEBUG(" HasT0");
918  else
919  ATH_MSG_DEBUG(" No T0");
921  if (std::abs(rot->driftRadius() - mdt->driftRadius()) > 0.1)
922  ATH_MSG_DEBUG(" Bad recalibration: old r " << mdt->driftRadius());
923  }
924  //the following is a cop-out until can sort out the unique_ptr magic for rot, mdt
925  std::unique_ptr<Trk::TrackStateOnSurface> new_tsos = MuonTSOSHelper::createMeasTSOSWithUpdate(*tsos, std::move(rot), pars->uniqueClone(), type);
926  newStates.emplace_back(std::move(new_tsos));
927  } else if (m_idHelperSvc->isCsc(id)) {
928  if (settings.chambersToBeremoved.count(chId) || settings.precisionLayersToBeremoved.count(stIndex)) {
929  std::unique_ptr<Trk::TrackStateOnSurface> new_tsos = MuonTSOSHelper::cloneTSOS(*tsos, Trk::TrackStateOnSurface::Outlier);
930  newStates.emplace_back(std::move(new_tsos));
931 
932  } else {
933  newStates.emplace_back(tsos->clone());
934  }
935  } else if (m_idHelperSvc->isTrigger(id)) {
936  if (m_idHelperSvc->measuresPhi(id)) {
938 
939  if (settings.chambersToBeremoved.count(chId) || settings.phiLayersToBeremoved.count(phiIndex)) {
940  std::unique_ptr<Trk::TrackStateOnSurface> new_tsos = MuonTSOSHelper::cloneTSOS(*tsos, Trk::TrackStateOnSurface::Outlier);
941  newStates.emplace_back(std::move(new_tsos));
942 
943  } else {
944  newStates.emplace_back(tsos->clone());
945  }
946 
947  } else {
948  if (settings.updateTriggerErrors) {
949  newStates.emplace_back(tsos->clone());
950 
951  } else {
952  newStates.emplace_back(tsos->clone());
953  }
954  }
955  } else if (m_idHelperSvc->isMM(id) || m_idHelperSvc->issTgc(id)) {
956  newStates.emplace_back(tsos->clone());
957 
958  } else {
959  ATH_MSG_WARNING(" unknown Identifier " << m_idHelperSvc->mdtIdHelper().print_to_string(id));
960  }
961  }
962  }
963 
964  if (deweightHits > 0) ATH_MSG_DEBUG(" de-weighted " << deweightHits << " MDT hits from neighbouring sectors");
965  if (removedSectorHits > 0) ATH_MSG_DEBUG(" removed " << removedSectorHits << " MDT hits from neighbouring sectors");
966 
967  ATH_MSG_VERBOSE(" original track had " << states->size() << " TSOS, adding " << newStates.size() - states->size() << " new TSOS ");
968 
969  // states were added, create a new track
970  auto trackStateOnSurfaces = std::make_unique<Trk::TrackStates>();
971  trackStateOnSurfaces->reserve(newStates.size());
972  for (std::unique_ptr<Trk::TrackStateOnSurface>& new_state : newStates) {
973  trackStateOnSurfaces->push_back(std::move(new_state));
974  }
975  std::unique_ptr<Trk::Track> newTrack = std::make_unique<Trk::Track>(track.info(), std::move(trackStateOnSurfaces),
976  track.fitQuality() ? track.fitQuality()->uniqueClone() : nullptr);
977  ATH_MSG_DEBUG("new track measurements: " << m_printer->printMeasurements(*newTrack));
978 
979  return newTrack;
980  }
981 
982  std::unique_ptr<Trk::Track> MuonRefitTool::updateMdtErrors(const Trk::Track& track, const EventContext& ctx,
983  const IMuonRefitTool::Settings& settings) const {
984  // uses the muonErrorStrategy
985 
986  // loop over track and calculate residuals
987  const Trk::TrackStates* states = track.trackStateOnSurfaces();
988  if (!states) {
989  ATH_MSG_WARNING(" track without states, discarding track ");
990  return nullptr;
991  }
992 
993  // vector to store states, the boolean indicated whether the state was create in this routine (true) or belongs to the track (false)
994  // If any new state is created, all states will be cloned and a new track will beformed from them.
995  std::vector<std::unique_ptr<Trk::TrackStateOnSurface>> newStates;
996  newStates.reserve(states->size() + 5);
997 
998  const Trk::TrackParameters* startPars = nullptr;
999 
1000  // loop over TSOSs and find start parameters
1001  for (const Trk::TrackStateOnSurface* tsos : *states) {
1002  if (!tsos) continue; // sanity check
1003 
1004  const Trk::TrackParameters* pars = tsos->trackParameters();
1005  if (!pars) continue;
1006 
1007  if (tsos->type(Trk::TrackStateOnSurface::Perigee)) {
1008  if (!dynamic_cast<const Trk::Perigee*>(pars)) {
1009  if (!startPars) {
1010  startPars = pars;
1011  } else {
1012  ATH_MSG_WARNING("Track with two fit starting parameters!!!");
1013  }
1014  }
1015  }
1016 
1017  // check whether state is a measurement
1018  const Trk::MeasurementBase* meas = tsos->measurementOnTrack();
1019  if (!meas) { continue; }
1020 
1021  // skip outliers
1022  if (tsos->type(Trk::TrackStateOnSurface::Outlier)) continue;
1023 
1024  Identifier id = m_edmHelperSvc->getIdentifier(*meas);
1025  // Not a ROT, else it would have had an identifier. Keep the TSOS.
1026  if (!id.is_valid() || !m_idHelperSvc->isMuon(id)) continue;
1027  if (m_idHelperSvc->isTrigger(id) || (m_idHelperSvc->isCsc(id) && m_idHelperSvc->measuresPhi(id))) continue;
1028  }
1029 
1030  if (!startPars) {
1031  if (!track.trackParameters() || track.trackParameters()->empty()) {
1032  ATH_MSG_WARNING("Track without parameters, cannot update errors");
1033  return nullptr;
1034  }
1035  startPars = track.trackParameters()->front();
1036  ATH_MSG_VERBOSE("Did not find fit starting parameters, using first parameters " << m_printer->print(*startPars));
1037  }
1038 
1039  bool addedPerigee = false;
1040  // loop over TSOSs
1041  for (const Trk::TrackStateOnSurface* tsos : *states) {
1042  if (!tsos) continue; // sanity check
1043 
1044  // check whether state is a measurement, if not add it, except if we haven't added the perigee surface yet
1045  const Trk::TrackParameters* pars = tsos->trackParameters();
1046  if (settings.prepareForFit && !pars) {
1047  if (addedPerigee) {
1048  newStates.emplace_back(tsos->clone());
1049  continue;
1050  } else {
1051  ATH_MSG_DEBUG("Dropping TSOS before perigee surface");
1052  continue;
1053  }
1054  }
1055 
1056  // if preparing for fit and not recreating the starting parameters, add the original perigee before back extrapolation to MS
1057  // entry
1058  if (settings.prepareForFit && !settings.recreateStartingParameters && tsos->type(Trk::TrackStateOnSurface::Perigee)) {
1059  if (pars == startPars) {
1060  ATH_MSG_DEBUG("Found fit starting parameters " << m_printer->print(*pars));
1061  std::unique_ptr<Trk::Perigee> perigee = createPerigee(*pars, ctx);
1062  newStates.emplace_back(MuonTSOSHelper::createPerigeeTSOS(std::move(perigee)));
1063  addedPerigee = true;
1064  continue;
1065  } else {
1066  ATH_MSG_DEBUG("Removing perigee");
1067  }
1068  }
1069 
1070  // check whether state is a measurement
1071  const Trk::MeasurementBase* meas = tsos->measurementOnTrack();
1072  if (!meas) {
1073  newStates.emplace_back(tsos->clone());
1074  continue;
1075  }
1076 
1077  if (settings.prepareForFit && settings.recreateStartingParameters && !addedPerigee) {
1078  // small shift towards the ip
1079  double sign = pars->position().dot(pars->momentum()) > 0 ? 1. : -1.;
1080  Amg::Vector3D perpos = pars->position() - 100. * sign * pars->momentum().unit();
1081 
1082  // create perigee
1083  double phi = pars->momentum().phi();
1084  double theta = pars->momentum().theta();
1085  double qoverp = pars->charge() / pars->momentum().mag();
1086  Trk::PerigeeSurface persurf(perpos);
1087  std::unique_ptr<Trk::Perigee> perigee = std::make_unique<Trk::Perigee>(0, 0, phi, theta, qoverp, persurf);
1088  newStates.emplace_back(MuonTSOSHelper::createPerigeeTSOS(std::move(perigee)));
1089  addedPerigee = true;
1090  ATH_MSG_DEBUG("Adding perigee in front of first measurement");
1091  }
1092 
1093  Identifier id = m_edmHelperSvc->getIdentifier(*meas);
1094 
1095  // Not a ROT, else it would have had an identifier. Keep the TSOS.
1096  if (!id.is_valid() || !m_idHelperSvc->isMuon(id)) {
1097  newStates.emplace_back(tsos->clone());
1098  continue;
1099  }
1100 
1101  if (!settings.updateErrors) {
1102  newStates.emplace_back(tsos->clone());
1103  } else {
1104  Identifier chId = m_idHelperSvc->chamberId(id);
1105  MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(id);
1106  if (m_idHelperSvc->isMdt(id)) {
1107  const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(meas);
1108  if (!mdt) {
1109  ATH_MSG_WARNING(" Measurement with MDT identifier that is not a MdtDriftCircleOnTrack ");
1110  continue;
1111  }
1112 
1113  bool hasT0Fit = false;
1115 
1116  Trk::RIO_OnTrack* rot = nullptr;
1120 
1121  stIndex = m_idHelperSvc->stationIndex(id);
1122 
1123  // use the muonErrorStrategy
1125  if (hasT0Fit) strat.setParameter(MuonDriftCircleErrorStrategy::T0Refit, true);
1126  if (settings.broad) strat.setParameter(MuonDriftCircleErrorStrategy::BroadError, true);
1127  rot = m_mdtRotCreator->updateError(*mdt, pars, &strat);
1128 
1129  MdtDriftCircleOnTrack* newMdt = rot ? dynamic_cast<MdtDriftCircleOnTrack*>(rot) : nullptr;
1130  if (!newMdt) {
1131  newMdt = mdt->clone();
1133  }
1134  if (settings.chambersToBeremoved.count(chId) || settings.precisionLayersToBeremoved.count(stIndex)) {
1136  }
1137 
1138  if (msgLvl(MSG::DEBUG)) {
1139  ATH_MSG_DEBUG(" updateMdtErrors " << m_idHelperSvc->toString(newMdt->identify()) << " radius "
1140  << newMdt->driftRadius() << " new err "
1141  << Amg::error(newMdt->localCovariance(), Trk::locR) << " old err "
1142  << Amg::error(mdt->localCovariance(), Trk::locR));
1143  if (hasT0Fit)
1144  ATH_MSG_DEBUG(" HasT0");
1145  else
1146  ATH_MSG_DEBUG(" No T0");
1148  if (std::abs(newMdt->driftRadius() - mdt->driftRadius()) > 0.1)
1149  ATH_MSG_DEBUG(" Bad recalibration: old r " << mdt->driftRadius());
1150  }
1151  std::unique_ptr<MdtDriftCircleOnTrack> newUniqueMdt {newMdt};
1152  std::unique_ptr<Trk::TrackStateOnSurface> new_tsos = MuonTSOSHelper::createMeasTSOSWithUpdate(*tsos, std::move(newUniqueMdt), pars->uniqueClone(), type);
1153  newStates.emplace_back(std::move(new_tsos));
1154  } else if (m_idHelperSvc->isCsc(id)) {
1155  if (settings.chambersToBeremoved.count(chId) || settings.precisionLayersToBeremoved.count(stIndex)) {
1156  std::unique_ptr<Trk::TrackStateOnSurface> new_tsos = MuonTSOSHelper::cloneTSOS(*tsos, Trk::TrackStateOnSurface::Outlier);
1157  newStates.emplace_back(std::move(new_tsos));
1158 
1159  } else {
1160  newStates.emplace_back(tsos->clone());
1161  }
1162  } else if (m_idHelperSvc->isTrigger(id)) {
1163  if (m_idHelperSvc->measuresPhi(id)) {
1165 
1166  if (settings.chambersToBeremoved.count(chId) || settings.phiLayersToBeremoved.count(phiIndex)) {
1167  std::unique_ptr<Trk::TrackStateOnSurface> new_tsos = MuonTSOSHelper::cloneTSOS(*tsos, Trk::TrackStateOnSurface::Outlier);
1168  newStates.emplace_back(std::move(new_tsos));
1169 
1170  } else {
1171  newStates.emplace_back(tsos->clone());
1172  }
1173 
1174  } else {
1175  if (settings.updateTriggerErrors) {
1176  newStates.emplace_back(tsos->clone());
1177 
1178  } else {
1179  newStates.emplace_back(tsos->clone());
1180  }
1181  }
1182  } else if (m_idHelperSvc->isMM(id) || m_idHelperSvc->issTgc(id)) {
1183  newStates.emplace_back(tsos->clone());
1184 
1185  } else {
1186  ATH_MSG_WARNING(" unknown Identifier " << m_idHelperSvc->mdtIdHelper().print_to_string(id));
1187  }
1188  }
1189  }
1190 
1191  ATH_MSG_VERBOSE(" original track had " << states->size() << " TSOS, adding " << newStates.size() - states->size() << " new TSOS ");
1192 
1193  // states were added, create a new track
1194  auto trackStateOnSurfaces = std::make_unique<Trk::TrackStates>();
1195  trackStateOnSurfaces->reserve(newStates.size());
1196  for ( std::unique_ptr<Trk::TrackStateOnSurface>& state : newStates) {
1197  // add states. If nit->first is true we have a new state. If it is false the state is from the old track and has to be cloned
1198  trackStateOnSurfaces->push_back(std::move(state));
1199  }
1200  std::unique_ptr<Trk::Track> newTrack = std::make_unique<Trk::Track>(track.info(), std::move(trackStateOnSurfaces),
1201  track.fitQuality() ? track.fitQuality()->uniqueClone() : nullptr);
1202  return newTrack;
1203  }
1204 
1205  std::unique_ptr<Trk::Track> MuonRefitTool::removeOutliers(const Trk::Track& track, const IMuonRefitTool::Settings& settings) const {
1206  // loop over track and calculate residuals
1207  const Trk::TrackStates* states = track.trackStateOnSurfaces();
1208  if (!states) {
1209  ATH_MSG_WARNING(" track without states, discarding track ");
1210  return nullptr;
1211  }
1212 
1213  Identifier currentMdtChId;
1214  std::set<Identifier> removedIdentifiers;
1215  std::vector<const MdtDriftCircleOnTrack*> mdts;
1216  const Trk::TrackParameters* chamberPars = nullptr;
1217 
1218  // loop over TSOSs and find start parameters
1219  Trk::TrackStates::const_iterator tsit = states->begin();
1220  Trk::TrackStates::const_iterator tsit_end = states->end();
1221  for (; tsit != tsit_end; ++tsit) {
1222  if (!*tsit) continue; // sanity check
1223 
1224  // check whether state is a measurement
1225  const Trk::TrackParameters* pars = (*tsit)->trackParameters();
1226  if (!pars) { continue; }
1227 
1228  if (!(*tsit)->type(Trk::TrackStateOnSurface::Measurement)) { continue; }
1229 
1230  // check whether state is a measurement
1231  const Trk::MeasurementBase* meas = (*tsit)->measurementOnTrack();
1232  if (!meas) { continue; }
1233 
1234  Identifier id = m_edmHelperSvc->getIdentifier(*meas);
1235 
1236  // Not a ROT, else it would have had an identifier. Keep the TSOS.
1237  if (!id.is_valid()) { continue; }
1238 
1239  if (m_idHelperSvc->isMdt(id)) {
1240  const MdtDriftCircleOnTrack* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(meas);
1241  if (!mdt) {
1242  ATH_MSG_WARNING(" Measurement with MDT identifier that is not a MdtDriftCircleOnTrack ");
1243  continue;
1244  }
1245  // get ch ID
1246  Identifier chId = m_idHelperSvc->chamberId(id);
1247 
1248  // if we have a new chambers
1249  if (chId != currentMdtChId) {
1250  // check that there are pars (not the case for the first mdt), if so we collected all hits for this chamber so call
1251  // cleaning
1252  if (chamberPars) {
1253  if (!removeMdtOutliers(*chamberPars, mdts, removedIdentifiers, settings)) {
1254  if (mdts.size() > 4)
1255  ATH_MSG_WARNING("Problem removing outliers in chamber " << m_idHelperSvc->toStringChamber(currentMdtChId)
1256  << " hits " << mdts.size());
1257  if (settings.discardNotCleanedTracks) return nullptr;
1258  }
1259  }
1260  // update to new chamber
1261  chamberPars = pars;
1262  mdts.clear();
1263  currentMdtChId = chId;
1264  }
1265 
1266  mdts.push_back(mdt);
1267  }
1268  }
1269 
1270  // clean the last chamber on the track
1271  if (chamberPars) {
1272  if (!removeMdtOutliers(*chamberPars, mdts, removedIdentifiers, settings)) {
1273  if (mdts.size() > 4)
1274  ATH_MSG_WARNING("Problem removing outliers in chamber " << m_idHelperSvc->toStringChamber(currentMdtChId) << " hits "
1275  << mdts.size());
1276  if (settings.discardNotCleanedTracks) return nullptr;
1277  }
1278  }
1279 
1280  if (removedIdentifiers.empty()) {
1281  ATH_MSG_DEBUG("No hits remove, returning original track");
1282  return std::make_unique<Trk::Track>(track);
1283  }
1284 
1285  // states were added, create a new track
1286  auto trackStateOnSurfaces = std::make_unique<Trk::TrackStates>();
1287  trackStateOnSurfaces->reserve(states->size());
1288 
1289  ATH_MSG_DEBUG("Removing nhits: " << removedIdentifiers.size());
1290 
1291  for (const Trk::TrackStateOnSurface* tsos : *states) {
1292  if (!*tsit) continue; // sanity check
1293 
1294  // check whether state is a measurement
1295  const Trk::MeasurementBase* meas = tsos->measurementOnTrack();
1296  if (meas) {
1297  Identifier id = m_edmHelperSvc->getIdentifier(*meas);
1298 
1299  if (removedIdentifiers.count(id)) {
1300  std::unique_ptr<Trk::TrackStateOnSurface> new_tsos = MuonTSOSHelper::cloneTSOS(*tsos, Trk::TrackStateOnSurface::Outlier);
1301  trackStateOnSurfaces->push_back(std::move(new_tsos));
1302  continue;
1303  }
1304  }
1305  trackStateOnSurfaces->push_back(tsos->clone());
1306  }
1307 
1308  std::unique_ptr<Trk::Track> newTrack = std::make_unique<Trk::Track>(track.info(), std::move(trackStateOnSurfaces),
1309  track.fitQuality() ? track.fitQuality()->uniqueClone() : nullptr);
1310  return newTrack;
1311  }
1312 
1313  bool MuonRefitTool::removeMdtOutliers(const Trk::TrackParameters& pars, const std::vector<const MdtDriftCircleOnTrack*>& hits,
1314  std::set<Identifier>& removedIdentifiers, const IMuonRefitTool::Settings& settings) const {
1315  if (hits.size() < 3) {
1316  ATH_MSG_VERBOSE("Too few hits, cannot perform cleaning");
1317  return false;
1318  }
1319  ATH_MSG_VERBOSE("Performing cleaning, nhits " << hits.size());
1320 
1323  /* ******** Mdt hits ******** */
1324 
1325  const MuonGM::MdtReadoutElement* detEl = nullptr;
1326 
1327  Amg::Transform3D gToStation;
1328 
1329  TrkDriftCircleMath::DCSLFitter dcslFitter;
1330  TrkDriftCircleMath::SegmentFinder segFinder(5., 3., false);
1331  if (!m_t0Fitter.empty()) {
1332  std::shared_ptr<const TrkDriftCircleMath::DCSLFitter> fitter(m_t0Fitter->getFitter(), Muon::IDCSLFitProvider::Unowned{});
1333  segFinder.setFitter(fitter);
1334  }
1335  segFinder.debugLevel(m_finderDebugLevel);
1336  segFinder.setRecoverMDT(false);
1337 
1338  for (const MdtDriftCircleOnTrack* mdt : hits) {
1339 
1340  Identifier id = mdt->identify();
1341 
1342  if (!detEl) {
1343  detEl = mdt->prepRawData()->detectorElement();
1344  if (!detEl) {
1345  ATH_MSG_WARNING(" error aborting not detEl found ");
1346  break;
1347  }
1348  gToStation = detEl->GlobalToAmdbLRSTransform();
1349  }
1350  // calculate local AMDB position
1351  Amg::Vector3D locPos = gToStation * mdt->prepRawData()->globalPosition();
1352  TrkDriftCircleMath::LocVec2D lpos(locPos.y(), locPos.z());
1353 
1354  double r = std::abs(mdt->localParameters()[Trk::locR]);
1355  double dr = Amg::error(mdt->localCovariance(), Trk::locR);
1356  ATH_MSG_VERBOSE("New MDT " << m_idHelperSvc->toString(id) << " r " << mdt->localParameters()[Trk::locR] << " dr " << dr
1357  << " (original) " << Amg::error(mdt->localCovariance(), Trk::locR));
1358 
1359  // create identifier
1360  TrkDriftCircleMath::MdtId mdtid(m_idHelperSvc->mdtIdHelper().isBarrel(id), m_idHelperSvc->mdtIdHelper().multilayer(id) - 1,
1361  m_idHelperSvc->mdtIdHelper().tubeLayer(id) - 1, m_idHelperSvc->mdtIdHelper().tube(id) - 1);
1362 
1363  // create new DriftCircle
1365  dcsOnTrack.emplace_back(dc, 1., 1.);
1366  dcs.emplace_back(std::move(dc));
1367  }
1368 
1369  if (!detEl) return false;
1370  // define axis of chamber in global coordinates
1371  Amg::Transform3D amdbToGlobal = detEl->AmdbLRSToGlobalTransform();
1372 
1373  // create new surface
1374  Amg::Transform3D surfaceTransform(amdbToGlobal.rotation());
1375  surfaceTransform.pretranslate(pars.position());
1376  double surfDim = 500.;
1377  const std::unique_ptr<Trk::PlaneSurface> surf = std::make_unique<Trk::PlaneSurface>(surfaceTransform, surfDim, surfDim);
1378 
1379  Amg::Vector3D dir = pars.momentum().unit();
1380  if (dir.y() * pars.position().y() < 0.) { dir *= -1.; }
1383 
1384  Amg::Vector3D locDirTrack(gToStation.linear() * dir);
1385  double track_angleYZ = std::atan2(locDirTrack.z(), locDirTrack.y());
1386 
1387  // transform nominal pointing chamber position into surface frame
1388  Amg::Vector3D dirCh(gToStation.linear() * detEl->center());
1389  double chamber_angleYZ = std::atan2(dirCh.z(), dirCh.y());
1390  double angleYZ = locDir.angleYZ();
1391 
1392  const Amg::Vector3D lpos = gToStation * pars.position();
1393 
1394  TrkDriftCircleMath::LocVec2D segPos(lpos.y(), lpos.z());
1395  TrkDriftCircleMath::Line segPars(segPos, angleYZ);
1396 
1397  ATH_MSG_DEBUG("Seeding angles " << track_angleYZ << " from surf " << angleYZ << " ch angle " << chamber_angleYZ << " pos "
1398  << segPos);
1399  segFinder.setPhiRoad(track_angleYZ, chamber_angleYZ, 0.14);
1400 
1401  if (msgLvl(MSG::VERBOSE)) {
1403  if (dcslFitter.fit(segment, segPars, dcsOnTrack)) {
1404  segment.hitsOnTrack(dcsOnTrack.size());
1405  ATH_MSG_DEBUG(" segment after fit " << segment.chi2() << " ndof " << segment.ndof() << " local parameters "
1406  << segment.line().x0() << " " << segment.line().y0() << " phi "
1407  << segment.line().phi());
1408  } else {
1409  ATH_MSG_DEBUG("Fit failed: hits" << dcsOnTrack.size());
1410  }
1411  }
1412 
1413  TrkDriftCircleMath::SegVec segments = segFinder.findSegments(dcs);
1414  if (!segments.empty()) { ATH_MSG_DEBUG("Found segments " << segments.size()); }
1415 
1416  if (segments.size() != 1) {
1417  if (hits.size() > 3)
1418  ATH_MSG_WARNING(" Found two solutions ");
1419  else
1420  ATH_MSG_DEBUG(" Found two solutions ");
1421  double dthetaBest = 10000.;
1422  int index = 0;
1423  int indexBest = -1;
1424  TrkDriftCircleMath::SegIt sit = segments.begin();
1425  TrkDriftCircleMath::SegIt sit_end = segments.end();
1426  for (; sit != sit_end; ++sit, ++index) {
1427  double dtheta = std::abs(sit->line().phi() - track_angleYZ);
1428  if (dtheta < dthetaBest) {
1429  dthetaBest = dtheta;
1430  indexBest = index;
1431  }
1432  if (sit->hitsOnTrack() > 4) { ATH_MSG_DEBUG("Recoverable segment " << *sit); }
1433  }
1434  if (indexBest != -1) {
1435  TrkDriftCircleMath::SegVec selectedSegments;
1436  selectedSegments.push_back(segments[indexBest]);
1437  segments = selectedSegments;
1438  ATH_MSG_DEBUG("Selected segment " << segments.front());
1439 
1440  } else {
1441  return false;
1442  }
1443  }
1444 
1445  TrkDriftCircleMath::Segment& segment = segments.front();
1446  if (settings.discardNotCleanedTracks && !segment.hasT0Shift()) return false;
1447 
1448  if (segment.hasT0Shift() || segment.hitsOnTrack() > 5) { ATH_MSG_DEBUG("Segment with t0 shift " << segment.t0Shift()); }
1449 
1450  if (dcs.size() == segment.hitsOnTrack()) {
1451  ATH_MSG_DEBUG(" No hits removed ");
1452  return true;
1453  } else if (dcs.size() > segment.hitsOnTrack() + 1) {
1454  ATH_MSG_DEBUG(" more than one hit removed ");
1455  if (segment.hitsOnTrack() < 4) return false;
1456  }
1457 
1458  ATH_MSG_DEBUG(" removed hits: " << dcs.size() - segment.hitsOnTrack());
1459 
1460  float tubeRadius = detEl->innerTubeRadius();
1461 
1463  const TrkDriftCircleMath::DCOnTrackVec& matchedDCs = matchDC.match(segment.dcs());
1464 
1465  for (TrkDriftCircleMath::DCOnTrackCit dcit = matchedDCs.begin(); dcit != matchedDCs.end(); ++dcit) {
1466  if (dcit->state() == TrkDriftCircleMath::DCOnTrack::OnTrack) {
1467  if (std::abs(dcit->r()) - std::abs(dcit->rot()->driftRadius()) > 0.1) {
1468  ATH_MSG_DEBUG("Large change in drift radius: r_old " << dcit->rot()->driftRadius() << " r_new " << dcit->r());
1469  }
1470  continue;
1471  }
1472  removedIdentifiers.insert(dcit->rot()->identify());
1473  ATH_MSG_VERBOSE(" removing hit " << m_idHelperSvc->toString(dcit->rot()->identify()));
1474  }
1475  return true;
1476  }
1477 
1478  std::unique_ptr<Trk::Perigee>
1479  MuonRefitTool::createPerigee(const Trk::TrackParameters& pars, const EventContext& ctx) const {
1480  std::unique_ptr<Trk::Perigee> perigee;
1481  if (m_muonExtrapolator.empty()) { return perigee; }
1482  Trk::PerigeeSurface persurf(pars.position());
1483  std::unique_ptr<Trk::TrackParameters> exPars{m_muonExtrapolator->extrapolateDirectly(ctx, pars, persurf)};
1484  perigee.reset (dynamic_cast<Trk::Perigee*>(exPars.release()));
1485  if (!perigee) {
1486  ATH_MSG_WARNING(" Extrapolation to Perigee surface did not return a perigee!! ");
1487  return perigee;
1488  }
1489  return perigee;
1490  }
1491 
1492 } // namespace Muon
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Muon::MuonRefitTool::m_defaultSettings
Settings m_defaultSettings
Definition: MuonRefitTool.h:126
Muon::MuonTSOSHelper::cloneTSOS
static std::unique_ptr< Trk::TrackStateOnSurface > cloneTSOS(const Trk::TrackStateOnSurface &tsos, Trk::TrackStateOnSurface::TrackStateOnSurfaceType type)
clone input, update the type
Definition: MuonTSOSHelper.h:15
xAOD::strategy
strategy
Definition: L2CombinedMuon_v1.cxx:107
Muon::MuonStationIndex::BIS
@ BIS
Definition: MuonStationIndex.h:17
Muon::MuonTSOSHelper::createPerigeeTSOS
static std::unique_ptr< Trk::TrackStateOnSurface > createPerigeeTSOS(std::unique_ptr< Trk::TrackParameters > perigee)
create a perigee TSOS, takes ownership of the Perigee
Definition: MuonTSOSHelper.h:54
TrkDriftCircleMath::MatchDCWithLine::match
const DCOnTrackVec & match(const DCVec &dcs)
Definition: MatchDCWithLine.cxx:9
used
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
Muon::MuonRefitTool::m_deweightBEE
Gaudi::Property< bool > m_deweightBEE
Definition: MuonRefitTool.h:107
beamspotman.r
def r
Definition: beamspotman.py:676
LArSamples::FitterData::fitter
const ShapeFitter * fitter
Definition: ShapeFitter.cxx:23
Muon::MuonStationIndex::BE
@ BE
Definition: MuonStationIndex.h:25
Trk::TrackStateOnSurface::trackParameters
const TrackParameters * trackParameters() const
return ptr to trackparameters const overload
TrkDriftCircleMath::SegmentFinder::findSegments
SegVec findSegments(const DCVec &dcs) const
Definition: SegmentFinder.cxx:122
Muon::MuonDriftCircleErrorStrategy
Definition: MuonDriftCircleErrorStrategy.h:15
MdtReadoutElement.h
Muon::MuonDriftCircleErrorStrategy::WireSagTimeCorrection
@ WireSagTimeCorrection
Wire sag correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:30
Muon::MuonDriftCircleErrorStrategy::Muon
@ Muon
Definition: MuonDriftCircleErrorStrategy.h:17
Muon::MuonRefitTool::m_alignmentAngle
Gaudi::Property< float > m_alignmentAngle
Definition: MuonRefitTool.h:97
Trk::TrackStateOnSurface::Perigee
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
Definition: TrackStateOnSurface.h:117
Muon::MuonRefitTool::updateErrors
std::unique_ptr< Trk::Track > updateErrors(const Trk::Track &track, const EventContext &ctx, const Settings &settings) const
update errors on a muon track
Definition: MuonRefitTool.cxx:632
MuonGM::MuonReadoutElement::AmdbLRSToGlobalTransform
virtual Amg::Transform3D AmdbLRSToGlobalTransform() const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx:145
Muon::MuonRefitTool::m_deweightBME
Gaudi::Property< bool > m_deweightBME
Definition: MuonRefitTool.h:110
AlignmentEffectsOnTrack.h
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
MuonAlign::AlignmentRotationDeviation
Definition: AlignmentRotationDeviation.h:11
Muon::IMuonRefitTool::Settings::recreateStartingParameters
bool recreateStartingParameters
prepare the input track for a refit
Definition: IMuonRefitTool.h:47
Trk::TrackStateOnSurface::TrackStateOnSurfaceType
TrackStateOnSurfaceType
Definition: TrackStateOnSurface.h:98
TrkDriftCircleMath::DCOnTrackVec
std::vector< DCOnTrack > DCOnTrackVec
Definition: DCOnTrack.h:59
max
#define max(a, b)
Definition: cfImp.cxx:41
TrackParameters.h
Muon::MuonRefitTool::m_errorStrategySL
MuonDriftCircleErrorStrategy m_errorStrategySL
Definition: MuonRefitTool.h:121
Muon::MuonRefitTool::removeMdtOutliers
bool removeMdtOutliers(const Trk::TrackParameters &pars, const std::vector< const MdtDriftCircleOnTrack * > &hits, std::set< Identifier > &removedIdentifiers, const Settings &settings) const
Definition: MuonRefitTool.cxx:1313
Muon::MuonRefitTool::m_printer
PublicToolHandle< MuonEDMPrinterTool > m_printer
Definition: MuonRefitTool.h:79
Muon::MuonRefitTool::m_deweightBOE
Gaudi::Property< bool > m_deweightBOE
Definition: MuonRefitTool.h:111
MeasurementBase.h
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
TrkDriftCircleMath::MdtId
Definition: MdtId.h:14
Surface.h
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
MuonGM::MdtReadoutElement::center
virtual const Amg::Vector3D & center(const Identifier &) const override final
Return the center of the surface associated with this identifier In the case of silicon it returns th...
Muon::MuonRefitTool::m_addAll
Gaudi::Property< bool > m_addAll
Definition: MuonRefitTool.h:103
MuonGM::MdtReadoutElement::innerTubeRadius
double innerTubeRadius() const
Returns the inner tube radius excluding the aluminium walls.
Muon::MuonRefitTool::m_errorStrategyBIS78
MuonDriftCircleErrorStrategy m_errorStrategyBIS78
Definition: MuonRefitTool.h:117
Muon::MuonStationIndex::EEL
@ EEL
Definition: MuonStationIndex.h:18
TrkDriftCircleMath::DCSLFitter::fit
virtual bool fit(Segment &result, const Line &line, const DCOnTrackVec &dcs, double t0Seed=-99999.) const
Definition: Tracking/TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/DCSLFitter.h:38
Trk::PerigeeSurface
Definition: PerigeeSurface.h:43
Muon::MuonStationIndex::EO
@ EO
Definition: MuonStationIndex.h:26
index
Definition: index.py:1
Trk::ParametersBase::uniqueClone
std::unique_ptr< ParametersBase< DIM, T > > uniqueClone() const
clone method for polymorphic deep copy returning unique_ptr; it is not overriden, but uses the existi...
Definition: ParametersBase.h:97
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
Muon::IMuonRefitTool::Settings::broad
bool broad
Definition: IMuonRefitTool.h:39
Muon::IMuonRefitTool::Settings::removeBarrelEndcapOverlap
bool removeBarrelEndcapOverlap
all trigger eta hits are turned into outliers
Definition: IMuonRefitTool.h:52
Muon::MuonRefitTool::m_failedOutlierRemoval
std::atomic< unsigned int > m_failedOutlierRemoval
Definition: MuonRefitTool.h:130
Muon::IMuonRefitTool::Settings
Definition: IMuonRefitTool.h:21
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
EventPrimitivesHelpers.h
theta
Scalar theta() const
theta method
Definition: AmgMatrixBasePlugin.h:71
Muon::IDCSLFitProvider::Unowned
Helper struct to overload the destructors of smart pointers.
Definition: IDCSLFitProvider.h:39
TrkDriftCircleMath::MatchDCWithLine::Pull
@ Pull
Definition: MatchDCWithLine.h:18
Muon::IMuonRefitTool::Settings::chambersToBeremoved
std::set< Identifier > chambersToBeremoved
turn all hits in the BEE chambers into outliers
Definition: IMuonRefitTool.h:54
MuonGM::MuonReadoutElement::GlobalToAmdbLRSTransform
virtual Amg::Transform3D GlobalToAmdbLRSTransform() const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx:153
skel.it
it
Definition: skel.GENtoEVGEN.py:423
TrkDriftCircleMath::DCSLFitter
Definition: Tracking/TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/DCSLFitter.h:17
Muon::MuonRefitTool::m_addTwo
Gaudi::Property< bool > m_addTwo
Definition: MuonRefitTool.h:106
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
Trk::TrackStateOnSurface::measurementOnTrack
const MeasurementBase * measurementOnTrack() const
returns MeasurementBase const overload
Muon::MdtDriftCircleOnTrack::errorStrategy
const MuonDriftCircleErrorStrategy & errorStrategy() const
Get information about the creation strategy used by Muon::MdtDriftCircleOnTrackCreator when making th...
Definition: MdtDriftCircleOnTrack.h:283
Muon::MuonStationIndex::BI
@ BI
Definition: MuonStationIndex.h:25
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
Muon::MuonRefitTool::m_BME_station
int m_BME_station
Definition: MuonRefitTool.h:137
Trk::locR
@ locR
Definition: ParamDefs.h:50
TrkDriftCircleMath::DriftCircle
This class represents a drift time measurement.
Definition: DriftCircle.h:22
Muon::IMuonRefitTool::Settings::removeOtherSectors
bool removeOtherSectors
recreate starting parameters by extrapolating from first hit on track
Definition: IMuonRefitTool.h:48
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
MdtDriftCircleOnTrack.h
Muon::MuonRefitTool::m_deweightEE
Gaudi::Property< bool > m_deweightEE
Definition: MuonRefitTool.h:108
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
Muon::MuonRefitTool::m_failedErrorUpdate
std::atomic< unsigned int > m_failedErrorUpdate
Definition: MuonRefitTool.h:131
Trk::TrackStateOnSurface::Alignment
@ Alignment
This TSOS contains a Trk::AlignmentEffectsOnTrack.
Definition: TrackStateOnSurface.h:150
Muon::MuonStationIndex::PhiIndex
PhiIndex
enum to classify the different phi layers in the muon spectrometer
Definition: MuonStationIndex.h:31
Muon::MuonRefitTool::m_deweightTwoStationTracks
Gaudi::Property< bool > m_deweightTwoStationTracks
Definition: MuonRefitTool.h:113
Muon::MuonRefitTool::m_errorStrategyBarEnd
MuonDriftCircleErrorStrategy m_errorStrategyBarEnd
Definition: MuonRefitTool.h:120
Muon::MuonDriftCircleErrorStrategy::PropCorrection
@ PropCorrection
Propagation correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:27
Muon::MuonDriftCircleErrorStrategy::TempCorrection
@ TempCorrection
Temperature correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:28
Muon::MuonRefitTool::m_failedRefit
std::atomic< unsigned int > m_failedRefit
Definition: MuonRefitTool.h:132
TrkDriftCircleMath::Segment
Definition: TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:18
Muon::MuonRefitTool::m_ngoodRefits
std::atomic< unsigned int > m_ngoodRefits
Definition: MuonRefitTool.h:129
TrkDriftCircleMath::LocVec2D
Implementation of 2 dimensional vector class.
Definition: LocVec2D.h:16
MuonRefitTool.h
Muon::MuonRefitTool::removeOutliers
std::unique_ptr< Trk::Track > removeOutliers(const Trk::Track &track, const Settings &settings) const
Definition: MuonRefitTool.cxx:1205
TrkDriftCircleMath::DCVec
std::vector< DriftCircle > DCVec
Definition: DriftCircle.h:117
Muon::MuonDriftCircleErrorStrategy::T0Refit
@ T0Refit
A special error was applied to account for the T0 refit (user defined via jobProperties)
Definition: MuonDriftCircleErrorStrategy.h:24
Muon::MuonDriftCircleErrorStrategy::WireSagGeomCorrection
@ WireSagGeomCorrection
Wire sag was applied, and so will affect errors.
Definition: MuonDriftCircleErrorStrategy.h:25
Trk::TrackStateOnSurface::Outlier
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
Definition: TrackStateOnSurface.h:122
AlignmentTranslationDeviation.h
Muon::MuonRefitTool::m_muonExtrapolator
ToolHandle< Trk::IExtrapolator > m_muonExtrapolator
Definition: MuonRefitTool.h:82
Track.h
Muon::MuonRefitTool::updateAlignmentErrors
std::unique_ptr< Trk::Track > updateAlignmentErrors(const Trk::Track &track, const EventContext &ctx, const Settings &settings) const
Definition: MuonRefitTool.cxx:223
TrkDriftCircleMath::Line
Definition: Line.h:17
Muon::MuonRefitTool::m_mdtRotCreator
ToolHandle< IMdtDriftCircleOnTrackCreator > m_mdtRotCreator
Definition: MuonRefitTool.h:83
MuonTSOSHelper.h
Muon::MuonDriftCircleErrorStrategy::SlewCorrection
@ SlewCorrection
Slewing correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:31
Muon::MuonRefitTool::m_muonErrorStrategy
MuonDriftCircleErrorStrategy m_muonErrorStrategy
Definition: MuonRefitTool.h:124
Muon::IMuonRefitTool::Settings::removeOutliers
bool removeOutliers
toogle on/off refit of the track
Definition: IMuonRefitTool.h:41
Muon::MuonRefitTool::m_errorStrategyBXE
MuonDriftCircleErrorStrategy m_errorStrategyBXE
Definition: MuonRefitTool.h:118
Muon::IMuonRefitTool::Settings::precisionLayersToBeremoved
std::set< MuonStationIndex::StIndex > precisionLayersToBeremoved
all hits in chambers that are in the list are turned into outliers
Definition: IMuonRefitTool.h:56
Muon::MuonRefitTool::m_errorStrategyEE
MuonDriftCircleErrorStrategy m_errorStrategyEE
Definition: MuonRefitTool.h:116
Muon::IMuonRefitTool::Settings::refit
bool refit
use broad error settings
Definition: IMuonRefitTool.h:40
Muon::MuonDriftCircleErrorStrategyInput
std::bitset< 23 > MuonDriftCircleErrorStrategyInput
Definition: MuonDriftCircleErrorStrategy.h:13
Muon::MuonRefitTool::m_alignmentErrors
Gaudi::Property< bool > m_alignmentErrors
Definition: MuonRefitTool.h:101
Muon::IMuonRefitTool::Settings::updateTriggerErrors
bool updateTriggerErrors
update the errors without recalibrating
Definition: IMuonRefitTool.h:45
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Muon::MuonDriftCircleErrorStrategy::FixedError
@ FixedError
A fixed error is given to this hit (user defined via jobProperties)
Definition: MuonDriftCircleErrorStrategy.h:20
MuonGM::MdtReadoutElement
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:50
MuonAlign::AlignmentTranslationDeviation
Definition: AlignmentTranslationDeviation.h:11
Muon::MuonRefitTool::m_errorStrategyEEL1C05
MuonDriftCircleErrorStrategy m_errorStrategyEEL1C05
Definition: MuonRefitTool.h:119
Muon::MuonRefitTool::m_simpleAEOTs
Gaudi::Property< bool > m_simpleAEOTs
Definition: MuonRefitTool.h:102
lumiFormat.i
int i
Definition: lumiFormat.py:92
Muon::IMuonRefitTool::Settings::phiLayersToBeremoved
std::set< MuonStationIndex::PhiIndex > phiLayersToBeremoved
all precision hits in station layers that are in the list are turned into outliers
Definition: IMuonRefitTool.h:58
Muon::MuonStationIndex::BM
@ BM
Definition: MuonStationIndex.h:25
Muon::MuonRefitTool::m_alignmentDeltaError
Gaudi::Property< float > m_alignmentDeltaError
Definition: MuonRefitTool.h:98
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
beamspotman.n
n
Definition: beamspotman.py:731
Muon::MuonDriftCircleErrorStrategy::TofCorrection
@ TofCorrection
Time of flight correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:26
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Muon::MuonRefitTool::finalize
virtual StatusCode finalize() override
Definition: MuonRefitTool.cxx:137
Muon::MuonStationIndex::EI
@ EI
Definition: MuonStationIndex.h:26
Muon::MuonRefitTool::initialize
virtual StatusCode initialize() override
Definition: MuonRefitTool.cxx:45
urldecode::states
states
Definition: urldecode.h:39
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
Muon::IMuonRefitTool::Settings::extrapolateToMuonEntry
bool extrapolateToMuonEntry
de-weight all hits in sectors that are not the main sector
Definition: IMuonRefitTool.h:50
Muon::MuonRefitTool::m_nrefits
std::atomic< unsigned int > m_nrefits
Definition: MuonRefitTool.h:128
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Muon::MuonRefitTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonRefitTool.h:75
TrackCollection.h
Muon::MuonRefitTool::m_compClusterCreator
ToolHandle< IMuonCompetingClustersOnTrackCreator > m_compClusterCreator
Definition: MuonRefitTool.h:85
PseudoMeasurementOnTrack.h
Muon::MuonRefitTool::m_errorStrategy
MuonDriftCircleErrorStrategy m_errorStrategy
Definition: MuonRefitTool.h:123
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:127
Muon::MuonRefitTool::m_edmHelperSvc
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MuonRefitTool.h:73
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Muon::MuonDriftCircleErrorStrategy::BackgroundCorrection
@ BackgroundCorrection
Background correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:32
TrkDriftCircleMath::DCOnTrackCit
DCOnTrackVec::const_iterator DCOnTrackCit
Definition: DCOnTrack.h:61
Trk::PlaneSurface::globalToLocalDirection
void globalToLocalDirection(const Amg::Vector3D &glodir, Trk::LocalDirection &locdir) const
This method transforms the global direction to a local direction wrt the plane.
Definition: PlaneSurface.cxx:260
Muon::MdtDriftCircleOnTrack::clone
virtual MdtDriftCircleOnTrack * clone() const override final
Pseudo-constructor, needed to avoid excessive RTTI.
Definition: MdtDriftCircleOnTrack.h:256
TrackSummary.h
Trk::ParametersBase
Definition: ParametersBase.h:55
Muon::MuonRefitTool::m_alignmentDelta
Gaudi::Property< float > m_alignmentDelta
Definition: MuonRefitTool.h:96
TrkDriftCircleMath::MatchDCWithLine
Definition: MatchDCWithLine.h:16
Muon::MdtDriftCircleOnTrack::driftRadius
double driftRadius() const
Returns the value of the drift radius.
Definition: MdtDriftCircleOnTrack.h:277
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
Muon::MuonDriftCircleErrorStrategy::Segment
@ Segment
Treating a segment or a track.
Definition: MuonDriftCircleErrorStrategy.h:33
Trk::muon
@ muon
Definition: ParticleHypothesis.h:28
TrkDriftCircleMath::SegmentFinder::setFitter
void setFitter(std::shared_ptr< const DCSLFitter > fitter)
Definition: SegmentFinder.h:65
Muon::MuonDriftCircleErrorStrategy::ErrorAtPredictedPosition
@ ErrorAtPredictedPosition
Definition: MuonDriftCircleErrorStrategy.h:23
DataVector< const Trk::TrackStateOnSurface >
Trk::LocalDirection
represents the three-dimensional global direction with respect to a planar surface frame.
Definition: LocalDirection.h:81
TrkDriftCircleMath::DCOnTrack::OnTrack
@ OnTrack
Definition: DCOnTrack.h:20
Muon::MuonDriftCircleErrorStrategy::MagFieldCorrection
@ MagFieldCorrection
Magnetic field correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:29
Trk::AlignmentDeviation
An object decorating a track and holding degrees of freedom reflecting alignment accuracy.
Definition: AlignmentDeviation.h:20
Muon::MuonRefitTool::m_deweightBIS78
Gaudi::Property< bool > m_deweightBIS78
Definition: MuonRefitTool.h:109
Trk::MeasurementBase::localCovariance
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Definition: MeasurementBase.h:138
beamspotman.dir
string dir
Definition: beamspotman.py:623
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:224
Muon::MuonRefitTool::m_deweightEEL1C05
Gaudi::Property< bool > m_deweightEEL1C05
Definition: MuonRefitTool.h:112
Muon::MuonRefitTool::makeAEOTs
std::unique_ptr< Trk::Track > makeAEOTs(const Trk::Track &track) const
Definition: MuonRefitTool.cxx:234
TrkDriftCircleMath::SegIt
SegVec::iterator SegIt
Definition: TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:123
Trk::MeasurementBase
Definition: MeasurementBase.h:58
EventPrimitives.h
Trk::Track::perigeeParameters
const Perigee * perigeeParameters() const
return Perigee.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:163
Muon::MuonRefitTool::m_alignmentAngleError
Gaudi::Property< float > m_alignmentAngleError
Definition: MuonRefitTool.h:99
Muon::MuonRefitTool::m_errorStrategyBEE
MuonDriftCircleErrorStrategy m_errorStrategyBEE
Definition: MuonRefitTool.h:115
Muon::MuonRefitTool::m_failedExtrapolationMuonEntry
std::atomic< unsigned int > m_failedExtrapolationMuonEntry
Definition: MuonRefitTool.h:133
Muon::MuonRefitTool::m_addInner
Gaudi::Property< bool > m_addInner
Definition: MuonRefitTool.h:104
Muon::MuonDriftCircleErrorStrategy::StationError
@ StationError
A term is added to account for misaligned.
Definition: MuonDriftCircleErrorStrategy.h:22
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
Muon::MuonRefitTool::m_muonEntryTrackExtrapolator
ToolHandle< Muon::IMuonTrackExtrapolationTool > m_muonEntryTrackExtrapolator
Definition: MuonRefitTool.h:88
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Trk::MeasurementBase::associatedSurface
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
Muon::IMuonRefitTool::Settings::prepareForFit
bool prepareForFit
update the errors of the trigger hits
Definition: IMuonRefitTool.h:46
Amg::error
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 ...
Definition: EventPrimitivesHelpers.h:40
Muon::MdtDriftCircleOnTrack
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
Definition: MdtDriftCircleOnTrack.h:37
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
AlignmentRotationDeviation.h
python.copyTCTOutput.locDir
locDir
Definition: copyTCTOutput.py:113
Muon::MuonDriftCircleErrorStrategy::setParameter
void setParameter(CreationParameter, bool value)
Definition: MuonDriftCircleErrorStrategy.h:65
Muon::MuonDriftCircleErrorStrategy::setStrategy
void setStrategy(Strategy)
Select the strategy to be used - only one can be set at a time.
Definition: MuonDriftCircleErrorStrategy.h:56
Muon::MuonRefitTool::m_addMiddle
Gaudi::Property< bool > m_addMiddle
Definition: MuonRefitTool.h:105
eflowRec::phiIndex
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition: EtaPhiLUT.cxx:23
Muon::MuonRefitTool::m_finderDebugLevel
Gaudi::Property< int > m_finderDebugLevel
Definition: MuonRefitTool.h:90
Muon::MuonDriftCircleErrorStrategy::ParameterisedErrors
@ ParameterisedErrors
Use parameterised errors.
Definition: MuonDriftCircleErrorStrategy.h:21
DeMoScan.index
string index
Definition: DeMoScan.py:362
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
Muon::MuonStationIndex::BO
@ BO
Definition: MuonStationIndex.h:25
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Muon::MuonRefitTool::m_t0Fitter
ToolHandle< IDCSLFitProvider > m_t0Fitter
Definition: MuonRefitTool.h:87
PlaneSurface.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Muon::IMuonRefitTool::Settings::updateErrors
bool updateErrors
recalibrate the hits
Definition: IMuonRefitTool.h:44
TrkDriftCircleMath::SegmentFinder::setPhiRoad
void setPhiRoad(double phiRoad, double phiChamber, double sinPhiCut=0.2, bool useRoadPhi=true, bool useChamberPhi=true)
Definition: SegmentFinder.cxx:87
DEBUG
#define DEBUG
Definition: page_access.h:11
Muon::IMuonRefitTool::Settings::removeBEE
bool removeBEE
turn all hits in the barrel/endcap part of the track with least hits into outliers
Definition: IMuonRefitTool.h:53
Muon::MuonRefitTool::m_trackFitter
ToolHandle< Trk::ITrackFitter > m_trackFitter
Definition: MuonRefitTool.h:81
Trk::RIO_OnTrack::identify
virtual Identifier identify() const final
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:155
Muon::MuonRefitTool::createPerigee
std::unique_ptr< Trk::Perigee > createPerigee(const Trk::TrackParameters &pars, const EventContext &ctx) const
Definition: MuonRefitTool.cxx:1479
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
python.LArCondContChannels.isBarrel
isBarrel
Definition: LArCondContChannels.py:659
TrkDriftCircleMath::SegVec
std::vector< Segment > SegVec
Definition: TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:122
Muon::MuonDriftCircleErrorStrategy::BroadError
@ BroadError
Definition: MuonDriftCircleErrorStrategy.h:18
Muon::MuonStationIndex::stName
static const std::string & stName(StIndex index)
convert StIndex into a string
Definition: MuonStationIndex.cxx:141
Muon::MuonTSOSHelper::createMeasTSOSWithUpdate
static std::unique_ptr< Trk::TrackStateOnSurface > createMeasTSOSWithUpdate(const Trk::TrackStateOnSurface &tsos, std::unique_ptr< Trk::MeasurementBase > meas, std::unique_ptr< Trk::TrackParameters > pars, Trk::TrackStateOnSurface::TrackStateOnSurfaceType type)
create a TSOS with a measurement, takes ownership of the pointers
Definition: MuonTSOSHelper.h:74
Muon::MuonStationIndex::StIndex
StIndex
enum to classify the different station layers in the muon spectrometer
Definition: MuonStationIndex.h:23
TrkDriftCircleMath::SegmentFinder
Definition: SegmentFinder.h:32
Muon::MuonDriftCircleErrorStrategy::ScaledError
@ ScaledError
Definition: MuonDriftCircleErrorStrategy.h:19
LocalDirection.h
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
Muon::MuonRefitTool::updateMdtErrors
std::unique_ptr< Trk::Track > updateMdtErrors(const Trk::Track &track, const EventContext &ctx, const Settings &settings) const
Definition: MuonRefitTool.cxx:982
AthAlgTool
Definition: AthAlgTool.h:26
Muon::IMuonRefitTool::Settings::discardNotCleanedTracks
bool discardNotCleanedTracks
remove MDT outliers locally redoing the local segment fit
Definition: IMuonRefitTool.h:42
Muon::MuonStationIndex::EE
@ EE
Definition: MuonStationIndex.h:26
Muon::MuonRefitTool::makeSimpleAEOTs
std::unique_ptr< Trk::Track > makeSimpleAEOTs(const Trk::Track &track) const
Definition: MuonRefitTool.cxx:481
Muon::MuonRefitTool::m_alignErrorTool
ToolHandle< Trk::ITrkAlignmentDeviationTool > m_alignErrorTool
Does not provide any method with EventContext yet.
Definition: MuonRefitTool.h:78
Muon::MuonRefitTool::refit
std::unique_ptr< Trk::Track > refit(const Trk::Track &track, const EventContext &ctx, const Settings *settings) const override
refit a track
Definition: MuonRefitTool.cxx:148
Muon::MuonStationIndex::BOL
@ BOL
Definition: MuonStationIndex.h:17
Muon::MuonDriftCircleErrorStrategy::creationParameter
bool creationParameter(CreationParameter) const
Definition: MuonDriftCircleErrorStrategy.h:84
CompareMuonSegmentKeys.h
Muon::MuonRefitTool::m_errorStrategyTwoStations
MuonDriftCircleErrorStrategy m_errorStrategyTwoStations
Definition: MuonRefitTool.h:122
Muon::IMuonRefitTool::Settings::deweightOtherSectors
bool deweightOtherSectors
remove all hits in sectors that are not the main sector
Definition: IMuonRefitTool.h:49
Trk::TrackStateOnSurface::Measurement
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
Definition: TrackStateOnSurface.h:101
Muon::MuonRefitTool::MuonRefitTool
MuonRefitTool(const std::string &ty, const std::string &na, const IInterface *pa)
Definition: MuonRefitTool.cxx:30
Muon::MuonStationIndex::EM
@ EM
Definition: MuonStationIndex.h:26
TrackStateOnSurface.h
MuonSegmentKey.h
TrkDriftCircleMath::SegmentFinder::setRecoverMDT
void setRecoverMDT(bool doRecover)
Definition: SegmentFinder.cxx:55
TrkDriftCircleMath::SegmentFinder::debugLevel
void debugLevel(int debugLevel)
Definition: SegmentFinder.h:71
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
TrkDriftCircleMath::DriftCircle::InTime
@ InTime
drift time too small to be compatible with drift spectrum
Definition: DriftCircle.h:27