--- UserCode/IPHCalignment2/analysis/Layout.cpp 2011/11/28 13:18:09 1.3 +++ UserCode/IPHCalignment2/analysis/Layout.cpp 2011/11/28 16:14:23 1.5 @@ -5,7 +5,7 @@ void Layout::DrawInit() { - /* gStyle->SetCanvasColor(0); + gStyle->SetCanvasColor(0); gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasBorderSize(3); @@ -70,13 +70,13 @@ void Layout::DrawInit() Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 }; TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont); gStyle->SetNumberContours(NCont); - */ + } void Layout::Draw(const std::vector& histos, - const std::string& xlabel, float K, float MU, float SIG) + const std::string& xlabel, bool fit, float K, float MU, float SIG) { std::cout << "----------------- Draw : " << histos[0].histo->GetName() << std::endl; @@ -91,7 +91,6 @@ void Layout::Draw(const std::vectorSetLineColor( histos[i].linecolor ); } @@ -110,7 +109,7 @@ void Layout::Draw(const std::vectorGetXaxis()->GetXmin(); // Draw legend - TLegend* mylegend = new TLegend(0.17,0.85-(0.04*histos.size()),0.33,0.85); + TLegend* mylegend = new TLegend(0.40,0.85-(0.04*histos.size()),0.90,0.85); mylegend->SetFillColor(0); for (unsigned int i=0;iDraw(); - std::cout << "size = " << mylegend->GetTextSize() << std::endl; - std::cout << "font = " << mylegend->GetTextFont() << std::endl; - - std::cout << mylegend->GetX1() << " " << mylegend->GetX2() << std::endl; - std::cout << mylegend->GetY1() << " " << mylegend->GetY2() << std::endl; - - TPaveText* toto = new TPaveText(0.17,0.72,0.43,0.83); - toto->SetFillColor(2); - toto->SetTextFont(2); - toto->SetTextSize(0); - toto->AddText("toto"); - toto->Draw(); - // To Fit - std::vector sigmas; - for (unsigned int i=0;iSetParameter(0,K); - fitter->SetParameter(1,MU); - fitter->SetParameter(2,SIG); - histos[i].histo->Fit(fitter,"0"); - sigmas.push_back(fitter->GetParameter(2)); - } - // Display sigmas - for (unsigned int i=0;iGetWNDC() << std::endl; + // To Fit + std::vector sigmas; + std::vector errors; + for (unsigned int i=0;iSetParameter(0,K); + fitter->SetParameter(1,MU); + fitter->SetParameter(2,SIG); + histos[i].histo->Fit(fitter,"0"); + sigmas.push_back(fitter->GetParameter(2)); + errors.push_back(fitter->GetParError(2)); + } + + // Display sigmas + TPaveText* myblock = new TPaveText(0.65,0.65-(0.04*histos.size()),0.90,0.65,"NDC"); + myblock->SetBorderSize(0); + myblock->SetFillColor(0); + for (unsigned int i=0;iAddText(str.str().c_str()); + mytext->SetTextColor(histos[i].linecolor); + mytext->SetTextAlign(11); + } + myblock->Draw(); } // Save