Can someone tell me how to remove an entry from an ntuple? More specifically, I want to remove those entries, where “shot_n==10”, for example.
This can only be done by copying the data to a new file. See $ROOTSYS/tutorials/tree/copytree*.C
It’s a petty. This is my attempt to make this. Can you give me a hint why it segfault? If I comment the line …SetBRanchAddress, then it runs without segfault (but of course if doesn’t make the job).
GetSize() returns the allocated size of the array and not the number of active entries (so from 2 and on you dereference null pointers)
Instead you should use GetEntries().
Humm … Also why did you elected to use Clone rather than the much more efficient CloneTree?
Also you can simplify you code by using TNtuple::GetArgs.
Here is a more efficient version of your code.
TNtuple *ntuple = new TNtuple(“ntuple”,“ntuple”,“x:y”);
TNtuple *ntuple_short = ntuple.CloneTree(0);
Float_t *vars = nuple->GetArgs()
for(int i=0; i<ntuple.GetEntries(); ++i)
ntuple = ntuple_short;