ATLAS Offline Software
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
Trk::TrkVKalVrtFitter Class Reference

#include <TrkVKalVrtFitter.h>

Inheritance diagram for Trk::TrkVKalVrtFitter:
Collaboration diagram for Trk::TrkVKalVrtFitter:

Classes

class  CascadeState
 
class  State
 
struct  TrkMatControl
 

Public Member Functions

virtual StatusCode initialize () override final
 
virtual StatusCode finalize () override final
 
 TrkVKalVrtFitter (const std::string &t, const std::string &name, const IInterface *parent)
 
virtual ~TrkVKalVrtFitter ()
 
virtual xAOD::Vertexfit (const std::vector< const TrackParameters * > &perigeeList, const Amg::Vector3D &startingPoint) const override final
 Interface for MeasuredPerigee with starting point. More...
 
virtual xAOD::Vertexfit (const std::vector< const TrackParameters * > &perigeeList, const std::vector< const NeutralParameters * > &, const Amg::Vector3D &startingPoint) const override final
 
virtual xAOD::Vertexfit (const std::vector< const TrackParameters * > &perigeeList, const xAOD::Vertex &constraint) const override final
 Interface for MeasuredPerigee with vertex constraint. More...
 
virtual xAOD::Vertexfit (const std::vector< const TrackParameters * > &perigeeList, const std::vector< const NeutralParameters * > &, const xAOD::Vertex &constraint) const override final
 
virtual std::unique_ptr< xAOD::Vertexfit (const EventContext &ctx, const std::vector< const xAOD::TrackParticle * > &vectorTrk, const Amg::Vector3D &startingPoint) const override final
 Interface for xAOD::TrackParticle with starting point Implements the new style (unique_ptr,EventContext) More...
 
virtual xAOD::Vertexfit (const std::vector< const xAOD::TrackParticle * > &vectorTrk, const xAOD::Vertex &constraint) const override final
 Interface for xAOD::TrackParticle with vertex constraint. More...
 
virtual xAOD::Vertexfit (const std::vector< const xAOD::TrackParticle * > &vectorTrk, const std::vector< const xAOD::NeutralParticle * > &vectorNeu, const Amg::Vector3D &startingPoint) const override final
 
virtual xAOD::Vertexfit (const std::vector< const xAOD::TrackParticle * > &vectorTrk, const std::vector< const xAOD::NeutralParticle * > &vectorNeu, const xAOD::Vertex &constraint) const override final
 
virtual xAOD::Vertexfit (const std::vector< const TrackParameters * > &) const override final
 
virtual xAOD::Vertexfit (const std::vector< const TrackParameters * > &, const std::vector< const Trk::NeutralParameters * > &) const override final
 
xAOD::Vertexfit (const std::vector< const xAOD::TrackParticle * > &vectorTrk, const Amg::Vector3D &constraint, IVKalState &istate) const
 
xAOD::Vertexfit (const std::vector< const xAOD::TrackParticle * > &vectorTrk, const xAOD::Vertex &constraint, IVKalState &istate) const
 
VertexID startVertex (const std::vector< const xAOD::TrackParticle * > &list, std::span< const double > particleMass, IVKalState &istate, double massConstraint=0.) const override final
 Interface for cascade fit. More...
 
VertexID nextVertex (const std::vector< const xAOD::TrackParticle * > &list, std::span< const double > particleMass, IVKalState &istate, double massConstraint=0.) const override final
 
VertexID nextVertex (const std::vector< const xAOD::TrackParticle * > &list, std::span< const double > particleMass, const std::vector< VertexID > &precedingVertices, IVKalState &istate, double massConstraint=0.) const override final
 
VxCascadeInfofitCascade (IVKalState &istate, const Vertex *primVertex=0, bool FirstDecayAtPV=false) const override final
 
StatusCode addMassConstraint (VertexID Vertex, const std::vector< const xAOD::TrackParticle * > &tracksInConstraint, const std::vector< VertexID > &verticesInConstraint, IVKalState &istate, double massConstraint) const override final
 
virtual std::unique_ptr< IVKalStatemakeState (const EventContext &ctx) const override final
 
virtual StatusCode VKalVrtFit (const std::vector< const xAOD::TrackParticle * > &, const std::vector< const xAOD::NeutralParticle * > &, Amg::Vector3D &Vertex, TLorentzVector &Momentum, long int &Charge, dvect &ErrorMatrix, dvect &Chi2PerTrk, std::vector< std::vector< double >> &TrkAtVrt, double &Chi2, IVKalState &istate, bool ifCovV0=false) const override final
 
virtual StatusCode VKalVrtFit (const std::vector< const Perigee * > &, Amg::Vector3D &Vertex, TLorentzVector &Momentum, long int &Charge, dvect &ErrorMatrix, dvect &Chi2PerTrk, std::vector< std::vector< double >> &TrkAtVrt, double &Chi2, IVKalState &istate, bool ifCovV0=false) const override final
 
virtual StatusCode VKalVrtFit (const std::vector< const TrackParameters * > &, const std::vector< const NeutralParameters * > &, Amg::Vector3D &Vertex, TLorentzVector &Momentum, long int &Charge, dvect &ErrorMatrix, dvect &Chi2PerTrk, std::vector< std::vector< double >> &TrkAtVrt, double &Chi2, IVKalState &istate, bool ifCovV0=false) const override final
 
virtual StatusCode VKalVrtCvtTool (const Amg::Vector3D &Vertex, const TLorentzVector &Momentum, const dvect &CovVrtMom, const long int &Charge, dvect &Perigee, dvect &CovPerigee, IVKalState &istate) const override final
 
virtual StatusCode VKalVrtFitFast (std::span< const xAOD::TrackParticle *const >, Amg::Vector3D &Vertex, double &minDZ, IVKalState &istate) const
 
virtual StatusCode VKalVrtFitFast (const std::span< const xAOD::TrackParticle *const >, Amg::Vector3D &Vertex, IVKalState &istate) const override final
 
virtual StatusCode VKalVrtFitFast (const std::vector< const TrackParameters * > &, Amg::Vector3D &Vertex, IVKalState &istate) const override final
 
virtual std::unique_ptr< Trk::PerigeeCreatePerigee (const std::vector< double > &VKPerigee, const std::vector< double > &VKCov, IVKalState &istate) const override final
 
virtual StatusCode VKalGetTrkWeights (dvect &Weights, const IVKalState &istate) const override final
 
virtual StatusCode VKalGetFullCov (long int, dvect &CovMtx, IVKalState &istate, bool=false) const override final
 
virtual StatusCode VKalGetMassError (double &Mass, double &MassError, const IVKalState &istate) const override final
 
virtual void setApproximateVertex (double X, double Y, double Z, IVKalState &istate) const override final
 
virtual void setMassForConstraint (double Mass, IVKalState &istate) const override final
 
virtual void setMassForConstraint (double Mass, std::span< const int >, IVKalState &istate) const override final
 
virtual void setRobustness (int, IVKalState &istate) const override final
 
virtual void setRobustScale (double, IVKalState &istate) const override final
 
virtual void setCnstType (int, IVKalState &istate) const override final
 
virtual void setVertexForConstraint (const xAOD::Vertex &, IVKalState &istate) const override final
 
virtual void setVertexForConstraint (double X, double Y, double Z, IVKalState &istate) const override final
 
virtual void setCovVrtForConstraint (double XX, double XY, double YY, double XZ, double YZ, double ZZ, IVKalState &istate) const override final
 
virtual void setMassInputParticles (const std::vector< double > &, IVKalState &istate) const override final
 
virtual double VKalGetImpact (const xAOD::TrackParticle *, const Amg::Vector3D &Vertex, const long int Charge, dvect &Impact, dvect &ImpactError, IVKalState &istate) const override final
 
virtual double VKalGetImpact (const Trk::Perigee *, const Amg::Vector3D &Vertex, const long int Charge, dvect &Impact, dvect &ImpactError, IVKalState &istate) const override final
 
virtual double VKalGetImpact (const xAOD::TrackParticle *, const Amg::Vector3D &Vertex, const long int Charge, dvect &Impact, dvect &ImpactError) const override final
 
virtual double VKalGetImpact (const Trk::Perigee *, const Amg::Vector3D &Vertex, const long int Charge, dvect &Impact, dvect &ImpactError) const override final
 

Private Member Functions

void initCnstList ()
 
void setAthenaPropagator (const Trk::IExtrapolator *)
 
void initState (const EventContext &ctx, State &state) const
 
void initState (State &state) const
 
bool convertAmg5SymMtx (const AmgSymMatrix(5) *, double[15]) const
 
void VKalTransform (double MAG, double A0V, double ZV, double PhiV, double ThetaV, double PInv, const double[15], long int &Charge, double[5], double[15]) const
 
xAOD::VertexmakeXAODVertex (int, const Amg::Vector3D &, const dvect &, const dvect &, const std::vector< dvect > &, double, State &state) const
 
StatusCode CvtPerigee (const std::vector< const Perigee * > &list, int &ntrk, State &state) const
 
StatusCode CvtTrackParticle (std::span< const xAOD::TrackParticle *const > list, int &ntrk, State &state) const
 
StatusCode CvtNeutralParticle (const std::vector< const xAOD::NeutralParticle * > &list, int &ntrk, State &state) const
 
StatusCode CvtTrackParameters (const std::vector< const TrackParameters * > &InpTrk, int &ntrk, State &state) const
 
StatusCode CvtNeutralParameters (const std::vector< const NeutralParameters * > &InpTrk, int &ntrk, State &state) const
 
void VKalVrtConfigureFitterCore (int NTRK, State &state) const
 
void VKalToTrkTrack (double curBMAG, double vp1, double vp2, double vp3, double &tp1, double &tp2, double &tp3) const
 
int VKalVrtFit3 (int ntrk, Amg::Vector3D &Vertex, TLorentzVector &Momentum, long int &Charge, dvect &ErrorMatrix, dvect &Chi2PerTrk, std::vector< std::vector< double >> &TrkAtVrt, double &Chi2, State &state, bool ifCovV0) const
 
std::unique_ptr< PerigeeCreatePerigee (double Vx, double Vy, double Vz, const std::vector< double > &VKPerigee, const std::vector< double > &VKCov, State &state) const
 

Static Private Member Functions

static void makeSimpleCascade (std::vector< std::vector< int > > &, std::vector< std::vector< int > > &, CascadeState &cstate)
 
static void printSimpleCascade (std::vector< std::vector< int > > &, std::vector< std::vector< int > > &, const CascadeState &cstate)
 
static int findPositions (const std::vector< int > &, const std::vector< int > &, std::vector< int > &)
 
static int getSimpleVIndex (const VertexID &, const CascadeState &cstate)
 
static int indexInV (const VertexID &, const CascadeState &cstate)
 
static int getCascadeNDoF (const CascadeState &cstate)
 
static void FillMatrixP (AmgSymMatrix(5)&, std::vector< double > &)
 
static void FillMatrixP (int iTrk, AmgSymMatrix(5)&, std::vector< double > &)
 
static Amg::MatrixXGiveFullMatrix (int NTrk, std::vector< double > &)
 
static const PerigeeGetPerigee (const TrackParameters *i_ntrk)
 
static int VKalGetNDOF (const State &state)
 

Private Attributes

SimpleProperty< int > m_Robustness
 
SimpleProperty< double > m_RobustScale
 
SimpleProperty< double > m_cascadeCnstPrecision
 
SimpleProperty< double > m_massForConstraint
 
SimpleProperty< int > m_IterationNumber
 
SimpleProperty< double > m_IterationPrecision
 
SimpleProperty< double > m_IDsizeR
 
SimpleProperty< double > m_IDsizeZ
 
std::vector< double > m_c_VertexForConstraint
 
std::vector< double > m_c_CovVrtForConstraint
 
std::vector< double > m_c_MassInputParticles
 
ToolHandle< IExtrapolatorm_extPropagator
 
SG::ReadCondHandleKey< AtlasFieldCacheCondObjm_fieldCacheCondObjInputKey
 
SimpleProperty< bool > m_firstMeasuredPoint
 
SimpleProperty< bool > m_firstMeasuredPointLimit
 
SimpleProperty< bool > m_makeExtendedVertex
 
SimpleProperty< bool > m_useFixedField
 
bool m_isAtlasField
 
bool m_useAprioriVertex
 
bool m_useThetaCnst
 
bool m_usePhiCnst
 
bool m_usePointingCnst
 
bool m_useZPointingCnst
 
bool m_usePassNear
 
bool m_usePassWithTrkErr
 
bool m_frozenVersionForBTagging
 
double m_BMAG
 
double m_CNVMAG
 
VKalExtPropagatorm_fitPropagator
 
const IExtrapolatorm_InDetExtrapolator
 Pointer to Extrapolator AlgTool. More...
 

Friends

class VKalExtPropagator
 

Detailed Description

Definition at line 64 of file TrkVKalVrtFitter.h.

Constructor & Destructor Documentation

◆ TrkVKalVrtFitter()

Trk::TrkVKalVrtFitter::TrkVKalVrtFitter ( const std::string &  t,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 30 of file TrkVKalVrtFitter.cxx.

32  :
33  base_class(type,name,parent),
34  m_Robustness(0),
35  m_RobustScale(1.),
40  m_IDsizeR(1150.),
41  m_IDsizeZ(3000.),
42  m_extPropagator(this), // Internal propagator
43  // m_extPropagator("Trk::Extrapolator/InDetExtrapolator"), // External propagator
44  m_firstMeasuredPoint(false),
46  m_makeExtendedVertex(false),
47  m_useFixedField(false),
48  m_useAprioriVertex(false),
49  m_useThetaCnst(false),
50  m_usePhiCnst(false),
51  m_usePointingCnst(false),
52  m_useZPointingCnst(false),
53  m_usePassNear(false),
54  m_usePassWithTrkErr(false),
56  {
57  declareInterface<IVertexFitter>(this);
58  declareInterface<ITrkVKalVrtFitter>(this);
59  declareInterface<IVertexCascadeFitter>(this);
60 
61  m_BMAG = 1.997; /*constant ATLAS magnetic field if no exact map*/
62  m_CNVMAG = 0.29979246; /* conversion constant for MeV and MM */
63 
65  for( int i=0; i<3; i++){m_c_VertexForConstraint.push_back(0.);}
67  for( int i=0; i<6; i++){m_c_CovVrtForConstraint.push_back(0.);}
68  m_c_MassInputParticles.clear();
69 //
70  declareProperty("Robustness", m_Robustness);
71  declareProperty("RobustScale", m_RobustScale);
72  declareProperty("CascadeCnstPrecision", m_cascadeCnstPrecision);
73  declareProperty("MassForConstraint", m_massForConstraint);
74  declareProperty("IterationNumber", m_IterationNumber);
75  declareProperty("IterationPrecision", m_IterationPrecision);
76  declareProperty("IDsizeR", m_IDsizeR);
77  declareProperty("IDsizeZ", m_IDsizeZ);
78  declareProperty("VertexForConstraint", m_c_VertexForConstraint);
79  declareProperty("CovVrtForConstraint", m_c_CovVrtForConstraint);
80  declareProperty("InputParticleMasses", m_c_MassInputParticles, "List of masses of input particles (pions assumed if this list is absent)" );
81  declareProperty("Extrapolator", m_extPropagator);
82  declareProperty("useFixedField", m_useFixedField, " Use fixed magnetic field instead of exact Atlas one");
83  declareProperty("FirstMeasuredPoint", m_firstMeasuredPoint);
84  declareProperty("FirstMeasuredPointLimit", m_firstMeasuredPointLimit);
85  declareProperty("MakeExtendedVertex", m_makeExtendedVertex, "VKalVrt returns VxCandidate with full covariance matrix");
86 //
87  declareProperty("useAprioriVertexCnst", m_useAprioriVertex);
88  declareProperty("useThetaCnst", m_useThetaCnst);
89  declareProperty("usePhiCnst", m_usePhiCnst);
90  declareProperty("usePointingCnst", m_usePointingCnst);
91  declareProperty("useZPointingCnst", m_useZPointingCnst);
92  declareProperty("usePassNearCnst", m_usePassNear);
93  declareProperty("usePassWithTrkErrCnst", m_usePassWithTrkErr);
94  declareProperty("FrozenVersionForBTagging", m_frozenVersionForBTagging);
95 //
96 
97 /*--------------------------------------------------------------------------*/
98 /* New propagator object is created. It's provided to VKalVrtCore. */
99 /* VKalVrtFitter must set up Core BEFORE any call required propagation!!! */
100 /* This object is created ONLY if IExtrapolator pointer is provideded. */
101 /* see VKalExtPropagator.cxx for details */
102 /*--------------------------------------------------------------------------*/
103  m_fitPropagator = nullptr; //Pointer to VKalVrtFitter propagator object to supply to VKalVrtCore (specific interface)
104  m_InDetExtrapolator = nullptr; //Direct pointer to Athena propagator
105 
106  m_isAtlasField = false; // To allow callback and then field first call only at execute stage
107 }

◆ ~TrkVKalVrtFitter()

Trk::TrkVKalVrtFitter::~TrkVKalVrtFitter ( )
virtual

Definition at line 111 of file TrkVKalVrtFitter.cxx.

111  {
112  //log << MSG::DEBUG << "TrkVKalVrtFitter destructor called" << endmsg;
113  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"TrkVKalVrtFitter destructor called" << endmsg;
114  if(m_fitPropagator) delete m_fitPropagator;
115 }

Member Function Documentation

◆ addMassConstraint()

StatusCode Trk::TrkVKalVrtFitter::addMassConstraint ( VertexID  Vertex,
const std::vector< const xAOD::TrackParticle * > &  tracksInConstraint,
const std::vector< VertexID > &  verticesInConstraint,
IVKalState istate,
double  massConstraint 
) const
finaloverride

Definition at line 728 of file TrkCascadeFitter.cxx.

733 {
734  assert(dynamic_cast<State*> (&istate)!=nullptr);
735  State& state = static_cast<State&> (istate);
736  CascadeState& cstate = *state.m_cascadeState;
737 
738  int ivc, it, itc;
739  //int NV=m_cstate.cascadeVList.size(); // cascade size
740 //----
741  if(Vertex < 0) return StatusCode::FAILURE;
742  //if(Vertex >= NV) return StatusCode::FAILURE; //Now this check is WRONG. Use indexInV(..) instead
743 //
744 //---- real tracks
745 //
746  int cnstNTRK=tracksInConstraint.size(); // number of real tracks in constraints
747  int indexV = indexInV(Vertex, cstate); // index of vertex in cascade structure
748  if(indexV<0) return StatusCode::FAILURE;
749  int NTRK = cstate.m_cascadeVList[indexV].trkInVrt.size(); // number of real tracks in chosen vertex
750  int totNTRK = cstate.m_partListForCascade.size(); // total number of real tracks
751  if( cnstNTRK > NTRK ) return StatusCode::FAILURE;
752 //-
753  PartialMassConstraint tmpMcnst;
754  tmpMcnst.Mass = massConstraint;
755  tmpMcnst.VRT = Vertex;
756 //
757  double totMass=0;
758  for(itc=0; itc<cnstNTRK; itc++) {
759  for(it=0; it<totNTRK; it++) if(tracksInConstraint[itc]==cstate.m_partListForCascade[it]) break;
760  if(it==totNTRK) return StatusCode::FAILURE; //track in constraint doesn't correspond to any track in vertex
761  tmpMcnst.trkInVrt.push_back(it);
762  totMass += cstate.m_partMassForCascade[it];
763  }
764  if(totMass > massConstraint)return StatusCode::FAILURE;
765 //
766 //---- pseudo tracks
767 //
768  int cnstNVP = pseudotracksInConstraint.size(); // number of pseudo-tracks in constraints
769  int NVP = cstate.m_cascadeVList[indexV].inPointingV.size(); // number of pseudo-tracks in chosen vertex
770  if( cnstNVP > NVP ) return StatusCode::FAILURE;
771 //-
772  for(ivc=0; ivc<cnstNVP; ivc++) {
773  int tmpV = indexInV(pseudotracksInConstraint[ivc], cstate); // index of vertex in cascade structure
774  if( tmpV< 0) return StatusCode::FAILURE; //pseudotrack in constraint doesn't correspond to any pseudotrack in vertex
775  tmpMcnst.pseudoInVrt.push_back( pseudotracksInConstraint[ivc] );
776  }
777 
778  cstate.m_partMassCnstForCascade.push_back(std::move(tmpMcnst));
779 
780  return StatusCode::SUCCESS;
781 }

◆ convertAmg5SymMtx()

bool Trk::TrkVKalVrtFitter::convertAmg5SymMtx ( const AmgSymMatrix(5) *  AmgMtx,
double  stdSymMtx[15] 
) const
private

Definition at line 26 of file VKalTransform.cxx.

27  {
28  if(!AmgMtx) return false;
29  //----- Check perigee covarince matrix for safety
30  double DET=AmgMtx->determinant();
31  if( DET!=DET ) {
32  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<" NaN in Perigee covariance is detected! Stop fit."<<endmsg;
33  return false;
34  }
35  if( fabs(DET) < 1000.*std::numeric_limits<double>::min()) {
36  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Zero Perigee covariance DET is detected! Stop fit."<<endmsg;
37  return false;
38  }
39 //std::cout.setf(std::ios::scientific); std::cout<<"VKMINNUMB="<<std::numeric_limits<double>::min()<<", "<<DET<<'\n';
40  //---------------------------------------------------------
41  stdSymMtx[ 0] =(*AmgMtx)(0,0);
42  stdSymMtx[ 1] =(*AmgMtx)(1,0);
43  stdSymMtx[ 2] =(*AmgMtx)(1,1);
44  stdSymMtx[ 3] =(*AmgMtx)(2,0);
45  stdSymMtx[ 4] =(*AmgMtx)(2,1);
46  stdSymMtx[ 5] =(*AmgMtx)(2,2);
47  stdSymMtx[ 6] =(*AmgMtx)(3,0);
48  stdSymMtx[ 7] =(*AmgMtx)(3,1);
49  stdSymMtx[ 8] =(*AmgMtx)(3,2);
50  stdSymMtx[ 9] =(*AmgMtx)(3,3);
51  stdSymMtx[10] =(*AmgMtx)(4,0);
52  stdSymMtx[11] =(*AmgMtx)(4,1);
53  stdSymMtx[12] =(*AmgMtx)(4,2);
54  stdSymMtx[13] =(*AmgMtx)(4,3);
55  stdSymMtx[14] =(*AmgMtx)(4,4);
56  return true;
57  }

◆ CreatePerigee() [1/2]

std::unique_ptr< Perigee > Trk::TrkVKalVrtFitter::CreatePerigee ( const std::vector< double > &  VKPerigee,
const std::vector< double > &  VKCov,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 159 of file CvtPerigee.cxx.

162  {
163  assert(dynamic_cast<const State*> (&istate)!=nullptr);
164  State& state = static_cast<State&> (istate);
165  return CreatePerigee(0., 0., 0., VKPerigee, VKCov, state);
166  }

◆ CreatePerigee() [2/2]

std::unique_ptr< Perigee > Trk::TrkVKalVrtFitter::CreatePerigee ( double  Vx,
double  Vy,
double  Vz,
const std::vector< double > &  VKPerigee,
const std::vector< double > &  VKCov,
State state 
) const
private

!!! Change of sign !!!!

!!! Change of sign of charge!!!!

Definition at line 172 of file CvtPerigee.cxx.

176  {
177 
178  // ------ Magnetic field access
179  double fx = 0., fy = 0., BMAG_CUR = 0.;
180  state.m_fitField.getMagFld(vX,vY,vZ,fx,fy,BMAG_CUR);
181  if(std::abs(BMAG_CUR) < 0.01) BMAG_CUR=0.01; //safety
182 
183  double TrkP3 = 0., TrkP4 = 0., TrkP5 = 0.;
184  VKalToTrkTrack(BMAG_CUR, VKPerigee[2], VKPerigee[3], VKPerigee[4],
185  TrkP3, TrkP4, TrkP5);
186  double TrkP1 = -VKPerigee[0];
187  double TrkP2 = VKPerigee[1];
188  TrkP5 = -TrkP5;
190  AmgSymMatrix(5) CovMtx;
191  double Deriv[5][5],CovMtxOld[5][5];
192  for(int i=0; i<5; i++){
193  for(int j=0; j<5; j++){
194  Deriv[i][j]=0.;
195  CovMtxOld[i][j]=0.;
196  }
197  }
198  Deriv[0][0] = -1.;
199  Deriv[1][1] = 1.;
200  Deriv[2][3] = 1.;
201  Deriv[3][2] = 1.;
202  Deriv[4][2] = (std::cos(VKPerigee[2])/(m_CNVMAG*BMAG_CUR)) * VKPerigee[4];
203  Deriv[4][4] = -(std::sin(VKPerigee[2])/(m_CNVMAG*BMAG_CUR));
204 
205  CovMtxOld[0][0] = VKCov[0];
206  CovMtxOld[0][1] = CovMtxOld[1][0] = VKCov[1];
207  CovMtxOld[1][1] = VKCov[2];
208  CovMtxOld[0][2] = CovMtxOld[2][0] = VKCov[3];
209  CovMtxOld[1][2] = CovMtxOld[2][1] = VKCov[4];
210  CovMtxOld[2][2] = VKCov[5];
211  CovMtxOld[0][3] = CovMtxOld[3][0] = VKCov[6];
212  CovMtxOld[1][3] = CovMtxOld[3][1] = VKCov[7];
213  CovMtxOld[2][3] = CovMtxOld[3][2] = VKCov[8];
214  CovMtxOld[3][3] = VKCov[9];
215  CovMtxOld[0][4] = CovMtxOld[4][0] = VKCov[10];
216  CovMtxOld[1][4] = CovMtxOld[4][1] = VKCov[11];
217  CovMtxOld[2][4] = CovMtxOld[4][2] = VKCov[12];
218  CovMtxOld[3][4] = CovMtxOld[4][3] = VKCov[13];
219  CovMtxOld[4][4] = VKCov[14];
220 
221  for(int i=0; i<5; i++){
222  for(int j=i; j<5; j++){
223  double tmp=0.;
224  for(int ik=4; ik>=0; ik--){
225  if(Deriv[i][ik]==0.)continue;
226  for(int jk=4; jk>=0; jk--){
227  if(Deriv[j][jk]==0.)continue;
228  tmp += Deriv[i][ik]*CovMtxOld[ik][jk]*Deriv[j][jk];
229  }
230  }
231  CovMtx(i,j) = CovMtx(j,i)=tmp;
232  }
233  }
234 
235  auto surface = PerigeeSurface(Amg::Vector3D(state.m_refFrameX+vX,
236  state.m_refFrameY+vY,
237  state.m_refFrameZ+vZ));
238 
239  return std::make_unique<Perigee>(TrkP1, TrkP2, TrkP3, TrkP4, TrkP5,
240  surface,
241  std::move(CovMtx));
242  }

◆ CvtNeutralParameters()

StatusCode Trk::TrkVKalVrtFitter::CvtNeutralParameters ( const std::vector< const NeutralParameters * > &  InpTrk,
int &  ntrk,
State state 
) const
private

Definition at line 179 of file CvtParametersBase.cxx.

182  {
183 
184  std::vector<const NeutralParameters*>::const_iterator i_pbase;
185  AmgVector(5) VectPerig;
186  Amg::Vector3D perGlobalPos,perGlobalVrt;
187  const NeutralPerigee* mPerN = nullptr;
188  double CovVertTrk[15];
189  double tmp_refFrameX = 0, tmp_refFrameY = 0, tmp_refFrameZ = 0;
190  double rxyMin = 1000000.;
191 
192  //
193  // ----- Set reference frame to (0.,0.,0.) == ATLAS frame
194  // ----- Magnetic field is taken in reference point
195  //
196  state.m_refFrameX = state.m_refFrameY = state.m_refFrameZ = 0.;
197  state.m_fitField.setAtlasMagRefFrame(0., 0., 0.);
198 
199  if( m_InDetExtrapolator == nullptr ){
200  if(msgLvl(MSG::WARNING))msg()<< "No InDet extrapolator given. Can't use TrackParameters!!!" << endmsg;
201  return StatusCode::FAILURE;
202  }
203 
204  //
205  // Cycle to determine common reference point for the fit
206  //
207  int counter = 0;
208  state.m_trkControl.clear();
209  state.m_trkControl.reserve(InpTrk.size());
210  for (i_pbase = InpTrk.begin(); i_pbase != InpTrk.end(); ++i_pbase) {
211  // Global position of hit
212  perGlobalPos = (*i_pbase)->position();
213  // Crazy user protection
214  if(std::abs(perGlobalPos.z()) > m_IDsizeZ) return StatusCode::FAILURE;
215  if(perGlobalPos.perp() > m_IDsizeR)return StatusCode::FAILURE;
216 
217  tmp_refFrameX += perGlobalPos.x() ;
218  tmp_refFrameY += perGlobalPos.y() ;
219  tmp_refFrameZ += perGlobalPos.z() ;
220 
221  // Here we create structure to control material effects
222  TrkMatControl tmpMat;
223  tmpMat.trkSavedLocalVertex.setZero();
224  // on track extrapolation
225  tmpMat.trkRefGlobPos = Amg::Vector3D(perGlobalPos.x(), perGlobalPos.y(), perGlobalPos.z());
226  // First measured point strategy
227  tmpMat.extrapolationType = 0;
228  //No reference point for neutral track for the moment !!!
229  tmpMat.TrkPnt = nullptr;
230  tmpMat.prtMass = 139.5702;
231  if(counter<(int)state.m_MassInputParticles.size()){
232  tmpMat.prtMass = state.m_MassInputParticles[counter];
233  }
234  tmpMat.TrkID = counter;
235  state.m_trkControl.push_back(tmpMat);
236  counter++;
237  if(perGlobalPos.perp()<rxyMin){
238  rxyMin = perGlobalPos.perp();
239  state.m_globalFirstHit=nullptr;
240  }
241  }
242 
243  if(counter == 0) return StatusCode::FAILURE;
244  // Reference frame for the fit based on hits positions
245  tmp_refFrameX /= counter;
246  tmp_refFrameY /= counter;
247  tmp_refFrameZ /= counter;
248  Amg::Vector3D refGVertex (tmp_refFrameX, tmp_refFrameY, tmp_refFrameZ);
249 
250  // Rotation parameters in case of rotation use
251  double fx,fy,fz,BMAG_FIXED;
252  state.m_fitField.getMagFld(tmp_refFrameX, tmp_refFrameY, tmp_refFrameZ,
253  fx, fy, fz);
254 
255  //
256  // Common reference frame is ready. Start extraction of parameters for fit.
257  // TracksParameters are extrapolated to common point and converted to Perigee
258  // This is needed for VKalVrtCore engine.
259  //
260 
261  for (i_pbase = InpTrk.begin(); i_pbase != InpTrk.end(); ++i_pbase) {
262  const Trk::NeutralParameters* neuparO = (*i_pbase);
263  if(neuparO == nullptr) return StatusCode::FAILURE;
264  const Trk::NeutralParameters* neuparN = m_fitPropagator->myExtrapNeutral(neuparO, &refGVertex);
265  mPerN = dynamic_cast<const Trk::NeutralPerigee*>(neuparN);
266  if(mPerN == nullptr) {
267  delete neuparN;
268  return StatusCode::FAILURE;
269  }
270 
271  VectPerig = mPerN->parameters();
272  // Global position of perigee point
273  perGlobalPos = mPerN->position();
274  // Global position of reference point
275  perGlobalVrt = mPerN->associatedSurface().center();
276  // VK no good covariance matrix!
277  if( !convertAmg5SymMtx(mPerN->covariance(), CovVertTrk) ) return StatusCode::FAILURE;
278  delete neuparN;
279 
280  state.m_refFrameX = state.m_refFrameY = state.m_refFrameZ = 0.;
281  // restore ATLAS frame for safety
282  state.m_fitField.setAtlasMagRefFrame( 0., 0., 0.);
283  // Magnetic field at perigee point
284  state.m_fitField.getMagFld(perGlobalPos.x(), perGlobalPos.y(), perGlobalPos.z(),
285  fx, fy, BMAG_FIXED);
286  if(std::abs(BMAG_FIXED) < 0.01) BMAG_FIXED = 0.01;
287 
288  VKalTransform(BMAG_FIXED,
289  (double)VectPerig[0], (double)VectPerig[1],
290  (double)VectPerig[2], (double)VectPerig[3],
291  (double)VectPerig[4], CovVertTrk,
292  state.m_ich[ntrk], &state.m_apar[ntrk][0],
293  &state.m_awgt[ntrk][0]);
294 
295  state.m_ich[ntrk]=0;
296  if(state.m_apar[ntrk][4]<0){
297  // Charge=0 is always equal to Charge=+1
298  state.m_apar[ntrk][4] = -state.m_apar[ntrk][4];
299  state.m_awgt[ntrk][10] = -state.m_awgt[ntrk][10];
300  state.m_awgt[ntrk][11] = -state.m_awgt[ntrk][11];
301  state.m_awgt[ntrk][12] = -state.m_awgt[ntrk][12];
302  state.m_awgt[ntrk][13] = -state.m_awgt[ntrk][13];
303  }
304  ntrk++;
305  if(ntrk>=NTrMaxVFit) return StatusCode::FAILURE;
306  }
307 
308  //-------------- Finally setting new reference frame common for ALL tracks
309  state.m_refFrameX = tmp_refFrameX;
310  state.m_refFrameY = tmp_refFrameY;
311  state.m_refFrameZ = tmp_refFrameZ;
312  state.m_fitField.setAtlasMagRefFrame(state.m_refFrameX, state.m_refFrameY, state.m_refFrameZ);
313 
314  return StatusCode::SUCCESS;
315  }

◆ CvtNeutralParticle()

StatusCode Trk::TrkVKalVrtFitter::CvtNeutralParticle ( const std::vector< const xAOD::NeutralParticle * > &  list,
int &  ntrk,
State state 
) const
private

Definition at line 124 of file CvtTrackParticle.cxx.

127  {
128  std::vector<const xAOD::NeutralParticle*>::const_iterator i_ntrk;
129  AmgVector(5) VectPerig; VectPerig.setZero();
130  const NeutralPerigee* mPer=nullptr;
131  double CovVertTrk[15]; std::fill(CovVertTrk,CovVertTrk+15,0.);
132  double tmp_refFrameX=0, tmp_refFrameY=0, tmp_refFrameZ=0;
133  double fx,fy,BMAG_FIXED;
134 //
135 // ----- Set reference frame to (0.,0.,0.) == ATLAS frame
136 // ----- Magnetic field is taken in reference point
137 //
138  state.m_refFrameX=state.m_refFrameY=state.m_refFrameZ=0.;
139  state.m_fitField.setAtlasMagRefFrame( 0., 0., 0.);
140 //
141 // Cycle to determine common reference point for the fit
142 //
143  int counter =0;
144  Amg::Vector3D perGlobalPos;
145  state.m_trkControl.clear(); state.m_trkControl.reserve(InpTrk.size());
146  for (i_ntrk = InpTrk.begin(); i_ntrk != InpTrk.end(); ++i_ntrk) {
147 //-- (Measured)Perigee in xAOD::NeutralParticle
148  mPer = &(*i_ntrk)->perigeeParameters();
149  if( mPer==nullptr ) continue; // No perigee!!!
150  perGlobalPos = mPer->position(); //Global position of perigee point
151  if(fabs(perGlobalPos.z()) > m_IDsizeZ)return StatusCode::FAILURE; // Crazy user protection
152  if( perGlobalPos.perp() > m_IDsizeR)return StatusCode::FAILURE;
153  tmp_refFrameX += perGlobalPos.x() ; // Reference system calculation
154  tmp_refFrameY += perGlobalPos.y() ; // Use hit position itself to get more precise
155  tmp_refFrameZ += perGlobalPos.z() ; // magnetic field
156  TrkMatControl tmpMat;
157  tmpMat.trkSavedLocalVertex.setZero();
158  tmpMat.trkRefGlobPos=Amg::Vector3D( perGlobalPos.x(), perGlobalPos.y(), perGlobalPos.z());
159  tmpMat.extrapolationType=2; // Perigee point strategy
160  tmpMat.TrkPnt=nullptr; //No reference point for neutral particle for the moment
161  tmpMat.prtMass = 139.5702;
162  if(counter<(int)state.m_MassInputParticles.size())tmpMat.prtMass = state.m_MassInputParticles[counter];
163  tmpMat.TrkID=counter; state.m_trkControl.push_back(tmpMat);
164  counter++;
165  }
166  if(counter == 0) return StatusCode::FAILURE;
167  tmp_refFrameX /= counter; // Reference frame for the fit
168  tmp_refFrameY /= counter;
169  tmp_refFrameZ /= counter;
170  Amg::Vector3D refGVertex (tmp_refFrameX, tmp_refFrameY, tmp_refFrameZ);
171  PerigeeSurface surfGRefPoint( refGVertex ); // Reference perigee surface for current fit
172 //
173 //std::cout.setf( std::ios::scientific); std::cout.precision(5);
174 //std::cout<<" VK ref.frame="<<tmp_refFrameX<<", "<<tmp_refFrameY<<", "<<tmp_refFrameZ<<'\n';
175 //
176 // Common reference frame is ready. Start extraction of parameters for fit.
177 //
178 
179  state.m_refFrameX=state.m_refFrameY=state.m_refFrameZ=0.; //set ATLAS frame
180  state.m_fitField.setAtlasMagRefFrame( 0., 0., 0.); //set ATLAS frame
181  for (i_ntrk = InpTrk.begin(); i_ntrk != InpTrk.end(); ++i_ntrk) {
182 //
183 //-- (Measured)Perigee in TrackParticle
184 //
185  mPer = &(*i_ntrk)->perigeeParameters();
186  if( mPer==nullptr ) continue; // No perigee!!!
187  perGlobalPos = mPer->position(); //Global position of perigee point
188  if( !convertAmg5SymMtx(mPer->covariance(), CovVertTrk) ) return StatusCode::FAILURE; //VK no good covariance matrix!;
189  state.m_fitField.getMagFld( perGlobalPos.x(), perGlobalPos.y(), perGlobalPos.z(), // Magnetic field
190  fx, fy, BMAG_FIXED); // at track perigee point
191  if(fabs(BMAG_FIXED) < 0.01) BMAG_FIXED=0.01;
192 
193 //
194 //--- Move ref. frame to the track common point refGVertex
195 // Small beamline inclination doesn't change track covariance matrix
196 //
197  AmgSymMatrix(5) tmpCov = AmgSymMatrix(5)(*(mPer->covariance()));
198  const Perigee tmpPer(mPer->position(),mPer->momentum(),mPer->charge(),surfGRefPoint,std::move(tmpCov));
199  VectPerig = tmpPer.parameters();
200  //--- Transform to internal parametrisation
201  VKalTransform( BMAG_FIXED, (double)VectPerig[0], (double)VectPerig[1],
202  (double)VectPerig[2], (double)VectPerig[3], (double)VectPerig[4], CovVertTrk,
203  state.m_ich[ntrk],&state.m_apar[ntrk][0],&state.m_awgt[ntrk][0]);
204  state.m_ich[ntrk]=0;
205  if(state.m_apar[ntrk][4]<0){ state.m_apar[ntrk][4] = -state.m_apar[ntrk][4]; // Charge=0 is always equal to Charge=+1
206  state.m_awgt[ntrk][10] = -state.m_awgt[ntrk][10];
207  state.m_awgt[ntrk][11] = -state.m_awgt[ntrk][11];
208  state.m_awgt[ntrk][12] = -state.m_awgt[ntrk][12];
209  state.m_awgt[ntrk][13] = -state.m_awgt[ntrk][13]; }
210 
211  ntrk++;
212  if(ntrk>=NTrMaxVFit) {
213  return StatusCode::FAILURE;
214  }
215  }
216 //-------------- Finally setting new reference frame common for ALL tracks
217  state.m_refFrameX=tmp_refFrameX;
218  state.m_refFrameY=tmp_refFrameY;
219  state.m_refFrameZ=tmp_refFrameZ;
220  state.m_fitField.setAtlasMagRefFrame( state.m_refFrameX, state.m_refFrameY, state.m_refFrameZ);
221  return StatusCode::SUCCESS;
222  }

◆ CvtPerigee()

StatusCode Trk::TrkVKalVrtFitter::CvtPerigee ( const std::vector< const Perigee * > &  list,
int &  ntrk,
State state 
) const
private

Definition at line 25 of file CvtPerigee.cxx.

28  {
29 
30  double tmp_refFrameX = 0, tmp_refFrameY = 0, tmp_refFrameZ = 0;
31 
32  //
33  // ----- Set reference frame to (0.,0.,0.) == ATLAS frame
34  // ----- Magnetic field is taken in reference point
35  //
36  state.m_refFrameX = state.m_refFrameY = state.m_refFrameZ = 0.;
37  state.m_fitField.setAtlasMagRefFrame( 0., 0., 0.);
38 
39  //
40  // Cycle to determine common reference point for the fit
41  //
42  int counter =0;
43  state.m_trkControl.clear();
44  for (const auto& mPer : InpPerigee) {
45  if( mPer == nullptr ){ continue; }
46 
47  // Global position of perigee point
48  Amg::Vector3D perGlobalPos = mPer->position();
49  // Crazy user protection
50  if(std::abs(perGlobalPos.z()) > m_IDsizeZ) return StatusCode::FAILURE;
51  if(perGlobalPos.perp() > m_IDsizeR) return StatusCode::FAILURE;
52 
53  // Reference system calculation
54  // Use hit position itself to get more precise magnetic field
55  tmp_refFrameX += perGlobalPos.x() ;
56  tmp_refFrameY += perGlobalPos.y() ;
57  tmp_refFrameZ += perGlobalPos.z() ;
58 
59  TrkMatControl tmpMat;
60  tmpMat.trkRefGlobPos = Amg::Vector3D(perGlobalPos.x(),
61  perGlobalPos.y(),
62  perGlobalPos.z());
63  // Perigee point strategy
64  tmpMat.extrapolationType = 2;
65  tmpMat.TrkPnt = mPer;
66  tmpMat.prtMass = 139.5702;
67  if(counter < static_cast<int>(state.m_MassInputParticles.size())){
68  tmpMat.prtMass = state.m_MassInputParticles[counter];
69  }
70  tmpMat.trkSavedLocalVertex.setZero();
71  tmpMat.TrkID=counter;
72  state.m_trkControl.push_back(tmpMat);
73  counter++;
74  }
75 
76  if(counter == 0) return StatusCode::FAILURE;
77 
78  // Reference frame for the fit
79  tmp_refFrameX /= counter;
80  tmp_refFrameY /= counter;
81  tmp_refFrameZ /= counter;
82 
83  //
84  // Common reference frame is ready. Start extraction of parameters for fit.
85  //
86  double fx = 0., fy = 0., BMAG_FIXED = 0.;
87  for (const auto& mPer : InpPerigee) {
88  if(mPer == nullptr){ continue; }
89  AmgVector(5) VectPerig = mPer->parameters();
90  // Global position of perigee point
91  Amg::Vector3D perGlobalPos = mPer->position();
92  // Global position of reference point
93  Amg::Vector3D perGlobalVrt = mPer->associatedSurface().center();
94  // Restore ATLAS frame
95  state.m_refFrameX = state.m_refFrameY = state.m_refFrameZ = 0.;
96  state.m_fitField.setAtlasMagRefFrame(0., 0., 0.);
97  // Magnetic field at perigee point
98  state.m_fitField.getMagFld(perGlobalPos.x(),
99  perGlobalPos.y(),
100  perGlobalPos.z(),
101  fx, fy, BMAG_FIXED);
102  if(std::abs(BMAG_FIXED) < 0.01) BMAG_FIXED = 0.01;
103 
104  double CovVertTrk[15];
105  std::fill(CovVertTrk,CovVertTrk+15,0.);
106  // No good covariance matrix!
107  if(!convertAmg5SymMtx(mPer->covariance(), CovVertTrk)) return StatusCode::FAILURE;
108  VKalTransform(BMAG_FIXED,
109  static_cast<double>(VectPerig(0)),
110  static_cast<double>(VectPerig(1)),
111  static_cast<double>(VectPerig(2)),
112  static_cast<double>(VectPerig(3)),
113  static_cast<double>(VectPerig(4)),
114  CovVertTrk,
115  state.m_ich[ntrk], &state.m_apar[ntrk][0],
116  &state.m_awgt[ntrk][0]);
117 
118  // Check if propagation to common reference point is needed and make it
119  // initial track reference position
120  state.m_refFrameX=perGlobalVrt.x();
121  state.m_refFrameY=perGlobalVrt.y();
122  state.m_refFrameZ=perGlobalVrt.z();
123  state.m_fitField.setAtlasMagRefFrame(state.m_refFrameX,
124  state.m_refFrameY,
125  state.m_refFrameZ);
126  double dX = tmp_refFrameX-perGlobalVrt.x();
127  double dY = tmp_refFrameY-perGlobalVrt.y();
128  double dZ = tmp_refFrameZ-perGlobalVrt.z();
129  if(std::abs(dX)+std::abs(dY)+std::abs(dZ) != 0.) {
130  double pari[5], covi[15];
131  double vrtini[3] = {0.,0.,0.};
132  double vrtend[3] = {dX,dY,dZ};
133  for(int i=0; i<5; i++) pari[i] = state.m_apar[ntrk][i];
134  for(int i=0; i<15;i++) covi[i] = state.m_awgt[ntrk][i];
135  long int Charge = (long int) mPer->charge();
136  long int TrkID = ntrk;
137  Trk::vkalPropagator::Propagate(TrkID, Charge, pari, covi,
138  vrtini, vrtend, &state.m_apar[ntrk][0],
139  &state.m_awgt[ntrk][0],
140  &state.m_vkalFitControl);
141  }
142 
143  ntrk++;
144  if(ntrk>=NTrMaxVFit) return StatusCode::FAILURE;
145  }
146 
147  //-------------- Finally setting new reference frame common for ALL tracks
148  state.m_refFrameX = tmp_refFrameX;
149  state.m_refFrameY = tmp_refFrameY;
150  state.m_refFrameZ = tmp_refFrameZ;
151  state.m_fitField.setAtlasMagRefFrame(state.m_refFrameX,
152  state.m_refFrameY,
153  state.m_refFrameZ);
154 
155  return StatusCode::SUCCESS;
156  }

◆ CvtTrackParameters()

StatusCode Trk::TrkVKalVrtFitter::CvtTrackParameters ( const std::vector< const TrackParameters * > &  InpTrk,
int &  ntrk,
State state 
) const
private

Definition at line 24 of file CvtParametersBase.cxx.

27  {
28 
29  std::vector<const TrackParameters*>::const_iterator i_pbase;
30  AmgVector(5) VectPerig;
31  VectPerig.setZero();
32  Amg::Vector3D perGlobalPos,perGlobalVrt;
33  const Trk::Perigee* mPer=nullptr;
34 
35  double tmp_refFrameX = 0, tmp_refFrameY = 0, tmp_refFrameZ = 0;
36  double rxyMin = 1000000.;
37 
38  //
39  // ----- Set reference frame to (0.,0.,0.) == ATLAS frame
40  // ----- Magnetic field is taken in reference point
41  //
42  state.m_refFrameX=state.m_refFrameY=state.m_refFrameZ=0.;
43  state.m_fitField.setAtlasMagRefFrame( 0., 0., 0.);
44 
45  if( m_InDetExtrapolator == nullptr ){
46  if(msgLvl(MSG::WARNING))msg()<< "No InDet extrapolator given. Can't use TrackParameters!!!" << endmsg;
47  return StatusCode::FAILURE;
48  }
49 
50  //
51  // Cycle to determine common reference point for the fit
52  //
53  int counter =0;
54  state.m_trkControl.clear();
55  state.m_trkControl.reserve(InpTrk.size());
56  for (i_pbase = InpTrk.begin(); i_pbase != InpTrk.end(); ++i_pbase) {
57  // Global position of hit
58  perGlobalPos = (*i_pbase)->position();
59  // Crazy user protection
60  if(std::abs(perGlobalPos.z()) > m_IDsizeZ) return StatusCode::FAILURE;
61  if(perGlobalPos.perp() > m_IDsizeR) return StatusCode::FAILURE;
62  tmp_refFrameX += perGlobalPos.x();
63  tmp_refFrameY += perGlobalPos.y();
64  tmp_refFrameZ += perGlobalPos.z();
65 
66  // Here we create structure to control material effects
67  TrkMatControl tmpMat;
68  tmpMat.trkSavedLocalVertex.setZero();
69  tmpMat.trkRefGlobPos = Amg::Vector3D(perGlobalPos.x(),
70  perGlobalPos.y(),
71  perGlobalPos.z());
72  // First measured point strategy
73  tmpMat.extrapolationType = m_firstMeasuredPoint ? 0 : 1;
74  tmpMat.TrkPnt = (*i_pbase);
75  tmpMat.prtMass = 139.5702;
76  if(counter < (int)state.m_MassInputParticles.size()){
77  tmpMat.prtMass = state.m_MassInputParticles[counter];
78  }
79  tmpMat.TrkID = counter;
80  state.m_trkControl.push_back(tmpMat);
81  counter++;
82 
83  if(perGlobalPos.perp() < rxyMin){
84  rxyMin=perGlobalPos.perp();
85  state.m_globalFirstHit=(*i_pbase);
86  }
87  }
88 
89  if(counter == 0) return StatusCode::FAILURE;
90  // Reference frame for the fit based on hits positions
91  tmp_refFrameX /= counter;
92  tmp_refFrameY /= counter;
93  tmp_refFrameZ /= counter;
94  Amg::Vector3D refGVertex(tmp_refFrameX, tmp_refFrameY, tmp_refFrameZ);
95 
96  //Rotation parameters in case of rotation use
97  double fx, fy, fz, BMAG_FIXED;
98  state.m_fitField.getMagFld(tmp_refFrameX, tmp_refFrameY, tmp_refFrameZ,
99  fx, fy, fz);
100 
101  //
102  // Common reference frame is ready. Start extraction of parameters for fit.
103  // TracksParameters are extrapolated to common point and converted to Perigee
104  // This is needed for VKalVrtCore engine.
105  //
106 
107  double CovVertTrk[15];
108  std::fill(CovVertTrk, CovVertTrk+15, 0.);
109 
110  for (i_pbase = InpTrk.begin(); i_pbase != InpTrk.end(); ++i_pbase) {
111  long int TrkID=ntrk;
112  const TrackParameters* trkparO = (*i_pbase);
113 
114  if(trkparO){
115  const Trk::TrackParameters* trkparN =
117  trkparO,
118  &refGVertex,
119  state);
120  if(trkparN == nullptr) return StatusCode::FAILURE;
121  mPer = dynamic_cast<const Trk::Perigee*>(trkparN);
122  if(mPer == nullptr) {
123  delete trkparN;
124  return StatusCode::FAILURE;
125  }
126 
127  VectPerig = mPer->parameters();
128  // Global position of perigee point
129  perGlobalPos = mPer->position();
130  // Global position of reference point
131  perGlobalVrt = mPer->associatedSurface().center();
132  // VK no good covariance matrix!
133  if( !convertAmg5SymMtx(mPer->covariance(), CovVertTrk) ) return StatusCode::FAILURE;
134  delete trkparN;
135  }
136 
137  state.m_refFrameX = state.m_refFrameY = state.m_refFrameZ = 0.;
138  // Restore ATLAS frame for safety
139  state.m_fitField.setAtlasMagRefFrame(0., 0., 0.);
140  // Magnetic field at perigee point
141  state.m_fitField.getMagFld(perGlobalPos.x(), perGlobalPos.y(), perGlobalPos.z(),
142  fx, fy, BMAG_FIXED);
143  if(std::abs(BMAG_FIXED) < 0.01) BMAG_FIXED = 0.01;
144 
145  VKalTransform(BMAG_FIXED,
146  (double)VectPerig[0], (double)VectPerig[1],
147  (double)VectPerig[2], (double)VectPerig[3],
148  (double)VectPerig[4], CovVertTrk,
149  state.m_ich[ntrk], &state.m_apar[ntrk][0],
150  &state.m_awgt[ntrk][0]);
151 
152  // Neutral track
153  if( trkparO==nullptr ) {
154  state.m_ich[ntrk]=0;
155  if(state.m_apar[ntrk][4]<0){
156  // Charge=0 is always equal to Charge=+1
157  state.m_apar[ntrk][4] = -state.m_apar[ntrk][4];
158  state.m_awgt[ntrk][10] = -state.m_awgt[ntrk][10];
159  state.m_awgt[ntrk][11] = -state.m_awgt[ntrk][11];
160  state.m_awgt[ntrk][12] = -state.m_awgt[ntrk][12];
161  state.m_awgt[ntrk][13] = -state.m_awgt[ntrk][13];
162  }
163  }
164  ntrk++;
165  if(ntrk>=NTrMaxVFit) return StatusCode::FAILURE;
166  }
167 
168  //-------------- Finally setting new reference frame common for ALL tracks
169  state.m_refFrameX = tmp_refFrameX;
170  state.m_refFrameY = tmp_refFrameY;
171  state.m_refFrameZ = tmp_refFrameZ;
172  state.m_fitField.setAtlasMagRefFrame(state.m_refFrameX, state.m_refFrameY, state.m_refFrameZ);
173 
174  return StatusCode::SUCCESS;
175  }

◆ CvtTrackParticle()

StatusCode Trk::TrkVKalVrtFitter::CvtTrackParticle ( std::span< const xAOD::TrackParticle *const list,
int &  ntrk,
State state 
) const
private

Definition at line 27 of file CvtTrackParticle.cxx.

30  {
31 
32  AmgVector(5) VectPerig; VectPerig.setZero();
33  const Trk::Perigee* mPer=nullptr;
34  double CovVertTrk[15]; std::fill(CovVertTrk,CovVertTrk+15,0.);
35  double tmp_refFrameX=0, tmp_refFrameY=0, tmp_refFrameZ=0;
36  double fx,fy,BMAG_FIXED;
37 //
38 // ----- Set reference frame to (0.,0.,0.) == ATLAS frame
39 // ----- Magnetic field is taken in reference point
40 //
41  state.m_refFrameX=state.m_refFrameY=state.m_refFrameZ=0.;
42  state.m_fitField.setAtlasMagRefFrame( 0., 0., 0.);
43 //
44 // Cycle to determine common reference point for the fit
45 //
46  int counter =0;
47  Amg::Vector3D perGlobalPos;
48  state.m_trkControl.clear(); state.m_trkControl.reserve(InpTrk.size());
49  for (auto i_ntrk = InpTrk.begin(); i_ntrk != InpTrk.end(); ++i_ntrk) {
50 //-- (Measured)Perigee in xAOD::TrackParticle
51  mPer = &(*i_ntrk)->perigeeParameters();
52  if( mPer==nullptr ) continue; // No perigee!!!
53  perGlobalPos = mPer->position(); //Global position of perigee point
54  if(fabs(perGlobalPos.z()) > m_IDsizeZ)return StatusCode::FAILURE; // Crazy user protection
55  if( perGlobalPos.perp() > m_IDsizeR)return StatusCode::FAILURE;
56  tmp_refFrameX += perGlobalPos.x() ; // Reference system calculation
57  tmp_refFrameY += perGlobalPos.y() ; // Use hit position itself to get more precise
58  tmp_refFrameZ += perGlobalPos.z() ; // magnetic field
59  TrkMatControl tmpMat;
60  tmpMat.trkSavedLocalVertex.setZero();
61  tmpMat.trkRefGlobPos=Amg::Vector3D( perGlobalPos.x(), perGlobalPos.y(), perGlobalPos.z());
62  tmpMat.extrapolationType=2; // Perigee point strategy
63  tmpMat.TrkPnt=mPer;
64  tmpMat.prtMass = 139.5702;
65  if(counter<(int)state.m_MassInputParticles.size())tmpMat.prtMass = state.m_MassInputParticles[counter];
66  tmpMat.TrkID=counter; state.m_trkControl.push_back(tmpMat);
67  counter++;
68  }
69  if(counter == 0) return StatusCode::FAILURE;
70  tmp_refFrameX /= counter; // Reference frame for the fit
71  tmp_refFrameY /= counter;
72  tmp_refFrameZ /= counter;
73  Amg::Vector3D refGVertex (tmp_refFrameX, tmp_refFrameY, tmp_refFrameZ);
74 
75  PerigeeSurface surfGRefPoint( refGVertex ); // Reference perigee surface for current fit
76 //
77 //std::cout.setf( std::ios::scientific); std::cout.precision(9);
78 //std::cout<<" VK ref.frame="<<tmp_refFrameX<<", "<<tmp_refFrameY<<", "<<tmp_refFrameZ<<'\n';
79 //
80 // Common reference frame is ready. Start extraction of parameters for fit.
81 //
82 
83  for (auto i_ntrk = InpTrk.begin(); i_ntrk != InpTrk.end(); ++i_ntrk) {
84 //
85 //-- (Measured)Perigee in TrackParticle
86 //
87  mPer = &(*i_ntrk)->perigeeParameters();
88  if( mPer==nullptr ) continue; // No perigee!!!
89  perGlobalPos = mPer->position(); //Global position of perigee point
90  if( !convertAmg5SymMtx(mPer->covariance(), CovVertTrk) ) return StatusCode::FAILURE; //VK no good covariance matrix!;
91  state.m_fitField.getMagFld( perGlobalPos.x(), perGlobalPos.y(), perGlobalPos.z(), // Magnetic field
92  fx, fy, BMAG_FIXED); // at the track perigee point
93  if(fabs(BMAG_FIXED) < 0.01) BMAG_FIXED=0.01;
94 //
95 //--- Move ref. frame to the track common point refGVertex
96 // Small beamline inclination doesn't change track covariance matrix
97  AmgSymMatrix(5) tmpCov = AmgSymMatrix(5)(*(mPer->covariance()));
98  const Perigee tmpPer(mPer->position(),mPer->momentum(),mPer->charge(),surfGRefPoint,std::move(tmpCov));
99  VectPerig = tmpPer.parameters();
100 //--- Transform to internal parametrisation
101  VKalTransform( BMAG_FIXED, (double)VectPerig[0], (double)VectPerig[1],
102  (double)VectPerig[2], (double)VectPerig[3], (double)VectPerig[4], CovVertTrk,
103  state.m_ich[ntrk],&state.m_apar[ntrk][0],&state.m_awgt[ntrk][0]);
104 //
105  ntrk++;
106  if(ntrk>=NTrMaxVFit) {
107  return StatusCode::FAILURE;
108  }
109  }
110 //-------------- Finally setting new reference frame common for ALL tracks
111  state.m_refFrameX=tmp_refFrameX;
112  state.m_refFrameY=tmp_refFrameY;
113  state.m_refFrameZ=tmp_refFrameZ;
114  state.m_fitField.setAtlasMagRefFrame( state.m_refFrameX, state.m_refFrameY, state.m_refFrameZ);
115 
116  return StatusCode::SUCCESS;
117  }

◆ FillMatrixP() [1/2]

void Trk::TrkVKalVrtFitter::FillMatrixP ( AmgSymMatrix(5)&  CovMtx,
std::vector< double > &  Matrix 
)
staticprivate

Definition at line 672 of file TrkVKalVrtFitter.cxx.

673 {
674  CovMtx.setIdentity();
675  if( Matrix.size() < 21) return;
676  CovMtx(0,0) = 0;
677  CovMtx(1,1) = 0;
678  CovMtx(2,2)= Matrix[ 9];
679  CovMtx.fillSymmetric(2,3,Matrix[13]);
680  CovMtx(3,3)= Matrix[14];
681  CovMtx.fillSymmetric(2,4,Matrix[18]);
682  CovMtx.fillSymmetric(3,4,Matrix[19]);
683  CovMtx(4,4)= Matrix[20];
684 }

◆ FillMatrixP() [2/2]

void Trk::TrkVKalVrtFitter::FillMatrixP ( int  iTrk,
AmgSymMatrix(5)&  CovMtx,
std::vector< double > &  Matrix 
)
staticprivate

Definition at line 687 of file TrkVKalVrtFitter.cxx.

688 {
689  int iTmp=(iTrk+1)*3;
690  int NContent = Matrix.size();
691  CovMtx.setIdentity(); //Clean matrix for the beginning, then fill needed elements
692  CovMtx(0,0) = 0;
693  CovMtx(1,1) = 0;
694  int pnt = (iTmp+1)*iTmp/2 + iTmp; if( pnt > NContent ) return;
695  CovMtx(2,2) = Matrix[pnt];
696  pnt = (iTmp+1+1)*(iTmp+1)/2 + iTmp; if( pnt+1 > NContent ){ CovMtx.setIdentity(); return; }
697  CovMtx.fillSymmetric(2,3,Matrix[pnt]);
698  CovMtx(3,3) = Matrix[pnt+1];
699  pnt = (iTmp+2+1)*(iTmp+2)/2 + iTmp; if( pnt+2 > NContent ){ CovMtx.setIdentity(); return; }
700  CovMtx.fillSymmetric(2,4,Matrix[pnt]);
701  CovMtx.fillSymmetric(3,4,Matrix[pnt+1]);
702  CovMtx(4,4) = Matrix[pnt+2];
703 }

◆ finalize()

StatusCode Trk::TrkVKalVrtFitter::finalize ( )
finaloverridevirtual

Definition at line 125 of file TrkVKalVrtFitter.cxx.

126 {
127  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) <<"TrkVKalVrtFitter finalize() successful" << endmsg;
128  return StatusCode::SUCCESS;
129 }

◆ findPositions()

int Trk::TrkVKalVrtFitter::findPositions ( const std::vector< int > &  inputList,
const std::vector< int > &  refList,
std::vector< int > &  index 
)
staticprivate

Definition at line 787 of file TrkCascadeFitter.cxx.

788 {
789  int R,I;
790  index.clear();
791  int nI=inputList.size(); if(nI==0) return 0; //all ok
792  int nR=refList.size(); if(nR==0) return 0; //all ok
793  //std::cout<<"inp="; for(I=0; I<nI; I++)std::cout<<inputList[I]; std::cout<<'\n';
794  //std::cout<<"ref="; for(R=0; R<nR; R++)std::cout<<refList[R]; std::cout<<'\n';
795  for(I=0; I<nI; I++){
796  for(R=0; R<nR; R++) if(inputList[I]==refList[R]){index.push_back(R); break;}
797  if(R==nR) return -1; //input element not found in reference list
798  }
799  return 0;
800 }

◆ fit() [1/12]

std::unique_ptr< xAOD::Vertex > Trk::TrkVKalVrtFitter::fit ( const EventContext &  ctx,
const std::vector< const xAOD::TrackParticle * > &  vectorTrk,
const Amg::Vector3D startingPoint 
) const
finaloverridevirtual

Interface for xAOD::TrackParticle with starting point Implements the new style (unique_ptr,EventContext)

Definition at line 423 of file TrkVKalVrtFitter.cxx.

426 {
427  State state;
428  initState(ctx, state);
429  return std::unique_ptr<xAOD::Vertex>(fit(xtpListC, startingPoint, state));
430 }

◆ fit() [2/12]

xAOD::Vertex * Trk::TrkVKalVrtFitter::fit ( const std::vector< const TrackParameters * > &  perigeeListC) const
finaloverridevirtual

Definition at line 615 of file TrkVKalVrtFitter.cxx.

616 {
617  State state;
618  initState (state);
619  Amg::Vector3D VertexIni(0.,0.,0.);
620  StatusCode sc=VKalVrtFitFast(perigeeListC, VertexIni, state);
621  if( sc.isSuccess()) setApproximateVertex(VertexIni.x(),VertexIni.y(),VertexIni.z(),state);
622  std::vector<const NeutralParameters*> perigeeListN(0);
624  TLorentzVector Momentum;
625  long int Charge;
626  std::vector<double> ErrorMatrix;
627  std::vector<double> Chi2PerTrk;
628  std::vector< std::vector<double> > TrkAtVrt;
629  double Chi2;
630  sc=VKalVrtFit( perigeeListC, perigeeListN,
631  Vertex, Momentum, Charge, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, true );
632 
633  xAOD::Vertex * tmpVertex = nullptr;
634  if(sc.isSuccess()) {
635  tmpVertex = makeXAODVertex( 0, Vertex, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state );
636  }
637  return tmpVertex;
638 }

◆ fit() [3/12]

xAOD::Vertex * Trk::TrkVKalVrtFitter::fit ( const std::vector< const TrackParameters * > &  perigeeListC,
const std::vector< const Trk::NeutralParameters * > &  perigeeListN 
) const
finaloverridevirtual

Definition at line 640 of file TrkVKalVrtFitter.cxx.

642 {
643  State state;
644  initState (state);
645  Amg::Vector3D VertexIni(0.,0.,0.);
646  StatusCode sc=VKalVrtFitFast(perigeeListC, VertexIni, state);
647  if( sc.isSuccess()) setApproximateVertex(VertexIni.x(),VertexIni.y(),VertexIni.z(),state);
649  TLorentzVector Momentum;
650  long int Charge;
651  std::vector<double> ErrorMatrix;
652  std::vector<double> Chi2PerTrk;
653  std::vector< std::vector<double> > TrkAtVrt;
654  double Chi2;
655  sc=VKalVrtFit( perigeeListC, perigeeListN,
656  Vertex, Momentum, Charge, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, true );
657 
658  xAOD::Vertex * tmpVertex = nullptr;
659  if(sc.isSuccess()) {
660  tmpVertex = makeXAODVertex( (int)perigeeListN.size(), Vertex, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state );
661  }
662  return tmpVertex;
663 }

◆ fit() [4/12]

xAOD::Vertex * Trk::TrkVKalVrtFitter::fit ( const std::vector< const TrackParameters * > &  perigeeList,
const Amg::Vector3D startingPoint 
) const
finaloverridevirtual

Interface for MeasuredPerigee with starting point.

Definition at line 261 of file TrkVKalVrtFitter.cxx.

263 {
264  State state;
265  initState (state);
266  setApproximateVertex(startingPoint.x(),
267  startingPoint.y(),
268  startingPoint.z(),
269  state);
270  std::vector<const NeutralParameters*> perigeeListN(0);
272  TLorentzVector Momentum;
273  long int Charge;
274  std::vector<double> ErrorMatrix;
275  std::vector<double> Chi2PerTrk;
276  std::vector< std::vector<double> > TrkAtVrt;
277  double Chi2;
278  StatusCode sc=VKalVrtFit( perigeeListC, perigeeListN,
279  Vertex, Momentum, Charge, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, true );
280 
281  xAOD::Vertex * tmpVertex = nullptr;
282  if(sc.isSuccess()) {
283  tmpVertex = makeXAODVertex( 0, Vertex, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state );
284  }
285  return tmpVertex;
286 }

◆ fit() [5/12]

xAOD::Vertex * Trk::TrkVKalVrtFitter::fit ( const std::vector< const TrackParameters * > &  perigeeList,
const std::vector< const NeutralParameters * > &  perigeeListN,
const Amg::Vector3D startingPoint 
) const
finaloverridevirtual

Definition at line 289 of file TrkVKalVrtFitter.cxx.

292 {
293  State state;
294  initState (state);
295  setApproximateVertex(startingPoint.x(),
296  startingPoint.y(),
297  startingPoint.z(),
298  state);
300  TLorentzVector Momentum;
301  long int Charge;
302  std::vector<double> ErrorMatrix;
303  std::vector<double> Chi2PerTrk;
304  std::vector< std::vector<double> > TrkAtVrt;
305  double Chi2;
306  StatusCode sc=VKalVrtFit( perigeeListC,perigeeListN,
307  Vertex, Momentum, Charge, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, true );
308 
309  xAOD::Vertex * tmpVertex = nullptr;
310  if(sc.isSuccess()) {
311  tmpVertex = makeXAODVertex( (int)perigeeListN.size(), Vertex, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state );
312  }
313  return tmpVertex;
314 }

◆ fit() [6/12]

xAOD::Vertex * Trk::TrkVKalVrtFitter::fit ( const std::vector< const TrackParameters * > &  perigeeList,
const std::vector< const NeutralParameters * > &  perigeeListN,
const xAOD::Vertex constraint 
) const
finaloverridevirtual

Definition at line 371 of file TrkVKalVrtFitter.cxx.

374 {
375  State state;
376  initState (state);
377 
378  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<< "A priori vertex constraint is activated in VKalVrt fitter!" << endmsg;
379  Amg::Vector3D VertexIni(0.,0.,0.);
380  StatusCode sc=VKalVrtFitFast(perigeeListC, VertexIni, state);
381  if( sc.isSuccess()){
382  setApproximateVertex(VertexIni.x(),VertexIni.y(),VertexIni.z(),state);
383  }else{
384  setApproximateVertex(constraint.position().x(),
385  constraint.position().y(),
386  constraint.position().z(),
387  state);
388  }
389  setVertexForConstraint(constraint.position().x(),
390  constraint.position().y(),
391  constraint.position().z(),
392  state);
393  setCovVrtForConstraint(constraint.covariancePosition()(Trk::x,Trk::x),
394  constraint.covariancePosition()(Trk::y,Trk::x),
395  constraint.covariancePosition()(Trk::y,Trk::y),
396  constraint.covariancePosition()(Trk::z,Trk::x),
397  constraint.covariancePosition()(Trk::z,Trk::y),
398  constraint.covariancePosition()(Trk::z,Trk::z),
399  state);
400  state.m_useAprioriVertex=true;
402  TLorentzVector Momentum;
403  long int Charge;
404  std::vector<double> ErrorMatrix;
405  std::vector<double> Chi2PerTrk;
406  std::vector< std::vector<double> > TrkAtVrt;
407  double Chi2;
408  sc=VKalVrtFit( perigeeListC, perigeeListN,
409  Vertex, Momentum, Charge, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, true );
410 
411 
412  xAOD::Vertex * tmpVertex = nullptr;
413  if(sc.isSuccess()) {
414  tmpVertex = makeXAODVertex( (int)perigeeListN.size(), Vertex, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state );
415  }
416  return tmpVertex;
417 }

◆ fit() [7/12]

xAOD::Vertex * Trk::TrkVKalVrtFitter::fit ( const std::vector< const TrackParameters * > &  perigeeListC,
const xAOD::Vertex constraint 
) const
finaloverridevirtual

Interface for MeasuredPerigee with vertex constraint.

the position of the constraint is ALWAYS the starting point

Definition at line 323 of file TrkVKalVrtFitter.cxx.

325 {
326  State state;
327  initState (state);
328  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<< "A priori vertex constraint is activated in VKalVrt fitter!" << endmsg;
329  Amg::Vector3D VertexIni(0.,0.,0.);
330  StatusCode sc=VKalVrtFitFast(perigeeListC, VertexIni, state);
331  if( sc.isSuccess()){
332  setApproximateVertex(VertexIni.x(),VertexIni.y(),VertexIni.z(),state);
333  }else{
334  setApproximateVertex(constraint.position().x(),
335  constraint.position().y(),
336  constraint.position().z(),
337  state);
338  }
339  setVertexForConstraint(constraint.position().x(),
340  constraint.position().y(),
341  constraint.position().z(),
342  state);
343  setCovVrtForConstraint(constraint.covariancePosition()(Trk::x,Trk::x),
344  constraint.covariancePosition()(Trk::y,Trk::x),
345  constraint.covariancePosition()(Trk::y,Trk::y),
346  constraint.covariancePosition()(Trk::z,Trk::x),
347  constraint.covariancePosition()(Trk::z,Trk::y),
348  constraint.covariancePosition()(Trk::z,Trk::z),
349  state);
350  state.m_useAprioriVertex=true;
351  std::vector<const NeutralParameters*> perigeeListN(0);
353  TLorentzVector Momentum;
354  long int Charge;
355  std::vector<double> ErrorMatrix;
356  std::vector<double> Chi2PerTrk;
357  std::vector< std::vector<double> > TrkAtVrt;
358  double Chi2;
359  sc=VKalVrtFit( perigeeListC, perigeeListN,
360  Vertex, Momentum, Charge, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, true );
361 
362 
363  xAOD::Vertex * tmpVertex = nullptr;
364  if(sc.isSuccess()) {
365  tmpVertex = makeXAODVertex( 0, Vertex, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state );
366  }
367  return tmpVertex;
368 }

◆ fit() [8/12]

xAOD::Vertex * Trk::TrkVKalVrtFitter::fit ( const std::vector< const xAOD::TrackParticle * > &  vectorTrk,
const Amg::Vector3D constraint,
IVKalState istate 
) const

Definition at line 432 of file TrkVKalVrtFitter.cxx.

435 {
436  assert(dynamic_cast<State*> (&istate)!=nullptr);
437  State& state = static_cast<State&> (istate);
438 
439  xAOD::Vertex * tmpVertex = nullptr;
440  setApproximateVertex(startingPoint.x(),
441  startingPoint.y(),
442  startingPoint.z(),
443  state);
444  std::vector<const xAOD::NeutralParticle*> xtpListN(0);
446  TLorentzVector Momentum;
447  long int Charge;
448  std::vector<double> ErrorMatrix;
449  std::vector<double> Chi2PerTrk;
450  std::vector< std::vector<double> > TrkAtVrt;
451  double Chi2;
452  StatusCode sc=VKalVrtFit( xtpListC, xtpListN,
453  Vertex, Momentum, Charge, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, true );
454  if(sc.isSuccess()) {
455  tmpVertex = makeXAODVertex( 0, Vertex, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state );
456  dvect fittrkwgt;
457  sc=VKalGetTrkWeights(fittrkwgt, state); if(sc.isFailure())fittrkwgt.clear();
458  for(int ii=0; ii<state.m_FitStatus; ii++) {
459  ElementLink<xAOD::TrackParticleContainer> TEL; TEL.setElement( xtpListC[ii] );
460  if(!fittrkwgt.empty()) tmpVertex->addTrackAtVertex(TEL,fittrkwgt[ii]);
461  else tmpVertex->addTrackAtVertex(TEL,1.);
462  }
463  }
464 
465  return tmpVertex;
466 }

◆ fit() [9/12]

xAOD::Vertex * Trk::TrkVKalVrtFitter::fit ( const std::vector< const xAOD::TrackParticle * > &  vectorTrk,
const std::vector< const xAOD::NeutralParticle * > &  vectorNeu,
const Amg::Vector3D startingPoint 
) const
finaloverridevirtual

Definition at line 468 of file TrkVKalVrtFitter.cxx.

471 {
472  State state;
473  initState (state);
474  xAOD::Vertex * tmpVertex = nullptr;
475  setApproximateVertex(startingPoint.x(),
476  startingPoint.y(),
477  startingPoint.z(),
478  state);
480  TLorentzVector Momentum;
481  long int Charge;
482  std::vector<double> ErrorMatrix;
483  std::vector<double> Chi2PerTrk;
484  std::vector< std::vector<double> > TrkAtVrt;
485  double Chi2;
486  StatusCode sc=VKalVrtFit( xtpListC, xtpListN,
487  Vertex, Momentum, Charge, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, true );
488  if(sc.isSuccess()) {
489  tmpVertex = makeXAODVertex( (int)xtpListN.size(), Vertex, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state );
490  dvect fittrkwgt;
491  sc=VKalGetTrkWeights(fittrkwgt, state); if(sc.isFailure())fittrkwgt.clear();
492  for(int ii=0; ii<state.m_FitStatus; ii++) {
493  if(ii<(int)xtpListC.size()) {
494  ElementLink<xAOD::TrackParticleContainer> TEL; TEL.setElement( xtpListC[ii] );
495  if(!fittrkwgt.empty()) tmpVertex->addTrackAtVertex(TEL,fittrkwgt[ii]);
496  else tmpVertex->addTrackAtVertex(TEL,1.);
497  }else{
499  if(!fittrkwgt.empty()) tmpVertex->addNeutralAtVertex(TEL,fittrkwgt[ii]);
500  else tmpVertex->addNeutralAtVertex(TEL,1.);
501  }
502  }
503  }
504 
505  return tmpVertex;
506 }

◆ fit() [10/12]

xAOD::Vertex * Trk::TrkVKalVrtFitter::fit ( const std::vector< const xAOD::TrackParticle * > &  vectorTrk,
const std::vector< const xAOD::NeutralParticle * > &  vectorNeu,
const xAOD::Vertex constraint 
) const
finaloverridevirtual

Definition at line 563 of file TrkVKalVrtFitter.cxx.

566 {
567  State state;
568  initState (state);
569 
570  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<< "A priori vertex constraint is activated in VKalVrt fitter!" << endmsg;
571  xAOD::Vertex * tmpVertex = nullptr;
572  setApproximateVertex(constraint.position().x(), constraint.position().y(),constraint.position().z(),state);
573  setVertexForConstraint(constraint.position().x(),
574  constraint.position().y(),
575  constraint.position().z(),
576  state);
577  setCovVrtForConstraint(constraint.covariancePosition()(Trk::x,Trk::x),
578  constraint.covariancePosition()(Trk::y,Trk::x),
579  constraint.covariancePosition()(Trk::y,Trk::y),
580  constraint.covariancePosition()(Trk::z,Trk::x),
581  constraint.covariancePosition()(Trk::z,Trk::y),
582  constraint.covariancePosition()(Trk::z,Trk::z),
583  state);
584  state.m_useAprioriVertex=true;
586  TLorentzVector Momentum;
587  long int Charge;
588  std::vector<double> ErrorMatrix;
589  std::vector<double> Chi2PerTrk;
590  std::vector< std::vector<double> > TrkAtVrt;
591  double Chi2;
592  StatusCode sc=VKalVrtFit( xtpListC, xtpListN,
593  Vertex, Momentum, Charge, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, true );
594  if(sc.isSuccess()){
595  tmpVertex = makeXAODVertex( (int)xtpListN.size(), Vertex, ErrorMatrix,Chi2PerTrk, TrkAtVrt, Chi2, state );
596  dvect fittrkwgt;
597  sc=VKalGetTrkWeights(fittrkwgt, state); if(sc.isFailure())fittrkwgt.clear();
598  for(int ii=0; ii<state.m_FitStatus; ii++) {
599  if(ii<(int)xtpListC.size()) {
600  ElementLink<xAOD::TrackParticleContainer> TEL; TEL.setElement( xtpListC[ii] );
601  if(!fittrkwgt.empty()) tmpVertex->addTrackAtVertex(TEL,fittrkwgt[ii]);
602  else tmpVertex->addTrackAtVertex(TEL,1.);
603  }else{
605  if(!fittrkwgt.empty()) tmpVertex->addNeutralAtVertex(TEL,fittrkwgt[ii]);
606  else tmpVertex->addNeutralAtVertex(TEL,1.);
607  }
608  }
609  }
610 
611  return tmpVertex;
612 }

◆ fit() [11/12]

xAOD::Vertex * Trk::TrkVKalVrtFitter::fit ( const std::vector< const xAOD::TrackParticle * > &  xtpListC,
const xAOD::Vertex constraint 
) const
finaloverridevirtual

Interface for xAOD::TrackParticle with vertex constraint.

the position of the constraint is ALWAYS the starting point

Definition at line 510 of file TrkVKalVrtFitter.cxx.

512 {
513  State state;
514  initState (state);
515  return fit (xtpListC, constraint, state);
516 }

◆ fit() [12/12]

xAOD::Vertex * Trk::TrkVKalVrtFitter::fit ( const std::vector< const xAOD::TrackParticle * > &  vectorTrk,
const xAOD::Vertex constraint,
IVKalState istate 
) const

Definition at line 517 of file TrkVKalVrtFitter.cxx.

520 {
521  assert(dynamic_cast<State*> (&istate)!=nullptr);
522  State& state = static_cast<State&> (istate);
523 
524  if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)<< "A priori vertex constraint is activated in VKalVrt fitter!" << endmsg;
525  xAOD::Vertex * tmpVertex = nullptr;
526  setApproximateVertex(constraint.position().x(), constraint.position().y(),constraint.position().z(),state);
527  setVertexForConstraint(constraint.position().x(),
528  constraint.position().y(),
529  constraint.position().z(),
530  state);
531  setCovVrtForConstraint(constraint.covariancePosition()(Trk::x,Trk::x),
532  constraint.covariancePosition()(Trk::y,Trk::x),
533  constraint.covariancePosition()(Trk::y,Trk::y),
534  constraint.covariancePosition()(Trk::z,Trk::x),
535  constraint.covariancePosition()(Trk::z,Trk::y),
536  constraint.covariancePosition()(Trk::z,Trk::z),
537  state);
538  state.m_useAprioriVertex=true;
539  std::vector<const xAOD::NeutralParticle*> xtpListN(0);
541  TLorentzVector Momentum;
542  long int Charge;
543  std::vector<double> ErrorMatrix;
544  std::vector<double> Chi2PerTrk;
545  std::vector< std::vector<double> > TrkAtVrt;
546  double Chi2;
547  StatusCode sc=VKalVrtFit( xtpListC, xtpListN,
548  Vertex, Momentum, Charge, ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, true );
549  if(sc.isSuccess()) {
550  tmpVertex = makeXAODVertex( 0, Vertex, ErrorMatrix,Chi2PerTrk, TrkAtVrt, Chi2, state );
551  dvect fittrkwgt;
552  sc=VKalGetTrkWeights(fittrkwgt, state); if(sc.isFailure())fittrkwgt.clear();
553  for(int ii=0; ii<state.m_FitStatus; ii++) {
554  ElementLink<xAOD::TrackParticleContainer> TEL; TEL.setElement( xtpListC[ii] );
555  if(!fittrkwgt.empty()) tmpVertex->addTrackAtVertex(TEL,fittrkwgt[ii]);
556  else tmpVertex->addTrackAtVertex(TEL,1.);
557  }
558  }
559 
560  return tmpVertex;
561 }

◆ fitCascade()

VxCascadeInfo * Trk::TrkVKalVrtFitter::fitCascade ( IVKalState istate,
const Vertex primVertex = 0,
bool  FirstDecayAtPV = false 
) const
finaloverride

Definition at line 274 of file TrkCascadeFitter.cxx.

276 {
277  assert(dynamic_cast<State*> (&istate)!=nullptr);
278  State& state = static_cast<State&> (istate);
279  CascadeState& cstate = *state.m_cascadeState;
280 
281  int iv,it,jt;
282  std::vector< Vect3DF > cVertices;
283  std::vector< std::vector<double> > covVertices;
284  std::vector< std::vector< VectMOM> > fittedParticles;
285  std::vector< std::vector<double> > fittedCovariance;
286  std::vector<double> fitFullCovariance;
287  std::vector<double> particleChi2;
288 //
289  int ntrk=0;
290  StatusCode sc;
291  std::vector<const TrackParameters*> baseInpTrk;
292  if(m_firstMeasuredPoint){ //First measured point strategy
293  std::vector<const xAOD::TrackParticle*>::const_iterator i_ntrk;
294  //for (i_ntrk = cstate.m_partListForCascade.begin(); i_ntrk < cstate.m_partListForCascade.end(); ++i_ntrk) baseInpTrk.push_back(GetFirstPoint(*i_ntrk));
295  unsigned int indexFMP;
296  for (i_ntrk = cstate.m_partListForCascade.begin(); i_ntrk < cstate.m_partListForCascade.end(); ++i_ntrk) {
297  if ((*i_ntrk)->indexOfParameterAtPosition(indexFMP, xAOD::FirstMeasurement)){
298  ATH_MSG_DEBUG("FirstMeasuredPoint on track is discovered. Use it.");
299  baseInpTrk.push_back(new CurvilinearParameters((*i_ntrk)->curvilinearParameters(indexFMP)));
300  }else{
301  ATH_MSG_DEBUG("No FirstMeasuredPoint on track in CascadeFitter. Stop fit");
302  { CLEANCASCADE(); return nullptr; }
303  }
304  }
305  sc=CvtTrackParameters(baseInpTrk,ntrk,state);
306  if(sc.isFailure()){ntrk=0; sc=CvtTrackParticle(cstate.m_partListForCascade,ntrk,state);}
307  }else{
308  sc=CvtTrackParticle(cstate.m_partListForCascade,ntrk,state);
309  }
310  if(sc.isFailure()){ CLEANCASCADE(); return nullptr; }
311 
312  VKalVrtConfigureFitterCore(ntrk, state);
313 
314  std::vector< std::vector<int> > vertexDefinition; // track indices for vertex;
315  std::vector< std::vector<int> > cascadeDefinition; // cascade structure
316  makeSimpleCascade(vertexDefinition, cascadeDefinition, cstate);
317 
318  double * partMass=new double[ntrk];
319  for(int i=0; i<ntrk; i++) partMass[i] = cstate.m_partMassForCascade[i];
320  int IERR = makeCascade(state.m_vkalFitControl, ntrk, state.m_ich, partMass, &state.m_apar[0][0], &state.m_awgt[0][0],
321  vertexDefinition,
322  cascadeDefinition,
323  m_cascadeCnstPrecision); delete[] partMass; if(IERR){ CLEANCASCADE(); return nullptr;}
324  CascadeEvent & refCascadeEvent=*(state.m_vkalFitControl.getCascadeEvent());
325 //
326 // Then set vertex mass constraints
327 //
328  std::vector<int> indexT,indexV,indexTT,indexVV,tmpInd; // track indices for vertex;
329  for (const PartialMassConstraint& c : cstate.m_partMassCnstForCascade) {
330  //int index=c.VRT; // vertex position in simple structure
331  int index=getSimpleVIndex(c.VRT, cstate); // vertex position in simple structure
332  IERR = findPositions(c.trkInVrt, vertexDefinition[index], indexT); if(IERR)break;
333  tmpInd.clear();
334  for (int idx : c.pseudoInVrt)
335  tmpInd.push_back( getSimpleVIndex(idx, cstate) );
336  IERR = findPositions( tmpInd, cascadeDefinition[index], indexV); if(IERR)break;
337  //IERR = findPositions(c.pseudoInVrt, cascadeDefinition[index], indexV); if(IERR)break; //VK 31.10.2011 ERROR!!!
338  IERR = setCascadeMassConstraint(refCascadeEvent,index, indexT, indexV, c.Mass);
339  if(IERR)break;
340  }
341  if(IERR){ CLEANCASCADE(); return nullptr;}
342  if(msgLvl(MSG::DEBUG)){
343  msg(MSG::DEBUG)<<"Standard cascade fit" << endmsg;
344  printSimpleCascade(vertexDefinition,cascadeDefinition, cstate);
345  }
346 //
347 // At last fit of cascade
348 // primVrt == 0 - no primary vertex
349 // primVrt is <Vertex*> - exact pointing to primary vertex
350 // primVrt is <RecVertex*> - summary track pass near primary vertex
351 //
352  if(primVrt){
353  double vertex[3] = {primVrt->position().x()-state.m_refFrameX, primVrt->position().y()-state.m_refFrameY,primVrt->position().z()-state.m_refFrameZ};
354  const RecVertex* primVrtRec=dynamic_cast< const RecVertex* > (primVrt);
355  if(primVrtRec){
356  double covari[6] = {primVrtRec->covariancePosition()(0,0),primVrtRec->covariancePosition()(0,1),
357  primVrtRec->covariancePosition()(1,1),primVrtRec->covariancePosition()(0,2),
358  primVrtRec->covariancePosition()(1,2),primVrtRec->covariancePosition()(2,2)};
359  if(FirstDecayAtPV) { IERR = processCascadePV(refCascadeEvent,vertex,covari);}
360  else { IERR = processCascade(refCascadeEvent,vertex,covari);}
361  }else{
362  IERR = processCascade(refCascadeEvent,vertex);
363  }
364  }else{
365  IERR = processCascade(refCascadeEvent);
366  }
367  if(IERR){ CLEANCASCADE(); return nullptr;}
368  getFittedCascade(refCascadeEvent, cVertices, covVertices, fittedParticles, fittedCovariance, particleChi2, fitFullCovariance );
369 
370 // for(int iv=0; iv<(int)cVertices.size(); iv++){ std::cout<<"iv="<<iv<<" masses=";
371 // for(int it=0; it<(int)fittedParticles[iv].size(); it++){
372 // double m=sqrt( fittedParticles[iv][it].E *fittedParticles[iv][it].E
373 // -fittedParticles[iv][it].Pz*fittedParticles[iv][it].Pz
374 // -fittedParticles[iv][it].Py*fittedParticles[iv][it].Py
375 // -fittedParticles[iv][it].Px*fittedParticles[iv][it].Px);
376 // std::cout<<m<<", "; } std::cout<<'\n'; }
377 //-----------------------------------------------------------------------------
378 //
379 // Check cascade correctness
380 //
381  int ip,ivFrom=0,ivTo;
382  double px,py,pz,Sign=10.;
383  for( ivTo=0; ivTo<(int)vertexDefinition.size(); ivTo++){ //Vertex to check
384  if(cascadeDefinition[ivTo].empty()) continue; //no pointing to it
385  for( ip=0; ip<(int)cascadeDefinition[ivTo].size(); ip++){
386  ivFrom=cascadeDefinition[ivTo][ip]; //pointing vertex
387  px=py=pz=0;
388  for(it=0; it<(int)fittedParticles[ivFrom].size(); it++){
389  px += fittedParticles[ivFrom][it].Px;
390  py += fittedParticles[ivFrom][it].Py;
391  pz += fittedParticles[ivFrom][it].Pz;
392  }
393  Sign= (cVertices[ivFrom].X-cVertices[ivTo].X)*px
394  +(cVertices[ivFrom].Y-cVertices[ivTo].Y)*py
395  +(cVertices[ivFrom].Z-cVertices[ivTo].Z)*pz;
396  if(Sign<0) break;
397  }
398  if(Sign<0) break;
399  }
400 //
401 //--------------- Wrong vertices in cascade precedence. Squeeze cascade and refit-----------
402 //
403  int NDOFsqueezed=0;
404  if(Sign<0.){
405  int index,itmp;
406  std::vector< std::vector<int> > new_vertexDefinition; // track indices for vertex;
407  std::vector< std::vector<int> > new_cascadeDefinition; // cascade structure
408  cstate.m_cascadeVList[ivFrom].mergedTO=cstate.m_cascadeVList[ivTo].vID;
409  cstate.m_cascadeVList[ivTo].mergedIN.push_back(ivFrom);
410  makeSimpleCascade(new_vertexDefinition, new_cascadeDefinition, cstate);
411  if(msgLvl(MSG::DEBUG)){
412  msg(MSG::DEBUG)<<"Compressed cascade fit" << endmsg;
413  printSimpleCascade(new_vertexDefinition,new_cascadeDefinition, cstate);
414  }
415 //-----------------------------------------------------------------------------------------
416  state.m_vkalFitControl.renewCascadeEvent(new CascadeEvent());
417  partMass=new double[ntrk];
418  for(int i=0; i<ntrk; i++) partMass[i] = cstate.m_partMassForCascade[i];
419  int IERR = makeCascade(state.m_vkalFitControl, ntrk, state.m_ich, partMass, &state.m_apar[0][0], &state.m_awgt[0][0],
420  new_vertexDefinition,
421  new_cascadeDefinition); delete[] partMass; if(IERR){ CLEANCASCADE(); return nullptr;}
422 //------Set up mass constraints
423  for (const PartialMassConstraint& c : cstate.m_partMassCnstForCascade) {
424  indexT.clear(); indexV.clear();
425  index=getSimpleVIndex( c.VRT, cstate);
426  IERR = findPositions(c.trkInVrt, new_vertexDefinition[index], indexT); if(IERR)break;
427  for (VertexID inV : c.pseudoInVrt) { //cycle over pseudotracks
428  int icv=indexInV(inV, cstate); if(icv<0) break;
429  if(cstate.m_cascadeVList[icv].mergedTO == c.VRT){
430  IERR = findPositions(cstate.m_cascadeVList[icv].trkInVrt, new_vertexDefinition[index], indexTT);
431  if(IERR)break;
432  indexT.insert (indexT.end(), indexTT.begin(), indexTT.end());
433  }else{
434  std::vector<int> tmpI(1); tmpI[0]=inV;
435  IERR = findPositions(tmpI, new_cascadeDefinition[index], indexVV);
436  if(IERR)break;
437  indexV.insert (indexV.end(), indexVV.begin(), indexVV.end());
438  }
439  } if(IERR)break;
440  //std::cout<<"trk2="; for(int I=0; I<(int)indexT.size(); I++)std::cout<<indexT[I]; std::cout<<'\n';
441  //std::cout<<"pse="; for(int I=0; I<(int)indexV.size(); I++)std::cout<<indexV[I]; std::cout<<'\n';
442  IERR = setCascadeMassConstraint(*(state.m_vkalFitControl.getCascadeEvent()), index , indexT, indexV, c.Mass); if(IERR)break;
443  }
444  ATH_MSG_DEBUG("Setting compressed mass constraints ierr="<<IERR);
445  if(IERR){ CLEANCASCADE(); return nullptr;}
446 //
447 //--------------------------- Refit
448 //
449  if(primVrt){
450  double vertex[3] = {primVrt->position().x()-state.m_refFrameX, primVrt->position().y()-state.m_refFrameY,primVrt->position().z()-state.m_refFrameZ};
451  const RecVertex* primVrtRec=dynamic_cast< const RecVertex* > (primVrt);
452  if(primVrtRec){
453  double covari[6] = {primVrtRec->covariancePosition()(0,0),primVrtRec->covariancePosition()(0,1),
454  primVrtRec->covariancePosition()(1,1),primVrtRec->covariancePosition()(0,2),
455  primVrtRec->covariancePosition()(1,2),primVrtRec->covariancePosition()(2,2)};
456  IERR = processCascade(*(state.m_vkalFitControl.getCascadeEvent()),vertex,covari);
457  }else{
458  IERR = processCascade(*(state.m_vkalFitControl.getCascadeEvent()),vertex);
459  }
460  }else{
461  IERR = processCascade(*(state.m_vkalFitControl.getCascadeEvent()));
462  }
463  if(IERR){ CLEANCASCADE(); return nullptr;}
464  NDOFsqueezed=getCascadeNDoF(cstate)+3-2; // Remove vertex (+3 ndf) and this vertex pointing (-2 ndf)
465 //
466 //-------------------- Get information according to old cascade structure
467 //
468  std::vector< Vect3DF > t_cVertices;
469  std::vector< std::vector<double> > t_covVertices;
470  std::vector< std::vector< VectMOM> > t_fittedParticles;
471  std::vector< std::vector<double> > t_fittedCovariance;
472  std::vector<double> t_fitFullCovariance;
473  getFittedCascade(*(state.m_vkalFitControl.getCascadeEvent()), t_cVertices, t_covVertices, t_fittedParticles,
474  t_fittedCovariance, particleChi2, t_fitFullCovariance);
475  cVertices.clear(); covVertices.clear();
476 //
477 //------------------------- Real tracks
478 //
479  if(msgLvl(MSG::DEBUG)){
480  msg(MSG::DEBUG)<<"Initial cascade momenta"<<endmsg;
481  for(int kv=0; kv<(int)fittedParticles.size(); kv++){
482  for(int kt=0; kt<(int)fittedParticles[kv].size(); kt++)
483  std::cout<<
484  " Px="<<fittedParticles[kv][kt].Px<<" Py="<<fittedParticles[kv][kt].Py<<";";
485  std::cout<<'\n';
486  }
487  msg(MSG::DEBUG)<<"Squized cascade momenta"<<endmsg;
488  for(int kv=0; kv<(int)t_fittedParticles.size(); kv++){
489  for(int kt=0; kt<(int)t_fittedParticles[kv].size(); kt++)
490  std::cout<<
491  " Px="<<t_fittedParticles[kv][kt].Px<<" Py="<<t_fittedParticles[kv][kt].Py<<";";
492  std::cout<<'\n';
493  }
494  }
495  for(iv=0; iv<(int)cstate.m_cascadeVList.size(); iv++){
496  index=getSimpleVIndex( cstate.m_cascadeVList[iv].vID, cstate ); //index of vertex in simplified structure
497  cVertices.push_back(t_cVertices[index]);
498  covVertices.push_back(t_covVertices[index]);
499  for(it=0; it<(int)cstate.m_cascadeVList[iv].trkInVrt.size(); it++){
500  int numTrk=cstate.m_cascadeVList[iv].trkInVrt[it]; //track itself
501  for(itmp=0; itmp<(int)new_vertexDefinition[index].size(); itmp++) if(numTrk==new_vertexDefinition[index][itmp])break;
502  fittedParticles[iv][it]=t_fittedParticles[index][itmp];
503 //Update only particle covariance. Cross particle covariance remains old.
504  fittedCovariance[iv][SymIndex(it,0,0)]=t_fittedCovariance[index][SymIndex(itmp,0,0)];
505  fittedCovariance[iv][SymIndex(it,1,0)]=t_fittedCovariance[index][SymIndex(itmp,1,0)];
506  fittedCovariance[iv][SymIndex(it,1,1)]=t_fittedCovariance[index][SymIndex(itmp,1,1)];
507  fittedCovariance[iv][SymIndex(it,2,0)]=t_fittedCovariance[index][SymIndex(itmp,2,0)];
508  fittedCovariance[iv][SymIndex(it,2,1)]=t_fittedCovariance[index][SymIndex(itmp,2,1)];
509  fittedCovariance[iv][SymIndex(it,2,2)]=t_fittedCovariance[index][SymIndex(itmp,2,2)];
510  }
511  fittedCovariance[iv][SymIndex(0,0,0)]=t_fittedCovariance[index][SymIndex(0,0,0)]; // Update also vertex
512  fittedCovariance[iv][SymIndex(0,1,0)]=t_fittedCovariance[index][SymIndex(0,1,0)]; // covarinace
513  fittedCovariance[iv][SymIndex(0,1,1)]=t_fittedCovariance[index][SymIndex(0,1,1)];
514  fittedCovariance[iv][SymIndex(0,2,0)]=t_fittedCovariance[index][SymIndex(0,2,0)];
515  fittedCovariance[iv][SymIndex(0,2,1)]=t_fittedCovariance[index][SymIndex(0,2,1)];
516  fittedCovariance[iv][SymIndex(0,2,2)]=t_fittedCovariance[index][SymIndex(0,2,2)];
517  }
518 // Pseudo-tracks. They are filled based on fitted results for nonmerged vertices
519 // or as sum for merged vertices
520  VectMOM tmpMom{};
521  for(iv=0; iv<(int)cstate.m_cascadeVList.size(); iv++){
522  index=getSimpleVIndex( cstate.m_cascadeVList[iv].vID, cstate ); //index of current vertex in simplified structure
523  int NTrkInVrt=cstate.m_cascadeVList[iv].trkInVrt.size();
524  for(ip=0; ip<(int)cstate.m_cascadeVList[iv].inPointingV.size(); ip++){ //inPointing verties
525  int tmpIndexV=indexInV( cstate.m_cascadeVList[iv].inPointingV[ip], cstate); //index of inPointing vertex in full structure
526  if(cstate.m_cascadeVList[tmpIndexV].mergedTO){ //vertex is merged, so take pseudo-track as a sum
527  tmpMom.Px=tmpMom.Py=tmpMom.Pz=tmpMom.E=0.;
528  for(it=0; it<(int)(cstate.m_cascadeVList[tmpIndexV].trkInVrt.size()+
529  cstate.m_cascadeVList[tmpIndexV].inPointingV.size()); it++){
530  tmpMom.Px += fittedParticles[tmpIndexV][it].Px; tmpMom.Py += fittedParticles[tmpIndexV][it].Py;
531  tmpMom.Pz += fittedParticles[tmpIndexV][it].Pz; tmpMom.E += fittedParticles[tmpIndexV][it].E;
532  }
533  fittedParticles[iv][ip+NTrkInVrt]=tmpMom;
534  }else{
535  int indexS=getSimpleVIndex( cstate.m_cascadeVList[iv].inPointingV[ip], cstate ); //index of inPointing vertex in simplified structure
536  for(itmp=0; itmp<(int)new_cascadeDefinition[index].size(); itmp++) if(indexS==new_cascadeDefinition[index][itmp])break;
537  fittedParticles[iv][ip+NTrkInVrt]=t_fittedParticles[index][itmp+new_vertexDefinition[index].size()];
538  }
539  }
540  }
541  if(msgLvl(MSG::DEBUG)){
542  msg(MSG::DEBUG)<<"Refit cascade momenta"<<endmsg;
543  for(int kv=0; kv<(int)fittedParticles.size(); kv++){
544  for(int kt=0; kt<(int)fittedParticles[kv].size(); kt++)
545  std::cout<<
546  " Px="<<fittedParticles[kv][kt].Px<<" Py="<<fittedParticles[kv][kt].Py<<";";
547  std::cout<<'\n';
548  }
549  }
550 // Covariance matrix for nonmerged vertices is updated.
551 // For merged vertices (both IN and TO ) it's taken from old fit
552 
553  for(iv=0; iv<(int)cstate.m_cascadeVList.size(); iv++){
554  bool isMerged=false;
555  if(cstate.m_cascadeVList[iv].mergedTO)isMerged=true; //vertex is merged
556  index=getSimpleVIndex( cstate.m_cascadeVList[iv].vID, cstate ); //index of current vertex in simplified structure
557  for(ip=0; ip<(int)cstate.m_cascadeVList[iv].inPointingV.size(); ip++){ //inPointing verties
558  int tmpIndexV=indexInV( cstate.m_cascadeVList[iv].inPointingV[ip], cstate); //index of inPointing vertex in full structure
559  if(cstate.m_cascadeVList[tmpIndexV].mergedTO)isMerged=true; //vertex is merged
560  }
561  if(!isMerged){
562  fittedCovariance[iv]=t_fittedCovariance[index]; //copy complete covarinace matrix for nonmerged vertices
563  }
564  }
565  }
566 //
567 //-------------------------------------Saving
568 //
569  ATH_MSG_DEBUG("Now save results");
570  Amg::MatrixX VrtCovMtx(3,3);
571  Trk::Perigee * measPerigee;
572  std::vector<xAOD::Vertex*> xaodVrtList(0);
573  double phi, theta, invP, mom, fullChi2=0.;
574 
575  int NDOF=getCascadeNDoF(cstate); if(NDOFsqueezed) NDOF=NDOFsqueezed;
576  if(primVrt){ if(FirstDecayAtPV){ NDOF+=3; }else{ NDOF+=2; } }
577 
578  for(iv=0; iv<(int)cVertices.size(); iv++){
579  Amg::Vector3D FitVertex(cVertices[iv].X+state.m_refFrameX,cVertices[iv].Y+state.m_refFrameY,cVertices[iv].Z+state.m_refFrameZ);
580  VrtCovMtx(0,0) = covVertices[iv][0]; VrtCovMtx(0,1) = covVertices[iv][1];
581  VrtCovMtx(1,1) = covVertices[iv][2]; VrtCovMtx(0,2) = covVertices[iv][3];
582  VrtCovMtx(1,2) = covVertices[iv][4]; VrtCovMtx(2,2) = covVertices[iv][5];
583  VrtCovMtx(1,0) = VrtCovMtx(0,1);
584  VrtCovMtx(2,0) = VrtCovMtx(0,2);
585  VrtCovMtx(2,1) = VrtCovMtx(1,2);
586  double Chi2=0;
587  for(it=0; it<(int)vertexDefinition[iv].size(); it++) { Chi2 += particleChi2[vertexDefinition[iv][it]];};
588  fullChi2+=Chi2;
589 
590 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-= xAOD::Vertex creation
591  xAOD::Vertex * tmpXAODVertex=new xAOD::Vertex();
592  tmpXAODVertex->makePrivateStore();
593  tmpXAODVertex->setPosition(FitVertex);
594  tmpXAODVertex->setFitQuality(Chi2, (float)NDOF);
595  std::vector<VxTrackAtVertex> & tmpVTAV=tmpXAODVertex->vxTrackAtVertex();
596  tmpVTAV.clear();
597 
598  int NRealT=vertexDefinition[iv].size();
599  Amg::MatrixX genCOV( NRealT*3+3, NRealT*3+3 ); // Fill cov. matrix for vertex
600  for( it=0; it<NRealT*3+3; it++){ // (X,Y,Z,px1,py1,....pxn,pyn,pzn)
601  for( jt=0; jt<=it; jt++){ //
602  genCOV(it,jt) = genCOV(jt,it) = fittedCovariance[iv][it*(it+1)/2+jt]; // for real tracks only
603  } } // (first in the list)
604  Amg::MatrixX fullDeriv;
605  if( m_makeExtendedVertex ){
606  //VK fullDeriv=new CLHEP::HepMatrix( NRealT*3+3, NRealT*3+3, 0); // matrix is filled by zeros
607  fullDeriv=Amg::MatrixX::Zero(NRealT*3+3, NRealT*3+3); // matrix is filled by zeros
608  fullDeriv(0,0)=fullDeriv(1,1)=fullDeriv(2,2)=1.;
609  }
610  for( it=0; it<NRealT; it++) {
611  mom= sqrt( fittedParticles[iv][it].Pz*fittedParticles[iv][it].Pz
612  +fittedParticles[iv][it].Py*fittedParticles[iv][it].Py
613  +fittedParticles[iv][it].Px*fittedParticles[iv][it].Px);
614  double Px=fittedParticles[iv][it].Px;
615  double Py=fittedParticles[iv][it].Py;
616  double Pz=fittedParticles[iv][it].Pz;
617  double Pt= sqrt(Px*Px + Py*Py) ;
618  phi=atan2( Py, Px);
619  theta=acos( Pz/mom );
620  invP = - state.m_ich[vertexDefinition[iv][it]] / mom; // Change charge sign according to ATLAS
621 // d(Phi,Theta,InvP)/d(Px,Py,Pz) - Perigee vs summary momentum
622  Amg::MatrixX tmpDeriv( 5, NRealT*3+3);
623  tmpDeriv.setZero(); // matrix is filled by zeros
624  tmpDeriv(0,1) = -sin(phi); // Space derivatives
625  tmpDeriv(0,2) = cos(phi);
626  tmpDeriv(1,1) = -cos(phi)/tan(theta);
627  tmpDeriv(1,2) = -sin(phi)/tan(theta);
628  tmpDeriv(1,3) = 1.;
629  tmpDeriv(2+0,3*it+3+0) = -Py/Pt/Pt; //dPhi/dPx
630  tmpDeriv(2+0,3*it+3+1) = Px/Pt/Pt; //dPhi/dPy
631  tmpDeriv(2+0,3*it+3+2) = 0; //dPhi/dPz
632  tmpDeriv(2+1,3*it+3+0) = Px*Pz/(Pt*mom*mom); //dTheta/dPx
633  tmpDeriv(2+1,3*it+3+1) = Py*Pz/(Pt*mom*mom); //dTheta/dPy
634  tmpDeriv(2+1,3*it+3+2) = -Pt/(mom*mom); //dTheta/dPz
635  tmpDeriv(2+2,3*it+3+0) = -Px/(mom*mom) * invP; //dInvP/dPx
636  tmpDeriv(2+2,3*it+3+1) = -Py/(mom*mom) * invP; //dInvP/dPy
637  tmpDeriv(2+2,3*it+3+2) = -Pz/(mom*mom) * invP; //dInvP/dPz
638 //---------- Here for Eigen block(startrow,startcol,sizerow,sizecol)
639  if( m_makeExtendedVertex )fullDeriv.block(3*it+3+0,3*it+3+0,3,3) = tmpDeriv.block(2,3*it+3+0,3,3);
640 //----------
641  AmgSymMatrix(5) tmpCovMtx ; // New Eigen based EDM
642  tmpCovMtx = genCOV.similarity(tmpDeriv); // New Eigen based EDM
643  measPerigee = new Perigee( 0.,0., phi, theta, invP, PerigeeSurface(FitVertex), std::move(tmpCovMtx) ); // New Eigen based EDM
644  tmpVTAV.emplace_back( particleChi2[vertexDefinition[iv][it]] , measPerigee ) ;
645  }
646  std::vector<float> floatErrMtx;
648  Amg::MatrixX tmpCovMtx(NRealT*3+3,NRealT*3+3); // New Eigen based EDM
649  tmpCovMtx=genCOV.similarity(fullDeriv);
650  floatErrMtx.resize((NRealT*3+3)*(NRealT*3+3+1)/2);
651  int ivk=0;
652  for(int i=0;i<NRealT*3+3;i++){
653  for(int j=0;j<=i;j++){
654  floatErrMtx.at(ivk++)=tmpCovMtx(i,j);
655  }
656  }
657  }else{
658  floatErrMtx.resize(6);
659  for(int i=0; i<6; i++) floatErrMtx[i]=covVertices[iv][i];
660  }
661  tmpXAODVertex->setCovariance(floatErrMtx);
662  for(int itvk=0; itvk<NRealT; itvk++) {
664  if(itvk < (int)cstate.m_cascadeVList[iv].trkInVrt.size()){
665  TEL.setElement( cstate.m_partListForCascade[ cstate.m_cascadeVList[iv].trkInVrt[itvk] ] );
666  }else{
667  TEL.setElement( nullptr );
668  }
669  tmpXAODVertex->addTrackAtVertex(TEL,1.);
670  }
671  xaodVrtList.push_back(tmpXAODVertex); //VK Save xAOD::Vertex
672 //
673  }
674 //
675 // Save momenta of all particles including combined at vertex positions
676 //
677  std::vector<TLorentzVector> tmpMoms;
678  std::vector<std::vector<TLorentzVector> > particleMoms;
679  std::vector<Amg::MatrixX> particleCovs;
680  int allFitPrt=0;
681  for(iv=0; iv<(int)cVertices.size(); iv++){
682  tmpMoms.clear();
683  int NTrkF=fittedParticles[iv].size();
684  for(it=0; it< NTrkF; it++) {
685  tmpMoms.emplace_back( fittedParticles[iv][it].Px, fittedParticles[iv][it].Py,
686  fittedParticles[iv][it].Pz, fittedParticles[iv][it].E );
687  }
688  //CLHEP::HepSymMatrix COV( NTrkF*3+3, 0 );
689  Amg::MatrixX COV(NTrkF*3+3,NTrkF*3+3); COV=Amg::MatrixX::Zero(NTrkF*3+3,NTrkF*3+3);
690  for( it=0; it<NTrkF*3+3; it++){
691  for( jt=0; jt<=it; jt++){
692  COV(it,jt) = COV(jt,it) = fittedCovariance[iv][it*(it+1)/2+jt];
693  } }
694  particleMoms.push_back( std::move(tmpMoms) );
695  particleCovs.push_back( std::move(COV) );
696  allFitPrt += NTrkF;
697  }
698 //
699  int NAPAR=(allFitPrt+cVertices.size())*3; //Full size of complete covariance matrix
700  //CLHEP::HepSymMatrix FULL( NAPAR, 0 );
701  Amg::MatrixX FULL(NAPAR,NAPAR); FULL.setZero();
702  if( !NDOFsqueezed ){ //normal cascade
703  for( it=0; it<NAPAR; it++){
704  for( jt=0; jt<=it; jt++){
705  FULL(it,jt) = FULL(jt,it) = fitFullCovariance[it*(it+1)/2+jt];
706  } }
707  }else{ //squeezed cascade
708  //int mcount=1; //Indexing in SUB starts from 1 !!!!
709  int mcount=0; //Indexing in BLOCK starts from 0 !!!!
710  for(iv=0; iv<(int)cstate.m_cascadeVList.size(); iv++){
711  //FULL.sub(mcount,particleCovs[iv]); mcount += particleCovs[iv].num_col();
712  FULL.block(mcount,mcount,particleCovs[iv].rows(),particleCovs[iv].cols())=particleCovs[iv];
713  mcount += particleCovs[iv].rows();
714  }
715  }
716 //
717 //
718 // VxCascadeInfo * recCascade= new VxCascadeInfo(vxVrtList,particleMoms,particleCovs, NDOF ,fullChi2);
719  VxCascadeInfo * recCascade= new VxCascadeInfo(std::move(xaodVrtList),std::move(particleMoms),std::move(particleCovs), NDOF ,fullChi2);
720  recCascade->setFullCascadeCovariance(FULL);
721  CLEANCASCADE();
722  return recCascade;
723 }

◆ getCascadeNDoF()

int Trk::TrkVKalVrtFitter::getCascadeNDoF ( const CascadeState cstate)
staticprivate

Definition at line 79 of file TrkCascadeFitter.cxx.

80 {
81 
82 // get Tracks, Vertices and Pointings in cascade
83 //
84  int nTrack = cstate.m_partListForCascade.size();
85  int nVertex = cstate.m_cascadeVList.size();
86 
87  int nPointing = 0;
88  for( int iv=0; iv<nVertex; iv++) nPointing += cstate.m_cascadeVList[iv].inPointingV.size();
89 
90  int nMassCnst = cstate.m_partMassCnstForCascade.size(); // mass cnsts
91 
92  return 2*nTrack - 3*nVertex + 2*nPointing + nMassCnst;
93 }

◆ GetPerigee()

const Perigee * Trk::TrkVKalVrtFitter::GetPerigee ( const TrackParameters i_ntrk)
staticprivate

Definition at line 226 of file CvtTrackParticle.cxx.

227  {
228  const Perigee* mPer = nullptr;
229  if(i_ntrk->surfaceType()==Trk::SurfaceType::Perigee && i_ntrk->covariance()!= nullptr ) {
230  mPer = dynamic_cast<const Perigee*> (i_ntrk);
231  }
232  return mPer;
233  }

◆ getSimpleVIndex()

int Trk::TrkVKalVrtFitter::getSimpleVIndex ( const VertexID vrt,
const CascadeState cstate 
)
staticprivate

Definition at line 804 of file TrkCascadeFitter.cxx.

806 {
807  int NVRT=cstate.m_cascadeVList.size();
808 
809  int iv=indexInV(vrt, cstate);
810  if(iv<0) return -1; //not found
811 
812  int ivv=0;
813  if(cstate.m_cascadeVList[iv].mergedTO){
814  for(ivv=0; ivv<NVRT; ivv++) if(cstate.m_cascadeVList[iv].mergedTO == cstate.m_cascadeVList[ivv].vID) break;
815  if(iv==NVRT) return -1; //not found
816  iv=ivv;
817  }
818  return cstate.m_cascadeVList[iv].indexInSimpleCascade;
819 }

◆ GiveFullMatrix()

Amg::MatrixX * Trk::TrkVKalVrtFitter::GiveFullMatrix ( int  NTrk,
std::vector< double > &  Matrix 
)
staticprivate

Definition at line 707 of file TrkVKalVrtFitter.cxx.

708 {
709  Amg::MatrixX * mtx = new Amg::MatrixX(3+3*NTrk,3+3*NTrk);
710  long int ij=0;
711  for(int i=1; i<=(3+3*NTrk); i++){
712  for(int j=1; j<=i; j++){
713  if(i==j){ (*mtx)(i-1,j-1)=Matrix[ij];}
714  else { (*mtx).fillSymmetric(i-1,j-1,Matrix[ij]);}
715  ij++;
716  }
717  }
718  return mtx;
719 }

◆ indexInV()

int Trk::TrkVKalVrtFitter::indexInV ( const VertexID vrt,
const CascadeState cstate 
)
staticprivate

Definition at line 823 of file TrkCascadeFitter.cxx.

825 { int icv; int NVRT=cstate.m_cascadeVList.size();
826  for(icv=0; icv<NVRT; icv++) if(vrt==cstate.m_cascadeVList[icv].vID)break;
827  if(icv==NVRT)return -1;
828  return icv;
829 }

◆ initCnstList()

void Trk::TrkVKalVrtFitter::initCnstList ( )
private

◆ initialize()

StatusCode Trk::TrkVKalVrtFitter::initialize ( )
finaloverridevirtual

Definition at line 132 of file TrkVKalVrtFitter.cxx.

133 {
134 
135 // Checking ROBUST algoritms
136  if(m_Robustness<0 || m_Robustness>7 ) m_Robustness=0;
137 
138 
139  if(!m_useFixedField){
140  // Read handle for AtlasFieldCacheCondObj
141  if (!m_fieldCacheCondObjInputKey.key().empty()){
142  if( (m_fieldCacheCondObjInputKey.initialize()).isSuccess() ){
143  m_isAtlasField = true;
144  ATH_MSG_DEBUG( "Found AtlasFieldCacheCondObj with key ="<< m_fieldCacheCondObjInputKey.key());
145  }else{
146  ATH_MSG_INFO( "No AtlasFieldCacheCondObj with key ="<< m_fieldCacheCondObjInputKey.key());
147  ATH_MSG_INFO( "Use fixed magnetic field instead");
148  }
149  }
150  }
151 //
152 // Only here the VKalVrtFitter propagator object is created if ATHENA propagator is provided (see setAthenaPropagator)
153 // In this case the ATHENA propagator can be used via pointers:
154 // m_InDetExtrapolator - direct access
155 // m_fitPropagator - via VKalVrtFitter object VKalExtPropagator
156 // If ATHENA propagator is not provided, only defined object is
157 // myPropagator - extern propagator from TrkVKalVrtCore
158 //
159  if (m_extPropagator.empty()){
160  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< "External propagator is not supplied - use internal one"<<endmsg;
161  m_extPropagator.disable();
162  }else{
163  if (m_extPropagator.retrieve().isFailure()) {
164  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< "Could not find external propagator=" <<m_extPropagator<<endmsg;
165  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< "TrkVKalVrtFitter will uses internal propagator" << endmsg;
166  m_extPropagator.disable();
167  }else{
168  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< "External propagator="<<m_extPropagator<<" retrieved" << endmsg;
170  }
171  }
172 
173 //
174 //
175 //
176  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<< "TrkVKalVrtFitter initialize() successful" << endmsg;
177  if(msgLvl(MSG::DEBUG)){
178  msg(MSG::DEBUG)<< "TrkVKalVrtFitter configuration:" << endmsg;
179  msg(MSG::DEBUG)<< " Frozen version for BTagging: "<< m_frozenVersionForBTagging <<endmsg;
180  msg(MSG::DEBUG)<< " A priori vertex constraint: "<< m_useAprioriVertex <<endmsg;
181  msg(MSG::DEBUG)<< " Angle dTheta=0 constraint: "<< m_useThetaCnst <<endmsg;
182  msg(MSG::DEBUG)<< " Angle dPhi=0 constraint: "<< m_usePhiCnst <<endmsg;
183  msg(MSG::DEBUG)<< " Pointing to other vertex constraint: "<< m_usePointingCnst <<endmsg;
184  msg(MSG::DEBUG)<< " ZPointing to other vertex constraint: "<< m_useZPointingCnst <<endmsg;
185  msg(MSG::DEBUG)<< " Comb. particle pass near other vertex:"<< m_usePassNear <<endmsg;
186  msg(MSG::DEBUG)<< " Pass near with comb.particle errors: "<< m_usePassWithTrkErr <<endmsg;
187  if(m_massForConstraint>0){
188  msg(MSG::DEBUG)<< " Mass constraint M="<< m_massForConstraint <<endmsg;
189  msg(MSG::DEBUG)<< " with particles M=";
190  for(int i=0; i<(int)m_c_MassInputParticles.size(); i++) msg(MSG::DEBUG)<<m_c_MassInputParticles[i]<<", ";
191  msg(MSG::DEBUG)<<endmsg; ;
192  }
193  if(m_IterationNumber==0){
194  msg(MSG::DEBUG)<< " Default iteration number limit 50 is used " <<endmsg;
195  } else {
196  msg(MSG::DEBUG)<< " Iteration number limit: "<< m_IterationNumber <<endmsg;
197  }
198 
199  if(m_isAtlasField){ msg(MSG::DEBUG)<< " ATLAS magnetic field is used!"<<endmsg; }
200  else { msg(MSG::DEBUG)<< " Constant magnetic field is used! B="<<m_BMAG<<endmsg; }
201 
202  if(m_InDetExtrapolator){ msg(MSG::DEBUG)<< " InDet extrapolator is used!"<<endmsg; }
203  else { msg(MSG::DEBUG)<< " Internal VKalVrt extrapolator is used!"<<endmsg;}
204 
205  if(m_Robustness) { msg(MSG::DEBUG)<< " VKalVrt uses robust algorithm! Type="<<m_Robustness<<" with Scale="<<m_RobustScale<<endmsg; }
206 
207  if(m_firstMeasuredPoint){ msg(MSG::DEBUG)<< " VKalVrt will use FirstMeasuredPoint strategy in fits with InDetExtrapolator"<<endmsg; }
208  else { msg(MSG::DEBUG)<< " VKalVrt will use Perigee strategy in fits with InDetExtrapolator"<<endmsg; }
209  if(m_firstMeasuredPointLimit){ msg(MSG::DEBUG)<< " VKalVrt will use FirstMeasuredPointLimit strategy "<<endmsg; }
210  }
211 
212 
213  return StatusCode::SUCCESS;
214 }

◆ initState() [1/2]

void Trk::TrkVKalVrtFitter::initState ( const EventContext &  ctx,
State state 
) const
private

Definition at line 223 of file TrkVKalVrtFitter.cxx.

225 {
226  //----------------------------------------------------------------------
227  // New magnetic field object is created. It's provided to VKalVrtCore.
228  // VKalVrtFitter must set up Core BEFORE any call required propagation!!!
229  if (m_isAtlasField) {
230  // For the moment, use Gaudi Hive for the event context - would need to be passed in from clients
232  const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
233  if (fieldCondObj == nullptr) {
234  ATH_MSG_ERROR("Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCacheCondObjInputKey.key());
235  return;
236  }
237  fieldCondObj->getInitializedCache (state.m_fieldCache);
238  state.m_fitField.setAtlasField(&state.m_fieldCache);
239  } else {
240  state.m_fitField.setAtlasField(m_BMAG);
241  }
242  state.m_eventContext = &ctx;
243  state.m_vkalFitControl.vk_objProp = m_fitPropagator;
244  state.m_useAprioriVertex = m_useAprioriVertex;
245  state.m_useThetaCnst = m_useThetaCnst;
246  state.m_usePhiCnst = m_usePhiCnst;
247  state.m_usePointingCnst = m_usePointingCnst;
248  state.m_useZPointingCnst = m_useZPointingCnst;
249  state.m_usePassNear = m_usePassNear;
250  state.m_usePassWithTrkErr = m_usePassWithTrkErr;
251  state.m_VertexForConstraint = m_c_VertexForConstraint;
252  state.m_CovVrtForConstraint = m_c_CovVrtForConstraint;
253  state.m_massForConstraint = m_massForConstraint;
254  state.m_Robustness = m_Robustness;
255  state.m_RobustScale = m_RobustScale;
256  state.m_MassInputParticles = m_c_MassInputParticles;
257  state.m_frozenVersionForBTagging = m_frozenVersionForBTagging;
258 }

◆ initState() [2/2]

void Trk::TrkVKalVrtFitter::initState ( State state) const
private

Definition at line 217 of file TrkVKalVrtFitter.cxx.

218 {
219  initState(Gaudi::Hive::currentContext(), state);
220 }

◆ makeSimpleCascade()

void Trk::TrkVKalVrtFitter::makeSimpleCascade ( std::vector< std::vector< int > > &  vrtDef,
std::vector< std::vector< int > > &  cascadeDef,
CascadeState cstate 
)
staticprivate

Definition at line 180 of file TrkCascadeFitter.cxx.

183 {
184  int iv,ip,it, nVAdd, iva;
185  vrtDef.clear();
186  cascadeDef.clear();
187  int NVC=cstate.m_cascadeVList.size();
188  vrtDef.resize(NVC);
189  cascadeDef.resize(NVC);
190 //
191 //---- First set up position of each vertex in simple structure with merging(!!!)
192 //
193  int vCounter=0;
194  for(iv=0; iv<NVC; iv++){
195  cascadeV &vrt=cstate.m_cascadeVList[iv];
196  vrt.indexInSimpleCascade=-1; // set to -1 for merged vertices not present in simple list
197  if(vrt.mergedTO) continue; // vertex is merged with another one;
198  vrt.indexInSimpleCascade=vCounter; // vertex position in simple cascade structure
199  vCounter++;
200  }
201 //---- Fill vertices in simple structure
202  vCounter=0;
203  for(iv=0; iv<NVC; iv++){
204  const cascadeV &vrt=cstate.m_cascadeVList[iv];
205  if(vrt.mergedTO) continue; // vertex is merged with another one;
206  for(it=0; it<(int)vrt.trkInVrt.size(); it++) vrtDef[vCounter].push_back(vrt.trkInVrt[it]); //copy real tracks
207  for(ip=0; ip<(int)vrt.inPointingV.size(); ip++) {
208  //int indInFull=vrt.inPointingV[ip]; // pointing vertex in full list WRONG!!!
209  int indInFull=indexInV(vrt.inPointingV[ip], cstate); // pointing vertex in full list
210  int indInSimple=cstate.m_cascadeVList[indInFull].indexInSimpleCascade; // its index in simple structure
211  if(indInSimple<0) continue; // merged out vertex. Will be added as tracks
212  cascadeDef[vCounter].push_back(indInSimple);
213  }
214  nVAdd=vrt.mergedIN.size();
215  if( nVAdd ) { //----------------------------- mergedIN(added) vertices exist
216  for(iva=0; iva<nVAdd; iva++){
217  const cascadeV &vrtM=cstate.m_cascadeVList[vrt.mergedIN[iva]]; // merged/added vertex itself
218  for(it=0; it<(int)vrtM.trkInVrt.size(); it++) vrtDef[vCounter].push_back(vrtM.trkInVrt[it]);
219  for(ip=0; ip<(int)vrtM.inPointingV.size(); ip++) {
220  //int indInFull=vrtM.inPointingV[ip]; // pointing vertex in full list WRONG!!!
221  int indInFull=indexInV(vrtM.inPointingV[ip], cstate); // pointing vertex in full list
222  int indInSimple=cstate.m_cascadeVList[indInFull].indexInSimpleCascade; // its index in simple structure
223  if(indInSimple<0) continue; // merged out vertex. Will be added as tracks
224  cascadeDef[vCounter].push_back(indInSimple);
225  }
226  }
227  }
228 
229  vCounter++;
230  }
231  vrtDef.resize(vCounter);
232  cascadeDef.resize(vCounter);
233 }

◆ makeState()

std::unique_ptr< IVKalState > Trk::TrkVKalVrtFitter::makeState ( const EventContext &  ctx) const
finaloverridevirtual

Definition at line 118 of file TrkVKalVrtFitter.cxx.

119 {
120  auto state = std::make_unique<State>();
121  initState(ctx, *state);
122  return state;
123 }

◆ makeXAODVertex()

xAOD::Vertex * Trk::TrkVKalVrtFitter::makeXAODVertex ( int  Neutrals,
const Amg::Vector3D Vertex,
const dvect fitErrorMatrix,
const dvect Chi2PerTrk,
const std::vector< dvect > &  TrkAtVrt,
double  Chi2,
State state 
) const
private

Definition at line 723 of file TrkVKalVrtFitter.cxx.

728 {
729  long int NTrk = state.m_FitStatus;
730  long int Ndf = VKalGetNDOF(state)+state.m_planeCnstNDOF;
731 
732  xAOD::Vertex * tmpVertex=new xAOD::Vertex();
733  tmpVertex->makePrivateStore();
734  tmpVertex->setPosition(Vertex);
735  tmpVertex->setFitQuality(Chi2, (float)Ndf);
736 
737  std::vector<VxTrackAtVertex> & tmpVTAV=tmpVertex->vxTrackAtVertex();
738  tmpVTAV.clear();
739  std::vector <double> CovFull;
740  StatusCode sc = VKalGetFullCov( NTrk, CovFull, state);
741  int covarExist=0; if( sc.isSuccess() ) covarExist=1;
742 
743  std::vector<float> floatErrMtx;
744  if( m_makeExtendedVertex && covarExist ) {
745  floatErrMtx.resize(CovFull.size());
746  for(int i=0; i<(int)CovFull.size(); i++) floatErrMtx[i]=CovFull[i];
747  }else{
748  floatErrMtx.resize(fitErrorMatrix.size());
749  for(int i=0; i<(int)fitErrorMatrix.size(); i++) floatErrMtx[i]=fitErrorMatrix[i];
750  }
751  tmpVertex->setCovariance(floatErrMtx);
752 
753  for(int ii=0; ii<NTrk ; ii++) {
754  AmgSymMatrix(5) CovMtxP;
755  if(covarExist){ FillMatrixP( ii, CovMtxP, CovFull );}
756  else { CovMtxP.setIdentity();}
757  Perigee * tmpChargPer=nullptr;
758  NeutralPerigee * tmpNeutrPer=nullptr;
759  if(ii<NTrk-Neutrals){
760  tmpChargPer = new Perigee( 0.,0., TrkAtVrt[ii][0],
761  TrkAtVrt[ii][1],
762  TrkAtVrt[ii][2],
763  PerigeeSurface(Vertex), std::move(CovMtxP) );
764  }else{
765  tmpNeutrPer = new NeutralPerigee( 0.,0., TrkAtVrt[ii][0],
766  TrkAtVrt[ii][1],
767  TrkAtVrt[ii][2],
768  PerigeeSurface(Vertex),
769  std::move(CovMtxP) );
770  }
771  tmpVTAV.emplace_back(Chi2PerTrk[ii], tmpChargPer, tmpNeutrPer );
772  }
773 
774  return tmpVertex;
775 }

◆ nextVertex() [1/2]

VertexID Trk::TrkVKalVrtFitter::nextVertex ( const std::vector< const xAOD::TrackParticle * > &  list,
std::span< const double >  particleMass,
const std::vector< VertexID > &  precedingVertices,
IVKalState istate,
double  massConstraint = 0. 
) const
finaloverride

Definition at line 144 of file TrkCascadeFitter.cxx.

149 {
150  assert(dynamic_cast<State*> (&istate)!=nullptr);
151  State& state = static_cast<State&> (istate);
152  CascadeState& cstate = *state.m_cascadeState;
153 
154  VertexID vID=nextVertex( list, particleMass, istate, massConstraint);
155 //
156  int lastC=cstate.m_partMassCnstForCascade.size()-1; // Check if full vertex mass constraint exist
157  if( lastC>=0 ){ if( cstate.m_partMassCnstForCascade[lastC].VRT == vID ){
158  for(int iv=0; iv<(int)precedingVertices.size(); iv++){
159  cstate.m_partMassCnstForCascade[lastC].pseudoInVrt.push_back(precedingVertices[iv]); }
160  }
161  }
162 //
163 //-- New vertex structure-----------------------------------
164  int lastV=cstate.m_cascadeVList.size()-1;
165  for(int iv=0; iv<(int)precedingVertices.size(); iv++){
166  cstate.m_cascadeVList[lastV].inPointingV.push_back(precedingVertices[iv]); // fill preceding vertices list
167  }
168 //--
169  return vID;
170 }

◆ nextVertex() [2/2]

VertexID Trk::TrkVKalVrtFitter::nextVertex ( const std::vector< const xAOD::TrackParticle * > &  list,
std::span< const double >  particleMass,
IVKalState istate,
double  massConstraint = 0. 
) const
finaloverride

Definition at line 97 of file TrkCascadeFitter.cxx.

101 {
102  assert(dynamic_cast<State*> (&istate)!=nullptr);
103  State& state = static_cast<State&> (istate);
104  CascadeState& cstate = *state.m_cascadeState;
105 
106 //----
107  int NV = cstate.m_cascadeSize++;
108  VertexID new_vID=10000+NV;
109 //----
110  int NTRK = list.size();
111  int presentNT = cstate.m_partListForCascade.size();
112 //----
113 
114  double totMass=0;
115  for(int it=0; it<NTRK; it++){
116  cstate.m_partListForCascade.push_back(list[it]);
117  cstate.m_partMassForCascade.push_back(particleMass[it]);
118  totMass += particleMass[it];
119  }
120 //---------------------- Fill complete vertex mass constraint
121  if(totMass < massConstraint) {
122  PartialMassConstraint tmpMcnst;
123  tmpMcnst.Mass = massConstraint;
124  tmpMcnst.VRT = new_vID;
125  for(int it=0; it<NTRK; it++)tmpMcnst.trkInVrt.push_back(it+presentNT);
126  cstate.m_partMassCnstForCascade.push_back(std::move(tmpMcnst));
127  }
128 //
129 //
130 //-- New vertex structure-----------------------------------
131  cascadeV newV; newV.vID=new_vID;
132  for(int it=0; it<NTRK; it++){
133  newV.trkInVrt.push_back(it+presentNT);
134  }
135  cstate.m_cascadeVList.push_back(std::move(newV));
136 //--------------------------------------------------------------
137  return new_vID;
138 }

◆ printSimpleCascade()

void Trk::TrkVKalVrtFitter::printSimpleCascade ( std::vector< std::vector< int > > &  vrtDef,
std::vector< std::vector< int > > &  cascadeDef,
const CascadeState cstate 
)
staticprivate

Definition at line 237 of file TrkCascadeFitter.cxx.

240 {
241  int kk,kkk;
242  for(kk=0; kk<(int)vrtDef.size(); kk++){
243  std::cout<<" Vertex("<<kk<<"):: trk=";
244  for(kkk=0; kkk<(int)vrtDef[kk].size(); kkk++){
245  std::cout<<vrtDef[kk][kkk]<<", ";} std::cout<<" pseu=";
246  for(kkk=0; kkk<(int)cascadeDef[kk].size(); kkk++){
247  std::cout<<cascadeDef[kk][kkk]<<", ";}
248  } std::cout<<'\n';
249 //---
250  for(kk=0; kk<(int)vrtDef.size(); kk++){
251  std::cout<<" Vertex("<<kk<<"):: trkM=";
252  for(kkk=0; kkk<(int)vrtDef[kk].size(); kkk++){
253  std::cout<<cstate.m_partMassForCascade[vrtDef[kk][kkk]]<<", ";}
254  }std::cout<<'\n';
255 //--
256  for (const PartialMassConstraint& c : cstate.m_partMassCnstForCascade) {
257  std::cout<<" MCnst vID=";
258  std::cout<<c.VRT<<" m="<<c.Mass<<" trk=";
259  for(int idx : c.trkInVrt) {
260  std::cout<<idx<<", ";
261  }
262  std::cout<<" pseudo=";
263  for (VertexID id : c.pseudoInVrt) {
264  std::cout<<id<<", ";
265  }
266  std::cout<<'\n';
267  }
268 }

◆ setApproximateVertex()

void Trk::TrkVKalVrtFitter::setApproximateVertex ( double  X,
double  Y,
double  Z,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 108 of file SetFitOptions.cxx.

110  {
111  assert(dynamic_cast<State*> (&istate)!=nullptr);
112  State& state = static_cast<State&> (istate);
113  state.m_ApproximateVertex.assign ({X, Y, Z});
114  }

◆ setAthenaPropagator()

void Trk::TrkVKalVrtFitter::setAthenaPropagator ( const Trk::IExtrapolator Pnt)
private

Definition at line 473 of file VKalExtPropagator.cxx.

474  {
475  // Save external propagator in VKalExtPropagator object and send it to TrkVKalVrtCore
476 //
477  if(m_fitPropagator != nullptr) delete m_fitPropagator;
478  m_fitPropagator = new VKalExtPropagator( this );
480  m_InDetExtrapolator = Pnt; // Pointer to InDet extrapolator
481  }

◆ setCnstType()

void Trk::TrkVKalVrtFitter::setCnstType ( int  TYPE,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 82 of file SetFitOptions.cxx.

83  {
84  assert(dynamic_cast<State*> (&istate)!=nullptr);
85  State& state = static_cast<State&> (istate);
86  if(TYPE>0)msg(MSG::DEBUG)<< "ConstraintType is changed at execution stage. New type="<<TYPE<< endmsg;
87  if(TYPE<0)TYPE=0;
88  if(TYPE>14)TYPE=0;
89  if( TYPE == 2) state.m_usePointingCnst = true;
90  if( TYPE == 3) state.m_useZPointingCnst = true;
91  if( TYPE == 4) state.m_usePointingCnst = true;
92  if( TYPE == 5) state.m_useZPointingCnst = true;
93  if( TYPE == 6) state.m_useAprioriVertex = true;
94  if( TYPE == 7) state.m_usePassWithTrkErr = true;
95  if( TYPE == 8) state.m_usePassWithTrkErr = true;
96  if( TYPE == 9) state.m_usePassNear = true;
97  if( TYPE == 10) state.m_usePassNear = true;
98  if( TYPE == 11) state.m_usePhiCnst = true;
99  if( TYPE == 12) { state.m_usePhiCnst = true; state.m_useThetaCnst = true;}
100  if( TYPE == 13) { state.m_usePhiCnst = true; state.m_usePassNear = true;}
101  if( TYPE == 14) { state.m_usePhiCnst = true; state.m_useThetaCnst = true; state.m_usePassNear = true;}
102  }

◆ setCovVrtForConstraint()

void Trk::TrkVKalVrtFitter::setCovVrtForConstraint ( double  XX,
double  XY,
double  YY,
double  XZ,
double  YZ,
double  ZZ,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 178 of file SetFitOptions.cxx.

181  {
182  assert(dynamic_cast<State*> (&istate)!=nullptr);
183  State& state = static_cast<State&> (istate);
184  state.m_CovVrtForConstraint.assign ({XX, XY, YY, XZ, YZ, ZZ});
185  }

◆ setMassForConstraint() [1/2]

void Trk::TrkVKalVrtFitter::setMassForConstraint ( double  Mass,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 134 of file SetFitOptions.cxx.

136  {
137  assert(dynamic_cast<State*> (&istate)!=nullptr);
138  State& state = static_cast<State&> (istate);
139  state.m_massForConstraint = MASS;
140  }

◆ setMassForConstraint() [2/2]

void Trk::TrkVKalVrtFitter::setMassForConstraint ( double  Mass,
std::span< const int >  TrkIndex,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 142 of file SetFitOptions.cxx.

145  {
146  assert(dynamic_cast<State*> (&istate)!=nullptr);
147  State& state = static_cast<State&> (istate);
148  state.m_partMassCnst.push_back(MASS);
149  state.m_partMassCnstTrk.emplace_back(TrkIndex.begin(), TrkIndex.end());
150  }

◆ setMassInputParticles()

void Trk::TrkVKalVrtFitter::setMassInputParticles ( const std::vector< double > &  mass,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 187 of file SetFitOptions.cxx.

189  {
190  assert(dynamic_cast<State*> (&istate)!=nullptr);
191  State& state = static_cast<State&> (istate);
192  state.m_MassInputParticles = mass;
193  for (double& m : state.m_MassInputParticles) {
194  m = std::abs(m);
195  }
196  }

◆ setRobustness()

void Trk::TrkVKalVrtFitter::setRobustness ( int  IROB,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 116 of file SetFitOptions.cxx.

117  { if(IROB>0)msg(MSG::DEBUG)<< "Robustness is changed at execution stage "<<m_Robustness<<"=>"<<IROB<< endmsg;
118  assert(dynamic_cast<State*> (&istate)!=nullptr);
119  State& state = static_cast<State&> (istate);
120  state.m_Robustness = IROB;
121  if(state.m_Robustness<0)state.m_Robustness=0;
122  if(state.m_Robustness>7)state.m_Robustness=0;
123  }

◆ setRobustScale()

void Trk::TrkVKalVrtFitter::setRobustScale ( double  Scale,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 125 of file SetFitOptions.cxx.

126  { if(Scale!=m_RobustScale)msg(MSG::DEBUG)<< "Robust Scale is changed at execution stage "<<m_RobustScale<<"=>"<<Scale<< endmsg;
127  assert(dynamic_cast<State*> (&istate)!=nullptr);
128  State& state = static_cast<State&> (istate);
129  state.m_RobustScale = Scale;
130  if(state.m_RobustScale<0.01) state.m_RobustScale=1.;
131  if(state.m_RobustScale>100.) state.m_RobustScale=1.;
132  }

◆ setVertexForConstraint() [1/2]

void Trk::TrkVKalVrtFitter::setVertexForConstraint ( const xAOD::Vertex Vrt,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 152 of file SetFitOptions.cxx.

154  {
155  assert(dynamic_cast<State*> (&istate)!=nullptr);
156  State& state = static_cast<State&> (istate);
157  state.m_VertexForConstraint.assign ({Vrt.position().x(),
158  Vrt.position().y(),
159  Vrt.position().z()});
160 
161  state.m_CovVrtForConstraint.assign ({
162  Vrt.covariancePosition()(Trk::x,Trk::x),
163  Vrt.covariancePosition()(Trk::x,Trk::y),
164  Vrt.covariancePosition()(Trk::y,Trk::y),
165  Vrt.covariancePosition()(Trk::x,Trk::z),
166  Vrt.covariancePosition()(Trk::y,Trk::z),
167  Vrt.covariancePosition()(Trk::z,Trk::z)});
168  }

◆ setVertexForConstraint() [2/2]

void Trk::TrkVKalVrtFitter::setVertexForConstraint ( double  X,
double  Y,
double  Z,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 170 of file SetFitOptions.cxx.

172  {
173  assert(dynamic_cast<State*> (&istate)!=nullptr);
174  State& state = static_cast<State&> (istate);
175  state.m_VertexForConstraint.assign ({X, Y, Z});
176  }

◆ startVertex()

VertexID Trk::TrkVKalVrtFitter::startVertex ( const std::vector< const xAOD::TrackParticle * > &  list,
std::span< const double >  particleMass,
IVKalState istate,
double  massConstraint = 0. 
) const
finaloverride

Interface for cascade fit.

Definition at line 62 of file TrkCascadeFitter.cxx.

66 {
67  assert(dynamic_cast<State*> (&istate)!=nullptr);
68  State& state = static_cast<State&> (istate);
69  state.m_cascadeState = std::make_unique<CascadeState>();
70  state.m_vkalFitControl.renewCascadeEvent(new CascadeEvent());
71 
72  return nextVertex (list, particleMass, istate, massConstraint);
73 }

◆ VKalGetFullCov()

StatusCode Trk::TrkVKalVrtFitter::VKalGetFullCov ( long int  NTrk,
dvect CovMtx,
IVKalState istate,
bool  useMom = false 
) const
finaloverridevirtual

Definition at line 434 of file VKalVrtFitSvc.cxx.

437  {
438  assert(dynamic_cast<State*> (&istate)!=nullptr);
439  State& state = static_cast<State&> (istate);
440  if(!state.m_FitStatus) return StatusCode::FAILURE;
441  if(NTrk<1) return StatusCode::FAILURE;
442  if(NTrk>NTrMaxVFit) return StatusCode::FAILURE;
443  if(state.m_ErrMtx.empty()) return StatusCode::FAILURE; //Now error matrix is taken from CORE in VKalVrtFit3.
444 //
445 // ------ Magnetic field access
446 //
447  double fx,fy,BMAG_CUR;
448  state.m_fitField.getMagFld(state.m_save_xyzfit[0],state.m_save_xyzfit[1],state.m_save_xyzfit[2],fx,fy,BMAG_CUR);
449  if(fabs(BMAG_CUR) < 0.01) BMAG_CUR=0.01; // Safety
450 //
451 // ------ Base code
452 //
453  int i,j,ik,jk,ip,iTrk;
454  int DIM=3*NTrk+3; //Current size of full covariance matrix
455  std::vector<std::vector<double> > Deriv (DIM);
456  for (std::vector<double>& v : Deriv) v.resize (DIM);
457  std::vector<double> CovMtxOld(DIM*DIM);
458 
459 
460  CovVrtTrk.resize(DIM*(DIM+1)/2);
461 
462  ip=0;
463  for( i=0; i<DIM;i++) {
464  for( j=0; j<=i; j++) {
465  CovMtxOld[i*DIM+j]=CovMtxOld[j*DIM+i]=state.m_ErrMtx[ip++];
466  }
467  }
468 
469  //delete [] ErrMtx;
470 
471  for(i=0;i<DIM;i++){ for(j=0;j<DIM;j++) {Deriv[i][j]=0.;}}
472  Deriv[0][0]= 1.;
473  Deriv[1][1]= 1.;
474  Deriv[2][2]= 1.;
475 
476  int iSt=0;
477  double Theta,invR,Phi;
478  for( iTrk=0; iTrk<NTrk; iTrk++){
479  Theta=state.m_parfs[iTrk][0];
480  Phi =state.m_parfs[iTrk][1];
481  invR =state.m_parfs[iTrk][2];
482  /*-----------*/
483  /* dNew/dOld */
484  iSt = 3 + iTrk*3;
485  if( !useMom ){
486  Deriv[iSt ][iSt+1] = 1; // Phi <-> Theta
487  Deriv[iSt+1][iSt ] = 1; // Phi <-> Theta
488  Deriv[iSt+2][iSt ] = -(cos(Theta)/(m_CNVMAG*BMAG_CUR)) * invR ; // d1/p / dTheta
489  Deriv[iSt+2][iSt+2] = -(sin(Theta)/(m_CNVMAG*BMAG_CUR)) ; // d1/p / d1/R
490  }else{
491  double pt=(m_CNVMAG*BMAG_CUR)/fabs(invR);
492  double px=pt*cos(Phi);
493  double py=pt*sin(Phi);
494  double pz=pt/tan(Theta);
495  Deriv[iSt ][iSt ]= 0; //dPx/dTheta
496  Deriv[iSt ][iSt+1]= -py; //dPx/dPhi
497  Deriv[iSt ][iSt+2]= -px/invR; //dPx/dinvR
498 
499  Deriv[iSt+1][iSt ]= 0; //dPy/dTheta
500  Deriv[iSt+1][iSt+1]= px; //dPy/dPhi
501  Deriv[iSt+1][iSt+2]= -py/invR; //dPy/dinvR
502 
503  Deriv[iSt+2][iSt ]= -pt/sin(Theta)/sin(Theta); //dPz/dTheta
504  Deriv[iSt+2][iSt+1]= 0; //dPz/dPhi
505  Deriv[iSt+2][iSt+2]= -pz/invR; //dPz/dinvR
506  }
507  }
508 //---------- Only upper half if filled and saved
509  int ipnt=0;
510  double tmp, tmpTmp;
511  for(i=0;i<DIM;i++){
512  for(j=0;j<=i;j++){
513  tmp=0.;
514  for(ik=0;ik<DIM;ik++){
515  if(Deriv[i][ik] == 0.) continue;
516  tmpTmp=0;
517  for(jk=DIM-1;jk>=0;jk--){
518  if(Deriv[j][jk] == 0.) continue;
519  tmpTmp += CovMtxOld[ik*DIM+jk]*Deriv[j][jk];
520  }
521  tmp += Deriv[i][ik]*tmpTmp;
522  }
523  CovVrtTrk[ipnt++]=tmp;
524  }}
525 
526  return StatusCode::SUCCESS;
527 
528  }

◆ VKalGetImpact() [1/4]

double Trk::TrkVKalVrtFitter::VKalGetImpact ( const Trk::Perigee InpPerigee,
const Amg::Vector3D Vertex,
const long int  Charge,
dvect Impact,
dvect ImpactError 
) const
finaloverridevirtual

Definition at line 21 of file VKalGetImpact.cxx.

26  {
27  State state;
28  initState (state);
29  return VKalGetImpact (InpPerigee, Vertex, Charge, Impact, ImpactError, state);
30  }

◆ VKalGetImpact() [2/4]

double Trk::TrkVKalVrtFitter::VKalGetImpact ( const Trk::Perigee InpPerigee,
const Amg::Vector3D Vertex,
const long int  Charge,
dvect Impact,
dvect ImpactError,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 32 of file VKalGetImpact.cxx.

38  {
39  assert(dynamic_cast<State*> (&istate)!=nullptr);
40  State& state = static_cast<State&> (istate);
41 
42  //
43  //------ Variables and arrays needed for fitting kernel
44  //
45  double SIGNIF=0.;
46  std::vector<const Trk::Perigee*> InpPerigeeList;
47  InpPerigeeList.push_back(InpPerigee);
48 
49  //
50  //------ extract information about selected tracks
51  //
52  int ntrk=0;
53  StatusCode sc = CvtPerigee(InpPerigeeList, ntrk, state);
54  if(sc.isFailure() || ntrk != 1) { //Something is wrong in conversion
55  Impact.assign(5,1.e10);
56  ImpactError.assign(3,1.e20);
57  return 1.e10;
58  }
59  long int vkCharge = state.m_ich[0];
60  if(Charge==0) vkCharge=0;
61 
62  //
63  // Target vertex in ref.frame defined by track themself
64  //
65  double VrtInp[3]={Vertex.x()-state.m_refFrameX,
66  Vertex.y()-state.m_refFrameY,
67  Vertex.z()-state.m_refFrameZ};
68  double VrtCov[6]={0.,0.,0.,0.,0.,0.};
69 
70  Impact.resize(5);
71  ImpactError.resize(3);
72  Trk::cfimp(0, vkCharge, 0,
73  &state.m_apar[0][0], &state.m_awgt[0][0],
74  &VrtInp[0], &VrtCov[0],
75  Impact.data(), ImpactError.data(),
76  &SIGNIF, &state.m_vkalFitControl);
77 
78  return SIGNIF;
79  }

◆ VKalGetImpact() [3/4]

double Trk::TrkVKalVrtFitter::VKalGetImpact ( const xAOD::TrackParticle InpTrk,
const Amg::Vector3D Vertex,
const long int  Charge,
dvect Impact,
dvect ImpactError 
) const
finaloverridevirtual

Definition at line 82 of file VKalGetImpact.cxx.

84  {
85  State state;
86  initState (state);
87  return VKalGetImpact (InpTrk, Vertex, Charge, Impact, ImpactError, state);
88  }

◆ VKalGetImpact() [4/4]

double Trk::TrkVKalVrtFitter::VKalGetImpact ( const xAOD::TrackParticle InpTrk,
const Amg::Vector3D Vertex,
const long int  Charge,
dvect Impact,
dvect ImpactError,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 91 of file VKalGetImpact.cxx.

94  {
95  assert(dynamic_cast<State*> (&istate)!=nullptr);
96  State& state = static_cast<State&> (istate);
97 //
98 //------ Variables and arrays needed for fitting kernel
99 //
100  double SIGNIF=0.;
101 
102  std::vector<const xAOD::TrackParticle*> InpTrkList(1,InpTrk);
103 //
104 
105 //
106 //------ extract information about selected tracks
107 //
108  int ntrk=0;
109  StatusCode sc = CvtTrackParticle(InpTrkList,ntrk,state);
110  if(sc.isFailure() || ntrk != 1 ) { //Something is wrong in conversion
111  Impact.assign(5,1.e10);
112  ImpactError.assign(3,1.e20);
113  return 1.e10;
114  }
115  if(std::abs(Vertex.z())>m_IDsizeZ || Vertex.perp()>m_IDsizeR){ // Crazy user request
116  Impact.assign(5,1.e10);
117  ImpactError.assign(3,1.e20);
118  return 1.e10;
119  }
120  long int vkCharge=state.m_ich[0];
121  if(Charge==0)vkCharge=0;
122 //
123 // Target vertex in ref.frame defined by track itself
124 //
125  double VrtInp[3]={Vertex.x() -state.m_refFrameX, Vertex.y() -state.m_refFrameY, Vertex.z() -state.m_refFrameZ};
126  double VrtCov[6]={0.,0.,0.,0.,0.,0.};
127 //
128 //
129  Impact.resize(5); ImpactError.resize(3);
130  Trk::cfimp( 0, vkCharge, 0, &state.m_apar[0][0], &state.m_awgt[0][0], &VrtInp[0], &VrtCov[0], Impact.data(), ImpactError.data(), &SIGNIF, &state.m_vkalFitControl);
131 
132  return SIGNIF;
133 
134  }

◆ VKalGetMassError()

StatusCode Trk::TrkVKalVrtFitter::VKalGetMassError ( double &  Mass,
double &  MassError,
const IVKalState istate 
) const
finaloverridevirtual

Definition at line 534 of file VKalVrtFitSvc.cxx.

536  {
537  assert(dynamic_cast<const State*> (&istate)!=nullptr);
538  const State& state = static_cast<const State&> (istate);
539  if(!state.m_FitStatus) return StatusCode::FAILURE;
540  dM = state.m_vkalFitControl.getVertexMass();
541  MassError = state.m_vkalFitControl.getVrtMassError();
542  return StatusCode::SUCCESS;
543  }

◆ VKalGetNDOF()

int Trk::TrkVKalVrtFitter::VKalGetNDOF ( const State state)
staticprivate

Definition at line 562 of file VKalVrtFitSvc.cxx.

563  {
564  if(!state.m_FitStatus) return 0;
565  int NDOF=2*state.m_FitStatus-3;
566  if(state.m_usePointingCnst) { NDOF+=2; }
567  else if(state.m_useZPointingCnst) { NDOF+=1; }
568  if( state.m_usePassNear || state.m_usePassWithTrkErr ) { NDOF+= 2; }
569 
570  if( state.m_massForConstraint>0. ) { NDOF+=1; }
571  if( !state.m_partMassCnst.empty() ) { NDOF+= state.m_partMassCnst.size(); }
572  if( state.m_useAprioriVertex ) { NDOF+= 3; }
573  if( state.m_usePhiCnst ) { NDOF+=1; }
574  if( state.m_useThetaCnst ) { NDOF+=1; }
575  return NDOF;
576  }

◆ VKalGetTrkWeights()

StatusCode Trk::TrkVKalVrtFitter::VKalGetTrkWeights ( dvect Weights,
const IVKalState istate 
) const
finaloverridevirtual

Definition at line 546 of file VKalVrtFitSvc.cxx.

548  {
549  assert(dynamic_cast<const State*> (&istate)!=nullptr);
550  const State& state = static_cast<const State&> (istate);
551  if(!state.m_FitStatus) return StatusCode::FAILURE; // no fit made
552  trkWeights.clear();
553 
554  int NTRK=state.m_FitStatus;
555 
556  for (int i=0; i<NTRK; i++) trkWeights.push_back(state.m_vkalFitControl.vk_forcft.robres[i]);
557 
558  return StatusCode::SUCCESS;
559  }

◆ VKalToTrkTrack()

void Trk::TrkVKalVrtFitter::VKalToTrkTrack ( double  curBMAG,
double  vp1,
double  vp2,
double  vp3,
double &  tp1,
double &  tp2,
double &  tp3 
) const
private

Definition at line 406 of file VKalVrtFitSvc.cxx.

409  { tp1= vp2; //phi angle
410  tp2= vp1; //theta angle
411  tp3= vp3 * std::sin( vp1 ) /(m_CNVMAG*curBMAG);
412  constexpr double pi = M_PI;
413  // -pi < phi < pi range
414  while ( tp1 > pi) tp1 -= 2.*pi;
415  while ( tp1 <-pi) tp1 += 2.*pi;
416  // 0 < Theta < pi range
417  while ( tp2 > pi) tp2 -= 2.*pi;
418  while ( tp2 <-pi) tp2 += 2.*pi;
419  if ( tp2 < 0.) {
420  tp2 = fabs(tp2); tp1 += pi;
421  while ( tp1 > pi) tp1 -= 2.*pi;
422  }
423 
424  }

◆ VKalTransform()

void Trk::TrkVKalVrtFitter::VKalTransform ( double  MAG,
double  A0V,
double  ZV,
double  PhiV,
double  ThetaV,
double  PInv,
const double  CovTrk[15],
long int &  Charge,
double  VTrkPar[5],
double  VTrkCov[15] 
) const
private

Definition at line 59 of file VKalTransform.cxx.

62  {
63  int i,j,ii,jj;
64  double CnvCst=m_CNVMAG*BMAG_FIXED;
65  double sinT = sin(ThetaV);
66  double cosT = cos(ThetaV);
67 
68  VTrkPar[0] = - A0V ;
69  VTrkPar[1] = ZV ;
70  VTrkPar[2] = ThetaV;
71  VTrkPar[3] = PhiV;
72  VTrkPar[4] = -PInv*CnvCst/sinT ;
73  Charge = PInv > 0 ? -1 : 1;
74 //
75 //
76  double CovI[5][5];
77  double Deriv[5][5] ={{0.,0.,0.,0.,0.},{0.,0.,0.,0.,0.},{0.,0.,0.,0.,0.},
78  {0.,0.,0.,0.,0.},{0.,0.,0.,0.,0.}};
79 
80  CovI[0][0] = CovTrk[0];
81 
82  CovI[1][0] = CovTrk[1];
83  CovI[0][1] = CovTrk[1];
84  CovI[1][1] = CovTrk[2];
85 
86  CovI[0][2] = CovTrk[3];
87  CovI[2][0] = CovTrk[3];
88  CovI[1][2] = CovTrk[4];
89  CovI[2][1] = CovTrk[4];
90  CovI[2][2] = CovTrk[5];
91 
92  CovI[0][3] = CovTrk[6];
93  CovI[3][0] = CovTrk[6];
94  CovI[1][3] = CovTrk[7];
95  CovI[3][1] = CovTrk[7];
96  CovI[2][3] = CovTrk[8];
97  CovI[3][2] = CovTrk[8];
98  CovI[3][3] = CovTrk[9];
99 
100  CovI[0][4] = CovTrk[10] ;
101  CovI[4][0] = CovTrk[10] ;
102  CovI[1][4] = CovTrk[11] ;
103  CovI[4][1] = CovTrk[11] ;
104  CovI[2][4] = CovTrk[12] ;
105  CovI[4][2] = CovTrk[12] ;
106  CovI[3][4] = CovTrk[13] ;
107  CovI[4][3] = CovTrk[13] ;
108  CovI[4][4] = CovTrk[14] ;
109 
110 
111  Deriv[0][0] = -1.;
112  Deriv[1][1] = 1.;
113  Deriv[2][3] = 1.;
114  Deriv[3][2] = 1.;
115  Deriv[4][3] = PInv*CnvCst *(cosT/sinT/sinT) ;
116  Deriv[4][4] = -CnvCst/sinT;
117 
118  double ct;
119  int ipnt=0;
120  for(i=0;i<5;i++){ for(j=0;j<=i;j++){
121  ct=0.;
122  for(ii=4;ii>=0;ii--){
123  if(Deriv[i][ii] == 0.) continue;
124  for(jj=4;jj>=0;jj--){
125  if(Deriv[j][jj] == 0.) continue;
126  ct += CovI[ii][jj]*Deriv[i][ii]*Deriv[j][jj];};};
127  VTrkCov[ipnt++]=ct;
128  };}
129 
130 }

◆ VKalVrtConfigureFitterCore()

void Trk::TrkVKalVrtFitter::VKalVrtConfigureFitterCore ( int  NTRK,
State state 
) const
private

Definition at line 17 of file SetFitOptions.cxx.

18  {
19  state.m_FitStatus = 0; // Drop all previous fit results
20  state.m_vkalFitControl.vk_forcft = ForCFT();
21 
22  //Set input particle masses
23  for(int it=0; it<NTRK; it++){
24  if( it<(int)state.m_MassInputParticles.size() ) {
25  state.m_vkalFitControl.vk_forcft.wm[it] = (double)(state.m_MassInputParticles[it]);
26  }
27  else { state.m_vkalFitControl.vk_forcft.wm[it]=(double)(139.5702); }
28  }
29  // Set reference vertex for different pointing constraints
30  if(state.m_VertexForConstraint.size() >= 3){
31  state.m_vkalFitControl.vk_forcft.vrt[0] =state.m_VertexForConstraint[0] - state.m_refFrameX;
32  state.m_vkalFitControl.vk_forcft.vrt[1] =state.m_VertexForConstraint[1] - state.m_refFrameY;
33  state.m_vkalFitControl.vk_forcft.vrt[2] =state.m_VertexForConstraint[2] - state.m_refFrameZ;
34  }else {for( int i=0; i<3; i++) state.m_vkalFitControl.vk_forcft.vrt[i] = 0.; }
35  // Set covariance matrix for reference vertex
36  if(state.m_CovVrtForConstraint.size() >= 6){
37  for( int i=0; i<6; i++) { state.m_vkalFitControl.vk_forcft.covvrt[i] = (double)(state.m_CovVrtForConstraint[i]); }
38  }else{ for( int i=0; i<6; i++) { state.m_vkalFitControl.vk_forcft.covvrt[i] = 0.; } }
39 
40  // Add global mass constraint if present
41  if(state.m_massForConstraint >= 0.) state.m_vkalFitControl.setMassCnstData(NTRK,state.m_massForConstraint);
42  // Add partial mass constraints if present
43  if(!state.m_partMassCnst.empty()) {
44  for(int ic=0; ic<(int)state.m_partMassCnst.size(); ic++){
45  state.m_vkalFitControl.setMassCnstData(NTRK, state.m_partMassCnstTrk[ic],state.m_partMassCnst[ic]);
46  }
47  }
48  // Set general configuration parameters
49  state.m_vkalFitControl.setRobustness(state.m_Robustness);
50  state.m_vkalFitControl.setRobustScale(state.m_RobustScale);
51  state.m_vkalFitControl.setUsePlaneCnst(0.,0.,0.,0.);
52  if(state.m_useAprioriVertex) state.m_vkalFitControl.setUseAprioriVrt();
53  if(state.m_useThetaCnst) state.m_vkalFitControl.setUseThetaCnst();
54  if(state.m_usePhiCnst) state.m_vkalFitControl.setUsePhiCnst();
55  if(state.m_usePointingCnst) state.m_vkalFitControl.setUsePointingCnst(1);
56  if(state.m_useZPointingCnst) state.m_vkalFitControl.setUsePointingCnst(2);
57  if(state.m_usePassNear) state.m_vkalFitControl.setUsePassNear(1);
58  if(state.m_usePassWithTrkErr)state.m_vkalFitControl.setUsePassNear(2);
59 
60  if(state.m_frozenVersionForBTagging)state.m_vkalFitControl.m_frozenVersionForBTagging=true;
61 
62  if(m_IterationPrecision>0.) state.m_vkalFitControl.setIterationPrec(m_IterationPrecision);
63  if(m_IterationNumber) state.m_vkalFitControl.setIterationNum(m_IterationNumber);
64  }

◆ VKalVrtCvtTool()

StatusCode Trk::TrkVKalVrtFitter::VKalVrtCvtTool ( const Amg::Vector3D Vertex,
const TLorentzVector &  Momentum,
const dvect CovVrtMom,
const long int &  Charge,
dvect Perigee,
dvect CovPerigee,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 364 of file VKalVrtFitSvc.cxx.

371  {
372  assert(dynamic_cast<State*> (&istate)!=nullptr);
373  State& state = static_cast<State&> (istate);
374  int i,j,ij;
375  double Vrt[3],PMom[4],Cov0[21],Per[5],CovPer[15];
376 
377  for(i=0; i<3; i++) Vrt[i]=Vertex[i];
378  for(i=0; i<3; i++) PMom[i]=Momentum[i];
379  for(ij=i=0; i<6; i++){
380  for(j=0; j<=i; j++){
381  Cov0[ij]=CovVrtMom[ij];
382  ij++;
383  }
384  }
385  state.m_refFrameX=state.m_refFrameY=state.m_refFrameZ=0.; //VK Work in ATLAS ref frame ONLY!!!
386  long int vkCharge=-Charge; //VK 30.11.2009 Change sign according to ATLAS
387 //
388 // ------ Magnetic field in vertex
389 //
390  double fx,fy,BMAG_CUR;
391  state.m_fitField.getMagFld(Vrt[0], Vrt[1], Vrt[2] ,fx,fy,BMAG_CUR);
392  if(fabs(BMAG_CUR) < 0.01) BMAG_CUR=0.01; // Safety
393 
394  Trk::xyztrp( vkCharge, Vrt, PMom, Cov0, BMAG_CUR, Per, CovPer );
395 
396  Perigee.clear();
397  CovPerigee.clear();
398 
399  for(i=0; i<5; i++) Perigee.push_back((double)Per[i]);
400  for(i=0; i<15; i++) CovPerigee.push_back((double)CovPer[i]);
401 
402  return StatusCode::SUCCESS;
403  }

◆ VKalVrtFit() [1/3]

virtual StatusCode Trk::TrkVKalVrtFitter::VKalVrtFit ( const std::vector< const Perigee * > &  ,
Amg::Vector3D Vertex,
TLorentzVector &  Momentum,
long int &  Charge,
dvect ErrorMatrix,
dvect Chi2PerTrk,
std::vector< std::vector< double >> &  TrkAtVrt,
double &  Chi2,
IVKalState istate,
bool  ifCovV0 = false 
) const
finaloverridevirtual

◆ VKalVrtFit() [2/3]

virtual StatusCode Trk::TrkVKalVrtFitter::VKalVrtFit ( const std::vector< const TrackParameters * > &  ,
const std::vector< const NeutralParameters * > &  ,
Amg::Vector3D Vertex,
TLorentzVector &  Momentum,
long int &  Charge,
dvect ErrorMatrix,
dvect Chi2PerTrk,
std::vector< std::vector< double >> &  TrkAtVrt,
double &  Chi2,
IVKalState istate,
bool  ifCovV0 = false 
) const
finaloverridevirtual

◆ VKalVrtFit() [3/3]

virtual StatusCode Trk::TrkVKalVrtFitter::VKalVrtFit ( const std::vector< const xAOD::TrackParticle * > &  ,
const std::vector< const xAOD::NeutralParticle * > &  ,
Amg::Vector3D Vertex,
TLorentzVector &  Momentum,
long int &  Charge,
dvect ErrorMatrix,
dvect Chi2PerTrk,
std::vector< std::vector< double >> &  TrkAtVrt,
double &  Chi2,
IVKalState istate,
bool  ifCovV0 = false 
) const
finaloverridevirtual

◆ VKalVrtFit3()

int Trk::TrkVKalVrtFitter::VKalVrtFit3 ( int  ntrk,
Amg::Vector3D Vertex,
TLorentzVector &  Momentum,
long int &  Charge,
dvect ErrorMatrix,
dvect Chi2PerTrk,
std::vector< std::vector< double >> &  TrkAtVrt,
double &  Chi2,
State state,
bool  ifCovV0 
) const
private

Definition at line 252 of file VKalVrtFitSvc.cxx.

262 {
263 //
264 //------ Variables and arrays needed for fitting kernel
265 //
266  int ierr,i;
267  double xyz0[3],covf[21],chi2f=-10.;
268  double ptot[4]={0.};
269  double xyzfit[3]={0.};
270 //
271 //--- Set field value at (0.,0.,0.) - some safety
272 //
273  double Bx,By,Bz;
274  state.m_fitField.getMagFld(-state.m_refFrameX,-state.m_refFrameY,-state.m_refFrameZ,Bx,By,Bz);
275 //
276 //------ Fit option setting
277 //
278  VKalVrtConfigureFitterCore(ntrk, state);
279 //
280 //------ Fit itself
281 //
282  state.m_FitStatus=0;
283  state.m_vkalFitControl.renewFullCovariance(nullptr); //
284  state.m_vkalFitControl.setVertexMass(-1.);
285  state.m_vkalFitControl.setVrtMassError(-1.);
286  if(state.m_ApproximateVertex.size()==3 && fabs(state.m_ApproximateVertex[2])<m_IDsizeZ &&
287  sqrt(state.m_ApproximateVertex[0]*state.m_ApproximateVertex[0]+state.m_ApproximateVertex[1]*state.m_ApproximateVertex[1])<m_IDsizeR)
288  {
289  xyz0[0]=(double)state.m_ApproximateVertex[0] - state.m_refFrameX;
290  xyz0[1]=(double)state.m_ApproximateVertex[1] - state.m_refFrameY;
291  xyz0[2]=(double)state.m_ApproximateVertex[2] - state.m_refFrameZ;
292  } else {
293  xyz0[0]=xyz0[1]=xyz0[2]=0.;
294  }
295  double par0[NTrMaxVFit][3]; //used only for fit preparation
296  Trk::cfpest( ntrk, xyz0, state.m_ich, state.m_apar, par0);
297 
298  Chi2PerTrk.resize (ntrk);
299  ierr=Trk::CFit( &state.m_vkalFitControl, ifCovV0, ntrk, state.m_ich, xyz0, par0, state.m_apar, state.m_awgt,
300  xyzfit, state.m_parfs, ptot, covf, chi2f,
301  Chi2PerTrk.data());
302 
303  if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG) << "VKalVrt fit status="<<ierr<<" Chi2="<<chi2f<<endmsg;
304 
305  Chi2 = 100000000.;
306  if(ierr){
307  return ierr;
308  }
309  if(ptot[0]*ptot[0]+ptot[1]*ptot[1] == 0.) return -5; // Bad (divergent) fit
310 //
311 // Postfit operation. Creation of array for different error calculations and full error matrix copy
312 //
313  state.m_FitStatus=ntrk;
314  if(ifCovV0 && state.m_vkalFitControl.getFullCovariance()){ //If full fit error matrix is returned by VKalVrtCORE
315  int SymCovMtxSize=(3*ntrk+3)*(3*ntrk+4)/2;
316  state.m_ErrMtx.assign (state.m_vkalFitControl.getFullCovariance(),
317  state.m_vkalFitControl.getFullCovariance()+SymCovMtxSize);
318  state.m_vkalFitControl.renewFullCovariance(nullptr);
319  ErrorMatrix.clear(); ErrorMatrix.reserve(21); ErrorMatrix.assign(covf,covf+21);
320  } else {
321  ErrorMatrix.clear(); ErrorMatrix.reserve(6); ErrorMatrix.assign(covf,covf+6);
322  }
323 //---------------------------------------------------------------------------
324  Momentum.SetPxPyPzE( ptot[0], ptot[1], ptot[2], ptot[3] );
325  Chi2 = (double) chi2f;
326 
327  Vertex[0]= xyzfit[0] + state.m_refFrameX;
328  Vertex[1]= xyzfit[1] + state.m_refFrameY;
329  Vertex[2]= xyzfit[2] + state.m_refFrameZ;
330 
331  if(Vertex.perp()>m_IDsizeR || std::abs(Vertex.z())>m_IDsizeZ)return -5; // Solution outside acceptable volume due to divergence
332 
333  state.m_save_xyzfit[0]=xyzfit[0]; // saving of vertex position
334  state.m_save_xyzfit[1]=xyzfit[1]; // for full error matrix
335  state.m_save_xyzfit[2]=xyzfit[2];
336 //
337 // ------ Magnetic field in fitted vertex
338 //
339  double fx,fy,BMAG_CUR;
340  state.m_fitField.getMagFld(xyzfit[0] ,xyzfit[1] ,xyzfit[2] ,fx,fy,BMAG_CUR);
341  if(fabs(BMAG_CUR) < 0.01) BMAG_CUR=0.01; // Safety
342 
343  Charge=0; for(i=0; i<ntrk; i++){Charge+=state.m_ich[i];};
344  Charge=-Charge; //VK 30.11.2009 Change sign acoording to ATLAS
345 
346 
347  TrkAtVrt.clear(); TrkAtVrt.reserve(ntrk);
348  for(i=0; i<ntrk; i++){
349  std::vector<double> TrkPar(3);
350  VKalToTrkTrack(BMAG_CUR,(double)state.m_parfs[i][0],(double)state.m_parfs[i][1],(double) state.m_parfs[i][2],
351  TrkPar[0],TrkPar[1],TrkPar[2]);
352  TrkPar[2] = -TrkPar[2]; // Change of sign needed
353  TrkAtVrt.push_back( TrkPar );
354  }
355  return 0;
356  }

◆ VKalVrtFitFast() [1/3]

virtual StatusCode Trk::TrkVKalVrtFitter::VKalVrtFitFast ( const std::span< const xAOD::TrackParticle *const ,
Amg::Vector3D Vertex,
IVKalState istate 
) const
finaloverridevirtual

◆ VKalVrtFitFast() [2/3]

StatusCode Trk::TrkVKalVrtFitter::VKalVrtFitFast ( const std::vector< const TrackParameters * > &  InpTrk,
Amg::Vector3D Vertex,
IVKalState istate 
) const
finaloverridevirtual

Definition at line 107 of file VKalVrtFitFastSvc.cxx.

110  {
111  assert(dynamic_cast<State*> (&istate)!=nullptr);
112  State& state = static_cast<State&> (istate);
113 //
114 // Convert particles and setup reference frame
115 //
116  int ntrk=0;
117  StatusCode sc = CvtTrackParameters(InpTrk,ntrk,state);
118  if(sc.isFailure() || ntrk<1 ) return StatusCode::FAILURE;
119  double fx,fy,BMAG_CUR;
120  state.m_fitField.getMagFld(0.,0.,0.,fx,fy,BMAG_CUR);
121  if(fabs(BMAG_CUR) < 0.1) BMAG_CUR=0.1;
122 //
123 //------ Variables and arrays needed for fitting kernel
124 //
125  double out[3];
126  std::vector<double> xx,yy,zz;
127  Vertex[0]=Vertex[1]=Vertex[2]=0.;
128 //
129 //
130  double xyz0[3]={ -state.m_refFrameX, -state.m_refFrameY, -state.m_refFrameZ};
131  if(ntrk==2){
132  Trk::vkvFastV(&state.m_apar[0][0],&state.m_apar[1][0], xyz0, BMAG_CUR, out);
133  } else {
134  for(int i=0;i<ntrk-1; i++){
135  for(int j=i+1; j<ntrk; j++){
136  Trk::vkvFastV(&state.m_apar[i][0],&state.m_apar[j][0], xyz0, BMAG_CUR, out);
137  xx.push_back(out[0]);
138  yy.push_back(out[1]);
139  zz.push_back(out[2]);
140  }
141  }
142  out[0] = median(xx);
143  out[1] = median(yy);
144  out[2] = median(zz);
145 
146  }
147  Vertex[0]= out[0] + state.m_refFrameX;
148  Vertex[1]= out[1] + state.m_refFrameY;
149  Vertex[2]= out[2] + state.m_refFrameZ;
150 
151 
152  return StatusCode::SUCCESS;
153  }

◆ VKalVrtFitFast() [3/3]

StatusCode Trk::TrkVKalVrtFitter::VKalVrtFitFast ( std::span< const xAOD::TrackParticle *const InpTrk,
Amg::Vector3D Vertex,
double &  minDZ,
IVKalState istate 
) const
virtual

Definition at line 56 of file VKalVrtFitFastSvc.cxx.

59  {
60  assert(dynamic_cast<State*> (&istate)!=nullptr);
61  State& state = static_cast<State&> (istate);
62 //
63 // Convert particles and setup reference frame
64 //
65  int ntrk=0;
66  StatusCode sc = CvtTrackParticle(InpTrk,ntrk,state);
67  if(sc.isFailure() || ntrk<1 ) return StatusCode::FAILURE;
68  double fx,fy,BMAG_CUR;
69  state.m_fitField.getMagFld(0.,0.,0.,fx,fy,BMAG_CUR);
70  if(fabs(BMAG_CUR) < 0.1) BMAG_CUR=0.1;
71 //
72 //------ Variables and arrays needed for fitting kernel
73 //
74  double out[3];
75  std::vector<double> xx,yy,zz,difz;
76  Vertex[0]=Vertex[1]=Vertex[2]=0.;
77 //
78 //
79  double xyz0[3]={ -state.m_refFrameX, -state.m_refFrameY, -state.m_refFrameZ};
80  if(ntrk==2){
81  minDZ=Trk::vkvFastV(&state.m_apar[0][0],&state.m_apar[1][0], xyz0, BMAG_CUR, out);
82  } else {
83  for(int i=0;i<ntrk-1; i++){
84  for(int j=i+1; j<ntrk; j++){
85  double dZ=Trk::vkvFastV(&state.m_apar[i][0],&state.m_apar[j][0], xyz0, BMAG_CUR, out);
86  xx.push_back(out[0]);
87  yy.push_back(out[1]);
88  zz.push_back(out[2]);
89  difz.push_back(dZ);
90  }
91  }
92  out[0] = median(xx);
93  out[1] = median(yy);
94  out[2] = median(zz);
95  minDZ = median(difz);
96  }
97  Vertex[0]= out[0] + state.m_refFrameX;
98  Vertex[1]= out[1] + state.m_refFrameY;
99  Vertex[2]= out[2] + state.m_refFrameZ;
100 
101 
102  return StatusCode::SUCCESS;
103  }

Friends And Related Function Documentation

◆ VKalExtPropagator

friend class VKalExtPropagator
friend

Definition at line 68 of file TrkVKalVrtFitter.h.

Member Data Documentation

◆ m_BMAG

double Trk::TrkVKalVrtFitter::m_BMAG
private

Definition at line 465 of file TrkVKalVrtFitter.h.

◆ m_c_CovVrtForConstraint

std::vector<double> Trk::TrkVKalVrtFitter::m_c_CovVrtForConstraint
private

Definition at line 329 of file TrkVKalVrtFitter.h.

◆ m_c_MassInputParticles

std::vector<double> Trk::TrkVKalVrtFitter::m_c_MassInputParticles
private

Definition at line 330 of file TrkVKalVrtFitter.h.

◆ m_c_VertexForConstraint

std::vector<double> Trk::TrkVKalVrtFitter::m_c_VertexForConstraint
private

Definition at line 328 of file TrkVKalVrtFitter.h.

◆ m_cascadeCnstPrecision

SimpleProperty<double> Trk::TrkVKalVrtFitter::m_cascadeCnstPrecision
private

Definition at line 322 of file TrkVKalVrtFitter.h.

◆ m_CNVMAG

double Trk::TrkVKalVrtFitter::m_CNVMAG
private

Definition at line 466 of file TrkVKalVrtFitter.h.

◆ m_extPropagator

ToolHandle<IExtrapolator> Trk::TrkVKalVrtFitter::m_extPropagator
private

Definition at line 332 of file TrkVKalVrtFitter.h.

◆ m_fieldCacheCondObjInputKey

SG::ReadCondHandleKey<AtlasFieldCacheCondObj> Trk::TrkVKalVrtFitter::m_fieldCacheCondObjInputKey
private
Initial value:
{ this,
"AtlasFieldCacheCondObj",
"fieldCondObj",
"Name of the Magnetic Field key" }

Definition at line 335 of file TrkVKalVrtFitter.h.

◆ m_firstMeasuredPoint

SimpleProperty<bool> Trk::TrkVKalVrtFitter::m_firstMeasuredPoint
private

Definition at line 339 of file TrkVKalVrtFitter.h.

◆ m_firstMeasuredPointLimit

SimpleProperty<bool> Trk::TrkVKalVrtFitter::m_firstMeasuredPointLimit
private

Definition at line 340 of file TrkVKalVrtFitter.h.

◆ m_fitPropagator

VKalExtPropagator* Trk::TrkVKalVrtFitter::m_fitPropagator
private

Definition at line 469 of file TrkVKalVrtFitter.h.

◆ m_frozenVersionForBTagging

bool Trk::TrkVKalVrtFitter::m_frozenVersionForBTagging
private

Definition at line 353 of file TrkVKalVrtFitter.h.

◆ m_IDsizeR

SimpleProperty<double> Trk::TrkVKalVrtFitter::m_IDsizeR
private

Definition at line 326 of file TrkVKalVrtFitter.h.

◆ m_IDsizeZ

SimpleProperty<double> Trk::TrkVKalVrtFitter::m_IDsizeZ
private

Definition at line 327 of file TrkVKalVrtFitter.h.

◆ m_InDetExtrapolator

const IExtrapolator* Trk::TrkVKalVrtFitter::m_InDetExtrapolator
private

Pointer to Extrapolator AlgTool.

Definition at line 470 of file TrkVKalVrtFitter.h.

◆ m_isAtlasField

bool Trk::TrkVKalVrtFitter::m_isAtlasField
private

Definition at line 344 of file TrkVKalVrtFitter.h.

◆ m_IterationNumber

SimpleProperty<int> Trk::TrkVKalVrtFitter::m_IterationNumber
private

Definition at line 324 of file TrkVKalVrtFitter.h.

◆ m_IterationPrecision

SimpleProperty<double> Trk::TrkVKalVrtFitter::m_IterationPrecision
private

Definition at line 325 of file TrkVKalVrtFitter.h.

◆ m_makeExtendedVertex

SimpleProperty<bool> Trk::TrkVKalVrtFitter::m_makeExtendedVertex
private

Definition at line 341 of file TrkVKalVrtFitter.h.

◆ m_massForConstraint

SimpleProperty<double> Trk::TrkVKalVrtFitter::m_massForConstraint
private

Definition at line 323 of file TrkVKalVrtFitter.h.

◆ m_Robustness

SimpleProperty<int> Trk::TrkVKalVrtFitter::m_Robustness
private

Definition at line 320 of file TrkVKalVrtFitter.h.

◆ m_RobustScale

SimpleProperty<double> Trk::TrkVKalVrtFitter::m_RobustScale
private

Definition at line 321 of file TrkVKalVrtFitter.h.

◆ m_useAprioriVertex

bool Trk::TrkVKalVrtFitter::m_useAprioriVertex
private

Definition at line 346 of file TrkVKalVrtFitter.h.

◆ m_useFixedField

SimpleProperty<bool> Trk::TrkVKalVrtFitter::m_useFixedField
private

Definition at line 342 of file TrkVKalVrtFitter.h.

◆ m_usePassNear

bool Trk::TrkVKalVrtFitter::m_usePassNear
private

Definition at line 351 of file TrkVKalVrtFitter.h.

◆ m_usePassWithTrkErr

bool Trk::TrkVKalVrtFitter::m_usePassWithTrkErr
private

Definition at line 352 of file TrkVKalVrtFitter.h.

◆ m_usePhiCnst

bool Trk::TrkVKalVrtFitter::m_usePhiCnst
private

Definition at line 348 of file TrkVKalVrtFitter.h.

◆ m_usePointingCnst

bool Trk::TrkVKalVrtFitter::m_usePointingCnst
private

Definition at line 349 of file TrkVKalVrtFitter.h.

◆ m_useThetaCnst

bool Trk::TrkVKalVrtFitter::m_useThetaCnst
private

Definition at line 347 of file TrkVKalVrtFitter.h.

◆ m_useZPointingCnst

bool Trk::TrkVKalVrtFitter::m_useZPointingCnst
private

Definition at line 350 of file TrkVKalVrtFitter.h.


The documentation for this class was generated from the following files:
Matrix
Definition: Trigger/TrigT1/TrigT1RPChardware/TrigT1RPChardware/Matrix.h:15
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
Trk::y
@ y
Definition: ParamDefs.h:56
Trk::TrkVKalVrtFitter::findPositions
static int findPositions(const std::vector< int > &, const std::vector< int > &, std::vector< int > &)
Definition: TrkCascadeFitter.cxx:787
Trk::TrkVKalVrtFitter::VKalVrtFit
virtual StatusCode VKalVrtFit(const std::vector< const xAOD::TrackParticle * > &, const std::vector< const xAOD::NeutralParticle * > &, Amg::Vector3D &Vertex, TLorentzVector &Momentum, long int &Charge, dvect &ErrorMatrix, dvect &Chi2PerTrk, std::vector< std::vector< double >> &TrkAtVrt, double &Chi2, IVKalState &istate, bool ifCovV0=false) const override final
xAOD::Vertex_v1::x
float x() const
Returns the x position.
Trk::py
@ py
Definition: ParamDefs.h:60
Trk::TrkVKalVrtFitter::makeXAODVertex
xAOD::Vertex * makeXAODVertex(int, const Amg::Vector3D &, const dvect &, const dvect &, const std::vector< dvect > &, double, State &state) const
Definition: TrkVKalVrtFitter.cxx:723
Trk::VKContraintType::Theta
@ Theta
xAOD::Vertex_v1::setPosition
void setPosition(const Amg::Vector3D &position)
Sets the 3-position.
Trk::TrkVKalVrtFitter::m_IterationPrecision
SimpleProperty< double > m_IterationPrecision
Definition: TrkVKalVrtFitter.h:325
Trk::TrkVKalVrtFitter::m_cascadeCnstPrecision
SimpleProperty< double > m_cascadeCnstPrecision
Definition: TrkVKalVrtFitter.h:322
CLEANCASCADE
#define CLEANCASCADE()
Definition: TrkCascadeFitter.cxx:272
xAOD::Vertex_v1::setFitQuality
void setFitQuality(float chiSquared, float numberDoF)
Set the 'Fit Quality' information.
Definition: Vertex_v1.cxx:150
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:27
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
Trk::TrkVKalVrtFitter::m_c_VertexForConstraint
std::vector< double > m_c_VertexForConstraint
Definition: TrkVKalVrtFitter.h:328
Trk::TrkVKalVrtFitter::setVertexForConstraint
virtual void setVertexForConstraint(const xAOD::Vertex &, IVKalState &istate) const override final
Definition: SetFitOptions.cxx:152
Trk::TrkVKalVrtFitter::setCovVrtForConstraint
virtual void setCovVrtForConstraint(double XX, double XY, double YY, double XZ, double YZ, double ZZ, IVKalState &istate) const override final
Definition: SetFitOptions.cxx:178
Trk::z
@ z
global position (cartesian)
Definition: ParamDefs.h:57
Trk::TrkVKalVrtFitter::m_useAprioriVertex
bool m_useAprioriVertex
Definition: TrkVKalVrtFitter.h:346
xAOD::Vertex
Vertex_v1 Vertex
Define the latest version of the vertex class.
Definition: Event/xAOD/xAODTracking/xAODTracking/Vertex.h:16
Trk::TrkVKalVrtFitter::initState
void initState(const EventContext &ctx, State &state) const
Definition: TrkVKalVrtFitter.cxx:223
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
Trk::VertexID
int VertexID
Definition: IVertexCascadeFitter.h:23
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
PlotCalibFromCool.yy
yy
Definition: PlotCalibFromCool.py:714
Trk::processCascadePV
int processCascadePV(CascadeEvent &cascadeEvent_, const double *primVrt, const double *primVrtCov)
Definition: CFitCascade.cxx:503
Trk::makeCascade
int makeCascade(VKalVrtControl &FitCONTROL, long int NTRK, const long int *ich, double *wm, double *inp_Trk5, double *inp_CovTrk5, const std::vector< std::vector< int > > &vertexDefinition, const std::vector< std::vector< int > > &cascadeDefinition, double definedCnstAccuracy)
Definition: CascadeDefinition.cxx:116
Trk::TrkVKalVrtFitter::m_InDetExtrapolator
const IExtrapolator * m_InDetExtrapolator
Pointer to Extrapolator AlgTool.
Definition: TrkVKalVrtFitter.h:470
AtlasFieldCacheCondObj
Definition: AtlasFieldCacheCondObj.h:19
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
correlationModel::FULL
@ FULL
Definition: AsgElectronEfficiencyCorrectionTool.cxx:49
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
Trk::SymIndex
int SymIndex(int it, int i, int j)
Definition: TrkCascadeFitter.cxx:271
Trk::TrkVKalVrtFitter::CreatePerigee
virtual std::unique_ptr< Trk::Perigee > CreatePerigee(const std::vector< double > &VKPerigee, const std::vector< double > &VKCov, IVKalState &istate) const override final
Definition: CvtPerigee.cxx:159
Trk::TrkVKalVrtFitter::VKalTransform
void VKalTransform(double MAG, double A0V, double ZV, double PhiV, double ThetaV, double PInv, const double[15], long int &Charge, double[5], double[15]) const
Definition: VKalTransform.cxx:59
Trk::TrkVKalVrtFitter::m_useZPointingCnst
bool m_useZPointingCnst
Definition: TrkVKalVrtFitter.h:350
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
Trk::TrkVKalVrtFitter::m_c_MassInputParticles
std::vector< double > m_c_MassInputParticles
Definition: TrkVKalVrtFitter.h:330
index
Definition: index.py:1
Monitored::Z
@ Z
Definition: HistogramFillerUtils.h:24
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
Trk::TrkVKalVrtFitter::FillMatrixP
static void FillMatrixP(AmgSymMatrix(5)&, std::vector< double > &)
Definition: TrkVKalVrtFitter.cxx:672
Trk::TrkVKalVrtFitter::m_BMAG
double m_BMAG
Definition: TrkVKalVrtFitter.h:465
Trk::CurvilinearParameters
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:29
Trk::TrkVKalVrtFitter::VKalVrtFitFast
virtual StatusCode VKalVrtFitFast(std::span< const xAOD::TrackParticle *const >, Amg::Vector3D &Vertex, double &minDZ, IVKalState &istate) const
Definition: VKalVrtFitFastSvc.cxx:56
Trk::TrkVKalVrtFitter::m_isAtlasField
bool m_isAtlasField
Definition: TrkVKalVrtFitter.h:344
Trk::TrkVKalVrtFitter::makeSimpleCascade
static void makeSimpleCascade(std::vector< std::vector< int > > &, std::vector< std::vector< int > > &, CascadeState &cstate)
Definition: TrkCascadeFitter.cxx:180
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
Trk::TrkVKalVrtFitter::nextVertex
VertexID nextVertex(const std::vector< const xAOD::TrackParticle * > &list, std::span< const double > particleMass, IVKalState &istate, double massConstraint=0.) const override final
Definition: TrkCascadeFitter.cxx:97
skel.it
it
Definition: skel.GENtoEVGEN.py:396
Trk::TrkVKalVrtFitter::m_extPropagator
ToolHandle< IExtrapolator > m_extPropagator
Definition: TrkVKalVrtFitter.h:332
Trk::TrkVKalVrtFitter::CvtTrackParameters
StatusCode CvtTrackParameters(const std::vector< const TrackParameters * > &InpTrk, int &ntrk, State &state) const
Definition: CvtParametersBase.cxx:24
test_pyathena.pt
pt
Definition: test_pyathena.py:11
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
Trk::TrkVKalVrtFitter::m_useThetaCnst
bool m_useThetaCnst
Definition: TrkVKalVrtFitter.h:347
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Trk::TrkVKalVrtFitter::m_fitPropagator
VKalExtPropagator * m_fitPropagator
Definition: TrkVKalVrtFitter.h:469
Trk::TrkVKalVrtFitter::VKalGetImpact
virtual double VKalGetImpact(const xAOD::TrackParticle *, const Amg::Vector3D &Vertex, const long int Charge, dvect &Impact, dvect &ImpactError, IVKalState &istate) const override final
Definition: VKalGetImpact.cxx:91
InDetSecVtxTruthMatchUtils::isMerged
bool isMerged(int matchInfo)
Definition: InDetSecVtxTruthMatchTool.h:52
Trk::getFittedCascade
void getFittedCascade(CascadeEvent &cascadeEvent_, std::vector< Vect3DF > &cVertices, std::vector< std::vector< double > > &covVertices, std::vector< std::vector< VectMOM > > &fittedParticles, std::vector< std::vector< double > > &cascadeCovar, std::vector< double > &particleChi2, std::vector< double > &fullCovar)
Definition: CFitCascade.cxx:685
Trk::TrkVKalVrtFitter::VKalExtPropagator
friend class VKalExtPropagator
Definition: TrkVKalVrtFitter.h:68
Trk::TrkVKalVrtFitter::m_c_CovVrtForConstraint
std::vector< double > m_c_CovVrtForConstraint
Definition: TrkVKalVrtFitter.h:329
InDet::median
float median(std::vector< float > &Vec)
Definition: BTagVrtSec.cxx:35
Trk::TrkVKalVrtFitter::CvtPerigee
StatusCode CvtPerigee(const std::vector< const Perigee * > &list, int &ntrk, State &state) const
Definition: CvtPerigee.cxx:25
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
Trk::VKalExtPropagator::myExtrapWithMatUpdate
const TrackParameters * myExtrapWithMatUpdate(long int TrkID, const TrackParameters *inpPer, Amg::Vector3D *endPoint, const IVKalState &istate) const
Definition: VKalExtPropagator.cxx:198
Phi
@ Phi
Definition: RPCdef.h:8
ParticleJetParams::kt
@ kt
Definition: ParticleJetParamDefs.h:43
Trk::cfimp
void cfimp(long int TrkID, long int ich, int IFL, double *par, const double *err, double *vrt, double *vcov, double *rimp, double *rcov, double *sign, VKalVrtControlBase *FitCONTROL)
Definition: cfImp.cxx:43
Trk::TrkVKalVrtFitter::m_RobustScale
SimpleProperty< double > m_RobustScale
Definition: TrkVKalVrtFitter.h:321
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
Trk::TrkVKalVrtFitter::getCascadeNDoF
static int getCascadeNDoF(const CascadeState &cstate)
Definition: TrkCascadeFitter.cxx:79
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
Trk::setCascadeMassConstraint
int setCascadeMassConstraint(CascadeEvent &cascadeEvent_, long int IV, double Mass)
Definition: CascadeDefinition.cxx:241
Trk::pz
@ pz
global momentum (cartesian)
Definition: ParamDefs.h:61
Trk::Perigee
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:33
Trk::TrkVKalVrtFitter::convertAmg5SymMtx
bool convertAmg5SymMtx(const AmgSymMatrix(5) *, double[15]) const
Definition: VKalTransform.cxx:26
xAOD::Vertex_v1::setCovariance
void setCovariance(const std::vector< float > &value)
Sets the covariance matrix as a simple vector of values.
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
Trk::TrkVKalVrtFitter::VKalGetNDOF
static int VKalGetNDOF(const State &state)
Definition: VKalVrtFitSvc.cxx:562
Trk::TrkVKalVrtFitter::indexInV
static int indexInV(const VertexID &, const CascadeState &cstate)
Definition: TrkCascadeFitter.cxx:823
Trk::TrkVKalVrtFitter::VKalGetFullCov
virtual StatusCode VKalGetFullCov(long int, dvect &CovMtx, IVKalState &istate, bool=false) const override final
Definition: VKalVrtFitSvc.cxx:434
pi
#define pi
Definition: TileMuonFitter.cxx:65
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
similarity
Matrix< Scalar, OtherDerived::RowsAtCompileTime, OtherDerived::RowsAtCompileTime > similarity(const MatrixBase< OtherDerived > &m) const
similarity method : yields ms = m*s*m^T
Definition: AmgMatrixBasePlugin.h:133
Trk::TrkVKalVrtFitter::m_Robustness
SimpleProperty< int > m_Robustness
Definition: TrkVKalVrtFitter.h:320
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
Trk::processCascade
int processCascade(CascadeEvent &cascadeEvent_)
Definition: CFitCascade.cxx:244
Trk::AmgSymMatrix
AmgSymMatrix(5) &GXFTrackState
Definition: GXFTrackState.h:156
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
python.changerun.kk
list kk
Definition: changerun.py:41
Trk::vkalPropagator::Propagate
static void Propagate(long int TrkID, long int Charge, double *ParOld, double *CovOld, double *RefStart, double *RefEnd, double *ParNew, double *CovNew, VKalVrtControlBase *FitControl=0)
Definition: Propagator.cxx:127
xAOD::Vertex_v1::addTrackAtVertex
void addTrackAtVertex(const ElementLink< TrackParticleContainer > &tr, float weight=1.0)
Add a new track to the vertex.
Definition: Vertex_v1.cxx:314
Trk::TrkVKalVrtFitter::m_CNVMAG
double m_CNVMAG
Definition: TrkVKalVrtFitter.h:466
Trk::TrkVKalVrtFitter::m_IDsizeR
SimpleProperty< double > m_IDsizeR
Definition: TrkVKalVrtFitter.h:326
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
Trk::xyztrp
void xyztrp(const long int ich, double *vrt0, double *pv0, double *covi, double BMAG, double *paro, double *errt)
Definition: XYZtrp.cxx:16
Trk::TrkVKalVrtFitter::m_massForConstraint
SimpleProperty< double > m_massForConstraint
Definition: TrkVKalVrtFitter.h:323
Trk::TrkVKalVrtFitter::setAthenaPropagator
void setAthenaPropagator(const Trk::IExtrapolator *)
Definition: VKalExtPropagator.cxx:473
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::TrkVKalVrtFitter::printSimpleCascade
static void printSimpleCascade(std::vector< std::vector< int > > &, std::vector< std::vector< int > > &, const CascadeState &cstate)
Definition: TrkCascadeFitter.cxx:237
Trk::TrkVKalVrtFitter::setApproximateVertex
virtual void setApproximateVertex(double X, double Y, double Z, IVKalState &istate) const override final
Definition: SetFitOptions.cxx:108
Trk::theta
@ theta
Definition: ParamDefs.h:66
xAOD::FirstMeasurement
@ FirstMeasurement
Parameter defined at the position of the 1st measurement.
Definition: TrackingPrimitives.h:213
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
vector
Definition: MultiHisto.h:13
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AmgVector
AmgVector(4) T2BSTrackFilterTool
Definition: T2BSTrackFilterTool.cxx:114
Trk::NeutralPerigee
ParametersT< NeutralParametersDim, Neutral, PerigeeSurface > NeutralPerigee
Definition: NeutralParameters.h:31
Trk::TrkVKalVrtFitter::m_makeExtendedVertex
SimpleProperty< bool > m_makeExtendedVertex
Definition: TrkVKalVrtFitter.h:341
Trk::NTrMaxVFit
@ NTrMaxVFit
Definition: TrkVKalVrtFitter.h:35
MuonR4::State
CalibratedSpacePoint::State State
Definition: SpacePointCalibrator.cxx:24
Trk::TrkVKalVrtFitter::m_IDsizeZ
SimpleProperty< double > m_IDsizeZ
Definition: TrkVKalVrtFitter.h:327
Trk::px
@ px
Definition: ParamDefs.h:59
test_pyathena.parent
parent
Definition: test_pyathena.py:15
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
Trk::vkvFastV
double vkvFastV(double *p1, double *p2, const double *vRef, double dbmag, double *out)
Definition: VKvFast.cxx:42
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
beamspotnt.rows
list rows
Definition: bin/beamspotnt.py:1112
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
AnalysisUtils::Delta::R
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)
Definition: AnalysisMisc.h:49
Trk::ParametersBase
Definition: ParametersBase.h:55
xAOD::Vertex_v1::z
float z() const
Returns the z position.
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
Scale
void Scale(TH1 *h, double d=1)
Definition: comparitor.cxx:76
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
Trk::cfpest
void cfpest(int ntrk, double *xyz, long int *ich, double(*parst)[5], double(*parf)[3])
Definition: cfPEst.cxx:10
dvect
std::vector< double > dvect
Definition: InDetVKalVxInJetTool.h:83
calibdata.ct
ct
Definition: calibdata.py:418
min
#define min(a, b)
Definition: cfImp.cxx:40
Trk::TrkVKalVrtFitter::m_useFixedField
SimpleProperty< bool > m_useFixedField
Definition: TrkVKalVrtFitter.h:342
grepfile.ic
int ic
Definition: grepfile.py:33
fill
void fill(H5::Group &out_file, size_t iterations)
Definition: test-hdf5-writer.cxx:95
Trk::TrkVKalVrtFitter::m_firstMeasuredPointLimit
SimpleProperty< bool > m_firstMeasuredPointLimit
Definition: TrkVKalVrtFitter.h:340
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
TYPE
#define TYPE(CODE, TYP, IOTYP)
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::SurfaceType::Perigee
@ Perigee
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
Trk::TrkVKalVrtFitter::VKalToTrkTrack
void VKalToTrkTrack(double curBMAG, double vp1, double vp2, double vp3, double &tp1, double &tp2, double &tp3) const
Definition: VKalVrtFitSvc.cxx:406
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Trk::TrkVKalVrtFitter::getSimpleVIndex
static int getSimpleVIndex(const VertexID &, const CascadeState &cstate)
Definition: TrkCascadeFitter.cxx:804
VP1PartSpect::E
@ E
Definition: VP1PartSpectFlags.h:21
Trk::VKalExtPropagator::setPropagator
void setPropagator(const IExtrapolator *)
Definition: VKalExtPropagator.cxx:41
Trk::TrackParameters
ParametersBase< TrackParametersDim, Charged > TrackParameters
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:27
Trk::TrkVKalVrtFitter::m_fieldCacheCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
Definition: TrkVKalVrtFitter.h:335
charge
double charge(const T &p)
Definition: AtlasPID.h:538
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:172
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::TrkVKalVrtFitter::VKalGetTrkWeights
virtual StatusCode VKalGetTrkWeights(dvect &Weights, const IVKalState &istate) const override final
Definition: VKalVrtFitSvc.cxx:546
Trk::VKalExtPropagator::myExtrapNeutral
const NeutralParameters * myExtrapNeutral(const NeutralParameters *inpPer, Amg::Vector3D *endPoint) const
Definition: VKalExtPropagator.cxx:416
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
DeMoScan.index
string index
Definition: DeMoScan.py:364
xAOD::Vertex_v1::addNeutralAtVertex
void addNeutralAtVertex(const ElementLink< NeutralParticleContainer > &tr, float weight=1.0)
Add a new neutral to the vertex.
Definition: Vertex_v1.cxx:323
Prompt::Def::Pt
@ Pt
Definition: VarHolder.h:76
VKalVrtAthena::varHolder_detail::clear
void clear(T &var)
Definition: NtupleVars.h:48
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
Trk::TrkVKalVrtFitter::m_IterationNumber
SimpleProperty< int > m_IterationNumber
Definition: TrkVKalVrtFitter.h:324
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
xAOD::Vertex_v1::y
float y() const
Returns the y position.
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
Trk::TrkVKalVrtFitter::VKalVrtConfigureFitterCore
void VKalVrtConfigureFitterCore(int NTRK, State &state) const
Definition: SetFitOptions.cxx:17
run_AODTCCLinking.inputList
list inputList
Definition: run_AODTCCLinking.py:93
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
Trk::phi
@ phi
Definition: ParamDefs.h:75
Trk::CFit
int CFit(VKalVrtControl *FitCONTROL, int ifCovV0, int NTRK, long int *ich, double xyz0[3], double(*par0)[3], double(*inp_Trk5)[5], double(*inp_CovTrk5)[15], double xyzfit[3], double(*parfs)[3], double ptot[4], double covf[21], double &chi2, double *chi2tr)
Definition: CFit.cxx:429
Trk::TrkVKalVrtFitter::fit
virtual xAOD::Vertex * fit(const std::vector< const TrackParameters * > &perigeeList, const Amg::Vector3D &startingPoint) const override final
Interface for MeasuredPerigee with starting point.
Definition: TrkVKalVrtFitter.cxx:261
I
#define I(x, y, z)
Definition: MD5.cxx:116
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
xAOD::Vertex_v1::vxTrackAtVertex
std::vector< Trk::VxTrackAtVertex > & vxTrackAtVertex()
Non-const access to the VxTrackAtVertex vector.
Definition: Vertex_v1.cxx:181
Trk::x
@ x
Definition: ParamDefs.h:55
Trk::TrkVKalVrtFitter::CvtTrackParticle
StatusCode CvtTrackParticle(std::span< const xAOD::TrackParticle *const > list, int &ntrk, State &state) const
Definition: CvtTrackParticle.cxx:27
test_pyathena.counter
counter
Definition: test_pyathena.py:15
Trk::TrkVKalVrtFitter::m_usePassWithTrkErr
bool m_usePassWithTrkErr
Definition: TrkVKalVrtFitter.h:352
Trk::TrkVKalVrtFitter::m_usePointingCnst
bool m_usePointingCnst
Definition: TrkVKalVrtFitter.h:349
python.compressB64.c
def c
Definition: compressB64.py:93
Trk::TrkVKalVrtFitter::m_usePhiCnst
bool m_usePhiCnst
Definition: TrkVKalVrtFitter.h:348
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Trk::TrkVKalVrtFitter::m_firstMeasuredPoint
SimpleProperty< bool > m_firstMeasuredPoint
Definition: TrkVKalVrtFitter.h:339
Trk::TrkVKalVrtFitter::m_usePassNear
bool m_usePassNear
Definition: TrkVKalVrtFitter.h:351
Trk::TrkVKalVrtFitter::m_frozenVersionForBTagging
bool m_frozenVersionForBTagging
Definition: TrkVKalVrtFitter.h:353
Trk::v
@ v
Definition: ParamDefs.h:78
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32