Fork me on GitHub

source: svn/trunk/Utilities/Hector/src/H_EllipticAperture.cc@ 12

Last change on this file since 12 was 3, checked in by Xavier Rouby, 16 years ago

first commit

File size: 1.6 KB
Line 
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*/
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
19#include "TEllipse.h"
20
21// local #includes
22#include "H_Parameters.h"
23#include "H_Aperture.h"
24#include "H_EllipticAperture.h"
25using namespace std;
26
27H_EllipticAperture::H_EllipticAperture(const float l, const float h, const float posx, const float posy) :H_Aperture(ELLIPTIC,l,h,0,0,posx,posy) {
28 /// @param l, h are the length and height of the elliptic shape
29 /// @param posx, posy are the (x,y) coordinates of the center of the ellipse
30}
31
32H_EllipticAperture* H_EllipticAperture::clone() const {
33 return new H_EllipticAperture(x1,x2,fx,fy);
34}
35
36bool H_EllipticAperture::isInside(const float x, const float y) const {
37 /// @param x, y are the (x,y) coordinates of the proton
38 return (((x-fx)/x1)*((x-fx)/x1) + ((y-fy)/x2)*((y-fy)/x2) < 1);
39}
40
41void H_EllipticAperture::draw(const float scale) const {
42 TEllipse* te = new TEllipse(fx*scale,fy*scale,x1*scale,x2*scale);
43 te->SetFillStyle(3003);
44 te->SetLineColor(39);
45 te->SetFillColor(39);
46 te->Draw("f");
47 return;
48}
49
50void H_EllipticAperture::printProperties() const {
51 cout<< "Aperture shape:" << getTypeString() << ", ellipse axes : "<<x1<<", "<<x2<<endl;
52 cout << " \t Center : " << fx << "," << fy << endl;
53 return;
54}
Note: See TracBrowser for help on using the repository browser.