Fork me on GitHub

source: svn/trunk/external/Hector/H_AbstractBeamLine.h@ 1389

Last change on this file since 1389 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: 5.1 KB
RevLine 
[1360]1#ifndef _H_AbstractBeamLine_
2#define _H_AbstractBeamLine_
3
[1365]4/*
5---- Hector the simulator ----
6 A fast simulator of particles through generic beamlines.
7 J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
[1360]8
[1365]9 http://www.fynu.ucl.ac.be/hector.html
[1360]10
[1365]11 Centre de Physique des Particules et de Phénoménologie (CP3)
12 Université Catholique de Louvain (UCL)
13*/
14
[1360]15/// \file H_AbstractBeamLine.h
16/// \brief Class aiming at simulating the LHC beamline.
17///
[1365]18/// Units : angles [µrad], distances [µm], energies [GeV], c=[1].
[1360]19
20 /// default length of the beam line
21#define LENGTH_DEF 100
22
23// c++ #includes
24#include <vector>
25#include <algorithm>
26#include <string>
27
28
29// ROOT #includes
30#include "TMatrix.h"
[1365]31////#include "TGraph.h"
[1360]32
33// local #includes
34#include "H_OpticalElement.h"
35using namespace std;
36
37/// Beamline made from a vector of H_OpticalElement.
38class H_AbstractBeamLine {
39
40 public:
[1365]41 void init(const float );
[1360]42 /// Constructors, destructor and operator
43 //@{
44 H_AbstractBeamLine() {init(LENGTH_DEF);};
45 H_AbstractBeamLine(const float length) {init(length);};
46 H_AbstractBeamLine(const H_AbstractBeamLine &);
47 H_AbstractBeamLine& operator=(const H_AbstractBeamLine&);
48 ~H_AbstractBeamLine();
49 //@}
50 /// Adds an element to the beamline
[1365]51 //@{
[1360]52 void add(H_OpticalElement *);
[1365]53 void add(H_OpticalElement &);
54 //@}
[1360]55 /// Returns the (float) length of the beamline
[1365]56 inline float getLength() const { return beam_length;};
[1360]57 /// Returns the (int) number of optics element of the beamline, including drifts
[1365]58 inline int getNumberOfElements() const { return (int)elements.size();};
[1360]59 /// Returns the transport matrix for the whole beam
[1365]60 const TMatrix * getBeamMatrix() const;
[1360]61 /// Returns the transport matrix for the whole beam, for given energy loss/mass/charge
[1365]62 const TMatrix * getBeamMatrix(const float , const float, const float ) ;
[1360]63 /// Returns the transport matrix for a part of the beam from the IP to a given element
[1365]64 const TMatrix * getPartialMatrix(const H_OpticalElement *) const;
[1360]65 /// Returns the transport matrix for a part of the beam from the IP to the ith element
[1365]66 const TMatrix * getPartialMatrix(const unsigned int ) const;
[1360]67 /// Returns the transport matrix for a part of the beam from the IP to a given element, given energy loss/mass/charge
[1365]68 const TMatrix * getPartialMatrix(const string, const float, const float, const float);
[1360]69 /// Returns the ith element of the beamline
70 //@{
71 H_OpticalElement * getElement(const unsigned int );
[1365]72 const H_OpticalElement * getElement(const unsigned int ) const;
[1360]73 //@}
74 /// Returns a given element of the beamline, choosen by name
75 //@{
[1365]76 H_OpticalElement * getElement(const string );
77 const H_OpticalElement * getElement(const string ) const;
[1360]78 //@}
79 /// Print some info
80 void printProperties() const;
81 /// Prints the element list
82 void showElements() const;
83 /// Prints the list of elements of a give type
84 void showElements(const int) const;
85 /// Prints the transport matrix for the whole beam
86 void showMatrix() const;
87 /// Prints the transport matrix for each element of the beamline
88 void showMatrices() const;
89 /// Reorders elements and adds the drift sections
90 void calcSequence();
91 /// Computes global transport matrix
92 void calcMatrix();
[1365]93 /// Draws the elements of the beam
94 void draw() const;
[1360]95 /// Draws the elements of the beam in the (x,s) plane
[1365]96 void drawX(const float, const float) const;
[1360]97 /// Draws the elements of the beam in the (y,s) plane
98 void drawY(const float, const float) const;
99 /// Moves an element in the list, reorders the lists and recomputes the transport matrix
[1365]100 void moveElement(const string, const float );
[1360]101 /// Moves the given element tranversely by given amounts.
[1365]102 void alignElement(const string, const float, const float);
[1360]103 /// Tilts the given element tranversely by given angles.
[1365]104 void tiltElement(const string, const float, const float);
[1360]105 /// Offsets all element in X pos from the start position
106 void offsetElements(const float start, const float offset);
107 /// Draws the beta functions, from MAD
108 //@{
[1365]109 ////TGraph * getBetaX() const;
110 ////TGraph * getBetaY() const;
[1360]111 //@}
112 /// Draws the dispersion functions, from MAD
113 //@{
[1365]114 ////TGraph * getDX() const;
115 ////TGraph * getDY() const;
[1360]116 //@}
117 /// Draws the relative position functions, from MAD
118 //@{
[1365]119 ////TGraph * getRelX() const;
120 ////TGraph * getRelY() const;
[1360]121 //@}
122
123
124 private:
[1365]125 /// list of all optics elements, including drifts
126 vector<H_OpticalElement*> elements;
[1360]127 /// list of matrices, 1 matrix = the transport till the end of each element
128 vector<TMatrix> matrices;
129 /// transport matrix for the whole beam
[1365]130 TMatrix * beam_mat;
[1360]131 /// Orderting method for the vector of H_OpticalElement*
[1365]132 struct ordering{ bool operator()(H_OpticalElement* el1, H_OpticalElement* el2) const { return (*el1 < *el2);}};
[1360]133
134 protected:
135 /// total length of the beamline
136 float beam_length;
137};
138
139#endif
Note: See TracBrowser for help on using the repository browser.