Re: [ROOT] TTree Draw , missing axis label

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Aug 11 2003 - 10:48:49 MEST


Hi Stefan,

I cannot reproduce this problem.

see:

http://root.cern.ch/root/roottalk/RoottalkRules.html

Rene Brun

Stefan Funk wrote:
> 
> Hello All,
> I would like to draw one thing against another from an ascii file.
> Therefore I wrote a little script that is included below.
> My problem is, that the TTree->Draw() does not label the axes and I have
> no idea how to label them (not the title but the numbers).
> 
> Thanks for your help
> 
> Stefan
> 
> #include <iostream>
> #include <fstream>
> #include <sstream>
> #include <vector>
> #include "Riostream.h"
> #include <TFile.h>
> #include <TH1F.h>
> #include <TNtuple.h>
> 
> void reading(char infile[], Int_t nvals,
>             char draw[]="x[0]:x[1]", char selection[]=""){
> 
>    // infile: ascii file to analyse
>    // nvals: Number of columns in the file
>    // draw:  Draw option for TTree->Draw()
>    // selection: selection criterion for that
> 
>    std::ifstream in;
>    in.open(infile);
> 
>    Float_t* x = new Float_t[nvals];
>    Int_t nlines = 0;
> 
>    std::ostringstream o;
>    o << "\"x[" << nvals << "]\"";
> 
>    TTree *tree = new TTree("tree","data from file");
>    tree->Branch("x", x, o.str().c_str());
> 
>    while (1) {
>      for(int i = 0; i < nvals; ++i )
>        in >> x[i];
> 
>       if (!in.good()) break;
>       tree->Fill();
>       nlines++;
>    }
>    printf(" found %d points\n",nlines);
> 
>    in.close();
>    tree->Draw(draw, selection, "hist", nlines, 0);
> 
> }



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