1 | #ifndef COLLIMATOR_H |
---|
2 | #define COLLIMATOR_H |
---|
3 | #include <iostream> |
---|
4 | #include <fstream> |
---|
5 | #include <sstream> |
---|
6 | #include <vector> |
---|
7 | #include <string> |
---|
8 | #include <cmath> |
---|
9 | #include "Element.h" |
---|
10 | #include "Particle.h" |
---|
11 | |
---|
12 | #if defined(FLUKA) |
---|
13 | #include "FlukaIO.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | using namespace std; |
---|
17 | |
---|
18 | /* |
---|
19 | ########################################################################################################################################### |
---|
20 | |
---|
21 | This pure virtual class describes all collimators in the accelerator lattice, which all inherit from it. |
---|
22 | |
---|
23 | The Collimator class inherit from the class Element. |
---|
24 | |
---|
25 | ########################################################################################################################################## |
---|
26 | */ |
---|
27 | |
---|
28 | |
---|
29 | class Collimator : public Element |
---|
30 | { |
---|
31 | |
---|
32 | public: |
---|
33 | |
---|
34 | //=================================================Constructors, destructor======================================= |
---|
35 | |
---|
36 | Collimator(const double& ALFX, const double& ALFY, const double& APER_1, const double& APER_2, const double& APER_3, const double& APER_4, const string& APERTYPE, const double& BETX, const double& BETY, const double& DPX, const double& DPY, const double& DX, const double& DY, const string& KEYWORD, const double& L, const double& MUX, const double& MUY, const string& NAME, const double& PTC, const double& PXC, const double& PYC, const double& S, const double& TC, const double& XC, const double& YC, const double& K0L, const double& K0SL, const double& K1L, const double& K1SL, const double& K2L, const double& K2SL, const string& PARENT, const string& meth, const long double& hgap, const long double& hgap2, const double& collang, const long double& pdepth, const long double& pdepth2, const double& tcang, const double& nsig); |
---|
37 | |
---|
38 | Collimator(const double& ALFX, const double& ALFY, const double& APER_1, const double& APER_2, const double& APER_3, const double& APER_4, const string& APERTYPE, const double& BETX, const double& BETY, const double& DPX, const double& DPY, const double& DX, const double& DY, const string& KEYWORD, const double& L, const double& MUX, const double& MUY, const string& NAME, const double& PTC, const double& PXC, const double& PYC, const double& S, const double& TC, const double& XC, const double& YC, const double& K0L, const double& K0SL, const double& K1L, const double& K1SL, const double& K2L, const double& K2SL, const string& PARENT, const string& meth, const long double& hgap, const long double& hgap2, const double& collang, const long double& pdepth, const long double& pdepth2, const double& tcang, const double& nsig, const long double& Bmax, const long double& thicknessMagneticField, const double& energyPerIon, const double& mass); |
---|
39 | |
---|
40 | Collimator(Element elt, const double& tcang, const double& nsig, const string& meth); |
---|
41 | |
---|
42 | Collimator(Element elt, const double& tcang, const double& nsig, const string& meth, const string& material); |
---|
43 | |
---|
44 | Collimator(const Collimator& obj); |
---|
45 | |
---|
46 | virtual ~Collimator() {}; |
---|
47 | |
---|
48 | |
---|
49 | //virtual method to describe the passage through a collimator |
---|
50 | |
---|
51 | virtual void collipass(Particle& p1, double& dpopeff, const double& scaleorbit, const double& R11X, const double& R12X, const double& R21X, const double& R22X, const double& R11Y, const double& R12Y, const double& R21Y, const double& R22Y, const double& dx1, const double& dpx1, const double& dy1, const double& dpy1, const double& delta_s, const double& Apr, const double& Zpr, const double& betgam) {}; |
---|
52 | |
---|
53 | |
---|
54 | virtual void collipassCrystal(vector <Particle>& bunch, const double& betgam, const int& pas, string outputpath) {}; |
---|
55 | //these methods are specific for a fluka/crystal collimator. They are just defined here. |
---|
56 | #if defined(FLUKA) |
---|
57 | virtual void collipassfluka(vector <Particle>& bunchstart, vector <Particle>& bunchend, flukaio_connection_t* connection, const int& turn, const double& momentum) {}; |
---|
58 | |
---|
59 | #endif |
---|
60 | |
---|
61 | |
---|
62 | //simulates a particles interaction with a collimator. The returned charge of a lost particle gives information about why the particle was lost: -1 means loss because we did't have cross sections infos, -2 means loss because the particle created corresponded to one of the omitted reactions and -3 means loss because the particle moved more than 10 interaction lengths inside the collimator. |
---|
63 | |
---|
64 | void collipassInteraction(Particle& p1, double Apr, double Zpr, double betgam, double lcoll); |
---|
65 | |
---|
66 | |
---|
67 | //reads informations about the cross-section and calculate probabilities for the different possible reactions. |
---|
68 | |
---|
69 | void genipsfastnewxc(double& sigt, vector <double>& isig, vector <double>& da, vector <double>& dz, string path, double a, double z); |
---|
70 | |
---|
71 | |
---|
72 | //calculates the change in momentum, dx/ds and dy/ds when a particle interacts with a collimator |
---|
73 | |
---|
74 | void BeBloMuSca(double& wx, double& wy, double& dpopdx, double betgam, string path, double rho, double L, double At, Particle p1); |
---|
75 | |
---|
76 | |
---|
77 | //displays the parameters of the collimator |
---|
78 | |
---|
79 | void affiche(); |
---|
80 | |
---|
81 | string method;//method used; can be: standard, magnetic, fluka or crystal |
---|
82 | |
---|
83 | long double hgap;//half the distance between the two edges of a collimator, measured at the beginning of the collimator |
---|
84 | long double hgap2;//same as above, but measured at the end of the collimator |
---|
85 | long double pdepth;//depth in the collimator at the entrance |
---|
86 | long double pdepth2;//depthin the collimator at the exit |
---|
87 | |
---|
88 | double tcang;//angle of the collimator |
---|
89 | double nsig;//initial size of the beam [sigma] |
---|
90 | |
---|
91 | string material;//material of the collimator (carbon, copper, iron, MARS or tungsten) |
---|
92 | string crossSectionPath;//path to the file where are the cross-section infos |
---|
93 | |
---|
94 | double phi;//absolute angle of the collimator |
---|
95 | |
---|
96 | |
---|
97 | //the following parameters are only useful for magnetic collimator |
---|
98 | |
---|
99 | long double Bmax;//maximum strength of the magnetic field [T] |
---|
100 | long double thicknessMagneticField;//the distance from the collimator edge until the magnetic field is about 10% of Bmax [T] |
---|
101 | double energyPerIon;//[GeV] |
---|
102 | double mass;//[GeV/c^2] |
---|
103 | double deltaGap;//how much each collimator edge is moved [m] |
---|
104 | |
---|
105 | |
---|
106 | //the following parameters are only useful for crystal collimators |
---|
107 | |
---|
108 | int C_orient; //crystal orientation (1 for 110, 2 for 111) |
---|
109 | int IS; //integer that defines the substance (0 for Si, 1 for W, 2 for C, 3 for Ge |
---|
110 | double Mirror; // -1 or 1; an integer to define the install location of the crystal. |
---|
111 | // -1: the crystal is installed inner side of the vacuum chamber |
---|
112 | // 1: the crystal is installed at the out side of the vacuum chamber |
---|
113 | double C_xmax; //maximum in the x direction (dimension of the crystal) [m] |
---|
114 | double C_ymax; //maximum in the y direction (dimension of the cystal) [m] |
---|
115 | double Cry_length; //crystal length [m] |
---|
116 | double Rcurv; //curvature radius of the crystal [m] |
---|
117 | double C_rotation; |
---|
118 | double C_aperture; |
---|
119 | double C_offset; |
---|
120 | double C_tilt; |
---|
121 | double Cry_tilt; |
---|
122 | |
---|
123 | }; |
---|
124 | |
---|
125 | #endif |
---|