RDataFrame.Snapshot never ends

Hi all, I just wanted to ask why this simple code is not working. As a part of a bigger project I wanted to read a ntuple, fiter it and save it to another .root file using RDataFrame. Snapshot, but the creation of the tuple does not seem to end.

path1 = "/RXcHadronic_3/RDp/Ntuples/v0/Selection/v2/MC/2016/RS/Dzcut/merged/Bd_DpXcInc_11496402_2016_Sim09h_ReDecay_Filtered_DecayTree_Sel_Dzcut.root"

ts0   = ROOT.RDataFrame("DecayTree", path1)

ts0 = ts0.Filter("((D_ENDVERTEX_Z-B_ENDVERTEX_Z)/sqrt(D_ENDVERTEX_ZERR*D_ENDVERTEX_ZERR+B_ENDVERTEX_ZERR*B_ENDVERTEX_ZERR)+50.0)>1 ")
ts0.Snapshot("newtree1", "MC.root")

fs1 = TFile("MC.root")
ts1 = fs1.Get("newtree1")

What I get as an output is something like this and does not change over the time, it simply never ends :confused: .

Hope it is a silly error but I have been with this for a while now.
Thaks a lot for your time

Hi @caetano.eirea ,
I see nothing wrong in your code nor in the output (Snapshot is simply telling you that it’s changing the name of some columns because it can’t write columns whose name contains a .).

Then it’s probably just doing its job, and I can’t tell whether it’s taking much longer than it should or why.
With the latest ROOT version, you can ask RDF to be more verbose about what it’s doing by adding these lines at the beginning of the script:

verbosity = ROOT.Experimental.RLogScopedVerbosity(ROOT.Detail.RDF.RDFLogChannel(), ROOT.Experimental.ELogLevel.kInfo);

My guess is that you’ll see a message that says RDF is starting the event loop and then again nothing until it’s done. Maybe the disk from which you read or to which you write is very slow?

Cheers,
Enrico

1 Like

Thank you very much!! Looks like I was just being impatient. I tried now to just Snapshot the branches that I will utilice and it finishes rather quickly.

Thanks again,
Caetano

1 Like