I have a MakeClass macro that I built under Root 5.15 on Windows XP with a certain chain of nutples. I have ported it onto a linux machine (lxplus at CERN) where I use Root 5.14. The ntuples themselves were made on the linux side. I use the exact same code and ntuples in both places and it works on XP and runs, but does not work, under linux.
The problem occurs because I check the size of a vector array at the start of the code. On the linux side
Array->size()
always returns zero, whereas on the XP size it returns a value >0.
Humm … Can you provide a complete running example, so I can investigate it further (i.e I don’t what your file look like, I don’t know what modification you made to the MakeClass skeleton, etc. ).
Thanks very much for being willing to look. I’ve attached the .C and .h files that I use . They are a bit lengthy, so if you want me to provide something else instead, please ask.
Can you simplify the example to show me what is not working (i.e. from your code I am sure what you are expecting from what you are getting)? A simple change in your code: ILoop=0;
cout << MSTrk_z0->size() << endl;
continue;
if(MSTrk_z0->size()>0 && IDTrk_z0->size()>0) {
shows me zeros and ones on linux …
For these two ntuple files both should be 1 for each event. That’s what I see under XP, but under linux I see only zeros for both. I will try to reproduce it with a stripped down macro.
OK, Attached is a very stripped down version which reproduces the problem. It uses the same two root files. It prints out the size of two vectors. They are always 1 when I run on XP and always 0 when I run on Linux.
I get the same result on Linux and Windows (albeit I am using 5.20).
More over, the result I am seeing with your MakeClass is actually consistent with the result of TTree::Scan/TTree::Draw). For example The event #75 of your first file seems to have indeed 0 element in the MSTrk_z0 vector.
So I am guessing Linux (in your case) is actually correct.
The first thing to try is to compile your code. To do so you will to slightly update your header file:
Humm … this is very odd . I assume that you might have a configuration problem (i.e. header and library and executable and compiler are not ‘compatible’). Check you PATH, LD_LIBRARY_PATH, ROOTSYS and check which compiler version is on your path.
If all those works, then you ought to run your example using valgrind to get more information.
Cheers,
Philippe.
PS. Also my observation (your data file contains 0 and 1 size) and your statement (all event have vector of size) are in conflict. Did you understand why?
I’m not sure what i’m looking for in the path. How do I tell what compiler is in my path?
Regarding the vector size, this is from a simulation sample with a single track per event, so the vector size of each of the vectors cited really should be 1 for every event. I can imagine that there might be an occasional zero, but not many. So I think what I’m seeing on XP is correct.
Thanks for your continued help! I really appreciate it!
It does indeed seem to be a setup issue - I tried it on a different linux machine (not CERN) where I just did a simple root setup rather than the whole ATLAS offline thing, and it works - even without compiling the code - so it must be something in my ATLAS setup that is scrambling things (but this is also happening to someone else who was trying to run my code, so it’s not just me!).