Problems with filling a histogram from Tree File

Hello all,

As this is my first post I apologize for omitting any information that is crucial to solving this problem. But this is the synopsis of my problem. I am attempting to draw a histogram from a Tree file but since the branches of the tree have different number of entries I cannot fill the histogram.

This is the error I get:

[quote]*** glibc detected *** /cern/root/root-v5-34/bin/root.exe: free(): invalid next size (fast): 0x0a0f8a88 ***
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(+0x75ee2)[0xb6d2eee2]
/cern/root/root-v5-34/lib/libCint.so(G__destroy_upto+0x240)[0xb67f04c0]
/cern/root/root-v5-34/lib/libCint.so(G__interpret_func+0x3a94)[0xb6752314]
/cern/root/root-v5-34/lib/libCint.so(G__getfunction+0x20a8)[0xb673e5a8]
/cern/root/root-v5-34/lib/libCint.so(G__getitem+0x975)[0xb67151d5]
/cern/root/root-v5-34/lib/libCint.so(G__getexpr+0x57d8)[0xb671bcf8]
/cern/root/root-v5-34/lib/libCint.so(G__calc_internal+0x363)[0xb6727ce3]
/cern/root/root-v5-34/lib/libCint.so(G__process_cmd+0x3514)[0xb67b8dd4]
/cern/root/root-v5-34/lib/libCore.so(_ZN5TCint11ProcessLineEPKcPN12TInterpreter10EErrorCodeE+0x4da)[0xb7189c3a]
/cern/root/root-v5-34/lib/libCore.so(_ZN5TCint16ProcessLineSynchEPKcPN12TInterpreter10EErrorCodeE+0xaf)[0xb717ed3f]
/cern/root/root-v5-34/lib/libCore.so(_ZN12TApplication11ExecuteFileEPKcPib+0x8b7)[0xb70daa37]
/cern/root/root-v5-34/lib/libCore.so(_ZN12TApplication11ProcessFileEPKcPib+0x2c)[0xb70dae0c]
/cern/root/root-v5-34/lib/libCore.so(_ZN12TApplication11ProcessLineEPKcbPi+0x80f)[0xb70d950f]
/cern/root/root-v5-34/lib/libRint.so(_ZN5TRint15HandleTermInputEv+0x275)[0xb6fa3d85]
/cern/root/root-v5-34/lib/libRint.so(_ZN17TTermInputHandler6NotifyEv+0x22)[0xb6fa3782]
/cern/root/root-v5-34/lib/libRint.so(_ZN17TTermInputHandler10ReadNotifyEv+0x12)[0xb6fa5d02]
/cern/root/root-v5-34/lib/libCore.so(_ZN11TUnixSystem16CheckDescriptorsEv+0x150)[0xb71c70d0]
/cern/root/root-v5-34/lib/libCore.so(_ZN11TUnixSystem16DispatchOneEventEb+0xcc)[0xb71c894c]
/cern/root/root-v5-34/lib/libCore.so(_ZN7TSystem9InnerLoopEv+0x22)[0xb713bc62]
/cern/root/root-v5-34/lib/libCore.so(_ZN7TSystem3RunEv+0x6c)[0xb713e3cc]
/cern/root/root-v5-34/lib/libCore.so(_ZN12TApplication3RunEb+0x38)[0xb70d6f88]
/cern/root/root-v5-34/lib/libRint.so(_ZN5TRint3RunEb+0x271)[0xb6fa4891]
/cern/root/root-v5-34/bin/root.exe(main+0x6f)[0x8048c8f]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0xb6cd24d3]
/cern/root/root-v5-34/bin/root.exe[0x8048d0d]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 08:05 2372216 /cern/root/root-v5-34/bin/root.exe
0804a000-0804b000 r–p 00001000 08:05 2372216 /cern/root/root-v5-34/bin/root.exe
0804b000-0804c000 rw-p 00002000 08:05 2372216 /cern/root/root-v5-34/bin/root.exe
09c7d000-0a4f2000 rw-p 00000000 00:00 0 [heap]
b3418000-b352b000 r-xp 00000000 08:05 2371825 /cern/root/root-v5-34/lib/libASImage.so
b352b000-b352d000 r–p 00112000 08:05 2371825 /cern/root/root-v5-34/lib/libASImage.so
b352d000-b352f000 rw-p 00114000 08:05 2371825 /cern/root/root-v5-34/lib/libASImage.so
b352f000-b4645000 rw-p 00000000 00:00 0
b4645000-b464e000 r-xp 00000000 08:05 11278082 /usr/lib/i386-linux-gnu/libXcursor.so.1.0.2
b464e000-b464f000 r–p 00008000 08:05 11278082 /usr/lib/i386-linux-gnu/libXcursor.so.1.0.2
b464f000-b4650000 rw-p 00009000 08:05 11278082 /usr/lib/i386-linux-gnu/libXcursor.so.1.0.2
b4650000-b46a6000 r–p 00000000 08:05 2363717 /cern/root/root-v5-34/fonts/FreeSansBold.otf
b46a6000-b46cc000 r-xp 00000000 08:05 6292474 /lib/i386-linux-gnu/libexpat.so.1.5.2
b46cc000-b46cd000 —p 00026000 08:05 6292474 /lib/i386-linux-gnu/libexpat.so.1.5.2
b46cd000-b46cf000 r–p 00026000 08:05 6292474 /lib/i386-linux-gnu/libexpat.so.1.5.2
b46cf000-b46d0000 rw-p 00028000 08:05 6292474 /lib/i386-linux-gnu/libexpat.so.1.5.2
b46d0000-b4702000 r-xp 00000000 08:05 11278266 /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4
b4702000-b4703000 r–p 00032000 08:05 11278266 /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4
b4703000-b4704000 rw-p 00033000 08:05 11278266 /usr/lib/i386-linux-gnu/libfontconfig.so.1.4.4
b4704000-b4718000 r-xp 00000000 08:05 11278092 /usr/lib/i386-linux-gnu/libXft.so.2.2.0
b4718000-b4719000 r–p 00013000 08:05 11278092 /usr/lib/i386-linux-gnu/libXft.so.2.2.0
b4719000-b471a000 rw-p 00014000 08:05 11278092 /usr/lib/i386-linux-gnu/libXft.so.2.2.0
b472e000-b472f000 rw-p 00000000 00:00 0
b472f000-b4742000 r-xp 00000000 08:05 2371297 /cern/root/root-v5-34/lib/libGX11TTF.so
b4742000-b4743000 r–p 00013000 08:05 2371297 /cern/root/root-v5-34/lib/libGX11TTF.so
b4743000-b4744000 rw-p 00014000 08:05 2371297 /cern/root/root-v5-34/lib/libGX11TTF.so
b4744000-b4de2000 r-xp 00000000 08:05 2370798 /cern/root/root-v5-34/lib/libGui.so
b4de2000-b4e0a000 r–p 0069d000 08:05 2370798 /cern/root/root-v5-34/lib/libGui.so
b4e0a000-b4e11000 rw-p 006c5000 08:05 2370798 /cern/root/root-v5-34/lib/libGui.so
b4e11000-b4e1c000 rw-p 00000000 00:00 0
b4e1c000-b4e21000 r-xp 00000000 08:05 11278086 /usr/lib/i386-linux-gnu/libXdmcp.so.6.0.0
b4e21000-b4e22000 r–p 00004000 08:05 11278086 /usr/lib/i386-linux-gnu/libXdmcp.so.6.0.0
b4e22000-b4e23000 rw-p 00005000 08:05 11278086 /usr/lib/i386-linux-gnu/libXdmcp.so.6.0.0
b4e23000-b4e25000 r-xp 00000000 08:05 11278075 /usr/lib/i386-linux-gnu/libXau.so.6.0.0
b4e25000-b4e26000 r–p 00001000 08:05 11278075 /usr/lib/i386-linux-gnu/libXau.so.6.0.0
b4e26000-b4e27000 rw-p 00002000 08:05 11278075 /usr/lib/i386-linux-gnu/libXau.so.6.0.0
b4e27000-b4e46000 r-xp 00000000 08:05 11278704 /usr/lib/i386-linux-gnu/libxcb.so.1.1.0
b4e46000-b4e47000 r–p 0001f000 08:05 11278704 /usr/lib/i386-linux-gnu/libxcb.so.1.1.0
b4e47000-b4e48000 rw-p 00020000 08:05 11278704 /usr/lib/i386-linux-gnu/libxcb.so.1.1.0
b4e48000-b4f78000 r-xp 00000000 08:05 11278073 /usr/lib/i386-linux-gnu/libX11.so.6.3.0
b4f78000-b4f79000 r–p 0012f000 08:05 11278073 /usr/lib/i386-linux-gnu/libX11.so.6.3.0
b4f79000-b4f7b000 rw-p 00130000 08:05 11278073 /usr/lib/i386-linux-gnu/libX11.so.6.3.0
b4f7b000-b4f7c000 rw-p 00000000 00:00 0
b4f7c000-b4f8c000 r-xp 00000000 08:05 11278088 /usr/lib/i386-linux-gnu/libXext.so.6.4.0
b4f8c000-b4f8d000 r–p 0000f000 08:05 11278088 /usr/lib/i386-linux-gnu/libXext.so.6.4.0
b4f8d000-b4f8e000 rw-p 00010000 08:05 11278088 /usr/lib/i386-linux-gnu/libXext.so.6.4.0
b4f8e000-b4f9e000 r-xp 00000000 08:05 11278104 /usr/lib/i386-linux-gnu/libXpm.so.4.11.0
b4f9e000-b4f9f000 r–p 0000f000 08:05 11278104 /usr/lib/i386-linux-gnu/libXpm.so.4.11.0
b4f9f000-b4fa0000 rw-p 00010000 08:05 11278104 /usr/lib/i386-linux-gnu/libXpm.so.4.11.0
b4fa0000-b4fd7000 r-xp 00000000 08:05 2371290 /cern/root/root-v5-34/lib/libGX11.so
b4fd7000-b4fd8000 r–p 00037000 08:05 2371290 /cern/root/root-v5-34/lib/libGX11.so
b4fd8000-b4fd9000 rw-p 00038000 08:05 2371290 /cern/root/root-v5-34/lib/libGX11.so
b4fd9000-b4fe9000 rw-p 00000000 00:00 0
b4fe9000-b50c9000 r-xp 00000000 08:05 2370532 /cern/root/root-v5-34/lib/libGpad.so
b50c9000-b50ce000 r–p 000df000 08:05 2370532 /cern/root/root-v5-34/lib/libGpad.so
b50ce000-b50d0000 rw-p 000e4000 08:05 2370532 /cern/root/root-v5-34/lib/libGpad.so
b50d0000-b50d1000 rw-p 00000000 00:00 0
b50d1000-b5166000 r-xp 00000000 08:05 11278274 /usr/lib/i386-linux-gnu/libfreetype.so.6.8.0
b5166000-b516a000 r–p 00094000 08:05 11278274 /usr/lib/i386-linux-gnu/libfreetype.so.6.8.0
b516a000-b516b000 rw-p 00098000 08:05 11278274 /usr/lib/i386-linux-gnu/libfreetype.so.6.8.0
b516b000-b5345000 r-xp 00000000 08:05 2370491 /cern/root/root-v5-34/lib/libGraf.so
b5345000-b534c000 r–p 001da000 08:05 2370491 /cern/root/root-v5-34/lib/libGraf.so
b534c000-b534f000 rw-p 001e1000 08:05 2370491 /cern/root/root-v5-34/lib/libGraf.so
b534f000-b5358000 rw-p 00000000 00:00 0
b5358000-b585f000 r-xp 00000000 08:05 2370396 /cern/root/root-v5-34/lib/libHist.so
b585f000-b5860000 —p 00507000 08:05 2370396 /cern/root/root-v5-34/lib/libHist.so
b5860000-b5874000 r–p 00507000 08:05 2370396 /cern/root/root-v5-34/lib/libHist.so
b5874000-b5878000 rw-p 0051b000 08:05 2370396 /cern/root/root-v5-34/lib/libHist.so
b5878000-b587d000 rw-p 00000000 00:00 0
b587d000-b5ab0000 r-xp 00000000 08:05 2370272 /cern/root/root-v5-34/lib/libMatrix.so
b5ab0000-b5ab1000 —p 00233000 08:05 2370272 /cern/root/root-v5-34/lib/libMatrix.so
b5ab1000-b5ab5000 r–p 00233000 08:05 2370272 /cern/root/root-v5-34/lib/libMatrix.so
b5ab5000-b5ab8000 rw-p 00237000 08:05 2370272 /cern/root/root-v5-34/lib/libMatrix.so
b5ab8000-b5abb000 rw-p 00000000 00:00 0
b5abb000-b5cc6000 r-xp 00000000 08:05 2370397 /cern/root/root-v5-34/lib/libTree.so
b5cc6000-b5cce000 r–p 0020a000 08:05 2370397 /cern/root/root-v5-34/lib/libTree.so
b5cce000-b5cd1000 rw-p 00212000 08:05 2370397 /cern/root/root-v5-34/lib/libTree.so
b5cd1000-b5cd3000 rw-p 00000000 00:00 0
b5cd3000-b5d24000 r-xp 00000000 08:05 6291696 /lib/i386-linux-gnu/libssl.so.1.0.0
b5d24000-b5d25000 —p 00051000 08:05 6291696 /lib/i386-linux-gnu/libssl.so.1.0.0
b5d25000-b5d27000 r–p 00051000 08:05 6291696 /lib/i386-linux-gnu/libssl.so.1.0.0
b5d27000-b5d2b000 rw-p 00053000 08:05 6291696 /lib/i386-linux-gnu/libssl.so.1.0.0
b5d2b000-b5ebd000 r-xp 00000000 08:05 6291695 /lib/i386-linux-gnu/libcrypto.so.1.0.0
b5ebd000-b5ecc000 r–p 00192000 08:05 6291695 /lib/i386-linux-gnu/libcrypto.so.1.0.0
b5ecc000-b5ed3000 rw-p 001a1000 08:05 6291695 /lib/i386-linux-gnu/libcrypto.so.1.0.0
b5ed3000-b5ed7000 rw-p 00000000 00:00 0
b5ed7000-b5eda000 rw-p 00000000 00:00 0
b5eda000-b5ede000 r-xp 00000000 08:05 11278090 /usr/lib/i386-linux-gnu/libXfixes.so.3.1.0
b5ede000-b5edf000 r–p 00004000 08:05 11278090 /usr/lib/i386-linux-gnu/libXfixes.so.3.1.0
b5edf000-b5ee0000 rw-p 00005000 08:05 11278090 /usr/lib/i386-linux-gnu/libXfixes.so.3.1.0
b5ee0000-b5ee8000 r-xp 00000000 08:05 11278108 /usr/lib/i386-linux-gnu/libXrender.so.1.3.0
b5ee8000-b5ee9000 r–p 00007000 08:05 11278108 /usr/lib/i386-linux-gnu/libXrender.so.1.3.0
b5ee9000-b5eea000 rw-p 00008000 08:05 11278108 /usr/lib/i386-linux-gnu/libXrender.so.1.3.0
b5eea000-b5eeb000 rw-p 00000000 00:00 0
b5eeb000-b6031000 r-xp 00000000 08:05 2370231 /cern/root/root-v5-34/lib/libNet.so
b6031000-b6032000 —p 00146000 08:05 2370231 /cern/root/root-v5-34/lib/libNet.so
b6032000-b6038000 r–p 00146000 08:05 2370231 /cern/root/root-v5-34/lib/libNet.so
b6038000-b603a000 rw-p 0014c000 08:05 2370231 /cern/root/root-v5-34/lib/libNet.so
b603a000-b6040000 rw-p 00000000 00:00 0
b6040000-b6368000 r-xp 00000000 08:05 2370117 /cern/root/root-v5-34/lib/libRIO.so
b6368000-b636e000 r–p 00327000 08:05 2370117 /cern/root/root-v5-34/lib/libRIO.so
b636e000-b6370000 rw-p 0032d000 08:05 2370117 /cern/root/root-v5-34/lib/libRIO.so
b6370000-b6372000 rw-p 00000000 00:00 0
b6372000-b63b7000 r-xp 00000000 08:05 2370058 /cern/root/root-v5-34/lib/libThread.so
b63b7000-b63b9000 r–p 00045000 08:05 2370058 /cern/root/root-v5-34/lib/libThread.so
b63b9000-b63ba000 rw-p 00047000 08:05 2370058 /cern/root/root-v5-34/lib/libThread.so
b63ba000-b63bb000 rw-p 00000000 00:00 0
b63bb000-b6605000 r-xp 00000000 08:05 2370230 /cern/root/root-v5-34/lib/libMathCore.so
b6605000-b6606000 —p 0024a000 08:05 2370230 /cern/root/root-v5-34/lib/libMathCore.so
b6606000-b660b000 r–p 0024a000 08:05 2370230 /cern/root/root-v5-34/lib/libMathCore.so
b660b000-b660e000 rw-p 0024f000 08:05 2370230 /cern/root/root-v5-34/lib/libMathCore.so
b660e000-b6612000 rw-p 00000000 00:00 0
b6612000-b661d000 r-xp 00000000 08:05 6292507 /lib/i386-linux-gnu/libnss_files-2.15.so
b661d000-b661e000 r–p 0000a000 08:05 6292507 /lib/i386-linux-gnu/libnss_files-2.15.so
b661e000-b661f000 rw-p 0000b000 08:05 6292507 /lib/i386-linux-gnu/libnss_files-2.15.so
b661f000-b6629000 r-xp 00000000 08:05 6292511 /lib/i386-linux-gnu/libnss_nis-2.15.so
b6629000-b662a000 r–p 00009000 08:05 6292511 /lib/i386-linux-gnu/libnss_nis-2.15.so
b662a000-b662b000 rw-p 0000a000 08:05 6292511 /lib/i386-linux-gnu/libnss_nis-2.15.so
b662b000-b6641000 r-xp 00000000 08:05 6292501 /lib/i386-linux-gnu/libnsl-2.15.so
b6641000-b6642000 r–p 00015000 08:05 6292501 /lib/i386-linux-gnu/libnsl-2.15.so
b6642000-b6643000 rw-p 00016000 08:05 6292501 /lib/i386-linux-gnu/libnsl-2.15.so
b6643000-b6645000 rw-p 00000000 00:00 0
b6645000-b664c000 r-xp 00000000 08:05 6292503 /lib/i386-linux-gnu/libnss_compat-2.15.so
b664c000-b664d000 r–p 00006000 08:05 6292503 /lib/i386-linux-gnu/libnss_compat-2.15.so
b664d000-b664e000 rw-p 00007000 08:05 6292503 /lib/i386-linux-gnu/libnss_compat-2.15.so
b664e000-b6651000 rw-p 00000000 00:00 0
b6651000-b667b000 r-xp 00000000 08:05 6292488 /lib/i386-linux-gnu/libm-2.15.so
b667b000-b667c000 r–p 00029000 08:05 6292488 /lib/i386-linux-gnu/libm-2.15.so
b667c000-b667d000 rw-p 0002a000 08:05 6292488 /lib/i386-linux-gnu/libm-2.15.so
b667d000-b6680000 r-xp 00000000 08:05 6292469 /lib/i386-linux-gnu/libdl-2.15.so
b6680000-b6681000 r–p 00002000 08:05 6292469 /lib/i386-linux-gnu/libdl-2.15.so
b6681000-b6682000 rw-p 00003000 08:05 6292469 /lib/i386-linux-gnu/libdl-2.15.so
b6682000-b68d6000 r-xp 00000000 08:05 2369282 /cern/root/root-v5-34/lib/libCint.so
b68d6000-b68d8000 r–p 00253000 08:05 2369282 /cern/root/root-v5-34/lib/libCint.so
b68d8000-b68db000 rw-p 00255000 08:05 2369282 /cern/root/root-v5-34/lib/libCint.so
b68db000-b6c66000 rw-p 00000000 00:00 0
b6c66000-b6ca0000 r-xp 00000000 08:05 6292529 /lib/i386-linux-gnu/libpcre.so.3.12.1
b6ca0000-b6ca1000 r–p 00039000 08:05 6292529 /lib/i386-linux-gnu/libpcre.so.3.12.1
b6ca1000-b6ca2000 rw-p 0003a000 08:05 6292529 /lib/i386-linux-gnu/libpcre.so.3.12.1
b6ca2000-b6ca3000 rw-p 00000000 00:00 0
b6ca3000-b6cb7000 r-xp 00000000 08:05 6292567 /lib/i386-linux-gnu/libz.so.1.2.3.4
b6cb7000-b6cb8000 r–p 00013000 08:05 6292567 /lib/i386-linux-gnu/libz.so.1.2.3.4
b6cb8000-b6cb9000 rw-p 00014000 08:05 6292567 /lib/i386-linux-gnu/libz.so.1.2.3.4
b6cb9000-b6e5d000 r-xp 00000000 08:05 6292456 /lib/i386-linux-gnu/libc-2.15.so
b6e5d000-b6e5f000 r–p 001a4000 08:05 6292456 /lib/i386-linux-gnu/libc-2.15.so
b6e5f000-b6e60000 rw-p 001a6000 08:05 6292456 /lib/i386-linux-gnu/libc-2.15.so
b6e60000-b6e63000 rw-p 00000000 00:00 0
b6e63000-b6e7a000 r-xp 00000000 08:05 6292536 /lib/i386-linux-gnu/libpthread-2.15.so
b6e7a000-b6e7b000 r–p 00016000 08:05 6292536 /lib/i386-linux-gnu/libpthread-2.15.so
b6e7b000-b6e7c000 rw-p 00017000 08:05 6292536 /lib/i386-linux-gnu/libpthread-2.15.so
b6e7c000-b6e7e000 rw-p 00000000 00:00 0
b6e7e000-b6e9a000 r-xp 00000000 08:05 6292477 /lib/i386-linux-gnu/libgcc_s.so.1
b6e9a000-b6e9b000 r–p 0001b000 08:05 6292477 /lib/i386-linux-gnu/libgcc_s.so.1
b6e9b000-b6e9c000 rw-p 0001c000 08:05 6292477 /lib/i386-linux-gnu/libgcc_s.so.1
b6e9c000-b6f74000 r-xp 00000000 08:05 11278627 /usr/lib/i386-linux-gnu/libstdc++.so.6.0.16[/quote]

this is my code

[code]gROOT->Reset();

#include “TFile.h”
#include “TTree.h”
#include “TBrowser.h”
#include “TRandom.h”
#include “TCanvas.h”
#include “TROOT.h”
#include “TH2D.h”
#include “TH1D.h”

void acqumacro() {

TFile *file1 = new TFile("Acqu_CBTaggTAPS_3976.root");
TTree *tree1 = (TTree*)file1->Get("treeTagger");

Double_t pb_E;
tree1->SetBranchAddress("photonbeam_E", &pb_E);

TH1D *a0 = new TH1D("PhotnonBeam", "Energy of incoming photon", 200, 100, 450);

Long64_t n_entries = (Long64_t)tree1->GetEntries();

for(Long64_t i = 0; i < n_entries; i++) {

	tree1->GetEntry(i);
	
	a0->Fill(pb_E);
}

TCanvas *c1 = new TCanvas();
a0->Draw();
}[/code]

The line:
gROOT->Reset();
does NOT belong there AT ALL.
Right before you return from your “acqumacro” routine, or just right after the filling loop, add:
tree1->ResetBranchAddresses();
Apart from the above, I see no problem in your macro.
I think we need your ROOT file (“Acqu_CBTaggTAPS_3976.root”) in order to proceed.

BTW. All branches of a TTree should have exactly the same number of entries. If not, the one who created this TTree made a terrible mistake.

Ok so here is the appended code:

[code]#include “TFile.h”
#include “TTree.h”
#include “TBrowser.h”
#include “TRandom.h”
#include “TCanvas.h”
#include “TROOT.h”
#include “TH2D.h”
#include “TH1D.h”

void acqumacro() {

TFile *file1 = new TFile("Acqu_CBTaggTAPS_3976.root");
TTree *tree1 = (TTree*)file1->Get("treeTagger");

Double_t pb_E;
tree1->SetBranchAddress("photonbeam_E", &pb_E);

TH1D *a0 = new TH1D("PhotnonBeam", "Energy of incoming photon", 200, 100, 450);

Long64_t n_entries = (Long64_t)tree1->GetEntries();

for(Long64_t i = 0; i < n_entries; i++) {

	tree1->GetEntry(i);
	
	a0->Fill(pb_E);
}

tree1->ResetBranchAddresses();

TCanvas *c1 = new TCanvas();
a0->Draw();
}[/code]

I am having trouble uploading the .root file seeing as it is 1.5 gigs and I’ve tried compressing it but that doesn’t work. So I have attached some photos to show the situation.

Under the same Tree there are two branches (highlighted) and both have different number of entries.




Try:
root [0] TFile *f = new TFile(“Acqu_CBTaggTAPS_3976.root”);
root [1] treeTagger->Print(); > treeTagger.Print.out.txt
root [2] .q
and post here the file “treeTagger.Print.out.txt”.

So something like this?

[quote]*Tree :treeTagger: treeTagger *
*Entries : 2043872 : Total = 2774627618 bytes File Size = 1290587421 *

  •    :          : Tree compression factor =   2.15                       *
    

*Br 0 :nTagged : nTagged/I *
*Entries : 2043872 : Total Size= 8194790 bytes File Size = 2439916 *
*Baskets : 190 : Basket Size= 51200 bytes Compression= 3.36 *

*Br 1 :photonbeam_E : photonbeam_E[nTagged]/D *
*Entries : 2043872 : Total Size= 1104934835 bytes File Size = 243723009 *
*Baskets : 982 : Basket Size= 5097472 bytes Compression= 4.53 *

*Br 2 :tagged_ch : tagged_ch[nTagged]/I *
*Entries : 2043872 : Total Size= 556566966 bytes File Size = 209438119 *
*Baskets : 610 : Basket Size= 2567168 bytes Compression= 2.66 *

*Br 3 :tagged_t : tagged_t[nTagged]/D *
*Entries : 2043872 : Total Size= 1104930891 bytes File Size = 834958326 *
*Baskets : 982 : Basket Size= 5096960 bytes Compression= 1.32 *

[/quote]

Your “photonbeam_E” branch is a variable length array of “Double_t” values (the actual length, “treeTagger” entry number specific, is given by the “nTagged” branch as an “Int_t” value), so it is not a simple “Double_t” variable.

Ok so I’m not sure where to proceed from this point. I used TTree::MakeClass and generated two files, but I’m not sure how to generate an “analysis skeleton”. Do I simply use the .h and .C files produced?

Actually I manage to figure it out. Thank you for all the help

Hello! Is it possible you can post the whole code and the directionary that contains the files ? Would be nice to have as an example