Clone of TrigConfTree


I was hoping someone might be able to answer a problem I’ve been having. I’m making some selections on a physics tree in my data, and copying out a subset of that tree to my output file. My problem is that I also want to copy the trigger configuration tree “physicsMeta/TrigConfTree” to the output file… this should be straightforward of course, the snippet of my code is

<once I attach m_TrigTChain to my input files.....>  
TFile *copyFile = new TFile("SelectedEvents.root","Recreate");
TTree* newTree = m_TrigTChain->CloneTree();

but this generates a segfault on the call to CloneTree.

I’m under the impression from your example( I need to call SetBranchAddress on the original tree, before calling CloneTree… I’m not clear what arguments I need to supply in this case. I tried using some dummy TObject I create there like so

TObject* tobj = new TObject();
TTree* newTree = m_TrigTChain->CloneTree();

but this also segfaults in the same way (stacktrace below). I also tried using CloneTree(-1,“fast”), but this causes a “double free or corruption” error as my program terminates (but appears to properly save what I want in my SelectEvents.root), I am guessing for similar reasons. All I want to do is copy that entire chain, m_TrigTChain into this new file SelectedEvents.root.

Sorry for the probably trivial question, and thanks for your help.


There was a crash (#7 0xf4972ced in SigHandler(ESignals) () from /cvmfs/
This is the entire stack trace of all threads:

#0 0xffffe410 in __kernel_vsyscall ()
#1 0xf3d95cb3 in __waitpid_nocancel () from /lib/
#2 0xf3d3a62b in do_system () from /lib/
#3 0xf3e6bf3d in system () from /lib/
#4 0xf496d6ed in TUnixSystem::Exec(char const*) () from /cvmfs/
#5 0xf4973377 in TUnixSystem::StackTrace() () from /cvmfs/
#6 0xf4972bdf in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/
#7 0xf4972ced in SigHandler(ESignals) () from /cvmfs/
#8 0xf4969f12 in sighandler(int) () from /cvmfs/
#10 0xf5cae6f0 in std::_Rb_tree<std::basic_string<char, std::char_traits, std::allocator >, std::pair<std::basic_string<char, std::char_traits, std::allocator > const, int>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, int> >, std::less<std::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, int> > >::_M_erase(std::_Rb_tree_node<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, int> >) () from /cvmfs/
#11 0xf59695dc in ROOT::TCollectionProxyInfo::Type<std::map<std::basic_string<char, std::char_traits, std::allocator >, int, std::less<std::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::basic_string<char, std::char_traits, std::allocator > const, int> > > >::clear(void
) () from /afs/
#12 0xf59f6f65 in TGenCollectionProxy::Allocate(unsigned int, bool) () from /cvmfs/
#13 0xf79e6d99 in TBranchElement::ReadLeavesCollection(TBuffer&) () from /cvmfs/
#14 0xf79d7291 in TBranch::GetEntry(long long, int) () from /cvmfs/
#15 0xf79dec40 in TBranchElement::GetEntry(long long, int) () from /cvmfs/
#16 0xf7a32a3c in TTree::GetEntry(long long, int) () from /cvmfs/
#17 0xf79fa5d2 in TChain::GetEntry(long long, int) () from /cvmfs/
#18 0xf7a39701 in TTree::CopyEntries(TTree*, long long, char const*) () from /cvmfs/
#19 0xf7a3c2f6 in TTree::CloneTree(long long, char const*) () from /cvmfs/
#20 0xf58bd181 in HZZAnalysis::runCutFlow (this=AttributeError: ‘module’ object has no attribute ‘objfile_hook’
#21 0x0804dc25 in main (argc=1, argv=0xff80d214) at …/util/H4lAnalysis.cxx:52


Were you able to resolve this issue (a priori you needed to make sure that you had loaded all the library you needed since some where already loaded).