How to get notification of TFile closing for TChain->Process

Hi,

I would like to collect some stat information in my TChain processing whenever a TFile is closed. How can I get such a notification for each TFile::Close()? Thanks.

–Shuwei

Hi,

The selector’s Notify method is called after each new file is opened.

Cheers,
Philippe.

Hi Philippe,

I need another notification for each old file is closed. At the time when a new file is opened, the pointer to the old file is already gone. So it is too late to collect the stat info for the old file.

–Shuwei

Hi,

There is no call back for this. What you can do is test at the end of your Process routine:if ( (entry+1) == fChain->GetTree()->GetEntries()) { // The file is about to be closed. }Cheers,
Philippe.

Hi Philippe,

Thanks for your suggestion. It works for nonProof mode, but not for Proof where the last event of a job on Proof worker is usually NOT the last event of a tree. Any suggestion for that case?

–Shuwei

Hi,

There is no way to hack this in PROOF.
But TFile is instrumented for monitoring via the TVirtualMonitoringWriter abstract interface (header file TVirtualMonitor.h) and the global gMonitoringWriter. All TFile implementations should have a call to that when defined. You can write your own implementation of TVirtualMonitoringWriter (currently only a Monalisa based implementation is available, which probably does not fit your case). This will work also in the local case.

Gerri

Hi Gerri,

Thanks for your suggestion. Is there any simpler way to determine if a job at a worker has processed the last event for current TTree? I tried TProofServ::GetNextPacket(), and did not succeed. Does TProofServ know the current packet allocated to a worker node and the last event in that packet for current TTree? And how? Thanks.

–Shuwei