Re: [ROOT] MakeClass on TTree containing different data types

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Mar 10 2004 - 17:22:17 MET


Hi Jeroen,

Your macro runs OK with 3.10/02 or 4.00/02.

Rene Brun

Jeroen Hegeman wrote:
> 
> Hi ROOTers,
> 
> Something strange happens when I try to read a TTree from file using the
> code that MakeClass generated for me.
> 
> I'm using ROOT version 3.05/07, a sample of the TTree is attached
> (testdata.root), also attached are the MakeClass code (testClass.*) and a
> macro showing the correct values (testMacro.C).
> 
> Here come the TTree::Print() output (NOTICE: the first leaf is a Short_t,
> the second a Double_t, then comes a Float_t!), the output of
> testGlobal::Loop() and the output of the testMacro which just uses
> TTree::Scan().
> 
> Clearly, the values given by Scan() are OK, but somehow the values reached
> by addressing from the Loop() method are screwed up.
> 
> My guess was that this may be something to do with the different data
> types in the same branch? The closest thing I could find on ROOTtalk was
> http://root.cern.ch/root/roottalk/roottalk03/1061.html
> but I'm hoping I won't have to go and call SetLeafAddress for all the
> leaves in the TTree.
> 
> Help would be appreciated.
> 
> Cheers,
> Jeroen Hegeman
> 
> TTREE::PRINT() OUTPUT
> ******************************************************************************
> *Tree    :Global    : Global
> *
> *Entries :       10 : Total =           21741 bytes  File  Size =       5891 *
> *        :          : Tree compression factor =   1.00
> *
> ******************************************************************************
> *Br    0 :JCCA      : jc7_size/I:jc7_Ecor[jc7_size]/D:jc7_CCMGF[jc7_size]/F: *
> *         | jc7_CHF[jc7_size]/F:jc7_E[jc7_size]/F:jc7_ECMGF[jc7_size]/F:     *
> *         | jc7_EM1F[jc7_size]/F:jc7_EM2F[jc7_size]/F:jc7_EM3F[jc7_size]/F:  *
> *         | jc7_EM4F[jc7_size]/F:jc7_EMF[jc7_size]/F:jc7_Eta[jc7_size]/F:    *
> *         | jc7_EtaD[jc7_size]/F:jc7_EtaW[jc7_size]/F:jc7_FH1F[jc7_size]/F:  *
> *         | jc7_FH2F[jc7_size]/F:jc7_FH3F[jc7_size]/F:jc7_HotF[jc7_size]/F:  *
> *         | jc7_ICDF[jc7_size]/F:jc7_ICDMGF[jc7_size]/F:jc7_JES[jc7_size]/F: *
> *         | jc7_L1ET[jc7_size]/F:jc7_PT[jc7_size]/F:jc7_Phi[jc7_size]/F:     *
> *         | jc7_PhiD[jc7_size]/F:jc7_PhiW[jc7_size]/F:jc7_Px[jc7_size]/F:    *
> *         | jc7_Py[jc7_size]/F:jc7_Pz[jc7_size]/F:jc7_Wdth[jc7_size]/F:      *
> *         | jc7_f90[jc7_size]/F:jc7_stat[jc7_size]/F:jc7_syst[jc7_size]/F:   *
> *         | jc7_NTwr[jc7_size]/S:jc7_SMW[jc7_size]/S:jc7_n90[jc7_size]/S     *
> *Entries :       10 : Total  Size=      21329 bytes  One basket in memory    *
> *Baskets :        0 : Basket Size=      32000 bytes  Compression=   1.00     *
> *............................................................................*
> 
> TESTGLOBAL::LOOP() OUTPUT
> Event index #: 0
>   jc7_E[0] = 66.9891
>   jc7_E[1] = 3.25665
> Event index #: 1
>   jc7_E[0] = 64.0778
>   jc7_E[1] = 55.5725
>   jc7_E[2] = 1.02844e-33!!!
> Event index #: 2
>   jc7_E[0] = 64.0778
> Event index #: 3
>   jc7_E[0] = 51.004
>   jc7_E[1] = 55.5725
> Event index #: 4
>   jc7_E[0] = 64.9475
>   jc7_E[1] = 165.079
>   jc7_E[2] = 14.0442
>   jc7_E[3] = 4.62428e-44!!!
> Event index #: 5
>   jc7_E[0] = 100.681
>   jc7_E[1] = 31.4758
>   jc7_E[2] = 17.9535
>   jc7_E[3] = 4.62428e-44!!!
> Event index #: 6
>   jc7_E[0] = 14.6576
>   jc7_E[1] = 70.1111
>   jc7_E[2] = 17.9535
> Event index #: 7
>   jc7_E[0] = 201.855
>   jc7_E[1] = 19.519
>   jc7_E[2] = 17.9535
> Event index #: 8
>   jc7_E[0] = 113.626
>   jc7_E[1] = 24.7742
>   jc7_E[2] = 85.1166
>   jc7_E[3] = 22.7234
>   jc7_E[4] = 12.2498
>   jc7_E[5] = 12.0156
> Event index #: 9
>   jc7_E[0] = 278.412
>   jc7_E[1] = 237.405
>   jc7_E[2] = 195.282
>   jc7_E[3] = 125.134
>   jc7_E[4] = 115.265
>   jc7_E[5] = 132.651
>   jc7_E[6] = 61.1572
>   jc7_E[7] = 5.48734e+07
> 
> TESTMACRO OUTPUT
> ************************************************************
> *    Row   *  jc7_size *  jc7_E[0] *  jc7_E[1] *  jc7_E[2] *
> ************************************************************
> *        0 *         2 * 86.975097 * 66.989135 *           *
> *        1 *         3 * 76.373291 * 64.077758 * 55.572509 *
> *        2 *         1 * 22.824096 *           *           *
> *        3 *         2 * 57.888793 * 51.004028 *           *
> *        4 *         4 * 160.69335 * 64.947509 * 165.07873 *
> *        5 *         4 * 168.46618 * 100.68054 * 31.475830 *
> *        6 *         3 * 177.31018 * 14.657592 * 70.111084 *
> *        7 *         3 * 113.71765 * 201.85546 * 19.519043 *
> *        8 *         6 * 76.895141 * 113.62609 * 24.774169 *
> *        9 *         8 * 381.93969 * 278.41186 * 237.40539 *
> ************************************************************
> 
>   --------------------------------------------------------------------------------
>                    Name: testGlobal.C
>    testGlobal.C    Type: Plain Text (TEXT/PLAIN)
>                Encoding: BASE64
> 
>                    Name: testGlobal.h
>    testGlobal.h    Type: Plain Text (TEXT/PLAIN)
>                Encoding: BASE64
> 
>                     Name: testdata.root
>    testdata.root    Type: unspecified type (APPLICATION/octet-stream)
>                 Encoding: BASE64
> 
>                   Name: testMacro.C
>    testMacro.C    Type: Plain Text (TEXT/PLAIN)
>               Encoding: BASE64



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET