Probe.h 3.09 KB
Newer Older
gsell's avatar
gsell committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#ifndef CLASSIC_Probe_HH
#define CLASSIC_Probe_HH

// ------------------------------------------------------------------------
// $RCSfile: Probe.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: Probe
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2009/10/07 09:32:32 $
// $Author: Bi, Yang $
// 2012/03/01: fix bugs and change the algorithm in the checkProbe()
//
// ------------------------------------------------------------------------

#include "AbsBeamline/Component.h"
25
#include <string>
frey_m's avatar
frey_m committed
26
#include <utility>
27

28 29
template <class T, unsigned Dim>
class PartBunchBase;
30

31
class LossDataSink;
frey_m's avatar
frey_m committed
32
class PeakFinder;
gsell's avatar
gsell committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

// Class Probe
// ------------------------------------------------------------------------
/// Interface for probe.
//  Class Probe defines the abstract interface for a probe.

class Probe: public Component {

public:

    /// Constructor with given name.
    explicit Probe(const std::string &name);

    Probe();
    Probe(const Probe &);
    virtual ~Probe();

    /// Apply visitor to Probe.
    virtual void accept(BeamlineVisitor &) const;

53 54
    virtual void initialise(PartBunchBase<double, 3> *bunch, double &startField, double &endField);
    virtual void initialise(PartBunchBase<double, 3> *bunch);
gsell's avatar
gsell committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68

    virtual void finalise();

    virtual bool bends() const;

    virtual void goOffline();

    void setXstart(double xstart);
    void setXend(double xend);

    void setYstart(double ystart);
    void setYend(double yend);

    void setWidth(double width);
69
    void setStep(double step);
gsell's avatar
gsell committed
70 71 72 73 74 75 76 77

    virtual double getXstart() const;
    virtual double getXend() const;

    virtual double getYstart() const;
    virtual double getYend() const;

    virtual double getWidth() const;
78 79
    virtual double getStep() const;

frey_m's avatar
frey_m committed
80
    bool  checkProbe(PartBunchBase<double, 3> *bunch, const int turnnumber, const double t, const double tstep);
81
    virtual ElementBase::ElementType getType() const;
gsell's avatar
gsell committed
82 83 84 85 86 87

    virtual void getDimensions(double &zBegin, double &zEnd) const;

private:
    std::string filename_m;             /**< The name of the inputfile*/
    double position_m;
88
    ///@{ input geometry positions
gsell's avatar
gsell committed
89 90 91 92
    double xstart_m;
    double xend_m;
    double ystart_m;
    double yend_m;
93 94 95 96
    ///@}
    double width_m;   ///< bin width, not used
    Point  geom_m[5]; ///< actual geometry positions with adaptive width such that each particle hits probe once per turn
    int step_m; ///< Step size of the probe (bin width in histogram file)
gsell's avatar
gsell committed
97 98 99 100

    double A_m, B_m,R_m, C_m;
    void setGeom(const double dist);
    int  checkPoint( const double & x, const double & y );
101

frey_m's avatar
frey_m committed
102
    std::unique_ptr<PeakFinder> peakfinder_m;
adelmann's avatar
adelmann committed
103 104

    std::unique_ptr<LossDataSink> lossDs_m;
gsell's avatar
gsell committed
105 106 107 108 109

    // Not implemented.
    void operator=(const Probe &);
};

frey_m's avatar
frey_m committed
110
#endif // CLASSIC_Probe_HH