// Author: I. Froehlich
// Written: 12.8.2011

#ifndef _PANYDISTRIBUTION_H_
#define _PANYDISTRIBUTION_H_

#define ANY_DISTRIBUTION_MAX_DAUGHTERS 8

#include "TF1.h"
#include "TF2.h"
#include "TF3.h"
#include "PDistribution.h"
#include "PProjector.h"


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

    Bool_t Init(void);
    Bool_t Prepare(void);
    Bool_t Finalize(void);
    Bool_t IsNotRejected(void);
    Bool_t CheckAbort(void);

    Bool_t AddEquation(TH1 *histo, const char *command);  //adds an equation + cache for non-uniform distributions
    Bool_t AddEquation(TH2 *histo, const char *command);  //adds an equation + cache for non-uniform distributions
    Bool_t AddEquation(TH3 *histo, const char *command);  //adds an equation + cache for non-uniform distributions
    Bool_t AddEquation(const char *command);
    
    void SetMaxEnhancementFactor(Double_t _max_enhance_factor) {
	max_enhance_factor = _max_enhance_factor;
    };

 private:
    PParticle *daughters[ANY_DISTRIBUTION_MAX_DAUGHTERS]; //up to 8 daughters
    PParticle *stack[ANY_DISTRIBUTION_MAX_DAUGHTERS+1];
    int decay_done[ANY_DISTRIBUTION_MAX_DAUGHTERS+1];
    int daughter_pos;
    PParticle *parent;

    PProjector *projector;

    void MakeVars(void);

    TH1 *cache1;
    TH2 *cache2;
    TH3 *cache3;

    PParticle *vparent;
    Double_t  *vf;
    Double_t *x, *y, *z;
    Double_t max, max_enhance_factor;

    ClassDef(PAnyDistribution, 0)  //Any possible distribution for a->b+c+d 

};

#endif


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