ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::InDetJetFitterUtils Class Reference

#include <InDetJetFitterUtils.h>

Inheritance diagram for InDet::InDetJetFitterUtils:
Collaboration diagram for InDet::InDetJetFitterUtils:

Public Member Functions

virtual StatusCode initialize () override
 InDetJetFitterUtils (const std::string &t, const std::string &n, const IInterface *p)
 ~InDetJetFitterUtils ()
std::pair< double, double > compatibility (const Trk::TrackParameters &measPerigee, const Trk::RecVertex &vertex) const
std::pair< double, double > compatibility (const Trk::ParametersBase< 5, Trk::Neutral > &measPerigee, const Trk::RecVertex &vertex) const
int getTwoTrackVtxCharge (const Trk::VxCandidate &myVxCandidate) const
int getTwoTrackVtxCharge (const xAOD::Vertex &myVxCandidate) const
double getTwoTrackVtxMass (const Trk::VxCandidate &myVxCandidate, double highestMomMass, double lowestMomMass) const
double getTwoTrackVtxMass (const xAOD::Vertex &myVxCandidate, double highestMomMass, double lowestMomMass) const
std::pair< double, double > getDistanceAndErrorBetweenTwoVertices (const xAOD::Vertex &, const Trk::RecVertex &) const
std::pair< double, double > getD0andZ0IP (const Trk::TrackParameters &trackPerigee, const Trk::Vertex &vertexToExtrapolateTo) const
std::pair< double, double > getD0andZ0IPSig (const Trk::TrackParameters &trackPerigee, const Trk::RecVertex &vertex) const
const Trk::LinkToTrackParticleBasefindNeutralTrackParticleBase (const std::vector< const Trk::LinkToTrackParticleBase * > &, const Trk::VxCandidate &) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()
static double get3DLifetimeSignOfTrack (const Trk::TrackParameters &track, const Amg::Vector3D &jetMomentum, const Trk::RecVertex &primaryVertex)
static const Trk::LinkToTrackParticleBasefindNeutralTrackParticleBase (const std::vector< const Trk::LinkToTrackParticleBase * > &, const xAOD::Vertex &)
static bool checkIfTrackIsInVector (const Trk::ITrackLink *trackToCheck, const std::vector< const Trk::ITrackLink * > &vectorOfTracks)
static bool checkIfTrackIsInVector (const Trk::ITrackLink *trackToCheck, const std::vector< const Trk::LinkToTrackParticleBase * > &vectorOfTracks)
static bool checkIfTrackIsInNeutralTrackVector (const Trk::ITrackLink *trackToCheck, const std::vector< const Trk::LinkToTrackParticleBase * > &vectorOfNeutrals)
static bool checkIfTrackIsInV0CandidatesVector (const Trk::ITrackLink *trackToCheck, const std::vector< const xAOD::Vertex * > &vectorOfVxCandidates)
static bool checkIfVxCandidateIsInVector (const xAOD::Vertex *vertexToCheck, const std::vector< const xAOD::Vertex * > &vectorOfCandidates)
static CLHEP::HepLorentzVector fourMomentumAtVertex (const Trk::VxVertexOnJetAxis &)

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

std::pair< AmgMatrix(3, 3), AmgSymMatrix(3)> getPosMomentumAndMomentumCovMatrix (const Trk::LinearizedTrack *linTrack, const AmgSymMatrix(3) &vrt_cov, const AmgSymMatrix(3) &vrt_weight) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< Trk::IVertexLinearizedTrackFactorym_LinearizedTrackFactory {this,"LinearizedTrackFactory","Trk::FullLinearizedTrackFactory/FullLinearizedTrackFactory",""}
ToolHandle< Trk::IExtrapolatorm_extrapolator {this,"Extrapolator","Trk::Extrapolator/InDetExtrapolator",""}
bool m_linearizedTrackFactoryIsAvailable
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 55 of file InDetJetFitterUtils.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

◆ InDetJetFitterUtils()

InDet::InDetJetFitterUtils::InDetJetFitterUtils ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 69 of file InDetJetFitterUtils.cxx.

69 :
70 AthAlgTool(t,n,p),
72 {
73
74 declareInterface< InDetJetFitterUtils >(this) ;
75
76 }
AthAlgTool()
Default constructor:

◆ ~InDetJetFitterUtils()

InDet::InDetJetFitterUtils::~InDetJetFitterUtils ( )
default

Member Function Documentation

◆ checkIfTrackIsInNeutralTrackVector()

bool InDet::InDetJetFitterUtils::checkIfTrackIsInNeutralTrackVector ( const Trk::ITrackLink * trackToCheck,
const std::vector< const Trk::LinkToTrackParticleBase * > & vectorOfNeutrals )
static

Definition at line 596 of file InDetJetFitterUtils.cxx.

598 {
599 //W
600 /*
601 std::vector<const Trk::LinkToTrackParticleBase*>::const_iterator vectorOfNeutralsBegin=vectorOfNeutrals.begin();
602 std::vector<const Trk::LinkToTrackParticleBase*>::const_iterator vectorOfNeutralsEnd=vectorOfNeutrals.end();
603
604 for (std::vector<const Trk::LinkToTrackParticleBase*>::const_iterator vectorOfNeutralsIter=vectorOfNeutralsBegin;
605 vectorOfNeutralsIter!=vectorOfNeutralsEnd;
606 ++vectorOfNeutralsIter)
607 {
608 const Trk::LinkToTrackParticleBase* myTPBlink=*vectorOfNeutralsIter;
609
610 if (myTPBlink==0)
611 {
612 msg(MSG::WARNING) << " null pointer (TPBlink). Skipping neutral candidate... " << endmsg;
613 continue;
614 }
615
616 const Trk::TrackParticleBase* myTPB=**myTPBlink;
617
618 if (myTPB==0)
619 {
620 msg(MSG::WARNING) << " null pointer (TPB). Skipping neutral candidate... " << endmsg;
621 continue;
622 }
623
624 const Trk::VxCandidate* myV0Candidate=myTPB->reconstructedVertex();
625
626 if (myV0Candidate==0)
627 {
628 msg(MSG::WARNING) << " neutral TP Base has no original Vx Candidate " << endmsg;
629 continue;
630 }
631
632 const Trk::VxTrackAtVertex* firstTrack((*(myV0Candidate->vxTrackAtVertex()))[0]);
633 const Trk::VxTrackAtVertex* secondTrack((*(myV0Candidate->vxTrackAtVertex()))[1]);
634
635 const Trk::ITrackLink* trackLink1=firstTrack->trackOrParticleLink();
636 const Trk::ITrackLink* trackLink2=secondTrack->trackOrParticleLink();
637
638 if (trackLink1==trackToCheck || trackLink2==trackToCheck )
639 {
640 return true;
641 }
642 }
643 */
644 return false;
645 }

◆ checkIfTrackIsInV0CandidatesVector()

bool InDet::InDetJetFitterUtils::checkIfTrackIsInV0CandidatesVector ( const Trk::ITrackLink * trackToCheck,
const std::vector< const xAOD::Vertex * > & vectorOfVxCandidates )
static

Definition at line 667 of file InDetJetFitterUtils.cxx.

669 {
670
671 std::vector<const xAOD::Vertex*>::const_iterator verticesToVetoBegin=vectorOfVxCandidates.begin();
672 std::vector<const xAOD::Vertex*>::const_iterator verticesToVetoEnd=vectorOfVxCandidates.end();
673
674 for (std::vector<const xAOD::Vertex*>::const_iterator verticesToVetoIter=verticesToVetoBegin;
675 verticesToVetoIter!=verticesToVetoEnd;++verticesToVetoIter)
676 {
677
678 Trk::VxTrackAtVertex firstTrack((((*verticesToVetoIter)->vxTrackAtVertex()))[0]);
679 Trk::VxTrackAtVertex secondTrack((((*verticesToVetoIter)->vxTrackAtVertex()))[1]);
680
681 const Trk::ITrackLink* linkToTP1= firstTrack.trackOrParticleLink();
682 const Trk::ITrackLink* linkToTP2=secondTrack.trackOrParticleLink();
683
684 if (trackToCheck==linkToTP1||
685 trackToCheck==linkToTP2)
686 {
687 return true;
688 }
689 }
690
691 return false;
692
693 }

◆ checkIfTrackIsInVector() [1/2]

bool InDet::InDetJetFitterUtils::checkIfTrackIsInVector ( const Trk::ITrackLink * trackToCheck,
const std::vector< const Trk::ITrackLink * > & vectorOfTracks )
static

Definition at line 560 of file InDetJetFitterUtils.cxx.

562 {
563
564 std::vector<const Trk::ITrackLink*>::const_iterator vectorOfTracksBegin=vectorOfTracks.begin();
565 std::vector<const Trk::ITrackLink*>::const_iterator vectorOfTracksEnd=vectorOfTracks.end();
566
567 for (std::vector<const Trk::ITrackLink*>::const_iterator vectorOfTracksIter=vectorOfTracksBegin;
568 vectorOfTracksIter!=vectorOfTracksEnd;++vectorOfTracksIter)
569 {
570 if (*vectorOfTracksIter==trackToCheck)
571 {
572 return true;
573 }
574 }
575 return false;
576 }

◆ checkIfTrackIsInVector() [2/2]

bool InDet::InDetJetFitterUtils::checkIfTrackIsInVector ( const Trk::ITrackLink * trackToCheck,
const std::vector< const Trk::LinkToTrackParticleBase * > & vectorOfTracks )
static

Definition at line 578 of file InDetJetFitterUtils.cxx.

580 {
581
582 std::vector<const Trk::LinkToTrackParticleBase*>::const_iterator vectorOfTracksBegin=vectorOfTracks.begin();
583 std::vector<const Trk::LinkToTrackParticleBase*>::const_iterator vectorOfTracksEnd=vectorOfTracks.end();
584
585 for (std::vector<const Trk::LinkToTrackParticleBase*>::const_iterator vectorOfTracksIter=vectorOfTracksBegin;
586 vectorOfTracksIter!=vectorOfTracksEnd;++vectorOfTracksIter)
587 {
588 if (*vectorOfTracksIter==trackToCheck)
589 {
590 return true;
591 }
592 }
593 return false;
594 }

◆ checkIfVxCandidateIsInVector()

bool InDet::InDetJetFitterUtils::checkIfVxCandidateIsInVector ( const xAOD::Vertex * vertexToCheck,
const std::vector< const xAOD::Vertex * > & vectorOfCandidates )
static

Definition at line 648 of file InDetJetFitterUtils.cxx.

650 {
651
652 std::vector<const xAOD::Vertex*>::const_iterator vectorOfCandidatesBegin=vectorOfCandidates.begin();
653 std::vector<const xAOD::Vertex*>::const_iterator vectorOfCandidatesEnd=vectorOfCandidates.end();
654
655 for (std::vector<const xAOD::Vertex*>::const_iterator vectorOfCandidatesIter=vectorOfCandidatesBegin;
656 vectorOfCandidatesIter!=vectorOfCandidatesEnd;
657 ++vectorOfCandidatesIter)
658 {
659 if (*vectorOfCandidatesIter==vertexToCheck)
660 {
661 return true;
662 }
663 }
664 return false;
665 }

◆ compatibility() [1/2]

std::pair< double, double > InDet::InDetJetFitterUtils::compatibility ( const Trk::ParametersBase< 5, Trk::Neutral > & measPerigee,
const Trk::RecVertex & vertex ) const

Definition at line 184 of file InDetJetFitterUtils.cxx.

186 {
187
189 {
190 msg(MSG::ERROR) << " No LinearizedTrackFactory defined. Cannot calculate compatibility. 0 compatibility returned" << endmsg;
191 return std::pair<double,double>(0,0);
192 }
193
194
195 Trk::LinearizedTrack* myLinearizedTrack=m_LinearizedTrackFactory->linearizedTrack(&measPerigee,vertex.position());
196 Amg::Vector3D vertexPosition(3);
197 vertexPosition[0]=vertex.position()[0];
198 vertexPosition[1]=vertex.position()[1];
199 vertexPosition[2]=vertex.position()[2];
200 // CLHEP::HepVector residual=myLinearizedTrack->positionJacobian()*vertexPosition+
201 // myLinearizedTrack->momentumJacobian()*myLinearizedTrack->expectedMomentumAtPCA()+
202 // myLinearizedTrack->constantTerm()-measPerigee.parameters();
203
204 const AmgSymMatrix(5) & ExpectedCovariance=myLinearizedTrack->expectedCovarianceAtPCA();
205
206 AmgSymMatrix(2) weightReduced=ExpectedCovariance.block<2,2>(0,0);
207
208 AmgSymMatrix(2) errorVertexReduced=vertex.covariancePosition().similarity(myLinearizedTrack->positionJacobian()).block<2,2>(0,0);
209
210 weightReduced+=errorVertexReduced;
211
212 weightReduced.inverse().eval();
213 //using determinant as protection - better solution to come...
214 if(weightReduced.determinant()==0)
215 {
216 msg(MSG::WARNING) << " Problem inverting cov matrix in compatibility method" << endmsg;
217 }
218 Amg::Vector2D paramsReduced((myLinearizedTrack->expectedParametersAtPCA())[0],(myLinearizedTrack->expectedParametersAtPCA())[1]);
219
220 double returnv2= paramsReduced.transpose() * weightReduced * paramsReduced;
221
222
223 delete myLinearizedTrack;
224 myLinearizedTrack=nullptr;
225
226 return std::pair<double,double>(returnv2,0);
227 }
Matrix< Scalar, OtherDerived::RowsAtCompileTime, OtherDerived::RowsAtCompileTime > similarity(const MatrixBase< OtherDerived > &m) const
similarity method : yields ms = m*s*m^T
#define endmsg
#define AmgSymMatrix(dim)
if(febId1==febId2)
MsgStream & msg() const
ToolHandle< Trk::IVertexLinearizedTrackFactory > m_LinearizedTrackFactory
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D

◆ compatibility() [2/2]

std::pair< double, double > InDet::InDetJetFitterUtils::compatibility ( const Trk::TrackParameters & measPerigee,
const Trk::RecVertex & vertex ) const

Definition at line 135 of file InDetJetFitterUtils.cxx.

137 {
138
140 {
141 msg(MSG::ERROR) << " No LinearizedTrackFactory defined. Cannot calculate compatibility. 0 compatibility returned" << endmsg;
142 return std::pair<double,double>(0,0);
143 }
144
145
146 Trk::LinearizedTrack* myLinearizedTrack=m_LinearizedTrackFactory->linearizedTrack(&measPerigee,vertex.position());
147
148 Amg::Vector3D vertexPosition;
149 vertexPosition[0]=vertex.position()[0];
150 vertexPosition[1]=vertex.position()[1];
151 vertexPosition[2]=vertex.position()[2];
152 // CLHEP::HepVector residual=myLinearizedTrack->positionJacobian()*vertexPosition+
153 // myLinearizedTrack->momentumJacobian()*myLinearizedTrack->expectedMomentumAtPCA()+
154 // myLinearizedTrack->constantTerm()-measPerigee.parameters();
155
156
157 const AmgSymMatrix(5) & ExpectedCovariance=myLinearizedTrack->expectedCovarianceAtPCA();
158
159 AmgSymMatrix(2) weightReduced=ExpectedCovariance.block<2,2>(0,0);
160
161 AmgSymMatrix(2) errorVertexReduced=vertex.covariancePosition().similarity(myLinearizedTrack->positionJacobian()).block<2,2>(0,0);
162
163 weightReduced+=errorVertexReduced;
164
165 weightReduced.inverse().eval();
166
167 //using determinant as protection - better solution to come...
168 if(weightReduced.determinant()==0)
169 {
170 msg(MSG::WARNING) << " Problem inverting cov matrix in compatibility method" << endmsg;
171 }
172 //double returnv2=weightReduced.similarity(myLinearizedTrack->expectedParametersAtPCA().block<2,2>(0,0));
173
174 Amg::Vector2D paramsReduced((myLinearizedTrack->expectedParametersAtPCA())[0],(myLinearizedTrack->expectedParametersAtPCA())[1]);
175
176 double returnv2= paramsReduced.transpose() * weightReduced.inverse() * paramsReduced;
177
178 delete myLinearizedTrack;
179 myLinearizedTrack=nullptr;
180
181 return std::pair<double,double>(returnv2,0);
182 }

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

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

◆ evtStore()

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.

◆ 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

◆ findNeutralTrackParticleBase() [1/2]

const Trk::LinkToTrackParticleBase * InDet::InDetJetFitterUtils::findNeutralTrackParticleBase ( const std::vector< const Trk::LinkToTrackParticleBase * > & ,
const Trk::VxCandidate &  ) const

◆ findNeutralTrackParticleBase() [2/2]

const Trk::LinkToTrackParticleBase * InDet::InDetJetFitterUtils::findNeutralTrackParticleBase ( const std::vector< const Trk::LinkToTrackParticleBase * > & ,
const xAOD::Vertex &  )
static

Definition at line 539 of file InDetJetFitterUtils.cxx.

541 {
542 //THIS WILL ANYWAY NOT WORK WITH NEW EDM! NEEDS TO BE FIXED!
543 /*
544 std::vector<const Trk::LinkToTrackParticleBase*>::const_iterator neutralsBegin=neutralTracks.begin();
545 std::vector<const Trk::LinkToTrackParticleBase*>::const_iterator neutralsEnd=neutralTracks.end();
546
547 for (std::vector<const Trk::LinkToTrackParticleBase*>::const_iterator neutralsIter=neutralsBegin;
548 neutralsIter!=neutralsEnd;++neutralsIter)
549 {
550 if ((****neutralsIter).reconstructedVertex()==&myVxCandidate)
551 {
552 return *neutralsIter;
553 }
554 }
555 //if not found, returns 0
556 */
557 return nullptr;
558 }

◆ fourMomentumAtVertex()

CLHEP::HepLorentzVector InDet::InDetJetFitterUtils::fourMomentumAtVertex ( const Trk::VxVertexOnJetAxis & myVxVertexOnJetAxis)
static

Definition at line 695 of file InDetJetFitterUtils.cxx.

696 {
697
698
699 const double s_pion=ParticleConstants::chargedPionMassInMeV;
700 //hard coded pion mass
701
702 CLHEP::HepLorentzVector massVector(0,0,0,0);
703
704 const std::vector<Trk::VxTrackAtVertex*> & tracksOfVertex=myVxVertexOnJetAxis.getTracksAtVertex();
705 std::vector<Trk::VxTrackAtVertex*>::const_iterator clustersOfTrackBegin=tracksOfVertex.begin();
706 std::vector<Trk::VxTrackAtVertex*>::const_iterator clustersOfTrackEnd=tracksOfVertex.end();
707 for (std::vector<Trk::VxTrackAtVertex*>::const_iterator clustersOfTrackIter=clustersOfTrackBegin;
708 clustersOfTrackIter!=clustersOfTrackEnd;
709 ++clustersOfTrackIter)
710 {
711 if (dynamic_cast<const Trk::Perigee*>((*clustersOfTrackIter)->perigeeAtVertex())!=nullptr)
712 {
713
714 const Trk::TrackParameters* aMeasPer=(*clustersOfTrackIter)->perigeeAtVertex();
715 Amg::Vector3D mytrack(aMeasPer->momentum());
716 massVector+=CLHEP::HepLorentzVector(mytrack.x(),mytrack.y(),mytrack.z(),TMath::Sqrt(s_pion*s_pion+mytrack.mag()*mytrack.mag()));
717 }
718 }
719
720 return massVector;
721 }
const Amg::Vector3D & momentum() const
Access method for the momentum.
const std::vector< VxTrackAtVertex * > & getTracksAtVertex(void) const
get Tracks At Vertex Method
constexpr double chargedPionMassInMeV
the mass of the charged pion (in MeV)
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ get3DLifetimeSignOfTrack()

double InDet::InDetJetFitterUtils::get3DLifetimeSignOfTrack ( const Trk::TrackParameters & track,
const Amg::Vector3D & jetMomentum,
const Trk::RecVertex & primaryVertex )
static

Definition at line 230 of file InDetJetFitterUtils.cxx.

233 {
234 //the formula in the end is VERY simple!
235 //(the calculation to get this result a bit harder!!!)
236 //This is also equivalent to the calculaton implemented in the IP3D Tagger
237 //but it is expressed in a MUCH MUCH MUCH simpler way!!!
238 const Amg::Vector3D & primaryPos=primaryVertex.position();
239 const Amg::Vector3D & trackPos=track.position();
240 const Amg::Vector3D & trackMom=track.momentum();
241
242 double sign=(jetMomentum.cross(trackMom)).dot(trackMom.cross(primaryPos-trackPos));
243 return sign>=0.?1.:-1;
244 }
int sign(int a)
const Amg::Vector3D & position() const
return position of vertex
Definition Vertex.cxx:63

◆ getD0andZ0IP()

std::pair< double, double > InDet::InDetJetFitterUtils::getD0andZ0IP ( const Trk::TrackParameters & trackPerigee,
const Trk::Vertex & vertexToExtrapolateTo ) const

Definition at line 465 of file InDetJetFitterUtils.cxx.

467 {
468 const EventContext& ctx = Gaudi::Hive::currentContext();
470 {
471 msg(MSG::ERROR) << "Cannot perform requested extrapolation. No extrapolator defined...Returning 0 compatibility..." << endmsg;
472 return std::pair<double,double>(0,0);
473 }
474
475
476 Trk::PerigeeSurface mySurface(vertexToExtrapolateTo.position());
477 const Trk::TrackParameters* newMeasPerigee= m_extrapolator->extrapolateDirectly(ctx,
478 trackPerigee,
479 mySurface).release();
480 if (newMeasPerigee==nullptr)
481 {
482 msg(MSG::WARNING) << " Extrapolation failed. Wrong d0 and z0 returned " << endmsg;
483 return std::pair<double,double>
484 (trackPerigee.parameters()[Trk::d0],
485 trackPerigee.parameters()[Trk::z0]*sin(trackPerigee.parameters()[Trk::theta]));
486 }
487
488 double IPd0=newMeasPerigee->parameters()[Trk::d0];
489 double IPz0=newMeasPerigee->parameters()[Trk::z0]*
490 sin(newMeasPerigee->parameters()[Trk::theta]);
491
492 delete newMeasPerigee;
493 newMeasPerigee=nullptr;
494
495 return std::pair<double,double>(IPd0,IPz0);
496 }
ToolHandle< Trk::IExtrapolator > m_extrapolator
@ theta
Definition ParamDefs.h:66
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64

◆ getD0andZ0IPSig()

std::pair< double, double > InDet::InDetJetFitterUtils::getD0andZ0IPSig ( const Trk::TrackParameters & trackPerigee,
const Trk::RecVertex & vertex ) const

Definition at line 499 of file InDetJetFitterUtils.cxx.

501 {
502
504 {
505 ATH_MSG_ERROR( "Cannot perform requested extrapolation. No extrapolator defined...Returning 0 compatibility..." );
506 return std::pair<double,double>(0,0);
507 }
508
509 Trk::LinearizedTrack* myLinearizedTrack=m_LinearizedTrackFactory->linearizedTrack(&trackPerigee,vertex.position());
510 Amg::Vector3D vertexPosition;
511 vertexPosition[0]=vertex.position()[0];
512 vertexPosition[1]=vertex.position()[1];
513 vertexPosition[2]=vertex.position()[2];
514
515 const AmgSymMatrix(5) & ExpectedCovariance=myLinearizedTrack->expectedCovarianceAtPCA();
516 AmgSymMatrix(2) weightReduced=ExpectedCovariance.block<2,2>(0,0);
517 //AmgSymMatrix(2) errorVertexReduced=vertex.covariancePosition().similarity(myLinearizedTrack->positionJacobian()).block<2,2>(0,0);
518 //weightReduced+=errorVertexReduced;
519
520 double IPd0Sig=(myLinearizedTrack->expectedParametersAtPCA())[0]/sqrt( weightReduced(0,0) );
521 double IPz0Sig=(myLinearizedTrack->expectedParametersAtPCA())[1]/sqrt( weightReduced(1,1) );
522
523 /*
524 std::cout << " " << std::endl;
525 std::cout << " --> ExpectedCovariance : " << sqrt( weightReduced(0,0)) << " , " << sqrt( weightReduced(1,1)) << std::endl;
526 std::cout << " --> Covarianceposition : " << sqrt(vertex.covariancePosition()(0,0)) << " , " << sqrt(vertex.covariancePosition()(1,1)) << std::endl;
527 std::cout << " --> d0/z0 : " << myLinearizedTrack->expectedParametersAtPCA()[0] << " , " << myLinearizedTrack->expectedParametersAtPCA()[1] << std::endl;
528 std::cout << " --> d0Sig/z0Sig : " << IPd0Sig << " , " << IPz0Sig << std::endl;
529 */
530
531 delete myLinearizedTrack;
532 myLinearizedTrack=nullptr;
533
534 return std::pair<double,double>(IPd0Sig,IPz0Sig);
535 }
#define ATH_MSG_ERROR(x)

◆ getDistanceAndErrorBetweenTwoVertices()

std::pair< double, double > InDet::InDetJetFitterUtils::getDistanceAndErrorBetweenTwoVertices ( const xAOD::Vertex & first,
const Trk::RecVertex & second ) const

Definition at line 419 of file InDetJetFitterUtils.cxx.

421 {
422
423 Amg::Vector3D difference=second.position()-first.position();
424
425 double distance=difference.mag();
426
427 AmgSymMatrix(3) sumErrorsThenInverted=first.covariancePosition()+
428 second.covariancePosition();
429
430
431 sumErrorsThenInverted.inverse().eval();
432 //using determinant as protection - better solution to come...
433 Amg::Vector3D differenceUnit(difference);
434 differenceUnit.normalize();
435
436 double error=1000;
437
438 if (sumErrorsThenInverted.determinant()>0 && distance>0)
439 {
440 double temp=differenceUnit.transpose() * sumErrorsThenInverted * differenceUnit;
441 if (temp>0)
442 {
443 error=1./std::sqrt(temp );
444 }
445 else
446 {
447 ATH_MSG_DEBUG( "The significance of the distance to the PV is negative or zero definite: " << temp );
448 //MU msg(MSG::WARNING) << std::scientific << temp << " two-trk vertex : " << first << " PV " << second << std::fixed << endmsg;
449 }
450 }
451 else
452 {
453 if (sumErrorsThenInverted.determinant()<=0)
454 {
455 ATH_MSG_DEBUG( "Sum of cov matrices of PV + single vertex fit is zero or negative. Error on distance is returned as 1000mm." );
456 }
457 else
458 {
459 ATH_MSG_DEBUG( "The distance between the vertices is: " << distance );
460 }
461 }
462 return std::pair<double,double>(distance,error);
463 }
#define ATH_MSG_DEBUG(x)
Double_t normalize(TF1 *func, Double_t *rampl=NULL, Double_t from=0., Double_t to=0., Double_t step=1.)
Eigen::Matrix< double, 3, 1 > Vector3D
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
bool first
Definition DeMoScan.py:534
difference(file_1="Geometry_1.json", file_2="Geometry_2.json", output_file="Geometry_diff.json")

◆ getPosMomentumAndMomentumCovMatrix()

std::pair< AmgMatrix(3, 3), AmgSymMatrix(3)> InDet::InDetJetFitterUtils::getPosMomentumAndMomentumCovMatrix ( const Trk::LinearizedTrack * linTrack,
const AmgSymMatrix(3) & vrt_cov,
const AmgSymMatrix(3) & vrt_weight ) const
private

Definition at line 111 of file InDetJetFitterUtils.cxx.

114 {
115
116 const AmgMatrix(5,3) & A = linTrack->positionJacobian();
117 const AmgMatrix(5,3) & B = linTrack->momentumJacobian();
118 const AmgSymMatrix(5) & trkParametersWeight = linTrack->expectedWeightAtPCA();
119 AmgSymMatrix(3) Sm = B.transpose() * trkParametersWeight * B;
120 //using determinant as protection - better solution to come...
121 Sm = Sm.inverse().eval();
122 if(Sm.determinant()==0){
123 msg(MSG::WARNING) << "Inversion of S matrix fails in track refit" << endmsg;
124 msg(MSG::WARNING) << " This track is returned not refitted" << endmsg;
125 throw std::string("Inversion of S matrix fails in track parameters refit");
126 }
127 AmgMatrix(3,3) posMomentumCovariance = -vrt_cov * A.transpose() * trkParametersWeight * B *Sm;
128 AmgSymMatrix(3) momentumCovariance = Sm + vrt_weight.similarityT(posMomentumCovariance);
129
130 return std::pair<AmgMatrix(3,3),AmgSymMatrix(3)>(posMomentumCovariance,momentumCovariance);
131 }
Matrix< Scalar, OtherDerived::RowsAtCompileTime, OtherDerived::RowsAtCompileTime > similarityT(const MatrixBase< OtherDerived > &m) const
similarityT method : yields ms = m^T*s*m
#define AmgMatrix(rows, cols)

◆ getTwoTrackVtxCharge() [1/2]

int InDet::InDetJetFitterUtils::getTwoTrackVtxCharge ( const Trk::VxCandidate & myVxCandidate) const

Definition at line 246 of file InDetJetFitterUtils.cxx.

247 {
248
249 //now obtain the daughters of the two vertex
250 std::vector<Trk::VxTrackAtVertex*>::const_iterator vtxIter=myVxCandidate.vxTrackAtVertex()->begin();
251
252 //obtain first track
253 Trk::VxTrackAtVertex* firstTrack(*vtxIter);
254
255 //obtain second track
256 ++vtxIter;
257 Trk::VxTrackAtVertex* secondTrack(*vtxIter);
258
259 //now obtain the momentum at the track (refitted)
260 const Trk::TrackParameters* firstTrackPerigee=firstTrack->perigeeAtVertex();
261
262 //second
263 const Trk::TrackParameters* secondTrackPerigee=secondTrack->perigeeAtVertex();
264
265 if (firstTrackPerigee==nullptr ||secondTrackPerigee==nullptr)
266 {
267 ATH_MSG_DEBUG( "No Perigee in one of the two tracks at vertex. No sensible charge returned." );
268 return -100;
269 }
270
271 return (int)(
272 std::floor(
273 firstTrackPerigee->parameters()[Trk::qOverP]/
274 fabs(firstTrackPerigee->parameters()[Trk::qOverP])+
275 secondTrackPerigee->parameters()[Trk::qOverP]/
276 fabs(secondTrackPerigee->parameters()[Trk::qOverP])+0.5 )
277 );
278 }
std::vector< Trk::VxTrackAtVertex * > * vxTrackAtVertex(void)
Unconst pointer to the vector of tracks Required by some of the vertex fitters.
@ qOverP
perigee
Definition ParamDefs.h:67

◆ getTwoTrackVtxCharge() [2/2]

int InDet::InDetJetFitterUtils::getTwoTrackVtxCharge ( const xAOD::Vertex & myVxCandidate) const

Definition at line 281 of file InDetJetFitterUtils.cxx.

282 {
283
284 //now obtain the daughters of the two vertex
285 std::vector<Trk::VxTrackAtVertex>::const_iterator vtxIter=myVxCandidate.vxTrackAtVertex().begin();
286
287 //obtain first track
288 Trk::VxTrackAtVertex firstTrack(*vtxIter);
289
290 //obtain second track
291 ++vtxIter;
292 Trk::VxTrackAtVertex secondTrack(*vtxIter);
293
294 //now obtain the momentum at the track (refitted)
295 const Trk::TrackParameters* firstTrackPerigee=firstTrack.perigeeAtVertex();
296
297 //second
298 const Trk::TrackParameters* secondTrackPerigee=secondTrack.perigeeAtVertex();
299
300 if (firstTrackPerigee==nullptr ||secondTrackPerigee==nullptr)
301 {
302 ATH_MSG_DEBUG( "No Perigee in one of the two tracks at vertex. No sensible charge returned." );
303 return -100;
304 }
305
306 return (int)(
307 std::floor(
308 firstTrackPerigee->parameters()[Trk::qOverP]/
309 fabs(firstTrackPerigee->parameters()[Trk::qOverP])+
310 secondTrackPerigee->parameters()[Trk::qOverP]/
311 fabs(secondTrackPerigee->parameters()[Trk::qOverP])+0.5 )
312 );
313 }
std::vector< Trk::VxTrackAtVertex > & vxTrackAtVertex()
Non-const access to the VxTrackAtVertex vector.

◆ getTwoTrackVtxMass() [1/2]

double InDet::InDetJetFitterUtils::getTwoTrackVtxMass ( const Trk::VxCandidate & myVxCandidate,
double highestMomMass,
double lowestMomMass ) const

Definition at line 316 of file InDetJetFitterUtils.cxx.

319 {
320
321
322 //now obtain the daughters of the two vertex
323 std::vector<Trk::VxTrackAtVertex*>::const_iterator vtxIter=myVxCandidate.vxTrackAtVertex()->begin();
324
325 //obtain first track
326 Trk::VxTrackAtVertex* firstTrack(*vtxIter);
327
328 //obtain second track
329 ++vtxIter;
330 Trk::VxTrackAtVertex* secondTrack(*vtxIter);
331
332 //now obtain the momentum at the track (refitted)
333 const Trk::TrackParameters* firstTrackPerigee=firstTrack->perigeeAtVertex();
334
335 //second
336 const Trk::TrackParameters* secondTrackPerigee=secondTrack->perigeeAtVertex();
337
338 if (firstTrackPerigee==nullptr ||secondTrackPerigee==nullptr)
339 {
340 ATH_MSG_DEBUG( "No Perigee in one of the two tracks at vertex. No sensible mass returned." );
341 return -100;
342 }
343
344 Amg::Vector3D firstMomentum=firstTrackPerigee->momentum();
345 Amg::Vector3D secondMomentum=secondTrackPerigee->momentum();
346
347
348 CLHEP::HepLorentzVector first4Mom;
349 CLHEP::HepLorentzVector second4Mom;
350
351 if (firstMomentum.mag2()>secondMomentum.mag2())
352 {
353 first4Mom=CLHEP::HepLorentzVector(firstMomentum.x(),firstMomentum.y(),firstMomentum.z(),TMath::Sqrt(highestMomMass*highestMomMass+firstMomentum.mag()*firstMomentum.mag()));
354 second4Mom=CLHEP::HepLorentzVector(secondMomentum.x(),secondMomentum.y(),secondMomentum.z(),TMath::Sqrt(lowestMomMass*lowestMomMass+secondMomentum.mag()*secondMomentum.mag()));
355 }
356 else
357 {
358 first4Mom=CLHEP::HepLorentzVector(firstMomentum.x(),firstMomentum.y(),firstMomentum.z(),TMath::Sqrt(lowestMomMass*highestMomMass+firstMomentum.mag()*firstMomentum.mag()));
359 second4Mom=CLHEP::HepLorentzVector(secondMomentum.x(),secondMomentum.y(),secondMomentum.z(),TMath::Sqrt(highestMomMass*lowestMomMass+secondMomentum.mag()*secondMomentum.mag()));
360 }
361
362 return (first4Mom+second4Mom).mag();
363 }

◆ getTwoTrackVtxMass() [2/2]

double InDet::InDetJetFitterUtils::getTwoTrackVtxMass ( const xAOD::Vertex & myVxCandidate,
double highestMomMass,
double lowestMomMass ) const

Definition at line 368 of file InDetJetFitterUtils.cxx.

371 {
372
373
374 //now obtain the daughters of the two vertex
375 std::vector<Trk::VxTrackAtVertex>::const_iterator vtxIter=myVxCandidate.vxTrackAtVertex().begin();
376
377 //obtain first track
378 Trk::VxTrackAtVertex firstTrack(*vtxIter);
379
380 //obtain second track
381 ++vtxIter;
382 Trk::VxTrackAtVertex secondTrack(*vtxIter);
383
384 //now obtain the momentum at the track (refitted)
385 const Trk::TrackParameters* firstTrackPerigee=firstTrack.perigeeAtVertex();
386
387 //second
388 const Trk::TrackParameters* secondTrackPerigee=secondTrack.perigeeAtVertex();
389
390 if (firstTrackPerigee==nullptr ||secondTrackPerigee==nullptr)
391 {
392 ATH_MSG_DEBUG( "No Perigee in one of the two tracks at vertex. No sensible mass returned." );
393 return -100;
394 }
395
396 Amg::Vector3D firstMomentum=firstTrackPerigee->momentum();
397 Amg::Vector3D secondMomentum=secondTrackPerigee->momentum();
398
399
400 CLHEP::HepLorentzVector first4Mom;
401 CLHEP::HepLorentzVector second4Mom;
402
403 if (firstMomentum.mag2()>secondMomentum.mag2())
404 {
405 first4Mom=CLHEP::HepLorentzVector(firstMomentum.x(),firstMomentum.y(),firstMomentum.z(),TMath::Sqrt(highestMomMass*highestMomMass+firstMomentum.mag()*firstMomentum.mag()));
406 second4Mom=CLHEP::HepLorentzVector(secondMomentum.x(),secondMomentum.y(),secondMomentum.z(),TMath::Sqrt(lowestMomMass*lowestMomMass+secondMomentum.mag()*secondMomentum.mag()));
407 }
408 else
409 {
410 first4Mom=CLHEP::HepLorentzVector(firstMomentum.x(),firstMomentum.y(),firstMomentum.z(),TMath::Sqrt(lowestMomMass*highestMomMass+firstMomentum.mag()*firstMomentum.mag()));
411 second4Mom=CLHEP::HepLorentzVector(secondMomentum.x(),secondMomentum.y(),secondMomentum.z(),TMath::Sqrt(highestMomMass*lowestMomMass+secondMomentum.mag()*secondMomentum.mag()));
412 }
413
414 return (first4Mom+second4Mom).mag();
415 }

◆ initialize()

StatusCode InDet::InDetJetFitterUtils::initialize ( )
overridevirtual

Definition at line 82 of file InDetJetFitterUtils.cxx.

82 {
83
84 if (!m_LinearizedTrackFactory.empty())
85 {
87 if (sc.isFailure()) {
88 msg(MSG::FATAL) << "Could not find TrackLinearizer tool." << endmsg;
89 return StatusCode::FAILURE;
90 }
91 else
92 {
94 }
95
96 }
97
98 if (!m_extrapolator.empty())
99 {
100 StatusCode sc=m_extrapolator.retrieve();
101 if (sc.isFailure()) {
102 msg(MSG::FATAL) << "Could not find Extrapolator tool." << endmsg;
103 return StatusCode::FAILURE;
104 }
105 }
106
107 return StatusCode::SUCCESS;
108 }
static Double_t sc
::StatusCode StatusCode
StatusCode definition for legacy code.

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

const InterfaceID & InDet::InDetJetFitterUtils::interfaceID ( )
inlinestatic

Definition at line 60 of file InDetJetFitterUtils.h.

60 {
62 }
static const InterfaceID IID_InDetJetFitterUtils("InDetJetFitterUtils", 1, 0)

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ 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();
384 }
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)

◆ 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 {
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 asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ 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) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

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_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_extrapolator

ToolHandle<Trk::IExtrapolator> InDet::InDetJetFitterUtils::m_extrapolator {this,"Extrapolator","Trk::Extrapolator/InDetExtrapolator",""}
private

Definition at line 140 of file InDetJetFitterUtils.h.

140{this,"Extrapolator","Trk::Extrapolator/InDetExtrapolator",""};

◆ m_LinearizedTrackFactory

ToolHandle<Trk::IVertexLinearizedTrackFactory> InDet::InDetJetFitterUtils::m_LinearizedTrackFactory {this,"LinearizedTrackFactory","Trk::FullLinearizedTrackFactory/FullLinearizedTrackFactory",""}
private

Definition at line 139 of file InDetJetFitterUtils.h.

139{this,"LinearizedTrackFactory","Trk::FullLinearizedTrackFactory/FullLinearizedTrackFactory",""};

◆ m_linearizedTrackFactoryIsAvailable

bool InDet::InDetJetFitterUtils::m_linearizedTrackFactoryIsAvailable
private

Definition at line 142 of file InDetJetFitterUtils.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: