Hi all, this is probably a pretty simple one for most but I’m really struggling with this one. I suck at reading root file. Anyway here is the issue. I have data in a root file like so:
I am trying to get the objects in PanelDIGI out. But I just cannot figure it out.
I have tried:
TFile* f = get_file(1); TTreeReader* t=new TTreeReader("a2MC",f); std::cout << "Number of events: " << t->GetEntries() << "\n"; TTreeReaderValue<a2mcPanelDIGI> panelDIGI(*t, "PanelDIGI"); t->Next();
which results in
Error in <TTreeReaderValueBase::CreateProxy()>: The branch PanelDIGI contains data of type TClonesArray. It cannot be accessed by a TTreeReaderValue<a2mcPanelDIGI>
std::unique_ptr<TFile> myFile( TFile::Open("../root/a2MC-2023-01-30-09-33-25_0.root") ); auto tree = myFile->Get<TTree>("a2MC"); a2mcPanelDIGIvariable; tree->SetBranchAddress("PanelDIGI", &variable); tree->GetEntry(0);
Error in <TTree::SetBranchAddress>: The address for "PanelDIGI" should be the address of a pointer! Error in <TTree::SetBranchAddress>: The pointer type given (a2mcPanelDIGI) does not correspond to the class needed (TClonesArray) by the branch: PanelDIGI
If anyone could help that would be great.
Please read tips for efficient and successful posting and posting code
ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided