Plotting points on the graph

I see… so now, I do not have any idea :slight_smile:

That’s your data you should know which value to pick …
What are your criteria ?
That’s up to you to decide which points are valid.

Before the test I have added:

   printf("%d %g\n",i,xpt);

It shows all the xpt values.
Clearly those you are testing are not present.

i will try this and check…

i found and tried these points:

(xpt == 0.409 || xpt == 0.6085 || xpt == 0.808 || xpt == 0.9676 )

but i still could not see the points.

 double eps = 0.0001;
 for (Int_t i=0; i<nof; i++)
 {
   av2->GetPoint(i, xpt, ypt);
   if (abs(xpt - 0.409)  < eps ||
       abs(xpt - 0.6085) < eps ||
       abs(xpt - 0.808)  < eps ||
       abs(xpt - 0.9676) < eps ) {

i will try this… then will just adjust the value of eps to suit… :slight_smile:

it did not work for now but will try and try… with new idea maybe :slight_smile:

it works for me:

StatNewEPScatteringSample01.C (4.5 KB)

$ root StatNewEPScatteringSample01.C 
   ------------------------------------------------------------------
  | Welcome to ROOT 6.19/01                        https://root.cern |
  | (c) 1995-2019, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for macosx64 on Aug 29 2019, 07:25:08                      |
  | From heads/master@v6-19-01-1073-g8b436b8e28                      |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

root [0] 
Processing StatNewEPScatteringSample01.C...
root [1] 

wait… i’ll do it again…

now it works… muchas gracias :slight_smile:

question: how many graphs can be contained in a multigraph?

i have this part of the court:

//======================

 av1->SetMarkerStyle(7);
 av1->SetMarkerColor(kBlack);
 av1->SetMarkerSize(1);

 av2->SetMarkerStyle(7);
 av2->SetMarkerColor(kRed);
 av2->SetMarkerSize(1);

 av3->SetMarkerStyle(7);
 av3->SetMarkerColor(kGreen);
 av3->SetMarkerSize(1);

 av4->SetMarkerStyle(7);
 av4->SetMarkerColor(kBlue);
 av4->SetMarkerSize(1);

 av5->SetMarkerStyle(7);
 av5->SetMarkerColor(kCyan);
 av5->SetMarkerSize(1);

 av6->SetMarkerStyle(7);
 av6->SetMarkerColor(kBlack);
 av6->SetMarkerSize(1);

 av7->SetMarkerStyle(7);
 av7->SetMarkerColor(kRed);
 av7->SetMarkerSize(1);

 av8->SetMarkerStyle(7);
 av8->SetMarkerColor(kGreen);
 av8->SetMarkerSize(1);

 av9->SetMarkerStyle(7);
 av9->SetMarkerColor(kBlue);
 av9->SetMarkerSize(1);

 av10->SetMarkerStyle(7);
 av10->SetMarkerColor(kCyan);
 av10->SetMarkerSize(1);

 av11->SetMarkerStyle(7);
 av11->SetMarkerColor(kBlack);
 av11->SetMarkerSize(1);

 av12->SetMarkerStyle(7);
 av12->SetMarkerColor(kRed);
 av12->SetMarkerSize(1);

 av13->SetMarkerStyle(7);
 av13->SetMarkerColor(kGreen);
 av13->SetMarkerSize(1);

 av14->SetMarkerStyle(7);
 av14->SetMarkerColor(kBlue);
 av14->SetMarkerSize(1);

 av15->SetMarkerStyle(7);
 av15->SetMarkerColor(kCyan);
 av15->SetMarkerSize(1);

 av16->SetMarkerStyle(7);
 av16->SetMarkerColor(kBlack);
 av16->SetMarkerSize(1);

 av17->SetMarkerStyle(7);
 av17->SetMarkerColor(kRed);
 av17->SetMarkerSize(1);

 av18->SetMarkerStyle(7);
 av18->SetMarkerColor(kGreen);
 av18->SetMarkerSize(1);

 av19->SetMarkerStyle(7);
 av19->SetMarkerColor(kBlue);
 av19->SetMarkerSize(1);

 av20->SetMarkerStyle(7);
 av20->SetMarkerColor(kCyan);
 av20->SetMarkerSize(1);

 av21->SetMarkerStyle(7);
 av21->SetMarkerColor(kBlack);
 av21->SetMarkerSize(1);

 av22->SetMarkerStyle(7);
 av22->SetMarkerColor(kRed);
 av22->SetMarkerSize(1);

 av23->SetMarkerStyle(7);
 av23->SetMarkerColor(kGreen);
 av23->SetMarkerSize(1);

 av24->SetMarkerStyle(7);
 av24->SetMarkerColor(kBlue);
 av24->SetMarkerSize(1);

 av25->SetMarkerStyle(7);
 av25->SetMarkerColor(kCyan);
 av25->SetMarkerSize(1);

 av26->SetMarkerStyle(7);
 av26->SetMarkerColor(kBlack);
 av26->SetMarkerSize(1);

 av27->SetMarkerStyle(7);
 av27->SetMarkerColor(kRed);
 av27->SetMarkerSize(1);

 av28->SetMarkerStyle(7);
 av28->SetMarkerColor(kGreen);
 av28->SetMarkerSize(1);

 av29->SetMarkerStyle(7);
 av29->SetMarkerColor(kBlue);
 av29->SetMarkerSize(1);

 av30->SetMarkerStyle(7);
 av30->SetMarkerColor(kCyan);
 av30->SetMarkerSize(1);

 av31->SetMarkerStyle(7);
 av31->SetMarkerColor(kBlack);
 av31->SetMarkerSize(1);

 av32->SetMarkerStyle(7);
 av32->SetMarkerColor(kRed);
 av32->SetMarkerSize(1);

 av33->SetMarkerStyle(7);
 av33->SetMarkerColor(kGreen);
 av33->SetMarkerSize(1);

 av34->SetMarkerStyle(7);
 av34->SetMarkerColor(kBlue);
 av34->SetMarkerSize(1);

 av35->SetMarkerStyle(7);
 av35->SetMarkerColor(kCyan);
 av35->SetMarkerSize(1);

 av36->SetMarkerStyle(7);
 av36->SetMarkerColor(kBlack);
 av36->SetMarkerSize(1);

 av37->SetMarkerStyle(7);
 av37->SetMarkerColor(kRed);
 av37->SetMarkerSize(1);

 av38->SetMarkerStyle(7);
 av38->SetMarkerColor(kGreen);
 av38->SetMarkerSize(1);

 av39->SetMarkerStyle(7);
 av39->SetMarkerColor(kBlue);
 av39->SetMarkerSize(1);

 av40->SetMarkerStyle(7);
 av40->SetMarkerColor(kCyan);
 av40->SetMarkerSize(1);

 av41->SetMarkerStyle(7);
 av41->SetMarkerColor(kBlack);
 av41->SetMarkerSize(1);

 av42->SetMarkerStyle(7);
 av42->SetMarkerColor(kRed);
 av42->SetMarkerSize(1);

 av43->SetMarkerStyle(7);
 av43->SetMarkerColor(kGreen);
 av43->SetMarkerSize(1);

 av44->SetMarkerStyle(7);
 av44->SetMarkerColor(kBlue);
 av44->SetMarkerSize(1);

 av45->SetMarkerStyle(7);
 av45->SetMarkerColor(kCyan);
 av45->SetMarkerSize(1);

 av46->SetMarkerStyle(7);
 av46->SetMarkerColor(kBlack);
 av46->SetMarkerSize(1);

 av47->SetMarkerStyle(7);
 av47->SetMarkerColor(kRed);
 av47->SetMarkerSize(1);

 av48->SetMarkerStyle(7);
 av48->SetMarkerColor(kGreen);
 av48->SetMarkerSize(1);

 av49->SetMarkerStyle(7);
 av49->SetMarkerColor(kBlue);
 av49->SetMarkerSize(1);

 av50->SetMarkerStyle(7);
 av50->SetMarkerColor(kCyan);
 av50->SetMarkerSize(1);

 av51->SetMarkerStyle(7);
 av51->SetMarkerColor(kBlack);
 av51->SetMarkerSize(1);

 av52->SetMarkerStyle(7);
 av52->SetMarkerColor(kRed);
 av52->SetMarkerSize(1);

 av53->SetMarkerStyle(7);
 av53->SetMarkerColor(kGreen);
 av53->SetMarkerSize(1);

 av54->SetMarkerStyle(7);
 av54->SetMarkerColor(kBlue);
 av54->SetMarkerSize(1);

 av55->SetMarkerStyle(7);
 av55->SetMarkerColor(kCyan);
 av55->SetMarkerSize(1);

//=== Plotting the points on canvas ===//
int j = 0;
double eps = 0.000001;
double ept = 0.001;

TGraph *av000 = new TGraph();
//===================Q^2=0.40
 for (Int_t i=0; i<nof; i++)
 {
   av1->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.399012) < eps)
   {
    av000->GetPoint(i, xpt, ypt);
    av000->SetPoint(j, xpt, ypt + fpf[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av6->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.399012) < eps)
   {
    av000->GetPoint(i, xpt, ypt);
    av000->SetPoint(j, xpt, ypt + fpa[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av11->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.399012) < eps)
   {
    av000->GetPoint(i, xpt, ypt);
    av000->SetPoint(j, xpt, ypt + fpb[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av16->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.399012) < eps)
   {
    av000->GetPoint(i, xpt, ypt);
    av000->SetPoint(j, xpt, ypt + fpc[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

TGraph *av0001 = new TGraph();
//===============================Q^2=0.50
 for (Int_t i=0; i<nof; i++)
 {
   av21->GetPoint(i, xpt, ypt);
//   if ( abs(xpt - 0.498762) < ept )
   if ( xpt == 0.498762 )
   {
    av0001->GetPoint(i, xpt, ypt);
    av0001->SetPoint(j, xpt, ypt + fpe[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av26->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.498762) < ept )
   {
    av0001->GetPoint(i, xpt, ypt);
    av0001->SetPoint(j, xpt, ypt + fpg[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av31->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.498762) < ept )
   {
    av0001->GetPoint(i, xpt, ypt);
    av0001->SetPoint(j, xpt, ypt + fph[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av36->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.498762) < ept )
   {
    av0001->GetPoint(i, xpt, ypt);
    av0001->SetPoint(j, xpt, ypt + fpi[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av41->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.498762) < ept )
   {
    av0001->GetPoint(i, xpt, ypt);
    av0001->SetPoint(j, xpt, ypt + fpj[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av46->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.498762) < ept )
   {
    av0001->GetPoint(i, xpt, ypt);
    av0001->SetPoint(j, xpt, ypt + fpk[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av51->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.498762) < ept)
   {
    av0001->GetPoint(i, xpt, ypt);
    av0001->SetPoint(j, xpt, ypt + fpl[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

//==========================
TGraph *av001 = new TGraph();

 for (Int_t i=0; i<nof; i++)
 {
   av2->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.399012) < eps)
   {
    av001->GetPoint(i, xpt, ypt);
    av001->SetPoint(j, xpt, ypt + qbs[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av7->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.399012) < eps)
   {
    av001->GetPoint(i, xpt, ypt);
    av001->SetPoint(j, xpt, ypt + dbs[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av12->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.399012) < eps)
   {
    av001->GetPoint(i, xpt, ypt);
    av001->SetPoint(j, xpt, ypt + bbs[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av17->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.399012) < eps)
   {
    av001->GetPoint(i, xpt, ypt);
    av001->SetPoint(j, xpt, ypt + lbs[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

//==========================
TGraph *av002 = new TGraph();

 for (Int_t i=0; i<nof; i++)
 {
   av3->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.400000) < eps)
   {
    av002->GetPoint(i, xpt, ypt);
    av002->SetPoint(j, xpt, ypt + qbc[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av8->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.400000) < eps)
   {
    av002->GetPoint(i, xpt, ypt);
    av002->SetPoint(j, xpt, ypt + abc[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av13->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.400000) < eps)
   {
    av002->GetPoint(i, xpt, ypt);
    av002->SetPoint(j, xpt, ypt + bbc[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av18->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.400000) < eps)
   {
    av002->GetPoint(i, xpt, ypt);
    av002->SetPoint(j, xpt, ypt + lbc[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }
//==========================
TGraph *av003 = new TGraph();

 for (Int_t i=0; i<nof; i++)
 {
   av4->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.400000) < eps)
   {
    av003->GetPoint(i, xpt, ypt);
    av003->SetPoint(j, xpt, ypt + qes[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av9->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.400000) < eps)
   {
    av003->GetPoint(i, xpt, ypt);
    av003->SetPoint(j, xpt, ypt + aes[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av14->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.400000) < eps)
   {
    av003->GetPoint(i, xpt, ypt);
    av003->SetPoint(j, xpt, ypt + bes[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av19->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.400000) < eps)
   {
    av003->GetPoint(i, xpt, ypt);
    av003->SetPoint(j, xpt, ypt + les[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

//==========================
TGraph *av004 = new TGraph();

 for (Int_t i=0; i<nof; i++)
 {
   av5->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.400000) < eps)
   {
    av004->GetPoint(i, xpt, ypt);
    av004->SetPoint(j, xpt, ypt + qec[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av10->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.400000) < eps)
   {
    av004->GetPoint(i, xpt, ypt);
    av004->SetPoint(j, xpt, ypt + aec[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av15->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.400000) < eps)
   {
    av004->GetPoint(i, xpt, ypt);
    av004->SetPoint(j, xpt, ypt + bec[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

 for (Int_t i=0; i<nof; i++)
 {
   av20->GetPoint(i, xpt, ypt);
   if ( abs(xpt - 0.400000) < eps)
   {
    av004->GetPoint(i, xpt, ypt);
    av004->SetPoint(j, xpt, ypt + lec[i]->Eval(xpt)/(Double_t)nof);
    j++;
   }
 }

//=== drawing the canvas ===//

 gPad->SetLogy(1);

 av000->SetMarkerStyle(22);
 av000->SetMarkerColor(1); //black
 av000->SetMarkerSize(1);

 av0001->SetMarkerStyle(22);
 av0001->SetMarkerColor(1); //black
 av0001->SetMarkerSize(1);

 av001->SetMarkerStyle(22);
 av001->SetMarkerColor(3); //green
 av001->SetMarkerSize(1);

 av002->SetMarkerStyle(22);
 av002->SetMarkerColor(2); //red
 av002->SetMarkerSize(1);

 av003->SetMarkerStyle(22);
 av003->SetMarkerColor(25); //brown
 av003->SetMarkerSize(1);

 av004->SetMarkerStyle(22);
 av004->SetMarkerColor(38); //blue-violet
 av004->SetMarkerSize(1);

//===Unified multigraph===//

 TMultiGraph *mgp = new TMultiGraph();
 mgp->SetTitle("dcs of ep, eq_s, eq_c (with mrf); Transfer Momentum in GeV^2; Differential Cross Section");
 mgp->SetMinimum(1.e-5);
 mgp->SetMaximum(1.e0);
 mgp->Add(av000,"P");
 mgp->Add(av0001,"P");
 mgp->Add(av001,"P");
 //mgp->Add(av002,"P");
 //mgp->Add(av003,"P");
 //mgp->Add(av004,"P");
 //mgp->Add(av1,"PL");
 //mgp->Add(av2,"PL");
 //mgp->Add(av3,"PL");
 //mgp->Add(av4,"PL");
 //mgp->Add(av5,"PL");
 //mgp->Add(av6,"PL");
 //mgp->Add(av7,"PL");
 //mgp->Add(av8,"PL");
 //mgp->Add(av9,"PL");
 //mgp->Add(av10,"PL");
 //mgp->Add(av11,"PL");
 //mgp->Add(av12,"PL");
 //mgp->Add(av13,"PL");
 //mgp->Add(av14,"PL");
 //mgp->Add(av15,"PL");
 //mgp->Add(av16,"PL");
 //mgp->Add(av17,"PL");
 //mgp->Add(av18,"PL");
 //mgp->Add(av19,"PL");
 //mgp->Add(av20,"PL");
 //mgp->Add(av21,"PL");
 //mgp->Add(av22,"PL");
 //mgp->Add(av23,"PL");
 //mgp->Add(av24,"PL");
 //mgp->Add(av25,"PL");
 //mgp->Add(av26,"PL");
 //mgp->Add(av27,"PL");
 //mgp->Add(av28,"PL");
 //mgp->Add(av29,"PL");
 //mgp->Add(av30,"PL");
 //mgp->Add(av31,"PL");
 //mgp->Add(av32,"PL");
 //mgp->Add(av33,"PL");
 //mgp->Add(av34,"PL");
 //mgp->Add(av35,"PL");
 //mgp->Add(av36,"PL");
 //mgp->Add(av37,"PL");
 //mgp->Add(av38,"PL");
 //mgp->Add(av39,"PL");
 //mgp->Add(av40,"PL");
 //mgp->Add(av41,"PL");
 //mgp->Add(av42,"PL");
 //mgp->Add(av43,"PL");
 //mgp->Add(av44,"PL");
 //mgp->Add(av45,"PL");
 //mgp->Add(av46,"PL");
 //mgp->Add(av47,"PL");
 //mgp->Add(av48,"PL");
 //mgp->Add(av49,"PL");
 //mgp->Add(av50,"PL");
 //mgp->Add(av51,"PL");
 //mgp->Add(av52,"PL");
 //mgp->Add(av53,"PL");
 //mgp->Add(av54,"PL");
 //mgp->Add(av55,"PL");

 mgp->Draw("a");

 avf->SetMaximum(1.e0);
 can->Modified();
 can->Update();
}

i could not see the points for av0001. what could have gone wrong?
there’s no error when i ran the program.
0.399012 and 0.498762 came out as x-values when i printed the points.

In principle there is no limit. Can you post a running example showing the problem ?

for this case, i could not see the points for av0001.
the shortened code is still too long.
like 3 times the limit of the number of characters.
can i send it through my email: jbmagallanes@gmail.com?

regards, jaybee

yes you can. Email me.

can i have your email sir? :slight_smile:

it was hard finding your email in www.
i saw people of the same name as you in facebook
but i am not completely sure.

i found two from a web article in 2004. i will try it.

olivier.couet@cern.ch

gracias :slight_smile: i sent it already…