]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added eta cut for raw TPC data visualisation
authorpdebski <pdebski@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 20 Sep 2010 18:18:10 +0000 (18:18 +0000)
committerpdebski <pdebski@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 20 Sep 2010 18:18:10 +0000 (18:18 +0000)
EVE/EveDet/AliEveTPCLoader.cxx
EVE/EveDet/AliEveTPCLoader.h
EVE/EveDet/AliEveTPCLoaderEditor.cxx
EVE/EveDet/AliEveTPCLoaderEditor.h
EVE/EveDet/AliEveTPCSector3D.cxx
EVE/EveDet/AliEveTPCSector3D.h

index 561446cad681897b8d1b306aeac20734078177ec..a144d3e2b6e4beec8b795be9237045fe24b92816 100644 (file)
@@ -46,7 +46,8 @@ AliEveTPCLoader::AliEveTPCLoader(const Text_t* n, const Text_t* t) :
   fSec3Ds(36),
 
   fSetInitSectorParams(kFALSE),
-  fInitMinTime(0), fInitMaxTime(460), fInitThreshold(5), fInitMaxVal(128)
+  fInitMinTime(0), fInitMaxTime(460), fInitThreshold(5), fInitMaxVal(128),
+  fCutOnEta(kFALSE), fEtaMax(1.5), fEtaMin(-1.5)
 {
   // Constructor.
 
@@ -267,6 +268,9 @@ void AliEveTPCLoader::UpdateSectors(Bool_t dropNonPresent)
        gEve->RemoveElement(fSec3Ds[i], this);
        fSec3Ds[i] = 0;
       } else {
+        fSec3Ds[i]->SetCutOnEta(fCutOnEta);
+        fSec3Ds[i]->SetEtaMax(fEtaMax);
+        fSec3Ds[i]->SetEtaMin(fEtaMin);
        fSec3Ds[i]->IncRTS();
         fSec3Ds[i]->ElementChanged();
       }
@@ -296,6 +300,9 @@ void AliEveTPCLoader::CreateSectors3D()
       fSec3Ds[i] = s;
       s->SetSectorID(i);
       s->SetDataSource(fData);
+      s->SetCutOnEta(fCutOnEta);
+      s->SetEtaMax(fEtaMax);
+      s->SetEtaMin(fEtaMin);
 
       if (fDoubleSR)
        s->SetDriftVel(2.273);
index 9e1b696385e5eb8b3084e738ff35e17c0329e999..d735d268a60c9c951e6ee89604cedff6f73a14a2 100644 (file)
@@ -59,6 +59,14 @@ public:
 
   void SetInitParams(Int_t mint, Int_t maxt, Int_t thr, Int_t maxval=128);
 
+  void SetCutOnEta(Bool_t cut) { fCutOnEta = cut; }
+  void SetEtaMax(Float_t max) { fEtaMax = max; }
+  void SetEtaMin(Float_t min) { fEtaMin = min; }
+
+  Float_t GetCutOnEta() { return fCutOnEta; }
+  Float_t GetEtaMax() { return fEtaMax; }
+  Float_t GetEtaMin() { return fEtaMin; }
+
 protected:
   TString           fFile;      // File holding raw-data.
   Int_t             fEvent;     // Current event.
@@ -77,6 +85,10 @@ protected:
   Int_t    fInitThreshold;       // Threshold.
   Int_t    fInitMaxVal;          // Maximum-signal value (all signals above mapped to saturation color).
 
+  Bool_t fCutOnEta;              // Bool for apply eta cut
+  Float_t fEtaMax;               // Maximum eta value for cut
+  Float_t fEtaMin;               // Minimum eta value for cut
+
 private:
   AliEveTPCLoader(const AliEveTPCLoader&);            // Not implemented
   AliEveTPCLoader& operator=(const AliEveTPCLoader&); // Not implemented
index 740ba2d4e4a36a0d68af86ea0311d2b2aaa7cfaf..e00bee1a93b87a9f2b37cd56891baba509fd26ab 100644 (file)
 #include <EveDet/AliEveTPCLoader.h>
 #include <EveDet/AliEveTPCData.h>
 
+#include <TEveScene.h>
 #include <TEveManager.h>
 #include <TEveGValuators.h>
+#include <TGDoubleSlider.h>
 
 #include <TSystem.h>
 #include <TVirtualPad.h>
@@ -53,7 +55,11 @@ AliEveTPCLoaderEditor::AliEveTPCLoaderEditor(const TGWindow *p,
   fUpdateSectors   (0),
   fReloadSectors   (0),
   fCreateSectors3D (0),
-  fDeleteSectors3D (0)
+  fDeleteSectors3D (0),
+
+  gEtaRange(0),
+  gCutOnEta(0)
+  
 {
   // Constructor.
 
@@ -163,6 +169,41 @@ AliEveTPCLoaderEditor::AliEveTPCLoaderEditor(const TGWindow *p,
                              "AliEveTPCLoaderEditor", this, "DoDeleteSectors3D()");
     AddFrame(f, new TGLayoutHints(kLHintsExpandX, 8,8,8,0));
   }
+  {
+    TGHorizontalFrame* f = new TGHorizontalFrame(this);
+    fCreateSectors3D = new TGTextButton(f, "Show 2D");
+    f->AddFrame(fCreateSectors3D, new TGLayoutHints(kLHintsExpandX, 0,4,0,0));
+    fCreateSectors3D->Connect("Clicked()",
+                             "AliEveTPCLoaderEditor", this, "DoShowSectors2D()");
+    fDeleteSectors3D = new TGTextButton(f, "Hide 2D");
+    f->AddFrame(fDeleteSectors3D, new TGLayoutHints(kLHintsExpandX, 4,0,0,0));
+    fDeleteSectors3D->Connect("Clicked()",
+                             "AliEveTPCLoaderEditor", this, "DoHideSectors2D()");
+    AddFrame(f, new TGLayoutHints(kLHintsExpandX, 8,8,8,0));
+  }
+
+   // Eta cuts slider
+
+  {
+   TGHorizontalFrame* f = new TGHorizontalFrame(this);
+
+   gEtaRange = new TEveGDoubleValuator(f,"Eta range:", 40, 0);
+   gEtaRange->SetNELength(6);
+   gEtaRange->SetLabelWidth(50);
+   gEtaRange->Build();
+   gEtaRange->GetSlider()->SetWidth(180);
+   gEtaRange->SetLimits(-1.5, 1.5, TGNumberFormat::kNESRealTwo);
+   gEtaRange->SetValues(-1.5, 1.5, TGNumberFormat::kNESRealTwo);
+
+   gCutOnEta = new TGCheckButton(f, "Set", 10);
+   gCutOnEta->SetEnabled(kTRUE);
+
+   f->AddFrame(gEtaRange, new TGLayoutHints(kLHintsExpandX, 10, 10, 10, 10));
+   f->AddFrame(gCutOnEta, new TGLayoutHints(kLHintsNormal, 10, 10, 10, 10));
+
+   AddFrame(f, new TGLayoutHints(kLHintsExpandX, 8,8,8,0));
+  }
+
 }
 
 /******************************************************************************/
@@ -282,6 +323,15 @@ void AliEveTPCLoaderEditor::DoUpdateSectors()
 {
   // Slot for UpdateSectors.
 
+  if(gCutOnEta)
+    fM->SetCutOnEta(gCutOnEta->IsOn());
+
+  if(gEtaRange)
+  {
+    fM->SetEtaMin(gEtaRange->GetMin());
+    fM->SetEtaMax(gEtaRange->GetMax());
+  }
+
   fM->UpdateSectors();
 }
 
@@ -289,6 +339,16 @@ void AliEveTPCLoaderEditor::DoReloadSectors()
 {
   // Slot for ReloadSectors.
 
+  if(gCutOnEta)
+    fM->SetCutOnEta(gCutOnEta->IsOn());
+
+  if(gEtaRange)
+  {
+    fM->SetEtaMin(gEtaRange->GetMin());
+    fM->SetEtaMax(gEtaRange->GetMax());
+  }
+
+
   fM->ReloadSectors();
 }
 
@@ -296,6 +356,15 @@ void AliEveTPCLoaderEditor::DoCreateSectors3D()
 {
   // Slot for CreateSectors3D.
 
+  if(gCutOnEta)
+    fM->SetCutOnEta(gCutOnEta->IsOn());
+
+  if(gEtaRange)
+  {
+    fM->SetEtaMin(gEtaRange->GetMin());
+    fM->SetEtaMax(gEtaRange->GetMax());
+  }
+
   fM->CreateSectors3D();
 }
 
@@ -306,3 +375,32 @@ void AliEveTPCLoaderEditor::DoDeleteSectors3D()
 
   fM->DeleteSectors3D();
 }
+
+void AliEveTPCLoaderEditor::DoShowSectors2D()
+{
+
+   for(Int_t i = 0; i< 36; i++)
+   {
+      if(gEve->GetEventScene()->FirstChild()->FindChild("AliEveTPCLoader")->FindChild(Form("Sector2D %d",i)))
+      {
+         gEve->GetEventScene()->FirstChild()->FindChild("AliEveTPCLoader")->FindChild(Form("Sector2D %d",i))->SetRnrSelf(kTRUE);
+         gEve->GetEventScene()->FirstChild()->FindChild("AliEveTPCLoader")->FindChild(Form("Sector2D %d",i))->SetRnrChildren(kTRUE);
+      }
+   }
+
+}
+
+void AliEveTPCLoaderEditor::DoHideSectors2D()
+{
+
+   for(Int_t i = 0; i< 36; i++)
+   {
+      if(gEve->GetEventScene()->FirstChild()->FindChild("AliEveTPCLoader")->FindChild(Form("Sector2D %d",i)))
+      {
+         gEve->GetEventScene()->FirstChild()->FindChild("AliEveTPCLoader")->FindChild(Form("Sector2D %d",i))->SetRnrSelf(kFALSE);
+         gEve->GetEventScene()->FirstChild()->FindChild("AliEveTPCLoader")->FindChild(Form("Sector2D %d",i))->SetRnrChildren(kFALSE);
+      }
+   }
+
+}
+
index 34de82794fa3bcaa93f2c3305793d358ede52c65..34c472498ea3fff07d88c315115e49317cc9bc30 100644 (file)
@@ -19,6 +19,7 @@ class TGColorSelect;
 class TGTextEntry;
 
 class TEveGValuator;
+class TEveGDoubleValuator;
 
 class AliEveTPCLoader;
 
@@ -55,6 +56,8 @@ public:
   void DoReloadSectors();
   void DoCreateSectors3D();
   void DoDeleteSectors3D();
+  void DoShowSectors2D();
+  void DoHideSectors2D();
 
 protected:
   AliEveTPCLoader *fM;                  // Model object.
@@ -75,6 +78,9 @@ protected:
   TGTextButton    *fCreateSectors3D;    // Button to create 3D sectors.
   TGTextButton    *fDeleteSectors3D;    // Button to delete 3D sectors.
 
+  TEveGDoubleValuator *gEtaRange;       // Slider to set eta cuts
+  TGCheckButton *gCutOnEta;             // Checkbutton to apply eta cuts
+
   ClassDef(AliEveTPCLoaderEditor, 0); // Editor for AliEveTPCLoader.
 };
 
index 922743b27b95450671152ba87af16a989d0ae0ec..4932279fdd746d734fd1b5b6f92c9620cb33e5f1 100644 (file)
@@ -42,11 +42,15 @@ AliEveTPCSector3D::AliEveTPCSector3D(const Text_t* n, const Text_t* t) :
   fPointSetMaxVal (0),
 
   fDriftVel  (1.07),
-  fZStep     (250.0/900)
+  fZStep     (250.0/900),
+  fCutOnEta  (kFALSE),
+  fEtaMin    (-1.5),
+  fEtaMax    (1.5)
+
 {
   // Constructor.
 
-  fRnrFrame = kFALSE;
+  fRnrFrame = kTRUE;
   ComputeBBox();
 }
 
@@ -93,6 +97,9 @@ void AliEveTPCSector3D::Paint(Option_t* /*option*/)
 
   TBuffer3D buffer(TBuffer3DTypes::kGeneric);
 
+  SetMainColor(36);
+  SetMainTransparency(100);
+
   // Section kCore
   buffer.fID           = this;
   buffer.fColor        = GetMainColor();
@@ -121,6 +128,7 @@ void AliEveTPCSector3D::LoadPadrow(AliEveTPCSectorData::RowIterator& iter,
   Float_t x0, z0;
   Float_t ym = ys + 0.5*ph;
   Float_t zs = fZStep/fDriftVel;
+  Float_t eta, x1, y1, z1, x, y, z, c, s, zL;
 
   while (iter.NextPad())
   {
@@ -133,6 +141,37 @@ void AliEveTPCSector3D::LoadPadrow(AliEveTPCSectorData::RowIterator& iter,
       if (val <= fThreshold || time < fMinTime || time > fMaxTime)
        continue;
 
+      if (fCutOnEta)
+      {
+
+        x1 = xs + (pad+0.5)*pw;
+        y1 = ym;
+        z1 = (time+0.5)*zs;
+
+        c = TMath::Cos((fSectorID + 0.5)*20*TMath::Pi()/180 - TMath::PiOver2());
+        s = TMath::Sin((fSectorID + 0.5)*20*TMath::Pi()/180 - TMath::PiOver2());
+        zL = AliEveTPCSectorData::GetZLength();
+
+        if (fSectorID < 18)
+        {
+          x = -c*x1-s*y1;
+          y = -s*x1+c*y1;
+          z = -z1+zL;
+        } 
+        else
+        {
+          x = c*x1+s*y1;
+          y = -s*x1+c*y1;
+          z = z1-zL;
+        }
+
+        eta = -TMath::Log(TMath::Tan(0.5*TMath::ACos(z/TMath::Sqrt(x*x + y*y + z*z))));
+
+        if(!(eta < fEtaMax && eta > fEtaMin) && !(-eta < fEtaMax && -eta > fEtaMin))
+         continue;
+
+      }
+
       if (fPointSetOn && val <= fPointSetMaxVal)
       {
        fPointSetArray.Fill(xs + (pad+0.5)*pw, ym, (time+0.5)*zs, val);
index 2389f2306ffb42b5785d8a34d6e5c961d9140ef4..515794a7b2cc1a71283ec80ba2f8fca61fc06fa0 100644 (file)
@@ -36,6 +36,14 @@ public:
   void SetDriftVel(Float_t v) { fDriftVel = v; IncRTS(); }
   void SetZStep(Float_t step) { fZStep = step; IncRTS(); }
 
+  void SetCutOnEta(Bool_t cut) { fCutOnEta = cut; IncRTS(); }
+  void SetEtaMax(Float_t max) { fEtaMax = max; IncRTS(); }
+  void SetEtaMin(Float_t min) { fEtaMin = min; IncRTS(); }
+
+  Float_t GetCutOnEta() { return fCutOnEta; }
+  Float_t GetEtaMax() { return fEtaMax; }
+  Float_t GetEtaMin() { return fEtaMin; }
+
   virtual void SetRnrFrame(Bool_t rf);
 
   virtual void ComputeBBox();
@@ -57,6 +65,10 @@ protected:
   Float_t             fDriftVel;        // Drift velocity for 'z' coordinate.
   Float_t             fZStep;           // Z width of a time-bin.
 
+  Bool_t              fCutOnEta;        // Bool used to apply eta cut
+  Float_t             fEtaMin;          // Minimum eta value for eta cut
+  Float_t             fEtaMax;          // Maximum eta value for eta cut
+
   ClassDef(AliEveTPCSector3D, 0); // Visualization of TPC raw-data in 3D.
 };