3 #include <GenFit/DAF.h>
4 #include <GenFit/EventDisplay.h>
5 #include <GenFit/FieldManager.h>
6 #include <GenFit/FitStatus.h>
7 #include <GenFit/KalmanFitter.h>
8 #include <GenFit/KalmanFitterRefTrack.h>
9 #include <GenFit/MaterialEffects.h>
10 #include <GenFit/TGeoMaterialInterface.h>
19 if(_kmfitter !=
nullptr)
delete _kmfitter;
20 if(_display !=
nullptr)
delete _display;
26 if(_kmfitter !=
nullptr) _kmfitter->setDebugLvl(_verbosity);
31 genfit::FieldManager::getInstance()->init(field);
32 genfit::MaterialEffects::getInstance()->init(
new genfit::TGeoMaterialInterface());
34 _fitterTy = fitter_choice;
35 if(fitter_choice ==
"KalmanFitterRefTrack")
36 _kmfitter =
new genfit::KalmanFitterRefTrack();
37 else if(fitter_choice ==
"KalmanFitter")
38 _kmfitter =
new genfit::KalmanFitter();
39 else if(fitter_choice ==
"DafSimple")
40 _kmfitter =
new genfit::DAF(
false);
41 else if(fitter_choice ==
"DafRef")
42 _kmfitter =
new genfit::DAF(
true);
44 _kmfitter =
new genfit::KalmanFitter();
46 _kmfitter->setMaxIterations(10);
47 _kmfitter->setDebugLvl(_verbosity);
57 catch(genfit::Exception& e)
59 std::cerr <<
"Track consistency error before fit: " << e.what() << std::endl;
67 _kmfitter->processTrack(gftrack);
69 catch(genfit::Exception& e)
71 std::cerr <<
"Track fitting failed: " << e.what() << std::endl;
80 catch(genfit::Exception& e)
82 std::cerr <<
"Track consistency error after fit: " << e.what() << std::endl;
86 genfit::AbsTrackRep* rep = gftrack->getCardinalRep();
87 if(!gftrack->getFitStatus(rep)->isFitConverged())
89 std::cerr <<
"Fit failed to converge." << std::endl;
95 if(_display ==
nullptr) _display = genfit::EventDisplay::getInstance();
96 _display->addEvent(gftrack);
104 if(_display !=
nullptr) _display->open();
void init(GFField *field, const TString &fitter_choice="KalmanFitterRefTrack")
void setVerbosity(unsigned int v)
int processTrack(GFTrack &track, bool display=false)
genfit::Track * getGenFitTrack()