- changed status to resolved
Comparator segfaulting when comparing samplers
The comparator is currently not comparing samplers. I've attached a zip with two gmad files, one with just a drift, the other with a quadrupole (both elements called d1). Both have the same beam (reference + X offset), therefore the same primaries.
Also in the zip file is two root files, one generated from each gmad file (t1_event from drift.gmad, t2_event from quad.gmad). Running the comparator on these two files, it passes, which it shouldn't.
Looking into it slightly, in Compare.cc, lines 303-304, two new Events are instantiated:
Event* evtLocal1 = new Event();
Event* evtLocal2 = new Event();
The event class has default constructors which have debug and processSamplers bools both set to be false. In Event.cc, the processSamplers bool needs to be true to process the samplers, so I've changed my local copy to instantiate the classes and set the processSamplers to be true:
Event* evtLocal1 = new Event(false,true);
Event* evtLocal2 = new Event(false,true);
Recompiling, the comparator then segfaults once executed:
dhcp232:1_drift williamshields$ comparator t1_event.root t2_event.root
Error in <TTree::SetBranchAddress>: unknown branch -> d1
Error in <TTree::SetBranchAddress>: unknown branch -> d1
*** Break *** segmentation violation
Generating stack trace...
0x0000000104280bb4 in Compare::EventTree(TTree*, TTree*, std::__1::vector<Result*, std::__1::allocator<Result*> >&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, st
0x000000010427fd8b in Compare::Trees(TTree*, TTree*, std::__1::vector<Result*, std::__1::allocator<Result*> >&) (in libcomparator.dylib) (vector:473)
0x000000010427f1ce in Compare::Directories(TDirectory*, TDirectory*, std::__1::vector<Result*, std::__1::allocator<Result*> >&) (in libcomparator.dylib) (Compare.cc:92)
0x000000010427ee8f in Compare::Files(TFile*, TFile*) (in libcomparator.dylib) (Compare.cc:40)
0x000000010426f48c in main (in comparator) (comparator.cc:47)
0x00007fff8c4e75c9 in start (in libdyld.dylib) + 1
Beyond this, I'm unsure where the problem lies.
Comments (5)
-
-
reporter - changed status to open
Unfortunately, having pulled the changes, and recompiled, I'm still seeing the same error:
dhcp232:1_drift williamshields$ comparator t1_event.root t2_event.root Error in <TTree::SetBranchAddress>: unknown branch -> d1 Error in <TTree::SetBranchAddress>: unknown branch -> d1 *** Break *** segmentation violation Generating stack trace... 0x0000000101be5b94 in Compare::EventTree(TTree*, TTree*, std::__1::vector<Result*, std::__1::allocator<Result*> >&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, st 0x0000000101be4d4b in Compare::Trees(TTree*, TTree*, std::__1::vector<Result*, std::__1::allocator<Result*> >&) (in libcomparator.dylib) (vector:473) 0x0000000101be418e in Compare::Directories(TDirectory*, TDirectory*, std::__1::vector<Result*, std::__1::allocator<Result*> >&) (in libcomparator.dylib) (Compare.cc:92) 0x0000000101be3e4f in Compare::Files(TFile*, TFile*) (in libcomparator.dylib) (Compare.cc:40) 0x0000000101bd148c in main (in comparator) (comparator.cc:47) 0x00007fff8c4e75c9 in start (in libdyld.dylib) + 1 0x0000000000000003 in <unknown function>
-
This happens only when using old data files after the fixes above. The error is due to an inconsistency between the sampler name stored in the Model tree versus the actual branch name in the Event tree for the sampler. Since this has been fixed, any new data will be consistent.
Can you confirm this is fixed now please.
-
reporter Yes, this is now fixed, thanks.
-
- changed status to resolved
Agreed to be closed as resolved.
- Log in to comment
Fix Issue
#177. Samplers weren't processed in the comparator. They now are automatically if there are any. Remove old code.→ <<cset ae82eb1911d0>>