Multiple ROOT files

Hello,

I’m trying to write several different root files from a single output file. This is gamma-gamma coincidence data that I’d like to split apart for each detector and each coincidence set to work with separately; however, the code I’ve written compiles but and runs without error except all the root files are empty with exception to the last root file I declare. Not sure what this error is but would love some assistance in resolving it so I don’t have to reread the file for every file I want to generate.
TPixieReader.cpp (30 KB)

Well…don’t I feel dumb. Tough tell root trees where to go if your not writing to the right directory. I just needed to preface the TTree* ->Fill(); command with the respective TFile* ->cd(); command. It still didn’t work when I did that without rearranging the declarations of the individual trees to subsequent the file declarations. The differences are small nuances. I’ve attached the new working code for anyone else who runs into a similar issue.
TPixieReader.cpp (30.1 KB)