2018-06-05 23:09:11 +02:00
|
|
|
//
|
|
|
|
// DB_Track.cpp
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Created by Baranyai David on 2018. 06. 05..
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2018-06-06 17:34:58 +02:00
|
|
|
#include <iostream>
|
2018-06-05 23:09:11 +02:00
|
|
|
#include "TApplication.h"
|
|
|
|
#include "TrackFinder.hpp"
|
|
|
|
#include "TH2D.h"
|
2018-06-06 17:34:58 +02:00
|
|
|
#include "TCanvas.h"
|
|
|
|
#include "TSystem.h"
|
2018-06-05 23:09:11 +02:00
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
TApplication App("tapp", &argc, argv);
|
|
|
|
|
2018-06-06 18:02:06 +02:00
|
|
|
std::cout << "Press enter for the next track." << std::endl << "Press Ctrl + C to exit." << std::endl;
|
|
|
|
|
2018-06-05 23:09:11 +02:00
|
|
|
TH2D *twoDhisto = new TH2D("2Dhisto","2Dhisto", 100, 0, 32, 100, 0, 32);
|
2018-06-06 17:34:58 +02:00
|
|
|
TCanvas *canvas = new TCanvas();
|
2018-06-05 23:09:11 +02:00
|
|
|
std::vector<int> ch_id;
|
|
|
|
std::vector<int> sec;
|
|
|
|
std::vector<int> nsec;
|
|
|
|
std::vector<int> amp;
|
|
|
|
|
2018-06-06 17:34:58 +02:00
|
|
|
std::vector<int> x_v;
|
|
|
|
std::vector<int> y_v;
|
|
|
|
|
|
|
|
int iterator = 0;
|
|
|
|
int null = 0;
|
|
|
|
|
|
|
|
canvas -> cd(0);
|
2018-06-05 23:09:11 +02:00
|
|
|
|
|
|
|
TrackFinder finder;
|
2018-06-06 17:34:58 +02:00
|
|
|
|
|
|
|
while(true)
|
2018-06-05 23:09:11 +02:00
|
|
|
{
|
2018-06-06 17:34:58 +02:00
|
|
|
if(std::cin.get() == '\n')
|
2018-06-05 23:09:11 +02:00
|
|
|
{
|
2018-06-06 17:34:58 +02:00
|
|
|
twoDhisto -> Reset();
|
|
|
|
x_v.clear();
|
|
|
|
y_v.clear();
|
|
|
|
|
|
|
|
if(finder.FindTrack())
|
2018-06-05 23:09:11 +02:00
|
|
|
{
|
2018-06-06 17:34:58 +02:00
|
|
|
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]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-05 23:09:11 +02:00
|
|
|
}
|
2018-06-06 17:34:58 +02:00
|
|
|
iterator++;
|
|
|
|
twoDhisto -> Draw("colz");
|
|
|
|
canvas -> Update();
|
|
|
|
gSystem -> ProcessEvents();
|
2018-06-05 23:09:11 +02:00
|
|
|
}
|
|
|
|
}
|
2018-06-05 23:15:19 +02:00
|
|
|
|
2018-06-06 17:34:58 +02:00
|
|
|
std::cout << iterator << std::endl;
|
|
|
|
|
2018-06-05 23:09:11 +02:00
|
|
|
App.Run();
|
|
|
|
return 0;
|
|
|
|
}
|