[3c40083] | 1 | /*
|
---|
| 2 | ---- Hector the simulator ----
|
---|
| 3 | A fast simulator of particles through generic beamlines.
|
---|
| 4 | J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
|
---|
| 5 |
|
---|
| 6 | http://www.fynu.ucl.ac.be/hector.html
|
---|
| 7 |
|
---|
| 8 | Centre de Physique des Particules et de Phénoménologie (CP3)
|
---|
| 9 | Université Catholique de Louvain (UCL)
|
---|
| 10 | */
|
---|
[5b822e5] | 11 |
|
---|
| 12 | /// \file H_EllipticAperture.cc
|
---|
| 13 | /// \brief Defines the elliptic aperture of beamline elements.
|
---|
| 14 |
|
---|
| 15 | // C++ #includes
|
---|
| 16 | #include <iostream>
|
---|
| 17 |
|
---|
| 18 | // ROOT #includes
|
---|
[3c40083] | 19 | //#include "TEllipse.h"
|
---|
[5b822e5] | 20 |
|
---|
| 21 | // local #includes
|
---|
| 22 | #include "H_Parameters.h"
|
---|
| 23 | #include "H_Aperture.h"
|
---|
| 24 | #include "H_EllipticAperture.h"
|
---|
| 25 | using namespace std;
|
---|
| 26 |
|
---|
[3c40083] | 27 | H_EllipticAperture::H_EllipticAperture(const float x1, const float x2, const float posx, const float posy) :H_Aperture(ELLIPTIC,x1,x2,0,0,posx,posy) {
|
---|
| 28 | /// @param x1, x2 are the length and height of the elliptic shape
|
---|
[5b822e5] | 29 | /// @param posx, posy are the (x,y) coordinates of the center of the ellipse
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | bool H_EllipticAperture::isInside(const float x, const float y) const {
|
---|
| 33 | /// @param x, y are the (x,y) coordinates of the proton
|
---|
| 34 | return (((x-fx)/x1)*((x-fx)/x1) + ((y-fy)/x2)*((y-fy)/x2) < 1);
|
---|
| 35 | }
|
---|
| 36 |
|
---|
[3c40083] | 37 | void H_EllipticAperture::draw() const {
|
---|
| 38 | /* Ellipse* te = new TEllipse(fx,fy,x1,x2);
|
---|
[5b822e5] | 39 | te->SetFillStyle(3003);
|
---|
[3c40083] | 40 | te->SetLineColor(2);
|
---|
| 41 | te->SetFillColor(2);
|
---|
| 42 | te->Draw();
|
---|
[5b822e5] | 43 | return;
|
---|
[3c40083] | 44 | */
|
---|
[5b822e5] | 45 | }
|
---|
| 46 |
|
---|
[3c40083] | 47 | void H_EllipticAperture::printProperties() const {
|
---|
| 48 | cout<< "Aperture shape:" << getTypeString() << ", ellipse axes : "<<x1<<", "<<x2<<endl;
|
---|
| 49 | cout << " \t Center : " << fx << "," << fy << endl;
|
---|
| 50 | return;
|
---|
[5b822e5] | 51 | }
|
---|