Using class to store and read data in root/5.34.11

Dear Roottalk,

I recently moved from root version 5.34.05 to 5.34.11 and it seems like I cannot use a class in a branch to store data anymore.
To be more specific here is what I do:
In geant4 I write my data into a root file instead of an ascii file, so in my Steppingaction.cc I create a class called “Secondaries” and write all the data I would like to have into the SecondariesClass variables. So far so good, when I open my rootfile with root and open the Browser it shows correct data. But when I try to access the class-variables via a root-analysis script it somehow cannot access the variables anymore and doesnt give me any value back.
Please take a look at my attachements, the first file is a summary of how I write my data into a rootfile in geant4, the second one is my not working analysis file and the third one is an example of my output file.
The weird thing is that calling the variable with Secondaries. worked in 4.34.05, what could cause this malfunction?

Thanks,
Martin
Output1_1.root (371 KB)
RootFileRead.C (3.38 KB)
root_class_summary.txt (3.19 KB)

Try with:
Secondaries_data->SetBranchAddress(“SecondariesBranch”, &(Secondaries.xPre_S));

Also, in the end of your “treeSec” routine (just before your return from it) add:
Secondaries_data->ResetBranchAddresses();

BTW. Maybe you should simply create your branch, in your “SteppingAction” constructor, using:
sec_Tree->Branch(“SecondariesBranch”, &Secondaries);
See “==> Case C” and “==> Case B” in the “TTree” class description.

Thanks so much Wile E., your suggestions worked right away. Also big thanks for answering so fast! :smiley: