Commit 867572ca authored by David Blyth's avatar David Blyth

saving state: little tweaks

parent e6030c97
......@@ -233,6 +233,7 @@ void trackEvent(proio::Event *event, const int n_validate, genfit::KalmanFitter
// build track seed
std::vector<uint64_t> track_obs;
std::sort(available_obs.begin(), available_obs.end(), seed_sort_fn);
if (seed_sort_param[available_obs.back()] > 1) break;
track_obs.push_back(available_obs.back());
available_obs.pop_back();
auto current_id = track_obs.back();
......@@ -271,7 +272,7 @@ void trackEvent(proio::Event *event, const int n_validate, genfit::KalmanFitter
track->getPoint(0)->setSortingParameter(0.0);
track->addTrackRep(new genfit::RKTrackRep(11));
track->addTrackRep(new genfit::RKTrackRep(13));
int n_seed = n_validate - 1;
int n_seed = 5;
for (int i = 0; i < n_seed - 1; i++) {
track_obs.push_back(available_obs.back());
available_obs.pop_back();
......@@ -285,7 +286,13 @@ void trackEvent(proio::Event *event, const int n_validate, genfit::KalmanFitter
id_lookup[track_point] = id;
}
track->sort();
fitter->processTrack(track);
fitter->setMaxIterations(16);
try {
fitter->processTrack(track);
} catch (genfit::Exception e) {
std::cerr << e.what() << std::endl;
continue;
}
bool do_extend = false;
for (auto rep : track->getTrackReps())
if (track->getFitStatus(rep)->isFitConverged()) {
......@@ -315,7 +322,11 @@ void trackEvent(proio::Event *event, const int n_validate, genfit::KalmanFitter
std::vector<genfit::AbsTrackRep *> all_reps(track->getTrackReps());
std::vector<genfit::AbsTrackRep *> bad_reps;
for (auto rep : all_reps) {
fitter->processTrackPartially(track, rep, -2, -1);
try {
fitter->processTrackPartially(track, rep, -2, -1);
} catch (genfit::Exception e) {
std::cerr << e.what() << std::endl;
}
double pval = forwardPVal(track, rep);
if (fabs(pval - 0.5) < 0.49) continue;
bad_reps.push_back(rep);
......@@ -333,14 +344,24 @@ void trackEvent(proio::Event *event, const int n_validate, genfit::KalmanFitter
}
for (auto rep : bad_reps) track->deleteTrackRep(track->getIdForRep(rep));
quickTrackProcess(fitter, track);
// try {
// quickTrackProcess(fitter, track);
//} catch (genfit::Exception e) {
// std::cerr << e.what() << std::endl;
// break;
//}
}
track->determineCardinalRep();
auto rep = track->getCardinalRep();
// fit track
if (track_obs.size() >= n_validate) {
fitter->processTrackWithRep(track, rep);
fitter->setMaxIterations(100);
try {
fitter->processTrackWithRep(track, rep);
} catch (genfit::Exception e) {
std::cerr << e.what() << std::endl;
}
if (track->getFitStatus(rep)->isFitConverged()) {
auto eic_track = new eic::Track;
......@@ -433,9 +454,8 @@ int main(int argc, char **argv) {
genfit::MaterialEffects::getInstance()->setNoEffects();
genfit::MaterialEffects::getInstance()->setEnergyLossBrems(false);
genfit::KalmanFitter fitter;
// fitter.setMaxIterations(100);
int comp = 0;
int n_validate = 6;
int n_validate = 8;
int opt;
while ((opt = getopt(argc, argv, "c:n:h")) != -1) {
......@@ -487,7 +507,7 @@ int main(int argc, char **argv) {
trackEvent(&event, n_validate, &fitter);
writer->Push(&event);
n_events++;
// if (n_events == 10) break;
if (n_events == 20) break;
}
delete writer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment