// created: 25 March 2014 // last modif: 25 March 2014 // Author: Creusot Alexandre #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; void timeFramePlot() { gROOT->Reset(); gROOT->SetStyle("Plain"); gStyle->SetPalette(1); gStyle->SetNumberContours(99); gStyle->SetOptFit(0000); TStopwatch watch; vector time; vector count; //TH1D* hTiming1 = new TH1D("hTiming1", "hTiming1", 1000, 0, 1.2e9); TH1D* hToT1 = new TH1D("hToT1", "hToT1", 200, 0, 200); string line; ifstream in1("timeFrame10.dat"); int counter = 0; while (getline(in1, line)) { istringstream iss; iss.clear(); iss.str(line); double temp[4]; if (iss >> temp[0] >> temp[1] >> temp[2] >> temp[3]) { ++counter; count.push_back(counter); time.push_back(temp[2]); //hTiming1->Fill(temp[1]); hToT1->Fill(temp[3]); } } in1.close(); TCanvas* cTiming = new TCanvas("cTiming", "cTiming", 800, 600); TGraph* hTiming1 = new TGraph(counter, &time[0], &count[0]); hTiming1->SetTitle(""); hTiming1->GetXaxis()->SetTitle("time"); hTiming1->GetXaxis()->CenterTitle(); hTiming1->GetXaxis()->SetTitleOffset(1.2); hTiming1->GetYaxis()->SetTitle("count"); hTiming1->GetYaxis()->CenterTitle(); hTiming1->GetYaxis()->SetTitleOffset(1.2); hTiming1->SetLineColor(kBlack); hTiming1->SetLineWidth(1); hTiming1->Draw("AL"); cTiming->SaveAs("../../../../figs/timing-run915-frame10.png"); TCanvas* cToT = new TCanvas("cToT", "cToT", 800, 600); hToT1->SetTitle(""); hToT1->GetXaxis()->SetTitle("time [ns]"); hToT1->GetXaxis()->CenterTitle(); hToT1->GetXaxis()->SetTitleOffset(1.2); hToT1->SetLineColor(kBlack); hToT1->SetLineWidth(1); hToT1->Draw(); cToT->SaveAs("../../../../figs/tot-run915-frame10.png"); cout << "time: " << watch.CpuTime() << " s" << endl; }