]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Merge from EVE-dev.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 Aug 2006 14:30:19 +0000 (14:30 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 Aug 2006 14:30:19 +0000 (14:30 +0000)
12 files changed:
EVE/Alieve/ChangeLog
EVE/Alieve/TPCSector2DGL.cxx
EVE/Alieve/TPCSector2DGL.h
EVE/Alieve/TPCSector3DGL.cxx
EVE/ChangeLog
EVE/Reve/BoxSetGL.cxx
EVE/Reve/ChangeLog
EVE/Reve/PointSet.cxx
EVE/Reve/QuadSetGL.cxx
EVE/Reve/RGTopFrame.cxx
EVE/Reve/RGTopFrame.h
EVE/alice-macros/clusters_from_label.C

index 13d9ca7fb94ccc4d403628c47c9ab9c6b94de350..f82fe8df2891bbf854f0acdfe506b6d568e30a07 100644 (file)
@@ -1,3 +1,13 @@
+2006-08-29  Matevz Tadel  <matevz.tadel@cern.ch>
+
+       * TPCSector2DGL.cxx:
+       * TPCSector2DGL.h:
+       Added support for two-level selection down to pad level; added
+       ifdefs for post root-5.11.0 prototype of SetModelCheckClass().
+
+       * TPCSector3DGL.cxx:
+       Added ifdefs for post root-5.11.0 prototype ofSetModelCheckClass().
+
 2006-07-11  Matevz Tadel  <matevz.tadel@cern.ch>
 
        * EventAlieve.cxx:
index 60ce376f56f62cfe377f2845e75610de7b73d464..d1ba4dbc99ee20ad927b25595df4ece90d853c44 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <TStopwatch.h>
 
+#include <TGLDrawFlags.h>
 #include <GL/gl.h>
 
 using namespace Reve;
@@ -48,8 +49,10 @@ Bool_t TPCSector2DGL::SetModel(TObject* obj)
 {
 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
   if(set_model(obj, "Alieve::TPCSector2D")) {
-#else
+#elif ROOT_VERSION_CODE <= ROOT_VERSION(5,13,0)
   if(SetModelCheckClass(obj, "Alieve::TPCSector2D")) {
+#else
+  if(SetModelCheckClass(obj, Alieve::TPCSector2D::Class())) {
 #endif
     fSector = (TPCSector2D*) fExternalObj;
     return kTRUE;
@@ -68,7 +71,7 @@ void TPCSector2DGL::SetBBox()
 
 /**************************************************************************/
 
-void TPCSector2DGL::DirectDraw(const TGLDrawFlags& /*flags*/) const
+void TPCSector2DGL::DirectDraw(const TGLDrawFlags& flags) const
 {
   // Actual GL drawing.
 
@@ -96,52 +99,42 @@ void TPCSector2DGL::DirectDraw(const TGLDrawFlags& /*flags*/) const
     const TPCSectorData::SegmentInfo& o1Seg = TPCSectorData::GetOut1Seg();
     const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
 
-    if(fSector->fUseTexture) {
-      //texture
-      glEnable(GL_BLEND);
-      glDepthMask(GL_FALSE);
-      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
-      glPolygonOffset(2,2);
-      glEnable(GL_POLYGON_OFFSET_FILL);
-
-      glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-      glBindTexture(GL_TEXTURE_2D, fTexture);
-      glEnable(GL_TEXTURE_2D);
-
-      if(fSector->fRnrInn)
-       DisplayTexture(iSeg.GetPadWidth(),  iSeg.GetPadHeight(),  iSeg.GetRLow(),
-                      iSeg.GetNMaxPads(),  iSeg.GetNRows(),
-                      0,                   0);
-      if(fSector->fRnrOut1)
-       DisplayTexture(o1Seg.GetPadWidth(), o1Seg.GetPadHeight(), o1Seg.GetRLow(),
-                      o1Seg.GetNMaxPads(), o1Seg.GetNRows(),
-                      iSeg.GetNMaxPads(),  0);
-      if(fSector->fRnrOut2)
-       DisplayTexture(o2Seg.GetPadWidth(), o2Seg.GetPadHeight(), o2Seg.GetRLow(),
-                      o2Seg.GetNMaxPads(), o2Seg.GetNRows(),
-                      0,                   o1Seg.GetNRows());
-
-      glDisable(GL_TEXTURE_2D);
+    if(flags.SecSelection()) {
+
+      if(fSector->fRnrInn)  DisplayNamedQuads(iSeg, 0, 0);
+      if(fSector->fRnrOut1) DisplayNamedQuads(o1Seg, iSeg.GetNMaxPads(), 0);
+      if(fSector->fRnrOut2) DisplayNamedQuads(o2Seg, 0, o1Seg.GetNRows());
+
     } else {
-      if(fSector->fRnrInn)
-       DisplayQuads(iSeg.GetPadWidth(),  iSeg.GetPadHeight(),  iSeg.GetRLow(),
-                    iSeg.GetNMaxPads(),  iSeg.GetNRows(),
-                    0,                   0);
-      if(fSector->fRnrOut1)
-       DisplayQuads(o1Seg.GetPadWidth(), o1Seg.GetPadHeight(), o1Seg.GetRLow(),
-                    o1Seg.GetNMaxPads(), o1Seg.GetNRows(),
-                    iSeg.GetNMaxPads(),    0);
-      if(fSector->fRnrOut2)
-       DisplayQuads(o2Seg.GetPadWidth(), o2Seg.GetPadHeight(), o2Seg.GetRLow(),
-                    o2Seg.GetNMaxPads(), o2Seg.GetNRows(),
-                    0,                   o1Seg.GetNRows());
+
+      if(fSector->fUseTexture) {
+       //texture
+       glEnable(GL_BLEND);
+       glDepthMask(GL_FALSE);
+       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+       glPolygonOffset(2,2);
+       glEnable(GL_POLYGON_OFFSET_FILL);
+
+       glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+       glBindTexture(GL_TEXTURE_2D, fTexture);
+       glEnable(GL_TEXTURE_2D);
+
+       if(fSector->fRnrInn)  DisplayTexture(iSeg, 0, 0);
+       if(fSector->fRnrOut1) DisplayTexture(o1Seg, iSeg.GetNMaxPads(), 0);
+       if(fSector->fRnrOut2) DisplayTexture(o2Seg, 0, o1Seg.GetNRows());
+
+       glDisable(GL_TEXTURE_2D);
+      } else {
+       if(fSector->fRnrInn)  DisplayQuads(iSeg, 0, 0);
+       if(fSector->fRnrOut1) DisplayQuads(o1Seg, iSeg.GetNMaxPads(), 0);
+       if(fSector->fRnrOut2) DisplayQuads(o2Seg, 0, o1Seg.GetNRows());
+      }
+      glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+      DisplayFrame();
     }
-  }
 
-  // Display frame
-  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-  DisplayFrame();
+  }
 
   glPopAttrib();
 }
@@ -232,7 +225,7 @@ void TPCSector2DGL::CreateTexture() const
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_REPEAT);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-  // glTexEnvf      (GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,   GL_MODULATE); // Lightning is off anyway.
+  glTexEnvf      (GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,   GL_REPLACE);
   glTexImage2D   (GL_TEXTURE_2D, 0, GL_RGBA, fgkTextureWidth, fgkTextureHeight,
                   0, GL_RGBA, GL_UNSIGNED_BYTE, fImage);
 
@@ -242,41 +235,46 @@ void TPCSector2DGL::CreateTexture() const
 // Data display
 /**************************************************************************/
 
-void TPCSector2DGL::DisplayTexture(Float_t padW,     Float_t padH, Float_t startR,
-                                   Int_t numMaxPads, Int_t numRows, 
-                                   Int_t startCol,   Int_t startRow) const
+void TPCSector2DGL::DisplayTexture(const TPCSectorData::SegmentInfo& seg,
+                                   Int_t startCol, Int_t startRow) const
 {
-  Float_t w  = numMaxPads*padW/2;
+  Float_t w  = seg.GetNMaxPads()*seg.GetPadWidth()/2;
+  Float_t y1 = seg.GetRLow();
+  Float_t y2 = y1 + seg.GetNRows()*seg.GetPadHeight();
+
   Float_t u1 = (Float_t) startCol / fgkTextureWidth;
   Float_t v1 = (Float_t) startRow / fgkTextureHeight;
-  Float_t u2 = u1 + (Float_t) numMaxPads / fgkTextureWidth;
-  Float_t v2 = v1 + (Float_t) numRows    / fgkTextureHeight;
+  Float_t u2 = u1 + (Float_t) seg.GetNMaxPads() / fgkTextureWidth;
+  Float_t v2 = v1 + (Float_t) seg.GetNRows()    / fgkTextureHeight;
 
   glBegin(GL_QUADS);  
-  glTexCoord2f(u1, v1);  glVertex2f(-w, startR);
-  glTexCoord2f(u1, v2);  glVertex2f(-w, startR + numRows*padH);
-  glTexCoord2f(u2, v2);  glVertex2f( w, startR + numRows*padH);
-  glTexCoord2f(u2, v1);  glVertex2f( w, startR);
+  glTexCoord2f(u1, v1);  glVertex2f(-w, y1);
+  glTexCoord2f(u1, v2);  glVertex2f(-w, y2);
+  glTexCoord2f(u2, v2);  glVertex2f( w, y2);
+  glTexCoord2f(u2, v1);  glVertex2f( w, y1);
   glEnd();
 }
 
 /**************************************************************************/
 
-void TPCSector2DGL::DisplayQuads(Float_t padW,     Float_t padH, Float_t startR,
-                                 Int_t numMaxPads, Int_t numRows, 
-                                 Int_t startCol,   Int_t startRow) const
+void TPCSector2DGL::DisplayQuads(const TPCSectorData::SegmentInfo& seg,
+                                 Int_t startCol, Int_t startRow) const
 {
-  UChar_t *pix;
   Float_t y_d, y_u;
   Float_t x_off, x;
+  Float_t padW = seg.GetPadWidth();
+  Float_t padH = seg.GetPadHeight();
 
   glBegin(GL_QUADS);
-  for (Int_t row=0; row<numRows; row++) {
-    y_d = startR + row*padH;
+  for (Int_t row=0; row<seg.GetNRows(); row++) {
+    y_d = seg.GetRLow() + row*padH;
     y_u = y_d + padH;
-    x_off = -numMaxPads*padW/2;
-    pix = GetRowCol(row + startRow, startCol);
-    for (Int_t pad=0; pad<numMaxPads; pad++, pix+=4) {
+    x_off = -seg.GetNMaxPads()*padW/2;
+    Int_t tpcRow = row + seg.GetFirstRow();
+    Int_t deltaPad = (seg.GetNMaxPads() - TPCSectorData::GetNPadsInRow(tpcRow))/2;
+    Int_t   maxPad = seg.GetNMaxPads() - deltaPad;
+    UChar_t   *pix = GetRowCol(row + startRow, startCol + deltaPad);
+    for (Int_t pad=deltaPad; pad<maxPad; pad++, pix+=4) {
       x = x_off + pad*padW;
       if (pix[3] != 0) {
         glColor4ubv(pix);
@@ -290,6 +288,44 @@ void TPCSector2DGL::DisplayQuads(Float_t padW,     Float_t padH, Float_t startR,
   glEnd();
 }
 
+void TPCSector2DGL::DisplayNamedQuads(const TPCSectorData::SegmentInfo& seg,
+                                     Int_t startCol, Int_t startRow) const
+{
+  Float_t y_d, y_u;
+  Float_t x_off, x;
+  Float_t padW = seg.GetPadWidth();
+  Float_t padH = seg.GetPadHeight();
+
+  glPushName(0);
+  for (Int_t row=0; row<seg.GetNRows(); row++) {
+    y_d = seg.GetRLow() + row*padH;
+    y_u = y_d + padH;
+    x_off = -seg.GetNMaxPads()*padW/2;
+    Int_t tpcRow = row + seg.GetFirstRow();
+    glLoadName(tpcRow);
+    Int_t deltaPad = (seg.GetNMaxPads() - TPCSectorData::GetNPadsInRow(tpcRow))/2;
+    Int_t   maxPad = seg.GetNMaxPads() - deltaPad;
+    UChar_t   *pix = GetRowCol(row + startRow, startCol + deltaPad);
+    glPushName(0);
+    for (Int_t pad=deltaPad; pad<maxPad; pad++, pix+=4) {
+      x = x_off + pad*padW;
+      // !!! Potentially replace following 'if', add an option to TPCSector2D.
+      // !!! Details depend on how data is processed during extraction.
+      if (pix[3] != 0) {
+       glLoadName(pad - deltaPad);
+       glBegin(GL_QUADS);
+        glVertex2f(x+padW, y_d);
+        glVertex2f(x,      y_d);
+        glVertex2f(x,      y_u);
+        glVertex2f(x+padW, y_u);
+       glEnd();
+      }
+    }
+    glPopName();
+  }
+  glPopName();
+}
+
 /**************************************************************************/
 // Frame drawing
 /**************************************************************************/
index 14b0eea1c80f548b28caec9a2ff534617831f2b7..5bd5cc0079db42162908936fecb1f627b524f0e0 100644 (file)
@@ -19,13 +19,13 @@ protected:
   void LoadPadrow(TPCSectorData::RowIterator& iter, Int_t row, Int_t off) const;
   void CreateTexture() const;
 
-  void DisplayTexture(Float_t padW,     Float_t padH, Float_t startR,
-                      Int_t numMaxPads, Int_t numRows,
-                      Int_t startCol,   Int_t startRow) const;
-  void DisplayQuads  (Float_t padW,     Float_t padH, Float_t startR,
-                     Int_t numMaxPads, Int_t numRows,
-                     Int_t startCol,   Int_t startRow) const;
-  void DisplayFrame  () const;
+  void DisplayTexture(const TPCSectorData::SegmentInfo& seg,
+                      Int_t startCol, Int_t startRow) const;
+  void DisplayQuads(const TPCSectorData::SegmentInfo& seg,
+                   Int_t startCol, Int_t startRow) const;
+  void DisplayNamedQuads(const TPCSectorData::SegmentInfo& seg,
+                        Int_t startCol, Int_t startRow) const;
+  void DisplayFrame() const;
 
   UChar_t* GetRowCol(Int_t row, Int_t col) const;
 
@@ -42,6 +42,7 @@ public:
 
   virtual Bool_t SetModel(TObject* obj); 
   virtual void   SetBBox();
+  virtual Bool_t SupportsSecondarySelect() const { return kTRUE; }
 
   static void TraceStepsUp  (const TPCSectorData::SegmentInfo& s);
   static void TraceStepsDown(const TPCSectorData::SegmentInfo& s);
index a8c082579c3ff8f9fd530e05b5e41d24306489cd..89a34a52ffcfc096123670633c039a5c7be40cc7 100644 (file)
@@ -39,8 +39,10 @@ Bool_t TPCSector3DGL::SetModel(TObject* obj)
 {
 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
   if(set_model(obj, "Alieve::TPCSector3D")) {
-#else
+#elif ROOT_VERSION_CODE <= ROOT_VERSION(5,13,0)
   if(SetModelCheckClass(obj, "Alieve::TPCSector3D")) {
+#else
+  if(SetModelCheckClass(obj, Alieve::TPCSector3D::Class())) {
 #endif
     fSector = (TPCSector3D*) fExternalObj;
     if(fBoxRnr == 0) {
index 9315eb9776f4d5e870850366ca3f5ef9724b39f7..92d4cb742550c75341e85fdff717f259d1ef92f3 100644 (file)
@@ -1,3 +1,14 @@
+2006-08-29  Matevz TADEL  <matevz.tadel@ijs.si>
+
+       Merged EVE-dev to HEAD. Re-tagged EVE-dev (EVE-dev-after-merge) and
+       EVE's HEAD (EVE-head-after-merge).
+
+2006-08-29  Matevz Tadel  <matevz.tadel@cern.ch>
+
+       * alice-macros/clusters_from_label.C:
+       Use Reve::PointSet for cluster representation; attach to each
+       cluster a copy of AliTrackPoint it represents.
+
 2006-08-04  Matevz TADEL  <matevz.tadel@cern.ch>
 
        Merged HEAD to EVE-dev. Re-tagged EVE-dev (EVE-dev-after-merge) and
index 881242a46887383dc4666374d55f1a0098ff6190..cabe04dd84c11b0e1bdd7048ed08c636de7e55e5 100644 (file)
@@ -32,8 +32,10 @@ Bool_t BoxSetGL::SetModel(TObject* obj)
 {
 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
   return set_model(obj, "Reve::BoxSet");
-#else
+#elif ROOT_VERSION_CODE <= ROOT_VERSION(5,13,0)
   return SetModelCheckClass(obj, "Reve::BoxSet");
+#else
+  return SetModelCheckClass(obj, Reve::BoxSet::Class());
 #endif
 }
 
index 7cd616277323e4addcbe253da4d18d070c473875..01f86df2f69ea96b61456e639828eaa6a0cfc4d4 100644 (file)
@@ -1,3 +1,20 @@
+2006-08-29  Matevz Tadel  <matevz.tadel@cern.ch>
+
+       EVE-dev
+       
+       * BoxSetGL.cxx:
+       * QuadSetGL.cxx:
+       Added ifdefs for post root-5.11.0 prototype of SetModelCheckClass().
+
+       * PointSet.cxx:
+       In Reset: added call to PointSet3D::ClearIds().
+
+       * RGTopFrame.cxx:
+       * RGTopFrame.h:
+       Added support for control of camera-reset to Redraw3D(); when
+       opening GL window disable automatic camera reset on update and on
+       double-click.
+
 2006-08-04  Matevz Tadel  <matevz.tadel@cern.ch>
 
        * PointSet.cxx:
index 9ac3f7de3f615acc51f83df3454163d2f1ca0e99..67a7654fc01bf188e39ecfe4e957fb8f931e2084 100644 (file)
@@ -59,6 +59,7 @@ void PointSet::Reset(Int_t n_points)
   if(fN) fP = new Float_t [3*fN];
   memset(fP, 0, 3*fN*sizeof(Float_t));
   fLastPoint = -1;
+  ClearIds();
   ResetBBox();
 }
 
index c24e3c275971e0d021ffeacc599e9cb7202f9e69..cab1d5c4549736814c885dd5f49aebce3cdef6d7 100644 (file)
@@ -32,8 +32,10 @@ Bool_t QuadSetGL::SetModel(TObject* obj)
 {
 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
   return set_model(obj, "Reve::QuadSet");
-#else
+#elif ROOT_VERSION_CODE <= ROOT_VERSION(5,13,0)
   return SetModelCheckClass(obj, "Reve::QuadSet");
+#else
+  return SetModelCheckClass(obj, Reve::QuadSet::Class());
 #endif
 }
 
index c52ba89a79dbf0edece2f27b8433f9d84baef170..f8e57c88e06db6e5746e25f89da3fa71f09047bc 100644 (file)
@@ -94,7 +94,8 @@ void RGTopFrame::Init()
   fGlobalStore    = 0;
 
   fRedrawDisabled = 0;
-  fTimerActive    = false;
+  fResetCameras   = kFALSE;
+  fTimerActive    = kFALSE;
   fRedrawTimer.Connect("Timeout()", "Reve::RGTopFrame", this, "DoRedraw3D()");
 }
 
@@ -185,7 +186,9 @@ RGTopFrame::RGTopFrame(const TGWindow *p, UInt_t w, UInt_t h, LookType_e look)
 
   TGLViewer* glv = dynamic_cast<TGLViewer*>(fCC->GetViewer3D());
   if(glv) {
-    glv->SetSmartRefresh(true);
+    glv->SetSmartRefresh(kTRUE);
+    glv->SetResetCamerasOnUpdate(kFALSE);
+    glv->SetResetCameraOnDoubleClick(kFALSE);
   }
 
   /**************************************************************************/
@@ -248,9 +251,13 @@ void RGTopFrame::RegisterRedraw3D()
 void RGTopFrame::DoRedraw3D()
 {
   // printf("RGTopFrame::DoRedraw3D redraw triggered\n");
+  if (fResetCameras) {
+    fCC->GetViewer3D()->ResetCamerasAfterNextUpdate();
+    fResetCameras = kFALSE;
+  }
   fCC->Modified();
   fCC->Update();
-  fTimerActive = false;
+  fTimerActive = kFALSE;
 }
 
 /**************************************************************************/
index 218ead2f7ab43a63b7ca6a265fe2811a4cd6820b..3ad9d2dd371c8c1e0309ea5d29409b291d5196fc 100644 (file)
@@ -50,6 +50,7 @@ private:
   RenderElementList   *fGlobalStore;
 
   Int_t                fRedrawDisabled;
+  Bool_t               fResetCameras;
   Bool_t               fTimerActive;
   TTimer               fRedrawTimer;
 
@@ -79,7 +80,10 @@ public:
   void DisableRedraw() { ++fRedrawDisabled; }
   void EnableRedraw()  { --fRedrawDisabled; if(fRedrawDisabled <= 0) Redraw3D(); }
 
-  void Redraw3D() { if(fRedrawDisabled <= 0 && !fTimerActive) RegisterRedraw3D(); }
+  void Redraw3D(Bool_t resetCameras=kFALSE) {
+    if(fRedrawDisabled <= 0 && !fTimerActive) RegisterRedraw3D();
+    if(resetCameras) fResetCameras = kTRUE;
+  }
   void RegisterRedraw3D();
   void DoRedraw3D();
 
index 888e2c128e5e6681f8251207f007046d00d51b4b..2bb2a6434ecbc0ef727fc66414ad5c2cbd092494 100644 (file)
@@ -3,7 +3,8 @@
 void clusters_from_label(Int_t label=0)
 {
   AliESD* esd = Alieve::Event::AssertESD();
-  TPolyMarker3D* clusters = new TPolyMarker3D(64);
+  Reve::PointSet* clusters = new Reve::PointSet(64);
+  clusters->SetOwnIds(kTRUE);
 
   for (Int_t n=0; n<esd->GetNumberOfTracks(); n++) {
     AliESDtrack* at = esd->GetTrack(n);
@@ -19,6 +20,9 @@ void clusters_from_label(Int_t label=0)
       const Float_t* z = pArr->GetZ();
       for (Int_t i=0; i<np; ++i) {
        clusters->SetNextPoint(x[i], y[i], z[i]);
+       AliTrackPoint *atp = new AliTrackPoint;
+       pArr->GetPoint(*atp, i);
+       clusters->SetPointId(atp);
       }
     }
   }