Repeated Selector use to cause Segmentation Break

Hello,

I have written the following selector to create canvases with histograms from data in trees in root files acquired elsewhere. I am a novice user of root so your help is much appreciated!

I have two questions:

  1. I apply this to a root file using
    TFile *f1 = TFile::Open(“SleptonDataTotal.root”);
    SleptonNtuple->Process(“MoEDALSelectorHist.C”);

I cannot open Root and use this selector more than once, even on the same data, without closing and relaunching root. This is posing a problem as I am trying to superimpose data from many files on one canvas in later studies.
Can you see why this might be?

  1. After opening and closing root a number of times to test the selector on data, I end up with a segmentation break I believe do to a memory leak. How can I avoid this?

Thank you
Stephanie
MoEDALSelectorHist.C (10.7 KB)