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

#ifndef _PADAPTIVEMESH_H_
#define _PADAPTIVEMESH_H_

#define MAX_SUBMESH 20

#include "TObject.h"
#include "TF1.h"
#include "TLine.h"

class PAdaptiveMesh : public TObject {

 private:

    Double_t y_max;        //upper boundary
    Double_t area_size;    //area of the box(es)
    Double_t x_max, x_min; //bin width
    Int_t sub_size, layer;
    PAdaptiveMesh *sub_tree[MAX_SUBMESH];
    Double_t  sub_area[MAX_SUBMESH];
    TF1   *tf1;
    TLine *line;  //upper line for the Draw() function 
    void ReCalc(void);
    PAdaptiveMesh *GetRandomBin(Double_t f_random);

 public:

    //constructor
    PAdaptiveMesh(Double_t my_x_max, Double_t my_x_min, Double_t my_y_max);
    ~PAdaptiveMesh();
 
    void SetTF1(TF1 * t) {tf1 = t;};
    Double_t GetRandom();
    Double_t GetArea() {return area_size;};
   
    Double_t GetXMax() {return x_max;};
    Double_t GetXMin() {return x_min;};
    Double_t GetYMax() {return y_max;};
    void SetYMax(Double_t d) {y_max=d;};

    void Divide(Int_t num, Int_t my_layer);

    void Draw(const Option_t *delme=NULL);

    ClassDef(PAdaptiveMesh, 0)  //TF1 envelope with adaptable size of the bins
};

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