24 if ( (
side ==
beam2) && (
ip == 1) ) {
return 26658.88320;}
25 if ( (
side ==
beam2) && (
ip == 5) ) {
return 13329.593967;}
27 if ( (
side ==
beam1) && (
ip == 5) ) {
return 13329.289233;}
35 if ( (
side ==
beam2) && (
ip == 1) ) {
return 13329.28923;}
36 if ( (
side ==
beam2) && (
ip == 5) ) {
return 13329.59397;}
37 if ( (
side ==
beam1) && (
ip == 1) ) {
return 13329.59397;}
38 if ( (
side ==
beam1) && (
ip == 5) ) {
return 13329.28923;}
45 if ( (
side ==
beam2) && (
ip == 5) ) {
return 13329.593967;}
47 if ( (
side ==
beam1) && (
ip == 5) ) {
return 13329.289233;}
71 const int& IP = cData.
IP;
72 const double& apermb = cData.
apermb;
73 const double& brho = cData.
brho;
80 std::ifstream& myMags = *magfile;
85 while (myMags.peek() ==
'@' || myMags.peek() ==
'*' || myMags.peek() ==
'$')
87 myMags.ignore(1000,
'\n');
96 double endpos=0, maglength=0, K0L=0, K1L=0, K2L=0, K3L=0, HKICK=0, VKICK=0;
97 float BETX=0,ALFX=0,MUX=0,DX=0,DPX=0,
X=0,PX=0,BETY=0,ALFY=0,MUY=0,DY=0,DPY=0,
Y=0,PY=0,A1=0,A2=0,A3=0,A4=0;
99 std::string magname,magsort, basicmag ;
101 std::string aperture;
105 myMags>>magname>>magsort>>endpos>>maglength>>K0L>>K1L>>K2L>>K3L>>HKICK>>VKICK
106 >>BETX>>ALFX>>MUX>>DX>>DPX>>
X>>PX>>BETY>>ALFY>>MUY>>DY>>DPY>>
Y>>PY
107 >>aperture>>A1>>A2>>A3>>A4;
109 else if( magver==2 or magver==3 )
111 myMags>>magname>>magsort>>basicmag>>endpos>>maglength>>HKICK>>VKICK>>K0L
112 >>K1L>>K2L>>K3L>>
X>>
Y>>PX>>PY>>BETX>>BETY>>ALFX>>ALFY
113 >>MUX>>MUY>>DX>>DY>>DPX>>DPY>>aperture>>A1>>A2>>A3>>A4;
122 if(std::fabs(K0L)==0.000188) K0L=K0L*188.175/188.0 ;
123 if(std::fabs(K0L)==0.001129) K0L=K0L*1129.049/1129. ;
124 if(std::fabs(K1L)==0.055577) K0L=K0L*55576.561/55577. ;
125 if(std::fabs(K1L)==0.047986) K0L=K0L*47986.041/47986. ;
126 if(std::fabs(VKICK)==0.00020) VKICK=VKICK*20.171/20. ;
127 if(std::fabs(VKICK)==0.00019) VKICK=VKICK*19.17/19. ;
130 double dist = centreIP - endpos + 0.5*maglength ;
132 float adist=std::fabs(dist) ;
137 if ( magver == 1 or magver == 2 )
141 if( dist > 0. ) {
continue;}
142 if( adist > absZMagMax ) {
break;}
146 if( adist > absZMagMax ) {
continue;}
147 if ( dist <= 0. ) {
break;}
150 else if( magver == 3 )
152 if( dist > 0. ) {
continue;}
153 if( adist > absZMagMax ) {
break;}
157 double magstrength = 0;
164 magstrength = -magstrength;
172 assert(maglength > 0.);
173 magstrength = std::fabs(brho*magstrength/maglength);
178 magstrength = -HKICK;
189 double mmagcen = -dist;
200 int mmagapertype = 0;
202 if(aperture ==
"\"NONE\"")
206 else if(aperture ==
"\"CIRCLE\"" && A1 == 0.)
210 else if(aperture ==
"\"CIRCLE\"" && A1 > 0.)
214 else if(aperture ==
"\"RECTELLIPSE\"")
218 else if(aperture ==
"\"OCTAGON\"")
224 throw std::runtime_error(
" Unknown magnet aperture type "+aperture+
"\n");
230 int pos = magname.find(
"MB.");
233 A3=apermb; A4=apermb;
258 magnets.push_back(std::move(mptr));
260 std::sort(magnets.begin(), magnets.end(), absZGreater< Magnet::ConstPtr_t >);