Is there a way to somehow clear a TGraph ?
Here’s my problem.
I have this piece of code that works great, but when I run it twice, the output is different and I don’t know why.
The vectors are cleared properly so it doesn’t come from there.
Your example is not complete and even incorrect (there is this endl; alone …) …can you post some thing we can run ?
As a suggestion may be you can delete the graph (if it exist) before creating it …
How ?
can I just do someting like gr_kaon->Delete() ??
I can’t give you an example you can run, because the code is REALLY long (this is just a very tiny part of it, but it was to illustrate the problem I have)
In addition, you should not forget that the pointer will then be invalid and should not be used. If a derefernce is performed after delete, you may cause a segmentation violation. Some advocate for setting it to nullptr after calling delete unless it will be used for something else.