Bad regular expression from FitSlicesY

Hello everybody,
I have tried to use the function FitSlicesY on a TH2F histogram, with root v3.05.07 on lxplus at CERN. What I get is a segmentation violation and the error “Bad Regular Expression”.

In the attachment you can find the root file with the histogram and at the end of the message the commands I gave and the output I got.

Can you please tell me how I can use this function in a proper way?


P.S. I wanted to try the new version 3.10.01, but the directory /afs/ is empty…

root [0] TFile *f = new TFile(“Histo.root”)
root [1] TH2F clw = (TH2F)gDirectory->Get(“El_clw”)
root [2] clw->FitSlicesY(0,0,0,20)
Error in TRegexp::Index: Bad Regular Expression

*** Break *** segmentation violation
Generating stack trace…
0x401dbdab in TUnixSystem::StackTrace(void) + 0x25b from /afs/
0x401da902 in TUnixSystem::DispatchSignals(ESignals) + 0xb2 from /afs/
0x401d999f in from /afs/
0x401dd679 in from /afs/
0x42029188 in from /afs/
0x408010d3 in TH2::FitSlicesY(TF1 *, int, int, int, char const *) + 0x427 from /afs/
0x408d0b81 in from /afs/
0x405f72ed in G__call_cppfunc + 0x281 from /afs/
0x405e685d in G__interpret_func + 0x895 from /afs/
0x405cc215 in G__getfunction + 0x16f5 from /afs/
0x4065c0eb in G__getstructmem + 0x7c3 from /afs/
0x40654ee2 in G__getvariable + 0x636 from /afs/
0x405c32e5 in G__getitem + 0x6e9 from /afs/
0x405c18a5 in G__getexpr + 0x8e05 from /afs/
0x4060e96d in G__exec_function + 0x169 from /afs/
0x406160bc in G__exec_statement + 0x2f3c from /afs/
0x405a8ec3 in G__exec_tempfile_core + 0x313 from /afs/
0x405a9072 in G__exec_tempfile_fp + 0x22 from /afs/
0x4061e95b in G__process_cmd + 0x4e9f from /afs/
0x401846ae in TCint::ProcessLine(char const *, TInterpreter::EErrorCode *) + 0x9a from /afs/
0x40105f97 in TApplication::ProcessLine(char const *, bool, int *) + 0x56b from /afs/
0x40de4cc7 in TRint::HandleTermInput(void) + 0x127 from /afs/
0x40de3ff0 in TTermInputHandler::Notify(void) + 0x28 from /afs/
0x40de5327 in TTermInputHandler::ReadNotify(void) + 0x13 from /afs/
0x401dacf7 in TUnixSystem::CheckDescriptors(void) + 0x113 from /afs/
0x401da40a in TUnixSystem::DispatchOneEvent(bool) + 0x112 from /afs/
0x40154b29 in TSystem::InnerLoop(void) + 0x1d from /afs/
0x40154abe in TSystem::Run(void) + 0x7e from /afs/
0x40106b25 in TApplication::Run(bool) + 0x31 from /afs/
0x40de4806 in TRint::Run(bool) + 0x2ba from /afs/
0x08048782 in main + 0x52 from /afs/
0x42017589 in __libc_start_main + 0x95 from /afs/
0x08048651 in __register_frame_info + 0x35 from /afs/

Histo.root (10.2 KB)

Dear Lucia,

this reply might not be very helpful for you - but on my box (root3.05-05, Linux RH9, gcc 3.2) it works just fine. I typed the commands exactly as you proposed and got nice slice fits (see attachment).

I wish you luck :wink:



I can not reproduce the problem either.
However you can now try v3.10.01 (/afs/ has been updated).


Hello again,
I think now I know where the problem was: I had an old version of the .rootrc file (copied from $ROOTSYS/etc/system.rootrc, where I had modified the library and macro paths). Taking the new one and modifying again the lines I need, makes the FitSlicesY function work again.


P.S. Knowing that the problem could not be reproduced actually helped a lot! Many thanks to the people who tried it!