7 #include "GaudiKernel/EventContext.h" 
    8 #include "GaudiKernel/IChronoStatSvc.h" 
   31                                     const std::string& 
name,
 
   35     declareInterface<IVertexFitter>(
this);
 
   36     declareInterface<ITrkVKalVrtFitter>(
this);
 
   37     declareInterface<IVertexCascadeFitter>(
this);
 
   57 std::unique_ptr<IVKalState>
 
   60   auto state = std::make_unique<State>();
 
   68     return StatusCode::SUCCESS;
 
  149        else                    { 
msg(
MSG::DEBUG)<< 
" VKalVrt will use Perigee strategy in fits with InDetExtrapolator"<<
endmsg; }
 
  154     return StatusCode::SUCCESS;
 
  160     initState(Gaudi::Hive::currentContext(), state);
 
  174      if (fieldCondObj == 
nullptr) {
 
  212     std::vector<const NeutralParameters*> perigeeListN(0);
 
  214     TLorentzVector Momentum;
 
  217     std::vector<double> Chi2PerTrk;
 
  218     std::vector< std::vector<double> >  TrkAtVrt;
 
  221                               Vertex, Momentum, Charge, 
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, 
true );
 
  232                                     const std::vector<const NeutralParameters*> & perigeeListN,
 
  242     TLorentzVector Momentum;
 
  245     std::vector<double> Chi2PerTrk;
 
  246     std::vector< std::vector<double> >  TrkAtVrt;
 
  249                               Vertex, Momentum, Charge, 
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, 
true );
 
  293     std::vector<const NeutralParameters*> perigeeListN(0);
 
  295     TLorentzVector Momentum;
 
  298     std::vector<double> Chi2PerTrk;
 
  299     std::vector< std::vector<double> >  TrkAtVrt;
 
  302                    Vertex, Momentum, Charge, 
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, 
true );
 
  314                                     const std::vector<const NeutralParameters*> & perigeeListN,
 
  344     TLorentzVector Momentum;
 
  347     std::vector<double> Chi2PerTrk;
 
  348     std::vector< std::vector<double> >  TrkAtVrt;
 
  351                    Vertex, Momentum, Charge, 
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, 
true );
 
  364 std::unique_ptr<xAOD::Vertex>
 
  366                       const std::vector<const xAOD::TrackParticle*>& xtpListC,
 
  371   return std::unique_ptr<xAOD::Vertex>(
fit(xtpListC, startingPoint, state));
 
  378     assert(
dynamic_cast<State*
> (&istate)!=
nullptr);
 
  386     std::vector<const xAOD::NeutralParticle*> xtpListN(0);
 
  388     TLorentzVector Momentum;
 
  391     std::vector<double> Chi2PerTrk;
 
  392     std::vector< std::vector<double> >  TrkAtVrt;
 
  395                               Vertex, Momentum, Charge, 
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, 
true );
 
  411                                      const std::vector<const xAOD::NeutralParticle*> & xtpListN,
 
  422     TLorentzVector Momentum;
 
  425     std::vector<double> Chi2PerTrk;
 
  426     std::vector< std::vector<double> >  TrkAtVrt;
 
  429                               Vertex, Momentum, Charge, 
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, 
true );
 
  435           if(ii<(
int)xtpListC.size()) {
 
  457     return fit (xtpListC, constraint, state);
 
  463     assert(
dynamic_cast<State*
> (&istate)!=
nullptr);
 
  481     std::vector<const xAOD::NeutralParticle*> xtpListN(0);
 
  483     TLorentzVector Momentum;
 
  486     std::vector<double> Chi2PerTrk;
 
  487     std::vector< std::vector<double> >  TrkAtVrt;
 
  490                               Vertex, Momentum, Charge, 
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, 
true );
 
  506                                      const std::vector<const xAOD::NeutralParticle*> & xtpListN,
 
  528     TLorentzVector Momentum;
 
  531     std::vector<double> Chi2PerTrk;
 
  532     std::vector< std::vector<double> >  TrkAtVrt;
 
  535                               Vertex, Momentum, Charge, 
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, 
true );
 
  541           if(ii<(
int)xtpListC.size()) {
 
  564     std::vector<const NeutralParameters*> perigeeListN(0);
 
  566     TLorentzVector Momentum;
 
  569     std::vector<double> Chi2PerTrk;
 
  570     std::vector< std::vector<double> >  TrkAtVrt;
 
  573                    Vertex, Momentum, Charge, 
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, 
true );
 
  583                                     const std::vector<const  NeutralParameters*> & perigeeListN)
 const 
  591     TLorentzVector Momentum;
 
  594     std::vector<double> Chi2PerTrk;
 
  595     std::vector< std::vector<double> >  TrkAtVrt;
 
  598                    Vertex, Momentum, Charge, 
ErrorMatrix, Chi2PerTrk, TrkAtVrt, Chi2, state, 
true );
 
  616     CovMtx.setIdentity();
 
  617     if( 
Matrix.size() < 21) 
return;
 
  621     CovMtx.fillSymmetric(2,3,
Matrix[13]);
 
  623     CovMtx.fillSymmetric(2,4,
Matrix[18]);
 
  624     CovMtx.fillSymmetric(3,4,
Matrix[19]);
 
  632     int NContent = 
Matrix.size();
 
  633     CovMtx.setIdentity();        
 
  636     int pnt = (iTmp+1)*iTmp/2 + iTmp;   
if( pnt   > NContent ) 
return;
 
  637     CovMtx(2,2) =  
Matrix[pnt];
 
  638     pnt = (iTmp+1+1)*(iTmp+1)/2 + iTmp; 
if( pnt+1 > NContent ){ CovMtx.setIdentity();  
return; }
 
  639     CovMtx.fillSymmetric(2,3,
Matrix[pnt]);
 
  640     CovMtx(3,3) =  
Matrix[pnt+1];
 
  641     pnt = (iTmp+2+1)*(iTmp+2)/2 + iTmp; 
if( pnt+2 > NContent ){ CovMtx.setIdentity();  
return; }
 
  642     CovMtx.fillSymmetric(2,4,
Matrix[pnt]);
 
  643     CovMtx.fillSymmetric(3,4,
Matrix[pnt+1]);
 
  644     CovMtx(4,4) = 
Matrix[pnt+2];
 
  653    for(
int i=1; 
i<=(3+3*NTrk); 
i++){
 
  654       for(
int j=1; j<=
i; j++){
 
  655          if(
i==j){ (*mtx)(
i-1,j-1)=
Matrix[ij];}
 
  656      else    { (*mtx).fillSymmetric(
i-1,j-1,
Matrix[ij]);}
 
  667     const std::vector<double> & Chi2PerTrk,  
const std::vector< std::vector<double> >& TrkAtVrt,
 
  681     std::vector <double> CovFull;
 
  683     int covarExist=0; 
if( 
sc.isSuccess() ) covarExist=1;
 
  685     std::vector<float> floatErrMtx;
 
  687        floatErrMtx.resize(CovFull.size());
 
  688        for(
int i=0; 
i<(
int)CovFull.size(); 
i++) {
 
  690              CovFull[
i] > std::numeric_limits<float>::lowest() ){
 
  691            floatErrMtx[
i]=
static_cast<float>(CovFull[
i]);
 
  697        floatErrMtx.resize(fitErrorMatrix.size());
 
  698        for(
int i=0; 
i<(
int)fitErrorMatrix.size(); 
i++) {
 
  700              fitErrorMatrix[
i] > std::numeric_limits<float>::lowest() ){
 
  701            floatErrMtx[
i]=
static_cast<float>(fitErrorMatrix[
i]);
 
  709     for(
int ii=0; ii<NTrk ; ii++) {
 
  711       if(covarExist){ 
FillMatrixP( ii, CovMtxP, CovFull );}
 
  712       else          { CovMtxP.setIdentity();}
 
  715       if(ii<NTrk-Neutrals){
 
  716          tmpChargPer  =  
new Perigee( 0.,0., TrkAtVrt[ii][0],
 
  725                                         std::move(CovMtxP) );
 
  727       tmpVTAV.emplace_back(Chi2PerTrk[ii], tmpChargPer, tmpNeutrPer );