ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCombined::MuonCreatorTool Class Reference

#include <MuonCreatorTool.h>

Inheritance diagram for MuonCombined::MuonCreatorTool:
Collaboration diagram for MuonCombined::MuonCreatorTool:

Public Types

using InDetCandidateTagsMap = std::vector<InDetCandidateTags>

Public Member Functions

 ~MuonCreatorTool ()=default
virtual StatusCode initialize () override final
virtual void create (const EventContext &ctx, const MuonCandidateCollection *muonCandidates, const std::vector< const InDetCandidateToTagMap * > &tagMaps, OutputData &outputData) const override final
 IMuonCreatorTool interface: build muons from ID and MS candidates.
virtual xAOD::Muoncreate (const EventContext &ctx, const MuonCandidate &candidate, OutputData &outputData) const override final
 IMuonCreatorTool interface: create a muon from a muon candidate.
virtual xAOD::Muoncreate (const EventContext &ctx, InDetCandidateTags &candidate, OutputData &outputData) const override final
 IMuonCreatorTool interface: create a muon from a muon candidate.

Private Member Functions

void decorateDummyValues (const EventContext &ctx, xAOD::Muon &muon, OutputData &outputData) const
 De^corated a bunch of dummy values to the muon to ensure data consistency in the xAOD.
void addStatisticalCombination (const EventContext &ctx, xAOD::Muon &muon, const InDetCandidate *candidate, const StacoTag *tag, OutputData &outputData) const
void addCombinedFit (const EventContext &ctx, xAOD::Muon &muon, const CombinedFitTag *tag, OutputData &outputData) const
void addMuGirl (const EventContext &ctx, xAOD::Muon &muon, const MuGirlTag *tag, OutputData &outputData) const
void addMuGirlLowBeta (const EventContext &ctx, xAOD::Muon &muon, const MuGirlLowBetaTag *tag, xAOD::SlowMuon *slowMuon, OutputData &outputData) const
void addSegmentTag (const EventContext &ctx, xAOD::Muon &muon, const SegmentTag *tag, OutputData &outputData) const
void addCaloTag (xAOD::Muon &muon, const CaloTag *tag) const
void addMuonCandidate (const EventContext &ctx, const MuonCandidate &candidate, xAOD::Muon &muon, OutputData &outputData, const ElementLink< TrackCollection > &meLink=ElementLink< TrackCollection >()) const
 add muon candidate info to a muon, if an updateExtrapolatedTrack is provided, the routine takes ownership of the track.
ElementLink< xAOD::TrackParticleContainercreateTrackParticleElementLink (const EventContext &ctx, const ElementLink< TrackCollection > &trackLink, xAOD::TrackParticleContainer &trackParticleContainer, TrackCollection *trackCollection=0) const
 function creates an element link to a track particle from the track and the TrackParticle collection.
ElementLink< xAOD::MuonSegmentContainercreateMuonSegmentElementLink (const EventContext &ctx, const Muon::MuonSegment *segLink, const OutputData &outData) const
void resolveOverlaps (const EventContext &ctx, const MuonCandidateCollection *muonCandidates, const std::vector< const InDetCandidateToTagMap * > &tagMaps, InDetCandidateTagsMap &resolvedInDetCandidates, std::vector< const MuonCombined::MuonCandidate * > &resolvedMuonCandidates) const
void selectStaus (InDetCandidateTagsMap &resolvedInDetCandidates, const std::vector< const InDetCandidateToTagMap * > &tagMaps) const
std::unique_ptr< Trk::TrackcreateDummyTrack (const EventContext &ctx, const std::vector< const Muon::MuonSegment * > &segments, const Trk::Track &indetTrack) const
void setMuonHitCounts (xAOD::Muon &muon) const
bool dressMuon (xAOD::Muon &muon) const
void addEnergyLossToMuon (xAOD::Muon &muon) const
void fillEnergyLossFromTrack (xAOD::Muon &muon, const std::vector< const Trk::TrackStateOnSurface * > *tsosVector) const
void setP4 (xAOD::Muon &muon, const xAOD::TrackParticle &tp) const
void collectCells (const EventContext &ctx, xAOD::Muon &muon, xAOD::CaloClusterContainer *clusterContainer, const Trk::CaloExtension *inputCaloExt=nullptr) const

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
ServiceHandle< Muon::IMuonEDMHelperSvcm_edmHelperSvc
PublicToolHandle< Muon::MuonEDMPrinterToolm_printer {this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}
ToolHandle< Rec::IMuonPrintingToolm_muonPrinter {this, "MuonPrinter", "Rec::MuonPrintingTool/MuonPrintingTool"}
ToolHandle< Trk::IParticleCaloExtensionToolm_caloExtTool
ToolHandle< Trk::ITrackParticleCreatorToolm_particleCreator
ToolHandle< Trk::ITrackAmbiguityProcessorToolm_ambiguityProcessor {this, "AmbiguityProcessor", ""}
ToolHandle< Trk::IPropagatorm_propagator {this, "Propagator", "Trk::RungeKuttaPropagator/AtlasRungeKuttaPropagator"}
ToolHandle< xAOD::IMuonDressingToolm_muonDressingTool {this, "MuonDressingTool", "MuonCombined::MuonDressingTool/MuonDressingTool"}
ToolHandle< Rec::IMuonMomentumBalanceSignificancem_momentumBalanceTool
ToolHandle< Rec::IMuonScatteringAngleSignificancem_scatteringAngleTool
ToolHandle< CP::IMuonSelectionToolm_selectorTool {this, "MuonSelectionTool", "CP::MuonSelectionTool/MuonSelectionTool"}
ToolHandle< Rec::IMuonMeanMDTdADCFillerm_meanMDTdADCTool
ToolHandle< Trk::ITrkMaterialProviderToolm_caloMaterialProvider
ToolHandle< Rec::IMuonTrackQuerym_trackQuery {this, "TrackQuery", "Rec::MuonTrackQuery/MuonTrackQuery"}
ToolHandle< Trk::IExtendedTrackSummaryToolm_trackSummaryTool {this, "TrackSummaryTool", "MuonTrackSummaryTool"}
Rec::CaloCellCollector m_cellCollector
SG::ReadHandleKey< CaloCellContainerm_cellContainerName {this, "CaloCellContainer", "AllCalo", "calo cells"}
SG::ReadCondHandleKey< CaloNoisem_caloNoiseKey {this, "CaloNoise", "", "CaloNoise object to use, or blank."}
Gaudi::Property< bool > m_buildStauContainer {this, "BuildStauContainer", false, "flag to decide whether to build stau or not"}
Gaudi::Property< bool > m_addMDTExtrasMuGirlLowBeta {this, "AddMDTExtrasMuGirlLowBeta", false}
Gaudi::Property< bool > m_fillEnergyLossFromTrack
Gaudi::Property< bool > m_fillExtraELossInfo
Gaudi::Property< bool > m_printSummary {this, "PrintSummary", false, "flag to print muon edm"}
Gaudi::Property< bool > m_useUpdatedExtrapolatedTrack
Gaudi::Property< bool > m_segLowBeta {this, "AssociateSegmentsToLowBetaMuons", false, "associate segments to MuGirlLowBeta muons"}
Gaudi::Property< bool > m_useCaloCells {this, "UseCaloCells", true}
Gaudi::Property< bool > m_doSA {this, "MakeSAMuons", false}
Gaudi::Property< bool > m_requireIDTracks {this, "RequireIDTrack", false}
 In case of running the muon reconstruction with LRT tracks this property removes the overlap of muons in the container in which in any case no ID track is available.
Gaudi::Property< float > m_sigmaCaloNoiseCut {this, "SigmaCaloNoiseCut", 3.4}
Gaudi::Property< std::vector< std::string > > m_copyFloatSummaryKeys
Gaudi::Property< std::vector< std::string > > m_copyCharSummaryKeys
Gaudi::Property< bool > m_requireMSOEforSA
Gaudi::Property< bool > m_requireCaloDepositForSA
std::vector< std::unique_ptr< SG::AuxElement::Accessor< float > > > m_copyFloatSummaryAccessors
std::vector< std::unique_ptr< SG::AuxElement::Accessor< uint8_t > > > m_copyCharSummaryAccessors
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey {this, "CaloDetDescrManager", "CaloDetDescrManager"}

Detailed Description

Definition at line 60 of file MuonCreatorTool.h.

Member Typedef Documentation

◆ InDetCandidateTagsMap

using MuonCombined::MuonCreatorTool::InDetCandidateTagsMap = std::vector<InDetCandidateTags>

Definition at line 62 of file MuonCreatorTool.h.

Constructor & Destructor Documentation

◆ ~MuonCreatorTool()

MuonCombined::MuonCreatorTool::~MuonCreatorTool ( )
default

Member Function Documentation

◆ addCaloTag()

void MuonCombined::MuonCreatorTool::addCaloTag ( xAOD::Muon & muon,
const CaloTag * tag ) const
private

Definition at line 713 of file MuonCreatorTool.cxx.

713 {
714 static const SG::Accessor<float> acc_ElType("CT_EL_Type"); // FIXME - should be uint
715 static const SG::Accessor<float> acc_ElFSREnergy("CT_ET_FSRCandidateEnergy");
716
717 if (!tag) {
718 // init variables if necessary.
719
720 mu.setParameter(0.f, xAOD::Muon::ParamDef::CaloMuonScore);
721 mu.setParameter(static_cast<int>(0xFF), xAOD::Muon::ParamDef::CaloMuonIDTag);
723 // Here we can make sure that we store the extra calotag information -
724 // just always add it since this is then unambigious for debugging
725 acc_ET_Core(mu) = 0.0;
726 acc_ElType(mu) = -999.0;
727 acc_ElFSREnergy(mu) = -999.0;
728 }
729 return;
730 }
731
732 ATH_MSG_DEBUG("Adding Calo Muon with author " << tag->author() << ", type " << tag->type() << ", CaloMuonScore "
733 << tag->caloMuonScore());
734 mu.setParameter(static_cast<float>(tag->caloMuonScore()), xAOD::Muon::ParamDef::CaloMuonScore);
735 mu.setParameter(static_cast<int>(tag->caloMuonIdTag()), xAOD::Muon::ParamDef::CaloMuonIDTag);
736
738 // Here we can make sure that we store the extra calotag information - just
739 // always add it since this is then unambigious for debugging
740 acc_ET_Core(mu) = tag->etCore();
741 acc_ElType(mu) = tag->energyLossType();
742 acc_ElFSREnergy(mu) = tag->fsrCandidateEnergy();
743 }
744 // FIXME - calo deposits
745 }
#define ATH_MSG_DEBUG(x)
Gaudi::Property< bool > m_fillExtraELossInfo

◆ addCombinedFit()

void MuonCombined::MuonCreatorTool::addCombinedFit ( const EventContext & ctx,
xAOD::Muon & muon,
const CombinedFitTag * tag,
OutputData & outputData ) const
private

Definition at line 474 of file MuonCreatorTool.cxx.

475 {
476 if (!tag) {
477 // init variables if necessary.
478 return;
479 }
480
481 ATH_MSG_DEBUG("Adding Combined fit Muon " << tag->author() << " type " << tag->type());
482 if (!muon.trackParticle(xAOD::Muon::TrackParticleType::CombinedTrackParticle)) {
483 // if the combined track particle is part of a container set the link
484 if (outputData.combinedTrackParticleContainer) {
485 // create element link from the track
486 ElementLink<xAOD::TrackParticleContainer> link = createTrackParticleElementLink(
487 ctx, tag->combinedTrackLink(), *outputData.combinedTrackParticleContainer, outputData.combinedTrackCollection);
488
489 if (link.isValid()) {
490 // link.toPersistent();
491 ATH_MSG_DEBUG("Adding combined fit: pt " << (*link)->pt() << " eta " << (*link)->eta() << " phi " << (*link)->phi());
492 muon.setTrackParticleLink(xAOD::Muon::TrackParticleType::CombinedTrackParticle, link);
493 } else
494 ATH_MSG_WARNING("Creating of Combined TrackParticle Link failed");
495 }
496 }
497 // add muon candidate
498 addMuonCandidate(ctx, tag->muonCandidate(), muon, outputData, tag->updatedExtrapolatedTrackLink());
499
500 // Add inner match chi^2
501 const float inner_chi2 = tag->matchChi2();
502 muon.setParameter(tag->matchDoF(), xAOD::Muon::ParamDef::msInnerMatchDOF);
503 muon.setParameter(inner_chi2, xAOD::Muon::ParamDef::msInnerMatchChi2);
504
505 ATH_MSG_DEBUG("Done adding Combined Fit Muon " << tag->author() << " type " << tag->type());
506 }
#define ATH_MSG_WARNING(x)
void addMuonCandidate(const EventContext &ctx, const MuonCandidate &candidate, xAOD::Muon &muon, OutputData &outputData, const ElementLink< TrackCollection > &meLink=ElementLink< TrackCollection >()) const
add muon candidate info to a muon, if an updateExtrapolatedTrack is provided, the routine takes owner...
ElementLink< xAOD::TrackParticleContainer > createTrackParticleElementLink(const EventContext &ctx, const ElementLink< TrackCollection > &trackLink, xAOD::TrackParticleContainer &trackParticleContainer, TrackCollection *trackCollection=0) const
function creates an element link to a track particle from the track and the TrackParticle collection.
pointer & link(pointer p) const
Return a reference to the link for an element.

◆ addEnergyLossToMuon()

void MuonCombined::MuonCreatorTool::addEnergyLossToMuon ( xAOD::Muon & muon) const
private

Definition at line 1259 of file MuonCreatorTool.cxx.

1259 {
1260 const xAOD::TrackParticle* trkPart = muon.trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle);
1261 if (!trkPart) {
1262 ATH_MSG_WARNING("Missing ID track particle link in addEnergyLossToMuon!");
1263 return;
1264 }
1265
1266 // get ID track particle
1267 const Trk::Track* trk = trkPart->track();
1268 if (!trk) {
1269 ATH_MSG_WARNING("Missing ID trk::track in addEnergyLossToMuon!");
1270 return;
1271 }
1272
1273 // find last ID TSOS with track parameters
1274 const Trk::TrackStateOnSurface* lastID = nullptr;
1277 for (; it != itEnd; ++it) {
1278 if ((*it)->trackParameters()) {
1279 lastID = *it;
1280 break;
1281 }
1282 }
1283 if (!lastID) {
1284 ATH_MSG_WARNING("Missing ID TSOS with track parameters in addEnergyLossToMuon!");
1285 return;
1286 }
1287
1288 // get calorimeter TSOS
1289 std::vector<const Trk::TrackStateOnSurface*>* caloTSOS = m_caloMaterialProvider->getCaloTSOS(*((*it)->trackParameters()), *trk);
1290
1291 if (!caloTSOS) {
1292 ATH_MSG_WARNING("Unable to find calo TSOS in addEnergyLossToMuon!");
1293 return;
1294 }
1295
1296 // fill muon parameters for eloss
1297 fillEnergyLossFromTrack(muon, caloTSOS);
1298
1299 // delete caloTSOS
1300 std::vector<const Trk::TrackStateOnSurface*>::const_iterator it2 = caloTSOS->begin();
1301 std::vector<const Trk::TrackStateOnSurface*>::const_iterator itEnd2 = caloTSOS->end();
1302 for (; it2 != itEnd2; ++it2) delete *it2;
1303 delete caloTSOS;
1304 }
const_reverse_iterator rend() const noexcept
Return a const_reverse_iterator pointing at the beginning of the collection.
const_reverse_iterator rbegin() const noexcept
Return a const_reverse_iterator pointing past the end of the collection.
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition DataVector.h:847
void fillEnergyLossFromTrack(xAOD::Muon &muon, const std::vector< const Trk::TrackStateOnSurface * > *tsosVector) const
ToolHandle< Trk::ITrkMaterialProviderTool > m_caloMaterialProvider
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
const Trk::Track * track() const
Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle.
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ addMuGirl()

void MuonCombined::MuonCreatorTool::addMuGirl ( const EventContext & ctx,
xAOD::Muon & muon,
const MuGirlTag * tag,
OutputData & outputData ) const
private

Definition at line 621 of file MuonCreatorTool.cxx.

621 {
622 if (!tag) {
623 // init variables if necessary.
624 return;
625 }
626
627 ATH_MSG_DEBUG("Adding MuGirl Muon " << tag->author() << " type " << tag->type());
628
629 if (!muon.trackParticle(xAOD::Muon::TrackParticleType::CombinedTrackParticle) && tag->combinedTrack()) {
630 // if the combined track particle is part of a container set the link
631 if (outputData.combinedTrackParticleContainer) {
632 // create element link
633 ElementLink<xAOD::TrackParticleContainer> link = createTrackParticleElementLink(
634 ctx, tag->combinedTrackLink(), *outputData.combinedTrackParticleContainer, outputData.combinedTrackCollection);
635
636 if (link.isValid()) {
637 // link.toPersistent();
638 ATH_MSG_DEBUG("Adding MuGirl: pt " << (*link)->pt() << " eta " << (*link)->eta() << " phi " << (*link)->phi());
639 muon.setTrackParticleLink(xAOD::Muon::TrackParticleType::CombinedTrackParticle, link);
640 } else
641 ATH_MSG_WARNING("Creating of MuGirl TrackParticle Link failed");
642 }
643
644 if (outputData.extrapolatedTrackParticleContainer && tag->updatedExtrapolatedTrack()) {
645 // create element link
646 ElementLink<xAOD::TrackParticleContainer> link =
647 createTrackParticleElementLink(ctx, tag->updatedExtrapolatedTrackLink(), *outputData.extrapolatedTrackParticleContainer,
648 outputData.extrapolatedTrackCollection);
649
650 if (link.isValid()) {
651 ATH_MSG_DEBUG("Adding MuGirl: pt " << (*link)->pt() << " eta " << (*link)->eta() << " phi " << (*link)->phi());
652 muon.setTrackParticleLink(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle, link);
653 } else
654 ATH_MSG_WARNING("Creating of MuGirl TrackParticle Link failed");
655 }
656
657 if (outputData.xaodSegmentContainer) {
658 ATH_MSG_DEBUG("Adding MuGirl muonSegmentCollection");
659
660 std::vector<ElementLink<xAOD::MuonSegmentContainer>> segments;
661 for (const Muon::MuonSegment* segLink : tag->associatedSegments()) {
662 ElementLink<xAOD::MuonSegmentContainer> link = createMuonSegmentElementLink(ctx, segLink, outputData);
663 if (link.isValid()) {
664 segments.push_back(link);
665 ATH_MSG_DEBUG("Adding MuGirl: xaod::MuonSegment px " << (*link)->px() << " py " << (*link)->py() << " pz "
666 << (*link)->pz());
667 } else
668 ATH_MSG_WARNING("Creating of MuGirl segment Link failed");
669 }
670 muon.setMuonSegmentLinks(segments);
671 }
672 }
673 ATH_MSG_DEBUG("Done Adding MuGirl Muon " << tag->author() << " type " << tag->type());
674 }
ElementLink< xAOD::MuonSegmentContainer > createMuonSegmentElementLink(const EventContext &ctx, const Muon::MuonSegment *segLink, const OutputData &outData) const

◆ addMuGirlLowBeta()

void MuonCombined::MuonCreatorTool::addMuGirlLowBeta ( const EventContext & ctx,
xAOD::Muon & muon,
const MuGirlLowBetaTag * tag,
xAOD::SlowMuon * slowMuon,
OutputData & outputData ) const
private

Definition at line 508 of file MuonCreatorTool.cxx.

512 {
513 if (!tag) {
514 // init variables if necessary.
515 return;
516 }
517
518 ATH_MSG_DEBUG("Adding MuGirlLowBeta Muon " << tag->author() << " type " << tag->type());
519
520 // get stauExtras and write to slowMuon
521 const MuGirlNS::StauExtras* stauExtras = tag->getStauExtras();
522 if (slowMuon && stauExtras) {
523 ATH_MSG_VERBOSE("StauSummary beta " << stauExtras->betaAll<<" "<<stauExtras->betaAllt);
524 slowMuon->setBeta(stauExtras->betaAll);
525 slowMuon->setBetaT(stauExtras->betaAllt);
526 slowMuon->setAnn(stauExtras->ann);
527 slowMuon->setNRpcHits(stauExtras->numRpcHitsInSeg);
528 slowMuon->setNTileCells(stauExtras->numCaloCells);
529 slowMuon->setRpcInfo(stauExtras->rpcBetaAvg, stauExtras->rpcBetaRms, stauExtras->rpcBetaChi2, stauExtras->rpcBetaDof);
530 slowMuon->setMdtInfo(stauExtras->mdtBetaAvg, stauExtras->mdtBetaRms, stauExtras->mdtBetaChi2, stauExtras->mdtBetaDof);
531 slowMuon->setCaloInfo(stauExtras->caloBetaAvg, stauExtras->caloBetaRms, stauExtras->caloBetaChi2, stauExtras->caloBetaDof);
532
533 static const SG::Accessor<std::vector<uint8_t> > eTechAcc ("hitTechnology");
534 static const SG::Accessor<std::vector<unsigned int> > idAcc ("hitIdentifier");
535 static const SG::Accessor<std::vector<float> > mToFAcc ("hitTOF");
536 static const SG::Accessor<std::vector<float> > xAcc ("hitPositionX");
537 static const SG::Accessor<std::vector<float> > yAcc ("hitPositionY");
538 static const SG::Accessor<std::vector<float> > zAcc ("hitPositionZ");
539 static const SG::Accessor<std::vector<float> > eAcc ("hitEnergy");
540 static const SG::Accessor<std::vector<float> > errorAcc ("hitError");
541 static const SG::Accessor<std::vector<float> > shiftAcc ("hitShift");
542 static const SG::Accessor<std::vector<float> > propTimeAcc ("hitPropagationTime");
543 static const SG::Accessor<std::vector<uint8_t> > hitPassesMDTBetaCutAcc ("hitPassesMDTBetaCut");
544
545 std::vector<uint8_t>& eTechVec = eTechAcc(*slowMuon);
546 std::vector<unsigned int>& idVec = idAcc(*slowMuon);
547 std::vector<float>& mToFVec = mToFAcc(*slowMuon);
548 std::vector<float>& xVec = xAcc(*slowMuon);
549 std::vector<float>& yVec = yAcc(*slowMuon);
550 std::vector<float>& zVec = zAcc(*slowMuon);
551 std::vector<float>& eVec = eAcc(*slowMuon);
552 std::vector<float>& errorVec = errorAcc(*slowMuon);
553 std::vector<float>& shiftVec = shiftAcc(*slowMuon);
554 std::vector<float>& propagationTimeVec = propTimeAcc(*slowMuon);
555 std::vector<uint8_t>& passesMDTBetaCutVec = hitPassesMDTBetaCutAcc(*slowMuon);
556
557 for (const auto& hit : stauExtras->hits) {
558 eTechVec.push_back(hit.eTech);
559 idVec.push_back(hit.id.get_identifier32().get_compact());
560 mToFVec.push_back(hit.mToF);
561 xVec.push_back(hit.x);
562 yVec.push_back(hit.y);
563 zVec.push_back(hit.z);
564 eVec.push_back(hit.e);
565 errorVec.push_back(hit.error);
566 shiftVec.push_back(hit.shift);
567 propagationTimeVec.push_back(hit.propagationTime);
568 passesMDTBetaCutVec.push_back(hit.passesMDTBetaCut ? uint8_t{1} : uint8_t{0});
569 }
570
571 // additional MDT hit info (optional)
573 static const SG::Accessor<std::vector<int> > adcAcc ("hitAdc");
574 static const SG::Accessor<std::vector<float> > rdriftAcc ("hitDriftRadius");
575
576 std::vector<int>& adcVec = adcAcc(*slowMuon);
577 std::vector<float>& rdriftVec = rdriftAcc(*slowMuon);
578
579 if (stauExtras->extraMDTHitInfo) { // check if extra MDT hit info added
580 for (const auto& extraMDTinfo : *stauExtras->extraMDTHitInfo) {
581 adcVec.push_back(extraMDTinfo.adc);
582 rdriftVec.push_back(extraMDTinfo.rdrift);
583 }
584 }
585 }
586
587
588 }
589
590 if (!muon.trackParticle(xAOD::Muon::TrackParticleType::CombinedTrackParticle) && tag->combinedTrack()) {
591 // if the combined track particle is part of a container set the link
592 if (outputData.combinedTrackParticleContainer) {
593 // create element link
594 ElementLink<xAOD::TrackParticleContainer> link = createTrackParticleElementLink(
595 ctx, tag->combinedTrackLink(), *outputData.combinedTrackParticleContainer, outputData.combinedTrackCollection);
596
597 if (link.isValid()) {
598 ATH_MSG_DEBUG("Adding MuGirlLowBeta: pt " << (*link)->pt() << " eta " << (*link)->eta() << " phi " << (*link)->phi());
599 muon.setTrackParticleLink(xAOD::Muon::TrackParticleType::CombinedTrackParticle, link);
600 } else
601 ATH_MSG_WARNING("Creating of MuGirlLowBeta TrackParticle Link failed");
602 }
603 }
604
605 if (outputData.xaodSegmentContainer) {
606 ATH_MSG_DEBUG("Adding MuGirlLowBeta muonSegmentColection");
607 std::vector<ElementLink<xAOD::MuonSegmentContainer>> segments;
608 for (const ElementLink<Trk::SegmentCollection>& seglink : tag->segments()) {
609 ElementLink<xAOD::MuonSegmentContainer> link{*outputData.xaodSegmentContainer, seglink.index(), ctx};
610 if (link.isValid()) {
611 segments.push_back(link);
612 ATH_MSG_DEBUG("Adding MuGirlLowBeta: xaod::MuonSegment px " << (*link)->px() << " py " << (*link)->py() << " pz "
613 << (*link)->pz());
614 } else
615 ATH_MSG_WARNING("Creating of MuGirlLowBeta segment Link failed");
616 }
617 muon.setMuonSegmentLinks(segments);
618 }
619 }
#define ATH_MSG_VERBOSE(x)
Gaudi::Property< bool > m_addMDTExtrasMuGirlLowBeta
void setNRpcHits(int nRpcHits)
Sets.
void setNTileCells(int nTileCells)
Sets.
void setAnn(float ann)
Sets.
void setMdtInfo(float mdtBetaAvg, float mdtBetaRms, float mdtBetaChi2, int mdtBetaDof)
Sets.
void setBeta(float beta)
Sets.
void setBetaT(float betaT)
Sets.
void setRpcInfo(float rpcBetaAvg, float rpcBetaRms, float rpcBetaChi2, int rpcBetaDof)
Sets.
void setCaloInfo(float caloBetaAvg, float caloBetaRms, float caloBetaChi2, int caloBetaDof)
Sets.
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:573
unsigned int numRpcHitsInSeg
std::optional< StauMDTHitExtras > extraMDTHitInfo

◆ addMuonCandidate()

void MuonCombined::MuonCreatorTool::addMuonCandidate ( const EventContext & ctx,
const MuonCandidate & candidate,
xAOD::Muon & muon,
OutputData & outputData,
const ElementLink< TrackCollection > & meLink = ElementLink<TrackCollection>() ) const
private

add muon candidate info to a muon, if an updateExtrapolatedTrack is provided, the routine takes ownership of the track.

The track will be used instead of the extrapolatedTrack of the MuonCandidate. The extrapolatedTrack of the MuonCandidate will be release during the operation.

Definition at line 791 of file MuonCreatorTool.cxx.

792 {
793 if (!muon.nMuonSegments()) {
794 std::vector< ElementLink<xAOD::MuonSegmentContainer>> segments;
795 for (const Muon::MuonSegment* segLink : candidate.getSegments()) {
796 ElementLink<xAOD::MuonSegmentContainer> link = createMuonSegmentElementLink(ctx, segLink, outputData);
797 if (link.isValid()) {
798 segments.push_back(link);
799 ATH_MSG_DEBUG("Adding MuGirl: xaod::MuonSegment px " << (*link)->px() << " py " << (*link)->py() << " pz "
800 << (*link)->pz());
801 } else
802 ATH_MSG_WARNING("Creating of Muon candidate segment failed "<<candidate.toString());
803
804 }
805 muon.setMuonSegmentLinks(segments);
806 }
807 // only set once
808 if (muon.trackParticle(xAOD::Muon::TrackParticleType::MuonSpectrometerTrackParticle)) { return; }
809 // case where we have a MuGirl muon that is also reconstructed by STACO: don't
810 // want to add this track as it is misleading however, we will still keep the
811 // MS-only extrapolated track (see below) for debugging purposes
812 if (muon.author() != xAOD::Muon::Author::MuGirl)
813 muon.setTrackParticleLink(xAOD::Muon::TrackParticleType::MuonSpectrometerTrackParticle, candidate.muonSpectrometerTrackLink());
814
815 // we need both the container and the extrapolated muon track to add the link
816 if (!outputData.extrapolatedTrackParticleContainer || (!candidate.extrapolatedTrack() && !meLink.isValid())) { return; }
817
818 const Trk::Track* extrapolatedTrack = candidate.extrapolatedTrack();
819
820 if (!extrapolatedTrack || !extrapolatedTrack->perigeeParameters()) {
821 ATH_MSG_DEBUG("There is no extrapolated track associated to the MuonCandidate.");
822 if (muon.author() == xAOD::Muon::Author::MuidCo) { // this can happen for MuidCo muons, though it's
823 // quite rare: in this case just add the ME track
824 if (meLink.isValid()) {
825 ElementLink<xAOD::TrackParticleContainer> link = createTrackParticleElementLink(
826 ctx, meLink, *outputData.extrapolatedTrackParticleContainer, outputData.extrapolatedTrackCollection);
827 if (link.isValid()) {
828 ATH_MSG_DEBUG("Adding standalone fit (refitted): pt " << (*link)->pt() << " eta " << (*link)->eta() << " phi "
829 << (*link)->phi());
830 muon.setTrackParticleLink(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle, link);
831 float fieldInt = m_trackQuery->fieldIntegral(**meLink, ctx).betweenSpectrometerMeasurements();
832 muon.setParameter(fieldInt, xAOD::Muon::ParamDef::spectrometerFieldIntegral);
833 int nunspoiled = (*link)->track()->trackSummary()->get(Trk::numberOfCscUnspoiltEtaHits);
834 acc_nUnspoiledCscHits(muon) = nunspoiled;
835 }
836 }
837 } else { // I don't think we should ever get here, but just in case
838 if (!extrapolatedTrack) ATH_MSG_WARNING("Track doesn't have extrapolated track. Skipping");
839 if (extrapolatedTrack && !extrapolatedTrack->perigeeParameters())
841 "Track doesn't have perigee parameters on extrapolated "
842 "track. Skipping");
843 }
844 } else {
845 // Now we just add the original extrapolated track itself
846 // but not for SA muons, for consistency they will still have
847 // extrapolatedTrackParticle
848 if (muon.muonType() != xAOD::Muon::MuonType::MuonStandAlone) {
849 if (meLink.isValid()) { // add ME track and MS-only extrapolated track
850 if (outputData.msOnlyExtrapolatedTrackParticleContainer) { // add un-refitted
851 // extrapolated track
852 // as MS-only
853 // extrapolated track
854 ElementLink<xAOD::TrackParticleContainer> link = createTrackParticleElementLink(
855 ctx, candidate.extrapolatedTrackLink(), *outputData.msOnlyExtrapolatedTrackParticleContainer,
856 outputData.msOnlyExtrapolatedTrackCollection);
857
858 if (link.isValid()) {
859 ATH_MSG_DEBUG("Adding MS-only extrapolated track: pt " << (*link)->pt() << " eta " << (*link)->eta() << " phi "
860 << (*link)->phi());
861 // link.toPersistent();
862 muon.setTrackParticleLink(xAOD::Muon::TrackParticleType::MSOnlyExtrapolatedMuonSpectrometerTrackParticle, link);
863 } else
864 ATH_MSG_WARNING("failed to create MS-only extrapolated track particle");
865 }
866 // now add refitted track as ME track
867 ElementLink<xAOD::TrackParticleContainer> link = createTrackParticleElementLink(
868 ctx, meLink, *outputData.extrapolatedTrackParticleContainer, outputData.extrapolatedTrackCollection);
869 if (link.isValid()) {
870 ATH_MSG_DEBUG("Adding standalone fit (refitted): pt " << (*link)->pt() << " eta " << (*link)->eta() << " phi "
871 << (*link)->phi());
872 muon.setTrackParticleLink(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle, link);
873 float fieldInt = m_trackQuery->fieldIntegral(**meLink, ctx).betweenSpectrometerMeasurements();
874 muon.setParameter(fieldInt, xAOD::Muon::ParamDef::spectrometerFieldIntegral);
875 int nunspoiled = (*link)->track()->trackSummary()->get(Trk::numberOfCscUnspoiltEtaHits);
876 acc_nUnspoiledCscHits(muon) = nunspoiled;
877 }
878 } else { // no refitted track, so add original un-refitted extrapolated
879 // track as ME track
880 if (muon.author() == xAOD::Muon::Author::MuGirl && muon.trackParticle(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle)) {
881 // MuGirl case: ME track is already set, but now we have the
882 // extrapolated track from the STACO tag add this as the MS-only
883 // extrapolated track instead
884 ElementLink<xAOD::TrackParticleContainer> link = createTrackParticleElementLink(
885 ctx, candidate.extrapolatedTrackLink(), *outputData.msOnlyExtrapolatedTrackParticleContainer,
886 outputData.msOnlyExtrapolatedTrackCollection);
887
888 if (link.isValid()) {
889 ATH_MSG_DEBUG("Adding MS-only extrapolated track to MuGirl muon: pt "
890 << (*link)->pt() << " eta " << (*link)->eta() << " phi " << (*link)->phi());
891 // link.toPersistent();
892 muon.setTrackParticleLink(xAOD::Muon::TrackParticleType::MSOnlyExtrapolatedMuonSpectrometerTrackParticle, link);
893 float fieldInt =
894 m_trackQuery->fieldIntegral(**candidate.extrapolatedTrackLink(), ctx).betweenSpectrometerMeasurements();
895 muon.setParameter(fieldInt, xAOD::Muon::ParamDef::spectrometerFieldIntegral);
896 }
897 } else {
898 ElementLink<xAOD::TrackParticleContainer> link = createTrackParticleElementLink(
899 ctx, candidate.extrapolatedTrackLink(), *outputData.extrapolatedTrackParticleContainer,
900 outputData.extrapolatedTrackCollection);
901
902 if (link.isValid()) {
903 ATH_MSG_DEBUG("Adding standalone fit (un-refitted): pt " << (*link)->pt() << " eta " << (*link)->eta()
904 << " phi " << (*link)->phi());
905 // link.toPersistent();
906 muon.setTrackParticleLink(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle, link);
907 float fieldInt =
908 m_trackQuery->fieldIntegral(**candidate.extrapolatedTrackLink(), ctx).betweenSpectrometerMeasurements();
909 muon.setParameter(fieldInt, xAOD::Muon::ParamDef::spectrometerFieldIntegral);
910 }
911 }
912 }
913 } else { // SA tracks only get un-refitted track as ME track
914 // create element link from the track
915 ElementLink<xAOD::TrackParticleContainer> link =
916 createTrackParticleElementLink(ctx, candidate.extrapolatedTrackLink(), *outputData.extrapolatedTrackParticleContainer,
917 outputData.extrapolatedTrackCollection);
918
919 if (link.isValid()) {
920 ATH_MSG_DEBUG("Adding standalone fit: pt " << (*link)->pt() << " eta " << (*link)->eta() << " phi " << (*link)->phi());
921 // link.toPersistent();
922 muon.setTrackParticleLink(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle, link);
923 float fieldInt =
924 m_trackQuery->fieldIntegral(**candidate.extrapolatedTrackLink(), ctx).betweenSpectrometerMeasurements();
925 muon.setParameter(fieldInt, xAOD::Muon::ParamDef::spectrometerFieldIntegral);
926 int nunspoiled = extrapolatedTrack->trackSummary()->get(Trk::numberOfCscUnspoiltEtaHits);
927 acc_nUnspoiledCscHits(muon) = nunspoiled;
928 } else {
929 ATH_MSG_WARNING("failed to create ME track particle for SA muon");
930 }
931 }
932 }
933 }
ToolHandle< Rec::IMuonTrackQuery > m_trackQuery
int get(const SummaryType &type) const
returns the summary information for the passed SummaryType.
const Perigee * perigeeParameters() const
return Perigee.
const Trk::TrackSummary * trackSummary() const
Returns a pointer to the const Trk::TrackSummary owned by this const track (could be nullptr).
@ numberOfCscUnspoiltEtaHits
number of unspoilt CSC eta measurements (all CSC phi measurements are by definition spoilt).

◆ addSegmentTag()

void MuonCombined::MuonCreatorTool::addSegmentTag ( const EventContext & ctx,
xAOD::Muon & muon,
const SegmentTag * tag,
OutputData & outputData ) const
private

Definition at line 676 of file MuonCreatorTool.cxx.

676 {
677 if (!tag) {
678 // init variables if necessary.
679 using enum xAOD::Muon::ParamDef;
680 muon.setParameter(-1.f, segmentDeltaEta);
681 muon.setParameter(-1.f, segmentDeltaPhi);
682 muon.setParameter(-1.f, segmentChi2OverDoF);
683 return;
684 }
685
686 ATH_MSG_DEBUG("Adding Segment Tag Muon " << tag->author() << " type " << tag->type());
687
688 std::vector<ElementLink<xAOD::MuonSegmentContainer>> segments;
689 bool foundseg = false;
690 for (const auto& info : tag->segmentsInfo()) {
691 // this is a bit tricky, as we have here a link to an xAOD segment in the old container
692 // but the new container should have the segments in the same order, plus the MuGirl ones tacked on the end
693 // so we should be able to just make a new link here
694 // note that this only applies to segment-tagged muons, others get their associated segments elsewhere
695 if (muon.author() == xAOD::Muon::Author::MuTagIMO) {
696 ElementLink<xAOD::MuonSegmentContainer> seglink = createMuonSegmentElementLink(ctx, info.segment, outputData);
697 if (seglink.isValid()) segments.push_back(seglink);
698 }
699
700 if (!foundseg) { // add parameters for the first segment
701 muon.setParameter(static_cast<float>(info.dtheta), xAOD::Muon::ParamDef::segmentDeltaEta);
702 muon.setParameter(static_cast<float>(info.dphi), xAOD::Muon::ParamDef::segmentDeltaPhi);
703 muon.setParameter(static_cast<float>(info.segment->fitQuality()->chiSquared() / info.segment->fitQuality()->numberDoF()),
704 xAOD::Muon::ParamDef::segmentChi2OverDoF);
705 foundseg = true;
706 } else if (muon.author() != xAOD::Muon::Author::MuTagIMO)
707 break; // for non-segment-tagged muons, we only need to set the above
708 // parameters
709 }
710 if (muon.author() == xAOD::Muon::Author::MuTagIMO) muon.setMuonSegmentLinks(segments); // set the associated segments
711 }

◆ addStatisticalCombination()

void MuonCombined::MuonCreatorTool::addStatisticalCombination ( const EventContext & ctx,
xAOD::Muon & muon,
const InDetCandidate * candidate,
const StacoTag * tag,
OutputData & outputData ) const
private

Also add this decoration to maintain data-format consistency to the combined track particles (cf. ATLASRECTS-6454)

Definition at line 373 of file MuonCreatorTool.cxx.

374 {
375 static const SG::Accessor<float> acc_d0("d0_staco");
376 static const SG::Accessor<float> acc_z0("z0_staco");
377 static const SG::Accessor<float> acc_phi0("phi0_staco");
378 static const SG::Accessor<float> acc_theta("theta_staco");
379 static const SG::Accessor<float> acc_qOverP("qOverP_staco");
380 static const SG::Accessor<float> acc_qOverPerr("qOverPErr_staco");
381
382 if (!tag) {
383 // init variables if necessary.
384 acc_d0(muon) = -999;
385 acc_z0(muon) = -999;
386 acc_phi0(muon) = -999;
387 acc_theta(muon) = -999;
388 acc_qOverP(muon) = -999;
389 acc_qOverPerr(muon) = -999.;
390 return;
391 }
392
393 ATH_MSG_DEBUG("Adding Staco Muon " << tag->author() << " type " << tag->type());
394
395 if (!muon.trackParticle(xAOD::Muon::TrackParticleType::CombinedTrackParticle)) {
396 // create primary track particle
397 // get summary
398 const Trk::Track* idTrack = candidate->indetTrackParticle().track();
399 const Trk::Track* msTrack = tag->muonCandidate().extrapolatedTrack() ? tag->muonCandidate().extrapolatedTrack()
400 : &tag->muonCandidate().muonSpectrometerTrack();
401
402 const Trk::TrackSummary* idSummary = idTrack ? idTrack->trackSummary() : nullptr;
403 const Trk::TrackSummary* msSummary = msTrack->trackSummary();
404
405 Trk::TrackSummary summary;
406 if (idSummary) summary += *idSummary;
407 if (msSummary) summary += *msSummary;
408
409 Trk::FitQuality fq(tag->matchChi2(), 5);
410 Trk::TrackInfo info(msTrack->info());
411 // todo update patrec bit set adding ID values
412
413 if (outputData.combinedTrackParticleContainer) {
414 xAOD::TrackParticle* tp = m_particleCreator->createParticle(ctx, &tag->combinedParameters(), &fq, &info, &summary, {}, {},
415 xAOD::muon, outputData.combinedTrackParticleContainer);
416 if (!tp) {
417 ATH_MSG_WARNING("Failed to create track particle");
418 } else {
421 std::vector<float> dummy_cov(15, 0.);
422 tp->setTrackParameterCovarianceMatrix(0, dummy_cov);
423
424 ElementLink<xAOD::TrackParticleContainer> link(*outputData.combinedTrackParticleContainer,
425 outputData.combinedTrackParticleContainer->size() - 1);
426 if (link.isValid()) {
427 // link.toPersistent();
428 ATH_MSG_DEBUG("Adding statistical combination: pt " << (*link)->pt() << " eta " << (*link)->eta() << " phi "
429 << (*link)->phi());
430 muon.setTrackParticleLink(xAOD::Muon::TrackParticleType::CombinedTrackParticle, link);
431 }
432 // for the purpose of the truth matching, set the track link to point to
433 // the ID track
434 // tp->setTrackLink(candidate.indetTrackParticle().trackLink());
435 tp->setTrackLink(ElementLink<TrackCollection>());
436 std::bitset<xAOD::NumberOfTrackRecoInfo> pattern;
437 pattern.set(xAOD::STACO);
438 tp->setPatternRecognitionInfo(pattern);
439
440 const xAOD::TrackParticle &id_track_particle = candidate->indetTrackParticle();
441 for (const std::unique_ptr< SG::Accessor<float> > &accessor : m_copyFloatSummaryAccessors ) {
442 if (accessor->isAvailable(id_track_particle)) {
443 (*accessor)( *tp ) = (*accessor)( id_track_particle );
444 }
445 }
446 for (const std::unique_ptr< SG::Accessor<uint8_t> > &accessor : m_copyCharSummaryAccessors ) {
447 if (accessor->isAvailable(id_track_particle)) {
448 (*accessor)( *tp ) = (*accessor)( id_track_particle );
449 }
450 }
451
452 }
453 } // endif outputData.combinedTrackParticleContainer
454 }
455
456 // add muon candidate
457 addMuonCandidate(ctx, tag->muonCandidate(), muon, outputData);
458
459 // Add inner match chi^2
460 muon.setParameter(5, xAOD::Muon::ParamDef::msInnerMatchDOF);
461 muon.setParameter(static_cast<float>(tag->matchChi2()), xAOD::Muon::ParamDef::msInnerMatchChi2);
462
463 // STACO parameters added as auxdata
464 acc_d0(muon) = tag->combinedParameters().parameters()[Trk::d0];
465 acc_z0(muon) = tag->combinedParameters().parameters()[Trk::z0];
466 acc_phi0(muon) = tag->combinedParameters().parameters()[Trk::phi0];
467 acc_theta(muon) = tag->combinedParameters().parameters()[Trk::theta];
468 acc_qOverP(muon) = tag->combinedParameters().parameters()[Trk::qOverP];
469 acc_qOverPerr(muon) = Amg::error(*tag->combinedParameters().covariance(), Trk::qOverP);
470
471 ATH_MSG_DEBUG("Done adding Staco Muon " << tag->author() << " type " << tag->type());
472 }
ToolHandle< Trk::ITrackParticleCreatorTool > m_particleCreator
std::vector< std::unique_ptr< SG::AuxElement::Accessor< float > > > m_copyFloatSummaryAccessors
std::vector< std::unique_ptr< SG::AuxElement::Accessor< uint8_t > > > m_copyCharSummaryAccessors
const TrackInfo & info() const
Returns a const ref to info of a const tracks.
void setTrackParameterCovarianceMatrix(unsigned int index, std::vector< float > &cov)
Set the cov matrix of the parameter at 'index', using a vector of floats.
void setTrackLink(const ElementLink< TrackCollection > &track)
Set the link to the original track.
void setPatternRecognitionInfo(const std::bitset< xAOD::NumberOfTrackRecoInfo > &patternReco)
Method setting the pattern recognition algorithm, using a bitset.
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 ...
@ phi0
Definition ParamDefs.h:65
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
const AccessorWrapper< T > * accessor(xAOD::JetAttribute::AttributeID id)
Returns an attribute accessor corresponding to an AttributeID.
@ STACO
Tracks produced by STACO.

◆ collectCells()

void MuonCombined::MuonCreatorTool::collectCells ( const EventContext & ctx,
xAOD::Muon & muon,
xAOD::CaloClusterContainer * clusterContainer,
const Trk::CaloExtension * inputCaloExt = nullptr ) const
private

Definition at line 1355 of file MuonCreatorTool.cxx.

1356 {
1357 const xAOD::TrackParticle* tp = muon.trackParticle(xAOD::Muon::TrackParticleType::Primary);
1358 if (!tp || !clusterContainer) {
1359 if (!tp) ATH_MSG_WARNING("Can not get primary track.");
1360 return;
1361 }
1362
1363 // get ParticleCellAssociation
1364 ATH_MSG_DEBUG(" Selected track: pt " << tp->pt() << " eta " << tp->eta() << " phi " << tp->phi());
1365
1366 xAOD::CaloCluster* cluster = nullptr;
1367 SG::ReadHandle<CaloCellContainer> container(m_cellContainerName, ctx);
1368
1369 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey, ctx};
1370 const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
1371
1372 if (!inputCaloExt) { // need to make one
1373 // for some reason, ID tracks need to be extrapolated from the ID exit, and
1374 // combined from the perigee
1375 std::unique_ptr<Trk::CaloExtension> caloExtension = m_caloExtTool->caloExtension(ctx, *tp);
1376 if (!caloExtension) {
1377 ATH_MSG_WARNING("Cannot get caloExtension.");
1378 return;
1379 }
1380 if (caloExtension->caloLayerIntersections().empty())
1381 ATH_MSG_DEBUG("Received a caloExtension object without track extrapolation");
1382
1383 cluster = m_cellCollector.collectCells(*caloExtension, caloDDMgr, *container, *clusterContainer);
1384 } else
1385 cluster = m_cellCollector.collectCells(*inputCaloExt, caloDDMgr, *container, *clusterContainer);
1386
1387 if (!cluster) {
1388 ATH_MSG_DEBUG("Failed to create cluster from ParticleCellAssociation");
1389 return;
1390 } else {
1391 ATH_MSG_DEBUG(" New cluster: eta " << cluster->eta() << " phi " << cluster->phi() << " cells " << cluster->size());
1392 }
1393
1394 // create element links
1395 ElementLink<xAOD::CaloClusterContainer> clusterLink(*clusterContainer, cluster->index(), ctx);
1396 muon.setClusterLink(clusterLink);
1397 const CaloNoise* caloNoise = nullptr;
1398 if (!m_caloNoiseKey.empty()) {
1399 SG::ReadCondHandle<CaloNoise> noiseH(m_caloNoiseKey, ctx);
1400 caloNoise = noiseH.cptr();
1401 }
1402 // collect the core energy
1403 std::vector<float> etcore(4, 0);
1404 m_cellCollector.collectEtCore(*cluster, etcore, caloNoise, m_sigmaCaloNoiseCut);
1405
1406 acc_ET_Core(muon) = etcore[Rec::CaloCellCollector::ET_Core];
1407 acc_ET_EMCore(muon) = etcore[Rec::CaloCellCollector::ET_EMCore];
1408 acc_ET_TileCore(muon) = etcore[Rec::CaloCellCollector::ET_TileCore];
1409 acc_ET_HECCore(muon) = etcore[Rec::CaloCellCollector::ET_HECCore];
1410 if (m_caloNoiseKey.empty())
1411 ATH_MSG_DEBUG("NO Tool for calo noise,sigma: " << m_sigmaCaloNoiseCut);
1412 else
1413 ATH_MSG_DEBUG("sigma: " << m_sigmaCaloNoiseCut);
1414
1415 ATH_MSG_DEBUG("Etcore: tot/em/tile/hec "
1416 << etcore[Rec::CaloCellCollector::ET_Core] << "/" << etcore[Rec::CaloCellCollector::ET_EMCore] << "/"
1418 }
ToolHandle< Trk::IParticleCaloExtensionTool > m_caloExtTool
SG::ReadHandleKey< CaloCellContainer > m_cellContainerName
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Gaudi::Property< float > m_sigmaCaloNoiseCut
SG::ReadCondHandleKey< CaloNoise > m_caloNoiseKey
Rec::CaloCellCollector m_cellCollector
virtual double eta() const
The pseudorapidity ( ) of the particle.
size_t size() const
size method (forwarded from CaloClusterCellLink obj)
virtual double phi() const
The azimuthal angle ( ) of the particle.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .).
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
const SG::AuxVectorData * container() const
Return the container holding this element.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ create() [1/3]

xAOD::Muon * MuonCombined::MuonCreatorTool::create ( const EventContext & ctx,
const MuonCandidate & candidate,
OutputData & outputData ) const
finaloverridevirtual

IMuonCreatorTool interface: create a muon from a muon candidate.

Definition at line 162 of file MuonCreatorTool.cxx.

162 {
163 // skip all muons without extrapolated track
164 if (m_requireMSOEforSA && !candidate.extrapolatedTrack()) {
165 ATH_MSG_DEBUG("MuonCreatorTool::create(...) No extrapolated track - aborting. Will not create Muon.");
166 return nullptr; // Do we really want to do this?
167 }
168
169 // Create the xAOD object:
170 xAOD::Muon* muon = outputData.muonContainer->push_back(std::make_unique<xAOD::Muon>());
171 decorateDummyValues(ctx, *muon, outputData);
172
173 muon->setAuthor(xAOD::Muon::Author::MuidSA);
174 muon->setMuonType(xAOD::Muon::MuonType::MuonStandAlone);
175 muon->addAllAuthor(xAOD::Muon::Author::MuidSA);
176
177 // create candidate from SA muon only
178 addMuonCandidate(ctx, candidate, *muon, outputData);
179
180 using TrackParticleType = xAOD::Muon::TrackParticleType;
181 if (m_requireMSOEforSA && !muon->trackParticle(TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle)) {
182 ATH_MSG_DEBUG("Creation of track particle for SA muon failed, removing it");
183 outputData.muonContainer->pop_back();
184 return nullptr;
185 }
186
187 if (!dressMuon(*muon)) {
188 ATH_MSG_WARNING("Failed to dress muon");
189 outputData.muonContainer->pop_back();
190 return nullptr;
191 }
192
193 const xAOD::TrackParticle* track = muon->trackParticle(TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle);
194 if (!track) track = muon->trackParticle(xAOD::Muon::TrackParticleType::Primary);
195 std::unique_ptr<Trk::CaloExtension> caloExtension = m_caloExtTool->caloExtension(ctx, *track);
196 if (m_requireCaloDepositForSA && !caloExtension) {
197 ATH_MSG_DEBUG("failed to get a calo extension for this SA muon, discard it");
198 outputData.muonContainer->pop_back();
199 return nullptr;
200 }
201 if (m_requireCaloDepositForSA && caloExtension->caloLayerIntersections().empty()) {
202 ATH_MSG_DEBUG("failed to retrieve any calo layers for this SA muon, discard it");
203 outputData.muonContainer->pop_back();
204 return nullptr;
205 }
206 // check if there is a cluster container, if yes collect the cells around the
207 // muon and fill Etcore variables for muon
208 if (caloExtension && m_useCaloCells) collectCells(ctx, *muon, outputData.clusterContainer, caloExtension.get());
209
210 return muon;
211 }
Gaudi::Property< bool > m_useCaloCells
bool dressMuon(xAOD::Muon &muon) const
void collectCells(const EventContext &ctx, xAOD::Muon &muon, xAOD::CaloClusterContainer *clusterContainer, const Trk::CaloExtension *inputCaloExt=nullptr) const
Gaudi::Property< bool > m_requireCaloDepositForSA
Gaudi::Property< bool > m_requireMSOEforSA
void decorateDummyValues(const EventContext &ctx, xAOD::Muon &muon, OutputData &outputData) const
De^corated a bunch of dummy values to the muon to ensure data consistency in the xAOD.
Muon_v1 Muon
Reference the current persistent version:

◆ create() [2/3]

void MuonCombined::MuonCreatorTool::create ( const EventContext & ctx,
const MuonCandidateCollection * muonCandidates,
const std::vector< const InDetCandidateToTagMap * > & tagMaps,
OutputData & outputData ) const
finaloverridevirtual

IMuonCreatorTool interface: build muons from ID and MS candidates.

Definition at line 111 of file MuonCreatorTool.cxx.

112 {
113 // Create containers for resolved candidates (always of type VIEW_ELEMENTS)
114 InDetCandidateTagsMap resolvedInDetCandidates;
115 // std::vector<const MuonCombined::InDetCandidate*> resolvedInDetCandidates;
116 std::vector<const MuonCombined::MuonCandidate*> resolvedMuonCandidates;
117
118 // Resolve Overlap
120 resolveOverlaps(ctx, muonCandidates, tagMaps, resolvedInDetCandidates, resolvedMuonCandidates);
121 else{
122 selectStaus(resolvedInDetCandidates, tagMaps);
123 }
124
125 unsigned int numIdCan = resolvedInDetCandidates.size();
126 unsigned int numMuCan = muonCandidates ? muonCandidates->size() : 0;
127 ATH_MSG_DEBUG("Creating xAOD::Muons from: " << numIdCan << " indet candidates and " << numMuCan << " muon candidates ");
128
129 if (!m_buildStauContainer && muonCandidates)
130 ATH_MSG_DEBUG("MuonCandidates : overlap removal " << muonCandidates->size() << " in, " << resolvedMuonCandidates.size()
131 << " out");
132
133 // Create a container for resolved candidates (always of type VIEW_ELEMENTS)
134 for (InDetCandidateTags& can : resolvedInDetCandidates) {
135 ATH_MSG_DEBUG("New InDetCandidate");
136 xAOD::Muon* muon = create(ctx, can, outputData);
137 if (!muon) {
138 ATH_MSG_DEBUG("no muon found");
139 } else {
140 ATH_MSG_DEBUG("muon found");
141 }
142 ATH_MSG_DEBUG("Creation of Muon from InDetCandidates done");
143 }
144 if (!m_requireIDTracks) { // only build SA muons if ID tracks are not required
145 for (const MuonCombined::MuonCandidate* can : resolvedMuonCandidates) {
146 ATH_MSG_DEBUG("New MuonCandidate");
147 create(ctx, *can, outputData);
148 ATH_MSG_DEBUG("Creation of Muon from MuonCandidates done");
149 }
150 }
151
152 if (msgLvl(MSG::DEBUG) || m_printSummary) {
153 ATH_MSG_INFO("Printing muon container:");
154 ATH_MSG_INFO(m_muonPrinter->print(*outputData.muonContainer));
155 ATH_MSG_INFO("Done");
156 }
157 if (msgLvl(MSG::VERBOSE) && outputData.clusterContainer) {
158 ATH_MSG_VERBOSE("Associated clusters : " << outputData.clusterContainer->size());
159 }
160 }
#define ATH_MSG_INFO(x)
size_type size() const noexcept
Returns the number of elements in the collection.
virtual void create(const EventContext &ctx, const MuonCandidateCollection *muonCandidates, const std::vector< const InDetCandidateToTagMap * > &tagMaps, OutputData &outputData) const override final
IMuonCreatorTool interface: build muons from ID and MS candidates.
std::vector< InDetCandidateTags > InDetCandidateTagsMap
ToolHandle< Rec::IMuonPrintingTool > m_muonPrinter
void selectStaus(InDetCandidateTagsMap &resolvedInDetCandidates, const std::vector< const InDetCandidateToTagMap * > &tagMaps) const
void resolveOverlaps(const EventContext &ctx, const MuonCandidateCollection *muonCandidates, const std::vector< const InDetCandidateToTagMap * > &tagMaps, InDetCandidateTagsMap &resolvedInDetCandidates, std::vector< const MuonCombined::MuonCandidate * > &resolvedMuonCandidates) const
Gaudi::Property< bool > m_printSummary
Gaudi::Property< bool > m_buildStauContainer
Gaudi::Property< bool > m_requireIDTracks
In case of running the muon reconstruction with LRT tracks this property removes the overlap of muons...

◆ create() [3/3]

xAOD::Muon * MuonCombined::MuonCreatorTool::create ( const EventContext & ctx,
InDetCandidateTags & candidate,
OutputData & outputData ) const
finaloverridevirtual

IMuonCreatorTool interface: create a muon from a muon candidate.

Definition at line 233 of file MuonCreatorTool.cxx.

233 {
234 // no tags, no muon
235 if (candidate.second.empty()) {
236 ATH_MSG_DEBUG("MuonCreatorTool::create(...) - InDetCandidate with empty combinedDataTags. Aborting. Will not create Muon.");
237 return nullptr;
238 }
239 const std::vector<const TagBase*>& tags = candidate.second;
240 if (tags.size() == 1 && !m_buildStauContainer) {
241 const MuGirlLowBetaTag* muGirlLowBetaTag = dynamic_cast<const MuGirlLowBetaTag*>(tags[0]);
242 if (muGirlLowBetaTag) {
243 ATH_MSG_DEBUG("Track has only a MuGirlLowBetaTag but Staus are not being built, so will not create muon");
244 return nullptr;
245 }
246 }
247
248 // Create the xAOD object:
249 xAOD::Muon* muon = new xAOD::Muon();
250 outputData.muonContainer->push_back(muon);
251 muon->setMuonSegmentLinks(std::vector<ElementLink<xAOD::MuonSegmentContainer>>{});
252
253 // now we need to sort the tags to get the best muon
254
255 // set the link to the ID track particle
256 muon->setTrackParticleLink(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle, candidate.first->indetTrackParticleLink());
257 ATH_MSG_DEBUG("Adding InDet Track: pt " << candidate.first->indetTrackParticle().pt() << " eta "
258 << candidate.first->indetTrackParticle().eta() << " phi "
259 << candidate.first->indetTrackParticle().phi());
260
261 ATH_MSG_DEBUG("creating Muon with " << tags.size() << " tags ");
262 // loop over the tags
263
264 decorateDummyValues(ctx, *muon, outputData);
265 bool first = true;
266 for (const MuonCombined::TagBase* tag : tags) {
267 ATH_MSG_DEBUG("Handling tag: type " << tag->type());
268
269 // staus
271 const MuGirlLowBetaTag* muGirlLowBetaTag = dynamic_cast<const MuGirlLowBetaTag*>(tag);
272
273 if (muGirlLowBetaTag) {
274 ATH_MSG_DEBUG("MuonCreatorTool MuGirlLowBetaTag ");
275
276 muon->setAuthor(tag->author());
277 muon->setMuonType(tag->type());
278
279 if (tag->type() == xAOD::Muon::MuonType::Combined) {
280 ATH_MSG_DEBUG("MuonCreatorTool MuGirlLowBetaTag combined");
281
282 // Create the xAOD object:
283 if (outputData.slowMuonContainer) {
284 xAOD::SlowMuon* slowMuon = outputData.slowMuonContainer->push_back(std::make_unique<xAOD::SlowMuon>());
285
286 addMuGirlLowBeta(ctx, *muon, muGirlLowBetaTag, slowMuon,
287 outputData); // CHECK to see what variables are created here.
288
289 ATH_MSG_DEBUG("slowMuon muonContainer size " << outputData.muonContainer->size());
290 ElementLink<xAOD::MuonContainer> muonLink(*outputData.muonContainer, outputData.muonContainer->size() - 1);
291 if (slowMuon && muonLink.isValid()) {
292 ATH_MSG_DEBUG("slowMuon muonLink valid");
293 slowMuon->setMuonLink(muonLink);
294 }
295 }
296 }
297 }
298 } else {
299 // Don't want staus in muon branch
300 const MuGirlLowBetaTag* muGirlLowBetaTag = dynamic_cast<const MuGirlLowBetaTag*>(tag);
301 if (muGirlLowBetaTag) continue;
302
303 // set author info
304 if (first) {
305 ATH_MSG_DEBUG("MuonCreatorTool first muon tag: author=" << tag->author() << " type=" << tag->type());
306 muon->setAuthor(tag->author());
307 muon->setMuonType(tag->type());
308 // Overrride type if InDet track is SiAssociated.
309 if (candidate.first->isSiliconAssociated()) {
310 muon->setMuonType(xAOD::Muon::MuonType::SiliconAssociatedForwardMuon);
311 }
312 first = false;
313 }
314
315 muon->addAllAuthor(tag->author());
316
317 // this is not too elegant, maybe rethink implementation
318 xAOD::Muon::MuonType type = tag->type();
319 if (type == xAOD::Muon::MuonType::Combined) {
320 // work out type of tag
321 const CombinedFitTag* cbFitTag = dynamic_cast<const CombinedFitTag*>(tag);
322 const StacoTag* stacoTag = dynamic_cast<const StacoTag*>(tag);
323 const MuGirlTag* muGirlTag = dynamic_cast<const MuGirlTag*>(tag);
324
325 addCombinedFit(ctx, *muon, cbFitTag, outputData);
326 addMuGirl(ctx, *muon, muGirlTag, outputData);
327 addStatisticalCombination(ctx, *muon, candidate.first, stacoTag, outputData);
328 if (!(cbFitTag || stacoTag || muGirlTag)) { ATH_MSG_WARNING("Unknown combined tag "); }
329
330 } else if (type == xAOD::Muon::MuonType::SegmentTagged) {
331 const SegmentTag* segTag = dynamic_cast<const SegmentTag*>(tag);
332 const MuGirlTag* muGirlTag = dynamic_cast<const MuGirlTag*>(tag);
333
334 addSegmentTag(ctx, *muon, segTag, outputData);
335 addMuGirl(ctx, *muon, muGirlTag, outputData);
336
337 if (!(segTag || muGirlTag)) { ATH_MSG_WARNING("Unknown segment-tagged tag "); }
338 } else if (type == xAOD::Muon::MuonType::CaloTagged) {
339 const CaloTag* caloTag = dynamic_cast<const CaloTag*>(tag);
340 addCaloTag(*muon, caloTag);
341 if (!caloTag) { ATH_MSG_WARNING("Unknown calo tag type "); }
342 } else {
343 ATH_MSG_WARNING("Unknown tag type. Type= "<<type);
344 }
345 }
346 } // m_buildStauContainer
347
348 if (!dressMuon(*muon)) {
349 ATH_MSG_WARNING("Failed to dress muon");
350 outputData.muonContainer->pop_back();
351 // if we are dealing with staus, also need to remove the slowMuon
352 if (m_buildStauContainer) outputData.slowMuonContainer->pop_back();
353 return nullptr;
354 }
355
356 // If eLoss is not already available then build it
357 float eLoss = -1;
358 bool haveEloss = muon->parameter(eLoss, xAOD::Muon::ParamDef::EnergyLoss);
359 if (!haveEloss || eLoss == 0) {
360 ATH_MSG_DEBUG("Adding Energy Loss to muon" << std::endl << m_muonPrinter->print(*muon));
361 addEnergyLossToMuon(*muon);
362 }
363
364 // check if there is a cluster container, if yes collect the cells around the
365 // muon and fill Etcore variables for muon
366 if (m_useCaloCells) collectCells(ctx, *muon, outputData.clusterContainer, candidate.first->getCaloExtension());
367
368 ATH_MSG_DEBUG("Done creating muon with " << acc_nUnspoiledCscHits(*muon) << " unspoiled csc hits");
369
370 return muon;
371 }
void addCaloTag(xAOD::Muon &muon, const CaloTag *tag) const
void addSegmentTag(const EventContext &ctx, xAOD::Muon &muon, const SegmentTag *tag, OutputData &outputData) const
void addMuGirlLowBeta(const EventContext &ctx, xAOD::Muon &muon, const MuGirlLowBetaTag *tag, xAOD::SlowMuon *slowMuon, OutputData &outputData) const
void addEnergyLossToMuon(xAOD::Muon &muon) const
void addCombinedFit(const EventContext &ctx, xAOD::Muon &muon, const CombinedFitTag *tag, OutputData &outputData) const
void addMuGirl(const EventContext &ctx, xAOD::Muon &muon, const MuGirlTag *tag, OutputData &outputData) const
void addStatisticalCombination(const EventContext &ctx, xAOD::Muon &muon, const InDetCandidate *candidate, const StacoTag *tag, OutputData &outputData) const
void setMuonLink(const ElementLink< MuonContainer > &muonLink)
Sets.
std::vector< std::string > tags
Definition hcg.cxx:107
bool first
Definition DeMoScan.py:534
SlowMuon_v1 SlowMuon
Reference the current persistent version:
Definition SlowMuon.h:13

◆ createDummyTrack()

std::unique_ptr< Trk::Track > MuonCombined::MuonCreatorTool::createDummyTrack ( const EventContext & ctx,
const std::vector< const Muon::MuonSegment * > & segments,
const Trk::Track & indetTrack ) const
private

Definition at line 1156 of file MuonCreatorTool.cxx.

1158 {
1159 ATH_MSG_VERBOSE("Creating dummy tracks from segments...");
1160
1161 auto trackStateOnSurfaces = std::make_unique<Trk::TrackStates>();
1162
1163 for (const Muon::MuonSegment* seg : segments) {
1164 // create pars for muon and loop over hits
1165 double momentum{1e8}, charge{0.};
1166 std::unique_ptr<const Trk::TrackParameters> pars{m_edmHelperSvc->createTrackParameters(*seg, momentum, charge)};
1167 for (const Trk::MeasurementBase* meas : seg->containedMeasurements()) {
1168 std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern(0);
1170 // TSoS takes ownership
1171 std::unique_ptr<Trk::TrackParameters> exPars{m_propagator->propagateParameters(
1172 ctx, *pars, meas->associatedSurface(), Trk::anyDirection, false, Trk::MagneticFieldProperties(Trk::NoField))};
1173 if (!exPars) { ATH_MSG_VERBOSE("Could not propagate Track to segment surface"); }
1174 Trk::TrackStateOnSurface* trackState =
1175 new Trk::TrackStateOnSurface(meas->uniqueClone(), std::move(exPars), nullptr, typePattern);
1176 trackStateOnSurfaces->push_back(trackState);
1177 } // end segment loop
1178 }
1179
1180 Trk::TrackInfo info(Trk::TrackInfo::Unknown, Trk::muon);
1182 info.setPatternRecognitionInfo(author);
1183 std::unique_ptr<Trk::Track> newtrack =
1184 std::make_unique<Trk::Track>(info, std::move(trackStateOnSurfaces), (indetTrack.fitQuality())->uniqueClone());
1185
1186 // create a track summary for this track
1187 if (m_trackSummaryTool.isEnabled()) { m_trackSummaryTool->computeAndReplaceTrackSummary(ctx, *newtrack, false); }
1188
1189 return newtrack;
1190 }
double charge(const T &p)
Definition AtlasPID.h:997
ToolHandle< Trk::IPropagator > m_propagator
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
ToolHandle< Trk::IExtendedTrackSummaryTool > m_trackSummaryTool
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
const FitQuality * fitQuality() const
return a pointer to the fit quality const-overload
@ anyDirection
@ NoField
Field is set to 0., 0., 0.,.

◆ createMuonSegmentElementLink()

ElementLink< xAOD::MuonSegmentContainer > MuonCombined::MuonCreatorTool::createMuonSegmentElementLink ( const EventContext & ctx,
const Muon::MuonSegment * segLink,
const OutputData & outData ) const
private

Definition at line 774 of file MuonCreatorTool.cxx.

776 {
777 if (outData.xaodSegmentContainer && outData.tagToSegmentAssocMap) {
778 // if a muon segment collection is provided, duplicate the segment and
779 // create a link to that
780 unsigned int link = outData.tagToSegmentAssocMap->linkIndex(trkSeg);
781 if (link >= outData.xaodSegmentContainer->size()) {
782 ATH_MSG_WARNING("Failed to retrieve a proper link for segment " << m_printer->print(*trkSeg));
783 return {};
784 }
785 ElementLink<xAOD::MuonSegmentContainer> eleLink{*outData.xaodSegmentContainer, link, ctx};
786 return eleLink;
787 }
788 return ElementLink<xAOD::MuonSegmentContainer>();
789 }
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer

◆ createTrackParticleElementLink()

ElementLink< xAOD::TrackParticleContainer > MuonCombined::MuonCreatorTool::createTrackParticleElementLink ( const EventContext & ctx,
const ElementLink< TrackCollection > & trackLink,
xAOD::TrackParticleContainer & trackParticleContainer,
TrackCollection * trackCollection = 0 ) const
private

function creates an element link to a track particle from the track and the TrackParticle collection.

if a TrackCollection is also provided, the element link to the track will also be set takes ownership of the track

Definition at line 747 of file MuonCreatorTool.cxx.

750 {
751 ATH_MSG_DEBUG("createTrackParticleElementLink");
752 xAOD::TrackParticle* tp = nullptr;
753 if (trackCollection) {
754 trackCollection->push_back(new Trk::Track(**trackLink));
755 // want to link the track particle to this track
756 ElementLink<TrackCollection> link(*trackCollection, trackCollection->size() - 1);
757 if (link.isValid())
758 tp = m_particleCreator->createParticle(ctx, link, &trackParticleContainer, nullptr, xAOD::muon);
759 else
760 ATH_MSG_WARNING("new Track Collection link invalid");
761 }
762 if (!tp) {
763 // create track particle without a link to the track
764 tp = m_particleCreator->createParticle(ctx, **trackLink, &trackParticleContainer, nullptr, xAOD::muon);
765 }
766
767 if (tp) {
768 ElementLink<xAOD::TrackParticleContainer> link(trackParticleContainer, trackParticleContainer.size() - 1);
769 return link;
770 }
771 return ElementLink<xAOD::TrackParticleContainer>();
772 }
value_type push_back(value_type pElem)
Add an element to the end of the collection.

◆ decorateDummyValues()

void MuonCombined::MuonCreatorTool::decorateDummyValues ( const EventContext & ctx,
xAOD::Muon & muon,
OutputData & outputData ) const
private

De^corated a bunch of dummy values to the muon to ensure data consistency in the xAOD.

Unspoiled CSC hits

Definition at line 213 of file MuonCreatorTool.cxx.

213 {
214 // Set variables to zero by calling the functions with null pointers.
215 addCaloTag(muon, nullptr);
216 addCombinedFit(ctx, muon, nullptr, outputData);
217 addStatisticalCombination(ctx, muon, nullptr, nullptr, outputData);
218 addMuGirl(ctx, muon, nullptr, outputData);
219 addSegmentTag(ctx, muon, nullptr, outputData);
220
222 acc_nUnspoiledCscHits(muon) = 0;
223 acc_MuonSpectrometerPt(muon) = -1;
224 acc_InnerDetectorPt(muon) = -1;
225
226 acc_ET_Core(muon) = 0;
227 acc_ET_EMCore(muon) = 0;
228 acc_ET_TileCore(muon) = 0;
229 acc_ET_HECCore(muon) = 0;
230
231 fillEnergyLossFromTrack(muon, nullptr);
232 }

◆ dressMuon()

bool MuonCombined::MuonCreatorTool::dressMuon ( xAOD::Muon & muon) const
private

Definition at line 1192 of file MuonCreatorTool.cxx.

1192 {
1193 const xAOD::TrackParticle* primary = muon.trackParticle(xAOD::Muon::TrackParticleType::Primary);
1194 // update parameters with primary track particle
1195 setP4(muon, *primary);
1196 const float qOverP = primary->qOverP();
1197 if (qOverP != 0.0) {
1198 muon.setCharge(qOverP > 0 ? 1. : -1.);
1199 } else {
1200 ATH_MSG_WARNING("MuonCreatorTool::dressMuon - trying to set qOverP, but value from muon.primaryTrackParticle ["
1201 << "] is zero. Setting charge=0.0. The eta/phi of the muon is: " << muon.eta() << " / " << muon.phi());
1202 muon.setCharge(0.0);
1203 }
1204
1205 // add hit summary
1206 m_muonDressingTool->addMuonHitSummary(muon);
1207
1208 // calculate scattering significance and momentum balance significance
1209 if (!m_scatteringAngleTool.empty()) {
1210 Rec::ScatteringAngleSignificance scatSign = m_scatteringAngleTool->scatteringAngleSignificance(muon);
1211 float curvatureSignificance = scatSign.curvatureSignificance();
1212 muon.setParameter(curvatureSignificance, xAOD::Muon::ParamDef::scatteringCurvatureSignificance);
1213 float neighbourSignificance = scatSign.neighbourSignificance();
1214 muon.setParameter(neighbourSignificance, xAOD::Muon::ParamDef::scatteringNeighbourSignificance);
1215 ATH_MSG_VERBOSE("Got curvatureSignificance " << curvatureSignificance << " and neighbourSignificance "
1216 << neighbourSignificance);
1217 }
1218
1219 if (!m_momentumBalanceTool.empty()) {
1220 float momentumBalanceSignificance = m_momentumBalanceTool->momentumBalanceSignificance(muon);
1221 muon.setParameter(momentumBalanceSignificance, xAOD::Muon::ParamDef::momentumBalanceSignificance);
1222 ATH_MSG_VERBOSE("Got momentumBalanceSignificance " << momentumBalanceSignificance);
1223 }
1224
1225 if (!m_meanMDTdADCTool.empty()) {
1226 float meanDeltaADC = float(m_meanMDTdADCTool->meanMDTdADCFiller(muon));
1227 muon.setParameter(meanDeltaADC, xAOD::Muon::ParamDef::meanDeltaADCCountsMDT);
1228 ATH_MSG_VERBOSE("Got meanDeltaADCCountsMDT " << meanDeltaADC);
1229 }
1230
1231 if (!m_selectorTool.empty()) {
1232 acc_MuonSpectrometerPt(muon) = muon.pt();
1233 acc_InnerDetectorPt(muon) = muon.pt();
1234 // set id cuts
1235 m_selectorTool->setPassesIDCuts(muon);
1236 ATH_MSG_VERBOSE("Setting passesIDCuts " << muon.passesIDCuts());
1237 // set quality
1238 m_selectorTool->setQuality(muon);
1239 ATH_MSG_VERBOSE("Setting Quality " << muon.quality());
1240 }
1241
1243 const Trk::Track* trk = nullptr;
1244 if (muon.trackParticle(xAOD::Muon::TrackParticleType::CombinedTrackParticle)) {
1245 trk = muon.trackParticle(xAOD::Muon::TrackParticleType::CombinedTrackParticle)->track();
1246 }
1247 if (!trk && muon.trackParticle(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle)) {
1248 trk = muon.trackParticle(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle)->track();
1249 }
1250 if (trk) {
1252 } else {
1253 fillEnergyLossFromTrack(muon, nullptr); // Just fill empty variables.
1254 ATH_MSG_VERBOSE("Couldn't find matching track which might have energy loss.");
1255 }
1256 }
1257 return true;
1258 }
const PtrVector & stdcont() const
Return the underlying std::vector of the container.
void setP4(xAOD::Muon &muon, const xAOD::TrackParticle &tp) const
ToolHandle< Rec::IMuonScatteringAngleSignificance > m_scatteringAngleTool
ToolHandle< xAOD::IMuonDressingTool > m_muonDressingTool
ToolHandle< CP::IMuonSelectionTool > m_selectorTool
ToolHandle< Rec::IMuonMomentumBalanceSignificance > m_momentumBalanceTool
Gaudi::Property< bool > m_fillEnergyLossFromTrack
ToolHandle< Rec::IMuonMeanMDTdADCFiller > m_meanMDTdADCTool
double curvatureSignificance(void) const
ScatteringAngleSignificance inline accessor: significance of maximum curvature discontinuity.
double neighbourSignificance(void) const
ScatteringAngleSignificance inline accessor: maximum significance of neighbouring scatterers.
@ qOverP
perigee

◆ fillEnergyLossFromTrack()

void MuonCombined::MuonCreatorTool::fillEnergyLossFromTrack ( xAOD::Muon & muon,
const std::vector< const Trk::TrackStateOnSurface * > * tsosVector ) const
private

Definition at line 1306 of file MuonCreatorTool.cxx.

1306 {
1307 // Ensure these are set for every muon
1308 if (!tsosVector) {
1309 using enum xAOD::Muon::ParamDef;
1310 muon.setParameter(0.f, EnergyLoss);
1311 muon.setParameter(0.f, ParamEnergyLoss);
1312 muon.setParameter(0.f, MeasEnergyLoss);
1313 muon.setParameter(0.f, EnergyLossSigma);
1314 muon.setParameter(0.f, MeasEnergyLossSigma);
1315 muon.setParameter(0.f, ParamEnergyLossSigmaPlus);
1316 muon.setParameter(0.f, ParamEnergyLossSigmaMinus);
1317 muon.setParameter(0.f, FSR_CandidateEnergy);
1318
1319 muon.setEnergyLossType(xAOD::Muon::EnergyLossType::Parametrized); // Not so nice! Add 'unknown' type?
1320 if (m_fillExtraELossInfo) acc_numEnergyLossPerTrack(muon) = 0;
1321
1322 return;
1323 }
1324
1325 unsigned int numEnergyLossPerTrack = 0;
1326 bool problem = false;
1327 for (const auto* tsos : *tsosVector) {
1328 const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(tsos->materialEffectsOnTrack());
1329 if (!meot) continue;
1330 const Trk::EnergyLoss* el = meot->energyLoss();
1331 const CaloEnergy* caloEnergy = dynamic_cast<const CaloEnergy*>(el);
1332 if (!caloEnergy) continue;
1333 ++numEnergyLossPerTrack;
1334 using enum xAOD::Muon::ParamDef;
1335
1336 muon.setParameter(static_cast<float>(caloEnergy->deltaE()), EnergyLoss);
1337 muon.setParameter(static_cast<float>(caloEnergy->deltaEParam()), ParamEnergyLoss);
1338 muon.setParameter(static_cast<float>(caloEnergy->deltaEMeas()), MeasEnergyLoss);
1339 muon.setParameter(static_cast<float>(caloEnergy->sigmaDeltaE()), EnergyLossSigma);
1340 muon.setParameter(static_cast<float>(caloEnergy->sigmaDeltaEMeas()), MeasEnergyLossSigma);
1341 muon.setParameter(static_cast<float>(caloEnergy->sigmaPlusDeltaEParam()), ParamEnergyLossSigmaPlus);
1342 muon.setParameter(static_cast<float>(caloEnergy->sigmaMinusDeltaEParam()), ParamEnergyLossSigmaMinus);
1343
1344 muon.setEnergyLossType(static_cast<xAOD::Muon::EnergyLossType>(caloEnergy->energyLossType()));
1345 muon.setParameter(static_cast<float>(caloEnergy->fsrCandidateEnergy()), FSR_CandidateEnergy);
1346 }
1347 if (numEnergyLossPerTrack > 1) {
1348 ATH_MSG_VERBOSE("More than one e loss per track... ");
1349 problem = true;
1350 }
1351 if (m_fillExtraELossInfo) acc_numEnergyLossPerTrack(muon) = numEnergyLossPerTrack;
1352 if (problem) ATH_MSG_VERBOSE("Dumping problematic muon: " << m_muonPrinter->print(muon));
1353 }
CaloEnergy::EnergyLossType energyLossType(void) const
Accessor methods.
Definition CaloEnergy.h:162
double sigmaMinusDeltaEParam() const
get parametrised energy loss minus error
Definition CaloEnergy.h:140
double deltaEMeas() const
get measured energy loss
Definition CaloEnergy.h:127
double sigmaDeltaEMeas() const
get measured energy loss error
Definition CaloEnergy.h:130
double deltaEParam() const
get parametrised energy loss
Definition CaloEnergy.h:137
double sigmaPlusDeltaEParam() const
get parametrised energy loss plus error
Definition CaloEnergy.h:143
float fsrCandidateEnergy() const
FSR Candidate Energy.
Definition CaloEnergy.h:94
double sigmaDeltaE() const
returns the symmatric error
double deltaE() const
returns the
const EnergyLoss * energyLoss() const
returns the energy loss object.

◆ initialize()

StatusCode MuonCombined::MuonCreatorTool::initialize ( )
finaloverridevirtual

Definition at line 56 of file MuonCreatorTool.cxx.

56 {
57 if (m_buildStauContainer) ATH_MSG_DEBUG(" building Stau container ");
58
59 ATH_CHECK(m_idHelperSvc.retrieve());
60 ATH_CHECK(m_printer.retrieve());
61 ATH_CHECK(m_muonPrinter.retrieve());
62 ATH_CHECK(m_caloExtTool.retrieve());
63 ATH_CHECK(m_edmHelperSvc.retrieve());
64 ATH_CHECK(m_particleCreator.retrieve());
66 ATH_CHECK(m_muonDressingTool.retrieve());
67 ATH_CHECK(m_caloMgrKey.initialize());
68 ATH_CHECK(m_trackQuery.retrieve());
69 if (!m_momentumBalanceTool.empty())
71 else
72 m_momentumBalanceTool.disable();
73 if (!m_scatteringAngleTool.empty())
75 else
76 m_scatteringAngleTool.disable();
77 if (!m_selectorTool.empty())
78 ATH_CHECK(m_selectorTool.retrieve());
79 else
80 m_selectorTool.disable();
81 if (!m_meanMDTdADCTool.empty())
82 ATH_CHECK(m_meanMDTdADCTool.retrieve());
83 else
84 m_meanMDTdADCTool.disable();
85
87
88 ATH_MSG_INFO("ET_Core calculation: doNoiseCut, sigma - " << !m_caloNoiseKey.empty() << " " << m_sigmaCaloNoiseCut);
89
90 if (!m_doSA) {
92 ATH_CHECK(m_propagator.retrieve());
93 } else {
94 m_caloMaterialProvider.disable();
95 m_propagator.disable();
96 }
98 ATH_CHECK(m_trackSummaryTool.retrieve());
99
101 for (const std::string &a_key : m_copyFloatSummaryKeys ) {
102 m_copyFloatSummaryAccessors.push_back(std::make_unique< SG::Accessor<float> >(a_key));
103 }
105 for (const std::string &a_key : m_copyCharSummaryKeys ) {
106 m_copyCharSummaryAccessors.push_back(std::make_unique< SG::Accessor<uint8_t> >(a_key));
107 }
108
109 return StatusCode::SUCCESS;
110 }
#define ATH_CHECK
Evaluate an expression and check for errors.
ToolHandle< Trk::ITrackAmbiguityProcessorTool > m_ambiguityProcessor
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Gaudi::Property< std::vector< std::string > > m_copyCharSummaryKeys
Gaudi::Property< std::vector< std::string > > m_copyFloatSummaryKeys
Gaudi::Property< bool > m_doSA

◆ resolveOverlaps()

void MuonCombined::MuonCreatorTool::resolveOverlaps ( const EventContext & ctx,
const MuonCandidateCollection * muonCandidates,
const std::vector< const InDetCandidateToTagMap * > & tagMaps,
InDetCandidateTagsMap & resolvedInDetCandidates,
std::vector< const MuonCombined::MuonCandidate * > & resolvedMuonCandidates ) const
private

Find all InDetCandidate – Combined tag combinations Be aware that different InDetCandidateMaps could have different InDetCandidate objects but the underlying tracks are always the same

Check whether the author arises from the comissioning chain The maps are filled in dedicated algorithim. So all tags will fail / satisfy this condition

Add the track for the ambiguity reprocessing

Create firs the dummy track

Add it to the list piped to ambiguity solving

Move the candidate into the map to find the resolved tracks

In principle we can include here STACO as well but that is lower ranked as MuidSA

Definition at line 963 of file MuonCreatorTool.cxx.

966 {
967 resolvedMuonCandidates.clear();
968 resolvedInDetCandidates.clear();
969
970 std::unique_ptr<const TrackCollection> resolvedTracks;
971 std::vector<std::unique_ptr<Trk::Track>> garbage_collection;
972
976 InDetCandidateTagsMap inDetCandidateMap;
977 for (const InDetCandidateToTagMap* tag_map : tagMaps) {
978 if (!tag_map) continue;
979 for (const auto& comb_tag : *tag_map) {
980 const TagBase* tag = comb_tag.second.get();
984 InDetCandidateTagsMap::iterator itr =
985 std::find_if(inDetCandidateMap.begin(), inDetCandidateMap.end(),
986 [&comb_tag](const InDetCandidateTags& to_test) { return (*to_test.first) == (*comb_tag.first); });
987 if (itr != inDetCandidateMap.end())
988 itr->second.emplace_back(tag);
989 else
990 inDetCandidateMap.emplace_back(std::make_pair(comb_tag.first, std::vector<const TagBase*>{tag}));
991 }
992 }
993
994 // Each InDetCandidate corresponds to a different ID track.
995 // Resolve overlap among InDetCandidates for cases where different
996 // ID tracks are tagged by the same MS info (track or segment)
997 if (!inDetCandidateMap.empty()) {
998 // the muons only found by the calo tagger should always be kept so we can
999 // filter them out from the start
1000 InDetCandidateTagsMap caloMuons;
1001
1002 // first loop over ID candidates and select all candidates that have a tag
1003 resolvedInDetCandidates.reserve(inDetCandidateMap.size());
1004 caloMuons.reserve(inDetCandidateMap.size());
1005 for (InDetCandidateTags& comb_tag : inDetCandidateMap) {
1006 std::stable_sort(comb_tag.second.begin(), comb_tag.second.end(), SortTagBasePtr());
1007 if (comb_tag.second.size() == 1 && comb_tag.second.front()->type() == xAOD::Muon::MuonType::CaloTagged) {
1008 caloMuons.emplace_back(std::move(comb_tag));
1009 } else
1010 resolvedInDetCandidates.emplace_back(std::move(comb_tag));
1011 }
1012 inDetCandidateMap.clear();
1013 // now sort the selected ID candidates
1014 std::stable_sort(resolvedInDetCandidates.begin(), resolvedInDetCandidates.end(), SortInDetCandidates());
1015 if (msgLvl(MSG::DEBUG)) {
1016 ATH_MSG_DEBUG("Found " << resolvedInDetCandidates.size() << " inner detector tags in event "
1017 << ctx.eventID().event_number());
1018 for (const InDetCandidateTags& candidate : resolvedInDetCandidates) {
1019 std::stringstream tags;
1020 for (const TagBase* tag : candidate.second) tags << " " << tag->toString();
1021 ATH_MSG_DEBUG("ID candidate: " << candidate.first->toString() << " " << tags.str());
1022 }
1023 }
1024
1025 ConstDataVector<TrackCollection> to_resolve{SG::VIEW_ELEMENTS};
1026
1027 to_resolve.reserve(resolvedInDetCandidates.size());
1028 garbage_collection.reserve(resolvedInDetCandidates.size());
1029
1030 // a dummy track for segment tagged candidates to be used in the overlap
1031 // check
1032 std::map<const Trk::Track*, InDetCandidateTags> trackInDetCandLinks;
1033
1034 for (InDetCandidateTags& candidate : resolvedInDetCandidates) {
1035 // retrieve the primary tag
1036 const TagBase* primaryTag = candidate.second[0];
1037
1038 // check if a track is available
1039 if (primaryTag->primaryTrack()) {
1041 to_resolve.push_back(primaryTag->primaryTrack());
1042 // create a track summary for this track
1043 trackInDetCandLinks[to_resolve.back()] = std::move(candidate);
1044 }
1045 // if not, make a dummy track out of segments, muonTracks takes ownership
1046 // of the memory
1047 else {
1048 std::vector<const Muon::MuonSegment*> segments = primaryTag->associatedSegments();
1049 if (!segments.empty()) {
1051 garbage_collection.emplace_back(
1052 createDummyTrack(ctx, primaryTag->associatedSegments(), *(candidate.first->indetTrackParticle().track())));
1054 to_resolve.push_back(garbage_collection.back().get());
1056 trackInDetCandLinks[garbage_collection.back().get()] = std::move(candidate);
1057 }
1058 }
1059 }
1060 resolvedInDetCandidates.clear();
1061
1062 // Resolve ambiguity between muon tracks
1063 resolvedTracks.reset(m_ambiguityProcessor->process(ctx, to_resolve.asDataVector()));
1064
1065 // link back to InDet candidates and fill the resolved container
1066 for (const Trk::Track* track : *resolvedTracks) {
1067 std::map<const Trk::Track*, InDetCandidateTags>::iterator trackCandLink = trackInDetCandLinks.find(track);
1068 if (trackCandLink == trackInDetCandLinks.end()) {
1069 ATH_MSG_WARNING("Unable to find internal link between MS track and ID candidate!");
1070 continue;
1071 }
1072 resolvedInDetCandidates.push_back(std::move(trackCandLink->second));
1073 }
1074
1075 // print-out
1076 if (msgLvl(MSG::VERBOSE)) {
1077 ATH_MSG_DEBUG("ID candidates after ambiguity solving "
1078 << resolvedInDetCandidates.size() << " trackCandLinks: " << trackInDetCandLinks.size()
1079 << " to_resolve: " << to_resolve.size() << " resolvedTracks: " << resolvedTracks->size());
1080 for (const InDetCandidateTags& candidate : resolvedInDetCandidates) {
1081 ATH_MSG_DEBUG("ID candidate: " << candidate.first->toString() << " " << candidate.second[0]->toString());
1082 }
1083 ATH_MSG_DEBUG("Calo muons after ambiguity solving: ");
1084 for (const InDetCandidateTags& candidate : caloMuons) {
1085 ATH_MSG_DEBUG("ID candidate: " << candidate.first->toString() << " " << candidate.second[0]->toString());
1086 }
1087 }
1088 // add muons only found by calo tagger
1089 resolvedInDetCandidates.insert(resolvedInDetCandidates.end(), caloMuons.begin(), caloMuons.end());
1090
1091 // now sort the selected ID candidates
1092 std::stable_sort(resolvedInDetCandidates.begin(), resolvedInDetCandidates.end(),
1093 [](const InDetCandidateTags& a, const InDetCandidateTags& b) {
1094 return a.first->indetTrackParticle().pt() > b.first->indetTrackParticle().pt();
1095 });
1096 }
1097
1098 // MuonCandidateCollection contains all muon tracks (SA extrapolated or not)
1099 // Resolve overlap with InDetCandidate collection
1100 if (!muonCandidates) { return; }
1101
1102 if (msgLvl(MSG::DEBUG)) {
1103 ATH_MSG_DEBUG("Muon candidates: " << muonCandidates->size());
1104 for (const MuonCandidate* candidate : *muonCandidates) { ATH_MSG_DEBUG("Muon candidate: " << candidate->toString()); }
1105 }
1106
1107 ConstDataVector<TrackCollection> resolvedTracks2{SG::VIEW_ELEMENTS};
1108 if (resolvedTracks) { resolvedTracks2.assign(resolvedTracks->begin(), resolvedTracks->end()); }
1109 // Keep track of the MuonCandidates used by MuidCo
1110 std::set<const MuonCandidate*> used_candidates;
1111 for (const InDetCandidateTags& indet_cand : resolvedInDetCandidates) {
1112 for (const TagBase* tag : indet_cand.second) {
1114 if (tag->author() == xAOD::Muon::Author::MuidCo) {
1115 const CombinedFitTag* cmb_tag = dynamic_cast<const CombinedFitTag*>(tag);
1116 used_candidates.insert(&cmb_tag->muonCandidate());
1117 } else if (tag->author() == xAOD::Muon::Author::STACO && indet_cand.second[0] == tag) {
1118 const StacoTag* staco_tag = dynamic_cast<const StacoTag*>(tag);
1119 used_candidates.insert(&staco_tag->muonCandidate());
1120 }
1121 }
1122 }
1123
1124 // add MS tracks to resolvedTrack collection and store a link between tracks
1125 // and muon candidates
1126 std::map<const Trk::Track*, const MuonCandidate*> trackMuonCandLinks;
1127 for (const MuonCandidate* candidate : *muonCandidates) {
1128 const Trk::Track* track = candidate->primaryTrack();
1129 if (used_candidates.count(candidate)) {
1130 ATH_MSG_DEBUG("Duplicate MS track " << m_printer->print(*track));
1131 continue;
1132 }
1133 used_candidates.insert(candidate);
1134 resolvedTracks2.push_back(track); // VIEW_ELEMENTS, pointer only
1135 trackMuonCandLinks[track] = candidate;
1136 }
1137
1138 // solve ambiguity
1139 resolvedTracks.reset(m_ambiguityProcessor->process(ctx, resolvedTracks2.asDataVector()));
1140
1141 // loop over resolved tracks and fill resolved muon candidates
1142 for (const Trk::Track* track : *resolvedTracks) {
1143 auto trackCandLink = trackMuonCandLinks.find(track);
1144 if (trackCandLink != trackMuonCandLinks.end()) resolvedMuonCandidates.push_back(trackCandLink->second);
1145 }
1146
1147 // print-out
1148 if (msgLvl(MSG::DEBUG)) {
1149 ATH_MSG_DEBUG("Muon candidates: " << muonCandidates->size() << " after ambiguity solving " << resolvedMuonCandidates.size());
1150 for (const MuonCandidate* candidate : resolvedMuonCandidates) {
1151 msg(MSG::DEBUG) << "Muon candidate: " << candidate->toString() << endmsg;
1152 }
1153 }
1154 }
#define endmsg
static Double_t a
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ElementProxy back()
Access the last element in the collection as an lvalue.
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
void assign(InputIterator first, InputIterator last)
Assign from iterators.
std::unique_ptr< Trk::Track > createDummyTrack(const EventContext &ctx, const std::vector< const Muon::MuonSegment * > &segments, const Trk::Track &indetTrack) const
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
void stable_sort(DataModel_detail::iterator< DVL > beg, DataModel_detail::iterator< DVL > end)
Specialization of stable_sort for DataVector/List.
MsgStream & msg
Definition testRead.cxx:32

◆ selectStaus()

void MuonCombined::MuonCreatorTool::selectStaus ( InDetCandidateTagsMap & resolvedInDetCandidates,
const std::vector< const InDetCandidateToTagMap * > & tagMaps ) const
private

Definition at line 935 of file MuonCreatorTool.cxx.

936 {
937 resolvedInDetCandidates.clear();
938 for (const InDetCandidateToTagMap* tag_map : tagMaps) {
939 if (!tag_map) continue;
940 for (const auto& combined_tag : *tag_map) {
941 const TagBase* tag = combined_tag.second.get();
942 const MuGirlLowBetaTag* muGirlLowBetaTag = dynamic_cast<const MuGirlLowBetaTag*>(tag);
943 if (muGirlLowBetaTag) { resolvedInDetCandidates.emplace_back(combined_tag.first, std::vector<const TagBase*>{tag}); }
944 }
945 break;
946 }
947 // print-out
948 if (msgLvl(MSG::DEBUG)) {
949 ATH_MSG_DEBUG("ID candidates: " << tagMaps.size() << " after stau selection " << resolvedInDetCandidates.size());
950 for (const InDetCandidateTags& candidate : resolvedInDetCandidates) {
951 msg(MSG::DEBUG) << "ID candidate staus: " << candidate.first->toString() << endmsg;
952 }
953 }
954
955 // tag_map above is keyed on a pointer.
956 // So we need to sort in order to get reproducible results.
957 std::stable_sort(resolvedInDetCandidates.begin(), resolvedInDetCandidates.end(),
958 [](const InDetCandidateTags& a, const InDetCandidateTags& b) {
959 return a.first->indetTrackParticle().pt() > b.first->indetTrackParticle().pt();
960 });
961 }

◆ setMuonHitCounts()

void MuonCombined::MuonCreatorTool::setMuonHitCounts ( xAOD::Muon & muon) const
private

◆ setP4()

void MuonCombined::MuonCreatorTool::setP4 ( xAOD::Muon & muon,
const xAOD::TrackParticle & tp ) const
private

Definition at line 1419 of file MuonCreatorTool.cxx.

1419{ muon.setP4(tp.pt(), tp.eta(), tp.phi()); }

Member Data Documentation

◆ m_addMDTExtrasMuGirlLowBeta

Gaudi::Property<bool> MuonCombined::MuonCreatorTool::m_addMDTExtrasMuGirlLowBeta {this, "AddMDTExtrasMuGirlLowBeta", false}
private

Definition at line 175 of file MuonCreatorTool.h.

175{this, "AddMDTExtrasMuGirlLowBeta", false};

◆ m_ambiguityProcessor

ToolHandle<Trk::ITrackAmbiguityProcessorTool> MuonCombined::MuonCreatorTool::m_ambiguityProcessor {this, "AmbiguityProcessor", ""}
private

Definition at line 150 of file MuonCreatorTool.h.

150{this, "AmbiguityProcessor", ""};

◆ m_buildStauContainer

Gaudi::Property<bool> MuonCombined::MuonCreatorTool::m_buildStauContainer {this, "BuildStauContainer", false, "flag to decide whether to build stau or not"}
private

Definition at line 174 of file MuonCreatorTool.h.

174{this, "BuildStauContainer", false, "flag to decide whether to build stau or not"};

◆ m_caloExtTool

ToolHandle<Trk::IParticleCaloExtensionTool> MuonCombined::MuonCreatorTool::m_caloExtTool
private
Initial value:
{this, "ParticleCaloExtensionTool",
"Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool"}

Definition at line 146 of file MuonCreatorTool.h.

146 {this, "ParticleCaloExtensionTool",
147 "Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool"};

◆ m_caloMaterialProvider

ToolHandle<Trk::ITrkMaterialProviderTool> MuonCombined::MuonCreatorTool::m_caloMaterialProvider
private
Initial value:
{this, "CaloMaterialProvider",
"Trk::TrkMaterialProviderTool/TrkMaterialProviderTool"}

Definition at line 163 of file MuonCreatorTool.h.

163 {this, "CaloMaterialProvider",
164 "Trk::TrkMaterialProviderTool/TrkMaterialProviderTool"};

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> MuonCombined::MuonCreatorTool::m_caloMgrKey {this, "CaloDetDescrManager", "CaloDetDescrManager"}
private

Definition at line 214 of file MuonCreatorTool.h.

214{this, "CaloDetDescrManager", "CaloDetDescrManager"};

◆ m_caloNoiseKey

SG::ReadCondHandleKey<CaloNoise> MuonCombined::MuonCreatorTool::m_caloNoiseKey {this, "CaloNoise", "", "CaloNoise object to use, or blank."}
private

Definition at line 172 of file MuonCreatorTool.h.

172{this, "CaloNoise", "", "CaloNoise object to use, or blank."};

◆ m_cellCollector

Rec::CaloCellCollector MuonCombined::MuonCreatorTool::m_cellCollector
private

Definition at line 169 of file MuonCreatorTool.h.

◆ m_cellContainerName

SG::ReadHandleKey<CaloCellContainer> MuonCombined::MuonCreatorTool::m_cellContainerName {this, "CaloCellContainer", "AllCalo", "calo cells"}
private

Definition at line 171 of file MuonCreatorTool.h.

171{this, "CaloCellContainer", "AllCalo", "calo cells"};

◆ m_copyCharSummaryAccessors

std::vector< std::unique_ptr<SG::AuxElement::Accessor<uint8_t> > > MuonCombined::MuonCreatorTool::m_copyCharSummaryAccessors
private

Definition at line 212 of file MuonCreatorTool.h.

◆ m_copyCharSummaryKeys

Gaudi::Property< std::vector<std::string> > MuonCombined::MuonCreatorTool::m_copyCharSummaryKeys
private
Initial value:
{this,"CopyUInt8SummaryKeys",
{"numberOfUsedHitsdEdx","numberOfIBLOverflowsdEdx","TRTdEdxUsedHits",
"expectInnermostPixelLayerHit", "expectNextToInnermostPixelLayerHit",
"numberOfPixelOutliers", "numberOfInnermostPixelLayerOutliers", "numberOfNextToInnermostPixelLayerOutliers", "numberOfSCTOutliers"},
"List of uint8_t aux element names to copy over from ID track particle summaries."}

Definition at line 199 of file MuonCreatorTool.h.

200 {this,"CopyUInt8SummaryKeys",
201 {"numberOfUsedHitsdEdx","numberOfIBLOverflowsdEdx","TRTdEdxUsedHits",
202 "expectInnermostPixelLayerHit", "expectNextToInnermostPixelLayerHit",
203 "numberOfPixelOutliers", "numberOfInnermostPixelLayerOutliers", "numberOfNextToInnermostPixelLayerOutliers", "numberOfSCTOutliers"},
204 "List of uint8_t aux element names to copy over from ID track particle summaries."};

◆ m_copyFloatSummaryAccessors

std::vector< std::unique_ptr<SG::AuxElement::Accessor<float> > > MuonCombined::MuonCreatorTool::m_copyFloatSummaryAccessors
private

Definition at line 211 of file MuonCreatorTool.h.

◆ m_copyFloatSummaryKeys

Gaudi::Property< std::vector<std::string> > MuonCombined::MuonCreatorTool::m_copyFloatSummaryKeys
private
Initial value:
{this,"CopyFloatSummaryKeys",{"TRTTrackOccupancy","eProbabilityComb","eProbabilityHT","pixeldEdx","TRTdEdx","eProbabilityNN"},
"List of float aux element names to copy over from ID track particle summaries."}

Definition at line 196 of file MuonCreatorTool.h.

197 {this,"CopyFloatSummaryKeys",{"TRTTrackOccupancy","eProbabilityComb","eProbabilityHT","pixeldEdx","TRTdEdx","eProbabilityNN"},
198 "List of float aux element names to copy over from ID track particle summaries."};

◆ m_doSA

Gaudi::Property<bool> MuonCombined::MuonCreatorTool::m_doSA {this, "MakeSAMuons", false}
private

Definition at line 188 of file MuonCreatorTool.h.

188{this, "MakeSAMuons", false};

◆ m_edmHelperSvc

ServiceHandle<Muon::IMuonEDMHelperSvc> MuonCombined::MuonCreatorTool::m_edmHelperSvc
private
Initial value:
{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
"Handle to the service providing the IMuonEDMHelperSvc interface"}

Definition at line 140 of file MuonCreatorTool.h.

140 {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
141 "Handle to the service providing the IMuonEDMHelperSvc interface"};

◆ m_fillEnergyLossFromTrack

Gaudi::Property<bool> MuonCombined::MuonCreatorTool::m_fillEnergyLossFromTrack
private
Initial value:
{this, "FillEnergyLossFromTrack", true,
"Decide whether to try to extract the calo energy loss from tracks "}

Definition at line 176 of file MuonCreatorTool.h.

176 {this, "FillEnergyLossFromTrack", true,
177 "Decide whether to try to extract the calo energy loss from tracks "};

◆ m_fillExtraELossInfo

Gaudi::Property<bool> MuonCombined::MuonCreatorTool::m_fillExtraELossInfo
private
Initial value:
{this, "FillExtraELossInfo", true,
"Can enabled this for debugging - will add extra information not for "
"production"}

Definition at line 179 of file MuonCreatorTool.h.

179 {this, "FillExtraELossInfo", true,
180 "Can enabled this for debugging - will add extra information not for "
181 "production"};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> MuonCombined::MuonCreatorTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 139 of file MuonCreatorTool.h.

139{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_meanMDTdADCTool

ToolHandle<Rec::IMuonMeanMDTdADCFiller> MuonCombined::MuonCreatorTool::m_meanMDTdADCTool
private
Initial value:
{this, "MeanMDTdADCTool",
"Rec::MuonMeanMDTdADCFillerTool/MuonMeanMDTdADCFillerTool"}

Definition at line 161 of file MuonCreatorTool.h.

161 {this, "MeanMDTdADCTool",
162 "Rec::MuonMeanMDTdADCFillerTool/MuonMeanMDTdADCFillerTool"};

◆ m_momentumBalanceTool

ToolHandle<Rec::IMuonMomentumBalanceSignificance> MuonCombined::MuonCreatorTool::m_momentumBalanceTool
private
Initial value:
{this, "MomentumBalanceTool",
"Rec::MuonMomentumBalanceSignificanceTool/"
"MuonMomentumBalanceSignificanceTool"}

Definition at line 153 of file MuonCreatorTool.h.

153 {this, "MomentumBalanceTool",
154 "Rec::MuonMomentumBalanceSignificanceTool/"
155 "MuonMomentumBalanceSignificanceTool"};

◆ m_muonDressingTool

ToolHandle<xAOD::IMuonDressingTool> MuonCombined::MuonCreatorTool::m_muonDressingTool {this, "MuonDressingTool", "MuonCombined::MuonDressingTool/MuonDressingTool"}
private

Definition at line 152 of file MuonCreatorTool.h.

152{this, "MuonDressingTool", "MuonCombined::MuonDressingTool/MuonDressingTool"};

◆ m_muonPrinter

ToolHandle<Rec::IMuonPrintingTool> MuonCombined::MuonCreatorTool::m_muonPrinter {this, "MuonPrinter", "Rec::MuonPrintingTool/MuonPrintingTool"}
private

Definition at line 144 of file MuonCreatorTool.h.

144{this, "MuonPrinter", "Rec::MuonPrintingTool/MuonPrintingTool"};

◆ m_particleCreator

ToolHandle<Trk::ITrackParticleCreatorTool> MuonCombined::MuonCreatorTool::m_particleCreator
private
Initial value:
{this, "TrackParticleCreator",
"Trk::TrackParticleCreatorTool/MuonCombinedTrackParticleCreator"}

Definition at line 148 of file MuonCreatorTool.h.

148 {this, "TrackParticleCreator",
149 "Trk::TrackParticleCreatorTool/MuonCombinedTrackParticleCreator"};

◆ m_printer

PublicToolHandle<Muon::MuonEDMPrinterTool> MuonCombined::MuonCreatorTool::m_printer {this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}
private

Definition at line 143 of file MuonCreatorTool.h.

143{this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};

◆ m_printSummary

Gaudi::Property<bool> MuonCombined::MuonCreatorTool::m_printSummary {this, "PrintSummary", false, "flag to print muon edm"}
private

Definition at line 182 of file MuonCreatorTool.h.

182{this, "PrintSummary", false, "flag to print muon edm"};

◆ m_propagator

ToolHandle<Trk::IPropagator> MuonCombined::MuonCreatorTool::m_propagator {this, "Propagator", "Trk::RungeKuttaPropagator/AtlasRungeKuttaPropagator"}
private

Definition at line 151 of file MuonCreatorTool.h.

151{this, "Propagator", "Trk::RungeKuttaPropagator/AtlasRungeKuttaPropagator"};

◆ m_requireCaloDepositForSA

Gaudi::Property<bool> MuonCombined::MuonCreatorTool::m_requireCaloDepositForSA
private
Initial value:
{this, "RequireCaloForSA", true,
"Flag to discard SA muons that have no calorimeter loss associated."}

Definition at line 209 of file MuonCreatorTool.h.

209 {this, "RequireCaloForSA", true,
210 "Flag to discard SA muons that have no calorimeter loss associated."};

◆ m_requireIDTracks

Gaudi::Property<bool> MuonCombined::MuonCreatorTool::m_requireIDTracks {this, "RequireIDTrack", false}
private

In case of running the muon reconstruction with LRT tracks this property removes the overlap of muons in the container in which in any case no ID track is available.

Definition at line 192 of file MuonCreatorTool.h.

192{this, "RequireIDTrack", false};

◆ m_requireMSOEforSA

Gaudi::Property<bool> MuonCombined::MuonCreatorTool::m_requireMSOEforSA
private
Initial value:
{this, "RequireMSOEforSA", true,
"Flag to accept muons with SA track only but not MSOE. Interesting for BSM?"}

Definition at line 206 of file MuonCreatorTool.h.

206 {this, "RequireMSOEforSA", true,
207 "Flag to accept muons with SA track only but not MSOE. Interesting for BSM?"};

◆ m_scatteringAngleTool

ToolHandle<Rec::IMuonScatteringAngleSignificance> MuonCombined::MuonCreatorTool::m_scatteringAngleTool
private
Initial value:
{this, "ScatteringAngleTool",
"Rec::MuonScatteringAngleSignificanceTool/"
"MuonScatteringAngleSignificanceTool"}

Definition at line 156 of file MuonCreatorTool.h.

156 {this, "ScatteringAngleTool",
157 "Rec::MuonScatteringAngleSignificanceTool/"
158 "MuonScatteringAngleSignificanceTool"};

◆ m_segLowBeta

Gaudi::Property<bool> MuonCombined::MuonCreatorTool::m_segLowBeta {this, "AssociateSegmentsToLowBetaMuons", false, "associate segments to MuGirlLowBeta muons"}
private

Definition at line 186 of file MuonCreatorTool.h.

186{this, "AssociateSegmentsToLowBetaMuons", false, "associate segments to MuGirlLowBeta muons"};

◆ m_selectorTool

ToolHandle<CP::IMuonSelectionTool> MuonCombined::MuonCreatorTool::m_selectorTool {this, "MuonSelectionTool", "CP::MuonSelectionTool/MuonSelectionTool"}
private

Definition at line 159 of file MuonCreatorTool.h.

159{this, "MuonSelectionTool", "CP::MuonSelectionTool/MuonSelectionTool"};

◆ m_sigmaCaloNoiseCut

Gaudi::Property<float> MuonCombined::MuonCreatorTool::m_sigmaCaloNoiseCut {this, "SigmaCaloNoiseCut", 3.4}
private

Definition at line 194 of file MuonCreatorTool.h.

194{this, "SigmaCaloNoiseCut", 3.4};

◆ m_trackQuery

ToolHandle<Rec::IMuonTrackQuery> MuonCombined::MuonCreatorTool::m_trackQuery {this, "TrackQuery", "Rec::MuonTrackQuery/MuonTrackQuery"}
private

Definition at line 166 of file MuonCreatorTool.h.

166{this, "TrackQuery", "Rec::MuonTrackQuery/MuonTrackQuery"};

◆ m_trackSummaryTool

ToolHandle<Trk::IExtendedTrackSummaryTool> MuonCombined::MuonCreatorTool::m_trackSummaryTool {this, "TrackSummaryTool", "MuonTrackSummaryTool"}
private

Definition at line 167 of file MuonCreatorTool.h.

167{this, "TrackSummaryTool", "MuonTrackSummaryTool"};

◆ m_useCaloCells

Gaudi::Property<bool> MuonCombined::MuonCreatorTool::m_useCaloCells {this, "UseCaloCells", true}
private

Definition at line 187 of file MuonCreatorTool.h.

187{this, "UseCaloCells", true};

◆ m_useUpdatedExtrapolatedTrack

Gaudi::Property<bool> MuonCombined::MuonCreatorTool::m_useUpdatedExtrapolatedTrack
private
Initial value:
{this, "UseUpdatedExtrapolatedTrack", true,
"configure whether to use the updated extrapolated track for a combined "
"fit or not"}

Definition at line 183 of file MuonCreatorTool.h.

183 {this, "UseUpdatedExtrapolatedTrack", true,
184 "configure whether to use the updated extrapolated track for a combined "
185 "fit or not"};

The documentation for this class was generated from the following files: