diff --git a/geo.js b/geo.js index 66520d8..4c12beb 100644 --- a/geo.js +++ b/geo.js @@ -216,6 +216,7 @@ class detectorStation extends beamCircleElement { super(xy, 100, 0, Math.PI*2, color.Detector); this.xy = xy; this.name = name; + this.entracePos = xy; } draw(onoff){ super.draw(onoff); @@ -371,12 +372,10 @@ let targetRoom1; //================= beam line to target room 2 let targetRoom2; { - let b2 = new beamLine(sourceLine.tandem.GetExitPos(300), 0, 600); b2.offset = 11; let q2 = new beamRectElement( sourceLine.tandem.GetExitPos(450), 0, 60, 60, color.Qpole); let df2 = new beamRectElement( q2.GetExitPos(50), 0, 40, 40, color.Deflector); let q3 = new beamRectElement( df2.GetExitPos(50), 0, 60, 60, color.Qpole); - let d2 = new beamDipole(b2.GetExitPos(0), 80, 90 * deg, 0, color.Dipole); - let b3 = new beamLine(d2.exitPos, -90 * deg, 1700, color.BeamPipe); + let d2 = new beamDipole(sourceLine.tandem.GetExitPos(900), 80, 90 * deg, 0, color.Dipole); let df3 = new beamRectElement(d2.GetExitPos(100), -90 * deg, 40, 40, color.Deflector); let q4 = new beamRectElement( df3.GetExitPos(50), -90 * deg, 60, 60, color.Qpole); let df4 = new beamRectElement(q4.GetExitPos(50), -90 * deg, 40, 40, color.Deflector); @@ -393,70 +392,66 @@ let targetRoom2; let q5 = new beamRectElement( df6.GetExitPos(50), -90 * deg, 60, 60, color.Qpole); let df7 = new beamRectElement(q5.GetExitPos(50), -90 * deg, 40, 40, color.Deflector); - let fan2 = new beamSpliter(b3.exitPos, 100, -100 * deg, color.Dipole); + let fan2 = new beamSpliter(d2.GetExitPos(1700), 100, -100 * deg, color.Dipole); let ResolutLine; { let frac = 0.7; - let b2a = new beamLine(fan2.GetExitPos(frac, 0), fan2.GetExitAng(frac), 500); b2a.offset = 8; let df2a_0 = new beamRectElement( fan2.GetExitPos(frac, 100), fan2.GetExitAng(frac), 30, 40, color.Deflector); let q2a = new beamRectElement(df2a_0.GetExitPos(30), fan2.GetExitAng(frac), 60, 60, color.Qpole); let df2a_1 = new beamRectElement( q2a.GetExitPos(30), fan2.GetExitAng(frac), 30, 40, color.Deflector); let df2a_2 = new beamRectElement( df2a_1.GetExitPos(30), fan2.GetExitAng(frac), 30, 40, color.Deflector); - let d3 = new beamDipole(b2a.GetExitPos(0), 80, 90* deg, -40 * deg, color.Dipole); - let b2a_1 = new beamLine( d3.GetExitPos(0), -95 * deg, 500); + let d3 = new beamDipole(fan2.GetExitPos(frac, 500), 80, 90* deg, -40 * deg, color.Dipole); + let b2a_1 = new beamLine( d3.GetExitPos(0), -95 * deg, 500); // dummy let Resolut = new detectorStation(b2a_1.GetExitPos(0), "Resolut"); - ResolutLine = {b2a, df2a_0, q2a, df2a_1, df2a_2, d3, b2a_1, Resolut}; + ResolutLine = {df2a_0, q2a, df2a_1, df2a_2, d3, Resolut}; } let AnasenLine; { let frac = 0.5; - let b2b = new beamLine(fan2.GetExitPos(frac, 0), fan2.GetExitAng(frac), 500); b2b.offset = 8; let q2b = new beamRectElement(fan2.GetExitPos(frac, 150), fan2.GetExitAng(frac), 60, 60, color.Qpole); let df2b = new beamRectElement( fan2.GetExitPos(frac, 240), fan2.GetExitAng(frac), 30, 40, color.Deflector); - let Anasen = new detectorStation(b2b.GetExitPos(0), "Anasen"); + let Anasen = new detectorStation(fan2.GetExitPos(frac, 500), "Anasen"); - AnasenLine = {b2b, q2b, df2b, Anasen}; + AnasenLine = {q2b, df2b, Anasen}; } let lowerLine; { let frac = 0.3; - let b2c = new beamLine(fan2.GetExitPos(frac, 0), fan2.GetExitAng(frac), 500); b2c.offset = 8; + //let b2c = new beamLine(fan2.GetExitPos(frac, 0), fan2.GetExitAng(frac), 500); b2c.offset = 8; let q2c = new beamRectElement(fan2.GetExitPos(frac, 100), fan2.GetExitAng(frac), 60, 60, color.Qpole); let df2c = new beamRectElement( fan2.GetExitPos(frac, 200), fan2.GetExitAng(frac), 30, 40, color.Deflector); - let fan2c = new beamSpliter(b2c.exitPos, 80, -130 * deg, color.Dipole); + let fan2c = new beamSpliter(fan2.GetExitPos(frac, 500), 80, -130 * deg, color.Dipole); let SplitPoleLine; { let frac = 0.7; - let b2c_1 = new beamLine(fan2c.GetExitPos(frac, 0), fan2c.GetExitAng(frac), 500); let q2c_1 = new beamRectElement(fan2c.GetExitPos(frac, 100), fan2c.GetExitAng(frac), 60, 60, color.Qpole); let df2c_1a = new beamRectElement( q2c_1.GetExitPos(30), fan2c.GetExitAng(frac), 30, 40, color.Deflector); let df2c_1b = new beamRectElement( df2c_1a.GetExitPos(30), fan2c.GetExitAng(frac), 30, 40, color.Deflector); - let SPS = new detectorStation(b2c_1.GetExitPos(0), "SPS"); + let SPS = new detectorStation(fan2c.GetExitPos(frac, 500), "SPS"); - SplitPoleLine = {b2c_1, q2c_1, df2c_1a, df2c_1b, SPS}; + SplitPoleLine = {q2c_1, df2c_1a, df2c_1b, SPS}; } let ClarionLine; { let frac = 0.4; - let b2c_2 = new beamLine(fan2c.GetExitPos(frac, 0), fan2c.GetExitAng(frac), 500); let q2c_2 = new beamRectElement(fan2c.GetExitPos(frac, 100), fan2c.GetExitAng(frac), 60, 60, color.Qpole); let df2c_2a = new beamRectElement( q2c_2.GetExitPos(30), fan2c.GetExitAng(frac), 30, 40, color.Deflector); let df2c_2b = new beamRectElement( df2c_2a.GetExitPos(30), fan2c.GetExitAng(frac), 30, 40, color.Deflector); - let Clarion2 = new detectorStation(b2c_2.GetExitPos(0), "Clarion2"); + let Clarion2 = new detectorStation(fan2c.GetExitPos(frac, 500), "Clarion2"); - ClarionLine = {b2c_2, q2c_2, df2c_2a, df2c_2b, Clarion2}; + ClarionLine = {q2c_2, df2c_2a, df2c_2b, Clarion2}; } - lowerLine = {b2c, q2c, df2c, fan2c, SplitPoleLine, ClarionLine}; + lowerLine = {q2c, df2c, fan2c, SplitPoleLine, ClarionLine}; } - targetRoom2 = {b2, q2, df2, q3, d2, b3, df3, q4, df4, + targetRoom2 = {q2, df2, q3, d2, df3, q4, df4, buncher, linac1, linac2, linac3, df5, df6, q5, df7, fan2, ResolutLine, AnasenLine, lowerLine}; } @@ -501,21 +496,67 @@ let posArray; // thsi is a collection of the position of beamlines targetRoom1.fan.GetExitPos(0.35,300) ]; - posArray = {Gamma, Catrina, Middle, Bottom}; + let Resolut = [ + sourceLine.RFSource1b.GetExitPos(0), + sourceLine.RFSource1b.GetExitPos(1500), + targetRoom2.d2.GetExitPos(0), + targetRoom2.d2.GetExitPos(1700), + targetRoom2.fan2.GetExitPos(0.7, 500), + targetRoom2.ResolutLine.d3.GetExitPos(0), + targetRoom2.ResolutLine.Resolut.entracePos + ] + + let Anasen = [ + sourceLine.RFSource1b.GetExitPos(0), + sourceLine.RFSource1b.GetExitPos(1500), + targetRoom2.d2.GetExitPos(0), + targetRoom2.d2.GetExitPos(1700), + targetRoom2.fan2.GetExitPos(0.5, 500) + ] + + let SPS = [ + sourceLine.RFSource1b.GetExitPos(0), + sourceLine.RFSource1b.GetExitPos(1500), + targetRoom2.d2.GetExitPos(0), + targetRoom2.d2.GetExitPos(1700), + targetRoom2.fan2.GetExitPos(0.3, 500), + targetRoom2.lowerLine.fan2c.GetExitPos(0.7,500) + ] + + let Clarion2 = [ + sourceLine.RFSource1b.GetExitPos(0), + sourceLine.RFSource1b.GetExitPos(1500), + targetRoom2.d2.GetExitPos(0), + targetRoom2.d2.GetExitPos(1700), + targetRoom2.fan2.GetExitPos(0.3, 500), + targetRoom2.lowerLine.fan2c.GetExitPos(0.4,500) + ] + + posArray = {Gamma, Catrina, Middle, Bottom, Resolut, Anasen, SPS, Clarion2}; } -let beamLineGamma = new multiBeamLine(posArray.Gamma); -let beamLineCatrina = new multiBeamLine(posArray.Catrina); -let beamLineMiddle = new multiBeamLine(posArray.Middle); -let beamLineBottom = new multiBeamLine(posArray.Bottom); +let beamLineHaHa; +{ + let Gamma = new multiBeamLine(posArray.Gamma); + let Catrina = new multiBeamLine(posArray.Catrina); + let Middle = new multiBeamLine(posArray.Middle); + let Bottom = new multiBeamLine(posArray.Bottom); + + let Resolut = new multiBeamLine(posArray.Resolut); + let Anasen = new multiBeamLine(posArray.Anasen); + let SPS = new multiBeamLine(posArray.SPS); + let Clarion2 = new multiBeamLine(posArray.Clarion2); + + beamLineHaHa = {Gamma, Catrina, Middle, Bottom, Resolut, Anasen, SPS, Clarion2}; +} -beamLineGamma.draw(false); -beamLineCatrina.draw(false); -beamLineMiddle.draw(false); -beamLineBottom.draw(false); //============================== Draw +for( const ele in beamLineHaHa){ + beamLineHaHa[ele].draw(false); +} + for( const ele in sourceLine){ sourceLine[ele].draw(true); } @@ -550,43 +591,25 @@ let destination = 'Gamma'; function EnableDetector(){ if( destination == 'Gamma' ) targetRoom1.upperLine.GammaStation.draw(true); if( destination == 'Catrina') targetRoom1.upperLine.Catrina.draw(true); + if( destination == 'Resolut') targetRoom2.ResolutLine.Resolut.draw(true); + if( destination == 'Anasen') targetRoom2.AnasenLine.Anasen.draw(true); + if( destination == 'SPS') targetRoom2.lowerLine.SplitPoleLine.SPS.draw(true); + if( destination == 'Clarion2') targetRoom2.lowerLine.ClarionLine.Clarion2.draw(true); + } function lineMotion(){ - if( destination == 'Gamma' ) beamLineGamma.march(); - if( destination == 'Catrina') beamLineCatrina.march(); - if( destination == 'Resolut'){ - targetRoom2.b2.march(); - targetRoom2.b3.march(); - targetRoom2.ResolutLine.b2a.march(); - targetRoom2.ResolutLine.b2a_1.march(); - targetRoom2.ResolutLine.Resolut.draw(true); - } - if( destination == 'Anasen'){ - targetRoom2.b2.march(); - targetRoom2.b3.march(); - targetRoom2.AnasenLine.b2b.march(); - targetRoom2.AnasenLine.Anasen.draw(true); - } - if( destination == 'SPS'){ - targetRoom2.b2.march(); - targetRoom2.b3.march(); - targetRoom2.lowerLine.b2c.march(); - targetRoom2.lowerLine.SplitPoleLine.b2c_1.march(); - targetRoom2.lowerLine.SplitPoleLine.SPS.draw(true); - } - if( destination == 'Clarion2'){ - targetRoom2.b2.march(); - targetRoom2.b3.march(); - targetRoom2.lowerLine.b2c.march(); - targetRoom2.lowerLine.ClarionLine.b2c_2.march(); - targetRoom2.lowerLine.ClarionLine.Clarion2.draw(true); - } + if( destination == 'Gamma' ) beamLineHaHa.Gamma.march(); + if( destination == 'Catrina') beamLineHaHa.Catrina.march(); + if( destination == 'Resolut') beamLineHaHa.Resolut.march(); + if( destination == 'Anasen') beamLineHaHa.Anasen.march(); + if( destination == 'SPS') beamLineHaHa.SPS.march(); + if( destination == 'Clarion2') beamLineHaHa.Clarion2.march(); setTimeout(lineMotion, 50); } -destination = 'Catrina'; +destination = 'Clarion2'; EnableDetector(); lineMotion();