ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/IPHCalignment2/analysis/Layout.cpp
(Generate patch)

Comparing UserCode/IPHCalignment2/analysis/Layout.cpp (file contents):
Revision 1.3 by econte, Mon Nov 28 13:18:09 2011 UTC vs.
Revision 1.4 by econte, Mon Nov 28 13:43:44 2011 UTC

# Line 5 | Line 5
5  
6   void Layout::DrawInit()
7   {
8 <  /*  gStyle->SetCanvasColor(0);
8 >  gStyle->SetCanvasColor(0);
9    gStyle->SetCanvasBorderMode(0);
10    gStyle->SetCanvasBorderSize(3);
11  
# Line 70 | Line 70 | void Layout::DrawInit()
70    Double_t blue[NRGBs]  = { 0.51, 1.00, 0.12, 0.00, 0.00 };
71    TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
72    gStyle->SetNumberContours(NCont);
73 <  */
73 >
74  
75   }
76  
# Line 91 | Line 91 | void Layout::Draw(const std::vector<Hist
91    // SetLineColor
92    for (unsigned int i=0;i<histos.size();i++)
93    {
94    std::cout << "TEST : " << histos[i].linecolor << std::endl;
94      histos[i].histo->SetLineColor( histos[i].linecolor );
95    }
96  
# Line 118 | Line 117 | void Layout::Draw(const std::vector<Hist
117                         histos[i].algoName.c_str(),"l");
118    }
119    mylegend->Draw();
121  std::cout << "size = " << mylegend->GetTextSize() << std::endl;
122  std::cout << "font = " << mylegend->GetTextFont() << std::endl;
123
124  std::cout << mylegend->GetX1() << " " << mylegend->GetX2() << std::endl;
125  std::cout << mylegend->GetY1() << " " << mylegend->GetY2() << std::endl;
126
127  TPaveText* toto = new TPaveText(0.17,0.72,0.43,0.83);
128  toto->SetFillColor(2);
129  toto->SetTextFont(2);
130  toto->SetTextSize(0);
131  toto->AddText("toto");
132  toto->Draw();
120  
121    // To Fit
122    std::vector<double> sigmas;
123 +  std::vector<double> errors;
124    for (unsigned int i=0;i<histos.size();i++)
125    {
126      TF1* fitter = new TF1(dummy().c_str(),"gaus",xmin,xmax);
# Line 141 | Line 129 | void Layout::Draw(const std::vector<Hist
129      fitter->SetParameter(2,SIG);
130      histos[i].histo->Fit(fitter,"0");
131      sigmas.push_back(fitter->GetParameter(2));
132 +    errors.push_back(fitter->GetParError(2));
133    }
134  
135    // Display sigmas
136 +  TPaveText* myblock = new TPaveText(0.6,0.65-(0.04*histos.size()),0.80,0.65,"NDC");
137 +  myblock->SetBorderSize(0);
138 +  myblock->SetFillColor(0);
139    for (unsigned int i=0;i<sigmas.size();i++)
140    {
141      std::stringstream str;
142      str << "#sigma_{RECO} = ";
143 <    str << sigmas[i];
144 <    TLatex mytext(56,200,str.str().c_str());
145 <    std::cout << mycanvas->GetXlowNDC() << " " << mycanvas->GetWNDC() << std::endl;
143 >    str.precision(3); str << sigmas[i];
144 >    str << " #pm ";
145 >    str.precision(3); str << errors[i];
146 >    TText* mytext = myblock->AddText(str.str().c_str());
147 >    mytext->SetTextColor(histos[i].linecolor);
148 >    mytext->SetTextAlign(11);
149    }
150 +  myblock->Draw();
151  
152    // Save
153    std::string filename = GetFileName(histos[0].histo->GetTitle());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines