Hi everybody,
I would like to know if is there a way to rotate a TH3F, using something like SetPhi SetTheta?
I would like to recreate the /root/tutorials/graphics/anim.C using TH3F.
Cheers
Hi everybody,
I would like to know if is there a way to rotate a TH3F, using something like SetPhi SetTheta?
I would like to recreate the /root/tutorials/graphics/anim.C using TH3F.
Cheers
see below a modified version of anim.C with a TH3
Rene
[code]#include “TStyle.h”
#include “TCanvas.h”
#include “TF2.h”
#include “TTimer.h”
Double_t pi;
TH3F *h3;
Float_t t = 0;
Float_t phi = 30;
void anim3()
{
gStyle->SetFrameFillColor(42);
TCanvas *c1 = new TCanvas(“c1”);
c1->SetFillColor(17);
pi = TMath::Pi();
h3 = new TH3F(“h3”,“test fitz”,5,-2,2,8,-2,2,5,0,10);
h3->Draw();
TTimer timer = new TTimer(20);
timer->SetCommand(“Animate()”);
timer->TurnOn();
}
void Animate()
{
//just in case the canvas has been deleted
//if (!gROOT->GetListOfCanvases()->FindObject(“glc1”)) return;
for (Int_t i=0;i<1000;i++) {
Float_t x = gRandom->Gaus(0,1);
Float_t y = gRandom->Gaus(0,1);
Float_t z = gRandom->Gaus(10,4);
h3->Fill(x,y,z);
}
t += 0.05pi;
phi += 2;
gPad->GetView()->SetLongitude(phi);
gPad->Modified();
gPad->Update();
}
[/code]
Thank you very much,
It works,
Cheers