 |
ATLAS Offline Software
|
Go to the documentation of this file.
19 #include <unordered_map>
23 struct LocalSegSorter {
26 if (
a ==
b)
return false;
27 if (
a->chamberIndex() !=
b->chamberIndex())
28 return a->chamberIndex() <
b->chamberIndex();
29 if (
a->sector() !=
b->sector())
30 return a->sector() <
b->sector();
31 if (
a->etaIndex() !=
b->etaIndex())
32 return a->etaIndex() <
b->etaIndex();
55 return StatusCode::SUCCESS;
60 return StatusCode::SUCCESS;
64 const EventContext& ctx{Gaudi::Hive::currentContext()};
66 using SegmentsPerBucket_t =
68 std::set<const xAOD::MuonSegment*, LocalSegSorter>>;
82 SegmentsPerBucket_t segPerBucket{};
86 segPerBucket[detSeg->parent()->parentBucket()].insert(seg);
96 const auto it = segPerBucket.find(bucket);
97 if (
it != segPerBucket.end()) {
107 float segEta =
static_cast<float>(globDir.eta());
108 float segPhi =
static_cast<float>(globDir.phi());
113 int32_t truthIdx = -1;
114 int32_t truthPdg = -1;
117 truthIdx =
static_cast<int32_t
>(
tp->index());
118 truthPdg =
static_cast<int32_t
>(
tp->pdgId());
137 return StatusCode::FAILURE;
142 return StatusCode::SUCCESS;
147 std::vector<unsigned int> uniqueLayers;
148 uniqueLayers.reserve(bucket.size());
150 for (
const SpacePointBucket::value_type& sp : bucket) {
151 const unsigned layNum =
sorter.sectorLayerNum(*sp);
152 if (
std::find(uniqueLayers.begin(), uniqueLayers.end(), layNum) == uniqueLayers.end()) {
153 uniqueLayers.push_back(layNum);
156 return static_cast<uint16_t>(uniqueLayers.size());
MuonVal::ThreeVectorBranch m_segmentDir
float numberDoF() const
Returns the numberDoF.
MuonVal::VectorBranch< int32_t > & m_segmentTruthIdx
Amg::Vector3D direction() const
Returns the direction as Amg::Vector.
: The muon space point bucket represents a collection of points that will bre processed together in t...
const xAOD::TruthParticle * getTruthMatchedParticle(const xAOD::MuonSegment &segment)
Returns the particle truth-matched to the segment.
StatusCode init(OWNER *instance)
Initialize method.
std::string find(const std::string &s)
return a remapped string
SG::ReadDecorHandleKeyArray< xAOD::MuonSegmentContainer > m_truthDecorKeys
Truth decoration (MC)
The SpacePointPerLayerSorter sort two given space points by their layer Identifier.
MuonVal::VectorBranch< float > & m_segmentTruthPt
StatusCode execute() override final
MuonVal::MuonTesterTree m_tree
Output tree.
Class describing a MuonSegment.
SG::ReadHandleKeyArray< SpacePointContainer > m_spacePointKeys
Inputs.
StatusCode finalize() override final
StatusCode initialize() override final
const Segment * detailedSegment(const xAOD::MuonSegment &seg)
Helper function to navigate from the xAOD::MuonSegment to the MuonR4::Segment.
MuonVal::VectorBranch< float > & m_segmentRecoPhi
void push_back(const Amg::Vector3D &vec)
interface using the Amg::Vector3D
MuonVal::VectorBranch< float > & m_segment_chiSquared
MuonVal::ScalarBranch< uint8_t > & m_bucket_sector
MuonVal::VectorBranch< float > & m_segment_numberDoF
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a truth particle in the MC record.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
MuonVal::ScalarBranch< uint16_t > & m_bucket_spacePoints
void push_back(const T &value)
Adds a new element at the end of the vector.
MuonVal::ScalarBranch< uint8_t > & m_bucket_chamberIdx
Amg::Vector3D position() const
Returns the position as Amg::Vector.
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
MuonVal::VectorBranch< float > & m_segmentTruthEta
Eigen::Matrix< double, 3, 1 > Vector3D
MuonVal::VectorBranch< float > & m_segmentTruthPhi
This header ties the generic definitions in this package.
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_segmentKeys
uint16_t countLayersInBucket(const SpacePointBucket &bucket) const
bool fill(const EventContext &ctx)
Fills the tree per call.
MuonVal::ScalarBranch< uint16_t > & m_bucket_layers
StatusCode write()
Finally write the TTree objects.
Parameters localSegmentPars(const xAOD::MuonSegment &seg)
Returns the localSegPars decoration from a xAODMuon::Segment.
MuonVal::VectorBranch< uint8_t > & m_segmentHasTruth
Handle class for reading from StoreGate.
MuonVal::VectorBranch< int32_t > & m_segmentTruthPDGId
decltype(auto) operator()(ObjectId< CI, CM > id) const noexcept
MuonVal::ThreeVectorBranch m_segmentPos
MuonVal::VectorBranch< float > & m_segmentRecoEta