Error in ROOT 5: "Limitation: Statement too long"

Hello experts,
I have the following error when trying to run my code:

Limitation: Statement too long processResultsAllTrigPt.C:276:
cint: Security mode 0x7:0x2 *** Fatal error in interpreter... restarting interpreter ***
*** Fatal error in interpreter... restarting interpreter ***

and the line it complains read as follows:

Int_t binLow = h3EtaPhiSB[iVtx][iPtT][iPtA]->GetZaxis()->FindBin(massMean-3.*massRes); 

could someone give a suggestion?
Thanks.
ROOT Version: 5
Compiler: CINT


can you go to ROOT 6 ?

Note: see how to post code

If you want to stay with ROOT 5, use your macro as ACLiC precompiled, e.g. something like: root [0] .x processResultsAllTrigPt.C++

my code is so complex it is written for root 5 so it wont to be easy for me to change the code to be compatible with root 6 (as a beginner). Could you please give an alternate resolution?

Wile solution (AClic) is the alternate solution. But you may need to change a few things in your code. Often the code working for CINT needs to be made fully C++ compliant to be run into AClic or ROOT 6. But that’s a good thing, your code becomes “stronger” after a such exercise. Just try what Wile suggested.

I used Root6 but I found new error the following :
( /home/mohammed/Desktop/NewWork27june/ProcessResultAllTriger/processResultsAllTrigPt.C:106:3: error: expected unqualified-id
if(bMerged){ )
could someone give a suggestion?

Please post the full error message and a few lines of code around the error message. Often this error message shows if you have an extra semicolon somewhere.

The error message as follows :
root [0] .x processResultsAllTrigPt.C
In file included from input_line_8:1:
/home/mohammed/Desktop/NewWork27june/ProcessResultAllTriger/processResultsAllTrigPt.C:106:3: error: expected unqualified-id
if(bMerged){
^
and the line it complains read as follows:

TFile * file = new TFile(“ResultData18JUL.root”, “READ”);

TFile * file;
if(bMerged){
if(bAll)
file = new TFile(“ResultData18JUL.root”, “READ”);
else
file = new TFile(Form(“MergedResultsCent%d_%d.root”,
centMin, centMax), “READ”);

//gDirectory->cd(Form("Cent%d_%d", centMin, centMax));
TIter nextkey(gDirectory->GetListOfKeys());
TKey* key;
while (Key = (TKey*)nextkey())

2x definitions of the same variable? Just remove the second TFile *file. By the way: this code leaks memory. You first open a file and if bMerged && bAll you open the same file again - and if bMerged && !bAll, you open the MergedResults file but the ResultData file is still open.

I modified the code by this way
TFile * file = new TFile(“ResultData18JUL.root”, “READ”);
TIter nextkey(gDirectory->GetListOfKeys());
TKey* key;
while (Key = (TKey*)nextkey()){
if(!strcmp( key->GetName(), Form(“OutputCent%d_%d”, centMin, centMax))){
TList * V0Xi = (TList*)key->ReadObj();

But i found this message error as follows
/home/mohammed/Desktop/NewWork27june/ProcessResultAllTriger/processResultsAllTrigPt.C:114:5: error: expected unqualified-id
while (Key = (TKey*)nextkey()){
^
/home/mohammed/Desktop/NewWork27june/ProcessResultAllTriger/processResultsAllTrigPt.C:207:3: error: expected unqualified-id
for(Int_t iVtx = 0; iVtx < nVtx; iVtx++)
^
/home/mohammed/Desktop/NewWork27june/ProcessResultAllTriger/processResultsAllTrigPt.C:242:3: error: expected unqualified-id
for(Int_t iVtx = 0; iVtx < nVtx; iVtx++)
^
/home/mohammed/Desktop/NewWork27june/ProcessResultAllTriger/processResultsAllTrigPt.C:282:3: error: expected unqualified-id
for(Int_t iVtx = 0; iVtx < nVtx; iVtx++)

May be it would be simpler if you post your macro.

You must enclose your unnamed macro into “curly brackets”:

{
  TFile * file = new TFile(“ResultData18JUL.root”, “READ”);
  // ... the reset of your code ...
}

i upload part from my code in this part i found error

my code.C (9.3 KB)

Rename your file into “mycode.C” (no space inside) and move the line 19 (which contains just “}”) to the end of your file.

As Wile said earlier you have code outside curly brackets … I would recommend you carefully check the indentation of your code and make sure it is real C++. right now some statements are “floating around”…

i think i got this mistake now during copy from my original code because i didn’t have this error before… i will send you the my original code
processResultsAllTrigPt.C (44.2 KB)

Move line 27 (which contains just “}”) to the end of your file.

i removed but still the same error

You should not remove … you should move… I have modified your macro. I fixed many mistakes but there is still some which you should fix yourself because it really depends on what you want to do. For instance fHistdPhidEtaSibK0s is declared as a vector but then you access it as a simple variable … you should choose… I guess you should spend some time cleaning up this macro which looks really ugly and difficult to understand. In particular indent it properly. processResultsAllTrigPt.C (44.9 KB)
.

OK I will do Thanks so much