Hi Valeri, As you correctly report, TTree::Scan prints only one entry in case of variable length arrays. The problem for a general implementation is when the same entry contains different arrays with different loop indices. I think that using TTree::Show is better in this case. Rene Brun Tioukov Valeri wrote: > > Hi rooters, > > The output of Scan() function seems to be misleading in case of > TClonesArray branch, especially then array could have 0 size. > > To demonstrate it I modify in MainEvent.cxx one line: > > // Int_t ntrack = Int_t(arg5 +arg5*sigmat/120.); > Int_t ntrack = ev; > > In this case the first event has 0 tracks. > > After producing Event.root start the macro : > > zero.C > { > gSystem.Load("libEvent"); > > TFile f("Event.root"); > > for(int i=0; i<3; i++) > T->Scan("fTemperature:fFlag:fNtrack:fPx:fPy","","",i+1); > } > > The output is: > root [0] .x zero.C > ************************************************************************ > * Row *fTemperature * fFlag * fNtrack * fPx * fPy * > ************************************************************************ > * 0 * 20.319 * 0 * 0 * 0 * 0 * > ************************************************************************ > ************************************************************************ > * Row *fTemperature * fFlag * fNtrack * fPx * fPy * > ************************************************************************ > * 0 * 20.319 * 0 * 0 * 0 * 0 * > * 1 * 20.041 * 0 * 1 * -0.52418 * 1.8685 * > ************************************************************************ > ************************************************************************ > * Row *fTemperature * fFlag * fNtrack * fPx * fPy * > ************************************************************************ > * 0 * 20.319 * 0 * 0 * -0.52418 * 1.8685 * > * 1 * 20.041 * 0 * 1 * -0.52418 * 1.8685 * > * 2 * 20.297 * 0 * 2 * 0.26634 * 0.052835 * > ************************************************************************ > > First question: fPx and fPy variables are printed only for 1-st track. > How to print them for all tracks? > > Second question: for the 1-st event (0-entry) fPx and fPy do not > defined because this event have no tracks, but there printed !? > > I paw the output of nt/scan is exactly as the expected - nothin > printed in case of 0 tracks, everithing - in case of many tracks: > > nt/scan 7100 ! ! ! ! idev ntr day daz > +-------+-------------+-------------+--------------+--------------+ > | Event | idev | ntr | day | daz | > +-------+-------------+-------------+--------------+--------------+ > | 403 | 4116 | 0 | | | > | 404 | 4172 | 0 | | | > | 405 | 65 | 1 | 0.004 | -0.002 | > | 406 | 66 | 1 | 0.001 | -0.002 | > | 407 | 69 | 1 | 0.002 | 0.003 | > .... > | 535 | 366 | 2 | | | > | * 1 | | | 0. | -0.025 | > | * 2 | | | -0.01 | -0.001 | > | 536 | 423 | 2 | | | > | * 1 | | | 0.021 | 0.009 | > | * 2 | | | 0.009 | -0.009 | > > Regards > Valeri
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:35 MET