ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HSCPValidation/scripts/MakeL1.C
Revision: 1.3
Committed: Thu Feb 4 14:55:48 2010 UTC (15 years, 3 months ago) by carrillo
Content type: text/plain
Branch: MAIN
CVS Tags: for_CMSSW_3_4_2, HEAD
Changes since 1.2: +1 -1 lines
Log Message:
updating make L1 Plots

File Contents

# User Rev Content
1 carrillo 1.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 carrillo 1.3 histo->SetLabelSize(0.02);
41 carrillo 1.2 histo->GetYaxis()->SetTitle("Efficiency(%)");
42 carrillo 1.1 Ca0->SaveAs((name+".png").c_str());
43    
44     exit(0);
45     }