ATLAS Offline Software
MuPatCandidateBase.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <set>
7 
8 namespace Muon {
9 
10  MuPatCandidateBase::MuPatCandidateBase(const MeasVec& etaHits, const MeasVec& phiHits, const MeasVec& fakePhiHits,
11  const MeasVec& allHits) :
12  m_etaHits(etaHits), m_phiHits(phiHits), m_fakePhiHits(fakePhiHits), m_allHits(allHits) {}
13 
14  void MuPatCandidateBase::setChambers(const std::set<MuonStationIndex::ChIndex>& chambers) {
16  m_stations.clear();
18  }
19 
21  std::vector<Identifier> intersection;
22  std::set_intersection(entry.chamberIds().begin(), entry.chamberIds().end(), chamberIds().begin(), chamberIds().end(),
23  std::back_inserter(intersection));
24 
25  unsigned int intersectionSize = intersection.size();
26  return intersectionSize != 0;
27  }
28 
29  const std::set<MuonStationIndex::StIndex>& MuPatCandidateBase::stations() const { return m_stations; }
30 
31  const std::set<MuonStationIndex::ChIndex>& MuPatCandidateBase::chambers() const { return m_chambers; }
32 
33  const std::set<Identifier>& MuPatCandidateBase::chamberIds() const { return m_chamberIds; }
34 
36  std::set<Identifier>& MuPatCandidateBase::chamberIds() { return m_chamberIds; }
37 
39  m_chambers.insert(chIndex);
41  }
42 
44 
46 
48 
49  void MuPatCandidateBase::hasSmallChamber(bool hasSmall) { m_hasSmallChamber = hasSmall; }
50 
51  void MuPatCandidateBase::hasLargeChamber(bool hasLarge) { m_hasLargeChamber = hasLarge; }
52 
53  void MuPatCandidateBase::hasSLOverlap(bool hasSL) { m_hasSLOverlap = hasSL; }
54 
55  const MuPatCandidateBase::MeasVec& MuPatCandidateBase::MuPatCandidateBase::etaHits() const { return m_etaHits; }
56 
58 
60 
62 
64 
66 
68 
70 
71  bool MuPatCandidateBase::hasEndcap() const { return m_hasEndcap; }
72 
73  void MuPatCandidateBase::hasEndcap(bool hasEC) { m_hasEndcap = hasEC; }
74 
76  return m_chambers.find(chIndex) != m_chambers.end();
77  }
78 
80  return m_stations.find(stIndex) != m_stations.end();
81  }
82 
84  m_chambers.clear();
85  m_stations.clear();
86  m_chamberIds.clear();
87  }
88 
90 
91  void MuPatCandidateBase::addToTrash(std::unique_ptr<const Trk::MeasurementBase> meas) {m_garbage.push_back(std::move(meas));}
92  void MuPatCandidateBase::addToTrash(const std::vector<std::shared_ptr<const Trk::MeasurementBase>>& measurements) {
93  if (m_garbage.capacity() < measurements.size() + m_garbage.size()){
94  m_garbage.reserve(measurements.size() + m_garbage.size());
95  }
96  m_garbage.insert(m_garbage.end(), measurements.begin(), measurements.end());
97  }
98  const std::vector<std::shared_ptr<const Trk::MeasurementBase>>& MuPatCandidateBase::garbage()const {return m_garbage;}
99 
100 } // namespace Muon
Muon::MuPatCandidateBase::addToTrash
void addToTrash(std::unique_ptr< const Trk::MeasurementBase > meas)
adds the measurement to the garbage container.
Definition: MuPatCandidateBase.cxx:91
Muon::MuonStationIndex::toStationIndex
static StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex
Definition: MuonStationIndex.cxx:43
Muon::MuPatCandidateBase::m_phiHits
MeasVec m_phiHits
Definition: MuPatCandidateBase.h:161
Muon::MuPatCandidateBase::phiHits
const MeasVec & phiHits() const
return all phi hits on the entry
Definition: MuPatCandidateBase.cxx:57
Muon::MuPatCandidateBase::hasMomentum
bool hasMomentum() const
returns whether entry has a momentum measurement
Definition: MuPatCandidateBase.cxx:89
Muon::MuPatCandidateBase
track candidate entry object.
Definition: MuPatCandidateBase.h:46
Muon::MuPatCandidateBase::m_hasMomentum
bool m_hasMomentum
Definition: MuPatCandidateBase.h:172
Muon::MuPatCandidateBase::m_fakePhiHits
MeasVec m_fakePhiHits
Definition: MuPatCandidateBase.h:162
Muon::MuPatCandidateBase::chambers
const std::set< MuonStationIndex::ChIndex > & chambers() const
returns set with contained chamberIndices
Definition: MuPatCandidateBase.cxx:31
Muon::MuPatCandidateBase::hasLargeChamber
bool hasLargeChamber() const
returns whether entry contains a small chamber
Definition: MuPatCandidateBase.cxx:45
Muon::MuPatCandidateBase::shareChambers
bool shareChambers(const MuPatCandidateBase &entry) const
checks whether the two entries contain the same chamber
Definition: MuPatCandidateBase.cxx:20
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:423
MuPatCandidateBase.h
Muon::MuPatCandidateBase::m_hasEndcap
bool m_hasEndcap
Definition: MuPatCandidateBase.h:186
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
Muon::MuPatCandidateBase::setAllHits
void setAllHits(const MeasVec &hits)
set all hits on the entry
Definition: MuPatCandidateBase.cxx:69
Muon::MuPatCandidateBase::m_garbage
std::vector< std::shared_ptr< const Trk::MeasurementBase > > m_garbage
Definition: MuPatCandidateBase.h:191
intersection
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
Definition: compareFlatTrees.cxx:25
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Muon::MuPatCandidateBase::m_hasSmallChamber
bool m_hasSmallChamber
Definition: MuPatCandidateBase.h:187
Muon::MuPatCandidateBase::setPhiHits
void setPhiHits(const MeasVec &hits)
set phi hits on the entry
Definition: MuPatCandidateBase.cxx:65
Muon::MuPatCandidateBase::fakePhiHits
const MeasVec & fakePhiHits() const
return all fake phi hits on the entry
Definition: MuPatCandidateBase.cxx:59
Muon::MuPatCandidateBase::MuPatCandidateBase
MuPatCandidateBase()=default
constructor.
Muon::MuPatCandidateBase::chamberIds
const std::set< Identifier > & chamberIds() const
returns set with contained chamber ids
Definition: MuPatCandidateBase.cxx:33
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
Muon::MuPatCandidateBase::m_stations
std::set< MuonStationIndex::StIndex > m_stations
Definition: MuPatCandidateBase.h:171
Muon::MuPatCandidateBase::setChambers
void setChambers(const std::set< MuonStationIndex::ChIndex > &chambers)
Set the list of chambers and update list of stations.
Definition: MuPatCandidateBase.cxx:14
Muon::MuPatCandidateBase::clearChambers
void clearChambers()
clear the list of contained chambers.
Definition: MuPatCandidateBase.cxx:83
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
Muon::MuPatCandidateBase::hasEndcap
bool hasEndcap() const
returns whether the entry contains endcap hits
Definition: MuPatCandidateBase.cxx:71
Muon::MuPatCandidateBase::containsStation
bool containsStation(MuonStationIndex::StIndex chIndex) const
returns whether the StationIndex is already contained in candidate
Definition: MuPatCandidateBase.cxx:79
Muon::MuPatCandidateBase::m_etaHits
MeasVec m_etaHits
Definition: MuPatCandidateBase.h:160
Muon::MuPatCandidateBase::MeasVec
std::vector< const Trk::MeasurementBase * > MeasVec
Definition: MuPatCandidateBase.h:50
Muon::MuPatCandidateBase::m_hasSLOverlap
bool m_hasSLOverlap
Definition: MuPatCandidateBase.h:189
Muon::MuPatCandidateBase::hasSLOverlap
bool hasSLOverlap() const
returns whether there is at least one small/large overlap in the same station layer
Definition: MuPatCandidateBase.cxx:47
Muon::MuPatCandidateBase::setEtaHits
void setEtaHits(const MeasVec &hits)
set eta hits on the entry
Definition: MuPatCandidateBase.cxx:63
Muon::MuPatCandidateBase::hasSmallChamber
bool hasSmallChamber() const
returns whether entry contains a small chamber
Definition: MuPatCandidateBase.cxx:43
Muon::MuPatCandidateBase::m_hasLargeChamber
bool m_hasLargeChamber
Definition: MuPatCandidateBase.h:188
Muon::MuPatCandidateBase::containsChamber
bool containsChamber(MuonStationIndex::ChIndex chIndex) const
returns whether the ChamberIndex is already contained in candidate
Definition: MuPatCandidateBase.cxx:75
Muon::MuPatCandidateBase::m_chamberIds
std::set< Identifier > m_chamberIds
Definition: MuPatCandidateBase.h:167
Muon::MuPatCandidateBase::m_chambers
std::set< MuonStationIndex::ChIndex > m_chambers
Definition: MuPatCandidateBase.h:170
Muon::MuPatCandidateBase::addChamber
void addChamber(MuonStationIndex::ChIndex chIndex)
add the chamber to the list of contained chambers.
Definition: MuPatCandidateBase.cxx:38
Muon::MuonStationIndex::ChIndex
ChIndex
enum to classify the different chamber layers in the muon spectrometer
Definition: MuonStationIndex.h:15
Muon::MuonStationIndex::StIndex
StIndex
enum to classify the different station layers in the muon spectrometer
Definition: MuonStationIndex.h:23
Muon::MuPatCandidateBase::setFakePhiHits
void setFakePhiHits(const MeasVec &hits)
set fake phi hits on the entry
Definition: MuPatCandidateBase.cxx:67
set_intersection
Set * set_intersection(Set *set1, Set *set2)
Perform an intersection of two sets.
Muon::MuPatCandidateBase::hits
const MeasVec & hits() const
return all hits on the entry.
Definition: MuPatCandidateBase.cxx:61
Muon::MuPatCandidateBase::m_allHits
MeasVec m_allHits
Definition: MuPatCandidateBase.h:163
Muon::MuPatCandidateBase::stations
const std::set< MuonStationIndex::StIndex > & stations() const
returns set with contained stationIndices
Definition: MuPatCandidateBase.cxx:29
Muon::MuPatCandidateBase::garbage
const std::vector< std::shared_ptr< const Trk::MeasurementBase > > & garbage() const
Definition: MuPatCandidateBase.cxx:98