#include #include #include #include #include "JReconstruction/JEvt.hh" #include "JReconstruction/JEvtToolkit.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to test application history. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; int debug; try { JParser<> zap("Example program to test application history."); zap['d'] = make_field(debug) = 3; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } const int numberOfFits = 3; JEvt evt; // JPrefit for (int i = 0; i != numberOfFits; ++i) { evt.push_back(getFit(JHistory(JMUONPREFIT), JTrack3D(), 0.0, 0)); } // subsequent fits const int application[] = { JMUONSIMPLEX, JMUONGANDALF, //JMUONENERGY, JMUONSTART }; for (int i = 0; i != sizeof(application)/sizeof(int); ++i) { JEvt out; // save previous results copy(evt.begin(), evt.end(), back_inserter(out)); // sort quality partial_sort(evt.begin(), evt.end(), evt.end(), qualitySorter); // partition according history of best fit JEvt::const_iterator __end = partition(evt.begin(), evt.end(), JHistory::is_event(evt.begin()->getHistory())); for (JEvt::const_iterator fit = evt.begin(); fit != __end; ++fit) { out.push_back(getFit(JHistory(fit->getHistory()).add(application[i]), JTrack3D(), 0, 0.0)); } // apply default sorter sort(out.begin(), out.end(), qualitySorter); // mimic process chain evt = out; } for (size_t i = 0; i != evt.size(); ++i) { DEBUG("fit[" << i << "]" << endl << static_cast(evt[i]) << endl); } ASSERT((int) evt.size() == numberOfFits * (sizeof(application)/sizeof(int) + 1)); for (int i = 0; i != numberOfFits; ++i) { ASSERT(has_muon_prefit (evt[i]) && has_muon_simplex(evt[i]) && has_muon_gandalf(evt[i]) && !has_muon_energy(evt[i]) && // disabled as test has_muon_start (evt[i])); } ASSERT( has_reconstructed_track(evt, has_muon_prefit)); ASSERT( has_reconstructed_track(evt, has_muon_simplex)); ASSERT( has_reconstructed_track(evt, has_muon_gandalf)); ASSERT(!has_reconstructed_track(evt, has_muon_energy)); ASSERT( has_reconstructed_track(evt, has_muon_start)); ASSERT( has_reconstructed_muon (evt)); ASSERT(!has_reconstructed_shower(evt)); const JFit& fit = get_best_reconstructed_muon(evt); ASSERT(has_muon_prefit (fit) && has_muon_simplex(fit) && has_muon_gandalf(fit) && !has_muon_energy(fit) && // disabled as test has_muon_start (fit)); return 0; }