1198{
1199
1200 if(m_turnOffField == true) {
1201 newb[0] = 0.;
1202 newb[1] = 0.;
1203 newb[2] = 0.;
1204#ifndef BEAN
1205 return StatusCode::SUCCESS;
1206#else
1207 return true;
1208#endif
1209 }
1210
1211
1212 if(m_uniField) {
1214#ifndef BEAN
1215 return StatusCode::SUCCESS;
1216#else
1217 return true;
1218#endif
1219 }
1220
1221
1222
1223 double new_x = -newr.x();
1224 double new_y = newr.y();
1225 double new_z = -newr.z();
1231
1232 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)
1233 {
1234 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)
1235
1236 {
1237 this->fieldGrid( r,
b );
1238 }
1239 else
1240 {
1241 this->fieldGrid_TE( r,
b );
1242 }
1243 }
1244 if((fabs(r.z())<=1970*mm && sqrt(r.x()*r.x()+r.y()*r.y()) >= 1740*mm) || (fabs(r.z())>=2050*mm))
1245 {
1248 int part = 0, layer = 0, mat = 0;
1249 double theta;
1250 bool ifbar = false;
1251 bool ifend = false;
1252 if(r.x()!=0.){
1253 theta = atan2(fabs(r.y()),fabs(r.x()));
1254 if(0<=theta&&theta<
pi/8) {
1255 mr[0] = fabs(r.x()); mr[1] = -fabs(r.y()); mr[2] = fabs(r.z());
1256 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm){
1257 part = 1;
1258 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1259 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1260 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1261 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1262 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1263 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1264 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1265 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1266 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1267 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1268 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1269 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1270 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1271 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1272 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1273 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1274 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1279 ifbar = true;
1280 }
1281 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1282 part = 0; layer = 0; mat = 0;
1287 ifend = true;
1288 }
1289 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1290 part = 0; layer = 0; mat = 1;
1295 ifend = true;
1296 }
1297 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1298 part = 0; layer = 1; mat = 0;
1303 ifend = true;
1304 }
1305 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1306 part = 0; layer = 1; mat = 1;
1311 ifend = true;
1312 }
1313 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1314 part = 0; layer = 2; mat = 0;
1319 ifend = true;
1320 }
1321 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1322 part = 0; layer = 2; mat = 1;
1327 ifend = true;
1328 }
1329 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1330 part = 0; layer = 3; mat = 0;
1335 ifend = true;
1336 }
1337 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1338 part = 0; layer = 3; mat = 1;
1343 ifend = true;
1344 }
1345 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1346 part = 0; layer = 4; mat = 0;
1351 ifend = true;
1352 }
1353 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1354 part = 0; layer = 4; mat = 1;
1359 ifend = true;
1360 }
1361 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1362 part = 0; layer = 5; mat = 0;
1367 ifend = true;
1368 }
1369 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1370 part = 0; layer = 5; mat =1;
1375 ifend = true;
1376 }
1377 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1378 part = 0; layer = 6; mat = 0;
1383 ifend = true;
1384 }
1385 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1386 part = 0; layer = 6; mat = 1;
1391 ifend = true;
1392 }
1393 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1394 part = 0; layer = 7; mat = 0;
1399 ifend = true;
1400 }
1401 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1402 part = 0; layer = 7; mat = 1;
1407 ifend = true;
1408 }
1409 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1410 part = 0; layer = 8; mat = 0;
1415 ifend = true;
1416 }
1417 }
1418 if(
pi/8<=theta&&theta<
pi/4) {
1419 mr[0] = fabs(r.x())*
cos(
pi/4)+fabs(r.y())*
sin(
pi/4);
1420 mr[1] = -fabs(r.x())*
sin(
pi/4)+fabs(r.y())*
cos(
pi/4);
1421 mr[2] = fabs(r.z());
1422 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm) {
1423 part = 1;
1424 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1425 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1426 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1427 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1428 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1429 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1430 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1431 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1432 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1433 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1434 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1435 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1436 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1437 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1438 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1439 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1440 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1445 ifbar = true;
1446 }
1447 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1448 part = 0; layer = 0; mat = 0;
1453 ifend = true;
1454 }
1455 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1456 part = 0; layer = 0; mat = 1;
1461 ifend = true;
1462 }
1463 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1464 part = 0; layer = 1; mat = 0;
1469 ifend = true;
1470 }
1471 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1472 part = 0; layer = 1; mat = 1;
1477 ifend = true;
1478 }
1479 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1480 part = 0; layer = 2; mat = 0;
1485 ifend = true;
1486 }
1487 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1488 part = 0; layer = 2; mat = 1;
1493 ifend = true;
1494 }
1495 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1496 part = 0; layer = 3; mat = 0;
1501 ifend = true;
1502 }
1503 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1504 part = 0; layer = 3; mat = 1;
1509 ifend = true;
1510 }
1511 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1512 part = 0; layer = 4; mat = 0;
1517 ifend = true;
1518 }
1519 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1520 part = 0; layer = 4; mat = 1;
1525 ifend = true;
1526 }
1527 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1528 part = 0; layer = 5; mat = 0;
1533 ifend = true;
1534 }
1535 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1536 part = 0; layer = 5; mat =1;
1541 ifend = true;
1542 }
1543 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1544 part = 0; layer = 6; mat = 0;
1549 ifend = true;
1550 }
1551 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1552 part = 0; layer = 6; mat = 1;
1557 ifend = true;
1558 }
1559 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1560 part = 0; layer = 7; mat = 0;
1565 ifend = true;
1566 }
1567 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1568 part = 0; layer = 7; mat = 1;
1573 ifend = true;
1574 }
1575 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1576 part = 0; layer = 8; mat = 0;
1581 ifend = true;
1582 }
1583 }
1584 if(
pi/4<=theta&&theta<3*
pi/8) {
1585 mr[0] = fabs(r.x())*
cos(
pi/4)+fabs(r.y())*
sin(
pi/4);
1586 mr[1] = fabs(r.x())*
sin(
pi/4)-fabs(r.y())*
cos(
pi/4);
1587 mr[2] = fabs(r.z());
1588 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm) {
1589 part = 1;
1590 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1591 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1592 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1593 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1594 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1595 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1596 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1597 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1598 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1599 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1600 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1601 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1602 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1603 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1604 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1605 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1606 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1611 ifbar = true;
1612 }
1613 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1614 part = 0; layer = 0; mat = 0;
1619 ifend = true;
1620 }
1621 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1622 part = 0; layer = 0; mat = 1;
1627 ifend = true;
1628 }
1629 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1630 part = 0; layer = 1; mat = 0;
1635 ifend = true;
1636 }
1637 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1638 part = 0; layer = 1; mat = 1;
1643 ifend = true;
1644 }
1645 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1646 part = 0; layer = 2; mat = 0;
1651 ifend = true;
1652 }
1653 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1654 part = 0; layer = 2; mat = 1;
1659 ifend = true;
1660 }
1661 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1662 part = 0; layer = 3; mat = 0;
1667 ifend = true;
1668 }
1669 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1670 part = 0; layer = 3; mat = 1;
1675 ifend = true;
1676 }
1677 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1678 part = 0; layer = 4; mat = 0;
1683 ifend = true;
1684 }
1685 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1686 part = 0; layer = 4; mat = 1;
1691 ifend = true;
1692 }
1693 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1694 part = 0; layer = 5; mat = 0;
1699 ifend = true;
1700 }
1701 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1702 part = 0; layer = 5; mat =1;
1707 ifend = true;
1708 }
1709 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1710 part = 0; layer = 6; mat = 0;
1715 ifend = true;
1716 }
1717 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1718 part = 0; layer = 6; mat = 1;
1723 ifend = true;
1724 }
1725 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1726 part = 0; layer = 7; mat = 0;
1731 ifend = true;
1732 }
1733 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1734 part = 0; layer = 7; mat = 1;
1739 ifend = true;
1740 }
1741 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1742 part = 0; layer = 8; mat = 0;
1747 ifend = true;
1748 }
1749 }
1750 if(3*
pi/8<=theta&&theta<
pi/2) {
1751 mr[0] = fabs(r.y()); mr[1] = -fabs(r.x()); mr[2] = fabs(r.z());
1752 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm) {
1753 part = 1;
1754 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1755 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1756 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1757 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1758 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1759 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1760 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1761 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1762 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1763 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1764 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1765 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1766 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1767 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1768 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1769 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1770 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1775 ifbar = true;
1776 }
1777 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1778 part = 0; layer = 0; mat = 0;
1783 ifend = true;
1784 }
1785 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1786 part = 0; layer = 0; mat = 1;
1791 ifend = true;
1792 }
1793 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1794 part = 0; layer = 1; mat = 0;
1799 ifend = true;
1800 }
1801 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1802 part = 0; layer = 1; mat = 1;
1807 ifend = true;
1808 }
1809 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1810 part = 0; layer = 2; mat = 0;
1815 ifend = true;
1816 }
1817 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1818 part = 0; layer = 2; mat = 1;
1823 ifend = true;
1824 }
1825 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1826 part = 0; layer = 3; mat = 0;
1831 ifend = true;
1832 }
1833 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1834 part = 0; layer = 3; mat = 1;
1839 ifend = true;
1840 }
1841 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1842 part = 0; layer = 4; mat = 0;
1847 ifend = true;
1848 }
1849 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1850 part = 0; layer = 4; mat = 1;
1855 ifend = true;
1856 }
1857 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
1858 part = 0; layer = 5; mat = 0;
1863 ifend = true;
1864 }
1865 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1866 part = 0; layer = 5; mat =1;
1871 ifend = true;
1872 }
1873 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
1874 part = 0; layer = 6; mat = 0;
1879 ifend = true;
1880 }
1881 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1882 part = 0; layer = 6; mat = 1;
1887 ifend = true;
1888 }
1889 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1890 part = 0; layer = 7; mat = 0;
1895 ifend = true;
1896 }
1897 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
1898 part = 0; layer = 7; mat = 1;
1903 ifend = true;
1904 }
1905 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
1906 part = 0; layer = 8; mat = 0;
1911 ifend = true;
1912 }
1913 }
1914 }
1915 if(r.x()==0.) {
1916 mr[0] = fabs(r.y()); mr[1] = -fabs(r.x()); mr[2] = fabs(r.z());
1917 if(mr[2]<=1970*mm&&1740*mm<=mr[0]&&mr[0]<=2620*mm) {
1918 part = 1;
1919 if(1740*mm<=mr[0]&&mr[0]<1770*mm) { layer = 0; mat = 0; }
1920 if(1770*mm<=mr[0]&&mr[0]<1810*mm) { layer = 0; mat = 1; }
1921 if(1810*mm<=mr[0]&&mr[0]<1840*mm) { layer = 1; mat = 0; }
1922 if(1840*mm<=mr[0]&&mr[0]<1880*mm) { layer = 1; mat = 1; }
1923 if(1880*mm<=mr[0]&&mr[0]<1910*mm) { layer = 2; mat = 0; }
1924 if(1910*mm<=mr[0]&&mr[0]<1950*mm) { layer = 2; mat = 1; }
1925 if(1950*mm<=mr[0]&&mr[0]<1990*mm) { layer = 3; mat = 0; }
1926 if(1990*mm<=mr[0]&&mr[0]<2030*mm) { layer = 3; mat = 1; }
1927 if(2030*mm<=mr[0]&&mr[0]<2070*mm) { layer = 4; mat = 0; }
1928 if(2070*mm<=mr[0]&&mr[0]<2110*mm) { layer = 4; mat = 1; }
1929 if(2110*mm<=mr[0]&&mr[0]<2190*mm) { layer = 5; mat = 0; }
1930 if(2190*mm<=mr[0]&&mr[0]<2230*mm) { layer = 5; mat = 1; }
1931 if(2230*mm<=mr[0]&&mr[0]<2310*mm) { layer = 6; mat = 0; }
1932 if(2310*mm<=mr[0]&&mr[0]<2350*mm) { layer = 6; mat = 1; }
1933 if(2350*mm<=mr[0]&&mr[0]<2430*mm) { layer = 7; mat = 0; }
1934 if(2430*mm<=mr[0]&&mr[0]<2470*mm) { layer = 7; mat = 1; }
1935 if(2470*mm<=mr[0]&&mr[0]<=2620*mm) { layer = 8; mat = 0; }
1940 ifbar = true;
1941 }
1942 if(2050*mm<=mr[2]&&mr[2]<2090*mm&&1034*mm<=mr[0]&&mr[0]<=2500*mm){
1943 part = 0; layer = 0; mat = 0;
1948 ifend = true;
1949 }
1950 if(2090*mm<=mr[2]&&mr[2]<2130*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1951 part = 0; layer = 0; mat = 1;
1956 ifend = true;
1957 }
1958 if(2130*mm<=mr[2]&&mr[2]<2170*mm&&1067*mm<=mr[0]&&mr[0]<=2500*mm) {
1959 part = 0; layer = 1; mat = 0;
1964 ifend = true;
1965 }
1966 if(2170*mm<=mr[2]&&mr[2]<2210*mm&&1100*mm<=mr[0]&&mr[0]<=2500*mm) {
1967 part = 0; layer = 1; mat = 1;
1972 ifend = true;
1973 }
1974 if(2210*mm<=mr[2]&&mr[2]<2240*mm&&1100*mm<mr[0]&&mr[0]<=2500*mm) {
1975 part = 0; layer = 2; mat = 0;
1980 ifend = true;
1981 }
1982 if(2240*mm<=mr[2]&&mr[2]<2280*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1983 part = 0; layer = 2; mat = 1;
1988 ifend = true;
1989 }
1990 if(2280*mm<=mr[2]&&mr[2]<2310*mm&&1133*mm<=mr[0]&&mr[0]<=2500*mm) {
1991 part = 0; layer = 3; mat = 0;
1996 ifend = true;
1997 }
1998 if(2310*mm<=mr[2]&&mr[2]<2350*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
1999 part = 0; layer = 3; mat = 1;
2004 ifend = true;
2005 }
2006 if(2350*mm<=mr[2]&&mr[2]<2380*mm&&1167*mm<=mr[0]&&mr[0]<=2500*mm) {
2007 part = 0; layer = 4; mat = 0;
2012 ifend = true;
2013 }
2014 if(2380*mm<=mr[2]&&mr[2]<2420*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
2015 part = 0; layer = 4; mat = 1;
2020 ifend = true;
2021 }
2022 if(2420*mm<=mr[2]&&mr[2]<2470*mm&&1203*mm<=mr[0]&&mr[0]<=2500*mm) {
2023 part = 0; layer = 5; mat = 0;
2028 ifend = true;
2029 }
2030 if(2470*mm<=mr[2]&&mr[2]<2510*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
2031 part = 0; layer = 5; mat =1;
2036 ifend = true;
2037 }
2038 if(2510*mm<=mr[2]&&mr[2]<2590*mm&&1241*mm<=mr[0]&&mr[0]<=2500*mm) {
2039 part = 0; layer = 6; mat = 0;
2044 ifend = true;
2045 }
2046 if(2590*mm<=mr[2]&&mr[2]<2630*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
2047 part = 0; layer = 6; mat = 1;
2052 ifend = true;
2053 }
2054 if(2630*mm<=mr[2]&&mr[2]<2710*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
2055 part = 0; layer = 7; mat = 0;
2060 ifend = true;
2061 }
2062 if(2710*mm<=mr[2]&&mr[2]<2750*mm&&1362*mm<=mr[0]&&mr[0]<=2500*mm) {
2063 part = 0; layer = 7; mat = 1;
2068 ifend = true;
2069 }
2070 if(2750*mm<=mr[2]&&mr[2]<=2800*mm&&1302*mm<=mr[0]&&mr[0]<=2500*mm) {
2071 part = 0; layer = 8; mat = 0;
2076 ifend = true;
2077 }
2078 }
2079 if(ifbar==true||ifend==true) {
2080 if( r.x() < 0. && r.y() >= 0. && r.z() > 0. ){
2082 }
2083 else if( r.x() <= 0. && r.y() < 0. && r.z() > 0. ){
2086 }
2087 else if( r.x() > 0. && r.y() < 0. && r.z() > 0. ){
2089 }
2090 else if( r.x() >= 0. && r.y() > 0. && r.z() < 0. ){
2093 }
2094 else if( r.x() < 0. && r.y() >= 0. && r.z() < 0. ){
2096 }
2097 else if( r.x() <= 0. && r.y() < 0. && r.z() < 0. ){
2100 }
2101 else if( r.x() > 0. && r.y() <= 0. && r.z() < 0. ){
2103 }
2104 }
2105 }
2106
2107
2108 newb[0] = -
b[0] * m_scale;
2109 newb[1] =
b[1] * m_scale;
2110 newb[2] = -
b[2] * m_scale;
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124#ifndef BEAN
2125 return StatusCode::SUCCESS;
2126#else
2127 return true;
2128#endif
2129}
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)