Skip to content
Snippets Groups Projects
Commit 1fda6daa authored by Adam Edward Barton's avatar Adam Edward Barton
Browse files

Merge branch 'AFP-add-octagon-aperture' into 'master'

Adding octagon aperture

See merge request atlas/athena!48407
parents 02474580 65534c37
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,7 @@ namespace FPTracker{
m_bender(bender),
m_label(label){
if (m_apertype == 1){ assert(m_aper_A1 != 0.);}
if (m_apertype == 2){ assert(m_aper_A3 != 0. and m_aper_A4 != 0.);}
if (m_apertype == 2 || m_apertype == 3){ assert(m_aper_A3 != 0. and m_aper_A4 != 0.);}
}
IBeamElement::ConstPtr_t Magnet::clone() const{
IBeamElement::ConstPtr_t pm(new Magnet(*this));
......@@ -175,8 +175,50 @@ namespace FPTracker{
return false;
}
if(m_apertype == 3)
{
double part_x = offCenter.x();
double part_y = offCenter.y();
if ( m_aper_A1 > 0. )
{
if( std::fabs(part_x)>m_aper_A1 )
{
std::ostringstream ost;
ost<<"outside for aperture type 3 x test: particle x "<<part_x<<" m_aper_A1 "<<m_aper_A1<<"\n";
particle.addMsg( ost.str() );
return true;
}
}
if ( m_aper_A2 > 0. )
{
if( std::fabs(part_y)>m_aper_A2)
{
std::ostringstream ost;
ost<<"outside for aperture type 3 y test: particle y "<<part_y<<" m_aper_A2 "<<m_aper_A2<<"\n";
particle.addMsg( ost.str() );
return true;
}
}
if ( m_aper_A3 > 0. && m_aper_A4 > 0. )
{
float B3=std::tan(m_aper_A3)*m_aper_A1;
float B4=m_aper_A2/std::tan(m_aper_A4);
float d=(m_aper_A1-std::fabs(part_x))/(m_aper_A1-B4)+(m_aper_A2-std::fabs(part_y))/(m_aper_A2-B3);
if(d<1.)
{
std::ostringstream ost;
ost<<"outside for aperture type 3 test: particle x "<<part_x<<" particle y "<<part_y<<"; m_aper_A1 "<<m_aper_A1<<" m_aper_A2 "<<m_aper_A2<<" m_aper_A3 "<<m_aper_A3<<" m_aper_A4 "<<m_aper_A4<<"\n";
particle.addMsg( ost.str() );
return true;
}
}
return false;
}
// aperture is checked anly if aperture type i s 1 or 2
// aperture is checked anly if aperture type i s 1, 2, or 3
return false;
}
......
......@@ -237,6 +237,10 @@ namespace FPTracker
{
mmagapertype =2;
}
else if(aperture == "\"OCTAGON\"")
{
mmagapertype =3;
}
else
{
std::stringstream sstr;
......
......@@ -112,6 +112,45 @@ namespace ForwardTracker {
return false;
}
else if (m_aperType == "\"OCTAGON\"") {
if ( m_A1 > 0. ) {
if( std::fabs(offCenter.x())>m_A1 ) {
std::ostringstream ost; ost << m_label << " isOutOfAperture ";
ost << " |x|: " << std::fabs(offCenter.x()) << " > A1: " << m_A1;
particle.addMsg(ost.str());
return true;
}
}
if ( m_A2 > 0. ) {
if( std::fabs(offCenter.y())>m_A2) {
std::ostringstream ost; ost << m_label << " isOutOfAperture ";
ost << " |y|: " << std::fabs(offCenter.y()) << " > A2: " << m_A2;
particle.addMsg(ost.str());
return true;
}
}
if ( m_A3 > 0. && m_A4 > 0. ) {
float B3=std::tan(m_A3)*m_A1;
float B4=m_A2/std::tan(m_A4);
float d=(m_A1-std::fabs(offCenter.x()))/(m_A1-B4)+(m_A2-std::fabs(offCenter.y()))/(m_A2-B3);
if(d<1.) {
std::ostringstream ost; ost << m_label << " isOutOfAperture ";
ost<<" x: "<<offCenter.x()<<" y: "<<offCenter.y()<<" m_A1 "<<m_A1<<" m_A2 "<<m_A2<<" m_A3 "<<m_A3<<" m_A4 "<<m_A4<<" d: "<<d;
particle.addMsg( ost.str() );
return true;
}
}
return false;
}
else {
std::stringstream sstr; sstr << " Unknown magnet aperture type " << m_aperType << "\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment