ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HFmon2012/macros/parseText.C
Revision: 1.1
Committed: Mon Aug 13 14:57:42 2012 UTC (12 years, 8 months ago) by yilmaz
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
update analysis

File Contents

# User Rev Content
1 yilmaz 1.1 #include <fstream>
2     #include <iostream>
3     #include <sstream>
4     #include "TGraphErrors.h"
5     #include "TFile.h"
6    
7     using namespace std;
8    
9    
10    
11     void parseText(const char* inname = "newraddam180633.txt"){
12    
13     double x[100];
14     double ex[100];
15    
16     double y1[100];
17     double e1[100];
18     double y2[100];
19     double e2[100];
20    
21     int i = 0;
22    
23     std::ifstream inputText(inname);
24     std::string line;
25     while( std::getline( inputText, line)){
26     std::istringstream linestream(line);
27     linestream>>x[i]>>y1[i]>>e1[i]>>y2[i]>>e2[i];
28    
29     ex[i] = 0;
30     i++;
31     }
32    
33     TFile* outf = new TFile("nothing.root","recreate");
34     TGraphErrors* g = new TGraphErrors(i,x,y2,ex,e2);
35    
36     g->SetMarkerStyle(20);
37     g->Draw("Ap");
38     g->SetName("g2");
39     g->Write();
40    
41     }
42