RE: text-to-histogram tool?

From: Linev Sergei <S.Linev_at_gsi.de>
Date: Mon, 18 Jun 2007 11:31:13 +0200


Hi, Gero

One more comment about XML I/O.
You can convert your object directly to the xml string without overhead of TFile structures. In this case code will look like:

 {

    TH1F *h = new TH1F("h","test",100,-3,3);     h->FillRandom("gaus",1000);     

    TString sbuf = TBufferXML::ConvertToXML(h);

    cout << sbuf << endl;
}

If you produce xml string with same format, later you can reconstruct object by:

{

   TString sbuf;
   // get your xml string from text file

   TObject* obj = TBufferXML::ConvertFromXML(sbuf); }

Regards,
Sergey

> -----Original Message-----
> From: owner-roottalk_at_pcroot.cern.ch
> [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Rene Brun
> Sent: Montag, 18. Juni 2007 10:16
> To: Gero Flucke
> Cc: ROOT talk
> Subject: Re: [ROOT] text-to-histogram tool?
>
>
> Hi Gero,
>
> If you are an XML fan, you can use the ROOT I/O XML driver.
> To see how
> it works,
> run for instance the small script below
> {
> TFile *f = TFile::Open("gero.xml","recreate");
> TH1F *h = new TH1F("h","test",100,-3,3);
> h->FillRandom("gaus",1000);
> h->Write();
> delete f;
> }
>
> You can read it gero.xml in ROOT with
> TFile *f = TFile::Open("gero.xml");
> h->Draw();
>
> If you are not interested by the automatic schema evolution,
> you do not
> need to generate
> the <StreamerInfos> block at the end of the file.
>
> Rene Brun
>
> Gero Flucke wrote:
> > Hi all,
> > does ROOT (or something/-one else) provide a tool that can read in a
> > (specially formated) text file and convert it into one (or
> better several)
> > histograms with title, axis labels, axis titles etc.?
> > I need something like that for a standalone program that
> outputs some
> > monitoring histogram information, but must not link to ROOT
> or something
> > else, but I have control over the format of the text
> output. Easiest would
> > be some xml-like syntax...
> >
> > Thanks for help
> >
> > Gero Flucke
> >
> > --
> >
> --------------------------------------------------------------
> ---------
> > Gero Flucke office: DESY, Bldg. 67b, room 24
> > Inst. f. Experimentalphysik fon: +49 (0)40 8998 4743
> > Universitaet Hamburg fax: +49 (0)40 8998 2959
> > Luruper Chaussee 149 at CERN: Bldg. 32 office 3-B20
> > 22761 Hamburg fon: +41 (0)22 76-77557
> > Germany
> >
> > --
> > A: Because it messes up the order in which people normally
> read text.
> > Q: Why is it such a bad thing?
> > A: Top-posting.
> > Q: What is the most annoying thing on usenet and in e-mail?
> >
>
>
Received on Mon Jun 18 2007 - 11:31:23 CEST

This archive was generated by hypermail 2.2.0 : Mon Jun 18 2007 - 23:50:02 CEST