// // TrackReconstruction.cpp // DB_Track // // Created by Baranyai David on 2018. 06. 07.. // #include #include "TApplication.h" #include "TrackFinder.hpp" #include "TH3D.h" #include "TCanvas.h" #include "TSystem.h" #include int main(int argc, char* argv[]) { TApplication App("tapp", &argc, argv); TCanvas *canvas = new TCanvas(); TH3D *threedhisto = new TH3D("threedhisto", "threedhisto", 100, 0, 32, 100, 0, 32, 100, 0, 2); std::vector track; std::vector x; std::vector y; TrackFinder finder; canvas -> cd(0); std::cout << "Press Enter for new track" << std:: endl; std::cout << "or press Ctrl + C to exit" << std::endl; while(true) { if(std::cin.get() == '\n') { x.clear(); y.clear(); track.clear(); if(finder.FindTrack()) { finder.GetTrack(track); /* Handling is easier if we separate the results to X and Y */ for(int i = 0; i < track.size(); i++) { if (track[i].direction == "x") { x.push_back(track[i]); } else { y.push_back(track[i]); } std::cout << track[i]; } std::cout << "X size = " << x.size() << std::endl; std::cout << "Y size = " << y.size() << std::endl; if(x.size() > 0 && y.size() > 0) { threedhisto -> Reset(); for(int x1 = 0; x1 < x.size(); x1++) { for(int y1 = 0; y1 < y.size(); y1++) { if(x[x1].which_chamber == y[y1].which_chamber) { threedhisto -> Fill(x[x1].ch_id, y[y1].ch_id, x[x1].which_chamber); } } } threedhisto -> Draw("lego2"); canvas -> Update(); gSystem -> ProcessEvents(); } } } } App.Run(); return 0; }