ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::MuPatCandidateTool Class Reference

class to manipulate MuPatCandidateBase objects More...

#include <MuPatCandidateTool.h>

Inheritance diagram for Muon::MuPatCandidateTool:
Collaboration diagram for Muon::MuPatCandidateTool:

Public Types

using MeasVec = std::vector<const Trk::MeasurementBase*>
typedef MeasVec::iterator MeasIt
typedef MeasVec::const_iterator MeasCit

Public Member Functions

 MuPatCandidateTool (const std::string &, const std::string &, const IInterface *)
 default AlgTool constructor
virtual ~MuPatCandidateTool ()=default
 destructor
virtual StatusCode initialize () override
 initialize method, method taken from bass-class AlgTool
bool extendWithSegment (MuPatTrack &can, MuPatSegment &segInfo, std::unique_ptr< Trk::Track > &track) const
 extend a track candidate with a segment
std::unique_ptr< MuPatTrackcreateCandidate (MuPatSegment &segInfo, std::unique_ptr< Trk::Track > &track) const
 create a track candidate from one segment
std::unique_ptr< MuPatTrackcreateCandidate (MuPatSegment &segInfo1, MuPatSegment &segInfo2, std::unique_ptr< Trk::Track > &track) const
 create a track candidate from two segments
std::unique_ptr< MuPatTrackcreateCandidate (std::unique_ptr< Trk::Track > &track) const
 create a track candidate from a track
bool updateTrack (MuPatTrack &candidate, std::unique_ptr< Trk::Track > &track) const
 set the new track in the candidate, and update candidate contents.
bool recalculateCandidateSegmentContent (MuPatTrack &candidate) const
 recalculate the chamber indices on the candidate and reset them.
std::unique_ptr< MuPatSegmentcreateSegInfo (const EventContext &ctx, const MuonSegment &segment) const
 create a MuPatSegment object from a segment
std::set< const MuonGM::MuonReadoutElement * > readoutElements (const MuPatCandidateBase &entry) const
 get list of the readout elements of the hits on the entry
std::string print (const MuPatSegment &segment, int level=0) const
 print the measurements on the track to string
std::string print (const std::vector< MuPatSegment * > &segments, int level=0) const
std::string print (const MuPatCandidateBase &candidate, int level=0) const
std::string print (const MuPatTrack &track, int level=0) const
std::string print (const std::vector< std::unique_ptr< MuPatTrack > > &tracks, int level=0) const
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

Static Public Member Functions

static const InterfaceID & interfaceID ()
 access to tool interface
static std::unique_ptr< MuPatTrackcopyCandidate (MuPatTrack *canIn)
 copy a candidate without copying the track (lazy pointer copy)

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

void updateHits (MuPatCandidateBase &entry, const MeasVec &measurements, bool recreateMDT=false, bool recreateCSC=false, bool createComp=false) const
 update hits for a MuPatCandidateBase
void addCluster (const Trk::MeasurementBase &meas, std::vector< const MuonClusterOnTrack * > &rots) const
 extract MuonClusterOnTrack('s) from measurement
void createAndAddCompetingROTs (const std::vector< const MuonClusterOnTrack * > &rots, MeasVec &hits, MeasVec &allHits, MuPatCandidateBase &entry) const
 create CompetingMuonClustersOnTracks from ROTs and add them to the MeasVec.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< IMdtDriftCircleOnTrackCreatorm_mdtRotCreator
ToolHandle< IMuonClusterOnTrackCreatorm_cscRotCreator
ToolHandle< IMuonCompetingClustersOnTrackCreatorm_compClusterCreator
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
ServiceHandle< IMuonEDMHelperSvcm_edmHelperSvc
PublicToolHandle< MuonEDMPrinterToolm_printer {this, "MuonPrinterTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}
ToolHandle< MuPatHitToolm_hitHandler {this, "HitTool", "Muon::MuPatHitTool/MuPatHitTool", "Tool to manipulate hit lists"}
ToolHandle< Muon::IMuonSegmentSelectionToolm_segmentSelector
Gaudi::Property< bool > m_createCompetingROTsPhi {this, "CreateCompetingROTsPhi", false}
Gaudi::Property< bool > m_createCompetingROTsEta {this, "CreateCompetingROTsEta", true}
Gaudi::Property< bool > m_doMdtRecreation {this, "DoMdtRecreation", false}
Gaudi::Property< bool > m_doCscRecreation {this, "DoCscRecreation", true}
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

class to manipulate MuPatCandidateBase objects

Definition at line 49 of file MuPatCandidateTool.h.

Member Typedef Documentation

◆ MeasCit

typedef MeasVec::const_iterator Muon::MuPatCandidateTool::MeasCit

Definition at line 53 of file MuPatCandidateTool.h.

◆ MeasIt

typedef MeasVec::iterator Muon::MuPatCandidateTool::MeasIt

Definition at line 52 of file MuPatCandidateTool.h.

◆ MeasVec

Definition at line 51 of file MuPatCandidateTool.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuPatCandidateTool()

Muon::MuPatCandidateTool::MuPatCandidateTool ( const std::string & t,
const std::string & n,
const IInterface * p )

default AlgTool constructor

Definition at line 34 of file MuPatCandidateTool.cxx.

34 :
35 AthAlgTool(t, n, p) {
36 declareInterface<MuPatCandidateTool>(this);
37 }
AthAlgTool()
Default constructor:

◆ ~MuPatCandidateTool()

virtual Muon::MuPatCandidateTool::~MuPatCandidateTool ( )
virtualdefault

destructor

Member Function Documentation

◆ addCluster()

void Muon::MuPatCandidateTool::addCluster ( const Trk::MeasurementBase & meas,
std::vector< const MuonClusterOnTrack * > & rots ) const
private

extract MuonClusterOnTrack('s) from measurement

Definition at line 283 of file MuPatCandidateTool.cxx.

283 {
284 const MuonClusterOnTrack* clus = dynamic_cast<const MuonClusterOnTrack*>(&meas);
285 if (clus)
286 rots.push_back(clus);
287 else {
288 const CompetingMuonClustersOnTrack* compclus = dynamic_cast<const CompetingMuonClustersOnTrack*>(&meas);
289 if (compclus) {
290 rots.insert(rots.end(), compclus->containedROTs().begin(), compclus->containedROTs().end());
291 } else {
292 Identifier id = m_edmHelperSvc->getIdentifier(meas);
293 ATH_MSG_WARNING(" Trigger Measurement is not a MuonClusterOnTrack or CompetingMuonClustersOnTrack!! "
294 << m_idHelperSvc->toString(id));
295 }
296 }
297 }
#define ATH_MSG_WARNING(x)
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc

◆ copyCandidate()

std::unique_ptr< MuPatTrack > Muon::MuPatCandidateTool::copyCandidate ( MuPatTrack * canIn)
static

copy a candidate without copying the track (lazy pointer copy)

Parameters
[in]canthe MuPatTrack to be copied
[out]thenew candidate, ownership is passed to caller. The new candidate will not own the track (lazy pointer copy)

Definition at line 95 of file MuPatCandidateTool.cxx.

95 {
96 // copy and update hits
97 std::unique_ptr<MuPatTrack> can = std::make_unique<MuPatTrack>(*canIn);
98 return can;
99 }

◆ createAndAddCompetingROTs()

void Muon::MuPatCandidateTool::createAndAddCompetingROTs ( const std::vector< const MuonClusterOnTrack * > & rots,
MuPatCandidateTool::MeasVec & hits,
MuPatCandidateTool::MeasVec & allHits,
MuPatCandidateBase & entry ) const
private

create CompetingMuonClustersOnTracks from ROTs and add them to the MeasVec.

NEVER pass mixed eta/phi hits!!

Definition at line 299 of file MuPatCandidateTool.cxx.

301 {
302 typedef std::map<Identifier, std::vector<const MuonClusterOnTrack*> > IdClusMap;
303 typedef IdClusMap::iterator IdClusIt;
304 IdClusMap idClusters;
305
306 // loop over hits and sort by detector element
307 for (const MuonClusterOnTrack* clus : rots) {
308 Identifier id = clus->identify();
309 Identifier detId = m_idHelperSvc->detElId(id);
310 idClusters[detId].push_back(clus);
311 }
312
313 ATH_MSG_DEBUG(" creating CompetingMuonClustersOnTrack for " << idClusters.size() << " chambers ");
314
315 IdClusIt chit = idClusters.begin();
316 IdClusIt chit_end = idClusters.end();
317 for (; chit != chit_end; ++chit) {
318 if (msgLvl(MSG::VERBOSE)) {
319 msg(MSG::VERBOSE )<<__FILE__<<":"<<__LINE__ << " in " << m_idHelperSvc->toStringDetEl(chit->first) << " clusters: " << chit->second.size()
320 << std::endl;
321 for (const MuonClusterOnTrack* cl_it : chit->second) {
322 msg(MSG::VERBOSE) << " " << m_idHelperSvc->toString(cl_it->identify());
323
324 // hack to get correct print-out
325 if (cl_it == chit->second.back())
326 msg(MSG::VERBOSE) << endmsg;
327 else
328 msg(MSG::VERBOSE) << std::endl;
329 }
330 }
331
332 if (chit->second.empty()) {
333 ATH_MSG_WARNING(" empty list, could not create CompetingMuonClustersOnTrack in chamber "
334 << m_idHelperSvc->toString(chit->first));
335 continue;
336 }
337
338 // only create competing ROT if there is more than one PRD
339 if (chit->second.size() == 1) {
340 hits.push_back(chit->second.front());
341 allHits.push_back(chit->second.front());
342 continue;
343 }
344
345 // create list of PRDs
346 std::list<const Trk::PrepRawData*> prds;
347 std::vector<const MuonClusterOnTrack*>::iterator cl_it = chit->second.begin();
348 std::vector<const MuonClusterOnTrack*>::iterator cl_it_end = chit->second.end();
349 for (; cl_it != cl_it_end; ++cl_it) {
350 const Trk::PrepRawData* prd = (*cl_it)->prepRawData();
351 if (prd) {
352 prds.push_back(prd);
353 } else {
354 ATH_MSG_WARNING("MuonClusterOnTrack has no PRD.");
355 }
356 }
357
358 std::unique_ptr<const CompetingMuonClustersOnTrack> comprot = m_compClusterCreator->createBroadCluster(prds, 0);
359 if (!comprot) {
360 ATH_MSG_WARNING(" could not create CompetingMuonClustersOnTrack in chamber " << m_idHelperSvc->toString(chit->first));
361 continue;
362 }
363 hits.push_back(comprot.get());
364 allHits.push_back(comprot.get());
365
366 // add to garbage collection
367 trash_bin.addToTrash(std::move(comprot));
368 }
369 }
#define endmsg
#define ATH_MSG_DEBUG(x)
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
ToolHandle< IMuonCompetingClustersOnTrackCreator > m_compClusterCreator

◆ createCandidate() [1/3]

std::unique_ptr< MuPatTrack > Muon::MuPatCandidateTool::createCandidate ( MuPatSegment & segInfo,
std::unique_ptr< Trk::Track > & track ) const

create a track candidate from one segment

Parameters
[in]seg1the first MuPatSegment to be added, ownership is NOT passed!
[in]seg2the second MuPatSegment to be added, ownership is NOT passed!
[in]trackthe new track, ownership is passed to the candidate
[out]thenew candidate, ownership is passed to caller

Definition at line 101 of file MuPatCandidateTool.cxx.

101 {
102 // create the new candidate
103 std::unique_ptr<MuPatTrack> candidate = std::make_unique< MuPatTrack>(&segInfo, track);
105 return candidate;
106 }
bool recalculateCandidateSegmentContent(MuPatTrack &candidate) const
recalculate the chamber indices on the candidate and reset them.

◆ createCandidate() [2/3]

std::unique_ptr< MuPatTrack > Muon::MuPatCandidateTool::createCandidate ( MuPatSegment & segInfo1,
MuPatSegment & segInfo2,
std::unique_ptr< Trk::Track > & track ) const

create a track candidate from two segments

Parameters
[in]seg1the first MuPatSegment to be added, ownership is NOT passed!
[in]seg2the second MuPatSegment to be added, ownership is NOT passed!
[in]trackthe new track, ownership is passed to the candidate
[out]thenew candidate, ownership is passed to caller

Definition at line 113 of file MuPatCandidateTool.cxx.

114 {
115 // create the new candidate
116 std::unique_ptr<MuPatTrack> candidate = std::make_unique<MuPatTrack>(&segInfo1, &segInfo2, track);
118 return candidate;
119 }

◆ createCandidate() [3/3]

std::unique_ptr< MuPatTrack > Muon::MuPatCandidateTool::createCandidate ( std::unique_ptr< Trk::Track > & track) const

create a track candidate from a track

Parameters
[in]trackthe new track, ownership is passed to the candidate
[out]thenew candidate, ownership is passed to caller

Definition at line 121 of file MuPatCandidateTool.cxx.

121 {
122 // create a dummy segment vector
123 std::vector<MuPatSegment*> segments;
124
125 // create the new candidate
126 std::unique_ptr<MuPatTrack> candidate = std::make_unique<MuPatTrack>(segments, track);
128 return candidate;
129 }

◆ createSegInfo()

std::unique_ptr< MuPatSegment > Muon::MuPatCandidateTool::createSegInfo ( const EventContext & ctx,
const MuonSegment & segment ) const

create a MuPatSegment object from a segment

Parameters
[in]segmentinput segment
[out]theMuPatSegment object, ownership is passed to caller

Definition at line 53 of file MuPatCandidateTool.cxx.

53 {
54 Identifier chid = m_edmHelperSvc->chamberId(segment);
55 if (m_idHelperSvc->isTrigger(chid)) {
56 ATH_MSG_WARNING("Trigger hit only segments not supported " << m_idHelperSvc->toStringChamber(chid));
57 return nullptr;
58 }
59 std::unique_ptr<MuPatSegment> info = std::make_unique<MuPatSegment>();
60 info->segment = &segment;
61 info->chid = chid;
62 info->chIndex = m_idHelperSvc->chamberIndex(info->chid);
63 std::set<Identifier> chIds = m_edmHelperSvc->chamberIds(segment);
64 for (const Identifier& id : chIds) {
65 MuonStationIndex::ChIndex chIdx = m_idHelperSvc->chamberIndex(id);
66 info->addChamber(chIdx);
67 // set default name
68 if (!info->name.empty()) info->name += "+";
69 // stationname_eta_phi
70 std::ostringstream oss;
71 oss << MuonStationIndex::chName(chIdx) << "_" << m_idHelperSvc->stationEta(id) << "_" << m_idHelperSvc->stationPhi(id);
72 info->name += oss.str();
73 }
74 info->stIndex = m_idHelperSvc->stationIndex(info->chid);
75 info->isEndcap = m_idHelperSvc->isEndcap(info->chid);
76 info->isMdt = m_idHelperSvc->isMdt(info->chid);
77 info->usedInFit = 0;
78 info->quality = m_segmentSelector->quality(segment);
79 info->segQuality = dynamic_cast<const MuonSegmentQuality*>(segment.fitQuality());
80
81 info->segPars.reset(m_edmHelperSvc->createTrackParameters(segment, 5000., 0.));
82 if (!info->segPars) { ATH_MSG_WARNING(" failed to create track parameter for segment "); }
83
84 updateHits(*info, info->segment->containedMeasurements(), m_doMdtRecreation, m_doCscRecreation, true);
85 m_hitHandler->create(ctx, segment, info->hitList());
86 return info;
87 }
ToolHandle< MuPatHitTool > m_hitHandler
ToolHandle< Muon::IMuonSegmentSelectionTool > m_segmentSelector
Gaudi::Property< bool > m_doCscRecreation
Gaudi::Property< bool > m_doMdtRecreation
void updateHits(MuPatCandidateBase &entry, const MeasVec &measurements, bool recreateMDT=false, bool recreateCSC=false, bool createComp=false) const
update hits for a MuPatCandidateBase
const FitQuality * fitQuality() const
return the FitQuality object, returns NULL if no FitQuality is defined
const std::string & chName(ChIndex index)
convert ChIndex into a string
ChIndex
enum to classify the different chamber layers in the muon spectrometer

◆ 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.

◆ extendWithSegment()

bool Muon::MuPatCandidateTool::extendWithSegment ( MuPatTrack & can,
MuPatSegment & segInfo,
std::unique_ptr< Trk::Track > & track ) const

extend a track candidate with a segment

Parameters
[in]canthe MuPatTrack to be extended
[in]trackthe new track, ownership is passed to the candidate
[in]segthe MuPatSegment to be added, ownership is NOT passed!
[out]trueif any segment was removed from the track, false if not

Definition at line 89 of file MuPatCandidateTool.cxx.

89 {
90 // add segment to candidate
91 can.addSegment(&segInfo, track);
93 }

◆ 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

◆ initialize()

StatusCode Muon::MuPatCandidateTool::initialize ( )
overridevirtual

initialize method, method taken from bass-class AlgTool

Definition at line 39 of file MuPatCandidateTool.cxx.

39 {
40 ATH_CHECK(m_idHelperSvc.retrieve());
41 ATH_CHECK(m_mdtRotCreator.retrieve());
42 ATH_CHECK(m_cscRotCreator.retrieve(EnableTool{m_idHelperSvc->hasCSC()}));
43
45 ATH_CHECK(m_hitHandler.retrieve());
46 ATH_CHECK(m_edmHelperSvc.retrieve());
47 ATH_CHECK(m_printer.retrieve());
48 ATH_CHECK(m_segmentSelector.retrieve());
49
50 return StatusCode::SUCCESS;
51 }
#define ATH_CHECK
Evaluate an expression and check for errors.
ToolHandle< IMuonClusterOnTrackCreator > m_cscRotCreator
ToolHandle< IMdtDriftCircleOnTrackCreator > m_mdtRotCreator
PublicToolHandle< MuonEDMPrinterTool > m_printer

◆ 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::MuPatCandidateTool::interfaceID ( )
inlinestatic

access to tool interface

Definition at line 66 of file MuPatCandidateTool.h.

66 {
67 static const InterfaceID IID_MuPatCandidateTool("Muon::MuPatCandidateTool", 1, 0);
68 return IID_MuPatCandidateTool;
69 }

◆ 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.

◆ print() [1/5]

std::string Muon::MuPatCandidateTool::print ( const MuPatCandidateBase & candidate,
int level = 0 ) const

Definition at line 492 of file MuPatCandidateTool.cxx.

492 {
493 const MuPatSegment* seg = dynamic_cast<const MuPatSegment*>(&candidate);
494 if (seg) return print(*seg, level);
495
496 const MuPatTrack* track = dynamic_cast<const MuPatTrack*>(&candidate);
497 if (track) return print(*track, level);
498
499 return "Unknown candidate type";
500 }
std::string print(const MuPatSegment &segment, int level=0) const
print the measurements on the track to string

◆ print() [2/5]

std::string Muon::MuPatCandidateTool::print ( const MuPatSegment & segment,
int level = 0 ) const

print the measurements on the track to string

This really belongs in MuonEDMPrinterTool in package MuonRecHelperTools. However, due to the tight tag collecting policy for release 15.5.0, this change is not likely to get accepted there. To be moved there as soon as release 16 is open

Definition at line 447 of file MuPatCandidateTool.cxx.

447 {
448 std::ostringstream oss;
449 oss << segment.name << ": " << m_printer->print(*segment.segment) << " q " << segment.quality;
450 if (level == 0) return oss.str();
451
452 if (segment.hitList().size() >= 2) {
453 DistanceAlongParameters distCal{};
454 oss << " length " << distCal(segment.hitList().front(), segment.hitList().back());
455 }
456 oss << std::endl << m_hitHandler->print(segment.hitList(), true, false, false);
457 return oss.str();
458 }

◆ print() [3/5]

std::string Muon::MuPatCandidateTool::print ( const MuPatTrack & track,
int level = 0 ) const

Definition at line 470 of file MuPatCandidateTool.cxx.

470 {
471 std::ostringstream oss;
472 oss << m_printer->print(track.track()) << std::endl << m_printer->printStations(track.track());
473
474 if (level == 0) return oss.str();
475
476 const std::vector<MuPatSegment*>& segs = track.segments();
477 oss << std::endl << print(segs, 0);
478
479 return oss.str();
480 }

◆ print() [4/5]

std::string Muon::MuPatCandidateTool::print ( const std::vector< MuPatSegment * > & segments,
int level = 0 ) const

Definition at line 460 of file MuPatCandidateTool.cxx.

460 {
461 std::vector<MuPatSegment*>::const_iterator it = segments.begin();
462 std::vector<MuPatSegment*>::const_iterator it_end = segments.end();
463 std::ostringstream oss;
464 oss << " Segment candidate vector: " << segments.size();
465 for (; it != it_end; ++it) oss << std::endl << print(**it, level);
466
467 return oss.str();
468 }

◆ print() [5/5]

std::string Muon::MuPatCandidateTool::print ( const std::vector< std::unique_ptr< MuPatTrack > > & tracks,
int level = 0 ) const

Definition at line 482 of file MuPatCandidateTool.cxx.

482 {
483 std::ostringstream oss;
484 oss << "MuPatTracks " << tracks.size() << std::endl;
485 std::vector<std::unique_ptr<MuPatTrack> >::const_iterator tit = tracks.begin();
486 std::vector<std::unique_ptr<MuPatTrack> >::const_iterator tit_end = tracks.end();
487 for (; tit != tit_end; ++tit) oss << " " << print(**tit, level) << std::endl;
488
489 return oss.str();
490 }

◆ readoutElements()

std::set< const MuonGM::MuonReadoutElement * > Muon::MuPatCandidateTool::readoutElements ( const MuPatCandidateBase & entry) const

get list of the readout elements of the hits on the entry

Definition at line 420 of file MuPatCandidateTool.cxx.

420 {
421 std::set<const MuonGM::MuonReadoutElement*> roEls;
422
423 MuPatHitCit it = entry.hitList().begin();
424 MuPatHitCit it_end = entry.hitList().end();
425 for (; it != it_end; ++it) {
426 if (!(*it)->info().id.is_valid()) continue;
427 // only want MDT or CSC detEls
428 if (!m_idHelperSvc->isMdt((*it)->info().id) && !m_idHelperSvc->isCsc((*it)->info().id)) continue;
429
430 const Trk::MeasurementBase& meas = (*it)->measurement();
431 const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(&meas);
432 if (!rot) {
433 const CompetingMuonClustersOnTrack* crot = dynamic_cast<const CompetingMuonClustersOnTrack*>(&meas);
434 if (crot) {
435 const std::vector<const MuonClusterOnTrack*>& rots = crot->containedROTs();
436 if (!rots.empty()) rot = rots.front();
437 }
438 }
439 if (rot) {
440 const MuonGM::MuonReadoutElement* roEl = dynamic_cast<const MuonGM::MuonReadoutElement*>(rot->detectorElement());
441 if (roEl) roEls.insert(roEl);
442 }
443 }
444 return roEls;
445 }
virtual const TrkDetElementBase * detectorElement() const =0
returns the detector element, assoicated with the PRD of this class
MuPatHitList::const_iterator MuPatHitCit
Definition MuPatHit.h:27

◆ recalculateCandidateSegmentContent()

bool Muon::MuPatCandidateTool::recalculateCandidateSegmentContent ( MuPatTrack & candidate) const

recalculate the chamber indices on the candidate and reset them.

Return whether segment has been removed.

Definition at line 371 of file MuPatCandidateTool.cxx.

371 {
372 // loop over track and get the chambers on the track
373 const Trk::TrackStates* states = candidate.track().trackStateOnSurfaces();
374 if (!states) return false;
375
376 std::set<MuonStationIndex::ChIndex> chambers;
377
378 // loop over TSOSs
379 for (const Trk::TrackStateOnSurface* tsos : *states) {
380 // only look at measurements
381 if (!tsos->type(Trk::TrackStateOnSurface::Measurement) || tsos->type(Trk::TrackStateOnSurface::Outlier)) continue;
382
383 // check whether state is a measurement
384 const Trk::MeasurementBase* meas = tsos->measurementOnTrack();
385 if (!meas) continue;
386
387 // get chamber index
388 Identifier id = m_edmHelperSvc->getIdentifier(*meas);
389 if (!id.is_valid() || !m_idHelperSvc->isMuon(id)) continue;
390
391 // don't include trigger hits
392 if (m_idHelperSvc->isTrigger(id)) continue;
393
394 chambers.insert(m_idHelperSvc->chamberIndex(id));
395
396 ATH_MSG_VERBOSE(" in recal " << m_idHelperSvc->toString(id));
397 }
398 if (msgLvl(MSG::VERBOSE)) {
399 ATH_MSG_VERBOSE(" recalculateCandidateSegmentContent, old chambers " << candidate.chambers().size() << " new chambers "
400 << chambers.size());
401 for (const MuonStationIndex::ChIndex& chit : candidate.chambers()) {
402 if (!chambers.count(chit)) { ATH_MSG_VERBOSE(" removing chamber index from candidate " << MuonStationIndex::chName(chit)); }
403 }
404 }
405
406 // reset chamber content
407 bool bRemovedSegments = candidate.resetChambersOnCandidate(chambers);
408
409 // recalculate hit list
410 candidate.hitList().clear();
411 m_hitHandler->create(candidate.track(), candidate.hitList());
412 // update the hit summary
413 updateHits(candidate, candidate.track().measurementsOnTrack()->stdcont());
414
415 ATH_MSG_VERBOSE("Print content after recalculateCandidateSegmentContent() -- "<<m_hitHandler->print(candidate.hitList()));
416
417 return bRemovedSegments;
418 }
#define ATH_MSG_VERBOSE(x)
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
DataVector< const Trk::TrackStateOnSurface > TrackStates

◆ 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.

◆ updateHits()

void Muon::MuPatCandidateTool::updateHits ( MuPatCandidateBase & entry,
const MeasVec & measurements,
bool recreateMDT = false,
bool recreateCSC = false,
bool createComp = false ) const
private

update hits for a MuPatCandidateBase

Definition at line 131 of file MuPatCandidateTool.cxx.

132 {
133 MeasVec etaHits{}, phiHits{}, fakePhiHits{}, allHits{};
134
135 unsigned int nmdtHitsMl1{0}, nmdtHitsMl2{0}, ncscHitsEta{0}, ncscHitsPhi{0}, nrpcHitsEta{0}, nrpcHitsPhi{0}, ntgcHitsEta{0},
136 ntgcHitsPhi{0};
137
138 entry.clearChambers(); // also clears stations and chamberIds
139
140 bool hasEndcap{false}, hasSmall{false}, hasLarge{false}, hassloverlap{false}, previssmall{false};
141 MuonStationIndex::StIndex prevstIndex = MuonStationIndex::StIndex::StUnknown;
142
143 Trk::MagneticFieldProperties magProps;
144
145 // vector to store trigger hits in case we have special treatment for them
146 std::vector<const MuonClusterOnTrack*> triggerHitsPhi{}, triggerHitsEta{};
147
148 // loop over hits
149 bool is_first_meas = true;
150 for (const Trk::MeasurementBase* meas : measurements) {
151 Identifier id = m_edmHelperSvc->getIdentifier(*meas);
152 if (!id.is_valid()) {
153 fakePhiHits.push_back(meas);
154 continue;
155 }
156
157 // skip ID hits
158 if (!m_idHelperSvc->isMuon(id)) continue;
159
160 Identifier chId = m_idHelperSvc->chamberId(id);
161 MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(chId);
162 MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(chId);
163 if (!hasEndcap) hasEndcap = m_idHelperSvc->isEndcap(id);
164
165 bool measuresPhi = false;
166
167 bool isMdt = m_idHelperSvc->isMdt(id);
168 bool isCsc = m_idHelperSvc->isCsc(id);
169 bool isNSW = m_idHelperSvc->isMM(id) || m_idHelperSvc->issTgc(id);
170 // only add precision hits
171 if (isMdt || isCsc || isNSW) {
172 entry.addChamber(chIndex); // will also add stationIndex
173 entry.chamberIds().insert(chId);
174 }
175 if (isMdt) {
176 // if in MDT recreation mode, recreate MDT using ROT creator. Store the pointer as we have to delete it ourselfs.
177 if (recreateMDT) {
178 if (!m_doMdtRecreation) {
180 " recreation of MDTs requiered although not configured via jobO, ignoring request. Please check jobO ");
181 } else {
182 const auto* mdt = dynamic_cast<const MdtDriftCircleOnTrack*>(meas);
183 if (!mdt) {
184 ATH_MSG_WARNING(" found MdtDriftCircleOnTrack without MDT identifier " << m_idHelperSvc->toString(id));
185 continue;
186 }
187 ATH_MSG_DEBUG(" recreating MdtDriftCircleOnTrack ");
188 meas = entry.addToTrash
189 (std::unique_ptr<const MdtDriftCircleOnTrack>
190 (m_mdtRotCreator->createRIO_OnTrack(*mdt->prepRawData(), mdt->globalPosition())));
191 }
192 }
193
194 const bool isSmall = m_idHelperSvc->isSmallChamber(id);
195 hasSmall |= isSmall;
196 hasLarge |= !isSmall;
197
198 if (isSmall != previssmall && !is_first_meas && stIndex == prevstIndex) hassloverlap = true;
199
200 is_first_meas = false;
201 previssmall = isSmall;
202 prevstIndex = stIndex;
203
204 unsigned int ml = m_idHelperSvc->mdtIdHelper().multilayer(id);
205 nmdtHitsMl1 += (ml ==1);
206 nmdtHitsMl2 += (ml ==2);
207 } else {
208 measuresPhi = m_idHelperSvc->measuresPhi(id);
209
210 const bool isRpc = m_idHelperSvc->isRpc(id);
211 const bool isTgc = m_idHelperSvc->isTgc(id);
212 nrpcHitsPhi += (measuresPhi && isRpc);
213 nrpcHitsEta += (!measuresPhi && isRpc);
214
215 ntgcHitsPhi += (measuresPhi && isTgc);
216 ntgcHitsEta += (!measuresPhi && isTgc);
217
218 ncscHitsPhi+= (measuresPhi && isCsc);
219 ncscHitsEta+= (!measuresPhi && isCsc);
220 if (isCsc && recreateCSC) {
221 const auto* csc = dynamic_cast<const CscClusterOnTrack*>(meas);
222 if (!csc) {
223 ATH_MSG_WARNING(" found CscClusterOnTrack without CSC identifier " << m_idHelperSvc->toString(id));
224 continue;
225 }
226 ATH_MSG_DEBUG(" recreating CscClusterOnTrack ");
227 meas = entry.addToTrash
228 (std::unique_ptr<const MuonClusterOnTrack>
229 (m_cscRotCreator->createRIO_OnTrack(*csc->prepRawData(), csc->globalPosition())));
230 }
231
232
233 // if selected create competing ROTs for trigger hits
234 if (createComp && (isRpc || isTgc)) {
235 if (measuresPhi && m_createCompetingROTsPhi) {
236 addCluster(*meas, triggerHitsPhi);
237 continue;
238 } else if (!measuresPhi && m_createCompetingROTsEta) {
239 addCluster(*meas, triggerHitsEta);
240 continue;
241 }
242 }
243 }
244
245 allHits.push_back(meas);
246
247 if (measuresPhi) {
248 phiHits.push_back(meas);
249 } else {
250 etaHits.push_back(meas);
251 }
252 }
253
254 if (createComp) {
255 if (m_createCompetingROTsEta && !triggerHitsEta.empty()) createAndAddCompetingROTs(triggerHitsEta, etaHits, allHits, entry);
256 if (m_createCompetingROTsPhi && !triggerHitsPhi.empty()) createAndAddCompetingROTs(triggerHitsPhi, phiHits, allHits, entry);
257 }
258
259 entry.nmdtHitsMl1 = nmdtHitsMl1;
260 entry.nmdtHitsMl2 = nmdtHitsMl2;
261 entry.ncscHitsEta = ncscHitsEta;
262 entry.ncscHitsPhi = ncscHitsPhi;
263 entry.nrpcHitsEta = nrpcHitsEta;
264 entry.nrpcHitsPhi = nrpcHitsPhi;
265 entry.ntgcHitsEta = ntgcHitsEta;
266 entry.ntgcHitsPhi = ntgcHitsPhi;
267 if (!triggerHitsEta.empty() && etaHits.empty()) {
268 ATH_MSG_WARNING("did not find any eta hits");
269 }
270 entry.setEtaHits(etaHits);
271 if (!triggerHitsPhi.empty() && phiHits.empty()) {
272 ATH_MSG_WARNING("did not find any phi hits");
273 }
274 entry.setPhiHits(phiHits);
275 entry.setFakePhiHits(fakePhiHits);
276 entry.setAllHits(allHits);
277 entry.hasEndcap(hasEndcap);
278 entry.hasSmallChamber(hasSmall);
279 entry.hasLargeChamber(hasLarge);
280 entry.hasSLOverlap(hassloverlap);
281 }
std::vector< const Trk::MeasurementBase * > MeasVec
void createAndAddCompetingROTs(const std::vector< const MuonClusterOnTrack * > &rots, MeasVec &hits, MeasVec &allHits, MuPatCandidateBase &entry) const
create CompetingMuonClustersOnTracks from ROTs and add them to the MeasVec.
Gaudi::Property< bool > m_createCompetingROTsPhi
Gaudi::Property< bool > m_createCompetingROTsEta
void addCluster(const Trk::MeasurementBase &meas, std::vector< const MuonClusterOnTrack * > &rots) const
extract MuonClusterOnTrack('s) from measurement
StIndex
enum to classify the different station layers in the muon spectrometer
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.

◆ updateTrack()

bool Muon::MuPatCandidateTool::updateTrack ( MuPatTrack & candidate,
std::unique_ptr< Trk::Track > & track ) const

set the new track in the candidate, and update candidate contents.

Candidate takes ownership of track. Returns whether segments have been removed compared to the pre-existing list of segments.

Definition at line 108 of file MuPatCandidateTool.cxx.

108 {
109 candidate.updateTrack(track);
110 return recalculateCandidateSegmentContent(candidate);
111 }

◆ 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_compClusterCreator

ToolHandle<IMuonCompetingClustersOnTrackCreator> Muon::MuPatCandidateTool::m_compClusterCreator
private
Initial value:
{
this, "CompetingClustersCreator", "Muon::TriggerChamberClusterOnTrackCreator/TriggerChamberClusterOnTrackCreator",
"tool to create competing clusters on track"}

Definition at line 157 of file MuPatCandidateTool.h.

157 {
158 this, "CompetingClustersCreator", "Muon::TriggerChamberClusterOnTrackCreator/TriggerChamberClusterOnTrackCreator",
159 "tool to create competing clusters on track"};

◆ m_createCompetingROTsEta

Gaudi::Property<bool> Muon::MuPatCandidateTool::m_createCompetingROTsEta {this, "CreateCompetingROTsEta", true}
private

Definition at line 169 of file MuPatCandidateTool.h.

169{this, "CreateCompetingROTsEta", true};

◆ m_createCompetingROTsPhi

Gaudi::Property<bool> Muon::MuPatCandidateTool::m_createCompetingROTsPhi {this, "CreateCompetingROTsPhi", false}
private

Definition at line 168 of file MuPatCandidateTool.h.

168{this, "CreateCompetingROTsPhi", false};

◆ m_cscRotCreator

ToolHandle<IMuonClusterOnTrackCreator> Muon::MuPatCandidateTool::m_cscRotCreator
private
Initial value:
{
this, "CscRotCreator", "Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator", "tool to calibrate CSC hits"}

Definition at line 155 of file MuPatCandidateTool.h.

155 {
156 this, "CscRotCreator", "Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator", "tool to calibrate CSC hits"};

◆ 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_doCscRecreation

Gaudi::Property<bool> Muon::MuPatCandidateTool::m_doCscRecreation {this, "DoCscRecreation", true}
private

Definition at line 171 of file MuPatCandidateTool.h.

171{this, "DoCscRecreation", true};

◆ m_doMdtRecreation

Gaudi::Property<bool> Muon::MuPatCandidateTool::m_doMdtRecreation {this, "DoMdtRecreation", false}
private

Definition at line 170 of file MuPatCandidateTool.h.

170{this, "DoMdtRecreation", false};

◆ m_edmHelperSvc

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

Definition at line 161 of file MuPatCandidateTool.h.

161 {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
162 "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_hitHandler

ToolHandle<MuPatHitTool> Muon::MuPatCandidateTool::m_hitHandler {this, "HitTool", "Muon::MuPatHitTool/MuPatHitTool", "Tool to manipulate hit lists"}
private

Definition at line 164 of file MuPatCandidateTool.h.

164{this, "HitTool", "Muon::MuPatHitTool/MuPatHitTool", "Tool to manipulate hit lists"};

◆ m_idHelperSvc

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

Definition at line 160 of file MuPatCandidateTool.h.

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

◆ m_mdtRotCreator

ToolHandle<IMdtDriftCircleOnTrackCreator> Muon::MuPatCandidateTool::m_mdtRotCreator
private
Initial value:
{
this, "MdtRotCreator", "Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator", "tool to calibrate MDT hits"}

Definition at line 153 of file MuPatCandidateTool.h.

153 {
154 this, "MdtRotCreator", "Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator", "tool to calibrate MDT hits"};

◆ m_printer

PublicToolHandle<MuonEDMPrinterTool> Muon::MuPatCandidateTool::m_printer {this, "MuonPrinterTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}
private

Definition at line 163 of file MuPatCandidateTool.h.

163{this, "MuonPrinterTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};

◆ m_segmentSelector

ToolHandle<Muon::IMuonSegmentSelectionTool> Muon::MuPatCandidateTool::m_segmentSelector
private
Initial value:
{
this, "SegmentSelector", "Muon::MuonSegmentSelectionTool/MuonSegmentSelectionTool", "Tool to resolve track ambiguities"}

Definition at line 165 of file MuPatCandidateTool.h.

165 {
166 this, "SegmentSelector", "Muon::MuonSegmentSelectionTool/MuonSegmentSelectionTool", "Tool to resolve track ambiguities"};

◆ 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: