Incompatible problem (32bit v.s 64bit) when reading data fro

Hi All

I want to extract some information from a data sample, which is
generated in a 32bit machine using ROOT 5.18 (or even earlier, not
quite sure).

First I use function:MakeClass to generate necessary files
(OutputTree_.h, OutputTree.C). Then I open the data file and use a
pointer to get the value I need.

The code is like this:

80 TString inputfile(argv[1]);
81 TFile f(inputfile,“read”);
82 TTree *t = (TTree *) f.Get(“OutputTree_”);
83
84 if(!t){
85 cout<<"No OutputTree_ tree found in "<<inputfil
<<endl;
86 exit(1);
87 }
88
89 p = new OutputTree_(chain);

38 NEvent = p->fChain->GetEntries();
39 cout<<“Found “<<NEvent<<” events.\n”;
40

42 for (int i=0; i<NEvent; i++) {
43 get_event(i);
45 cout<<( p->JetInvMasses_flagCenteralJetVeto)<<endl;
46 cout<<( p->JetInvMasses_deltaEtaJ1J2)<<endl;
47 cout<<( p->JetInvMasses_mJ1J2)<<endl;
48 cout<<( p->JetInvMasses_eta1stJ)<<endl;
cout<<( p->JetInvMasses_pt1stG)<<endl;
52 }
55 }

If I compile and run this program on a 64-bit machine, then I get
funny values for some of the variables ( JetInvMasses_eta1stJ,
JetInvMasses_mJ1J2 etc). It looks like they are not properly
initialized. However, other variables, like JetInvMasses_pt1stG, get
right value just as expected.

In contrast, in a 32 bit machine, the analysis code works just fine
and assigns all of the variables the right value.

I have no idea how can this kind of things happen. All the variables
I used are double_t or float_t type, which has the same length in both
32bit and 64bit machines.I don’t think any part of my codes depends on
architecture. And I linked the right version of ROOT for 32bit and
64bit machine, respectively. So I am writing to see if you have any
clue.

The ROOT I used to do the analysis is ROOT v5.24.

Attached is my codes( OutputTree_.h, OutputTree_.C check.C) and the
data sample I used can be found at /afs/cern.ch/user/y/yangsuli/public

Thank you.
readfile.C (1.76 KB)
OutputTree_.C (1.43 KB)
OutputTree_.h (7.82 KB)

Hi,

The problem is that you created the TTree using the leaflist method of branch creation with more than one variable per branch and did not sort the variable in decreasing order of ‘sizeof’; This is known to not be portable across different architecture. To solve the problem you would need to rewrite your file either sorting the variable or, better yet, by using compiled object instead.

Cheers,
Philippe.