ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HSCPValidation/scripts/MakeL1.C
Revision: 1.1
Committed: Fri Jan 29 08:50:04 2010 UTC (15 years, 3 months ago) by carrillo
Content type: text/plain
Branch: MAIN
Log Message:
First release

File Contents

# Content
1 #include "Riostream.h"
2 #include <fstream>
3 #include <iomanip>
4 #include <vector>
5 #include <string>
6
7 void MakeL1(){
8 gROOT->Reset();
9 gStyle->SetOptStat(0);
10
11 ifstream data;
12
13 float value;
14
15 string name = "L1"; //name withtout .txt
16
17 data.open((name+".txt").c_str());
18 string label;
19 float eff;
20 float err;
21
22 TH1F * histo = new TH1F("histo",name.c_str(),67,0.5,67.5);
23 int bin = 0;
24
25 while(!data.eof() && bin<67){
26 bin++;
27 data >>label>>eff>>err;
28 cout<<label<<" "<<eff<<" "<<err<<endl;
29 histo->GetXaxis()->SetBinLabel(bin,label.c_str());
30 histo->SetBinContent(bin,eff);
31 histo->SetBinError(bin,err);
32 }
33
34 TCanvas * Ca0 = new TCanvas("Ca0","Canvas",1200,800);
35 Ca0->SetBottomMargin(0.4);
36 histo->Draw();
37 histo->SetMaximum(100.);
38 histo->SetMinimum(0.);
39 histo->GetXaxis()->LabelsOption("v");
40 histo->SetLabelSize(0.03);
41 Ca0->SaveAs((name+".png").c_str());
42
43 exit(0);
44 }