Fork me on GitHub

source: svn/trunk/Utilities/Hector/src/H_RomanPot.cc@ 235

Last change on this file since 235 was 232, checked in by Xavier Rouby, 16 years ago

memory leak in constructors removed

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_RomanPot.cc
13/// \brief Roman pot class
14
15// local #includes
16#include "H_RomanPot.h"
17#include "H_RectangularAperture.h"
18#include "H_TransportMatrices.h"
19
20void H_RomanPot::init() {
21 // must be in public section
22 setTypeString();
23 setMatrix(0,MP,QP);
24 return;
25}
26
27H_RomanPot::H_RomanPot(const double s, const double app) :H_Drift(s,RP_LENGTH){
28 type = RP;
29 init();
30 if(element_aperture) delete element_aperture;
31 element_aperture = new H_RectangularAperture(app,RP_HEIGHT,0,0);
32}
33
34H_RomanPot::H_RomanPot(const string& nameE, const double s, const double app) :H_Drift(nameE,s,RP_LENGTH){
35 type = RP;
36 init();
37 if(element_aperture) delete element_aperture;
38 element_aperture = new H_RectangularAperture(app,RP_HEIGHT,0,0);
39}
40
41void H_RomanPot::printProperties() const {
42 cout << typestring << name;
43 cout << "\t\t at s = " << fs;
44 if(element_aperture->getType()!=NONE) {
45 cout <<"\t aperture type = " << element_aperture->getTypeString();
46 element_aperture->printProperties();
47 }
48
49 cout<<endl;
50}
51
52void H_RomanPot::setMatrix(const float eloss, const float p_mass, const float p_charge) {
53 element_mat = driftmat(0);
54 return ;
55}
56
57H_RomanPot* H_RomanPot::clone() const {
58 H_RomanPot* temp_rp = new H_RomanPot(name,fs,element_length);
59 temp_rp->setAperture(element_aperture);
60 temp_rp->setX(xpos);
61 temp_rp->setY(ypos);
62 temp_rp->setTX(txpos);
63 temp_rp->setTY(typos);
64 temp_rp->setBetaX(betax);
65 temp_rp->setBetaY(betay);
66 return temp_rp;
67}
68
Note: See TracBrowser for help on using the repository browser.