ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/auterman/SusyScan/PlotScript/plot.cc
Revision: 1.1
Committed: Tue Nov 23 20:16:52 2010 UTC (14 years, 5 months ago) by auterman
Content type: text/plain
Branch: MAIN
Log Message:
adding new functionality

File Contents

# User Rev Content
1 auterman 1.1 #include "plot.h"
2     #include "SusyScan.h"
3    
4     #include "TRint.h"
5     #include "TROOT.h"
6     #include "TObjArray.h"
7     #include "TStyle.h"
8    
9     #include "TChain.h"
10     #include "TFile.h"
11     #include "TH1.h"
12     #include "TH2.h"
13     #include "TH2F.h"
14     #include "TTree.h"
15     #include "TKey.h"
16     #include "Riostream.h"
17     #include "TCanvas.h"
18    
19     #include <string>
20    
21     double Mzero(const SusyScan* p){ return p->Mzero; }
22     double Mhalf(const SusyScan* p){ return p->Mhalf; }
23     double Xsection(const SusyScan* p){ return p->Xsection; }
24    
25     void TheLimits::plot(TH2*h, double(*x)(const SusyScan*), double(*y)(const SusyScan*), double(*f)(const SusyScan*) )
26     {
27     for (std::vector<SusyScan*>::const_iterator it=_scan.begin();it!=_scan.end();++it )
28     h->Fill( x(*it), y(*it), f(*it) );
29     }
30    
31     int plot(int argc, char** argv)
32     {
33     gStyle->SetHistFillColor(0);
34     gStyle->SetPalette(1);
35     //gStyle->SetFillColor(0);
36     //gStyle->SetOptStat(kFALSE);
37     gStyle->SetCanvasColor(0);
38     gStyle->SetCanvasBorderMode(0);
39     gStyle->SetPadColor(0);
40     gStyle->SetPadBorderMode(0);
41     gStyle->SetFrameBorderMode(0);
42    
43     gStyle->SetTitleFillColor(0);
44     gStyle->SetTitleBorderSize(0);
45     gStyle->SetTitleX(0.10);
46     gStyle->SetTitleY(0.98);
47     gStyle->SetTitleW(0.8);
48     gStyle->SetTitleH(0.06);
49    
50     gStyle->SetErrorX(0);
51     gStyle->SetStatColor(0);
52     gStyle->SetStatBorderSize(0);
53     gStyle->SetStatX(0);
54     gStyle->SetStatY(0);
55     gStyle->SetStatW(0);
56     gStyle->SetStatH(0);
57    
58     gStyle->SetTitleFont(22);
59     gStyle->SetLabelFont(22,"X");
60     gStyle->SetLabelFont(22,"Y");
61     gStyle->SetLabelFont(22,"Z");
62     gStyle->SetLabelSize(0.03,"X");
63     gStyle->SetLabelSize(0.03,"Y");
64     gStyle->SetLabelSize(0.03,"Z");
65    
66     //gROOT->SetStyle("MyStyle");
67     TCanvas * c1 = new TCanvas("c1","c1",600,600);
68     c1->SetFillStyle ( 4000 );
69     c1->SetLeftMargin ( 0.15 );
70     c1->SetRightMargin ( 0.15 );
71     c1->SetBottomMargin( 0.10 );
72     c1->cd();
73    
74     TheLimits * doIt = new TheLimits();
75     for (int i = 1; i<argc; ++i)
76     {
77     doIt->add( new SusyScan(argv[i]) );
78     }
79     //std::cout << "Read "<<scan->size()<<" points."<<std::endl;
80     //TRint *theApp = new TRint("ROOT example", &argc, argv);
81     //theApp->Run();
82     TApplication * theApp = new TApplication("App", &argc, argv);
83    
84     TH2F*h = new TH2F("xsec","mSUGRA,m_0 [GeV]; m_{1/2} [GeV]",
85     100,0,2000,100,0,2000);
86    
87     doIt->plot(h, Mzero, Mhalf, Xsection);
88     h->Draw("colz");
89     //c1->Draw();
90     c1->SaveAs("plot.pdf");
91     std::cout<<"Drawn!!"<<std::endl;
92    
93     gApplication->Run();
94     }
95    
96    
97     int main(int argc, char** argv)
98     {
99     // TRint *theApp = new TRint("ROOT example", &argc, argv);
100    
101     return plot(argc, argv);
102     }