]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/Alieve/TPCSector2D.cxx
Moved code responding to secondary selection from TPCSector2DGL::ProcessSelection...
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSector2D.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)