Get the next track by pressing enter. Fresh fill script, one step closer to the real track.
This commit is contained in:
		
							parent
							
								
									d1f9dc179f
								
							
						
					
					
						commit
						106ba02740
					
				
							
								
								
									
										78
									
								
								DB_Track.cpp
								
								
								
								
							
							
						
						
									
										78
									
								
								DB_Track.cpp
								
								
								
								
							| 
						 | 
					@ -6,45 +6,91 @@
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <iostream>
 | 
				
			||||||
#include "TApplication.h"
 | 
					#include "TApplication.h"
 | 
				
			||||||
#include "TrackFinder.hpp"
 | 
					#include "TrackFinder.hpp"
 | 
				
			||||||
#include "TH2D.h"
 | 
					#include "TH2D.h"
 | 
				
			||||||
 | 
					#include "TCanvas.h"
 | 
				
			||||||
 | 
					#include "TSystem.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int main(int argc, char* argv[])
 | 
					int main(int argc, char* argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    TApplication App("tapp", &argc, argv);
 | 
					    TApplication App("tapp", &argc, argv);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    TH2D *twoDhisto = new TH2D("2Dhisto","2Dhisto", 100, 0, 32, 100, 0, 32);
 | 
					    TH2D *twoDhisto = new TH2D("2Dhisto","2Dhisto", 100, 0, 32, 100, 0, 32);
 | 
				
			||||||
 | 
					    TCanvas *canvas = new TCanvas();
 | 
				
			||||||
    std::vector<int> ch_id;
 | 
					    std::vector<int> ch_id;
 | 
				
			||||||
    std::vector<int> sec;
 | 
					    std::vector<int> sec;
 | 
				
			||||||
    std::vector<int> nsec;
 | 
					    std::vector<int> nsec;
 | 
				
			||||||
    std::vector<int> amp;
 | 
					    std::vector<int> amp;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    int x = 0;
 | 
					    std::vector<int> x_v;
 | 
				
			||||||
    int y = 0;
 | 
					    std::vector<int> y_v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int iterator = 0;
 | 
				
			||||||
 | 
					    int null = 0;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    canvas -> cd(0);
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    TrackFinder finder;
 | 
					    TrackFinder finder;
 | 
				
			||||||
    if(finder.FindTrack())
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        finder.GetTrack(ch_id, sec, nsec, amp);
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        for(int i = 0; i < ch_id.size(); i++)
 | 
					    while(true)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        if(std::cin.get() == '\n')
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            x = 0;
 | 
					            twoDhisto -> Reset();
 | 
				
			||||||
            y = 0;
 | 
					            x_v.clear();
 | 
				
			||||||
            if(ch_id[i] < 32)
 | 
					            y_v.clear();
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            if(finder.FindTrack())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                x = ch_id[i];
 | 
					                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]);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					            iterator++;
 | 
				
			||||||
            {
 | 
					            twoDhisto -> Draw("colz");
 | 
				
			||||||
                y = ch_id[i] - 32;
 | 
					            canvas -> Update();
 | 
				
			||||||
            }
 | 
					            gSystem -> ProcessEvents();
 | 
				
			||||||
            twoDhisto -> Fill(x, y);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        twoDhisto -> Draw("lego2");
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    std::cout << iterator << std::endl;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    App.Run();
 | 
					    App.Run();
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,9 +25,7 @@ public:
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    std::ifstream file;
 | 
					    std::ifstream file;
 | 
				
			||||||
    std::string line;
 | 
					    std::string line;
 | 
				
			||||||
    int interval = 700000; //nanosec
 | 
					    int interval = 900000; //nanosec
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    int iterator = 0;
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    int ch_id_1 = 0;
 | 
					    int ch_id_1 = 0;
 | 
				
			||||||
    int sec_1 = 0;
 | 
					    int sec_1 = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,7 +50,7 @@ bool TrackFinder::FindTrack()
 | 
				
			||||||
    sec.erase(sec.begin(), sec.end());
 | 
					    sec.erase(sec.begin(), sec.end());
 | 
				
			||||||
    nsec.erase(nsec.begin(), nsec.end());
 | 
					    nsec.erase(nsec.begin(), nsec.end());
 | 
				
			||||||
    amp.erase(amp.begin(), amp.end());
 | 
					    amp.erase(amp.begin(), amp.end());
 | 
				
			||||||
    while(1)
 | 
					    while(!file.eof())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        getline(file, line);
 | 
					        getline(file, line);
 | 
				
			||||||
        std::istringstream is(line);
 | 
					        std::istringstream is(line);
 | 
				
			||||||
| 
						 | 
					@ -95,6 +95,7 @@ bool TrackFinder::FindTrack()
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TrackFinder::GetTrack(std::vector<int> &ch, std::vector<int> &s, std::vector<int> &ns, std::vector<int> &a)
 | 
					void TrackFinder::GetTrack(std::vector<int> &ch, std::vector<int> &s, std::vector<int> &ns, std::vector<int> &a)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue