// $Id: EFocalSurfacePainter.hh,v 1.21 2005/05/05 17:39:22 thea Exp $ // A.Thea created Jun, 28 2004 /***************************************************************************** * ESAF: Euso Simulation and Analysis Framework * * * * Id: FocalSurfacePainter * * Package: EventViewer * * Coordinator: Alessandro.Thea * * * *****************************************************************************/ #ifndef __EFOCALSURFACEPAINTER_HH__ #define __EFOCALSURFACEPAINTER_HH__ #include "EAnimator.hh" #include "TSeqCollection.h" #include "TPolyLine.h" #include "TVector3.h" #include "TText.h" #include "TPaveText.h" #include #include ////////////////////////////////////////////////////////////////////////////// // // // EFocalSurfacePainter // // // // A painter to show the development of the signal on // // the focal surface // // // ////////////////////////////////////////////////////////////////////////////// class EDetector; class ERunParameters; class EPolygon; enum EMapId { kFeeHits = 1, kFeeSignals = 2, kCellHits = 3 }; using std::map; using std::vector; typedef map Counts_t; typedef map GtuCounts_t; const Counts_t operator+(const Counts_t&, const Counts_t&); Counts_t& operator+=( Counts_t&, const Counts_t&); class EFocalSurfacePainter: public EAnimator { public: EFocalSurfacePainter( EDetector *, ERunParameters* ); virtual ~EFocalSurfacePainter(); virtual void Clear( Option_t* =""); virtual void Draw( Option_t* =""); virtual void Paint( Option_t* =""); virtual Int_t DistancetoPrimitive(Int_t px, Int_t py); virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py); virtual char* GetObjectInfo(Int_t px, Int_t py) const; virtual void Play( Option_t* =""); // *MENU* virtual void Animate(); virtual void NextFrame(); // *MENU* virtual inline void Rewind() { fGtu = fFirstGtu; } // *MENU* virtual inline Bool_t IsEnded() { return fGtu >= fLastGtu; } inline ERunParameters* GetRunPars() const { return fRunPars; } virtual void FeeHits() { SetCurrentMapID( kFeeHits ); } // *MENU* virtual void FeeSignals() { SetCurrentMapID( kFeeSignals ); } // *MENU* virtual void CellHits() { SetCurrentMapID( kCellHits ); } // *MENU* virtual void Move() { fMoveView = kTRUE; } // *MENU* virtual void CenterViewOnPmt( Int_t ); // *MENU* virtual void SetViewCenter( Float_t x, Float_t y) { fViewCenter.SetXYZ(x,y,0); } //*MENU* virtual void Modified( Bool_t flag=1) { fModified=flag;} void MakeGifSequence(const char* option = "", const char* path="Anim"); // getters inline Int_t GetGtu() const { return fGtu; } inline Int_t GetFirstGtu() const { return fFirstGtu; } inline Int_t GetLastGtu() const { return fLastGtu; } inline EMapId GetCurrentMapID() const { return fCurrentMapID; } inline const TVector3& GetViewCenter() const { return fViewCenter; } inline const TVector3& GetSpread() const { return fSpread; } inline Int_t GetViewThreshold() const { return fViewThreshold; } inline Float_t GetViewRange() const { return fViewRange; } inline Float_t GetViewBorder() const { return fViewBorder; } inline Bool_t GetPixelEmpty() const { return fPixelEmpty; } inline Bool_t GetPixelOff() const { return fPixelOff; } inline Bool_t GetGtuCounter() const { return fGtuCounter; } inline Bool_t GetTimeIntegral() const { return fTimeIntegral; } inline UInt_t GetNumColors() const { return fNumColors; } inline UInt_t GetMaxCounts() const { return fMaxCounts; } inline Color_t GetPixelColorEmpty() const { return fPixelColorEmpty; } inline Color_t GetPixelColorOff() const { return fPixelColorOff; } inline Color_t GetPmtColorEmpty() const { return fPmtColorEmpty; } inline Color_t GetPmtColorHit() const { return fPmtColorHit; } // setters inline void SetGtu( Int_t gtu ) { fGtu = gtu; } // *MENU* inline void SetFirstGtu( Int_t gtu ) { fFirstGtu = gtu; } inline void SetLastGtu( Int_t gtu ) { fLastGtu = gtu; } inline void SetCurrentMapID( EMapId id ) { fCurrentMapID = id; } inline void SetViewThreshold( Int_t t ) { fViewThreshold = t; Modified(); } // *MENU* inline void SetViewRange( Float_t s) { fViewRange = s; } // *MENU* inline void SetViewBorder( Float_t b ) { fViewBorder = b; } // *MENU* inline void SetPixelEmpty( Bool_t b = kTRUE ) { fPixelEmpty = b; } // *TOGGLE* inline void SetPixelOff( Bool_t b = kTRUE ) { fPixelOff = b; } // *TOGGLE* inline void SetGtuCounter( Bool_t b = kTRUE ) { fGtuCounter = b; } // *TOGGLE* inline void SetTimeIntegral( Bool_t b = kTRUE ) { fTimeIntegral = b; } // *TOGGLE* inline void SetNumColors( UInt_t n ) { fNumColors = n; } // *MENU* inline void SetMaxCounts( UInt_t n ) { fMaxCounts = n; } // *MENU* inline void SetPixelColorEmpty( Color_t c ) { fPixelColorEmpty = c; } inline void SetPixelColorOff( Color_t c ) { fPixelColorOff = c; } inline void SetPmtColorEmpty( Color_t c ) { fPmtColorEmpty = c; } inline void SetPmtColorHit( Color_t c ) { fPmtColorHit = c; } private: // helper functions Bool_t Load(); void BuildPolyLines(); void ClearPolyLines(); EPolygon* FindPmtLine( Int_t ) const; void FindPmtsToPaint( Float_t, Float_t, Float_t, Float_t ); Bool_t FindView( EMapId ); EPolygon* GetPmtLine( Int_t ); EPolygon* GetPixelLine( Int_t ); void PaintHits(); void PaintNightGlowRate(); // painter settings Int_t fGtu; // current gtu EMapId fCurrentMapID; // identifier of the data to paint Bool_t fModified; // viewport Int_t fViewThreshold; // min counts of hits used to def the VP Float_t fViewRange; // size of viewport in signal Nspread Float_t fViewBorder; // border size, from 0 to 0.5 // gif display size Int_t fGifCanvasW; // width of the gif sequence canvas Int_t fGifCanvasH; // hieght of the gif sequence canvas // draw options Bool_t fPixelEmpty; // true to draw pixels with 0 hits Bool_t fPixelOff; // true to draw pixels even not in the maps Bool_t fGtuCounter; // true to draw the gtu counter Bool_t fTimeIntegral; // true to draw time integral of the track Bool_t fAutoRadius; // true to set the view according the signal Bool_t fMoveView; // if true the next leftmouse click moves the view center Float_t fX1; // X coord of the lower left corner Float_t fX2; // X coord of the lower right corner Float_t fY1; // Y coord of the lower left corner Float_t fY2; // Y coord of the lower right corner Float_t fXmin; // X coord of the frame lower left corner Float_t fXmax; // X coord of the frame lower right corner Float_t fYmin; // Y coord of the frame lower left corner Float_t fYmax; // Y coord of the frame lower right corner // colors Int_t fColorOffset; // first color in the palette Int_t fNumColors; // maximum number of colors UInt_t fMaxCounts; // Color_t fPixelColorOff; // color code of absent pixels Color_t fPixelColorEmpty; // color code of empty pixels Color_t fPmtColorEmpty; // color code of empty pmts Color_t fPmtColorHit; // color code of hit pmts // data EDetector *fDetector; ERunParameters *fRunPars; // data maps GtuCounts_t fFrontEndHits; GtuCounts_t fFrontEndSignals; GtuCounts_t fMacroCellHits; Int_t fFirstGtu; // first gtu in data Int_t fLastGtu; // last gtu in data TVector3 fViewCenter; // signal center in Detector coordinates TVector3 fSpread; // signal spread TSeqCollection *fLines; // list of lines used by the destructor vector fPmtsToPaint; // list of the pmt ids in the viewport map fPmtLines; map fPixelLines; GtuCounts_t fInteglFrontEndHits; GtuCounts_t fInteglFrontEndSignals; GtuCounts_t fInteglCellHits; // cache mutable GtuCounts_t fCache; mutable Int_t fCacheContents; TText fTxtCounter; TText fTxtSum; void CacheTimeInt() const; Counts_t GetMapToPaint() const; const GtuCounts_t* GtuCountsToPaint() const; ClassDef(EFocalSurfacePainter,1) }; //////////////////////////////////////////////////////////////////////////////// // // // EPolygon // // // //////////////////////////////////////////////////////////////////////////////// class EPolygon : public TPolyLine { public: EPolygon( Int_t n, Float_t *x, Float_t *y); virtual ~EPolygon(); virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py); virtual Int_t DistancetoPrimitive(Int_t px, Int_t py); private: ClassDef(EPolygon,0) }; #endif /* __EFOCALSURFACEPAINTER_HH__ */