When I try to use the new TimageDump functionality to output a
graphic file while in root batch mode, I get a problem where the
scatter plot central dots do not appear in the output. Below is
the macro I am using to print the TCanvas to a png file – am I
doing anything wrong? To see the files referenced, go to:
www-cdf.fnal.gov/~badgett/daqmon/
[code]#include “TFile.h”
#include “TKey.h”
#include “TCanvas.h”
#include “TImageDump.h”
void daqmon()
{
TFile *file = new TFile(“daqmon.root”,“READ”);
if ( file->IsOpen())
{
TKey *key = file->FindKeyAny("(S19) Timing info;1");
if ( key != NULL )
{
TCanvas *canvas = (TCanvas *)key->ReadObj();
if ( canvas != NULL )
{
canvas->Draw();
TImageDump *dump = new TImageDump(“daqmon.png”,111);
canvas->Paint();
dump->Close();
}
}
file->Close();
}
}[/code]
[/url]
Forgot to point out: I am using root v5_12_00e, and have also
tried v5_13_02, with the same effect.
couet
October 10, 2006, 3:33pm
3
I get:
root [0] TFile *file = new TFile("daqmon.root");
Error in <TFile::Init>: daqmon.root not a ROOT file
root [1]
may be put all lthe 3 files in a tar.gz file …
Perhaps it got corrupted in the file transfer. Try it at:
/afs/cern.ch/user/b/badgett/public/html/daqmon/daqmon.root
instead…
Sorry, the daqmon.root file located at the link:
www-cdf.fnal.gov/~badgett/daqmon/
was accidentally read protected; i have fixed this now & also
it is attached to this reply.
daqmon.root (18.8 KB)
couet
October 11, 2006, 11:34am
6
why don’t you do:
void daqmon()
{
TFile *file = new TFile("daqmon.root","READ");
if ( file->IsOpen())
{
TKey *key = file->FindKeyAny("(S19) Timing info;1");
if ( key != NULL )
{
TCanvas *canvas = (TCanvas *)key->ReadObj();
if ( canvas != NULL )
{
canvas->Draw();
}
}
file->Close();
}
canvas->Print("daqmon.gif");
}
That method works fine in interactive mode, but not in batch
mode:
root -b -q daqmon.cc
OK. I see and investigating
I see the same problem using version v5_13_04
couet
October 12, 2006, 9:45am
10
Yes, this problem is present in the CVS head.
Hi,
I fixed all problems, must be in CVS soon.
Many thanks.
Regards. Valeriy
++
btw, we introduced possibility to generate animated gifs in batch mode.
I think it would be very usefull for such kind of tasks like detector monitoring
and simulation.
Hi,
small inconsistencies still exist.
Compare pictures made in gui and batch mode:
size of dashes of lines
size of circle markers
sizes of images are different
sizes of boxes of pave texts
Not critical and will be elliminated step-by-step.
More thanks for reporting this.
Regards. Valeriy