Re: [ROOT] TH1I

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Sep 08 2003 - 14:26:29 MEST


Ed,

The problem has nothing to do with TH1I, but with an incomplete declaration
of vector. Choose one of the two solutions:

//solution1
===========
#include <TROOT.h>
#include <TH1.h>
#include <vector>
using namespace std;

class Analysis {
private:
vector<TH1S*>* m_particleLevelsHist;
};

solution2
=========
#include <TROOT.h>
#include <TH1.h>
#include <vector>

class Analysis {
private:
std::vector<TH1S*>* m_particleLevelsHist;
};

Rene Brun

Edward Moyse wrote:
> 
> Okay. If you compile the following very, very simple example with :
> g++ -c -fPIC `root-config --cflags` test.cxx
> then it works.
> 
> Change:
> vector<TH1S*>* m_particleLevelsHist;
> to:
> vector<TH1I*>* m_particleLevelsHist;
> 
> then it doesn't and I get:
> test.cxx:8: `TH1I' was not declared in this scope
> test.cxx:8: parse error before `>'
> 
> ---------------------------------------- test.cxx
> #include <TROOT.h>
> #include <TH1.h>
> #include <vector>
> 
> class Analysis {
> private:
> vector<TH1S*>* m_particleLevelsHist;
> };
> 
> On Monday 08 September 2003 1:38 pm, Rene Brun wrote:
> > Ed,
> >
> > TH1I is defined in TH1.h. I do not see any problems with your example.
> >
> > Send a short script reproducing the problem.
> >
> > Rene Brun
> >
> > Edward Moyse wrote:
> > > Hi,
> > >
> > > Can anyone explain why:
> > >
> > > #include <TH1.h>
> > > vector<TH1S*>* m_particleLevelsHist;
> > >
> > > works, but
> > > #include <TH1.h>
> > > vector<TH1I*>* m_particleLevelsHist;
> > > gives:
> > >
> > > In file included from Analysis.C:1:
> > > Analysis.h:70: `TH1I' was not declared in this scope
> > >
> > > I'd guess that TH1Is aren't supported somehow., especially since there's
> > > a TH1F header which just points to TH1.h, but there's no TH1I.h header
> > > doing the same thing.
> > >
> > > % ls $ROOTSYS/include/TH1*
> > > /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/include/TH1.h
> > > /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/include/TH1C.h
> > > /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/include/TH1D.h
> > > /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/include/TH1F.h
> > > /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/include/TH1K.h
> > > /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root/include/TH1S.h
> > >
> > > But this page:
> > > http://root.cern.ch/root/html/TH1I.html
> > > definitely lists TH1Is as an available type of histogram.
> > >
> > > Cheers,
> > >
> > > Ed



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