Fork me on GitHub

Ignore:
Timestamp:
Mar 1, 2009, 3:56:11 PM (15 years ago)
Author:
Xavier Rouby
Message:

new Hector version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/Hector/include/H_BeamParticle.h

    r237 r281  
    22#define _H_BeamParticle_
    33
    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 */
     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   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1421
    1522/// \file H_BeamParticle.h
     
    2734#include "TVectorD.h"
    2835#include "TLorentzVector.h"
     36#include "TRandom3.h"
    2937
    3038// local #includes
     
    3947
    4048        public:
    41                 void init();
    4249                /// Constructors and Destructor
    4350                //@{
     
    4956                //@}
    5057                /// Smears the (x,y) coordinates of the particle [\f$ \mu m \f$]
    51                 void smearPos(const double, const double);
    52                 /// Smears the (x,y) coordinates of the particle (using default values in parameters.h)
    53                 void smearPos();
     58                void smearPos(const double dx=SX,const double dy=SY, TRandom* r=gRandom);
    5459                /// Smears the (x,y) angular coordinates of the particle [\f$ \mu rad \f$]
    55                 void smearAng(const double, const double);
    56                 /// Smears the (x,y) angular coordinates of the particle (using default values in parameters.h)
    57                 void smearAng();
     60                void smearAng(const double tx=STX, const double ty=STY, TRandom* r=gRandom);
    5861                /// Smears the Energy of the particle [GeV]
    59                 void smearE(const double);
    60                 /// Smears the Energy of the particle (using default values in parameters.h)
    61                 void smearE();
     62                void smearE(const double erre=SBE, TRandom* r=gRandom);
    6263                /// Smears the longitudinal position of the particle [\f$ \mu m \f$]
    63                 void smearS(const double);
    64                 /// Smears the longitudinal position of the particle (using default values in parameters.h)
    65                 void smearS();
     64                void smearS(const double errs=SS, TRandom* r=gRandom);
    6665                /// Sets the energy [GeV].
    6766                void setE(const double);
     
    7372                void setPosition(const double , const double , const double , const double , const double );
    7473                /// Returns the particle mass [GeV]
    75                 double getM() const {return mp;};
     74                const double getM() const {return mp;};
    7675                /// Returns the particle charge [e]
    77                 double getQ() const {return qp;};
     76                const double getQ() const {return qp;};
    7877                /// Returns the current x coordinate [\f$ \mu \f$m]
    79                 double getX() const {return fx;};
     78                const double getX() const {return fx;};
    8079                /// Returns the current y coordinate [\f$ \mu \f$m]
    81                 double getY() const {return fy;};
     80                const double getY() const {return fy;};
    8281                /// Returns the current s coordinate [m]
    83                 inline double getS() const {return fs;};
     82                const double getS() const {return fs;};
    8483                /// Returns the current \f$ \theta_x \f$ angular coordinate [\f$ \mu \f$rad]
    85                 double getTX() const {return thx;};
     84                const double getTX() const {return thx;};
    8685                /// Returns the current \f$ \theta_y \f$ angular coordinate [\f$ \mu \f$rad]
    87                 double getTY() const {return thy;};
     86                const double getTY() const {return thy;};
    8887                /// Returns the current particle energy [GeV]
    89                 inline double getE() const {return energy;};
     88                const double getE() const {return energy;};
    9089                /// Returns all the positions
    9190                vector<TVectorD> getPositions() const {return positions;};
    92                 bool isPhysical() const {return isphysical;};
     91                const bool isPhysical() const {return isphysical;};
    9392                /// \brief Simulates the emission of a photon in a random direction
    9493                ///
     
    9998                /// \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$
    10099                //@{
    101                 void emitGamma(const double, const double, const double, const double);
    102                 void emitGamma(const double, const double);
     100                void emitGamma(const double gee, const double gq2, const double phimin=0, const double phimax=2*TMath::Pi());
    103101                //@}
    104102                /// uses Pythia to generate some inelastic pp->pX collision as background
     
    120118                const TVectorD * getPosition(const int ) const;
    121119                /// Prints the properties of the particle
    122                 void printProperties() const;
     120                void printProperties() const {cout << *this; return;};
    123121                /// Prints the phase vector of the particle
    124122                void printV() const;
     
    126124                const H_OpticalElement * getStoppingElement() const;
    127125                /// Checks if the particle has been stopped in any element of the beamline
    128                 bool stopped(const H_AbstractBeamLine *);
     126                const bool stopped(const H_AbstractBeamLine *);
    129127                /// Returns the StopPosition vector
    130128                inline const TVectorD * getStopPosition() const { return stop_position; };
     
    134132                /// Returns the particle path in the beamline
    135133                TGraph * getPath(const int , const int ) const;
    136                 /// Computes the position of the particle at the end of each element of the beam, without non linear effects
    137                 void computePath(const H_AbstractBeamLine *);
    138134                /// Computes the position of the particle at the end of each element of the beam.
    139                 void computePath(const H_AbstractBeamLine *, const bool);
     135                void computePath(const H_AbstractBeamLine * beam, const bool NonLinear=true);
    140136                /// Computes the position of the particle at the end of each element of the beam.
    141                 void computePath(const H_AbstractBeamLine &, const bool);
     137                void computePath(const H_AbstractBeamLine & beam, const bool NonLinear=true);
    142138                /// Clears H_BeamParticle::positions but keeps the initial vector.
    143139                void resetPath();
    144140
    145141        private:
     142                void init();
    146143                /// Particle mass [GeV]
    147144                double mp;
     
    175172                void addPosition(const double , const double , const double , const double , const double );
    176173
    177                 static const float pi = 3.14159265358979312;
     174        friend std::ostream& operator<< (std::ostream& os, const H_BeamParticle& p);
    178175};
    179176#endif
Note: See TracChangeset for help on using the changeset viewer.