Rev 345 | Rev 349 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 345 | Rev 347 | ||
---|---|---|---|
1 | var funMatrix = [[0, 0, 0, 0], |
1 | var funMatrix = [[0, 0, 0, 0], |
2 | [0, 0, 0, 0], |
2 | [0, 0, 0, 0], |
3 | [0, 0, 0, 0], |
3 | [0, 0, 0, 0], |
4 | [0, 0, 0, 0], |
4 | [0, 0, 0, 0], |
5 | [0, 0, 0, 0]] |
5 | [0, 0, 0, 0]] |
6 | 6 | ||
7 | function initSliders(sframe){ |
7 | function initSliders(sframe){ |
8 | genFunList(sframe); |
8 | genFunList(sframe); |
9 | var obj = JSROOT.GetMainPainter(sframe).draw_object; //get the histogram |
9 | var obj = JSROOT.GetMainPainter(sframe).draw_object; //get the histogram |
10 | 10 | ||
11 | //Initialise all ParameterSliders |
11 | //Initialise all ParameterSliders |
12 | $( function() { |
12 | $( function() { |
13 | $(".ParamSlider"+sframe).each(function() { |
13 | $(".ParamSlider"+sframe).each(function() { |
14 | var ID = String('#'+this.id); |
14 | var ID = String('#'+this.id); |
15 | var n = ID.length; |
15 | var n = ID.length; |
16 | var paramName = ID.slice(6,n-5); |
16 | var paramName = ID.slice(6,n-5); |
17 | switch (paramName) { |
17 | switch (paramName) { |
18 | case 'Amplitude': |
18 | case 'Amplitude': |
19 | var min = 0; |
19 | var min = 0; |
20 | var max = 10000; |
20 | var max = 10000; |
21 | var value = 100; |
21 | var value = 100; |
22 | break; |
22 | break; |
23 | 23 | ||
24 | case 'Mu': |
24 | case 'Mu': |
25 | var min = 0; |
25 | var min = 0; |
26 | var max = 1; |
26 | var max = 1; |
27 | var value = 0; |
27 | var value = 0; |
28 | break; |
28 | break; |
29 | 29 | ||
30 | case 'Sigma': |
30 | case 'Sigma': |
31 | var min = 0; |
31 | var min = 0; |
32 | var max = 1; |
32 | var max = 1; |
33 | var value = 0.05; |
33 | var value = 0.05; |
34 | break; |
34 | break; |
35 | 35 | ||
36 | case 'AmpBW': |
36 | case 'AmpBW': |
37 | var min = 0; |
37 | var min = 0; |
38 | var max = 100; |
38 | var max = 100; |
39 | var value = 1000; |
39 | var value = 1000; |
40 | break; |
40 | break; |
41 | 41 | ||
42 | case 'Gamma': |
42 | case 'Gamma': |
43 | var min = 0; |
43 | var min = 0; |
44 | var max = 1; |
44 | var max = 1; |
45 | var value = 0.5; |
45 | var value = 0.5; |
46 | break; |
46 | break; |
47 | 47 | ||
48 | case 'M': |
48 | case 'M': |
49 | var min = 0; |
49 | var min = 0; |
50 | var max = 5; |
50 | var max = 5; |
51 | var value = 0; |
51 | var value = 0; |
52 | break; |
52 | break; |
53 | 53 | ||
54 | default: |
54 | default: |
55 | var min = -10; |
55 | var min = -10; |
56 | var max = 10; |
56 | var max = 10; |
57 | var value = 0; |
57 | var value = 0; |
58 | break; |
58 | break; |
59 | } |
59 | } |
60 | 60 | ||
61 | $(this).slider({ |
61 | $(this).slider({ |
62 | range: false, min: min, max: max, value:value, step: 0.0001, |
62 | range: false, min: min, max: max, value:value, step: 0.0001, |
63 | slide: function( event, ui ) { |
63 | slide: function( event, ui ) { |
64 | $( ID.slice(0,n-5)+sframe ).val(ui.value); |
64 | $( ID.slice(0,n-5)+sframe ).val(ui.value); |
65 | calculate(sframe); |
65 | calculate(sframe); |
66 | }, |
66 | }, |
67 | change: function( event, ui ){ |
67 | change: function( event, ui ){ |
68 | $( ID.slice(0,n-5)+sframe ).val(ui.value); |
68 | $( ID.slice(0,n-5)+sframe ).val(ui.value); |
69 | calculate(sframe); |
69 | calculate(sframe); |
70 | } |
70 | } |
71 | }); |
71 | }); |
72 | setDefaultParameters(paramName, sframe); |
72 | setDefaultParameters(paramName, sframe); |
73 | }) |
73 | }) |
74 | }) |
74 | }) |
75 | //Script for initialising range sliders |
75 | //Script for initialising range sliders |
76 | $( function() { |
76 | $( function() { |
77 | $( "#slider-range"+sframe ).slider({ |
77 | $( "#slider-range"+sframe ).slider({ |
78 | range: true, |
78 | range: true, |
79 | min: obj.fXaxis.fXmin, |
79 | min: obj.fXaxis.fXmin, |
80 | max: obj.fXaxis.fXmax, |
80 | max: obj.fXaxis.fXmax, |
81 | step: (obj.fXaxis.fXmax-obj.fXaxis.fXmin)/1000, |
81 | step: (obj.fXaxis.fXmax-obj.fXaxis.fXmin)/1000, |
82 | values: [ obj.fXaxis.fXmin, obj.fXaxis.fXmax ], |
82 | values: [ obj.fXaxis.fXmin, obj.fXaxis.fXmax ], |
83 | slide: function( event, ui ) { |
83 | slide: function( event, ui ) { |
84 | document.getElementById("minRange"+sframe).value = ui.values[0]; |
84 | document.getElementById("minRange"+sframe).value = ui.values[0]; |
85 | document.getElementById("maxRange"+sframe).value = ui.values[1]; |
85 | document.getElementById("maxRange"+sframe).value = ui.values[1]; |
86 | calculate(sframe); |
86 | calculate(sframe); |
87 | } |
87 | } |
88 | }); |
88 | }); |
89 | $("#minRange"+sframe).val($( "#slider-range"+sframe ).slider( "values", 0)); |
89 | $("#minRange"+sframe).val($( "#slider-range"+sframe ).slider( "values", 0)); |
90 | $("#maxRange"+sframe).val($( "#slider-range"+sframe ).slider( "values", 1)); |
90 | $("#maxRange"+sframe).val($( "#slider-range"+sframe ).slider( "values", 1)); |
91 | }); |
91 | }); |
92 | 92 | ||
93 | //Script for choosing polynomial order |
93 | //Script for choosing polynomial order |
94 | $( function() { |
94 | $( function() { |
95 | $( "#slider-polOrder"+sframe ).slider({ |
95 | $( "#slider-polOrder"+sframe ).slider({ |
96 | range: false, |
96 | range: false, |
97 | min: 0, |
97 | min: 0, |
98 | max: 4, |
98 | max: 4, |
99 | step: 1, |
99 | step: 1, |
100 | value: 1, |
100 | value: 1, |
101 | slide: function( event, ui ) { |
101 | slide: function( event, ui ) { |
102 | $( "#polOrderDisplay" + sframe ).val(ui.value); |
102 | $( "#polOrderDisplay" + sframe ).val(ui.value); |
103 | updatePolParamList(ui.value, sframe); |
103 | updatePolParamList(ui.value, sframe); |
104 | var fName = genFunctionName(sframe); |
104 | var fName = genFunctionName(sframe); |
105 | showFormula(fName, sframe); |
105 | showFormula(fName, sframe); |
106 | calculate(sframe); |
106 | calculate(sframe); |
107 | } |
107 | } |
108 | }); |
108 | }); |
109 | $( "#polOrderDisplay" + sframe ).val( $("#slider-polOrder"+sframe).slider("value") ); |
109 | $( "#polOrderDisplay" + sframe ).val( $("#slider-polOrder"+sframe).slider("value") ); |
110 | updatePolParamList($("#slider-polOrder"+sframe).slider("value"), sframe); |
110 | updatePolParamList($("#slider-polOrder"+sframe).slider("value"), sframe); |
111 | }); |
111 | }); |
112 | } |
112 | } |
113 | 113 | ||
114 | function autoFit(sframe){ |
114 | function autoFit(sframe){ |
115 | //works only if histogram is on canvas |
115 | //works only if histogram is on canvas |
116 | //document.getElementById('status').style.display='block'; |
116 | //document.getElementById('status').style.display='block'; |
117 | var xmin = parseFloat(document.getElementById("minRange"+sframe).value); |
117 | var xmin = parseFloat(document.getElementById("minRange"+sframe).value); |
118 | var xmax = parseFloat(document.getElementById("maxRange"+sframe).value); |
118 | var xmax = parseFloat(document.getElementById("maxRange"+sframe).value); |
119 | 119 | ||
120 | //var initParam = getManualParameters();//unused |
120 | //var initParam = getManualParameters();//unused |
121 | var data = getDataFromHisto(sframe); |
121 | var data = getDataFromHisto(sframe); |
122 | var N = data.length; |
122 | var N = data.length; |
123 | 123 | ||
124 | var x = [], y = []; //data points |
124 | var x = [], y = []; //data points |
125 | var NdataPoints = 0; |
125 | var NdataPoints = 0; |
126 | for(var i=0; i<N; ++i){ |
126 | for(var i=0; i<N; ++i){ |
127 | if( (data[i][0] > xmin) && (data[i][0] < xmax)){ |
127 | if( (data[i][0] > xmin) && (data[i][0] < xmax)){ |
128 | x.push(data[i][0]); |
128 | x.push(data[i][0]); |
129 | y.push(data[i][1]); |
129 | y.push(data[i][1]); |
130 | if(data[i][1]>0){NdataPoints++;} |
130 | if(data[i][1]>0){NdataPoints++;} |
131 | } |
131 | } |
132 | } |
132 | } |
133 | var p0 = getManualParameters(sframe); |
133 | var p0 = getManualParameters(sframe); |
134 | var maskParam = getParametersMask(sframe); //use only these parameters, all others are fixed or un used |
134 | var maskParam = getParametersMask(sframe); //use only these parameters, all others are fixed or un used |
135 | var maskParamRange = getParamRangeMask(sframe); |
135 | var maskParamRange = getParamRangeMask(sframe); |
136 | var result = fminsearch(calcMasterFun2, p0, x, y, {maxIter:100, mask:maskParam, maskBond:maskParamRange, sframe:sframe}); |
136 | var result = fminsearch(calcMasterFun2, p0, x, y, {maxIter:100, mask:maskParam, maskBond:maskParamRange, sframe:sframe}); |
137 | var Parm0 = result[0]; |
137 | var Parm0 = result[0]; |
138 | var chi2 = result[1]; |
138 | var chi2 = result[1]; |
139 | setManualParameters(Parm0, maskParam, sframe); // set parameters' values |
139 | setManualParameters(Parm0, maskParam, sframe); // set parameters' values |
140 | var obj = JSROOT.GetMainPainter(sframe).draw_object; |
140 | var obj = JSROOT.GetMainPainter(sframe).draw_object; |
141 | 141 | ||
142 | funkcija = CreateTF1Fit(Parm0, sframe); |
142 | funkcija = CreateTF1Fit(Parm0, sframe); |
143 | funkcija.fChisquare = chi2; |
143 | funkcija.fChisquare = chi2; |
144 | funkcija.fNDF = NdataPoints-getNparameters(sframe); //calculate ndf |
144 | funkcija.fNDF = NdataPoints-getNparameters(sframe); //calculate ndf |
145 | StoreAndDrawFitFunction(obj, funkcija, [xmin, xmax], 1, sframe); |
145 | StoreAndDrawFitFunction(obj, funkcija, [xmin, xmax], 1, sframe); |
146 | } |
146 | } |
147 | 147 | ||
148 | function getParamRangeMask(sframe){ |
148 | function getParamRangeMask(sframe){ |
149 | //return mask to bond parameters inside of range |
149 | //return mask to bond parameters inside of range |
150 | var varList = ['Amplitude', 'Mu', 'Sigma', 'A0', 'A1', 'A2', 'A3', 'A4', 'AmpExp', 'K', 'AmpBW', 'Gamma', 'M']; |
150 | var varList = ['Amplitude', 'Mu', 'Sigma', 'A0', 'A1', 'A2', 'A3', 'A4', 'AmpExp', 'K', 'AmpBW', 'Gamma', 'M']; |
151 | var x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
151 | var x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
152 | var ranges = []; |
152 | var ranges = []; |
153 | for(var i=0; i<varList.length; i++){ |
153 | for(var i=0; i<varList.length; i++){ |
154 | //find fixed values and mask them |
154 | //find fixed values and mask them |
155 | if(document.getElementById('bond'+varList[i] + sframe).checked){ |
155 | if(document.getElementById('bond'+varList[i] + sframe).checked){ |
156 | x[i]=1; |
156 | x[i]=1; |
157 | ranges.push([parseFloat(document.getElementById('Param'+varList[i]+'min'+sframe).value), parseFloat(document.getElementById('Param'+varList[i]+'max'+sframe).value)]); |
157 | ranges.push([parseFloat(document.getElementById('Param'+varList[i]+'min'+sframe).value), parseFloat(document.getElementById('Param'+varList[i]+'max'+sframe).value)]); |
158 | }else{ |
158 | }else{ |
159 | ranges.push([0, 0]); |
159 | ranges.push([0, 0]); |
160 | } |
160 | } |
161 | } |
161 | } |
162 | return [x, ranges] |
162 | return [x, ranges] |
163 | } |
163 | } |
164 | 164 | ||
165 | function calculate(h){ |
165 | function calculate(h){ |
166 | //var x = parseFloat(document.getElementById("xValue").value); |
166 | //var x = parseFloat(document.getElementById("xValue").value); |
167 | var N = 501; // number of points for function ploting |
167 | var N = 501; // number of points for function ploting |
168 | //var funfit = document.getElementById("fitfun").value; |
168 | //var funfit = document.getElementById("fitfun").value; |
169 | 169 | ||
170 | var xmin = parseFloat(document.getElementById("minRange"+h).value); |
170 | var xmin = parseFloat(document.getElementById("minRange"+h).value); |
171 | var xmax = parseFloat(document.getElementById("maxRange"+h).value); |
171 | var xmax = parseFloat(document.getElementById("maxRange"+h).value); |
172 | 172 | ||
173 | var parameters = []; |
173 | var parameters = []; |
174 | parameters = getManualParameters(h); |
174 | parameters = getManualParameters(h); |
175 | 175 | ||
176 | fitMasterFun(xmin, xmax, N, parameters, h); |
176 | fitMasterFun(xmin, xmax, N, parameters, h); |
177 | } |
177 | } |
178 | 178 | ||
179 | function getManualParameters(sframe){ |
179 | function getManualParameters(sframe){ |
180 | var parametri = []; |
180 | var parametri = []; |
181 | var mu = parseFloat(document.getElementById("ParamMu"+sframe).value); |
181 | var mu = parseFloat(document.getElementById("ParamMu"+sframe).value); |
182 | var sigma = parseFloat(document.getElementById("ParamSigma"+sframe).value); |
182 | var sigma = parseFloat(document.getElementById("ParamSigma"+sframe).value); |
183 | var amplitude = parseFloat(document.getElementById("ParamAmplitude"+sframe).value); |
183 | var amplitude = parseFloat(document.getElementById("ParamAmplitude"+sframe).value); |
184 | parametri = [amplitude, mu, sigma]; |
184 | parametri = [amplitude, mu, sigma]; |
185 | 185 | ||
186 | var n = document.getElementById("polOrderDisplay" + sframe).value; |
186 | var n = document.getElementById("polOrderDisplay" + sframe).value; |
187 | for(var i=0; i<5; ++i){ |
187 | for(var i=0; i<5; ++i){ |
188 | if(i<=n){ |
188 | if(i<=n){ |
189 | parametri.push(parseFloat(document.getElementById("ParamA"+i+sframe).value)); |
189 | parametri.push(parseFloat(document.getElementById("ParamA"+i+sframe).value)); |
190 | }else{ |
190 | }else{ |
191 | parametri.push(0); //set higher orders to 0 |
191 | parametri.push(0); //set higher orders to 0 |
192 | } |
192 | } |
193 | } |
193 | } |
194 | 194 | ||
195 | parametri.push(parseFloat(document.getElementById("ParamAmpExp"+sframe).value)); |
195 | parametri.push(parseFloat(document.getElementById("ParamAmpExp"+sframe).value)); |
196 | parametri.push(parseFloat(document.getElementById("ParamK"+sframe).value)); |
196 | parametri.push(parseFloat(document.getElementById("ParamK"+sframe).value)); |
197 | 197 | ||
198 | parametri.push(parseFloat(document.getElementById("ParamAmpBW"+sframe).value)); |
198 | parametri.push(parseFloat(document.getElementById("ParamAmpBW"+sframe).value)); |
199 | parametri.push(parseFloat(document.getElementById("ParamGamma"+sframe).value)); |
199 | parametri.push(parseFloat(document.getElementById("ParamGamma"+sframe).value)); |
200 | parametri.push(parseFloat(document.getElementById("ParamM"+sframe).value)); |
200 | parametri.push(parseFloat(document.getElementById("ParamM"+sframe).value)); |
201 | 201 | ||
202 | return parametri |
202 | return parametri |
203 | } |
203 | } |
204 | 204 | ||
205 | function setManualParameters(p, mask, sframe){ |
205 | function setManualParameters(p, mask, sframe){ |
206 | //sets the value of parameters and correct max or min value if p greater or smaller |
206 | //sets the value of parameters and correct max or min value if p greater or smaller |
207 | 207 | ||
208 | var paramNames = ["Amplitude", "Mu", "Sigma", "A0", "A1", "A2", "A3", "A4", "AmpExp", "K", 'AmpBW', 'Gamma', 'M']; |
208 | var paramNames = ["Amplitude", "Mu", "Sigma", "A0", "A1", "A2", "A3", "A4", "AmpExp", "K", 'AmpBW', 'Gamma', 'M']; |
209 | 209 | ||
210 | for(var i = 0; i<paramNames.length; i++){ |
210 | for(var i = 0; i<paramNames.length; i++){ |
211 | if(mask[i]){ |
211 | if(mask[i]){ |
212 | document.getElementById("Param"+paramNames[i]+sframe).value = p[i]; |
212 | document.getElementById("Param"+paramNames[i]+sframe).value = p[i]; |
213 | 213 | ||
214 | var max = $("#Param"+paramNames[i]+"Set"+sframe).slider("option", "max"); |
214 | var max = $("#Param"+paramNames[i]+"Set"+sframe).slider("option", "max"); |
215 | var min = $("#Param"+paramNames[i]+"Set"+sframe).slider("option", "min"); |
215 | var min = $("#Param"+paramNames[i]+"Set"+sframe).slider("option", "min"); |
216 | 216 | ||
217 | if(p[i] > max){ |
217 | if(p[i] > max){ |
218 | $("#Param"+paramNames[i]+"Set"+sframe).slider("option", "max", p[i]); |
218 | $("#Param"+paramNames[i]+"Set"+sframe).slider("option", "max", p[i]); |
219 | document.getElementById("Param"+paramNames[i]+"max"+sframe).value = p[i]; |
219 | document.getElementById("Param"+paramNames[i]+"max"+sframe).value = p[i]; |
220 | 220 | ||
221 | }; |
221 | }; |
222 | if(p[i] < min){ |
222 | if(p[i] < min){ |
223 | $("#Param"+paramNames[i]+"Set"+sframe).slider("option", "min", p[i]); |
223 | $("#Param"+paramNames[i]+"Set"+sframe).slider("option", "min", p[i]); |
224 | document.getElementById("Param"+paramNames[i]+"min"+sframe).value = p[i]; |
224 | document.getElementById("Param"+paramNames[i]+"min"+sframe).value = p[i]; |
225 | 225 | ||
226 | } |
226 | } |
227 | 227 | ||
228 | $("#Param"+paramNames[i]+"Set"+sframe).slider("value", p[i]); |
228 | $("#Param"+paramNames[i]+"Set"+sframe).slider("value", p[i]); |
229 | } |
229 | } |
230 | } |
230 | } |
231 | } |
231 | } |
232 | 232 | ||
233 | function fitMasterFun(xmin, xmax, N, parametri, sframe){ |
233 | function fitMasterFun(xmin, xmax, N, parametri, sframe){ |
234 | var x = []; |
234 | var x = []; |
235 | var y = []; |
235 | var y = []; |
236 | 236 | ||
237 | for(var i = 0; i<N; i++){ |
237 | for(var i = 0; i<N; i++){ |
238 | x.push((xmax-xmin)*i/N+xmin); |
238 | x.push((xmax-xmin)*i/N+xmin); |
239 | y.push(calcMasterFun(x[i], parametri, sframe)); |
239 | y.push(calcMasterFun(x[i], parametri, sframe)); |
240 | } |
240 | } |
241 | 241 | ||
242 | var data = getDataFromHisto(sframe); |
242 | var data = getDataFromHisto(sframe); |
243 | var sum = 0; |
243 | var sum = 0; |
244 | var NdataPoints = 0; |
244 | var NdataPoints = 0; |
245 | 245 | ||
246 | for(var i=0; i<data.length; ++i){ |
246 | for(var i=0; i<data.length; ++i){ |
247 | //calculate sum of residuals |
247 | //calculate sum of residuals |
248 | if( (data[i][0] > xmin) && (data[i][0] < xmax) && (data[i][1] != 0)){ |
248 | if( (data[i][0] > xmin) && (data[i][0] < xmax) && (data[i][1] != 0)){ |
249 | var yfit = calcMasterFun(data[i][0], parametri, sframe); |
249 | var yfit = calcMasterFun(data[i][0], parametri, sframe); |
250 | var ydata = data[i][1]; |
250 | var ydata = data[i][1]; |
251 | sum += Math.pow(ydata-yfit, 2) / ydata; |
251 | sum += Math.pow(ydata-yfit, 2) / ydata; |
252 | NdataPoints++; |
252 | NdataPoints++; |
253 | } |
253 | } |
254 | } |
254 | } |
255 | 255 | ||
256 | var chi2 = sum.toPrecision(4); |
256 | var chi2 = sum.toPrecision(4); |
257 | //display chi^2 |
257 | //display chi^2 |
258 | document.getElementById("chi2Output"+sframe).innerHTML = chi2; |
258 | document.getElementById("chi2Output"+sframe).innerHTML = chi2; |
259 | 259 | ||
260 | //calculate ndf |
260 | //calculate ndf |
261 | var ndf = NdataPoints; |
261 | var ndf = NdataPoints; |
262 | var Nparameters = getNparameters(sframe); |
262 | var Nparameters = getNparameters(sframe); |
263 | ndf -= Nparameters; |
263 | ndf -= Nparameters; |
264 | 264 | ||
265 | document.getElementById("ndfOutput"+sframe).innerHTML = ndf; |
265 | document.getElementById("ndfOutput"+sframe).innerHTML = ndf; |
266 | document.getElementById("chi2Red"+sframe).innerHTML = (chi2/ndf).toPrecision(4); |
266 | document.getElementById("chi2Red"+sframe).innerHTML = (chi2/ndf).toPrecision(4); |
267 | 267 | ||
268 | var g = JSROOT.CreateTGraph(N, x, y); |
268 | var g = JSROOT.CreateTGraph(N, x, y); |
269 | var isTGraphOn = JSROOT.GetMainPainter(sframe).draw_object.fTGraphPlotted; |
269 | var isTGraphOn = JSROOT.GetMainPainter(sframe).draw_object.fTGraphPlotted; |
270 | if (typeof isTGraphOn === "undefined") { |
270 | if (typeof isTGraphOn === "undefined") { |
271 | //TGraph does not exist yet |
271 | //TGraph does not exist yet |
272 | var a = JSROOT.GetMainPainter(sframe).draw_object; |
272 | var a = JSROOT.GetMainPainter(sframe).draw_object; |
273 | a.fTGraphPlotted = 0; |
273 | a.fTGraphPlotted = 0; |
274 | JSROOT.draw(sframe, g, "", function(){ |
274 | JSROOT.draw(sframe, g, "", function(){ |
275 | var obj = JSROOT.GetMainPainter(sframe).draw_object; |
275 | var obj = JSROOT.GetMainPainter(sframe).draw_object; |
276 | obj.fTGraphPlotted = 1; |
276 | obj.fTGraphPlotted = 1; |
277 | }); |
277 | }); |
278 | } else { |
278 | } else { |
279 | //replot only if TGraph is already plotted, else: it is plotting |
279 | //replot only if TGraph is already plotted, else: it is plotting |
280 | if(isTGraphOn==1){JSROOT.redraw(sframe, g, "");} |
280 | if(isTGraphOn==1){JSROOT.redraw(sframe, g, "");} |
281 | } |
281 | } |
282 | 282 | ||
283 | } |
283 | } |
284 | 284 | ||
285 | function getNparameters(sframe){ |
285 | function getNparameters(sframe){ |
286 | var x = 0; |
286 | var x = 0; |
287 | var funList = getFunList(sframe); |
287 | var funList = getFunList(sframe); |
288 | if(funList[0]==1){ |
288 | if(funList[0]==1){ |
289 | //Gaus has 3 parameters |
289 | //Gaus has 3 parameters |
290 | x += 3; |
290 | x += 3; |
291 | } |
291 | } |
292 | 292 | ||
293 | if(funList[1]){ |
293 | if(funList[1]){ |
294 | //Substract (polynomial order + 1) |
294 | //Substract (polynomial order + 1) |
295 | x += parseInt(document.getElementById("polOrderDisplay" + sframe).value)+1; |
295 | x += parseInt(document.getElementById("polOrderDisplay" + sframe).value)+1; |
296 | } |
296 | } |
297 | 297 | ||
298 | if(funList[2]){ |
298 | if(funList[2]){ |
299 | //Exponential function has 2 parameters |
299 | //Exponential function has 2 parameters |
300 | x += 2; |
300 | x += 2; |
301 | } |
301 | } |
302 | return x |
302 | return x |
303 | } |
303 | } |
304 | 304 | ||
305 | function getParametersMask(sframe){ |
305 | function getParametersMask(sframe){ |
306 | //return mask to fix parameters |
306 | //return mask to fix parameters |
307 | var x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
307 | var x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
308 | var varList = ['Amplitude', 'Mu', 'Sigma', 'A0', 'A1', 'A2', 'A3', 'A4', 'AmpExp', 'K', 'AmpBW', 'Gamma', 'M']; |
308 | var varList = ['Amplitude', 'Mu', 'Sigma', 'A0', 'A1', 'A2', 'A3', 'A4', 'AmpExp', 'K', 'AmpBW', 'Gamma', 'M']; |
309 | var i; |
309 | var i; |
310 | var funList = getFunList(sframe); |
310 | var funList = getFunList(sframe); |
311 | if(funList[0]==1){ |
311 | if(funList[0]==1){ |
312 | //Gaus has 3 parameters |
312 | //Gaus has 3 parameters |
313 | for(i = 0; i < 3; i++){ |
313 | for(i = 0; i < 3; i++){ |
314 | x[i] = 1; |
314 | x[i] = 1; |
315 | } |
315 | } |
316 | } |
316 | } |
317 | i = 3; |
317 | i = 3; |
318 | if(funList[1]){ |
318 | if(funList[1]){ |
319 | //Substract (polynomial order + 1) |
319 | //Substract (polynomial order + 1) |
320 | var order = parseInt(document.getElementById("polOrderDisplay" + sframe).value); |
320 | var order = parseInt(document.getElementById("polOrderDisplay" + sframe).value); |
321 | for(var j=0; j < order+1; j++){ |
321 | for(var j=0; j < order+1; j++){ |
322 | x[i] = 1; |
322 | x[i] = 1; |
323 | i++; |
323 | i++; |
324 | } |
324 | } |
325 | } |
325 | } |
326 | 326 | ||
327 | if(funList[2]){ |
327 | if(funList[2]){ |
328 | //Exponential function has 2 parameters |
328 | //Exponential function has 2 parameters |
329 | x[8] = 1; |
329 | x[8] = 1; |
330 | x[9] = 1; |
330 | x[9] = 1; |
331 | } |
331 | } |
332 | 332 | ||
333 | if(funList[3]){ |
333 | if(funList[3]){ |
334 | //BW function has 3 parameters |
334 | //BW function has 3 parameters |
335 | x[10] = 1; |
335 | x[10] = 1; |
336 | x[11] = 1; |
336 | x[11] = 1; |
337 | x[12] = 1; |
337 | x[12] = 1; |
338 | } |
338 | } |
339 | 339 | ||
340 | for(var i=0; i<varList.length; i++){ |
340 | for(var i=0; i<varList.length; i++){ |
341 | //find fixed values and mask them |
341 | //find fixed values and mask them |
342 | if(document.getElementById('fix'+varList[i]+sframe).checked){ |
342 | if(document.getElementById('fix'+varList[i]+sframe).checked){ |
343 | x[i]=0; |
343 | x[i]=0; |
344 | } |
344 | } |
345 | } |
345 | } |
346 | return x |
346 | return x |
347 | } |
347 | } |
348 | 348 | ||
349 | function getDataFromHisto(divid){ |
349 | function getDataFromHisto(divid){ |
350 | //get x and y from ploted histogram, and compute y_fit for ploted x and calculate chi^2 |
350 | //get x and y from ploted histogram, and compute y_fit for ploted x and calculate chi^2 |
351 | var obj = JSROOT.GetMainPainter(divid).draw_object; |
351 | var obj = JSROOT.GetMainPainter(divid).draw_object; |
352 | var N = obj.fNcells; |
352 | var N = obj.fNcells; |
353 | var x = []; |
353 | var x = []; |
354 | var y = []; |
354 | var y = []; |
355 | var data = []; |
355 | var data = []; |
356 | for(var i=1; i<=N-2; ++i){ |
356 | for(var i=1; i<=N-2; ++i){ |
357 | data.push([obj.fXaxis.GetBinCenter(i), obj.fArray[i]]); |
357 | data.push([obj.fXaxis.GetBinCenter(i), obj.fArray[i]]); |
358 | } |
358 | } |
359 | 359 | ||
360 | return data |
360 | return data |
361 | } |
361 | } |
362 | 362 | ||
363 | function calcMasterFun(x, parametri, sframe){ |
363 | function calcMasterFun(x, parametri, sframe){ |
364 | //calculates function gaus + pol + exp |
364 | //calculates function gaus + pol + exp |
365 | parametriGaus = [parametri[0], parametri[1], parametri[2]]; |
365 | parametriGaus = [parametri[0], parametri[1], parametri[2]]; |
366 | parametriPol = [parametri[3], parametri[4], parametri[5], parametri[6], parametri[7]]; |
366 | parametriPol = [parametri[3], parametri[4], parametri[5], parametri[6], parametri[7]]; |
367 | parametriExp = [parametri[8], parametri[9]]; |
367 | parametriExp = [parametri[8], parametri[9]]; |
368 | parametriBW = [parametri[10], parametri[11], parametri[12]]; |
368 | parametriBW = [parametri[10], parametri[11], parametri[12]]; |
369 | var funList = getFunList(sframe); |
369 | var funList = getFunList(sframe); |
370 | return funList[0]*gaus(x, parametriGaus) + funList[1]*pol(x, parametriPol) + funList[2]*expo(x, parametriExp) + funList[3]*BW(x, parametriBW); |
370 | return funList[0]*gaus(x, parametriGaus) + funList[1]*pol(x, parametriPol) + funList[2]*expo(x, parametriExp) + funList[3]*BW(x, parametriBW); |
371 | } |
371 | } |
372 | 372 | ||
373 | function calcMasterFun2(x, parametri, sframe){ |
373 | function calcMasterFun2(x, parametri, sframe){ |
374 | //calculates function gaus + pol + exp, x must be vector |
374 | //calculates function gaus + pol + exp, x must be vector |
375 | return x.map(function(xi){return (calcMasterFun(xi, parametri, sframe))}); |
375 | return x.map(function(xi){return (calcMasterFun(xi, parametri, sframe))}); |
376 | } |
376 | } |
377 | 377 | ||
378 | function pol(x, p){ |
378 | function pol(x, p){ |
379 | var n = p.length; |
379 | var n = p.length; |
380 | if(n > 5){ |
380 | if(n > 5){ |
381 | alert("Only pol5 is implemented"); |
381 | alert("Only pol5 is implemented"); |
382 | return "Error" |
382 | return "Error" |
383 | } else { |
383 | } else { |
384 | for(var i = n; i<5; i++){ |
384 | for(var i = n; i<5; i++){ |
385 | p[i] = 0; |
385 | p[i] = 0; |
386 | } |
386 | } |
387 | return p[0] + x * p[1] + x**2 * p[2] + x**3 * p[3] + x**4 * p[4]; |
387 | return p[0] + x * p[1] + x**2 * p[2] + x**3 * p[3] + x**4 * p[4]; |
388 | } |
388 | } |
389 | } |
389 | } |
390 | 390 | ||
391 | function gaus(x, p){ |
391 | function gaus(x, p){ |
392 | var amplitude = p[0] |
392 | var amplitude = p[0] |
393 | var mu = p[1]; |
393 | var mu = p[1]; |
394 | var sigma = p[2]; |
394 | var sigma = p[2]; |
395 | 395 | ||
396 | return amplitude * Math.exp(-0.5 * Math.pow((x-mu) / sigma, 2)); |
396 | return amplitude * Math.exp(-0.5 * Math.pow((x-mu) / sigma, 2)); |
397 | } |
397 | } |
398 | 398 | ||
399 | function expo(x, p){ |
399 | function expo(x, p){ |
400 | var a = p[0]; |
400 | var a = p[0]; |
401 | var k = p[1]; |
401 | var k = p[1]; |
402 | return a * Math.exp(k * x); |
402 | return a * Math.exp(k * x); |
403 | } |
403 | } |
404 | 404 | ||
405 | function BW(x, p){ |
405 | function BW(x, p){ |
406 | var a = p[0]; |
406 | var a = p[0]; |
407 | var gamma = p[1]; |
407 | var gamma = p[1]; |
408 | var M = p[2]; |
408 | var M = p[2]; |
409 | return a / (2 * Math.PI) * gamma / (Math.pow(x-M, 2) + Math.pow(gamma/2, 2)); |
409 | return a / (2 * Math.PI) * gamma / (Math.pow(x-M, 2) + Math.pow(gamma/2, 2)); |
410 | } |
410 | } |
411 | 411 | ||
412 | function divClean(divid){ |
412 | function divClean(divid){ |
413 | JSROOT.cleanup(divid); |
413 | JSROOT.cleanup(divid); |
414 | } |
414 | } |
415 | 415 | ||
416 | function getFunList(sframe){ |
416 | function getFunList(sframe){ |
417 | //returns funList from funMatrix |
417 | //returns funList from funMatrix |
418 | var k = parseInt(sframe.slice(1)); //get histogram number 0, 1, 2, ... |
418 | var k = parseInt(sframe.slice(1)); //get histogram number 0, 1, 2, ... |
419 | return funMatrix[k] |
419 | return funMatrix[k] |
420 | } |
420 | } |
421 | 421 | ||
422 | function genFunList(sframe){ |
422 | function genFunList(sframe){ |
423 | //sframe - string name: h0, h1, ... |
423 | //sframe - string name: h0, h1, ... |
424 | //actualy does not show, but only creates funList, funList should go in TH1.funList? |
424 | //actualy does not show, but only creates funList, funList should go in TH1.funList? |
425 | var funfit = document.getElementById("selectFitFun"+sframe).value; |
425 | var funfit = document.getElementById("selectFitFun"+sframe).value; |
426 | var funfit2 = funfit.split(/[ +]/); |
426 | var funfit2 = funfit.split(/[ +]/); |
427 | var implementedFun = ["gaus", "pol", "expo", "BW"] // |
427 | var implementedFun = ["gaus", "pol", "expo", "BW"] // |
428 | var funList = getFunList(sframe); |
428 | var funList = getFunList(sframe); |
429 | var k = parseInt(sframe.slice(1)); //get histogram number 0, 1, 2, ... |
429 | var k = parseInt(sframe.slice(1)); //get histogram number 0, 1, 2, ... |
430 | 430 | ||
431 | for (var i = 0; i < implementedFun.length; i++) { |
431 | for (var i = 0; i < implementedFun.length; i++) { |
432 | if (funfit2.includes(implementedFun[i])) { |
432 | if (funfit2.includes(implementedFun[i])) { |
433 | funList[i] = 1; |
433 | funList[i] = 1; |
434 | funMatrix[k][i] = 1; |
434 | funMatrix[k][i] = 1; |
435 | document.getElementById(implementedFun[i]+"FitPanel"+sframe).style.display = "block"; |
435 | document.getElementById(implementedFun[i]+"FitPanel"+sframe).style.display = "block"; |
436 | } else { |
436 | } else { |
437 | funList[i] = 0; |
437 | funList[i] = 0; |
438 | funMatrix[k][i] = 0; |
438 | funMatrix[k][i] = 0; |
439 | document.getElementById(implementedFun[i]+"FitPanel"+sframe).style.display = "none"; |
439 | document.getElementById(implementedFun[i]+"FitPanel"+sframe).style.display = "none"; |
440 | } |
440 | } |
441 | } |
441 | } |
442 | 442 | ||
443 | var fName = genFunctionName(sframe); |
443 | var fName = genFunctionName(sframe); |
444 | showFormula(fName, sframe); |
444 | showFormula(fName, sframe); |
445 | if((funMatrix[k][0]+funMatrix[k][1]+funMatrix[k][2]+funMatrix[k][3]) == 0){ alert("These are implemented functions:\n" + implementedFun.toString()) } // |
445 | if((funMatrix[k][0]+funMatrix[k][1]+funMatrix[k][2]+funMatrix[k][3]) == 0){ alert("These are implemented functions:\n" + implementedFun.toString()) } // |
446 | } |
446 | } |
447 | 447 | ||
448 | function genFunctionName(sframe){ |
448 | function genFunctionName(sframe){ |
449 | var funList = getFunList(sframe); |
449 | var funList = getFunList(sframe); |
450 | var fName = ""; |
450 | var fName = ""; |
451 | var Npar = 0; |
451 | var Npar = 0; |
452 | if(funList[0]){ |
452 | if(funList[0]){ |
453 | //Gaus function |
453 | //Gaus function |
454 | fName = "N \\cdot e^{-(\\frac{x-\\mu}{2 \\sigma})^2}"; |
454 | fName = "N \\cdot e^{-(\\frac{x-\\mu}{2 \\sigma})^2}"; |
455 | Npar += 3; |
455 | Npar += 3; |
456 | } |
456 | } |
457 | 457 | ||
458 | if(funList[1]){ |
458 | if(funList[1]){ |
459 | //pol function |
459 | //pol function |
460 | var n = parseInt(document.getElementById("polOrderDisplay"+sframe).value); |
460 | var n = parseInt(document.getElementById("polOrderDisplay"+sframe).value); |
461 | 461 | ||
462 | for(var i=0; i<=n; ++i){ |
462 | for(var i=0; i<=n; ++i){ |
463 | if((i>0) || (Npar > 0)){ |
463 | if((i>0) || (Npar > 0)){ |
464 | fName += " + "; |
464 | fName += " + "; |
465 | } |
465 | } |
466 | 466 | ||
467 | if(i==0){ |
467 | if(i==0){ |
468 | fName += "p" + String(i); |
468 | fName += "p" + String(i); |
469 | }else{ |
469 | }else{ |
470 | if(i==1){ |
470 | if(i==1){ |
471 | fName += "p" + String(i) + " \\cdot x"; |
471 | fName += "p" + String(i) + " \\cdot x"; |
472 | }else{ |
472 | }else{ |
473 | fName += "p" + String(i) + " \\cdot x^" + String(i); |
473 | fName += "p" + String(i) + " \\cdot x^" + String(i); |
474 | } |
474 | } |
475 | } |
475 | } |
476 | } |
476 | } |
477 | Npar += n+1; |
477 | Npar += n+1; |
478 | } |
478 | } |
479 | 479 | ||
480 | if(funList[2]){ |
480 | if(funList[2]){ |
481 | if((Npar > 0)){ |
481 | if((Npar > 0)){ |
482 | fName += " + "; |
482 | fName += " + "; |
483 | } |
483 | } |
484 | fName += "N_{exp} \\cdot e^{K \\cdot x}"; |
484 | fName += "N_{exp} \\cdot e^{K \\cdot x}"; |
485 | Npar += 2; |
485 | Npar += 2; |
486 | } |
486 | } |
487 | 487 | ||
488 | if(funList[3]){ |
488 | if(funList[3]){ |
489 | if((Npar > 0)){ |
489 | if((Npar > 0)){ |
490 | fName += " + "; |
490 | fName += " + "; |
491 | } |
491 | } |
492 | fName += "N_{BW} \\cdot \\frac{1}{2 \\pi} \\frac{\\Gamma}{(x - |
492 | fName += "N_{BW} \\cdot \\frac{1}{2 \\pi} \\frac{\\Gamma}{(x - M_{BW})^2 + (\\Gamma/2)^2} "; // * [Gamma] / ((x - [MeanBW])^2 + ([Gamma]/2)^2) |
493 | 493 | ||
494 | Npar += 3; |
494 | Npar += 3; |
495 | } |
495 | } |
496 | return fName; |
496 | return fName; |
497 | } |
497 | } |
498 | 498 | ||
499 | function updatePolParamList(n, sframe){ |
499 | function updatePolParamList(n, sframe){ |
500 | //disables or enables inputs in table for diferent parameters |
500 | //disables or enables inputs in table for diferent parameters |
501 | if(n>=0){ |
501 | if(n>=0){ |
502 | disableInput(false, "listA0"+sframe, sframe); |
502 | disableInput(false, "listA0"+sframe, sframe); |
503 | }else{ |
503 | }else{ |
504 | disableInput(true, "listA0"+sframe, sframe); |
504 | disableInput(true, "listA0"+sframe, sframe); |
505 | } |
505 | } |
506 | 506 | ||
507 | if(n>=1){ |
507 | if(n>=1){ |
508 | disableInput(false, "listA1"+sframe, sframe); |
508 | disableInput(false, "listA1"+sframe, sframe); |
509 | }else{ |
509 | }else{ |
510 | disableInput(true, "listA1"+sframe, sframe); |
510 | disableInput(true, "listA1"+sframe, sframe); |
511 | } |
511 | } |
512 | 512 | ||
513 | if(n>=2){ |
513 | if(n>=2){ |
514 | disableInput(false, "listA2"+sframe, sframe); |
514 | disableInput(false, "listA2"+sframe, sframe); |
515 | }else{ |
515 | }else{ |
516 | disableInput(true, "listA2"+sframe, sframe); |
516 | disableInput(true, "listA2"+sframe, sframe); |
517 | } |
517 | } |
518 | 518 | ||
519 | if(n>=3){ |
519 | if(n>=3){ |
520 | disableInput(false, "listA3"+sframe, sframe); |
520 | disableInput(false, "listA3"+sframe, sframe); |
521 | }else{ |
521 | }else{ |
522 | disableInput(true, "listA3"+sframe, sframe); |
522 | disableInput(true, "listA3"+sframe, sframe); |
523 | } |
523 | } |
524 | 524 | ||
525 | if(n>=4){ |
525 | if(n>=4){ |
526 | disableInput(false, "listA4"+sframe, sframe); |
526 | disableInput(false, "listA4"+sframe, sframe); |
527 | }else{ |
527 | }else{ |
528 | disableInput(true, "listA4"+sframe, sframe); |
528 | disableInput(true, "listA4"+sframe, sframe); |
529 | } |
529 | } |
530 | 530 | ||
531 | if(n>4){ |
531 | if(n>4){ |
532 | alert("Only pol4 is inplemented!"); |
532 | alert("Only pol4 is inplemented!"); |
533 | }else{ |
533 | }else{ |
534 | if(n<0){alert("Error, wrong number " + n);} |
534 | if(n<0){alert("Error, wrong number " + n);} |
535 | } |
535 | } |
536 | } |
536 | } |
537 | 537 | ||
538 | function disableInput(state, objId, sframe){ |
538 | function disableInput(state, objId, sframe){ |
539 | //Change disabled state of parameters inputs |
539 | //Change disabled state of parameters inputs |
540 | disableParamSlider(state, objId, sframe); |
540 | disableParamSlider(state, objId, sframe); |
541 | var obj = document.getElementById(objId).getElementsByTagName("input");//find inputs inside of row |
541 | var obj = document.getElementById(objId).getElementsByTagName("input");//find inputs inside of row |
542 | for (var i = 0; i < obj.length; i++) { |
542 | for (var i = 0; i < obj.length; i++) { |
543 | obj[i].disabled = state; //set state of inputs |
543 | obj[i].disabled = state; //set state of inputs |
544 | } |
544 | } |
545 | } |
545 | } |
546 | 546 | ||
547 | function disableParamSlider(state, objId, sframe){ |
547 | function disableParamSlider(state, objId, sframe){ |
548 | //Disables slider if state is true and enables if state is false. |
548 | //Disables slider if state is true and enables if state is false. |
549 | var name = String(objId[objId.length-2])+ String(objId[objId.length-1]); |
549 | var name = String(objId[objId.length-2])+ String(objId[objId.length-1]); |
550 | switch (state) { |
550 | switch (state) { |
551 | case true: |
551 | case true: |
552 | $("#Param"+name+"Set"+sframe).slider("disable"); |
552 | $("#Param"+name+"Set"+sframe).slider("disable"); |
553 | break; |
553 | break; |
554 | 554 | ||
555 | case false: |
555 | case false: |
556 | $("#Param"+name+"Set"+sframe).slider("enable"); |
556 | $("#Param"+name+"Set"+sframe).slider("enable"); |
557 | break; |
557 | break; |
558 | 558 | ||
559 | default: |
559 | default: |
560 | break; |
560 | break; |
561 | } |
561 | } |
562 | } |
562 | } |
563 | 563 | ||
564 | 564 | ||
565 | function setDefaultParameters(name, sframe){ |
565 | function setDefaultParameters(name, sframe){ |
566 | //this function is used for setting parameters back to their default value after page refresh |
566 | //this function is used for setting parameters back to their default value after page refresh |
567 | $( "#Param"+name+sframe).val( $("#Param"+name+"Set"+sframe).slider("value") ); |
567 | $( "#Param"+name+sframe).val( $("#Param"+name+"Set"+sframe).slider("value") ); |
568 | $( "#Param"+name+"min"+sframe ).val( $("#Param"+name+"Set"+sframe).slider("option", "min") ); |
568 | $( "#Param"+name+"min"+sframe ).val( $("#Param"+name+"Set"+sframe).slider("option", "min") ); |
569 | $( "#Param"+name+"max"+sframe ).val( $("#Param"+name+"Set"+sframe).slider("option", "max") ); |
569 | $( "#Param"+name+"max"+sframe ).val( $("#Param"+name+"Set"+sframe).slider("option", "max") ); |
570 | $( "#Param"+name+"step"+sframe ).val( $("#Param"+name+"Set"+sframe).slider("option", "step") ); |
570 | $( "#Param"+name+"step"+sframe ).val( $("#Param"+name+"Set"+sframe).slider("option", "step") ); |
571 | } |
571 | } |
572 | 572 | ||
573 | function updateSetSlider(id){ |
573 | function updateSetSlider(id){ |
574 | //Get id to update its slider ?min? value |
574 | //Get id to update its slider ?min? value |
575 | var sframe = id.id.slice(id.id.length-2); |
575 | var sframe = id.id.slice(id.id.length-2); |
576 | var last = id.id[id.id.length-3]; //it can be steP, maX or miN |
576 | var last = id.id[id.id.length-3]; //it can be steP, maX or miN |
577 | switch (last) { |
577 | switch (last) { |
578 | case "p": |
578 | case "p": |
579 | $("#Param"+id.name+"Set"+sframe).slider("option", "step", parseFloat(id.value)); |
579 | $("#Param"+id.name+"Set"+sframe).slider("option", "step", parseFloat(id.value)); |
580 | break; |
580 | break; |
581 | 581 | ||
582 | case "x": |
582 | case "x": |
583 | $("#Param"+id.name+"Set"+sframe).slider("option", "max", parseFloat(id.value)); |
583 | $("#Param"+id.name+"Set"+sframe).slider("option", "max", parseFloat(id.value)); |
584 | break; |
584 | break; |
585 | 585 | ||
586 | case "n": |
586 | case "n": |
587 | $("#Param"+id.name+"Set"+sframe).slider("option", "min", parseFloat(id.value)); |
587 | $("#Param"+id.name+"Set"+sframe).slider("option", "min", parseFloat(id.value)); |
588 | break; |
588 | break; |
589 | 589 | ||
590 | default: |
590 | default: |
591 | if(id.value > $("#Param"+id.name+"Set"+sframe).slider("option", "max")){ alert("Inserted value is to big."); } |
591 | if(id.value > $("#Param"+id.name+"Set"+sframe).slider("option", "max")){ alert("Inserted value is to big."); } |
592 | if(id.value < $("#Param"+id.name+"Set"+sframe).slider("option", "min")){ alert("Inserted value is to small."); } |
592 | if(id.value < $("#Param"+id.name+"Set"+sframe).slider("option", "min")){ alert("Inserted value is to small."); } |
593 | $("#Param"+id.name+"Set"+sframe).slider("value", parseFloat(id.value)); |
593 | $("#Param"+id.name+"Set"+sframe).slider("value", parseFloat(id.value)); |
594 | break; |
594 | break; |
595 | } |
595 | } |
596 | } |
596 | } |
597 | 597 | ||
598 | function insertHTML(sframe, callback){ |
598 | function insertHTML(sframe, callback){ |
599 | var r = document.getElementById('fit'+sframe); |
599 | var r = document.getElementById('fit'+sframe); |
600 | var htmlCode = generateHTMLcode(sframe); |
600 | var htmlCode = generateHTMLcode(sframe); |
601 | r.insertAdjacentHTML('beforeend', htmlCode); |
601 | r.insertAdjacentHTML('beforeend', htmlCode); |
602 | if(callback!=null){callback(sframe)} |
602 | if(callback!=null){callback(sframe)} |
603 | } |
603 | } |
604 | 604 | ||
605 | function generateHTMLcode(sframe){ |
605 | function generateHTMLcode(sframe){ |
606 | 606 | ||
607 | mform = '<button type="button" onclick="calculate('+ "'" + sframe + "'"+')">Draw Function</button>'; |
607 | mform = '<button type="button" onclick="calculate('+ "'" + sframe + "'"+')">Draw Function</button>'; |
608 | mform += '<button type="button" onclick="autoFit('+ "'" + sframe + "'"+')">Click to fit</button>'; |
608 | mform += '<button type="button" onclick="autoFit('+ "'" + sframe + "'"+')">Click to fit</button>'; |
609 | mform += '<div class="rangeSettings">'; |
609 | mform += '<div class="rangeSettings">'; |
610 | mform += 'Range: min = <input type="text" size="2" value="-5" name="min" id="minRange'+sframe+'" disabled=true>'; |
610 | mform += 'Range: min = <input type="text" size="2" value="-5" name="min" id="minRange'+sframe+'" disabled=true>'; |
611 | mform += 'max = <input type="text" size="2" value="5" name="max" id="maxRange'+sframe+'" disabled=true>'; |
611 | mform += 'max = <input type="text" size="2" value="5" name="max" id="maxRange'+sframe+'" disabled=true>'; |
612 | mform += '<div style="display: inline-block;">'; |
612 | mform += '<div style="display: inline-block;">'; |
613 | mform += ' χ²/ndf = <output id="chi2Output'+ sframe +'"></output> / <output id="ndfOutput'+ sframe +'"></output> = <output id="chi2Red'+ sframe +'"></output> <br>'; |
613 | mform += ' χ²/ndf = <output id="chi2Output'+ sframe +'"></output> / <output id="ndfOutput'+ sframe +'"></output> = <output id="chi2Red'+ sframe +'"></output> <br>'; |
614 | mform += '</div>'; |
614 | mform += '</div>'; |
615 | mform += '<div class="slidecontainer" style="width:600px">'; |
615 | mform += '<div class="slidecontainer" style="width:600px">'; |
616 | mform += '<div class="slider-range" id="slider-range'+ sframe +'"></div>'; |
616 | mform += '<div class="slider-range" id="slider-range'+ sframe +'"></div>'; |
617 | mform += '</div>'; |
617 | mform += '</div>'; |
618 | mform += '</div>' |
618 | mform += '</div>' |
619 | mform += ' <div id="fitPanel">' |
619 | mform += ' <div id="fitPanel">' |
620 | mform += ' <div class="functionSelect">' |
620 | mform += ' <div class="functionSelect">' |
621 | mform += ' Function:' |
621 | mform += ' Function:' |
622 | mform += ' <select name="fitfun" id="selectFitFun'+sframe+'" onclick="genFunList(' + "'" + sframe + "'"+ ')">' |
622 | mform += ' <select name="fitfun" id="selectFitFun'+sframe+'" onclick="genFunList(' + "'" + sframe + "'"+ ')">' |
623 | mform += ' <option value="gaus">Gaus</option>' |
623 | mform += ' <option value="gaus">Gaus</option>' |
624 | mform += ' <option value="pol">Poly</option>' |
624 | mform += ' <option value="pol">Poly</option>' |
625 | mform += ' <option value="expo">Expo</option>' |
625 | mform += ' <option value="expo">Expo</option>' |
626 | mform += ' <option value="BW">Breit-Wigner</option>' |
626 | mform += ' <option value="BW">Breit-Wigner</option>' |
- | 627 | mform += ' <option disabled="disabled">--------</option>' |
|
627 | mform += ' <option value="gaus+pol">Gaus + Poly</option>' |
628 | mform += ' <option value="gaus+pol">Gaus + Poly</option>' |
628 | mform += ' <option value="gaus+expo">Gaus + Expo</option>' |
629 | mform += ' <option value="gaus+expo">Gaus + Expo</option>' |
629 | mform += ' <option value="BW+gaus">Gaus + Breit-Wigner</option>' |
630 | mform += ' <option value="BW+gaus">Gaus + Breit-Wigner</option>' |
630 | mform += ' <option value="pol+expo">Poly + Expo</option>' |
631 | mform += ' <option value="pol+expo">Poly + Expo</option>' |
631 | mform += ' <option value="BW+pol">Poly + Breit-Wigner</option>' |
632 | mform += ' <option value="BW+pol">Poly + Breit-Wigner</option>' |
632 | mform += ' <option value="BW+expo">Expo + Breit-Wigner</option>' |
633 | mform += ' <option value="BW+expo">Expo + Breit-Wigner</option>' |
- | 634 | mform += ' <option disabled="disabled">--------</option>' |
|
633 | mform += ' <option value="BW+expo+pol">Breit-Wigner + Poly + Expo</option>' |
635 | mform += ' <option value="BW+expo+pol">Breit-Wigner + Poly + Expo</option>' |
634 | mform += ' <option value="BW+gaus+pol">Breit-Wigner + Poly + Gaus</option>' |
636 | mform += ' <option value="BW+gaus+pol">Breit-Wigner + Poly + Gaus</option>' |
635 | mform += ' <option value="BW+expo+gaus">Breit-Wigner + Expo + Gaus</option>' |
637 | mform += ' <option value="BW+expo+gaus">Breit-Wigner + Expo + Gaus</option>' |
636 | mform += ' <option value="gaus+pol+expo">Gaus + Poly + Expo</option>' |
638 | mform += ' <option value="gaus+pol+expo">Gaus + Poly + Expo</option>' |
637 | mform += ' <option value="BW+expo+gaus+pol">Breit-Wigner + Expo + Gaus + Poly</option>' |
639 | mform += ' <option value="BW+expo+gaus+pol">Breit-Wigner + Expo + Gaus + Poly</option>' |
638 | mform += ' </select>' |
640 | mform += ' </select>' |
639 | mform += ' <span id="functionDisplay'+sframe+'"></span>' |
641 | mform += ' <span id="functionDisplay'+sframe+'" style="font-size:32px"></span>' |
640 | mform += ' </div>' |
642 | mform += ' </div>' |
641 | mform += ' <!--' |
643 | mform += ' <!--' |
642 | mform += ' This was replaced b select:option' |
644 | mform += ' This was replaced b select:option' |
643 | mform += ' <input type="text" name="fitfun" id="fitfun" value="pol" onblur="genFunList()"><br>' |
645 | mform += ' <input type="text" name="fitfun" id="fitfun" value="pol" onblur="genFunList()"><br>' |
644 | mform += ' -->' |
646 | mform += ' -->' |
645 | mform += ' <div id="gausFitPanel' + sframe + '" class="FitPanel">' |
647 | mform += ' <div id="gausFitPanel' + sframe + '" class="FitPanel">' |
646 | mform += ' <table class="inputParametersTable" id="inputParamTableGaus">' |
648 | mform += ' <table class="inputParametersTable" id="inputParamTableGaus">' |
647 | mform += ' <tbody>' |
649 | mform += ' <tbody>' |
648 | mform += ' <tr class="description">' |
650 | mform += ' <tr class="description">' |
649 | mform += ' <td>Name</td>' |
651 | mform += ' <td>Name</td>' |
650 | mform += ' <td>Fix</td>' |
652 | mform += ' <td>Fix</td>' |
651 | mform += ' <td>Bond</td>' |
653 | mform += ' <td>Bond</td>' |
652 | mform += ' <td>Value</td>' |
654 | mform += ' <td>Value</td>' |
653 | mform += ' <td>Min</td>' |
655 | mform += ' <td>Min</td>' |
654 | mform += ' <td>Set</td>' |
656 | mform += ' <td>Set</td>' |
655 | mform += ' <td>Max</td>' |
657 | mform += ' <td>Max</td>' |
656 | mform += ' <td>Step</td>' |
658 | mform += ' <td>Step</td>' |
657 | mform += ' </tr>' |
659 | mform += ' </tr>' |
658 | mform += ' <tr id="listMu">' |
660 | mform += ' <tr id="listMu">' |
659 | mform += ' <td><li>μ:</td>' |
661 | mform += ' <td><li>μ:</td>' |
660 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixMu'+sframe+'"></td>' |
662 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixMu'+sframe+'"></td>' |
661 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondMu'+sframe+'"></td>' |
663 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondMu'+sframe+'"></td>' |
662 | mform += ' <td><input type="text" class="inputParam" id="ParamMu'+sframe+'" name="Mu" value="0" onblur="updateSetSlider(this)"></td>' |
664 | mform += ' <td><input type="text" class="inputParam" id="ParamMu'+sframe+'" name="Mu" value="0" onblur="updateSetSlider(this)"></td>' |
663 | mform += ' <td><input type="text" class="inputParam" id="ParamMumin'+sframe+'" name="Mu" onkeyup="updateSetSlider(this)"></td>' |
665 | mform += ' <td><input type="text" class="inputParam" id="ParamMumin'+sframe+'" name="Mu" onkeyup="updateSetSlider(this)"></td>' |
664 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamMuSet'+sframe+'"></div></td>' |
666 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamMuSet'+sframe+'"></div></td>' |
665 | mform += ' <td><input type="text" class="inputParam" id="ParamMumax'+sframe+'" name="Mu" onkeyup="updateSetSlider(this)"></td>' |
667 | mform += ' <td><input type="text" class="inputParam" id="ParamMumax'+sframe+'" name="Mu" onkeyup="updateSetSlider(this)"></td>' |
666 | mform += ' <td><input type="text" class="inputParam" id="ParamMustep'+sframe+'" name="Mu" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
668 | mform += ' <td><input type="text" class="inputParam" id="ParamMustep'+sframe+'" name="Mu" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
667 | mform += ' </tr>' |
669 | mform += ' </tr>' |
668 | mform += ' <tr id="listSigma">' |
670 | mform += ' <tr id="listSigma">' |
669 | mform += ' <td><li>σ:</td>' |
671 | mform += ' <td><li>σ:</td>' |
670 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixSigma'+sframe+'"></td>' |
672 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixSigma'+sframe+'"></td>' |
671 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondSigma'+sframe+'"></td>' |
673 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondSigma'+sframe+'"></td>' |
672 | mform += ' <td><input type="text" class="inputParam" id="ParamSigma'+sframe+'" name="Sigma" value="1" onblur="updateSetSlider(this)"></td>' |
674 | mform += ' <td><input type="text" class="inputParam" id="ParamSigma'+sframe+'" name="Sigma" value="1" onblur="updateSetSlider(this)"></td>' |
673 | mform += ' <td><input type="text" class="inputParam" id="ParamSigmamin'+sframe+'" name="Sigma" onkeyup="updateSetSlider(this)"></td>' |
675 | mform += ' <td><input type="text" class="inputParam" id="ParamSigmamin'+sframe+'" name="Sigma" onkeyup="updateSetSlider(this)"></td>' |
674 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamSigmaSet'+sframe+'"></div></td>' |
676 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamSigmaSet'+sframe+'"></div></td>' |
675 | mform += ' <td><input type="text" class="inputParam" id="ParamSigmamax'+sframe+'" name="Sigma" onkeyup="updateSetSlider(this)"></td>' |
677 | mform += ' <td><input type="text" class="inputParam" id="ParamSigmamax'+sframe+'" name="Sigma" onkeyup="updateSetSlider(this)"></td>' |
676 | mform += ' <td><input type="text" class="inputParam" id="ParamSigmastep'+sframe+'" name="Sigma" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
678 | mform += ' <td><input type="text" class="inputParam" id="ParamSigmastep'+sframe+'" name="Sigma" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
677 | mform += ' </tr>' |
679 | mform += ' </tr>' |
678 | mform += ' <tr id="listAmplitude">' |
680 | mform += ' <tr id="listAmplitude">' |
679 | mform += ' <td><li> |
681 | mform += ' <td><li>N:</td>' |
680 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixAmplitude'+sframe+'"></td>' |
682 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixAmplitude'+sframe+'"></td>' |
681 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondAmplitude'+sframe+'"></td>' |
683 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondAmplitude'+sframe+'"></td>' |
682 | mform += ' <td><input type="text" class="inputParam" id="ParamAmplitude'+sframe+'" name="Amplitude" value="1" onblur="updateSetSlider(this)"></td>' |
684 | mform += ' <td><input type="text" class="inputParam" id="ParamAmplitude'+sframe+'" name="Amplitude" value="1" onblur="updateSetSlider(this)"></td>' |
683 | mform += ' <td><input type="text" class="inputParam" id="ParamAmplitudemin'+sframe+'" name="Amplitude" onkeyup="updateSetSlider(this)"></td>' |
685 | mform += ' <td><input type="text" class="inputParam" id="ParamAmplitudemin'+sframe+'" name="Amplitude" onkeyup="updateSetSlider(this)"></td>' |
684 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamAmplitudeSet'+sframe+'"></div></td>' |
686 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamAmplitudeSet'+sframe+'"></div></td>' |
685 | mform += ' <td><input type="text" class="inputParam" id="ParamAmplitudemax'+sframe+'" name="Amplitude" onkeyup="updateSetSlider(this)"></td>' |
687 | mform += ' <td><input type="text" class="inputParam" id="ParamAmplitudemax'+sframe+'" name="Amplitude" onkeyup="updateSetSlider(this)"></td>' |
686 | mform += ' <td><input type="text" class="inputParam" id="ParamAmplitudestep'+sframe+'" name="Amplitude" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
688 | mform += ' <td><input type="text" class="inputParam" id="ParamAmplitudestep'+sframe+'" name="Amplitude" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
687 | mform += ' </tr>' |
689 | mform += ' </tr>' |
688 | mform += ' </tbody>' |
690 | mform += ' </tbody>' |
689 | mform += ' </table>' |
691 | mform += ' </table>' |
690 | mform += ' </div>' |
692 | mform += ' </div>' |
691 | 693 | ||
692 | mform += ' <div id="polFitPanel' + sframe + '" class="FitPanel">' |
694 | mform += ' <div id="polFitPanel' + sframe + '" class="FitPanel">' |
693 | mform += ' Polynomial order: <input type="text" name="polOrder" id="polOrderDisplay' + sframe + '" size="1" disabled=true>' |
695 | mform += ' Polynomial order: <input type="text" name="polOrder" id="polOrderDisplay' + sframe + '" size="1" disabled=true>' |
694 | mform += ' <div style="width: 100px;display: inline-block;" id="slider-polOrder' + sframe + '"></div>' |
696 | mform += ' <div style="width: 100px;display: inline-block;" id="slider-polOrder' + sframe + '"></div>' |
695 | mform += ' <table class="inputParametersTable">' |
697 | mform += ' <table class="inputParametersTable">' |
696 | mform += ' <tbody>' |
698 | mform += ' <tbody>' |
697 | mform += ' <tr class="description">' |
699 | mform += ' <tr class="description">' |
698 | mform += ' <td>Name</td>' |
700 | mform += ' <td>Name</td>' |
699 | mform += ' <td>Fix</td>' |
701 | mform += ' <td>Fix</td>' |
700 | mform += ' <td>Bond</td>' |
702 | mform += ' <td>Bond</td>' |
701 | mform += ' <td>Value</td>' |
703 | mform += ' <td>Value</td>' |
702 | mform += ' <td>Min</td>' |
704 | mform += ' <td>Min</td>' |
703 | mform += ' <td>Set</td>' |
705 | mform += ' <td>Set</td>' |
704 | mform += ' <td>Max</td>' |
706 | mform += ' <td>Max</td>' |
705 | mform += ' <td>Step</td>' |
707 | mform += ' <td>Step</td>' |
706 | mform += ' </tr>' |
708 | mform += ' </tr>' |
707 | mform += ' <tr class="pol" id="listA0'+sframe+'">' |
709 | mform += ' <tr class="pol" id="listA0'+sframe+'">' |
708 | mform += ' <td><li> |
710 | mform += ' <td><li>p0:</td>' |
709 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixA0'+sframe+'"></td>' |
711 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixA0'+sframe+'"></td>' |
710 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondA0'+sframe+'"></td>' |
712 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondA0'+sframe+'"></td>' |
711 | mform += ' <td><input type="text" class="inputParam" id="ParamA0'+sframe+'" name="A0" value="0" disabled=true onblur="updateSetSlider(this)"></td>' |
713 | mform += ' <td><input type="text" class="inputParam" id="ParamA0'+sframe+'" name="A0" value="0" disabled=true onblur="updateSetSlider(this)"></td>' |
712 | mform += ' <td><input type="text" class="inputParam" id="ParamA0min'+sframe+'" name="A0" onkeyup="updateSetSlider(this)"></td>' |
714 | mform += ' <td><input type="text" class="inputParam" id="ParamA0min'+sframe+'" name="A0" onkeyup="updateSetSlider(this)"></td>' |
713 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamA0Set'+sframe+'"></div></td>' |
715 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamA0Set'+sframe+'"></div></td>' |
714 | mform += ' <td><input type="text" class="inputParam" id="ParamA0max'+sframe+'" name="A0" onkeyup="updateSetSlider(this)"></td>' |
716 | mform += ' <td><input type="text" class="inputParam" id="ParamA0max'+sframe+'" name="A0" onkeyup="updateSetSlider(this)"></td>' |
715 | mform += ' <td><input type="text" class="inputParam" id="ParamA0step'+sframe+'" name="A0" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
717 | mform += ' <td><input type="text" class="inputParam" id="ParamA0step'+sframe+'" name="A0" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
716 | mform += ' </tr>' |
718 | mform += ' </tr>' |
717 | mform += ' <tr class="pol" id="listA1'+sframe+'">' |
719 | mform += ' <tr class="pol" id="listA1'+sframe+'">' |
718 | mform += ' <div id="rowA1">' |
720 | mform += ' <div id="rowA1">' |
719 | mform += ' <td><li> |
721 | mform += ' <td><li>p1:</td>' |
720 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixA1'+sframe+'"></td>' |
722 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixA1'+sframe+'"></td>' |
721 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondA1'+sframe+'"></td>' |
723 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondA1'+sframe+'"></td>' |
722 | mform += ' <td><input type="text" class="inputParam" id="ParamA1'+sframe+'" name="A1" value="0" disabled=true onblur="updateSetSlider(this)"></td>' |
724 | mform += ' <td><input type="text" class="inputParam" id="ParamA1'+sframe+'" name="A1" value="0" disabled=true onblur="updateSetSlider(this)"></td>' |
723 | mform += ' <td><input type="text" class="inputParam" id="ParamA1min'+sframe+'" name="A1" onkeyup="updateSetSlider(this)"></td>' |
725 | mform += ' <td><input type="text" class="inputParam" id="ParamA1min'+sframe+'" name="A1" onkeyup="updateSetSlider(this)"></td>' |
724 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamA1Set'+sframe+'"></div></td>' |
726 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamA1Set'+sframe+'"></div></td>' |
725 | mform += ' <td><input type="text" class="inputParam" id="ParamA1max'+sframe+'" name="A1" onkeyup="updateSetSlider(this)"></td>' |
727 | mform += ' <td><input type="text" class="inputParam" id="ParamA1max'+sframe+'" name="A1" onkeyup="updateSetSlider(this)"></td>' |
726 | mform += ' <td><input type="text" class="inputParam" id="ParamA1step'+sframe+'" name="A1" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
728 | mform += ' <td><input type="text" class="inputParam" id="ParamA1step'+sframe+'" name="A1" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
727 | mform += ' </div>' |
729 | mform += ' </div>' |
728 | mform += ' </tr>' |
730 | mform += ' </tr>' |
729 | mform += ' <tr class="pol" id="listA2'+sframe+'">' |
731 | mform += ' <tr class="pol" id="listA2'+sframe+'">' |
730 | mform += ' <td><li> |
732 | mform += ' <td><li>p2:</td>' |
731 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixA2'+sframe+'"></td>' |
733 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixA2'+sframe+'"></td>' |
732 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondA2'+sframe+'"></td>' |
734 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondA2'+sframe+'"></td>' |
733 | mform += ' <td><input type="text" class="inputParam" id="ParamA2'+sframe+'" name="A2" value="0" disabled=true onblur="updateSetSlider(this)"></td>' |
735 | mform += ' <td><input type="text" class="inputParam" id="ParamA2'+sframe+'" name="A2" value="0" disabled=true onblur="updateSetSlider(this)"></td>' |
734 | mform += ' <td><input type="text" class="inputParam" id="ParamA2min'+sframe+'" name="A2" onkeyup="updateSetSlider(this)"></td>' |
736 | mform += ' <td><input type="text" class="inputParam" id="ParamA2min'+sframe+'" name="A2" onkeyup="updateSetSlider(this)"></td>' |
735 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamA2Set'+sframe+'"></div></td>' |
737 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamA2Set'+sframe+'"></div></td>' |
736 | mform += ' <td><input type="text" class="inputParam" id="ParamA2max'+sframe+'" name="A2" onkeyup="updateSetSlider(this)"></td>' |
738 | mform += ' <td><input type="text" class="inputParam" id="ParamA2max'+sframe+'" name="A2" onkeyup="updateSetSlider(this)"></td>' |
737 | mform += ' <td><input type="text" class="inputParam" id="ParamA2step'+sframe+'" name="A2" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
739 | mform += ' <td><input type="text" class="inputParam" id="ParamA2step'+sframe+'" name="A2" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
738 | mform += ' </tr>' |
740 | mform += ' </tr>' |
739 | mform += ' <tr class="pol" id="listA3'+sframe+'">' |
741 | mform += ' <tr class="pol" id="listA3'+sframe+'">' |
740 | mform += ' <td><li> |
742 | mform += ' <td><li>p3:</td>' |
741 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixA3'+sframe+'"></td>' |
743 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixA3'+sframe+'"></td>' |
742 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondA3'+sframe+'"></td>' |
744 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondA3'+sframe+'"></td>' |
743 | mform += ' <td><input type="text" class="inputParam" id="ParamA3'+sframe+'" name="A3" value="0" disabled=true onblur="updateSetSlider(this)"></td>' |
745 | mform += ' <td><input type="text" class="inputParam" id="ParamA3'+sframe+'" name="A3" value="0" disabled=true onblur="updateSetSlider(this)"></td>' |
744 | mform += ' <td><input type="text" class="inputParam" id="ParamA3min'+sframe+'" name="A3" onkeyup="updateSetSlider(this)"></td>' |
746 | mform += ' <td><input type="text" class="inputParam" id="ParamA3min'+sframe+'" name="A3" onkeyup="updateSetSlider(this)"></td>' |
745 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamA3Set'+sframe+'"></div></td>' |
747 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamA3Set'+sframe+'"></div></td>' |
746 | mform += ' <td><input type="text" class="inputParam" id="ParamA3max'+sframe+'" name="A3" onkeyup="updateSetSlider(this)"></td>' |
748 | mform += ' <td><input type="text" class="inputParam" id="ParamA3max'+sframe+'" name="A3" onkeyup="updateSetSlider(this)"></td>' |
747 | mform += ' <td><input type="text" class="inputParam" id="ParamA3step'+sframe+'" name="A3" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
749 | mform += ' <td><input type="text" class="inputParam" id="ParamA3step'+sframe+'" name="A3" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
748 | mform += ' </tr>' |
750 | mform += ' </tr>' |
749 | mform += ' <tr class="pol" id="listA4'+sframe+'">' |
751 | mform += ' <tr class="pol" id="listA4'+sframe+'">' |
750 | mform += ' <td><li> |
752 | mform += ' <td><li>p4:</td>' |
751 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixA4'+sframe+'"></td>' |
753 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixA4'+sframe+'"></td>' |
752 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondA4'+sframe+'"></td>' |
754 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondA4'+sframe+'"></td>' |
753 | mform += ' <td><input type="text" class="inputParam" id="ParamA4'+sframe+'" name="A4" value="0" disabled=true onblur="updateSetSlider(this)"></td>' |
755 | mform += ' <td><input type="text" class="inputParam" id="ParamA4'+sframe+'" name="A4" value="0" disabled=true onblur="updateSetSlider(this)"></td>' |
754 | mform += ' <td><input type="text" class="inputParam" id="ParamA4min'+sframe+'" name="A4" onkeyup="updateSetSlider(this)"></td>' |
756 | mform += ' <td><input type="text" class="inputParam" id="ParamA4min'+sframe+'" name="A4" onkeyup="updateSetSlider(this)"></td>' |
755 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamA4Set'+sframe+'"></div></td>' |
757 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamA4Set'+sframe+'"></div></td>' |
756 | mform += ' <td><input type="text" class="inputParam" id="ParamA4max'+sframe+'" name="A4" onkeyup="updateSetSlider(this)"></td>' |
758 | mform += ' <td><input type="text" class="inputParam" id="ParamA4max'+sframe+'" name="A4" onkeyup="updateSetSlider(this)"></td>' |
757 | mform += ' <td><input type="text" class="inputParam" id="ParamA4step'+sframe+'" name="A4" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
759 | mform += ' <td><input type="text" class="inputParam" id="ParamA4step'+sframe+'" name="A4" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
758 | mform += ' </tr>' |
760 | mform += ' </tr>' |
759 | mform += ' </tbody>' |
761 | mform += ' </tbody>' |
760 | mform += ' </table>' |
762 | mform += ' </table>' |
761 | mform += ' </div>' |
763 | mform += ' </div>' |
762 | 764 | ||
763 | 765 | ||
764 | mform += ' <div id="BWFitPanel' + sframe + '" class="FitPanel">' |
766 | mform += ' <div id="BWFitPanel' + sframe + '" class="FitPanel">' |
765 | mform += ' <table class="inputParametersTable" id="inputParamTableBW">' |
767 | mform += ' <table class="inputParametersTable" id="inputParamTableBW">' |
766 | mform += ' <tbody>' |
768 | mform += ' <tbody>' |
767 | mform += ' <tr class="description">' |
769 | mform += ' <tr class="description">' |
768 | mform += ' <td>Name</td>' |
770 | mform += ' <td>Name</td>' |
769 | mform += ' <td>Fix</td>' |
771 | mform += ' <td>Fix</td>' |
770 | mform += ' <td>Bond</td>' |
772 | mform += ' <td>Bond</td>' |
771 | mform += ' <td>Value</td>' |
773 | mform += ' <td>Value</td>' |
772 | mform += ' <td>Min</td>' |
774 | mform += ' <td>Min</td>' |
773 | mform += ' <td>Set</td>' |
775 | mform += ' <td>Set</td>' |
774 | mform += ' <td>Max</td>' |
776 | mform += ' <td>Max</td>' |
775 | mform += ' <td>Step</td>' |
777 | mform += ' <td>Step</td>' |
776 | mform += ' </tr>' |
778 | mform += ' </tr>' |
777 | mform += ' <tr id="listGamma">' |
779 | mform += ' <tr id="listGamma">' |
778 | mform += ' <td><li>Γ:</td>' |
780 | mform += ' <td><li>Γ:</td>' |
779 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixGamma'+sframe+'"></td>' |
781 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixGamma'+sframe+'"></td>' |
780 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondGamma'+sframe+'"></td>' |
782 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondGamma'+sframe+'"></td>' |
781 | mform += ' <td><input type="text" class="inputParam" id="ParamGamma'+sframe+'" name="Gamma" value="0" onblur="updateSetSlider(this)"></td>' |
783 | mform += ' <td><input type="text" class="inputParam" id="ParamGamma'+sframe+'" name="Gamma" value="0" onblur="updateSetSlider(this)"></td>' |
782 | mform += ' <td><input type="text" class="inputParam" id="ParamGammamin'+sframe+'" name="Gamma" onkeyup="updateSetSlider(this)"></td>' |
784 | mform += ' <td><input type="text" class="inputParam" id="ParamGammamin'+sframe+'" name="Gamma" onkeyup="updateSetSlider(this)"></td>' |
783 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamGammaSet'+sframe+'"></div></td>' |
785 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamGammaSet'+sframe+'"></div></td>' |
784 | mform += ' <td><input type="text" class="inputParam" id="ParamGammamax'+sframe+'" name="Gamma" onkeyup="updateSetSlider(this)"></td>' |
786 | mform += ' <td><input type="text" class="inputParam" id="ParamGammamax'+sframe+'" name="Gamma" onkeyup="updateSetSlider(this)"></td>' |
785 | mform += ' <td><input type="text" class="inputParam" id="ParamGammastep'+sframe+'" name="Gamma" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
787 | mform += ' <td><input type="text" class="inputParam" id="ParamGammastep'+sframe+'" name="Gamma" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
786 | mform += ' </tr>' |
788 | mform += ' </tr>' |
787 | mform += ' <tr id="listM">' |
789 | mform += ' <tr id="listM">' |
788 | mform += ' <td><li>M:</td>' |
790 | mform += ' <td><li>M<sub>BW</sub>:</td>' |
789 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixM'+sframe+'"></td>' |
791 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixM'+sframe+'"></td>' |
790 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondM'+sframe+'"></td>' |
792 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondM'+sframe+'"></td>' |
791 | mform += ' <td><input type="text" class="inputParam" id="ParamM'+sframe+'" name="M" value="1" onblur="updateSetSlider(this)"></td>' |
793 | mform += ' <td><input type="text" class="inputParam" id="ParamM'+sframe+'" name="M" value="1" onblur="updateSetSlider(this)"></td>' |
792 | mform += ' <td><input type="text" class="inputParam" id="ParamMmin'+sframe+'" name="M" onkeyup="updateSetSlider(this)"></td>' |
794 | mform += ' <td><input type="text" class="inputParam" id="ParamMmin'+sframe+'" name="M" onkeyup="updateSetSlider(this)"></td>' |
793 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamMSet'+sframe+'"></div></td>' |
795 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamMSet'+sframe+'"></div></td>' |
794 | mform += ' <td><input type="text" class="inputParam" id="ParamMmax'+sframe+'" name="M" onkeyup="updateSetSlider(this)"></td>' |
796 | mform += ' <td><input type="text" class="inputParam" id="ParamMmax'+sframe+'" name="M" onkeyup="updateSetSlider(this)"></td>' |
795 | mform += ' <td><input type="text" class="inputParam" id="ParamMstep'+sframe+'" name="M" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
797 | mform += ' <td><input type="text" class="inputParam" id="ParamMstep'+sframe+'" name="M" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
796 | mform += ' </tr>' |
798 | mform += ' </tr>' |
797 | mform += ' <tr id="listAmpBW">' |
799 | mform += ' <tr id="listAmpBW">' |
798 | mform += ' <td><li> |
800 | mform += ' <td><li>N<sub>BW</sub>:</td>' |
799 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixAmpBW'+sframe+'"></td>' |
801 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixAmpBW'+sframe+'"></td>' |
800 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondAmpBW'+sframe+'"></td>' |
802 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondAmpBW'+sframe+'"></td>' |
801 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpBW'+sframe+'" name="AmpBW" value="1" onblur="updateSetSlider(this)"></td>' |
803 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpBW'+sframe+'" name="AmpBW" value="1" onblur="updateSetSlider(this)"></td>' |
802 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpBWmin'+sframe+'" name="AmpBW" onkeyup="updateSetSlider(this)"></td>' |
804 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpBWmin'+sframe+'" name="AmpBW" onkeyup="updateSetSlider(this)"></td>' |
803 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamAmpBWSet'+sframe+'"></div></td>' |
805 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamAmpBWSet'+sframe+'"></div></td>' |
804 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpBWmax'+sframe+'" name="AmpBW" onkeyup="updateSetSlider(this)"></td>' |
806 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpBWmax'+sframe+'" name="AmpBW" onkeyup="updateSetSlider(this)"></td>' |
805 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpBWstep'+sframe+'" name="AmpBW" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
807 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpBWstep'+sframe+'" name="AmpBW" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
806 | mform += ' </tr>' |
808 | mform += ' </tr>' |
807 | mform += ' </tbody>' |
809 | mform += ' </tbody>' |
808 | mform += ' </table>' |
810 | mform += ' </table>' |
809 | mform += ' </div>' |
811 | mform += ' </div>' |
810 | 812 | ||
811 | mform += ' <div id="expoFitPanel' + sframe + '" class="FitPanel">' |
813 | mform += ' <div id="expoFitPanel' + sframe + '" class="FitPanel">' |
812 | mform += ' <table class="inputParametersTable" id="inputParamTableExpo">' |
814 | mform += ' <table class="inputParametersTable" id="inputParamTableExpo">' |
813 | mform += ' <tbody>' |
815 | mform += ' <tbody>' |
814 | mform += ' <tr class="description">' |
816 | mform += ' <tr class="description">' |
815 | mform += ' <td>Name</td>' |
817 | mform += ' <td>Name</td>' |
816 | mform += ' <td>Fix</td>' |
818 | mform += ' <td>Fix</td>' |
817 | mform += ' <td>Bond</td>' |
819 | mform += ' <td>Bond</td>' |
818 | mform += ' <td>Value</td>' |
820 | mform += ' <td>Value</td>' |
819 | mform += ' <td>Min</td>' |
821 | mform += ' <td>Min</td>' |
820 | mform += ' <td>Set</td>' |
822 | mform += ' <td>Set</td>' |
821 | mform += ' <td>Max</td>' |
823 | mform += ' <td>Max</td>' |
822 | mform += ' <td>Step</td>' |
824 | mform += ' <td>Step</td>' |
823 | mform += ' </tr>' |
825 | mform += ' </tr>' |
824 | mform += ' <tr id="listK">' |
826 | mform += ' <tr id="listK">' |
825 | mform += ' <td><li>K:</td>' |
827 | mform += ' <td><li>K:</td>' |
826 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixK'+sframe+'"></td>' |
828 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixK'+sframe+'"></td>' |
827 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondK'+sframe+'"></td>' |
829 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondK'+sframe+'"></td>' |
828 | mform += ' <td><input type="text" class="inputParam" id="ParamK'+sframe+'" name="K" value="0" onblur="updateSetSlider(this)"></td>' |
830 | mform += ' <td><input type="text" class="inputParam" id="ParamK'+sframe+'" name="K" value="0" onblur="updateSetSlider(this)"></td>' |
829 | mform += ' <td><input type="text" class="inputParam" id="ParamKmin'+sframe+'" name="K" onkeyup="updateSetSlider(this)"></td>' |
831 | mform += ' <td><input type="text" class="inputParam" id="ParamKmin'+sframe+'" name="K" onkeyup="updateSetSlider(this)"></td>' |
830 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamKSet'+sframe+'"></div></td>' |
832 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamKSet'+sframe+'"></div></td>' |
831 | mform += ' <td><input type="text" class="inputParam" id="ParamKmax'+sframe+'" name="K" onkeyup="updateSetSlider(this)"></td>' |
833 | mform += ' <td><input type="text" class="inputParam" id="ParamKmax'+sframe+'" name="K" onkeyup="updateSetSlider(this)"></td>' |
832 | mform += ' <td><input type="text" class="inputParam" id="ParamKstep'+sframe+'" name="K" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
834 | mform += ' <td><input type="text" class="inputParam" id="ParamKstep'+sframe+'" name="K" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
833 | mform += ' </tr>' |
835 | mform += ' </tr>' |
834 | mform += ' <tr id="listAmpExp">' |
836 | mform += ' <tr id="listAmpExp">' |
835 | mform += ' <td><li> |
837 | mform += ' <td><li>N<sub>exp</sub>:</td>' |
836 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixAmpExp'+sframe+'"></td>' |
838 | mform += ' <td><input type="checkbox" class="inputParamBox" id="fixAmpExp'+sframe+'"></td>' |
837 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondAmpExp'+sframe+'"></td>' |
839 | mform += ' <td><input type="checkbox" class="inputParamBox" id="bondAmpExp'+sframe+'"></td>' |
838 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpExp'+sframe+'" name="AmpExp" value="1" onblur="updateSetSlider(this)"></td>' |
840 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpExp'+sframe+'" name="AmpExp" value="1" onblur="updateSetSlider(this)"></td>' |
839 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpExpmin'+sframe+'" name="AmpExp" onkeyup="updateSetSlider(this)"></td>' |
841 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpExpmin'+sframe+'" name="AmpExp" onkeyup="updateSetSlider(this)"></td>' |
840 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamAmpExpSet'+sframe+'"></div></td>' |
842 | mform += ' <td><div name="ParamSlider" class="ParamSlider'+sframe+'" id="ParamAmpExpSet'+sframe+'"></div></td>' |
841 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpExpmax'+sframe+'" name="AmpExp" onkeyup="updateSetSlider(this)"></td>' |
843 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpExpmax'+sframe+'" name="AmpExp" onkeyup="updateSetSlider(this)"></td>' |
842 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpExpstep'+sframe+'" name="AmpExp" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
844 | mform += ' <td><input type="text" class="inputParam" id="ParamAmpExpstep'+sframe+'" name="AmpExp" value="0.1" onkeyup="updateSetSlider(this)"></td>' |
843 | mform += ' </tr>' |
845 | mform += ' </tr>' |
844 | mform += ' </tbody>' |
846 | mform += ' </tbody>' |
845 | mform += ' </table>' |
847 | mform += ' </table>' |
846 | mform += ' </div>' |
848 | mform += ' </div>' |
847 | mform += ' </div>' |
849 | mform += ' </div>' |
848 | 850 | ||
849 | return mform |
851 | return mform |
850 | } |
852 | } |
851 | 853 | ||
852 | 854 |