33 Double_t amplitude = par[0] * (cos(tpi_l *
sqrt(x_p2 + ym_p2))
34 + par[3] * cos(tpi_l *
sqrt(x_p2 + yp_p2)));
35 return amplitude * amplitude;
45 for(
Int_t i=0; i<10; i++){
48 Double_t intens = interference(xint, par);
49 if(intens > maxintens) maxintens = intens;
61 c1->Range(0, -10, 30, 10);
63 TPad *pad =
new TPad(
"pr",
"pr", 0.5, 0 , 1., 1);
64 pad->
Range(0, -10, 15, 10);
67 const Int_t colNum = 30;
68 Int_t palette[colNum];
69 for (
Int_t i=0;i<colNum;i++) {
71 , pow(i/((colNum)*1.0),0.3)
72 , pow(i/((colNum)*1.0),0.3)
73 ,0.5*(i/((colNum)*1.0)),
"");
78 TF2 * f0 =
new TF2(
"ray_source",interference, 0.02, 15, -8, 8, 4);
87 title.
DrawLatex(1.6, 8.5,
"A double slit experiment");
90 graph->SetFillColor(0);
91 graph->SetFillStyle(1001);
92 graph->SetLineWidth(0);
93 graph->SetPoint(0, 0., 0.1);
94 graph->SetPoint(1, 14.8, 8);
95 graph->SetPoint(2, 0, 8);
96 graph->SetPoint(3, 0, 0.1);
100 graph->SetFillColor(0);
101 graph->SetFillStyle(1001);
102 graph->SetLineWidth(0);
103 graph->SetPoint(0, 0, -0.1);
104 graph->SetPoint(1, 14.8, -8);
105 graph->SetPoint(2, 0, -8);
106 graph->SetPoint(3, 0, -0.1);
112 line =
new TLine(15, 0 - 0.5*
d +0.2 ,15, 0 + 0.5*
d -0.2);
119 finter =
new TF2(
"interference",interference, 0.01, 14, -10, 10, 4);
125 finter->
Draw(
"samecolorz");
131 Float_t r = 0.5 * lambda, dr = lambda;
132 for (
Int_t i = 0; i < 16; i++) {
133 arc->
DrawArc(0, 0.5*
d,
r, 0., 360.,
"only");
134 arc->
DrawArc(0, -0.5*
d,
r, 0., 360.,
"only");
139 TF2 * fresult =
new TF2(
"result",result, 14, 15, -10, 10, 4);
145 fresult->
Draw(
"samecolor");
R__EXTERN TStyle * gStyle
virtual void 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 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.
The color creation and management class.
virtual void SetNpx(Int_t npx=100)
Set the number of points used to draw the function.
virtual void SetParameters(const Double_t *params)
A 2-Dim function with parameters.
virtual void SetNpy(Int_t npy=100)
Set the number of points used to draw the function.
virtual void SetContour(Int_t nlevels=20, const Double_t *levels=0)
Set the number and values of contour levels.
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
A TGraph is an object made of two arrays X and Y with npoints each.
To draw Mathematical Formula.
TLatex * DrawLatex(Double_t x, Double_t y, const char *text)
Make a copy of this object with the new parameters And copy object attributes.
Use the TLine constructor to create a simple line.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
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).
void SetPalette(Int_t ncolors=kBird, Int_t *colors=0, Float_t alpha=1.)
See TColor::SetPalette.
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)