class Bunch
{
  private:
    int NParticle ;
    double TimeBunch ; // realtime  
    double a0, ap0, de0, tau0, E0, q ;
    double a_rms0, ap_rms0, de_rms0, tau_rms0 ;
    Particle particle[NParticleMAX] ;
     double dst[NParticleMAX] ;
     double tmpdat[NParticleMAX] ; 
     double tmpq[NParticleMAX] ; 
  public: 
    void set_NParticle( int NParticleT ){ NParticle = NParticleT ;};
    void InputData( BunchInput BunchIn ) ; 
    void SetData() ; 
    void Build() ; 

    void set_de0( double de0t ){ de0 = de0t ;};
    void set_tau0( double tau0t ){ tau0 = tau0t ;};
    void set_a0( double a0t ){ a0 = a0t ;};
    void set_ap0( double ap0t ){ ap0 = ap0t ;};
    void set_E0( double E0t ){ E0 = E0t ;};
    void set_de_rms0( double de_rms0t ){ de_rms0 = de_rms0t ;};
    void set_tau_rms0( double tau_rms0t ){ tau_rms0 = tau_rms0t ;};
    void set_a_rms0( double a_rms0t ){ a_rms0 = a_rms0t ;};
    void set_ap_rms0( double ap_rms0t ){ ap_rms0 = ap_rms0t ;};
    void set_q( double q_bunch ) ;

    void add_de( double DE ) ;

    void set_de_particle( int i, double de ){ particle[i].set_de( de ) ;};
    void set_tau_particle( int i, double tau ){ particle[i].set_tau( tau ) ;};

    void set_TimeBunch( double TimeBuncht ){ TimeBunch = TimeBuncht ;};

    Particle* get_Particle( int ParticleNo ){ return &particle[ParticleNo] ;};
    int get_NParticle(){ return NParticle ;};

    double get_de_particle(int i){ return particle[i].get_de() ;};
    double get_tau_particle(int i){ return particle[i].get_tau() ;};
 
    double cal_de() ;
    double cal_tau() ;
    double cal_a() ;
    double cal_ap() ;
    double cal_de_rms() ;
    double cal_tau_rms() ;
    double cal_a_rms() ;
    double cal_ap_rms() ;
    double cal_amp( double NuBeta ) ;
    double cal_q() ;

    double get_q(){ return q ;};
    double get_E0(){ return E0 ;};
    double get_TimeBunch(){ return TimeBunch ;}; 
} ;

