// $Id: EFocalSurfacePainter.hh,v 1.40 2005/11/07 14:44:23 pesce 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 #include #include #include #include #include #include #include #include #include "Etypes.hh" ////////////////////////////////////////////////////////////////////////////// // // // EFocalSurfacePainter // // // // A painter to show the development of the signal on // // the focal surface // // // ////////////////////////////////////////////////////////////////////////////// class EEvent; class EDetector; class ERunParameters; class EPolygon; class TH1F; enum EMapId { kFeeHits = 1, kFeeSignals = 2, kCellHits = 3 }; enum EIntegral { kIntNone = 1, kIntSum = 2, kIntMax = 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& ); const Counts_t operator|( const Counts_t&, const Counts_t& ); Counts_t& operator|=( Counts_t&, const Counts_t& ); class EFocalSurfacePainter: public EAnimator { public: EFocalSurfacePainter(); EFocalSurfacePainter( EEvent* ); 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 ApplyTriggerThreshold( ETriggerTypeIdentifier ); // *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;} Bool_t IsTriggerEnabled( ETriggerTypeIdentifier ); void MakeGifSequence(const char* option = "", const char* path="Anim"); // getters inline Float_t GetAlpha() const { return fAlpha; } inline Int_t GetCurrentMapID() const { return fCurrentMapID; } inline Int_t GetFirstGtu() const { return fFirstGtu; } inline Int_t GetGtu() const { return fGtu; } inline TH1F* GetHitsHist() const { return fH1Hits; } inline TStyle* GetHitsHistStyle() const { return fHitsStyle; } inline TH1F* GetSigProfile() const { return fH1SigProfile; } inline TH1F* GetSigMaxProfile() const { return fH1SigMaxProfile; } inline TH1F* GetNoiseMaxProfile() const { return fH1NoiseMaxProfile; } inline TH1F* GetNoiseMinProfile() const { return fH1NoiseMinProfile; } inline TH1F* GetNoiseMeanProfile() const { return fH1NoiseMeanProfile; } inline TH1F* GetHitsMaxProfile() const { return fH1HitsMaxProfile; } inline Int_t GetLastGtu() const { return fLastGtu; } inline const TVector3& GetSpread() const { return fSpread; } inline const TVector3& GetViewCenter() const { return fViewCenter; } inline Float_t GetViewRange() const { return fViewRange; } inline Int_t GetViewThreshold() const { return fViewThreshold; } inline Bool_t IsApplyThreshold() const { return fApplyThreshold; } inline Bool_t IsAbsoluteThreshold() const { return fAbsoluteThreshold; } inline Bool_t IsShowAxis() const { return fShowAxis; } inline Bool_t IsShowEmptyPixels() const { return fShowEmptyPixels; } inline Bool_t IsShowOffPixels() const { return fShowOffPixels; } inline Bool_t IsShowGtuCounter() const { return fShowGtuCounter; } inline Bool_t IsDrawNightGlow() const { return fDrawNightGlow; } inline Bool_t IsStdPalette() const { return fStdPalette; } inline Int_t GetIntegral() const { return fIntegral; } inline Int_t GetCurrentTrigger() const { return fCurrentTrigger; } 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 void SetAlpha( Float_t alpha ) { fAlpha = alpha; if (fAlpha<0) { SetApplyThreshold(kFALSE); fAlpha=0; } PaintHits(); } // *MENU* void SetApplyThreshold( Bool_t apply = kTRUE ) { fApplyThreshold = apply; if (!apply) fAlpha=0; PaintHits(); } // *TOGGLE* void SetAbsoluteThreshold( Bool_t t = kTRUE ) { fAbsoluteThreshold = t; PaintHits(); } // *TOGGLE* inline void SetCurrentMapID( Int_t id ) { fCurrentMapID = id; } inline void SetPaletteOffset( Color_t c ) { fPaletteOffset = c; } inline void SetFirstGtu( Int_t gtu ) { fFirstGtu = gtu; } inline void SetGtu( Int_t gtu ) { fGtu = gtu; } // *MENU* inline void SetHitsHistStyle( TStyle* sty ) { SafeDelete(fHitsStyle); fHitsStyle = sty; } inline void SetLastGtu( Int_t gtu ) { fLastGtu = gtu; } inline void SetMaxCounts( UInt_t n ) { fMaxCounts = n; UpdateHist(); } // *MENU* inline void SetNumColors( UInt_t n ) { fNumColors = n; } // *MENU* inline void SetPixelEmptyColor( Color_t c ) { fPixelColorEmpty = c; } inline void SetPixelOffColor( Color_t c ) { fPixelColorOff = c; } inline void SetPmtColorEmpty( Color_t c ) { fPmtColorEmpty = c; } inline void SetPmtColorHit( Color_t c ) { fPmtColorHit = c; } inline void SetStdPalette( Bool_t std = kTRUE ) { fStdPalette = std; } // *TOGGLE* inline void SetShowAxis( Bool_t show = kTRUE ) { fShowAxis = show; } // *TOGGLE* inline void SetShowGtuCounter( Bool_t show = kTRUE ) { fShowGtuCounter = show; } // *TOGGLE* inline void SetShowEmptyPixels( Bool_t show = kTRUE ) { fShowEmptyPixels = show; } // *TOGGLE* inline void SetShowOffPixels( Bool_t show = kTRUE ) { fShowOffPixels = show; } // *TOGGLE* inline void SetDrawNightGlow( Bool_t draw = kTRUE ) { fDrawNightGlow = draw; } inline void SetIntegral( Int_t id ) { fIntegral = id; } // *MENU* inline void SetViewBorder( Float_t b ) { fViewBorder = b; } // *MENU* inline void SetViewRange( Float_t s) { fViewRange = s; } // *MENU* inline void SetViewThreshold( Int_t t ) { fViewThreshold = t; Modified(); } // *MENU* void UpdateHist(Bool_t force=kFALSE); private: enum { kColorPixelEmpty = -1, kColorPixelOff = -2, kColorPmtEmpty = -3, kColorPmtHit = -4 }; // helper functions void Constructor(); Bool_t Load(); void BuildPolyLines(); void ClearPolyLines(); Int_t CurrentCode() const { return fCurrentMapID+10*fIntegral;} void CacheIntegral() const; EPolygon* FindPmtLine( Int_t ) const; void FindPmtsToPaint( Float_t, Float_t, Float_t, Float_t ); Bool_t FindView( Int_t ); EPolygon* GetPixelLine( Int_t ); EPolygon* GetPmtLine( Int_t ); const Counts_t* MapToPaint() const; const GtuCounts_t* GtuCountsToPaint() const; void PaintHits(); void PaintNightGlowRate(); Int_t GetColorPalette( Int_t i ) const; Int_t GetNormColorPalette( Float_t i ) const; Int_t GetPaletteNumColors() const { return fStdPalette ? gStyle->GetNumberOfColors() : fNumColors; } void FillChipTriggers(); // create a map with the chip triggers threshold numbers // painter settings Int_t fGtu; // current gtu Int_t fCurrentMapID; // identifier of the data to paint Int_t fCurrentTrigger; // identifier of the trigger 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 Bool_t fAutoThreshold; // it true and no count over threshold are found, it is lowered to find the viewport // 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 fShowAxis; // true to draw axis are shown Bool_t fShowEmptyPixels; // true to draw pixels with 0 hits Bool_t fShowOffPixels; // true to draw pixels even not in the maps Bool_t fShowGtuCounter; // true to draw the gtu counter Bool_t fDrawNightGlow; // true to draw nightglow rate Int_t fIntegral; // 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 fAlpha; // Bool_t fApplyThreshold; // if true subtracts mu-fAlpha*sqrt(mu) from each Efee // where mu is the mean nightglow rate in the fee Bool_t fAbsoluteThreshold; // if true the threshold is absolute: subtract fAlpha // from each Efee 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 Bool_t fStdPalette; // if true uses the gStyle palette Int_t fPaletteOffset; // 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; map fTriggers; // array of the chip tracking triggers Bool_t fHasTriggersFilled; // histo TH1F* fH1Hits; TStyle* fHitsStyle; TH1F* fH1SigProfile; TH1F* fH1SigMaxProfile; // pixel max signal per GTU TH1F* fH1NoiseMaxProfile; // pixel max noise per GTU (only EC with signal) TH1F* fH1NoiseMinProfile; // pixel min noise per GTU (only EC with signal) TH1F* fH1NoiseMeanProfile; // pixel mean noise per GTU (in EC most hitted) TH1F* fH1HitsMaxProfile; // pixel max hits per GTU (only pixels with signal) // data maps GtuCounts_t fFrontEndHits; // map fe hits per gtu GtuCounts_t fFrontEndSignals; // map fe signals per gtu GtuCounts_t fFrontEndNoises; // map fe background per gtu GtuCounts_t fMacroCellHits; // map mc hits GtuCounts_t fSelFrontEndHits; // map fe hits in pixels with signal GtuCounts_t fECHits; // map elem. cell hits per gtu 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 Counts_t fCountsSum; mutable GtuCounts_t fCache; mutable Int_t fCacheCode; TText fTxtCounter; TText fTxtSum; TGaxis fXaxis; TGaxis fYaxis; TGaxis fHaxis; ClassDef(EFocalSurfacePainter,1) }; //////////////////////////////////////////////////////////////////////////////// // // // EPolygon // // // //////////////////////////////////////////////////////////////////////////////// class EPolygon : public TPolyLine { public: EPolygon() {}; 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,1) }; #endif /* __EFOCALSURFACEPAINTER_HH__ */