7 #include "GaudiKernel/EventContext.h"
8 #include "GaudiKernel/IChronoStatSvc.h"
31 const std::string&
name,
36 m_cascadeCnstPrecision(1.
e-4),
37 m_massForConstraint(-1.),
39 m_IterationPrecision(0),
42 m_extPropagator(this),
44 m_firstMeasuredPoint(false),
45 m_firstMeasuredPointLimit(false),
46 m_makeExtendedVertex(false),
47 m_useFixedField(false),
48 m_useAprioriVertex(false),
49 m_useThetaCnst(false),
51 m_usePointingCnst(false),
52 m_useZPointingCnst(false),
54 m_usePassWithTrkErr(false),
55 m_frozenVersionForBTagging(false)
57 declareInterface<IVertexFitter>(
this);
58 declareInterface<ITrkVKalVrtFitter>(
this);
59 declareInterface<IVertexCascadeFitter>(
this);
80 declareProperty(
"InputParticleMasses",
m_c_MassInputParticles,
"List of masses of input particles (pions assumed if this list is absent)" );
82 declareProperty(
"useFixedField",
m_useFixedField,
" Use fixed magnetic field instead of exact Atlas one");
85 declareProperty(
"MakeExtendedVertex",
m_makeExtendedVertex,
"VKalVrt returns VxCandidate with full covariance matrix");
117 std::unique_ptr<IVKalState>
120 auto state = std::make_unique<State>();
128 return StatusCode::SUCCESS;
208 else {
msg(
MSG::DEBUG)<<
" VKalVrt will use Perigee strategy in fits with InDetExtrapolator"<<
endmsg; }
213 return StatusCode::SUCCESS;
219 initState(Gaudi::Hive::currentContext(), state);
233 if (fieldCondObj ==
nullptr) {
270 std::vector<const NeutralParameters*> perigeeListN(0);
272 TLorentzVector Momentum;
275 std::vector<double> Chi2PerTrk;
276 std::vector< std::vector<double> > TrkAtVrt;
279 Vertex, Momentum, Charge,
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state,
true );
290 const std::vector<const NeutralParameters*> & perigeeListN,
300 TLorentzVector Momentum;
303 std::vector<double> Chi2PerTrk;
304 std::vector< std::vector<double> > TrkAtVrt;
307 Vertex, Momentum, Charge,
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state,
true );
351 std::vector<const NeutralParameters*> perigeeListN(0);
353 TLorentzVector Momentum;
356 std::vector<double> Chi2PerTrk;
357 std::vector< std::vector<double> > TrkAtVrt;
360 Vertex, Momentum, Charge,
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state,
true );
372 const std::vector<const NeutralParameters*> & perigeeListN,
402 TLorentzVector Momentum;
405 std::vector<double> Chi2PerTrk;
406 std::vector< std::vector<double> > TrkAtVrt;
409 Vertex, Momentum, Charge,
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state,
true );
422 std::unique_ptr<xAOD::Vertex>
424 const std::vector<const xAOD::TrackParticle*>& xtpListC,
429 return std::unique_ptr<xAOD::Vertex>(
fit(xtpListC, startingPoint, state));
436 assert(
dynamic_cast<State*
> (&istate)!=
nullptr);
444 std::vector<const xAOD::NeutralParticle*> xtpListN(0);
446 TLorentzVector Momentum;
449 std::vector<double> Chi2PerTrk;
450 std::vector< std::vector<double> > TrkAtVrt;
453 Vertex, Momentum, Charge,
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state,
true );
469 const std::vector<const xAOD::NeutralParticle*> & xtpListN,
480 TLorentzVector Momentum;
483 std::vector<double> Chi2PerTrk;
484 std::vector< std::vector<double> > TrkAtVrt;
487 Vertex, Momentum, Charge,
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state,
true );
493 if(ii<(
int)xtpListC.size()) {
515 return fit (xtpListC, constraint, state);
521 assert(
dynamic_cast<State*
> (&istate)!=
nullptr);
539 std::vector<const xAOD::NeutralParticle*> xtpListN(0);
541 TLorentzVector Momentum;
544 std::vector<double> Chi2PerTrk;
545 std::vector< std::vector<double> > TrkAtVrt;
548 Vertex, Momentum, Charge,
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state,
true );
564 const std::vector<const xAOD::NeutralParticle*> & xtpListN,
586 TLorentzVector Momentum;
589 std::vector<double> Chi2PerTrk;
590 std::vector< std::vector<double> > TrkAtVrt;
593 Vertex, Momentum, Charge,
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state,
true );
599 if(ii<(
int)xtpListC.size()) {
622 std::vector<const NeutralParameters*> perigeeListN(0);
624 TLorentzVector Momentum;
627 std::vector<double> Chi2PerTrk;
628 std::vector< std::vector<double> > TrkAtVrt;
631 Vertex, Momentum, Charge,
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state,
true );
641 const std::vector<const NeutralParameters*> & perigeeListN)
const
649 TLorentzVector Momentum;
652 std::vector<double> Chi2PerTrk;
653 std::vector< std::vector<double> > TrkAtVrt;
656 Vertex, Momentum, Charge,
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state,
true );
674 CovMtx.setIdentity();
675 if(
Matrix.size() < 21)
return;
679 CovMtx.fillSymmetric(2,3,
Matrix[13]);
681 CovMtx.fillSymmetric(2,4,
Matrix[18]);
682 CovMtx.fillSymmetric(3,4,
Matrix[19]);
690 int NContent =
Matrix.size();
691 CovMtx.setIdentity();
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];
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]);}
725 const std::vector<double> & Chi2PerTrk,
const std::vector< std::vector<double> >& TrkAtVrt,
739 std::vector <double> CovFull;
741 int covarExist=0;
if(
sc.isSuccess() ) covarExist=1;
743 std::vector<float> floatErrMtx;
745 floatErrMtx.resize(CovFull.size());
746 for(
int i=0;
i<(
int)CovFull.size();
i++) floatErrMtx[
i]=CovFull[
i];
748 floatErrMtx.resize(fitErrorMatrix.size());
749 for(
int i=0;
i<(
int)fitErrorMatrix.size();
i++) floatErrMtx[
i]=fitErrorMatrix[
i];
753 for(
int ii=0; ii<NTrk ; ii++) {
755 if(covarExist){
FillMatrixP( ii, CovMtxP, CovFull );}
756 else { CovMtxP.setIdentity();}
759 if(ii<NTrk-Neutrals){
760 tmpChargPer =
new Perigee( 0.,0., TrkAtVrt[ii][0],
769 std::move(CovMtxP) );
771 tmpVTAV.emplace_back(Chi2PerTrk[ii], tmpChargPer, tmpNeutrPer );