Fork me on GitHub

Changeset 281 in svn for trunk/Utilities/Hector/src


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

new Hector version

Location:
trunk/Utilities/Hector/src
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/Hector/src/H_AbstractBeamLine.cc

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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