26 return StatusCode::SUCCESS;
39 std::vector<float> z_positions, r_positions;
43 for(
const auto& cand : *barrelCandidates) {
47 if (!
fitRPC(*cand, m, b, z_positions, r_positions)) {
52 std::vector<const xAOD::MdtDriftCircle*> mdtHits;
58 std::vector<const xAOD::MdtDriftCircle*> biHits;
59 std::vector<const xAOD::MdtDriftCircle*> bmHits;
60 std::vector<const xAOD::MdtDriftCircle*> boHits;
68 const std::string st = idh.stationNameString(idh.stationName(
id));
70 if (st.rfind(
"BI", 0) == 0) {
72 }
else if (st.rfind(
"BM", 0) == 0) {
74 }
else if (st.rfind(
"BO", 0) == 0) {
81 int nStationsWithEnoughHits = 0;
82 if (biHits.size() >= 3) ++nStationsWithEnoughHits;
83 if (bmHits.size() >= 3) ++nStationsWithEnoughHits;
84 if (boHits.size() >= 3) ++nStationsWithEnoughHits;
86 if (nStationsWithEnoughHits < 2) {
87 ATH_MSG_DEBUG(
"Bad candidate: fewer than 2 stations with enough MDT hits");
94 std::vector<L0MDT::Segment> biSegmentsCSF;
95 std::vector<L0MDT::Segment> bmSegmentsCSF;
96 std::vector<L0MDT::Segment> boSegmentsCSF;
98 std::vector<L0MDT::Segment> biSegmentsLEG;
99 std::vector<L0MDT::Segment> bmSegmentsLEG;
100 std::vector<L0MDT::Segment> boSegmentsLEG;
103 if (biHits.size() >= 2) {
107 if (bmHits.size() >= 2) {
111 if (boHits.size() >= 2) {
118 <<
" BI=" << biSegmentsCSF.size()
119 <<
" BM=" << bmSegmentsCSF.size()
120 <<
" BO=" << boSegmentsCSF.size());
124 <<
" BI=" << biSegmentsLEG.size()
125 <<
" BM=" << bmSegmentsLEG.size()
126 <<
" BO=" << boSegmentsLEG.size());
128 const L0MDT::Segment* biSeg = biSegmentsCSF.empty() ? nullptr : &biSegmentsCSF.front();
129 const L0MDT::Segment* bmSeg = bmSegmentsCSF.empty() ? nullptr : &bmSegmentsCSF.front();
130 const L0MDT::Segment* boSeg = boSegmentsCSF.empty() ? nullptr : &boSegmentsCSF.front();
136 <<
"nStations=" << ptResult->nStations
137 <<
" pt=" << ptResult->pt
138 <<
" deltaBeta=" << ptResult->deltaBeta
139 <<
" sagitta=" << ptResult->sagitta
140 <<
" leverArm=" << ptResult->leverArm);
142 ATH_MSG_DEBUG(
"pT estimate not available for this candidate");
147 return StatusCode::SUCCESS;
154 float theta = 2.f * std::atan(std::exp(-
eta));
155 float tanTheta = std::tan(
theta);
160 for (
int i = 0; i < 4; ++i) {
162 z_positions.push_back(z_pos);
163 r_positions.push_back(z_pos * tanTheta);
166 size_t N = z_positions.size();
167 if (N < 1)
return false;
169 float sumZ=0, sumR=0, sumZZ=0, sumZR=0;
170 for (
size_t i=0;i<N;++i) {
171 sumZ += z_positions[i];
172 sumR += r_positions[i];
173 sumZZ += z_positions[i]*z_positions[i];
174 sumZR += z_positions[i]*r_positions[i];
178 float den = N*sumZZ - sumZ*sumZ;
180 m = (N*sumZR - sumZ*sumR) / den;
181 b = (sumR - m*sumZ) / N;
199 const float dEta = 0.01f, dPhi = 0.01f;
208 if (!regSel)
return StatusCode::FAILURE;
210 std::vector<IdentifierHash> hashList;
211 regSel->HashIDList(trigROI, hashList);
217 float windowSize = 5;
235 const Amg::Vector3D gpos = locToGlob* dc->localMeasurementPos() ;
237 if (std::abs(resZ) > windowSize * pitch)
continue;
245 return StatusCode::SUCCESS;
250 float z_pred = (m!=0.f ? (gpos.perp() - b)/m : 0.f);
251 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.
Class describing a reconstructed MDT segment used by the L0Muon trigger.
ToolHandle< L0MDT::IL0MDTSegmentFinderTool > m_legendreSegmentFinder
SG::ReadHandleKey< xAOD::RPCCandDataContainer > m_barrelCandidateKey
virtual StatusCode initialize() override
float computeResidual(const Amg::Vector3D &gpos, float m, float b) const
Compute the residual between a MDT hit global position and the fit line.
virtual StatusCode execute(const EventContext &ctx) const override
bool fitRPC(const xAOD::RPCCandData &cand, float &m, float &b, std::vector< float > &z_positions, std::vector< float > &r_positions) const
ToolHandle< IRegSelTool > m_regionSelector
StatusCode collectMDTHits(const EventContext &ctx, const ActsTrk::GeometryContext &gctx, float eta, float phi, std::vector< const xAOD::MdtDriftCircle * > &hits, float m, float b) const
Collect MDT hits within a RoI around (eta, phi), keeping only those whose residual from the RPC fit l...
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
ToolHandle< L0MDT::IL0MDTSegmentFinderTool > m_csfSegmentFinder
SG::ReadHandleKey< xAOD::MdtDriftCircleContainer > m_mdtDriftCircleKey
ToolHandle< L0MDT::IPtEstimationTool > m_ptEstimationTool
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
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.
uint16_t eta() const
Retrieve the eta.
static constexpr uint16_t phiBitRange()
static constexpr float etaRange()
static constexpr float phiRange()
static constexpr uint16_t etaBitRange()
static constexpr uint16_t zPosBitRange()
static constexpr float zPosRange()
std::array< uint16_t, 4 > zPos() const
Retrieve the global z positions of the RPC sector logic.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
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
RPCCandDataContainer_v1 RPCCandDataContainer
RPCCandData_v1 RPCCandData