Hi everyone, I’ve a for cycle
but I’m having problems using it, because I don’t get error in the code but, sometimes ROOT runs the macro, other times it closes automatically without running it. How should it be possible?
si-500274.root (2.7 MB)
calo.cpp (18.5 KB)
ROOT Version: 5.34/38
Your .cpp file had many C mistake. They are fixed in the attached version.
calo.cpp (8.0 KB)
Hi couet, thank you, but running your macro I have the same problem…
As it is on Windows may be @bellenot have some idea about it.
I ran your macro on mac with ROOT 6. I got many C++ errors.
I fixed them and now it runs fine, always, on my machine.
One thing you can try is to run your macro using Aclic
root .x calo.cpp+
Yes, please run with ACLiC, it looks like the problem comes from the interpreter…
In the attachment there is the macro that I used on saturday and it worked (I got plots) …now I’m trying to run it and I’ve the same problems due to the for cycle
…It’ s strange that it worked on saturday, but it isn’t working today
calo.cpp (15.4 KB)
si-500427.root (944.4 KB)
Using Aclic I get this error (caloc is your macro, but obiuvsly I get it also using mine).
To run with ACLiC, you need to have the Microsoft compiler to be installed and run from a
Developer Command Prompt for VS2013, or call the
vcvars32.bat batch script to properly set the environment variables.
Also have a look at the mods i did. in particular the declaration of
timenamesuba … you declare it several in if statements and use it outside the if. It goes out of scope. that’s not valid C++. I will try (again) to modify your new macro.
also you do things like:
it should be:
is it this one https://www.microsoft.com/it-it/download/confirmation.aspx?id=30679 ?
@couet you are right for the declaration
int c_YTitleOffset=1.55, the reason is that I first setted the values 1, later I changed to 1.55 and I forgot to change from int to double
Anyway, if I don’t use the for cycle the macro works…it looks like some problem due to the for cycle (especially because I get same problem with your macro).
No, you need the complete Visual Studio, not only the redistributable. And the version depends on which version of the ROOT binaries you installed on your system…
Looking at your code I found many C++ syntax mistakes but error one is really fatal and I do not know how to fix it. You have the line:
lemma is not declared …
Yes…because I opened this page https://visualstudio.microsoft.com/it/vs/older-downloads/ then I clicked on the download button of visual studio 2012, but the download doesn’t work
Then you must instanciate your object with:
And this is very basic C/C++
Then there is not much we can do. Try to fix the errors in your code
@bellenot thank you I fixed the
Anyway there are things very strange
- If I don’t use the “for cycles” the macro works (See attachment)
- I’m trying to run the macro that I used on saturday but on saturday the for cycle worked, today it isn’t working
- Couet’s macro doesn’t work too (on my computer).
calo.cpp (18.7 KB)
I’m trying to fix the many errors you have in your code…