]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added comments required by coding conventions.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Nov 2007 19:25:36 +0000 (19:25 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Nov 2007 19:25:36 +0000 (19:25 +0000)
EVE/Reve/BoxSet.cxx
EVE/Reve/BoxSet.h
EVE/Reve/BoxSetGL.cxx
EVE/Reve/BoxSetGL.h
EVE/Reve/DigitSet.cxx
EVE/Reve/DigitSet.h
EVE/Reve/DigitSetEditor.cxx
EVE/Reve/DigitSetEditor.h

index 479cfdd4126ea9901b559407d309818a781f7130..89e2f93e22b855e355ccda3ce444b5c7e8c8e7c3 100644 (file)
 using namespace Reve;
 
 
-//______________________________________________________________________
+//______________________________________________________________________________
 // BoxSet
 //
+// A collection of 3D-boxes. The way how the boxes are defined depends
+// on the fBoxType data-member.
+//   BT_FreeBox         arbitrary box: specify 8*(x,y,z) box corners
+//   BT_AABox           axis-aligned box: specify (x,y,z) and (w, h, d)
+//   BT_AABoxFixedDim   axis-aligned box w/ fixed dimensions: specify (x,y,z)
+//                      also set fDefWidth, fDefHeight and fDefDepth
+//
+// Each box can be assigned:
+// a) Color or signal value. Thresholds and signal-to-color mapping
+//    can then be set dynamically via the RGBAPalette class.
+// b) External TObject* (stored as TRef).
+//
+// See also base-class DigitSet for more information.
 
 ClassImp(BoxSet)
 
+//______________________________________________________________________________
 BoxSet::BoxSet(const Text_t* n, const Text_t* t) :
   DigitSet      (n, t),
 
@@ -24,14 +38,19 @@ BoxSet::BoxSet(const Text_t* n, const Text_t* t) :
   fDefHeight    (1),
   fDefDepth     (1)
 {
+  // Constructor.
+
   // Override from DigitSet.
   fDisableLigting = kFALSE;
 }
 
 /**************************************************************************/
 
+//______________________________________________________________________________
 Int_t BoxSet::SizeofAtom(BoxSet::BoxType_e bt)
 {
+  // Return size of data-structure describing a box of type bt.
+
   static const Exc_t eH("BoxSet::SizeofAtom ");
 
   switch (bt) {
@@ -46,8 +65,12 @@ Int_t BoxSet::SizeofAtom(BoxSet::BoxType_e bt)
 
 /**************************************************************************/
 
+//______________________________________________________________________________
 void BoxSet::Reset(BoxSet::BoxType_e boxType, Bool_t valIsCol, Int_t chunkSize)
 {
+  // Reset the data containers to zero size.
+  // The arguments describe the basic parameters of data storage.
+
   fBoxType      = boxType;
   fValueIsColor = valIsCol;
   fDefaultValue = valIsCol ? 0 : kMinInt;
@@ -56,8 +79,12 @@ void BoxSet::Reset(BoxSet::BoxType_e boxType, Bool_t valIsCol, Int_t chunkSize)
   fPlex.Reset(SizeofAtom(fBoxType), chunkSize);
 }
 
+//______________________________________________________________________________
 void BoxSet::Reset()
 {
+  // Reset the data containers to zero size.
+  // Keep the old data-storage parameters.
+
   if (fOwnIds)
     ReleaseIds();
   fPlex.Reset(SizeofAtom(fBoxType), TMath::Max(fPlex.N(), 64));
@@ -65,6 +92,7 @@ void BoxSet::Reset()
 
 /**************************************************************************/
 
+//______________________________________________________________________________
 void BoxSet::AddBox(const Float_t* verts)
 {
   // Create a new box from a set of 8 vertices.
@@ -79,6 +107,7 @@ void BoxSet::AddBox(const Float_t* verts)
   memcpy(b->fVertices, verts, sizeof(b->fVertices));
 }
 
+//______________________________________________________________________________
 void BoxSet::AddBox(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h, Float_t d)
 {
   // Create a new axis-aligned box from at a given position and with
@@ -95,6 +124,7 @@ void BoxSet::AddBox(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h, Float
   box->fW = w; box->fH = h; box->fD = d;
 }
 
+//______________________________________________________________________________
 void BoxSet::AddBox(Float_t a, Float_t b, Float_t c)
 {
   // Create a new axis-aligned box from at a given position.
@@ -111,6 +141,7 @@ void BoxSet::AddBox(Float_t a, Float_t b, Float_t c)
 
 /**************************************************************************/
 
+//______________________________________________________________________________
 void BoxSet::ComputeBBox()
 {
   // Fill bounding-box information of the base-class TAttBBox (virtual method).
@@ -182,100 +213,13 @@ void BoxSet::ComputeBBox()
          fBBox[0], fBBox[1], fBBox[2], fBBox[3], fBBox[4], fBBox[5]);
 }
 
-/*
-void BoxSet::Paint(Option_t* option)
-{
-  TBuffer3D buff(TBuffer3DTypes::kGeneric);
-
-  // Section kCore
-  buff.fID           = this;
-  buff.fColor        = 1;
-  buff.fTransparency = 0;
-  fHMTrans.SetBuffer3D(buff);
-  buff.SetSectionsValid(TBuffer3D::kCore);
-
-  Int_t reqSections = gPad->GetViewer3D()->AddObject(buff);
-  if (reqSections == TBuffer3D::kNone) {
-    // printf("BoxSet::Paint viewer was happy with Core buff3d.\n");
-    return;
-  }
-
-  if (reqSections & TBuffer3D::kRawSizes) {
-    Int_t nbPnts = fBoxes.size()*8;
-    Int_t nbSegs = fBoxes.size()*12;
-    Int_t nbPoly = fBoxes.size()*6;
-    if (!buff.SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, nbPoly, nbPoly*6)) {
-      return;
-    }
-    buff.SetSectionsValid(TBuffer3D::kRawSizes);
-  }
-
-  if ((reqSections & TBuffer3D::kRaw) && buff.SectionsValid(TBuffer3D::kRawSizes)) {
-    // Points
-    Int_t pidx = 0;
-    for (std::vector<Box>::iterator i=fBoxes.begin(); i!=fBoxes.end(); ++i) {
-      for (Int_t k=0; k<24; ++k) {
-       buff.fPnts[pidx] = (*i).vertices[k];
-       pidx++;
-      }
-    }
-    Int_t c = 2;   // color; !!! wrong
-    Int_t eoff;    // polygon or segment offset in fPols and fSegs array
-    Int_t voff;    // vertex offset
-    Int_t soff;    // offset in counting segments
-    Int_t nspp = 4; // number of segments per polygon
-
-    // Segments & Polygons
-    for (Int_t q = 0; q < (Int_t)fBoxes.size(); ++q) {
-      eoff = q*36;
-      soff = q*12;
-      voff = q*8;
-      //bottom
-      buff.fSegs[ 0 + eoff] = c;  buff.fSegs[ 1 + eoff] = 0 + voff;  buff.fSegs[ 2 + eoff] = 1 + voff;
-      buff.fSegs[ 3 + eoff] = c;  buff.fSegs[ 4 + eoff] = 1 + voff;  buff.fSegs[ 5 + eoff] = 2 + voff;
-      buff.fSegs[ 6 + eoff] = c;  buff.fSegs[ 7 + eoff] = 2 + voff;  buff.fSegs[ 8 + eoff] = 3 + voff;
-      buff.fSegs[ 9 + eoff] = c;  buff.fSegs[10 + eoff] = 3 + voff;  buff.fSegs[11 + eoff] = 0 + voff;
-      // top
-      buff.fSegs[12 + eoff] = c;  buff.fSegs[13 + eoff] = 4 + voff;  buff.fSegs[14 + eoff] = 5 + voff;
-      buff.fSegs[15 + eoff] = c;  buff.fSegs[16 + eoff] = 5 + voff;  buff.fSegs[17 + eoff] = 6 + voff;
-      buff.fSegs[18 + eoff] = c;  buff.fSegs[19 + eoff] = 6 + voff;  buff.fSegs[20 + eoff] = 7 + voff;
-      buff.fSegs[21 + eoff] = c;  buff.fSegs[22 + eoff] = 7 + voff;  buff.fSegs[23 + eoff] = 4 + voff;
-      //sides
-      buff.fSegs[24 + eoff] = c;  buff.fSegs[25 + eoff] = 0 + voff;  buff.fSegs[26 + eoff] = 4 + voff;
-      buff.fSegs[27 + eoff] = c;  buff.fSegs[28 + eoff] = 1 + voff;  buff.fSegs[29 + eoff] = 5 + voff;
-      buff.fSegs[30 + eoff] = c;  buff.fSegs[31 + eoff] = 2 + voff;  buff.fSegs[32 + eoff] = 6 + voff;
-      buff.fSegs[33 + eoff] = c;  buff.fSegs[34 + eoff] = 3 + voff;  buff.fSegs[35 + eoff] = 7 + voff;
-
-      buff.fPols[ 0 + eoff] = c;         buff.fPols[ 1 + eoff] = nspp;
-      buff.fPols[ 2 + eoff] = 0 + soff;  buff.fPols[ 3 + eoff] = 9  + soff;
-      buff.fPols[ 4 + eoff] = 4 + soff;  buff.fPols[ 5 + eoff] = 8  + soff;
-      buff.fPols[ 6 + eoff] = c;         buff.fPols[ 7 + eoff] = nspp;
-      buff.fPols[ 8 + eoff] = 1 + soff;  buff.fPols[ 9 + eoff] = 10 + soff;
-      buff.fPols[10 + eoff] = 5 + soff;  buff.fPols[11 + eoff] = 9  + soff;
-      buff.fPols[12 + eoff] = c;         buff.fPols[13 + eoff] = nspp;
-      buff.fPols[14 + eoff] = 2 + soff;  buff.fPols[15 + eoff] = 11 + soff;
-      buff.fPols[16 + eoff] = 6 + soff;  buff.fPols[17 + eoff] = 10 + soff;
-      buff.fPols[18 + eoff] = c;         buff.fPols[19 + eoff] = nspp;
-      buff.fPols[20 + eoff] = 3 + soff;  buff.fPols[21 + eoff] = 8  + soff;
-      buff.fPols[22 + eoff] = 7 + soff;  buff.fPols[23 + eoff] = 11 + soff;
-      buff.fPols[24 + eoff] = c;         buff.fPols[25 + eoff] = nspp;
-      buff.fPols[26 + eoff] = 0 + soff;  buff.fPols[27 + eoff] = 3  + soff;
-      buff.fPols[28 + eoff] = 2 + soff;  buff.fPols[29 + eoff] = 1  + soff;
-      buff.fPols[30 + eoff] = c;         buff.fPols[31 + eoff] = nspp;
-      buff.fPols[32 + eoff] = 4 + soff;  buff.fPols[33 + eoff] = 5  + soff;
-      buff.fPols[34 + eoff] = 6 + soff;  buff.fPols[35 + eoff] = 7  + soff;
-    }
-    buff.fColor = 2; // colors on polygons are ignored
-    buff.SetSectionsValid(TBuffer3D::kRaw);
-  }
-  gPad->GetViewer3D()->AddObject(buff);
-}
-*/
-
 /**************************************************************************/
 
+//______________________________________________________________________________
 void BoxSet::Test(Int_t nboxes)
 {
+  // Fill the structure with a random set of boxes.
+
   Reset(BT_AABox, kTRUE, nboxes);
   TRandom rnd(0);
   const Float_t origin = 10, size = 2;
index 5f694a05c8bb36d57d0f874b201d59da5ce47795..87607d147caca53582aaaa299307d18a101c629d 100644 (file)
@@ -32,16 +32,16 @@ protected:
 
   struct BOrigin        : public DigitBase { Float_t fA, fB, fC; };
 
-  struct BAABox         : public BOrigin { Float_t fW, fH, fD; };
+  struct BAABox         : public BOrigin   { Float_t fW, fH, fD; };
 
   struct BAABoxFixedDim : public BOrigin {};
 
 protected:
-  BoxType_e         fBoxType;
+  BoxType_e         fBoxType;      // Type of rendered box.
 
-  Float_t           fDefWidth;     // Breadth assigned to first coordinate  (A)
-  Float_t           fDefHeight;    // Breadth assigned to second coordinate (B)
-  Float_t           fDefDepth;     // Breadth assigned to third coordinate  (C)
+  Float_t           fDefWidth;     // Breadth assigned to first coordinate  (A).
+  Float_t           fDefHeight;    // Breadth assigned to second coordinate (B).
+  Float_t           fDefDepth;     // Breadth assigned to third coordinate  (C).
 
   static Int_t SizeofAtom(BoxType_e bt);
 
@@ -69,7 +69,7 @@ public:
   void SetDefHeight(Float_t v) { fDefHeight = v ; }
   void SetDefDepth(Float_t v)  { fDefDepth  = v ; }
 
-  ClassDef(BoxSet, 1);
+  ClassDef(BoxSet, 1); // Visual class showing a set of boxes.
 }; // endclass BoxSet
 
 }
index e2f73f6e3e3bfe4aa61505cb89bffea83289a8d6..0a796886a15db9c76617142c81d31591b82413c5 100644 (file)
 
 using namespace Reve;
 
-//______________________________________________________________________
+//______________________________________________________________________________
 // BoxSetGL
 //
+// A GL rendering class for BoxSet.
+//
 
 ClassImp(BoxSetGL)
 
+//______________________________________________________________________________
 BoxSetGL::BoxSetGL() : fM(0), fBoxDL(0)
 {
+  // Default constructor.
+
   // fDLCache = false; // Disable display list.
 }
 
+//______________________________________________________________________________
 BoxSetGL::~BoxSetGL()
-{}
+{
+  // Destructor. Noop.
+}
 
 /**************************************************************************/
 // Protected methods
 /**************************************************************************/
 
+//______________________________________________________________________________
 Int_t BoxSetGL::PrimitiveType() const
 {
+  // Return GL primitive used to render the boxes, based on the
+  // render-mode specified in the model object.
+
   return (fM->fRenderMode != DigitSet::RM_Line) ? GL_QUADS : GL_LINE_LOOP;
 }
 
+//______________________________________________________________________________
 inline Bool_t BoxSetGL::SetupColor(const DigitSet::DigitBase& q) const
 {
+  // Set GL color for given primitive.
+
   if (fM->fValueIsColor)
   {
     glColor4ubv((UChar_t*) & q.fValue);
@@ -51,8 +66,11 @@ inline Bool_t BoxSetGL::SetupColor(const DigitSet::DigitBase& q) const
   }
 }
 
-void BoxSetGL::MakeOriginBox(Float_t* p, Float_t dx, Float_t dy, Float_t dz) const
+//______________________________________________________________________________
+void BoxSetGL::MakeOriginBox(Float_t p[24], Float_t dx, Float_t dy, Float_t dz) const
 {
+  // Fill array p to represent a box (0,0,0) - (dx,dy,dz).
+
   // bottom
   p[0] = 0;  p[1] = dy; p[2] = 0;  p += 3;
   p[0] = dx; p[1] = dy; p[2] = 0;  p += 3;
@@ -65,8 +83,11 @@ void BoxSetGL::MakeOriginBox(Float_t* p, Float_t dx, Float_t dy, Float_t dz) con
   p[0] = 0;  p[1] = 0;  p[2] = dz;
 }
 
-inline void BoxSetGL::RenderBox(const Float_t* p) const
+//______________________________________________________________________________
+inline void BoxSetGL::RenderBox(const Float_t p[24]) const
 {
+  // Render a box specified by points in array p.
+
   // bottom: 0123
   glNormal3f(0, 0, -1);
   glVertex3fv(p);      glVertex3fv(p + 3);
@@ -93,8 +114,14 @@ inline void BoxSetGL::RenderBox(const Float_t* p) const
   glVertex3fv(p + 18);  glVertex3fv(p + 6);
 }
 
+//______________________________________________________________________________
 void BoxSetGL::MakeDisplayList() const
 {
+  // Create a display-list for rendering a single box, based on the
+  // current box-type.
+  // Some box-types don't benefit from the display-list rendering and
+  // so display-list is not created.
+
   if (fM->fBoxType == BoxSet::BT_AABox ||
       fM->fBoxType == BoxSet::BT_AABoxFixedDim)
   {
@@ -119,8 +146,12 @@ void BoxSetGL::MakeDisplayList() const
 // Virtuals from base-classes
 /**************************************************************************/
 
+//______________________________________________________________________________
 Bool_t BoxSetGL::ShouldDLCache(const TGLRnrCtx & rnrCtx) const
 {
+  // Determines if display-list will be used for rendering.
+  // Virtual from TGLLogicalShape.
+
   MakeDisplayList();
 
   if (rnrCtx.DrawPass() == TGLRnrCtx::kPassOutlineLine)
@@ -128,14 +159,23 @@ Bool_t BoxSetGL::ShouldDLCache(const TGLRnrCtx & rnrCtx) const
   return TGLObject::ShouldDLCache(rnrCtx);
 }
 
+//______________________________________________________________________________
 void BoxSetGL::DLCacheDrop()
 {
+  // Called when display lists have been destroyed externally and the
+  // internal display-list data needs to be cleare.
+  // Virtual from TGLLogicalShape.
+
   fBoxDL = 0;
   TGLObject::DLCacheDrop();
 }
 
+//______________________________________________________________________________
 void BoxSetGL::DLCachePurge()
 {
+  // Called when display-lists need to be returned to the system.
+  // Virtual from TGLLogicalShape.
+
   static const Exc_t eH("BoxSetGL::DLCachePurge ");
 
   if (fBoxDL == 0) return;
@@ -153,20 +193,32 @@ void BoxSetGL::DLCachePurge()
 
 /**************************************************************************/
 
+//______________________________________________________________________________
 Bool_t BoxSetGL::SetModel(TObject* obj, const Option_t* /*opt*/)
 {
+  // Set model object.
+  // Virtual from TGLObject.
+
   Bool_t isok = SetModelCheckClass(obj, Reve::BoxSet::Class());
   fM = isok ? dynamic_cast<Reve::BoxSet*>(obj) : 0;
   return isok;
 }
 
+//______________________________________________________________________________
 void BoxSetGL::SetBBox()
 {
+  // Fill the bounding-box data of the logical-shape.
+  // Virtual from TGLObject.
+
   SetAxisAlignedBBox(fM->AssertBBox());
 }
 
+//______________________________________________________________________________
 void BoxSetGL::DirectDraw(TGLRnrCtx & rnrCtx) const
 {
+  // Actual rendering code.
+  // Virtual from TGLLogicalShape.
+
   static const Exc_t eH("BoxSetGL::DirectDraw ");
 
   if (rnrCtx.DrawPass() == TGLRnrCtx::kPassOutlineLine)
@@ -266,7 +318,6 @@ void BoxSetGL::DirectDraw(TGLRnrCtx & rnrCtx) const
   glPopAttrib();
 }
 
-/**************************************************************************/
 /**************************************************************************/
 
 //______________________________________________________________________________
@@ -280,9 +331,11 @@ void BoxSetGL::ProcessSelection(TGLRnrCtx & /*rnrCtx*/, TGLSelectRecord & rec)
   fM->DigitSelected(rec.GetItem(1));
 }
 
+//______________________________________________________________________________
 void BoxSetGL::Render(TGLRnrCtx & rnrCtx)
 {
-  // Interface for direct rendering from classes that include BoxSet as a member.
+  // Interface for direct rendering from classes that include BoxSet
+  // as a member.
 
   MakeDisplayList();
   DirectDraw(rnrCtx);
index a4b8fd53d52c96567a3a0478319bca3c3e657c03..4676876b8f7a92ee94540ab125689779445be78c 100644 (file)
@@ -14,16 +14,16 @@ class BoxSetGL : public TGLObject
   BoxSetGL& operator=(const BoxSetGL&); // Not implemented
 
 protected:
-  BoxSet* fM;
+  BoxSet* fM;               // Model object.
 
-  mutable UInt_t  fBoxDL;
+  mutable UInt_t  fBoxDL;   // Display-list id for a box atom.
 
   virtual void DirectDraw(TGLRnrCtx & rnrCtx) const;
 
   Int_t  PrimitiveType() const;
   Bool_t SetupColor(const DigitSet::DigitBase& q) const;
-  void   MakeOriginBox(Float_t* p, Float_t dx, Float_t dy, Float_t dz) const;
-  void   RenderBox(const Float_t* p) const;
+  void   MakeOriginBox(Float_t p[24], Float_t dx, Float_t dy, Float_t dz) const;
+  void   RenderBox(const Float_t p[24]) const;
   void   MakeDisplayList() const;
 
 public:
@@ -42,7 +42,7 @@ public:
 
   virtual void Render(TGLRnrCtx & rnrCtx);
 
-  ClassDef(BoxSetGL, 0);
+  ClassDef(BoxSetGL, 0); // GL rendering class for BoxSet.
 }; // endclass BoxSetGL
 
 }
index 18a5a3afde36ae649b9134d832bc69de434fa29c..720e99abe13592a91381a5b3b7f3f7530d8b2ae6 100644 (file)
 
 using namespace Reve;
 
-//______________________________________________________________________
+//______________________________________________________________________________
 // DigitSet
 //
+// Base-class for displaying a digit collection.
+// Provdies common services for:
+// - specifying signal / color per digit
+// - specifying object reference per digit
+// - controlling palette and thresholds (external object RGBAPalette)
+// - showing a frame around the digits (external object FrameBox)
+// - specifying transformation matrix for the whole collection
+//   by data-member of class ZTrans.
+//
+// See also:
+//   QuadSet: rectangle, hexagon or line per digit
+//   BoxSet   a 3D box per digit
 
 ClassImp(DigitSet)
 
+//______________________________________________________________________________
 DigitSet::DigitSet(const Text_t* n, const Text_t* t) :
   RenderElement   (),
   TNamed          (n, t),
@@ -37,27 +50,39 @@ DigitSet::DigitSet(const Text_t* n, const Text_t* t) :
   fHistoButtons   (kTRUE),
   fHMTrans        ()
 {
-
+  // Constructor.
 }
 
+//______________________________________________________________________________
 DigitSet::~DigitSet()
 {
+  // Destructor.
+  // Unreference frame and palette. Destroy referenced objects if they
+  // are owned by the DigitSet.
+
   SetFrame(0);
   SetPalette(0);
   if (fOwnIds)
     ReleaseIds();
 }
 
-/**************************************************************************/
+/******************************************************************************/
 
+//______________________________________________________________________________
 DigitSet::DigitBase* DigitSet::NewDigit()
 {
+  // Protected method called whenever a new digit is added.
+
   fLastDigit = new (fPlex.NewAtom()) DigitBase(fDefaultValue);
   return fLastDigit;
 }
 
+//______________________________________________________________________________
 void DigitSet::ReleaseIds()
 {
+  // Protected method. Release and delete the referenced objects, the
+  // ownership is *NOT* checked.
+
   VoidCPlex::iterator qi(fPlex);
   while (qi.next()) {
     DigitBase& q = * (DigitBase*) qi();
@@ -68,9 +93,10 @@ void DigitSet::ReleaseIds()
   }
 }
 
-/**************************************************************************/
-/**************************************************************************/
+/******************************************************************************/
+/******************************************************************************/
 
+//______________________________________________________________________________
 void DigitSet::SetMainColor(Color_t color)
 {
   // Override from RenderElement, forward to Frame.
@@ -82,9 +108,10 @@ void DigitSet::SetMainColor(Color_t color)
   gReve->Redraw3D();
 }
 
-/**************************************************************************/
-/**************************************************************************/
+/******************************************************************************/
+/******************************************************************************/
 
+//______________________________________________________________________________
 void DigitSet::RefitPlex()
 {
   // Instruct underlying memory allocator to regroup itself into a
@@ -93,10 +120,13 @@ void DigitSet::RefitPlex()
   fPlex.Refit();
 }
 
-/**************************************************************************/
+/******************************************************************************/
 
+//______________________________________________________________________________
 void DigitSet::ScanMinMaxValues(Int_t& min, Int_t& max)
 {
+  // Iterate over the digits and detmine min and max signal values.
+
   if (fValueIsColor || fPlex.Size() == 0) return;
   min = kMaxInt;
   max = kMinInt;
@@ -116,43 +146,58 @@ void DigitSet::ScanMinMaxValues(Int_t& min, Int_t& max)
     --min;
 }
 
-/**************************************************************************/
-
+/******************************************************************************/
 
+//______________________________________________________________________________
 void DigitSet::DigitValue(Int_t value)
 {
+  // Set signal value for the last digit added.
+
   fLastDigit->fValue = value;
 }
 
+//______________________________________________________________________________
 void DigitSet::DigitColor(Color_t ci)
 {
+  // Set color for the last digit added.
+
   ColorFromIdx(ci, (UChar_t*) & fLastDigit->fValue, kTRUE);
 }
 
+//______________________________________________________________________________
 void DigitSet::DigitColor(UChar_t r, UChar_t g, UChar_t b, UChar_t a)
 {
+  // Set color for the last digit added.
+
   UChar_t* x = (UChar_t*) & fLastDigit->fValue;
   x[0] = r; x[1] = g; x[2] = b; x[3] = a;
 }
 
+//______________________________________________________________________________
 void DigitSet::DigitColor(UChar_t* rgba)
 {
+  // Set color for the last digit added.
+
   UChar_t* x = (UChar_t*) & fLastDigit->fValue;
   x[0] = rgba[0]; x[1] = rgba[1]; x[2] = rgba[2]; x[3] = rgba[3];
 }
 
-/**************************************************************************/
-
+//______________________________________________________________________________
 void DigitSet::DigitId(TObject* id)
 {
+  // Set external object reference for the last digit added.
+
   fLastDigit->fId = id;
 }
 
-/**************************************************************************/
-/**************************************************************************/
+/******************************************************************************/
+/******************************************************************************/
 
+//______________________________________________________________________________
 void DigitSet::Paint(Option_t* /*option*/)
 {
+  // Paint this object. Only direct rendering is supported.
+
   static const Exc_t eH("DigitSet::Paint ");
 
   TBuffer3D buff(TBuffer3DTypes::kGeneric);
@@ -169,8 +214,11 @@ void DigitSet::Paint(Option_t* /*option*/)
     Error(eH, "only direct GL rendering supported.");
 }
 
+//______________________________________________________________________________
 void DigitSet::DigitSelected(Int_t idx)
 {
+  // Called from renderer when a digit with index idx is selected.
+
   if (fEmitSignals) {
     CtrlClicked(this, idx);
   } else {
@@ -183,8 +231,11 @@ void DigitSet::DigitSelected(Int_t idx)
   }
 }
 
+//______________________________________________________________________________
 void DigitSet::CtrlClicked(DigitSet* qs, Int_t idx)
 {
+  // Emit a CtrlClicked signal.
+
   Long_t args[2];
   args[0] = (Long_t) qs;
   args[1] = (Long_t) idx;
@@ -192,12 +243,15 @@ void DigitSet::CtrlClicked(DigitSet* qs, Int_t idx)
   Emit("CtrlClicked(Reve::DigitSet*, Int_t)", args);
 }
 
-/**************************************************************************/
+/******************************************************************************/
 // Getters / Setters for Frame, RGBAPalette, ZTrans
-/**************************************************************************/
+/******************************************************************************/
 
+//______________________________________________________________________________
 void DigitSet::SetFrame(FrameBox* b)
 {
+  // Set FrameBox pointer.
+
   if (fFrame == b) return;
   if (fFrame) fFrame->DecRefCount(this);
   fFrame = b;
@@ -209,16 +263,24 @@ void DigitSet::SetFrame(FrameBox* b)
   }
 }
 
+//______________________________________________________________________________
 void DigitSet::SetPalette(RGBAPalette* p)
 {
+  // Set RGBAPalette pointer.
+
   if (fPalette == p) return;
   if (fPalette) fPalette->DecRefCount();
   fPalette = p;
   if (fPalette) fPalette->IncRefCount();
 }
 
+//______________________________________________________________________________
 RGBAPalette* DigitSet::AssertPalette()
 {
+  // Make sure the RGBAPalette pointer is not null.
+  // If it is not set, a new one is instantiated and the range is set
+  // to current min/max signal values.
+
   if (fPalette == 0) {
     fPalette = new RGBAPalette;
     if (!fValueIsColor) {
index eb48f4e08ad11431ced3dc71fc81d93d6e7928ae..5187bac40a3dce64b681358d9f1c9ae2aca0a270 100644 (file)
@@ -35,27 +35,27 @@ public:
 protected:
   struct DigitBase
   {
-    Int_t fValue;
-    TRef  fId;
+    // Base-class for digit representation classes.
 
-    // Here could have additional integer (like time, second threshold).
+    Int_t fValue; // signal value of a digit (can be direct RGBA color)
+    TRef  fId;    // external object reference
 
     DigitBase(Int_t v=0) : fValue(v), fId() {}
   };
 
-  Int_t             fDefaultValue;
-  Bool_t            fValueIsColor;
-  Bool_t            fOwnIds;       //Flag specifying if id-objects are owned by the DigitSet
-  VoidCPlex         fPlex;
-  DigitBase*        fLastDigit;    //!
+  Int_t             fDefaultValue;  // Default signal value.
+  Bool_t            fValueIsColor;  // Interpret signal value as RGBA color.
+  Bool_t            fOwnIds;        // Flag specifying if id-objects are owned by the DigitSet
+  VoidCPlex         fPlex;          // Container of digit data.
+  DigitBase*        fLastDigit;     //! The last digit added to collection.
 
-  FrameBox*         fFrame;
-  RGBAPalette*      fPalette;
-  RenderMode_e      fRenderMode;
-  Bool_t            fDisableLigting;
-  Bool_t            fEmitSignals;
-  Bool_t            fHistoButtons;
-  ZTrans            fHMTrans;
+  FrameBox*         fFrame;          // Pointer to frame structure.
+  RGBAPalette*      fPalette;        // Pointer to signal-color palette.
+  RenderMode_e      fRenderMode;     // Render mode: as-is / line / filled.
+  Bool_t            fDisableLigting; // Disable lighting for rendering.
+  Bool_t            fEmitSignals;    // Emit signals on secondary-select.
+  Bool_t            fHistoButtons;   // Show histogram buttons in object editor.
+  ZTrans            fHMTrans;        // Overall transformation of whole collection.
 
   DigitBase* NewDigit();
   void       ReleaseIds();
@@ -67,6 +67,7 @@ public:
   virtual Bool_t CanEditMainColor() { return kTRUE; }
   virtual void   SetMainColor(Color_t color);
 
+  // Implemented in sub-classes:
   // virtual void Reset(QuadType_e quadType, Bool_t valIsCol, Int_t chunkSize);
 
   void RefitPlex();
@@ -81,15 +82,17 @@ public:
 
   void DigitId(TObject* id);
 
-  Bool_t GetOwnIds() const    { return fOwnIds; }
-  void   SetOwnIds(Bool_t o)  { fOwnIds = o; }
+  Bool_t GetOwnIds() const     { return fOwnIds; }
+  void   SetOwnIds(Bool_t o)   { fOwnIds = o; }
 
   DigitBase* GetDigit(Int_t n) { return (DigitBase*) fPlex.Atom(n);   }
-  TObject*   GetId(Int_t n)   { return GetDigit(n)->fId.GetObject(); }
+  TObject*   GetId(Int_t n)    { return GetDigit(n)->fId.GetObject(); }
 
   // --------------------------------
 
-  // virtual void ComputeBBox(); // implement in subclass
+  // Implemented in subclasses:
+  // virtual void ComputeBBox();
+
   virtual void Paint(Option_t* option="");
 
   virtual void DigitSelected(Int_t idx);
@@ -121,7 +124,7 @@ public:
   void SetTransMatrix(Double_t* carr)        { fHMTrans.SetFrom(carr); }
   void SetTransMatrix(const TGeoMatrix& mat) { fHMTrans.SetFrom(mat);  }
 
-  ClassDef(DigitSet, 1);
+  ClassDef(DigitSet, 1); // Base-class for visual digit collections.
 }; // endclass DigitSet
 
 }
index 90d12194db7a4770bb44c2c6ce3d84019aeb59fc..6664519175616b30c6a7c43639a09c05d7d80fa0 100644 (file)
 
 using namespace Reve;
 
-//______________________________________________________________________
+//______________________________________________________________________________
 // DigitSetEditor
 //
+// GUI editor for class DigitSet.
+//
 
 ClassImp(DigitSetEditor)
 
+//______________________________________________________________________________
 DigitSetEditor::DigitSetEditor(const TGWindow *p, Int_t width, Int_t height,
                             UInt_t options, Pixel_t back) :
   TGedFrame(p, width, height, options | kVerticalFrame, back),
@@ -38,6 +41,8 @@ DigitSetEditor::DigitSetEditor(const TGWindow *p, Int_t width, Int_t height,
   fHistoButtFrame(0),
   fInfoFrame(0)
 {
+  // Constructor.
+
   MakeTitle("Transformation matrix");
 
   fHMTrans = new ZTransSubEditor(this);
@@ -55,12 +60,18 @@ DigitSetEditor::DigitSetEditor(const TGWindow *p, Int_t width, Int_t height,
   CreateInfoTab();
 }
 
+//______________________________________________________________________________
 DigitSetEditor::~DigitSetEditor()
-{}
+{
+  // Destructor. Noop.
+}
 
 /*************************************************************************/
+
+//______________________________________________________________________________
 void DigitSetEditor::CreateInfoTab()
 {
+  // Create information tab.
 
   fInfoFrame = CreateEditorTabSubFrame("Info");
 
@@ -93,8 +104,11 @@ void DigitSetEditor::CreateInfoTab()
 
 /**************************************************************************/
 
+//______________________________________________________________________________
 void DigitSetEditor::SetModel(TObject* obj)
 {
+  // Set model object.
+
   fM = dynamic_cast<DigitSet*>(obj);
 
   fHMTrans->SetDataFromTrans(&fM->fHMTrans);
@@ -106,9 +120,6 @@ void DigitSetEditor::SetModel(TObject* obj)
     fPalette->MapWindow();
   }
 
-  // Set values of widgets
-  // fXYZZ->SetValue(fM->GetXYZZ());
-
   if (fM->fHistoButtons)
     fHistoButtFrame->MapWindow();
   else
@@ -117,8 +128,11 @@ void DigitSetEditor::SetModel(TObject* obj)
 
 /**************************************************************************/
 
+//______________________________________________________________________________
 void DigitSetEditor::DoHisto()
 {
+  // Show histogram slot.
+
   Int_t min, max;
   if (fM->fPalette) {
     min = fM->fPalette->GetLowLimit();
@@ -129,8 +143,11 @@ void DigitSetEditor::DoHisto()
   PlotHisto(min, max);
 }
 
+//______________________________________________________________________________
 void DigitSetEditor::DoRangeHisto()
 {
+  // Show ranged histogram slot.
+
   Int_t min, max;
   if (fM->fPalette) {
     min = fM->fPalette->GetMinVal();
@@ -141,8 +158,11 @@ void DigitSetEditor::DoRangeHisto()
   PlotHisto(min, max);
 }
 
+//______________________________________________________________________________
 void DigitSetEditor::PlotHisto(Int_t min, Int_t max)
 {
+  // Plots a histogram from digit vales with given range.
+
   Int_t nbins = max-min+1;
   while (nbins > 200)
     nbins /= 2;
index 0ed1520534cd1469d2c48336b30922f03db5afe0..48c8676b5d832d4efcfcaff160d1e20ce0a76dd3 100644 (file)
@@ -29,13 +29,13 @@ private:
 
   void CreateInfoTab();
 protected:
-  DigitSet*              fM; // fModel dynamic-casted to DigitSetEditor
+  DigitSet             * fM;              // Model object.
 
-  ZTransSubEditor*      fHMTrans;
-  RGBAPaletteSubEditor* fPalette;
+  ZTransSubEditor      *fHMTrans;         // ZTrans sub-editor.
+  RGBAPaletteSubEditor *fPalette;         // Palette sub-editor.
 
-  TGHorizontalFrame*    fHistoButtFrame;
-  TGVerticalFrame*      fInfoFrame;
+  TGHorizontalFrame    *fHistoButtFrame;  // Frame holding histogram display buttons.
+  TGVerticalFrame      *fInfoFrame;       // Frame displaying basic digit statistics.
 
 public:
   DigitSetEditor(const TGWindow* p=0, Int_t width=170, Int_t height=30, UInt_t options = kChildFrame, Pixel_t back=GetDefaultFrameBackground());
@@ -48,7 +48,7 @@ public:
   void DoRangeHisto();
   void PlotHisto(Int_t min, Int_t max);
 
-  ClassDef(DigitSetEditor, 1); // Editor for DigitSet
+  ClassDef(DigitSetEditor, 1); // Editor for DigitSet class.
 }; // endclass DigitSetEditor
 
 }