// Author: I. Froehlich
// Written: 18.7.2007
// Revised: 

#ifndef _PBEAMSMEARING_H_
#define _PBEAMSMEARING_H_


#include "TF1.h"
#include "TF2.h"
#include "TH1F.h"
#include "PDistribution.h"


class PBeamSmearing : public PDistribution  {
  
 public:
    PBeamSmearing();
    ~PBeamSmearing();
    PBeamSmearing(const Char_t *id, const Char_t *de);
    
    PDistribution *Clone(const char *delme=NULL) const;

    Bool_t Init(void);
    Bool_t Prepare(void);
    
    void Print(const Option_t *delme=NULL) const;  //Debug info
    
    void SetMomentumSmearing(TF1 *f) {
	//A function stretching the beam momentum (x=1 means no modification)
	mom_smearing = f;
    };

    void SetMomentumSmearing(TH1 *f) {
	//A function stretching the beam momentum (x=1 means no modification)
	mom_smearing_histo = f;
    };
    
    void SetMomentumFunction(TF1 *f) {
	//A function which desribes the absolute momentum distribution
	mom_function = f;
    };
    
    void SetMomentumFunction(TH1 *f) {
	//A function which desribes the absolute momentum distribution
	mom_function_histo = f;
    };
    
    void SetBeamParameters(Double_t th, Double_t ph, Double_t sig) {
	//N.B. these are in units DEGREE because this is more convenient!
	thetaBeam = th * TMath::Pi() / 180.;
	phiBeam   = ph * TMath::Pi() / 180.;
	sigmaBeam = sig* TMath::Pi() / 180.;
    };

    void SetAngularSmearing(TF1 *f) {
	//smearing distribution in degree
	ang_smearing=f;
    };
    
    void SetReaction(const char *reaction);

 private:

    PParticle *beam,   *mybeam;
    PParticle *target, *mytarget;
    PParticle *parent;

    TF1     *mom_smearing;
    TF1     *mom_function;
    TF1     *ang_smearing;
    TH1     *mom_smearing_histo;
    TH1     *mom_function_histo;
    Double_t thetaBeam;           // polar angle of beam
    Double_t phiBeam;             // azimuthal angle of beam
    Double_t sigmaBeam;           // smearing of beam
    ClassDef(PBeamSmearing, 0)    // General purpose beam smearing models
};

#endif


 PBeamSmearing.h:1
 PBeamSmearing.h:2
 PBeamSmearing.h:3
 PBeamSmearing.h:4
 PBeamSmearing.h:5
 PBeamSmearing.h:6
 PBeamSmearing.h:7
 PBeamSmearing.h:8
 PBeamSmearing.h:9
 PBeamSmearing.h:10
 PBeamSmearing.h:11
 PBeamSmearing.h:12
 PBeamSmearing.h:13
 PBeamSmearing.h:14
 PBeamSmearing.h:15
 PBeamSmearing.h:16
 PBeamSmearing.h:17
 PBeamSmearing.h:18
 PBeamSmearing.h:19
 PBeamSmearing.h:20
 PBeamSmearing.h:21
 PBeamSmearing.h:22
 PBeamSmearing.h:23
 PBeamSmearing.h:24
 PBeamSmearing.h:25
 PBeamSmearing.h:26
 PBeamSmearing.h:27
 PBeamSmearing.h:28
 PBeamSmearing.h:29
 PBeamSmearing.h:30
 PBeamSmearing.h:31
 PBeamSmearing.h:32
 PBeamSmearing.h:33
 PBeamSmearing.h:34
 PBeamSmearing.h:35
 PBeamSmearing.h:36
 PBeamSmearing.h:37
 PBeamSmearing.h:38
 PBeamSmearing.h:39
 PBeamSmearing.h:40
 PBeamSmearing.h:41
 PBeamSmearing.h:42
 PBeamSmearing.h:43
 PBeamSmearing.h:44
 PBeamSmearing.h:45
 PBeamSmearing.h:46
 PBeamSmearing.h:47
 PBeamSmearing.h:48
 PBeamSmearing.h:49
 PBeamSmearing.h:50
 PBeamSmearing.h:51
 PBeamSmearing.h:52
 PBeamSmearing.h:53
 PBeamSmearing.h:54
 PBeamSmearing.h:55
 PBeamSmearing.h:56
 PBeamSmearing.h:57
 PBeamSmearing.h:58
 PBeamSmearing.h:59
 PBeamSmearing.h:60
 PBeamSmearing.h:61
 PBeamSmearing.h:62
 PBeamSmearing.h:63
 PBeamSmearing.h:64
 PBeamSmearing.h:65
 PBeamSmearing.h:66
 PBeamSmearing.h:67
 PBeamSmearing.h:68
 PBeamSmearing.h:69
 PBeamSmearing.h:70
 PBeamSmearing.h:71
 PBeamSmearing.h:72
 PBeamSmearing.h:73
 PBeamSmearing.h:74
 PBeamSmearing.h:75
 PBeamSmearing.h:76
 PBeamSmearing.h:77
 PBeamSmearing.h:78
 PBeamSmearing.h:79
 PBeamSmearing.h:80
 PBeamSmearing.h:81
 PBeamSmearing.h:82