Changeset 3c40083 in git for external/Hector/H_BeamParticle.h
- Timestamp:
- Apr 16, 2014, 3:56:14 PM (11 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 64a4950
- Parents:
- f6b9fec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
external/Hector/H_BeamParticle.h
rf6b9fec r3c40083 2 2 #define _H_BeamParticle_ 3 3 4 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * 5 * * 6 * --<--<-- A fast simulator --<--<-- * 7 * / --<--<-- of particle --<--<-- * 8 * ----HECTOR----< * 9 * \ -->-->-- transport through -->-->-- * 10 * -->-->-- generic beamlines -->-->-- * 11 * * 12 * JINST 2:P09005 (2007) * 13 * X Rouby, J de Favereau, K Piotrzkowski (CP3) * 14 * http://www.fynu.ucl.ac.be/hector.html * 15 * * 16 * Center for Cosmology, Particle Physics and Phenomenology * 17 * Universite catholique de Louvain * 18 * Louvain-la-Neuve, Belgium * 19 * * 20 * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 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 */ 21 14 22 15 /// \file H_BeamParticle.h … … 33 26 #include "TMatrixD.h" 34 27 #include "TVectorD.h" 35 #include "TLorentzVector.h"36 #include "TRandom 3.h"28 //#include "TPolyLine3D.h" 29 #include "TRandom.h" 37 30 38 31 // local #includes … … 43 36 using namespace std; 44 37 38 // local defines 39 #define LENGTH_VEC 5 40 #define INDEX_X 0 41 #define INDEX_TX 1 42 #define INDEX_Y 2 43 #define INDEX_TY 3 44 #define INDEX_S 4 45 // (x,theta_x,y,theta_y,s) 46 45 47 /// Defines a particle from the beam and its transport through the beamline 46 48 class H_BeamParticle { 47 49 48 50 public: 51 void init(); 49 52 /// Constructors and Destructor 50 53 //@{ … … 53 56 H_BeamParticle(const double, const double); 54 57 H_BeamParticle& operator=(const H_BeamParticle&); 55 ~H_BeamParticle() { if(stop_position) delete stop_position; if(!stop_element) delete stop_element; positions.clear();}58 ~H_BeamParticle() {delete stop_position; if(!stop_element) delete stop_element; positions.clear(); return; } 56 59 //@} 57 60 /// Smears the (x,y) coordinates of the particle [\f$ \mu m \f$] … … 67 70 /// Sets the particle 4-momentum \f$ P^\mu \f$ 68 71 void set4Momentum(const double, const double, const double, const double); 69 /// Sets the particle 4-momentum \f$ P^\mu \f$70 void set4Momentum(const TLorentzVector&);71 72 /// Clears H_BeamParticle::positions and sets the initial one. 72 73 void setPosition(const double , const double , const double , const double , const double ); 73 74 /// Returns the particle mass [GeV] 74 constdouble getM() const {return mp;};75 double getM() const {return mp;}; 75 76 /// Returns the particle charge [e] 76 constdouble getQ() const {return qp;};77 double getQ() const {return qp;}; 77 78 /// Returns the current x coordinate [\f$ \mu \f$m] 78 constdouble getX() const {return fx;};79 double getX() const {return fx;}; 79 80 /// Returns the current y coordinate [\f$ \mu \f$m] 80 constdouble getY() const {return fy;};81 double getY() const {return fy;}; 81 82 /// Returns the current s coordinate [m] 82 constdouble getS() const {return fs;};83 inline double getS() const {return fs;}; 83 84 /// Returns the current \f$ \theta_x \f$ angular coordinate [\f$ \mu \f$rad] 84 constdouble getTX() const {return thx;};85 inline double getTX() const {return thx;}; 85 86 /// Returns the current \f$ \theta_y \f$ angular coordinate [\f$ \mu \f$rad] 86 constdouble getTY() const {return thy;};87 inline double getTY() const {return thy;}; 87 88 /// Returns the current particle energy [GeV] 88 constdouble getE() const {return energy;};89 inline double getE() const {return energy;}; 89 90 /// Returns all the positions 90 91 vector<TVectorD> getPositions() const {return positions;}; 91 constbool isPhysical() const {return isphysical;};92 bool isPhysical() const {return isphysical;}; 92 93 /// \brief Simulates the emission of a photon in a random direction 93 94 /// … … 98 99 /// \f$ Q^{2}_{max} = -2 * \big( \frac{M_{p} E_{\gamma}}{p_{1}+p_{2}} \big) \big[ 1 + \frac{E^{2}_{1} + E^{2}_{2} - M^{2}_{p} }{ E_{1} E_{2} + p_{1} p_{2}} \big] \f$ 99 100 //@{ 100 void emitGamma(const double gee, const double gq2, const double phimin=0, const double phimax=2*TMath::Pi()); 101 void emitGamma(const double, const double, const double, const double); 102 void emitGamma(const double, const double); 101 103 //@} 102 104 /// uses Pythia to generate some inelastic pp->pX collision as background … … 110 112 void propagate(const H_AbstractBeamLine *, const H_OpticalElement *); 111 113 /// Propagates the particle accross the beamline until a given element 112 void propagate(const H_AbstractBeamLine *, const string &);114 void propagate(const H_AbstractBeamLine *, const string); 113 115 /// Propagates the particle until the end of the beamline 114 116 void propagate(const H_AbstractBeamLine *); … … 118 120 const TVectorD * getPosition(const int ) const; 119 121 /// Prints the properties of the particle 120 void printProperties() const {cout << *this; return;};122 void printProperties() const; 121 123 /// Prints the phase vector of the particle 122 124 void printV() const; … … 124 126 const H_OpticalElement * getStoppingElement() const; 125 127 /// Checks if the particle has been stopped in any element of the beamline 126 constbool stopped(const H_AbstractBeamLine *);128 bool stopped(const H_AbstractBeamLine *); 127 129 /// Returns the StopPosition vector 128 130 inline const TVectorD * getStopPosition() const { return stop_position; }; … … 131 133 void showPositions() const; 132 134 /// Returns the particle path in the beamline 133 TGraph * getPath(const int , const int ) const; 134 void getPath(const int x_or_y, const string& filename) const; 135 ////TGraph * getPath(const int , const int ) const; 136 /// Draws the particle path in the beamline in 3D 137 ////TPolyLine3D * getPath3D(const H_AbstractBeamLine *, const bool, const int, const int) const; 138 /// Computes the position of the particle at the end of each element of the beam, without non linear effects 139 void computePath(const H_AbstractBeamLine *); 135 140 /// Computes the position of the particle at the end of each element of the beam. 136 void computePath(const H_AbstractBeamLine * beam, const bool NonLinear=true);141 void computePath(const H_AbstractBeamLine *, const bool); 137 142 /// Computes the position of the particle at the end of each element of the beam. 138 void computePath(const H_AbstractBeamLine & beam, const bool NonLinear=true);143 void computePath(const H_AbstractBeamLine &, const bool); 139 144 /// Clears H_BeamParticle::positions but keeps the initial vector. 140 145 void resetPath(); 141 146 142 147 private: 143 void init();144 148 /// Particle mass [GeV] 145 149 double mp; … … 172 176 /// Adds a new vector (x,tx,y,ty,s) at the end of H_BeamParticle::positions 173 177 void addPosition(const double , const double , const double , const double , const double ); 174 175 friend std::ostream& operator<< (std::ostream& os, const H_BeamParticle& p);176 178 }; 177 179 #endif
Note:
See TracChangeset
for help on using the changeset viewer.