Re: problem with a Boolean

From: Victor Perevoztchikov (perev@bnl.gov)
Date: Mon Mar 06 2000 - 19:24:51 MET


Hi Thomas,
try to type before .O0
Often it helps.
Victor

Thomas Eberl wrote:
> 
> 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

-- 
Victor M. Perevoztchikov   perev@bnl.gov  perev@vxcern.cern.ch       
Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690



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