RE: [ROOT] Re: errors in bstring.h

From: Philippe Canal (pcanal@fnal.gov)
Date: Fri Oct 08 2004 - 10:47:03 MEST


Hi,

Just use
TF1 *t[2];
t[0] = new TF1("g","gaus",-6,6);
t[1] = new TF1("p","pol1", 0,6);

Or better yet, use a container instead of a C-style array (TObjArray, TList
or the equivalent stl container).

Cheers,
Philippe. 

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]
On Behalf Of Tomasz Bold
Sent: Thursday, October 07, 2004 8:08 PM
To: cint@pcroot.cernch
Cc: roottalk@pcroot.cern.ch
Subject: Re: [ROOT] Re: errors in bstring.h

Hi ROOTers,
	I desperatelly need to perform plenty of fits of simuilar
functions. I wnated to create table of pointer to plain C functions.
Does not work. Now I want to create an array of pointer to objects.
Does not work. See below.  (Seems like parsing of array statement
problem.)

Any idea how to make it.

Regards,
	Tomasz Bold

root [0] TF1 *t[]={new TF1("g","gaus",-6,6), new TF1("p","pol1", 0,6)};
Error: Function newTF1("g","gaus",-6,6) is not defined in current scope
FILE:(tmpfile) LINE:1
Possible candidates are...
filename       line:size busy function type and name
*** Interpreter error recovered ***


--------------------------------------
Tomasz Bold
mail me:
bold@ftj.agh.edu.pl,
Tomasz.Bold@cern.ch
Tomasz.Bold@desy.de
or call:
+48 12 617 4729 (AGH)
+48 12 662 8023 (IFJ)
-------------------------------------

On Thu, 7 Oct 2004, Rene Brun wrote:

> I cannot reproduce this problem.
> Could yous send the instructions to reproduce it if the problem happens
> during the script execution. Send the data file required to run the
script.
>
> Rene Brun
>
> boinee wrote:
> >
> > Dear rooters
> > i am using
> > root version : 3.10/02 : system : suse 9.1 professional , gcc -> 3.3.1
> > (SuSE Linux)
> >
> >
> > I am getting the following errors
> >
> > Error: non class,struct,union object $i used with . or ->Error: Symbol i
> > is not defined in current scope  FILE:bstring.h LINE:2523
> > Error: Failed to evaluate i.operatorvoidError: Binary operator oprand
> > missing FILE:bstring.h LINE:2523
> > *** Interpreter error recovered ***
> >
> > and here is my macro. {  It is working well  as a c++ program. }
> >
> > #include <string>
> > #include <iostream>
> > #include <sstream>
> > #include <fstream>
> >
> > rootsala()
> > {
> >
> > string s1;
> >
> > fstream f("/data1/mrk1.txt",ios::in);
> > if (f.is_open())
> > cout <<"The file has been opened properly \n";
> > else
> > {
> >
> > cout <<"The file has not been opened properly  \n";
> > exit(0);
> > }
> > int prun=0,pcount=0;
> > int crun=0,ccount=0;
> > int drun=0,dcount=0;
> >
> > while (!f.eof())
> > {
> >
> > f>>s1;
> > string s2(s1,9,6);// (mother string,index of first char, no.of chars to
> > be copied
> > //cout <<"s1 = "<<s1<<endl;
> > stringstream ss (stringstream::in | stringstream::out);
> > ss.str(s2);
> >
> > if(s1.find("P") != string::npos)
> > {
> >     ss>>prun;
> >     pcount++;
> >     cout <<"prun "<<pcount<<" = "<<prun<<endl;
> > }
> >
> >  if (s1.find("D") != string::npos)
> > {
> >     ss>>drun;
> >     dcount++;
> >     cout <<"drun "<<dcount<<" = "<<drun<<endl;
> > }
> > if (s1.find("C") != string::npos)
> > {
> >     ss>>crun;
> >     ccount++;
> >     cout <<"crun "<<ccount<<" = "<<crun<<endl;
> > }
> >
> > }
> >
> > cout <<"No.of Pedestal Files = "<<pcount<<endl;
> > cout <<"No.of Calibration Files = "<<ccount<<endl;
> > cout <<"No.of Data Files = "<<dcount<<endl;
> >
> > }
> >
> > waiting for reply
> > Praveen boinee
> > Dep. Physics
> > Udine University
> > Udine
> > Italy
>
>



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET