ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::MuonChamberHoleRecoveryTool Class Referenceabstract

tool to select tracks More...

#include <MuonChamberHoleRecoveryTool.h>

Inheritance diagram for Muon::MuonChamberHoleRecoveryTool:
Collaboration diagram for Muon::MuonChamberHoleRecoveryTool:

Classes

struct  RecoveryState

Public Types

using NewTrackStates = std::vector<std::unique_ptr<const Trk::TrackStateOnSurface>>

Public Member Functions

 MuonChamberHoleRecoveryTool (const std::string &, const std::string &, const IInterface *)
virtual ~MuonChamberHoleRecoveryTool ()=default
StatusCode initialize () override
std::unique_ptr< Trk::Trackrecover (const Trk::Track &track, const EventContext &ctx) const override
 returns a new track with holes recovered
void createHoleTSOSsForClusterChamber (const Identifier &detElId, const EventContext &ctx, const Trk::TrackParameters &pars, std::set< Identifier > &layIds, NewTrackStates &states) const override
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
virtual void createHoleTSOSsForClusterChamber (const Identifier &detElId, const EventContext &ctx, const Trk::TrackParameters &pars, std::set< Identifier > &layIds, std::vector< std::unique_ptr< const Trk::TrackStateOnSurface > > &states) const =0

Static Public Member Functions

static const InterfaceID & interfaceID ()
 access to tool interface

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

bool getNextMuonMeasurement (RecoveryState &trkRecov, RecoveryState::CopyTarget target) const
 Increments the internal iterator of the RecoveryState until the next muon measurement on track is found Measurements inside the MS volume or any scatterer are copied automatically copied onto the target vector.
void recoverHitsInChamber (const EventContext &ctx, RecoveryState &trkRecov) const
 Loops over all muon hits in a muon chamber and tries to find missed ones by checking each tracking layer for hits.
std::set< IdentifierholesInMdtChamber (const EventContext &ctx, const Amg::Vector3D &position, const Amg::Vector3D &direction, const Identifier &chId, const std::set< Identifier > &tubeIds) const
 calculate holes in a given chamber using local straight line extrapolation
void recoverMdtHits (const EventContext &ctx, const Identifier &chId, const Trk::TrackParameters &pars, NewTrackStates &newStates, std::set< Identifier > &knownLayers) const
void recoverClusterHits (const EventContext &ctx, const Identifier &chId, const Trk::TrackParameters &chambPars, NewTrackStates &newStates, std::set< Identifier > &knownLayers) const
std::set< IdentifierlayersOnTrkIds (const Trk::Track &track) const
 Returns a set of all layer Identifiers of the associated track hits.
const Trk::TrkDetElementBasegetDetectorElement (const EventContext &ctx, const Identifier &id) const
 Returns the detector element associated with the muon Identifier.
std::set< IdentifiergetHoleLayerIds (const Identifier &detElId, const std::set< Identifier > &knownLayers) const
 Returns a set of all layer Identifiers (GasGap + channel orientation) in a muon chamber of type X excluding the ones in the knownLayers set.
template<class Prd>
NewTrackStates recoverChamberClusters (const EventContext &ctx, const SG::ReadHandleKey< MuonPrepDataContainerT< Prd > > &prdKey, const Identifier &chambId, const Trk::TrackParameters &parsInChamb, std::set< Identifier > &knownLayers) const
 Attempts to recover all missing hits in a chamber.
template<class Prd>
std::vector< const Prd * > loadPrepDataHits (const EventContext &ctx, const SG::ReadHandleKey< MuonPrepDataContainerT< Prd > > &key, const std::set< Identifier > &layerIds) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
ServiceHandle< Muon::IMuonEDMHelperSvcm_edmHelperSvc
ServiceHandle< Trk::ITrackingVolumesSvcm_trackingVolumesSvc {this, "TrackingVolumesSvc", "Trk::TrackingVolumesSvc/TrackingVolumesSvc"}
PublicToolHandle< Muon::MuonEDMPrinterToolm_printer {this, "EDMPrinter", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}
ToolHandle< Trk::IExtrapolatorm_extrapolator {this, "Extrapolator", "Trk::Extrapolator/MuonExtrapolator"}
ToolHandle< Muon::IMdtDriftCircleOnTrackCreatorm_mdtRotCreator
ToolHandle< Muon::IMuonClusterOnTrackCreatorm_cscRotCreator
ToolHandle< Muon::IMuonClusterOnTrackCreatorm_clusRotCreator
ToolHandle< Trk::IResidualPullCalculatorm_pullCalculator
SG::ReadCondHandleKey< MuonGM::MuonDetectorManagerm_DetectorManagerKey
SG::ReadHandleKey< Muon::MdtPrepDataContainerm_key_mdt {this, "MdtPrepDataContainer", "MDT_DriftCircles", "MDT PRDs"}
SG::ReadHandleKey< Muon::CscPrepDataContainerm_key_csc {this, "CscPrepDataContainer", "CSC_Clusters", "CSC PRDS"}
SG::ReadHandleKey< Muon::TgcPrepDataContainerm_key_tgc {this, "TgcPrepDataContainer", "TGC_Measurements", "TGC PRDs"}
SG::ReadHandleKey< Muon::RpcPrepDataContainerm_key_rpc {this, "RpcPrepDataContainer", "RPC_Measurements", "RPC PRDs"}
SG::ReadHandleKey< Muon::sTgcPrepDataContainerm_key_stgc {this, "sTgcPrepDataContainer", "STGC_Measurements", "sTGC PRDs"}
SG::ReadHandleKey< Muon::MMPrepDataContainerm_key_mm {this, "MMPrepDataContainer", "MM_Measurements", "MM PRDs"}
SG::ReadCondHandleKey< Muon::MuonIntersectGeoDatam_chamberGeoKey {this, "ChamberGeoKey", "MuonStationIntersects", "Pointer to hole search service"}
Gaudi::Property< bool > m_addMeasurements {this, "AddMeasurements", true}
Gaudi::Property< bool > m_detectBadSort {this, "DetectBadSorting", false}
Gaudi::Property< double > m_associationPullCutEta {this, "AssociationPullCutEta", 3}
Gaudi::Property< double > m_associationPullCutPhi {this, "AssociationPullCutPhi", 10}
Gaudi::Property< double > m_adcCut {this, "AdcCut", 50}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

tool to select tracks

Definition at line 34 of file MuonChamberHoleRecoveryTool.h.

Member Typedef Documentation

◆ NewTrackStates

Definition at line 40 of file MuonChamberHoleRecoveryTool.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuonChamberHoleRecoveryTool()

Muon::MuonChamberHoleRecoveryTool::MuonChamberHoleRecoveryTool ( const std::string & ty,
const std::string & na,
const IInterface * pa )

Definition at line 89 of file MuonChamberHoleRecoveryTool.cxx.

89 :
90 AthAlgTool(ty, na, pa) {
91 declareInterface<IMuonHoleRecoveryTool>(this);
92 }
AthAlgTool()
Default constructor:

◆ ~MuonChamberHoleRecoveryTool()

virtual Muon::MuonChamberHoleRecoveryTool::~MuonChamberHoleRecoveryTool ( )
virtualdefault

Member Function Documentation

◆ createHoleTSOSsForClusterChamber() [1/2]

virtual void Muon::IMuonHoleRecoveryTool::createHoleTSOSsForClusterChamber ( const Identifier & detElId,
const EventContext & ctx,
const Trk::TrackParameters & pars,
std::set< Identifier > & layIds,
std::vector< std::unique_ptr< const Trk::TrackStateOnSurface > > & states ) const
pure virtualinherited

◆ createHoleTSOSsForClusterChamber() [2/2]

void Muon::MuonChamberHoleRecoveryTool::createHoleTSOSsForClusterChamber ( const Identifier & detElId,
const EventContext & ctx,
const Trk::TrackParameters & pars,
std::set< Identifier > & layIds,
NewTrackStates & states ) const
override

Definition at line 344 of file MuonChamberHoleRecoveryTool.cxx.

348 {
349 ATH_MSG_VERBOSE(" performing holes search in chamber " << m_idHelperSvc->toString(detElId));
350 recoverClusterHits(ctx, detElId, pars, states, layIds);
351 }
#define ATH_MSG_VERBOSE(x)
void recoverClusterHits(const EventContext &ctx, const Identifier &chId, const Trk::TrackParameters &chambPars, NewTrackStates &newStates, std::set< Identifier > &knownLayers) const
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getDetectorElement()

const Trk::TrkDetElementBase * Muon::MuonChamberHoleRecoveryTool::getDetectorElement ( const EventContext & ctx,
const Identifier & id ) const
private

Returns the detector element associated with the muon Identifier.

Definition at line 354 of file MuonChamberHoleRecoveryTool.cxx.

355 {
356 SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey, ctx};
357 const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle};
358 if (!MuonDetMgr) {
359 ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object");
360 return nullptr;
361 }
362 if (m_idHelperSvc->isMdt(detElId))
363 return MuonDetMgr->getMdtReadoutElement(detElId);
364 else if (m_idHelperSvc->isTgc(detElId))
365 return MuonDetMgr->getTgcReadoutElement(detElId);
366 else if (m_idHelperSvc->isRpc(detElId))
367 return MuonDetMgr->getRpcReadoutElement(detElId);
368 else if (m_idHelperSvc->isCsc(detElId))
369 return MuonDetMgr->getCscReadoutElement(detElId);
370 // New Small Wheel
371 else if (m_idHelperSvc->issTgc(detElId))
372 return MuonDetMgr->getsTgcReadoutElement(detElId);
373 else if (m_idHelperSvc->isMM(detElId))
374 return MuonDetMgr->getMMReadoutElement(detElId);
375 return nullptr;
376 }
#define ATH_MSG_ERROR(x)
const RpcReadoutElement * getRpcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const MMReadoutElement * getMMReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey

◆ getHoleLayerIds()

std::set< Identifier > Muon::MuonChamberHoleRecoveryTool::getHoleLayerIds ( const Identifier & detElId,
const std::set< Identifier > & knownLayers ) const
private

Returns a set of all layer Identifiers (GasGap + channel orientation) in a muon chamber of type X excluding the ones in the knownLayers set.

the second gas gap of the three layer stations does not have a phi measurement

Definition at line 459 of file MuonChamberHoleRecoveryTool.cxx.

460 {
461 std::set<Identifier> holeGaps{};
462 if (m_idHelperSvc->isMdt(detElId)) {
463 const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
464 for (int ml = 1; ml <= idHelper.numberOfMultilayers(detElId); ++ml) {
465 for (int layer = idHelper.tubeLayerMin(detElId);
466 layer <= idHelper.tubeLayerMax(detElId); ++layer) {
467 const Identifier layerId = idHelper.channelID(detElId, ml, layer, 1);
468 if (!knownLayers.count(layerId)) holeGaps.insert(layerId);
469 }
470 }
471 } else if (m_idHelperSvc->isMM(detElId)) {
472 const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
473 for (int ml : {1 ,2}) {
474 for (int gap = MmIdHelper::gasGapMin(); gap <= MmIdHelper::gasGapMax(); ++gap) {
475 const Identifier layerId = idHelper.channelID(detElId, ml, gap, 1);
476 if (!knownLayers.count(layerId)) holeGaps.insert(layerId);
477 }
478 }
479 } else if (m_idHelperSvc->issTgc(detElId)) {
480 const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
481 using channelType = sTgcIdHelper::sTgcChannelTypes;
482 for (int ml : {1, 2}) {
483 for (const channelType chType : {channelType::Strip,
484 channelType::Pad,
485 channelType::Wire}){
486 for (int gap = sTgcIdHelper::gasGapMin();
488 const Identifier layerId = idHelper.channelID(detElId, ml, gap, chType, 1);
489 if (!knownLayers.count(layerId)) holeGaps.insert(layerId);
490 }
491 }
492 }
493 } else if (m_idHelperSvc->isTgc(detElId)) {
494 const TgcIdHelper& idHelper = m_idHelperSvc->tgcIdHelper();
495 const int gapMax{idHelper.gasGapMax(detElId)};
496 for (int gasgap = idHelper.gasGapMin(detElId);
497 gasgap < gapMax; ++gasgap){
498 for (int measPhi: {0,1}) {
500 if (gapMax == 3 && gasgap ==2 && measPhi == 1) continue;
501 const Identifier layerId = idHelper.channelID(detElId, gasgap, measPhi, 1);
502 if (!knownLayers.count(layerId)) holeGaps.insert(layerId);
503 }
504 }
505 } else if (m_idHelperSvc->isRpc(detElId)) {
506 const RpcIdHelper& idHelper = m_idHelperSvc->rpcIdHelper();
507 const int doubZ{idHelper.doubletZ(detElId)};
508 const int gapMax{idHelper.gasGapMax(detElId)};
509 for (int phiGap = idHelper.doubletPhi(detElId);
510 phiGap <= idHelper.doubletPhiMax(detElId); ++phiGap) {
511 for (int gap = idHelper.gasGapMin(detElId);
512 gap <= gapMax; ++gap) {
513 for (int measPhi: {0, 1}) {
514 const Identifier layerId = idHelper.channelID(detElId, doubZ, phiGap, gap, measPhi, 1);
515 if (!knownLayers.count(layerId)) holeGaps.insert(layerId);
516 }
517 }
518 }
519 } else if (m_idHelperSvc->isCsc(detElId)) {
520 const CscIdHelper& idHelper{m_idHelperSvc->cscIdHelper()};
521 for (int layer = 1; layer <= 4; ++ layer) {
522 for (bool measPhi: {false, true}) {
523 const Identifier layId = idHelper.channelID(detElId, 2, layer, measPhi, 1);
524 if (!knownLayers.count(layId)) holeGaps.insert(layId);
525 }
526 }
527 }
528 return holeGaps;
529 }
Identifier channelID(int stationName, int stationEta, int stationPhi, int chamberLayer, int wireLayer, int measuresPhi, int strip) const
static int tubeLayerMax()
int numberOfMultilayers(const Identifier &id) const
static int tubeLayerMin()
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
static int gasGapMax()
static int gasGapMin()
Identifier channelID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
int gasGapMax() const
static int gasGapMin()
int doubletPhi(const Identifier &id) const
static int doubletPhiMax()
int doubletZ(const Identifier &id) const
static int gasGapMax(bool triplet)
static int gasGapMin()
Identifier channelID(int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const
static int gasGapMin()
static int gasGapMax()
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType, int channel) const
gap(flags, cells_name, *args, **kw)
@ layer
Definition HitInfo.h:79

◆ getNextMuonMeasurement()

bool Muon::MuonChamberHoleRecoveryTool::getNextMuonMeasurement ( RecoveryState & trkRecov,
RecoveryState::CopyTarget target ) const
private

Increments the internal iterator of the RecoveryState until the next muon measurement on track is found Measurements inside the MS volume or any scatterer are copied automatically copied onto the target vector.

Copy all track states inside the MS

Scatteres AEOTs, material etc.

Definition at line 121 of file MuonChamberHoleRecoveryTool.cxx.

121 {
122 while(trkRecov.nextState()) {
123 const Trk::TrackParameters* pars = trkRecov.tsos()->trackParameters();
124 ATH_MSG_VERBOSE("Track parameters "<<(*pars));
127 if (msVol.inside(pars->position())) {
128 ATH_MSG_VERBOSE("Tracking parameters are inside the MS");
129 trkRecov.copyState(target);
130 continue;
131 }
132
133 if (trkRecov.tsos()->type(Trk::TrackStateOnSurface::Hole)) {
134 ATH_MSG_VERBOSE("Skip hole in MS");
135 continue;
136 }
138 const Trk::MeasurementBase* meas = trkRecov.tsos()->measurementOnTrack();
139 if (!meas) {
140 ATH_MSG_VERBOSE("The track state does not have an associated measurement");
141 trkRecov.copyState(target);
142 continue;
143 }
144 trkRecov.tsosId = m_edmHelperSvc->getIdentifier(*meas);
145 // Potentially a pseudo measurement. Anyway keep it
146 if (!trkRecov.tsosId.is_valid() || !m_idHelperSvc->isMuon(trkRecov.tsosId)) {
147 ATH_MSG_VERBOSE("No muon measurement");
148 trkRecov.copyState(target);
149 continue;
150 }
151 return true;
152 }
153 return false;
154 }
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
ServiceHandle< Trk::ITrackingVolumesSvc > m_trackingVolumesSvc
@ MuonSpectrometerEntryLayer
Tracking Volume which defines the entrance surfaces of the MS.
@ Hole
A hole on the track - this is defined in the following way.
bool inside(const Amg::Vector3D &gp, double tol=0.) const
Inside() method for checks.
Definition Volume.cxx:72
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ holesInMdtChamber()

std::set< Identifier > Muon::MuonChamberHoleRecoveryTool::holesInMdtChamber ( const EventContext & ctx,
const Amg::Vector3D & position,
const Amg::Vector3D & direction,
const Identifier & chId,
const std::set< Identifier > & tubeIds ) const
private

calculate holes in a given chamber using local straight line extrapolation

Parameters
parsTrackParameters in the chamber
chIdIdentifier of the chamber
tubeIdsset containing the Identifier of the hits that should not be counted as holes
Returns
a vector of hole Identifiers

Definition at line 378 of file MuonChamberHoleRecoveryTool.cxx.

379 {
380
381 SG::ReadCondHandle<Muon::MuonIntersectGeoData> interSectSvc{m_chamberGeoKey,ctx};
382 if (!interSectSvc.isValid()) {
383 ATH_MSG_ERROR("Failed to retrieve chamber intersection service");
384 throw std::runtime_error("No chamber intersection service");
385 }
386
387 SG::ReadCondHandle<MuonGM::MuonDetectorManager> detMgr{m_DetectorManagerKey,ctx};
388 const MuonGM::MuonDetectorManager* MuonDetMgr = detMgr.cptr();
389 const MuonGM::MdtReadoutElement* readoutEle = MuonDetMgr->getMdtReadoutElement(chId);
390
391 MuonStationIntersect intersect = interSectSvc->tubesCrossedByTrack(MuonDetMgr, chId, position, direction);
392
393 // clear hole vector
394 std::set<Identifier> holes;
395 for (unsigned int ii = 0; ii < intersect.tubeIntersects().size(); ++ii) {
396 const MuonTubeIntersect& tint = intersect.tubeIntersects()[ii];
397
398 if (tubeIds.count(tint.tubeId)) { continue; }
399 ATH_MSG_VERBOSE(" intersect " << m_idHelperSvc->toString(tint.tubeId) << " dist wire " << tint.rIntersect
400 << " dist to tube end " << tint.xIntersect);
401
402 if (std::abs(tint.rIntersect) > readoutEle->innerTubeRadius() || tint.xIntersect > -10.) {
403 ATH_MSG_VERBOSE(" not counted");
404 continue;
405 }
406 // check whether there is a hit in this tube
407 ATH_MSG_VERBOSE(" hole tube");
408 holes.insert(tint.tubeId);
409
410 }
411 return holes;
412 }
double innerTubeRadius() const
Returns the inner tube radius excluding the aluminium walls.
SG::ReadCondHandleKey< Muon::MuonIntersectGeoData > m_chamberGeoKey
const_pointer_type cptr()
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.

◆ initialize()

StatusCode Muon::MuonChamberHoleRecoveryTool::initialize ( )
override

Definition at line 94 of file MuonChamberHoleRecoveryTool.cxx.

94 {
95 ATH_CHECK(m_DetectorManagerKey.initialize());
96 ATH_CHECK(m_edmHelperSvc.retrieve());
97 ATH_CHECK(m_idHelperSvc.retrieve());
99 ATH_CHECK(m_printer.retrieve());
100 ATH_CHECK(m_extrapolator.retrieve());
101
102
103 ATH_CHECK(m_key_csc.initialize(!m_key_csc.empty()));
104 ATH_CHECK(m_key_stgc.initialize(!m_key_stgc.empty()));
105 ATH_CHECK(m_key_mm.initialize(!m_key_mm.empty()));
106
107 ATH_CHECK(m_key_mdt.initialize(!m_key_mdt.empty()));
108 ATH_CHECK(m_key_tgc.initialize(!m_key_tgc.empty()));
109 ATH_CHECK(m_key_rpc.initialize(!m_key_rpc.empty()));
110
111 ATH_CHECK(m_cscRotCreator.retrieve(DisableTool{m_key_csc.empty()}));
112
113 const bool hasClusKey = !m_key_stgc.empty() || !m_key_mm.empty() || !m_key_tgc.empty() || !m_key_rpc.empty();
114 ATH_CHECK(m_clusRotCreator.retrieve(EnableTool{hasClusKey}));
115 ATH_CHECK(m_mdtRotCreator.retrieve(EnableTool{!m_key_mdt.empty()}));
116 ATH_CHECK(m_pullCalculator.retrieve());
117
118 ATH_CHECK(m_chamberGeoKey.initialize());
119 return StatusCode::SUCCESS;
120 }
#define ATH_CHECK
Evaluate an expression and check for errors.
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_key_rpc
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_key_tgc
ToolHandle< Trk::IExtrapolator > m_extrapolator
SG::ReadHandleKey< Muon::MdtPrepDataContainer > m_key_mdt
SG::ReadHandleKey< Muon::sTgcPrepDataContainer > m_key_stgc
ToolHandle< Muon::IMuonClusterOnTrackCreator > m_clusRotCreator
SG::ReadHandleKey< Muon::CscPrepDataContainer > m_key_csc
ToolHandle< Muon::IMuonClusterOnTrackCreator > m_cscRotCreator
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer
ToolHandle< Trk::IResidualPullCalculator > m_pullCalculator
ToolHandle< Muon::IMdtDriftCircleOnTrackCreator > m_mdtRotCreator
SG::ReadHandleKey< Muon::MMPrepDataContainer > m_key_mm

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & Muon::IMuonHoleRecoveryTool::interfaceID ( )
inlinestaticinherited

access to tool interface

Definition at line 23 of file IMuonHoleRecoveryTool.h.

23 {
24 static const InterfaceID IID_IMuonHoleRecoveryTool("Muon::IMuonHoleRecoveryTool", 1, 0);
25 return IID_IMuonHoleRecoveryTool;
26 }

◆ layersOnTrkIds()

std::set< Identifier > Muon::MuonChamberHoleRecoveryTool::layersOnTrkIds ( const Trk::Track & track) const
private

Returns a set of all layer Identifiers of the associated track hits.

Definition at line 156 of file MuonChamberHoleRecoveryTool.cxx.

156 {
157 std::set<Identifier> layerIds{};
158 for (const Trk::TrackStateOnSurface* tsos: *track.trackStateOnSurfaces()){
159 const Trk::MeasurementBase* meas = tsos->measurementOnTrack();
160 if (!meas) continue;
161 const Identifier measId = m_edmHelperSvc->getIdentifier(*meas);
162
163 if (!m_idHelperSvc->isMuon(measId)) continue;
164 layerIds.insert(measId);
165 layerIds.insert(m_idHelperSvc->layerId(measId));
166 // split competing ROTs into constituents
167 const CompetingMuonClustersOnTrack* comp = dynamic_cast<const CompetingMuonClustersOnTrack*>(meas);
168 if (!comp) { continue; }
169
170 for (const Muon::MuonClusterOnTrack* clust : comp->containedROTs()) {
171 layerIds.insert(m_idHelperSvc->layerId(clust->identify()));
172 }
173 }
174 return layerIds;
175 }

◆ loadPrepDataHits()

template<class Prd>
std::vector< const Prd * > Muon::MuonChamberHoleRecoveryTool::loadPrepDataHits ( const EventContext & ctx,
const SG::ReadHandleKey< MuonPrepDataContainerT< Prd > > & key,
const std::set< Identifier > & layerIds ) const
private

Create a subset of Identifiers

Sort the Mdt prepdatas per Identifier as there's the possibily 2 DC can exist for the same channel

Definition at line 413 of file MuonChamberHoleRecoveryTool.cxx.

415 {
416 std::vector<const Prd*> collectedHits{};
417 if (key.empty()) {
418 ATH_MSG_DEBUG("No container configured for "<<typeid(Prd).name());
419 return collectedHits;
420 }
421 SG::ReadHandle<MuonPrepDataContainerT<Prd>> prdContainer{key, ctx};
422 if (!prdContainer.isPresent()) {
423 ATH_MSG_FATAL("Failed to load prep data collection "<<key.fullKey());
424 throw std::runtime_error("Invalid prepdata container");
425 }
427 std::set<IdentifierHash> chamberIds{};
428 std::transform(gasGapIds.begin(), gasGapIds.end(),
429 std::inserter(chamberIds, chamberIds.end()),
430 [this](const Identifier& id){
431 return m_idHelperSvc->moduleHash(id);
432 });
433 for (const IdentifierHash& moduleHash : chamberIds) {
434 const MuonPrepDataCollection<Prd>* prdColl = prdContainer->indexFindPtr(moduleHash);
435 if (!prdColl) continue;
436 collectedHits.reserve(collectedHits.size() + prdColl->size());
437 for (const Prd* prd: *prdColl) {
438 bool appendPrd{false};
439 if constexpr (std::is_same<Prd, MdtPrepData>::value) {
440 appendPrd = gasGapIds.count(prd->identify());
441 } else {
442 appendPrd = gasGapIds.count(m_idHelperSvc->layerId(prd->identify()));
443 }
444 if (appendPrd) {
445 ATH_MSG_VERBOSE(__func__<<"() - Add prd candidate "<<m_printer->print(*prd));
446 collectedHits.push_back(prd);
447 }
448 }
449 }
452 if constexpr(std::is_same<Prd, MdtPrepData>::value) {
453 std::sort(collectedHits.begin(), collectedHits.end(), [](const Prd* a, const Prd* b){
454 return a->identify() < b->identify();
455 });
456 }
457 return collectedHits;
458 }
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
static Double_t a
bool isPresent() const
Is the referenced object present in SG?
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ recover()

std::unique_ptr< Trk::Track > Muon::MuonChamberHoleRecoveryTool::recover ( const Trk::Track & track,
const EventContext & ctx ) const
overridevirtual

returns a new track with holes recovered

Copy all parameters befor the MS onto the new track state

Start an iterative recovery looping over each chamber

Implements Muon::IMuonHoleRecoveryTool.

Definition at line 177 of file MuonChamberHoleRecoveryTool.cxx.

177 {
178 ATH_MSG_DEBUG(" performing hole search track " << std::endl
179 << m_printer->print(track) << std::endl
180 << m_printer->printMeasurements(track));
181
182 RecoveryState recovState{track};
183 recovState.layersOnTrk = layersOnTrkIds(track);
184
188 recoverHitsInChamber(ctx, recovState);
189 std::unique_ptr<Trk::Track> newTrack = std::make_unique<Trk::Track>(track.info(), recovState.releaseStates(),
190 track.fitQuality() ? track.fitQuality()->uniqueClone() : nullptr);
191 return newTrack;
192 }
std::set< Identifier > layersOnTrkIds(const Trk::Track &track) const
Returns a set of all layer Identifiers of the associated track hits.
void recoverHitsInChamber(const EventContext &ctx, RecoveryState &trkRecov) const
Loops over all muon hits in a muon chamber and tries to find missed ones by checking each tracking la...
bool getNextMuonMeasurement(RecoveryState &trkRecov, RecoveryState::CopyTarget target) const
Increments the internal iterator of the RecoveryState until the next muon measurement on track is fou...
std::set< Identifier > layersOnTrk
List of all measurement layers on track.

◆ recoverChamberClusters()

template<class Prd>
NewTrackStates Muon::MuonChamberHoleRecoveryTool::recoverChamberClusters ( const EventContext & ctx,
const SG::ReadHandleKey< MuonPrepDataContainerT< Prd > > & prdKey,
const Identifier & chambId,
const Trk::TrackParameters & parsInChamb,
std::set< Identifier > & knownLayers ) const
private

Attempts to recover all missing hits in a chamber.

The hit is out of bounds --> continue

Loop over all prd candidates

The surface cannot be reached. Discard the prd

Compare the pad & local positions

Calculate the pull by hand

For one reason or another, the pads have 1D covariances

Check whether the pull is reasonable

Assign the best pad onto the track

Calculate the track pull

the best clusters are found. Put them onto the track

Next loop over the reamining parameters at surface to create holes

Definition at line 530 of file MuonChamberHoleRecoveryTool.cxx.

534 {
535 NewTrackStates recoveredStates{};
536 const std::set<Identifier> missingLayers = getHoleLayerIds(detElId, knownLayers);
537 std::vector<const Prd*> prdCandidates = loadPrepDataHits(ctx, prdKey, missingLayers);
539 using LayerParsMap = std::map<Identifier, std::unique_ptr<Trk::TrackParameters>>;
540 LayerParsMap parsAtSurfMap{};
541 for (const Identifier& holeId : missingLayers) {
542 const Trk::TrkDetElementBase* detEl = getDetectorElement(ctx, holeId);
543 const Trk::Surface& surf{detEl->surface(holeId)};
544 std::unique_ptr<Trk::TrackParameters> pars = m_extrapolator->extrapolateDirectly(ctx, parsInChamb, surf,
546 if (!pars) {
547 ATH_MSG_VERBOSE("Surface layer "<<m_idHelperSvc->toStringGasGap(holeId)<<" cannot be reached");
548 continue;
549 }
550 if (!Amg::hasPositiveDiagElems(*pars->covariance())) {
551 ATH_MSG_DEBUG("Uncertainties of extraploation to "<<m_idHelperSvc->toStringGasGap(holeId)<<" blew up");
552 continue;
553 }
554 const Amg::Vector2D locExPos{pars->parameters()[Trk::locX],
555 pars->parameters()[Trk::locY]};
556 bool inbounds{false};
557 if constexpr(std::is_same<Prd, MMPrepData>::value) {
558 inbounds = static_cast<const MuonGM::MMReadoutElement*>(detEl)->insideActiveBounds(holeId, locExPos, 10.,10.);
559 } else {
560 inbounds = surf.insideBounds(locExPos, 10., 10.);
561 }
563 if (!inbounds) {
564 ATH_MSG_VERBOSE("Extrapolation to layer "<<m_idHelperSvc->toStringGasGap(holeId)
565 <<" is outside of the chamber "<<Amg::toString(locExPos, 2));
566 continue;
567 }
568 parsAtSurfMap[holeId] = std::move(pars);
569 }
570 ClusterLayerMap bestClusterInLay;
572 for (const Prd* hit : prdCandidates) {
573 const Identifier layId = m_idHelperSvc->layerId(hit->identify());
575 LayerParsMap::const_iterator pars_itr = parsAtSurfMap.find(layId);
576 if (pars_itr == parsAtSurfMap.end()) {
577 continue;
578 }
579 const std::unique_ptr<Trk::TrackParameters>& parsInLay{pars_itr->second};
580 std::unique_ptr<MuonClusterOnTrack> calibClus{};
581 if constexpr(std::is_same<Prd, CscPrepData>::value) {
582 calibClus.reset(m_cscRotCreator->createRIO_OnTrack(*hit,
583 parsInLay->position(),
584 parsInLay->momentum().unit()));
585 } else {
586 calibClus.reset(m_clusRotCreator->createRIO_OnTrack(*hit,
587 parsInLay->position(),
588 parsInLay->momentum().unit()));
589 }
590 if (!calibClus) continue;
591
592 if constexpr (std::is_same<Prd, sTgcPrepData>::value) {
593 const sTgcIdHelper& idHelper{m_idHelperSvc->stgcIdHelper()};
594 if (idHelper.channelType(hit->identify()) == sTgcIdHelper::sTgcChannelTypes::Pad){
596 const Amg::Vector2D locExPos{parsInLay->parameters()[Trk::locX],
597 parsInLay->parameters()[Trk::locY]};
598
599 const MuonGM::MuonPadDesign* pad = hit->detectorElement()->getPadDesign(hit->identify());
600 const Amg::Vector2D padDist = pad->distanceToPad(locExPos, idHelper.channel(hit->identify()));
601
603 const double xCov = std::hypot(Amg::error(*parsInLay->covariance(), Trk::locX),
604 Amg::error(hit->localCovariance(), Trk::locX));
606 const double yCov =Amg::error(*parsInLay->covariance(), Trk::locY);
607
608 const double xPull = padDist.x() / xCov;
609 const double yPull = padDist.y() / yCov;
610
611 ATH_MSG_VERBOSE(__func__<<"() - check "<<m_printer->print(*calibClus)
612 <<" diff "<<Amg::toString(padDist, 2)
613 <<" covariance: ("<<xCov<<", "<<yCov<<")"
614 <<" pull: ("<<xPull<<","<<yPull<<").");
615
617 if (xPull > m_associationPullCutEta || yPull > m_associationPullCutPhi) continue;
618 const double pull = std::hypot(xPull, yPull);
619
621 PullCluster& bestClus = bestClusterInLay[layId];
622 if (bestClus.pull < pull) continue;
623 bestClus.pull = pull;
624 bestClus.clus = std::move(calibClus);
625 bestClus.pars = parsInLay->uniqueClone();
626 continue;
627 }
628 }
629
631 std::optional<const Trk::ResidualPull> resPull{
632 m_pullCalculator->residualPull(calibClus.get(), parsInLay.get(),
634 if (!resPull || resPull->pull().empty()) {
635 continue;
636 }
637
638 const double pull = std::abs(resPull->pull().front());
639 const double pullCut = m_idHelperSvc->measuresPhi(layId) ? m_associationPullCutPhi
641 if (pull > pullCut) continue;
642
643 PullCluster& bestClus = bestClusterInLay[layId];
644 if (bestClus.pull < pull) continue;
645 bestClus.pull = pull;
646 bestClus.clus = std::move(calibClus);
647 bestClus.pars = parsInLay->uniqueClone();
648
649 }
651 for (auto& [layerId, foundClus]: bestClusterInLay) {
652 ATH_MSG_VERBOSE(__func__<<"() recovered hit " << m_printer->print(*foundClus.clus)<<" pull: "<<foundClus.pull);
653 std::unique_ptr<Trk::TrackStateOnSurface> tsos = MuonTSOSHelper::createMeasTSOS(std::move(foundClus.clus),
654 std::move(foundClus.pars),
656 recoveredStates.emplace_back(std::move(tsos));
657 knownLayers.insert(layerId);
658 parsAtSurfMap[layerId].reset();
659 }
661 for (auto& [layerId, exPars] : parsAtSurfMap) {
662 if (!exPars) continue;
663 ATH_MSG_VERBOSE(__func__<<"() add new hole state "<<m_idHelperSvc->toStringGasGap(layerId));
664 recoveredStates.emplace_back(MuonTSOSHelper::createHoleTSOS(std::move(exPars)));
665 }
666 return recoveredStates;
667 }
const Trk::TrkDetElementBase * getDetectorElement(const EventContext &ctx, const Identifier &id) const
Returns the detector element associated with the muon Identifier.
std::set< Identifier > getHoleLayerIds(const Identifier &detElId, const std::set< Identifier > &knownLayers) const
Returns a set of all layer Identifiers (GasGap + channel orientation) in a muon chamber of type X exc...
std::vector< const Prd * > loadPrepDataHits(const EventContext &ctx, const SG::ReadHandleKey< MuonPrepDataContainerT< Prd > > &key, const std::set< Identifier > &layerIds) const
std::vector< std::unique_ptr< const Trk::TrackStateOnSurface > > NewTrackStates
static std::unique_ptr< Trk::TrackStateOnSurface > createHoleTSOS(std::unique_ptr< Trk::TrackParameters > pars)
create a hole TSOS, takes ownership of the pointers
static std::unique_ptr< Trk::TrackStateOnSurface > createMeasTSOS(std::unique_ptr< Trk::MeasurementBase > meas, std::unique_ptr< Trk::TrackParameters > pars, Trk::TrackStateOnSurface::TrackStateOnSurfaceType type)
create a TSOS with a measurement, takes ownership of the pointers
@ Unbiased
RP with track state that has measurement not included.
virtual bool insideBounds(const Amg::Vector2D &locpos, double tol1=0., double tol2=0.) const =0
virtual methods to be overwritten by the inherited surfaces
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
virtual const Surface & surface() const =0
Return surface associated with this detector element.
int channelType(const Identifier &id) const
int channel(const Identifier &id) const override
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
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 ...
bool hasPositiveDiagElems(const AmgSymMatrix(N) &mat)
Returns true if all diagonal elements of the covariance matrix are finite aka sane in the above defin...
Eigen::Matrix< double, 2, 1 > Vector2D
@ anyDirection
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37
Amg::Vector2D distanceToPad(const Amg::Vector2D &pos, int channel) const

◆ recoverClusterHits()

void Muon::MuonChamberHoleRecoveryTool::recoverClusterHits ( const EventContext & ctx,
const Identifier & chId,
const Trk::TrackParameters & chambPars,
NewTrackStates & newStates,
std::set< Identifier > & knownLayers ) const
private

Definition at line 324 of file MuonChamberHoleRecoveryTool.cxx.

327 {
328
329 NewTrackStates recovered{};
330 if (m_idHelperSvc->isRpc(chambId)) {
331 recovered = recoverChamberClusters(ctx, m_key_rpc, chambId, pars, knownLayers);
332 } else if (m_idHelperSvc->isTgc(chambId)) {
333 recovered = recoverChamberClusters(ctx, m_key_tgc, chambId, pars, knownLayers);
334 } else if (m_idHelperSvc->isCsc(chambId)) {
335 recovered = recoverChamberClusters(ctx, m_key_csc, chambId, pars, knownLayers);
336 } else if (m_idHelperSvc->isMM(chambId)) {
337 recovered = recoverChamberClusters(ctx, m_key_mm, chambId, pars, knownLayers);
338 } else if (m_idHelperSvc->issTgc(chambId)) {
339 recovered = recoverChamberClusters(ctx, m_key_stgc, chambId, pars, knownLayers);
340 }
341 states.insert(states.end(), std::make_move_iterator(recovered.begin()),
342 std::make_move_iterator(recovered.end()));
343 }
NewTrackStates recoverChamberClusters(const EventContext &ctx, const SG::ReadHandleKey< MuonPrepDataContainerT< Prd > > &prdKey, const Identifier &chambId, const Trk::TrackParameters &parsInChamb, std::set< Identifier > &knownLayers) const
Attempts to recover all missing hits in a chamber.

◆ recoverHitsInChamber()

void Muon::MuonChamberHoleRecoveryTool::recoverHitsInChamber ( const EventContext & ctx,
RecoveryState & trkRecov ) const
private

Loops over all muon hits in a muon chamber and tries to find missed ones by checking each tracking layer for hits.

If a new chamber is reached another iteration of the method is called

Collect all hits in a chamber

New chamber added

Definition at line 193 of file MuonChamberHoleRecoveryTool.cxx.

193 {
194 const Muon::MuonStationIndex::ChIndex currStation = m_idHelperSvc->chamberIndex(trkRecov.tsosId);
196 std::set<Identifier> chambInStation{};
197 do {
198 if (currStation != m_idHelperSvc->chamberIndex(trkRecov.tsosId)) {
199 trkRecov.finalizeChamber();
200 recoverHitsInChamber(ctx, trkRecov);
201 return;
202 }
205 if (chambInStation.insert(m_idHelperSvc->chamberId(trkRecov.tsosId)).second) {
206 if (m_idHelperSvc->isMdt(trkRecov.tsosId)) {
207 recoverMdtHits(ctx, trkRecov.tsosId, *trkRecov.tsos()->trackParameters(),
208 trkRecov.chamberStates, trkRecov.layersOnTrk);
209 } else {
210 recoverClusterHits(ctx, trkRecov.tsosId, *trkRecov.tsos()->trackParameters(),
211 trkRecov.chamberStates, trkRecov.layersOnTrk);
212 }
213 }
215 trkRecov.finalizeChamber();
216 }
void recoverMdtHits(const EventContext &ctx, const Identifier &chId, const Trk::TrackParameters &pars, NewTrackStates &newStates, std::set< Identifier > &knownLayers) const
ChIndex
enum to classify the different chamber layers in the muon spectrometer

◆ recoverMdtHits()

void Muon::MuonChamberHoleRecoveryTool::recoverMdtHits ( const EventContext & ctx,
const Identifier & chId,
const Trk::TrackParameters & pars,
NewTrackStates & newStates,
std::set< Identifier > & knownLayers ) const
private

calculate Amg::Vector2D using surf to obtain sign

calculate side

update sign

pointer to resPull

Overwrite the previous drift circle if the pull of this one is better or it's an outlier

Definition at line 217 of file MuonChamberHoleRecoveryTool.cxx.

220 {
221
222
223 std::set<Identifier> chHoles = holesInMdtChamber(ctx, pars.position(), pars.momentum().unit(), chId, knownLayers);
224 ATH_MSG_VERBOSE(" chamber " << m_idHelperSvc->toStringChamber(chId) << " has holes " << chHoles.size());
225 if (chHoles.empty()) return;
226
227 const std::vector<const MdtPrepData*> prdCandidates{loadPrepDataHits<MdtPrepData>(ctx, m_key_mdt, chHoles)};
228 bool addedState{false};
229 for (const MdtPrepData* mdtPrd : prdCandidates) {
230 const Trk::StraightLineSurface& surf{mdtPrd->detectorElement()->surface(mdtPrd->identify())};
231 std::unique_ptr<Trk::TrackParameters> exPars = m_extrapolator->extrapolateDirectly(ctx, pars, surf, Trk::anyDirection, false, Trk::muon);
232 if (!exPars) {
233 ATH_MSG_VERBOSE("Propagation to "<<m_idHelperSvc->toString(mdtPrd->identify())<<" failed.");
234 continue;
235 }
236
238 Amg::Vector2D locPos{Amg::Vector2D::Zero()};
239 if (!surf.globalToLocal(exPars->position(), exPars->momentum(), locPos)) {
240 ATH_MSG_DEBUG(" failed to calculate drift sign ");
241 continue;
242 }
243 if (!surf.insideBounds(locPos)) {
244 chHoles.erase(mdtPrd->identify());
245 continue;
246 }
247
248 // calibrate Mdt PRD
249 const Amg::Vector3D momentum = exPars->momentum();
250 std::unique_ptr<MdtDriftCircleOnTrack> mdtROT{m_mdtRotCreator->createRIO_OnTrack(*mdtPrd,
251 exPars->position(),
252 &momentum)};
253 if (!mdtROT) continue;
254
258 m_mdtRotCreator->updateSign(*mdtROT, side);
259
261 std::optional<const Trk::ResidualPull> resPull{m_pullCalculator->residualPull(mdtROT.get(),
262 exPars.get(),
264 if (!resPull) { continue; }
265
266 const double pull = resPull->pull().front();
267 const double radialResidual = std::abs(mdtROT->localParameters()[Trk::locR]) -
268 std::abs(exPars->parameters()[Trk::locR]);
269
270 unsigned int hitFlag = 1;
271 if (mdtPrd->adc() < m_adcCut || mdtPrd->status() != MdtStatusDriftTime)
272 hitFlag = 3; // noise
273 else if (std::abs(pull) < m_associationPullCutEta)
274 hitFlag = 0; // hit on track
275 else if (radialResidual > 0.)
276 hitFlag = 2; // out of time
277
278 ATH_MSG_VERBOSE(__func__<<"() - Recover "<<m_printer->print(*mdtROT)<<" pull: "<<pull<<" hitFlag: "<<hitFlag);
279 std::unique_ptr<Trk::TrackStateOnSurface> tsos = MuonTSOSHelper::createMeasTSOS(std::move(mdtROT),
280 std::move(exPars),
281 (hitFlag != 0 || !m_addMeasurements) ?
284
285 if (!addedState) {
286 newStates.emplace_back(std::move(tsos));
287 addedState = true;
288 } else {
289 const MdtDriftCircleOnTrack* prevDC = static_cast<const MdtDriftCircleOnTrack*>(newStates.back()->measurementOnTrack());
290 if (prevDC->identify() != mdtPrd->identify()) {
291 newStates.emplace_back(std::move(tsos));
292 } else {
293 ATH_MSG_DEBUG("Two hits recorded for the same tube "<<std::endl<<
294 " *** current: "<<m_printer->print(*tsos->measurementOnTrack())<<std::endl<<
295 " *** previous: "<<m_printer->print(*prevDC));
296 std::optional<Trk::ResidualPull> prevPullObj{m_pullCalculator->residualPull(prevDC,
297 tsos->trackParameters(),
299 const double prevPull = prevPullObj->pull().front();
301 if (std::abs(pull) < std::abs(prevPull) ||
303 newStates.back()->type(Trk::TrackStateOnSurface::Outlier))) {
304 newStates.back() = std::move(tsos);
305 }
306
307 }
308 }
309 chHoles.erase(mdtPrd->identify());
310 knownLayers.insert(mdtPrd->identify());
311 }
312
313 for (const Identifier& hole : chHoles) {
314 const Trk::Surface& surf{getDetectorElement(ctx, hole)->surface(hole)};
315 std::unique_ptr<Trk::TrackParameters> exPars = m_extrapolator->extrapolateDirectly(ctx, pars, surf, Trk::anyDirection, false, Trk::muon);
316 if (!exPars) {
317 ATH_MSG_VERBOSE("Propagation to "<<m_idHelperSvc->toString(hole)<<" failed.");
318 continue;
319 }
320 ATH_MSG_VERBOSE(__func__<<"() - Add hole "<<m_idHelperSvc->toString(hole));
321 newStates.emplace_back(MuonTSOSHelper::createHoleTSOS(std::move(exPars)));
322 }
323 }
std::set< Identifier > holesInMdtChamber(const EventContext &ctx, const Amg::Vector3D &position, const Amg::Vector3D &direction, const Identifier &chId, const std::set< Identifier > &tubeIds) const
calculate holes in a given chamber using local straight line extrapolation
Identifier identify() const
return the identifier -extends MeasurementBase
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override final
Specified for StraightLineSurface: GlobalToLocal method without dynamic memory allocation This method...
virtual bool insideBounds(const Amg::Vector2D &locpos, double tol1=0., double tol2=0.) const override final
This surface calls the iside method of the bouns.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
Eigen::Matrix< double, 3, 1 > Vector3D
@ MdtStatusDriftTime
The tube produced a vaild measurement.
DriftCircleSide
Enumerates the 'side' of the wire on which the tracks passed (i.e.
@ RIGHT
the drift radius is positive (see Trk::AtaStraightLine)
@ LEFT
the drift radius is negative (see Trk::AtaStraightLine)
@ driftRadius
trt, straws
Definition ParamDefs.h:53
@ locR
Definition ParamDefs.h:44

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_adcCut

Gaudi::Property<double> Muon::MuonChamberHoleRecoveryTool::m_adcCut {this, "AdcCut", 50}
private

Definition at line 197 of file MuonChamberHoleRecoveryTool.h.

197{this, "AdcCut", 50};

◆ m_addMeasurements

Gaudi::Property<bool> Muon::MuonChamberHoleRecoveryTool::m_addMeasurements {this, "AddMeasurements", true}
private

Definition at line 192 of file MuonChamberHoleRecoveryTool.h.

192{this, "AddMeasurements", true};

◆ m_associationPullCutEta

Gaudi::Property<double> Muon::MuonChamberHoleRecoveryTool::m_associationPullCutEta {this, "AssociationPullCutEta", 3}
private

Definition at line 195 of file MuonChamberHoleRecoveryTool.h.

195{this, "AssociationPullCutEta", 3};

◆ m_associationPullCutPhi

Gaudi::Property<double> Muon::MuonChamberHoleRecoveryTool::m_associationPullCutPhi {this, "AssociationPullCutPhi", 10}
private

Definition at line 196 of file MuonChamberHoleRecoveryTool.h.

196{this, "AssociationPullCutPhi", 10};

◆ m_chamberGeoKey

SG::ReadCondHandleKey<Muon::MuonIntersectGeoData> Muon::MuonChamberHoleRecoveryTool::m_chamberGeoKey {this, "ChamberGeoKey", "MuonStationIntersects", "Pointer to hole search service"}
private

Definition at line 190 of file MuonChamberHoleRecoveryTool.h.

190{this, "ChamberGeoKey", "MuonStationIntersects", "Pointer to hole search service"};

◆ m_clusRotCreator

ToolHandle<Muon::IMuonClusterOnTrackCreator> Muon::MuonChamberHoleRecoveryTool::m_clusRotCreator
private
Initial value:
{this, "ClusterRotCreator",
"Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator",
"IMuonClusterOnTrackCreator for RPC, TGC, NSW hits"}

Definition at line 173 of file MuonChamberHoleRecoveryTool.h.

173 {this, "ClusterRotCreator",
174 "Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator",
175 "IMuonClusterOnTrackCreator for RPC, TGC, NSW hits"};

◆ m_cscRotCreator

ToolHandle<Muon::IMuonClusterOnTrackCreator> Muon::MuonChamberHoleRecoveryTool::m_cscRotCreator
private
Initial value:
{
this, "CscRotCreator", "", "IMuonClusterOnTrackCreator for cscs"}

Definition at line 171 of file MuonChamberHoleRecoveryTool.h.

171 {
172 this, "CscRotCreator", "", "IMuonClusterOnTrackCreator for cscs"};

◆ m_detectBadSort

Gaudi::Property<bool> Muon::MuonChamberHoleRecoveryTool::m_detectBadSort {this, "DetectBadSorting", false}
private

Definition at line 193 of file MuonChamberHoleRecoveryTool.h.

193{this, "DetectBadSorting", false};

◆ m_DetectorManagerKey

SG::ReadCondHandleKey<MuonGM::MuonDetectorManager> Muon::MuonChamberHoleRecoveryTool::m_DetectorManagerKey
private
Initial value:
{this, "DetectorManagerKey", "MuonDetectorManager",
"Key of input MuonDetectorManager condition data"}

Definition at line 179 of file MuonChamberHoleRecoveryTool.h.

179 {this, "DetectorManagerKey", "MuonDetectorManager",
180 "Key of input MuonDetectorManager condition data"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_edmHelperSvc

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

Definition at line 158 of file MuonChamberHoleRecoveryTool.h.

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

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extrapolator

ToolHandle<Trk::IExtrapolator> Muon::MuonChamberHoleRecoveryTool::m_extrapolator {this, "Extrapolator", "Trk::Extrapolator/MuonExtrapolator"}
private

Definition at line 167 of file MuonChamberHoleRecoveryTool.h.

167{this, "Extrapolator", "Trk::Extrapolator/MuonExtrapolator"};

◆ m_idHelperSvc

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

Definition at line 157 of file MuonChamberHoleRecoveryTool.h.

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

◆ m_key_csc

SG::ReadHandleKey<Muon::CscPrepDataContainer> Muon::MuonChamberHoleRecoveryTool::m_key_csc {this, "CscPrepDataContainer", "CSC_Clusters", "CSC PRDS"}
private

Definition at line 183 of file MuonChamberHoleRecoveryTool.h.

183{this, "CscPrepDataContainer", "CSC_Clusters", "CSC PRDS"};

◆ m_key_mdt

SG::ReadHandleKey<Muon::MdtPrepDataContainer> Muon::MuonChamberHoleRecoveryTool::m_key_mdt {this, "MdtPrepDataContainer", "MDT_DriftCircles", "MDT PRDs"}
private

Definition at line 182 of file MuonChamberHoleRecoveryTool.h.

182{this, "MdtPrepDataContainer", "MDT_DriftCircles", "MDT PRDs"};

◆ m_key_mm

SG::ReadHandleKey<Muon::MMPrepDataContainer> Muon::MuonChamberHoleRecoveryTool::m_key_mm {this, "MMPrepDataContainer", "MM_Measurements", "MM PRDs"}
private

Definition at line 187 of file MuonChamberHoleRecoveryTool.h.

187{this, "MMPrepDataContainer", "MM_Measurements", "MM PRDs"};

◆ m_key_rpc

SG::ReadHandleKey<Muon::RpcPrepDataContainer> Muon::MuonChamberHoleRecoveryTool::m_key_rpc {this, "RpcPrepDataContainer", "RPC_Measurements", "RPC PRDs"}
private

Definition at line 185 of file MuonChamberHoleRecoveryTool.h.

185{this, "RpcPrepDataContainer", "RPC_Measurements", "RPC PRDs"};

◆ m_key_stgc

SG::ReadHandleKey<Muon::sTgcPrepDataContainer> Muon::MuonChamberHoleRecoveryTool::m_key_stgc {this, "sTgcPrepDataContainer", "STGC_Measurements", "sTGC PRDs"}
private

Definition at line 186 of file MuonChamberHoleRecoveryTool.h.

186{this, "sTgcPrepDataContainer", "STGC_Measurements", "sTGC PRDs"};

◆ m_key_tgc

SG::ReadHandleKey<Muon::TgcPrepDataContainer> Muon::MuonChamberHoleRecoveryTool::m_key_tgc {this, "TgcPrepDataContainer", "TGC_Measurements", "TGC PRDs"}
private

Definition at line 184 of file MuonChamberHoleRecoveryTool.h.

184{this, "TgcPrepDataContainer", "TGC_Measurements", "TGC PRDs"};

◆ m_mdtRotCreator

ToolHandle<Muon::IMdtDriftCircleOnTrackCreator> Muon::MuonChamberHoleRecoveryTool::m_mdtRotCreator
private
Initial value:
{this, "MdtRotCreator",
"Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator",
"IMdtDriftCircleOnTrackCreator full calibration"}

Definition at line 168 of file MuonChamberHoleRecoveryTool.h.

168 {this, "MdtRotCreator",
169 "Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator",
170 "IMdtDriftCircleOnTrackCreator full calibration"};

◆ m_printer

PublicToolHandle<Muon::MuonEDMPrinterTool> Muon::MuonChamberHoleRecoveryTool::m_printer {this, "EDMPrinter", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}
private

Definition at line 166 of file MuonChamberHoleRecoveryTool.h.

166{this, "EDMPrinter", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};

◆ m_pullCalculator

ToolHandle<Trk::IResidualPullCalculator> Muon::MuonChamberHoleRecoveryTool::m_pullCalculator
private
Initial value:
{this, "PullCalculator",
"Trk::ResidualPullCalculator/ResidualPullCalculator"}

Definition at line 176 of file MuonChamberHoleRecoveryTool.h.

176 {this, "PullCalculator",
177 "Trk::ResidualPullCalculator/ResidualPullCalculator"};

◆ m_trackingVolumesSvc

ServiceHandle<Trk::ITrackingVolumesSvc> Muon::MuonChamberHoleRecoveryTool::m_trackingVolumesSvc {this, "TrackingVolumesSvc", "Trk::TrackingVolumesSvc/TrackingVolumesSvc"}
private

Definition at line 161 of file MuonChamberHoleRecoveryTool.h.

161{this, "TrackingVolumesSvc", "Trk::TrackingVolumesSvc/TrackingVolumesSvc"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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