[ROOT] undeclared objects

From: Justin Findlay (findlay@cosmic.utah.edu)
Date: Fri May 23 2003 - 19:23:50 MEST


Hi,

I have some statements like this,

for ( UInt_t i = 0, i < N; i ++ )
{
  tree->Draw( "a : b", cut1 + cut2 );

  if ( 0 < tree->GetSelectedRows() )
  {
    htemp->Fit( "pol1", "q", "", 0.0, range );
  }
}

which return

Error: non class,struct,union object $htemp used with . or ->

This only happens if the first "Draw" command of the loop does not return
a positive number of entries.  If I try 

TH1D * htemp = new TH1D();

before the loop, then all subsequent calls to htemp will point to this
object which is unique from the default "htemp".  The first problem I see
is that cint wants to check the validity of the statements within the
selection structure even if they will not be executed.  The second, deeper
issue is whether it is possible to explicitly instantiate default objects
without roundabout statements like calling the "TTree::Draw" method to get
the default histogram, "htemp".


Justin



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