35 return TechIdx_t::MDT;
37 return TechIdx_t::RPC;
39 return TechIdx_t::TGC;
43 return TechIdx_t::STGC;
45 return TechIdx_t::TechnologyUnknown;
59 return StatusCode::SUCCESS;
66 ATH_CHECK(outContainer.
record(std::make_unique<xAOD::MuonSegmentContainer>(),
67 std::make_unique<xAOD::MuonSegmentAuxContainer>()));
70 ATH_CHECK(prdCombContainer.
record(std::make_unique<xAOD::CombinedMuonStripContainer>(),
71 std::make_unique<xAOD::CombinedMuonStripAuxContainer>()));
77 static std::atomic<unsigned> sTgcWarnings{0};
78 bool printWarning{sTgcWarnings < 100};
80 std::vector<std::tuple<const xAOD::UncalibratedMeasurement*, State>> combineMap{};
81 combineMap.reserve(10);
88 auto decorateLinks = [
this, &dec_prdLinks, &prdCombContainer, &printWarning,
91 std::vector<char>& linkStates = dec_prdStates(outSegment);
92 links.reserve(2*inSegment.measurements().size());
93 linkStates.reserve(2*inSegment.measurements().size());
101 linkStates.emplace_back(Acts::toUnderlying(st));
110 auto cmbMeas = prdCombContainer->push_back(std::make_unique<xAOD::CombinedMuonStrip>());
112 cmbMeas->setPrimaryStrip(m1);
113 cmbMeas->setSecondaryStrip(m2);
122 appendLink(cmbMeas, st);
124 for (
const auto& meas : inSegment.measurements()) {
129 switch (
sp->type()) {
132 case MdtDriftCircleType:
133 case MMClusterType: {
134 appendLink(
sp->primaryMeasurement(), meas->fitState());
138 if (
sp->primaryMeasurement() &&
sp->secondaryMeasurement()) {
139 if (
sp->primaryMeasurement() !=
sp->secondaryMeasurement()) {
140 combine(
sp->primaryMeasurement(),
sp->secondaryMeasurement(), meas->fitState());
142 appendLink(
sp->primaryMeasurement(), meas->fitState());
148 combineMap.emplace_back(
sp->primaryMeasurement(), meas->fitState());
151 }
case sTgcStripType:{
153 appendLink(
sp->primaryMeasurement(), meas->fitState());
154 appendLink(
sp->secondaryMeasurement(), meas->fitState());
157 ATH_MSG_WARNING(__FILE__<<
":"<<__LINE__<<
" Please implement a stgc combination schema");
158 printWarning =
false;
165 for (std::size_t cmbIdx = 0; cmbIdx < combineMap.size(); ++cmbIdx){
167 const State s1{std::get<1>(combineMap[cmbIdx])};
170 if (cmbIdx +1 < combineMap.size()){
172 const State s2{std::get<1>(combineMap[cmbIdx+1])};
174 <<
" is a good candidate");
175 if (m1->type() == m2->type() &&
176 m1->identifierHash() == m2->identifierHash() &&
201 unsigned recoSegIdx{0};
202 outContainer->reserve(outContainer->size() + segmentContainer->
size());
203 for (
const Segment* inSegment : *segmentContainer) {
206 xAOD::MuonSegment* convertedSeg = outContainer->push_back(std::make_unique<xAOD::MuonSegment>());
207 dec_parentLink(*convertedSeg) =
SegLink_t{segmentContainer, recoSegIdx};
212 convertedSeg->
setPosition(pos.x(), pos.y(), pos.z());
218 convertedSeg->
setFitQuality(inSegment->chi2(), inSegment->nDoF());
219 convertedSeg->
setNHits(inSegment->summary().nPrecHits, inSegment->summary().nPhiHits,
220 inSegment->summary().nEtaTrigHits);
223 convertedSeg->
setT0Error(inSegment->segementT0(),
224 Amg::error(inSegment->covariance(), Acts::toUnderlying(
t0)));
226 SegPars_t& localPars{dec_locPars(*convertedSeg)};
231 localPars[Acts::toUnderlying(x0)] = locPos.x();
232 localPars[Acts::toUnderlying(y0)] = locPos.y();
233 localPars[Acts::toUnderlying(
theta)] = locDir.theta();
234 localPars[Acts::toUnderlying(
phi)] = locDir.phi();
235 localPars[Acts::toUnderlying(
t0)] = inSegment->segementT0();
236 decorateLinks(*inSegment, *convertedSeg);
241 sTgcWarnings = sTgcWarnings + 1;
243 return StatusCode::SUCCESS;
Scalar phi() const
phi method
Scalar theta() const
theta method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Handle class for adding a decoration to an object.
Handle class for recording to StoreGate.
size_type size() const noexcept
Returns the number of elements in the collection.
ElementLink implementation for ROOT usage.
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
int8_t side() const
Returns the side of the MS-sector 1 -> A side ; -1 -> C side.
Amg::Transform3D globalToLocalTrans(const ActsTrk::GeometryContext &gctx) const
Returns the global -> local transformation from the ATLAS global.
int sector() const
Returns the sector of the MS-sector.
Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index scheme.
static std::string toString(const State s)
Converts the state enum into a string.
State
State flag to distinguish different space point states.
Placeholder for what will later be the muon segment EDM representation.
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
DecorKey_t m_prdStateKey
Decoration to the PrdLink state (I.e.
DecorKey_t m_localSegParKey
Decoration to the local segment parameters.
DecorKey_t m_parentSegKey
Decoration of the original segment.
SG::WriteHandleKey< xAOD::MuonSegmentContainer > m_writeKey
Output segment container key.
SG::WriteHandleKey< xAOD::CombinedMuonStripContainer > m_combMeasKey
Auxiliary container to model two measurements in the same gas gap as a single track state.
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
Alignment container key.
DecorKey_t m_prdLinkKey
Decoration to the links to the associated Uncalibrated measurements.
virtual StatusCode execute(const EventContext &ctx) const override final
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
IdHelperSvc for Identifier printing & manipulation.
virtual StatusCode initialize() override final
SG::ReadHandleKeyArray< SegmentContainer > m_readKeys
Input segment container key.
Property holding a SG store/key/clid from which a ReadHandle is made.
Handle class for adding a decoration to an object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
void setDirection(float px, float py, float pz)
Sets the direction.
void setFitQuality(float chiSquared, float numberDoF)
Set the 'Fit Quality' information.
void setNHits(int nPrecisionHits, int nPhiLayers, int nTrigEtaLayers)
Set the number of hits/layers.
void setT0Error(float t0, float t0Error)
Sets the time error.
void setIdentifier(int sector, ::Muon::MuonStationIndex::ChIndex chamberIndex, int etaIndex, ::Muon::MuonStationIndex::TechnologyIndex technology)
Set the identifier.
void setPosition(float x, float y, float z)
Sets the global position.
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
SeedingAux::FitParIndex ParamDefs
Use the same parameter indices as used by the CompSpacePointAuxiliaries.
This header ties the generic definitions in this package.
std::vector< PrdLink_t > PrdLinkVec_t
Abrivation of a collection of Prd links.
constexpr TechIdx_t toTechIdx(const xAOD::UncalibMeasType aodType)
CalibratedSpacePoint::State State
Muon::MuonStationIndex::TechnologyIndex TechIdx_t
ElementLink< MuonR4::SegmentContainer > SegLink_t
Abrivation of the link to the reco segment container.
DataVector< Segment > SegmentContainer
ElementLink< PrdCont_t > PrdLink_t
Abrivation to call the link to an element inside an uncalibrated measurement container.
xAOD::UncalibratedMeasurementContainer PrdCont_t
Abrivation to call an uncalibrated measurement container.
xAOD::MeasVector< Acts::toUnderlying(ParamDefs::nPars)> SegPars_t
Abrivation of the decorated local segment parameters.
TechnologyIndex
enum to classify the different layers in the muon spectrometer
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
UncalibMeasType
Define the type of the uncalibrated measurement.
const Identifier & identify(const UncalibratedMeasurement *meas)
Returns the associated identifier from the muon measurement.
IdentifierHash layerHash(const UncalibratedMeasurement *meas)
Returns the layer hash from an uncalibrated meaurement.
UncalibratedMeasurementContainer_v1 UncalibratedMeasurementContainer
Define the version of the uncalibrated measurement container.
MuonSegment_v1 MuonSegment
Reference the current persistent version:
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
#define THROW_EXCEPTION(MESSAGE)