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

seeded segment finder that gets its data directly from storegate for a give set of Identifiers or IdentifierHashes More...

#include <MuonSeededSegmentFinder.h>

Inheritance diagram for Muon::MuonSeededSegmentFinder:
Collaboration diagram for Muon::MuonSeededSegmentFinder:

Public Member Functions

 MuonSeededSegmentFinder (const std::string &, const std::string &, const IInterface *)
 constructor
 ~MuonSeededSegmentFinder ()=default
 destructor
StatusCode initialize ()
 AlgTool initilize.
std::unique_ptr< Trk::SegmentCollectionfind (const EventContext &ctx, const Trk::TrackParameters &pars, const std::set< Identifier > &chIds) const
 find segments in a set of chambers starting from seeding TrackParameters
std::unique_ptr< Trk::SegmentCollectionfind (const EventContext &ctx, const Trk::TrackParameters &pars, const std::set< IdentifierHash > &chIdHs) const
 find segments in a set of chambers starting from seeding TrackParameters (version with Hashes)
std::unique_ptr< Trk::SegmentCollectionfind (const EventContext &ctx, const Trk::TrackParameters &pars, const std::vector< const MdtPrepData * > &mdtPrds) const
 find segments in a set of MdtPrepData starting from seeding TrackParameters
void extractMdtPrdCols (const EventContext &ctx, const std::set< IdentifierHash > &chIdHs, std::vector< const MdtPrepDataCollection * > &target) const
 retrieve MDT PRD collections for the given hashes
void extractRpcPrdCols (const EventContext &ctx, const std::set< IdentifierHash > &chIdHs, std::vector< const RpcPrepDataCollection * > &target) const
 retrieve RPC PRD collections for the given hashes
void extractTgcPrdCols (const EventContext &ctx, const std::set< IdentifierHash > &chIdHs, std::vector< const TgcPrepDataCollection * > &target) const
 retrieve TGC PRD collections for the given hashes
void extractCscPrdCols (const std::set< IdentifierHash > &chIdHs, std::vector< const CscPrepDataCollection * > &target) const
 retrieve CSC PRD collections for the given hashes
void extractsTgcPrdCols (const EventContext &ctx, const std::set< IdentifierHash > &chIdHs, std::vector< const sTgcPrepDataCollection * > &target) const
 retrieve STGC PRD collections for the given hashes
void extractMMPrdCols (const std::set< IdentifierHash > &chIdHs, std::vector< const MMPrepDataCollection * > &target) const
 retrieve MM PRD collections for the given hashes

Private Member Functions

std::vector< const MdtPrepData * > extractPrds (const EventContext &ctx, const std::set< Identifier > &chIds) const
 retrieve the MdtPrepDataCollections for the give Identifiers
std::vector< const MdtPrepData * > extractPrds (const EventContext &ctx, const std::set< IdentifierHash > &chIdHs) const
 retrieve the MdtPrepDataCollections for the give Identifier Hashes
void selectAndCalibrate (const EventContext &ctx, const Trk::TrackParameters &pars, const std::vector< const MdtPrepData * > &mdtPrdCols, std::vector< const MdtDriftCircleOnTrack * > &mdtROTs, bool &doHoleSearch) const
 select a set of Mdt hits and calibrate them
const MdtDriftCircleOnTrackhandleMdtPrd (const EventContext &ctx, const Trk::TrackParameters &pars, const MdtPrepData &mdtPrd, bool &doHoleSearch) const
 select and calibrate a single MdtPrepData

Private Attributes

SG::ReadCondHandleKey< MuonGM::MuonDetectorManagerm_DetectorManagerKey
ToolHandle< Muon::IMuonSegmentMakerm_segMaker
 actual segment maker with hole search
ToolHandle< Muon::IMuonSegmentMakerm_segMakerNoHoles
 actual segment maker no hole search
ToolHandle< Trk::IPropagatorm_propagator
 propagator
ToolHandle< Muon::IMdtDriftCircleOnTrackCreatorm_mdtRotCreator
 IMdtDriftCircleOnTrackCreator.
Trk::MagneticFieldProperties m_magFieldProperties
 magnetic field properties
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
PublicToolHandle< Muon::MuonEDMPrinterToolm_printer
 EDM printer tool.
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"}
Gaudi::Property< double > m_adcCut {this, "AdcCut", 50}
Gaudi::Property< double > m_maxSigma {this, "MdtSigmaFromTrack", 3}

Detailed Description

seeded segment finder that gets its data directly from storegate for a give set of Identifiers or IdentifierHashes

Definition at line 30 of file MuonSeededSegmentFinder.h.

Constructor & Destructor Documentation

◆ MuonSeededSegmentFinder()

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

constructor

Definition at line 23 of file MuonSeededSegmentFinder.cxx.

23 :
24 base_class(ty, na, pa), m_magFieldProperties(Trk::NoField) {}
Trk::MagneticFieldProperties m_magFieldProperties
magnetic field properties
@ NoField
Field is set to 0., 0., 0.,.

◆ ~MuonSeededSegmentFinder()

Muon::MuonSeededSegmentFinder::~MuonSeededSegmentFinder ( )
default

destructor

Member Function Documentation

◆ extractCscPrdCols()

void Muon::MuonSeededSegmentFinder::extractCscPrdCols ( const std::set< IdentifierHash > & chIdHs,
std::vector< const CscPrepDataCollection * > & target ) const

retrieve CSC PRD collections for the given hashes

Definition at line 247 of file MuonSeededSegmentFinder.cxx.

248 {
249 if (m_key_csc.empty()) {
250 ATH_MSG_DEBUG("No CSC collection");
251 return;
252 }
253 SG::ReadHandle cscPrdContainer{m_key_csc};
254 if (cscPrdContainer->empty()) return;
255
256 // loop over chambers and get collections
257 std::set<IdentifierHash>::const_iterator chit = chIdHs.begin();
258 std::set<IdentifierHash>::const_iterator chit_end = chIdHs.end();
259 for (; chit != chit_end; ++chit) {
260 const auto* collptr = cscPrdContainer->indexFindPtr(*chit);
261 if (collptr == nullptr || collptr->empty()) { continue; }
262
263 ATH_MSG_DEBUG(" Adding for: " << m_idHelperSvc->toStringChamber(collptr->front()->identify()) << " size "
264 << collptr->size());
265
266 // reserve space for the new PRDs
267 target.push_back(collptr);
268 }
269 }
#define ATH_MSG_DEBUG(x)
SG::ReadHandleKey< Muon::CscPrepDataContainer > m_key_csc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc

◆ extractMdtPrdCols()

void Muon::MuonSeededSegmentFinder::extractMdtPrdCols ( const EventContext & ctx,
const std::set< IdentifierHash > & chIdHs,
std::vector< const MdtPrepDataCollection * > & target ) const

retrieve MDT PRD collections for the given hashes

Definition at line 186 of file MuonSeededSegmentFinder.cxx.

187 {
188
189 if (m_key_mdt.empty()) return;
190 SG::ReadHandle mdtPrdContainer{m_key_mdt, ctx};
191 if (mdtPrdContainer->empty()) return;
192
193 // loop over chambers and get collections
194 std::set<IdentifierHash>::const_iterator chit = chIdHs.begin();
195 std::set<IdentifierHash>::const_iterator chit_end = chIdHs.end();
196 for (; chit != chit_end; ++chit) {
197 const auto* collptr = mdtPrdContainer->indexFindPtr(*chit);
198 if (collptr == nullptr || collptr->empty()) { continue; }
199 ATH_MSG_DEBUG(" Adding for: " << m_idHelperSvc->toStringChamber(collptr->front()->identify()) << " size "
200 << collptr->size());
201
202 // reserve space for the new PRDs
203 target.push_back(collptr);
204 }
205 }
SG::ReadHandleKey< Muon::MdtPrepDataContainer > m_key_mdt

◆ extractMMPrdCols()

void Muon::MuonSeededSegmentFinder::extractMMPrdCols ( const std::set< IdentifierHash > & chIdHs,
std::vector< const MMPrepDataCollection * > & target ) const

retrieve MM PRD collections for the given hashes

Definition at line 306 of file MuonSeededSegmentFinder.cxx.

307 {
308 if (m_key_mm.key().empty()) {
309 ATH_MSG_DEBUG("no MM collection");
310 return;
311 }
312
313 SG::ReadHandle<Muon::MMPrepDataContainer> h_mmPrdCont(m_key_mm);
314 const Muon::MMPrepDataContainer* mmPrdContainer;
315 if (h_mmPrdCont.isValid()) {
316 mmPrdContainer = h_mmPrdCont.cptr();
317 } else {
318 ATH_MSG_WARNING("Cannot retrieve mmPrepDataContainer " << m_key_mm.key());
319 return;
320 }
321 if (mmPrdContainer->empty()) return;
322
323 // loop over chambers and get collections
324 std::set<IdentifierHash>::const_iterator chit = chIdHs.begin();
325 std::set<IdentifierHash>::const_iterator chit_end = chIdHs.end();
326 for (; chit != chit_end; ++chit) {
327 const auto* collptr = mmPrdContainer->indexFindPtr(*chit);
328 if (collptr == nullptr || collptr->empty()) { continue; }
329 ATH_MSG_DEBUG(" Adding for: " << m_idHelperSvc->toStringChamber(collptr->front()->identify()) << " size "
330 << collptr->size());
331
332 target.push_back(collptr);
333 }
334 }
#define ATH_MSG_WARNING(x)
bool empty() const
return true if container is empty
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
SG::ReadHandleKey< Muon::MMPrepDataContainer > m_key_mm
MuonPrepDataContainerT< MMPrepData > MMPrepDataContainer

◆ extractPrds() [1/2]

std::vector< const MdtPrepData * > Muon::MuonSeededSegmentFinder::extractPrds ( const EventContext & ctx,
const std::set< Identifier > & chIds ) const
private

retrieve the MdtPrepDataCollections for the give Identifiers

Definition at line 124 of file MuonSeededSegmentFinder.cxx.

124 {
125 SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey, ctx};
126 const MuonGM::MuonDetectorManager* MuonDetMgr{*DetectorManagerHandle};
127 if (MuonDetMgr == nullptr) {
128 ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object");
129 // return;
130 }
131
132 // set of IdHashes corresponding to these identifiers
133 std::set<IdentifierHash> chIdHs;
134
135 // loop over chambers and get collections
136 std::set<Identifier>::const_iterator chit = chIds.begin();
137 std::set<Identifier>::const_iterator chit_end = chIds.end();
138 for (; chit != chit_end; ++chit) {
139 if (!m_idHelperSvc->isMdt(*chit)) {
140 ATH_MSG_WARNING(" Requested chamber is not an MDT: " << m_idHelperSvc->toStringChamber(*chit));
141 continue;
142 }
143
144 const MuonGM::MdtReadoutElement* detEl = MuonDetMgr->getMdtReadoutElement(*chit);
145 if (!detEl) {
146 ATH_MSG_WARNING(" Requested chamber does not exist in geometry: " << m_idHelperSvc->toStringChamber(*chit));
147 continue;
148 }
149 chIdHs.insert(detEl->identifyHash());
150 }
151
152 // vector to store pointers to collections
153 std::vector<const MdtPrepData*> mdtPrds = extractPrds(ctx, chIdHs);
154
155 return mdtPrds;
156 }
#define ATH_MSG_ERROR(x)
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
IdentifierHash identifyHash() const override final
Returns the IdentifierHash of the MuonStation, i.e.
std::vector< const MdtPrepData * > extractPrds(const EventContext &ctx, const std::set< Identifier > &chIds) const
retrieve the MdtPrepDataCollections for the give Identifiers
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_DetectorManagerKey

◆ extractPrds() [2/2]

std::vector< const MdtPrepData * > Muon::MuonSeededSegmentFinder::extractPrds ( const EventContext & ctx,
const std::set< IdentifierHash > & chIdHs ) const
private

retrieve the MdtPrepDataCollections for the give Identifier Hashes

Definition at line 158 of file MuonSeededSegmentFinder.cxx.

159 {
160 SG::ReadHandle<Muon::MdtPrepDataContainer> h_mdtPrdCont(m_key_mdt, ctx);
161 const Muon::MdtPrepDataContainer* mdtPrdContainer;
162 if (h_mdtPrdCont.isValid()) {
163 mdtPrdContainer = h_mdtPrdCont.cptr();
164 } else {
165 ATH_MSG_WARNING("Cannot retrieve mdtPrepDataContainer " << m_key_mdt.key());
166 return {};
167 }
168
169 // vector to store pointers to collections
170 std::vector<const MdtPrepData*> mdtPrds;
171
172 // loop over chambers and get collections
173 std::set<IdentifierHash>::const_iterator chit = chIdHs.begin();
174 std::set<IdentifierHash>::const_iterator chit_end = chIdHs.end();
175 for (; chit != chit_end; ++chit) {
176 const auto* collptr = mdtPrdContainer->indexFindPtr(*chit);
177 if (collptr == nullptr) { continue; }
178
179 // reserve space for the new PRDs
180 mdtPrds.insert(mdtPrds.end(), collptr->begin(), collptr->end());
181 }
182
183 return mdtPrds;
184 }
MuonPrepDataContainerT< MdtPrepData > MdtPrepDataContainer

◆ extractRpcPrdCols()

void Muon::MuonSeededSegmentFinder::extractRpcPrdCols ( const EventContext & ctx,
const std::set< IdentifierHash > & chIdHs,
std::vector< const RpcPrepDataCollection * > & target ) const

retrieve RPC PRD collections for the given hashes

Definition at line 207 of file MuonSeededSegmentFinder.cxx.

208 {
209 if (m_key_rpc.empty()) return;
210 SG::ReadHandle rpcPrdContainer{m_key_rpc, ctx};
211 if (rpcPrdContainer->empty()) return;
212
213 // loop over chambers and get collections
214 std::set<IdentifierHash>::const_iterator chit = chIdHs.begin();
215 std::set<IdentifierHash>::const_iterator chit_end = chIdHs.end();
216 for (; chit != chit_end; ++chit) {
217 const auto* collptr = rpcPrdContainer->indexFindPtr(*chit);
218 if (collptr == nullptr || collptr->empty()) { continue; }
219 ATH_MSG_DEBUG(" Adding for: " << m_idHelperSvc->toStringChamber(collptr->front()->identify()) << " size "
220 << collptr->size());
221
222 // reserve space for the new PRDs
223 target.push_back(collptr);
224 }
225 }
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_key_rpc

◆ extractsTgcPrdCols()

void Muon::MuonSeededSegmentFinder::extractsTgcPrdCols ( const EventContext & ctx,
const std::set< IdentifierHash > & chIdHs,
std::vector< const sTgcPrepDataCollection * > & target ) const

retrieve STGC PRD collections for the given hashes

Definition at line 274 of file MuonSeededSegmentFinder.cxx.

275 {
276 if (m_key_stgc.key().empty()) {
277 ATH_MSG_DEBUG("no sTGC collection");
278 return;
279 }
280
281 SG::ReadHandle<Muon::sTgcPrepDataContainer> h_stgcPrdCont(m_key_stgc, ctx);
282 const Muon::sTgcPrepDataContainer* stgcPrdContainer;
283 if (h_stgcPrdCont.isValid()) {
284 stgcPrdContainer = h_stgcPrdCont.cptr();
285 } else {
286 ATH_MSG_WARNING("Cannot retrieve stgcPrepDataContainer " << m_key_stgc.key());
287 return;
288 }
289 if (stgcPrdContainer->empty()) return;
290
291 // loop over chambers and get collections
292 std::set<IdentifierHash>::const_iterator chit = chIdHs.begin();
293 std::set<IdentifierHash>::const_iterator chit_end = chIdHs.end();
294 for (; chit != chit_end; ++chit) {
295 const auto* collptr = stgcPrdContainer->indexFindPtr(*chit);
296 if (collptr == nullptr || collptr->empty()) { continue; }
297 ATH_MSG_DEBUG(" Adding for: " << m_idHelperSvc->toStringChamber(collptr->front()->identify()) << " size "
298 << collptr->size());
299
300 // reserve space for the new PRDs
301 target.push_back(collptr);
302 }
303 }
SG::ReadHandleKey< Muon::sTgcPrepDataContainer > m_key_stgc
MuonPrepDataContainerT< sTgcPrepData > sTgcPrepDataContainer

◆ extractTgcPrdCols()

void Muon::MuonSeededSegmentFinder::extractTgcPrdCols ( const EventContext & ctx,
const std::set< IdentifierHash > & chIdHs,
std::vector< const TgcPrepDataCollection * > & target ) const

retrieve TGC PRD collections for the given hashes

Definition at line 227 of file MuonSeededSegmentFinder.cxx.

228 {
229 if (m_key_tgc.empty()) return;
230 SG::ReadHandle tgcPrdContainer{m_key_tgc, ctx};
231 if (tgcPrdContainer->empty()) return;
232
233 // loop over chambers and get collections
234 std::set<IdentifierHash>::const_iterator chit = chIdHs.begin();
235 std::set<IdentifierHash>::const_iterator chit_end = chIdHs.end();
236 for (; chit != chit_end; ++chit) {
237 const auto* collptr = tgcPrdContainer->indexFindPtr(*chit);
238 if (collptr == nullptr || collptr->empty()) { continue; }
239 ATH_MSG_DEBUG(" Adding for: " << m_idHelperSvc->toStringChamber(collptr->front()->identify()) << " size "
240 << collptr->size());
241
242 // reserve space for the new PRDs
243 target.push_back(collptr);
244 }
245 }
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_key_tgc

◆ find() [1/3]

std::unique_ptr< Trk::SegmentCollection > Muon::MuonSeededSegmentFinder::find ( const EventContext & ctx,
const Trk::TrackParameters & pars,
const std::set< Identifier > & chIds ) const

find segments in a set of chambers starting from seeding TrackParameters

Definition at line 49 of file MuonSeededSegmentFinder.cxx.

50 {
51 // get MdtPrepData collections correspondign to the chamber Identifiers
52 std::vector<const MdtPrepData*> mdtPrds = extractPrds(ctx, chIds);
53
54 if (mdtPrds.empty()) {
55 ATH_MSG_DEBUG(" no MdtPrepData found ");
56 return {};
57 }
58
59 // find segments
60 return find(ctx, pars, mdtPrds);
61 }
std::unique_ptr< Trk::SegmentCollection > find(const EventContext &ctx, const Trk::TrackParameters &pars, const std::set< Identifier > &chIds) const
find segments in a set of chambers starting from seeding TrackParameters

◆ find() [2/3]

std::unique_ptr< Trk::SegmentCollection > Muon::MuonSeededSegmentFinder::find ( const EventContext & ctx,
const Trk::TrackParameters & pars,
const std::set< IdentifierHash > & chIdHs ) const

find segments in a set of chambers starting from seeding TrackParameters (version with Hashes)

Definition at line 63 of file MuonSeededSegmentFinder.cxx.

64 {
65 // get MdtPrepData collections correspondign to the chamber Identifiers
66 std::vector<const MdtPrepData*> mdtPrds = extractPrds(ctx, chIdHs);
67
68 if (mdtPrds.empty()) {
69 ATH_MSG_DEBUG(" no MdtPrepData found ");
70 return {};
71 }
72
73 // find segments
74 return find(ctx, pars, mdtPrds);
75 }

◆ find() [3/3]

std::unique_ptr< Trk::SegmentCollection > Muon::MuonSeededSegmentFinder::find ( const EventContext & ctx,
const Trk::TrackParameters & pars,
const std::vector< const MdtPrepData * > & mdtPrds ) const

find segments in a set of MdtPrepData starting from seeding TrackParameters

Definition at line 77 of file MuonSeededSegmentFinder.cxx.

78 {
79 // are we close to the chamber edge?
80 bool doHoleSearch = true;
81
82 // select and calibrate the MdtPrepData
83 std::vector<const MdtDriftCircleOnTrack*> mdtROTs;
84 mdtROTs.reserve(mdtPrds.size());
85 selectAndCalibrate(ctx, pars, mdtPrds, mdtROTs, doHoleSearch);
86
87 if (mdtROTs.empty()) {
88 ATH_MSG_DEBUG(" no MdtDriftCircles selected ");
89 return nullptr;
90 }
91
92 // create track road
93 double roadWidthEta = 1.;
94 if (pars.covariance()) {
95 double trackError = Amg::error(*pars.covariance(), Trk::theta);
96 ATH_MSG_DEBUG(" local track Error on theta " << trackError);
97 if (trackError < 0.2) trackError = 0.2;
98 roadWidthEta = 5. * trackError;
99 }
100 Trk::TrackRoad road(pars.position(), pars.momentum(), roadWidthEta, 1.);
101
102 // create dummy vector<vector>
103 std::vector<std::vector<const MdtDriftCircleOnTrack*> > mdtROTsVec;
104 mdtROTsVec.push_back(mdtROTs);
105 std::vector<std::vector<const MuonClusterOnTrack*> > clusterROTsVec;
106
107 // call segment finder
108 std::unique_ptr<Trk::SegmentCollection> segments(new Trk::SegmentCollection());
109 doHoleSearch ? m_segMaker->find(road, mdtROTsVec, clusterROTsVec, segments.get(), true)
110 : m_segMakerNoHoles->find(road, mdtROTsVec, clusterROTsVec, segments.get(), true);
111
112 // delete ROTs
113 std::for_each(mdtROTs.begin(), mdtROTs.end(), MuonDeleteObject<const MdtDriftCircleOnTrack>());
114
115 if (!segments) {
116 ATH_MSG_DEBUG(" No segments found ");
117 } else {
118 ATH_MSG_DEBUG(" Number of segments found: " << segments->size());
119 }
120
121 return segments;
122 }
ToolHandle< Muon::IMuonSegmentMaker > m_segMakerNoHoles
actual segment maker no hole search
void selectAndCalibrate(const EventContext &ctx, const Trk::TrackParameters &pars, const std::vector< const MdtPrepData * > &mdtPrdCols, std::vector< const MdtDriftCircleOnTrack * > &mdtROTs, bool &doHoleSearch) const
select a set of Mdt hits and calibrate them
ToolHandle< Muon::IMuonSegmentMaker > m_segMaker
actual segment maker with hole search
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 ...
DataVector< Trk::Segment > SegmentCollection
@ theta
Definition ParamDefs.h:66

◆ handleMdtPrd()

const MdtDriftCircleOnTrack * Muon::MuonSeededSegmentFinder::handleMdtPrd ( const EventContext & ctx,
const Trk::TrackParameters & pars,
const MdtPrepData & mdtPrd,
bool & doHoleSearch ) const
private

select and calibrate a single MdtPrepData

Definition at line 357 of file MuonSeededSegmentFinder.cxx.

358 {
359 // skip noise hits
360 if (mdtPrd.adc() < m_adcCut) return nullptr;
361
362 // get surface of PRD
363 const Identifier& id = mdtPrd.identify();
364 const MuonGM::MdtReadoutElement& detEl = *mdtPrd.detectorElement();
365 const Trk::StraightLineSurface& surf = detEl.surface(id);
366
367 // propagate segment parameters to first measurement
368 // retain ownership; this code deleted the exPars before
369 auto exPars = m_propagator->propagate(ctx, pars, surf, Trk::anyDirection, false, m_magFieldProperties);
370 if (!exPars) {
371 ATH_MSG_DEBUG(" Propagation failed!! ");
372 return nullptr;
373 }
374
375 // calculate position on wire + error
376 double distanceToWire = exPars->parameters()[Trk::locR];
377 double posAlongWire = exPars->parameters()[Trk::locZ];
378
379 double errorR = exPars->covariance() ? fabs(Amg::error(*exPars->covariance(), Trk::locR)) : 500.;
380 double errorZ = exPars->covariance() ? fabs(Amg::error(*exPars->covariance(), Trk::locZ)) : 300.;
381
382 // range check
383 bool isOnSurface = surf.isOnSurface(exPars->position(), true, 5 * errorR, 5 * errorZ);
384
385 // get tube length
386 int layer = m_idHelperSvc->mdtIdHelper().tubeLayer(id);
387 int tube = m_idHelperSvc->mdtIdHelper().tube(id);
388 double halfTubeLength = 0.5 * detEl.getActiveTubeLength(layer, tube);
389 double tubeRadius = detEl.innerTubeRadius();
390
391 // take into account the tube width
392 double roadWidthR = 5 * errorR + 4 * tubeRadius;
393 double roadWidthZ = 5 * errorZ + 100.;
394
395 double driftdr = Amg::error(mdtPrd.localCovariance(), Trk::locR);
396 double nSigmaFromTrack = fabs(fabs(distanceToWire) - mdtPrd.localPosition()[Trk::locR]) / sqrt(errorR * errorR + driftdr * driftdr);
397
398 if (msgLvl(MSG::VERBOSE)) {
399 std::string boundCheckStr = isOnSurface ? " onSurface" : " outOfSurface";
400 msg() << MSG::VERBOSE << " " << m_idHelperSvc->toString(mdtPrd.identify()) << " r " << distanceToWire << " range "
401 << roadWidthR << " z " << posAlongWire << " range " << halfTubeLength + roadWidthZ << boundCheckStr;
402 }
403
404 // if( fabs(distanceToWire) > roadWidthR || fabs(posAlongWire) > halfTubeLength + roadWidthZ ){
405 if (nSigmaFromTrack > m_maxSigma || fabs(posAlongWire) > halfTubeLength + roadWidthZ) {
406 if (msgLvl(MSG::VERBOSE)) msg() << " --- dropped" << endmsg;
407 // delete exPars;
408 return nullptr;
409 }
410
411 // update hole search flag, set to false if we are close to the tube edge
412 if (doHoleSearch && fabs(posAlongWire) < halfTubeLength + roadWidthZ) doHoleSearch = false;
413
414 Amg::Vector3D momentum = exPars->momentum();
415
416 // pointer to ROT
417 const MdtDriftCircleOnTrack* mdtROT = m_mdtRotCreator->createRIO_OnTrack(mdtPrd, exPars->position(), &momentum);
418
419 // clean up pointers
420 // delete exPars;
421
422 // check whether ROT is created
423 if (!mdtROT) {
424 ATH_MSG_DEBUG(" failed to calibrate MdtPrepData " << m_idHelperSvc->toString(mdtPrd.identify()));
425 return nullptr;
426 }
427
428 if (msgLvl(MSG::VERBOSE)) {
429 double radius = mdtROT->localParameters()[Trk::locR];
430 double error = driftdr;
431 double residual = radius - fabs(distanceToWire);
432 double fullError = sqrt(errorR * errorR + error * error);
433 double radialPull = residual / fullError;
434 std::string hitType;
435 if (fabs(radialPull) < 5)
436 hitType = "onTrack";
437 else if (fabs(radialPull) > 5 && residual > 0)
438 hitType = "delta";
439 else
440 hitType = "outOfTime";
441 msg() << " r_drift " << radius << " res " << residual << " pull " << radialPull << " " << hitType << endmsg;
442 }
443 return mdtROT;
444 }
#define endmsg
double getActiveTubeLength(const int tubeLayer, const int tube) const
virtual const Trk::Surface & surface() const override final
Return surface associated with this detector element.
double innerTubeRadius() const
Returns the inner tube radius excluding the aluminium walls.
ToolHandle< Muon::IMdtDriftCircleOnTrackCreator > m_mdtRotCreator
IMdtDriftCircleOnTrackCreator.
Gaudi::Property< double > m_maxSigma
ToolHandle< Trk::IPropagator > m_propagator
propagator
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
virtual bool isOnSurface(const Amg::Vector3D &glopo, const BoundaryCheck &bchk=true, double tol1=0., double tol2=0.) const override final
This method checks if the provided GlobalPosition is inside the assigned straw radius,...
Eigen::Matrix< double, 3, 1 > Vector3D
@ layer
Definition HitInfo.h:79
@ anyDirection
@ locR
Definition ParamDefs.h:44
@ locZ
local cylindrical
Definition ParamDefs.h:42
MsgStream & msg
Definition testRead.cxx:32

◆ initialize()

StatusCode Muon::MuonSeededSegmentFinder::initialize ( )

AlgTool initilize.

Definition at line 26 of file MuonSeededSegmentFinder.cxx.

26 {
27
28
29 ATH_CHECK(m_key_mdt.initialize(!m_key_mdt.empty()));
30 ATH_CHECK(m_key_csc.initialize(!m_key_csc.empty())); // check for layouts without CSCs
31 ATH_CHECK(m_key_tgc.initialize(!m_key_tgc.empty()));
32 ATH_CHECK(m_key_rpc.initialize(!m_key_rpc.empty()));
33 ATH_CHECK(m_key_stgc.initialize(!m_key_stgc.empty())); // check for layouts without STGCs
34 ATH_CHECK(m_key_mm.initialize(!m_key_mm.empty())); // check for layouts without MicroMegas
35
36 ATH_CHECK(m_DetectorManagerKey.initialize());
37 ATH_CHECK(m_segMaker.retrieve());
38 ATH_CHECK(m_segMakerNoHoles.retrieve());
39 ATH_CHECK(m_propagator.retrieve());
40 ATH_CHECK(m_mdtRotCreator.retrieve());
41 ATH_CHECK(m_idHelperSvc.retrieve());
42 ATH_CHECK(m_printer.retrieve());
43
44
45
46 return StatusCode::SUCCESS;
47 }
#define ATH_CHECK
Evaluate an expression and check for errors.
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer
EDM printer tool.

◆ selectAndCalibrate()

void Muon::MuonSeededSegmentFinder::selectAndCalibrate ( const EventContext & ctx,
const Trk::TrackParameters & pars,
const std::vector< const MdtPrepData * > & mdtPrdCols,
std::vector< const MdtDriftCircleOnTrack * > & mdtROTs,
bool & doHoleSearch ) const
private

select a set of Mdt hits and calibrate them

Definition at line 336 of file MuonSeededSegmentFinder.cxx.

338 {
339 ATH_MSG_VERBOSE(" in selectAndCalibrate, get PRDs " << mdtPrdCols.size());
340
341 // loop over MdtPrepDataCollections
342 std::vector<const MdtPrepData*>::const_iterator mit = mdtPrdCols.begin();
343 std::vector<const MdtPrepData*>::const_iterator mit_end = mdtPrdCols.end();
344 for (; mit != mit_end; ++mit) {
345 if (!MC::isStable(*mit)) continue;
346 // calibrate MDT
347 const MdtDriftCircleOnTrack* mdt = handleMdtPrd(ctx, pars, **mit, doHoleSearch);
348
349 // not selected
350 if (!mdt) continue;
351
352 mdtROTs.push_back(mdt);
353 }
354 ATH_MSG_VERBOSE(" calibrated " << mdtROTs.size() << " prds out of " << mdtPrdCols.size());
355 }
#define ATH_MSG_VERBOSE(x)
const MdtDriftCircleOnTrack * handleMdtPrd(const EventContext &ctx, const Trk::TrackParameters &pars, const MdtPrepData &mdtPrd, bool &doHoleSearch) const
select and calibrate a single MdtPrepData
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.

Member Data Documentation

◆ m_adcCut

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

Definition at line 116 of file MuonSeededSegmentFinder.h.

116{this, "AdcCut", 50};

◆ m_DetectorManagerKey

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

Definition at line 93 of file MuonSeededSegmentFinder.h.

93 {this, "DetectorManagerKey", "MuonDetectorManager",
94 "Key of input MuonDetectorManager condition data"};

◆ m_idHelperSvc

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

Definition at line 105 of file MuonSeededSegmentFinder.h.

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

◆ m_key_csc

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

Definition at line 110 of file MuonSeededSegmentFinder.h.

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

◆ m_key_mdt

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

Definition at line 109 of file MuonSeededSegmentFinder.h.

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

◆ m_key_mm

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

Definition at line 114 of file MuonSeededSegmentFinder.h.

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

◆ m_key_rpc

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

Definition at line 112 of file MuonSeededSegmentFinder.h.

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

◆ m_key_stgc

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

Definition at line 113 of file MuonSeededSegmentFinder.h.

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

◆ m_key_tgc

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

Definition at line 111 of file MuonSeededSegmentFinder.h.

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

◆ m_magFieldProperties

Trk::MagneticFieldProperties Muon::MuonSeededSegmentFinder::m_magFieldProperties
private

magnetic field properties

Definition at line 104 of file MuonSeededSegmentFinder.h.

◆ m_maxSigma

Gaudi::Property<double> Muon::MuonSeededSegmentFinder::m_maxSigma {this, "MdtSigmaFromTrack", 3}
private

Definition at line 117 of file MuonSeededSegmentFinder.h.

117{this, "MdtSigmaFromTrack", 3};

◆ m_mdtRotCreator

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

IMdtDriftCircleOnTrackCreator.

Definition at line 102 of file MuonSeededSegmentFinder.h.

102 {
103 this, "MdtRotCreator", "Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator"};

◆ m_printer

PublicToolHandle<Muon::MuonEDMPrinterTool> Muon::MuonSeededSegmentFinder::m_printer
private
Initial value:
{this, "Printer",
"Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}

EDM printer tool.

Definition at line 106 of file MuonSeededSegmentFinder.h.

106 {this, "Printer",
107 "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};

◆ m_propagator

ToolHandle<Trk::IPropagator> Muon::MuonSeededSegmentFinder::m_propagator
private
Initial value:
{this, "Propagator",
"Trk::RungeKuttaPropagator/AtlasRungeKuttaPropagator"}

propagator

Definition at line 100 of file MuonSeededSegmentFinder.h.

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

◆ m_segMaker

ToolHandle<Muon::IMuonSegmentMaker> Muon::MuonSeededSegmentFinder::m_segMaker
private
Initial value:
{
this, "SegmentMaker", "Muon::DCMathSegmentMaker/DCMathSegmentMaker"}

actual segment maker with hole search

Definition at line 96 of file MuonSeededSegmentFinder.h.

96 {
97 this, "SegmentMaker", "Muon::DCMathSegmentMaker/DCMathSegmentMaker"};

◆ m_segMakerNoHoles

ToolHandle<Muon::IMuonSegmentMaker> Muon::MuonSeededSegmentFinder::m_segMakerNoHoles
private
Initial value:
{
this, "SegmentMakerNoHoles", "Muon::DCMathSegmentMaker/DCMathSegmentMaker"}

actual segment maker no hole search

Definition at line 98 of file MuonSeededSegmentFinder.h.

98 {
99 this, "SegmentMakerNoHoles", "Muon::DCMathSegmentMaker/DCMathSegmentMaker"};

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