// ESAF : Euso Simulation and Analysis Framework
// $Id: ETreeShowerPainter.hh,v 1.3 2004/11/15 17:14:11 thea Exp $
// Author: Dmitry V.Naumov   Aug,  1 2004

#ifndef __ETREESHOWERPAINTER_HH__
#define __ETREESHOWERPAINTER_HH__

//#include "euso.hh"
#include <TObject.h>
#include <TSeqCollection.h>

class TGeoManager;
class TGeoVolume;
class TGeoMedium;
class TTree;
class EShower;
class EEvent;
class TH1F;
/*******************************************************************************
 *
 * ETreeShowerPainter: class description
 * This class is responsible for reading tracks from the euso simulation tree
 * and doing its graphycal representation. It can draw the EUSO Field of View,
 * display 3D tracks, draw histogramms with Energy, Theta, Phi and X1 (more tome 
 * come) and even make the animation of 3D tracks and histogramms
 ******************************************************************************/

class ETreeShowerPainter : public TObject {
public:
    ETreeShowerPainter(TTree *);           // ctor
    virtual ~ETreeShowerPainter();	   // dtor
    virtual void Draw( Option_t * ="");    
    
    inline Bool_t IsWorldBuilt() {return fWorldBuild;} // Checks if the geometry is built
    void Build();                                      // Build the geometry and read the tracks
    void BuildWorld();                                 // Build the geometry
    void AddShower(EShower*);                          // Adds new shower read from the file 
    TH1F* BuildHistos(const char *name, const char *title); // Build histogramms
    void FillHistos(EShower *);                             // Fills the histogramms
    void DrawHistos(Option_t *);                            // Draw the histogramms
   
private:
    TTree       *fTree;               // Pointer for the euso tree to read from
    EEvent      *fEv;                 // Current Euso Event
    Bool_t       fWorldBuild;         // true if the geometry is build, false othewise 
    TGeoVolume  *fTop;                // TOP Volume of the global geometry 
    TGeoVolume  *fFoVVolume;          // Geometry realization of the Field of View of EUSO
    TGeoMedium  *fVacuum;             // Geometry Medium
    Int_t        fCurrentTrack;       // index of the current track read from fTree
    Int_t        fEvTot;              // Total number of events in the fTree
    TSeqCollection *fHistos;          // Collection of histogramms representing the events
    ClassDef(ETreeShowerPainter,1)
};

#endif  /* __ETREESHOWERPAINTER_HH__ */