Fork me on GitHub

Changeset 281 in svn for trunk


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

new Hector version

Location:
trunk/Utilities/Hector
Files:
55 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/Hector/VERSION

    r3 r281  
    1 _1_4_0
     1_1_5_2pre
  • trunk/Utilities/Hector/include/H_AbstractBeamLine.h

    r216 r281  
    22#define _H_AbstractBeamLine_
    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
     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   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    821
    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 */
    1422
    1523/// \file H_AbstractBeamLine.h
    1624/// \brief Class aiming at simulating the LHC beamline.
    1725///
    18 /// Units : angles [ï¿œrad], distances [ï¿œm], energies [GeV], c=[1].
     26/// Units : angles [urad], distances [um], energies [GeV], c=[1].
    1927
    2028        /// default length of the beam line
     
    3947
    4048        public:
    41                 void init(const float );
    4249                ///     Constructors, destructor and operator
    4350                //@{
     
    5057                //@}
    5158                ///     Adds an element to the beamline
    52                 //@{
    5359                void add(H_OpticalElement *);
    54                 void add(H_OpticalElement &);
    55                 //@}
    5660                ///     Returns the (float) length of the beamline
    57                 inline float getLength() const { return beam_length;};
     61                const float getLength() const { return beam_length;};
    5862                ///     Returns the (int) number of optics element of the beamline, including drifts
    59                 inline int getNumberOfElements() const { return (int)elements.size();};
     63                const unsigned int getNumberOfElements() const { return elements.size();};
    6064                ///     Returns the transport matrix for the whole beam
    6165                const TMatrix getBeamMatrix() const;
     
    124128
    125129        private:
    126                 /// list of all optics elements, including drifts
    127                 vector<H_OpticalElement*> elements;
    128130                /// list of matrices, 1 matrix = the transport till the end of each element
    129131                vector<TMatrix> matrices;
    130132                /// transport matrix for the whole beam
    131                 TMatrix beam_mat;                       
     133                TMatrix beam_mat;
     134                /// list of all optics elements, including drifts
     135                vector<H_OpticalElement*> elements;
    132136                /// Orderting method for the vector of H_OpticalElement*
    133                 struct ordering{ bool operator()(H_OpticalElement* el1, H_OpticalElement* el2) const { return (*el1 < *el2);}};
     137                struct ordering{ bool operator()(const H_OpticalElement* el1, const H_OpticalElement* el2) const {return (*el1 < *el2);}};
     138                // private method for copying the contents of "elements"
     139                void cloneElements(const H_AbstractBeamLine&);
    134140
    135141        protected:
     142                void init(const float );
    136143                /// total length of the beamline
    137144                float beam_length;
     145        friend std::ostream& operator<< (std::ostream& os, const H_AbstractBeamLine& be);
    138146};
    139147
  • trunk/Utilities/Hector/include/H_Aperture.h

    r216 r281  
    22#define _H_Aperture_
    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_Aperture.h
     
    1825// C++ #defines
    1926#include <string>
     27#include <iostream>
    2028using namespace std;
    2129
    2230// local #defines
    23 #define NONE        0
    24 #define RECTANGULAR 1
    25 #define ELLIPTIC    2
    26 #define CIRCULAR    3
    27 #define RECTELLIPSE 4
     31enum {NONE=0, RECTANGULAR, ELLIPTIC, CIRCULAR, RECTELLIPSE};
    2832#define NONENAME        "None       "
    2933#define RECTANGULARNAME "Rectangle  "
     
    4347                H_Aperture& operator=(const H_Aperture&);
    4448                virtual ~H_Aperture() { };
    45                 virtual H_Aperture* clone() const { return new H_Aperture(type,x1,x2,x3,x4,fx,fy); };
     49                virtual H_Aperture* clone() const { return new H_Aperture(type_,x1,x2,x3,x4,fx,fy); };
    4650                //@}
    4751
    4852                /// Prints the aperture features
    49                 virtual void printProperties() const;
     53                //virtual void printProperties() const;
     54                void printProperties() const;
    5055                /// Draws the aperture shape
    5156                virtual void draw(const float scale=1) const {return;};
     
    5560                virtual bool isInside(const float, const float) const;
    5661                /// Returns the (int) type of aperture
    57                 inline int getType() const {return type;};
     62                inline int getType() const {return type_;};
    5863                /// Returns the (string) type of the aperture
    5964                inline const string getTypeString() const { return aptypestring; }
     
    6267        protected:
    6368                /// Aperture shape (either RECTANGULAR or ELLIPTIC or ...)
    64                 int type;
    65                 /// Aperture shape string
    66                 string aptypestring;
    67 
     69                int type_;
    6870                /// Aperture geometrical sizes (length/width or great/small radii) [m]
    6971                //@{
    7072                float x1, x2, x3, x4;
    7173                //@}
    72 
    7374                /// Horizontal coordinate of the aperture center [m] (from the nominal beam position).
    7475                //@{
    7576                float fx, fy;
    7677                //@}
    77                 /// Sets the name of the aperture from its type.
    78                 void setApertureString();
     78                /// Aperture shape string
     79                string aptypestring;
     80                // Sets the name of the aperture from its type.
     81                //void setApertureString();
     82                /// Gets the name of the aperture from its type.
     83                const string getApertureString() const;
     84
     85        friend std::ostream& operator<< (std::ostream& os, const H_Aperture& ap);
    7986};
    8087
     88
    8189#endif
  • trunk/Utilities/Hector/include/H_Beam.h

    r236 r281  
    22#define _H_Beam_
    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_Beam.h
     
    2734#include "TGraphErrors.h"
    2835#include "TMultiGraph.h"
     36#include "TMath.h"
    2937
    3038// local #includes
     
    5664        //@}
    5765        /// Fills the beam with particles in given position/angle/energy        intervals (flat distribution)
    58                 //void particleGun(const unsigned int Number_of_particles, const float E_min, const float E_max, const float fs_min, const float fs_max, const float fx_min, const float fx_max, const float fy_min, const float fy_max, const float tx_min, const float tx_max, const float ty_min, const float ty_max, const float p_mass, const double p_charge);
    59                 void particleGun(const unsigned int Number_of_particles, const float E_min=BE, const float E_max=BE, const float fs_min=0, const float fs_max=0, const float fx_min=0, const float fx_max=0, const float fy_min=0, const float fy_max=0, const float tx_min=-pi/2., const float tx_max=pi/2., const float ty_min=-pi/2., const float ty_max=pi/2., const float p_mass=MP, const double p_charge=QP, const bool flat = true);
     66                void particleGun(const unsigned int Number_of_particles, const float E_min=BE, const float E_max=BE, const float fs_min=0, const float fs_max=0, const float fx_min=0, const float fx_max=0, const float fy_min=0, const float fy_max=0, const float tx_min=-TMath::Pi()/2., const float tx_max=TMath::Pi()/2., const float ty_min=-TMath::Pi()/2., const float ty_max=TMath::Pi()/2., const float p_mass=MP, const double p_charge=QP, const bool flat = true, TRandom* r=gRandom);
    6067
    6168        /// Fills the beam with particles
    62         //@{
    63                 void createBeamParticles(const unsigned int , const double , const double );
    64                 void createBeamParticles(const unsigned int);
    65         //@}
     69                void createBeamParticles(const unsigned int Number_of_particles, const double p_mass=MP, const double p_charge=QP, TRandom* r=gRandom);
    6670        /// Fills the beam with particles with incremental offset and no initial transverse momentum
    6771        //@{
     
    8286                void add(const H_BeamParticle&);
    8387        /// Compute the position of each particle in the beamline
    84         //@{   
    85                 void computePath(const H_AbstractBeamLine *, const bool);
    86                 void computePath(const H_AbstractBeamLine *);
    87         //@}
     88                void computePath(const H_AbstractBeamLine * beamline, const bool NonLinear=false);
    8889        // Photon emission by the particle
    89         // @{
    90                 void emitGamma(const double, const double, const double, const double);
    91                 void emitGamma(const double, const double);
    92         //@}
     90                void emitGamma(const double gee, const double gq2, const double phimin=0, const double phimax=2*TMath::Pi());
    9391        // Propagates the beam until a given s
    9492                void propagate(const float );
     
    146144                void printInitialState() const;
    147145        /// Prints the properties for each particle
    148                 void printProperties() const;
     146                void printProperties() const {cout << *this; return;}
    149147        /// Prints the list of the stopping elements in the beamline
    150148                void printStoppingElements(const vector<H_OpticalElement>&, const vector<int>&) const;
     
    186184                unsigned int Nparticles;
    187185
    188         static const float pi = 3.14159265358979312;
     186        friend std::ostream& operator<< (std::ostream& os, const H_Beam& be);
    189187};
    190188
  • trunk/Utilities/Hector/include/H_BeamLine.h

    r216 r281  
    22#define _H_BeamLine_
    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_BeamLine.h
     
    3239        ///     Constructors and destructor
    3340        //@{
    34                 H_BeamLine():H_AbstractBeamLine() {direction=1; ips=0; };
     41                H_BeamLine();
    3542                H_BeamLine(const H_BeamLine& );
    3643                H_BeamLine(const int, const float);
     
    3946        //@
    4047                ///     Finds the IP position (s) from the MAD table. Should be "IP5" or "IP1".
    41                 //@{
    42                 void findIP(const string&);
    43                 void findIP(const string&, const string&);
    44                 //@}
     48                void findIP(const string& filename, const string& ipname="IP5");
    4549                ///     Reader for the external MAD table
    46                 //@{
    47                 void fill(const string&);
    48                 void fill(const string&, const int, const string& );
    49                 //@}
     50                void fill(const string& filename, const int dir=1, const string& ipname="IP5");
    5051                ///     Returns the IP position (s)
    51                 double getIP() {return ips;};
     52                double getIP() const {return ips;};
    5253                ///             Returns positions and angles of beam at IP
    5354                double* getIPProperties();
  • trunk/Utilities/Hector/include/H_BeamLineParser.h

    r216 r281  
    22#define _H_BeamLineParser_
    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_BeamLineParser.h
  • 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
  • trunk/Utilities/Hector/include/H_CircularAperture.h

    r216 r281  
    22#define _H_CircularAperture_
    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_CircularAperture.h
     
    2633                /// Constructors and destructor
    2734                //@{
    28                 H_CircularAperture():H_EllipticAperture(0,0,0,0) {type = CIRCULAR; setApertureString();}
    29                 H_CircularAperture(const float, const float, const float);
     35                H_CircularAperture():H_EllipticAperture(CIRCULAR,0,0,0,0) {};
     36                H_CircularAperture(const float r, const float posx, const float posy) : H_EllipticAperture(CIRCULAR,r,r,posx,posy) {};
     37                /// @param r is the radius of the circular shape
     38                /// @param posx, posy are the (x,y) coordinates of the center of the circle
    3039                ~H_CircularAperture() {};
    3140                H_CircularAperture* clone() const;
    3241                //@}
    33                 virtual void printProperties() const;
     42        friend std::ostream& operator<< (std::ostream& os, const H_CircularAperture& ap);
    3443};
    3544
  • trunk/Utilities/Hector/include/H_Dipole.h

    r216 r281  
    22/// \brief Class aiming at simulating LHC beam dipoles.
    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#ifndef _H_Dipole_
     
    3037                //@}
    3138                /// Prints the properties of the element
    32                 virtual void printProperties() const;
     39                virtual void printProperties() const { cout << *this; return;};
    3340                virtual H_Dipole* clone() const =0;
    3441                void init();
     
    3744                virtual void setTypeString() =0;
    3845                virtual void setMatrix(const float, const float, const float) = 0;
    39        
     46   
     47        friend std::ostream& operator<< (std::ostream& os, const H_Dipole& el);
    4048};
    4149
  • trunk/Utilities/Hector/include/H_Drift.h

    r216 r281  
    22#define _H_Drift_
    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_Drift.h
     
    3037                ~H_Drift() { };
    3138        //@}
    32                 virtual void printProperties() const;
    3339                void init();
     40                virtual void printProperties() const { cout << *this; return;};
    3441                H_Drift* clone() const;
    3542
     
    3744                virtual void setTypeString() {typestring = DRIFTNAME;};
    3845                virtual void setMatrix(const float, const float, const float) ;
     46        friend std::ostream& operator<< (std::ostream& os, const H_Drift& el);
    3947};
    4048
  • trunk/Utilities/Hector/include/H_EllipticAperture.h

    r216 r281  
    22#define _H_EllipticAperture_
    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_EllipticAperture.h
     
    2633                //@{
    2734                H_EllipticAperture():H_Aperture(ELLIPTIC,0,0,0,0,0,0) {}
     35                H_EllipticAperture(const int, const float, const float, const float, const float);
    2836                H_EllipticAperture(const float, const float, const float, const float);
    2937                ~H_EllipticAperture() {};
     
    3442                /// Draws the aperture shape.
    3543                virtual void draw(const float scale=1) const;
    36                 virtual void printProperties() const;
     44        friend std::ostream& operator<< (std::ostream& os, const H_EllipticAperture& ap);
    3745};
    3846
  • trunk/Utilities/Hector/include/H_HorizontalKicker.h

    r216 r281  
     1#ifndef _H_HorizontalKicker_
     2#define _H_HorizontalKicker_
     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   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
     21
    122/// \file H_HorizontalKicker.h
    223/// \brief Classes aiming at simulating horizontal kickers in beamline.
    324///
    425/// fk [rad] for kickers !!!!
    5 
    6 /*
    7 ---- Hector the simulator ----
    8    A fast simulator of particles through generic beamlines.
    9    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    10 
    11         http://www.fynu.ucl.ac.be/hector.html
    12 
    13    Centre de Physique des Particules et de Phénoménologie (CP3)
    14    Université Catholique de Louvain (UCL)
    15 */
    16 
    17 #ifndef _H_HorizontalKicker_
    18 #define _H_HorizontalKicker_
    1926
    2027// local #includes
  • trunk/Utilities/Hector/include/H_HorizontalQuadrupole.h

    r216 r281  
    22#define _H_HorizontalQuadrupole_
    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_HorizontalQuadrupole.h
  • trunk/Utilities/Hector/include/H_Kicker.h

    r216 r281  
     1#ifndef _H_Kicker_
     2#define _H_Kicker_
     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   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
     21
    122/// \file H_Kicker.h
    223/// \brief Classes aiming at simulating kickers in LHC beamline.
    324/// fk [rad] for kickers !!!!
    4 
    5 /*
    6 ---- Hector the simulator ----
    7    A fast simulator of particles through generic beamlines.
    8    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    9 
    10         http://www.fynu.ucl.ac.be/hector.html
    11 
    12    Centre de Physique des Particules et de Phénoménologie (CP3)
    13    Université Catholique de Louvain (UCL)
    14 */
    15 
    16 #ifndef _H_Kicker_
    17 #define _H_Kicker_
    1825
    1926// local #includes
     
    3138                virtual ~H_Kicker() {};
    3239        //@}
    33         /// prints the kicker properties
    34                 virtual void printProperties() const;
    3540                virtual H_Kicker* clone() const = 0;
     41                virtual void printProperties() const { cout << *this; return;};
    3642                void init();
    3743
     
    3945                virtual void setTypeString() = 0;
    4046                virtual void setMatrix(const float, const float, const float) = 0;
     47        friend std::ostream& operator<< (std::ostream& os, const H_Kicker& el);
    4148};
    4249
  • trunk/Utilities/Hector/include/H_Marker.h

    r216 r281  
    22#define _H_Marker_
    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_Marker.h
     
    3037                ~H_Marker() { };
    3138        //@}
    32                 virtual void printProperties() const;
    3339                H_Marker* clone() const ;
    3440                void init();
     
    3743                virtual void setTypeString() {typestring = MARKERNAME;};
    3844                virtual void setMatrix(const float , const float, const float) ;
     45        friend std::ostream& operator<< (std::ostream& os, const H_Marker& el);
    3946};
    4047
  • trunk/Utilities/Hector/include/H_OpticalElement.h

    r216 r281  
    22#define _H_OpticalElement_
    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_OpticalElement.h
     
    3643
    3744        // type #defines
    38 #define DRIFT        1
    39 #define RDIPOLE      2
    40 #define SDIPOLE      3
    41 #define VQUADRUPOLE  4
    42 #define HQUADRUPOLE  5
    43 #define VKICKER      6
    44 #define HKICKER      7
    45 #define RCOLLIMATOR  8
    46 #define ECOLLIMATOR  9
    47 #define CCOLLIMATOR 10
    48 #define RP          11
    49 #define IP          12
    50 #define MARKER      13
     45enum {DRIFT=1, RDIPOLE, SDIPOLE, VQUADRUPOLE, HQUADRUPOLE, VKICKER, HKICKER, RCOLLIMATOR, ECOLLIMATOR, CCOLLIMATOR, RP, IP, MARKER};
    5146
    5247        // typestring[30] #defines
     
    8277                //@}
    8378                ///     Prints the element features
    84                 virtual void printProperties() const ;
     79                virtual void printProperties() const { cout << *this; return;};
    8580                ///     Shows the element transport matrix
    8681                void showMatrix() const ;
     
    9085                void setAperture(const H_Aperture*);
    9186                ///     Ordering operator acting on the s coordinate
    92                 inline bool operator>(const H_OpticalElement tocomp) const {if(fs>tocomp.getS()) { return true; } else { return false; }};
     87                inline bool operator>(const H_OpticalElement& tocomp) const {return ( fs>tocomp.getS() ); };
    9388                ///     Ordering operator acting on the s coordinate
    94                 inline bool operator<(const H_OpticalElement tocomp) const {if(fs<tocomp.getS()) { return true; } else { return false; }};
     89                inline bool operator<(const H_OpticalElement& tocomp) const {return ( fs<tocomp.getS() ); };
    9590                ///     Copy operator
    9691                H_OpticalElement& operator=(const H_OpticalElement&);
     
    178173                //@}
    179174                virtual H_OpticalElement* clone() const { return new H_OpticalElement();};
    180                 TVectorD getHitPosition(TVectorD, double, double, double);
     175                TVectorD getHitPosition(const TVectorD& , const double, const double, const double);
    181176
    182177
     
    210205                virtual void setTypeString() {return;};
    211206                /// Optical element transport matrix.
    212             virtual void setMatrix(const float, const float, const float) { cout<<"dummy setmatrix"<<endl; return;};
     207                virtual void setMatrix(const float, const float, const float) { cout<<"dummy setmatrix"<<endl; return;};
    213208                /// Optical element transport matrix.
    214209                TMatrix element_mat;
    215210                /// Optical element aperture.
    216211                H_Aperture* element_aperture;
     212
     213        friend std::ostream& operator<< (std::ostream& os, const H_OpticalElement& el);
    217214};
    218215
  • trunk/Utilities/Hector/include/H_Parameters.h

    r235 r281  
    22#define _Hector_parameters_
    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         J.~de Favereau, X.~Rouby and K.~Piotrzkowski,
    11         Hector, a fast simulator for the transport of particles in beamlines,
    12         JINST 2, P09005 (2007)
    13         arXiv:0707.1198 [physics.acc-ph]
    14 
    15    Centre de Physique des Particules et de Phénoménologie (CP3)
    16    Université Catholique de Louvain (UCL)
    17 */
     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   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1821
    1922/// \file H_Parameters.h
  • trunk/Utilities/Hector/include/H_Quadrupole.h

    r216 r281  
    22#define _H_Quadrupole_
    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_Quadrupole.h
     
    3037                virtual ~H_Quadrupole() {};
    3138        //@}   
    32                 virtual void printProperties() const;
    3339                virtual H_Quadrupole* clone() const =0 ;
     40                virtual void printProperties() const { cout << *this; return;};
    3441                void init();
    3542
     
    3845                virtual void setMatrix(const float, const float, const float) = 0;
    3946               
     47        friend std::ostream& operator<< (std::ostream& os, const H_Quadrupole& el);
    4048};
    4149
  • trunk/Utilities/Hector/include/H_RecRPObject.h

    r3 r281  
    22#define _H_RecRPObject_
    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_RecRPObject.h
     
    2229#define NOT_YET_COMPUTED -666
    2330
     31/// Reconstruction of parameters at IP using measurements with roman pots
    2432class H_RecRPObject {
    2533        public:
    2634                H_RecRPObject();
    27                 H_RecRPObject(const float, const float, H_AbstractBeamLine* );
     35                H_RecRPObject(const float, const float, const H_AbstractBeamLine* );
    2836                H_RecRPObject(const H_RecRPObject&);
    2937                H_RecRPObject& operator=(const H_RecRPObject&);
    30                 ~H_RecRPObject() {if(f_1) delete f_1; if(f_2) delete f_2; if(g_1) delete g_1; if(g_2) delete g_2; if(d_1) delete d_1; if(d_2) delete d_2; if(k_1) delete k_1; if(k_2) delete k_2; if(l_1) delete l_1; if(l_2) delete l_2; };
     38                ~H_RecRPObject() {delete f_1; delete f_2; delete g_1; delete g_2;
     39                                  delete d_1; delete d_2; delete k_1; delete k_2;
     40                                  delete l_1; delete l_2;
     41                                  delete thebeam;};
    3142
    3243                inline float getX1() const {return x1;};
     
    6475                TF1* k_1, *k_2;
    6576                TF1* l_1, *l_2;
     77        friend std::ostream& operator<< (std::ostream& os, const H_RecRPObject& rp);
    6678};
    6779
  • trunk/Utilities/Hector/include/H_RectEllipticAperture.h

    r216 r281  
    22#define _H_RectEllipticAperture_
    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   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
     21
    422/// \file H_RectEllipticAperture.h
    523/// \brief Defines the Rect-Elliptic aperture of beamline elements.
    6 
    7 /*
    8 ---- Hector the simulator ----
    9    A fast simulator of particles through generic beamlines.
    10    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    11 
    12         http://www.fynu.ucl.ac.be/hector.html
    13 
    14    Centre de Physique des Particules et de Phénoménologie (CP3)
    15    Université Catholique de Louvain (UCL)
    16 */
    1724
    1825// local #includes
     
    3037                H_RectEllipticAperture* clone() const;
    3138                //@}
    32                 virtual void printProperties() const;
    3339                /// Checks whether the point is inside the aperture or not
    3440                virtual bool isInside(const float, const float) const;
    3541                /// Draws the aperture shape.
    3642                virtual void draw(const float scale=1) const;
     43        friend std::ostream& operator<< (std::ostream& os, const H_RectEllipticAperture& ap);
    3744};
    3845
  • trunk/Utilities/Hector/include/H_RectangularAperture.h

    r216 r281  
    22#define _H_RectangularAperture_
    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_RectangularAperture.h
     
    3441                /// Draws the aperture shape.
    3542                virtual void draw(const float scale=1) const;
    36                 virtual void printProperties() const;
     43        friend std::ostream& operator<< (std::ostream& os, const H_RectangularAperture& ap);
    3744};
    3845
  • trunk/Utilities/Hector/include/H_RectangularCollimator.h

    r216 r281  
    22#define _H_RectangularCollimator_
    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_RectangularCollimator.h
     
    3037                ~H_RectangularCollimator() {};
    3138        //@}
    32                 virtual void printProperties() const;
    3339                H_RectangularCollimator* clone() const;
    3440                void init();
     
    3642                virtual void setTypeString() {typestring=RCOLLIMATORNAME;};
    3743                virtual void setMatrix(const float, const float, const float) ;
    38 
     44       
     45        friend std::ostream& operator<< (std::ostream& os, const H_RectangularCollimator& el);
    3946};
    4047
  • trunk/Utilities/Hector/include/H_RectangularDipole.h

    r216 r281  
    22#define _H_RectangularDipole_
    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   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
     21
    422/// \file H_RectangularDipole.h
    523/// \brief Classes aiming at simulating LHC beam rectangular dipoles.
    6 
    7 /*
    8 ---- Hector the simulator ----
    9    A fast simulator of particles through generic beamlines.
    10    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    11 
    12         http://www.fynu.ucl.ac.be/hector.html
    13 
    14    Centre de Physique des Particules et de Phénoménologie (CP3)
    15    Université Catholique de Louvain (UCL)
    16 */
    1724
    1825#include "H_Dipole.h"
  • trunk/Utilities/Hector/include/H_RomanPot.h

    r216 r281  
    22#define _H_RomanPot_
    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   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
     21
    422/// \file H_RomanPot.h
    523/// \brief Roman pot class
    6 
    7 /*
    8 ---- Hector the simulator ----
    9    A fast simulator of particles through generic beamlines.
    10    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    11 
    12         http://www.fynu.ucl.ac.be/hector.html
    13 
    14    Centre de Physique des Particules et de Phénoménologie (CP3)
    15    Université Catholique de Louvain (UCL)
    16 */
    1724
    1825// local #includes
     
    3239                ~H_RomanPot() {};
    3340        //@}
    34                 virtual void printProperties() const;
    3541                H_RomanPot* clone() const ;
    3642                void init();
     
    3844                virtual void setTypeString() {typestring=RPNAME;};
    3945                virtual void setMatrix(const float, const float, const float) ;
    40 
     46        friend std::ostream& operator<< (std::ostream& os, const H_RomanPot& el);
    4147};
    4248
  • trunk/Utilities/Hector/include/H_SectorDipole.h

    r216 r281  
    1 /// \file H_SectorDipole.h
    2 /// \brief Classes aiming at simulating sector dipoles.
    3 
    41#ifndef _H_SectorDipole_
    52#define _H_SectorDipole_
    63
    7 /*
    8 ---- Hector the simulator ----
    9    A fast simulator of particles through generic beamlines.
    10    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
     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   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1121
    12         http://www.fynu.ucl.ac.be/hector.html
    13 
    14    Centre de Physique des Particules et de Phénoménologie (CP3)
    15    Université Catholique de Louvain (UCL)
    16 */
     22/// \file H_SectorDipole.h
     23/// \brief Classes aiming at simulating sector dipoles.
    1724
    1825#include "H_Dipole.h"
     
    2633                H_SectorDipole():H_Dipole(SDIPOLE,0.,0.,0.) {init();}
    2734                H_SectorDipole(const double s, const double k, const double l) :H_Dipole(SDIPOLE,s,k,l){init();}
    28                 H_SectorDipole(const string nameE, const double s, const double k, const double l) :H_Dipole(nameE,SDIPOLE,s,k,l){init();}
     35                H_SectorDipole(const string& nameE, const double s, const double k, const double l) :H_Dipole(nameE,SDIPOLE,s,k,l){init();}
    2936                ~H_SectorDipole() {};
    3037                //@}
  • trunk/Utilities/Hector/include/H_TransportMatrices.h

    r3 r281  
    22#define _H_TransportMatrices_
    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_TransportMatrices.h
  • trunk/Utilities/Hector/include/H_VerticalKicker.h

    r216 r281  
    22#define _H_VerticalKicker_
    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_VerticalKicker.h
     
    3037                H_VerticalKicker():H_Kicker(VKICKER,0.,0.,0.) {init();}
    3138                H_VerticalKicker(const double s, const double k, const double l) :H_Kicker(VKICKER,s,k,l){init();}
    32                 H_VerticalKicker(const string nameE, const double s, const double k, const double l) :H_Kicker(nameE,VKICKER,s,k,l){init();}
     39                H_VerticalKicker(const string& nameE, const double s, const double k, const double l) :H_Kicker(nameE,VKICKER,s,k,l){init();}
    3340                ~H_VerticalKicker() {};
    3441        //@}
  • trunk/Utilities/Hector/include/H_VerticalQuadrupole.h

    r216 r281  
    22#define _H_VerticalQuadrupole_
    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
     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   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    821
    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 */
    1422
    1523/// \file H_VerticalQuadrupole.h
     
    2735                H_VerticalQuadrupole():H_Quadrupole(VQUADRUPOLE,0.,0.,0.) {init();}
    2836                H_VerticalQuadrupole(const double s, const double k, const double l):H_Quadrupole(VQUADRUPOLE,s,k,l) {init();}
    29                 H_VerticalQuadrupole(string nameE, const double s, const double k, const double l):H_Quadrupole(nameE,VQUADRUPOLE,s,k,l) {init();}
    30                 ~H_VerticalQuadrupole() {};
    31         //@}
    32                 H_VerticalQuadrupole* clone() const ;
    33         private:
     37                H_VerticalQuadrupole(const string& nameE, const double s, const double k, const double l):H_Quadrupole(nameE,VQUADRUPOLE,s,k,l) {init();}
     38        ~H_VerticalQuadrupole() {};
     39//@}
     40        H_VerticalQuadrupole* clone() const ;
     41private:
    3442                virtual void setTypeString() {typestring = VQUADRUPOLENAME;} ;
    3543                virtual void setMatrix(const float, const float, const float) ;
  • trunk/Utilities/Hector/src/H_AbstractBeamLine.cc

    r264 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
    11 
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1218
    1319/// \file H_AbstractBeamLine.cc
     
    4551}
    4652
    47 H_AbstractBeamLine::H_AbstractBeamLine(const H_AbstractBeamLine& beamline) {
    48         elements = beamline.elements;
    49         matrices = beamline.matrices;
     53H_AbstractBeamLine::H_AbstractBeamLine(const H_AbstractBeamLine& beamline) :
     54        matrices(beamline.matrices)   {
     55        //elements = beamline.elements; //<-- bad ! the new vector contains the same pointers as the previous one
     56        cloneElements(beamline);
    5057        beam_mat.ResizeTo(MDIM,MDIM);
    5158        beam_mat = beamline.beam_mat;
     
    5562H_AbstractBeamLine& H_AbstractBeamLine::operator=(const H_AbstractBeamLine& beamline) {
    5663        if(this== &beamline) return *this;
    57         elements = beamline.elements;
     64        //elements = beamline.elements; //<-- bad ! the new vector contains the same pointers as the previous one
     65        cloneElements(beamline);
    5866        matrices = beamline.matrices;
    5967        beam_mat = beamline.beam_mat;
     
    8391        elements.clear();
    8492        matrices.clear();
     93}
     94
     95void H_AbstractBeamLine::cloneElements(const H_AbstractBeamLine& beam) {
     96        vector<H_OpticalElement*>::const_iterator element_i;
     97        for (element_i = beam.elements.begin(); element_i< beam.elements.end(); element_i++) {
     98                H_OpticalElement* temp_el = (*element_i)->clone();
     99                elements.push_back(temp_el);
     100        }
    85101}
    86102
     
    101117}
    102118
    103 void H_AbstractBeamLine::add(H_OpticalElement & newElement) {
    104         /// @param newElement is added to the beamline
    105 //      H_OpticalElement * el = new H_OpticalElement(newElement);
    106 //      elements.push_back(el);
    107         elements.push_back(&newElement);
    108         float a = newElement.getS()+newElement.getLength();
    109         if (a > beam_length)    {
    110                 beam_length = a;
    111                 if(VERBOSE) cout<<"<H_AbstractBeamLine> WARNING : element ("<< newElement.getName()<<") too far away. The beam length has been extended to "<< beam_length << ". "<<endl;
    112         }
    113         calcSequence();
    114         calcMatrix();
    115 }
    116 
    117119const TMatrix H_AbstractBeamLine::getBeamMatrix() const {
    118120        return beam_mat;
     
    205207}
    206208
    207 void H_AbstractBeamLine::printProperties() const {
    208         vector<H_OpticalElement*>::const_iterator element_i;
    209         cout << "Pointeurs des elements du faisceau" << endl;
    210         for (element_i = elements.begin(); element_i < elements.end(); element_i++) {
    211                 cout << (int)(element_i-elements.begin()) << "\t" << (*element_i)->getName() << "\t" << (*element_i)->getS() << endl;   
    212         }
    213         return;
    214 }
     209std::ostream& operator<< (std::ostream& os, const H_AbstractBeamLine& be) {
     210        vector<H_OpticalElement*>::const_iterator element_i;
     211        os << "Beamline content" << endl;
     212        for (element_i = be.elements.begin(); element_i < be.elements.end(); element_i++) {
     213                os << (int)(element_i - be.elements.begin()) << "\t" << (*element_i)->getName() << "\t" << (*element_i)->getS() << endl;
     214        }
     215  return os;
     216}
     217
     218void H_AbstractBeamLine::printProperties() const { cout << *this; return; }
    215219
    216220void H_AbstractBeamLine::showElements() const{
     
    485489        /// @param offset In meters
    486490
    487         extern bool relative_energy;
     491        extern int relative_energy;
    488492        if(!relative_energy) {
    489493                vector<H_OpticalElement*>::iterator element_i;
  • trunk/Utilities/Hector/src/H_Aperture.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_Aperture.cc
     
    2027using namespace std;
    2128
    22 H_Aperture::H_Aperture() {
    23         type = NONE;
    24         setApertureString();
    25         x1 = 0;
    26         x2 = 0;
    27         x3 = 0;
    28         x4 = 0;
    29         fx = 0;
    30         fy = 0;
     29H_Aperture::H_Aperture() :
     30        type_(NONE), x1(0), x2(0), x3(0), x4(0), fx(0), fy(0),  aptypestring(getApertureString()) {
    3131}
    3232
    33 H_Aperture::H_Aperture(const int dtype, const float size1, const float size2, const float size3, const float size4, const float posx, const float posy) {
     33H_Aperture::H_Aperture(const int dtype, const float size1, const float size2, const float size3, const float size4, const float posx, const float posy) :
     34        type_(dtype), x1(size1), x2(size2), x3(size3), x4(size4), fx(posx), fy(posy), aptypestring(getApertureString()) {
    3435    /// @param dtype defines the aperture shape
    3536        /// @param size1, size2, size3, size4 are the geometrical sizes (length/width or great/small radii) in m
    3637        /// @param posx, posy are the (x,y) coordinates of the center of the aperture [m]
    37         type = dtype;
    38         setApertureString();
    39         x1 = size1;
    40         x2 = size2;
    41         x3 = size3;
    42         x4 = size4;
    43         fx = posx;
    44         fy = posy;
    4538}
    4639
    47 H_Aperture::H_Aperture(const H_Aperture& ap) {
    48         type = ap.type;
    49         aptypestring = ap.aptypestring;
    50         x1 = ap.x1;
    51         x2 = ap.x2;
    52         x3 = ap.x3;
    53         x4 = ap.x4;
    54         fx = ap.fx;
    55         fy = ap.fy;
     40H_Aperture::H_Aperture(const H_Aperture& ap) :
     41        type_(ap.type_), x1(ap.x1), x2(ap.x2), x3(ap.x3), x4(ap.x4), fx(ap.fx), fy(ap.fy), aptypestring(ap.aptypestring) {
    5642}
    5743
    5844H_Aperture& H_Aperture::operator=(const H_Aperture& ap) {
    5945        if(this==&ap) return *this;
    60         type = ap.type;
    61         aptypestring = ap.aptypestring;
     46        type_ = ap.type_;
    6247        x1 = ap.x1;
    6348        x2 = ap.x2;
     
    6651        fx = ap.fx;
    6752        fy = ap.fy;
     53        aptypestring = ap.aptypestring;
    6854        return *this;
    6955}
    7056
     57std::ostream& operator<< (std::ostream& os, const H_Aperture& ap) {
     58        os << "Aperture shape:" << ap.aptypestring << ", parameters "<<ap.x1<<", "<<ap.x2<<", "<<ap.x3<<", "<<ap.x4<<endl;
     59        os << " \t Center : " << ap.fx << "," << ap.fy << endl;
     60        return os;
     61}
     62
    7163void H_Aperture::printProperties() const {
    72         cout << "Aperture shape:" << getTypeString() << ", parameters "<<x1<<", "<<x2<<", "<<x3<<", "<<x4<<endl;
    73         cout << " \t Center : " << fx << "," << fy << endl;
     64        cout << *this;
    7465        return;
    7566}
     
    9081
    9182
    92 void H_Aperture::setApertureString() {
    93         switch (type) {
     83/*void H_Aperture::setApertureString() {
     84        switch (type_) {
    9485                case NONE: aptypestring = NONENAME; break;
    9586                case RECTANGULAR: aptypestring = RECTANGULARNAME; break;
     
    10091        }
    10192}
     93*/
     94
     95const string H_Aperture::getApertureString() const {
     96        string str;
     97        switch (type_) {
     98                case NONE: str = NONENAME; break;
     99                case RECTANGULAR: str = RECTANGULARNAME; break;
     100                case ELLIPTIC: str = ELLIPTICNAME; break;
     101                case CIRCULAR: str = CIRCULARNAME; break;
     102                case RECTELLIPSE: str = RECTELLIPSENAME; break;
     103                default: str = NONENAME; break;
     104        }
     105        return str;
     106}
     107
  • trunk/Utilities/Hector/src/H_Beam.cc

    r233 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_Beam.cc
     
    5562};
    5663
    57 void H_Beam::createBeamParticles(const unsigned int Number_of_particles) {
    58         createBeamParticles(Number_of_particles,MP,QP);
    59 }
    60 
    61 void H_Beam::createBeamParticles(const unsigned int Number_of_particles, const double p_mass, const double p_charge) {
     64void H_Beam::createBeamParticles(const unsigned int Number_of_particles, const double p_mass, const double p_charge, TRandom* r) {
    6265        beamParticles.clear();
    6366        Nparticles = (Number_of_particles<1) ? 1 : Number_of_particles;
     
    6669                p.setPosition(fx_ini,fy_ini,tx_ini,ty_ini,fs_ini);
    6770                p.setE(fe_ini);
    68                 p.smearPos(x_disp,y_disp);
    69                 p.smearAng(tx_disp,ty_disp);
    70                 p.smearE(e_disp);
    71                 p.smearS(s_disp);
     71                p.smearPos(x_disp,y_disp,r);
     72                p.smearAng(tx_disp,ty_disp,r);
     73                p.smearE(e_disp,r);
     74                p.smearS(s_disp,r);
    7275                if (VERBOSE) {if (i==0) cout << " x_ini , tx_ini " << p.getX() << " " << p.getTX() << endl;}
    7376                beamParticles.push_back(p);
     
    7679
    7780//void H_Beam::particleGun(const unsigned int Number_of_particles, const float E_min=BE, const float E_max=BE, const float fs_min=0, const float fs_max=0, const float fx_min=0, const float fx_max=0, const float fy_min=0, const float fy_max=0, const float tx_min=-PI/2., const float tx_max=PI/2., const float ty_min=-PI/2., const float ty_max=PI/2., const float p_mass=MP, const double p_charge=QP) {
    78 void H_Beam::particleGun(const unsigned int Number_of_particles, const float E_min, const float E_max, const float fs_min, const float fs_max, const float fx_min, const float fx_max, const float fy_min, const float fy_max, const float tx_min, const float tx_max, const float ty_min, const float ty_max, const float p_mass, const double p_charge, const bool flat) {
     81void H_Beam::particleGun(const unsigned int Number_of_particles, const float E_min, const float E_max, const float fs_min, const float fs_max, const float fx_min, const float fx_max, const float fy_min, const float fy_max, const float tx_min, const float tx_max, const float ty_min, const float ty_max, const float p_mass, const double p_charge, const bool flat, TRandom* r) {
    7982        beamParticles.clear();
    8083        Nparticles = (Number_of_particles<2) ? 2 : Number_of_particles;
     
    8386                H_BeamParticle p(p_mass,p_charge);
    8487                if (flat) {
    85                         gx = gRandom->Uniform(fx_min,fx_max);
    86                         gy = gRandom->Uniform(fy_min,fy_max);
    87                         gs = gRandom->Uniform(fs_min,fs_max);
    88                         gtx = gRandom->Uniform(tx_min,tx_max);
    89                         gty = gRandom->Uniform(ty_min,ty_max);
    90                         gE = gRandom->Uniform(E_min,E_max);
     88                        gx = r->Uniform(fx_min,fx_max);
     89                        gy = r->Uniform(fy_min,fy_max);
     90                        gs = r->Uniform(fs_min,fs_max);
     91                        gtx = r->Uniform(tx_min,tx_max);
     92                        gty = r->Uniform(ty_min,ty_max);
     93                        gE = r->Uniform(E_min,E_max);
    9194                } else {
    92                         gx = gRandom->Gaus((fx_min+fx_max)/2,(-fx_min+fx_max)/2);
    93                         gy = gRandom->Gaus((fy_min+fy_max)/2,(-fy_min+fy_max)/2);
    94                         gs = gRandom->Gaus((fs_min+fs_max)/2,(-fs_min+fs_max)/2);
    95                         gtx = gRandom->Gaus((tx_min+tx_max)/2,(-tx_min+tx_max)/2);
    96                         gty = gRandom->Gaus((ty_min+ty_max)/2,(-ty_min+ty_max)/2);
    97                         gE = gRandom->Gaus ((E_min+E_max)/2,(-E_min+E_max)/2);
     95                        gx = r->Gaus((fx_min+fx_max)/2,(-fx_min+fx_max)/2);
     96                        gy = r->Gaus((fy_min+fy_max)/2,(-fy_min+fy_max)/2);
     97                        gs = r->Gaus((fs_min+fs_max)/2,(-fs_min+fs_max)/2);
     98                        gtx = r->Gaus((tx_min+tx_max)/2,(-tx_min+tx_max)/2);
     99                        gty = r->Gaus((ty_min+ty_max)/2,(-ty_min+ty_max)/2);
     100                        gE = r->Gaus ((E_min+E_max)/2,(-E_min+E_max)/2);
    98101                }
    99102                p.setPosition(gx,gy,gtx,gty,gs);
     
    179182}
    180183
    181 void H_Beam::computePath(const H_AbstractBeamLine * beamline) {
    182         computePath(beamline,false);
    183 }
    184 
    185184/// Propagates the beam until a given s
    186185void H_Beam::propagate(const float position) {
     
    189188                particle_i->propagate(position);
    190189        }
    191 }
    192 
    193 void H_Beam::emitGamma(const double gee, const double gq2) {
    194         /// @param gee = \f$ E_{\gamma} \f$ is the photon energy
    195         /// @param gq2 = \f$ Q^2 < 0 \f$ is virtuality of photon \f$ Q^{2} = E^{2}-\vec{k}^{2} \f$
    196         emitGamma(gee,gq2,0,2*pi);
    197190}
    198191
     
    386379}
    387380
    388 void H_Beam::printProperties() const {
     381std::ostream& operator<< (std::ostream& os, const H_Beam& be) {
    389382        vector<H_BeamParticle>::const_iterator particle_i;
    390         cout << "There are " << Nparticles << " in the beam." << endl;
    391         for (particle_i = beamParticles.begin();particle_i < beamParticles.end(); particle_i++) {
    392                 particle_i->printProperties();
    393         }
     383        cout << "There are " << be.Nparticles << " in the beam." << endl;
     384        for (particle_i = be.beamParticles.begin(); particle_i < be.beamParticles.end(); particle_i++) {
     385                cout << *particle_i;
     386        }
     387   return os;
    394388}
    395389
  • trunk/Utilities/Hector/src/H_BeamLine.cc

    r238 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_BeamLine.cc
     
    3946// are opposite to Wille's. See fill() for more details.
    4047
    41 H_BeamLine::H_BeamLine(const int si, const float length) : H_AbstractBeamLine(length){
    42         direction = (si >= abs(si)) ? 1 : -1;
    43         ips=0;
    44         ipx=0;
    45         ipy=0;
    46         iptx=0;
    47         ipty=0;
    48 }
    49 
    50 H_BeamLine::H_BeamLine(const H_BeamLine& beam) : H_AbstractBeamLine(beam) {
     48H_BeamLine::H_BeamLine(): H_AbstractBeamLine(),
     49        direction(1), ips(0), ipx(0), ipy(0), iptx(0), ipty(0) {
     50}
     51
     52H_BeamLine::H_BeamLine(const int si, const float length) : H_AbstractBeamLine(length),
     53        direction((si >= abs(si)) ? 1 : -1), ips(0), ipx(0), ipy(0), iptx(0), ipty(0) {
     54}
     55
     56H_BeamLine::H_BeamLine(const H_BeamLine& beam) : H_AbstractBeamLine(beam),
     57        direction(beam.direction), ips(beam.ips), ipx(beam.ipx), ipy(beam.ipy), iptx(beam.iptx), ipty(beam.ipty) {
     58}
     59
     60H_BeamLine& H_BeamLine::operator=(const H_BeamLine& beam) {
     61        if(this==&beam) return *this;
     62        H_AbstractBeamLine::operator=(beam); // call the mother's operator=
    5163        direction = beam.direction;
    5264        ips = beam.ips;
     
    5567        iptx = beam.iptx;
    5668        ipty = beam.ipty;
    57 }
    58 
    59 H_BeamLine& H_BeamLine::operator=(const H_BeamLine& beam) {
    60         if(this==&beam) return *this;
    61         direction = beam.direction;
    62         ips = beam.ips;
    63         ipx = beam.ipx;
    64     ipy = beam.ipy;
    65     iptx = beam.iptx;
    66     ipty = beam.ipty;
    6769        return *this;
    68 }
    69 
    70 void H_BeamLine::findIP(const string& filename) {
    71         findIP(filename,"IP5");
    72         return;
    7370}
    7471
     
    125122        temp[3] = ipty;
    126123        return temp;
    127 }
    128 
    129 void H_BeamLine::fill(const string& filename) {
    130         fill(filename,1,"IP5");
    131         return;
    132124}
    133125
  • trunk/Utilities/Hector/src/H_BeamLineParser.cc

    r216 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_BeamLineParser.cc
    1320/// \brief Reader for madx tables
    1421///
    15 /// Notes : Vï¿œifier que tous les SBEND sont toujours appelï¿œ MB. Et seulement comme ï¿œ !
    16 /// Vï¿œifier qu'il n'y a pas de problï¿œe d'inversion H/V QUADRUPOLES
     22/// Notes : Verifier que tous les SBEND sont toujours appeles MB. Et seulement comme ca !
     23/// Verifier qu'il n'y a pas de problemes d'inversion H/V QUADRUPOLES
    1724/// no distinction between H and Vkickers ?
    1825/// The identification of the element is based on the values of k1l, k2l, hkick, vkick and on their name.
  • trunk/Utilities/Hector/src/H_BeamParticle.cc

    r240 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_BeamParticle.cc
     
    3946using namespace std;
    4047
    41 void H_BeamParticle::init() {
     48void H_BeamParticle::init() { // for more efficiency, put the objects away from init!
    4249        mp = MP;
    4350        qp = QP;
     
    5764}
    5865
    59 H_BeamParticle::H_BeamParticle() {
     66H_BeamParticle::H_BeamParticle() { 
    6067        init();
    6168}
    6269
    63 H_BeamParticle::H_BeamParticle(const H_BeamParticle& p) {
    64         mp = p.mp;
    65         qp = p.qp;
    66         fx = p.fx;
    67         fy = p.fy;
    68         thx = p.thx;
    69         thy = p.thy;
    70         fs = p.fs;
    71         energy = p.energy;
    72         hasstopped = p.hasstopped;
    73         hasemitted = p.hasemitted;
    74         isphysical = p.isphysical;
    75         stop_position = new TVectorD(*(p.stop_position));
     70H_BeamParticle::H_BeamParticle(const H_BeamParticle& p):
     71        mp(p.mp), qp(p.qp), fs(p.fs), fx(p.fx), fy(p.fy), thx(p.thx), thy(p.thy),
     72        energy(p.energy), hasstopped(p.hasstopped), hasemitted(p.hasemitted),
     73        isphysical(p.isphysical), stop_position(new TVectorD(*(p.stop_position))),
     74        stop_element(0), positions(p.positions) {
    7675        if(p.hasstopped) stop_element = new H_OpticalElement(*(p.stop_element));
    77         positions = p.positions;
    7876}
    7977
     
    10098        stop_position = new TVectorD(*(p.stop_position));
    10199        if(p.hasstopped) stop_element = new H_OpticalElement(*(p.stop_element));
     100        else stop_element = 0;
    102101        positions = p.positions;
    103102        return *this;
    104103}
    105104
    106 bool H_BeamParticle::stopped(const H_AbstractBeamLine * beamline) {
     105const bool H_BeamParticle::stopped(const H_AbstractBeamLine * beamline) {
    107106        vector<TVectorD>::const_iterator position_i;
    108107        for(position_i = positions.begin(); position_i < positions.end()-1; position_i++) {
     
    159158}
    160159
    161 void H_BeamParticle::smearPos(const double dx,const double dy) {
     160
     161
     162void H_BeamParticle::smearPos(const double dx,const double dy, TRandom* r) {
    162163  // the beam is centered on (fx,fy) at IP
    163         fx = gRandom->Gaus(fx,dx);
    164         fy = gRandom->Gaus(fy,dy);
     164        fx = r->Gaus(fx,dx);
     165        fy = r->Gaus(fy,dy);
     166        positions.clear();
     167        addPosition(fx,thx,fy,thy,fs);
     168        return;
     169}
     170
     171void H_BeamParticle::smearAng(const double tx, const double ty, TRandom* r) {
     172  // the beam transverse direction is centered on (thx,thy) at IP
     173        thx = r->Gaus(thx,tx);
     174        thy = r->Gaus(thy,ty);
    165175        positions.clear();
    166176        addPosition(fx,thx,fy,thy,fs);
     
    168178}
    169179
    170 void H_BeamParticle::smearPos() {
    171   // the beam is centered on (fx,fy) at IP
    172         fx = gRandom->Gaus(fx,SX);
    173         fy = gRandom->Gaus(fy,SY);
    174         positions.clear();
    175         addPosition(fx,thx,fy,thy,fs);
    176         return;
    177 }
    178 
    179 void H_BeamParticle::smearAng(const double tx, const double ty) {
    180   // the beam transverse direction is centered on (thx,thy) at IP
    181         thx = gRandom->Gaus(thx,tx);
    182         thy = gRandom->Gaus(thy,ty);
    183         positions.clear();
    184         addPosition(fx,thx,fy,thy,fs);
    185         return;
    186 }
    187 
    188 void H_BeamParticle::smearAng() {
    189    // the beam transverse direction is centered on (thx,thy) at IP
    190         thx = gRandom->Gaus(thx,STX);
    191         thy = gRandom->Gaus(thy,STY);
    192         positions.clear();
    193         addPosition(fx,thx,fy,thy,fs);
    194         return;
    195 }
    196 
    197 void H_BeamParticle::smearE(const double erre) {
    198         energy = gRandom->Gaus(energy,erre);
    199         return;
    200 }
    201 
    202 void H_BeamParticle::smearE() {
    203         energy = gRandom->Gaus(energy,SBE);
    204         return;
    205 }
    206 
    207 void H_BeamParticle::smearS(const double errs) {
    208         fs= gRandom->Gaus(fs,errs);
     180void H_BeamParticle::smearE(const double erre, TRandom* r) {
     181        energy = r->Gaus(energy,erre);
     182        return;
     183}
     184
     185void H_BeamParticle::smearS(const double errs, TRandom* r) {
     186        fs= r->Gaus(fs,errs);
    209187        positions.clear();
    210188        addPosition(fx,thx,fy,thy,fs);
     
    212190}
    213191
    214 void H_BeamParticle::smearS() {
    215         fs = gRandom->Gaus(fs,SS);
    216         positions.clear();
    217         addPosition(fx,thx,fy,thy,fs);
    218         return;
    219 }
    220192
    221193void H_BeamParticle::set4Momentum(const double px, const double py, const double pz, const double ene) {
     
    267239        if(hasstopped) return stop_element;
    268240        else { H_OpticalElement * dummy_el = new H_Drift("",0,0); return dummy_el;}
    269 }
    270 
    271 void H_BeamParticle::emitGamma(const double gee, const double gq2) {
    272         emitGamma(gee,gq2,0,2*pi);
    273         return;
    274241}
    275242
     
    362329}
    363330
    364 void H_BeamParticle::printProperties() const {
    365         cout << " M   = " << getM()  << "GeV ";
    366         cout << " Q   = " << getQ()  << "e";
    367         cout << " fx  = " << getX()  << "m   ";
    368         cout << " fy  = " << getY()  << "m   ";
    369         cout << " thx = " << getTX() << "rad ";
    370         cout << " thy = " << getTY() << "rad ";
    371         cout << endl;
    372         return;
     331std::ostream& operator<< (std::ostream& os, const H_BeamParticle& p) {
     332        os << " M   = " << p.getM()  << "GeV ";
     333        os << " Q   = " << p.getQ()  << "e";
     334        os << " fx  = " << p.getX()  << "m   ";
     335        os << " fy  = " << p.getY()  << "m   ";
     336        os << " thx = " << p.getTX() << "rad ";
     337        os << " thy = " << p.getTY() << "rad ";
     338        os << endl;
     339   return os;
    373340}
    374341
     
    491458        delete [] graph;
    492459        return ppath;
    493 }
    494 
    495 void H_BeamParticle::computePath(const H_AbstractBeamLine * beam) {
    496         computePath(beam,true);
    497460}
    498461
  • trunk/Utilities/Hector/src/H_CircularAperture.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_CircularAperture.cc
     
    2330using namespace std;
    2431
    25 /// Circular apertures
    26 H_CircularAperture::H_CircularAperture(const float r, const float posx, const float posy) :H_EllipticAperture(r,r,posx,posy) {
    27         /// @param r is the radius of the circular shape
    28         /// @param posx, posy are the (x,y) coordinates of the center of the circle
    29         type= CIRCULAR;
    30 }
    31 
    3232H_CircularAperture* H_CircularAperture::clone() const {
    3333        return new H_CircularAperture(x1,fx,fy);
    3434}
    3535
    36 void H_CircularAperture::printProperties() const {
    37         cout << "Aperture shape:" << getTypeString() << ", aperture radius : " << x1 << endl;
    38         cout << " \t Center : " << fx << "," << fy << endl;
    39         return;
     36std::ostream& operator<< (std::ostream& os, const H_CircularAperture& ap) {
     37        os     << "Aperture shape:" << ap.aptypestring << ", aperture radius : " << ap.x1 << endl;
     38        os     << " \t Center : " << ap.fx << "," << ap.fy << endl;
     39        return os;
    4040}
  • trunk/Utilities/Hector/src/H_Dipole.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_Dipole.cc
     
    2532}
    2633
    27 void H_Dipole::printProperties() const {
    28         cout << typestring;
    29         cout << name;
    30         cout<<"\t at s = "<< fs;
    31         cout<<"\t length = "<< element_length;
    32         cout<<"\t k0 = "<<fk;
    33         cout<<endl;
    34         if(element_aperture->getType()!=NONE) {
    35                 cout <<"\t aperture type = " << element_aperture->getTypeString();
    36                 element_aperture->printProperties();
     34std::ostream& operator<< (std::ostream& os, const H_Dipole& el) {
     35        os << el.typestring << el.name <<"\t at s = "<< el.fs <<"\t length = "<< el.element_length <<"\t k0 = "<<el.fk << endl;
     36        if(el.element_aperture->getType()!=NONE) {
     37                os << *(el.element_aperture) << endl;
    3738        }
    3839
    39         if(element_length<0)  { if(VERBOSE) cout<<"<H_Dipole> ERROR : Interpenetration of elements !"<<endl; }
    40         if(element_length==0) { if(VERBOSE) cout<<"<H_Dipole> WARNING : 0-length "<< name << " !" << endl; }
     40        if(el.element_length<0)  { if(VERBOSE) os <<"<H_Dipole> ERROR : Interpenetration of elements !"<<endl; }
     41        if(el.element_length==0) { if(VERBOSE) os <<"<H_Dipole> WARNING : 0-length "<< el.name << " !" << endl; }
     42   return os;
    4143}
  • trunk/Utilities/Hector/src/H_Drift.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_Drift.cc
     
    2633}
    2734
    28 void H_Drift::printProperties() const {
    29         cout << typestring << name;
    30         cout << "\t\t at s = " << fs;
    31         cout << "\t length = " << element_length;
    32         cout<<endl;
    33         if(element_aperture->getType()!=NONE) {
    34                 cout <<"\t aperture type = " << element_aperture->getTypeString();
    35                 element_aperture->printProperties();
     35std::ostream& operator<< (std::ostream& os, const H_Drift& el) {
     36        os << el.typestring << el.name << "\t\t at s = " << el.fs << "\t length = " << el.element_length <<endl;
     37        if(el.element_aperture->getType()!=NONE) {
     38                os << *(el.element_aperture) << endl;
    3639        }
    37         if(element_length<0)  { if(VERBOSE) cout<<"<H_Drift> ERROR : Interpenetration of elements !"<<endl; }
    38         if(element_length==0) { if(VERBOSE) cout<<"<H_Drift> WARNING : 0-length "<< name << " !" << endl; }
     40        if(el.element_length<0 && VERBOSE) os <<"<H_Drift> ERROR : Interpenetration of elements !"<<endl;
     41        else if(el.element_length==0 && VERBOSE) os <<"<H_Drift> WARNING : 0-length "<< el.name << " !" << endl;
     42   return os;
    3943}
    4044
  • trunk/Utilities/Hector/src/H_EllipticAperture.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_EllipticAperture.cc
     
    2532using namespace std;
    2633
    27 H_EllipticAperture::H_EllipticAperture(const float l, const float h, const float posx, const float posy) :H_Aperture(ELLIPTIC,l,h,0,0,posx,posy) {
     34H_EllipticAperture::H_EllipticAperture(const int type, const float l, const float h, const float posx, const float posy) :
     35        H_Aperture(type,l,h,0,0,posx,posy) {
     36        /// @param type is the aperture type (ELLIPTIC or CIRCULAR)
     37        /// @param l, h are the length and height of the elliptic shape
     38        /// @param posx, posy are the (x,y) coordinates of the center of the ellipse
     39
     40        if (type!= ELLIPTIC && type != CIRCULAR) {
     41                cout << "Warning: trying to define an EllipticalAperture which is neither elliptical nor circular." << endl;
     42                cout << "'Elliptical' type forced\n";
     43                type_ = ELLIPTIC;
     44                aptypestring = getApertureString();
     45        }
     46}
     47
     48H_EllipticAperture::H_EllipticAperture(const float l, const float h, const float posx, const float posy) :
     49        H_Aperture(ELLIPTIC,l,h,0,0,posx,posy) {
    2850        /// @param l, h are the length and height of the elliptic shape
    2951        /// @param posx, posy are the (x,y) coordinates of the center of the ellipse
     
    4870}
    4971
    50 void H_EllipticAperture::printProperties() const {
    51         cout<< "Aperture shape:" << getTypeString() << ", ellipse axes : "<<x1<<", "<<x2<<endl;
    52         cout << " \t Center : " << fx << "," << fy << endl;
    53         return;
     72std::ostream& operator<< (std::ostream& os, const H_EllipticAperture& ap) {
     73        os<< "Aperture shape:" << ap.aptypestring << ", ellipse axes : "<< ap.x1 <<", " << ap.x2 << endl;
     74        os << " \t Center : "  << ap.fx << "," << ap.fy << endl;
     75        return os;
    5476}
  • trunk/Utilities/Hector/src/H_HorizontalKicker.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_HorizontalKicker.cc
  • trunk/Utilities/Hector/src/H_HorizontalQuadrupole.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_HorizontalQuadrupole.cc
  • trunk/Utilities/Hector/src/H_Kicker.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_Kicker.cc
     
    2734}
    2835
    29 void H_Kicker::printProperties() const {
    30         cout << typestring;
    31         cout << name;
    32         cout<<"\t at s = "<< fs;
    33         cout<<"\t length = "<< element_length;
    34         cout<<"\t k0 = "<<fk;
    35         cout<<endl;
    36         if(element_aperture->getType()!=NONE) {
    37                 cout <<"\t aperture type = " << element_aperture->getTypeString();
    38                 element_aperture->printProperties();
     36std::ostream& operator<< (std::ostream& os, const H_Kicker& el) {
     37        os << el.typestring << el.name <<"\t at s = "<< el.fs <<"\t length = "<< el.element_length;
     38        os<<"\t k0 = "<< el.fk <<endl;
     39        if(el.element_aperture->getType()!=NONE) {
     40                os << *(el.element_aperture) << endl;
    3941        }
    4042
    41         if(element_length<0)  { if(VERBOSE) cout<<"<H_Kicker> ERROR : Interpenetration of elements !"<<endl; }
    42         if(element_length==0) { if(VERBOSE) cout<<"<H_Kicker> WARNING : 0-length "<< name << " !" << endl; }
     43        if(el.element_length<0 && VERBOSE) os<<"<H_Kicker> ERROR : Interpenetration of elements !"<<endl;
     44        else if(el.element_length==0 && VERBOSE) os<<"<H_Kicker> WARNING : 0-length "<< el.name << " !" << endl;
     45  return os;
    4346}
  • trunk/Utilities/Hector/src/H_Marker.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_Marker.cc
     
    2431}
    2532
    26 void H_Marker::printProperties() const {
    27         cout << typestring << name;
    28         cout << "\t\t at s = " << fs << endl;
    29         if(element_aperture->getType()!=NONE) {
    30                 cout <<"\t aperture type = " << element_aperture->getTypeString();
    31                 element_aperture->printProperties();
     33std::ostream& operator<< (std::ostream& os, const H_Marker& el) {
     34        os << el.typestring << el.name << "\t\t at s = " << el.fs;
     35        if(el.element_aperture->getType()!=NONE) {
     36                os << *(el.element_aperture) << endl;
    3237        }
     38   return os;
    3339}
    3440
  • trunk/Utilities/Hector/src/H_OpticalElement.cc

    r239 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_OpticalElement.cc
     
    135142*/
    136143
    137 
    138 
    139 void H_OpticalElement::printProperties() const {
    140                 cout << typestring;
    141                 cout << name;
    142                 cout <<"\t at s = " << fs;
    143                 cout <<"\t length = "<< element_length;
    144                 if(fk!=0) cout <<"\t strength = " << fk;
    145                 if(element_aperture->getType()!=NONE) {
    146                         cout <<"\t aperture type = " << element_aperture->getTypeString();
    147                         element_aperture->printProperties();                   
    148                 }
    149        
    150                 cout<<endl;
    151                 if(element_length<0)  { if(VERBOSE) cout<<"<H_OpticalElement> ERROR : Interpenetration of elements !"<<endl; }
    152                 if(element_length==0) { if(VERBOSE) cout<<"<H_OpticalElement> WARNING : 0-length "<< typestring << " !" << endl; }
    153 
    154  return;
     144std::ostream& operator<< (std::ostream& os, const H_OpticalElement& el) {
     145        os << el.typestring << el.name << "\t at s = " << el.fs << "\t length = "<< el.element_length;
     146        if(el.fk!=0) os <<"\t strength = " << el.fk;
     147        if(el.element_aperture->getType()!=NONE) {
     148                os << *(el.element_aperture) << endl;
     149        }
     150        os<<endl;
     151        if(el.element_length<0 && VERBOSE)
     152                os <<"<H_OpticalElement> ERROR : Interpenetration of elements !"<<endl;
     153        else if(el.element_length==0 && VERBOSE)
     154                os <<"<H_OpticalElement> WARNING : 0-length "<< el.typestring << " !" << endl;
     155  return os;
    155156}
    156157
     
    189190}
    190191
    191 TVectorD H_OpticalElement::getHitPosition(TVectorD init_pos, double energy_loss, double mp, double qp) {
     192TVectorD H_OpticalElement::getHitPosition(const TVectorD& init_pos, const double energy_loss, const double mp, const double qp) {
    192193        if(!element_length) {
    193194                // cout<<"O-length element ("<<getName()<<"), should not appear here !"<<endl;
     
    196197        // some declarations
    197198        bool inside = false;
    198         double vec[MDIM] = {init_pos[INDEX_X]/URAD,tan(init_pos[INDEX_TX]/URAD),init_pos[INDEX_Y]/URAD,tan(init_pos[INDEX_TY]/URAD),-energy_loss,1};
     199        double vec[MDIM] = {init_pos[INDEX_X]/URAD,  tan(init_pos[INDEX_TX]/URAD),
     200                            init_pos[INDEX_Y]/URAD,  tan(init_pos[INDEX_TY]/URAD),
     201                            -energy_loss,            1};
    199202        TMatrixD mat_init(1,MDIM,vec);
    200203        TMatrixD mat_min(1,MDIM,vec);
     
    253256                mat_min[0][1] = mat_min[0][1] + tan(temp_el->getTX());
    254257                mat_min[0][2] = mat_min[0][2] + temp_el->getY();
    255             mat_min[0][3] = mat_min[0][3] + tan(temp_el->getTY());
     258                mat_min[0][3] = mat_min[0][3] + tan(temp_el->getTY());
    256259                mat_min[0][4] = min_pos + init_pos[4];
    257260                // getting vector at max_pos (for second boundary) :
    258261                temp_el->setLength(max_pos);
    259262                mat_max[0][0] = mat_init[0][0] - temp_el->getX();
    260             mat_max[0][1] = mat_init[0][1] - tan(temp_el->getTX());
    261                 mat_max[0][2] = mat_init[0][2] - temp_el->getY();
    262             mat_max[0][3] = mat_init[0][3] - tan(temp_el->getTY());
    263             mat_max *= temp_el->getMatrix(energy_loss,mp,qp);
    264             mat_max[0][0] = mat_max[0][0] + temp_el->getX();
    265             mat_max[0][1] = mat_max[0][1] + tan(temp_el->getTX());
    266             mat_max[0][2] = mat_max[0][2] + temp_el->getY();
    267         mat_max[0][3] = mat_max[0][3] + tan(temp_el->getTY());
     263                mat_max[0][1] = mat_init[0][1] - tan(temp_el->getTX());
     264                mat_max[0][2] = mat_init[0][2] - temp_el->getY();
     265                mat_max[0][3] = mat_init[0][3] - tan(temp_el->getTY());
     266                mat_max *= temp_el->getMatrix(energy_loss,mp,qp);
     267                mat_max[0][0] = mat_max[0][0] + temp_el->getX();
     268                mat_max[0][1] = mat_max[0][1] + tan(temp_el->getTX());
     269                mat_max[0][2] = mat_max[0][2] + temp_el->getY();
     270                mat_max[0][3] = mat_max[0][3] + tan(temp_el->getTY());
    268271                mat_max[0][4] = max_pos + init_pos[4];
    269272        }
    270273        // getting vector in the middle (for estimate) :
    271274        temp_el->setLength((max_pos+min_pos)/2.);
    272     mat_stop[0][0] = mat_init[0][0] - temp_el->getX();
    273     mat_stop[0][1] = mat_init[0][1] - tan(temp_el->getTX());
    274     mat_stop[0][2] = mat_init[0][2] - temp_el->getY();
    275     mat_stop[0][3] = mat_init[0][3] - tan(temp_el->getTY());
    276     mat_stop *= temp_el->getMatrix(energy_loss,mp,qp);
    277     mat_stop[0][0] = mat_stop[0][0] + temp_el->getX();
    278     mat_stop[0][1] = mat_stop[0][1] + tan(temp_el->getTX());
    279     mat_stop[0][2] = mat_stop[0][2] + temp_el->getY();
    280     mat_stop[0][3] = mat_stop[0][3] + tan(temp_el->getTY());
     275        mat_stop[0][0] = mat_init[0][0] - temp_el->getX();
     276        mat_stop[0][1] = mat_init[0][1] - tan(temp_el->getTX());
     277        mat_stop[0][2] = mat_init[0][2] - temp_el->getY();
     278        mat_stop[0][3] = mat_init[0][3] - tan(temp_el->getTY());
     279        mat_stop *= temp_el->getMatrix(energy_loss,mp,qp);
     280        mat_stop[0][0] = mat_stop[0][0] + temp_el->getX();
     281        mat_stop[0][1] = mat_stop[0][1] + tan(temp_el->getTX());
     282        mat_stop[0][2] = mat_stop[0][2] + temp_el->getY();
     283        mat_stop[0][3] = mat_stop[0][3] + tan(temp_el->getTY());
    281284        mat_stop[0][4] = (max_pos+min_pos)/2. + init_pos[4];
    282285
    283     double xys[LENGTH_VEC];
    284     xys[INDEX_X]=  mat_stop[0][0]*URAD;
    285     xys[INDEX_TX]= atan(mat_stop[0][1])*URAD;
    286     xys[INDEX_Y]=  mat_stop[0][2]*URAD;
    287     xys[INDEX_TY]= atan(mat_stop[0][3])*URAD;
    288     xys[INDEX_S]=  mat_stop[0][4] ;
    289     TVectorD temp_vec(LENGTH_VEC,xys);
     286        double xys[LENGTH_VEC];
     287        xys[INDEX_X]=  mat_stop[0][0]*URAD;
     288        xys[INDEX_TX]= atan(mat_stop[0][1])*URAD;
     289        xys[INDEX_Y]=  mat_stop[0][2]*URAD;
     290        xys[INDEX_TY]= atan(mat_stop[0][3])*URAD;
     291        xys[INDEX_S]=  mat_stop[0][4] ;
     292        TVectorD temp_vec(LENGTH_VEC,xys);
    290293
    291294        if(precision_estimate) {
     
    297300                cout<<" - "<<fabs(((mat_min[0][0]<mat_max[0][0])?(mat_stop[0][0]-mat_min[0][0])*URAD:(mat_stop[0][0]-mat_max[0][0])*URAD))<<" µm"<<endl;
    298301                cout<<"\t hit point y  : "<<mat_stop[0][2]*URAD;
    299         cout<<" + "<<fabs(((mat_min[0][0]<mat_max[0][2])?(mat_max[0][2]-mat_stop[0][2])*URAD:(mat_min[0][2]-mat_stop[0][2])*URAD));
    300         cout<<" - "<<fabs(((mat_min[0][0]<mat_max[0][2])?(mat_stop[0][2]-mat_min[0][2])*URAD:(mat_stop[0][2]-mat_max[0][2])*URAD))<<" µm"<<endl;
    301         cout<<"\t hit point tx : "<<mat_stop[0][1]*URAD;
    302         cout<<" + "<<fabs(((mat_min[0][0]<mat_max[0][1])?(mat_max[0][1]-mat_stop[0][1])*URAD:(mat_min[0][1]-mat_stop[0][1])*URAD));
    303         cout<<" - "<<fabs(((mat_min[0][0]<mat_max[0][1])?(mat_stop[0][1]-mat_min[0][1])*URAD:(mat_stop[0][1]-mat_max[0][1])*URAD))<<" µrad"<<endl;
     302                cout<<" + "<<fabs(((mat_min[0][0]<mat_max[0][2])?(mat_max[0][2]-mat_stop[0][2])*URAD:(mat_min[0][2]-mat_stop[0][2])*URAD));
     303                cout<<" - "<<fabs(((mat_min[0][0]<mat_max[0][2])?(mat_stop[0][2]-mat_min[0][2])*URAD:(mat_stop[0][2]-mat_max[0][2])*URAD))<<" µm"<<endl;
     304                cout<<"\t hit point tx : "<<mat_stop[0][1]*URAD;
     305                cout<<" + "<<fabs(((mat_min[0][0]<mat_max[0][1])?(mat_max[0][1]-mat_stop[0][1])*URAD:(mat_min[0][1]-mat_stop[0][1])*URAD));
     306                cout<<" - "<<fabs(((mat_min[0][0]<mat_max[0][1])?(mat_stop[0][1]-mat_min[0][1])*URAD:(mat_stop[0][1]-mat_max[0][1])*URAD))<<" µrad"<<endl;
    304307                cout<<"\t hit point ty : "<<mat_stop[0][3]*URAD;
    305         cout<<" + "<<fabs(((mat_min[0][0]<mat_max[0][3])?(mat_max[0][3]-mat_stop[0][3])*URAD:(mat_min[0][3]-mat_stop[0][3])*URAD));
    306         cout<<" - "<<fabs(((mat_min[0][0]<mat_max[0][3])?(mat_stop[0][3]-mat_min[0][3])*URAD:(mat_stop[0][3]-mat_max[0][3])*URAD))<<" µrad"<<endl;
     308                cout<<" + "<<fabs(((mat_min[0][0]<mat_max[0][3])?(mat_max[0][3]-mat_stop[0][3])*URAD:(mat_min[0][3]-mat_stop[0][3])*URAD));
     309                cout<<" - "<<fabs(((mat_min[0][0]<mat_max[0][3])?(mat_stop[0][3]-mat_min[0][3])*URAD:(mat_stop[0][3]-mat_max[0][3])*URAD))<<" µrad"<<endl;
    307310
    308311        }
  • trunk/Utilities/Hector/src/H_Parameters.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219///\file H_Parameters.cc
  • trunk/Utilities/Hector/src/H_Quadrupole.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_Quadrupole.cc
     
    2431}
    2532
    26 void H_Quadrupole::printProperties() const{
    27         cout << typestring;
    28         cout << name;
    29         cout << "\t at s = " << fs;
    30         cout << "\t length = " << element_length;
    31         cout << "\t k1 = " << fk;
    32         cout<<endl;
    33         if(element_aperture->getType()!=NONE) {
    34                 cout <<"\t aperture type = " << element_aperture->getTypeString();
    35                 element_aperture->printProperties();
     33std::ostream& operator<< (std::ostream& os, const H_Quadrupole& el) {
     34        os << el.typestring  << el.name  << "\t at s = " << el.fs << "\t length = " << el.element_length << "\t k1 = " << el.fk <<endl;
     35        if(el.element_aperture->getType()!=NONE) {
     36                os << *(el.element_aperture) << endl;
    3637        }
    3738
    38         if(element_length<0)  { if(VERBOSE) cout<<"<H_Quadrupole> ERROR : Interpenetration of elements !"<<endl; }
    39         if(element_length==0) { if(VERBOSE) cout<<"<H_Quadrupole> WARNING : 0-length "<< typestring << " !" << endl; }
     39        if(el.element_length<0 && VERBOSE) os<<"<H_Quadrupole> ERROR : Interpenetration of elements !"<<endl;
     40        else if(el.element_length==0 && VERBOSE) os<<"<H_Quadrupole> WARNING : 0-length "<< el.typestring << " !" << endl;
     41   return os;
    4042}
  • trunk/Utilities/Hector/src/H_RecRPObject.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
    11 
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1218
    1319/// \file H_RecRPObject.cc
     
    4147                                l_1(new TF1("l_1","[0] + [1]*x + [2]*x*x ",emin,emax)),
    4248                                l_2(new TF1("l_2","[0] + [1]*x + [2]*x*x ",emin,emax))
    43                                 {
    44         // emax = -1; /* GeV */
    45 }
    46 
    47 H_RecRPObject::H_RecRPObject(float ss1, float ss2, H_AbstractBeamLine* beam) : emin(0), emax(-1), x1(0), x2(0), y1(0), y2(0), s1(ss1), s2(ss2),
     49{}
     50
     51H_RecRPObject::H_RecRPObject(const float ss1, const float ss2, const H_AbstractBeamLine* beam) : emin(0), emax(-1), x1(0), x2(0), y1(0), y2(0), s1(ss1), s2(ss2),
    4852                                txip(NOT_YET_COMPUTED), tyip(NOT_YET_COMPUTED), energy(NOT_YET_COMPUTED), q2(NOT_YET_COMPUTED), pt(NOT_YET_COMPUTED),
    49                                 thebeam(beam),
     53                                thebeam(beam->clone()),
    5054                                f_1(new TF1("f_1","[0] + [1]*x + [2]*x*x ",emin,emax)),
    5155                                f_2(new TF1("f_2","[0] + [1]*x + [2]*x*x ",emin,emax)),
     
    5862                                l_1(new TF1("l_1","[0] + [1]*x + [2]*x*x ",emin,emax)),
    5963                                l_2(new TF1("l_2","[0] + [1]*x + [2]*x*x ",emin,emax))
    60                                 {
    61         if(ss1==ss2) cout<<"<H_RecRPObject> WARNING : detectors are on same position"<<endl;
    62         // emax = -1; /* GeV */
     64        {if(ss1==ss2) cout<<"<H_RecRPObject> WARNING : detectors are on same position"<<endl;
     65}
     66
     67H_RecRPObject::H_RecRPObject(const H_RecRPObject& r):
     68   emin(r.emin), emax(r.emax), x1(r.x1), x2(r.x2), y1(r.y1), y2(r.y2), s1(r.s1), s2(r.s2),
     69   txip(r.txip), tyip(r.tyip), energy(r.energy), q2(r.q2),  pt(r.pt),
     70   //thebeam(r.thebeam->clone()),
     71   thebeam(new H_AbstractBeamLine(*(r.thebeam))),
     72   f_1(new TF1(*(r.f_1))),  f_2(new TF1(*(r.f_2))),  g_1(new TF1(*(r.g_1))),  g_2(new TF1(*(r.g_2))),
     73   d_1(new TF1(*(r.d_1))),  d_2(new TF1(*(r.d_2))),  k_1(new TF1(*(r.k_1))),  k_2(new TF1(*(r.k_2))),
     74   l_1(new TF1(*(r.l_1))),  l_2(new TF1(*(r.l_2)))
     75 {}
     76
     77H_RecRPObject& H_RecRPObject::operator=(const H_RecRPObject& r) {
     78  if (this == &r) return *this;
     79   emin = r.emin, emax = r.emax;
     80   x1 = r.x1;   x2 = r.x2;
     81   y1 = r.y1;   y2 = r.y2;
     82   s1 = r.s1;   s2 = r.s2;
     83   txip= r.txip; tyip=r.tyip;
     84   energy= r.energy; q2= r.q2;  pt= r.pt;
     85   //thebeam = r.thebeam->clone();
     86   thebeam = new H_AbstractBeamLine(*(r.thebeam));
     87   f_1 = new TF1(*(r.f_1));
     88   f_2 = new TF1(*(r.f_2));
     89   g_1 = new TF1(*(r.g_1));
     90   g_2 = new TF1(*(r.g_2));
     91   d_1 = new TF1(*(r.d_1));
     92   d_2 = new TF1(*(r.d_2));
     93   k_1 = new TF1(*(r.k_1));
     94   k_2 = new TF1(*(r.k_2));
     95   l_1 = new TF1(*(r.l_1));
     96   l_2 = new TF1(*(r.l_2));
     97  return *this;
    6398}
    6499
     
    308343        return pt;
    309344}
     345
     346std::ostream& operator<< (std::ostream& os, const H_RecRPObject& rp) {
     347        os << "e_min=" <<  rp.emin << "\t e_max= " << rp.emax << endl;
     348        os << "x1="    << rp.x1 << "\t x2= " << rp.x2 << "\t y1=" << rp.y1 << "\t y2=" << rp.y2
     349           << "\t s1=" << rp.s1 << "\t s2=" << rp.s2 << endl;
     350        os << "txip=" << rp.txip << "\t tyip=" << rp.tyip << "\t energy=" << rp.energy << "\t q2=" << rp.q2 << "\t pt=" << rp.pt << endl;
     351   return os;
     352}
  • trunk/Utilities/Hector/src/H_RectEllipticAperture.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_RectEllipticAperture.cc
     
    2936        /// @param l, h, L, H are the geometrical parameters of the rect-ellipse shape
    3037        /// @param posx, posy defines the (x,y) of the center of the shape
    31         type= RECTELLIPSE;
    3238}
    3339
     
    127133}
    128134
    129 void H_RectEllipticAperture::printProperties() const {
    130         cout << "Aperture shape:" << getTypeString() << ", parameters " <<x1<<", "<<x2<<", "<<x3<<", "<<x4<< endl;
    131         cout << " \t Center : "<<fx<<", "<<fy<<endl;
    132         return;
     135std::ostream& operator<< (std::ostream& os, const H_RectEllipticAperture& ap) {
     136        os << "Aperture shape:" << ap.aptypestring << ", parameters " << ap.x1 <<", "<< ap.x2 <<", "<< ap.x3 <<", "<< ap.x4 << endl;
     137        os << " \t Center : " << ap.fx <<", "<< ap.fy <<endl;
     138        return os;
    133139}
  • trunk/Utilities/Hector/src/H_RectangularAperture.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_RectangularAperture.cc
     
    4855        return;
    4956}
    50 void H_RectangularAperture::printProperties() const {
    51         cout << "Aperture shape:" << getTypeString() << ", rectangle Sides : "<<x1<<", "<<x2<<endl;
    52         cout << " \t Center : " << fx << "," << fy << endl;
    53         return;
     57
     58std::ostream& operator<< (std::ostream& os, const H_RectangularAperture& ap) {
     59        os << "Aperture shape:" << ap.aptypestring << ", rectangle sides : " << ap. x1 <<", " << ap.x2 <<endl;
     60        os << " \t Center : " << ap.fx << "," << ap.fy << endl;
     61        return os;
    5462}
     63
  • trunk/Utilities/Hector/src/H_RectangularCollimator.cc

    r216 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_RectangularCollimator.cc
     
    3643}
    3744
    38 void H_RectangularCollimator::printProperties() const {
    39         cout << typestring << name;
    40         cout << "\t\t at s = " << fs;
    41         cout << "\t length = " << element_length;
    42         cout<<endl;
    43         if(element_aperture->getType()!=NONE) {
    44                 cout <<"\t aperture type = " << element_aperture->getTypeString();
    45                         element_aperture->printProperties();
     45std::ostream& operator<< (std::ostream& os, const H_RectangularCollimator& el) {
     46        os << el.typestring << el.name << "\t\t at s = " << el.fs << "\t length = " << el.element_length <<endl;
     47        if(el.element_aperture->getType()!=NONE) {
     48                os << *(el.element_aperture) << endl;
    4649        }
    4750
    48         if(element_length<0)  { if(VERBOSE) cout<<"<H_RectangularCollimator> ERROR : Interpenetration of elements !"<<endl; }
    49         if(element_length==0) { if(VERBOSE) cout<<"<H_RectangularCollimator> WARNING : 0-length "<< name << " !" << endl; }
     51        if(el.element_length<0 && VERBOSE) os <<"<H_RectangularCollimator> ERROR : Interpenetration of elements !"<<endl;
     52        else if(el.element_length==0 && VERBOSE) os <<"<H_RectangularCollimator> WARNING : 0-length "<< el.name << " !" << endl;
     53   return os;
    5054}
    5155
  • trunk/Utilities/Hector/src/H_RectangularDipole.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_RectangularDipole.cc
  • trunk/Utilities/Hector/src/H_RomanPot.cc

    r232 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_RomanPot.cc
     
    3946}
    4047
    41 void H_RomanPot::printProperties() const {
    42                 cout << typestring << name;
    43                 cout << "\t\t at s = " << fs;
    44                 if(element_aperture->getType()!=NONE) {
    45                         cout <<"\t aperture type = " << element_aperture->getTypeString();
    46                         element_aperture->printProperties();
    47                 }
    48 
    49                 cout<<endl;
     48std::ostream& operator<< (std::ostream& os, const H_RomanPot& el) {
     49        os << el.typestring << el.name << "\t\t at s = " << el.fs;
     50        if(el.element_aperture->getType()!=NONE) {
     51                os << *(el.element_aperture) << endl;
     52        }
     53   return os;
    5054}
    5155
  • trunk/Utilities/Hector/src/H_SectorDipole.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_SectorDipole.cc
  • trunk/Utilities/Hector/src/H_TransportMatrices.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_TransportMatrices.cc
     
    2936
    3037extern double omega(const double k, const double l) {
    31                 // [l] = [m] and [k] = [1/mï¿œ] for quadrupoles
     38                // [l] = [m] and [k] = [1/m^2] for quadrupoles
    3239                // [omega] = [1]
    3340        return sqrt(fabs(k))*l;
     
    3542
    3643extern double radius(const double k) {
    37                 // [k] = [1/mï¿œ] for quadrupoles
     44                // [k] = [1/m^2] for quadrupoles
    3845                // [k] = [1/m]  for dipoles
    3946                // [radius(k)] = [m]
  • trunk/Utilities/Hector/src/H_VerticalKicker.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_VerticalKicker.cc
  • trunk/Utilities/Hector/src/H_VerticalQuadrupole.cc

    r3 r281  
    1 /*
    2 ---- Hector the simulator ----
    3    A fast simulator of particles through generic beamlines.
    4    J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
    5 
    6         http://www.fynu.ucl.ac.be/hector.html
    7 
    8    Centre de Physique des Particules et de Phénoménologie (CP3)
    9    Université Catholique de Louvain (UCL)
    10 */
     1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
     2 *                                                         *
     3*                   --<--<--  A fast simulator --<--<--     *
     4*                 / --<--<--     of particle   --<--<--     *
     5*  ----HECTOR----<                                          *
     6*                 \ -->-->-- transport through -->-->--     *
     7*                   -->-->-- generic beamlines -->-->--     *
     8*                                                           *
     9* JINST 2:P09005 (2007)                                     *
     10*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
     11*       http://www.fynu.ucl.ac.be/hector.html               *
     12*                                                           *
     13* Center for Cosmology, Particle Physics and Phenomenology  *
     14*              Universite catholique de Louvain             *
     15*                 Louvain-la-Neuve, Belgium                 *
     16 *                                                         *
     17   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    1118
    1219/// \file H_VerticalQuadrupole.cc
Note: See TracChangeset for help on using the changeset viewer.