Fork me on GitHub

source: git/external/Hector/H_AbstractBeamLine.h@ b1fd38d

ImprovedOutputFile Timing dual_readout llp
Last change on this file since b1fd38d was 3c40083, checked in by pavel <pavel@…>, 11 years ago

switch to a more stable Hector version

  • Property mode set to 100644
File size: 5.1 KB
RevLine 
[5b822e5]1#ifndef _H_AbstractBeamLine_
2#define _H_AbstractBeamLine_
3
[3c40083]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
[5b822e5]8
[3c40083]9 http://www.fynu.ucl.ac.be/hector.html
10
11 Centre de Physique des Particules et de Phénoménologie (CP3)
12 Université Catholique de Louvain (UCL)
13*/
[5b822e5]14
15/// \file H_AbstractBeamLine.h
16/// \brief Class aiming at simulating the LHC beamline.
17///
[3c40083]18/// Units : angles [µrad], distances [µm], energies [GeV], c=[1].
[5b822e5]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"
[3c40083]31////#include "TGraph.h"
[5b822e5]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:
[3c40083]41 void init(const float );
[5b822e5]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
[3c40083]51 //@{
[5b822e5]52 void add(H_OpticalElement *);
[3c40083]53 void add(H_OpticalElement &);
54 //@}
[5b822e5]55 /// Returns the (float) length of the beamline
[3c40083]56 inline float getLength() const { return beam_length;};
[5b822e5]57 /// Returns the (int) number of optics element of the beamline, including drifts
[3c40083]58 inline int getNumberOfElements() const { return (int)elements.size();};
[5b822e5]59 /// Returns the transport matrix for the whole beam
[3c40083]60 const TMatrix * getBeamMatrix() const;
[5b822e5]61 /// Returns the transport matrix for the whole beam, for given energy loss/mass/charge
[3c40083]62 const TMatrix * getBeamMatrix(const float , const float, const float ) ;
[5b822e5]63 /// Returns the transport matrix for a part of the beam from the IP to a given element
[3c40083]64 const TMatrix * getPartialMatrix(const H_OpticalElement *) const;
[5b822e5]65 /// Returns the transport matrix for a part of the beam from the IP to the ith element
[3c40083]66 const TMatrix * getPartialMatrix(const unsigned int ) const;
[5b822e5]67 /// Returns the transport matrix for a part of the beam from the IP to a given element, given energy loss/mass/charge
[3c40083]68 const TMatrix * getPartialMatrix(const string, const float, const float, const float);
[5b822e5]69 /// Returns the ith element of the beamline
70 //@{
71 H_OpticalElement * getElement(const unsigned int );
[3c40083]72 const H_OpticalElement * getElement(const unsigned int ) const;
[5b822e5]73 //@}
74 /// Returns a given element of the beamline, choosen by name
75 //@{
[3c40083]76 H_OpticalElement * getElement(const string );
77 const H_OpticalElement * getElement(const string ) const;
[5b822e5]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();
[3c40083]93 /// Draws the elements of the beam
94 void draw() const;
[5b822e5]95 /// Draws the elements of the beam in the (x,s) plane
[3c40083]96 void drawX(const float, const float) const;
[5b822e5]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
[3c40083]100 void moveElement(const string, const float );
[5b822e5]101 /// Moves the given element tranversely by given amounts.
[3c40083]102 void alignElement(const string, const float, const float);
[5b822e5]103 /// Tilts the given element tranversely by given angles.
[3c40083]104 void tiltElement(const string, const float, const float);
[5b822e5]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 //@{
[3c40083]109 ////TGraph * getBetaX() const;
110 ////TGraph * getBetaY() const;
[5b822e5]111 //@}
112 /// Draws the dispersion functions, from MAD
113 //@{
[3c40083]114 ////TGraph * getDX() const;
115 ////TGraph * getDY() const;
[5b822e5]116 //@}
117 /// Draws the relative position functions, from MAD
118 //@{
[3c40083]119 ////TGraph * getRelX() const;
120 ////TGraph * getRelY() const;
[5b822e5]121 //@}
122
123
124 private:
[3c40083]125 /// list of all optics elements, including drifts
126 vector<H_OpticalElement*> elements;
[5b822e5]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
[3c40083]130 TMatrix * beam_mat;
[5b822e5]131 /// Orderting method for the vector of H_OpticalElement*
[3c40083]132 struct ordering{ bool operator()(H_OpticalElement* el1, H_OpticalElement* el2) const { return (*el1 < *el2);}};
[5b822e5]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.