ATLAS Offline Software
MuonStauRecoTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "MuonStauRecoTool.h"
6 
7 #include <memory>
8 
10 #include "GaudiKernel/ConcurrencyFlags.h"
29 
30 namespace {
31  constexpr double inverseSpeedOfLight = 1 / Gaudi::Units::c_light; // need 1/299.792458 inside calculateTof()/calculateBeta()
32 
33 }
34 
35 namespace MuonCombined {
36 
38  std::ostringstream sout;
39  sout << " sector " << intersection.layerSurface.sector << " "
40  << Muon::MuonStationIndex::regionName(intersection.layerSurface.regionIndex) << " "
41  << Muon::MuonStationIndex::layerName(intersection.layerSurface.layerIndex);
42  return sout.str();
43  }
44 
45  MuonStauRecoTool::MuonStauRecoTool(const std::string& type, const std::string& name, const IInterface* parent) :
47 
49  ATH_CHECK(m_idHelperSvc.retrieve());
50  ATH_CHECK(m_printer.retrieve());
51  ATH_CHECK(m_edmHelperSvc.retrieve());
52  ATH_CHECK(m_segmentMaker.retrieve());
53  ATH_CHECK(m_segmentMakerT0Fit.retrieve());
54  ATH_CHECK(m_segmentMatchingTool.retrieve());
56  ATH_CHECK(m_hitTimingTool.retrieve());
59  ATH_CHECK(m_mdtCreator.retrieve());
60  ATH_CHECK(m_mdtCreatorStau.retrieve());
61  ATH_CHECK(m_insideOutRecoTool.retrieve());
62  ATH_CHECK(m_updator.retrieve());
65 
66  if (m_doTruth) {
67  // add pdgs from jobO to set
68  for (auto pdg : m_pdgsToBeConsidered.value()) { m_selectedPdgs.insert(pdg); }
69  }
70  return StatusCode::SUCCESS;
71  }
72 
75  TrackCollection* meTracks, Trk::SegmentCollection* segments, const EventContext& ctx) const {
76  // Maybe we'll need this later, I wouldn't be surprised if the PRDs are retrieved somewhere down the chain
77  // For now it's just a placeholder though
78  if (!prdData.mdtPrds) ATH_MSG_DEBUG("empty PRDs passed");
79  extend(inDetCandidates, tagMap, combTracks, meTracks, segments, ctx);
80  }
81 
83  TrackCollection* combTracks, TrackCollection* meTracks, Trk::SegmentCollection* segments,
84  const EventContext& ctx) const {
85  ATH_MSG_DEBUG(" extending " << inDetCandidates.size());
86 
87  if (meTracks) ATH_MSG_DEBUG("Not currently creating ME tracks for staus");
88  for (const InDetCandidate* it : inDetCandidates) { handleCandidate(ctx, *it, tagMap, combTracks, segments); }
89  }
90 
91  std::unique_ptr<MuonStauRecoTool::TruthInfo>
92  MuonStauRecoTool::getTruth(const xAOD::TrackParticle& indetTrackParticle) const {
93  // in case we are using the truth, check if the truth link is set and create the TruthInfo object
95  truthParticleLinkAcc("truthParticleLink");
96  if (m_doTruth && truthParticleLinkAcc.isAvailable(indetTrackParticle)) {
97  const ElementLink<xAOD::TruthParticleContainer>& truthLink = truthParticleLinkAcc(indetTrackParticle);
98  if (truthLink.isValid()) {
99  return std::make_unique<TruthInfo>((*truthLink)->pdgId(), (*truthLink)->m(), (*truthLink)->p4().Beta());
100  }
101  }
102  return nullptr;
103  }
104 
105  void MuonStauRecoTool::handleCandidate(const EventContext& ctx, const InDetCandidate& indetCandidate, InDetCandidateToTagMap* tagMap,
106  TrackCollection* combTracks, Trk::SegmentCollection* segments) const {
107  if (m_ignoreSiAssocated && indetCandidate.isSiliconAssociated()) {
108  ATH_MSG_DEBUG(" skip silicon associated track for extension ");
109  return;
110  }
111 
116  // get TrackParticle and apply the kinematic selection
117  const xAOD::TrackParticle& indetTrackParticle = indetCandidate.indetTrackParticle();
118  if (!indetTrackParticle.track() || indetTrackParticle.pt() < m_ptThreshold) return;
119 
120  // get truth info (will be zero pointer if running on data or m_doTruth == false)
121  std::unique_ptr<TruthInfo> truthInfo(getTruth(indetTrackParticle));
122 
123  // if truth based reconstruction is enabled, check whether to accept the given pdgId
124  if (!selectTruth(truthInfo.get())) {
125  ATH_MSG_DEBUG("Truth reconstruction enabled: skipping ID track with pdgId: " << (truthInfo ? truthInfo->pdgId : 0));
126  return;
127  }
128 
129  // get intersections which precision layers in the muon system
130  const Muon::MuonSystemExtension* muonSystemExtension = indetCandidate.getExtension();
131 
132  // summary for selected ID track
133  if (m_doSummary || msgLvl(MSG::DEBUG)) {
134  msg(MSG::INFO) << " ID track: pt " << indetTrackParticle.pt() << " eta " << indetTrackParticle.eta() << " phi "
135  << indetTrackParticle.phi();
136  if (truthInfo) msg(MSG::INFO) << truthInfo->toString();
137  if (!muonSystemExtension) msg(MSG::INFO) << " failed muonSystemExtension";
138  msg(MSG::INFO) << endmsg;
139  }
140 
141  // exit if no MuonSystemExtension was found
142  if (!muonSystemExtension) { return; }
143 
144  // fill validation content
145  if (!m_recoValidationTool.empty()) m_recoValidationTool->addTrackParticle(indetTrackParticle, *muonSystemExtension);
150  AssociatedData associatedData;
151  if (!extractTimeMeasurements(ctx, *muonSystemExtension, associatedData)) { return; }
152 
158  if (!createCandidates(associatedData, candidates)) { return; }
159 
160  if (!m_recoValidationTool.empty()) addCandidatesToNtuple(indetTrackParticle, candidates, 0);
161 
166  if (!refineCandidates(ctx, candidates)) { return; }
167 
168  if (!m_recoValidationTool.empty()) addCandidatesToNtuple(indetTrackParticle, candidates, 1);
169 
174  if (!combineCandidates(ctx, indetTrackParticle, candidates)) { return; }
175 
176  if (!m_recoValidationTool.empty()) addCandidatesToNtuple(indetTrackParticle, candidates, 2);
181  if (!resolveAmbiguities(candidates)) { return; }
182 
183  if (!m_recoValidationTool.empty()) addCandidatesToNtuple(indetTrackParticle, candidates, 3);
187  addTag(indetCandidate, *candidates.front(), tagMap, combTracks, segments);
188  }
189 
191  // keep track of candidates for which segments are found
192  CandidateVec refinedCandidates;
193 
194  // loop over candidates and redo segments using beta estimate from candidate
195  ATH_MSG_DEBUG("Refining candidates " << candidates.size());
196  for (auto& candidate : candidates) {
197  ATH_MSG_DEBUG(" candidate: betaseed beta" << candidate->betaSeed.beta << ", error" << candidate->betaSeed.error
198  << " layerDataVec size" << candidate->layerDataVec.size() << " hits size"
199  << candidate->hits.size());
200 
201  // loop over layers and perform segment finding, collect segments per layer
202  for (const auto& layerData : candidate->layerDataVec) {
203  // store segments in layer
204  std::vector<std::shared_ptr<const Muon::MuonSegment>> segments;
205 
206  // loop over maxima
207  for (const auto& maximumData : layerData.maximumDataVec) {
208  // find segments for intersection
209  findSegments(layerData.intersection, *maximumData, segments, m_muonPRDSelectionToolStau, m_segmentMaker);
210  }
211 
212  // skip if no segment were found
213  if (segments.empty()) continue;
214 
215  // fill validation content
216  if (!m_recoValidationTool.empty()) {
217  for (const auto& seg : segments) m_recoValidationTool->add(layerData.intersection, *seg, 2);
218  }
219 
220  // match segments to intersection, store the ones that match
221  std::vector<std::shared_ptr<const Muon::MuonSegment>> selectedSegments;
222  m_segmentMatchingTool->select(ctx, layerData.intersection, segments, selectedSegments);
223  // fill validation content
224  if (!m_recoValidationTool.empty()) {
225  for (const auto& seg : selectedSegments) m_recoValidationTool->add(layerData.intersection, *seg, 3);
226  }
227 
228  // add layer list
229  candidate->allLayers.emplace_back(layerData.intersection, std::move(selectedSegments));
230  }
231 
232  // keep candidate if any segments were found
233  if (!candidate->allLayers.empty()) refinedCandidates.push_back(candidate);
234  }
235 
236  // set candidates to the refinedCandidates
237  candidates = refinedCandidates;
238 
239  // print results afer refineCandidate
240  if (m_doSummary || msgLvl(MSG::DEBUG)) {
241  msg(MSG::INFO) << " Summary::refineCandidates ";
242  if (candidates.empty())
243  msg(MSG::INFO) << " No candidated found ";
244  else
245  msg(MSG::INFO) << " candidates " << candidates.size();
246 
247  for (const auto& candidate : candidates) {
248  msg(MSG::INFO) << std::endl
249  << " candidate: beta fit result: beta " << candidate->betaFitResult.beta << " chi2/ndof "
250  << candidate->betaFitResult.chi2PerDOF() << " layers with segments" << candidate->allLayers.size();
251  for (const auto& layer : candidate->allLayers)
252  msg(MSG::INFO) << std::endl
253  << " " << printIntersectionToString(layer.intersection) << " segments " << layer.segments.size();
254  }
255  msg(MSG::INFO) << endmsg;
256  }
257 
258  return !candidates.empty();
259  }
260 
262  Candidate& candidate) const {
263 
265  if (!mdtCalibConstants.isValid()) {
266  ATH_MSG_FATAL("Failed to retrieve calibration constants "<<m_calibDbKey.fullKey());
267  throw std::runtime_error("Failed to retrieve calibration constants");
268  }
269  ATH_MSG_VERBOSE("extractTimeMeasurementsFromTrack for candidate: beta seed " << candidate.betaSeed.beta);
270  Trk::Track* combinedTrack = candidate.combinedTrack.get();
271  if (!combinedTrack) return;
272 
273  // select around seed
274  float betaSeed = candidate.betaFitResult.beta;
275 
276  // fitter + hits
279 
280  // loop over track and calculate residuals
281  const Trk::TrackStates* states = combinedTrack->trackStateOnSurfaces();
282  if (!states) {
283  ATH_MSG_WARNING(" track without states, cannot extractTimeMeasurementsFromTrack ");
284  return;
285  }
286 
287  ATH_MSG_VERBOSE("Track : " << (*combinedTrack));
288 
289  // store RPC prds for clustering
290  typedef std::vector<const Muon::MuonClusterOnTrack*> RpcClVec;
291  using RpcClPerChMap = std::map<Identifier, std::tuple<const Trk::TrackParameters*, RpcClVec, RpcClVec>>;
292  RpcClPerChMap rpcPrdsPerChamber;
293 
294  using MdtTubeData = std::pair<const Trk::TrackParameters*, const Muon::MdtDriftCircleOnTrack*>;
295  using MdtTubeDataVec = std::vector<MdtTubeData>;
296  using MdtChamberLayerData = std::map<int, MdtTubeDataVec>;
297  MdtChamberLayerData mdtDataPerChamberLayer;
298 
299  // loop over TSOSs
301  Trk::TrackStates::const_iterator tsit_end = states->end();
302  for (; tsit != tsit_end; ++tsit) {
303  const Trk::TrackParameters* pars = (*tsit)->trackParameters();
304  if (!pars) continue;
305 
306  // check whether state is a measurement
307  const Trk::MeasurementBase* meas = (*tsit)->measurementOnTrack();
308  if (!meas || (*tsit)->type(Trk::TrackStateOnSurface::Outlier)) continue;
309 
310  // get Identifier and skip pseudo measurements, ID hits and all but MDT/RPC hits
311  Identifier id = m_edmHelperSvc->getIdentifier(*meas);
312  if (!id.is_valid() || !m_idHelperSvc->isMuon(id)) continue;
313 
314  // extract time measurements for RPCs
315  if (m_idHelperSvc->isMdt(id)) {
316  // MDTs
317  const Muon::MdtDriftCircleOnTrack* mdt = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(meas);
318  if (!mdt) continue;
319 
320  if (m_segmentMDTT) {
321  int chIndexWithBIR = m_idHelperSvc->chamberIndex(mdt->identify());
322  if (chIndexWithBIR == Muon::MuonStationIndex::BIL) {
323  std::string stName = m_idHelperSvc->chamberNameString(id);
324  if (stName[2] == 'R') { chIndexWithBIR += 1000; }
325  }
326  mdtDataPerChamberLayer[chIndexWithBIR].push_back(std::make_pair(pars, mdt));
327  } else {
329  float distance = pars->position().mag();
330  float time = 0.;
331 
332  float ix = pars->position().x();
333  float iy = pars->position().y();
334  float iz = pars->position().z();
335  float ie = 0.;
336  float er = -1;
337  float sh = 0;
338  bool isEta = !m_idHelperSvc->measuresPhi(id);
339  float propTime = 0;
340  float tof = calculateTof(1, distance);
341 
342  // use inverted RT relation together with track prediction to get estimate of drift time
343  float driftTime = mdt->driftTime(); // we need to add beta seed as it was subtracted when calibrating the hits
344  float locR = pars->parameters()[Trk::locR];
345  float errR = pars->covariance() ? Amg::error(*pars->covariance(), Trk::locR) : 0.3;
346  auto data = mdtCalibConstants->getCalibData(id, msgStream());
347  const auto& rtRelation = data->rtRelation;
348  bool out_of_bound_flag = false;
349  float drdt = rtRelation->rt()->driftVelocity(driftTime);
350  float rres = rtRelation->rtRes()->resolution(driftTime);
351  float tres = rres / drdt;
352  float TlocR = rtRelation->tr()->tFromR(std::abs(locR), out_of_bound_flag);
353  float trackTimeRes = errR / drdt;
354  float tofShiftFromBeta = calculateTof(betaSeed, distance) - tof;
355  er = std::sqrt(tres * tres + trackTimeRes * trackTimeRes);
356  mdtTimeCalibration(id, driftTime, er);
357  time = driftTime - TlocR + tofShiftFromBeta;
358  propTime = driftTime;
359  ie = trackTimeRes;
360  // try removal of hit from fit
361  if (!m_updator.empty()) {
362  std::unique_ptr<const Trk::TrackParameters> unbiasedPars(
363  m_updator->removeFromState(*pars, meas->localParameters(), meas->localCovariance()));
364  if (unbiasedPars) {
365  float locRu = unbiasedPars->parameters()[Trk::locR];
366  float TlocRu = rtRelation->tr()->tFromR(std::abs(locRu), out_of_bound_flag);
367  float errRu = unbiasedPars->covariance() ? Amg::error(*unbiasedPars->covariance(), Trk::locR) : 0.3;
368  float trackTimeResu = errRu / drdt;
369  sh = TlocR - TlocRu;
370  time = driftTime - TlocRu + tofShiftFromBeta;
371  er = std::sqrt(tres * tres + trackTimeResu * trackTimeResu);
372  ie = trackTimeResu;
373  ATH_MSG_VERBOSE(" Got unbiased parameters: r " << locR << " ur " << locRu << " err " << errR << " uerr "
374  << errRu << " terr " << trackTimeRes << " terru "
375  << trackTimeResu);
376  }
377  }
378 
379  ATH_MSG_VERBOSE(" MDT " << mdt->driftRadius() << " locR " << locR << " err " << errR << " drift time " << driftTime
380  << " TlocR " << TlocR << " diff " << driftTime - TlocR << " tofShift " << tofShiftFromBeta
381  << " time " << time << " err " << er << " intrinsic " << tres << " track " << trackTimeRes);
382 
383  float beta = calculateBeta(time + tof, distance);
384  ATH_MSG_VERBOSE(" adding " << m_idHelperSvc->toString(id) << " distance " << distance << " time " << time << " beta"
385  << beta << " diff " << std::abs(beta - betaSeed));
386  if (std::abs(beta - betaSeed) > m_mdttBetaAssociationCut) continue;
387 
388  hits.push_back(Muon::TimePointBetaFitter::Hit(distance, time, er));
389  candidate.stauHits.push_back(MuGirlNS::StauHit(tech, time + tof, ix, iy, iz, id, ie, er, sh, isEta, propTime));
390  }
391  } else if (m_idHelperSvc->isRpc(id)) {
392  // treat CompetingMuonClustersOnTrack differently than RpcClusterOnTrack
393  std::vector<const Muon::MuonClusterOnTrack*> clusters;
394  const Muon::CompetingMuonClustersOnTrack* crot = dynamic_cast<const Muon::CompetingMuonClustersOnTrack*>(meas);
395  if (crot) {
396  clusters = crot->containedROTs();
397  } else {
398  const Muon::RpcClusterOnTrack* rpc = dynamic_cast<const Muon::RpcClusterOnTrack*>(meas);
399  if (rpc) clusters.push_back(rpc);
400  }
401  Identifier chamberId = m_idHelperSvc->chamberId(id);
402  bool measuresPhi = m_idHelperSvc->measuresPhi(id);
403  auto pos = rpcPrdsPerChamber.find(chamberId);
404  if (pos == rpcPrdsPerChamber.end()) {
405  if (measuresPhi)
406  rpcPrdsPerChamber[chamberId] = std::make_tuple(pars, clusters, RpcClVec());
407  else
408  rpcPrdsPerChamber[chamberId] = std::make_tuple(pars, RpcClVec(), clusters);
409  } else {
410  RpcClVec& clVec = measuresPhi ? std::get<1>(pos->second) : std::get<2>(pos->second);
411  clVec.insert(clVec.end(), clusters.begin(), clusters.end());
412  }
413  } else if (m_idHelperSvc->isCsc(id)) {
414  const Muon::CscClusterOnTrack* csc = dynamic_cast<const Muon::CscClusterOnTrack*>(meas);
415 
417  float distance = pars->position().mag();
418  float time = csc->prepRawData()->time();
419 
420  float ix = pars->position().x();
421  float iy = pars->position().y();
422  float iz = pars->position().z();
423  float ie = 0.;
424  float er = -1;
425  float sh = 0;
426  bool isEta = !m_idHelperSvc->measuresPhi(id);
427  float propTime = 0;
428  float tof = calculateTof(1, distance);
429  candidate.stauHits.push_back(MuGirlNS::StauHit(tech, time + tof, ix, iy, iz, id, ie, er, sh, isEta, propTime));
430  }
431  }
432 
433  auto insertRpcs = [betaSeed, this](const Trk::TrackParameters& pars, const RpcClVec& clusters,
435  if (clusters.empty()) return;
436 
437  std::vector<const Muon::MuonClusterOnTrack*> calibratedClusters;
438  for (const auto* cluster : clusters) {
439  const Muon::MuonClusterOnTrack* cl = m_muonPRDSelectionTool->calibrateAndSelect(pars, *cluster->prepRawData());
440  if (cl) calibratedClusters.push_back(cl);
441  }
442  if (calibratedClusters.empty()) return;
443 
444  Muon::IMuonHitTimingTool::TimingResult result = m_hitTimingTool->calculateTimingResult(calibratedClusters);
445  for (const auto* cl : calibratedClusters) delete cl;
446  if (!result.valid) return;
447 
448  Identifier id = clusters.front()->identify();
449 
451  float distance = pars.position().mag();
452  float time = result.time;
453  float ix = pars.position().x();
454  float iy = pars.position().y();
455  float iz = pars.position().z();
456  float ie = 0.;
457  float er = result.error;
458  rpcTimeCalibration(id, time, er);
459  float sh = 0;
460  bool isEta = !m_idHelperSvc->measuresPhi(id);
461  if (isEta) tech = MuGirlNS::RPCETA_STAU_HIT;
462  float propTime = 0;
463  float tof = calculateTof(1, distance);
464  float beta = calculateBeta(time + tof, distance);
465  ATH_MSG_VERBOSE(" adding " << m_idHelperSvc->toString(id) << " distance " << distance << " time " << time << " beta" << beta
466  << " diff " << std::abs(beta - betaSeed));
467 
468  if (std::abs(beta - betaSeed) > m_mdttBetaAssociationCut) return;
469 
470  hits.push_back(Muon::TimePointBetaFitter::Hit(distance, time, er));
471  candidate.stauHits.push_back(MuGirlNS::StauHit(tech, time + tof, ix, iy, iz, id, ie, er, sh, isEta, propTime));
472  };
473 
474  // get RPC timing per chamber
475  RpcClPerChMap::const_iterator chit = rpcPrdsPerChamber.begin();
476  RpcClPerChMap::const_iterator chit_end = rpcPrdsPerChamber.end();
477  ATH_MSG_VERBOSE("RPCs per chamber " << rpcPrdsPerChamber.size());
478 
479  for (; chit != chit_end; ++chit) {
480  const Trk::TrackParameters* pars = std::get<0>(chit->second);
481  const RpcClVec& phiClusters = std::get<1>(chit->second);
482  const RpcClVec& etaClusters = std::get<2>(chit->second);
483  insertRpcs(*pars, phiClusters, candidate, hits);
484  insertRpcs(*pars, etaClusters, candidate, hits);
485  }
486 
487  // get timing per MDT chamber, use segment error strategy (errors of the RT relation
489  Muon::MuonDriftCircleErrorStrategy calibrationStrategy(bits);
492 
494  TrkDriftCircleMath::SegmentFinder segmentFinder;
495  segmentFinder.setMaxDropDepth(2);
496  segmentFinder.setChi2DropCut(5);
497  segmentFinder.setDeltaCut(3);
498 
499  MdtChamberLayerData::const_iterator mit = mdtDataPerChamberLayer.begin();
500  MdtChamberLayerData::const_iterator mit_end = mdtDataPerChamberLayer.end();
501  for (; mit != mit_end; ++mit) {
502  ATH_MSG_VERBOSE(" new station layer " << Muon::MuonStationIndex::chName((Muon::MuonStationIndex::ChIndex)(mit->first % 1000))
503  << " hits " << mit->second.size());
504  if (mit->second.size() < 4) continue;
505 
506  // get RE element for first hit
507  const MuonGM::MdtReadoutElement* detEl = mit->second.front().second->detectorElement();
508  const Trk::PlaneSurface* surf = dynamic_cast<const Trk::PlaneSurface*>(&detEl->surface());
509  if (!surf) {
510  ATH_MSG_WARNING("MdtReadoutElement should always have a PlaneSurface as reference surface");
511  continue;
512  }
513  Amg::Transform3D gToStation = detEl->GlobalToAmdbLRSTransform();
514 
515  // get TrackParameters and SL intersect the DetEl surface (above a few GeV SL intersection is accurate enough)
516  const Trk::TrackParameters& firstPars = *mit->second.front().first;
517  Trk::Intersection slIntersection = surf->straightLineIntersection(firstPars.position(), firstPars.momentum(), false, false);
518 
519  // calculate seed position and direction
520  Trk::LocalDirection seedLocDir;
521  surf->globalToLocalDirection(firstPars.momentum(), seedLocDir);
522  Amg::Vector3D seedLocPos = gToStation * slIntersection.position;
523  TrkDriftCircleMath::LocVec2D seedPos(seedLocPos.y(), seedLocPos.z());
524  TrkDriftCircleMath::Line seedLine(seedPos, seedLocDir.angleYZ());
526 
527  std::vector<std::pair<std::shared_ptr<const Muon::MdtDriftCircleOnTrack>, const Trk::TrackParameters*>> indexLookUp;
528  unsigned index = 0;
529  for (const auto& entry : mit->second) {
530  const Trk::TrackParameters& pars = *entry.first;
531  const Muon::MdtDriftCircleOnTrack& mdt = *entry.second;
532  Identifier id = mdt.identify();
533  // calibrate MDT
534  std::unique_ptr<const Muon::MdtDriftCircleOnTrack> calibratedMdt(
535  m_mdtCreatorStau->correct(*mdt.prepRawData(), pars, &calibrationStrategy, betaSeed));
536  if (!calibratedMdt) {
537  ATH_MSG_WARNING("Failed to recalibrate existing MDT on track " << m_idHelperSvc->toString(id));
538  continue;
539  }
540  ATH_MSG_VERBOSE(" recalibrated MDT " << m_idHelperSvc->toString(id) << " r " << calibratedMdt->driftRadius() << " "
541  << Amg::error(calibratedMdt->localCovariance(), Trk::locR) << " old r "
542  << mdt.driftRadius() << " " << Amg::error(mdt.localCovariance(), Trk::locR)
543  << " r_track " << pars.parameters()[Trk::locR] << " residual "
544  << std::abs(mdt.driftRadius()) - std::abs(pars.parameters()[Trk::locR]));
545 
546  // calculate tube position taking into account the second coordinate
547  Amg::Vector2D lp(0., pars.parameters()[Trk::locZ]);
548  Amg::Vector3D gpos;
549  mdt.associatedSurface().localToGlobal(lp, pars.momentum(), gpos);
550 
551  // calculate local AMDB position
552  Amg::Vector3D locPos = gToStation * gpos;
553  TrkDriftCircleMath::LocVec2D lpos(locPos.y(), locPos.z());
554 
555  double r = std::abs(calibratedMdt->driftRadius());
556  double dr = Amg::error(calibratedMdt->localCovariance(), Trk::locR);
557 
558  // create identifier
559  TrkDriftCircleMath::MdtId mdtid(m_idHelperSvc->mdtIdHelper().isBarrel(id), m_idHelperSvc->mdtIdHelper().multilayer(id) - 1,
560  m_idHelperSvc->mdtIdHelper().tubeLayer(id) - 1, m_idHelperSvc->mdtIdHelper().tube(id) - 1);
561 
562  // create new DriftCircle
564  TrkDriftCircleMath::DCOnTrack dcOnTrack(dc, 1., 1.);
565 
566  dcs.push_back(dcOnTrack);
567  indexLookUp.emplace_back(std::move(calibratedMdt), &pars);
568  ++index;
569  }
570 
571  // now loop over the hits and fit the segment taking out each of the hits individually
572  for (unsigned int i = 0; i < dcs.size(); ++i) {
574  selection[i] = 1;
576  if (!mdtFitter.fit(result, seedLine, dcs, selection)) {
577  ATH_MSG_DEBUG("Fit failed ");
578  continue;
579  }
581  segment.hitsOnTrack(dcs.size());
582  unsigned int ndofFit = segment.ndof();
583  if (ndofFit < 1) continue;
584  double chi2NdofSegmentFit = segment.chi2() / ndofFit;
585  bool hasDropHit = false;
586  unsigned int dropDepth = 0;
587  if (!segmentFinder.dropHits(segment, hasDropHit, dropDepth)) {
588  ATH_MSG_DEBUG("DropHits failed, fit chi2/ndof " << chi2NdofSegmentFit);
589  if (msgLvl(MSG::VERBOSE)) {
590  segmentFinder.debugLevel(20);
591  segment = result;
592  segmentFinder.dropHits(segment, hasDropHit, dropDepth);
593  segmentFinder.debugLevel(0);
594  }
595  continue;
596  }
597  if (i >= segment.dcs().size()) continue;
599  const TrkDriftCircleMath::DCOnTrack& dc = segment.dcs()[i];
600  double res = dc.residual();
601  double err = std::sqrt(dc.dr() * dc.dr() + dc.errorTrack() * dc.errorTrack());
602  double pull = res / err;
603  double rline = toLine.toLineY(dc.position());
604  int index = dc.index();
605  if (index < 0 || index >= (int)indexLookUp.size()) {
606  ATH_MSG_WARNING(" lookup of TrackParameters and MdtDriftCircleOnTrack failed " << index << " range: 0 - "
607  << indexLookUp.size() - 1);
608  continue;
609  }
610  const Trk::TrackParameters* pars = indexLookUp[dc.index()].second;
611  const Muon::MdtDriftCircleOnTrack* mdt = indexLookUp[dc.index()].first.get();
612  Identifier id = mdt->identify();
613 
614  // calibrate MDT with nominal timing
615  std::shared_ptr<const Muon::MdtDriftCircleOnTrack> calibratedMdt(
616  m_mdtCreator->correct(*mdt->prepRawData(), *pars, &calibrationStrategy, betaSeed));
617  if (!calibratedMdt.get()) {
618  ATH_MSG_WARNING("Failed to recalibrate existing MDT on track " << m_idHelperSvc->toString(id));
619  continue;
620  }
621  float distance = pars->position().mag();
622  float time = 0.;
623 
624  float ix = pars->position().x();
625  float iy = pars->position().y();
626  float iz = pars->position().z();
627  float ie = 0.;
628  float er = -1;
629  float sh = 0;
630  bool isEta = !m_idHelperSvc->measuresPhi(id);
631  float propTime = 0;
632  float tof = calculateTof(1, distance);
633 
634  // use inverted RT relation together with track prediction to get estimate of drift time
635  float driftTime = calibratedMdt->driftTime(); // we need to add beta seed as it was subtracted when calibrating the hits
636  float locR = rline;
637  float errR = dc.errorTrack();
638  auto data = mdtCalibConstants->getCalibData(id, msgStream());
639  const auto& rtRelation = data->rtRelation;
640  bool out_of_bound_flag = false;
641  float drdt = rtRelation->rt()->driftVelocity(driftTime);
642  float rres = rtRelation->rtRes()->resolution(driftTime);
643  float tres = rres / drdt;
644  float TlocR = rtRelation->tr()->tFromR(std::abs(locR), out_of_bound_flag);
645  float trackTimeRes = errR / drdt;
646  float tofShiftFromBeta = 0.; // muonBetaCalculationUtils.calculateTof(betaSeed,distance)-tof;
647  er = std::sqrt(tres * tres + trackTimeRes * trackTimeRes);
648  mdtTimeCalibration(id, driftTime, er);
649  time = driftTime - TlocR + tofShiftFromBeta;
650  propTime = driftTime;
651  ie = trackTimeRes;
652 
653  const float beta = calculateBeta(time + tof, distance);
654  bool isSelected = std::abs(beta - betaSeed) < m_mdttBetaAssociationCut;
655 
656  if (msgLvl(MSG::DEBUG)) {
657  msg(MSG::DEBUG) << m_idHelperSvc->toString(id) << std::setprecision(2) << " segment: after fit " << std::setw(5)
658  << chi2NdofSegmentFit << " ndof " << std::setw(2) << ndofFit;
659  if (segment.ndof() != ndofFit)
660  msg(MSG::DEBUG) << " after outlier " << std::setw(5) << chi2NdofSegmentFit << " ndof " << std::setw(2) << ndofFit;
661  msg(MSG::DEBUG) << " driftR " << std::setw(4) << dc.r() << " rline " << std::setw(5) << rline << " residual "
662  << std::setw(5) << res << " pull " << std::setw(4) << pull << " time " << std::setw(3) << time
663  << " beta" << std::setw(2) << beta << " err " << std::setw(3) << er << " intrinsic " << std::setw(3)
664  << tres << " track " << std::setw(3) << trackTimeRes;
665  if (!isSelected) msg(MSG::DEBUG) << " outlier";
666  msg(MSG::DEBUG) << std::setprecision(5) << endmsg;
667  }
668 
669  if (!isSelected) continue;
670 
671  hits.emplace_back(distance, time, er);
672  candidate.stauHits.emplace_back(MuGirlNS::MDTT_STAU_HIT, time + tof, ix, iy, iz, id, ie, er, sh, isEta, propTime);
673  }
674  }
675  // fit data
676  Muon::TimePointBetaFitter::FitResult betaFitResult = fitter.fitWithOutlierLogic(hits);
677  ATH_MSG_DEBUG(" extractTimeMeasurementsFromTrack: extracted " << candidate.stauHits.size() << " time measurements "
678  << " status fit " << betaFitResult.status << " beta "
679  << betaFitResult.beta << " chi2/ndof " << betaFitResult.chi2PerDOF());
680 
681  candidate.finalBetaFitResult = betaFitResult;
682  }
683 
684  void MuonStauRecoTool::addTag(const InDetCandidate& indetCandidate,
685  MuonStauRecoTool::Candidate& candidate,
686  InDetCandidateToTagMap* tagMap,
687  TrackCollection* combTracks,
688  Trk::SegmentCollection* segments) const {
689  // get combined track and the segments
690  combTracks->push_back(candidate.combinedTrack.release());
691  ElementLink<TrackCollection> comblink(*combTracks, combTracks->size() - 1);
692  std::vector<ElementLink<Trk::SegmentCollection>> segmentLinks;
693  for (const auto& layer : candidate.allLayers) {
694  for (const auto& segment : layer.segments) {
695  segments->push_back(segment->clone());
696  ElementLink<Trk::SegmentCollection> segLink(*segments, segments->size() - 1);
697  segmentLinks.push_back(segLink);
698  }
699  }
700 
701  // create tag
703 
704  // add additional info
705  tag->setMuBeta(candidate.betaFitResult.beta);
706 
707  // add StauExtras
708  std::unique_ptr<MuGirlNS::StauExtras> stauExtras = std::make_unique<MuGirlNS::StauExtras>();
709  stauExtras->betaAll = candidate.betaFitResult.beta;
710  stauExtras->betaAllt = candidate.finalBetaFitResult.beta;
711  stauExtras->hits = candidate.stauHits;
712  tag->setStauExtras(std::move(stauExtras));
713 
714  // print results afer refineCandidate
715  if (m_doSummary || msgLvl(MSG::DEBUG)) {
716  msg(MSG::INFO) << " Summary::addTag ";
717  msg(MSG::INFO) << std::endl
718  << " candidate: beta fit result: beta " << candidate.betaFitResult.beta << " chi2/ndof "
719  << candidate.betaFitResult.chi2PerDOF() << " segments" << segmentLinks.size();
720  for (const auto& segment : segmentLinks) msg(MSG::INFO) << std::endl << " " << m_printer->print(**segment);
721  if (*comblink)
722  msg(MSG::INFO) << std::endl
723  << " track " << m_printer->print(**comblink) << std::endl
724  << m_printer->printStations(**comblink);
725  msg(MSG::INFO) << endmsg;
726  }
727 
728  // add tag to IndetCandidate
729  tagMap->addEntry(&indetCandidate, tag);
730  }
731 
733  ATH_MSG_DEBUG("Resolving ambiguities: candidates " << candidates.size());
734 
735  // push tracks into a collection and run ambi-solver
737  std::map<const Trk::Track*, std::shared_ptr<Candidate>> trackCandidateLookup;
738  for (const auto& candidate : candidates) {
739  Trk::Track* track = candidate->combinedTrack.get();
740  if (track) {
741  tracks.push_back(track);
742  trackCandidateLookup[track] = candidate;
743  }
744  }
745 
746  // first handle easy cases of zero or one track
747  if (tracks.empty()) return false;
748  if (tracks.size() == 1) return true;
749 
750  // more than 1 track call ambiguity solver and select first track
751  std::unique_ptr<const TrackCollection> resolvedTracks(m_trackAmbibuityResolver->process(&tracks));
752  if (!resolvedTracks || resolvedTracks->empty()) {
753  ATH_MSG_WARNING("No track survived the ambiguity solving");
754  return false;
755  }
756  const Trk::Track* selectedTrack = resolvedTracks->front();
757 
758  // get candidate
759  auto pos = trackCandidateLookup.find(selectedTrack);
760  if (pos == trackCandidateLookup.end()) {
761  ATH_MSG_WARNING("candidate lookup failed, this should not happen");
762  return false;
763  }
764 
765  // remove all candidates that were not combined
766  std::shared_ptr<Candidate> candidate = pos->second;
767  candidates.clear();
768  candidates.push_back(candidate);
769 
770  // print results afer resolveAmbiguities
771  if (m_doSummary || msgLvl(MSG::DEBUG)) {
772  msg(MSG::INFO) << " Summary::resolveAmbiguities ";
773  msg(MSG::INFO) << std::endl
774  << " candidate: beta fit result: beta " << candidate->betaFitResult.beta << " chi2/ndof "
775  << candidate->betaFitResult.chi2PerDOF() << " layers with segments" << candidate->allLayers.size() << std::endl
776  << " track " << m_printer->print(*candidate->combinedTrack) << std::endl
777  << m_printer->printStations(*candidate->combinedTrack);
778  msg(MSG::INFO) << endmsg;
779  }
780 
781  return true;
782  }
783 
784  bool MuonStauRecoTool::combineCandidates(const EventContext& ctx, const xAOD::TrackParticle& indetTrackParticle,
786  // keep track of candidates that have a successfull fit
787  CandidateVec combinedCandidates;
788 
789  // loop over candidates and redo segments using beta estimate from candidate
790  ATH_MSG_DEBUG("Combining candidates " << candidates.size());
791  for (auto& candidate : candidates) {
792  // find best matching track
793  std::pair<std::unique_ptr<const Muon::MuonCandidate>, std::unique_ptr<Trk::Track>> result =
794  m_insideOutRecoTool->findBestCandidate(ctx, indetTrackParticle, candidate->allLayers);
795 
796  if (result.first && result.second) {
797  ATH_MSG_DEBUG(" combined track found " << std::endl
798  << m_printer->print(*result.second) << std::endl
799  << m_printer->printStations(*result.second));
800  // add segments and track pointer to the candidate
801  candidate->muonCandidate = std::move(result.first);
802  candidate->combinedTrack = std::move(result.second);
803 
804  // extract times form track
805  extractTimeMeasurementsFromTrack(ctx, *candidate);
806  combinedCandidates.push_back(candidate);
807  if (!m_recoValidationTool.empty()) m_recoValidationTool->addTimeMeasurements(indetTrackParticle, candidate->stauHits);
808  }
809  }
810 
811  // remove all candidates that were not combined
812  candidates = combinedCandidates;
813 
814  // print results afer combineCandidate
815  if (m_doSummary || msgLvl(MSG::DEBUG)) {
816  msg(MSG::INFO) << " Summary::combineCandidates ";
817  if (candidates.empty())
818  msg(MSG::INFO) << " No candidated found ";
819  else
820  msg(MSG::INFO) << " candidates " << candidates.size();
821 
822  for (const auto& candidate : candidates) {
823  msg(MSG::INFO) << std::endl
824  << " candidate: beta fit result: " << candidate->betaFitResult.beta << " chi2/ndof "
825  << candidate->betaFitResult.chi2PerDOF();
826  if (candidate->finalBetaFitResult.status != 0)
827  msg(MSG::INFO) << " MDTT beta fit result: " << candidate->finalBetaFitResult.beta << " chi2/ndof "
828  << candidate->finalBetaFitResult.chi2PerDOF();
829  msg(MSG::INFO) << " layers with segments" << candidate->allLayers.size() << std::endl
830  << " track " << m_printer->print(*candidate->combinedTrack) << std::endl
831  << m_printer->printStations(*candidate->combinedTrack);
832  }
833  msg(MSG::INFO) << endmsg;
834  }
835 
836  return !candidates.empty();
837  }
838 
840  CandidateVec& candidates) const {
841  // loop over layers and select seed maxima
842  MaximumDataVec seedMaximumDataVec;
843  LayerDataVec::const_iterator it = associatedData.layerData.begin();
844  LayerDataVec::const_iterator it_end = associatedData.layerData.end();
845  for (; it != it_end; ++it) {
846  // loop over maximumDataVec
847  for (const auto& maximumData : it->maximumDataVec) {
848  // add all maximumData that have a time measurement
849  if (!maximumData->betaSeeds.empty()) seedMaximumDataVec.push_back(maximumData);
850  }
851  }
852  ATH_MSG_DEBUG("Creating candidates from seeds " << seedMaximumDataVec.size());
853 
854  if (seedMaximumDataVec.empty()) {
855  if (m_doSummary || msgLvl(MSG::DEBUG)) msg(MSG::INFO) << " Summary::createCandidates, no seeds found " << endmsg;
856  return false;
857  }
858 
859  // sorting lambda for MaximumData seeds
860  auto SortMaximumDataVec = [](const std::shared_ptr<MaximumData>& max1, const std::shared_ptr<MaximumData>& max2) {
861  return max1->maximum->max < max2->maximum->max;
862  };
863  std::stable_sort(seedMaximumDataVec.begin(), seedMaximumDataVec.end(), SortMaximumDataVec);
864 
865  // loop over seeds and create candidates
867  std::set<const MaximumData*> usedMaximumData;
868  MaximumDataVec::iterator sit = seedMaximumDataVec.begin();
869  MaximumDataVec::iterator sit_end = seedMaximumDataVec.end();
870  for (; sit != sit_end; ++sit) {
871  // only use once
872  if (usedMaximumData.count(sit->get())) continue;
873  usedMaximumData.insert(sit->get());
874 
875  // create new candidates from the beta seeds of the maximum
876  CandidateVec newCandidates;
877  for (const auto& betaSeed : (*sit)->betaSeeds) { newCandidates.push_back(std::make_shared<Candidate>(betaSeed)); }
878  // extend the candidates
879  extendCandidates(newCandidates, usedMaximumData, associatedData.layerData.begin(), associatedData.layerData.end());
880 
881  // loop over the candidates and fit them
882  for (auto& newCandidate : newCandidates) {
883  // fit data
884  newCandidate->betaFitResult = fitter.fitWithOutlierLogic(newCandidate->hits);
885  ATH_MSG_DEBUG(" New candidate: time measurements "
886  << newCandidate->hits.size() << " status " << newCandidate->betaFitResult.status << " beta "
887  << newCandidate->betaFitResult.beta << " chi2/ndof " << newCandidate->betaFitResult.chi2PerDOF());
888  // if the fit was successfull add the candidate to the candidate vector
889  if (newCandidate->betaFitResult.status != 0) {
890  newCandidate->combinedTrack = nullptr; // no track exists at this stage
891  candidates.push_back(newCandidate);
892  }
893  }
894  }
895 
896  // print results afer createCandidate
897  if (m_doSummary || msgLvl(MSG::DEBUG)) {
898  msg(MSG::INFO) << " Summary::createCandidates ";
899  if (candidates.empty())
900  msg(MSG::INFO) << " No candidated found ";
901  else
902  msg(MSG::INFO) << " candidates " << candidates.size();
903 
904  for (const auto& candidate : candidates) {
905  msg(MSG::INFO) << std::endl
906  << " candidate: beta seed " << candidate->betaSeed.beta << " beta fit result: beta "
907  << candidate->betaFitResult.beta << " chi2/ndof " << candidate->betaFitResult.chi2PerDOF() << " layers "
908  << candidate->layerDataVec.size();
909  for (const auto& layerData : candidate->layerDataVec)
910  msg(MSG::INFO) << std::endl
911  << " " << printIntersectionToString(layerData.intersection) << " maximumDataVec "
912  << layerData.maximumDataVec.size();
913  }
914  msg(MSG::INFO) << endmsg;
915  }
916 
917  return !candidates.empty();
918  }
919 
920  void MuonStauRecoTool::extendCandidates(MuonStauRecoTool::CandidateVec& candidates, std::set<const MaximumData*>& usedMaximumData,
921  MuonStauRecoTool::LayerDataVec::const_iterator it,
922  MuonStauRecoTool::LayerDataVec::const_iterator it_end) const {
923  // get current layer and move forward the
924  const LayerData& layerData = *it;
925  ATH_MSG_DEBUG(" extendCandidates: " << printIntersectionToString(layerData.intersection) << " maxima "
926  << layerData.maximumDataVec.size());
927 
928  CandidateVec newCandidates; // store new candidates
929  for (auto& candidate : candidates) {
930  // keep track of how often we extend this candidate
931  unsigned int nextensions = 0;
932 
933  // copy content of the candidate for reference
934  LayerDataVec layerDataVec = candidate->layerDataVec;
935  Muon::TimePointBetaFitter::HitVec hits = candidate->hits;
936 
937  // loop over maximumDataVec of the layer
938  for (const auto& maximumData : layerData.maximumDataVec) {
939  // create new hit vector
940  Muon::TimePointBetaFitter::HitVec newhits; // create new hits vector and add the ones from the maximum
941  if (extractTimeHits(*maximumData, newhits, &candidate->betaSeed)) {
942  // decide which candidate to update, create a new candidate if a maximum was already selected in the layer
943  Candidate* theCandidate = nullptr;
944  if (nextensions == 0)
945  theCandidate = candidate.get();
946  else {
947  std::shared_ptr<Candidate> newCandidate = std::make_unique<Candidate>(candidate->betaSeed);
948  newCandidate->layerDataVec = layerDataVec;
949  newCandidate->hits = hits;
950  newCandidates.push_back(newCandidate);
951  theCandidate = newCandidate.get();
952  }
953 
954  // create a LayerData object to add to the selected candidate
955  LayerData newLayerData(layerData.intersection);
956  newLayerData.maximumDataVec.push_back(maximumData);
957 
958  // update the candidate
959  theCandidate->hits.insert(theCandidate->hits.end(), newhits.begin(), newhits.end());
960  theCandidate->layerDataVec.push_back(newLayerData);
961  usedMaximumData.insert(maximumData.get());
962 
963  ATH_MSG_DEBUG(" adding maximumData: candidate hits " << theCandidate->hits.size() << " LayerDataVec "
964  << theCandidate->layerDataVec.size() << " nextensions "
965  << nextensions);
966 
967  ++nextensions;
968  }
969  }
970  }
971  ATH_MSG_DEBUG(" extendCandidates done, new candidates " << newCandidates.size());
972 
973  // add the new candidates
974  candidates.insert(candidates.end(), newCandidates.begin(), newCandidates.end());
975 
976  // move to the next layer, if we haven't reached the last layer, continue recursion
977  ++it;
978  if (it != it_end) extendCandidates(candidates, usedMaximumData, it, it_end);
979  }
980 
981  bool MuonStauRecoTool::extractTimeMeasurements(const EventContext& ctx,
982  const Muon::MuonSystemExtension& muonSystemExtension,
983  AssociatedData& associatedData) const {
984  // get layer intersections
985  // find RPC time measurements and segments to seed the beta fit using t0 fitting
986  for (const Muon::MuonSystemExtension::Intersection& iSect: muonSystemExtension.layerIntersections()) {
987  // create layer data object and add maxima
988  LayerData layerData{iSect};
989  associateHoughMaxima(ctx, layerData);
990 
991  // skip layer of not maxima are associated
992  if (layerData.maximumDataVec.empty()) continue;
993 
994  associatedData.layerData.push_back(layerData);
995 
996  // loop over associated maxima
997  for (auto& maximum : layerData.maximumDataVec) {
998  // extract RPC timing
999  extractRpcTimingFromMaximum(iSect, *maximum);
1000 
1001  // find segments for intersection
1002  std::vector<std::shared_ptr<const Muon::MuonSegment>> t0fittedSegments;
1003  findSegments(iSect, *maximum, t0fittedSegments, m_muonPRDSelectionTool, m_segmentMakerT0Fit);
1004  if (t0fittedSegments.empty()) continue;
1005 
1006  // match segments to intersection, store the ones that match
1007  m_segmentMatchingTool->select(ctx, iSect, t0fittedSegments, maximum->t0fittedSegments);
1008 
1009  // get beta seeds for Maximum
1010  getBetaSeeds(*maximum);
1011  }
1012  }
1013 
1014  // print results afer extractTimeMeasurements
1015  if (m_doSummary || msgLvl(MSG::DEBUG)) {
1016  msg(MSG::INFO) << " Summary::extractTimeMeasurements ";
1017  if (associatedData.layerData.empty())
1018  msg(MSG::INFO) << " No layers associated ";
1019  else
1020  msg(MSG::INFO) << " Associated layers " << associatedData.layerData.size();
1021 
1022  for (const auto& layerData : associatedData.layerData) {
1023  unsigned int nmaxWithBeta = 0;
1024  for (const auto& maximumData : layerData.maximumDataVec) {
1025  if (!maximumData->betaSeeds.empty()) ++nmaxWithBeta;
1026  }
1027  msg(MSG::INFO) << std::endl
1028  << " layer " << printIntersectionToString(layerData.intersection) << " associated maxima "
1029  << layerData.maximumDataVec.size() << " maxima with beta seeds " << nmaxWithBeta;
1030  }
1031  msg(MSG::INFO) << endmsg;
1032  }
1033 
1034  // return false if no layers were associated
1035  return !associatedData.layerData.empty();
1036  }
1037 
1039  const BetaSeed* seed) const {
1040  unsigned int nstart = hits.size();
1041 
1042  auto addHit = [&](float distance, float time, float error, float cut) {
1043  if (seed) {
1044  float beta = calculateBeta(time + calculateTof(1, distance), distance);
1045  ATH_MSG_VERBOSE(" matching hit: distance " << distance << " time " << time << " beta" << beta << " diff "
1046  << std::abs(beta - seed->beta));
1047  if (std::abs(beta - seed->beta) > cut) return;
1048  } else {
1049  ATH_MSG_VERBOSE(" addHit: distance " << distance << " time " << time << " beta"
1050  << calculateBeta(time + calculateTof(1, distance), distance));
1051  }
1052  if (error != 0.) hits.emplace_back(distance, time, error);
1053  };
1054 
1055  // add rpc measurements
1056  for (const auto& rpc : maximumData.rpcTimeMeasurements) {
1057  float time = rpc.time;
1058  float error = rpc.error;
1059  rpcTimeCalibration(rpc.rpcClusters.front()->identify(), time, error);
1060  addHit(rpc.rpcClusters.front()->globalPosition().mag(), time, error, m_rpcBetaAssociationCut);
1061  }
1062 
1063  // add segment t0 fits
1064  // if not seeded take all segments
1065  if (!seed) {
1066  for (const auto& seg : maximumData.t0fittedSegments) {
1067  if (!seg->hasFittedT0()) continue;
1068  float time = seg->time();
1069  float error = seg->errorTime();
1070  Identifier id = m_edmHelperSvc->chamberId(*seg);
1071  segmentTimeCalibration(id, time, error);
1072  addHit(seg->globalPosition().mag(), time, error, m_segmentBetaAssociationCut);
1073  }
1074  } else {
1075  // pick the best match
1076  const Muon::MuonSegment* bestSegment = nullptr;
1077  float smallestResidual = FLT_MAX;
1078  for (const auto& seg : maximumData.t0fittedSegments) {
1079  if (!seg->hasFittedT0()) continue;
1080  float distance = seg->globalPosition().mag();
1081  float time = seg->time();
1082  float beta = calculateBeta(time + calculateTof(1, distance), distance);
1083  float residual = std::abs(beta - seed->beta);
1084 
1085  if (residual < smallestResidual) {
1086  smallestResidual = residual;
1087  bestSegment = seg.get();
1088  }
1089  }
1090  if (bestSegment) {
1091  addHit(bestSegment->globalPosition().mag(), bestSegment->time(), bestSegment->errorTime(), m_segmentBetaAssociationCut);
1092  ATH_MSG_VERBOSE(" adding best segment: " << m_printer->print(*bestSegment));
1093  }
1094  }
1095  ATH_MSG_VERBOSE(" extractTimeHits done: added " << hits.size() - nstart << " hits");
1096 
1097  return nstart != hits.size();
1098  }
1099 
1100  void MuonStauRecoTool::getBetaSeeds(MaximumData& maximumData) const {
1101  // skip maximumData if no timing information is available
1102  if (maximumData.rpcTimeMeasurements.empty() && maximumData.t0fittedSegments.empty()) return;
1103 
1104  // fitter + hits
1107  extractTimeHits(maximumData, hits);
1108 
1109  Muon::TimePointBetaFitter::FitResult result = fitter.fitWithOutlierLogic(hits);
1110  float chi2ndof = result.chi2PerDOF();
1111 
1112  ATH_MSG_DEBUG(" fitting beta for maximum: time measurements " << hits.size() << " status " << result.status << " beta "
1113  << result.beta << " chi2/ndof " << chi2ndof);
1114  if (result.status != 0) maximumData.betaSeeds.emplace_back(result.beta, 1.);
1115  }
1116 
1118  std::vector<std::shared_ptr<const Muon::MuonSegment>>& segments,
1119  const ToolHandle<Muon::IMuonPRDSelectionTool>& muonPRDSelectionTool,
1120  const ToolHandle<Muon::IMuonSegmentMaker>& segmentMaker) const {
1121  const MuonHough::MuonLayerHough::Maximum& maximum = *maximumData.maximum;
1122  const std::vector<std::shared_ptr<const Muon::MuonClusterOnTrack>>& phiClusterOnTracks = maximumData.phiClusterOnTracks;
1123 
1124  // lambda to handle calibration and selection of MDTs
1125  auto handleMdt = [intersection, muonPRDSelectionTool](const Muon::MdtPrepData& prd,
1126  std::vector<const Muon::MdtDriftCircleOnTrack*>& mdts) {
1127  const Muon::MdtDriftCircleOnTrack* mdt = muonPRDSelectionTool->calibrateAndSelect(intersection, prd);
1128  if (mdt) mdts.push_back(mdt);
1129  };
1130 
1131  // lambda to handle calibration and selection of clusters
1132  auto handleCluster = [intersection, muonPRDSelectionTool](const Muon::MuonCluster& prd,
1133  std::vector<const Muon::MuonClusterOnTrack*>& clusters) {
1134  const Muon::MuonClusterOnTrack* cluster = muonPRDSelectionTool->calibrateAndSelect(intersection, prd);
1135  if (cluster) clusters.push_back(cluster);
1136  };
1137 
1138  // loop over hits in maximum and add them to the hit list
1139  std::vector<const Muon::MdtDriftCircleOnTrack*> mdts;
1140  std::vector<const Muon::MuonClusterOnTrack*> clusters;
1141 
1142  // insert phi hits, clone them
1143  clusters.reserve(phiClusterOnTracks.size());
1144 
1145  for (const auto& phiClusterOnTrack : phiClusterOnTracks) { clusters.push_back(phiClusterOnTrack->clone()); }
1146 
1147  ATH_MSG_DEBUG("About to loop over Hough::Hits");
1148 
1149  MuonHough::HitVec::const_iterator hit = maximum.hits.begin();
1150  MuonHough::HitVec::const_iterator hit_end = maximum.hits.end();
1151  for (; hit != hit_end; ++hit) {
1152  ATH_MSG_DEBUG("hit x,y_min,y_max,w = " << (*hit)->x << "," << (*hit)->ymin << "," << (*hit)->ymax << "," << (*hit)->w);
1153  // treat the case that the hit is a composite TGC hit
1154  if ((*hit)->tgc) {
1155  for (const auto& prd : (*hit)->tgc->etaCluster) handleCluster(*prd, clusters);
1156  } else if ((*hit)->prd) {
1157  Identifier id = (*hit)->prd->identify();
1158  if (m_idHelperSvc->isMdt(id))
1159  handleMdt(static_cast<const Muon::MdtPrepData&>(*(*hit)->prd), mdts);
1160  else
1161  handleCluster(static_cast<const Muon::MuonCluster&>(*(*hit)->prd), clusters);
1162  }
1163  }
1164 
1165  ATH_MSG_DEBUG("About to loop over calibrated hits");
1166 
1167  ATH_MSG_DEBUG("Dumping MDTs");
1168  for (const auto* it : mdts) ATH_MSG_DEBUG(*it);
1169 
1170  ATH_MSG_DEBUG("Dumping clusters");
1171  for (const auto* it : clusters) ATH_MSG_DEBUG(*it);
1172 
1173  // require at least 2 MDT hits
1174  if (mdts.size() > 2) {
1175  // run segment finder
1176  auto segColl = std::make_unique<Trk::SegmentCollection>(SG::VIEW_ELEMENTS);
1177  segmentMaker->find(intersection.trackParameters->position(), intersection.trackParameters->momentum(), mdts, clusters,
1178  !clusters.empty(), segColl.get(), intersection.trackParameters->momentum().mag());
1179  if (segColl) {
1180  Trk::SegmentCollection::iterator sit = segColl->begin();
1181  Trk::SegmentCollection::iterator sit_end = segColl->end();
1182  for (; sit != sit_end; ++sit) {
1183  Trk::Segment* tseg = *sit;
1184  Muon::MuonSegment* mseg = dynamic_cast<Muon::MuonSegment*>(tseg);
1185  ATH_MSG_DEBUG("Segment: " << m_printer->print(*mseg));
1186  segments.push_back(std::shared_ptr<const Muon::MuonSegment>(mseg));
1187  }
1188  }
1189  }
1190  // clean-up memory
1191  for (const auto* hit : mdts) delete hit;
1192  for (const auto* hit : clusters) delete hit;
1193  }
1194 
1196  MaximumData& maximumData) const {
1197  // extract trigger hits per chamber
1198  const MuonHough::MuonLayerHough::Maximum& maximum = *maximumData.maximum;
1199  std::map<Identifier, std::vector<const Muon::RpcPrepData*>> rpcPrdsPerChamber;
1200 
1201  // lambda to add the PRD
1202  auto addRpc = [&rpcPrdsPerChamber, this](const Trk::PrepRawData* prd) {
1203  const Muon::RpcPrepData* rpcPrd = dynamic_cast<const Muon::RpcPrepData*>(prd);
1204  if (rpcPrd) {
1205  Identifier chamberId = m_idHelperSvc->chamberId(rpcPrd->identify());
1206  rpcPrdsPerChamber[chamberId].push_back(rpcPrd);
1207  }
1208  };
1209 
1210  // extract eta hits
1211  MuonHough::HitVec::const_iterator hit = maximum.hits.begin();
1212  MuonHough::HitVec::const_iterator hit_end = maximum.hits.end();
1213  for (; hit != hit_end; ++hit) {
1214  if ((*hit)->tgc || !(*hit)->prd || !m_idHelperSvc->isRpc((*hit)->prd->identify())) continue;
1215  addRpc((*hit)->prd);
1216  }
1217 
1218  // extract phi hits
1219  for (const auto& rot : maximumData.phiClusterOnTracks) { addRpc(rot->prepRawData()); }
1220 
1221  // exit if no hits are found
1222  if (rpcPrdsPerChamber.empty()) return;
1223 
1224  std::map<Identifier, std::vector<const Muon::RpcPrepData*>>::iterator chit = rpcPrdsPerChamber.begin();
1225  std::map<Identifier, std::vector<const Muon::RpcPrepData*>>::iterator chit_end = rpcPrdsPerChamber.end();
1226  for (; chit != chit_end; ++chit) {
1227  // cluster hits
1228  Muon::RpcHitClusteringObj clustering(&m_idHelperSvc->rpcIdHelper());
1229  if (!clustering.cluster(chit->second)) {
1230  ATH_MSG_WARNING("Clustering failed");
1231  return;
1232  }
1233 
1234  ATH_MSG_DEBUG(" " << m_idHelperSvc->toStringChamber(chit->first) << " clustered RPCs: " << chit->second.size()
1235  << " eta clusters " << clustering.clustersEta.size() << " phi clusters " << clustering.clustersPhi.size());
1238  }
1239  }
1240 
1242  const std::vector<Muon::RpcClusterObj>& clusterObjects,
1243  MuonStauRecoTool::RpcTimeMeasurementVec& rpcTimeMeasurements) const {
1244  // loop over the clusters
1245  for (const auto& cluster : clusterObjects) {
1246  if (cluster.hitList.empty() || !cluster.hitList.front()) {
1247  ATH_MSG_WARNING("Cluster without hits: " << cluster.hitList.size());
1248  continue;
1249  }
1250  ATH_MSG_DEBUG(" new cluster: " << m_idHelperSvc->toString(cluster.hitList.front()->identify()) << " size "
1251  << cluster.hitList.size());
1252 
1253  // create the ROTs
1254  std::vector<const Muon::MuonClusterOnTrack*> clusters;
1255  for (const auto* rpc : cluster.hitList) {
1256  const Muon::MuonClusterOnTrack* rot(m_muonPRDSelectionTool->calibrateAndSelect(intersection, *rpc));
1257  if (rot) {
1258  clusters.push_back(rot);
1259  ATH_MSG_DEBUG(" strip " << m_idHelperSvc->toString(rot->identify()) << " time "
1260  << static_cast<const Muon::RpcClusterOnTrack*>(rot)->time());
1261  }
1262  }
1263  // get the timing result for the cluster
1265  if (result.valid) {
1266  // add the result
1267  RpcTimeMeasurement rpcTimeMeasurement;
1268  rpcTimeMeasurement.time = result.time;
1269  rpcTimeMeasurement.error = result.error;
1270  for (const auto* cl : clusters) {
1271  const Muon::RpcClusterOnTrack* rcl = dynamic_cast<const Muon::RpcClusterOnTrack*>(cl);
1272  if (rcl) rpcTimeMeasurement.rpcClusters.push_back(std::shared_ptr<const Muon::RpcClusterOnTrack>(rcl));
1273  }
1274  rpcTimeMeasurements.push_back(rpcTimeMeasurement);
1275  } else {
1276  // if no time measurement was created we need to clean up the memory
1277  for (const auto* cl : clusters) delete cl;
1278  }
1279  }
1280  }
1281 
1282  void MuonStauRecoTool::associateHoughMaxima(const EventContext& ctx,
1283  MuonStauRecoTool::LayerData& layerData) const {
1284 
1285  if (m_houghDataPerSectorVecKey.empty()) return;
1286  // get intersection and layer identifiers
1288  int sector = intersection.layerSurface.sector;
1289  Muon::MuonStationIndex::DetectorRegionIndex regionIndex = intersection.layerSurface.regionIndex;
1290  Muon::MuonStationIndex::LayerIndex layerIndex = intersection.layerSurface.layerIndex;
1291 
1292  // get hough data
1294  if (!houghDataPerSectorVec.isValid()) {
1295  ATH_MSG_ERROR("Hough data per sector vector not found");
1296  return;
1297  }
1298 
1299  // sanity check
1300  if (static_cast<int>(houghDataPerSectorVec->vec.size()) <= sector - 1) {
1301  ATH_MSG_WARNING(" sector " << sector
1302  << " larger than the available sectors in the Hough tool: " << houghDataPerSectorVec->vec.size());
1303  return;
1304  }
1305 
1306  // get hough maxima in the layer
1307  unsigned int sectorLayerHash = Muon::MuonStationIndex::sectorLayerHash(regionIndex, layerIndex);
1308  const Muon::MuonLayerHoughTool::HoughDataPerSector& houghDataPerSector = houghDataPerSectorVec->vec[sector - 1];
1309 
1310  // sanity check
1311  if (houghDataPerSector.maxVec.size() <= sectorLayerHash) {
1312  ATH_MSG_WARNING(" houghDataPerSector.maxVec.size() smaller than hash " << houghDataPerSector.maxVec.size() << " hash "
1313  << sectorLayerHash);
1314  return;
1315  }
1316  const Muon::MuonLayerHoughTool::MaximumVec& maxVec = houghDataPerSector.maxVec[sectorLayerHash];
1317  if (maxVec.empty()) return;
1318 
1319  // get local coordinates in the layer frame
1320  bool barrelLike = intersection.layerSurface.regionIndex == Muon::MuonStationIndex::Barrel;
1321 
1322  // in the endcaps take the r in the sector frame from the local position of the extrapolation
1323  float phi = intersection.trackParameters->position().phi();
1324  float r = barrelLike ? m_muonSectorMapping.transformRToSector(intersection.trackParameters->position().perp(), phi,
1325  intersection.layerSurface.sector, true)
1326  : intersection.trackParameters->parameters()[Trk::locX];
1327 
1328  float z = intersection.trackParameters->position().z();
1329  float errx = intersection.trackParameters->covariance() ?
1330  Amg::error(*intersection.trackParameters->covariance(), Trk::locX) : 0.;
1331  float x = barrelLike ? z : r;
1332  float y = barrelLike ? r : z;
1333  float theta = std::atan2(y, x);
1334 
1335  // get phi hits
1336  const Muon::MuonLayerHoughTool::PhiMaximumVec& phiMaxVec = houghDataPerSector.phiMaxVec[regionIndex];
1337  ATH_MSG_DEBUG(" Got Phi Hough maxima " << phiMaxVec.size() << " phi " << phi);
1338 
1339  // lambda to handle calibration and selection of clusters
1340  auto handleCluster = [intersection, this](const Muon::MuonCluster& prd,
1341  std::vector<std::shared_ptr<const Muon::MuonClusterOnTrack>>& clusters) {
1342  std::unique_ptr<const Muon::MuonClusterOnTrack> cluster{m_muonPRDSelectionTool->calibrateAndSelect(intersection, prd)};
1343  if (cluster) clusters.push_back(std::move(cluster));
1344  };
1345 
1346  // loop over maxima and associate phi hits with the extrapolation, should optimize this but calculating the residual with the phi
1347  // maximum
1348  std::vector<std::shared_ptr<const Muon::MuonClusterOnTrack>> phiClusterOnTracks;
1349  Muon::MuonLayerHoughTool::PhiMaximumVec::const_iterator pit = phiMaxVec.begin();
1350  Muon::MuonLayerHoughTool::PhiMaximumVec::const_iterator pit_end = phiMaxVec.end();
1351  for (; pit != pit_end; ++pit) {
1352  const MuonHough::MuonPhiLayerHough::Maximum& maximum = **pit;
1353  for (const std::shared_ptr<MuonHough::PhiHit>& hit : maximum.hits) {
1354  // treat the case that the hit is a composite TGC hit
1355  if (hit->tgc) {
1356  Identifier id = hit->tgc->phiCluster.front()->identify();
1357  if (m_idHelperSvc->layerIndex(id) != intersection.layerSurface.layerIndex) continue;
1358  for (const Muon::MuonCluster* prd : hit->tgc->phiCluster) handleCluster(*prd, phiClusterOnTracks);
1359  } else if (hit->prd && !(hit->prd->type(Trk::PrepRawDataType::sTgcPrepData) ||
1361  const Identifier id = hit->prd->identify();
1362  if (m_idHelperSvc->layerIndex(id) != intersection.layerSurface.layerIndex) continue;
1363  handleCluster(static_cast<const Muon::MuonCluster&>(*hit->prd), phiClusterOnTracks);
1364  }
1365  }
1366  }
1367 
1368  ATH_MSG_DEBUG(" associateHoughMaxima: " << printIntersectionToString(intersection) << " maxima " << maxVec.size() << " x,y=(" << x
1369  << "," << y << ") errorx " << errx << " "
1370  << " angle " << theta);
1371 
1372  // loop over maxima and associate them to the extrapolation
1373  for (const auto& mit : maxVec) {
1374  const MuonHough::MuonLayerHough::Maximum& maximum = *mit;
1375  if (std::find_if(maximum.hits.begin(),maximum.hits.end(),
1376  [](const std::shared_ptr<MuonHough::Hit>& hit){
1377  return hit->prd && (hit->prd->type(Trk::PrepRawDataType::sTgcPrepData) ||
1378  hit->prd->type(Trk::PrepRawDataType::MMPrepData));
1379  }) != maximum.hits.end()) continue;
1380  float residual = maximum.pos - x;
1381  float residualTheta = maximum.theta - theta;
1382  float refPos = (maximum.hough != nullptr) ? maximum.hough->m_descriptor.referencePosition : 0;
1383  float maxwidth = (maximum.binposmax - maximum.binposmin);
1384 
1385  if (maximum.hough){
1386  maxwidth *= maximum.hough->m_binsize;
1387  }
1388  const float pullUncert = std::sqrt(errx * errx + maxwidth * maxwidth / 12.);
1389  float pull = residual / (pullUncert > std::numeric_limits<float>::epsilon() ? pullUncert : 1.) ;
1390 
1391  ATH_MSG_DEBUG(" Hough maximum " << maximum.max << " position (" << refPos << "," << maximum.pos << ") residual " << residual
1392  << " pull " << pull << " angle " << maximum.theta << " residual " << residualTheta);
1393 
1394  // fill validation content
1395 
1396  // select maximum and add it to LayerData
1397  if (std::abs(pull) > 5) continue;
1398  layerData.maximumDataVec.emplace_back(std::make_shared<MaximumData>(intersection, &maximum, phiClusterOnTracks));
1399  }
1400  }
1401  void MuonStauRecoTool::mdtTimeCalibration(const Identifier& /*id*/, float& time, float& error) const {
1402  time -= 1.5;
1403  error *= 1.;
1404  }
1405  void MuonStauRecoTool::rpcTimeCalibration(const Identifier& /*id*/, float& time, float& error) const {
1406  time -= 0;
1407  error *= 0.5;
1408  }
1409  void MuonStauRecoTool::segmentTimeCalibration(const Identifier& /*id*/, float& time, float& error) const {
1410  time -= 1.5;
1411  error *= 1.;
1412  }
1414  float MuonStauRecoTool::calculateTof(const float beta, const float dist) const {
1415  return std::abs(beta) > 0 ? dist * inverseSpeedOfLight / beta : 1.e12;
1416  }
1419  float MuonStauRecoTool::calculateBeta(const float time, const float dist) const {
1420  return time != 0. ? dist * inverseSpeedOfLight / time : 20.;
1421  }
1423  const MuonStauRecoTool::CandidateVec& candidates, int stage) const {
1425  ATH_MSG_WARNING("You are calling the non thread-safe MuonRecoValidationTool with multiple threads, will most likely crash");
1426  }
1427  if (m_recoValidationTool.empty()) return;
1428 
1429  ATH_MSG_DEBUG("add candidates to ntuple, stage " << stage);
1430  for (const auto& candidate : candidates) {
1431  int ntimes = 0;
1432  float beta = -1.;
1433  float chi2ndof = -1.;
1434  if (candidate->finalBetaFitResult.status != 0) {
1435  ntimes = candidate->stauHits.size();
1436  beta = candidate->finalBetaFitResult.beta;
1437  chi2ndof = candidate->finalBetaFitResult.chi2PerDOF();
1438  } else if (candidate->betaFitResult.status != 0) {
1439  ntimes = candidate->hits.size();
1440  beta = candidate->betaFitResult.beta;
1441  chi2ndof = candidate->betaFitResult.chi2PerDOF();
1442  } else {
1443  ntimes = 1;
1444  beta = candidate->betaSeed.beta;
1445  chi2ndof = 0;
1446  }
1447  if (candidate->combinedTrack) ATH_MSG_DEBUG("candidate has combined track");
1448  m_recoValidationTool->addMuonCandidate(indetTrackParticle, candidate->muonCandidate.get(), candidate->combinedTrack.get(),
1449  ntimes, beta, chi2ndof, stage);
1450  }
1451  }
1452 
1453 } // namespace MuonCombined
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Muon::RpcHitClusteringObj::clustersPhi
std::vector< RpcClusterObj > clustersPhi
Definition: RpcHitClustering.h:117
Muon::MuonStationIndex::chName
static const std::string & chName(ChIndex index)
convert ChIndex into a string
Definition: MuonStationIndex.cxx:157
Trk::SpaceTimePointBase::errorTime
float errorTime() const
access to the error on the measured time
Definition: SpaceTimePointBase.h:50
xAOD::TrackParticle_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: TrackParticle_v1.cxx:73
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
MuonCombined::MuonStauRecoTool::m_muonPRDSelectionToolStau
ToolHandle< Muon::IMuonPRDSelectionTool > m_muonPRDSelectionToolStau
Definition: MuonStauRecoTool.h:247
beamspotman.r
def r
Definition: beamspotman.py:676
LArSamples::FitterData::fitter
const ShapeFitter * fitter
Definition: ShapeFitter.cxx:23
Muon::MuonDriftCircleErrorStrategy
Definition: MuonDriftCircleErrorStrategy.h:15
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
MuonCombined::MuonStauRecoTool::Candidate
Definition: MuonStauRecoTool.h:100
MuonDriftCircleErrorStrategy.h
MuonCombined::InDetCandidate::getExtension
const Muon::MuonSystemExtension * getExtension() const
Definition: InDetCandidate.cxx:46
MuonCombined::MuonStauRecoTool::extractTimeHits
bool extractTimeHits(const MaximumData &maximumData, Muon::TimePointBetaFitter::HitVec &hits, const BetaSeed *seed=0) const
extract hits for the beta fit, returns true if hits were added
Definition: MuonStauRecoTool.cxx:1038
Muon::TimePointBetaFitter::Hit
simple struct holding the input to the fit
Definition: TimePointBetaFitter.h:18
MuonCombined::MuonStauRecoTool::extractTimeMeasurementsFromTrack
void extractTimeMeasurementsFromTrack(const EventContext &ctx, Candidate &candidate) const
extract time measurements from the track associated with the candidate
Definition: MuonStauRecoTool.cxx:261
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
MuonCombined::MuonStauRecoTool::Candidate::layerDataVec
LayerDataVec layerDataVec
Definition: MuonStauRecoTool.h:107
Trk::Intersection
Definition: Intersection.h:24
TrkDriftCircleMath::DriftCircle::index
unsigned int index() const
Definition: DriftCircle.h:99
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
TrRelation.h
get_generator_info.result
result
Definition: get_generator_info.py:21
TrkDriftCircleMath::DCOnTrackVec
std::vector< DCOnTrack > DCOnTrackVec
Definition: DCOnTrack.h:59
MuonCombined::MuonStauRecoTool::MaximumDataVec
std::vector< std::shared_ptr< MaximumData > > MaximumDataVec
Definition: MuonStauRecoTool.h:87
TileDCSDataPlotter.max1
max1
Definition: TileDCSDataPlotter.py:884
python.FPGATrackSimAnalysisConfig.stage
stage
Definition: FPGATrackSimAnalysisConfig.py:475
MuonCombined::MuonStauRecoTool::m_printer
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer
Definition: MuonStauRecoTool.h:235
MuGirlNS::StauExtras::betaAll
double betaAll
Definition: CandidateSummary.h:71
MuonCombined::MuonStauRecoTool::m_calibDbKey
SG::ReadCondHandleKey< MuonCalib::MdtCalibDataContainer > m_calibDbKey
Definition: MuonStauRecoTool.h:255
TrkDriftCircleMath::SegmentFinder::setChi2DropCut
void setChi2DropCut(double chi2)
Definition: SegmentFinder.cxx:79
Trk::PrepRawDataType::MMPrepData
@ MMPrepData
MuonCombined::MuonStauRecoTool::addCandidatesToNtuple
void addCandidatesToNtuple(const xAOD::TrackParticle &indetTrackParticle, const CandidateVec &candidates, int stage) const
helper function to add Candidate to ntuple
Definition: MuonStauRecoTool.cxx:1422
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
Muon::MdtDriftCircleOnTrack::prepRawData
virtual const MdtPrepData * prepRawData() const override final
Returns the PrepRawData used to create this corrected measurement.
Definition: MdtDriftCircleOnTrack.h:257
Trk::locX
@ locX
Definition: ParamDefs.h:37
MuGirlNS::StauHitTechnology
StauHitTechnology
Definition: CandidateSummary.h:26
TrkDriftCircleMath::MdtId
Definition: MdtId.h:14
Muon::HoughDataPerSec::phiMaxVec
RegionPhiMaximumVec phiMaxVec
Definition: HoughDataPerSec.h:52
MuonCombined::MuonStauRecoTool::m_rpcBetaAssociationCut
Gaudi::Property< double > m_rpcBetaAssociationCut
Definition: MuonStauRecoTool.h:269
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Muon::MuonSectorMapping::transformRToSector
double transformRToSector(double r, double phi, int sector, bool toSector=true) const
expresses a radial position from and to the sector coordinate frame, the phi position should always b...
Definition: MuonSectorMapping.h:136
SegmentFinder.h
MuonHough::MuonLayerHough::m_binsize
float m_binsize
Definition: MuonLayerHough.h:168
MuonCombined::MuonStauRecoTool::m_ptThreshold
Gaudi::Property< double > m_ptThreshold
Definition: MuonStauRecoTool.h:266
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
ClusterSeg::residual
@ residual
Definition: ClusterNtuple.h:20
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
MuonCombined::MuonStauRecoTool::m_doTruth
Gaudi::Property< bool > m_doTruth
Definition: MuonStauRecoTool.h:262
MuonCombined::InDetCandidateToTagMap
Definition: InDetCandidateToTagMap.h:15
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
drawFromPickle.candidates
candidates
Definition: drawFromPickle.py:271
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:77
MuonCombined::MuonStauRecoTool::m_recoValidationTool
ToolHandle< Muon::IMuonRecoValidationTool > m_recoValidationTool
Definition: MuonStauRecoTool.h:242
MuonCombined::MuonStauRecoTool::m_updator
ToolHandle< Trk::IUpdator > m_updator
Definition: MuonStauRecoTool.h:254
MuonCombined::MuonStauRecoTool::CandidateVec
std::vector< std::shared_ptr< Candidate > > CandidateVec
Definition: MuonStauRecoTool.h:120
MuonCombined::MuonStauRecoTool::m_hitTimingTool
ToolHandle< Muon::IMuonHitTimingTool > m_hitTimingTool
Definition: MuonStauRecoTool.h:245
MuonCombined::MuonStauRecoTool::MaximumData::phiClusterOnTracks
std::vector< std::shared_ptr< const Muon::MuonClusterOnTrack > > phiClusterOnTracks
Definition: MuonStauRecoTool.h:81
MuonHough::MuonLayerHough::m_descriptor
RegionDescriptor m_descriptor
Definition: MuonLayerHough.h:179
TruthParticleContainer.h
EventPrimitivesHelpers.h
MuonCombined::MuonStauRecoTool::RpcTimeMeasurement
Definition: MuonStauRecoTool.h:67
TrkDriftCircleMath::HitSelection
std::vector< bool > HitSelection
Definition: HitSelection.h:9
MuonCombined::MuonStauRecoTool::initialize
virtual StatusCode initialize() override
Definition: MuonStauRecoTool.cxx:48
Muon::TimePointBetaFitter
Definition: TimePointBetaFitter.h:15
MuonGM::MuonReadoutElement::GlobalToAmdbLRSTransform
virtual Amg::Transform3D GlobalToAmdbLRSTransform() const
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonReadoutElement.cxx:153
TrkDriftCircleMath::SegmentFinder::setDeltaCut
void setDeltaCut(double cut)
Definition: SegmentFinder.cxx:81
TransformToLine.h
Muon::MuonStationIndex::LayerIndex
LayerIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:38
MuonCombined::MuonStauRecoTool::TruthInfo::toString
std::string toString() const
Definition: MuonStauRecoTool.h:127
Muon::MuonStationIndex::sectorLayerHash
static unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
Definition: MuonStationIndex.cxx:226
MuonCombined::MuonStauRecoTool::m_doSummary
Gaudi::Property< bool > m_doSummary
Definition: MuonStauRecoTool.h:260
TrkDriftCircleMath::DriftCircle::position
const LocVec2D & position() const
access to local position
Definition: DriftCircle.h:74
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TrkDriftCircleMath::DCSLFitter
Definition: Tracking/TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/DCSLFitter.h:17
CompetingMuonClustersOnTrack.h
TRTCalib_Extractor.tres
tres
Definition: TRTCalib_Extractor.py:32
TrkDriftCircleMath::DriftCircle::dr
double dr() const
access to error drift radius
Definition: DriftCircle.h:89
TrkDriftCircleMath::SegmentFinder::setMaxDropDepth
void setMaxDropDepth(int max)
Definition: SegmentFinder.cxx:46
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
MuonCombined::InDetCandidate
Definition: InDetCandidate.h:18
Segment.h
Muon::MuonDriftCircleErrorStrategy::Moore
@ Moore
Definition: MuonDriftCircleErrorStrategy.h:17
MuonCombined::MuonStauRecoTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonStauRecoTool.h:231
Muon::TimePointBetaFitter::FitResult::beta
float beta
status flag (0 = failed, 1 = ok)
Definition: TimePointBetaFitter.h:43
Trk::PrepRawData::type
virtual bool type(PrepRawDataType type) const =0
Interface method checking the type.
Muon::TimePointBetaFitter::FitResult::chi2PerDOF
float chi2PerDOF() const
chi2/ndof, return 0 if ndof == 0 or status == 0
Definition: TimePointBetaFitter.h:39
DCSLFitter.h
Muon::RpcClusterOnTrack
Class to represent calibrated clusters formed from RPC strips.
Definition: RpcClusterOnTrack.h:35
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
MuonCombined::MuonStauRecoTool::createRpcTimeMeasurementsFromClusters
void createRpcTimeMeasurementsFromClusters(const Muon::MuonSystemExtension::Intersection &intersection, const std::vector< Muon::RpcClusterObj > &clusterObjects, RpcTimeMeasurementVec &rpcTimeMeasurements) const
create Rpc hit timing for a set of clusters
Definition: MuonStauRecoTool.cxx:1241
Trk::locR
@ locR
Definition: ParamDefs.h:44
TrkDriftCircleMath::DriftCircle
This class represents a drift time measurement.
Definition: DriftCircle.h:22
MuonCombined::MuonStauRecoTool::Candidate::betaSeed
BetaSeed betaSeed
Definition: MuonStauRecoTool.h:104
MuonHough::RegionDescriptor::referencePosition
float referencePosition
Definition: MuonLayerHough.h:43
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Muon::CompetingMuonClustersOnTrack
Definition: CompetingMuonClustersOnTrack.h:54
MdtDriftCircleOnTrack.h
TrkDriftCircleMath::DriftCircle::r
double r() const
access to drift radius
Definition: DriftCircle.h:86
x
#define x
MuonCombined::MuonStauRecoTool::RpcTimeMeasurementVec
std::vector< RpcTimeMeasurement > RpcTimeMeasurementVec
Definition: MuonStauRecoTool.h:72
intersection
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
Definition: compareFlatTrees.cxx:25
Trk::combinedTrack
void combinedTrack(long int ICH, double *pv0, double *covi, double BMAG, double *par, double *covo)
Definition: XYZtrp.cxx:113
TrkDriftCircleMath::TransformToLine
Definition: TransformToLine.h:15
MuonCombined::MuonStauRecoTool::resolveAmbiguities
bool resolveAmbiguities(CandidateVec &candidates) const
resolve ambiguities between the candidates
Definition: MuonStauRecoTool.cxx:732
MuGirlNS::MDTT_STAU_HIT
@ MDTT_STAU_HIT
Definition: CandidateSummary.h:26
MuonCombined::MuonStauRecoTool::extractRpcTimingFromMaximum
void extractRpcTimingFromMaximum(const Muon::MuonSystemExtension::Intersection &intersection, MaximumData &maximumData) const
extract RPC hit timing
Definition: MuonStauRecoTool.cxx:1195
Muon::MdtDriftCircleOnTrack::driftTime
double driftTime() const
Returns the value of the drift time used to obtain the drift radius.
Definition: MdtDriftCircleOnTrack.h:280
MuonCombined::MuonStauRecoTool::extendCandidates
void extendCandidates(CandidateVec &candidates, std::set< const MaximumData * > &usedMaximumData, LayerDataVec::const_iterator it, LayerDataVec::const_iterator it_end) const
extend a CandidateVec with the next LayerData
Definition: MuonStauRecoTool.cxx:920
MuonCombined::MuonStauRecoTool::RpcTimeMeasurement::rpcClusters
std::vector< std::shared_ptr< const Muon::RpcClusterOnTrack > > rpcClusters
Definition: MuonStauRecoTool.h:68
TrkDriftCircleMath::DCOnTrack::errorTrack
void errorTrack(double error)
set track error
Definition: DCOnTrack.h:41
TrkDriftCircleMath::Segment
Definition: Tracking/TrkUtilityPackages/TrkDriftCircleMath/TrkDriftCircleMath/Segment.h:18
TrkDriftCircleMath::LocVec2D
Implementation of 2 dimensional vector class.
Definition: LocVec2D.h:16
PlotCalibFromCool.ie
ie
Definition: PlotCalibFromCool.py:420
Trk::LocalDirection::angleYZ
double angleYZ() const
access method for angle of local YZ projection
Definition: LocalDirection.h:106
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
MuonCombined::MuGirlLowBetaTag
TagBase implementation for a combined fit.
Definition: MuGirlLowBetaTag.h:27
Muon::TimePointBetaFitter::FitResult
simple struct holding the fit result
Definition: TimePointBetaFitter.h:33
TrkDriftCircleMath::Line
Definition: Line.h:17
MuonCombined::MuonStauRecoTool::m_trackAmbibuityResolver
ToolHandle< Trk::ITrackAmbiguityProcessorTool > m_trackAmbibuityResolver
Definition: MuonStauRecoTool.h:243
MuonCombined::InDetCandidateToTagMap::addEntry
void addEntry(const InDetCandidate *idcand, TagBase *tag)
Definition: InDetCandidateToTagMap.cxx:8
MuonCombined::MuonStauRecoTool::segmentTimeCalibration
void segmentTimeCalibration(const Identifier &id, float &time, float &error) const
Definition: MuonStauRecoTool.cxx:1409
MuonHough::MuonLayerHough::Maximum::binposmin
int binposmin
Definition: MuonLayerHough.h:68
LB_AnalMapSplitter.rline
rline
Definition: LB_AnalMapSplitter.py:60
MuonHough::MuonLayerHough::Maximum
struct representing the maximum in the hough space
Definition: MuonLayerHough.h:56
RpcClusterOnTrack.h
Muon::MuonLayerHoughTool::MaximumVec
HoughDataPerSec::MaximumVec MaximumVec
Definition: MuonLayerHoughTool.h:63
Muon::MuonStationIndex::regionName
static const std::string & regionName(DetectorRegionIndex index)
convert DetectorRegionIndex into a string
Definition: MuonStationIndex.cxx:176
MuonHough::MuonLayerHough::Maximum::theta
float theta
Definition: MuonLayerHough.h:61
MuGirlNS::RPCETA_STAU_HIT
@ RPCETA_STAU_HIT
Definition: CandidateSummary.h:26
MuonCombined::MuonStauRecoTool::m_muonSectorMapping
Muon::MuonSectorMapping m_muonSectorMapping
Definition: MuonStauRecoTool.h:258
MuGirlNS::RPC_STAU_HIT
@ RPC_STAU_HIT
Definition: CandidateSummary.h:26
Muon::MuonDriftCircleErrorStrategyInput
std::bitset< 23 > MuonDriftCircleErrorStrategyInput
Definition: MuonDriftCircleErrorStrategy.h:13
MuonCombined::MuonStauRecoTool::rpcTimeCalibration
void rpcTimeCalibration(const Identifier &id, float &time, float &error) const
Definition: MuonStauRecoTool.cxx:1405
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TRT::Hit::driftTime
@ driftTime
Definition: HitInfo.h:43
MuonHough::MuonLayerHough::Maximum::max
float max
Definition: MuonLayerHough.h:59
MuonHough::PhiHit::tgc
const Muon::TgcClusterObj3D * tgc
Definition: MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLayerHough/MuonLayerHough/Hit.h:123
Trk::locZ
@ locZ
local cylindrical
Definition: ParamDefs.h:42
MuonCombined::MuonStauRecoTool::LayerDataVec
std::vector< LayerData > LayerDataVec
Definition: MuonStauRecoTool.h:93
MuonCombined::MuonStauRecoTool::m_segmentMatchingTool
ToolHandle< Muon::IMuonLayerSegmentMatchingTool > m_segmentMatchingTool
Definition: MuonStauRecoTool.h:239
MuonGM::MdtReadoutElement
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:51
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
MuGirlNS::StauExtras::hits
StauHits hits
Definition: CandidateSummary.h:88
Line.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
MuonCombined::MuonStauRecoTool::TruthInfo::pdgId
int pdgId
Definition: MuonStauRecoTool.h:124
z
#define z
Muon::RpcPrepData
Class to represent RPC measurements.
Definition: RpcPrepData.h:35
Muon::RpcHitClusteringObj::cluster
bool cluster(const std::vector< const RpcPrepData * > &col)
Definition: RpcHitClustering.cxx:9
MuonCombined::MuonStauRecoTool::m_mdttBetaAssociationCut
Gaudi::Property< double > m_mdttBetaAssociationCut
Definition: MuonStauRecoTool.h:268
MuonCombined::MuonStauRecoTool::m_mdtCreator
ToolHandle< Muon::IMdtDriftCircleOnTrackCreator > m_mdtCreator
Definition: MuonStauRecoTool.h:248
RCU::Shell
Definition: ShellExec.cxx:28
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonHough::MuonPhiLayerHough::Maximum
Definition: MuonPhiLayerHough.h:23
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
urldecode::states
states
Definition: urldecode.h:39
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Muon::MuonStationIndex::Barrel
@ Barrel
Definition: MuonStationIndex.h:49
Muon::TgcClusterObj3D::phiCluster
HitList phiCluster
Definition: TgcHitClustering.h:27
Muon::MuonSystemExtension
Tracking class to hold the extrapolation from a particle from the calo entry to the end of muon syste...
Definition: MuonSystemExtension.h:18
MuonCombined::MuonStauRecoTool::Candidate::allLayers
std::vector< Muon::MuonLayerRecoData > allLayers
Definition: MuonStauRecoTool.h:112
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonHough::MuonPhiLayerHough::Maximum::hits
PhiHitVec hits
Definition: MuonPhiLayerHough.h:35
Trk::Segment
Definition: Tracking/TrkEvent/TrkSegment/TrkSegment/Segment.h:56
Muon::RpcHitClusteringObj
Definition: RpcHitClustering.h:76
MuonCombined::MuonStauRecoTool::RpcTimeMeasurement::error
float error
Definition: MuonStauRecoTool.h:70
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
CscClusterOnTrack.h
MuonCombined::MuonStauRecoTool::MuonStauRecoTool
MuonStauRecoTool(const std::string &type, const std::string &name, const IInterface *parent)
Default AlgTool functions.
Definition: MuonStauRecoTool.cxx:45
MuonCombined::MuonStauRecoTool::BetaSeed::beta
float beta
Definition: MuonStauRecoTool.h:63
DataVector::front
const T * front() const
Access the first element in the collection as an rvalue.
BindingsTest.cut
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
Definition: BindingsTest.py:13
MuonCombined::MuonStauRecoTool::m_segmentMDTT
Gaudi::Property< bool > m_segmentMDTT
Definition: MuonStauRecoTool.h:263
MuGirlNS::StauHit
Definition: CandidateSummary.h:39
test_pyathena.parent
parent
Definition: test_pyathena.py:15
python.StandardJetMods.pull
pull
Definition: StandardJetMods.py:282
Muon::MuonLayerHoughTool::PhiMaximumVec
HoughDataPerSec::PhiMaximumVec PhiMaximumVec
Definition: MuonLayerHoughTool.h:64
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Muon::CscPrepData::time
double time() const
Returns the time.
Definition: CscPrepData.h:158
MuonCombined::MuonStauRecoTool::mdtTimeCalibration
void mdtTimeCalibration(const Identifier &id, float &time, float &error) const
Definition: MuonStauRecoTool.cxx:1401
MuonCombined::MuonStauRecoTool::createCandidates
bool createCandidates(const AssociatedData &associatedData, CandidateVec &candidates) const
create candidates from the beta seeds
Definition: MuonStauRecoTool.cxx:839
Trk::MeasurementBase::type
virtual bool type(MeasurementBaseType::Type type) const =0
Interface method checking the type.
MuonCombined::MuonStauRecoTool::AssociatedData
Definition: MuonStauRecoTool.h:95
Muon::MuonStationIndex::layerName
static const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
Definition: MuonStationIndex.cxx:192
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
MuonCombined::MuonStauRecoTool::Candidate::finalBetaFitResult
Muon::TimePointBetaFitter::FitResult finalBetaFitResult
Definition: MuonStauRecoTool.h:118
MuonCombined::MuonStauRecoTool::MaximumData::maximum
const MuonHough::MuonLayerHough::Maximum * maximum
Definition: MuonStauRecoTool.h:80
MuonCombined::MuonStauRecoTool::BetaSeed
Definition: MuonStauRecoTool.h:61
MuonCombined::MuonStauRecoTool::Candidate::hits
Muon::TimePointBetaFitter::HitVec hits
Definition: MuonStauRecoTool.h:108
MuonCombined::MuonStauRecoTool::m_houghDataPerSectorVecKey
SG::ReadHandleKey< Muon::MuonLayerHoughTool::HoughDataPerSectorVec > m_houghDataPerSectorVecKey
storegate
Definition: MuonStauRecoTool.h:228
Trk::ParametersBase
Definition: ParametersBase.h:55
MuGirlNS::StauExtras::betaAllt
double betaAllt
Definition: CandidateSummary.h:72
Muon::MdtDriftCircleOnTrack::driftRadius
double driftRadius() const
Returns the value of the drift radius.
Definition: MdtDriftCircleOnTrack.h:277
IRtResolution.h
MuonHough::MuonLayerHough::Maximum::hough
const MuonLayerHough * hough
Definition: MuonLayerHough.h:75
Muon::MuonDriftCircleErrorStrategy::Segment
@ Segment
Treating a segment or a track.
Definition: MuonDriftCircleErrorStrategy.h:33
Trk::Intersection::position
Amg::Vector3D position
Definition: Intersection.h:25
selection
std::string selection
Definition: fbtTestBasics.cxx:75
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
MuonCombined::MuonStauRecoTool::addTag
void addTag(const InDetCandidate &inDetCandidate, Candidate &candidate, InDetCandidateToTagMap *tagMap, TrackCollection *combTracks, Trk::SegmentCollection *segments) const
create final tag object and add it to the inDetCandidate
Definition: MuonStauRecoTool.cxx:684
Trk::LocalDirection
represents the three-dimensional global direction with respect to a planar surface frame.
Definition: LocalDirection.h:81
MuonCombined::MuonStauRecoTool::m_segmentMaker
ToolHandle< Muon::IMuonSegmentMaker > m_segmentMaker
Definition: MuonStauRecoTool.h:236
MuonCombined::MuonStauRecoTool::m_segmentBetaAssociationCut
Gaudi::Property< double > m_segmentBetaAssociationCut
Definition: MuonStauRecoTool.h:270
MuonCombined::MuonStauRecoTool::MaximumData
Definition: MuonStauRecoTool.h:74
Trk::MeasurementBase::localCovariance
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Definition: MeasurementBase.h:138
Muon::IMuonHitTimingTool::TimingResult
simple struct holding the result of the tool
Definition: IMuonHitTimingTool.h:38
MuonCombined::MuonStauRecoTool::combineCandidates
bool combineCandidates(const EventContext &ctx, const xAOD::TrackParticle &indetTrackParticle, CandidateVec &candidates) const
combine reconstruction
Definition: MuonStauRecoTool.cxx:784
MuonCombined::printIntersectionToString
std::string printIntersectionToString(const Muon::MuonSystemExtension::Intersection &intersection)
Definition: MuonStauRecoTool.cxx:37
Muon::MuonStationIndex::DetectorRegionIndex
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:47
Trk::PrepRawData
Definition: PrepRawData.h:62
Trk::MeasurementBase
Definition: MeasurementBase.h:58
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
MuonCombined::MuonStauRecoTool::LayerData::maximumDataVec
MaximumDataVec maximumDataVec
Definition: MuonStauRecoTool.h:91
MuonCombined::MuonStauRecoTool::m_selectedPdgs
std::set< int > m_selectedPdgs
Definition: MuonStauRecoTool.h:272
MuonCombined::MuonStauRecoTool::calculateTof
float calculateTof(const float beta, const float dist) const
Calcualte for zero betas.
Definition: MuonStauRecoTool.cxx:1414
MuonCombined::MuonStauRecoTool::associateHoughMaxima
void associateHoughMaxima(const EventContext &ctx, LayerData &layerData) const
associate Hough maxima to intersection
Definition: MuonStauRecoTool.cxx:1282
TrkDriftCircleMath::DCOnTrack::residual
void residual(double res)
set residual
Definition: DCOnTrack.h:35
MuonCombined::MuonStauRecoTool::MaximumData::betaSeeds
std::vector< BetaSeed > betaSeeds
Definition: MuonStauRecoTool.h:85
MuonHough::PhiHit::prd
const Trk::PrepRawData * prd
access to assiciated hit, either the prd or the tgc pointer is set in athena
Definition: MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLayerHough/MuonLayerHough/Hit.h:122
MuonCombined::MuonStauRecoTool::findSegments
void findSegments(const Muon::MuonSystemExtension::Intersection &intersection, MaximumData &maximumData, std::vector< std::shared_ptr< const Muon::MuonSegment >> &t0fittedSegments, const ToolHandle< Muon::IMuonPRDSelectionTool > &muonPRDSelectionTool, const ToolHandle< Muon::IMuonSegmentMaker > &segmentMaker) const
find segments for a given maximum
Definition: MuonStauRecoTool.cxx:1117
MuonCombined::MuonStauRecoTool::getBetaSeeds
void getBetaSeeds(MaximumData &maximumData) const
calculate the beta seeds for a give MaximumData
Definition: MuonStauRecoTool.cxx:1100
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
MuonCombined::MuonStauRecoTool::Candidate::stauHits
MuGirlNS::StauHits stauHits
Definition: MuonStauRecoTool.h:117
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
Trk::PrepRawDataType::sTgcPrepData
@ sTgcPrepData
MuonCombined::MuonStauRecoTool::calculateBeta
float calculateBeta(const float time, const float dist) const
In cases of invalid times just return an phyisical value of 20 times the speed of light The subsequen...
Definition: MuonStauRecoTool.cxx:1419
Muon::MdtDriftCircleOnTrack
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
Definition: MdtDriftCircleOnTrack.h:37
Trk::StraightLineSurface::localToGlobal
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override final
Specified for StraightLineSurface: LocalToGlobal method without dynamic memory allocation.
Definition: StraightLineSurface.cxx:139
MuonHough::MuonLayerHough::Maximum::pos
float pos
Definition: MuonLayerHough.h:60
Muon::RpcClusterOnTrack::time
float time() const
Return the time (ns)
Definition: RpcClusterOnTrack.h:159
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
python.PhysicalConstants.c_light
float c_light
Definition: PhysicalConstants.py:63
MuonCombined::MuonStauRecoTool::handleCandidate
void handleCandidate(const EventContext &ctx, const InDetCandidate &inDetCandidate, InDetCandidateToTagMap *tagMap, TrackCollection *combTracks, Trk::SegmentCollection *segments) const
handle a single candidate
Definition: MuonStauRecoTool.cxx:105
MuonCombined::MuonStauRecoTool::LayerData::intersection
Muon::MuonSystemExtension::Intersection intersection
Definition: MuonStauRecoTool.h:90
Muon::MdtPrepData
Class to represent measurements from the Monitored Drift Tubes.
Definition: MdtPrepData.h:33
Muon::CompetingMuonClustersOnTrack::containedROTs
const std::vector< const MuonClusterOnTrack * > & containedROTs() const
returns the vector of SCT_ClusterOnTrack objects .
Definition: CompetingMuonClustersOnTrack.h:184
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::PlaneSurface::straightLineIntersection
virtual Intersection straightLineIntersection(const Amg::Vector3D &pos, const Amg::Vector3D &dir, bool forceDir, Trk::BoundaryCheck bchk) const override final
fast straight line intersection schema - standard: provides closest intersection and (signed) path le...
Definition: PlaneSurface.cxx:223
MuonCombined::MuonStauRecoTool::MaximumData::rpcTimeMeasurements
RpcTimeMeasurementVec rpcTimeMeasurements
Definition: MuonStauRecoTool.h:84
Muon::CscClusterOnTrack::prepRawData
virtual const CscPrepData * prepRawData() const override final
Returns the CscPrepData - is a CscPrepData in this scope.
Definition: CscClusterOnTrack.h:154
Muon::MuonDriftCircleErrorStrategy::setParameter
void setParameter(CreationParameter, bool value)
Definition: MuonDriftCircleErrorStrategy.h:65
Muon::HoughDataPerSec
Definition: HoughDataPerSec.h:20
MuonHough::MuonLayerHough::Maximum::hits
HitVec hits
Definition: MuonLayerHough.h:73
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
TrkDriftCircleMath::TransformToLine::toLineY
double toLineY(const LocVec2D &pos) const
Definition: TransformToLine.h:24
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::RpcHitClusteringObj::clustersEta
std::vector< RpcClusterObj > clustersEta
Definition: RpcHitClustering.h:116
Trk::MeasurementBase::localParameters
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
Definition: MeasurementBase.h:132
MuonCombined::MuonStauRecoTool::m_segmentMakerT0Fit
ToolHandle< Muon::IMuonSegmentMaker > m_segmentMakerT0Fit
Definition: MuonStauRecoTool.h:237
MuonStauRecoTool.h
MuonCombined::MuonStauRecoTool::extend
virtual void extend(const InDetCandidateCollection &inDetCandidates, InDetCandidateToTagMap *tagMap, TrackCollection *combTracks, TrackCollection *meTracks, Trk::SegmentCollection *segments, const EventContext &ctx) const override
IMuonCombinedInDetExtensionTool interface: extend ID candidate.
Definition: MuonStauRecoTool.cxx:82
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
MuGirlNS::CSC_STAU_HIT
@ CSC_STAU_HIT
Definition: CandidateSummary.h:26
DeMoScan.index
string index
Definition: DeMoScan.py:364
Muon::CscClusterOnTrack
Class to represent the calibrated clusters created from CSC strips.
Definition: CscClusterOnTrack.h:47
Muon::TimePointBetaFitter::HitVec
std::vector< Hit > HitVec
Definition: TimePointBetaFitter.h:30
MuonCombined::MuonStauRecoTool::getTruth
std::unique_ptr< TruthInfo > getTruth(const xAOD::TrackParticle &indetTrackParticle) const
extract truth from the indetTrackParticle
Definition: MuonStauRecoTool.cxx:92
MuonCombined::InDetCandidate::indetTrackParticle
const xAOD::TrackParticle & indetTrackParticle() const
access TrackParticle
Definition: InDetCandidate.cxx:27
y
#define y
MuonCombined::MuonStauRecoTool::Candidate::combinedTrack
std::unique_ptr< Trk::Track > combinedTrack
Definition: MuonStauRecoTool.h:116
MuonCombined::InDetCandidate::isSiliconAssociated
bool isSiliconAssociated() const
Returns true if this candidate was formed from a special far forward InDet track.
Definition: InDetCandidate.cxx:35
python.BackTrackingConfig.numThreads
int numThreads
Definition: BackTrackingConfig.py:61
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Muon::MuonStationIndex::BIL
@ BIL
Definition: MuonStationIndex.h:17
Trk::PlaneSurface
Definition: PlaneSurface.h:64
Muon::MdtDriftCircleOnTrack::associatedSurface
virtual const Trk::StraightLineSurface & associatedSurface() const override final
Returns the surface on which this measurement was taken.
Definition: MdtDriftCircleOnTrack.h:271
IRtRelation.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MdtFullCalibData.h
MuonCombined
The MuonTagToSegMap is an auxillary construct that links the MuonSegments associated with a combined ...
Definition: IMuonSystemExtensionTool.h:23
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
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
MuonCombined::MuonStauRecoTool::AssociatedData::layerData
LayerDataVec layerData
Definition: MuonStauRecoTool.h:96
TrkDriftCircleMath::SegmentFinder::dropHits
bool dropHits(Segment &segment, bool &hasDroppedHit, unsigned int &dropDepth) const
Definition: SegmentFinder.cxx:409
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
MuonGM::MdtReadoutElement::surface
virtual const Trk::Surface & surface() const override final
Return surface associated with this detector element.
Definition: MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx:891
Muon::MuonSystemExtension::layerIntersections
const std::vector< Intersection > & layerIntersections() const
access to the intersections with the layers.
Definition: MuonSystemExtension.h:62
TrkDriftCircleMath::DCOnTrack
class representing a drift circle meaurement on segment
Definition: DCOnTrack.h:16
MuonCombined::MuonStauRecoTool::m_ignoreSiAssocated
Gaudi::Property< bool > m_ignoreSiAssocated
Definition: MuonStauRecoTool.h:264
Muon::MuonStationIndex::ChIndex
ChIndex
enum to classify the different chamber layers in the muon spectrometer
Definition: MuonStationIndex.h:15
MuonCombined::MuonStauRecoTool::m_mdtCreatorStau
ToolHandle< Muon::IMdtDriftCircleOnTrackCreator > m_mdtCreatorStau
Definition: MuonStauRecoTool.h:250
MuonCombined::MuonStauRecoTool::Candidate::betaFitResult
Muon::TimePointBetaFitter::FitResult betaFitResult
Definition: MuonStauRecoTool.h:109
MuonSegment.h
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
Muon::MuonCluster
Class representing clusters in the muon system.
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonCluster.h:37
Muon::MuonSystemExtension::Intersection
data per intersection
Definition: MuonSystemExtension.h:21
TrkDriftCircleMath::SegmentFinder
Definition: SegmentFinder.h:32
Muon::MuonSegment::globalPosition
virtual const Amg::Vector3D & globalPosition() const override final
global position
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:157
MuonCombined::MuonStauRecoTool::m_insideOutRecoTool
ToolHandle< MuonCombined::MuonInsideOutRecoTool > m_insideOutRecoTool
Definition: MuonStauRecoTool.h:252
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
Trk::SpaceTimePointBase::time
float time() const
access to the measured time
Definition: SpaceTimePointBase.h:47
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
MuonCombined::MuonStauRecoTool::extractTimeMeasurements
bool extractTimeMeasurements(const EventContext &ctx, const Muon::MuonSystemExtension &muonSystemExtension, AssociatedData &associatedData) const
associate Hough maxima and associate time measurements
Definition: MuonStauRecoTool.cxx:981
xAOD::TrackParticle_v1::track
const Trk::Track * track() const
Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle.
Definition: TrackParticle_v1.cxx:805
MuonCombined::IMuonCombinedInDetExtensionTool::MuonPrdData
Definition: IMuonCombinedInDetExtensionTool.h:27
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
Muon::MuonSegment
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:45
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
MuonCombined::MuonStauRecoTool::m_muonPRDSelectionTool
ToolHandle< Muon::IMuonPRDSelectionTool > m_muonPRDSelectionTool
Definition: MuonStauRecoTool.h:246
AthAlgTool
Definition: AthAlgTool.h:26
MuonParameters::beta
@ beta
Definition: MuonParamDefs.h:144
get_generator_info.error
error
Definition: get_generator_info.py:40
MuonCombined::MuonStauRecoTool::extendWithPRDs
virtual void extendWithPRDs(const InDetCandidateCollection &inDetCandidates, InDetCandidateToTagMap *tagMap, IMuonCombinedInDetExtensionTool::MuonPrdData prdData, TrackCollection *combTracks, TrackCollection *meTracks, Trk::SegmentCollection *segments, const EventContext &ctx) const override
Definition: MuonStauRecoTool.cxx:73
MuonHough::MuonLayerHough::Maximum::binposmax
int binposmax
Definition: MuonLayerHough.h:69
MuonCombined::MuonStauRecoTool::selectTruth
bool selectTruth(const TruthInfo *truthInfo) const
if truth tracking is enabled, return whether the pdg is selected
Definition: MuonStauRecoTool.h:206
error
Definition: IImpactPoint3dEstimator.h:70
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
LocVec2D.h
MuonCombined::MuonStauRecoTool::m_pdgsToBeConsidered
Gaudi::Property< std::vector< int > > m_pdgsToBeConsidered
Definition: MuonStauRecoTool.h:265
MuonCombined::MuonStauRecoTool::RpcTimeMeasurement::time
float time
Definition: MuonStauRecoTool.h:69
MuonCombined::MuonStauRecoTool::m_edmHelperSvc
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MuonStauRecoTool.h:232
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
MuonCombined::MuonStauRecoTool::MaximumData::t0fittedSegments
std::vector< std::shared_ptr< const Muon::MuonSegment > > t0fittedSegments
Definition: MuonStauRecoTool.h:83
MuonCombined::MuonStauRecoTool::refineCandidates
bool refineCandidates(const EventContext &ctx, CandidateVec &candidates) const
refine candidates: find segments for the given beta
Definition: MuonStauRecoTool.cxx:190
Muon::MuonClusterOnTrack
Base class for Muon cluster RIO_OnTracks.
Definition: MuonClusterOnTrack.h:34
Muon::TimePointBetaFitter::FitResult::status
int status
data members
Definition: TimePointBetaFitter.h:42
MuonCombined::MuonStauRecoTool::LayerData
Definition: MuonStauRecoTool.h:88
xAOD::TrackParticle_v1::phi
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
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
MuonCombined::IMuonCombinedInDetExtensionTool::MuonPrdData::mdtPrds
const Muon::MdtPrepDataContainer * mdtPrds
Definition: IMuonCombinedInDetExtensionTool.h:29
Muon::HoughDataPerSec::maxVec
RegionMaximumVec maxVec
Definition: HoughDataPerSec.h:51
TrkDriftCircleMath::DriftCircle::InTime
@ InTime
drift time too small to be compatible with drift spectrum
Definition: DriftCircle.h:27
Identifier
Definition: IdentifierFieldParser.cxx:14