Re: [ROOT] Superimposing a marker on a 2d histo drawn as a surface

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Dec 11 2001 - 22:39:48 MET


Hi Francois,

An example:

void montanet() {
   TCanvas *c1 = new TCanvas("c1");
   c1->SetTheta(54);
   c1->SetPhi(23);
   TH2F *h = new TH2F("h","test",40,-4,4,40,-4,4);
   TF2 *f2 = new TF2("f2","xygaus",-4,4,-4,4);
   f2->SetParameters(1,0,1,0,1);
   h->FillRandom("f2",30000);
   h->Draw("surf4");
   Double_t yhalf = h->GetMaximum()/2;
   Double_t r = 3;
   Int_t np = 20;
   Double_t dphi = 2*TMath::Pi()/np;
   TPolyLine3D *pl3 = new TPolyLine3D(np);
   TPolyMarker3D *pm3 = new TPolyMarker3D(np);
   for (Int_t i=0;i<np;i++) {
      pl3->SetPoint(i,r*cos(i*dphi), r*sin(i*dphi),yhalf);
      pm3->SetPoint(i,r*cos(i*dphi), r*sin(i*dphi),yhalf);
   }
   pl3->SetLineColor(kBlue);
   pl3->SetLineWidth(4);
   pl3->Draw();
   pm3->SetMarkerStyle(20);
   pm3->SetMarkerColor(kRed);
   pm3->SetMarkerSize(2);
   pm3->Draw();      
}

Rene Brun

On Tue, 11 Dec 2001, [iso-8859-1] François Montanet wrote:

> Dear rooters,
> 
> I have a TH2F that I draw as a "surf4". 
> I would then like to superimpose a marker, a polyline or even better a
> TShape that I would define in the 3D coordinates. Am I asking for the
> moon and if not how do I do?
> Many thanks.
> 
>      François Montanet
> --
> Email: montanet@fnal.gov or montanet@in2p3.fr
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:11 MET