Fork me on GitHub

Ignore:
Timestamp:
Apr 16, 2014, 3:56:14 PM (10 years ago)
Author:
Pavel Demin
Message:

switch to a more stable Hector version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/external/Hector/H_BeamParticle.h

    r1360 r1365  
    22#define _H_BeamParticle_
    33
    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*/
    2114
    2215/// \file H_BeamParticle.h
     
    3326#include "TMatrixD.h"
    3427#include "TVectorD.h"
    35 #include "TLorentzVector.h"
    36 #include "TRandom3.h"
     28//#include "TPolyLine3D.h"
     29#include "TRandom.h"
    3730
    3831// local #includes
     
    4336using namespace std;
    4437
     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
    4547/// Defines a particle from the beam and its transport through the beamline
    4648class H_BeamParticle {
    4749
    4850        public:
     51                void init();
    4952                /// Constructors and Destructor
    5053                //@{
     
    5356                H_BeamParticle(const double, const double);
    5457                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; }
    5659                //@}
    5760                /// Smears the (x,y) coordinates of the particle [\f$ \mu m \f$]
     
    6770                /// Sets the particle 4-momentum \f$ P^\mu \f$
    6871                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&);       
    7172                /// Clears H_BeamParticle::positions and sets the initial one.
    7273                void setPosition(const double , const double , const double , const double , const double );
    7374                /// Returns the particle mass [GeV]
    74                 const double getM() const {return mp;};
     75                double getM() const {return mp;};
    7576                /// Returns the particle charge [e]
    76                 const double getQ() const {return qp;};
     77                double getQ() const {return qp;};
    7778                /// Returns the current x coordinate [\f$ \mu \f$m]
    78                 const double getX() const {return fx;};
     79                double getX() const {return fx;};
    7980                /// Returns the current y coordinate [\f$ \mu \f$m]
    80                 const double getY() const {return fy;};
     81                double getY() const {return fy;};
    8182                /// Returns the current s coordinate [m]
    82                 const double getS() const {return fs;};
     83                inline double getS() const {return fs;};
    8384                /// Returns the current \f$ \theta_x \f$ angular coordinate [\f$ \mu \f$rad]
    84                 const double getTX() const {return thx;};
     85                inline double getTX() const {return thx;};
    8586                /// Returns the current \f$ \theta_y \f$ angular coordinate [\f$ \mu \f$rad]
    86                 const double getTY() const {return thy;};
     87                inline double getTY() const {return thy;};
    8788                /// Returns the current particle energy [GeV]
    88                 const double getE() const {return energy;};
     89                inline double getE() const {return energy;};
    8990                /// Returns all the positions
    9091                vector<TVectorD> getPositions() const {return positions;};
    91                 const bool isPhysical() const {return isphysical;};
     92                bool isPhysical() const {return isphysical;};
    9293                /// \brief Simulates the emission of a photon in a random direction
    9394                ///
     
    9899                /// \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$
    99100                //@{
    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);
    101103                //@}
    102104                /// uses Pythia to generate some inelastic pp->pX collision as background
     
    110112                void propagate(const H_AbstractBeamLine *, const H_OpticalElement *);
    111113                /// 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);
    113115                /// Propagates the particle until the end of the beamline
    114116                void propagate(const H_AbstractBeamLine *);
     
    118120                const TVectorD * getPosition(const int ) const;
    119121                /// Prints the properties of the particle
    120                 void printProperties() const {cout << *this; return;};
     122                void printProperties() const;
    121123                /// Prints the phase vector of the particle
    122124                void printV() const;
     
    124126                const H_OpticalElement * getStoppingElement() const;
    125127                /// Checks if the particle has been stopped in any element of the beamline
    126                 const bool stopped(const H_AbstractBeamLine *);
     128                bool stopped(const H_AbstractBeamLine *);
    127129                /// Returns the StopPosition vector
    128130                inline const TVectorD * getStopPosition() const { return stop_position; };
     
    131133                void showPositions() const;
    132134                /// 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 *);
    135140                /// 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);
    137142                /// 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);
    139144                /// Clears H_BeamParticle::positions but keeps the initial vector.
    140145                void resetPath();
    141146
    142147        private:
    143                 void init();
    144148                /// Particle mass [GeV]
    145149                double mp;
     
    172176                /// Adds a new vector (x,tx,y,ty,s) at the end of H_BeamParticle::positions
    173177                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);
    176178};
    177179#endif
Note: See TracChangeset for help on using the changeset viewer.