Fork me on GitHub

Changeset 388 in svn for trunk


Ignore:
Timestamp:
May 16, 2009, 10:31:14 AM (15 years ago)
Author:
Xavier Rouby
Message:

modif Xav

Location:
trunk/Utilities/Hector
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/Hector/include/H_BeamParticle.h

    r281 r388  
    132132                /// Returns the particle path in the beamline
    133133                TGraph * getPath(const int , const int ) const;
     134                void getPath(const int , const string& ) const;
    134135                /// Computes the position of the particle at the end of each element of the beam.
    135136                void computePath(const H_AbstractBeamLine * beam, const bool NonLinear=true);
  • trunk/Utilities/Hector/src/H_BeamParticle.cc

    r281 r388  
    2626// c++ #includes
    2727#include <iostream>
     28#include <fstream>
    2829#include <iomanip>
    2930#include <vector>
     
    458459        delete [] graph;
    459460        return ppath;
     461}
     462
     463void H_BeamParticle::getPath(const int x_or_y, const string& filename) const {
     464        ofstream outfile(filename.c_str());
     465        int index;
     466        if(x_or_y==0) {index = INDEX_X;} else {index = INDEX_Y;}
     467
     468        vector<TVectorD>::const_iterator position_i;
     469        for(position_i = positions.begin(); position_i < positions.end(); position_i++) {
     470                outfile << (*position_i)[INDEX_S] <<"\t\t" << (*position_i)[index] << endl;
     471        }
     472        outfile.close();
    460473}
    461474
Note: See TracChangeset for help on using the changeset viewer.