/* ---- Hector the simulator ---- A fast simulator of particles through generic beamlines. J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be http://www.fynu.ucl.ac.be/hector.html Centre de Physique des Particules et de Phénoménologie (CP3) Université Catholique de Louvain (UCL) */ /// \file H_OpticalElement.cc /// \brief Class aiming at describing any beam optical element. // c++ #includes #include #include // ROOT #includes //#include "TPaveLabel.h" // local #includes #include "H_TransportMatrices.h" #include "H_Aperture.h" #include "H_OpticalElement.h" using namespace std; /// called by the constructors void H_OpticalElement::init(const string nameE, const int typeE, const double s, const double k, const double l, H_Aperture* the_app) { // this is called by the constructors // must be in public section ! // xpos and ypos are vectors with n point. They define the aperture shape of the optical element. name = nameE; fs = s; fk = k; xpos = 0; ypos = 0; txpos = 0; typos = 0; element_length = l; type = typeE; element_mat = new TMatrix(MDIM,MDIM); setAperture(the_app); if(element_length<0) { if(VERBOSE) cout<<"\t ERROR : Interpenetration of elements !"<(ap); element_aperture = ap; return; } void H_OpticalElement::printProperties() const { cout << typestring; cout << name; cout <<"\t at s = " << fs; cout <<"\t length = "<< element_length; if(fk!=0) cout <<"\t strength = " << fk; if(element_aperture->getType()!=NONE) { cout <<"\t aperture type = " << element_aperture->getTypeString(); element_aperture->printProperties(); } cout<draw(); return; } TMatrix H_OpticalElement::getMatrix() const { return *element_mat; } TMatrix H_OpticalElement::getMatrix(const float eloss, const float p_mass, const float p_charge) const { setMatrix(eloss,p_mass,p_charge); return *element_mat; } void H_OpticalElement::draw(const float meight, const float height) const{ /* /// @param meight is the minimal extend of the graph /// @param height is the maximal extend of the graph float x1 = getS(); float x2 = getS() + getLength(); float y1 = meight; float y2 = height; TPaveLabel* cur_box = new TPaveLabel(x1,y1,x2,y2,""); cur_box->SetBorderSize(1); cur_box->SetFillStyle(1001); cur_box->SetFillColor((int)getType()); cur_box->Draw(); */ }