Merge a TGraph with PROOF

Hallo everyone,

i’m quite a noob, probably it’s a stupid question or a terrible coding mistake.
I’m performing an analysis with Proof+TSelector, but i can’t merge a TGraph object.
I have the usual:

void selector::SlaveBegin(TTree * /tree/)
{

int g_count = 0;
g = new TGraph();
g->SetNameTitle(“graf”,“graf”);
fOutput->Add(g);

}

Bool_t selector::Process(Long64_t entry)
{

g->SetPoint( g_count ,(*Muons)[0].Pt(),(*Muons)[1].Pt() );
g_count++;

return kTRUE;
}

And i try to retrieve my graph in Terminate with:

g = static_cast<TGraph*>(fOutput->FindObject(“graf”));
if(!g)
{
Error(“Terminate”, “ERROR: g NOT FOUND”);
return;
}

but object “g” is not found.

Any ideas?

Thank you,
Davide

Hi,

Sorry for the late reply.
I am not able to reproduce the problem.
Do you see anything related to the graph from

root [] gProof->GetOutputList()->ls()

?

This said, I see two potential problems with what your are doing:

  1. You have a point for each entry: your graph could become easily huge …
  2. One thing that PROOF cannot do is to preserve the order of entries, i.e., in your case, the order of points in the graph, which for graphs is important. Your points are going to be scattered around … but of course your may have a way to reorder in Terminate. If your intention is to use the TGraph to store the information, then you should perhaps consider using a TNtuple …

G. Ganis