Fork me on GitHub

Changeset 3c40083 in git for external/Hector/H_Aperture.cc


Ignore:
Timestamp:
Apr 16, 2014, 3:56:14 PM (11 years ago)
Author:
pavel <pavel@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
64a4950
Parents:
f6b9fec
Message:

switch to a more stable Hector version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/Hector/H_Aperture.cc

    rf6b9fec r3c40083  
    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    * * * * * * * * * * * * * * * * * * * * * * * * * * * */
     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*/
    1811
    1912/// \file H_Aperture.cc
     
    2720using namespace std;
    2821
    29 H_Aperture::H_Aperture() :
    30         type_(NONE), x1(0), x2(0), x3(0), x4(0), fx(0), fy(0),  aptypestring(getApertureString()) {
     22H_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;
    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) :
    34         type_(dtype), x1(size1), x2(size2), x3(size3), x4(size4), fx(posx), fy(posy), aptypestring(getApertureString()) {
     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) {
    3534    /// @param dtype defines the aperture shape
    3635        /// @param size1, size2, size3, size4 are the geometrical sizes (length/width or great/small radii) in m
    3736        /// @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;
    3845}
    3946
    40 H_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) {
     47H_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;
    4256}
    4357
    4458H_Aperture& H_Aperture::operator=(const H_Aperture& ap) {
    4559        if(this==&ap) return *this;
    46         type_ = ap.type_;
     60        type = ap.type;
     61        aptypestring = ap.aptypestring;
    4762        x1 = ap.x1;
    4863        x2 = ap.x2;
     
    5166        fx = ap.fx;
    5267        fy = ap.fy;
    53         aptypestring = ap.aptypestring;
    5468        return *this;
    5569}
    5670
    57 std::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 
    6371void H_Aperture::printProperties() const {
    64         cout << *this;
     72        cout << "Aperture shape:" << getTypeString() << ", parameters"<<x1<<", "<<x2<<", "<<x3<<", "<<x4<<endl;
     73        cout << " \t Center : " << fx << "," << fy << endl;
    6574        return;
    6675}
     
    7483}
    7584
    76 bool H_Aperture::isInside(const float , const float ) const {
     85bool H_Aperture::isInside(const float x, const float y) const {
    7786        /// @param x, y are the (x,y) coordinates of the proton, in [m]
    78         //cout << "aperture::isInside" << endl;
     87        cout << "aperture::isInside" << endl;
    7988        return false;
    8089}
    8190
    8291
    83 /*void H_Aperture::setApertureString() {
    84         switch (type_) {
     92void H_Aperture::setApertureString() {
     93        switch (type) {
    8594                case NONE: aptypestring = NONENAME; break;
    8695                case RECTANGULAR: aptypestring = RECTANGULARNAME; break;
     
    91100        }
    92101}
    93 */
    94 
    95 const 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 
Note: See TracChangeset for help on using the changeset viewer.