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