Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FullJetFinder.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FullJetFinder.cc
1 
14 #include "FullJetFinder.h"
15 
17 #include <fun4all/PHTFileServer.h>
18 
19 #include <phool/PHCompositeNode.h>
20 #include <phool/getClass.h>
21 
22 #include <jetbase/JetContainer.h>
23 #include <jetbase/JetMap.h>
24 #include <jetbase/Jet.h>
25 
27 
30 
31 #include <particleflowreco/ParticleFlowElementv1.h>
32 #include <particleflowreco/ParticleFlowElementContainer.h>
33 
34 #define HomogeneousField
35 #include <KFParticle.h>
36 
38 #include <g4main/PHG4Particle.h>
39 
42 
43 #include <trackbase/MvtxDefs.h>
44 
46 #pragma GCC diagnostic push
47 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
48 #include <HepMC/GenEvent.h>
49 #include <HepMC/GenVertex.h>
50 #pragma GCC diagnostic pop
51 
54 
55 #include <TDatabasePDG.h>
56 
57 #include <TTree.h>
58 #include <TH1.h>
59 
60 #include <cmath>
61 
62 
63 
64 //____________________________________________________________________________..
66  SubsysReco("FullJetFinder")
67  , m_recoJetName()
68  , m_truthJetName()
69  , m_outputFileName(outputfilename)
70  , m_ptRangeReco(0, 100)
71  , m_ptRangeTruth(0, 100)
72  , m_doTruthJets(0)
73  , m_T()
74 {
75  std::cout << "FullJetFinder::FullJetFinder(const std::string &name) Calling ctor" << std::endl;
76 }
77 
78 //____________________________________________________________________________..
80 {
81  std::cout << "FullJetFinder::~FullJetFinder() Calling dtor" << std::endl;
82 }
83 
84 //_________________________________________________________
86 {
87  reco_jet_n = -1;
88  truth_jet_n = -1;
89  centrality = -1;
90  impactparam = -1;
91  recojets.clear();
92  truthjets.clear();
93  primaryVertex.clear();
94 }
95 
96 //____________________________________________________________________________..
98 {
99  std::cout << "FullJetFinder::Init(PHCompositeNode *topNode) Initializing" << std::endl;
101  std::cout << "FullJetFinder::Init - Output to " << m_outputFileName << std::endl;
102 
103  if (m_inputs == 0 || m_inputs > 10){
104  std::cout << "MyJetAnalysis::Init - Error number of inputs outside (0,10> " << std::endl;
105  exit(-1);
106  }
107 
108  // configure Tree
109  for(int i = 0 ; i < m_inputs; i++){
110  //m_T[i] = new TTree(m_TreeNameCollection.at(i).data(), m_TreeNameCollection.at(i).data());
111  m_T[i] = new TTree("Data", "Data");
112  m_container[i] = new Container;
113  m_T[i]->Branch( "JetContainer", &m_container[i] );
114 
115  TString tmp = "";
116  m_chi2ndf[i] = new TH1D(tmp +"chi2ndf_" + m_TreeNameCollection.at(i).data(),tmp +"chi2ndf_" + m_TreeNameCollection.at(i).data(),1000,0,100);
117  m_mvtxcl[i] = new TH1I(tmp +"mvtxcl_" + m_TreeNameCollection.at(i).data(),tmp +"mvtxcl_" + m_TreeNameCollection.at(i).data(),6,0,6);
118  m_inttcl[i] = new TH1I(tmp +"inttcl_" + m_TreeNameCollection.at(i).data(),tmp +"inttcl_" + m_TreeNameCollection.at(i).data(),6,0,6);
119  m_mtpccl[i]= new TH1I(tmp +"tpccl_" + m_TreeNameCollection.at(i).data(),tmp +"tpccl_" + m_TreeNameCollection.at(i).data(),100,0,100);
120  }
121 
122  m_stat = new TH1I("event_stat","event_stat",10,-0.5,9.5);
123  m_stat->GetXaxis()->SetBinLabel(1,"n_events");
124  m_stat->GetXaxis()->SetBinLabel(2,"GV_exists");
125  m_stat->GetXaxis()->SetBinLabel(3,"GV_notempty");
126 
127 
128 
130 }
131 
132 //____________________________________________________________________________..
134 {
135  std::cout << "FullJetFinder::InitRun(PHCompositeNode *topNode) Initializing for Run XXX" << std::endl;
137 }
138 
139 //____________________________________________________________________________..
141 {
142  m_stat->Fill(0);
143  //centrality
144  CentralityInfo* cent_node = findNode::getClass<CentralityInfo>(topNode, "CentralityInfo");
145  if (!cent_node){
146  std::cout << "MyJetAnalysis::process_event - Error can not find centrality node " << std::endl;
147  exit(-1);
148  }
149 
150  // interface to reco jets
151  if ((m_recoJetName.size() != m_truthJetName.size()) || m_recoJetName.empty() || m_truthJetName.empty()){
152  std::cout << "MyJetAnalysis::process_event - Error in m_recoJetName size != m_truthJetName.size() or empty" << std::endl;
153  exit(-1);
154  }
155 
156  if (m_recoJetName.size() != static_cast<long unsigned int>(m_inputs)){
157  std::cout << "MyJetAnalysis::process_event - Error number of AddInput() calls does not match with number of inputs specified in constructor" << std::endl;
158  exit(-1);
159  }
160 
161 
162 
163  GlobalVertexMap *vertexmap = findNode::getClass<GlobalVertexMap>(topNode, "GlobalVertexMap");
164  if (!vertexmap){
165  std::cout << "MyJetAnalysis::process_event - Fatal Error - GlobalVertexMap node is missing. Please turn on the do_global flag in the main macro in order to reconstruct the global vertex." << std::endl;
166  assert(vertexmap); // force quit
167  exit(-1);
168  }
169 
170  m_stat->Fill(1);
171 
172  if (vertexmap->empty()){
173  std::cout << "MyJetAnalysis::process_event - Fatal Error - GlobalVertexMap node is empty. Please turn on the do_global flag in the main macro in order to reconstruct the global vertex." << std::endl;
175  }
176 
177  m_stat->Fill(2);
178 
179 
180 //std::cout<<"processing event "<<std::endl;
181 /*
182 new event
183 A -0.000921115 0.00567926 2.26759 0 0
184 source 400
185 vtx -0.000921115 0.00567926 2.26759
186 
187 A 0 0 -11.2419 1 1
188 source 300
189 vtx 0 0 -11.2419
190 
191 A -0.000921115 0.00567926 2.26759 2 2
192 source 400
193 vtx -0.000921115 0.00567926 2.26759*/
194 
195 
196 
197  PHG4TruthInfoContainer *truthinfo = findNode::getClass<PHG4TruthInfoContainer>(topNode, "G4TruthInfo");
198  if (!truthinfo)
199  {
200  std::cout << PHWHERE << " ERROR: Can't find G4TruthInfo" << std::endl;
201  exit(-1);
202  }
203 
204  //loop over multiple JetReco->add_algo()
205  for(long unsigned int input = 0; input < m_recoJetName.size(); input++){
206  //reset per event container
207  m_container[input]->Reset();
208 
209  //get the event centrality/impact parameter from HIJING
210  m_container[input]->centrality = cent_node->get_centile(CentralityInfo::PROP::bimp);
211  m_container[input]->impactparam = cent_node->get_quantity(CentralityInfo::PROP::bimp);
212 
213 
214 
215  // interface to reco jets
216  JetContainer* jets = findNode::getClass<JetContainer>(topNode, m_recoJetName.at(input));
217  if (!jets){
218  std::cout << "MyJetAnalysis::process_event - Error can not find DST Reco JetContainer node " << m_recoJetName.at(input) << std::endl;
219  exit(-1);
220  }
221 
222  //interface to truth jets
223  //JetMap* jetsMC = findNode::getClass<JetMap>(topNode, m_truthJetName.at(input));
224  JetContainer* jetsMC = findNode::getClass<JetContainer>(topNode, m_truthJetName.at(input));
225  if (!jetsMC && m_doTruthJets){
226  std::cout << "MyJetAnalysis::process_event - Error can not find DST Truth JetContainer node " << m_truthJetName.at(input) << std::endl;
227  exit(-1);
228  }
229 
230  //get associated hepMCGenEvent
231  HepMC::GenEvent *hepMCGenEvent = nullptr;
232  if(m_doTruthJets){
233  PHHepMCGenEventMap *hepmceventmap = findNode::getClass<PHHepMCGenEventMap>(topNode, "PHHepMCGenEventMap");
234 
236  if (!hepmceventmap){
237  std::cout << PHWHERE
238  << "HEPMC event map node is missing, can't collected HEPMC truth particles"
239  << std::endl;
240  return 0;
241  }
242 
243  PHHepMCGenEvent *hepmcevent = hepmceventmap->get(1);
244 
245  if (!hepmcevent)
246  {
247  std::cout << PHWHERE
248  << "PHHepMCGenEvent node is missing, can't collected HEPMC truth particles"
249  << std::endl;
250  return 0;
251  }
252 
253  hepMCGenEvent = hepmcevent->getEvent();
254 
255  if(!hepMCGenEvent) return Fun4AllReturnCodes::ABORTEVENT;
256  }
257 
258  //get Particle Flow container
259  ParticleFlowElementContainer *pflowContainer = findNode::getClass<ParticleFlowElementContainer>(topNode, "ParticleFlowElements");
260 
261  if(!pflowContainer){
262  std::cout << PHWHERE
263  << "ParticleFlowElements node is missing, can't collect particles"
264  << std::endl;
265  return -1;
266  }
267 
268  for(auto vertex : *vertexmap){
269  PrimaryVertex primary;
270  std::vector<GlobalVertex::VTXTYPE> source;
271  source.clear();
272  primary.id = vertex.second->get_id();
273  primary.x = vertex.second->get_x();
274  primary.y = vertex.second->get_y();
275  primary.z = vertex.second->get_z();
276  primary.x_unc = sqrt(vertex.second->get_error(0,0));
277  primary.y_unc = sqrt(vertex.second->get_error(1,1));
278  primary.z_unc = sqrt(vertex.second->get_error(2,2));
279  primary.chisq = vertex.second->get_chisq();
280  primary.ndf = vertex.second->get_ndof();
281 
282  //std::cout<<std::endl<<"A "<<vertex.second->get_x()<<" "<<vertex.second->get_y()<<" "<<vertex.second->get_z()<<" "<<vertex.second->get_id()<<" "<<vertex.first<<std::endl;
283  for (auto iter = vertex.second->begin_vertexes(); iter != vertex.second->end_vertexes(); ++iter){
284  source.push_back(iter->first);
285  GlobalVertex::VertexVector vtx = iter->second;
286  //std::cout<<"source "<<iter->first<<std::endl;
287  // for(auto vx :vtx){
288  //std::cout<<"vtx "<<vx->get_x()<<" "<<vx->get_y()<<" "<<vx->get_z()<<" "<<vx->get_chisq()<<std::endl;
289  //}
290  }
291  if((std::find(source.begin(), source.end(), GlobalVertex::VTXTYPE::SVTX) != source.end()) && (std::find(source.begin(), source.end(), GlobalVertex::VTXTYPE::MBD) != source.end())) primary.vtxtype = GlobalVertex::VTXTYPE::SVTX_MBD;
292  else if(std::find(source.begin(), source.end(), GlobalVertex::VTXTYPE::SVTX) != source.end()) primary.vtxtype = GlobalVertex::VTXTYPE::SVTX;
293  else if(std::find(source.begin(), source.end(), GlobalVertex::VTXTYPE::MBD) != source.end()) primary.vtxtype = GlobalVertex::VTXTYPE::MBD;
294  m_container[input]->primaryVertex.push_back(primary);
295  }
296 
297  int nrecojet = 0;
298 
299  Jet::PROPERTY recojet_area_index = jets->property_index(Jet::PROPERTY::prop_area);
300 
301  for (Jet* jet : *jets){
302  if(jet->get_pt() < m_ptRangeReco.first || jet->get_pt() > m_ptRangeReco.second) continue;
303  if (not (std::abs(jet->get_eta()) <= 1.1 - (doFiducial?jetR.at(input):0))) continue;
304 
305  //std::cout<<jet->get_pt()<<std::endl;
306  nrecojet++;
307 
308  int nChtracks = 0;
309 
310  RecoJets recojet;
311 
312  //loop over jet constituents
313  for (const auto& comp : jet->get_comp_vec()){
314  ParticleFlowElement *pflow = pflowContainer->getParticleFlowElement(comp.second);
315  //if charged track
316  if(pflow->get_track()){
317  chConstituent track_properties;
318 
319  //get vertex associated to tarck
320  int id = pflow->get_track()->get_vertex_id();
321  GlobalVertex *vtx = vertexmap->get(id);
322  //skip if track without vertex
323  if (vtx == nullptr){
324  std::cout << "MyJetAnalysis::process_event - Fatal Error - Gvtx null." << std::endl;
325  continue;
326  }
327  nChtracks++;
328 
329  float DCA_xy, DCA_xy_unc;
330  GetDistanceFromVertexXY(pflow->get_track(),vtx,DCA_xy,DCA_xy_unc); //rerutn DCA_XY vector, val ||DCA|| + unc DCA
331  double dot = (pflow->get_track()->get_x() - vtx->get_x()) * jet->get_px() + (pflow->get_track()->get_y() - vtx->get_y()) * jet->get_py();
332  double sign = int(dot/std::abs(dot));
333 
334  //tarcking team way - no uncertainty of vertex in DCA calculation
335  /*Acts::Vector3 vtxActs(vtx->get_x(), vtx->get_y(), vtx->get_z());
336  std::pair<std::pair<float, float>, std::pair<float, float>> DCApair;
337  DCApair = TrackAnalysisUtils::get_dca(pflow->get_track(),vtxActs);
338  double dot2 = (pflow->get_track()->get_x() - vtx->get_x()) * jet->get_px() + (pflow->get_track()->get_y() - vtx->get_y()) * jet->get_py();
339  double sign2 = int(dot2/std::abs(dot2));*/
340 
341  //get some track quality values
342  int n_mvtx_hits = 0;
343  int n_intt_hits = 0;
344  int n_tpc_hits = 0;
345 
346  for (const auto& ckey : TrackAnalysisUtils::get_cluster_keys(pflow->get_track())){
347  switch (TrkrDefs::getTrkrId(ckey)){
348  case TrkrDefs::mvtxId:
349  n_mvtx_hits++;
350  break;
351  case TrkrDefs::inttId:
352  n_intt_hits++;
353  break;
354  case TrkrDefs::tpcId:
355  n_tpc_hits++;
356  break;
357  }
358  }
359 
360 
361  /*m_chi2ndf[input]->Fill(pflow->get_track()->get_chisq()/pflow->get_track()->get_ndf());
362  m_mvtxcl[input]->Fill(m_nmaps);
363  m_inttcl[input]->Fill(m_nintt);
364  m_mtpccl[input]->Fill(m_ntpc);*/
365  track_properties.pflowtype = pflow->get_type();
366  track_properties.vtx_id = id;
367  track_properties.e = pflow->get_e();
368  track_properties.eta = pflow->get_eta();
369  track_properties.phi = pflow->get_phi();
370  track_properties.pt = pflow->get_pt();
371  track_properties.DCA_xy = DCA_xy;
372  track_properties.DCA_xy_unc = DCA_xy_unc;
373  track_properties.sDCA_xy = sign*std::abs(DCA_xy/DCA_xy_unc);
374  track_properties.n_mvtx = n_mvtx_hits;
375  track_properties.n_intt = n_intt_hits;
376  track_properties.n_tpc = n_tpc_hits;
377  track_properties.chisq = pflow->get_track()->get_chisq();
378  track_properties.ndf = pflow->get_track()->get_ndf();
379 
380  recojet.chConstituents.push_back(track_properties);
381  } // end if(pflow->get_track())
382  else{ //neutral tracl
383  neConstituent neutral_properties;
384  neutral_properties.pflowtype = pflow->get_type();
385  neutral_properties.e = pflow->get_e();
386  neutral_properties.eta = pflow->get_eta();
387  neutral_properties.phi = pflow->get_phi();
388  recojet.neConstituents.push_back(neutral_properties);
389  }
390  } // end for (const auto& comp : jet->get_comp_vec())
391 
392  recojet.id = jet->get_id();
393  recojet.area = jet->get_property(recojet_area_index);
394  recojet.num_Constituents = static_cast<int>(jet->get_comp_vec().size());
395  recojet.num_ChConstituents = nChtracks;
396  recojet.px = jet->get_px();
397  recojet.py = jet->get_py();
398  recojet.pz = jet->get_pz();
399  recojet.pt = jet->get_pt();
400  recojet.eta = jet->get_eta();
401  recojet.phi = jet->get_phi();
402  recojet.m = jet->get_mass();
403  recojet.e = jet->get_e();
404 
405  m_container[input]->recojets.push_back(recojet);
406  } // end for (Jet* jet : *jets)
407  m_container[input]->reco_jet_n = static_cast<int>(nrecojet);
408 
409 
410 
411  //get truth jets
412  if(m_doTruthJets){
413  int ntruthjet = 0;
414  TruthJets mtruthjet;
415  Jet::PROPERTY truthjet_area_index = jetsMC->property_index(Jet::PROPERTY::prop_area);
416 
417  //Jet::PROPERTY recojet_area_index = jetsMC->property_index(Jet::PROPERTY::prop_area);
418 
419  //truth jet loop
420  //for (JetMap::Iter iter = jetsMC->begin(); iter != jetsMC->end(); ++iter){
421  for (Jet* truthjet : *jetsMC){
422  //Jet* truthjet = iter->second;
423  if(truthjet->get_pt() < m_ptRangeTruth.first || truthjet->get_pt() > m_ptRangeTruth.second) continue;
424  if (not (std::abs(truthjet->get_eta()) <= 1.1 - (doFiducial?jetR.at(input):0))) continue;
425  if(truthjet->get_pt() < 10.0) continue;
426  ntruthjet++;
427 
428 
429  mtruthjet.id = truthjet->get_id();
430  mtruthjet.area = truthjet->get_property(truthjet_area_index);
431  mtruthjet.num_Constituents = truthjet->size_comp();
432  mtruthjet.px = truthjet->get_px();
433  mtruthjet.py = truthjet->get_py();
434  mtruthjet.pz = truthjet->get_pz();
435  mtruthjet.pt = truthjet->get_pt();
436  mtruthjet.eta = truthjet->get_eta();
437  mtruthjet.phi = truthjet->get_phi();
438  mtruthjet.m = truthjet->get_mass();
439  mtruthjet.e = truthjet->get_e();
440 
441 
442  //jet-tarck PDG identification
443  TString taggedPDGIDs[] = {"B-Meson","CharmedMeson","CharmedBaryon", "B-Baryon"};
444  int forbiddenPDGIDs[] = {1,2,3,4,5,6,7,8,21,22};
445  int nChTrackstruth = 0;
446 
447  //loop over jet constituents
448  //for(auto citer = truthjet->begin_comp(); citer != truthjet->end_comp(); ++citer){
449  for (const auto& comp : truthjet->get_comp_vec()){
450  //PHG4Particle *g4part = truthinfo->GetPrimaryParticle(citer->second);
451  PHG4Particle *g4part = truthinfo->GetPrimaryParticle(comp.second);
452  HepMC::GenParticle* constituent = hepMCGenEvent->barcode_to_particle(g4part->get_barcode());
453  if(std::abs((TDatabasePDG::Instance()->GetParticle((constituent)->pdg_id()))->Charge()) > 10e-4) nChTrackstruth++;
454 
455  //mother track tagged, stop search
456  if (std::find(std::begin(taggedPDGIDs), std::end(taggedPDGIDs), TString((TDatabasePDG::Instance()->GetParticle((constituent)->pdg_id()))->ParticleClass())) != std::end(taggedPDGIDs)){
457  mtruthjet.constituents_PDG_ID.push_back((constituent)->pdg_id());
458  continue;
459  }
460 
461  //not yet tagged, begin history search
462  while (!constituent->is_beam()){
463  bool breakOut = false;
464  bool taggedHF = false;
465  for (HepMC::GenVertex::particle_iterator mother = constituent->production_vertex()->particles_begin(HepMC::parents); mother != constituent->production_vertex()->particles_end(HepMC::parents); ++mother){
466  //found HF in parent tree
467  if (std::find(std::begin(taggedPDGIDs), std::end(taggedPDGIDs), TString((TDatabasePDG::Instance()->GetParticle((*mother)->pdg_id()))->ParticleClass())) != std::end(taggedPDGIDs)){
468  taggedHF = true;
469  mtruthjet.constituents_PDG_ID.push_back((*mother)->pdg_id());
470  break;
471  }
472  //reached partonic level, break search
473  if (std::find(std::begin(forbiddenPDGIDs), std::end(forbiddenPDGIDs), abs((*mother)->pdg_id())) != std::end(forbiddenPDGIDs)){
474  breakOut = true;
475  break;
476  }
477  constituent = *mother;
478  }
479  if (breakOut || taggedHF) break;
480  }
481  }// end loop over constituents
482 
483  mtruthjet.num_ChConstituents = nChTrackstruth ;
484  m_container[input]->truthjets.push_back(mtruthjet);
485  }// end jet loop
486  m_container[input]->truth_jet_n = static_cast<int>(ntruthjet);
487  }//end if do truth
488  //fill tree
489  m_T[input]->Fill();
490  }//end input loop
491 
493 }
494 
495 //____________________________________________________________________________..
497 {
498  //std::cout << "FullJetFinder::ResetEvent(PHCompositeNode *topNode) Resetting internal structures, prepare for next event" << std::endl;
500 }
501 
502 //____________________________________________________________________________..
504 {
505  std::cout << "FullJetFinder::EndRun(const int runnumber) Ending Run for Run " << runnumber << std::endl;
507 }
508 
509 //____________________________________________________________________________..
511 {
512  std::cout << "FullJetFinder::End - Output to " << m_outputFileName << std::endl;
513 
514  /*CutSelection cutselection;
515  cutselection.jetptmin = 5;
516  cutselection.jetptmin = 30;*/
517 
519  m_stat->Write();
520  }
521 
522  for(int i = 0 ; i < m_inputs; i++){
523  if(m_T[i] ){
525  TDirectory *cdtof = gDirectory->mkdir(m_TreeNameCollection.at(i).data());
526  cdtof->cd();
527  //cdtof-><CutSelection>WriteObject(cutselection, "Selection");
528  //cutselection.Write("Selection");
529  m_T[i]->Write();
530  }
531  }
532  }
533  std::cout << "FullJetFinder::End(PHCompositeNode *topNode) This is the End..." << std::endl;
535 }
536 
537 //____________________________________________________________________________..
539 {
540  std::cout << "FullJetFinder::Reset(PHCompositeNode *topNode) being Reset" << std::endl;
542 }
543 
544 //____________________________________________________________________________..
545 void FullJetFinder::Print(const std::string &what) const
546 {
547  std::cout << "FullJetFinder::Print(const std::string &what) const Printing info for " << what << std::endl;
548 }
549 
550 void FullJetFinder::GetDistanceFromVertexXY(SvtxTrack *m_dst_track, GlobalVertex *m_dst_vertex,float &val, float &err){
551 
552  KFParticle::SetField(1.4e1);
553 
554  KFParticle kfp_particle;
555 
556  float f_trackParameters[6] = {m_dst_track->get_x(),
557  m_dst_track->get_y(),
558  m_dst_track->get_z(),
559  m_dst_track->get_px(),
560  m_dst_track->get_py(),
561  m_dst_track->get_pz()};
562 
563  float f_trackCovariance[21];
564  unsigned int iterate = 0;
565  for (unsigned int i = 0; i < 6; ++i)
566  for (unsigned int j = 0; j <= i; ++j)
567  {
568  f_trackCovariance[iterate] = m_dst_track->get_error(i, j);
569  ++iterate;
570  }
571 
572  kfp_particle.Create(f_trackParameters, f_trackCovariance, (Int_t) m_dst_track->get_charge(), -1);
573  kfp_particle.NDF() = m_dst_track->get_ndf();
574  kfp_particle.Chi2() = m_dst_track->get_chisq();
575  kfp_particle.SetId(m_dst_track->get_id());
576 
577  float f_vertexParameters[6] = {m_dst_vertex->get_x(),
578  m_dst_vertex->get_y(),
579  m_dst_vertex->get_z(), 0, 0, 0};
580 
581  float f_vertexCovariance[21];
582  unsigned int iterate2 = 0;
583  for (unsigned int i = 0; i < 3; ++i)
584  for (unsigned int j = 0; j <= i; ++j)
585  {
586  f_vertexCovariance[iterate2] = m_dst_vertex->get_error(i, j);
587  ++iterate2;
588  }
589 
590  KFParticle kfp_vertex;
591  kfp_vertex.Create(f_vertexParameters, f_vertexCovariance, 0, -1);
592  kfp_vertex.NDF() = m_dst_vertex->get_ndof();
593  kfp_vertex.Chi2() = m_dst_vertex->get_chisq();
594  kfp_particle.GetDistanceFromVertexXY(kfp_vertex,val,err);
595 }
596