Fork me on GitHub

source: svn/trunk/external/Hector/H_RectEllipticAperture.cc@ 1371

Last change on this file since 1371 was 1365, checked in by Pavel Demin, 11 years ago

switch to a more stable Hector version

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision Date
File size: 1.8 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_RectEllipticAperture.cc
13/// \brief Defines the Rect-Elliptic 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
22//#include "TEllipse.h"
23//#include "TPave.h"
24
25// local #includes
26#include "H_RectEllipticAperture.h"
27using namespace std;
28
29H_RectEllipticAperture::H_RectEllipticAperture(const float x1, const float x2, const float x3, const float x4, const float posx, const float posy) :H_Aperture(RECTELLIPSE,((x1==0)?x3:x1),((x2==0)?x4:x2),x3,x4,posx,posy) {
30 /// @param x1, x2, x3, x4 are the geometrical parameters of the rect-ellipse shape
31 /// @param posx, posy defines the (x,y) of the center of the shape
32 type= RECTELLIPSE;
33}
34
35void H_RectEllipticAperture::draw() const {
36/* TEllipse* te = new TEllipse(fx,fy,x3,x4);
37 TPave* tp = new TPave(fx-x1,fy-x2,fx+x1,fy+x2,1);
38 te->SetLineColor(2);
39 te->SetFillColor(2);
40 te->SetFillStyle(3004);
41 te->Draw();
42 tp->SetLineColor(2);
43 tp->SetFillColor(2);
44 tp->SetFillStyle(3005);
45 tp->Draw();
46 return;
47*/
48}
49
50bool H_RectEllipticAperture::isInside(const float x, const float y) const {
51 return((fabs(fx-x)<x1)&&(fabs(fy-y)<x2)&&(((x-fx)/x3)*((x-fx)/x3)+((y-fy)/x4)*((y-fy)/x4)<1));
52}
53
54void H_RectEllipticAperture::printProperties() const {
55 cout << "Aperture shape:" << getTypeString() << ", parameters " <<x1<<", "<<x2<<", "<<x3<<", "<<x4<< endl;
56 cout << " \t Center : "<<fx<<", "<<fy<<endl;
57 return;
58}
Note: See TracBrowser for help on using the repository browser.