Contact
Project: ROOT
Views: 643
Kernel: ROOT (root.cern.ch)

ROOT in CoCalc

This uses the "ROOT" kernel, and shows some randomly picked examples from https://root.cern.ch/root/html608/group__Tutorials.html

TCanvas *c1 = new TCanvas("c1","test",600,700);
TLatex l; l.SetTextAlign(12); l.SetTextSize(0.04); l.DrawLatex(0.1,0.9,"1) C(x) = d #sqrt{#frac{2}{#lambdaD}}\ #int^{x}_{0}cos(#frac{#pi}{2}t^{2})dt"); l.DrawLatex(0.1,0.7,"2) C(x) = d #sqrt{#frac{2}{#lambdaD}}\ #int^{x}cos(#frac{#pi}{2}t^{2})dt"); l.DrawLatex(0.1,0.5,"3) R = |A|^{2} = #frac{1}{2}#left(#[]{#frac{1}{2}+\ C(V)}^{2}+#[]{#frac{1}{2}+S(V)}^{2}#right)"); l.DrawLatex(0.1,0.3, "4) F(t) = #sum_{i=-#infty}^{#infty}A(i)cos#[]{#frac{i}{t+i}}"); l.DrawLatex(0.1,0.1,"5) {}_{3}^{7}Li"); c1->Print("latex.ps");
Info in <TCanvas::Print>: ps file latex.ps has been created
gROOT->GetListOfCanvases()->Draw()
TCanvas * CPol = new TCanvas("CPol","TGraphPolar Examples",1200,600); CPol->Divide(2,1); CPol->cd(1); Double_t xmin=0; Double_t xmax=TMath::Pi()*2; Double_t x[1000]; Double_t y[1000]; Double_t xval1[20]; Double_t yval1[20]; TF1 * fplot = new TF1("fplot","cos(2*x)*cos(20*x)",xmin,xmax); for (Int_t ipt = 0; ipt < 1000; ipt++){ x[ipt] = ipt*(xmax-xmin)/1000+xmin; y[ipt] = fplot->Eval(x[ipt]); } TGraphPolar * grP = new TGraphPolar(1000,x,y); grP->SetLineColor(2); grP->SetLineWidth(2); grP->SetFillStyle(3012); grP->SetFillColor(2); grP->Draw("AFL"); for (Int_t ipt = 0; ipt < 20; ipt++){ xval1[ipt] = x[1000/20*ipt]; yval1[ipt] = y[1000/20*ipt]; } TGraphPolar * grP1 = new TGraphPolar(20,xval1,yval1); grP1->SetMarkerStyle(29); grP1->SetMarkerSize(2); grP1->SetMarkerColor(4); grP1->SetLineColor(4); grP1->Draw("CP");
CPol->Update(); grP1->GetPolargram()->SetTextColor(8); grP1->GetPolargram()->SetRangePolar(-TMath::Pi(),TMath::Pi()); grP1->GetPolargram()->SetNdivPolar(703); grP1->GetPolargram()->SetToRadian(); CPol->cd(2); Double_t x2[30]; Double_t y2[30]; Double_t ex[30]; Double_t ey[30]; for (Int_t ipt = 0; ipt < 30; ipt++){ x2[ipt] = x[1000/30*ipt]; y2[ipt] = 1.2 + 0.4*sin(TMath::Pi()*2*ipt/30); ex[ipt] = 0.2+0.1*cos(2*TMath::Pi()/30*ipt); ey[ipt] = 0.2; } TGraphPolar * grPE = new TGraphPolar(30,x2,y2,ex,ey); grPE->SetMarkerStyle(22); grPE->SetMarkerSize(1.5); grPE->SetMarkerColor(5); grPE->SetLineColor(6); grPE->SetLineWidth(2); grPE->Draw("EP"); CPol->Update(); grPE->GetPolargram()->SetTextSize(0.03); grPE->GetPolargram()->SetTwoPi(); grPE->GetPolargram()->SetToRadian();
gROOT->GetListOfCanvases()->Last()->Draw()
#include "TH1D.h" #include "TVirtualFFT.h" #include "TF1.h" #include "TCanvas.h" #include "TMath.h"