I am trying to draw “Averge graph” with all other branches data in TTree using ROOT. Please find the attachment of “ApproxAverage.pdf”.

I am trying to draw a same graph with CORAL-DRAW. Please find the attachement of “Graph.pdf”. By using CORAL-DRAW the Average Graph is exactly in middle of S1 and S4.

But with ROOT all the graphs are same but “Average graph” is lying approximately on S4 graph.

My code for calculating Average graph is as follows:

It is calculating average correctly. But while plotting a graph in ROOT why it is the difference? I am expecting a graph which getting with Coral-Draw. How to do it?

Before you “T1->Draw(…);”, try to add:
T1->SetEstimate(T1->GetEntries() + 1);
Also, instead of drawing a “smooth curve”, draw a “simple polyline” plus a “star at each point” (i.e. try the “L*” TGraph drawing options). I think the shape of the “smooth curve” may be influenced by some very first points of your TGraph for which the “Sx” value is 0, for “Time” < 0 (try to get rid of these points adding appropriate conditions into your “cut”).

I tried to add T1->SetEstimate(T1->GetEntries() + 1); before T1->Draw(). But it’s not helping. Also, I tried to use TCut method but still not working. Would you recommend some other option? My .data file is attached here with.

I would need a description of “variables” that appear in your data file (so that I can use TTree::ReadFile to create a TTree out of it) plus a definition of your “cut3” (so that I can reproduce your picture).

As a starting point, try this: [code]{
TTree *T1 = new TTree(“T1”, “T1”);
T1->ReadFile(“DATA.txt”,
“T:S0:S1:S2:S3:S4:S5:S6:S7:S8:S9:S10:S11:S12:S13:S14”);
// T1->SetEstimate(T1->GetEntries() + 1); // if n_entries > 1000000