[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_RectangularAperture.cc
|
---|
| 13 | /// \brief Defines the rectangular aperture of beamline elements.
|
---|
| 14 |
|
---|
| 15 | // C++ #includes
|
---|
| 16 | #include <iostream>
|
---|
| 17 |
|
---|
| 18 | // C #includes
|
---|
| 19 | #include <cmath> // needed for fabs
|
---|
| 20 |
|
---|
| 21 | // ROOT #includes
|
---|
[3c40083] | 22 | //#include "TPave.h"
|
---|
[5b822e5] | 23 |
|
---|
| 24 | // local #includes
|
---|
| 25 | #include "H_RectangularAperture.h"
|
---|
| 26 | using namespace std;
|
---|
| 27 |
|
---|
[3c40083] | 28 | H_RectangularAperture::H_RectangularAperture(const float x1, const float x2, const float posx, const float posy) :H_Aperture(RECTANGULAR,x1,x2,0,0,posx,posy) {
|
---|
| 29 | /// @param x1, x2 are the length and height of the rectangular shape
|
---|
[5b822e5] | 30 | /// @param posx, posy are the (x,y) coordinates of the center of the rectangular shape
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | bool H_RectangularAperture::isInside(const float x, const float y) const {
|
---|
| 34 | /// @param x, y are the (x,y) coordinates of the proton, in [m]
|
---|
| 35 | return (fabs(x-fx)<x1&&fabs(y-fy)<x2);
|
---|
| 36 | }
|
---|
| 37 |
|
---|
[3c40083] | 38 | void H_RectangularAperture::draw() const {
|
---|
| 39 | /* TPave* tp = new TPave(fx-x1,fy-x2,fx+x1,fy+x2,1);
|
---|
[5b822e5] | 40 | tp->SetFillStyle(3003);
|
---|
| 41 | tp->SetLineColor(2);
|
---|
| 42 | tp->SetFillColor(2);
|
---|
| 43 | tp->Draw();
|
---|
| 44 | return;
|
---|
[3c40083] | 45 | */
|
---|
[5b822e5] | 46 | }
|
---|
[3c40083] | 47 | void H_RectangularAperture::printProperties() const {
|
---|
| 48 | cout << "Aperture shape:" << getTypeString() << ", rectangle Sides : "<<x1<<", "<<x2<<endl;
|
---|
| 49 | cout << " \t Center : " << fx << "," << fy << endl;
|
---|
| 50 | return;
|
---|
[5b822e5] | 51 | }
|
---|