Index: trunk/Utilities/Hector/VERSION
===================================================================
--- trunk/Utilities/Hector/VERSION	(revision 264)
+++ trunk/Utilities/Hector/VERSION	(revision 281)
@@ -1,1 +1,1 @@
-_1_4_0
+_1_5_2pre
Index: trunk/Utilities/Hector/include/H_AbstractBeamLine.h
===================================================================
--- trunk/Utilities/Hector/include/H_AbstractBeamLine.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_AbstractBeamLine.h	(revision 281)
@@ -2,19 +2,27 @@
 #define _H_AbstractBeamLine_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*	http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-	http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de Phï¿œnomï¿œnologie (CP3)
-   Universitï¿œ Catholique de Louvain (UCL)
-*/
 
 /// \file H_AbstractBeamLine.h
 /// \brief Class aiming at simulating the LHC beamline.
 ///
-/// Units : angles [ï¿œrad], distances [ï¿œm], energies [GeV], c=[1].
+/// Units : angles [urad], distances [um], energies [GeV], c=[1].
 
 	/// default length of the beam line
@@ -39,5 +47,4 @@
 
 	public:
-		void init(const float );
 		///     Constructors, destructor and operator
 		//@{
@@ -50,12 +57,9 @@
 		//@}
 		///     Adds an element to the beamline
-		//@{
 		void add(H_OpticalElement *);
-		void add(H_OpticalElement &);
-		//@}
 		///     Returns the (float) length of the beamline
-  		inline float getLength() const { return beam_length;};
+  		const float getLength() const { return beam_length;};
 		///     Returns the (int) number of optics element of the beamline, including drifts
-  		inline int getNumberOfElements() const { return (int)elements.size();}; 
+  		const unsigned int getNumberOfElements() const { return elements.size();}; 
 		///     Returns the transport matrix for the whole beam
 		const TMatrix getBeamMatrix() const;
@@ -124,16 +128,20 @@
 
 	private:
-	        /// list of all optics elements, including drifts
-		vector<H_OpticalElement*> elements; 
         	/// list of matrices, 1 matrix = the transport till the end of each element
 		vector<TMatrix> matrices; 
 	        /// transport matrix for the whole beam
-		TMatrix beam_mat;		    	
+		TMatrix beam_mat;
+                /// list of all optics elements, including drifts
+                vector<H_OpticalElement*> elements;
 		/// Orderting method for the vector of H_OpticalElement*
-		struct ordering{ bool operator()(H_OpticalElement* el1, H_OpticalElement* el2) const { return (*el1 < *el2);}};
+		struct ordering{ bool operator()(const H_OpticalElement* el1, const H_OpticalElement* el2) const {return (*el1 < *el2);}};
+		// private method for copying the contents of "elements"
+		void cloneElements(const H_AbstractBeamLine&);
 
 	protected:
+		void init(const float );
 		/// total length of the beamline
 		float beam_length;
+	friend std::ostream& operator<< (std::ostream& os, const H_AbstractBeamLine& be);
 };
 
Index: trunk/Utilities/Hector/include/H_Aperture.h
===================================================================
--- trunk/Utilities/Hector/include/H_Aperture.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_Aperture.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_Aperture_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Aperture.h
@@ -18,12 +25,9 @@
 // C++ #defines
 #include <string>
+#include <iostream>
 using namespace std;
 
 // local #defines
-#define NONE        0
-#define RECTANGULAR 1
-#define ELLIPTIC    2
-#define CIRCULAR    3
-#define RECTELLIPSE 4
+enum {NONE=0, RECTANGULAR, ELLIPTIC, CIRCULAR, RECTELLIPSE};
 #define NONENAME        "None       "
 #define RECTANGULARNAME "Rectangle  "
@@ -43,9 +47,10 @@
 		H_Aperture& operator=(const H_Aperture&);
 		virtual ~H_Aperture() { };
-		virtual H_Aperture* clone() const { return new H_Aperture(type,x1,x2,x3,x4,fx,fy); };
+		virtual H_Aperture* clone() const { return new H_Aperture(type_,x1,x2,x3,x4,fx,fy); };
 		//@}
 
 		/// Prints the aperture features
-		virtual void printProperties() const;
+		//virtual void printProperties() const;
+		void printProperties() const;
 		/// Draws the aperture shape
 		virtual void draw(const float scale=1) const {return;};
@@ -55,5 +60,5 @@
 		virtual bool isInside(const float, const float) const; 
 		/// Returns the (int) type of aperture
-		inline int getType() const {return type;};
+		inline int getType() const {return type_;};
 		/// Returns the (string) type of the aperture
 		inline const string getTypeString() const { return aptypestring; }
@@ -62,20 +67,23 @@
 	protected:
 		/// Aperture shape (either RECTANGULAR or ELLIPTIC or ...)
-		int type;
-		/// Aperture shape string
-		string aptypestring;
-
+		int type_;
 		/// Aperture geometrical sizes (length/width or great/small radii) [m]
 		//@{
 		float x1, x2, x3, x4; 
 		//@}
-
 		/// Horizontal coordinate of the aperture center [m] (from the nominal beam position).
 		//@{
 		float fx, fy;
 		//@}
-		/// Sets the name of the aperture from its type.
-		void setApertureString();
+                /// Aperture shape string
+                string aptypestring;
+		// Sets the name of the aperture from its type.
+		//void setApertureString();
+		/// Gets the name of the aperture from its type.
+		const string getApertureString() const;
+
+	friend std::ostream& operator<< (std::ostream& os, const H_Aperture& ap);
 };
 
+
 #endif
Index: trunk/Utilities/Hector/include/H_Beam.h
===================================================================
--- trunk/Utilities/Hector/include/H_Beam.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_Beam.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_Beam_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Beam.h
@@ -27,4 +34,5 @@
 #include "TGraphErrors.h"
 #include "TMultiGraph.h"
+#include "TMath.h"
 
 // local #includes
@@ -56,12 +64,8 @@
 	//@}
         /// Fills the beam with particles in given position/angle/energy        intervals (flat distribution)
-                //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);
-                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);
+                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);
 
 	/// Fills the beam with particles
-	//@{
-		void createBeamParticles(const unsigned int , const double , const double );
-		void createBeamParticles(const unsigned int);
-	//@}
+		void createBeamParticles(const unsigned int Number_of_particles, const double p_mass=MP, const double p_charge=QP, TRandom* r=gRandom);
 	/// Fills the beam with particles with incremental offset and no initial transverse momentum
 	//@{
@@ -82,13 +86,7 @@
 		void add(const H_BeamParticle&);
 	/// Compute the position of each particle in the beamline
-	//@{	
-		void computePath(const H_AbstractBeamLine *, const bool);
-		void computePath(const H_AbstractBeamLine *);
-	//@}
+		void computePath(const H_AbstractBeamLine * beamline, const bool NonLinear=false);
 	// Photon emission by the particle
-	// @{
-                void emitGamma(const double, const double, const double, const double);
-		void emitGamma(const double, const double);
-	//@}
+                void emitGamma(const double gee, const double gq2, const double phimin=0, const double phimax=2*TMath::Pi());
 	// Propagates the beam until a given s
 		void propagate(const float );
@@ -146,5 +144,5 @@
 		void printInitialState() const;
 	/// Prints the properties for each particle
-		void printProperties() const;
+		void printProperties() const {cout << *this; return;}
 	/// Prints the list of the stopping elements in the beamline
 		void printStoppingElements(const vector<H_OpticalElement>&, const vector<int>&) const;
@@ -186,5 +184,5 @@
 		unsigned int Nparticles;
 
-	static const float pi = 3.14159265358979312;
+	friend std::ostream& operator<< (std::ostream& os, const H_Beam& be);
 };
 
Index: trunk/Utilities/Hector/include/H_BeamLine.h
===================================================================
--- trunk/Utilities/Hector/include/H_BeamLine.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_BeamLine.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_BeamLine_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_BeamLine.h
@@ -32,5 +39,5 @@
 	///     Constructors and destructor
 	//@{
-		H_BeamLine():H_AbstractBeamLine() {direction=1; ips=0; };
+		H_BeamLine();
 		H_BeamLine(const H_BeamLine& );
 		H_BeamLine(const int, const float);
@@ -39,15 +46,9 @@
 	//@
 		///     Finds the IP position (s) from the MAD table. Should be "IP5" or "IP1".
-		//@{
-		void findIP(const string&);
-		void findIP(const string&, const string&);
-		//@}
+		void findIP(const string& filename, const string& ipname="IP5");
 		///     Reader for the external MAD table
-		//@{
-		void fill(const string&);
-		void fill(const string&, const int, const string& );
-		//@}
+		void fill(const string& filename, const int dir=1, const string& ipname="IP5");
 		///     Returns the IP position (s)
-		double getIP() {return ips;};
+		double getIP() const {return ips;};
 		///		Returns positions and angles of beam at IP
 		double* getIPProperties();
Index: trunk/Utilities/Hector/include/H_BeamLineParser.h
===================================================================
--- trunk/Utilities/Hector/include/H_BeamLineParser.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_BeamLineParser.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_BeamLineParser_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_BeamLineParser.h
Index: trunk/Utilities/Hector/include/H_BeamParticle.h
===================================================================
--- trunk/Utilities/Hector/include/H_BeamParticle.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_BeamParticle.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_BeamParticle_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_BeamParticle.h
@@ -27,4 +34,5 @@
 #include "TVectorD.h"
 #include "TLorentzVector.h"
+#include "TRandom3.h"
 
 // local #includes
@@ -39,5 +47,4 @@
 
 	public:
-		void init();
 		/// Constructors and Destructor
 		//@{
@@ -49,19 +56,11 @@
 		//@}
 		/// Smears the (x,y) coordinates of the particle [\f$ \mu m \f$]
-		void smearPos(const double, const double);
-		/// Smears the (x,y) coordinates of the particle (using default values in parameters.h)
-		void smearPos();
+		void smearPos(const double dx=SX,const double dy=SY, TRandom* r=gRandom);
 		/// Smears the (x,y) angular coordinates of the particle [\f$ \mu rad \f$]
-		void smearAng(const double, const double);
-		/// Smears the (x,y) angular coordinates of the particle (using default values in parameters.h)
-		void smearAng();
+		void smearAng(const double tx=STX, const double ty=STY, TRandom* r=gRandom);
 		/// Smears the Energy of the particle [GeV]
-		void smearE(const double);
-		/// Smears the Energy of the particle (using default values in parameters.h) 
-		void smearE();
+		void smearE(const double erre=SBE, TRandom* r=gRandom);
 		/// Smears the longitudinal position of the particle [\f$ \mu m \f$]
-		void smearS(const double);
-		/// Smears the longitudinal position of the particle (using default values in parameters.h)
-		void smearS();
+		void smearS(const double errs=SS, TRandom* r=gRandom);
 		/// Sets the energy [GeV].
 		void setE(const double);
@@ -73,22 +72,22 @@
 		void setPosition(const double , const double , const double , const double , const double );
 		/// Returns the particle mass [GeV]
-		double getM() const {return mp;};
+		const double getM() const {return mp;};
 		/// Returns the particle charge [e]
-		double getQ() const {return qp;};
+		const double getQ() const {return qp;};
 		/// Returns the current x coordinate [\f$ \mu \f$m]
-		double getX() const {return fx;};
+		const double getX() const {return fx;};
 		/// Returns the current y coordinate [\f$ \mu \f$m]
-		double getY() const {return fy;};
+		const double getY() const {return fy;};
 		/// Returns the current s coordinate [m]
-		inline double getS() const {return fs;};
+		const double getS() const {return fs;};
 		/// Returns the current \f$ \theta_x \f$ angular coordinate [\f$ \mu \f$rad]
-		double getTX() const {return thx;};
+		const double getTX() const {return thx;};
 		/// Returns the current \f$ \theta_y \f$ angular coordinate [\f$ \mu \f$rad]
-		double getTY() const {return thy;};
+		const double getTY() const {return thy;};
 		/// Returns the current particle energy [GeV]
-		inline double getE() const {return energy;};
+		const double getE() const {return energy;};
 		/// Returns all the positions 
 		vector<TVectorD> getPositions() const {return positions;};
-		bool isPhysical() const {return isphysical;};
+		const bool isPhysical() const {return isphysical;};
 		/// \brief Simulates the emission of a photon in a random direction
 		///
@@ -99,6 +98,5 @@
         	/// \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$
 		//@{
-		void emitGamma(const double, const double, const double, const double);
-		void emitGamma(const double, const double);
+		void emitGamma(const double gee, const double gq2, const double phimin=0, const double phimax=2*TMath::Pi());
 		//@}
                 /// uses Pythia to generate some inelastic pp->pX collision as background
@@ -120,5 +118,5 @@
 		const TVectorD * getPosition(const int ) const;
 		/// Prints the properties of the particle
-		void printProperties() const;
+		void printProperties() const {cout << *this; return;};
 		/// Prints the phase vector of the particle
 		void printV() const;
@@ -126,5 +124,5 @@
 		const H_OpticalElement * getStoppingElement() const;
 		/// Checks if the particle has been stopped in any element of the beamline
-		bool stopped(const H_AbstractBeamLine *);
+		const bool stopped(const H_AbstractBeamLine *);
 		/// Returns the StopPosition vector
 		inline const TVectorD * getStopPosition() const { return stop_position; };
@@ -134,14 +132,13 @@
 		/// Returns the particle path in the beamline
 		TGraph * getPath(const int , const int ) const;
-		/// Computes the position of the particle at the end of each element of the beam, without non linear effects
-		void computePath(const H_AbstractBeamLine *);
 		/// Computes the position of the particle at the end of each element of the beam.
-		void computePath(const H_AbstractBeamLine *, const bool);
+		void computePath(const H_AbstractBeamLine * beam, const bool NonLinear=true);
 		/// Computes the position of the particle at the end of each element of the beam.
-		void computePath(const H_AbstractBeamLine &, const bool);
+		void computePath(const H_AbstractBeamLine & beam, const bool NonLinear=true);
 		/// Clears H_BeamParticle::positions but keeps the initial vector.
 		void resetPath();
 
 	private:
+		void init();
 		/// Particle mass [GeV]
 		double mp;
@@ -175,5 +172,5 @@
   		void addPosition(const double , const double , const double , const double , const double );
 
-		static const float pi = 3.14159265358979312;
+	friend std::ostream& operator<< (std::ostream& os, const H_BeamParticle& p);
 };
 #endif
Index: trunk/Utilities/Hector/include/H_CircularAperture.h
===================================================================
--- trunk/Utilities/Hector/include/H_CircularAperture.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_CircularAperture.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_CircularAperture_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_CircularAperture.h
@@ -26,10 +33,12 @@
 		/// Constructors and destructor
 		//@{
-		H_CircularAperture():H_EllipticAperture(0,0,0,0) {type = CIRCULAR; setApertureString();}
-		H_CircularAperture(const float, const float, const float);
+		H_CircularAperture():H_EllipticAperture(CIRCULAR,0,0,0,0) {};
+		H_CircularAperture(const float r, const float posx, const float posy) : H_EllipticAperture(CIRCULAR,r,r,posx,posy) {};
+		/// @param r is the radius of the circular shape
+        	/// @param posx, posy are the (x,y) coordinates of the center of the circle
 		~H_CircularAperture() {};
 		H_CircularAperture* clone() const;
 		//@}
-		virtual void printProperties() const;
+	friend std::ostream& operator<< (std::ostream& os, const H_CircularAperture& ap);
 };
 
Index: trunk/Utilities/Hector/include/H_Dipole.h
===================================================================
--- trunk/Utilities/Hector/include/H_Dipole.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_Dipole.h	(revision 281)
@@ -2,14 +2,21 @@
 /// \brief Class aiming at simulating LHC beam dipoles.
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 #ifndef _H_Dipole_
@@ -30,5 +37,5 @@
 		//@}
 		/// Prints the properties of the element
-		virtual void printProperties() const;
+		virtual void printProperties() const { cout << *this; return;};
 		virtual H_Dipole* clone() const =0;
 		void init();
@@ -37,5 +44,6 @@
     		virtual void setTypeString() =0;
 	    	virtual void setMatrix(const float, const float, const float) = 0;
-    	
+    
+	friend std::ostream& operator<< (std::ostream& os, const H_Dipole& el);
 };
 
Index: trunk/Utilities/Hector/include/H_Drift.h
===================================================================
--- trunk/Utilities/Hector/include/H_Drift.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_Drift.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_Drift_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Drift.h
@@ -30,6 +37,6 @@
 	        ~H_Drift() { };
 	//@}
-        	virtual void printProperties() const;
 	        void init();
+		virtual void printProperties() const { cout << *this; return;};
 		H_Drift* clone() const;
 
@@ -37,4 +44,5 @@
         	virtual void setTypeString() {typestring = DRIFTNAME;};
 	        virtual void setMatrix(const float, const float, const float) ;
+	friend std::ostream& operator<< (std::ostream& os, const H_Drift& el);
 };
 
Index: trunk/Utilities/Hector/include/H_EllipticAperture.h
===================================================================
--- trunk/Utilities/Hector/include/H_EllipticAperture.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_EllipticAperture.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_EllipticAperture_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_EllipticAperture.h
@@ -26,4 +33,5 @@
 		//@{
 		H_EllipticAperture():H_Aperture(ELLIPTIC,0,0,0,0,0,0) {}
+		H_EllipticAperture(const int, const float, const float, const float, const float);
 		H_EllipticAperture(const float, const float, const float, const float);
 		~H_EllipticAperture() {};
@@ -34,5 +42,5 @@
 		/// Draws the aperture shape.
 		virtual void draw(const float scale=1) const;
-		virtual void printProperties() const;
+	friend std::ostream& operator<< (std::ostream& os, const H_EllipticAperture& ap);
 };
 
Index: trunk/Utilities/Hector/include/H_HorizontalKicker.h
===================================================================
--- trunk/Utilities/Hector/include/H_HorizontalKicker.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_HorizontalKicker.h	(revision 281)
@@ -1,20 +1,27 @@
+#ifndef _H_HorizontalKicker_
+#define _H_HorizontalKicker_
+
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
 /// \file H_HorizontalKicker.h
 /// \brief Classes aiming at simulating horizontal kickers in beamline.
 ///
 /// fk [rad] for kickers !!!!
-
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
-
-#ifndef _H_HorizontalKicker_
-#define _H_HorizontalKicker_
 
 // local #includes
Index: trunk/Utilities/Hector/include/H_HorizontalQuadrupole.h
===================================================================
--- trunk/Utilities/Hector/include/H_HorizontalQuadrupole.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_HorizontalQuadrupole.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_HorizontalQuadrupole_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_HorizontalQuadrupole.h
Index: trunk/Utilities/Hector/include/H_Kicker.h
===================================================================
--- trunk/Utilities/Hector/include/H_Kicker.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_Kicker.h	(revision 281)
@@ -1,19 +1,26 @@
+#ifndef _H_Kicker_
+#define _H_Kicker_
+
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
 /// \file H_Kicker.h
 /// \brief Classes aiming at simulating kickers in LHC beamline.
 /// fk [rad] for kickers !!!!
-
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
-
-#ifndef _H_Kicker_
-#define _H_Kicker_
 
 // local #includes
@@ -31,7 +38,6 @@
 		virtual ~H_Kicker() {};
 	//@}
-	/// prints the kicker properties
-		virtual void printProperties() const;
 		virtual H_Kicker* clone() const = 0;
+		virtual void printProperties() const { cout << *this; return;};
 		void init();
 
@@ -39,4 +45,5 @@
 		virtual void setTypeString() = 0;
 		virtual void setMatrix(const float, const float, const float) = 0;
+	friend std::ostream& operator<< (std::ostream& os, const H_Kicker& el);
 };
 
Index: trunk/Utilities/Hector/include/H_Marker.h
===================================================================
--- trunk/Utilities/Hector/include/H_Marker.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_Marker.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_Marker_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Marker.h
@@ -30,5 +37,4 @@
 	        ~H_Marker() { };
 	//@}
-        	virtual void printProperties() const;
 		H_Marker* clone() const ;
 	        void init();
@@ -37,4 +43,5 @@
         	virtual void setTypeString() {typestring = MARKERNAME;};
 	        virtual void setMatrix(const float , const float, const float) ;
+	friend std::ostream& operator<< (std::ostream& os, const H_Marker& el);
 };
 
Index: trunk/Utilities/Hector/include/H_OpticalElement.h
===================================================================
--- trunk/Utilities/Hector/include/H_OpticalElement.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_OpticalElement.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_OpticalElement_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_OpticalElement.h
@@ -36,17 +43,5 @@
 
 	// type #defines
-#define DRIFT        1
-#define RDIPOLE      2
-#define SDIPOLE      3
-#define VQUADRUPOLE  4
-#define HQUADRUPOLE  5
-#define VKICKER      6
-#define HKICKER      7
-#define RCOLLIMATOR  8
-#define ECOLLIMATOR  9
-#define CCOLLIMATOR 10
-#define RP          11
-#define IP          12
-#define MARKER      13
+enum {DRIFT=1, RDIPOLE, SDIPOLE, VQUADRUPOLE, HQUADRUPOLE, VKICKER, HKICKER, RCOLLIMATOR, ECOLLIMATOR, CCOLLIMATOR, RP, IP, MARKER};
 
 	// typestring[30] #defines
@@ -82,5 +77,5 @@
 		//@}
 		///     Prints the element features
-	        virtual void printProperties() const ;
+	        virtual void printProperties() const { cout << *this; return;};
 		///     Shows the element transport matrix
 	        void showMatrix() const ;
@@ -90,7 +85,7 @@
 		void setAperture(const H_Aperture*);
 		///     Ordering operator acting on the s coordinate
-		inline bool operator>(const H_OpticalElement tocomp) const {if(fs>tocomp.getS()) { return true; } else { return false; }};
+		inline bool operator>(const H_OpticalElement& tocomp) const {return ( fs>tocomp.getS() ); };
 		///     Ordering operator acting on the s coordinate
-		inline bool operator<(const H_OpticalElement tocomp) const {if(fs<tocomp.getS()) { return true; } else { return false; }};
+		inline bool operator<(const H_OpticalElement& tocomp) const {return ( fs<tocomp.getS() ); };
 		/// 	Copy operator
 		H_OpticalElement& operator=(const H_OpticalElement&); 
@@ -178,5 +173,5 @@
                 //@}
 		virtual H_OpticalElement* clone() const { return new H_OpticalElement();};
-		TVectorD getHitPosition(TVectorD, double, double, double);
+		TVectorD getHitPosition(const TVectorD& , const double, const double, const double);
 
 
@@ -210,9 +205,11 @@
 		virtual void setTypeString() {return;};
 		/// Optical element transport matrix.
-	    virtual void setMatrix(const float, const float, const float) { cout<<"dummy setmatrix"<<endl; return;};
+		virtual void setMatrix(const float, const float, const float) { cout<<"dummy setmatrix"<<endl; return;};
 		/// Optical element transport matrix.
  		TMatrix element_mat;
 		/// Optical element aperture. 
 	    	H_Aperture* element_aperture;
+
+	friend std::ostream& operator<< (std::ostream& os, const H_OpticalElement& el);
 };
 
Index: trunk/Utilities/Hector/include/H_Parameters.h
===================================================================
--- trunk/Utilities/Hector/include/H_Parameters.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_Parameters.h	(revision 281)
@@ -2,18 +2,21 @@
 #define _Hector_parameters_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-	J.~de Favereau, X.~Rouby and K.~Piotrzkowski, 
-        Hector, a fast simulator for the transport of particles in beamlines,
-	JINST 2, P09005 (2007)
-	arXiv:0707.1198 [physics.acc-ph]
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Parameters.h
Index: trunk/Utilities/Hector/include/H_Quadrupole.h
===================================================================
--- trunk/Utilities/Hector/include/H_Quadrupole.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_Quadrupole.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_Quadrupole_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Quadrupole.h
@@ -30,6 +37,6 @@
 		virtual ~H_Quadrupole() {};
 	//@}	
-		virtual void printProperties() const;
 		virtual H_Quadrupole* clone() const =0 ;
+		virtual void printProperties() const { cout << *this; return;};
 		void init();
 
@@ -38,4 +45,5 @@
 		virtual void setMatrix(const float, const float, const float) = 0;
 	   	
+	friend std::ostream& operator<< (std::ostream& os, const H_Quadrupole& el);
 };
 
Index: trunk/Utilities/Hector/include/H_RecRPObject.h
===================================================================
--- trunk/Utilities/Hector/include/H_RecRPObject.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_RecRPObject.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_RecRPObject_
 
-/*
- * ---- Hector the simulator ----
- * A fast simulator of particles through generic beamlines.
- * J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
- *
- * http://www.fynu.ucl.ac.be/hector.html
- *
- * Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
- * UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_RecRPObject.h
@@ -22,11 +29,15 @@
 #define NOT_YET_COMPUTED -666
 
+/// Reconstruction of parameters at IP using measurements with roman pots
 class H_RecRPObject {
 	public:
 		H_RecRPObject();
-		H_RecRPObject(const float, const float, H_AbstractBeamLine* );
+		H_RecRPObject(const float, const float, const H_AbstractBeamLine* );
 		H_RecRPObject(const H_RecRPObject&);
 		H_RecRPObject& operator=(const H_RecRPObject&);
-		~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; };
+		~H_RecRPObject() {delete f_1; delete f_2; delete g_1; delete g_2; 
+				  delete d_1; delete d_2; delete k_1; delete k_2; 
+				  delete l_1; delete l_2; 
+				  delete thebeam;};
 
 		inline float getX1() const {return x1;};
@@ -64,4 +75,5 @@
 		TF1* k_1, *k_2;
 		TF1* l_1, *l_2;
+	friend std::ostream& operator<< (std::ostream& os, const H_RecRPObject& rp);
 };
 
Index: trunk/Utilities/Hector/include/H_RectEllipticAperture.h
===================================================================
--- trunk/Utilities/Hector/include/H_RectEllipticAperture.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_RectEllipticAperture.h	(revision 281)
@@ -2,17 +2,24 @@
 #define _H_RectEllipticAperture_
 
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
 /// \file H_RectEllipticAperture.h
 /// \brief Defines the Rect-Elliptic aperture of beamline elements.
-
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
 
 // local #includes
@@ -30,9 +37,9 @@
 		H_RectEllipticAperture* clone() const;
 		//@}
-		virtual void printProperties() const;
 		/// Checks whether the point is inside the aperture or not
 		virtual bool isInside(const float, const float) const;
 		/// Draws the aperture shape.
 		virtual void draw(const float scale=1) const;
+	friend std::ostream& operator<< (std::ostream& os, const H_RectEllipticAperture& ap);
 };
 
Index: trunk/Utilities/Hector/include/H_RectangularAperture.h
===================================================================
--- trunk/Utilities/Hector/include/H_RectangularAperture.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_RectangularAperture.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_RectangularAperture_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_RectangularAperture.h
@@ -34,5 +41,5 @@
 		/// Draws the aperture shape.
 		virtual void draw(const float scale=1) const;
-		virtual void printProperties() const;
+	friend std::ostream& operator<< (std::ostream& os, const H_RectangularAperture& ap);
 };
 
Index: trunk/Utilities/Hector/include/H_RectangularCollimator.h
===================================================================
--- trunk/Utilities/Hector/include/H_RectangularCollimator.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_RectangularCollimator.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_RectangularCollimator_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_RectangularCollimator.h
@@ -30,5 +37,4 @@
 		~H_RectangularCollimator() {};
 	//@}
-		virtual void printProperties() const;
 		H_RectangularCollimator* clone() const;
 		void init();
@@ -36,5 +42,6 @@
 	 	virtual void setTypeString() {typestring=RCOLLIMATORNAME;};
 		virtual void setMatrix(const float, const float, const float) ;
-
+	
+	friend std::ostream& operator<< (std::ostream& os, const H_RectangularCollimator& el);
 };
 
Index: trunk/Utilities/Hector/include/H_RectangularDipole.h
===================================================================
--- trunk/Utilities/Hector/include/H_RectangularDipole.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_RectangularDipole.h	(revision 281)
@@ -2,17 +2,24 @@
 #define _H_RectangularDipole_
 
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
 /// \file H_RectangularDipole.h
 /// \brief Classes aiming at simulating LHC beam rectangular dipoles.
-
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
 
 #include "H_Dipole.h"
Index: trunk/Utilities/Hector/include/H_RomanPot.h
===================================================================
--- trunk/Utilities/Hector/include/H_RomanPot.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_RomanPot.h	(revision 281)
@@ -2,17 +2,24 @@
 #define _H_RomanPot_
 
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
 /// \file H_RomanPot.h
 /// \brief Roman pot class
-
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
 
 // local #includes
@@ -32,5 +39,4 @@
 		~H_RomanPot() {};
 	//@}
-		virtual void printProperties() const;
 		H_RomanPot* clone() const ;
 		void init();
@@ -38,5 +44,5 @@
 		virtual void setTypeString() {typestring=RPNAME;};
 		virtual void setMatrix(const float, const float, const float) ;
-
+	friend std::ostream& operator<< (std::ostream& os, const H_RomanPot& el);
 };
 
Index: trunk/Utilities/Hector/include/H_SectorDipole.h
===================================================================
--- trunk/Utilities/Hector/include/H_SectorDipole.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_SectorDipole.h	(revision 281)
@@ -1,18 +1,25 @@
-/// \file H_SectorDipole.h
-/// \brief Classes aiming at simulating sector dipoles.
-
 #ifndef _H_SectorDipole_
 #define _H_SectorDipole_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+/// \file H_SectorDipole.h
+/// \brief Classes aiming at simulating sector dipoles.
 
 #include "H_Dipole.h"
@@ -26,5 +33,5 @@
 		H_SectorDipole():H_Dipole(SDIPOLE,0.,0.,0.) {init();}
 		H_SectorDipole(const double s, const double k, const double l) :H_Dipole(SDIPOLE,s,k,l){init();}
-		H_SectorDipole(const string nameE, const double s, const double k, const double l) :H_Dipole(nameE,SDIPOLE,s,k,l){init();}
+		H_SectorDipole(const string& nameE, const double s, const double k, const double l) :H_Dipole(nameE,SDIPOLE,s,k,l){init();}
 		~H_SectorDipole() {};
 		//@}
Index: trunk/Utilities/Hector/include/H_TransportMatrices.h
===================================================================
--- trunk/Utilities/Hector/include/H_TransportMatrices.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_TransportMatrices.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_TransportMatrices_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /** \file H_TransportMatrices.h
Index: trunk/Utilities/Hector/include/H_VerticalKicker.h
===================================================================
--- trunk/Utilities/Hector/include/H_VerticalKicker.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_VerticalKicker.h	(revision 281)
@@ -2,14 +2,21 @@
 #define _H_VerticalKicker_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_VerticalKicker.h
@@ -30,5 +37,5 @@
 		H_VerticalKicker():H_Kicker(VKICKER,0.,0.,0.) {init();}
 		H_VerticalKicker(const double s, const double k, const double l) :H_Kicker(VKICKER,s,k,l){init();}
-		H_VerticalKicker(const string nameE, const double s, const double k, const double l) :H_Kicker(nameE,VKICKER,s,k,l){init();}
+		H_VerticalKicker(const string& nameE, const double s, const double k, const double l) :H_Kicker(nameE,VKICKER,s,k,l){init();}
 		~H_VerticalKicker() {};
 	//@}
Index: trunk/Utilities/Hector/include/H_VerticalQuadrupole.h
===================================================================
--- trunk/Utilities/Hector/include/H_VerticalQuadrupole.h	(revision 264)
+++ trunk/Utilities/Hector/include/H_VerticalQuadrupole.h	(revision 281)
@@ -2,14 +2,22 @@
 #define _H_VerticalQuadrupole_
 
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
 
 /// \file H_VerticalQuadrupole.h
@@ -27,9 +35,9 @@
 		H_VerticalQuadrupole():H_Quadrupole(VQUADRUPOLE,0.,0.,0.) {init();}
 		H_VerticalQuadrupole(const double s, const double k, const double l):H_Quadrupole(VQUADRUPOLE,s,k,l) {init();}
-		H_VerticalQuadrupole(string nameE, const double s, const double k, const double l):H_Quadrupole(nameE,VQUADRUPOLE,s,k,l) {init();}
-		~H_VerticalQuadrupole() {};
-	//@}
-		H_VerticalQuadrupole* clone() const ;
-	private:
+		H_VerticalQuadrupole(const string& nameE, const double s, const double k, const double l):H_Quadrupole(nameE,VQUADRUPOLE,s,k,l) {init();}
+	~H_VerticalQuadrupole() {};
+//@}
+	H_VerticalQuadrupole* clone() const ;
+private:
 		virtual void setTypeString() {typestring = VQUADRUPOLENAME;} ;
 		virtual void setMatrix(const float, const float, const float) ;
Index: trunk/Utilities/Hector/src/H_AbstractBeamLine.cc
===================================================================
--- trunk/Utilities/Hector/src/H_AbstractBeamLine.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_AbstractBeamLine.cc	(revision 281)
@@ -1,13 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
-
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_AbstractBeamLine.cc
@@ -45,7 +51,8 @@
 }
 
-H_AbstractBeamLine::H_AbstractBeamLine(const H_AbstractBeamLine& beamline) {
-	elements = beamline.elements;
-	matrices = beamline.matrices;
+H_AbstractBeamLine::H_AbstractBeamLine(const H_AbstractBeamLine& beamline) : 
+	matrices(beamline.matrices)   {
+	//elements = beamline.elements; //<-- bad ! the new vector contains the same pointers as the previous one
+	cloneElements(beamline);
 	beam_mat.ResizeTo(MDIM,MDIM);
 	beam_mat = beamline.beam_mat;
@@ -55,5 +62,6 @@
 H_AbstractBeamLine& H_AbstractBeamLine::operator=(const H_AbstractBeamLine& beamline) {
 	if(this== &beamline) return *this;
-        elements = beamline.elements;
+	//elements = beamline.elements; //<-- bad ! the new vector contains the same pointers as the previous one
+	cloneElements(beamline);
         matrices = beamline.matrices;
         beam_mat = beamline.beam_mat;
@@ -83,4 +91,12 @@
 	elements.clear(); 
 	matrices.clear(); 
+}
+
+void H_AbstractBeamLine::cloneElements(const H_AbstractBeamLine& beam) {
+	vector<H_OpticalElement*>::const_iterator element_i;
+        for (element_i = beam.elements.begin(); element_i< beam.elements.end(); element_i++) {
+        	H_OpticalElement* temp_el = (*element_i)->clone();
+                elements.push_back(temp_el);
+        }
 }
 
@@ -101,18 +117,4 @@
 }
 
-void H_AbstractBeamLine::add(H_OpticalElement & newElement) {
-	/// @param newElement is added to the beamline
-//	H_OpticalElement * el = new H_OpticalElement(newElement);
-//	elements.push_back(el);
-	elements.push_back(&newElement);
- 	float a = newElement.getS()+newElement.getLength();
-	if (a > beam_length)	{
-		beam_length = a;
-		if(VERBOSE) cout<<"<H_AbstractBeamLine> WARNING : element ("<< newElement.getName()<<") too far away. The beam length has been extended to "<< beam_length << ". "<<endl;
-	}
-	calcSequence();
-	calcMatrix();
-}
-
 const TMatrix H_AbstractBeamLine::getBeamMatrix() const {
 	return beam_mat;
@@ -205,12 +207,14 @@
 }
 
-void H_AbstractBeamLine::printProperties() const {
-	vector<H_OpticalElement*>::const_iterator element_i;
-	cout << "Pointeurs des elements du faisceau" << endl;
-	for (element_i = elements.begin(); element_i < elements.end(); element_i++) {
-		cout << (int)(element_i-elements.begin()) << "\t" << (*element_i)->getName() << "\t" << (*element_i)->getS() << endl;	
-	}
-	return;
-}
+std::ostream& operator<< (std::ostream& os, const H_AbstractBeamLine& be) {
+        vector<H_OpticalElement*>::const_iterator element_i;
+        os << "Beamline content" << endl;
+        for (element_i = be.elements.begin(); element_i < be.elements.end(); element_i++) {
+                os << (int)(element_i - be.elements.begin()) << "\t" << (*element_i)->getName() << "\t" << (*element_i)->getS() << endl;
+        }
+  return os;
+}
+
+void H_AbstractBeamLine::printProperties() const { cout << *this; return; }
 
 void H_AbstractBeamLine::showElements() const{
@@ -485,5 +489,5 @@
 	/// @param offset In meters
 
-	extern bool relative_energy;
+	extern int relative_energy;
 	if(!relative_energy) {
 		vector<H_OpticalElement*>::iterator element_i;
Index: trunk/Utilities/Hector/src/H_Aperture.cc
===================================================================
--- trunk/Utilities/Hector/src/H_Aperture.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_Aperture.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Aperture.cc
@@ -20,44 +27,22 @@
 using namespace std;
 
-H_Aperture::H_Aperture() {
-        type = NONE;
-        setApertureString();
-        x1 = 0;
-        x2 = 0;
-        x3 = 0;
-        x4 = 0;
-        fx = 0;
-        fy = 0;
+H_Aperture::H_Aperture() :
+        type_(NONE), x1(0), x2(0), x3(0), x4(0), fx(0), fy(0),  aptypestring(getApertureString()) {
 }
 
-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) {
+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) :
+        type_(dtype), x1(size1), x2(size2), x3(size3), x4(size4), fx(posx), fy(posy), aptypestring(getApertureString()) {
     /// @param dtype defines the aperture shape
         /// @param size1, size2, size3, size4 are the geometrical sizes (length/width or great/small radii) in m
 	/// @param posx, posy are the (x,y) coordinates of the center of the aperture [m]
-        type = dtype;
-        setApertureString();
-        x1 = size1;
-        x2 = size2;
-	x3 = size3;
-	x4 = size4;
-        fx = posx;
-        fy = posy;
 }
 
-H_Aperture::H_Aperture(const H_Aperture& ap) {
-        type = ap.type;
-	aptypestring = ap.aptypestring;
-        x1 = ap.x1;
-        x2 = ap.x2;
-        x3 = ap.x3;
-        x4 = ap.x4;
-        fx = ap.fx;
-        fy = ap.fy;
+H_Aperture::H_Aperture(const H_Aperture& ap) :
+        type_(ap.type_), x1(ap.x1), x2(ap.x2), x3(ap.x3), x4(ap.x4), fx(ap.fx), fy(ap.fy), aptypestring(ap.aptypestring) {
 }
 
 H_Aperture& H_Aperture::operator=(const H_Aperture& ap) {
 	if(this==&ap) return *this;
-	type = ap.type;
-	aptypestring = ap.aptypestring;
+	type_ = ap.type_;
 	x1 = ap.x1;
 	x2 = ap.x2;
@@ -66,10 +51,16 @@
 	fx = ap.fx;
 	fy = ap.fy;
+	aptypestring = ap.aptypestring;
 	return *this;
 }
 
+std::ostream& operator<< (std::ostream& os, const H_Aperture& ap) {
+	os << "Aperture shape:" << ap.aptypestring << ", parameters "<<ap.x1<<", "<<ap.x2<<", "<<ap.x3<<", "<<ap.x4<<endl;
+	os << " \t Center : " << ap.fx << "," << ap.fy << endl;
+	return os;
+}
+
 void H_Aperture::printProperties() const {
-        cout << "Aperture shape:" << getTypeString() << ", parameters "<<x1<<", "<<x2<<", "<<x3<<", "<<x4<<endl;
-        cout << " \t Center : " << fx << "," << fy << endl;
+	cout << *this;
         return;
 }
@@ -90,6 +81,6 @@
 
 
-void H_Aperture::setApertureString() {
-	switch (type) {
+/*void H_Aperture::setApertureString() {
+	switch (type_) {
 		case NONE: aptypestring = NONENAME; break;
  		case RECTANGULAR: aptypestring = RECTANGULARNAME; break;
@@ -100,2 +91,17 @@
 	}
 }
+*/
+
+const string H_Aperture::getApertureString() const {
+	string str;
+        switch (type_) {
+                case NONE: str = NONENAME; break;
+                case RECTANGULAR: str = RECTANGULARNAME; break;
+                case ELLIPTIC: str = ELLIPTICNAME; break;
+                case CIRCULAR: str = CIRCULARNAME; break;
+                case RECTELLIPSE: str = RECTELLIPSENAME; break;
+                default: str = NONENAME; break;
+        }
+	return str;
+}
+
Index: trunk/Utilities/Hector/src/H_Beam.cc
===================================================================
--- trunk/Utilities/Hector/src/H_Beam.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_Beam.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Beam.cc
@@ -55,9 +62,5 @@
 };
 
-void H_Beam::createBeamParticles(const unsigned int Number_of_particles) {
-	createBeamParticles(Number_of_particles,MP,QP);
-}
-
-void H_Beam::createBeamParticles(const unsigned int Number_of_particles, const double p_mass, const double p_charge) {
+void H_Beam::createBeamParticles(const unsigned int Number_of_particles, const double p_mass, const double p_charge, TRandom* r) {
 	beamParticles.clear();
 	Nparticles = (Number_of_particles<1) ? 1 : Number_of_particles;
@@ -66,8 +69,8 @@
 		p.setPosition(fx_ini,fy_ini,tx_ini,ty_ini,fs_ini);
 		p.setE(fe_ini);
-		p.smearPos(x_disp,y_disp);
-		p.smearAng(tx_disp,ty_disp);
-		p.smearE(e_disp);
-		p.smearS(s_disp);
+		p.smearPos(x_disp,y_disp,r);
+		p.smearAng(tx_disp,ty_disp,r);
+		p.smearE(e_disp,r);
+		p.smearS(s_disp,r);
 		if (VERBOSE) {if (i==0) cout << " x_ini , tx_ini " << p.getX() << " " << p.getTX() << endl;}
 		beamParticles.push_back(p);
@@ -76,5 +79,5 @@
 
 //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) {
-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) {
+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, TRandom* r) {
         beamParticles.clear();
         Nparticles = (Number_of_particles<2) ? 2 : Number_of_particles;
@@ -83,17 +86,17 @@
                 H_BeamParticle p(p_mass,p_charge);
                 if (flat) {
-                        gx = gRandom->Uniform(fx_min,fx_max);
-                        gy = gRandom->Uniform(fy_min,fy_max);
-                        gs = gRandom->Uniform(fs_min,fs_max);
-                        gtx = gRandom->Uniform(tx_min,tx_max);
-                        gty = gRandom->Uniform(ty_min,ty_max);
-                        gE = gRandom->Uniform(E_min,E_max);
+                        gx = r->Uniform(fx_min,fx_max);
+                        gy = r->Uniform(fy_min,fy_max);
+                        gs = r->Uniform(fs_min,fs_max);
+                        gtx = r->Uniform(tx_min,tx_max);
+                        gty = r->Uniform(ty_min,ty_max);
+                        gE = r->Uniform(E_min,E_max);
                 } else {
-                        gx = gRandom->Gaus((fx_min+fx_max)/2,(-fx_min+fx_max)/2);
-                        gy = gRandom->Gaus((fy_min+fy_max)/2,(-fy_min+fy_max)/2);
-                        gs = gRandom->Gaus((fs_min+fs_max)/2,(-fs_min+fs_max)/2);
-                        gtx = gRandom->Gaus((tx_min+tx_max)/2,(-tx_min+tx_max)/2);
-                        gty = gRandom->Gaus((ty_min+ty_max)/2,(-ty_min+ty_max)/2);
-                        gE = gRandom->Gaus ((E_min+E_max)/2,(-E_min+E_max)/2);
+                        gx = r->Gaus((fx_min+fx_max)/2,(-fx_min+fx_max)/2);
+                        gy = r->Gaus((fy_min+fy_max)/2,(-fy_min+fy_max)/2);
+                        gs = r->Gaus((fs_min+fs_max)/2,(-fs_min+fs_max)/2);
+                        gtx = r->Gaus((tx_min+tx_max)/2,(-tx_min+tx_max)/2);
+                        gty = r->Gaus((ty_min+ty_max)/2,(-ty_min+ty_max)/2);
+                        gE = r->Gaus ((E_min+E_max)/2,(-E_min+E_max)/2);
                 }
                 p.setPosition(gx,gy,gtx,gty,gs);
@@ -179,8 +182,4 @@
 }
 
-void H_Beam::computePath(const H_AbstractBeamLine * beamline) {
-	computePath(beamline,false);
-}
-
 /// Propagates the beam until a given s
 void H_Beam::propagate(const float position) {
@@ -189,10 +188,4 @@
                 particle_i->propagate(position);
         }
-}
-
-void H_Beam::emitGamma(const double gee, const double gq2) {
-	/// @param gee = \f$ E_{\gamma} \f$ is the photon energy
-	/// @param gq2 = \f$ Q^2 < 0 \f$ is virtuality of photon \f$ Q^{2} = E^{2}-\vec{k}^{2} \f$
-	emitGamma(gee,gq2,0,2*pi);
 }
 
@@ -386,10 +379,11 @@
 }
 
-void H_Beam::printProperties() const {
+std::ostream& operator<< (std::ostream& os, const H_Beam& be) {
 	vector<H_BeamParticle>::const_iterator particle_i;
-	cout << "There are " << Nparticles << " in the beam." << endl;
-	for (particle_i = beamParticles.begin();particle_i < beamParticles.end(); particle_i++) {
-		particle_i->printProperties();
-	}
+	cout << "There are " << be.Nparticles << " in the beam." << endl;
+	for (particle_i = be.beamParticles.begin(); particle_i < be.beamParticles.end(); particle_i++) {
+		cout << *particle_i;
+	}
+   return os;
 }
 
Index: trunk/Utilities/Hector/src/H_BeamLine.cc
===================================================================
--- trunk/Utilities/Hector/src/H_BeamLine.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_BeamLine.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_BeamLine.cc
@@ -39,14 +46,19 @@
 // are opposite to Wille's. See fill() for more details.
 
-H_BeamLine::H_BeamLine(const int si, const float length) : H_AbstractBeamLine(length){
-	direction = (si >= abs(si)) ? 1 : -1;
-	ips=0;
-	ipx=0;
-	ipy=0;
-	iptx=0;
-	ipty=0;
-}
-
-H_BeamLine::H_BeamLine(const H_BeamLine& beam) : H_AbstractBeamLine(beam) {
+H_BeamLine::H_BeamLine(): H_AbstractBeamLine(), 
+	direction(1), ips(0), ipx(0), ipy(0), iptx(0), ipty(0) {
+}
+
+H_BeamLine::H_BeamLine(const int si, const float length) : H_AbstractBeamLine(length),
+	direction((si >= abs(si)) ? 1 : -1), ips(0), ipx(0), ipy(0), iptx(0), ipty(0) {
+}
+
+H_BeamLine::H_BeamLine(const H_BeamLine& beam) : H_AbstractBeamLine(beam),
+	direction(beam.direction), ips(beam.ips), ipx(beam.ipx), ipy(beam.ipy), iptx(beam.iptx), ipty(beam.ipty) {
+}
+
+H_BeamLine& H_BeamLine::operator=(const H_BeamLine& beam) {
+	if(this==&beam) return *this;
+	H_AbstractBeamLine::operator=(beam); // call the mother's operator=
 	direction = beam.direction;
 	ips = beam.ips;
@@ -55,20 +67,5 @@
 	iptx = beam.iptx;
 	ipty = beam.ipty;
-}
-
-H_BeamLine& H_BeamLine::operator=(const H_BeamLine& beam) {
-	if(this==&beam) return *this;
-	direction = beam.direction;
-	ips = beam.ips;
-	ipx = beam.ipx;
-    ipy = beam.ipy;
-    iptx = beam.iptx;
-    ipty = beam.ipty;
 	return *this;
-}
-
-void H_BeamLine::findIP(const string& filename) {
-	findIP(filename,"IP5");
-	return;
 }
 
@@ -125,9 +122,4 @@
 	temp[3] = ipty;
 	return temp;
-}
-
-void H_BeamLine::fill(const string& filename) {
-	fill(filename,1,"IP5");
-	return;
 }
 
Index: trunk/Utilities/Hector/src/H_BeamLineParser.cc
===================================================================
--- trunk/Utilities/Hector/src/H_BeamLineParser.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_BeamLineParser.cc	(revision 281)
@@ -1,18 +1,25 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_BeamLineParser.cc
 /// \brief Reader for madx tables
 ///
-/// Notes : Vï¿œifier que tous les SBEND sont toujours appelï¿œ MB. Et seulement comme ï¿œ !
-/// Vï¿œifier qu'il n'y a pas de problï¿œe d'inversion H/V QUADRUPOLES
+/// Notes : Verifier que tous les SBEND sont toujours appeles MB. Et seulement comme ca !
+/// Verifier qu'il n'y a pas de problemes d'inversion H/V QUADRUPOLES
 /// no distinction between H and Vkickers ?
 /// The identification of the element is based on the values of k1l, k2l, hkick, vkick and on their name.
Index: trunk/Utilities/Hector/src/H_BeamParticle.cc
===================================================================
--- trunk/Utilities/Hector/src/H_BeamParticle.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_BeamParticle.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_BeamParticle.cc
@@ -39,5 +46,5 @@
 using namespace std;
 
-void H_BeamParticle::init() {
+void H_BeamParticle::init() { // for more efficiency, put the objects away from init!
 	mp = MP;
 	qp = QP;
@@ -57,23 +64,14 @@
 }
 
-H_BeamParticle::H_BeamParticle() {
+H_BeamParticle::H_BeamParticle() { 
 	init();
 }
 
-H_BeamParticle::H_BeamParticle(const H_BeamParticle& p) {
-	mp = p.mp;
-	qp = p.qp;
-	fx = p.fx;
-	fy = p.fy;
-	thx = p.thx;
-	thy = p.thy;
-	fs = p.fs;
-	energy = p.energy;
-	hasstopped = p.hasstopped;
-	hasemitted = p.hasemitted;
-	isphysical = p.isphysical;
-	stop_position = new TVectorD(*(p.stop_position));
+H_BeamParticle::H_BeamParticle(const H_BeamParticle& p): 
+	mp(p.mp), qp(p.qp), fs(p.fs), fx(p.fx), fy(p.fy), thx(p.thx), thy(p.thy), 
+	energy(p.energy), hasstopped(p.hasstopped), hasemitted(p.hasemitted),
+	isphysical(p.isphysical), stop_position(new TVectorD(*(p.stop_position))),
+	stop_element(0), positions(p.positions) {
 	if(p.hasstopped) stop_element = new H_OpticalElement(*(p.stop_element)); 
-	positions = p.positions;
 }
 
@@ -100,9 +98,10 @@
         stop_position = new TVectorD(*(p.stop_position));
 	if(p.hasstopped) stop_element = new H_OpticalElement(*(p.stop_element));
+	else stop_element = 0;
         positions = p.positions;
 	return *this;
 }
 
-bool H_BeamParticle::stopped(const H_AbstractBeamLine * beamline) {
+const bool H_BeamParticle::stopped(const H_AbstractBeamLine * beamline) {
 	vector<TVectorD>::const_iterator position_i;
 	for(position_i = positions.begin(); position_i < positions.end()-1; position_i++) {
@@ -159,8 +158,19 @@
 }
 
-void H_BeamParticle::smearPos(const double dx,const double dy) {
+
+
+void H_BeamParticle::smearPos(const double dx,const double dy, TRandom* r) {
   // the beam is centered on (fx,fy) at IP
-        fx = gRandom->Gaus(fx,dx);
-        fy = gRandom->Gaus(fy,dy);
+        fx = r->Gaus(fx,dx);
+        fy = r->Gaus(fy,dy);
+        positions.clear();
+        addPosition(fx,thx,fy,thy,fs);
+        return;
+}
+
+void H_BeamParticle::smearAng(const double tx, const double ty, TRandom* r) {
+  // the beam transverse direction is centered on (thx,thy) at IP
+        thx = r->Gaus(thx,tx);
+        thy = r->Gaus(thy,ty);
 	positions.clear();
 	addPosition(fx,thx,fy,thy,fs);
@@ -168,43 +178,11 @@
 }
 
-void H_BeamParticle::smearPos() {
-  // the beam is centered on (fx,fy) at IP
-	fx = gRandom->Gaus(fx,SX);
-	fy = gRandom->Gaus(fy,SY);
-	positions.clear();
-	addPosition(fx,thx,fy,thy,fs);
-	return;
-}
-
-void H_BeamParticle::smearAng(const double tx, const double ty) {
-  // the beam transverse direction is centered on (thx,thy) at IP
-        thx = gRandom->Gaus(thx,tx);
-        thy = gRandom->Gaus(thy,ty);
-	positions.clear();
-	addPosition(fx,thx,fy,thy,fs);
-	return;
-}
-
-void H_BeamParticle::smearAng() {
-   // the beam transverse direction is centered on (thx,thy) at IP
-	thx = gRandom->Gaus(thx,STX);
-	thy = gRandom->Gaus(thy,STY);
-	positions.clear();
-	addPosition(fx,thx,fy,thy,fs);
-	return;
-}
-
-void H_BeamParticle::smearE(const double erre) {
-	energy = gRandom->Gaus(energy,erre);
-	return;
-}
-
-void H_BeamParticle::smearE() {
-	energy = gRandom->Gaus(energy,SBE);
-	return;
-}
-
-void H_BeamParticle::smearS(const double errs) {
-        fs= gRandom->Gaus(fs,errs);
+void H_BeamParticle::smearE(const double erre, TRandom* r) {
+	energy = r->Gaus(energy,erre);
+	return;
+}
+
+void H_BeamParticle::smearS(const double errs, TRandom* r) {
+        fs= r->Gaus(fs,errs);
 	positions.clear();
 	addPosition(fx,thx,fy,thy,fs);
@@ -212,10 +190,4 @@
 }
 
-void H_BeamParticle::smearS() {
-        fs = gRandom->Gaus(fs,SS);
-	positions.clear();
-	addPosition(fx,thx,fy,thy,fs);
-        return;
-}
 
 void H_BeamParticle::set4Momentum(const double px, const double py, const double pz, const double ene) {
@@ -267,9 +239,4 @@
 	if(hasstopped) return stop_element;
 	else { H_OpticalElement * dummy_el = new H_Drift("",0,0); return dummy_el;}
-}
-
-void H_BeamParticle::emitGamma(const double gee, const double gq2) {
-	emitGamma(gee,gq2,0,2*pi);
-	return;
 }
 
@@ -362,13 +329,13 @@
 }
 
-void H_BeamParticle::printProperties() const {
-	cout << " M   = " << getM()  << "GeV ";
-	cout << " Q   = " << getQ()  << "e";
-	cout << " fx  = " << getX()  << "m   ";
- 	cout << " fy  = " << getY()  << "m   ";
-	cout << " thx = " << getTX() << "rad ";
-	cout << " thy = " << getTY() << "rad ";
-	cout << endl;
-	return;
+std::ostream& operator<< (std::ostream& os, const H_BeamParticle& p) {
+        os << " M   = " << p.getM()  << "GeV ";
+        os << " Q   = " << p.getQ()  << "e";
+        os << " fx  = " << p.getX()  << "m   ";
+        os << " fy  = " << p.getY()  << "m   ";
+        os << " thx = " << p.getTX() << "rad ";
+        os << " thy = " << p.getTY() << "rad ";
+        os << endl;
+   return os;
 }
 
@@ -491,8 +458,4 @@
 	delete [] graph;
         return ppath;
-}
-
-void H_BeamParticle::computePath(const H_AbstractBeamLine * beam) {
-	computePath(beam,true);
 }
 
Index: trunk/Utilities/Hector/src/H_CircularAperture.cc
===================================================================
--- trunk/Utilities/Hector/src/H_CircularAperture.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_CircularAperture.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_CircularAperture.cc
@@ -23,18 +30,11 @@
 using namespace std;
 
-/// Circular apertures
-H_CircularAperture::H_CircularAperture(const float r, const float posx, const float posy) :H_EllipticAperture(r,r,posx,posy) { 
-        /// @param r is the radius of the circular shape
-        /// @param posx, posy are the (x,y) coordinates of the center of the circle
-	type= CIRCULAR; 
-}
-
 H_CircularAperture* H_CircularAperture::clone() const {
 	return new H_CircularAperture(x1,fx,fy);
 }
 
-void H_CircularAperture::printProperties() const {
-        cout << "Aperture shape:" << getTypeString() << ", aperture radius : " << x1 << endl;
-        cout << " \t Center : " << fx << "," << fy << endl;
-        return;
+std::ostream& operator<< (std::ostream& os, const H_CircularAperture& ap) {
+        os     << "Aperture shape:" << ap.aptypestring << ", aperture radius : " << ap.x1 << endl;
+        os     << " \t Center : " << ap.fx << "," << ap.fy << endl;
+        return os;
 }
Index: trunk/Utilities/Hector/src/H_Dipole.cc
===================================================================
--- trunk/Utilities/Hector/src/H_Dipole.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_Dipole.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Dipole.cc
@@ -25,17 +32,12 @@
 }
 
-void H_Dipole::printProperties() const {
-	cout << typestring;
-	cout << name;
-	cout<<"\t at s = "<< fs;
-	cout<<"\t length = "<< element_length;
-	cout<<"\t k0 = "<<fk;
-	cout<<endl;
-        if(element_aperture->getType()!=NONE) {
-        	cout <<"\t aperture type = " << element_aperture->getTypeString();
-                element_aperture->printProperties();
+std::ostream& operator<< (std::ostream& os, const H_Dipole& el) {
+	os << el.typestring << el.name <<"\t at s = "<< el.fs <<"\t length = "<< el.element_length <<"\t k0 = "<<el.fk << endl;
+        if(el.element_aperture->getType()!=NONE) {
+                os << *(el.element_aperture) << endl;
 	}
 
-	if(element_length<0)  { if(VERBOSE) cout<<"<H_Dipole> ERROR : Interpenetration of elements !"<<endl; }
-	if(element_length==0) { if(VERBOSE) cout<<"<H_Dipole> WARNING : 0-length "<< name << " !" << endl; }
+	if(el.element_length<0)  { if(VERBOSE) os <<"<H_Dipole> ERROR : Interpenetration of elements !"<<endl; }
+	if(el.element_length==0) { if(VERBOSE) os <<"<H_Dipole> WARNING : 0-length "<< el.name << " !" << endl; }
+   return os;
 }
Index: trunk/Utilities/Hector/src/H_Drift.cc
===================================================================
--- trunk/Utilities/Hector/src/H_Drift.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_Drift.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Drift.cc
@@ -26,15 +33,12 @@
 }
 
-void H_Drift::printProperties() const {
-	cout << typestring << name;
-	cout << "\t\t at s = " << fs;
-	cout << "\t length = " << element_length;
-	cout<<endl;
-	if(element_aperture->getType()!=NONE) {
-		cout <<"\t aperture type = " << element_aperture->getTypeString();
-                element_aperture->printProperties();
+std::ostream& operator<< (std::ostream& os, const H_Drift& el) {
+	os << el.typestring << el.name << "\t\t at s = " << el.fs << "\t length = " << el.element_length <<endl;
+	if(el.element_aperture->getType()!=NONE) {
+		os << *(el.element_aperture) << endl;
         }
-	if(element_length<0)  { if(VERBOSE) cout<<"<H_Drift> ERROR : Interpenetration of elements !"<<endl; }
-	if(element_length==0) { if(VERBOSE) cout<<"<H_Drift> WARNING : 0-length "<< name << " !" << endl; }
+	if(el.element_length<0 && VERBOSE) os <<"<H_Drift> ERROR : Interpenetration of elements !"<<endl;
+	else if(el.element_length==0 && VERBOSE) os <<"<H_Drift> WARNING : 0-length "<< el.name << " !" << endl;
+   return os;
 }
 
Index: trunk/Utilities/Hector/src/H_EllipticAperture.cc
===================================================================
--- trunk/Utilities/Hector/src/H_EllipticAperture.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_EllipticAperture.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_EllipticAperture.cc
@@ -25,5 +32,20 @@
 using namespace std;
 
-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) {
+H_EllipticAperture::H_EllipticAperture(const int type, const float l, const float h, const float posx, const float posy) :
+	H_Aperture(type,l,h,0,0,posx,posy) {
+        /// @param type is the aperture type (ELLIPTIC or CIRCULAR)
+        /// @param l, h are the length and height of the elliptic shape
+        /// @param posx, posy are the (x,y) coordinates of the center of the ellipse
+
+	if (type!= ELLIPTIC && type != CIRCULAR) { 
+		cout << "Warning: trying to define an EllipticalAperture which is neither elliptical nor circular." << endl;
+		cout << "'Elliptical' type forced\n"; 
+		type_ = ELLIPTIC; 
+		aptypestring = getApertureString(); 
+	}
+}
+
+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) {
         /// @param l, h are the length and height of the elliptic shape
         /// @param posx, posy are the (x,y) coordinates of the center of the ellipse
@@ -48,7 +70,7 @@
 }
 
-void H_EllipticAperture::printProperties() const {
-	cout<< "Aperture shape:" << getTypeString() << ", ellipse axes : "<<x1<<", "<<x2<<endl;
-	cout << " \t Center : " << fx << "," << fy << endl;
-	return;
+std::ostream& operator<< (std::ostream& os, const H_EllipticAperture& ap) {
+	os<< "Aperture shape:" << ap.aptypestring << ", ellipse axes : "<< ap.x1 <<", " << ap.x2 << endl;
+	os << " \t Center : "  << ap.fx << "," << ap.fy << endl;
+	return os;
 }
Index: trunk/Utilities/Hector/src/H_HorizontalKicker.cc
===================================================================
--- trunk/Utilities/Hector/src/H_HorizontalKicker.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_HorizontalKicker.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_HorizontalKicker.cc
Index: trunk/Utilities/Hector/src/H_HorizontalQuadrupole.cc
===================================================================
--- trunk/Utilities/Hector/src/H_HorizontalQuadrupole.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_HorizontalQuadrupole.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_HorizontalQuadrupole.cc
Index: trunk/Utilities/Hector/src/H_Kicker.cc
===================================================================
--- trunk/Utilities/Hector/src/H_Kicker.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_Kicker.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Kicker.cc
@@ -27,17 +34,13 @@
 }
 
-void H_Kicker::printProperties() const {
-	cout << typestring;
-	cout << name;
-	cout<<"\t at s = "<< fs;
-	cout<<"\t length = "<< element_length;
-	cout<<"\t k0 = "<<fk;
-	cout<<endl;
-	if(element_aperture->getType()!=NONE) {
-		cout <<"\t aperture type = " << element_aperture->getTypeString();
-                element_aperture->printProperties();
+std::ostream& operator<< (std::ostream& os, const H_Kicker& el) {
+	os << el.typestring << el.name <<"\t at s = "<< el.fs <<"\t length = "<< el.element_length;
+	os<<"\t k0 = "<< el.fk <<endl;
+	if(el.element_aperture->getType()!=NONE) {
+		os << *(el.element_aperture) << endl;
         }
 
-	if(element_length<0)  { if(VERBOSE) cout<<"<H_Kicker> ERROR : Interpenetration of elements !"<<endl; }
-	if(element_length==0) { if(VERBOSE) cout<<"<H_Kicker> WARNING : 0-length "<< name << " !" << endl; }
+	if(el.element_length<0 && VERBOSE) os<<"<H_Kicker> ERROR : Interpenetration of elements !"<<endl; 
+	else if(el.element_length==0 && VERBOSE) os<<"<H_Kicker> WARNING : 0-length "<< el.name << " !" << endl; 
+  return os;
 }
Index: trunk/Utilities/Hector/src/H_Marker.cc
===================================================================
--- trunk/Utilities/Hector/src/H_Marker.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_Marker.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Marker.cc
@@ -24,11 +31,10 @@
 }
 
-void H_Marker::printProperties() const {
-	cout << typestring << name;
-	cout << "\t\t at s = " << fs << endl;
-	if(element_aperture->getType()!=NONE) {
-		cout <<"\t aperture type = " << element_aperture->getTypeString();
-                element_aperture->printProperties();
+std::ostream& operator<< (std::ostream& os, const H_Marker& el) {
+	os << el.typestring << el.name << "\t\t at s = " << el.fs;
+	if(el.element_aperture->getType()!=NONE) {
+                os << *(el.element_aperture) << endl;
         }
+   return os;
 }
 
Index: trunk/Utilities/Hector/src/H_OpticalElement.cc
===================================================================
--- trunk/Utilities/Hector/src/H_OpticalElement.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_OpticalElement.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_OpticalElement.cc
@@ -135,22 +142,16 @@
 */
 
-
-
-void H_OpticalElement::printProperties() const {
-		cout << typestring;
-		cout << name;
-		cout <<"\t at s = " << fs;
-		cout <<"\t length = "<< element_length;
-		if(fk!=0) cout <<"\t strength = " << fk;
-		if(element_aperture->getType()!=NONE) { 
-			cout <<"\t aperture type = " << element_aperture->getTypeString();
-			element_aperture->printProperties();			
-		}
-	
-		cout<<endl;
-		if(element_length<0)  { if(VERBOSE) cout<<"<H_OpticalElement> ERROR : Interpenetration of elements !"<<endl; }
-		if(element_length==0) { if(VERBOSE) cout<<"<H_OpticalElement> WARNING : 0-length "<< typestring << " !" << endl; }
-
- return;
+std::ostream& operator<< (std::ostream& os, const H_OpticalElement& el) {
+        os << el.typestring << el.name << "\t at s = " << el.fs << "\t length = "<< el.element_length;
+        if(el.fk!=0) os <<"\t strength = " << el.fk;
+        if(el.element_aperture->getType()!=NONE) {
+                os << *(el.element_aperture) << endl;
+        }
+        os<<endl;
+        if(el.element_length<0 && VERBOSE) 
+		os <<"<H_OpticalElement> ERROR : Interpenetration of elements !"<<endl; 
+        else if(el.element_length==0 && VERBOSE) 
+		os <<"<H_OpticalElement> WARNING : 0-length "<< el.typestring << " !" << endl;
+  return os;
 }
 
@@ -189,5 +190,5 @@
 }
 
-TVectorD H_OpticalElement::getHitPosition(TVectorD init_pos, double energy_loss, double mp, double qp) {
+TVectorD H_OpticalElement::getHitPosition(const TVectorD& init_pos, const double energy_loss, const double mp, const double qp) {
 	if(!element_length) {
 		// cout<<"O-length element ("<<getName()<<"), should not appear here !"<<endl;
@@ -196,5 +197,7 @@
 	// some declarations
 	bool inside = false;
-	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};
+	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};
 	TMatrixD mat_init(1,MDIM,vec);
 	TMatrixD mat_min(1,MDIM,vec);
@@ -253,39 +256,39 @@
    		mat_min[0][1] = mat_min[0][1] + tan(temp_el->getTX());
  	  	mat_min[0][2] = mat_min[0][2] + temp_el->getY();
-	    mat_min[0][3] = mat_min[0][3] + tan(temp_el->getTY());
+		mat_min[0][3] = mat_min[0][3] + tan(temp_el->getTY());
 		mat_min[0][4] = min_pos + init_pos[4];
 		// getting vector at max_pos (for second boundary) :
 		temp_el->setLength(max_pos);
 	   	mat_max[0][0] = mat_init[0][0] - temp_el->getX();
-	    mat_max[0][1] = mat_init[0][1] - tan(temp_el->getTX());
- 		mat_max[0][2] = mat_init[0][2] - temp_el->getY();
- 	    mat_max[0][3] = mat_init[0][3] - tan(temp_el->getTY());
- 	    mat_max *= temp_el->getMatrix(energy_loss,mp,qp);
- 	    mat_max[0][0] = mat_max[0][0] + temp_el->getX();
-  	    mat_max[0][1] = mat_max[0][1] + tan(temp_el->getTX());
-  	    mat_max[0][2] = mat_max[0][2] + temp_el->getY();
-        mat_max[0][3] = mat_max[0][3] + tan(temp_el->getTY());
+		mat_max[0][1] = mat_init[0][1] - tan(temp_el->getTX());
+		mat_max[0][2] = mat_init[0][2] - temp_el->getY();
+		mat_max[0][3] = mat_init[0][3] - tan(temp_el->getTY());
+		mat_max *= temp_el->getMatrix(energy_loss,mp,qp);
+		mat_max[0][0] = mat_max[0][0] + temp_el->getX();
+		mat_max[0][1] = mat_max[0][1] + tan(temp_el->getTX());
+		mat_max[0][2] = mat_max[0][2] + temp_el->getY();
+		mat_max[0][3] = mat_max[0][3] + tan(temp_el->getTY());
 		mat_max[0][4] = max_pos + init_pos[4];
 	}
 	// getting vector in the middle (for estimate) :
 	temp_el->setLength((max_pos+min_pos)/2.);
-    mat_stop[0][0] = mat_init[0][0] - temp_el->getX();
-    mat_stop[0][1] = mat_init[0][1] - tan(temp_el->getTX());
-    mat_stop[0][2] = mat_init[0][2] - temp_el->getY();
-    mat_stop[0][3] = mat_init[0][3] - tan(temp_el->getTY());
-    mat_stop *= temp_el->getMatrix(energy_loss,mp,qp);
-    mat_stop[0][0] = mat_stop[0][0] + temp_el->getX();
-    mat_stop[0][1] = mat_stop[0][1] + tan(temp_el->getTX());
-    mat_stop[0][2] = mat_stop[0][2] + temp_el->getY();
-    mat_stop[0][3] = mat_stop[0][3] + tan(temp_el->getTY());
+	mat_stop[0][0] = mat_init[0][0] - temp_el->getX();
+	mat_stop[0][1] = mat_init[0][1] - tan(temp_el->getTX());
+	mat_stop[0][2] = mat_init[0][2] - temp_el->getY();
+	mat_stop[0][3] = mat_init[0][3] - tan(temp_el->getTY());
+	mat_stop *= temp_el->getMatrix(energy_loss,mp,qp);
+	mat_stop[0][0] = mat_stop[0][0] + temp_el->getX();
+	mat_stop[0][1] = mat_stop[0][1] + tan(temp_el->getTX());
+	mat_stop[0][2] = mat_stop[0][2] + temp_el->getY();
+	mat_stop[0][3] = mat_stop[0][3] + tan(temp_el->getTY());
 	mat_stop[0][4] = (max_pos+min_pos)/2. + init_pos[4];
 
-    double xys[LENGTH_VEC];
-    xys[INDEX_X]=  mat_stop[0][0]*URAD;
-    xys[INDEX_TX]= atan(mat_stop[0][1])*URAD;
-    xys[INDEX_Y]=  mat_stop[0][2]*URAD;
-    xys[INDEX_TY]= atan(mat_stop[0][3])*URAD;
-    xys[INDEX_S]=  mat_stop[0][4] ;
-    TVectorD temp_vec(LENGTH_VEC,xys);
+	double xys[LENGTH_VEC];
+	xys[INDEX_X]=  mat_stop[0][0]*URAD;
+	xys[INDEX_TX]= atan(mat_stop[0][1])*URAD;
+	xys[INDEX_Y]=  mat_stop[0][2]*URAD;
+	xys[INDEX_TY]= atan(mat_stop[0][3])*URAD;
+	xys[INDEX_S]=  mat_stop[0][4] ;
+	TVectorD temp_vec(LENGTH_VEC,xys);
 
 	if(precision_estimate) {
@@ -297,12 +300,12 @@
 		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;
 		cout<<"\t hit point y  : "<<mat_stop[0][2]*URAD;
-        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));
-        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;
-    	cout<<"\t hit point tx : "<<mat_stop[0][1]*URAD;
-        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));
-        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;
+		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));
+		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;
+		cout<<"\t hit point tx : "<<mat_stop[0][1]*URAD;
+		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));
+		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;
 		cout<<"\t hit point ty : "<<mat_stop[0][3]*URAD;
-        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));
-        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;
+		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));
+		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;
 
 	}
Index: trunk/Utilities/Hector/src/H_Parameters.cc
===================================================================
--- trunk/Utilities/Hector/src/H_Parameters.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_Parameters.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 ///\file H_Parameters.cc
Index: trunk/Utilities/Hector/src/H_Quadrupole.cc
===================================================================
--- trunk/Utilities/Hector/src/H_Quadrupole.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_Quadrupole.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_Quadrupole.cc
@@ -24,17 +31,12 @@
 }
 
-void H_Quadrupole::printProperties() const{
-	cout << typestring;
-	cout << name;
-	cout << "\t at s = " << fs;
-	cout << "\t length = " << element_length;
-	cout << "\t k1 = " << fk;
-	cout<<endl;
-        if(element_aperture->getType()!=NONE) {
-        	cout <<"\t aperture type = " << element_aperture->getTypeString();
-                element_aperture->printProperties();
+std::ostream& operator<< (std::ostream& os, const H_Quadrupole& el) {
+	os << el.typestring  << el.name  << "\t at s = " << el.fs << "\t length = " << el.element_length << "\t k1 = " << el.fk <<endl;
+        if(el.element_aperture->getType()!=NONE) {
+        	os << *(el.element_aperture) << endl;
 	}
 
-	if(element_length<0)  { if(VERBOSE) cout<<"<H_Quadrupole> ERROR : Interpenetration of elements !"<<endl; }
-	if(element_length==0) { if(VERBOSE) cout<<"<H_Quadrupole> WARNING : 0-length "<< typestring << " !" << endl; }
+	if(el.element_length<0 && VERBOSE) os<<"<H_Quadrupole> ERROR : Interpenetration of elements !"<<endl; 
+	else if(el.element_length==0 && VERBOSE) os<<"<H_Quadrupole> WARNING : 0-length "<< el.typestring << " !" << endl; 
+   return os;
 }
Index: trunk/Utilities/Hector/src/H_RecRPObject.cc
===================================================================
--- trunk/Utilities/Hector/src/H_RecRPObject.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_RecRPObject.cc	(revision 281)
@@ -1,13 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
-
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_RecRPObject.cc
@@ -41,11 +47,9 @@
 				l_1(new TF1("l_1","[0] + [1]*x + [2]*x*x ",emin,emax)), 
 				l_2(new TF1("l_2","[0] + [1]*x + [2]*x*x ",emin,emax)) 
-				{
-	// emax = -1; /* GeV */
-}
-
-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), 
+{}
+
+H_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), 
 				txip(NOT_YET_COMPUTED), tyip(NOT_YET_COMPUTED), energy(NOT_YET_COMPUTED), q2(NOT_YET_COMPUTED), pt(NOT_YET_COMPUTED), 
-				thebeam(beam),
+				thebeam(beam->clone()),
 				f_1(new TF1("f_1","[0] + [1]*x + [2]*x*x ",emin,emax)), 
 				f_2(new TF1("f_2","[0] + [1]*x + [2]*x*x ",emin,emax)), 
@@ -58,7 +62,38 @@
 				l_1(new TF1("l_1","[0] + [1]*x + [2]*x*x ",emin,emax)), 
 				l_2(new TF1("l_2","[0] + [1]*x + [2]*x*x ",emin,emax))
-				{
-	if(ss1==ss2) cout<<"<H_RecRPObject> WARNING : detectors are on same position"<<endl;
-	// emax = -1; /* GeV */
+	{if(ss1==ss2) cout<<"<H_RecRPObject> WARNING : detectors are on same position"<<endl;
+}
+
+H_RecRPObject::H_RecRPObject(const H_RecRPObject& r):
+   emin(r.emin), emax(r.emax), x1(r.x1), x2(r.x2), y1(r.y1), y2(r.y2), s1(r.s1), s2(r.s2),
+   txip(r.txip), tyip(r.tyip), energy(r.energy), q2(r.q2),  pt(r.pt), 
+   //thebeam(r.thebeam->clone()),
+   thebeam(new H_AbstractBeamLine(*(r.thebeam))),
+   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))),
+   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))),
+   l_1(new TF1(*(r.l_1))),  l_2(new TF1(*(r.l_2)))
+ {}
+
+H_RecRPObject& H_RecRPObject::operator=(const H_RecRPObject& r) {
+  if (this == &r) return *this;
+   emin = r.emin, emax = r.emax;
+   x1 = r.x1;   x2 = r.x2; 
+   y1 = r.y1;   y2 = r.y2; 
+   s1 = r.s1;   s2 = r.s2;
+   txip= r.txip; tyip=r.tyip;
+   energy= r.energy; q2= r.q2;  pt= r.pt;
+   //thebeam = r.thebeam->clone();
+   thebeam = new H_AbstractBeamLine(*(r.thebeam));
+   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));
+   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));
+   l_1 = new TF1(*(r.l_1));
+   l_2 = new TF1(*(r.l_2));
+  return *this;
 }
 
@@ -308,2 +343,10 @@
 	return pt;
 }
+
+std::ostream& operator<< (std::ostream& os, const H_RecRPObject& rp) {
+	os << "e_min=" <<  rp.emin << "\t e_max= " << rp.emax << endl;
+	os << "x1="    << rp.x1 << "\t x2= " << rp.x2 << "\t y1=" << rp.y1 << "\t y2=" << rp.y2 
+	   << "\t s1=" << rp.s1 << "\t s2=" << rp.s2 << endl;
+	os << "txip=" << rp.txip << "\t tyip=" << rp.tyip << "\t energy=" << rp.energy << "\t q2=" << rp.q2 << "\t pt=" << rp.pt << endl;
+   return os;
+}
Index: trunk/Utilities/Hector/src/H_RectEllipticAperture.cc
===================================================================
--- trunk/Utilities/Hector/src/H_RectEllipticAperture.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_RectEllipticAperture.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_RectEllipticAperture.cc
@@ -29,5 +36,4 @@
 	/// @param l, h, L, H are the geometrical parameters of the rect-ellipse shape
 	/// @param posx, posy defines the (x,y) of the center of the shape
-	type= RECTELLIPSE;
 }
 
@@ -127,7 +133,7 @@
 }
 
-void H_RectEllipticAperture::printProperties() const {
-	cout << "Aperture shape:" << getTypeString() << ", parameters " <<x1<<", "<<x2<<", "<<x3<<", "<<x4<< endl;
-	cout << " \t Center : "<<fx<<", "<<fy<<endl;
-	return;
+std::ostream& operator<< (std::ostream& os, const H_RectEllipticAperture& ap) {
+	os << "Aperture shape:" << ap.aptypestring << ", parameters " << ap.x1 <<", "<< ap.x2 <<", "<< ap.x3 <<", "<< ap.x4 << endl;
+	os << " \t Center : " << ap.fx <<", "<< ap.fy <<endl;
+	return os;
 }
Index: trunk/Utilities/Hector/src/H_RectangularAperture.cc
===================================================================
--- trunk/Utilities/Hector/src/H_RectangularAperture.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_RectangularAperture.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_RectangularAperture.cc
@@ -48,7 +55,9 @@
 	return;
 }
-void H_RectangularAperture::printProperties() const {
-	cout << "Aperture shape:" << getTypeString() << ", rectangle Sides : "<<x1<<", "<<x2<<endl;
-	cout << " \t Center : " << fx << "," << fy << endl;
-	return;
+
+std::ostream& operator<< (std::ostream& os, const H_RectangularAperture& ap) {
+	os << "Aperture shape:" << ap.aptypestring << ", rectangle sides : " << ap. x1 <<", " << ap.x2 <<endl;
+	os << " \t Center : " << ap.fx << "," << ap.fy << endl;
+        return os;
 }
+
Index: trunk/Utilities/Hector/src/H_RectangularCollimator.cc
===================================================================
--- trunk/Utilities/Hector/src/H_RectangularCollimator.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_RectangularCollimator.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_RectangularCollimator.cc
@@ -36,16 +43,13 @@
 }
 
-void H_RectangularCollimator::printProperties() const {
-	cout << typestring << name;
-	cout << "\t\t at s = " << fs;
-	cout << "\t length = " << element_length;
-	cout<<endl;
-	if(element_aperture->getType()!=NONE) {
-        	cout <<"\t aperture type = " << element_aperture->getTypeString();
-                	element_aperture->printProperties();
+std::ostream& operator<< (std::ostream& os, const H_RectangularCollimator& el) {
+	os << el.typestring << el.name << "\t\t at s = " << el.fs << "\t length = " << el.element_length <<endl;
+	if(el.element_aperture->getType()!=NONE) {
+        	os << *(el.element_aperture) << endl;
 	}
 
-	if(element_length<0)  { if(VERBOSE) cout<<"<H_RectangularCollimator> ERROR : Interpenetration of elements !"<<endl; }
-	if(element_length==0) { if(VERBOSE) cout<<"<H_RectangularCollimator> WARNING : 0-length "<< name << " !" << endl; }
+	if(el.element_length<0 && VERBOSE) os <<"<H_RectangularCollimator> ERROR : Interpenetration of elements !"<<endl; 
+	else if(el.element_length==0 && VERBOSE) os <<"<H_RectangularCollimator> WARNING : 0-length "<< el.name << " !" << endl;
+   return os;
 }
 
Index: trunk/Utilities/Hector/src/H_RectangularDipole.cc
===================================================================
--- trunk/Utilities/Hector/src/H_RectangularDipole.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_RectangularDipole.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_RectangularDipole.cc
Index: trunk/Utilities/Hector/src/H_RomanPot.cc
===================================================================
--- trunk/Utilities/Hector/src/H_RomanPot.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_RomanPot.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_RomanPot.cc
@@ -39,13 +46,10 @@
 }
 
-void H_RomanPot::printProperties() const {
-		cout << typestring << name;
-		cout << "\t\t at s = " << fs;
-                if(element_aperture->getType()!=NONE) {
-                        cout <<"\t aperture type = " << element_aperture->getTypeString();
-                        element_aperture->printProperties();
-                }
-
-		cout<<endl;
+std::ostream& operator<< (std::ostream& os, const H_RomanPot& el) {
+	os << el.typestring << el.name << "\t\t at s = " << el.fs;
+	if(el.element_aperture->getType()!=NONE) {
+		os << *(el.element_aperture) << endl;
+	}
+   return os;
 }
 
Index: trunk/Utilities/Hector/src/H_SectorDipole.cc
===================================================================
--- trunk/Utilities/Hector/src/H_SectorDipole.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_SectorDipole.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_SectorDipole.cc
Index: trunk/Utilities/Hector/src/H_TransportMatrices.cc
===================================================================
--- trunk/Utilities/Hector/src/H_TransportMatrices.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_TransportMatrices.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_TransportMatrices.cc
@@ -29,5 +36,5 @@
 
 extern double omega(const double k, const double l) {
-		// [l] = [m] and [k] = [1/mï¿œ] for quadrupoles
+		// [l] = [m] and [k] = [1/m^2] for quadrupoles
 		// [omega] = [1]
 	return sqrt(fabs(k))*l;
@@ -35,5 +42,5 @@
 
 extern double radius(const double k) {
-		// [k] = [1/mï¿œ] for quadrupoles
+		// [k] = [1/m^2] for quadrupoles
 		// [k] = [1/m]  for dipoles
 		// [radius(k)] = [m]
Index: trunk/Utilities/Hector/src/H_VerticalKicker.cc
===================================================================
--- trunk/Utilities/Hector/src/H_VerticalKicker.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_VerticalKicker.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_VerticalKicker.cc
Index: trunk/Utilities/Hector/src/H_VerticalQuadrupole.cc
===================================================================
--- trunk/Utilities/Hector/src/H_VerticalQuadrupole.cc	(revision 264)
+++ trunk/Utilities/Hector/src/H_VerticalQuadrupole.cc	(revision 281)
@@ -1,12 +1,19 @@
-/*
----- Hector the simulator ----
-   A fast simulator of particles through generic beamlines.
-   J. de Favereau, X. Rouby ~~~ hector_devel@cp3.phys.ucl.ac.be
-
-        http://www.fynu.ucl.ac.be/hector.html
-
-   Centre de Physique des Particules et de PhÃ©nomÃ©nologie (CP3)
-   UniversitÃ© Catholique de Louvain (UCL)
-*/
+  /* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                         *
+*                   --<--<--  A fast simulator --<--<--     *
+*                 / --<--<--     of particle   --<--<--     *
+*  ----HECTOR----<                                          *
+*                 \ -->-->-- transport through -->-->--     *
+*                   -->-->-- generic beamlines -->-->--     *
+*                                                           *
+* JINST 2:P09005 (2007)                                     *
+*      X Rouby, J de Favereau, K Piotrzkowski (CP3)         *
+*       http://www.fynu.ucl.ac.be/hector.html               *
+*                                                           *
+* Center for Cosmology, Particle Physics and Phenomenology  *
+*              Universite catholique de Louvain             *
+*                 Louvain-la-Neuve, Belgium                 *
+ *                                                         *
+   * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 /// \file H_VerticalQuadrupole.cc
