31 + par[3] *
cos(tpi_l *
sqrt(x_p2 + yp_p2)));
32 return amplitude * amplitude;
42 for(
Int_t i=0; i<10; i++){
45 Double_t intens = interference(xint, par);
46 if(intens > maxintens) maxintens = intens;
56 TCanvas *
c1 =
new TCanvas(
"gr201_waves",
"A double slit experiment", 300, 40, 1004, 759);
57 c1->Range(0, -10, 30, 10);
59 TPad *pad =
new TPad(
"pr",
"pr", 0.5, 0, 1., 1);
60 pad->
Range(0, -10, 15, 10);
63 const Int_t colNum = 30;
64 Int_t palette[colNum];
65 for (
Int_t i = 0; i < colNum; i++) {
70 gStyle->SetPalette(colNum, palette);
76 TF2 *f0 =
new TF2(
"ray_source", interference, 0.02, 15, -8, 8, 4);
84 title.DrawLatex(1.6, 8.5,
"A double slit experiment");
110 line->SetLineWidth(10);
113 line =
new TLine(15, 0 - 0.5*
d + 0.2, 15, 0 + 0.5*
d - 0.2);
114 line->SetLineWidth(10);
117 line =
new TLine(15, 0 + 0.5*
d + 0.2, 15, 10);
118 line->SetLineWidth(10);
124 TF2 *finter =
new TF2(
"interference",interference, 0.01, 14, -10, 10, 4);
129 finter->
Draw(
"samecol");
136 Float_t r = 0.5 * lambda, dr = lambda;
137 for (
Int_t i = 0; i < 16; i++) {
138 arc.
DrawArc(0, 0.5*
d,
r, 0., 360.,
"only");
139 arc.
DrawArc(0, -0.5*
d,
r, 0., 360.,
"only");
146 TF2 *fresult =
new TF2(
"result",result, 14, 15, -10, 10, 4);
151 fresult->
Draw(
"samecol");
155 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).
RVec< PromoteType< T > > cos(const RVec< T > &v)
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.