2022-12-13 18:24:26 -05:00
<!DOCTYPE html>
< html >
< head >
< title > Heliosmatics< / title >
2022-12-16 16:02:36 -05:00
< meta name = "description" content = "HELIOSmatics was first built by Ben P. Kay in MS Excel around 2010. Later, it was modified by Ryan Tang. Now, it migrates to web." >
2022-12-13 18:24:26 -05:00
< script src = "https://cdn.plot.ly/plotly-2.16.1.min.js" > < / script >
2022-12-16 16:02:36 -05:00
< meta name = "viewport" content = "width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, user-scalable=0" / >
2022-12-13 18:24:26 -05:00
< / head >
< style >
2022-12-15 17:28:32 -05:00
body{
font-family: Arial, Helvetica, sans-serif;
}
.column{
float : left;
width: 650px;
padding: 0px;
}
.row:after {
content: "";
display: table;
clear: both;
}
.plotStyle{
width:650px;
height:600px;
}
.slider{
width : 400px;
}
.plotSlider{
width: 400px;
}
2022-12-15 17:44:45 -05:00
2022-12-15 17:28:32 -05:00
hr {
height:4px;
background-color:#F7CF3C;
border-style:none;
border-width:none;
}
@media screen and (max-width: 1000px) {
2022-12-15 13:26:17 -05:00
.column {
width: 100%;
}
2022-12-15 17:28:32 -05:00
.plotStyle{
width:400px;
height: 370px;
}
.slider{
width: 200px;
}
.plotSlider{
width: 180px;
}
img {
height: 50px;
}
2022-12-15 13:26:17 -05:00
}
2022-12-13 18:24:26 -05:00
< / style >
2022-12-14 19:28:28 -05:00
< body bgcolor = "#6DB33E" >
2022-12-13 18:24:26 -05:00
2022-12-14 14:31:54 -05:00
< h1 > HELIOSmatics< / h1 >
2022-12-14 16:25:37 -05:00
< h1 id = 'reactionName' style = "color: #1363A7" > 24F(d,p)25F@10MeV/u< / h1 >
2022-12-13 23:02:47 -05:00
< table >
< tr >
< td style = "text-align:right" > Beam (A):< / td >
2022-12-15 13:26:17 -05:00
< td > < Input type = "text" style = "width:60px" value = "24F" id = "beam" enterkeyhint = "done" / > < / td >
2022-12-13 23:02:47 -05:00
< td style = "text-align:right" > Beam Ex:< / td >
2022-12-15 13:26:17 -05:00
< td > < Input type = "text" style = "width:60px" value = "0" id = "beamEx" enterkeyhint = "done" / > < / td >
2022-12-13 23:02:47 -05:00
< td > MeV< / td >
2022-12-15 17:28:32 -05:00
< td id = 'beamSp' > < / td >
2022-12-13 23:02:47 -05:00
< / tr >
< tr >
< td style = "text-align:right" > Target (a):< / td >
2022-12-15 13:26:17 -05:00
< td > < Input type = "text" style = "width:60px" value = "d" id = "target" enterkeyhint = "done" / > < / td >
2022-12-13 23:02:47 -05:00
< / tr >
< tr >
< td style = "text-align:right" > Light (b):< / td >
2022-12-15 13:26:17 -05:00
< td > < Input type = "text" style = "width:60px" value = "p" id = "light" enterkeyhint = "done" / > < / td >
2022-12-13 23:02:47 -05:00
< td style = "text-align:right" > Q-value:< / td >
< td id = 'Q-value' > 2.057< / td >
< td > MeV< / td >
< / tr >
< tr >
< td style = "text-align:right" > Heavy (B):< / td >
< td id = 'heavyName' > 25F< / td >
< / tr >
< / table >
2022-12-15 17:28:32 -05:00
< p style = "font: 12px" id = 'heavySp' > < / p >
2022-12-13 23:02:47 -05:00
< p > < / p >
2022-12-13 18:24:26 -05:00
< table >
< tr >
< td >
< input type = "radio" name = "SSType" id = 'HELIOS' value = "HELIOS" / > HELIOS
< / td >
< td >
< input type = "radio" name = "SSType" id = 'SOLARIS' value = "SOLARIS" checked = "checked" / > SOLARIS
< / td >
< td >
< input type = "radio" name = "SSType" id = 'ISS' value = "ISS" / > ISS
< / td >
< / tr >
< / table >
< p > < / p >
2022-12-13 23:02:47 -05:00
< table >
2022-12-13 18:24:26 -05:00
< tr >
2022-12-15 18:14:18 -05:00
< td style = "text-align:right" > B-field (abs.):< / td >
< td > < Input type = "text" style = "width:60px" value = "2" id = 'BField' enterkeyhint = "done" / > < / td >
2022-12-13 23:02:47 -05:00
< td > T< / td >
2022-12-15 18:14:18 -05:00
< td > < Input type = "range" min = "0" max = "6" step = "0.05" value = "2" class = "slider" id = 'BRange' / > < / td >
2022-12-13 18:24:26 -05:00
< / tr >
2022-12-13 23:02:47 -05:00
2022-12-13 18:24:26 -05:00
< tr >
< td style = "text-align:right" > Beam Energy:< / td >
2022-12-15 13:26:17 -05:00
< td > < Input type = "text" style = "width:60px" value = "10" id = 'KEA' enterkeyhint = "done" / > < / td >
2022-12-13 18:24:26 -05:00
< td > MeV/u< / td >
2022-12-15 17:28:32 -05:00
< td > < Input type = "range" min = "0" max = "20" step = "0.1" value = "10" class = "slider" id = 'KEARange' / > < / td >
2022-12-13 18:24:26 -05:00
< / tr >
< tr >
2022-12-15 17:28:32 -05:00
< td > < / td >
< td > < / td >
< td > < / td >
< td id = 'minKEA' > < / td >
2022-12-13 18:24:26 -05:00
< / tr >
< / table >
2022-12-14 14:31:54 -05:00
< p > < / p >
< table id = "ExTable" , style = "border:1px solid; text-align:center;" >
2022-12-13 18:24:26 -05:00
< tr >
2022-12-14 14:31:54 -05:00
< th style = "width:85px" > E< sub > x< / sub > [MeV]< / th >
< th style = "width:85px" > θ < sub > cm< / sub > [deg]< / th >
< th style = "width:70px" > E< sub > b< / sub > [MeV]< / th >
< th style = "width:70px" > Z< sub > b0< / sub > [mm]< / th >
< th style = "width:70px" > Z< sub > b< / sub > [mm]< / th >
< th style = "width:70px" > 2ρ < sub > b< / sub > [mm]< / th >
< th style = "width:70px" > θ Lab< sub > b< / sub > [deg]< / th >
< th style = "width:60px" > T< sub > b< / sub > [ns]< / th >
< th style = "width:70px" > E< sub > B< / sub > [MeV]< / th >
< th style = "width:90px" > θ Lab< sub > B< / sub > [deg]< / th >
< th style = "width:80px" > Z< sub > B0< / sub > /2[mm]< / th >
2022-12-14 17:37:09 -05:00
< th style = "width:70px" > 2ρ < sub > B< / sub > [mm]< / th >
2022-12-13 18:24:26 -05:00
< / tr >
< / tr >
2022-12-15 13:26:17 -05:00
< td > < input type = "text" id = 'Ex1' name = "Ex" size = "8" value = "0" enterkeyhint = "done" / > < / td >
< td > < input type = "text" id = 'theta1' name = "thetaCM" size = "8" value = "10" enterkeyhint = "done" / > < / td >
2022-12-13 18:24:26 -05:00
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< / tr >
2022-12-14 16:59:17 -05:00
< / tr >
2022-12-15 18:02:38 -05:00
< td > < input type = "text" id = 'Ex2' name = "Ex" size = "8" value = "1" enterkeyhint = "done" / > < / td >
2022-12-15 13:26:17 -05:00
< td > < input type = "text" id = 'theta2' name = "thetaCM" size = "8" value = "40" enterkeyhint = "done" / > < / td >
2022-12-14 16:59:17 -05:00
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< td > < / td >
< / tr >
2022-12-13 18:24:26 -05:00
< tr >
2022-12-13 23:02:47 -05:00
< td > < button type = "button" onclick = "addRow()" style = "width:85px" > Add E< sub > x< / sub > < / button > < / td >
2022-12-13 18:24:26 -05:00
< td > < button type = "button" onclick = "deleteRow()" > Remove E< sub > x< / sub > < / button > < / td >
< / tr >
< / table >
2022-12-13 23:02:47 -05:00
< p > < / p >
< table >
< tr >
< td style = "text-align:right" > θ < sub > CM< / sub > :< / td >
2022-12-15 13:26:17 -05:00
< td > < Input type = "text" style = "width:60px" value = "0" id = 'thetaCM' enterkeyhint = "done" / > < / td >
2022-12-13 23:02:47 -05:00
< td > deg< / td >
2022-12-15 17:28:32 -05:00
< td > < Input type = "range" min = "0" max = "50" step = "0.1" value = "0" class = "slider" id = 'thetaCMRange' / > < / td >
2022-12-13 23:02:47 -05:00
< / tr >
< td style = "text-align:right" > Array Pos:< / td >
2022-12-15 13:26:17 -05:00
< td > < Input type = "text" style = "width:60px" value = "-100" id = 'posArray' enterkeyhint = "done" / > < / td >
2022-12-13 23:02:47 -05:00
< td > mm< / td >
2022-12-15 17:28:32 -05:00
< td > < Input type = "range" min = "-500" max = "1000" step = "1" value = "-100" class = "slider" id = 'posArrayRange' / > < / td >
2022-12-13 23:02:47 -05:00
< / tr >
2022-12-14 16:25:37 -05:00
< tr >
< td style = "text-align:right" > Recoil Pos:< / td >
2022-12-15 13:26:17 -05:00
< td > < Input type = "text" style = "width:60px" value = "1500" id = 'posRecoil' enterkeyhint = "done" / > < / td >
2022-12-14 16:25:37 -05:00
< td > mm< / td >
2022-12-15 17:28:32 -05:00
< td > < Input type = "range" min = "0" max = "2000" step = "1" value = "1500" class = "slider" id = 'posRecoilRange' / > < / td >
2022-12-14 16:25:37 -05:00
< / tr >
2022-12-13 23:02:47 -05:00
< / table >
2022-12-13 18:24:26 -05:00
2022-12-13 23:02:47 -05:00
< p > < / p >
2022-12-13 18:24:26 -05:00
2022-12-15 13:26:17 -05:00
< div class = "row" >
< div class = "column" >
< table cellspacing = "0" cellpadding = "0" >
< tr >
< td >
2022-12-15 17:28:32 -05:00
< div id = "Plot_EZ" class = "plotStyle" > < / div >
2022-12-15 13:26:17 -05:00
< / td >
< / tr >
2022-12-15 17:44:45 -05:00
< tr > < td > < / td > < / tr >
2022-12-16 16:02:36 -05:00
< tr >
< td > zRange can be changed by Array position.< / td >
< / tr >
2022-12-15 13:26:17 -05:00
< tr >
< td >
2022-12-15 17:28:32 -05:00
< table >
2022-12-15 13:26:17 -05:00
< tr >
< td > eRange:< / td >
< td > < Input type = "text" style = "width:60px" value = "12" id = 'eRange' enterkeyhint = "done" / > < / td >
< td > MeV< / td >
2022-12-15 17:28:32 -05:00
< td > < Input type = "range" min = "1" max = "30" step = "0.1" value = "12" class = "plotSlider" id = 'eRangeSlider' / > < / td >
2022-12-15 13:26:17 -05:00
< / tr >
< / table >
< / td >
< / tr >
2022-12-15 17:44:45 -05:00
< tr > < td > < / td > < / tr >
2022-12-15 13:26:17 -05:00
< / table >
< / div >
< div class = "column" >
< table cellspacing = "0" cellpadding = "0" >
< tr >
< td >
2022-12-15 17:28:32 -05:00
< div id = "Plot_RZ" class = "plotStyle" > < / div >
2022-12-15 13:26:17 -05:00
< / td >
< / tr >
2022-12-15 17:44:45 -05:00
< tr > < td > < / td > < / tr >
2022-12-14 16:25:37 -05:00
< tr >
2022-12-14 17:37:09 -05:00
< td >
2022-12-15 17:28:32 -05:00
< table >
2022-12-14 16:25:37 -05:00
< tr >
< td > zRange(Min):< / td >
2022-12-15 13:26:17 -05:00
< td > < Input type = "text" style = "width:60px" value = "-200" id = 'zRange1' enterkeyhint = "done" / > < / td >
2022-12-14 16:25:37 -05:00
< td > mm< / td >
2022-12-15 17:28:32 -05:00
< td > < Input type = "range" min = "-2000" max = "4000" step = "1" value = "-200" class = "plotSlider" id = 'zRange1Slider' / > < / td >
2022-12-14 16:25:37 -05:00
< / tr >
< tr >
< td > zRange(Max):< / td >
2022-12-15 13:26:17 -05:00
< td > < Input type = "text" style = "width:60px" value = "2000" id = 'zRange2' enterkeyhint = "done" / > < / td >
2022-12-14 16:25:37 -05:00
< td > mm< / td >
2022-12-15 17:28:32 -05:00
< td > < Input type = "range" min = "-2000" max = "4000" step = "1" value = "2000" class = "plotSlider" id = 'zRange2Slider' / > < / td >
2022-12-14 16:25:37 -05:00
< / tr >
< tr >
< td > rRange:< / td >
2022-12-15 13:26:17 -05:00
< td > < Input type = "text" style = "width:60px" value = "50" id = 'rRange' enterkeyhint = "done" / > < / td >
2022-12-14 16:25:37 -05:00
< td > mm< / td >
2022-12-15 17:28:32 -05:00
< td > < Input type = "range" min = "1" max = "400" step = "1" value = "50" class = "plotSlider" id = 'rRangeSlider' / > < / td >
2022-12-14 16:25:37 -05:00
< / tr >
2022-12-15 13:26:17 -05:00
< / table >
2022-12-14 16:25:37 -05:00
< / td >
2022-12-15 17:44:45 -05:00
< / tr >
< tr > < td > < / td > < / tr >
2022-12-14 16:25:37 -05:00
< / table >
2022-12-15 13:26:17 -05:00
< / div >
< / div >
2022-12-13 18:24:26 -05:00
< p id = "n0" > < / p >
< p id = "n1" > < / p >
< p id = "n2" > < / p >
< p id = "n3" > < / p >
2022-12-16 16:02:36 -05:00
< hr >
< h1 > θ < sub > CM< / sub > Calculator< / h1 >
The calculation only give θ < sub > CM< / sub > after the bending.
< p > < / p >
< table >
< tr >
< td > Ex [MeV] : < / td >
< td > < Input type = "text" style = "width:60px" value = "0" id = 'Ex0' enterkeyhint = "done" / > < / td >
< td > θ < sub > CM< / sub > Gate [deg] : < / td >
< td > < Input type = "text" style = "width:60px" value = "10" id = 'thetaCMGate' enterkeyhint = "done" / > < / td >
< td > X Gate [%] : < / td >
< td > < Input type = "text" style = "width:60px" value = "95" id = 'XGate' enterkeyhint = "done" / > < / td >
< / tr >
< tr >
< table id = 'thetaCMTable' style = "border:1px solid; text-align:center;" >
< tr >
< td style = "width:30px" > < b > ID< / b > < / td >
< td style = "width:120px" > < b > pos< sub > 0< / sub > (gated)< / b > < / td >
< td style = "width:120px" > < b > pos< sub > 1< / sub > (gated)< / b > < / td >
< td style = "width:60px" > < b > θ < sub > 1< / sub > [deg]< / b > < / td >
< td style = "width:60px" > < b > θ < sub > 2< / sub > [deg]< / b > < / td >
< td style = "width:60px" > < b > θ < sub > avg< / sub > [deg]< / b > < / td >
< td style = "width:60px" > < b > Δ θ [deg]< / b > < / td >
< td style = "width:100px" > < b > sin(θ < sub > avg< / sub > )Δ θ < / b > < / td >
< / tr >
< / table >
< / tr >
< / table >
2022-12-14 19:28:28 -05:00
<!-- ===================================================== -->
2022-12-15 17:28:32 -05:00
<!--
< hr >
2022-12-14 19:28:28 -05:00
< h1 > DWBA and Monte Carlo Simulation (under construction...)< / h1 >
2022-12-15 17:28:32 -05:00
< table id = 'DWBATable' style = "border:1px solid; text-align:center;" >
2022-12-14 19:28:28 -05:00
< tr >
< td > E< sub > x< / sub > [MeV]< / td >
< td > J< sup > π < / sup > < / td >
< td > Orbital < / td >
< / tr >
< / tr >
< td id = 'dwba1' > 0< / td >
2022-12-15 13:26:17 -05:00
< td > < input type = "text" name = "Jpi" size = "5" value = "3/2+" enterkeyhint = "done" / > < / td >
< td > < input type = "text" name = "Orb" size = "5" value = "0d3/2" enterkeyhint = "done" / > < / td >
2022-12-14 19:28:28 -05:00
< / tr >
2022-12-15 17:28:32 -05:00
< / tr >
< td id = 'dwba2' > 0< / td >
< td > < input type = "text" name = "Jpi" size = "5" value = "1/2+" enterkeyhint = "done" / > < / td >
< td > < input type = "text" name = "Orb" size = "5" value = "1s1/2" enterkeyhint = "done" / > < / td >
< / tr >
2022-12-14 19:28:28 -05:00
< / table >
< p > < / p >
< input type = "checkbox" name = "DWBA" value = "On" / > Cal. DWBA
< table >
< tr >
< td > Incoming Channel< / td >
< td >
< select name = "op1" >
< option value = "A" selected > D | An & Cai (2006), E < 183 , 12 < A < 238 < / option >
< option value = "H" > D | Han, Shi, & Shen, (2006), E < 200 | 12 < A < 209 < / option >
< option value = "B" > D | Bojowald et al., (1988), 50 < E < 80 | 27 < A < 208 < / option >
< option value = "K" > P | Koning & Delaroche, (2009), E < 200 | 24 < A < 209 | Iso . Dep . < / option >
< option value = "V" > P | Varner et al., (1991), 16 < E < 65 | 4 < A < 209 < / option >
< option value = "M" > P | Menet et al., (1971), 30 < E < 60 | 40 < A < / option >
< option value = "x" > A=3 | Xu, Guo, Han, & Shen, (2011), E < 250 | 20 < A < 209 < / option >
< option value = "l" > A=3 | Liang, Li, & Cai, (2009), E < 270 | All masses < / option >
< option value = "x" > A=4 | Su & Han, (2015), E < 398 | 20 < A < 209 < / option >
< / select >
< td >
< / tr >
< tr >
< td > Outgoing Channel< / td >
< td >
< select name = "op2" >
< option value = "A" > D | An & Cai (2006), E < 183 , 12 < A < 238 < / option >
< option value = "H" > D | Han, Shi, & Shen, (2006), E < 200 | 12 < A < 209 < / option >
< option value = "B" > D | Bojowald et al., (1988), 50 < E < 80 | 27 < A < 208 < / option >
< option value = "K" selected > P | Koning & Delaroche, (2009), E < 200 | 24 < A < 209 | Iso . Dep . < / option >
< option value = "V" > P | Varner et al., (1991), 16 < E < 65 | 4 < A < 209 < / option >
< option value = "M" > P | Menet et al., (1971), 30 < E < 60 | 40 < A < / option >
< option value = "x" > A=3 | Xu, Guo, Han, & Shen, (2011), E < 250 | 20 < A < 209 < / option >
< option value = "l" > A=3 | Liang, Li, & Cai, (2009), E < 270 | All masses < / option >
< option value = "x" > A=4 | Su & Han, (2015), E < 398 | 20 < A < 209 < / option >
< / select >
< td >
< / tr >
< / table >
< h3 > Plot config (still working on):< / h3 >
< input type = "checkbox" name = "plot" value = "pEZ" checked / > E vs Z< br >
< input type = "checkbox" name = "plot" value = "pExCal" checked / > Ex (cal.)< br >
< input type = "checkbox" name = "plot" value = "pThetaCM" checked / > ThetaCM< br >
< input type = "checkbox" name = "plot" value = "pThetaCM_Z" checked / > ThetaCM vs Z< br >
< input type = "checkbox" name = "plot" value = "pRecoilXY" checked / > Recoil X vs Y< br >
< input type = "checkbox" name = "plot" value = "pRecoilRThetaCM" / > Recoil-R vs ThetaCM< br >
< input type = "checkbox" name = "plot" value = "pRecoilRZ" / > Recoil R vs Z< br >
< input type = "checkbox" name = "plot" value = "pArrayXY" / > Array X vs Y< br >
< p > < / p >
< input type = "checkbox" name = "gate" value = "hit==1" checked / > Array Hit< br >
< input type = "checkbox" name = "gate" value = "loop<=1" checked / > Loop = 1< br >
< input type = "checkbox" name = "gate" value = "thetaCM>10" checked / > ThetaCM > 10 deg< br >
< p > < / p >
< input type = "submit" value = "Run Simulation" style = "width:200px;height:60px;font-size:20px" / >
< p > < / p >
< iframe style = "border:none;" > < / iframe >
2022-12-15 17:28:32 -05:00
-->
2022-12-14 19:28:28 -05:00
<!-- ===================================================== -->
2022-12-16 16:02:36 -05:00
< hr >
2022-12-18 12:41:52 -05:00
< p > < / p >
2022-12-16 16:02:36 -05:00
HELIOSmatics was first built by Ben P. Kay in MS Excel around 2010. It was modified by Ryan Tang later. And now it migrated to the web on Dec, 2022.
2022-12-18 12:41:52 -05:00
<!--
< hr >
Experimental 3D model
< div id = "Plot_3D" class = "plotStyle" > < / div >
-->
2022-12-13 18:24:26 -05:00
< / body >
2022-12-14 19:28:28 -05:00
<!-- ######################################################################################### -->
2022-12-13 18:24:26 -05:00
< script >
function addRow() {
2022-12-14 16:59:17 -05:00
let table = document.getElementById("ExTable");
let nRow = table.rows.length;
let row = table.insertRow(nRow-1);
2022-12-15 18:02:38 -05:00
let energy = Math.random()*Math.min(heavy[4], heavy[5], heavy[6]);
let angle = Math.floor(Math.random() * 30) + 10;
row.innerHTML = '< td > < input type = "text" name = "Ex" size = "8" value = \"' + energy . toFixed ( 3 ) + ' \ " id = \"Ex' + ( nRow-1 ) + ' \ " enterkeyhint = \"done\"/ > < / td > \
< td > < input type = "text" name = "thetaCM" size = "8" value = \"' + angle + ' \ " id = \"theta' + ( nRow-1 ) + ' \ " enterkeyhint = \"done\"/ > < / td > \
2022-12-13 18:24:26 -05:00
< td > < / td > \
< td > < / td > \
< td > < / td > \
< td > < / td > \
< td > < / td > \
< td > < / td > \
< td > < / td > \
< td > < / td > \
< td > < / td > \
< td > < / td > ';
2022-12-15 17:28:32 -05:00
2022-12-14 16:25:37 -05:00
CalculateEZ();
CalculateRZ();
2022-12-15 17:28:32 -05:00
//let table2 = document.getElementById("DWBATable");
//row = table2.insertRow(nRow-1);
//row.innerHTML = '< td id = \"dwba' + ( nRow-1 ) + ' \ " > ' + (nRow-2) + '< / td > \
// < td > < input type = "text" name = "Jpi" size = "5" value = "3/2+" enterkeyhint = "done" / > < / td > \
// < td > < input type = "text" name = "Orb" size = "5" value = "0d3/2" enterkeyhint = "done" / > < / td > ';
2022-12-13 18:24:26 -05:00
}
function deleteRow(){
2022-12-14 16:59:17 -05:00
let table = document.getElementById("ExTable");
let nRow = table.rows.length;
2022-12-13 18:24:26 -05:00
if ( nRow > 3){
table.deleteRow(nRow-2);
}
2022-12-14 16:25:37 -05:00
CalculateEZ();
CalculateRZ();
2022-12-15 17:28:32 -05:00
//let table2 = document.getElementById("DWBATable");
//if ( nRow > 3){
// table2.deleteRow(nRow-2);
//}
2022-12-13 18:24:26 -05:00
}
2022-12-15 17:28:32 -05:00
var beam = []; //A, Z, Mass, Name, Sn, Sp, Sa
2022-12-13 23:02:47 -05:00
var beamMass;
2022-12-13 18:24:26 -05:00
var target= [];
var light=[];
2022-12-15 17:28:32 -05:00
var heavy=[]; //A, Z, Mass, Name, Sn, Sp, Sa
2022-12-13 18:24:26 -05:00
2022-12-13 23:02:47 -05:00
var beamEx;
var BField;
var KEA;
var KE;
var reactionName;
var Qvalue;
var minKEA;
var perpDistant = 11.5; //mm, detector prepdicular distance
var bore = 462.0; // mm
2022-12-14 14:31:54 -05:00
var arrayLen = 50 * 10 + 2 * 9 // SOLARIS
var detLen = 50; // SOLARIS
var nDet = 10; // SOLARIS
var detGap = 2; // SOLARIS
2022-12-16 16:02:36 -05:00
var arrayPos = [];
2022-12-13 23:02:47 -05:00
2022-12-14 14:31:54 -05:00
const c = 299.792468; // mm/ns
2022-12-13 23:02:47 -05:00
var beam_k_lab;
var E_tot_cm ;
var KE_cm ;
var max_Ex ;
var beta ;
var gamma ;
var ez_slope ; // MeV/mm
var alpha ;
var alpha_B ;
2022-12-14 16:25:37 -05:00
var xList =[]; // for E-Z plot
var yList =[]; // for E-Z plot
2022-12-13 23:02:47 -05:00
var ExList = [];
2022-12-14 16:25:37 -05:00
var Zb0List = [];
var rhoList = [];
var ZB0List = [];
var rhoBList = [];
2022-12-14 14:31:54 -05:00
2022-12-14 16:59:17 -05:00
var xRange ;
2022-12-14 14:31:54 -05:00
var yRange = [0, 12];
2022-12-13 23:02:47 -05:00
2022-12-14 16:25:37 -05:00
var zList = []; // for R-Z plot
2022-12-14 16:59:17 -05:00
var rbList = []; // for R-Z plot
var rBList = []; // for R-Z plot
2022-12-14 16:25:37 -05:00
2022-12-14 17:37:09 -05:00
var color = ['rgb(31,119,180)', // muted blue
'rgb(255,127,14)', // safety orange
'rgb(44,160,44)', // cooked asparagus green
'rgb(214,39,40)', // brick red
'rgb(148,103,189)', // muted purple
'rgb(140,86,75)', // chestnut brown
'rgb(277,119,194)', // raspberry yogurt pink
'rgb(127,127,127)', // middle gray
'rgb(118,189,34)', // curry yellow-green
'rgb(23,190,207)']; // blue-teal
2022-12-13 23:02:47 -05:00
function GetMassFromSym(AZ, id){
let str = 'massProxy.py?AZ=' + AZ;
2022-12-13 18:24:26 -05:00
2022-12-13 23:02:47 -05:00
let client = new XMLHttpRequest();
2022-12-13 18:24:26 -05:00
client.onreadystatechange = function() {
2022-12-13 23:02:47 -05:00
let mass = client.responseText.split(",");
2022-12-13 18:24:26 -05:00
if( id == 0 ){
beam[0] = parseInt(mass[0]);
beam[1] = parseInt(mass[1]);
beam[2] = parseFloat(mass[2]);
2022-12-13 23:02:47 -05:00
beam[3] = AZ;
2022-12-15 17:28:32 -05:00
beam[4] = parseFloat(mass[4]);
beam[5] = parseFloat(mass[5]);
beam[6] = parseFloat(mass[6]);
2022-12-13 18:24:26 -05:00
}
if( id == 1 ){
target[0] = parseInt(mass[0]);
target[1] = parseInt(mass[1]);
target[2] = parseFloat(mass[2]);
2022-12-13 23:02:47 -05:00
target[3] = AZ;
2022-12-13 18:24:26 -05:00
}
if( id == 2 ){
light[0] = parseInt(mass[0]);
light[1] = parseInt(mass[1]);
light[2] = parseFloat(mass[2]);
2022-12-13 23:02:47 -05:00
light[3] = AZ;
2022-12-13 18:24:26 -05:00
}
}
client.open('GET', str, false);
client.send();
}
2022-12-13 23:02:47 -05:00
function GetMassFromAZ(A,Z){
let str = 'massProxy.py?A=' + A + '& Z=' + Z;
2022-12-13 18:24:26 -05:00
2022-12-13 23:02:47 -05:00
let client = new XMLHttpRequest();
2022-12-13 18:24:26 -05:00
client.onreadystatechange = function() {
2022-12-13 23:02:47 -05:00
let mass = client.responseText.split(",");
2022-12-13 18:24:26 -05:00
heavy[2] = parseFloat(mass[2]);
2022-12-15 17:28:32 -05:00
heavy[3] = mass[3]?.trim();
heavy[4] = parseFloat(mass[4]);
heavy[5] = parseFloat(mass[5]);
heavy[6] = parseFloat(mass[6]);
2022-12-13 18:24:26 -05:00
}
client.open('GET', str, false);
client.send();
}
2022-12-13 23:02:47 -05:00
function GetMass(){
2022-12-15 17:28:32 -05:00
GetMassFromSym(document.getElementById('beam').value, 0);
GetMassFromSym(document.getElementById('target').value, 1);
GetMassFromSym(document.getElementById('light').value, 2);
2022-12-13 18:24:26 -05:00
2022-12-15 17:28:32 -05:00
beamMass = beam[2];
2022-12-13 23:02:47 -05:00
heavy[0] = beam[0]+target[0]-light[0];
heavy[1] = beam[1]+target[1]-light[1];
GetMassFromAZ(heavy[0], heavy[1]);
document.getElementById('heavyName').innerHTML = heavy[3];
2022-12-15 17:28:32 -05:00
document.getElementById('heavySp').innerHTML = 'Sn: ' + heavy[4] + ' MeV, Sp: ' + heavy[5] + ' MeV, Sa : ' + heavy[6] + ' MeV';
2022-12-13 23:02:47 -05:00
//document.getElementById('n0').innerHTML = beam[0] + "," + beam[1] + "," + beam[2]
//document.getElementById('n1').innerHTML = target[0] + "," + target[1] + "," + target[2]
//document.getElementById('n2').innerHTML = light[0] + "," + light[1] + "," + light[2]
//document.getElementById('n3').innerHTML = heavy[0] + "," + heavy[1] + "," + heavy[2]
2022-12-13 18:24:26 -05:00
}
2022-12-13 23:02:47 -05:00
function CalConstants(){
2022-12-13 18:24:26 -05:00
2022-12-13 23:02:47 -05:00
beamEx = parseFloat(document.getElementById('beamEx').value);
beam[2] = beamMass + beamEx;
2022-12-13 18:24:26 -05:00
2022-12-13 23:02:47 -05:00
BField = parseFloat(document.getElementById('BField').value);
KEA = document.getElementById('KEA').value;
KE = KEA * beam[0];
2022-12-13 18:24:26 -05:00
2022-12-13 23:02:47 -05:00
reactionName = beam[3] +"(" + target[3] + "," + light[3] + ")" + heavy[3] + "@" + KEA + "MeV/u";
2022-12-13 18:24:26 -05:00
2022-12-13 23:02:47 -05:00
Qvalue = - heavy[2] - light[2] + beam[2] + target[2] ;
minKEA = (Math.pow(light[2] + heavy[2],2) - Math.pow(beam[2] + target[2],2))/2/target[2]/beam[0];
document.getElementById('reactionName').innerHTML = reactionName;
2022-12-15 17:28:32 -05:00
document.getElementById('minKEA').innerHTML = "min Beam Energy: " + minKEA.toFixed(3) + " MeV/u";
2022-12-13 18:24:26 -05:00
document.getElementById('Q-value').innerHTML = Qvalue.toFixed(3);
2022-12-13 23:02:47 -05:00
beam_k_lab = Math.sqrt(Math.pow(beam[2] + KE,2) - Math.pow(beam[2],2));
E_tot_cm = Math.sqrt(Math.pow(target[2] + beam[2],2) + 2*target[2]*KE);
KE_cm = E_tot_cm - beam[2] - target[2];
max_Ex = KE_cm + Qvalue;
beta = beam_k_lab/(beam[2] + target[2] + KE);
gamma = 1./Math.sqrt(1-beta*beta);
2022-12-13 18:24:26 -05:00
2022-12-13 23:02:47 -05:00
ez_slope = Math.abs(BField) * c * light[1]*beta/2/Math.PI/1000; // MeV/mm
alpha = ez_slope/beta;
alpha_B = alpha * heavy[1]/light[1];
2022-12-13 18:24:26 -05:00
2022-12-13 23:02:47 -05:00
}
2022-12-16 16:02:36 -05:00
function CalArrayPos(){
let haha = parseFloat(document.getElementById('posArray').value);
arrayPos = [];
for( let i = 0; i < nDet ; i + + ) {
let kaka = [];
if( haha < 0 ) {
kaka.push(haha - (i+1) * detLen - i * detGap);
kaka.push(haha - (i) * detLen - i * detGap);
}else{
kaka.push(haha + (i) * detLen + i * detGap);
kaka.push(haha + (i+1) * detLen + i * detGap);
}
arrayPos.push(kaka);
}
}
2022-12-13 23:02:47 -05:00
function SetSSType(){
let helios = document.getElementById('HELIOS').checked;
let solaris = document.getElementById('SOLARIS').checked;
let iss = document.getElementById('ISS').checked;
2022-12-14 14:31:54 -05:00
if ( helios == true ) {
perpDistant = 11.5;
detGap = 5;
detLen = 50;
nDet = 6;
}
if ( solaris == true ) {
perpDistant = 11.5;
detGap = 5;
detLen = 50;
nDet = 10;
}
if ( iss == true ) {
perpDistant = 20;
detGap = 5;
detLen = 100;
nDet = 4;
}
arrayLen = detLen * nDet + detGap * (nDet-1);
2022-12-13 18:24:26 -05:00
2022-12-16 16:02:36 -05:00
CalArrayPos();
2022-12-13 23:02:47 -05:00
//document.getElementById('n1').innerHTML = perpDistant;
}
2022-12-13 18:24:26 -05:00
2022-12-14 16:25:37 -05:00
function CalculateEZ(){
2022-12-13 23:02:47 -05:00
let tableEx = document.getElementById("ExTable");
let nRow = tableEx.rows.length;
xList = [];
yList = [];
ExList = [];
2022-12-14 16:25:37 -05:00
Zb0List = [];
rhoList = [];
ZB0List = [];
rhoBList = [];
2022-12-14 16:59:17 -05:00
//alert("CalculateEZ called, nRow = " + nRow);
2022-12-13 18:24:26 -05:00
for( let i = 1; i < nRow-1 ; i + + ) {
let Ex = parseFloat(document.getElementById("Ex" + i).value);
let theta = parseFloat(document.getElementById("theta" + i).value);
2022-12-13 23:02:47 -05:00
ExList.push(Ex);
//alert( i, ", Ex : " + Ex);
2022-12-13 18:24:26 -05:00
let haha1 = E_tot_cm*E_tot_cm - Math.pow(heavy[2] + Ex + light[2],2);
let haha2 = E_tot_cm*E_tot_cm - Math.pow(heavy[2] + Ex - light[2],2);
let k_cm = Math.sqrt(haha1*haha2)/2/E_tot_cm;
let cs = Math.cos(theta*Math.PI/180.);
let ss = Math.sin(theta*Math.PI/180.);
let qb = Math.sqrt(light[2]*light[2]+k_cm*k_cm);
let Eb = gamma * qb - gamma * beta * k_cm * cs - light[2];
let Zb0 = (gamma*beta* qb - gamma * k_cm * cs )/alpha; //mm
2022-12-14 16:25:37 -05:00
Zb0List.push(Zb0);
2022-12-13 23:02:47 -05:00
let rho = k_cm * ss/c/light[1]/Math.abs(BField) * 1000; // mm
2022-12-14 16:25:37 -05:00
rhoList.push(rho);
2022-12-16 16:02:36 -05:00
let Zb = Zb0 * (1- Math.asin(perpDistant/rho/2)/Math.PI);
2022-12-13 18:24:26 -05:00
let thetaLab = 180 - Math.atan2(k_cm * ss, gamma * (beta * qb - k_cm * cs)) * 180/Math.PI;
let Tcyc = (light[2] + Eb)/alpha/c;
tableEx.rows[i].cells[2].innerHTML = Eb.toFixed(3);
tableEx.rows[i].cells[3].innerHTML = Zb0.toFixed(1);
tableEx.rows[i].cells[4].innerHTML = Zb.toFixed(1);
tableEx.rows[i].cells[5].innerHTML = (2*rho).toFixed(1);
tableEx.rows[i].cells[6].innerHTML = thetaLab.toFixed(2);
tableEx.rows[i].cells[7].innerHTML = Tcyc.toFixed(2);
let qB = Math.sqrt(heavy[2]*heavy[2]+k_cm*k_cm);
let EB = gamma * qB + gamma * beta * k_cm * cs - heavy[2];
let thetaLab_B = Math.atan2(-k_cm * ss, gamma * (beta * qB + k_cm * cs)) * 180/Math.PI;
let ZB0 = (gamma*beta* qB + gamma * k_cm * cs )/alpha_B; //mm
2022-12-13 23:02:47 -05:00
let rhoB = k_cm * ss/c/heavy[1]/Math.abs(BField) * 1000; // mm
2022-12-14 16:25:37 -05:00
ZB0List.push(ZB0);
rhoBList.push(rhoB);
2022-12-13 18:24:26 -05:00
tableEx.rows[i].cells[8].innerHTML = EB.toFixed(3);
tableEx.rows[i].cells[9].innerHTML = thetaLab_B.toFixed(2);
tableEx.rows[i].cells[10].innerHTML = (ZB0/2).toFixed(2);
tableEx.rows[i].cells[11].innerHTML = (2*rhoB).toFixed(2);
2022-12-13 23:02:47 -05:00
let xxx = [];
let yyy = [];
2022-12-13 18:24:26 -05:00
for( let j = 0; j < 100 ; j + + ) {
let thetaCM = Math.PI/Math.log10(100) * Math.log10(100/(100-j)) ;
2022-12-16 16:02:36 -05:00
let temp = Math.PI * ez_slope / beta / k_cm * perpDistant / Math.sin(thetaCM); // perpDistant / 2/ rho(thetaCM)
2022-12-13 18:24:26 -05:00
if( !isFinite(temp) ) continue;
2022-12-16 16:02:36 -05:00
let pxTemp = 1. /alpha * (gamma * beta * qb - gamma * k_cm * Math.cos(thetaCM)) * (1 - Math.asin(temp)/Math.PI) ;
2022-12-13 18:24:26 -05:00
let pyTemp = gamma * qb - light[2] - gamma * beta * k_cm * Math.cos(thetaCM);
if( !isNaN(pxTemp) & & !isNaN(pyTemp) ){
xxx.push(pxTemp);
yyy.push(pyTemp);
}
};
xList.push(xxx);
yList.push(yyy);
};
2022-12-15 13:26:17 -05:00
PlotEZ();
AdjustRangeEZ();
2022-12-13 18:24:26 -05:00
2022-12-14 14:31:54 -05:00
}
2022-12-15 13:26:17 -05:00
function PlotEZ(){
2022-12-14 14:31:54 -05:00
SetSSType();
Plotly.purge("Plot_EZ");
2022-12-14 16:59:17 -05:00
2022-12-14 14:31:54 -05:00
let nEx = xList.length;
2022-12-14 16:25:37 -05:00
let data = [];
2022-12-14 17:37:09 -05:00
for( let i = 0; i < nEx ; i + + ) {
let kaka = color[i%10];
2022-12-14 16:25:37 -05:00
let newData = {
2022-12-14 17:37:09 -05:00
x : xList[i],
y : yList[i],
mode:"lines",
type:"scatter",
name:"Ex="+ExList[i],
marker : { color : kaka}
2022-12-14 16:25:37 -05:00
}
data.push(newData);
}
2022-12-15 13:26:17 -05:00
let haha = parseFloat(document.getElementById('posArrayRange').value);
let xStart = (haha < 0 ? haha - arrayLen - 100 : haha - 100 ) ;
let xEnd = (haha < 0 ? haha + 100: haha + arrayLen + 100 ) ;
xRange = [xStart, xEnd];
//document.getElementById('n0').innerHTML = xRange;
let haha2 = parseFloat(document.getElementById('eRangeSlider').value);
yRange = [0, haha2];
2022-12-14 14:31:54 -05:00
let layout = {
2022-12-15 18:02:38 -05:00
xaxis: {range: xRange, title: { text : "Z [mm]", standoff : 1}, mirror : "allticks", linewidth : "1"},
2022-12-15 13:26:17 -05:00
yaxis: {range: yRange, title: "Energy [MeV]" , mirror : "allticks", linewidth : "1"},
2022-12-14 14:31:54 -05:00
title: reactionName,
2022-12-18 12:41:52 -05:00
dragmode : "pan",
2022-12-15 18:02:38 -05:00
margin: { l: 40, r: 40, b : 60, t : 40},
2022-12-14 14:31:54 -05:00
legend: {yanchor:"top", xanchor:"left", x:"0.01",y:"0.99" }
};
2022-12-15 13:26:17 -05:00
2022-12-15 17:28:32 -05:00
Plotly.newPlot( "Plot_EZ", data, layout, {responsive: true});
2022-12-14 16:25:37 -05:00
2022-12-14 14:31:54 -05:00
PlotThetaCMLine(document.getElementById('thetaCM').value);
PlotBore();
2022-12-15 13:26:17 -05:00
2022-12-14 16:25:37 -05:00
PlotRZ();
2022-12-13 23:02:47 -05:00
}
function PlotThetaCMLine(thetaCM){
let cs = Math.cos(thetaCM * Math.PI /180);
let ss = Math.sin(thetaCM * Math.PI /180);
2022-12-14 16:25:37 -05:00
let zzList = [];
2022-12-13 23:02:47 -05:00
let eList = [];
for( let z = -2000; z < 2000 ; z + = 30 ) {
2022-12-14 16:25:37 -05:00
zzList.push(z);
2022-12-13 23:02:47 -05:00
let kaka = Math.pow(gamma * ss,2);
let a1 = light[2]*light[2]*(1-kaka);
let haha = (cs*Math.sqrt(alpha*alpha*z*z + a1) - kaka * ez_slope * z)/(1-kaka)- light[2];
eList.push(haha);
2022-12-13 18:24:26 -05:00
}
2022-12-15 13:26:17 -05:00
Plotly.addTraces("Plot_EZ", {x : zzList,
y: eList,
name:"thetaCM=" + thetaCM ,
marker : { color : 'rgb(100,100,100)'},
line : {dash : 'solid', width : 1 }
}
, 0);
2022-12-13 23:02:47 -05:00
}
function PlotBore(){
2022-12-14 16:25:37 -05:00
let zzList = [];
2022-12-13 23:02:47 -05:00
let eList = [];
for( let z = -2000; z < 2000 ; z + = 30 ) {
2022-12-14 16:25:37 -05:00
zzList.push(z);
2022-12-13 23:02:47 -05:00
let haha = Math.sqrt((z*z+Math.PI*Math.PI*bore*bore)*alpha*alpha + light[2]*light[2]) - light[2];
eList.push(haha);
2022-12-14 16:25:37 -05:00
}
2022-12-14 17:37:09 -05:00
Plotly.addTraces("Plot_EZ", {x : zzList, y: eList, name:"Bore", marker : { color : 'rgb(200,200, 200)'} }, 0);
2022-12-14 16:25:37 -05:00
}
function CalculateRZ(){
// this rquire ZB0List and rhoBList from CalculateEZ();
zList = [];
2022-12-14 16:59:17 -05:00
rbList = [];
rBList = [];
2022-12-14 16:25:37 -05:00
for( let z = -2000; z < 4000 ; z + = 2 ) zList . push ( z ) ;
// cal the heavy recoil first
for( let i = 0; i < ZB0List.length ; i + + ) {
let rrr = []
for( let j = 0; j < zList.length ; j + + ) {
if( zList[j] < 0 ) {
rrr.push(NaN);
}else{
rrr.push(2*rhoBList[i] *Math.abs( Math.sin(zList[j] * Math.PI / ZB0List[i])));
}
}
2022-12-14 16:59:17 -05:00
rBList.push(rrr);
}
// cal the light recoil first
for( let i = 0; i < Zb0List.length ; i + + ) {
let rrr = []
for( let j = 0; j < zList.length ; j + + ) {
if( target[0] > light[0] ){
if( zList[j] > 0 ){
rrr.push(NaN);
}else{
rrr.push(2*rhoList[i] *Math.abs( Math.sin(zList[j] * Math.PI / Zb0List[i])));
}
}else{
if( zList[j] < 0 ) {
rrr.push(NaN);
}else{
rrr.push(2*rhoList[i] *Math.abs( Math.sin(zList[j] * Math.PI / Zb0List[i])));
}
}
}
rbList.push(rrr);
2022-12-13 23:02:47 -05:00
}
2022-12-14 16:25:37 -05:00
PlotRZ();
AdjustRecoilPos();
}
function PlotRZ(){
Plotly.purge("Plot_RZ");
let data = [];
2022-12-14 16:59:17 -05:00
let nEx = ExList.length;
2022-12-14 16:25:37 -05:00
for(let i = 0 ; i < nEx ; i + + ) {
2022-12-14 17:37:09 -05:00
let kaka = color[i%10];
2022-12-14 16:25:37 -05:00
let newData = {
x : zList,
2022-12-14 16:59:17 -05:00
y : rBList[i],
mode : "lines",
type : "scatter",
name : "Ex="+ExList[i] + ",theta=" + document.getElementById('theta'+(i+1)).value,
2022-12-14 17:37:09 -05:00
marker : { color : kaka}
2022-12-14 16:59:17 -05:00
}
data.push(newData);
}
for(let i = 0 ; i < nEx ; i + + ) {
2022-12-14 17:37:09 -05:00
let kaka = color[i%10];
2022-12-14 16:59:17 -05:00
let newData = {
x : zList,
y : rbList[i],
2022-12-14 16:25:37 -05:00
mode : "lines",
2022-12-14 16:59:17 -05:00
line : {dash : 'dashdot', width : 1 },
2022-12-14 16:25:37 -05:00
type : "scatter",
name : "Ex="+ExList[i] + ",theta=" + document.getElementById('theta'+(i+1)).value,
2022-12-14 17:37:09 -05:00
marker : { color : kaka}
2022-12-14 16:25:37 -05:00
}
data.push(newData);
}
let xxx = [parseInt(document.getElementById('zRange1').value), parseInt(document.getElementById('zRange2').value)];
let yyy = [0, parseInt(document.getElementById('rRange').value)];
let layout = {
2022-12-15 18:02:38 -05:00
xaxis: {range: xxx, title: { text : "Z [mm]", standoff : 1}, mirror : "allticks", linewidth : "1"},
2022-12-14 16:25:37 -05:00
yaxis: {range: yyy, title: "R [mm]" , mirror : "allticks", linewidth : "1"},
title: reactionName,
showlegend : true,
2022-12-18 12:41:52 -05:00
dragmode : "pan",
2022-12-15 18:02:38 -05:00
margin: { l: 40, r: 40, b : 60, t : 40},
2022-12-15 17:28:32 -05:00
legend: { yanchor:"top", xanchor:"left", x:"0.01",y:"0.99"}
2022-12-14 16:25:37 -05:00
};
2022-12-15 17:28:32 -05:00
Plotly.newPlot( "Plot_RZ", data, layout, {responsive: true});
2022-12-14 16:25:37 -05:00
2022-12-13 23:02:47 -05:00
}
2022-12-16 16:02:36 -05:00
function CalZ(theta, k_cm, qb){
let cs = Math.cos(theta*Math.PI/180.);
let ss = Math.sin(theta*Math.PI/180.);
let Zb0 = (gamma*beta* qb - gamma * k_cm * cs )/alpha; //mm
let rho = k_cm * ss / c/ light[1]/ Math.abs(BField) * 1000; // mm
return Zb0 * ( 1 - Math.sin( perpDistant/2/rho ) / Math.PI );
}
function SearchThetaCM(Z, thetaMin, k_cm, qb){
let step = 0.01;
for( let yy = thetaMin; yy < 180 ; yy + = step ) {
if( yy > 12 ) step = 0.1;
if( yy > 20 ) step = 0.5;
if( yy > 40 ) step = 1.0;
let z1 = CalZ(yy, k_cm, qb);
let z2 = CalZ(yy+step, k_cm, qb);
//console.log(Z, ", ", yy.toFixed(3), ", ", z1.toFixed(3), ", ", z2.toFixed(3), ", ", (z2-z1).toFixed(3) );
if( z1 > z2 ){ /// in the bending range
continue;
}else{
if( Z < z1 ) {
// return yy;
break;
}
if( z1< = Z & & Z < = z2 ){ // do a linear approximation
return (Z-z1)/(z2-z1)*step + yy;
}
}
}
return NaN;
}
function CalThetaCM(){
let ex = parseFloat(document.getElementById('Ex0').value);
let angGate = parseFloat(document.getElementById('thetaCMGate').value);
let xGate = parseFloat(document.getElementById('XGate').value);
CalArrayPos();
let haha1 = E_tot_cm*E_tot_cm - Math.pow(heavy[2] + ex + light[2],2);
let haha2 = E_tot_cm*E_tot_cm - Math.pow(heavy[2] + ex - light[2],2);
let k_cm = Math.sqrt(haha1*haha2)/2/E_tot_cm;
let qb = Math.sqrt(light[2]*light[2]+k_cm*k_cm);
let table = document.getElementById('thetaCMTable');
let nRow = table.rows.length;
if( nRow > 1 ){
for( let i = nRow-1; i > 0; i -- ){
table.deleteRow(i);
}
}
for( let i = 0; i < arrayPos.length ; i + + ) {
let row = table.insertRow(i+1);
row.insertCell().innerHTML = i;
let p1 = (arrayPos[i][0] + detLen * (100. - xGate)/200.);
let p2 = (arrayPos[i][1] - detLen * (100. - xGate)/200.);
row.insertCell().innerHTML = arrayPos[i][0] + "(" + p1 + ")";
row.insertCell().innerHTML = arrayPos[i][1] + "(" + p2 + ")";
///Search thetaCM for Z
let a1 = SearchThetaCM(p1, angGate, k_cm, qb);
let a2 = SearchThetaCM(p2, angGate, k_cm, qb);
row.insertCell().innerHTML = a1.toFixed(2);
row.insertCell().innerHTML = a2.toFixed(2);
let am = (a2+a1)/2;
let da = Math.abs(a2-a1);
row.insertCell().innerHTML = am.toFixed(2);
row.insertCell().innerHTML = da.toFixed(2);
row.insertCell().innerHTML = (Math.sin(am*Math.PI/180) * da * Math.PI/180).toExponential(2);
}
}
2022-12-13 18:24:26 -05:00
document.getElementById('beam').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
2022-12-13 23:02:47 -05:00
GetMass();
CalConstants();
2022-12-13 18:24:26 -05:00
}
}, false
);
2022-12-14 14:31:54 -05:00
document.getElementById('beamEx').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
CalConstants();
}
}, false
);
2022-12-13 18:24:26 -05:00
document.getElementById('target').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
2022-12-13 23:02:47 -05:00
GetMass();
CalConstants();
2022-12-13 18:24:26 -05:00
}
}, false
);
document.getElementById('light').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
2022-12-13 23:02:47 -05:00
GetMass();
CalConstants();
2022-12-13 18:24:26 -05:00
}
}, false
);
document.getElementById('BField').addEventListener('keypress',
function(e){
2022-12-15 13:26:17 -05:00
//document.getElementById('n0').innerHTML = e.keyCode;
2022-12-13 18:24:26 -05:00
if(e.keyCode == 13){
2022-12-13 23:02:47 -05:00
document.getElementById('BRange').value = this.value;
2022-12-14 16:25:37 -05:00
CalConstants();
CalculateEZ();
CalculateRZ();
2022-12-16 16:02:36 -05:00
CalThetaCM();
2022-12-13 18:24:26 -05:00
}
}, false
);
2022-12-14 14:31:54 -05:00
document.getElementById('BRange').oninput = function(){
document.getElementById('BField').value = this.value;
CalConstants();
2022-12-14 16:25:37 -05:00
CalculateEZ();
CalculateRZ();
2022-12-15 13:26:17 -05:00
AdjustRangeEZ();
2022-12-16 16:02:36 -05:00
CalThetaCM();
2022-12-14 14:31:54 -05:00
}
2022-12-13 18:24:26 -05:00
document.getElementById('KEA').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
2022-12-13 23:02:47 -05:00
document.getElementById('KEARange').value = this.value;
2022-12-14 16:25:37 -05:00
CalConstants();
CalculateEZ();
CalculateRZ();
2022-12-16 16:02:36 -05:00
CalThetaCM();
2022-12-13 23:02:47 -05:00
}
}, false
);
2022-12-14 14:31:54 -05:00
document.getElementById('KEARange').oninput = function(){
document.getElementById('KEA').value = this.value;
CalConstants();
2022-12-14 16:25:37 -05:00
CalculateEZ();
CalculateRZ();
2022-12-16 16:02:36 -05:00
CalThetaCM();
2022-12-14 14:31:54 -05:00
}
2022-12-13 23:02:47 -05:00
document.getElementById('thetaCM').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
document.getElementById('thetaCMRange').value = this.value;
2022-12-14 16:25:37 -05:00
CalConstants();
CalculateEZ();
2022-12-13 23:02:47 -05:00
}
}, false
);
2022-12-14 14:31:54 -05:00
document.getElementById('thetaCMRange').oninput = function(){
document.getElementById('thetaCM').value = this.value;
CalConstants();
2022-12-14 16:25:37 -05:00
CalculateEZ();
2022-12-14 14:31:54 -05:00
}
2022-12-15 13:26:17 -05:00
function AdjustRangeEZ(){
let haha = parseFloat(document.getElementById('posArray').value);
2022-12-14 14:31:54 -05:00
let xStart = (haha < 0 ? haha - arrayLen - 100 : haha - 100 ) ;
let xEnd = (haha < 0 ? haha + 100: haha + arrayLen + 100 ) ;
2022-12-16 16:02:36 -05:00
CalArrayPos();
2022-12-15 13:26:17 -05:00
2022-12-16 16:02:36 -05:00
xRange = [xStart, xEnd];
yRange = [0, parseFloat(document.getElementById('eRangeSlider').value)];
2022-12-14 14:31:54 -05:00
//document.getElementById('n0').innerHTML = pos;
//document.getElementById('n2').innerHTML = arrayLen;
//document.getElementById('n1').innerHTML = xRange;
2022-12-14 16:25:37 -05:00
2022-12-14 14:31:54 -05:00
let shapeArray = [];
for( let i = 0; i < nDet ; i + + ) {
let newBlock = {
type: 'rect',
xref: 'x',
yref: 'paper',
2022-12-16 16:02:36 -05:00
x0 : arrayPos[i][0],
x1 : arrayPos[i][1],
2022-12-14 14:31:54 -05:00
y0 : 0,
y1 : 1,
fillcolor : '#9999FF',
opacity : 0.1,
line : { width : 0} }
shapeArray.push(newBlock);
}
var update = {
'xaxis.range' : xRange,
'yaxis.range' : yRange,
'shapes' : shapeArray
}
Plotly.relayout("Plot_EZ", update);
}
2022-12-13 23:02:47 -05:00
document.getElementById('posArray').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
document.getElementById('posArrayRange').value = this.value;
2022-12-15 13:26:17 -05:00
AdjustRangeEZ();
2022-12-14 16:25:37 -05:00
AdjustRecoilPos();
2022-12-16 16:02:36 -05:00
CalThetaCM();
2022-12-13 18:24:26 -05:00
}
}, false
);
2022-12-14 14:31:54 -05:00
document.getElementById('posArrayRange').oninput = function(){
document.getElementById('posArray').value = this.value;
2022-12-15 13:26:17 -05:00
AdjustRangeEZ();
2022-12-14 16:25:37 -05:00
AdjustRecoilPos();
2022-12-16 16:02:36 -05:00
CalThetaCM();
2022-12-14 14:31:54 -05:00
}
2022-12-14 16:25:37 -05:00
function AdjustRecoilPos(){
let pos1 = parseInt(document.getElementById('posRecoil').value);
let pos2 = pos1+10;
//document.getElementById('n0').innerHTML = pos1;
let shapeRecoil = {
type: 'rect',
xref: 'x',
yref: 'y',
x0 : pos1,
x1 : pos2,
y0 : 10,
y1 : 45,
fillcolor : '#FF0000',
opacity : 0.4,
line : { width : 0}
};
let totalShape = [];
for( let i = 0; i < nDet ; i + + ) {
let newhaha = {
type: 'rect',
xref: 'x',
yref: 'y',
2022-12-16 16:02:36 -05:00
x0 : arrayPos[i][0],
x1 : arrayPos[i][1],
2022-12-14 16:25:37 -05:00
y0 : 0,
y1 : perpDistant,
fillcolor : '#9999FF',
opacity : 0.1,
line : { width : 0} };
totalShape.push(newhaha);
}
totalShape.push(shapeRecoil);
var update = {
'shapes' : totalShape
}
Plotly.relayout("Plot_RZ", update);
}
document.getElementById('posRecoil').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
document.getElementById('posRecoilRange').value = this.value;
AdjustRecoilPos();
}
}, false
);
document.getElementById('posRecoilRange').oninput = function(){
document.getElementById('posRecoil').value = this.value;
AdjustRecoilPos();
}
function AdjustRangeRZ(){
let zmin = parseInt(document.getElementById('zRange1').value);
let zmax = parseInt(document.getElementById('zRange2').value);
let rmax = parseInt(document.getElementById('rRange').value);
let update = {
'xaxis.range' : [zmin, zmax],
'yaxis.range' : [0, rmax]
}
Plotly.relayout("Plot_RZ", update);
}
document.getElementById('zRange1').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
document.getElementById('zRange1Slider').value = this.value;
AdjustRangeRZ();
}
}, false
);
document.getElementById('zRange1Slider').oninput = function(){
document.getElementById('zRange1').value = this.value;
AdjustRangeRZ();
}
document.getElementById('zRange2').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
document.getElementById('zRange2Slider').value = this.value;
AdjustRangeRZ();
}
}, false
);
document.getElementById('zRange2Slider').oninput = function(){
document.getElementById('zRange2').value = this.value;
AdjustRangeRZ();
}
document.getElementById('rRange').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
let rrrr = parseInt(this.value);
if ( rrrr < 1 ) {
document.getElementById('rRange').value = 1;
rrrr = 1;
}
document.getElementById('rRangeSlider').value = rrrr;
AdjustRangeRZ();
}
}, false
);
document.getElementById('rRangeSlider').oninput = function(){
document.getElementById('rRange').value = this.value;
AdjustRangeRZ();
}
2022-12-15 13:26:17 -05:00
document.getElementById('eRange').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
let rrrr = parseInt(this.value);
if ( rrrr < 1 ) {
document.getElementById('eRange').value = 1;
rrrr = 1;
}
document.getElementById('eRangeSlider').value = rrrr;
AdjustRangeEZ();
}
}, false
);
document.getElementById('eRangeSlider').oninput = function(){
document.getElementById('eRange').value = this.value;
AdjustRangeEZ();
}
2022-12-13 23:02:47 -05:00
window.logMeThis = function(){
SetSSType();
2022-12-14 16:25:37 -05:00
CalculateEZ();
CalculateRZ();
2022-12-13 18:24:26 -05:00
}
2022-12-15 13:26:17 -05:00
2022-12-13 18:24:26 -05:00
var FuncEx = window.logMeThis.bind(null, "Ex");
window.addEventListener('keypress', FuncEx);
var FuncThetaCM = window.logMeThis.bind(null, "thetaCM");
window.addEventListener('keypress', FuncThetaCM);
2022-12-13 23:02:47 -05:00
window.checkSSType = function(){
SetSSType();
2022-12-14 16:25:37 -05:00
CalculateEZ();
2022-12-16 16:02:36 -05:00
CalThetaCM();
2022-12-13 23:02:47 -05:00
}
2022-12-13 18:24:26 -05:00
2022-12-13 23:02:47 -05:00
var FuncCheckSSType = window.checkSSType.bind(null, "SSType");
document.getElementById('HELIOS').addEventListener('click', FuncCheckSSType);
document.getElementById('SOLARIS').addEventListener('click', FuncCheckSSType);
document.getElementById('ISS').addEventListener('click', FuncCheckSSType);
2022-12-16 16:02:36 -05:00
document.getElementById('Ex0').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
CalThetaCM();
}
}, false
);
document.getElementById('thetaCMGate').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
CalThetaCM();
}
}, false
);
document.getElementById('XGate').addEventListener('keypress',
function(e){
if(e.keyCode == 13){
CalThetaCM();
}
}, false
);
2022-12-13 18:24:26 -05:00
2022-12-18 12:41:52 -05:00
function HalfCylinder(r, y, d, up){
let a = [];
let b = [];
let c = [];
let nStep = 60;
let step = 2*r/nStep;
for( let i = 0; i < = nStep ; i++){
let x = -r + i * step;
a.push(x);
c.push(Math.sqrt(r*r - x*x) * up);
b.push(y);
}
for( let i = 0; i < = nStep; i ++){
let x = r - i * step;
a.push(x);
c.push(Math.sqrt(r*r - x*x) * up);
b.push(y+d);
}
let haha = [];
haha.push(a);
haha.push(b);
haha.push(c);
return haha;
}
function detMesh(startPos, phi){
let aaa = 110; // prepdist
let len = 500; // detLen
let www = 100; //det width
let a =[];
let b =[];
let c =[];
let cs = Math.cos(phi * Math.PI / 180);
let ss = Math.sin(phi * Math.PI / 180);
let A0 = aaa * cs - www / 2 * ss;
let A1 = aaa * ss + www / 2 * cs;
let B0 = aaa * cs + www / 2 * ss;
let B1 = aaa * ss - www / 2 * cs;
a.push(A0); b.push(A1); c.push(startPos);
a.push(B0); b.push(B1); c.push(startPos);
a.push(B0); b.push(B1); c.push(startPos + len);
a.push(A0); b.push(A1); c.push(startPos + len);
let haha = [];
haha.push(a);
haha.push(b);
haha.push(c);
return haha;
}
function Helix(theta, phi, rho, sign, nCyc){
// sign = B-field
// nCyc < 0 = updatream
let a = [];
let b = [];
let c = [];
let deg = Math.PI/180;
let nStep = 100;
let ts = Math.tan(theta * deg);
let zRange = nCyc * rho/ts * Math.PI * 2;
let zStep = zRange/nStep;
for( let i = 0; i < nStep ; i + + ) {
let zzz;
zzz = i * zStep;
b.push(zzz);
a.push( rho * ( Math.sin( ts * zzz / rho - phi * deg ) + Math.sin(phi * deg) ) );
c.push( rho * sign * (Math.cos( ts * zzz / rho - phi * deg ) - Math.cos(phi * deg)) );
}
let haha = [];
haha.push(a);
haha.push(b);
haha.push(c);
return haha;
}
function Plot3D(){
let u1 = HalfCylinder(bore, -1000, 2500., 1);
let d1 = HalfCylinder(bore, -1000, 2500., -1);
let line1 = Helix(40, 0, 80, -1, -1);
let line2 = Helix(2, 180, 10, -1, 0.5);
let data = [
{type : 'mesh3d', x : u1[0], y : u1[1], z : u1[2], hoverinfo: 'none', opacity : 0.2, color : "#DDDDDD"}
,{type : 'mesh3d', x : d1[0], y : d1[1], z : d1[2], hoverinfo: 'none', opacity : 0.2, color : "#DDDDDD"}
,{type : 'scatter3d', mode : 'lines', x : line1[0], y : line1[1], z : line1[2], name : "haha"}
,{type : 'scatter3d', mode : 'lines', x : line2[0], y : line2[1], z : line2[2], name : "kaka"}
];
/*
let data = [];
for( let i = 0; i < 1 ; i + + ) {
let haha = detMesh(-200, 360/6*i + 90);
console.log(haha[0], "| ", haha[1], "| ", haha[2]);
data.push(
{type : 'mesh3d', x : haha[0], y : haha[1], z : haha[2], hoverinfo: 'none', opacity : 1.0, color : "#FF0000"}
);
}*/
let layout = {
aspectmode: 'manual',
aspectratio:{ x : 0.5, y : 0.5, z : 2.5 },
margin: { l: 40, r: 40, b : 60, t : 40},
};
Plotly.newPlot('Plot_3D', data, layout);
}
2022-12-13 23:02:47 -05:00
GetMass();
CalConstants();
SetSSType();
2022-12-14 16:25:37 -05:00
CalculateEZ();
CalculateRZ();
AdjustRecoilPos();
2022-12-16 16:02:36 -05:00
CalThetaCM();
2022-12-18 12:41:52 -05:00
//Plot3D();
2022-12-13 18:24:26 -05:00
< / script >
< html >