]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Moved code responding to secondary selection from TPCSector2DGL::ProcessSelection...
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Dec 2006 14:13:30 +0000 (14:13 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Dec 2006 14:13:30 +0000 (14:13 +0000)
EVE/Alieve/TPCSector2D.cxx
EVE/Alieve/TPCSector2D.h
EVE/Alieve/TPCSector2DGL.cxx

index 9344d23d2cc16f5b5d463b10087b0d7392211967..67c352ba3fb5963aa54c6c6acf23e79296928baa 100644 (file)
 #include <TVirtualPad.h>
 #include <TVirtualViewer3D.h>
 
+#include <TH1S.h>
+#include <TH2S.h>
+#include <TVirtualPad.h>
+
 using namespace Reve;
 using namespace Alieve;
 using namespace std;
@@ -70,6 +74,68 @@ void TPCSector2D::ComputeBBox()
 
 /**************************************************************************/
 
+void TPCSector2D::PadSelected(Int_t row, Int_t pad)
+{
+  // Called when ctrl-mouse-left-click registered over a pad.
+
+  // EVE -> Std convention
+  Int_t sseg = fSectorID, srow = row;
+  if (row >= TPCSectorData::GetInnSeg().GetNRows()) {
+    sseg += 18;
+    srow -= TPCSectorData::GetInnSeg().GetNRows();
+  }
+  switch (fPickMode)
+    {
+    case 0: {
+      printf("TPCSector2DGL::ProcessSelection segment=%d, row=%d, pad=%d\n",
+            sseg, srow, pad);
+      break;
+    }
+    case 1: {
+      TPCSectorData* sectorData = GetSectorData();
+      if (sectorData == 0) return;
+      Int_t mint = fMinTime;
+      Int_t maxt = fMaxTime;
+      TH1S* h = new TH1S(Form("Seg%d_Row%d_Pad%d", sseg, srow, pad),
+                        Form("Segment %d, Row %d, Pad %d", sseg, srow, pad),
+                        maxt - mint +1 , mint, maxt);
+      h->SetXTitle("Time");
+      h->SetYTitle("ADC");
+      TPCSectorData::PadIterator i = sectorData->MakePadIterator(row, pad);
+      while (i.Next())
+       h->Fill(i.Time(), i.Signal());
+      h->Draw();
+      gPad->Modified();
+      gPad->Update();
+      break;
+    }
+    case 2: {
+      TPCSectorData* sectorData = GetSectorData();
+      if (sectorData == 0) return;
+      Int_t mint = fMinTime;
+      Int_t maxt = fMaxTime;
+      Int_t npad = TPCSectorData::GetNPadsInRow(row);
+      TH2S* h = new TH2S(Form("Seg%d_Row%d", sseg, srow),
+                        Form("Segment %d, Row %d", sseg, srow),
+                        maxt - mint +1 , mint, maxt,
+                        npad, 0, npad - 1);
+      h->SetXTitle("Time");
+      h->SetYTitle("Pad");
+      h->SetZTitle("ADC");
+      TPCSectorData::RowIterator i = sectorData->MakeRowIterator(row);
+      while (i.NextPad())
+       while (i.Next())
+         h->Fill(i.Time(), i.Pad(), i.Signal());
+      h->Draw();
+      gPad->Modified();
+      gPad->Update();
+      break;
+    }
+    } // switch
+}
+
+/**************************************************************************/
+
 void TPCSector2D::Paint(Option_t* )
 {
   if(fRnrElement == kFALSE)
index 3679a50bb2b7b30027a4dc4a0452d582e20328d1..2e7f18b7c707427cdfb1d92b72c3041273db42d8 100644 (file)
@@ -36,6 +36,8 @@ public:
 
   virtual void ComputeBBox();
 
+  virtual void PadSelected(Int_t row, Int_t pad);
+
   virtual void Paint(Option_t* option="");
 
   ClassDef(TPCSector2D, 1); // Visualization of TPC raw-data in 2D
index c49e0e63b35012c390639f8b3424ce8c57de33b1..3ed226ad6a51f51b7d170d2a81c306d72c90ddd4 100644 (file)
@@ -4,11 +4,6 @@
 
 #include <Alieve/TPCData.h>
 
-#include <TH1S.h>
-#include <TH2S.h>
-#include <TVirtualPad.h>
-#include <TStopwatch.h>
-
 #include <TGLDrawFlags.h>
 #include <GL/gl.h>
 
@@ -81,61 +76,9 @@ void TPCSector2DGL::ProcessSelection(UInt_t* ptr, TGLViewer*, TGLScene*)
   ptr += 3; // skip n, zmin, zmax
   Int_t row = ptr[1];
   Int_t pad = ptr[2];
-  Int_t seg = fSector->fSectorID;
-  if (row < 0 || row >= TPCSectorData::GetNAllRows()) return;
+  if (row < 0 || row >= TPCSectorData::GetNAllRows())      return;
   if (pad < 0 || pad >= TPCSectorData::GetNPadsInRow(row)) return;
-  // EVE -> Std convention
-  Int_t sseg = seg, srow = row;
-  if (row >= TPCSectorData::GetInnSeg().GetNRows()) {
-    sseg += 18;
-    srow -= TPCSectorData::GetInnSeg().GetNRows();
-  }
-  switch (fSector->fPickMode)
-    {
-    case 0: {
-      printf("TPCSector2DGL::ProcessSelection segment=%d, row=%d, pad=%d\n",
-            sseg, srow, pad);
-      break;
-    }
-    case 1: {
-      if (fSectorData == 0) return;
-      Int_t mint = fSector->GetMinTime();
-      Int_t maxt = fSector->GetMaxTime();
-      TH1S* h = new TH1S(Form("Seg%d_Row%d_Pad%d", sseg, srow, pad),
-                        Form("Segment %d, Row %d, Pad %d", sseg, srow, pad),
-                        maxt - mint +1 , mint, maxt);
-      h->SetXTitle("Time");
-      h->SetYTitle("ADC");
-      TPCSectorData::PadIterator i = fSectorData->MakePadIterator(row, pad);
-      while (i.Next())
-       h->Fill(i.Time(), i.Signal());
-      h->Draw();
-      gPad->Modified();
-      gPad->Update();
-      break;
-    }
-    case 2: {
-      if (fSectorData == 0) return;
-      Int_t mint = fSector->GetMinTime();
-      Int_t maxt = fSector->GetMaxTime();
-      Int_t npad = TPCSectorData::GetNPadsInRow(row);
-      TH2S* h = new TH2S(Form("Seg%d_Row%d", sseg, srow),
-                        Form("Segment %d, Row %d", sseg, srow),
-                        maxt - mint +1 , mint, maxt,
-                        npad, 0, npad - 1);
-      h->SetXTitle("Time");
-      h->SetYTitle("Pad");
-      h->SetZTitle("ADC");
-      TPCSectorData::RowIterator i = fSectorData->MakeRowIterator(row);
-      while (i.NextPad())
-       while (i.Next())
-         h->Fill(i.Time(), i.Pad(), i.Signal());
-      h->Draw();
-      gPad->Modified();
-      gPad->Update();
-      break;
-    }
-    } // switch
+  fSector->PadSelected(row, pad);
 }
 
 /**************************************************************************/