#ifndef COLLIMATORPHYSICS_HH #define COLLIMATORPHYSICS_HH //Class:CollimatorPhysics // Defines the collimator physics models // ------------------------------------------------------------------------ // Class category: // ------------------------------------------------------------------------ // $Date: 2009/07/20 09:32:31 $ // $Author: Bi, Yang, Stachel, Adelmann$ //------------------------------------------------------------------------- #include #include "Solvers/SurfacePhysicsHandler.hh" #include "Algorithms/Vektor.h" #include "AbsBeamline/Component.h" #include class ElementBase; class PartBunch; class LossDataSink; class Inform; typedef struct { int label; unsigned localID; Vector_t Rincol; Vector_t Pincol; long IDincol; int Binincol; double DTincol; double Qincol; long LastSecincol; Vector_t Bfincol; Vector_t Efincol; } PART; class CollimatorPhysics: public SurfacePhysicsHandler { public: CollimatorPhysics(const std::string &name, ElementBase *element, std::string &mat); void apply(PartBunch &bunch); virtual const std::string getType() const; ~CollimatorPhysics(); void Material(); void EnergyLoss(double &Eng, bool &pdead); void CoulombScat(Vector_t &R, Vector_t &P, double &deltat); void CoulombScat(); void EnergyLoss(double &Eng, bool &pdead, double &deltat); // Old Bi stuff // void Rot(Vector_t &P, Vector_t Prot, double normP); // double Rot(double &p1, double &p2, double &scatang); void Rot(double &px, double &pz, double &x, double &z, double xplane, double Norm_P, double thetacou, double deltas, int coord); private: gsl_rng *rGen_m; std::string material_m; std::string FN_m; std::string collshape_m; int Z_m; double A_m; double A2_c; double A3_c; double A4_c; double A5_c; double rho_m; double X0_m; double I_m; double n_m; unsigned bunchToMatStat_m; unsigned stoppedPartStat_m; unsigned redifusedStat_m; // some statistics double Eavg_m; double Emax_m; double Emin_m; public: double dT_m; int N_m; private: bool incoll_m; double time_m; std::vector locParts_m; std::unique_ptr lossDs_m; void copyFromBunch(PartBunch &bunch); void addBackToBunch(PartBunch &bunch, unsigned i); void deleteParticleFromLocalVector(); public: void print(Inform& os); bool stillActive() { return bunchToMatStat_m != 0;} }; #endif //COLLIMATORPHYSICS_HH