|
ATLAS Offline Software
|
tool to match segments
More...
#include <MuonSegmentInOverlapResolvingTool.h>
|
| MuonSegmentInOverlapResolvingTool (const std::string &, const std::string &, const IInterface *) |
| constructor More...
|
|
virtual | ~MuonSegmentInOverlapResolvingTool () |
| destructor More...
|
|
StatusCode | initialize () |
| AlgTool initilize. More...
|
|
SegmentMatchResult | matchResult (const EventContext &ctx, const MuonSegment &seg1, const MuonSegment &seg2) const |
| performance match and return result More...
|
|
SegmentPositionMatchResult | bestPositionAlongTubeMatch (const MuonSegment &seg1, const MuonSegment &seg2, const Amg::Vector3D &segDir1Min) const |
| calculate the position along a tube direction of the first segment that results in the smallest position residual in the precision plane of the second segment given the segment direction for segment 1 in global coordinates More...
|
|
SegmentPhiMatchResult | bestPhiMatch (const MuonSegment &seg1, const MuonSegment &seg2) const |
| calculate the angle phi for which the angular residual in the precision plane of the second segment is zero More...
|
|
SegmentPhiMatchResult | bestPhiMatchAnalytic (const MuonSegment &seg1, const MuonSegment &seg2) const |
| calculate the angle phi for which the angular residual in the precision plane of the second segment is zero More...
|
|
Amg::Vector3D | updateSegmentDirection (const MuonSegment &seg, double phi) const |
| recalculate the segment direction give a new angle phi, keeps the angle in the precision plane fixed More...
|
|
SegmentGeometrySummary | segmentGeometrySummary (const MuonSegment &seg) const |
| calculate geometrical information for a segment More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
|
double | checkPhiHitConsistency (const EventContext &ctx, const Muon::MuonSegment &segment, SegmentPhiMatchResult &phiMatchResult, SegmentPositionMatchResult &matchResult) const |
| compare phi hits with segment parameters, return average pull of the phi hits More...
|
|
Amg::Vector3D | estimateSegmentDirection (const MuonSegment &seg1, const MuonSegment &seg2, double &phi, double &stereoangle) const |
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
tool to match segments
Definition at line 41 of file MuonSegmentInOverlapResolvingTool.h.
◆ MeasCit
◆ MeasIt
◆ MeasVec
◆ StoreGateSvc_t
◆ MuonSegmentInOverlapResolvingTool()
Muon::MuonSegmentInOverlapResolvingTool::MuonSegmentInOverlapResolvingTool |
( |
const std::string & |
ty, |
|
|
const std::string & |
na, |
|
|
const IInterface * |
pa |
|
) |
| |
◆ ~MuonSegmentInOverlapResolvingTool()
virtual Muon::MuonSegmentInOverlapResolvingTool::~MuonSegmentInOverlapResolvingTool |
( |
| ) |
|
|
inlinevirtual |
◆ bestPhiMatch()
calculate the angle phi for which the angular residual in the precision plane of the second segment is zero
Implements Muon::IMuonSegmentInOverlapResolvingTool.
Definition at line 275 of file MuonSegmentInOverlapResolvingTool.cxx.
278 unsigned int nbins = 11;
280 double scanRange = 1.;
281 double scanStep = scanRange / (
nbins - 1);
282 double phiStart = seg1.globalDirection().phi() - 0.5 * scanRange;
284 double dthetaMin = 1e9;
287 seg2.associatedSurface().globalToLocalDirection(seg2.globalDirection(), segLocDir2);
288 for (
unsigned int i = 0;
i <
nbins; ++
i) {
289 double phi = phiStart + scanStep *
i;
292 seg2.associatedSurface().globalToLocalDirection(segDir1, segLocDir12);
293 double dyz = std::abs(segLocDir12.
angleYZ() - segLocDir2.
angleYZ());
294 if (dyz < dthetaMin) {
296 segDir1Min = segDir1;
◆ bestPhiMatchAnalytic()
calculate the angle phi for which the angular residual in the precision plane of the second segment is zero
Definition at line 194 of file MuonSegmentInOverlapResolvingTool.cxx.
214 Amg::Transform3D gToLocal1 = seg1.associatedSurface().transform().inverse();
228 Amg::Vector3D lDiro12 = gToLocal1.linear() * (gToGlobal2.linear() * segLocDiro);
239 double b = lDir1.y() * lDir12.z() - lDir1.z() * lDir12.y();
240 double a = lDir1.y() * lDiro12.z() - lDir1.z() * lDiro12.y();
241 double dxn = lDir12.x();
242 double dyn = lDir12.y();
243 double dzn = lDir12.z();
244 if (std::abs(
a) > 1
e-2) {
245 dxn = lDir12.x() -
b * lDiro12.x() /
a;
246 dyn = lDir12.y() -
b * lDiro12.y() /
a;
247 dzn = lDir12.z() -
b * lDiro12.z() /
a;
249 double norm = std::hypot(dxn, dyn, dzn);
254 if (dxn * lDir1.x() + dyn * lDir1.y() + dzn * lDir1.z() < 0)
norm = -
norm;
267 seg2.associatedSurface().globalToLocalDirection(segDir1Min, segLocDir1);
269 seg2.associatedSurface().globalToLocalDirection(segDir2Min, segLocDir2);
270 double dyz = std::abs(segLocDir1.
angleYZ() - segLocDir2.
angleYZ());
271 return {segDir1Min, segDir2Min, dyz};
◆ bestPositionAlongTubeMatch()
calculate the position along a tube direction of the first segment that results in the smallest position residual in the precision plane of the second segment given the segment direction for segment 1 in global coordinates
Implements Muon::IMuonSegmentInOverlapResolvingTool.
Definition at line 305 of file MuonSegmentInOverlapResolvingTool.cxx.
308 bool goodMatch =
true;
315 double tubeStep = segmentGeometry.hvPosInSegFrame - segmentGeometry.roPosInSegFrame;
317 double posStep = tubeStep / (
nbins - 1);
319 double resfirst{1e9}, reslast{1e9}, posfirst{1e9}, poslast{1e9};
320 double locy = seg1.localParameters().contains(
Trk::locY) ? seg1.localParameters()[
Trk::locY] : 0.;
322 for (
int j = 0; j <
nbins; ++j) {
323 double distToRO = segmentGeometry.roPosInSegFrame + posStep * j;
333 seg1.associatedSurface().
localToGlobal(lpos, segDir1Min, gpos);
340 << segDir1Min.phi() <<
" theta "
341 << segDir1Min.theta());
351 if (j ==
nbins - 1) {
358 double distPosMin2{1e9}, distPosInTube2{1e9}, distPosMin{1e9}, distPosInTube{1e9}, resyMin{1e9};
360 double rangeCut = 1e5;
361 if (resfirst < rangeCut && reslast < rangeCut && posfirst < rangeCut && poslast < rangeCut) {
362 double resDif = reslast - resfirst;
363 double posDif = poslast - posfirst;
364 if (std::abs(resDif) < 1
e-6) {
366 resDif = resDif < 0. ? -1
e-6 : 1
e-6;
368 if (std::abs(posDif) < 1
e-6) {
370 posDif = posDif < 0. ? -1
e-6 : 1
e-6;
372 distPosMin = posfirst - resfirst / (resDif) * (posDif);
373 distPosInTube = segmentGeometry.positionInsideTube(distPosMin);
374 resyMin = resfirst + (resDif) * (distPosInTube - posfirst) / (posDif);
376 double locx = distPosInTube;
377 double locy = seg1.localParameters().contains(
Trk::locY) ? seg1.localParameters()[
Trk::locY] : 0.;
387 seg1.associatedSurface().
localToGlobal(lpos, segDir1Min, gpos);
394 << segDir1Min.phi() <<
" theta "
395 << segDir1Min.theta());
399 distPosMin2 = locExSeg2.x();
400 distPosInTube2 = segmentGeometry2.positionInsideTube(distPosMin2);
407 return {distPosMin, distPosInTube, segmentGeometry.shortestChannelLength, distPosMin2,
408 distPosInTube2, segmentGeometry2.shortestChannelLength, resyMin, goodMatch,
◆ checkPhiHitConsistency()
compare phi hits with segment parameters, return average pull of the phi hits
Definition at line 492 of file MuonSegmentInOverlapResolvingTool.cxx.
498 unsigned int nphiMeas = 0;
499 double averagePull = 0.;
503 double locx = posMatchResult.positionInTube1;
505 Trk::AtaPlane segPars(locx, locy, phiMatchResult.segmentDirection1.phi(), phiMatchResult.segmentDirection1.theta(),
506 0.,
segment.associatedSurface());
512 if (!
id.is_valid() || !
m_idHelperSvc->measuresPhi(
id))
continue;
515 const Trk::Surface& measSurf = meas->associatedSurface();
518 std::unique_ptr<const Trk::TrackParameters> exPars {
527 ATH_MSG_WARNING(
" Failed to propagate parameter to segment surface" << std::endl
535 ATH_MSG_DEBUG(
" calculation of residual/pull failed !!!!! ");
540 if (resPull->pull().size() != 1) {
544 const double pull = resPull->pull().front();
549 if (nphiMeas != 0) averagePull /= nphiMeas;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ estimateSegmentDirection()
Definition at line 69 of file MuonSegmentInOverlapResolvingTool.cxx.
101 Amg::Vector3D lDiro12 = gToLocal1.linear() * (gToGlobal2.linear() * segLocDiro);
103 Amg::Vector3D lDiro21 = gToLocal2.linear() * (gToGlobal1.linear() * segLocDiro);
105 stereoangle = std::acos(lDiro12.x());
112 double b = lDir1.y() * lDir12.z() - lDir1.z() * lDir12.y();
113 double a = lDir1.y() * lDiro12.z() - lDir1.z() * lDiro12.y();
114 double dxn = lDir12.x();
115 double dyn = lDir12.y();
116 double dzn = lDir12.z();
117 if (std::abs(
a) > 1
e-2) {
118 dxn = lDir12.x() -
b * lDiro12.x() /
a;
119 dyn = lDir12.y() -
b * lDiro12.y() /
a;
120 dzn = lDir12.z() -
b * lDiro12.z() /
a;
122 double norm = std::hypot(dxn, dyn, dzn);
127 if (dxn * lDir1.x() + dyn * lDir1.y() + dzn * lDir1.z() < 0)
norm = -
norm;
141 double theta = gDirn.theta();
151 double res21 = (lPos2.y() - lPos21.y()) * lDirn2.z() - (lPos2.z() - lPos21.z()) * lDirn2.y();
153 double step = (lDiro21.y() * lDirn2.z() - lDiro21.z() * lDirn2.y());
154 if (std::abs(
step) > 1
e-5) {
155 localx1 = res21 /
step;
160 Amg::Vector3D lPosn1(lPos1.x() + localx1, lPos1.y(), lPos1.z());
163 double res12 = (lPos1.y() - lPos12.y()) * lDirn1.z() - (lPos1.z() - lPos12.z()) * lDirn1.y();
164 step = (lDiro12.y() * lDirn1.z() - lDiro12.z() * lDirn1.y());
166 if (std::abs(
step) > 1
e-5) {
167 localx2 = res12 /
step;
172 Amg::Vector3D lPosn2(lPos2.x() + localx2, lPos2.y(), lPos2.z());
175 << lPos1 <<
" new " << lPosn1 << std::endl
176 <<
" segment 1 global position " << gPos1 <<
" new " << gPosn1 << std::endl
177 <<
" segment 2 local position " << lPos2 <<
" new " << lPosn2 << std::endl
178 <<
" segment 2 global position " << gPos2 <<
" new " << gPosn2);
182 if (gDir1.x() * gDirPos.x() + gDir1.y() * gDirPos.y() + gDir1.z() * gDirPos.z() < 0) {
183 gDirPos = -gPosn2 + gPosn1;
185 double dtheta =
theta - gDirPos.theta();
186 double dphi =
phi - gDirPos.phi();
187 ATH_MSG_DEBUG(
" theta " << theta <<
" gDirPos theta " << gDirPos.theta() <<
" dtheta " << dtheta <<
" phi " << phi
188 <<
" gDirPos phi " << gDirPos.phi() <<
" dphi " << dphi);
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ initialize()
StatusCode Muon::MuonSegmentInOverlapResolvingTool::initialize |
( |
| ) |
|
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ interfaceID()
static const InterfaceID& Muon::IMuonSegmentInOverlapResolvingTool::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
access to tool interface
Definition at line 150 of file IMuonSegmentInOverlapResolvingTool.h.
151 static const InterfaceID IID_IMuonSegmentInOverlapResolvingTool(
"Muon::IMuonSegmentInOverlapResolvingTool", 1, 0);
152 return IID_IMuonSegmentInOverlapResolvingTool;
◆ matchResult()
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ renounce()
◆ renounceArray()
◆ segmentGeometrySummary()
calculate geometrical information for a segment
Implements Muon::IMuonSegmentInOverlapResolvingTool.
Definition at line 414 of file MuonSegmentInOverlapResolvingTool.cxx.
417 SegmentGeometrySummary
summary;
421 double shortestTubeLen = 1e9;
427 const MdtDriftCircleOnTrack* mdt =
dynamic_cast<const MdtDriftCircleOnTrack*
>(meas);
433 double tubelen = mdt->prepRawData()->detectorElement()->getActiveTubeLength(
layer,
tube);
434 if (tubelen < shortestTubeLen) {
435 shortestTubeLen = tubelen;
436 roPos = mdt->prepRawData()->detectorElement()->ROPos(
id);
437 tubeCenter = mdt->prepRawData()->detectorElement()->surface(
id).center();
438 detEl = mdt->prepRawData()->detectorElement();
445 summary.segToGlobal = seg.associatedSurface().transform();
448 double distTubeCenterFromRO = (
summary.globalToSeg * tubeCenter).
x() -
summary.roPosInSegFrame;
449 summary.hvPosInSegFrame =
summary.roPosInSegFrame + 2 * distTubeCenterFromRO;
450 summary.shortestChannelLength = std::abs(2 * distTubeCenterFromRO);
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateSegmentDirection()
recalculate the segment direction give a new angle phi, keeps the angle in the precision plane fixed
Implements Muon::IMuonSegmentInOverlapResolvingTool.
Definition at line 42 of file MuonSegmentInOverlapResolvingTool.cxx.
49 Amg::Vector3D lsegDir = gToStation.linear() * seg.globalDirection();
50 double road_dz = lphiDir.z();
51 double seg_dy = lsegDir.y();
52 double seg_dz = lsegDir.z();
53 if (road_dz * seg_dz < 0) {
57 if (std::abs(seg_dz) < 1
e-6) {
59 ATH_MSG_DEBUG(
" Unexpected local direction of segment " << lsegDir);
61 double scale = road_dz / seg_dz;
◆ updateVHKA()
◆ m_detStore
◆ m_edmHelperSvc
Initial value:{
this,
"edmHelper",
"Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
"Handle to the service providing the IMuonEDMHelperSvc interface",
}
EDM Helper tool.
Definition at line 88 of file MuonSegmentInOverlapResolvingTool.h.
◆ m_evtStore
◆ m_idHelperSvc
◆ m_magFieldProperties
◆ m_printer
◆ m_propagator
ToolHandle<Trk::IPropagator> Muon::MuonSegmentInOverlapResolvingTool::m_propagator |
|
private |
◆ m_pullCalculator
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override final
Specified for PlaneSurface: GlobalToLocal method without dynamic memory allocation - boolean checks i...
Eigen::Matrix< double, 2, 1 > Vector2D
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
@ Unbiased
RP with track state that has measurement not included.
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
virtual void setOwner(IDataHandleHolder *o)=0
double angleYZ() const
access method for angle of local YZ projection
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Affine3d Transform3D
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
represents the three-dimensional global direction with respect to a planar surface frame.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
@ NoField
Field is set to 0., 0., 0.,.
Eigen::Matrix< double, 3, 1 > Vector3D
virtual Intersection straightLineIntersection(const Amg::Vector3D &pos, const Amg::Vector3D &dir, bool forceDir, Trk::BoundaryCheck bchk) const override final
fast straight line intersection schema - standard: provides closest intersection and (signed) path le...
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
#define ATH_MSG_WARNING(x)
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override final
Specified for PlaneSurface: LocalToGlobal method without dynamic memory allocation.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
void setThetaPhi(Amg::Vector3D &v, double theta, double phi)
sets the theta and phi angle of a vector without changing the magnitude
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)