|
ATLAS Offline Software
|
Go to the documentation of this file.
10 #include "GaudiKernel/PhysicalConstants.h"
11 #include "GeoModelHelpers/throwExcept.h"
22 namespace SegmentFitHelpers{
23 using namespace SegmentFit;
32 switch (measurement.
type()) {
42 if (
msg.level() <= MSG::WARNING) {
43 msg<<MSG::WARNING<<__FILE__<<
":"<<__LINE__<<
" - Unsupported measurement: "
60 if (
msg.level() <= printLvl) {
79 std::optional<double> travelledDist = Amg::intersect<3>(segPos, segDir, normal, normal.dot(stripSP.
positionInChamber()));
80 const Amg::Vector3D planeCrossing = segPos + travelledDist.value_or(0) * segDir;
84 if (
msg.level() <= printLvl) {
89 <<
", covariance: " <<std::endl<<
Amg::toString(stripSP.covariance())<<
", inverse: "
98 const double timeOffset, std::optional<double> arrivalTime,
102 switch (hit.
type()) {
114 if (
msg.level() <= MSG::WARNING) {
115 msg<<MSG::WARNING<<__FILE__<<
":"<<__LINE__<<
" - Unsupported measurement: "
132 const Amg::Vector3D closePointSeg = segPos + Amg::intersect<3>(hitPos, hitDir, segPos, segDir).value_or(0)* segDir;
134 const Amg::Vector3D closePointWire = hitPos + hitDir.dot(closePointSeg - hitPos) * hitDir;
139 if (
msg.level() <= printLvl) {
146 (Amg::lineDistance<3>(hitPos, hitDir, segPos, segDir) -hit.
driftRadius())<<std::endl <<
", covariance: "<<std::endl
156 const double offsetTime,
157 std::optional<double> arrivalTime,
164 const SpacePoint* spacePoint = strip.spacePoint();
166 std::optional<double> travelledDist = Amg::intersect<3>(segPos, segDir, normal, normal.dot(spacePoint->
positionInChamber()));
167 const Amg::Vector3D planeCrossing = segPos + travelledDist.value_or(0) * segDir;
169 if (strip.measuresTime() && arrivalTime) {
170 residual[
Amg::z] = strip.time() - (*arrivalTime) - travelledDist.value_or(0) * c_inv - offsetTime;
175 if (
msg.level() <= printLvl) {
180 <<
", covariance: "<<std::endl<<
toString(strip.covariance())<<
", inverse: "
194 const Amg::Vector3D planeCrossing{segPos + Amg::intersect<3>(segPos, segDir, Amg::Vector3D::UnitZ(),
199 if (
msg.level() <= printLvl) {
211 const std::vector<const SpacePoint*>& uncalibHits,
214 std::vector<int> signs{};
215 signs.reserve(uncalibHits.size());
217 signs.push_back( sp ?
driftSign(segPos,segDir, *sp,
msg) : 0);
227 const double signedDist = deltaPos.y() - (segDir.y() / segDir.z()) * deltaPos.z();
228 if (
msg.level() <= printLvl) {
230 <<
", signed distance: "<<signedDist<<
", unsigned distance: "
233 return signedDist >0 ? 1 : -1;
241 const double signedDist = deltaPos.y() - (segDir.y() / segDir.z()) * deltaPos.z();
242 if (
msg.level() <= printLvl) {
245 <<
", signed distance: "<<signedDist<<
", unsigned distance: "
248 return signedDist >0 ? 1 : -1;
251 std::optional<double> arrivalTime,
252 std::vector<std::unique_ptr<CalibratedSpacePoint>>&
hits,
255 std::vector<double> measChi2{};
258 for (std::unique_ptr<CalibratedSpacePoint>& hit :
hits) {
265 chi2+= measChi2.back();
268 return std::make_pair(std::move(measChi2),
chi2);
std::vector< int > driftSigns(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const std::vector< const SpacePoint * > &uncalibHits, MsgStream &msg)
Calculates whether a segement line travereses the tube measurements on the left (-1) or right (1) sid...
const MuonGMR4::SpectrometerSector * msSector() const
xAOD::UncalibMeasType type() const
AmgVector(toInt(ParamDefs::nPars)) Parameters
std::pair< std::vector< double >, double > postFitChi2PerMas(const SegmentFit::Parameters &segPars, std::optional< double > arrivalTime, std::vector< std::unique_ptr< CalibratedSpacePoint >> &hits, MsgStream &msg)
Calculates the chi2 per measurement and the chi2 itself after the fit is finished.
Eigen::Matrix< double, 2, 1 > Vector2D
Amg::Vector3D planeNormal() const
Returns the vector pointing out of the measurement plane.
double chiSqTerm(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const SpacePoint &measurement, MsgStream &msg)
Calculates the chi2 contribuation to a linear segment line from an uncalibrated measurement.
std::pair< Amg::Vector3D, Amg::Vector3D > makeLine(const Parameters &pars)
Returns the parsed parameters into an Eigen line parametrization.
std::string toString(const CalibratedSpacePoint::Covariance_t &mat)
Returns the matrix in string.
const xAOD::UncalibratedMeasurement * primaryMeasurement() const
int driftSign(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const SpacePoint &uncalibHit, MsgStream &msg)
Calculates whether a segement line travereses the tube measurement on the left (-1) or right (1) side...
double chiSqTermStrip(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const SpacePoint &measurement, MsgStream &msg)
Calculates the chi2 contribuation to a linear segment line from an uncalibrated strip measurement.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
double chiSqTermMdt(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const SpacePoint &measurement, MsgStream &msg)
Calculates the chi2 contribuation to a linear segment line from an uncalibrated Mdt measurement.
CalibratedSpacePoint::Covariance_t inverse(const CalibratedSpacePoint::Covariance_t &mat)
Inverts the parsed matrix.
double chi2(TH1 *h0, TH1 *h1)
State
State flag to distinguish different space point states.
xAOD::UncalibMeasType type() const
Returns the space point type.
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
const Amg::Vector3D & directionInChamber() const
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns the IdHelpeSvc.
State fitState() const
Returns the state of the calibrated space point.
constexpr int toInt(const ParamDefs p)
const Amg::Vector3D & positionInChamber() const
The position of the calibrated space point inside the chamber.
Eigen::Matrix< double, 3, 1 > Vector3D
This header ties the generic definitions in this package.
const Amg::Vector3D & positionInChamber() const
virtual std::string toString(const Identifier &id) const =0
print all fields to string
The calibrated Space point is created during the calibration process.
unsigned int dimension() const
Is the space point a 1D or combined 2D measurement.
double driftRadius() const
: Returns the size of the drift radius
const Covariance_t & covariance() const
https://gitlab.cern.ch/atlas/athena/-/blob/master/MuonSpectrometer/MuonReconstruction/MuonRecEvent/Mu...
const SpacePoint * spacePoint() const
The pointer to the space point out of which this space point has been built.
const Amg::Vector3D & directionInChamber() const
The direction of the calibrated space point inside the chamber.
double driftRadius() const
The drift radius of the calibrated space point.
Scalar mag() const
mag method
const Identifier & identify() const
: Identifier of the primary measurement
double chiSqTermBeamspot(const Amg::Vector3D &posInChamber, const Amg::Vector3D &dirInChamber, const CalibratedSpacePoint &beamSpotMeas, MsgStream &msg)
Calculates the chi2 contribution from an external beam spot constraint.
double contract(const CalibratedSpacePoint::Covariance_t &mat, const Amg::Vector3D &a, const Amg::Vector3D &b)