1199{
1200
1201 if(m_turnOffField == true) {
1202 newb[0] = 0.;
1203 newb[1] = 0.;
1204 newb[2] = 0.;
1205#ifndef BEAN
1206 return StatusCode::SUCCESS;
1207#else
1208 return true;
1209#endif
1210 }
1211
1212
1213 if(m_uniField) {
1215#ifndef BEAN
1216 return StatusCode::SUCCESS;
1217#else
1218 return true;
1219#endif
1220 }
1221
1222
1223
1224 double new_x = -newr.x();
1225 double new_y = newr.y();
1226 double new_z = -newr.z();
1232
1233 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)
1234 {
1235 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)
1236
1237 {
1238 this->fieldGrid( r,
b );
1239 }
1240 else
1241 {
1242 this->fieldGrid_TE( r,
b );
1243 }
1244 }
1245 if((fabs(r.z())<=1970*mm && sqrt(r.x()*r.x()+r.y()*r.y()) >= 1740*mm) || (fabs(r.z())>=2050*mm))
1246 {
1249 int part = 0, layer = 0, mat = 0;
1250 double theta;
1251 bool ifbar = false;
1252 bool ifend = false;
1253 if(r.x()!=0.){
1254 theta = atan2(fabs(r.y()),fabs(r.x()));
1255 if(0<=theta&&theta<
pi/8) {
1256 mr[0] = fabs(r.x()); mr[1] = -fabs(r.y()); mr[2] = fabs(r.z());
1257 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm){
1258 part = 1;
1259 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1260 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1261 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1262 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1263 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1264 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1265 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1266 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1267 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1268 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1269 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1270 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1271 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1272 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1273 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1274 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1275 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1280 ifbar = true;
1281 }
1282 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1283 part = 0; layer = 0; mat = 0;
1288 ifend = true;
1289 }
1290 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1291 part = 0; layer = 0; mat = 1;
1296 ifend = true;
1297 }
1298 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1299 part = 0; layer = 1; mat = 0;
1304 ifend = true;
1305 }
1306 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1307 part = 0; layer = 1; mat = 1;
1312 ifend = true;
1313 }
1314 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1315 part = 0; layer = 2; mat = 0;
1320 ifend = true;
1321 }
1322 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1323 part = 0; layer = 2; mat = 1;
1328 ifend = true;
1329 }
1330 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1331 part = 0; layer = 3; mat = 0;
1336 ifend = true;
1337 }
1338 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1339 part = 0; layer = 3; mat = 1;
1344 ifend = true;
1345 }
1346 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1347 part = 0; layer = 4; mat = 0;
1352 ifend = true;
1353 }
1354 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1355 part = 0; layer = 4; mat = 1;
1360 ifend = true;
1361 }
1362 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1363 part = 0; layer = 5; mat = 0;
1368 ifend = true;
1369 }
1370 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1371 part = 0; layer = 5; mat =1;
1376 ifend = true;
1377 }
1378 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1379 part = 0; layer = 6; mat = 0;
1384 ifend = true;
1385 }
1386 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1387 part = 0; layer = 6; mat = 1;
1392 ifend = true;
1393 }
1394 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1395 part = 0; layer = 7; mat = 0;
1400 ifend = true;
1401 }
1402 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1403 part = 0; layer = 7; mat = 1;
1408 ifend = true;
1409 }
1410 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1411 part = 0; layer = 8; mat = 0;
1416 ifend = true;
1417 }
1418 }
1419 if(
pi/8<=theta&&theta<
pi/4) {
1420 mr[0] = fabs(r.x())*
cos(
pi/4)+fabs(r.y())*
sin(
pi/4);
1421 mr[1] = -fabs(r.x())*
sin(
pi/4)+fabs(r.y())*
cos(
pi/4);
1422 mr[2] = fabs(r.z());
1423 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm) {
1424 part = 1;
1425 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1426 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1427 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1428 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1429 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1430 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1431 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1432 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1433 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1434 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1435 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1436 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1437 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1438 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1439 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1440 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1441 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1446 ifbar = true;
1447 }
1448 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1449 part = 0; layer = 0; mat = 0;
1454 ifend = true;
1455 }
1456 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1457 part = 0; layer = 0; mat = 1;
1462 ifend = true;
1463 }
1464 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1465 part = 0; layer = 1; mat = 0;
1470 ifend = true;
1471 }
1472 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1473 part = 0; layer = 1; mat = 1;
1478 ifend = true;
1479 }
1480 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1481 part = 0; layer = 2; mat = 0;
1486 ifend = true;
1487 }
1488 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1489 part = 0; layer = 2; mat = 1;
1494 ifend = true;
1495 }
1496 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1497 part = 0; layer = 3; mat = 0;
1502 ifend = true;
1503 }
1504 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1505 part = 0; layer = 3; mat = 1;
1510 ifend = true;
1511 }
1512 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1513 part = 0; layer = 4; mat = 0;
1518 ifend = true;
1519 }
1520 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1521 part = 0; layer = 4; mat = 1;
1526 ifend = true;
1527 }
1528 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1529 part = 0; layer = 5; mat = 0;
1534 ifend = true;
1535 }
1536 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1537 part = 0; layer = 5; mat =1;
1542 ifend = true;
1543 }
1544 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1545 part = 0; layer = 6; mat = 0;
1550 ifend = true;
1551 }
1552 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1553 part = 0; layer = 6; mat = 1;
1558 ifend = true;
1559 }
1560 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1561 part = 0; layer = 7; mat = 0;
1566 ifend = true;
1567 }
1568 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1569 part = 0; layer = 7; mat = 1;
1574 ifend = true;
1575 }
1576 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1577 part = 0; layer = 8; mat = 0;
1582 ifend = true;
1583 }
1584 }
1585 if(
pi/4<=theta&&theta<3*
pi/8) {
1586 mr[0] = fabs(r.x())*
cos(
pi/4)+fabs(r.y())*
sin(
pi/4);
1587 mr[1] = fabs(r.x())*
sin(
pi/4)-fabs(r.y())*
cos(
pi/4);
1588 mr[2] = fabs(r.z());
1589 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm) {
1590 part = 1;
1591 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1592 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1593 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1594 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1595 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1596 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1597 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1598 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1599 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1600 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1601 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1602 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1603 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1604 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1605 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1606 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1607 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1612 ifbar = true;
1613 }
1614 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1615 part = 0; layer = 0; mat = 0;
1620 ifend = true;
1621 }
1622 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1623 part = 0; layer = 0; mat = 1;
1628 ifend = true;
1629 }
1630 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1631 part = 0; layer = 1; mat = 0;
1636 ifend = true;
1637 }
1638 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1639 part = 0; layer = 1; mat = 1;
1644 ifend = true;
1645 }
1646 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1647 part = 0; layer = 2; mat = 0;
1652 ifend = true;
1653 }
1654 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1655 part = 0; layer = 2; mat = 1;
1660 ifend = true;
1661 }
1662 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1663 part = 0; layer = 3; mat = 0;
1668 ifend = true;
1669 }
1670 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1671 part = 0; layer = 3; mat = 1;
1676 ifend = true;
1677 }
1678 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1679 part = 0; layer = 4; mat = 0;
1684 ifend = true;
1685 }
1686 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1687 part = 0; layer = 4; mat = 1;
1692 ifend = true;
1693 }
1694 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1695 part = 0; layer = 5; mat = 0;
1700 ifend = true;
1701 }
1702 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1703 part = 0; layer = 5; mat =1;
1708 ifend = true;
1709 }
1710 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1711 part = 0; layer = 6; mat = 0;
1716 ifend = true;
1717 }
1718 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1719 part = 0; layer = 6; mat = 1;
1724 ifend = true;
1725 }
1726 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1727 part = 0; layer = 7; mat = 0;
1732 ifend = true;
1733 }
1734 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1735 part = 0; layer = 7; mat = 1;
1740 ifend = true;
1741 }
1742 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1743 part = 0; layer = 8; mat = 0;
1748 ifend = true;
1749 }
1750 }
1751 if(3*
pi/8<=theta&&theta<
pi/2) {
1752 mr[0] = fabs(r.y()); mr[1] = -fabs(r.x()); mr[2] = fabs(r.z());
1753 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm) {
1754 part = 1;
1755 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1756 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1757 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1758 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1759 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1760 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1761 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1762 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1763 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1764 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1765 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1766 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1767 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1768 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1769 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1770 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1771 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1776 ifbar = true;
1777 }
1778 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1779 part = 0; layer = 0; mat = 0;
1784 ifend = true;
1785 }
1786 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1787 part = 0; layer = 0; mat = 1;
1792 ifend = true;
1793 }
1794 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1795 part = 0; layer = 1; mat = 0;
1800 ifend = true;
1801 }
1802 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1803 part = 0; layer = 1; mat = 1;
1808 ifend = true;
1809 }
1810 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1811 part = 0; layer = 2; mat = 0;
1816 ifend = true;
1817 }
1818 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1819 part = 0; layer = 2; mat = 1;
1824 ifend = true;
1825 }
1826 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1827 part = 0; layer = 3; mat = 0;
1832 ifend = true;
1833 }
1834 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1835 part = 0; layer = 3; mat = 1;
1840 ifend = true;
1841 }
1842 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1843 part = 0; layer = 4; mat = 0;
1848 ifend = true;
1849 }
1850 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1851 part = 0; layer = 4; mat = 1;
1856 ifend = true;
1857 }
1858 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1859 part = 0; layer = 5; mat = 0;
1864 ifend = true;
1865 }
1866 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1867 part = 0; layer = 5; mat =1;
1872 ifend = true;
1873 }
1874 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1875 part = 0; layer = 6; mat = 0;
1880 ifend = true;
1881 }
1882 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1883 part = 0; layer = 6; mat = 1;
1888 ifend = true;
1889 }
1890 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1891 part = 0; layer = 7; mat = 0;
1896 ifend = true;
1897 }
1898 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1899 part = 0; layer = 7; mat = 1;
1904 ifend = true;
1905 }
1906 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1907 part = 0; layer = 8; mat = 0;
1912 ifend = true;
1913 }
1914 }
1915 }
1916 if(r.x()==0.) {
1917 mr[0] = fabs(r.y()); mr[1] = -fabs(r.x()); mr[2] = fabs(r.z());
1918 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm) {
1919 part = 1;
1920 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1921 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1922 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1923 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1924 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1925 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1926 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1927 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1928 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1929 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1930 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1931 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1932 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1933 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1934 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1935 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1936 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1941 ifbar = true;
1942 }
1943 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1944 part = 0; layer = 0; mat = 0;
1949 ifend = true;
1950 }
1951 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1952 part = 0; layer = 0; mat = 1;
1957 ifend = true;
1958 }
1959 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1960 part = 0; layer = 1; mat = 0;
1965 ifend = true;
1966 }
1967 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1968 part = 0; layer = 1; mat = 1;
1973 ifend = true;
1974 }
1975 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1976 part = 0; layer = 2; mat = 0;
1981 ifend = true;
1982 }
1983 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1984 part = 0; layer = 2; mat = 1;
1989 ifend = true;
1990 }
1991 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1992 part = 0; layer = 3; mat = 0;
1997 ifend = true;
1998 }
1999 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
2000 part = 0; layer = 3; mat = 1;
2005 ifend = true;
2006 }
2007 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
2008 part = 0; layer = 4; mat = 0;
2013 ifend = true;
2014 }
2015 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
2016 part = 0; layer = 4; mat = 1;
2021 ifend = true;
2022 }
2023 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
2024 part = 0; layer = 5; mat = 0;
2029 ifend = true;
2030 }
2031 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
2032 part = 0; layer = 5; mat =1;
2037 ifend = true;
2038 }
2039 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
2040 part = 0; layer = 6; mat = 0;
2045 ifend = true;
2046 }
2047 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
2048 part = 0; layer = 6; mat = 1;
2053 ifend = true;
2054 }
2055 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
2056 part = 0; layer = 7; mat = 0;
2061 ifend = true;
2062 }
2063 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
2064 part = 0; layer = 7; mat = 1;
2069 ifend = true;
2070 }
2071 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
2072 part = 0; layer = 8; mat = 0;
2077 ifend = true;
2078 }
2079 }
2080 if(ifbar==true||ifend==true) {
2081 if( r.x() < 0. && r.y() >= 0. && r.z() > 0. ){
2083 }
2084 else if( r.x() <= 0. && r.y() < 0. && r.z() > 0. ){
2087 }
2088 else if( r.x() > 0. && r.y() < 0. && r.z() > 0. ){
2090 }
2091 else if( r.x() >= 0. && r.y() > 0. && r.z() < 0. ){
2094 }
2095 else if( r.x() < 0. && r.y() >= 0. && r.z() < 0. ){
2097 }
2098 else if( r.x() <= 0. && r.y() < 0. && r.z() < 0. ){
2101 }
2102 else if( r.x() > 0. && r.y() <= 0. && r.z() < 0. ){
2104 }
2105 }
2106 }
2107
2108
2109 newb[0] = -
b[0] * m_scale;
2110 newb[1] =
b[1] * m_scale;
2111 newb[2] = -
b[2] * m_scale;
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125#ifndef BEAN
2126 return StatusCode::SUCCESS;
2127#else
2128 return true;
2129#endif
2130}
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)