I am trying to load a root file in a TChain. The root file contains a Tree with my own event class in it.
I load the event class into ROOT (The exact same file as was used in the module that made the tree), and then when I call GetEntries I get issues.
root [0] .L SMTracks.cxx
root [1] ana::smts* track_rec=0
(ana::smts *) nullptr
root [2] auto ch=new TChain("StopMuonFilter3x1x1/TrackRecords");
root [3] ch->SetBranchAddress("TrackRecordBranch", &track_rec);
root [4] ch->Add("~/wa105-r1002-s1-StopMuonFilter.root")
(int) 1
root [5] auto nEntries=ch->GetEntries();
Warning in <TStreamerInfo::Build>: pair<double,double>: base class __pair_base<double,double> has no streamer or dictionary it will not be saved
root [6] nEntries
(long long) 335
root [7] ch->GetEntry(0)
Error in <TClass::New with placement>: cannot create object of class ana::smtrec::sp version 1 at address 0x557d1308fa40
Error in <TClass::New with placement>: cannot create object of class ana::smtrec::sp version 1 at address 0x557d1308fa58
Error in <TClass::New with placement>: cannot create object of class ana::smtrec::sp version 1 at address 0x557d1308fa70
Error in <TClass::New with placement>: cannot create object of class ana::smtrec::sp version 1 at address 0x557d1308fa88
Error in <TClass::New with placement>: cannot create object of class ana::smtrec::sp version 1 at address 0x557d1308faa0
When I try compiling my event class at loading, I have a different problem.
In file included from /home/USER/Documents/GROUP/ROOT/MODULE/CLASS_cxx_ACLiC_dict.cxx:31:
/usr/include/root/TCollectionProxyInfo.h: In instantiation of ‘static void* ROOT::Detail::TCollectionProxyInfo::Type<T>::construct(void*, std::size_t) [with T = std::vector<ana::smtrec::sp>; std::size_t = long unsigned int]’:
/usr/include/root/TCollectionProxyInfo.h:568:17: required from ‘static ROOT::Detail::TCollectionProxyInfo* ROOT::Detail::TCollectionProxyInfo::Generate(const T&) [with T = ROOT::Detail::TCollectionProxyInfo::Pushback<std::vector<ana::smtrec::sp> >]’
/home/USER/Documents/GROUP/ROOT/3x1x1_Tracks/SMTracks_cxx_ACLiC_dict.cxx:417:131: required from here
/usr/include/root/TCollectionProxyInfo.h:334:13: error: no matching function for call to ‘ana::smtrec::sp::sp()’
It looks like for some reason ROOT is calling a default constructor? I specifically DO NOT have a default constructor for this class. Adding one would make no sense.
Can someone help me understand these errors? I believe my code for the event class file is identical to the version used to make the ROOT file I am loading.