Problem with slow closing

I am running into a problem with a standalone application that I wrote. Currently when it exits it takes on the order of 5 hours to exit. Now, that being said let me explain the application a little to you. First the application creates a TChain to load up the root trees that I have previously created. The number of individual files that it loads up is about 400 to 500 in the worst case. Once the files have been added to the program the system loops over all the events and fills histograms of various quantities. After the histos are filled a final root file is opened with TFile and the histos are saved to the new TFile with the Write() method on the TObject. This final root file is then closed. Here is the thing, it takes about 1 to 1.5 hours to loop over all my events, but then like 4-5 hours to close the TFile. So, something in not correct here. Nowhere am I killing the TChain so that could be an issue but I am not sure. I will include the code here to reference but it is not compilable since it depends on an outside defined class (MyJet). Any comments are welcomed.

Justace
analysis.cpp (21 KB)

Hi,

Indeed this is extremely odd. Your write generatePlots function should be almost immediate (less than one second) …

I do not see anything suspicious in the code your provided

I would recommend running (a few event of) your example with valgrind because I suspect the problem is some memory over-write of some sort.

Anyway for further help, I would need a complete running example.

Cheers,
Philippe.

I forgot to mention that the version of root that I am using is 4.04/02b here at D0. I also forgot to mention that the memory usage starts to go up, even possibly to double after the event loop is finished and it is trying to save the TFile.

Justace

I have placed a tar ball at the following location.

clued0.fnal.gov/~prophecy/rooms/ … s/dist.tgz

I would have just attached it but it is 100M is size, figured that would be abuse. The effect does not show up untill you have a lot of events or files loaded. It does not become noticable till you have about 20000000 events, so if you load the two files several times you will get to this. Just untar and execute “./make” and then “./execute” to run it. I just compiled it clean on a clued0 node.

Justace

The file seems to be no longer available. Could you repost it (or tell me where to find it on clued0).

Thanks,
Philippe