fTotBytes error

I have recently started using root again after a break of about 6 months. Now, whenever I run a program and try to write a tree I get the following error:

Error in TStreamerInfo::WriteBuffer: The element TTree::fTotBytes type 236 (Long64_t) is not supported yet

This happens with both new programs and ones previously working. I have recently updated my mac to mountain lion, and downloaded the new root patch.

Any clues as to why this has arisen would be appreciated!

Hi,

This is odd. Can you send a complete example reproducing the problem? (The error message technically indicates that the ‘current’ class layout of TTree is marked to be schema evolved)

Philippe.

Ok, so here are the (i think) important bits of my code:

[code]#include
#include
#include
#include
#include <string.h>
#include <stdio.h>
#include “TDatime.h”
#include “TTree.h”
#include “TFile.h”
#include “TSystem.h”
#include “TString.h”
#include

void Autocorrelation()
{
std::string output=“Auto”;
std::string title=“Auto”;
const int N=60, taumax=10;
int ret=-1, i=0, tau=0;
float u[N]=0, u1[N]=0, u12[N]=0, ubar=0, u12bar=0,
u22[taumax]=0, u22bar=0, R=0, in;
TFile fc2012((output+".root").c_str(),“recreate”); //creates new ROOT file
TTree tc2012(output.c_str(),title.c_str()); //creates new tree
//tc2011.Branch(“u”,&u,“u/F”);
//tc2011.Branch(“u1”,&u1,“u1/F”);
tc2012.Branch(“R”,&R,“R/F”);
tc2012.Branch(“tau”,&tau,“tau/F”);

FILE *file = fopen("./3rdYearLab/WindTurbulence/random.csv","r");
for(i = 0; i < N; i++)
{
    ret = fscanf(file,"%g%*c",&in);

blah blah blah
tc2012.Fill();
tc2012.Print(); //print tree in terminal
tc2012.Write(); //write tree to file
fclose(file); //close file
}
}[/code]

Hi,

As is, this code snippet can not (should not) issue the error message you have shown. There is no reading of an old ROOT file that could trigger the use schema evolution … So there is still something missing.

Philippe.

Instead of “TFile fc2012(…);” try “TFile *fc2012 = new TFile(…);” and instead of “TTree tc2012(…);” try "TTree *tc2012 = new TTree(…);"
Note: the “for” loop should end after “tc2012->Fill();” and before "tc2012->Print();"
The last four lines should be:
tc2012->Write(); // write the tree to the output file
delete fc2012; // close the output file (DO NOT try to delete the tc2012 tree manually!!!)
fclose(file); // close the input file
See also: [url]GetEntry() crash in second using

Ok, this is the whole thing. It still produces the error, having made the changes suggested.

[code]#include
#include
#include
#include
#include <string.h>
#include <stdio.h>
#include “TDatime.h”
#include “TTree.h”
#include “TFile.h”
#include “TSystem.h”
#include “TString.h”
#include

void Autocorrelation()
{
std::string output=“Auto”;
std::string title=“Auto”;
const int N=60, taumax=10;
int ret=-1, i=0, tau=0;
float u[N]=0, u1[N]=0, u12[N]=0, ubar=0, u12bar=0,
u22[taumax]=0, u22bar=0, R=0, in;
TFile *fc2012 = new TFile((output+".root").c_str(),“recreate”); //creates new ROOT file
TTree *tc2012 = new TTree(output.c_str(),title.c_str()); //creates new tree
//tc2011.Branch(“u”,&u,“u/F”);
//tc2011.Branch(“u1”,&u1,“u1/F”);
tc2012.Branch(“R”,&R,“R/F”);
tc2012.Branch(“tau”,&tau,“tau/F”);

FILE *file = fopen("./3rdYearLab/WindTurbulence/random.csv","r");
for(i = 0; i < N; i++)
{
    ret = fscanf(file,"%g%*c",&in);
    u[i] = in;
    //cout <<i<<" "<<u[i]<<endl;
    ubar += (u[i]/N);
  
}

//cout<<ubar<<endl;


for (i = 0; i < N; i++)
{
    u1[i] = u[i]-ubar;
    u12[i] = (u1[i])*(u1[i]);
    u12bar += (u12[i]/N);
    //cout<<i<<" "<<u1[i]<<" "<<u12[i]<<endl;
}
//cout<<u12bar<<endl;                               //good to here

for(tau=0;tau<=taumax;tau++)
{
    u22[tau]=0;
    //cout<<"tau="<<tau<<endl;
    for(i=0;i<(N-(tau));i++)
    {
        //cout<<u22[tau]<<endl;
        u22[tau] += (u1[i])*(u1[i+tau]);
        //cout<<u22[tau]<<" "<<u1[i]<<" "<<u1[i+tau]<<endl;
    }

    u22bar = u22[tau]/(N-(tau));
    R=(u22bar)/(u12bar);
    cout << R <<endl;
    tc2012.Fill();
}


tc2012.Print(); //print tree in terminal
tc2012.Write(); //write tree to file
delete fc2012;
fclose(file); //close file

}[/code]

And the “random.csv”? :wink:

[code]#include “TFile.h”
#include “TTree.h”
#include “TRandom.h”

#include
#include
#include

void Autocorrelation()
{
std::string output=“Auto”;
std::string title=“Auto”;
const int N=60, taumax=10;
int ret=-1, i=0, tau=0;
float u[N]={0}, u1[N]={0}, u12[N]={0}, ubar=0, u12bar=0;
float u22[taumax]={0}, u22bar=0, R=0, in;
TFile *fc2012 = new TFile((output+".root").c_str(),“recreate”); //creates new ROOT file
TTree *tc2012 = new TTree(output.c_str(),title.c_str()); //creates new tree
//tc2011.Branch(“u”,&u,“u/F”);
//tc2011.Branch(“u1”,&u1,“u1/F”);
tc2012->Branch(“R”,&R,“R/F”);
tc2012->Branch(“tau”,&tau,“tau/F”);

FILE *file = fopen("./3rdYearLab/WindTurbulence/random.csv",“r”);
if (!file) std::cout << “Autocorrelation: Warning: Using FAKE data!” <<std::endl;
for(i = 0; i < N; i++)
{
if (file) ret = fscanf(file,"%g%*c",&in);
else in = gRandom->Rndm();
u[i] = in;
//std::cout <<i<<" "<<u[i]<<std::endl;
ubar += (u[i]/N);
}

//std::cout<<ubar<<std::endl;

for (i = 0; i < N; i++)
{
u1[i] = u[i]-ubar;
u12[i] = (u1[i])*(u1[i]);
u12bar += (u12[i]/N);
//std::cout<<i<<" “<<u1[i]<<” "<<u12[i]<<std::endl;
}
//std::cout<<u12bar<<std::endl; //good to here

for(tau = 0; tau < taumax; tau++)
{
u22[tau]=0;
//std::cout<<“tau=”<<tau<<std::endl;
for(i=0;i<(N-(tau));i++)
{
//std::cout<<u22[tau]<<std::endl;
u22[tau] += (u1[i])*(u1[i+tau]);
//std::cout<<u22[tau]<<" “<<u1[i]<<” "<<u1[i+tau]<<std::endl;
}

  u22bar = u22[tau]/(N-(tau));
  R=(u22bar)/(u12bar);
  std::cout << R <<std::endl;
  tc2012->Fill();
}

tc2012->Print(); //print tree in terminal
tc2012->Write(); //write tree to file
delete fc2012;
if (file) fclose(file); //close file
}[/code]
BTW. Always try to precompile your source code using ACLiC (this will check the “C++ validity” of your source code), e.g. using something like:
root [0] .L YourMacro.cxx++
And try to run your code using valgrind:
valgrind --tool=memcheck --leak-check=full [–show-reachable=yes] [–num-callers=50] [–track-origins=yes] [–db-attach=yes] --suppressions=root-config --etcdir/valgrind-root.supp root-config --bindir/root.exe -l -q 'YourMacro.cxx[++][(Any, Parameters, You, Need)]'
or:
valgrind --tool=memcheck --leak-check=full [–show-reachable=yes] [–num-callers=50] [–track-origins=yes] [–db-attach=yes] --suppressions=root-config --etcdir/valgrind-root.supp YourExecutable [Any Options You Need]
and especially carefully study messages that appear in the beginning of the output.
(Note: the “–show-reachable=yes” option will give you too many warnings, I believe.)
Last, but not least, always try to post “complete test source code” (including required data files, or modify it so that no separate data files are needed) which one could run in order to reproduce your problem.

Hmmm, it won’t let me upload a .csv file. The file is just a randomly generate list of 60 no.s between 0 and 3.0.

Having made the adjustments you suggested, I still get the same error, before and after the tree is printed in terminal.

Try to run the source code that I posted (in my previous post) without any modifications. If you still get problems, attach the “random.csv” file, renaming it into “random.csv.txt”.

Still the same error. Here is “random”.
random.csv.txt (239 Bytes)

I have no problems running my example source code on your data file (tried on 32-bit and 64-bit machines, ROOT 5.28 and 5.34): [code]root [0] .x Autocorrelation.cxx
1
-0.0760724
-0.00429676
-0.156983
0.18371
-0.145474
-0.0390198
-0.0862693
0.0368508
-0.15021


*Tree :Auto : Auto *
*Entries : 10 : Total = 1593 bytes File Size = 0 *

  •    :          : Tree compression factor =   1.00                       *
    

*Br 0 :R : R/F *
*Entries : 10 : Total Size= 650 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *

*Br 1 :tau : tau/F *
*Entries : 10 : Total Size= 662 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32000 bytes Compression= 1.00 *
[/code]
I’m afraid you need to report details of your operating system, compiler version, ROOT version.

and content of a rootlogon.C if any and result of running valgrind …

and the result of:
root-config --bindir
ldd root-config --bindir/root.exe
root-config --libdir
ldd root-config --libdir/libTree.so
root-config --etcdir
(I started to suspect that there is a version mismatch between different ROOT libraries and executables.)