Does TApplication change argv?

Hi,

I have a quite strange problem with this little program:

int main(int argc, char **argv)
{
TApplication theApp(“App”, &argc, argv);

std::cout << argc << std::endl;
for (unsigned int nfiles = 1 ; nfiles < argc ; nfiles++)
{
std::cout << nfiles << “\t” << argv[nfiles] << std::endl;
}
theApp.Run();
return 0;
}

If I leave the TApplication theApp(…) at the top then this call of TrackingAna.exe ignores the input argument:

./TrackingAna.exe
/home/wildauer/data/data10_7TeV.00165956.express_express.vtxmon.D3PD_TRK.x44_c331._0001.1

and the print out is just
1
(which is num arguments and the first on is the program itself).

If I move TApplication past the print out then everything is fine. It prints
2
/home/wildauer/data/data10_7TeV.00165956.express_express.vtxmon.D3PD_TRK.x44_c331._0001.1

now the fun part is if I change the argument i.e. replace the .1 at the end with .2 then it works again …
any other string but the one above seems to work.

When I give 2 arguments in the “non working” case and the first one is
/home/wildauer/data/data10_7TeV.00165956.express_express.vtxmon.D3PD_TRK.x44_c331._0001.1

and the second one is
blabla

then it prints:
2
blabla

meaning it ignores the first string again. I am very confused about what is going on here!

My root version is root_v5.26.00.Linux-slc5_amd64-gcc3.4

Cheers
Andi

Hi,

quick addendum. When I run the same on e.g. lxplus215 then this does not happen …

On my local machine it does. Both are SLC5 64bit, but on my local machine
I downloaded root and I am not using the afs version.

My version is:
v5.26.00.Linux-slc5_amd64-gcc3.4

on lxplus215 I use:
5.26.00/x86_64-slc5-gcc34-opt

which seems pretty similar to me …

I’ll change to use the afs version also on my machine, maybe it helps.

Cheers
Andi

Hi,

the problem is sort of solved. In the constructor of TApplication the content of argc and argv is indeed
"fiddled around" with which results (maybe a bug?) that it removes an argument like this:

/home/wildauer/data/data10_7TeV.00165956.express_express.vtxmon.D3PD_TRK.x44_c331._0001.1

The solution is to use the Argc() and Argv() methods of TApplication which give back the unchanged input argument list. A cout of argc and theApp.Argc() gives:
3
4
showing that in argv one argument is missing.

Cheers
Andi