ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Trk::CompareTwoTracks Class Reference

#include <BeamspotVertexPreProcessor.h>

Collaboration diagram for Trk::CompareTwoTracks:

Public Member Functions

 CompareTwoTracks (const Track *track, const std::string &compareMethod)
 
bool operator() (VxTrackAtVertex vtxTrk)
 

Private Attributes

std::string m_method
 
const Trackm_track
 

Detailed Description

Definition at line 153 of file BeamspotVertexPreProcessor.h.

Constructor & Destructor Documentation

◆ CompareTwoTracks()

Trk::CompareTwoTracks::CompareTwoTracks ( const Track track,
const std::string &  compareMethod 
)
inline

Definition at line 156 of file BeamspotVertexPreProcessor.h.

157  :m_method(compareMethod)
158  ,m_track(track)
159  { //std::cout <<"compareMethod: "<< m_method <<std::endl;
160  }

Member Function Documentation

◆ operator()()

bool Trk::CompareTwoTracks::operator() ( VxTrackAtVertex  vtxTrk)

Definition at line 218 of file BeamspotVertexPreProcessor.cxx.

218  { // MD: took away deref*
219 
220  ITrackLink* trkLink = vtxTrk.trackOrParticleLink();
221  LinkToTrackParticleBase* linkToTrackParticle = dynamic_cast<Trk::LinkToTrackParticleBase*>(trkLink);
222  if(!linkToTrackParticle) return false;
223  const TrackParticleBase* tpb = *(linkToTrackParticle->cptr());
224 
225  const Track* originalTrk = tpb->originalTrack();
226 
227  bool equal = false;
228  // compare the addresses of these two tracks directly
229  if(m_method.find("compareAddress") != std::string::npos){
230  if (m_track == originalTrk) equal = true;
231  //std::cout << " comparing two Tracks' addresses directly, the address of the comparing track : "<< m_track <<" the address of the compared track : "<< originalTrk << " compare result : " << equal << std::endl;
232  }
233 
234  // compare the perigee parameters of these two tracks, should safer
235  if(m_method.find("comparePerigee") != std::string::npos){
236  const Trk::Perigee * measPer1 = m_track->perigeeParameters();
237  const Trk::Perigee * measPer2 = originalTrk->perigeeParameters();
238  if(! (measPer1 && measPer2 )) equal = false;
239  else{
240  float diff = std::abs(std::numeric_limits<float>::epsilon());
241  if( ( std::abs(measPer1->parameters()[Trk::d0] - measPer2->parameters()[Trk::d0]) > diff)
242  || ( std::abs(measPer1->parameters()[Trk::z0] - measPer2->parameters()[Trk::z0]) > diff)
243  || ( std::abs(measPer1->parameters()[Trk::phi] - measPer2->parameters()[Trk::phi]) > diff)
244  || ( std::abs(measPer1->parameters()[Trk::theta] - measPer2->parameters()[Trk::theta]) > diff)
245  || ( std::abs(measPer1->parameters()[Trk::qOverP] - measPer2->parameters()[Trk::qOverP]) > diff))
246  equal = false;
247  }
248  //std::cout << " comparing two Tracks' perigee parameter, the perigee of the comparing track is: "<< *measPer1 <<" the perigee of the compared track is: "<< *measPer2 << " compare result is: " << equal << std::endl;
249  }
250  return equal;
251 }

Member Data Documentation

◆ m_method

std::string Trk::CompareTwoTracks::m_method
private

Definition at line 165 of file BeamspotVertexPreProcessor.h.

◆ m_track

const Track* Trk::CompareTwoTracks::m_track
private

Definition at line 166 of file BeamspotVertexPreProcessor.h.


The documentation for this class was generated from the following files:
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
Trk::z0
@ z0
Definition: ParamDefs.h:64
CxxUtils::fpcompare::equal
bool equal(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition: fpcompare.h:114
Trk::CompareTwoTracks::m_method
std::string m_method
Definition: BeamspotVertexPreProcessor.h:165
Trk::theta
@ theta
Definition: ParamDefs.h:66
Trk::LinkToTrackParticleBase
Definition: LinkToTrackParticleBase.h:17
Trk::Track::perigeeParameters
const Perigee * perigeeParameters() const
return Perigee.
Definition: Tracking/TrkEvent/TrkTrack/src/Track.cxx:163
Trk::d0
@ d0
Definition: ParamDefs.h:63
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:67
Track
Definition: TriggerChamberClusterOnTrackCreator.h:21
Trk::phi
@ phi
Definition: ParamDefs.h:75
Trk::CompareTwoTracks::m_track
const Track * m_track
Definition: BeamspotVertexPreProcessor.h:166
xAOD::track
@ track
Definition: TrackingPrimitives.h:512