Slow histogram drawing with option "PE" with rootlogon.C

I am drawing (many) fitted histograms with many points (over 5000 points). One thing I encountered is that it takes long time to draw the histograms with option “PE” but not “HIST”.
This happens only if I put ROOT.gROOT.Macro("rootlogon.C") .

Am I lefting out something in the rootlogon.C so it lead to this kind of situation ?

the rootlogon.C contents are as below:

{
 // Definition of new styles
 TStyle *MyStyle      = new TStyle("MyStyle","MyStyle");
 TStyle *MyStyle_work = new TStyle("MyStyle_Work","MyStyle_work");

 // Set the default parameters for style MyStyle
 MyStyle->SetCanvasBorderMode(0);     // Removes Canvas Border
 MyStyle->SetPadBorderMode(0);        // Removes Pad Border
 MyStyle->SetCanvasColor(0);          // Changes Canvas color to white
 MyStyle->SetPadColor(0);             // Changes Pad color to white
 MyStyle->SetStatColor(0);            // Changes Stats bg color to white
 MyStyle->SetTitleFillColor(0);       // Changes Title bg color to white

 MyStyle->SetFrameLineWidth(2);       // make frame pop 
 MyStyle->SetLabelSize(0.04,"xyz");   // increase size for redability
 MyStyle->SetTitleSize(0.04,"xyz");   // "
 MyStyle->SetLabelFont(62,"xyz");     // helvetica bold for redability
 MyStyle->SetTitleFont(62,"xyz");     // "

 MyStyle->SetPadTickX(1);             // Sets tic marks on both horizontal axes
 MyStyle->SetPadTickY(1);             // Sets tic marks on both vertical axes
 MyStyle->SetTickLength(0.02,"xyz"); // Sets tic length
 MyStyle->SetOptStat(0);              // Turns off Statistics display
 MyStyle->SetOptTitle(0);             // Turns off Title display
 MyStyle->SetHistLineWidth(2);        // Changes Histogram Line width
 MyStyle->SetFrameBorderMode(0);      // Removes the Frame Border
 MyStyle->SetFrameFillStyle(0);
 MyStyle->SetCanvasDefH(600);         // Sets Default Canva Height
 MyStyle->SetCanvasDefW(900);         // Sets Default Canvas Width
 MyStyle->SetPalette(1);

 // The next for commands set the default margin size
 // n.b. the margins do not take axis labels into account! grr!!
 MyStyle->SetPadTopMargin(0.1);     // Set Margin Top
 MyStyle->SetPadRightMargin(0.1);   // Set Margin Right
 MyStyle->SetPadBottomMargin(0.1);    // Set Margin Bottom
 MyStyle->SetPadLeftMargin(0.1);     // Set Margin Left

 //make a nice palette
 int NRGBs = 7, NCont = 999;
 MyStyle->SetNumberContours(NCont);
 Double_t stops[7] = { 0.00, 0.10, 0.25, 0.45, 0.60, 0.75, 1.00 };
 Double_t red[7]   = { 1.00, 0.00, 0.00, 0.00, 0.97, 0.97, 0.10 };
 Double_t green[7] = { 1.00, 0.97, 0.30, 0.40, 0.97, 0.00, 0.00 };
 Double_t blue[7]  = { 1.00, 0.97, 0.97, 0.00, 0.00, 0.00, 0.00 };
 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);

 // Make MyStyle_work a copy of MyStyle and remove stats
 MyStyle->Copy(*MyStyle_work);
 MyStyle_work->SetOptStat(1);
 MyStyle_work->SetOptTitle(1);
 // MyStyle_work->SetPadTopMargin(0.1);
 // MyStyle_work->SetPadRightMargin(0.1);

 MyStyle_work->SetMarkerStyle(20);
 MyStyle_work->SetTitleOffset(1,"xyz"); 

 // Select Which style to use 
  gROOT->SetStyle("MyStyle_Work");
 // gROOT->SetStyle("MyStyle");


 // Use the RooFit functions
 // using namespace RooFit;

 // Force Root to run MyStyle/MyStyle_Work style
 gROOT->ForceStyle();

}

update: I tried to add My_Style->SetMarkerSize(0); in the rootlogon.C and it seems to be drawing faster.


_ROOT Version:6.26.00 (conda-forge)
_Platform:ubuntu 20.04 (wsl)
_Compiler:gcc


Try with “E”. “P” is useless if you do not change the marker style. The default is a dot and you will not see it if you draw also the errors bar (option “E”).

still taking long time …

You said that without rootlogon.C it is fast. Can you identify which line in rootlogon.C makes it slow ? looking at it I do not see anything obvious. Except may be the line width. X11 (the graphics backend used on Ubuntu) is known to be slow when drawing lines with a line width > 1.

setting line width at 1 did not make it faster … get the TStyle and setmarkersize doesnt work. so far i have no idea on where the issue is comming from. So my temporary workaround is to histo.SetMarkerSize(0) before drawing

If you provide me your hitogram and your rootlogon.C I can have a look

try

 MyStyle_work->SetMarkerStyle(1);

outputfile.root (2.0 MB)

I see a small slow down with rootlogon.C. Using:

 MyStyle_work->SetMarkerStyle(1);

makes it faster. Whihc is normal because circle markers takes longer tro draw than dot.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.