Null values in a TTree Branch

Hi,

I have a TTree with a branch “rw7_qelNCma[4]” that was giving some anomalous values. Went I looked up those element with a TTree::Scan, they were empty.

[quote]root [9] gst->Scan(“rw7_qelNCma[4]”,"","",1000000,2750)


  • Row * rw7_qelNC *

  • 2750 *         1 *
    
  • 2751 *         1 *
    
  • 2752 * 1.0378572 *
    
  • 2753 *         1 *
    
  • 2754 *         1 *
    
  • 2755 *         1 *
    
  • 2756 *         1 *
    
  • 2757 *         1 *
    
  • 2758 *         1 *
    
  • 2759 *         1 *
    
  • 2760 *         1 *
    
  • 2761 *         1 *
    
  • 2762 * 1.8582798 *
    
  • 2763 *           *
    
  • 2764 *         1 *
    
  • 2765 *         1 *
    
  • 2766 *         1 *
    
  • 2767 *         1 *
    
  • 2768 *         1 *
    
  • 2769 * 1.0825097 *
    
  • 2770 *         1 *
    
  • 2771 *         1 *
    
  • 2772 *         1 *
    
  • 2773 *         1 *
    
  • 2774 *         1 *
    

Type to continue or q to quit ==>
[/quote]

these ‘blank’ entries should be filled with 1. When I loop over the tree they return the last non-unity value. For example entry 2763 returns a value of 1.8582798 instead of 1, 0 or null. Is there any way to way to check for these entries and set the value to 1.

Thanks,

Dan

Hi Dan,

Those empty lines indicates that the array has less than 4 elements in these entries.

[quote] When I loop over the tree they return the last non-unity value.[/quote]This usually indicates that you are looking at a variable size array but are not correctly checking the array bound.

Cheers,
Philippe.