Two closed TGraphs filled with white are used here to draw triangles on top of a 2D function in order to hide parts of it.
{
Double_t amplitude = par[0] * (cos(tpi_l * sqrt(x_p2 + ym_p2))
+ par[3] * cos(tpi_l * sqrt(x_p2 + yp_p2)));
return amplitude * amplitude;
}
{
for(
Int_t i=0; i<10; i++){
xint[0] = xcur;
Double_t intens = interference(xint, par);
if(intens > maxintens) maxintens = intens;
xcur -= dlambda;
}
return maxintens;
}
{
TCanvas *
c1 =
new TCanvas(
"gr201_waves",
"A double slit experiment", 300, 40, 1004, 759);
c1->Range(0, -10, 30, 10);
TPad *pad =
new TPad(
"pr",
"pr", 0.5, 0, 1., 1);
pad->
Range(0, -10, 15, 10);
for (
Int_t i = 0; i < colNum; i++) {
}
gStyle->SetPalette(colNum, palette);
TF2 *f0 =
new TF2(
"ray_source", interference, 0.02, 15, -8, 8, 4);
title.DrawLatex(1.6, 8.5, "A double slit experiment");
line =
new TLine(15, 0 - 0.5*
d + 0.2, 15, 0 + 0.5*
d - 0.2);
TF2 *finter =
new TF2(
"interference",interference, 0.01, 14, -10, 10, 4);
for (
Int_t i = 0; i < 16; i++) {
}
TF2 *fresult =
new TF2(
"result",result, 14, 15, -10, 10, 4);
fresult->
Draw(
"samecol");
line->SetLineWidth(10);
line->SetLineColor(0);
line->Draw();
}
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
virtual TArc * DrawArc(Double_t x1, Double_t y1, Double_t radius, Double_t phimin=0, Double_t phimax=360, Option_t *option="")
Draw this arc with new coordinates.
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
static Int_t GetColor(const char *hexcolor)
virtual void SetNpx(Int_t npx=100)
virtual void SetParameters(const Double_t *params)
virtual void SetContour(Int_t nlevels=20, const Double_t *levels=nullptr)
void Draw(Option_t *option="") override
Default Draw method for all objects.
virtual void SetNpy(Int_t npy=100)
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
void Draw(Option_t *chopt="") override
Default Draw method for all objects.
Use the TLine constructor to create a simple line.
The most important graphics class in the ROOT system.
void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Set world coordinate system for the pad.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
void Draw(Option_t *option="") override
Draw Pad in Current pad (re-parent pad if necessary).
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.