Problem accesing tree data in makeclass Loop

Hi,
I am experiencing issues while trying to access data stored in Ttree.
I am using Loop function in makeClass. My Ttree consists of:

// Declaration of leaf types
   Int_t           info_iev;
   Int_t           info_len1;
   Int_t           info_len2;
   Int_t           info_len3;
   Int_t           info_len4;
   Int_t           info_loop;
   ULong64_t       info_trigTime;
   Double_t        info_xscale[4];
   Double_t        info_yscale[4];
   Double_t        info_yoffset[4];
   //Float_t         info_timer1;
   //Float_t         info_timer2;
   Short_t         y1[20002];   //[len1]
   Short_t         y2[0];   //[len2]
   Short_t         y3[20002];   //[len3]
   Short_t         y4[0];   //[len4]
   Int_t           debug;
   Int_t           fMode;

when i try to access data, i get the right values for all but info_xscale and info_yscale.
The two arrays return the same incorrect value everytime. I am trying to access these arrays with the following code:

for (Long64_t jentry=1; jentry<nentries;jentry++) 
   {  
      Long64_t ientry = LoadTree(jentry);
      if (ientry < 0) break;
      nb = fChain->GetEntry(jentry);   nbytes += nb;
      fChain->Show(jentry);
      for (int i=0; i<4; i++) {
        cout<<info_xscale[i]<<"\n";
      }

when creating a tree I set the problematic branch like this:

T2c->Branch("info", &info, "iev/I:len1/I:len2/I:len3/I:len4/I:loop/I:trigTime/l:xscale[4]/D:yscale[4]/D:yoffset[4]/D");

When using fChain->Show(jentry) function I get the output that has correct values for all leafs. the problem only occurs when trying to access individual array od info_xscale and info_yscale.
I assume the problem is in how I access these arrays, since the Tree seems to be initialized correctly.
I would appriciate any advice on how to approach these problem.
Thank you in advance.

_ROOT Version: 6.28/00
Platform: Not Provided
Compiler: Not Provided


The “y2[0]” and “y4[0]” look weird.
Attach your ROOT file for inspection.

Welcome to the ROOT Forum!
And you don’t have issues with info_yoffset and other arrays? Can you try to change the type of info_trigTime to ULong_t?

Thank you for your response!
The files are quite large. The zero length of some y arrays is ok, this is so because the program that crates the tree samples multiple oscilloscope channels. The ones set not to be sampled result in eg. “y4[0] ”.
I can attach a file if you still think it is necessary.

Try:

// ...
   Int_t           dummy_align_8B;   //!
// Declaration of leaf types
   Int_t           info_iev;
// ...
1 Like

Thank you for replying!
Actually, the same issue is with info_yoffset, I just haven’t noticed it, because if ALL info_yoffset array elements are zero (0), the values returned are also 0 - correct. This was almost always the case. Otherwise, the values returned are eg.

info_yoffset[i]=

5.25596e-315
-1.49167e-154
5.28452e-315
0
and similar for info_xscale and info_yscale as well.
The y1,y2,y3,y4 arrays are ok.
Also, tried changing info_trigTime as proposed, unfortunately doesn’t result in any change, but was helpful to remind me that info_trigTime is also returned incorrectly (no matter the datatype).

// …
Int_t dummy_align_8B; //!
// Declaration of leaf types
Int_t info_iev;
// …

Thank you, this makes everything work as it should!
How did you think of this?

I assumed that before the “Declaration of leaf types”, you only had (8 + 4 Bytes): TTree *fChain; Int_t fCurrent;
I added another “Int_t” (4 Bytes) to make the “info_iev” (and then also the arrays) aligned at the 8 Bytes boundary.

1 Like