24 return StatusCode::SUCCESS;
40 std::vector<float> z_positions, r_positions;
42 for(
const auto& cand : *barrelCandidates) {
47 if (!
fitRPC(*cand, m, b, z_positions, r_positions)) {
53 std::vector<const xAOD::MdtDriftCircle*> mdtHits;
59 return StatusCode::SUCCESS;
65 float theta = 2.f * std::atan(std::exp(-cand.
eta()));
66 float tanTheta = std::tan(
theta);
72 for (
int i = 0; i < 4; ++i) {
73 const uint16_t z_bits = cand.
zPos(i);
74 if (!z_bits)
continue;
78 z_positions.push_back(z_mm);
79 r_positions.push_back(z_mm * tanTheta);
82 size_t N = z_positions.size();
83 if (N < 1)
return false;
85 float sumZ=0, sumR=0, sumZZ=0, sumZR=0;
86 for (
size_t i=0;i<N;++i) {
87 sumZ += z_positions[i];
88 sumR += r_positions[i];
89 sumZZ += z_positions[i]*z_positions[i];
90 sumZR += z_positions[i]*r_positions[i];
94 float den = N*sumZZ - sumZ*sumZ;
96 m = (N*sumZR - sumZ*sumR) / den;
97 b = (sumR - m*sumZ) / N;
111 const float dEta = 0.01f, dPhi = 0.01f;
120 if (!regSel)
return StatusCode::FAILURE;
122 std::vector<IdentifierHash> hashList;
123 regSel->HashIDList(trigROI, hashList);
129 float windowSize = 5;
146 const Amg::Vector3D gpos = locToGlob* dc->localMeasurementPos() ;
150 if (std::abs(resZ) > windowSize * pitch)
continue;
156 return StatusCode::SUCCESS;
162 float z_pred = (m!=0.f ? (gpos.perp() - b)/m : 0.f);
163 return gpos.z() - z_pred;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Scalar theta() const
theta method
#define ATH_CHECK
Evaluate an expression and check for errors.
Header file for AthHistogramAlgorithm.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
This is a "hash" representation of an Identifier.
float eta() const
get the kinematic parameters
virtual StatusCode initialize() override
float computeResidual(const Amg::Vector3D &gpos, float m, float b) const
virtual StatusCode execute(const EventContext &ctx) const override
ToolHandle< IRegSelTool > m_regionSelector
ToolHandle< IMdtCalibrationTool > m_calibrationTool
StatusCode collectMDTHits(const EventContext &ctx, const ActsTrk::GeometryContext &gctx, float eta, float phi, std::vector< const xAOD::MdtDriftCircle * > &hits, float m, float b) const
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
SG::ReadHandleKey< xAOD::MdtDriftCircleContainer > m_mdtDriftCircleKey
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
bool fitRPC(const L0Muon::RPCCandData &cand, float &m, float &b, std::vector< float > &z_positions, std::vector< float > &r_positions) const
SG::ReadHandleKey< L0Muon::RPCCandDataContainer > m_barrelCandidateKey
static constexpr float s_zPosRange
range of the RPC hits z positions
static constexpr uint16_t s_zPosBitRange
12 bits for z position
float zPos(int index) const
Readout element to describe the Monitored Drift Tube (Mdt) chambers Mdt chambers usually comrpise out...
double tubePitch() const
Returns the pitch between 2 tubes in a layer.
const Amg::Transform3D & localToGlobalTransform(const ActsTrk::GeometryContext &ctx) const
Returns the transformation from the local coordinate system of the readout element into the global AT...
Describes the Region of Ineterest geometry It has basically 9 parameters.
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
bool loadView(const Identifier &chamberId)
Loads the view matching the parsed identifier.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
DataVector< RPCCandData > RPCCandDataContainer
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
@ Chamber
View ends if the moduleHash changes.
MdtDriftCircle_v1 MdtDriftCircle
MdtDriftCircleContainer_v1 MdtDriftCircleContainer