Fork me on GitHub

source: git/external/Hector/H_RectEllipticAperture.cc@ 1d5395b

Timing
Last change on this file since 1d5395b was 3c40083, checked in by pavel <pavel@…>, 11 years ago

switch to a more stable Hector version

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[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_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
[3c40083]22//#include "TEllipse.h"
23//#include "TPave.h"
[5b822e5]24
25// local #includes
26#include "H_RectEllipticAperture.h"
27using namespace std;
28
[3c40083]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
[5b822e5]31 /// @param posx, posy defines the (x,y) of the center of the shape
[3c40083]32 type= RECTELLIPSE;
[5b822e5]33}
34
[3c40083]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();
[5b822e5]46 return;
[3c40083]47*/
[5b822e5]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
[3c40083]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;
[5b822e5]58}
Note: See TracBrowser for help on using the repository browser.