Re: [ROOT] Global variable scope question

From: Edward Chen (edward@SLAC.stanford.edu)
Date: Wed Aug 21 2002 - 21:31:41 MEST


Hi Rene - I don't explicitly call gROOT-Reset() in my selector.  It's
pretty much the standard selector generated from TChain::MakeSelector(),
with a couple modifications that I don't think call gROOT->Reset().

However, when I do .g at the command line, I see (for example):

(compiled)          0x2ae4d680 const Int_t kMaxInt=2147483647

vs.

                 11 0x8733ca0  Float_t R2=0.607421

so my R2 variable doesn't have this (compiled) status.  And I can print
out the value of kMaxInt from my selector.  R2 is declared at the command
line (or via unnamed macro) - how do I get it into compiled status?

Thanks.

-Ed

On Wed, 21 Aug 2002, Rene Brun wrote:

> Hi Ed,
>
> If you define a global variable with CINT (eg float R2), this variable
> must be visible in any interpreted function.
> My guess is that you are calling "gROOT->Reset()" somewhere
> in your selector.
>
> A CINT global variable cannot be seen from the compiled code
> if it is not declared to CINT as well (like we do for globals
> like gFile, gDirectory,etc).
>
> Rene Brun
>
> On Tue, 20 Aug 2002, Edward Chen wrote:
>
> > Hi - I have a global variable which shows up when I do .g:
> >
> >
> >                  11 0x8733bf0  Float_t R2=0
> >
> >
> > I want to access the value of R2 in TSelector::ProcessCut().  Is that
> > possible?  I'm getting the following error message:
> >
> >
> > /data1/babar/edward/root/temp.C:67: `R2' undeclared (first use this
> > function)
> >
> > Thanks.  (I'm using ROOT 3.03/06)
> >
> > -Ed
> >
>
>



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:05 MET