|
ATLAS Offline Software
|
Go to the documentation of this file.
12 constexpr
unsigned int num_sectors = 16;
16 inline const Trk::PrepRawData* prepData(
const std::shared_ptr<MuonHough::Hit>& hit) {
17 if (hit->
prd)
return hit->
prd;
23 struct hough_chamber {
26 std::set<int> sectors;
46 return StatusCode::SUCCESS;
50 ATH_MSG_DEBUG(
"Cakes are availablei in "<<ctx.eventID().event_number());
54 if (!input_container.isValid()) {
56 return StatusCode::FAILURE;
58 output_cache.input_candidates = input_container.cptr();
66 ATH_MSG_DEBUG(
"Find the inner detector candidates to be used for MuGirl / Segment tagging");
69 ATH_CHECK(indetCandidateCollection.
record(std::move(output_cache.outputContainer)));
73 return StatusCode::SUCCESS;
77 if (!tag_map.isValid()) {
78 ATH_MSG_FATAL(
"Failed to retrieve the tag map from " << tag_map.fullKey());
79 return StatusCode::FAILURE;
81 if (tag_map->empty()) {
83 return StatusCode::SUCCESS;
86 for (
const auto& combined_tags : *tag_map) {
88 ATH_MSG_WARNING(
"Found a non MuidCo tag.... Please check " << combined_tags.second->toString());
93 out_cache.
tag_map.push_back(std::move(cache));
100 return StatusCode::SUCCESS;
127 std::vector<Muon::MuonSystemExtension::Intersection> intersects = extension->
layerIntersections();
148 std::stringstream sstr;
150 sstr <<
" * " << extended->
toString() << std::endl;
153 sstr << std::endl <<
" ======== The following tracks were already successfully combined ======== " << std::endl;
155 sstr <<
" = " << combined->
toString() << std::endl;
159 sstr << std::endl <<
" ++++++++ The following candidates were not extrapolated ++++++++ " << std::endl;
168 sstr <<
" + " << rejected->
toString() << std::endl;
172 <<
" tracks through the spectrometer" << std::endl
176 return StatusCode::SUCCESS;
181 if (!readHandle.isValid()) {
183 return StatusCode::FAILURE;
185 const std::vector<Muon::HoughDataPerSec>& hough_data = readHandle->vec;
187 auto count_finished = [&output_cache]() ->
unsigned int {
189 for (
const auto& sector_hits : output_cache.
hit_sectors) {
n += sector_hits.second.size() >= num_sectors; }
196 const RegionIndex region_index =
static_cast<RegionIndex
>(det_region);
198 const LayerIndex layer_index =
static_cast<LayerIndex
>(
layer);
204 auto num_hough_hits = [&masked_hits,
this](
const std::shared_ptr<MuonHough::MuonLayerHough::Maximum>& hough_maximum) {
205 std::map<Identifier, hough_chamber> chamber_counts;
206 for (
const std::shared_ptr<MuonHough::Hit>& hough_hit : hough_maximum->hits) {
223 for (
auto& ch_it : chamber_counts) {
224 if (
N.nhits < ch_it.second.nhits) {
N = std::move(ch_it.second); }
234 for (
const std::shared_ptr<MuonHough::MuonLayerHough::Maximum>& maxima : eta_hits) {
236 const hough_chamber effect_hits = num_hough_hits(maxima);
241 <<
", hits: " << effect_hits.nhits);
243 for (
const int sector : effect_hits.sectors) {
244 output_cache.
hit_sectors[region_index].insert(sector);
246 output_cache.
eta_seeds[sector].push_back(effect_hits.eta);
249 if (count_finished() >= RegionIndex::DetectorRegionIndexMax) {
250 ATH_MSG_VERBOSE(
"The MS is filled up with Hough seeds. We do not need to search for them any longer");
255 for (
auto& theta_pair : output_cache.
eta_seeds) { std::sort(theta_pair.second.begin(), theta_pair.second.end()); }
258 return StatusCode::SUCCESS;
262 if (!segmentContainer.isValid()) {
264 return StatusCode::FAILURE;
266 for (
const Trk::Segment* trk_segment : *segmentContainer) {
270 ATH_MSG_WARNING(
"How can it be that a Muon segment is not a muon segment?");
282 const Identifier meas_id = m_edmHelperSvc->getIdentifier(*meas);
283 return meas_id.is_valid() && (m_idHelperSvc->isMM(meas_id) || m_idHelperSvc->issTgc(meas_id));
287 maskHits(muon_segment, output_cache);
291 return StatusCode::SUCCESS;
296 const double ThetaID = ms_entry->
position().theta();
297 std::vector<int> id_sectors;
299 auto sector_match = [&id_sectors,
this](
const Amg::Vector3D& seg_pos) ->
bool {
300 std::vector<int> seg_sectors;
302 return std::find_if(id_sectors.begin(), id_sectors.end(), [&seg_sectors](
const int id_sec) {
303 return std::find(seg_sectors.begin(), seg_sectors.end(), id_sec) != seg_sectors.end();
304 }) != id_sectors.end();
308 const double dTheta =
pos.theta() - ThetaID;
309 const bool theta_match = std::abs(dTheta) < 0.2;
314 if (!sector_match(
pos)) {
325 const double etaID = ms_entry->
position().eta();
326 std::vector<int> id_sectors;
328 for (
const int& sect : id_sectors) {
329 std::map<int, std::vector<double>>::const_iterator theta_itr = cache.
eta_seeds.find(sect);
330 if (theta_itr == cache.
eta_seeds.end())
continue;
331 if (std::find_if(theta_itr->second.begin(), theta_itr->second.end(),
332 [&etaID](
const double eta_seed) { return std::abs(etaID - eta_seed) < 0.1; }) != theta_itr->second.end())
341 ATH_MSG_VERBOSE(
"No candidates for stau reconstruction will be written");
342 return StatusCode::SUCCESS;
344 ATH_MSG_DEBUG(
"Now find the candidates to be considered for MuGirlStau");
357 cache.
candidate = std::make_unique<MuonCombined::InDetCandidate>(idMuidCo.id_trk->indetTrackParticleLink());
358 cache.
candidate->setSiliconAssociated(idMuidCo.id_trk->isSiliconAssociated());
359 cache.
candidate->setExtension(idMuidCo.id_trk->getCaloExtension());
365 ATH_MSG_FATAL(
"Could not determine the intersections. Although that should be possible");
366 return StatusCode::FAILURE;
368 stau_cache.outputContainer->push_back(std::move(cache.
candidate));
374 return a->indetTrackParticle().pt() < b->indetTrackParticle().pt();});
375 ATH_CHECK(indetCandidateCollection.
record(std::move(stau_cache.outputContainer)));
376 return StatusCode::SUCCESS;
381 const LayerIndex layer_index =
m_idHelperSvc->layerIndex(seg_id);
382 const RegionIndex region_index =
m_idHelperSvc->regionIndex(seg_id);
387 id_set.insert(meas_id);
virtual double pt() const override final
The transverse momentum ( ) of the particle.
ToolHandle< Muon::IMuonSystemExtensionTool > m_muonSystemExtensionTool
The system extension tool extrapolates the candidate through the spectrometer.
std::map< unsigned int, std::set< Identifier > > consumed_hits
Map of hits that were successfully combined to a muon segment Key is the hash made out of region & la...
Gaudi::Property< float > m_extThreshold
Minimum pt threshold of the IdCandidate to be extrapolated through the spectrometer.
const Muon::MuonSystemExtension * getExtension() const
std::vector< const Muon::MuonSegment * > associatedSegments() const override
access to associated segments, empty vector if non available
Const iterator class for DataVector/DataList.
std::unique_ptr< InDetCandidateCollection > outputContainer
Output container for the StoreGate.
SG::ReadHandleKey< MuonCombined::InDetCandidateToTagMap > m_combTagMap
That is the collection of MuidCo candidates.
PublicToolHandle< Muon::IMuonSegmentSelectionTool > m_segmentSelector
Gaudi::Property< bool > m_extendBulk
Shall ordinary ID tracks be equiped with a muon system extension used by MuGirl later.
std::vector< MuidCoCache > MuidCoVector
Gaudi::Property< int > m_houghMin
The hough maxima always contain at least 2 hits.
SG::WriteHandleKey< InDetCandidateCollection > m_bulkInDetCandKey
Collection of InDet candidates written for MuGirl and MuonSegmentTag.
Scalar eta() const
pseudorapidity method
const Amg::Vector3D & position() const
Access method for the position.
DataVector adapter that acts like it holds const pointers.
void getSectors(double phi, std::vector< int > §ors) const
returns the main sector plus neighboring if the phi position is in an overlap region
LayerIndex
enum to classify the different layers in the muon spectrometer
std::set< const Muon::MuonSegment * > combined_segs
List of segments that were successfully combined to a muon.
static unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
MuidCoVector tag_map
Combined fit tag map.
const Muon::MuonSectorMapping m_sector_mapping
const InDetCandidateCollection * input_candidates
Collection of the InDet candidates to consider.
void maskHits(const Muon::MuonSegment *muon_seg, InDetCandidateCache &output_cache) const
Mask the hits of the corresponding muon segment as used.
const ElementLink< xAOD::TrackParticleContainer > & indetTrackParticleLink() const
access TrackParticleLink
#define ATH_MSG_VERBOSE(x)
const TrackParameters * muonEntryLayerIntersection() const
access to intersection with the muon entry layer return NULL if the intersection failed
StatusCode execute(const EventContext &ctx) const override
int getSector(double phi) const
returns the sector corresponding to the phi position
An algorithm that can be simultaneously executed in multiple threads.
Gaudi::Property< int > m_segmentQuality
static const std::string & regionName(DetectorRegionIndex index)
convert DetectorRegionIndex into a string
SG::WriteHandleKey< InDetCandidateCollection > m_stauInDetCandKey
Collection of InDet candidates written for MuGirlStau.
const Trk::TrackParameters & muonEntryLayerIntersection() const
access to intersection with the muon entry layer
Gaudi::Property< bool > m_restrictExtension
Restrict the extrapolation of ID tracks to sectors in the MS where at least a hit is recorded.
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
StatusCode createStaus(const EventContext &ctx, const InDetCandidateCollection *ext_candidates, const MuidCoVector &tag_map) const
StatusCode findSegments(const EventContext &ctx, InDetCandidateCache &output_cache) const
Select good segments.
::StatusCode StatusCode
StatusCode definition for legacy code.
pointer_type ptr()
Dereference the pointer.
MuonInDetToMuonSystemExtensionAlg(const std::string &name, ISvcLocator *pSvcLocator)
Tracking class to hold the extrapolation from a particle from the calo entry to the end of muon syste...
const std::vector< const Trk::MeasurementBase * > & containedMeasurements() const
returns the vector of Trk::MeasurementBase objects
StatusCode selectCandidates(const EventContext &ctx, InDetCandidateCache &cache) const
Select the MuidCo candidates and put the associated id tracks on a black list.
TagBase implementation for a combined fit.
static const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
std::set< const MuonCombined::InDetCandidate * > excluded_trks
Inner detector tracks to exclude.
bool hasMatchingSeed(const MuonCombined::InDetCandidate &id_cand, const InDetCandidateCache &cache) const
Searches for hough seeds within theta < 0.2 && sharing the same sector.
std::vector< const Muon::MuonSegment * > candidate_segments
Muon segments that could be potentially used for MuGirl / MuTagIMO.
std::string toString() const
print candidate to string
bool hasMatchingSegment(const MuonCombined::InDetCandidate &id_cand, const InDetCandidateCache &cache) const
Searches for segments within theta < 0.2 && sharing the same sector.
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
Identifier identify() const
return the identifier
StatusCode findHitSectors(const EventContext &ctx, InDetCandidateCache &output_cache) const
Find the sectors in the MS with muon signals.
Gaudi::Property< bool > m_excludeNSW
Prelimnary studies have shown that the NSWs generate a massive amount of fake candidates.
Eigen::Matrix< double, 3, 1 > Vector3D
Helper struct to cache the MuidCo track and it's associated segments while keeping the association In...
const Trk::CaloExtension * getCaloExtension() const
Gaudi::Property< bool > m_extendSAF
Shall SAF tracks be equiped with a muon system extension used by MuGirl later.
SG::ReadHandleKey< Muon::HoughDataPerSectorVec > m_houghDataPerSectorVecKey
Use the hough data to find sectors in the speectrometer traversed by a muon.
StatusCode create(const EventContext &ctx, InDetCandidateCache &cache) const
Create the InDetCandidaes with system extensions.
const Muon::TgcClusterObj3D * tgc
const xAOD::TrackParticle & indetTrackParticle() const
access TrackParticle
std::map< Muon::MuonStationIndex::DetectorRegionIndex, std::set< int > > hit_sectors
Hit sector map.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
bool isSiliconAssociated() const
Returns true if this candidate was formed from a special far forward InDet track.
#define ATH_MSG_WARNING(x)
StatusCode initialize() override
const std::vector< Intersection > & layerIntersections() const
access to the intersections with the layers.
const Trk::PrepRawData * prd
access to assiciated hit, either the prd or the tgc pointer is set in athena
virtual const Amg::Vector3D & globalPosition() const override final
global position
SG::ReadHandleKey< Trk::SegmentCollection > m_segmentKey
Let's exploit the segments to get rid of as much tracks as possible.
virtual const Amg::Vector3D & center() const =0
Return the center of the element.
SG::ReadHandleKey< InDetCandidateCollection > m_inputCandidate
std::map< int, std::vector< double > > eta_seeds
size_type size() const noexcept
Returns the number of elements in the collection.
std::vector< std::shared_ptr< MuonHough::MuonLayerHough::Maximum > > MaximumVec
virtual const TrkDetElementBase * detectorElement() const =0
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...