problem with a Boolean

From: Thomas Eberl (teberl@physik.tu-muenchen.de)
Date: Mon Mar 06 2000 - 18:26:26 MET


Dear rooters,

I have a very strange problem. The following macro works fine if I set
the boolean variable kRichCal to 1 (kTRUE). If I set it to 0 (kFALSE),
it should only loop and in particular it should not see the following
line:

nBytesRichCal += bRichCalNrLeaves -> GetEntry(i);

Instead, what happens is that it says the following:

>>Error: non class,struct,union object $bRichCalNrLeaves used with . or -> >>FILE:/share/home/teberl/hydra/v401/macros/Rich/testBoolean.C LINE:38
>>Error: Binary operator oprand missing >>FILE:/share/home/teberl/hydra/v401/macros/Rich/testBoolean.C LINE:38

I absolutely do not understand why it looks at all to this line as it is
enclosed in the if-statement that is FALSE !!!!!


I am currently using 2.23 / 09 (Nov. 26th) on RedHat 6.0 .

I can always comment out the lines, but I'd like to understand why it
behaves in this irrational (?) way :)

best regards

Thomas

//
//
//
//
//

The macro is the following:

>> ------------------
{
TStopwatch timer;
Text_t *iname = "/scratch/titan/data/ExpData/anaAll2.root";
TFile *f = new TFile (iname, "READ");
HTree *T = (HTree *) f->Get ("T");

Stat_t nMaxEntry = T->GetEntries();
Stat_t nMinEntry = 0; // first entry to get from Tree 

// *** SWITCHES
Bool_t kRichCal;
kRichCal       = 0; 
 
if (kRichCal){

      Int_t nRichCalData; 
      TBranch *bRichCalNrLeaves;
      bRichCalNrLeaves = T->GetBranch("HRichCal.fData_"); 
      bRichCalNrLeaves -> SetAddress(&nRichCalData);  
      
}   


if(kRichCal)       Int_t nBytesRichCal       = 0; // Byte counter

timer.Start(); //  performance

for (Int_t i=nMinEntry; i<nMaxEntry; i++){ // event loop

     if(kRichCal){
       nBytesRichCal += bRichCalNrLeaves -> GetEntry(i); 
           } 

} // *** end of event loop

timer.Stop();
}

>> ---------------------------------
-- 
Thomas Eberl                       Phone: (+49 89) 289 1 2425   
Physik-Department E12, Technische Universitaet Muenchen
James-Franck-Strasse *** D-85748 Garching b. Muenchen
Email: Thomas.Eberl@physik.tu-muenchen.de



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