#ifndef COLLIMATOR_H #define COLLIMATOR_H #include #include #include #include #include #include #include "Element.h" #include "Particle.h" #if defined(FLUKA) #include "FlukaIO.h" #endif using namespace std; /* ########################################################################################################################################### This pure virtual class describes all collimators in the accelerator lattice, which all inherit from it. The Collimator class inherit from the class Element. ########################################################################################################################################## */ class Collimator : public Element { public: //=================================================Constructors, destructor======================================= 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); 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); Collimator(Element elt, const double& tcang, const double& nsig, const string& meth); Collimator(Element elt, const double& tcang, const double& nsig, const string& meth, const string& material); Collimator(const Collimator& obj); virtual ~Collimator() {}; //virtual method to describe the passage through a collimator 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) {}; virtual void collipassCrystal(vector & bunch, const double& betgam, const int& pas, long int& nhit, string outputpath) {}; //these methods are specific for a fluka/crystal collimator. They are just defined here. #if defined(FLUKA) virtual void collipassfluka(vector & bunchstart, vector & bunchend, flukaio_connection_t* connection, const int& turn, const double& momentum) {}; #endif //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. void collipassInteraction(Particle& p1, double Apr, double Zpr, double betgam, double lcoll); //reads informations about the cross-section and calculate probabilities for the different possible reactions. void genipsfastnewxc(double& sigt, vector & isig, vector & da, vector & dz, string path, double a, double z); //calculates the change in momentum, dx/ds and dy/ds when a particle interacts with a collimator void BeBloMuSca(double& wx, double& wy, double& dpopdx, double betgam, string path, double rho, double L, double At, Particle p1); //displays the parameters of the collimator void affiche(); string method;//method used; can be: standard, magnetic, fluka or crystal long double hgap;//half the distance between the two edges of a collimator, measured at the beginning of the collimator long double hgap2;//same as above, but measured at the end of the collimator long double pdepth;//depth in the collimator at the entrance long double pdepth2;//depthin the collimator at the exit double tcang;//angle of the collimator double nsig;//initial size of the beam [sigma] string material;//material of the collimator (carbon, copper, iron, MARS or tungsten) string crossSectionPath;//path to the file where are the cross-section infos double phi;//absolute angle of the collimator //the following parameters are only useful for magnetic collimator long double Bmax;//maximum strength of the magnetic field [T] long double thicknessMagneticField;//the distance from the collimator edge until the magnetic field is about 10% of Bmax [T] double energyPerIon;//[GeV] double mass;//[GeV/c^2] double deltaGap;//how much each collimator edge is moved [m] //the following parameters are only useful for crystal collimators int C_orient; //crystal orientation (1 for 110, 2 for 111) int IS; //integer that defines the substance (0 for Si, 1 for W, 2 for C, 3 for Ge double Mirror; // -1 or 1; an integer to define the install location of the crystal. // -1: the crystal is installed inner side of the vacuum chamber // 1: the crystal is installed at the out side of the vacuum chamber double C_xmax; //maximum in the x direction (dimension of the crystal) [m] double C_ymax; //maximum in the y direction (dimension of the cystal) [m] double Cry_length; //crystal length [m] double Rcurv; //curvature radius of the crystal [m] double C_rotation; double C_aperture; double C_offset; double C_tilt; double Cry_tilt; }; #endif