ATLAS Offline Software
TrkDistanceFinderNeutralNeutral.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 namespace {
8 
9 }
10 
11 namespace Trk {
12 
13 TrkDistanceFinderNeutralNeutral::TrkDistanceFinderNeutralNeutral(const std::string& t, const std::string& n, const IInterface* p) :
14  AthAlgTool(t,n,p)
15 {
16  declareInterface<TrkDistanceFinderNeutralNeutral>(this);
17 
18 }
19 
21 
22 std::pair<Amg::Vector3D,double>
24  const Trk::NeutralTrack& neutraltrk,
25  double & distanceOnAxis) const {
26 
27  const Trk::NeutralTrack& neutraltrk1=neutralaxis;
28  const Trk::NeutralTrack& neutraltrk2=neutraltrk;
29 
30  Amg::Vector3D DeltaR0(neutraltrk1.position()-neutraltrk2.position());
31  const Amg::Vector3D& Mom1(neutraltrk1.momentum());
32  const Amg::Vector3D& Mom2(neutraltrk2.momentum());
33 
34  double p1p2=Mom1.dot(Mom2);
35  double p1DR0=Mom1.dot(DeltaR0);
36  double p2DR0=Mom2.dot(DeltaR0);
37  double p1p1=Mom1.mag2();
38  double p2p2=Mom2.mag2();
39 
40  double lambda1=(p1DR0*p2p2-p1p2*p2DR0)/(p1p2*p1p2-p1p1*p2p2);
41  double lambda2=(p1DR0*p1p2-p1p1*p2DR0)/(p1p2*p1p2-p1p1*p2p2);
42 
43  Amg::Vector3D pos1=neutraltrk1.position()+lambda1*Mom1;
44  Amg::Vector3D pos2=neutraltrk2.position()+lambda2*Mom2;
45 
46  ATH_MSG_VERBOSE ("x1fin " << pos1.x() << "y1fin " << pos1.y() << "z1fin " << pos1.z());
47  ATH_MSG_VERBOSE ("x2fin " << pos2.x() << "y2fin " << pos2.y() << "z2fin " << pos2.z());
48 
49  double distance = (pos1-pos2).mag();
50 
51  distanceOnAxis = lambda1/sqrt(p1p1);
52 
53  ATH_MSG_VERBOSE ("orig distance " << DeltaR0.mag() << " final distance " << distance);
54  ATH_MSG_VERBOSE ("fitted dist from 1 " << lambda1*sqrt(p1p1));
55  ATH_MSG_VERBOSE ("fitted dist from 2 " << lambda2*sqrt(p2p2));
56 
57  return std::pair<Amg::Vector3D,double>(pos1,distance);//give back position on neutral track... (jet axis)
58 
59 }
60 
61 }
Trk::TrkDistanceFinderNeutralNeutral::TrkDistanceFinderNeutralNeutral
TrkDistanceFinderNeutralNeutral(const std::string &t, const std::string &n, const IInterface *p)
Definition: TrkDistanceFinderNeutralNeutral.cxx:13
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Trk::TrkDistanceFinderNeutralNeutral::getPointAndDistance
std::pair< Amg::Vector3D, double > getPointAndDistance(const Trk::NeutralTrack &, const Trk::NeutralTrack &, double &) const
Definition: TrkDistanceFinderNeutralNeutral.cxx:23
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
beamspotman.n
n
Definition: beamspotman.py:731
Trk::NeutralTrack::momentum
const Amg::Vector3D & momentum() const
Definition: NeutralTrack.h:21
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::NeutralTrack
Definition: NeutralTrack.h:10
TrkDistanceFinderNeutralNeutral.h
AthAlgTool
Definition: AthAlgTool.h:26
Trk::TrkDistanceFinderNeutralNeutral::~TrkDistanceFinderNeutralNeutral
~TrkDistanceFinderNeutralNeutral()
Trk::NeutralTrack::position
const Amg::Vector3D & position() const
Definition: NeutralTrack.h:17
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26