/* ---- Hector the simulator ---- A fast simulator of particles through generic beamlines. J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be http://www.fynu.ucl.ac.be/hector.html Centre de Physique des Particules et de Phénoménologie (CP3) Université Catholique de Louvain (UCL) */ /// \file H_RectEllipticAperture.cc /// \brief Defines the Rect-Elliptic aperture of beamline elements. // C++ #includes #include // C #includes #include // needed for fabs // ROOT #includes #include "TPolyLine.h" // local #includes #include "H_RectEllipticAperture.h" using namespace std; H_RectEllipticAperture::H_RectEllipticAperture(const float l, const float h, const float L, const float H, const float posx, const float posy) :H_Aperture(RECTELLIPSE,((l==0)?L:l),((h==0)?H:h),L,H,posx,posy) { /// @param l, h, L, H are the geometrical parameters of the rect-ellipse shape /// @param posx, posy defines the (x,y) of the center of the shape type= RECTELLIPSE; } H_RectEllipticAperture* H_RectEllipticAperture::clone() const { return new H_RectEllipticAperture(x1,x2,x3,x4,fx,fy); } TPolyLine * rectellipse(const float a_e = 2, const float b_e = 1, const float a_r = 1, const float b_r = 2, const float center_x = 0, const float center_y =0) { const int n = 20; // number of points per segment const int N = 4*n; // there are 4 segments float x[N+1], y[N+1]; if(a_e>a_r) { // a rectellipse has 4 segments // 1) upper one for (int i=0; iSetLineColor(39); re->SetLineWidth(2); re->Draw("l"); return; } bool H_RectEllipticAperture::isInside(const float x, const float y) const { return((fabs(fx-x)