Fork me on GitHub

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

Last change on this file since 1372 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
RevLine 
[1365]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
[1360]5
[1365]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
[1360]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
[1365]22//#include "TEllipse.h"
23//#include "TPave.h"
[1360]24
25// local #includes
26#include "H_RectEllipticAperture.h"
27using namespace std;
28
[1365]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
[1360]31 /// @param posx, posy defines the (x,y) of the center of the shape
[1365]32 type= RECTELLIPSE;
[1360]33}
34
[1365]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();
[1360]46 return;
[1365]47*/
[1360]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
[1365]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;
[1360]58}
Note: See TracBrowser for help on using the repository browser.