1 #ifndef __JROOT__JLEGEND__ 
    2 #define __JROOT__JLEGEND__ 
   16 namespace JPP { 
using namespace JROOT; }
 
   31                             const std::string option,
 
   32                             const Double_t    factor = 1.0)
 
   38     const Double_t X1  = 0.0 + gPad->GetLeftMargin();
 
   39     const Double_t X2  = 1.0 - gPad->GetRightMargin();
 
   40     const Double_t Y1  = 0.0 + gPad->GetBottomMargin();
 
   41     const Double_t Y2  = 1.0 - gPad->GetTopMargin();
 
   42     const Double_t 
w   = gPad->XtoPixel(gPad->GetX2()) * (X2 - X1) / 1.0;
 
   43     const Double_t h   = gPad->YtoPixel(gPad->GetY1()) * (Y2 - Y1) / 1.0;
 
   44     const Double_t ch  = gStyle->GetStatFontSize() * (
w < h ? 
w : h);
 
   46     const Double_t fx  = 1.00 * factor * ch/
w;   
 
   47     const Double_t fy  = 1.00 * factor * ch/h;   
 
   48     const Double_t eps = 0.005;                  
 
   57     Double_t W  =  (wd)      * fx;               
 
   58     Double_t 
H  =  (height)  * fy;               
 
   62     if (fc * W > X2 - X1 - 2*eps) {
 
   63       fc *= (X2 - X1 - 2*eps) / W;
 
   66     if (fc * 
H > Y2 - Y1 - 2*eps) {
 
   67       fc *= (Y2 - Y1 - 2*eps) / 
H;
 
   75     Double_t x1  = X2 - W - eps;
 
   76     Double_t y1  = Y2 - 
H - eps;
 
   77     Double_t x2  = X2     - eps;
 
   78     Double_t y2  = Y2     - eps;
 
   83     if (option.find(
'T') != string::npos && option.find(
'B') == string::npos) {   
 
   91     if (option.find(
'B') != string::npos && option.find(
'T') == string::npos) {   
 
   99     if (option.find(
'R') != string::npos && option.find(
'L') == string::npos) {   
 
  107     if (option.find(
'L') != string::npos && option.find(
'R') == string::npos) {   
 
  115     TLegend* lg = 
new TLegend(x1, y1, x2, y2);
 
  118     lg->SetFillColor(kWhite);
 
  119     lg->SetBorderSize(0);
 
  120     lg->SetTextAlign(halign*10 + valign);
 
  121     lg->SetTextFont(gStyle->GetStatFont());
 
  122     lg->SetTextSize(gStyle->GetStatFontSize() * factor);
 
  123     lg->SetMargin((Double_t) nc / (Double_t) (wd + nc));
 
static const double H
Planck constant [eV s]. 
 
TLegend * getLegend(const Int_t width, const Int_t height, const std::string option, const Double_t factor=1.0)
Get legend.