i’m fitting several histograms in a loop and would like to
add them to a legend. the problem is that all of the entries
have the same color as the last entry. the way i solved this
in root 3.04.02 is to copy the resultant TF1 and add that.
the relevant part of the code looks like…
for(int i=0;i<nCriteria;i++){
…
ksMassFits[i] = new TF1(*massFit);
leg->AddEntry(ksMassFits[i] ,criteriaNames[i],“l”);
…
}
however in root 3.10-01 this causes a crash. i’ve also
updated gcc to 3.3.2 so i can’t rule out the possibility that
it’s a gcc problem.
the dump looks like…
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1085104000 (LWP 9519)]
0x01f49276 in free () from /lib/tls/libc.so.6
(gdb) where
#0 0x01f49276 in free () from /lib/tls/libc.so.6
#1 0x03ffc233 in operator delete(void*) () from /usr/lib/libstdc++.so.5
#2 0x03ffc28f in operator delete () from /usr/lib/libstdc++.so.5
#3 0x0016b0fd in TF1::Copy(TObject&) const () from /usr/local/root_v3.10-01/lib/libHist.so
#4 0x00178c19 in TFormula::TFormula(TFormula const&) () from /usr/local/root_v3.10-01/lib/libHist.so
#5 0x0016ae7f in TF1::TF1(TF1 const&) () from /usr/local/root_v3.10-01/lib/libHist.so
#6 0x08053e7f in go(char*) (collection=0xbff09870 “Data”) at TObject.h:154
#7 0x08052765 in main (argc=2, argv=0xbfe30f64) at src/KsCombinedStudy.cc:10
does anyone know of the “correct” way to do what i’m trying to do?
thanks,
alex.