ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Muon::MuonSegmentPairMatchingTool Class Reference

tool to match segments More...

#include <MuonSegmentPairMatchingTool.h>

Inheritance diagram for Muon::MuonSegmentPairMatchingTool:
Collaboration diagram for Muon::MuonSegmentPairMatchingTool:

Public Member Functions

 MuonSegmentPairMatchingTool (const std::string &, const std::string &, const IInterface *)
 constructor More...
 
virtual ~MuonSegmentPairMatchingTool ()
 destructor More...
 
StatusCode initialize ()
 AlgTool initilize. More...
 
SegmentMatchResult matchResult (const MuonSegment &seg1, const MuonSegment &seg2) const
 performance match and return result More...
 
std::pair< Amg::Vector3D, Amg::Vector3DgetShortestTubePos (const Muon::MuonSegment &seg) const
 
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
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 access to tool interface More...
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

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...
 

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc
 
ServiceHandle< IMuonEDMHelperSvcm_edmHelperSvc
 EDM Helper tool. More...
 
PublicToolHandle< MuonEDMPrinterToolm_printer
 EDM printer tool. More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

tool to match segments

Definition at line 23 of file MuonSegmentPairMatchingTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ MuonSegmentPairMatchingTool()

Muon::MuonSegmentPairMatchingTool::MuonSegmentPairMatchingTool ( const std::string &  ty,
const std::string &  na,
const IInterface *  pa 
)

constructor

Definition at line 38 of file MuonSegmentPairMatchingTool.cxx.

40  : AthAlgTool(ty, na, pa)
41 {
42  declareInterface<IMuonSegmentPairMatchingTool>(this);
43 }

◆ ~MuonSegmentPairMatchingTool()

virtual Muon::MuonSegmentPairMatchingTool::~MuonSegmentPairMatchingTool ( )
inlinevirtual

destructor

Definition at line 29 of file MuonSegmentPairMatchingTool.h.

29 {};

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation 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.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation 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.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation 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.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation 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.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

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

◆ getShortestTubePos()

std::pair< Amg::Vector3D, Amg::Vector3D > Muon::MuonSegmentPairMatchingTool::getShortestTubePos ( const Muon::MuonSegment seg) const

Definition at line 299 of file MuonSegmentPairMatchingTool.cxx.

300 {
301  const Muon::MdtDriftCircleOnTrack* shortestMdt = nullptr;
302  double storedLength = 999999;
303 
304  // loop over hits, cast each hit to drift circle
305 
306  const std::vector<const Trk::MeasurementBase*>& rioVec = seg.containedMeasurements();
307  std::vector<const Trk::MeasurementBase*>::const_iterator it = rioVec.begin();
308  std::vector<const Trk::MeasurementBase*>::const_iterator it_end = rioVec.end();
309 
310  for (; it != it_end; ++it) {
311  const Muon::MdtDriftCircleOnTrack* mdt = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(*it);
312  if (!mdt) continue;
313  const MuonGM::MdtReadoutElement* roe = mdt->detectorElement();
314  if (!roe) continue;
315 
316  // sanity check with getActiveTubeLength
317  int layer = m_idHelperSvc->mdtIdHelper().tubeLayer(mdt->identify());
318  int tube = m_idHelperSvc->mdtIdHelper().tube(mdt->identify());
319  double halfLength = 0.5 * roe->getActiveTubeLength(layer, tube);
320 
321  if (2 * halfLength > storedLength) continue;
322 
323  storedLength = halfLength;
324  shortestMdt = mdt;
325  }
326  std::pair<Amg::Vector3D, Amg::Vector3D> shortpos;
327  Amg::Vector2D lp(0, storedLength);
328  if (shortestMdt) shortestMdt->associatedSurface().localToGlobal(lp, Amg::Vector3D::UnitZ(), shortpos.first);
329  lp[1] = -storedLength;
330  if (shortestMdt) shortestMdt->associatedSurface().localToGlobal(lp, Amg::Vector3D::UnitZ(), shortpos.second);
331  return shortpos;
332 }

◆ initialize()

StatusCode Muon::MuonSegmentPairMatchingTool::initialize ( )

AlgTool initilize.

Definition at line 46 of file MuonSegmentPairMatchingTool.cxx.

47 {
49 
50  ATH_CHECK(m_edmHelperSvc.retrieve());
51  ATH_CHECK(m_printer.retrieve());
52  ATH_CHECK(m_idHelperSvc.retrieve());
53 
54  return StatusCode::SUCCESS;
55 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

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::IMuonSegmentPairMatchingTool::interfaceID ( )
inlinestaticinherited

access to tool interface

Definition at line 46 of file IMuonSegmentPairMatchingTool.h.

46  {
47  static const InterfaceID IID_IMuonSegmentPairMatchingTool("Muon::IMuonSegmentPairMatchingTool", 1, 0);
48  return IID_IMuonSegmentPairMatchingTool;
49  }

◆ matchResult()

IMuonSegmentPairMatchingTool::SegmentMatchResult Muon::MuonSegmentPairMatchingTool::matchResult ( const MuonSegment seg1,
const MuonSegment seg2 
) const
virtual

performance match and return result

Implements Muon::IMuonSegmentPairMatchingTool.

Definition at line 58 of file MuonSegmentPairMatchingTool.cxx.

59 {
60  IMuonSegmentPairMatchingTool::SegmentMatchResult result;
61 
62  // get identifiers
63  // and the detector region from identifier
64  Identifier chid1 = m_edmHelperSvc->chamberId(seg1);
65  MuonStationIndex::StIndex station1 = m_idHelperSvc->stationIndex(chid1);
66 
67  Identifier chid2 = m_edmHelperSvc->chamberId(seg2);
68  MuonStationIndex::StIndex station2 = m_idHelperSvc->stationIndex(chid2);
69 
70  // Don't deal with overlap/merge of segments here
71  if (chid1 == chid2) return result;
72  if (station1 == station2) return result;
73 
74  // Don't know how to deal with these cases yet...
75  if (station1 == MuonStationIndex::StUnknown) return result;
76  if (station2 == MuonStationIndex::StUnknown) return result;
77  if (station1 >= MuonStationIndex::StIndexMax) return result;
78  if (station2 >= MuonStationIndex::StIndexMax) return result;
79 
80  // Here order matters, so sort segment by order a= inner, b= outer
81  // MuonStationIndex::StIndex station_a = station1;
82  // MuonStationIndex::StIndex station_b = station2;
83 
84  const MuonSegment* pSeg_a = nullptr;
85  const MuonSegment* pSeg_b = nullptr;
86 
87  // bool swapped = false;
88  if (station1 < station2) {
89  pSeg_a = &seg1;
90  pSeg_b = &seg2;
91 
92  } else {
93  // swapped = true;
94  pSeg_a = &seg2;
95  pSeg_b = &seg1;
96  // station_a = station2;
97  // station_b = station1;
98  }
99 
100  const MuonSegment& seg_a(*pSeg_a);
101  const MuonSegment& seg_b(*pSeg_b);
102 
103  Identifier chid_a = m_edmHelperSvc->chamberId(seg_a);
104  Identifier chid_b = m_edmHelperSvc->chamberId(seg_b);
105 
106  int phiSector_a = m_idHelperSvc->sector(chid_a);
107  int phiSector_b = m_idHelperSvc->sector(chid_b);
108 
109  result.chid_a = chid_a;
110  result.chid_b = chid_b;
111 
112  result.phiSector_a = phiSector_a;
113  result.phiSector_b = phiSector_b;
114 
115  const Amg::Vector3D& dir_a = seg_a.globalDirection();
116  const Amg::Vector3D& dir_b = seg_b.globalDirection();
117  const Amg::Vector3D& pos_a = seg_a.globalPosition();
118  const Amg::Vector3D& pos_b = seg_b.globalPosition();
119 
120  // Define direction between segment position
121  Amg::Vector3D vecAB = pos_b - pos_a;
122 
123  // compute angle between vector position a and b using dot product
124  double sizeA = dir_a.mag();
125  double sizeB = dir_b.mag();
126  double cosAB = dir_a.dot(dir_b) / (sizeA * sizeB);
127  double angleAB = robust_acos(cosAB);
128 
129  // compute angle between vector position a and b using dot product
130  double sizeC = vecAB.mag();
131  double cosAC = dir_a.dot(vecAB) / (sizeA * sizeC);
132  double angleAC = robust_acos(cosAC);
133 
134  // compute angle between vector position a and b using dot product
135  double cosBC = dir_b.dot(vecAB) / (sizeB * sizeC);
136  double angleBC = robust_acos(cosBC);
137 
138 
139  if (angleAB > M_PI / 2.) angleAB = fabs(angleAB - M_PI);
140  if (angleAC > M_PI / 2.) angleAC = fabs(angleAC - M_PI);
141  if (angleBC > M_PI / 2.) angleBC = fabs(angleBC - M_PI);
142 
143  result.angleAB = angleAB;
144  result.angleAC = angleAC;
145  result.angleBC = angleBC;
146 
147  // Compute local angles
148  // for some reason, vec12 gets the direction right far more often than vecAB
149  double dirTheta_a = seg_a.localDirection().angleYZ();
150  double dirTheta_b = seg_b.localDirection().angleYZ();
151  Trk::LocalDirection dirPred_a;
152  seg_a.associatedSurface().globalToLocalDirection(vecAB, dirPred_a);
153  Trk::LocalDirection dirPred_b;
154  seg_b.associatedSurface().globalToLocalDirection(vecAB, dirPred_b);
155  double deltaTheta_a = limit_angle_2pi(dirTheta_a - dirPred_a.angleYZ());
156  double deltaTheta_b = limit_angle_2pi(dirTheta_b - dirPred_b.angleYZ());
157 
158  // bool opposite = false;
159  // in case both segment directions are opposite to vecAB, try opposite direction
160  if (std::abs(deltaTheta_a) > 0.5 * M_PI && std::abs(deltaTheta_b) > 0.5 * M_PI) {
161  // opposite = true;
162  seg_a.associatedSurface().globalToLocalDirection(-vecAB, dirPred_a);
163  seg_b.associatedSurface().globalToLocalDirection(-vecAB, dirPred_b);
164  deltaTheta_a = limit_angle_2pi(dirTheta_a - dirPred_a.angleYZ());
165  deltaTheta_b = limit_angle_2pi(dirTheta_b - dirPred_b.angleYZ());
166  }
167 
168 
169  // look at the relative orientation of the local X axes to determine if YZ angles are flipped
170  bool flipped = false;
171  const Amg::Transform3D& trf_a = seg_a.associatedSurface().transform();
172  const Amg::Transform3D& trf_b = seg_b.associatedSurface().transform();
173  double xAxisDotProduct = trf_a(0, 0) * trf_b(0, 0) + trf_a(1, 0) * trf_b(1, 0) + trf_a(2, 0) * trf_b(2, 0);
174  if (xAxisDotProduct < 0.0) flipped = true;
175 
176  double deltaTheta = 0.0;
177  if (flipped) {
178  deltaTheta = std::abs(limit_angle_2pi(deltaTheta_a - deltaTheta_b));
179  } else {
180  deltaTheta = std::abs(limit_angle_2pi(deltaTheta_a + deltaTheta_b));
181  }
182 
183  result.deltaTheta_a = deltaTheta_a;
184  result.deltaTheta_b = deltaTheta_b;
185  result.deltaTheta = deltaTheta;
186 
187  // compute angular differences in second coordinate
188  result.deltaPhipos = fabs(seg_a.globalPosition().phi() - seg_b.globalPosition().phi());
189  result.deltaPhidir = fabs(seg_a.globalDirection().phi() - seg_b.globalDirection().phi());
190 
191  // check presence of phi hits on segment a
192  bool ContainPhiHits = false;
193  std::vector<const Trk::MeasurementBase*>::const_iterator hit = seg_a.containedMeasurements().begin();
194  std::vector<const Trk::MeasurementBase*>::const_iterator hit_end = seg_a.containedMeasurements().end();
195  for (; hit != hit_end; ++hit) {
196  Identifier id;
197  const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(*hit);
198  if (rot)
199  id = rot->identify();
200  else {
201  const CompetingMuonClustersOnTrack* crot = dynamic_cast<const CompetingMuonClustersOnTrack*>(*hit);
202  if (crot) id = crot->containedROTs().front()->identify();
203  }
204  if (!id.is_valid()) continue;
205  if (m_idHelperSvc->measuresPhi(id)) {
206  ContainPhiHits = true;
207  break;
208  }
209  }
210 
211  if (ContainPhiHits) {
212  result.phiposerr_a = seg_a.localCovariance()(Trk::locX, Trk::locX);
213  result.phidirerr_a = seg_a.localCovariance()(Trk::phi, Trk::phi);
214  } else {
215  result.phiposerr_a = 99999.;
216  result.phidirerr_a = 99999.;
217  }
218 
219  // check presence of phi hits on segment b
220  ContainPhiHits = false;
221  hit = seg_b.containedMeasurements().begin();
222  hit_end = seg_b.containedMeasurements().end();
223  for (; hit != hit_end; ++hit) {
224  Identifier id;
225  const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(*hit);
226  if (rot)
227  id = rot->identify();
228  else {
229  const CompetingMuonClustersOnTrack* crot = dynamic_cast<const CompetingMuonClustersOnTrack*>(*hit);
230  if (crot) id = crot->containedROTs().front()->identify();
231  }
232  if (!id.is_valid()) continue;
233  if (m_idHelperSvc->measuresPhi(id)) {
234  ContainPhiHits = true;
235  break;
236  }
237  }
238 
239  if (ContainPhiHits) {
240  result.phiposerr_b = seg_b.localCovariance()(Trk::locX, Trk::locX);
241  result.phidirerr_b = seg_b.localCovariance()(Trk::phi, Trk::phi);
242  } else {
243  result.phiposerr_b = 99999.;
244  result.phidirerr_b = 99999.;
245  }
246 
247  result.shorttube_a = 99999.;
248  if (m_idHelperSvc->isMdt(chid_a)) {
249  // make shortest tube calculations
250  std::pair<Amg::Vector3D, Amg::Vector3D> stseg1 = getShortestTubePos(seg_a);
251  double shorttube_lx_a = stseg1.first.x();
252  double shorttube_ly_a = stseg1.first.y();
253  double shorttube_rx_a = stseg1.second.x();
254  double shorttube_ry_a = stseg1.second.y();
255 
256  double dist_x_la = seg_a.globalPosition().x() - shorttube_lx_a;
257  double dist_x_ra = seg_a.globalPosition().x() - shorttube_rx_a;
258 
259  double dist_y_la = seg_a.globalPosition().y() - shorttube_ly_a;
260  double dist_y_ra = seg_a.globalPosition().y() - shorttube_ry_a;
261 
262  double dist_la = sqrt(dist_x_la * dist_x_la + dist_y_la * dist_y_la);
263  double dist_ra = sqrt(dist_x_ra * dist_x_ra + dist_y_ra * dist_y_ra);
264 
265  if (dist_la >= dist_ra)
266  result.shorttube_a = dist_ra;
267  else
268  result.shorttube_a = dist_la;
269  }
270 
271  result.shorttube_b = 99999.;
272  if (m_idHelperSvc->isMdt(chid_b)) {
273  std::pair<Amg::Vector3D, Amg::Vector3D> stseg2 = getShortestTubePos(seg_b);
274  double shorttube_lx_b = stseg2.first.x();
275  double shorttube_ly_b = stseg2.first.y();
276  double shorttube_rx_b = stseg2.second.x();
277  double shorttube_ry_b = stseg2.second.y();
278 
279  double dist_x_lb = seg_b.globalPosition().x() - shorttube_lx_b;
280  double dist_x_rb = seg_b.globalPosition().x() - shorttube_rx_b;
281 
282  double dist_y_lb = seg_b.globalPosition().y() - shorttube_ly_b;
283  double dist_y_rb = seg_b.globalPosition().y() - shorttube_ry_b;
284 
285  double dist_lb = sqrt(dist_x_lb * dist_x_lb + dist_y_lb * dist_y_lb);
286  double dist_rb = sqrt(dist_x_rb * dist_x_rb + dist_y_rb * dist_y_rb);
287 
288  if (dist_lb >= dist_rb)
289  result.shorttube_b = dist_rb;
290  else
291  result.shorttube_b = dist_lb;
292  }
293  result.matchFlag = true;
294 
295  return result;
296 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

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()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_edmHelperSvc

ServiceHandle<IMuonEDMHelperSvc> Muon::MuonSegmentPairMatchingTool::m_edmHelperSvc
private
Initial value:
{
this,
"edmHelper",
"Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
"Handle to the service providing the IMuonEDMHelperSvc interface",
}

EDM Helper tool.

Definition at line 44 of file MuonSegmentPairMatchingTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::MuonSegmentPairMatchingTool::m_idHelperSvc
private
Initial value:
{
this,
"MuonIdHelperSvc",
"Muon::MuonIdHelperSvc/MuonIdHelperSvc",
}

Definition at line 39 of file MuonSegmentPairMatchingTool.h.

◆ m_printer

PublicToolHandle<MuonEDMPrinterTool> Muon::MuonSegmentPairMatchingTool::m_printer
private
Initial value:
{
this,
"Printer",
"Muon::MuonEDMPrinterTool/MuonEDMPrinterTool",
}

EDM printer tool.

Definition at line 51 of file MuonSegmentPairMatchingTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
Muon::MuonSegmentPairMatchingTool::m_printer
PublicToolHandle< MuonEDMPrinterTool > m_printer
EDM printer tool.
Definition: MuonSegmentPairMatchingTool.h:51
Muon::MuonStationIndex::StUnknown
@ StUnknown
Definition: MuonStationIndex.h:24
get_generator_info.result
result
Definition: get_generator_info.py:21
Muon::MuonSegmentPairMatchingTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonSegmentPairMatchingTool.h:39
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
Trk::locX
@ locX
Definition: ParamDefs.h:43
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Muon::MuonSegmentPairMatchingTool::getShortestTubePos
std::pair< Amg::Vector3D, Amg::Vector3D > getShortestTubePos(const Muon::MuonSegment &seg) const
Definition: MuonSegmentPairMatchingTool.cxx:299
initialize
void initialize()
Definition: run_EoverP.cxx:894
skel.it
it
Definition: skel.GENtoEVGEN.py:423
M_PI
#define M_PI
Definition: ActiveFraction.h:11
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Muon::MdtDriftCircleOnTrack::detectorElement
virtual const MuonGM::MdtReadoutElement * detectorElement() const override final
Returns the detector element, assoicated with the PRD of this class.
Definition: MdtDriftCircleOnTrack.h:268
xAOD::MuonSegment
MuonSegment_v1 MuonSegment
Reference the current persistent version:
Definition: Event/xAOD/xAODMuon/xAODMuon/MuonSegment.h:13
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Trk::LocalDirection::angleYZ
double angleYZ() const
access method for angle of local YZ projection
Definition: LocalDirection.h:106
AthCommonDataStore
Definition: AthCommonDataStore.h:52
Muon::MuonSegmentPairMatchingTool::m_edmHelperSvc
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
EDM Helper tool.
Definition: MuonSegmentPairMatchingTool.h:44
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
MuonGM::MdtReadoutElement
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:50
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
MuonGM::MdtReadoutElement::getActiveTubeLength
double getActiveTubeLength(const int tubeLayer, const int tube) const
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Trk::Segment::containedMeasurements
const std::vector< const Trk::MeasurementBase * > & containedMeasurements() const
returns the vector of Trk::MeasurementBase objects
Definition: TrkEvent/TrkSegment/TrkSegment/Segment.h:166
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Trk::LocalDirection
represents the three-dimensional global direction with respect to a planar surface frame.
Definition: LocalDirection.h:81
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Muon::MuonStationIndex::StIndexMax
@ StIndexMax
Definition: MuonStationIndex.h:27
Muon::MdtDriftCircleOnTrack
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
Definition: MdtDriftCircleOnTrack.h:37
Trk::StraightLineSurface::localToGlobal
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const override final
Specified for StraightLineSurface: LocalToGlobal method without dynamic memory allocation.
Definition: StraightLineSurface.cxx:139
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
a
TList * a
Definition: liststreamerinfos.cxx:10
h
Muon::MdtDriftCircleOnTrack::associatedSurface
virtual const Trk::StraightLineSurface & associatedSurface() const override final
Returns the surface on which this measurement was taken.
Definition: MdtDriftCircleOnTrack.h:271
Trk::RIO_OnTrack::identify
virtual Identifier identify() const final
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:155
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
Muon::MuonStationIndex::StIndex
StIndex
enum to classify the different station layers in the muon spectrometer
Definition: MuonStationIndex.h:23
Trk::phi
@ phi
Definition: ParamDefs.h:81
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
calibdata.tube
tube
Definition: calibdata.py:31
fitman.k
k
Definition: fitman.py:528