Re: [ROOT] Ntuples in programs

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Fri Oct 27 2000 - 18:10:26 MEST


Could you lookup  your project parameters to make sure you compiled / linked against
of "Multithreaded DLL" versions of MS libraries.
          Valery
----- Original Message -----
From: kamps <kamps@fsw.leidenuniv.nl>
To: Rene Brun <Rene.Brun@cern.ch>
Cc: <roottalk@pcroot.cern.ch>
Sent: 27 октября 2000 г. 6:05
Subject: RE: [ROOT] Ntuples in programs


> Hello Rene, Valery, Bernard
> If I make a console program, using the files in the attachments, the problem
> occurs. If
> I comment the #include <iostream> in "network.h", a correct n-tuple is
> produced. Some
> files are no-op, because I stripped irrelevant code from them, but all are
> necesssary to produce the problem.
>
> Bernard: the problem is also present in a slightly larger program that I got
> from Andy
> and that works fine as starting point for ROOT appications so far. As far as
> I am aware
> the most important point Andy makes concerning compiling/linking is that
> standard <iostream> headers may clash with root files. In the tuple.* files
> no such include files are present and the tuple.h file does not expose
> references to ROOT objects.
>
> Cheers,
> Marc
>
> > -----Original Message-----
> > From: brun@pcbrun.cern.ch [mailto:brun@pcbrun.cern.ch]On Behalf Of Rene
> > Brun
> > Sent: Thursday, October 26, 2000 4:02 PM
> > To: kamps
> > Cc: roottalk@pcroot.cern.ch
> > Subject: Re: [ROOT] Ntuples in programs
> >
> >
> > Hi Marc,
> > Could you send me a simple working example that I can use
> > to reproduce your problem ?
> >
> > Rene Brun
> >
> > kamps wrote:
> > >
> > > Hello,
> > >
> > > I use ROOT version 2.25/03, using MSVC++ 6.0 under WinNT. The
> > program below
> > > runs fine
> > > in principle. If I throw in a couple of events, with
> > Tuple::Addevent, I can
> > > plot them
> > > from the n-tuple that is produced. If I add more and more files to the
> > > project, without
> > > changing main.cpp at all, none of the extra files using ROOT
> > related code,
> > > the program will fail in Tuple::CloseTuple, in the line p_file->Write().
> > >
> > > The message I get is then:
> > > --------------------------------------------------------------------
> > > <CustomRealloc2>: passed oldsize 1032, should be 18415747
> > > Fatal in <CustomReAlloc2>: unreasonable size (18415747)
> > > aborting
> > > Warning in <TWinNTSystem::StackTrace>: this method must be overriden!
> > > --------------------------------------------------------------------
> > >
> > > I know that linking root into C++ programs sometimes involves subtleties
> > > that are
> > > not present in macros, so I probably have overlooked something simple. I
> > > want to use
> > > the buffering and compression facilities of n-tuples in my
> > program, however.
> > > I hope you can tell from this information what goes wrong.
> > > Thanks,
> > >         Marc
> > >
> > > --------------------- main.cpp -----------------------------------
> > > #include "D:/code/libs/neuronlib/tuple.h"
> > >
> > > int main()
> > > {
> > >         Tuple tup;
> > >         tup.OpenTuple("bla");
> > >         tup.CloseTuple();
> > >
> > >         return 0;
> > > }
> > > ------------------------ tuple.h -----------------------------------
> > > class Tuple {
> > > public:
> > >
> > >         Tuple();
> > >
> > >         bool OpenTuple(const char*p);
> > >         void CloseTuple();
> > >         void AddEvent( int, int, float);
> > > };
> > >
> > > ------------------------ tuple.cpp
> > ---------------------------------------
> > > #include "tuple.h"
> > >
> > > #include <TRoot.h>
> > > #include <TNtuple.h>
> > > #include <TFile.h>
> > >
> > > TROOT root("root","tup");
> > >
> > > TFile*   p_file;
> > > TNtuple* p_tuple;
> > >
> > > Tuple::Tuple()
> > > {
> > > }
> > >
> > > bool Tuple::OpenTuple(const char* p)
> > > {
> > >         p_file  = new TFile(p,"RECREATE","spike simulation run");
> > >         p_tuple = new TNtuple("ntuple","events","in:out:time");
> > >
> > >         return true;
> > > }
> > >
> > > void Tuple::CloseTuple()
> > > {
> > >         p_file->Write();
> > >         p_file->Close();
> > >         delete p_file;
> > > }
> > >
> > > void Tuple::AddEvent( int i, int j, float f)
> > > {
> > >         p_tuple->Fill((float)i,(float)j,f);
> > > }
> > >
> > >
> > ------------------------------------------------------------------
> > ----------
> > > ----
> >
>



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET