18 #include <phgenfit/Fitter.h>
20 #include <phfield/PHFieldUtility.h>
22 #include <phgeom/PHGeomUtility.h>
36 #include <GenFit/FitStatus.h>
37 #include <GenFit/GFRaveTrackParameters.h>
38 #include <GenFit/GFRaveVertex.h>
39 #include <GenFit/GFRaveVertexFactory.h>
40 #include <GenFit/KalmanFittedStateOnPlane.h>
41 #include <GenFit/KalmanFitterInfo.h>
42 #include <GenFit/MeasuredStateOnPlane.h>
43 #include <GenFit/RKTrackRep.h>
45 #include <GenFit/TrackPoint.h>
47 #include <TMatrixDSymfwd.h>
48 #include <TMatrixTSym.h>
49 #include <TMatrixTUtils.h>
60 namespace genfit {
class AbsTrackRep; }
62 #define LogDebug(exp) std::cout << "DEBUG: " << __FILE__ << ": " << __LINE__ << ": " << exp << std::endl
63 #define LogError(exp) std::cout << "ERROR: " << __FILE__ << ": " << __LINE__ << ": " << exp << std::endl
64 #define LogWarning(exp) std::cout << "WARNING: " << __FILE__ << ": " << __LINE__ << ": " << exp << std::endl
75 , _over_write_svtxvertexmap(
false)
76 , _svtxvertexmaprefit_node_name(
"SvtxVertexMapRefit")
78 , _primary_pid_guess(211)
80 , _vertex_finder(nullptr)
81 , _vertexing_method(
"avf-smoothing:1")
84 , _vertexmap_refit(nullptr)
85 , _t_translate(nullptr)
114 "RKTrackRep",
false);
117 std::cout <<
PHWHERE <<
" PHGenFit::Fitter::getInstance returned nullptr"
132 std::cout <<
PHWHERE <<
" genfit::GFRaveVertexFactory returned null ptr" << std::endl;
158 std::cout <<
PHWHERE <<
"Events processed: " <<
_event << std::endl;
164 vector<genfit::Track*> gf_tracks;
179 unsigned int nmvtx = 0;
189 if(
Verbosity() > 1) std::cout <<
" track " << iter->first <<
" has nmvtx at least " << nmvtx << std::endl;
196 gf_track_map.insert({genfit_track, iter->first});
197 gf_tracks.push_back(const_cast<genfit::Track*>(genfit_track));
202 vector<genfit::GFRaveVertex*> rave_vertices;
203 if (gf_tracks.size() >= 2)
212 std::cout <<
PHWHERE <<
"GFRaveVertexFactory::findVertices failed!";
218 for (
auto iter : gf_track_map)
delete iter.first;
224 std::cout <<
"=============== Timers: ===============" << std::endl;
225 std::cout <<
"Event: " <<
_event << std::endl;
228 std::cout <<
"=======================================" << std::endl;
257 "PHCompositeNode",
"DST"));
260 cerr <<
PHWHERE <<
"DST Node missing, doing nothing." << endl;
267 "PHCompositeNode",
"SVTX"));
273 cout <<
"SVTX node added" << endl;
281 tb_node->
addNode(vertexes_node);
283 cout <<
"Svtx/SvtxVertexMapRefit node added" << endl;
285 else if (!findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMap"))
290 tb_node->
addNode(vertexes_node);
292 cout <<
"Svtx/SvtxVertexMap node added" << endl;
306 _trackmap = findNode::getClass<SvtxTrackMap>(topNode,
"SvtxTrackMap");
309 cout <<
PHWHERE <<
" SvtxTrackMap node not found on node tree"
315 _vertexmap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMap");
318 cout <<
PHWHERE <<
" SvtxVertexrMap node not found on node tree"
330 cout <<
PHWHERE <<
" SvtxVertexMapRefit node not found on node tree"
343 const std::vector<genfit::GFRaveVertex*>& rave_vertices,
364 svtx_vtx->set_chisq(rave_vtx->getChi2());
365 svtx_vtx->set_ndof(rave_vtx->getNdf());
366 svtx_vtx->set_position(0, rave_vtx->getPos().X());
367 svtx_vtx->set_position(1, rave_vtx->getPos().Y());
368 svtx_vtx->set_position(2, rave_vtx->getPos().Z());
370 for (
int i = 0;
i < 3;
i++)
371 for (
int j = 0;
j < 3;
j++)
372 svtx_vtx->set_error(
i,
j, rave_vtx->getCov()[
i][
j]);
374 for (
unsigned int i = 0;
i < rave_vtx->getNTracks();
i++)
378 rave_vtx->getParameters(
i)->getTrack();
383 auto iter = gf_track_map.find(rave_track);
384 if (iter != gf_track_map.end())
385 svtx_vtx->insert_track(iter->second);
412 cout << __LINE__ << endl;
413 svtx_vtx->identify();
431 LogDebug(
"TranslateSvtxToGenFitTrack no state in track!");
448 LogDebug(
"TranslateSvtxToGenFitTrack invalid state found on track!");
455 for (
int i = 0;
i < 6; ++
i)
457 for (
int j = 0;
j < 6; ++
j)
465 cout <<
"DEBUG" << __LINE__ << endl;
467 cout <<
"radius: " <<
pos.Perp() << endl;
468 cout <<
"DEBUG: " << __LINE__ << endl;
469 for (
int i = 0;
i < 6; ++
i)
471 for (
int j = 0;
j < 6; ++
j)
504 cout <<
"DEBUG: " << __LINE__ << endl;
506 cout <<
"Orig: " << __LINE__ << endl;
508 cout <<
"Translate: " << __LINE__ << endl;
535 LogDebug(
"TranslateSvtxToGenFitTrack failed!");