36 declareInterface<MuPatCandidateTool>(
this);
50 return StatusCode::SUCCESS;
59 std::unique_ptr<MuPatSegment> info = std::make_unique<MuPatSegment>();
60 info->segment = &segment;
66 info->addChamber(chIdx);
68 if (!info->name.empty()) info->name +=
"+";
70 std::ostringstream oss;
72 info->name += oss.str();
81 info->segPars.reset(
m_edmHelperSvc->createTrackParameters(segment, 5000., 0.));
82 if (!info->segPars) {
ATH_MSG_WARNING(
" failed to create track parameter for segment "); }
91 can.addSegment(&segInfo, track);
97 std::unique_ptr<MuPatTrack> can = std::make_unique<MuPatTrack>(*canIn);
103 std::unique_ptr<MuPatTrack> candidate = std::make_unique< MuPatTrack>(&segInfo, track);
114 std::unique_ptr<Trk::Track>& track)
const {
116 std::unique_ptr<MuPatTrack> candidate = std::make_unique<MuPatTrack>(&segInfo1, &segInfo2, track);
123 std::vector<MuPatSegment*> segments;
126 std::unique_ptr<MuPatTrack> candidate = std::make_unique<MuPatTrack>(segments, track);
132 bool recreateMDT,
bool recreateCSC,
bool createComp)
const {
133 MeasVec etaHits{}, phiHits{}, fakePhiHits{}, allHits{};
135 unsigned int nmdtHitsMl1{0}, nmdtHitsMl2{0}, ncscHitsEta{0}, ncscHitsPhi{0}, nrpcHitsEta{0}, nrpcHitsPhi{0}, ntgcHitsEta{0},
138 entry.clearChambers();
140 bool hasEndcap{
false}, hasSmall{
false}, hasLarge{
false}, hassloverlap{
false}, previssmall{
false};
146 std::vector<const MuonClusterOnTrack*> triggerHitsPhi{}, triggerHitsEta{};
149 bool is_first_meas =
true;
152 if (!
id.is_valid()) {
153 fakePhiHits.push_back(meas);
165 bool measuresPhi =
false;
171 if (isMdt || isCsc || isNSW) {
173 entry.chamberIds().insert(chId);
180 " recreation of MDTs requiered although not configured via jobO, ignoring request. Please check jobO ");
188 meas = entry.addToTrash
189 (std::unique_ptr<const MdtDriftCircleOnTrack>
190 (
m_mdtRotCreator->createRIO_OnTrack(*mdt->prepRawData(), mdt->globalPosition())));
198 if (
isSmall != previssmall && !is_first_meas && stIndex == prevstIndex) hassloverlap =
true;
200 is_first_meas =
false;
202 prevstIndex = stIndex;
204 unsigned int ml =
m_idHelperSvc->mdtIdHelper().multilayer(
id);
205 nmdtHitsMl1 += (ml ==1);
206 nmdtHitsMl2 += (ml ==2);
212 nrpcHitsPhi += (measuresPhi && isRpc);
213 nrpcHitsEta += (!measuresPhi && isRpc);
215 ntgcHitsPhi += (measuresPhi && isTgc);
216 ntgcHitsEta += (!measuresPhi && isTgc);
218 ncscHitsPhi+= (measuresPhi && isCsc);
219 ncscHitsEta+= (!measuresPhi && isCsc);
220 if (isCsc && recreateCSC) {
227 meas = entry.addToTrash
228 (std::unique_ptr<const MuonClusterOnTrack>
229 (
m_cscRotCreator->createRIO_OnTrack(*csc->prepRawData(), csc->globalPosition())));
234 if (createComp && (isRpc || isTgc)) {
245 allHits.push_back(meas);
248 phiHits.push_back(meas);
250 etaHits.push_back(meas);
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()) {
270 entry.setEtaHits(etaHits);
271 if (!triggerHitsPhi.empty() && phiHits.empty()) {
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);
286 rots.push_back(clus);
290 std::ranges::transform(compclus->
containedROTs(),std::back_inserter(rots), [](
const auto& rot){
295 ATH_MSG_WARNING(
" Trigger Measurement is not a MuonClusterOnTrack or CompetingMuonClustersOnTrack!! "
304 typedef std::map<Identifier, std::vector<const MuonClusterOnTrack*> > IdClusMap;
305 typedef IdClusMap::iterator IdClusIt;
306 IdClusMap idClusters;
312 idClusters[detId].push_back(clus);
315 ATH_MSG_DEBUG(
" creating CompetingMuonClustersOnTrack for " << idClusters.size() <<
" chambers ");
317 IdClusIt chit = idClusters.begin();
318 IdClusIt chit_end = idClusters.end();
319 for (; chit != chit_end; ++chit) {
320 if (
msgLvl(MSG::VERBOSE)) {
321 msg(MSG::VERBOSE )<<__FILE__<<
":"<<__LINE__ <<
" in " <<
m_idHelperSvc->toStringDetEl(chit->first) <<
" clusters: " << chit->second.size()
327 if (cl_it == chit->second.back())
330 msg(MSG::VERBOSE) << std::endl;
334 if (chit->second.empty()) {
335 ATH_MSG_WARNING(
" empty list, could not create CompetingMuonClustersOnTrack in chamber "
341 if (chit->second.size() == 1) {
342 hits.push_back(chit->second.front());
343 allHits.push_back(chit->second.front());
348 std::list<const Trk::PrepRawData*> prds;
349 std::vector<const MuonClusterOnTrack*>::iterator cl_it = chit->second.begin();
350 std::vector<const MuonClusterOnTrack*>::iterator cl_it_end = chit->second.end();
351 for (; cl_it != cl_it_end; ++cl_it) {
360 std::unique_ptr<const CompetingMuonClustersOnTrack> comprot =
m_compClusterCreator->createBroadCluster(prds, 0);
365 hits.push_back(comprot.get());
366 allHits.push_back(comprot.get());
376 if (!states)
return false;
378 std::set<MuonStationIndex::ChIndex> chambers;
400 if (
msgLvl(MSG::VERBOSE)) {
401 ATH_MSG_VERBOSE(
" recalculateCandidateSegmentContent, old chambers " << candidate.
chambers().size() <<
" new chambers "
419 return bRemovedSegments;
423 std::set<const MuonGM::MuonReadoutElement*> roEls;
427 for (; it != it_end; ++it) {
428 if (!(*it)->info().id.is_valid())
continue;
444 if (roEl) roEls.insert(roEl);
451 std::ostringstream oss;
453 if (level == 0)
return oss.str();
455 if (segment.
hitList().size() >= 2) {
457 oss <<
" length " << distCal(segment.
hitList().front(), segment.
hitList().back());
464 std::vector<MuPatSegment*>::const_iterator it = segments.begin();
465 std::vector<MuPatSegment*>::const_iterator it_end = segments.end();
466 std::ostringstream oss;
467 oss <<
" Segment candidate vector: " << segments.size();
468 for (; it != it_end; ++it) oss << std::endl <<
print(**it, level);
474 std::ostringstream oss;
475 oss <<
m_printer->print(track.track()) << std::endl <<
m_printer->printStations(track.track());
477 if (level == 0)
return oss.str();
479 const std::vector<MuPatSegment*>& segs = track.segments();
480 oss << std::endl <<
print(segs, 0);
486 std::ostringstream oss;
487 oss <<
"MuPatTracks " << tracks.size() << std::endl;
488 std::vector<std::unique_ptr<MuPatTrack> >
::const_iterator tit = tracks.begin();
490 for (; tit != tit_end; ++tit) oss <<
" " <<
print(**tit, level) << std::endl;
497 if (seg)
return print(*seg, level);
500 if (track)
return print(*track, level);
502 return "Unknown candidate type";
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
bool msgLvl(const MSG::Level lvl) const
const_iterator end() const
Base class for the XxxReadoutElement, with Xxx = Mdt, Rpc, Tgc, Csc.
Class for competing MuonClusters, it extends the Trk::CompetingRIOsOnTrack base class.
const std::vector< std::unique_ptr< const MuonClusterOnTrack > > & containedROTs() const
returns the vector of SCT_ClusterOnTrack objects .
Class to represent the calibrated clusters created from CSC strips.
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
track candidate entry object.
const Trk::MeasurementBase * addToTrash(std::unique_ptr< const Trk::MeasurementBase > meas)
adds the measurement to the garbage container.
const MuPatHitList & hitList() const
returns a reference to the hit list
const std::set< MuonStationIndex::ChIndex > & chambers() const
returns set with contained chamberIndices
segment candidate object.
const MuonSegment * segment
Trk::Track & track() const
access to track
void updateTrack(std::unique_ptr< Trk::Track > &newTrack)
update track.
bool resetChambersOnCandidate(const std::set< MuonStationIndex::ChIndex > &chambers)
reset chambers on the candidate.
Base class for Muon cluster RIO_OnTracks.
This is the common muon segment quality object.
This is the common class for 3D segments used in the muon spectrometer.
magnetic field properties to steer the behavior of the extrapolation
This class is the pure abstract base class for all fittable tracking measurements.
Class to handle RIO On Tracks ROT) for InDet and Muons, it inherits from the common MeasurementBase.
virtual const TrkDetElementBase * detectorElement() const =0
returns the detector element, assoicated with the PRD of this class
Identifier identify() const
return the identifier -extends MeasurementBase
const FitQuality * fitQuality() const
return the FitQuality object, returns NULL if no FitQuality is defined
represents the track state (measurement, material, fit parameters and quality) at a surface.
@ 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 ...
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
const DataVector< const MeasurementBase > * measurementsOnTrack() const
return a pointer to a vector of MeasurementBase (NOT including any that come from outliers).
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.
const std::string & chName(ChIndex index)
convert ChIndex into a string
ChIndex
enum to classify the different chamber layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
MuPatHitList::const_iterator MuPatHitCit
DataVector< const Trk::TrackStateOnSurface > TrackStates