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

#ifndef _PFUNCTION_H_
#define _PFUNCTION_H_


#include "TF1.h"
#include "TF2.h"
#include "TF3.h"
#include "PChannelModel.h"

#include "PBatch.h"


class PFunction : public PChannelModel  {
  
 public:
    PFunction();
    PFunction(const Char_t *id, const Char_t *de, Int_t key);
    PDistribution *Clone(const char *delme=NULL) const;

    Bool_t Init(void);

    using PDistribution::GetWeight;   
    Double_t GetWeight(Double_t *mass, Int_t *didx=NULL);	

    using TF1::SetFunction;
    void SetFunction(TF1 *my_tf1) {tf1 = my_tf1;};
    void SetFunction(TF2 *my_tf2) {tf2 = my_tf2;};
    void SetFunction(TF3 *my_tf3) {tf2 = my_tf3;};
    void SetFunction(Double_t c)  {constant = c;};
    Bool_t AddEquation(const char *command);

    using PDistribution::SampleMass;   
    Bool_t SampleMass(Double_t *mass, Int_t *didx=NULL);

 private:

    TF1 *tf1;
    TF2 *tf2;
    TF3 *tf3;
    Double_t constant, *vf, *vx;
    PBatch  *batch;

    ClassDef(PFunction, 0)  //Function wrapper (e.g. for model pathes)

};

#endif


 PFunction.h:1
 PFunction.h:2
 PFunction.h:3
 PFunction.h:4
 PFunction.h:5
 PFunction.h:6
 PFunction.h:7
 PFunction.h:8
 PFunction.h:9
 PFunction.h:10
 PFunction.h:11
 PFunction.h:12
 PFunction.h:13
 PFunction.h:14
 PFunction.h:15
 PFunction.h:16
 PFunction.h:17
 PFunction.h:18
 PFunction.h:19
 PFunction.h:20
 PFunction.h:21
 PFunction.h:22
 PFunction.h:23
 PFunction.h:24
 PFunction.h:25
 PFunction.h:26
 PFunction.h:27
 PFunction.h:28
 PFunction.h:29
 PFunction.h:30
 PFunction.h:31
 PFunction.h:32
 PFunction.h:33
 PFunction.h:34
 PFunction.h:35
 PFunction.h:36
 PFunction.h:37
 PFunction.h:38
 PFunction.h:39
 PFunction.h:40
 PFunction.h:41
 PFunction.h:42
 PFunction.h:43
 PFunction.h:44
 PFunction.h:45
 PFunction.h:46
 PFunction.h:47
 PFunction.h:48
 PFunction.h:49
 PFunction.h:50
 PFunction.h:51
 PFunction.h:52
 PFunction.h:53