Skip to content

Commit a466470

Browse files
committed
Rectification after discussion with Jan Saroun, j-loop was lost in translation from 2.x to 3.x
1 parent 980c2fb commit a466470

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

mcstas-comps/contrib/NPI_tof_dhkl_detector.comp

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -189,23 +189,28 @@ The values are:
189189
double da=(a2-a1)/na;
190190
double dt=(tmax-tmin)/nt;
191191
for (i=0;i<na;i++) {
192-
a=a1+(i+0.5)*da;
193-
sth=sin(a/2);
194-
drange=trange*t2lam/2/sth;
195-
tdet=tmin+(j+0.5)*dt;
196-
iline=getNearestLine(-1,sth, tdet, trange, n_dhkl, dhkl, mod_shift,Ltof);
197-
if (iline>=0) {
198-
io=getNearestLine(iline, sth, tdet, trange, n_dhkl, dhkl, mod_shift,Ltof);
199-
if (io<0) {
200-
TOF_N[i][j] += 1;
201-
TOF_p[i][j] += 1;
202-
TOF_p2[i][j] += 1;
203-
} else {
204-
TOF_N[i][j] += 1;
205-
TOF_p[i][j] += 2;
206-
TOF_p2[i][j] += 4;
207-
}
208-
}
192+
a=a1+(i+0.5)*da;
193+
sth=sin(a/2);
194+
drange=trange*t2lam/2/sth;
195+
for (j=0;j<nt;j++) {
196+
TOF_N[i][j] = 0;
197+
TOF_p[i][j] = 0;
198+
TOF_p2[i][j] = 0;
199+
tdet=tmin+(j+0.5)*dt;
200+
iline=getNearestLine(-1,sth, tdet, trange, n_dhkl, dhkl, mod_shift,Ltof);
201+
if (iline>=0) {
202+
io=getNearestLine(iline, sth, tdet, trange, n_dhkl, dhkl, mod_shift,Ltof);
203+
if (io<0) {
204+
TOF_N[i][j] += 1;
205+
TOF_p[i][j] += 1;
206+
TOF_p2[i][j] += 1;
207+
} else {
208+
TOF_N[i][j] += 1;
209+
TOF_p[i][j] += 2;
210+
TOF_p2[i][j] += 4;
211+
}
212+
}
213+
}
209214
}
210215
}
211216

0 commit comments

Comments
 (0)