99 lines
2.5 KiB
C++
99 lines
2.5 KiB
C++
//
|
|
// DB_Track.cpp
|
|
//
|
|
//
|
|
// Created by Baranyai David on 2018. 06. 05..
|
|
//
|
|
|
|
#include <stdio.h>
|
|
#include <iostream>
|
|
#include "TApplication.h"
|
|
#include "TrackFinder.hpp"
|
|
#include "TH2D.h"
|
|
#include "TCanvas.h"
|
|
#include "TSystem.h"
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
TApplication App("tapp", &argc, argv);
|
|
|
|
std::cout << "Press enter for the next track." << std::endl << "Press Ctrl + C to exit." << std::endl;
|
|
|
|
TH2D *twoDhisto = new TH2D("2Dhisto","2Dhisto", 100, 0, 32, 100, 0, 32);
|
|
TCanvas *canvas = new TCanvas();
|
|
std::vector<int> ch_id;
|
|
std::vector<int> sec;
|
|
std::vector<int> nsec;
|
|
std::vector<int> amp;
|
|
|
|
std::vector<int> x_v;
|
|
std::vector<int> y_v;
|
|
|
|
int iterator = 0;
|
|
int null = 0;
|
|
|
|
canvas -> cd(0);
|
|
|
|
TrackFinder finder;
|
|
|
|
while(true)
|
|
{
|
|
if(std::cin.get() == '\n')
|
|
{
|
|
twoDhisto -> Reset();
|
|
x_v.clear();
|
|
y_v.clear();
|
|
|
|
if(finder.FindTrack())
|
|
{
|
|
finder.GetTrack(ch_id, sec, nsec, amp);
|
|
for(int i = 0; i < ch_id.size(); i++)
|
|
{
|
|
if(ch_id[i] < 32)
|
|
{
|
|
x_v.push_back(ch_id[i]);
|
|
}
|
|
else
|
|
{
|
|
y_v.push_back(ch_id[i] - 32);
|
|
}
|
|
|
|
}
|
|
if(x_v.size() == 0)
|
|
{
|
|
for(int i = 0; i < y_v.size(); i++)
|
|
{
|
|
twoDhisto -> Fill(null, y_v[i]);
|
|
}
|
|
}
|
|
if(y_v.size() == 0)
|
|
{
|
|
for(int i = 0; i < x_v.size(); i++)
|
|
{
|
|
twoDhisto -> Fill(x_v[i], null);
|
|
}
|
|
}
|
|
if(x_v.size() > 0 && y_v.size() > 0)
|
|
{
|
|
for(int z = 0; z < x_v.size(); z++)
|
|
{
|
|
for(int j = 0; j < y_v.size(); j++)
|
|
{
|
|
twoDhisto -> Fill(x_v[z], y_v[j]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
iterator++;
|
|
twoDhisto -> Draw("colz");
|
|
canvas -> Update();
|
|
gSystem -> ProcessEvents();
|
|
}
|
|
}
|
|
|
|
std::cout << iterator << std::endl;
|
|
|
|
App.Run();
|
|
return 0;
|
|
}
|