1081{
1082
1083 if(m_turnOffField == true) {
1084 newb[0] = 0.;
1085 newb[1] = 0.;
1086 newb[2] = 0.;
1087#ifndef BEAN
1088 return StatusCode::SUCCESS;
1089#else
1090 return true;
1091#endif
1092 }
1093
1094
1095 if(m_uniField) {
1097#ifndef BEAN
1098 return StatusCode::SUCCESS;
1099#else
1100 return true;
1101#endif
1102 }
1103
1104
1105
1106 double new_x = -newr.x();
1107 double new_y = newr.y();
1108 double new_z = -newr.z();
1114
1115 if(-2.1*m<r.z() && r.z()<2.1*m && -1.8*m<r.x() && r.x()<1.8*m && -1.8*m<r.y() && r.y()<1.8*m)
1116 {
1117 if(-1.2*m<r.z()&&r.z()<1.2*m&&0*m<=std::sqrt(r.x()*r.x()+r.y()*r.y())&&std::sqrt(r.x()*r.x()+r.y()*r.y())<0.9*m)
1118
1119 {
1120 this->fieldGrid( r,
b );
1121 }
1122 else
1123 {
1124 this->fieldGrid_TE( r,
b );
1125 }
1126 }
1127 if((fabs(r.z())<=1970*mm && sqrt(r.x()*r.x()+r.y()*r.y()) >= 1740*mm) || (fabs(r.z())>=2050*mm))
1128 {
1131 int part = 0, layer = 0, mat = 0;
1132 double theta;
1133 bool ifbar = false;
1134 bool ifend = false;
1135 if(r.x()!=0.){
1136 theta = atan2(fabs(r.y()),fabs(r.x()));
1137 if(0<=theta&&theta<
pi/8) {
1138 mr[0] = fabs(r.x()); mr[1] = -fabs(r.y()); mr[2] = fabs(r.z());
1139 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm){
1140 part = 1;
1141 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1142 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1143 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1144 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1145 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1146 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1147 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1148 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1149 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1150 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1151 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1152 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1153 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1154 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1155 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1156 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1157 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1162 ifbar = true;
1163 }
1164 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1165 part = 0; layer = 0; mat = 0;
1170 ifend = true;
1171 }
1172 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1173 part = 0; layer = 0; mat = 1;
1178 ifend = true;
1179 }
1180 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1181 part = 0; layer = 1; mat = 0;
1186 ifend = true;
1187 }
1188 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1189 part = 0; layer = 1; mat = 1;
1194 ifend = true;
1195 }
1196 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1197 part = 0; layer = 2; mat = 0;
1202 ifend = true;
1203 }
1204 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1205 part = 0; layer = 2; mat = 1;
1210 ifend = true;
1211 }
1212 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1213 part = 0; layer = 3; mat = 0;
1218 ifend = true;
1219 }
1220 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1221 part = 0; layer = 3; mat = 1;
1226 ifend = true;
1227 }
1228 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1229 part = 0; layer = 4; mat = 0;
1234 ifend = true;
1235 }
1236 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1237 part = 0; layer = 4; mat = 1;
1242 ifend = true;
1243 }
1244 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1245 part = 0; layer = 5; mat = 0;
1250 ifend = true;
1251 }
1252 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1253 part = 0; layer = 5; mat =1;
1258 ifend = true;
1259 }
1260 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1261 part = 0; layer = 6; mat = 0;
1266 ifend = true;
1267 }
1268 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1269 part = 0; layer = 6; mat = 1;
1274 ifend = true;
1275 }
1276 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1277 part = 0; layer = 7; mat = 0;
1282 ifend = true;
1283 }
1284 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1285 part = 0; layer = 7; mat = 1;
1290 ifend = true;
1291 }
1292 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1293 part = 0; layer = 8; mat = 0;
1298 ifend = true;
1299 }
1300 }
1301 if(
pi/8<=theta&&theta<
pi/4) {
1302 mr[0] = fabs(r.x())*
cos(
pi/4)+fabs(r.y())*
sin(
pi/4);
1303 mr[1] = -fabs(r.x())*
sin(
pi/4)+fabs(r.y())*
cos(
pi/4);
1304 mr[2] = fabs(r.z());
1305 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm) {
1306 part = 1;
1307 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1308 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1309 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1310 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1311 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1312 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1313 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1314 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1315 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1316 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1317 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1318 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1319 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1320 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1321 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1322 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1323 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1328 ifbar = true;
1329 }
1330 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1331 part = 0; layer = 0; mat = 0;
1336 ifend = true;
1337 }
1338 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1339 part = 0; layer = 0; mat = 1;
1344 ifend = true;
1345 }
1346 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1347 part = 0; layer = 1; mat = 0;
1352 ifend = true;
1353 }
1354 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1355 part = 0; layer = 1; mat = 1;
1360 ifend = true;
1361 }
1362 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1363 part = 0; layer = 2; mat = 0;
1368 ifend = true;
1369 }
1370 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1371 part = 0; layer = 2; mat = 1;
1376 ifend = true;
1377 }
1378 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1379 part = 0; layer = 3; mat = 0;
1384 ifend = true;
1385 }
1386 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1387 part = 0; layer = 3; mat = 1;
1392 ifend = true;
1393 }
1394 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1395 part = 0; layer = 4; mat = 0;
1400 ifend = true;
1401 }
1402 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1403 part = 0; layer = 4; mat = 1;
1408 ifend = true;
1409 }
1410 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1411 part = 0; layer = 5; mat = 0;
1416 ifend = true;
1417 }
1418 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1419 part = 0; layer = 5; mat =1;
1424 ifend = true;
1425 }
1426 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1427 part = 0; layer = 6; mat = 0;
1432 ifend = true;
1433 }
1434 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1435 part = 0; layer = 6; mat = 1;
1440 ifend = true;
1441 }
1442 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1443 part = 0; layer = 7; mat = 0;
1448 ifend = true;
1449 }
1450 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1451 part = 0; layer = 7; mat = 1;
1456 ifend = true;
1457 }
1458 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1459 part = 0; layer = 8; mat = 0;
1464 ifend = true;
1465 }
1466 }
1467 if(
pi/4<=theta&&theta<3*
pi/8) {
1468 mr[0] = fabs(r.x())*
cos(
pi/4)+fabs(r.y())*
sin(
pi/4);
1469 mr[1] = fabs(r.x())*
sin(
pi/4)-fabs(r.y())*
cos(
pi/4);
1470 mr[2] = fabs(r.z());
1471 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm) {
1472 part = 1;
1473 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1474 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1475 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1476 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1477 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1478 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1479 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1480 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1481 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1482 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1483 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1484 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1485 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1486 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1487 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1488 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1489 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1494 ifbar = true;
1495 }
1496 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1497 part = 0; layer = 0; mat = 0;
1502 ifend = true;
1503 }
1504 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1505 part = 0; layer = 0; mat = 1;
1510 ifend = true;
1511 }
1512 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1513 part = 0; layer = 1; mat = 0;
1518 ifend = true;
1519 }
1520 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1521 part = 0; layer = 1; mat = 1;
1526 ifend = true;
1527 }
1528 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1529 part = 0; layer = 2; mat = 0;
1534 ifend = true;
1535 }
1536 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1537 part = 0; layer = 2; mat = 1;
1542 ifend = true;
1543 }
1544 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1545 part = 0; layer = 3; mat = 0;
1550 ifend = true;
1551 }
1552 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1553 part = 0; layer = 3; mat = 1;
1558 ifend = true;
1559 }
1560 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1561 part = 0; layer = 4; mat = 0;
1566 ifend = true;
1567 }
1568 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1569 part = 0; layer = 4; mat = 1;
1574 ifend = true;
1575 }
1576 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1577 part = 0; layer = 5; mat = 0;
1582 ifend = true;
1583 }
1584 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1585 part = 0; layer = 5; mat =1;
1590 ifend = true;
1591 }
1592 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1593 part = 0; layer = 6; mat = 0;
1598 ifend = true;
1599 }
1600 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1601 part = 0; layer = 6; mat = 1;
1606 ifend = true;
1607 }
1608 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1609 part = 0; layer = 7; mat = 0;
1614 ifend = true;
1615 }
1616 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1617 part = 0; layer = 7; mat = 1;
1622 ifend = true;
1623 }
1624 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1625 part = 0; layer = 8; mat = 0;
1630 ifend = true;
1631 }
1632 }
1633 if(3*
pi/8<=theta&&theta<
pi/2) {
1634 mr[0] = fabs(r.y()); mr[1] = -fabs(r.x()); mr[2] = fabs(r.z());
1635 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm) {
1636 part = 1;
1637 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1638 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1639 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1640 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1641 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1642 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1643 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1644 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1645 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1646 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1647 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1648 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1649 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1650 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1651 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1652 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1653 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1658 ifbar = true;
1659 }
1660 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1661 part = 0; layer = 0; mat = 0;
1666 ifend = true;
1667 }
1668 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1669 part = 0; layer = 0; mat = 1;
1674 ifend = true;
1675 }
1676 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1677 part = 0; layer = 1; mat = 0;
1682 ifend = true;
1683 }
1684 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1685 part = 0; layer = 1; mat = 1;
1690 ifend = true;
1691 }
1692 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1693 part = 0; layer = 2; mat = 0;
1698 ifend = true;
1699 }
1700 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1701 part = 0; layer = 2; mat = 1;
1706 ifend = true;
1707 }
1708 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1709 part = 0; layer = 3; mat = 0;
1714 ifend = true;
1715 }
1716 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1717 part = 0; layer = 3; mat = 1;
1722 ifend = true;
1723 }
1724 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1725 part = 0; layer = 4; mat = 0;
1730 ifend = true;
1731 }
1732 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1733 part = 0; layer = 4; mat = 1;
1738 ifend = true;
1739 }
1740 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1741 part = 0; layer = 5; mat = 0;
1746 ifend = true;
1747 }
1748 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1749 part = 0; layer = 5; mat =1;
1754 ifend = true;
1755 }
1756 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1757 part = 0; layer = 6; mat = 0;
1762 ifend = true;
1763 }
1764 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1765 part = 0; layer = 6; mat = 1;
1770 ifend = true;
1771 }
1772 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1773 part = 0; layer = 7; mat = 0;
1778 ifend = true;
1779 }
1780 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1781 part = 0; layer = 7; mat = 1;
1786 ifend = true;
1787 }
1788 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1789 part = 0; layer = 8; mat = 0;
1794 ifend = true;
1795 }
1796 }
1797 }
1798 if(r.x()==0.) {
1799 mr[0] = fabs(r.y()); mr[1] = -fabs(r.x()); mr[2] = fabs(r.z());
1800 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm) {
1801 part = 1;
1802 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1803 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1804 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1805 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1806 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1807 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1808 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1809 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1810 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1811 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1812 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1813 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1814 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1815 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1816 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1817 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1818 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1823 ifbar = true;
1824 }
1825 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1826 part = 0; layer = 0; mat = 0;
1831 ifend = true;
1832 }
1833 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1834 part = 0; layer = 0; mat = 1;
1839 ifend = true;
1840 }
1841 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1842 part = 0; layer = 1; mat = 0;
1847 ifend = true;
1848 }
1849 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1850 part = 0; layer = 1; mat = 1;
1855 ifend = true;
1856 }
1857 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1858 part = 0; layer = 2; mat = 0;
1863 ifend = true;
1864 }
1865 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1866 part = 0; layer = 2; mat = 1;
1871 ifend = true;
1872 }
1873 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1874 part = 0; layer = 3; mat = 0;
1879 ifend = true;
1880 }
1881 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1882 part = 0; layer = 3; mat = 1;
1887 ifend = true;
1888 }
1889 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1890 part = 0; layer = 4; mat = 0;
1895 ifend = true;
1896 }
1897 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1898 part = 0; layer = 4; mat = 1;
1903 ifend = true;
1904 }
1905 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1906 part = 0; layer = 5; mat = 0;
1911 ifend = true;
1912 }
1913 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1914 part = 0; layer = 5; mat =1;
1919 ifend = true;
1920 }
1921 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1922 part = 0; layer = 6; mat = 0;
1927 ifend = true;
1928 }
1929 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1930 part = 0; layer = 6; mat = 1;
1935 ifend = true;
1936 }
1937 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1938 part = 0; layer = 7; mat = 0;
1943 ifend = true;
1944 }
1945 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1946 part = 0; layer = 7; mat = 1;
1951 ifend = true;
1952 }
1953 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1954 part = 0; layer = 8; mat = 0;
1959 ifend = true;
1960 }
1961 }
1962 if(ifbar==true||ifend==true) {
1963 if( r.x() < 0. && r.y() >= 0. && r.z() > 0. ){
1965 }
1966 else if( r.x() <= 0. && r.y() < 0. && r.z() > 0. ){
1969 }
1970 else if( r.x() > 0. && r.y() < 0. && r.z() > 0. ){
1972 }
1973 else if( r.x() >= 0. && r.y() > 0. && r.z() < 0. ){
1976 }
1977 else if( r.x() < 0. && r.y() >= 0. && r.z() < 0. ){
1979 }
1980 else if( r.x() <= 0. && r.y() < 0. && r.z() < 0. ){
1983 }
1984 else if( r.x() > 0. && r.y() <= 0. && r.z() < 0. ){
1986 }
1987 }
1988 }
1989
1990
1991 newb[0] = -
b[0] * m_scale;
1992 newb[1] =
b[1] * m_scale;
1993 newb[2] = -
b[2] * m_scale;
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007#ifndef BEAN
2008 return StatusCode::SUCCESS;
2009#else
2010 return true;
2011#endif
2012}
double sin(const BesAngle a)
double cos(const BesAngle a)
virtual StatusCode uniFieldVector(const HepPoint3D &xyz, HepVector3D &fvec) const
void getMucField(int part, int layer, int mat, HepPoint3D &r, HepVector3D &b)