12 #include "Acts/Definitions/Tolerance.hpp"
13 #include "Acts/Definitions/Units.hpp"
14 #include "Acts/Utilities/Helpers.hpp"
15 #include "Acts/Surfaces/PlaneSurface.hpp"
17 using namespace Acts::UnitLiterals;
20 constexpr float toFloat(
const double x) {
22 if (Acts::abs(
x) < Acts::s_epsilon) {
25 constexpr double min = 3.*
static_cast<double>(std::numeric_limits<float>::min());
26 constexpr double max =
static_cast<double>(std::numeric_limits<float>::max());
27 const double clampedX = std::copysign(std::clamp(Acts::abs(
x),
min,
max),
x);
28 return static_cast<float>(clampedX);
38 return StatusCode::SUCCESS;
41 unsigned bucketCounter{0u};
51 for (
const auto& bucket : *container) {
52 std::vector<std::uint32_t> layNumbers{};
53 for (
const auto& spacePoint : *bucket) {
54 const std::uint32_t layNum = layerSorter.
sectorLayerNum(*spacePoint);
55 if (!Acts::rangeContainsValue(layNumbers, layNum)) {
56 layNumbers.push_back(layNum);
65 const Acts::Surface& measSurface =
xAOD::muonSurface(spacePoint->primaryMeasurement());
67 m_driftR += toFloat(spacePoint->driftRadius());
68 m_time += toFloat(spacePoint->time());
70 m_toMeasFrame += spacePoint->msSector()->surface().localToGlobalTransform(tgContext).inverse()*
71 measSurface.localToGlobalTransform(tgContext);
73 m_covLoc0 += toFloat(spacePoint->covariance()[Acts::toUnderlying(AxisDefs::etaCov)]);
74 m_covLoc1 += toFloat(spacePoint->covariance()[Acts::toUnderlying(AxisDefs::phiCov)]);
75 m_covT += toFloat(spacePoint->covariance()[Acts::toUnderlying(AxisDefs::timeCov)]);
82 return StatusCode::SUCCESS;
86 return StatusCode::SUCCESS;
89 std::uint32_t gasGap)
const {
90 constexpr std::uint32_t threeBit = 0x7;
91 constexpr std::uint32_t fourBit = 0xF;
92 constexpr std::uint32_t sixBit = 0x3F;
93 std::uint32_t rawRep{0u};
95 rawRep |= (
static_cast<std::uint32_t
>(ch->chamberIndex()) & fourBit);
96 if (ch->side() == 1) {
101 rawRep |= ((
static_cast<std::uint32_t
>(techIdx) & threeBit) << 5);
102 rawRep |= ((
static_cast<std::uint32_t
>(ch->sector() - 1u) & sixBit) << 8);
103 rawRep |= (
static_cast<std::uint32_t
>(spacePoint.
measuresEta()) << 14);
104 rawRep |= (
static_cast<std::uint32_t
>(spacePoint.
measuresPhi()) << 15);
105 rawRep |= (
static_cast<std::uint32_t
>(spacePoint.
hasTime()) << 16);
134 rawRep |= ((
static_cast<std::uint32_t
>(gasGap - 1u) & fourBit) << 17);
135 rawRep |= (
static_cast<std::uint32_t
>(primaryCh - 1u) << 21);
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Handle class for reading from StoreGate.
int tube(const Identifier &id) const
int channel(const Identifier &id) const override
Chamber represent the volume enclosing a muon station.
The SpacePointPerLayerSorter sort two given space points by their layer Identifier.
unsigned int sectorLayerNum(const SpacePoint &sp) const
method returning the logic layer number
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
bool hasTime() const
Returns whether the measurement carries time information.
const Identifier & identify() const
: Identifier of the primary measurement
bool measuresPhi() const
: Does the space point contain a phi measurement
const MuonGMR4::Chamber * chamber() const
: Pointer to the associated chamber
bool measuresEta() const
: Does the space point contain an eta measurement
MuonVal::UnitThreeVectorBranch m_sensorDirection
Orientation of the wire or strip.
virtual StatusCode initialize() override final
MuonVal::VectorBranch< float > & m_time
Recorded measurement time.
MuonVal::VectorBranch< std::uint32_t > & m_muonId
Identifier encoding the staion name && the coordinates measured by the space point.
MuonVal::UnitThreeVectorBranch m_toNextSensor
Vector pointing to the next channel in the same measurement plane.
MuonVal::MuonTesterTree m_tree
instance to the Event tree
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
The tool handle of the tracking geometry tool.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Service handle towards the IdHelper svc.
MuonVal::VectorBranch< float > & m_covLoc0
Covariance value along the non-bending direction.
MuonVal::VectorBranch< float > & m_covT
Time covariance value.
MuonVal::VectorBranch< std::uint16_t > & m_bucketId
Bucket counter in the event.
MuonVal::ThreeVectorBranch m_localPosition
Position of the measurement.
MuonVal::VectorBranch< GeoId_t > & m_geometryId
SG::ReadHandleKeyArray< MuonR4::SpacePointContainer > m_spacePointKeys
virtual StatusCode finalize() override final
MuonVal::VectorBranch< float > & m_covLoc1
Covaraiance value along the bending direction.
MuonVal::ScalarBranch< std::uint32_t > & m_eventId
The event number in this event.
MuonVal::CoordSystemsBranch m_toMeasFrame
Coordinate transformation from the local measurement's frame to the common sector frame.
std::uint32_t encodeId(const MuonR4::SpacePoint &spacePoint, std::uint32_t gasGap) const
Encode the space point's identifier into the Identifier understood by ActsExamples.
MuonVal::VectorBranch< float > & m_driftR
Drift radius of the straw measurements.
virtual StatusCode execute(const EventContext &ctx) override final
Execute method.
int channel(const Identifier &id) const override
Property holding a SG store/key/clid from which a ReadHandle is made.
int channel(const Identifier &id) const override
int channel(const Identifier &id) const override
DataVector< SpacePointBucket > SpacePointContainer
Abrivation of the space point container type.
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...
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.
const Acts::Surface & muonSurface(const UncalibratedMeasurement *meas)
Returns the associated Acts surface to the measurement.