[ROOT] PS file on B/W printer and other headaches

From: Dmitry Litvintsev (litvinse@fnal.gov)
Date: Thu Aug 21 2003 - 01:20:21 MEST


Dear ROOTers,

I have run in several problems:

1) Colors on B/W prints. If I print a color PS file of a canvas on a
B/W  printer, then even the
     primary colors come out dithered (as opposed to grey-scale). This
makes B/W prints
     of pictures of rather poor quality.  This naturally leads to
necessity to keep two versions of
     pictures around (one colored for slide presentation and one for the
paper). Note that PAW color
     prints  were grey scaled at least for primary colors (r,g,b,y,m,c).
Could that be fixed?

2) I have some problems with OptFit and OptStat, let me try to describe
the problem:

      - thise is what I have in rootlogon.C:

        gROOT->SetStyle("Plain");
        gStyle->SetFrameLineWidth(3);
        gStyle->SetTitleOffset(1.3,"X");
        gStyle->SetPadBottomMargin(0.15);
        gStyle->SetPadTickX(1);
        gStyle->SetPadTickY(1);
        gStyle->SetHistLineWidth(2);
        gStyle->SetFuncWidth(2);
        gStyle->SetStatFormat("6.4f");
        gStyle->SetFitFormat("6.4f");
        gStyle->SetTitleX(gStyle->GetPadLeftMargin());
        gStyle->SetTitleY(1.-0.25*gStyle->GetPadTopMargin());
        gSystem->Load("libDCache.so");  // thi is needed to access files
in dCache
        gSystem->Load("libPhysics.so");  // this is needed to use
TVector
        gROOT->LoadMacro("fit.C");       //  this is my fit functions
collection
        gROOT->LoadMacro("add.C");    // this one addes/subtracts
histograms  right

gROOT->GetPluginManager()->AddHandler("TFile","^dcache:","TDCacheFile","DCache","TDCacheFile(const
char*)");

gROOT->GetPluginManager()->AddHandler("TFile","^dcap:","TDCacheFile","DCache","TDCacheFile(const
char*)");

    -  If I plot a histogram, there is a "stat box" superimposed
        If I fit this histogram, the FitBox does not show, so I do
gStyle->SetOptFit(111), As the result of this command I see
        a box filled with tiny text. Well, I think it is due to OptStat,
so I do gStyle->SetOptStat(0); pictures changes a little bit, but
        still looks strange, then if I point cursor to the "TPaveStats"
and explicitly delete it, only then the Fit Status pave looks right
        to me.

    - now, if _before _  plotting/itting  any histograms I say

            gStyle->SetOptStat(0);
            gStyle->SetOptFit(111);

        and then proceed fitting the histogram, then the Fit Status box
looks _right_ .

    - Also,  if I plot histogram first and then say
'gStyle->SetOptStat(0)', the PaveStat does not dissappear. Instead it
goes overlayed
       by the histogram frame.

    - In addition , the function plotted after fit behaves kind of
flaky. It may jump all around after
        identical sequence of calls, like these for example:

          h->Fit("gp","QMR");
          h->Fit("gp","QMR");
          fitFun->SetParLimits(0,0,1000000);
          fitFun->SetParLimits(3,2.0,3.);
          h->Fit("gp","QMR");
          h->Fit("gp","QMR");
          fitFun->SetParLimits(2,0.0001,0.030);
          h->Fit("gp","EMQR");

    I may run these commands, get a fit done, obtain reasonable
paramaters but the function plotted
    has very little to do with the distribution fitted. I would repeat
last command a couple of times and
    the function would finally be plotted correctly (note, that fit
parameters would not change). This one
    drives me nuts :(  Sometimes just redrawing the histogram causes the
fit function to jump.
    (I plot several histograms using the same function, could that be
the cause of the problem). This is my fit
     function:

#include "TH1.h"
#include "TF1.h"

void fitter1(TH1* h,double hLow=-1, double hHigh=-1, double
mass=2.6,double sigma=0.020) {

  double hig = ( hHigh > 0 ) ? hHigh : h->GetXaxis()->GetXmax();
  double low = ( hLow > 0  ) ? hLow  : h->GetXaxis()->GetXmin();
  double bw  = h->GetBinWidth(0);

  TF1* fitFun = new TF1("gp",gp1,low,hig,6);

  fitFun->SetLineWidth(2);
  fitFun->SetLineColor(4);


  fitFun->SetParameter(0,0);
  fitFun->SetParameter(1,bw);
  fitFun->SetParameter(2,sigma);
  fitFun->SetParameter(3,mass);
  fitFun->SetParameter(4,0);
  fitFun->SetParameter(5,0);

  fitFun->SetRange(low,hig);

  fitFun->SetParLimits(0,1,1);
  fitFun->SetParLimits(1,1,1);
  fitFun->SetParLimits(2,1,1);
  fitFun->SetParLimits(3,1,1);

  fitFun->SetParName(0,"Entries");
  fitFun->SetParName(1,"binwidth");
  fitFun->SetParName(2,"sigma ");
  fitFun->SetParName(3,"Mass ");

  h->Fit("gp","QMR");
  h->Fit("gp","QMR");
  fitFun->SetParLimits(0,0,1000000);
  fitFun->SetParLimits(3,2.0,3.);
  h->Fit("gp","QMR");
  h->Fit("gp","QMR");
  fitFun->SetParLimits(2,0.0001,0.030);
  h->Fit("gp","EMQR");
  h->Fit("gp","EMQR");
  h->Fit("gp","EMQR");
}

I use it like this:

    .L fitter1.C
    fitter1(h);

is that the 'new' that never gets deleted that is causing such problems?

  All of the above is rather annoying. This is the ROOT version I am
using:
  v3_05_04dKCC_4_0

   Does anybody have similar experience, is there something  I am doing
wrong, and if not can that be fixed?

   thanks,

Dmitri Litvintsev

/----------------------------------------------------------\
| Tel:       (630) 840 5005                                |
| FAX:       (630) 840 2968                                |
| office:    149-L CDF Trailers                            |
| E-mail:    litvinse@fnal.gov                             |
\----------------------------------------------------------/



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET