Fork me on GitHub

source: svn/trunk/external/Hector/H_RectangularAperture.cc@ 1392

Last change on this file since 1392 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.5 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_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
[1365]22//#include "TPave.h"
[1360]23
24// local #includes
25#include "H_RectangularAperture.h"
26using namespace std;
27
[1365]28H_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
[1360]30 /// @param posx, posy are the (x,y) coordinates of the center of the rectangular shape
31}
32
33bool 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
[1365]38void H_RectangularAperture::draw() const {
39/* TPave* tp = new TPave(fx-x1,fy-x2,fx+x1,fy+x2,1);
[1360]40 tp->SetFillStyle(3003);
41 tp->SetLineColor(2);
42 tp->SetFillColor(2);
43 tp->Draw();
44 return;
[1365]45*/
[1360]46}
[1365]47void H_RectangularAperture::printProperties() const {
48 cout << "Aperture shape:" << getTypeString() << ", rectangle Sides : "<<x1<<", "<<x2<<endl;
49 cout << " \t Center : " << fx << "," << fy << endl;
50 return;
[1360]51}
Note: See TracBrowser for help on using the repository browser.