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);
293 ATH_MSG_WARNING(
" Trigger Measurement is not a MuonClusterOnTrack or CompetingMuonClustersOnTrack!! "
302 typedef std::map<Identifier, std::vector<const MuonClusterOnTrack*> > IdClusMap;
303 typedef IdClusMap::iterator IdClusIt;
304 IdClusMap idClusters;
310 idClusters[detId].push_back(clus);
313 ATH_MSG_DEBUG(
" creating CompetingMuonClustersOnTrack for " << idClusters.size() <<
" chambers ");
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()
325 if (cl_it == chit->second.back())
328 msg(MSG::VERBOSE) << std::endl;
332 if (chit->second.empty()) {
333 ATH_MSG_WARNING(
" empty list, could not create CompetingMuonClustersOnTrack in chamber "
339 if (chit->second.size() == 1) {
340 hits.push_back(chit->second.front());
341 allHits.push_back(chit->second.front());
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) {
358 std::unique_ptr<const CompetingMuonClustersOnTrack> comprot =
m_compClusterCreator->createBroadCluster(prds, 0);
363 hits.push_back(comprot.get());
364 allHits.push_back(comprot.get());
374 if (!states)
return false;
376 std::set<MuonStationIndex::ChIndex> chambers;
398 if (
msgLvl(MSG::VERBOSE)) {
399 ATH_MSG_VERBOSE(
" recalculateCandidateSegmentContent, old chambers " << candidate.
chambers().size() <<
" new chambers "
417 return bRemovedSegments;
421 std::set<const MuonGM::MuonReadoutElement*> roEls;
425 for (; it != it_end; ++it) {
426 if (!(*it)->info().id.is_valid())
continue;
435 const std::vector<const MuonClusterOnTrack*>& rots = crot->
containedROTs();
436 if (!rots.empty()) rot = rots.front();
441 if (roEl) roEls.insert(roEl);
448 std::ostringstream oss;
450 if (level == 0)
return oss.str();
452 if (segment.
hitList().size() >= 2) {
454 oss <<
" length " << distCal(segment.
hitList().front(), segment.
hitList().back());
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);
471 std::ostringstream oss;
472 oss <<
m_printer->print(track.track()) << std::endl <<
m_printer->printStations(track.track());
474 if (level == 0)
return oss.str();
476 const std::vector<MuPatSegment*>& segs = track.segments();
477 oss << std::endl <<
print(segs, 0);
483 std::ostringstream oss;
484 oss <<
"MuPatTracks " << tracks.size() << std::endl;
485 std::vector<std::unique_ptr<MuPatTrack> >
::const_iterator tit = tracks.begin();
487 for (; tit != tit_end; ++tit) oss <<
" " <<
print(**tit, level) << std::endl;
494 if (seg)
return print(*seg, level);
497 if (track)
return print(*track, level);
499 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< 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