[ROOT] Re:

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Jun 04 2004 - 15:54:55 MEST


Hi Gustavo,

Do not use a TH3 but a TH2. See script below

Rene Brun


{
  //TH3F *hist= new TH3F("hist","#sigma
Vs(1/R,#LambdaR)",100,0,1500,100,0,110,10000,0.001,1000); 
  TH2F *hist= new TH2F("hist","#sigma Vs(1/R,#LambdaR)",100,0,1500,100,0,110); 
  hist->GetXaxis()->SetTitle("1/R (GeV)");
  hist->GetYaxis()->SetTitle ("#LambdaR");
  hist->GetZaxis()->SetTitle ("#sigma (pb)");
  hist->GetXaxis()->CenterTitle();
  hist->GetYaxis()->CenterTitle();
  hist->GetZaxis()->CenterTitle();
  hist->SetMarkerStyle(20);
  hist->SetMarkerSize(1);
  hist->SetStats(kFALSE);

Int_t n=5,m=7;
Float_t R[n]={300,500,700,900,1200}; 
Float_t lambdaR[m]={10,20,30,40,60,80,100};
Float_t Xsec[n][m]={
                        {777, 601, 524, 476, 417, 382, 357},
                        {34.3, 25.6, 23.4, 19.5, 16.7, 15.1, 14.0},
                        {3.35, 2.40, 2.00, 1.77, 1.49, 1.32, 1.21},
                        {0.498, 0.334, 0.271,0.236,0.195, 0.171, 0.154},
                        {0.0393, 0.0254, 0.0200, 0.0170, 0.0135, 0.0116,0.0102}
                };

for (Int_t i=0;i<n;i++) {
 //for (Int_t j=0;j<m;j++) hist->Fill(R[i],lambdaR[j],Xsec[i][j],1);
 for (Int_t j=0;j<m;j++) hist->Fill(R[i],lambdaR[j],Xsec[i][j]);
}


TCanvas *v1= new TCanvas("v1","v1");
         v1->SetLogz();
hist->Draw("lego");
}



gustavo@lip.pt wrote:
> 
> Hi All,
> 
> I'm trying to generate a 3D histograms with the script below, but I find some
> problems:
> 
>  first I cannot set the Z axis in logarithmic scale.
> 
>  Second, I would like to use the "lego" options for the drawing, is it possible?
> 
> Thank you for your help,
> 
> Gustavo
> 
> {
>   TH3F *hist= new TH3F("hist","#sigma Vs
> (1/R,#LambdaR)",100,0,1500,100,0,110,10000,0.001,1000);
>   hist->GetXaxis()->SetTitle("1/R (GeV)");
>   hist->GetYaxis()->SetTitle ("#LambdaR");
>   hist->GetZaxis()->SetTitle ("#sigma (pb)");
>   hist->GetXaxis()->CenterTitle();
>   hist->GetYaxis()->CenterTitle();
>   hist->GetZaxis()->CenterTitle();
>   hist->SetMarkerStyle(20);
>   hist->SetMarkerSize(1);
>   hist->SetStats(kFALSE);
> 
> Int_t n=5,m=7;
> Float_t R[n]={300,500,700,900,1200};
> Float_t lambdaR[m]={10,20,30,40,60,80,100};
> Float_t Xsec[n][m]={
>                         {777, 601, 524, 476, 417, 382, 357},
>                         {34.3, 25.6, 23.4, 19.5, 16.7, 15.1, 14.0},
>                         {3.35, 2.40, 2.00, 1.77, 1.49, 1.32, 1.21},
>                         {0.498, 0.334, 0.271,0.236,0.195, 0.171, 0.154},
>                         {0.0393, 0.0254, 0.0200, 0.0170, 0.0135, 0.0116,0.0102}
>                 };
> 
> for (Int_t i=0;i<n;i++) {
>  for (Int_t j=0;j<m;j++) hist->Fill(R[i],lambdaR[j],Xsec[i][j],1);
> }
> 
> TCanvas *v1= new TCanvas("v1","v1");
>          v1->SetLogz();
> hist->Draw();
> }



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:08 MET