Re: [ROOT] Re: Is this a bug in CopyTree() (3.05/00)

From: Ricardo Eusebi (eusebi@fnal.gov)
Date: Sat Mar 01 2003 - 18:39:17 MET


Is not a ROOT problem. The code that was been used did not check for the 
array counter before trying to read a value, therefore the value present 
was the memory resident value of some previous event.

Ricardo


Rene Brun wrote:

>Hi Mircea,
>
>Which version are you using? When reading (normal or a la MakeClass)
>the array counter is set to 0 if the number of array elements was 0.
>
>Rene Brun
>
>On 
>Fri, 28 Feb 2003, Mircea Coca wrote:
>
>  
>
>>	Hi,
>>
>>	We found the problem: not checking the number of entries
>>in the array; root doesn't initialize the array element to some
>>nonsense number every time reads an event. So if the previous event had 2
>>electrons and the current event has only one, then the second entry in the
>>electron array has the second electron values from the previous
>>event...The weakness of using MakeClass.
>>
>>	Mircea
>>
>>On Fri, 28 Feb 2003, Jedong Lee wrote:
>>
>>    
>>
>>>I noticed et2 of j=164 and j=165 were the same. It was a length-of-array
>>>problem, not a bug of CopyTree().
>>>I realize CopyTree() was smarter than I am.
>>>
>>>- Jedong
>>>
>>>On Fri, 28 Feb 2003, Jedong Lee wrote:
>>>
>>>      
>>>
>>>>Hello,
>>>>
>>>>I am stripping off an ntuple with command like this: (ROOT 3.05/00)
>>>>
>>>>  TTree *small = mmm.fChain->CopyTree("Et[0]>20&&Et[1]>20")
>>>>
>>>>By the way, the resulting file contains less events than I expected.
>>>>I compared the entries and found that not all the events
>>>>that pass the criteria are written to the target file.
>>>>
>>>>This seems to be happening whenever the event(entry = i) passes
>>>>the cut and event(entry = i+x) also passes, and x is small number..
>>>>
>>>>This is the list of variables in two files:
>>>>( j=164 and j=165 passes the cut, only j=164 survived.
>>>>  Out of j=175,177,178,179, j=175 and j=178 survived.
>>>>  Out of j=301,302, j=301 survived.)
>>>>
>>>>Original file: (showing the events that passes the cut)
>>>>
>>>>j 8     et1 101.701     et2 37.4808
>>>>j 10    et1 39.8504     et2 27.9597
>>>>j 28    et1 43.283      et2 37.779
>>>>j 84    et1 45.18       et2 27.6098
>>>>j 86    et1 40.8786     et2 20.0176
>>>>j 141   et1 37.3549     et2 22.055
>>>>j 158   et1 32.8841     et2 20.5765
>>>>j 164   et1 46.0031     et2 29.4996
>>>>j 165   et1 38.1034     et2 29.4996
>>>>j 175   et1 70.7513     et2 31.3695
>>>>j 177   et1 32.906      et2 31.3695
>>>>j 178   et1 32.8016     et2 24.8853
>>>>j 179   et1 22.3331     et2 24.8853
>>>>j 216   et1 151.5       et2 91.1525
>>>>j 246   et1 26.6626     et2 20.8906
>>>>j 257   et1 121.573     et2 72.1682
>>>>j 267   et1 36.5081     et2 23.0727
>>>>j 301   et1 40.4186     et2 36.0574
>>>>j 302   et1 29.8817     et2 36.0574
>>>>j 334   et1 59.1586     et2 37.6737
>>>> .
>>>> .
>>>> .
>>>>
>>>>Target file: (all the events in the target)
>>>>
>>>>j 0     et1 101.701     et2 37.4808
>>>>j 1     et1 39.8504     et2 27.9597
>>>>j 2     et1 43.283      et2 37.779
>>>>j 3     et1 45.18       et2 27.6098
>>>>j 4     et1 40.8786     et2 20.0176
>>>>j 5     et1 37.3549     et2 22.055
>>>>j 6     et1 32.8841     et2 20.5765
>>>>j 7     et1 46.0031     et2 29.4996
>>>>j 8     et1 70.7513     et2 31.3695
>>>>j 9     et1 32.8016     et2 24.8853
>>>>j 10    et1 151.5       et2 91.1525
>>>>j 11    et1 26.6626     et2 20.8906
>>>>j 12    et1 121.573     et2 72.1682
>>>>j 13    et1 36.5081     et2 23.0727
>>>>j 14    et1 40.4186     et2 36.0574
>>>>j 15    et1 59.1586     et2 37.6737
>>>> .
>>>> .
>>>> .
>>>>
>>>>Best,
>>>>Jedong
>>>>
>>>>
>>>>        
>>>>
>
>  
>

-- 
--------------------------------------------------------------------
Ricardo Eusebi
High Energy Physics
University of Rochester
Fermilab,  (630) 840 8622
--------------------------------------------------------------------



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