|
ATLAS Offline Software
|
Go to the documentation of this file.
6 #include "GaudiKernel/SystemOfUnits.h"
14 #include "GaudiKernel/PhysicalConstants.h"
21 using TruthHitCol = std::unordered_set<const xAOD::MuonSimHit*>;
30 std::vector<MuonHoughTransformTester::ObjectMatching>
34 std::vector<ObjectMatching> assocObj{}, assocObjMultMatch{};
35 std::unordered_set<const SegmentSeed*> usedSeeds{};
36 std::unordered_set<const Segment*> usedSegs{};
37 std::vector<TruthHitCol> truthHitsVec{}, seedHitsVec{}, segmentHitsVec{};
55 if (seed->msSector() != matchTempl.chamber) {
59 unsigned int matchedHits =
countMatched(truthHits, seedHits);
63 double matchFracion{1.*matchedHits / (1.*seed->getHitsInMax().size())};
64 if (matchFracion > matchTempl.matchFracSeed) {
65 matchTempl.matchFracSeed = matchFracion;
66 matchTempl.matchedSeed = seed;
67 matchTempl.nTruthMatchedMax = matchedHits;
72 std::vector<const Segment*> matchedSegs{};
75 if (
segment->msSector() != matchTempl.chamber) {
78 const TruthHitCol& segmentHits{segmentHitsVec[segmentIdx]};
79 unsigned int matchedHits =
countMatched(truthHits, segmentHits);
84 double matchFracion{1.*matchedHits / (1.*truthHits.size())};
85 if (matchFracion > matchTempl.matchFracSegment) {
86 matchTempl.matchFracSegment = matchFracion;
87 matchTempl.nTruthMatchedSeg = matchedHits;
88 matchTempl.matchedSegment =
segment;
91 }
else if (matchTempl.nTruthMatchedSeg == matchedHits) {
95 usedSegs.insert(matchTempl.matchedSegment);
96 usedSeeds.insert(matchTempl.matchedSeed);
97 assocObj.push_back(matchTempl);
101 matching.matchedSegment =
matched;
102 usedSeeds.insert(matching.matchedSeed);
103 usedSegs.insert(matching.matchedSegment);
104 assocObjMultMatch.push_back(std::move(matching));
109 for (
const Segment* seg: *segmentContainer) {
111 if (usedSegs.count(seg)) {
115 match.chamber = seg->msSector();
116 match.matchedSegment = seg;
117 match.matchedSeed = seg->parent();
118 for (
unsigned int truthIdx = 0 ; truthIdx < truthHitsVec.size(); ++truthIdx){
122 unsigned int matches =
countMatched(truthHitsVec[truthIdx], segmentHitsVec[segIdx]);
123 if (!matches)
continue;
124 match.bestTruthMatch =
false;
125 const double matchFrac = 1. * matches / (1. *seg->measurements().size());
126 if (matchFrac >
match.matchFracSegment) {
127 match.matchFracSeed = matchFrac;
128 match.truthSegment = truthSegments->
at(truthIdx);
129 match.nTruthMatchedSeg = matches;
132 usedSeeds.insert(
match.matchedSeed);
133 assocObj.push_back(
match);
138 if (usedSeeds.count(seed)) {
142 match.chamber = seed->msSector();
143 match.matchedSeed = seed;
144 for (
unsigned int truthIdx = 0 ; truthIdx < truthHitsVec.size(); ++truthIdx){
148 unsigned int matches =
countMatched(truthHitsVec[truthIdx], seedHitsVec[seedIdx]);
149 if (!matches)
continue;
150 match.bestTruthMatch =
false;
151 const double matchFrac = 1. * matches / (1. *seed->getHitsInMax().size());
152 if (matchFrac >
match.matchFracSeed) {
153 match.matchFracSeed = matchFrac;
154 match.truthSegment = truthSegments->
at(truthIdx);
155 match.nTruthMatchedMax = matches;
158 assocObj.push_back(
match);
160 assocObj.insert(assocObj.end(), std::make_move_iterator(assocObjMultMatch.begin()),
161 std::make_move_iterator(assocObjMultMatch.end()));
183 return StatusCode::SUCCESS;
185 template <
class ContainerType>
188 const ContainerType*& contToPush)
const {
189 contToPush =
nullptr;
192 return StatusCode::SUCCESS;
196 contToPush = readHandle.cptr();
197 return StatusCode::SUCCESS;
202 return StatusCode::SUCCESS;
250 if (!foundMax)
return;
262 [](
int i,
const HoughHitType &
h){i += h->measuresEta();return i;});
264 [](
int i,
const HoughHitType &
h){i += h->measuresPhi();return i;});
265 unsigned int nMdtMax{0}, nRpcMax{0}, nTgcMax{0}, nMmMax{0}, nsTgcMax{0};
268 switch (houghSP->type()) {
273 nRpcMax+=houghSP->measuresEta();
274 nRpcMax+=houghSP->measuresPhi();
277 nTgcMax+=houghSP->measuresEta();
278 nTgcMax+=houghSP->measuresPhi();
288 <<
" not yet implemented");
302 using namespace SegmentFit;
306 !=
segment->measurements().end();
319 for (
const double c2 :
segment->chi2PerMeasurement()){
329 unsigned int nMdtHits{0}, nRpcEtaHits{0}, nRpcPhiHits{0}, nTgcEtaHits{0}, nTgcPhiHits{0};
330 for (
const auto & meas :
segment->measurements()){
331 switch (meas->type()) {
338 nRpcEtaHits += meas->measuresEta();
339 nRpcPhiHits += meas->measuresPhi();
343 nTgcEtaHits += meas->measuresEta();
344 nTgcPhiHits += meas->measuresPhi();
358 const EventContext & ctx = Gaudi::Hive::currentContext();
377 std::vector<ObjectMatching>
objects =
matchWithTruth(readTruthSegments, readSegmentSeeds, readMuonSegments);
387 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
int8_t side() const
Returns the side of the MS-sector 1 -> A side ; -1 -> C side.
const SpectrometerSector * msSector() const
Returns the pointer to the envelope volume enclosing all chambers in the sector.
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
int stationPhi() const
: Returns the station phi of the sector
StatusCode init(OWNER *instance)
Initialize method.
std::unordered_set< const xAOD::MuonSimHit * > getTruthMatchedHits(const xAOD::MuonSegment &segment)
: Returns all truth hits matched to a xAOD::MuonSegment
@ BEE
BEE measurement point.
double tanPhi() const
Returns the angle from the phi extension.
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Placeholder for what will later be the muon segment EDM representation.
The MuonReadoutElement is an abstract class representing the geometry representing the muon detector.
Class describing a MuonSegment.
virtual DetectorType detectorType() const =0
Returns the detector element type.
virtual IdentifierHash layerHash(const Identifier &measId) const =0
#define ATH_MSG_VERBOSE(x)
std::pair< Amg::Vector3D, Amg::Vector3D > makeLine(const Parameters &pars)
Returns the parsed parameters into an Eigen line parametrization.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
std::unordered_set< const xAOD::MuonSimHit * > TruthHitCol
double houghTanPhi(const Amg::Vector3D &v)
: Returns the hough tanPhi [x] / [z]
Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index scheme.
double tanTheta() const
Returns the angular coordinate of the eta transform.
bool hasPhiExtension() const
check whether the segment seed includes a valid phi extension
::StatusCode StatusCode
StatusCode definition for legacy code.
Amg::Transform3D globalToLocalTrans(const ActsGeometryContext &gctx) const
Returns the global -> local transformation from the ATLAS global.
Eigen::Affine3d Transform3D
double interceptY() const
Returns the intercept coordinate of the eta transform.
const std::vector< HitType > & getHitsInMax() const
Returns the list of assigned hits.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Include the GeoPrimitives which need to be put first.
void push_back(const T &value)
Adds a new element at the end of the vector.
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
constexpr int toInt(const ParamDefs p)
double interceptX() const
Returns the intercept from the phi extension.
Eigen::Matrix< double, 3, 1 > Vector3D
This header ties the generic definitions in this package.
#define ATH_MSG_WARNING(x)
const T & getVariable() const
Representation of a segment seed (a fully processed hough maximum) produced by the hough transform.
virtual IdentifierHash measurementHash(const Identifier &measId) const =0
Constructs the identifier hash from the full measurement Identifier.
bool fill(const EventContext &ctx)
Fills the tree per call.
const Amg::Transform3D & localToGlobalTrans(const ActsGeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.
StatusCode write()
Finally write the TTree objects.
unsigned int countMatched(const TruthHitCol &truthHits, const TruthHitCol &recoHits)
Parameters localSegmentPars(const xAOD::MuonSegment &seg)
Returns the localSegPars decoration from a xAODMuon::Segment.
const T * at(size_type n) const
Access an element, as an rvalue.
double houghTanTheta(const Amg::Vector3D &v)
Returns the hough tanTheta [y] / [z].
bool match(std::string s1, std::string s2)
match the individual directories of two strings
const SpectrometerSector * getSectorEnvelope(const Identifier &channelId) const
Retrieves the spectrometer envelope enclosing the channel's readout element.
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
bool addBranch(std::shared_ptr< IMuonTesterBranch > branch)
Branch is added to the tree without transferring the ownership.
const MuonReadoutElement * getReadoutElement(const Identifier &id) const
Returns a generic Muon readout element.