Fork me on GitHub

source: git/external/Hector/H_AbstractBeamLine.h@ 51cabe8

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