Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TEveQuadSet.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/eve:$Id$
0002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TEveQuadSet
0013 #define ROOT_TEveQuadSet
0014 
0015 #include "TEveDigitSet.h"
0016 
0017 class TRandom;
0018 
0019 class TEveQuadSet : public TEveDigitSet
0020 {
0021    friend class TEveQuadSetGL;
0022 
0023    TEveQuadSet(const TEveQuadSet&);            // Not implemented
0024    TEveQuadSet& operator=(const TEveQuadSet&); // Not implemented
0025 
0026 public:
0027    enum EQuadType_e {
0028       kQT_Undef,                // unknown-ignored
0029       kQT_FreeQuad,             // arbitrary quad: specify 4*(x,y,z) quad corners
0030       kQT_RectangleXY,          // rectangle in x-y plane: specify x, y, z, w, h
0031       kQT_RectangleXZ,          // rectangle in x-z plane: specify x, y, z, w, h
0032       kQT_RectangleYZ,          // rectangle in y-z plane: specify x, y, z, w, h
0033       kQT_RectangleXYFixedDim,  // rectangle in x-y plane: specify x, y, z; w, h taken from fDefWidth/Height
0034       kQT_RectangleXYFixedZ,    // rectangle in x-y plane: specify x, y, w, h; z taken from fDefCoord
0035       kQT_RectangleXZFixedY,    // rectangle in x-z plane: specify x, z, w, h; y taken from fDefCoord
0036       kQT_RectangleYZFixedX,    // rectangle in y-z plane: specify y, z, w, h; x taken from fDefWidth/Height/Coord
0037       kQT_RectangleXYFixedDimZ, // rectangle in x-y plane: specify x, y; w, h, z taken from fDefWidth/Height/Coord
0038       kQT_RectangleXZFixedDimY, // rectangle in x-z plane: specify x, z; w, h, y taken from fDefWidth/Height/Coord
0039       kQT_RectangleYZFixedDimX, // rectangle in y-z plane: specify y, z; w, h, x taken from fDefWidth/Height/Coord
0040       kQT_Rectangle_End,
0041       // line modes (needed for uniform handling of silicon-strip digits)
0042       kQT_LineXYFixedZ,         // line in x-y plane: specify x, y, w(dx), h(dy); z taken from fDefCoord
0043       kQT_LineXZFixedY,         // line in x-z plane: specify x, z, w(dx), h(dz); y taken from fDefCoord
0044       kQT_Line_End,
0045       // hexagon modes
0046       kQT_HexagonXY,            // horizontal hexagon: specify x, y, z, r
0047       kQT_HexagonYX,            // vertical   hexagon: specify x, y, z, r
0048       kQT_Hexagon_End
0049       // circle modes:
0050       // QT_CircleXY,          // specify r, z
0051       // QT_CircleXYFixedZ,    // specify r
0052       // QT_CircleXYFixedR,    // specify z
0053    };
0054 
0055    struct QFreeQuad_t     : public DigitBase_t     { Float_t fVertices[12]; };
0056 
0057    struct QOrigin_t       : public DigitBase_t     { Float_t fA, fB; };
0058 
0059    struct QRectFixDimC_t  : public QOrigin_t       {};
0060 
0061    struct QRectFixDim_t   : public QRectFixDimC_t  { Float_t fC; };
0062 
0063    struct QRectFixC_t     : public QRectFixDimC_t  { Float_t fW, fH; };
0064 
0065    struct QRect_t         : public QRectFixDim_t   { Float_t fW, fH; };
0066 
0067    struct QLineFixC_t     : public QOrigin_t       { Float_t fDx, fDy; };
0068 
0069    struct QHex_t          : public QOrigin_t       { Float_t fC, fR; };
0070 
0071 protected:
0072    EQuadType_e       fQuadType;
0073 
0074    Float_t           fDefWidth;     // Breadth assigned to first coordinate  (A)
0075    Float_t           fDefHeight;    // Breadth assigned to second coordinate (B)
0076    Float_t           fDefCoord;     // Default value for third coordinate    (C)
0077 
0078    static Int_t SizeofAtom(EQuadType_e qt);
0079 
0080 public:
0081    TEveQuadSet(const char* n="TEveQuadSet", const char* t="");
0082    TEveQuadSet(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize,
0083                const char* n="TEveQuadSet", const char* t="");
0084    ~TEveQuadSet() override {}
0085 
0086    void Reset(EQuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);
0087 
0088    Float_t GetDefWidth()  const { return fDefWidth;  }
0089    Float_t GetDefHeight() const { return fDefHeight; }
0090    Float_t GetDefCoord()  const { return fDefCoord;  }
0091 
0092    void SetDefWidth(Float_t v)  { fDefWidth  = v; }
0093    void SetDefHeight(Float_t v) { fDefHeight = v; }
0094    void SetDefCoord(Float_t v)  { fDefCoord  = v; }
0095 
0096    // --------------------------------
0097 
0098    void AddQuad(Float_t verts[12]);
0099 
0100    void AddQuad(Float_t a, Float_t b);
0101    void AddQuad(Float_t a, Float_t b, Float_t c);
0102    void AddQuad(Float_t a, Float_t b, Float_t w, Float_t h);
0103    void AddQuad(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h);
0104 
0105    void AddLine(Float_t a, Float_t b, Float_t w, Float_t h);
0106 
0107    void AddHexagon(Float_t a, Float_t b, Float_t z, Float_t r);
0108 
0109    // Wrappers to make transition to TEveDigitSet as base easier
0110    void QuadValue(Int_t value) { DigitValue(value); }
0111    void QuadColor(Color_t ci)  { DigitColor(ci); }
0112    void QuadColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a=255) { DigitColor(r, g, b, a); }
0113    void QuadId(TObject* id)    { DigitId(id); }
0114 
0115    // --------------------------------
0116 
0117    // void Test(Int_t nquads);
0118 
0119    void ComputeBBox() override;
0120 
0121    // virtual void Paint(Option_t* option="");
0122 
0123    ClassDefOverride(TEveQuadSet, 0); // Collection of 2D primitives (rectangles, hexagons, or lines); each primitive can be assigned a signal value and a TRef.
0124 };
0125 
0126 #endif