]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
AliEveMacro
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Feb 2009 20:39:57 +0000 (20:39 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Feb 2009 20:39:57 +0000 (20:39 +0000)
-----------
Add data-source flag AOD.

AliEveMacroExecutor
-------------------
Use AOD data-source flag.

AliEveEventManager
------------------
Add container for transient objects, register them via:
  static void RegisterTransient(TEveElement* element);
These is for elements that need to be deleted when going to a new
event but do not belong to the Event folder (the objects there are
displayed in main views).

jetplane.C
----------
Register jet-plane object to the list of transients.

vplot_tpc.C
-----------
With Adam J. - new macro for display of V-plot from TPC clusters.

visscan_init.C
--------------
Add jetplane.C and vplot_tpc.C to data selector (disbaled by default).

EVE/EveBase/AliEveEventManager.cxx
EVE/EveBase/AliEveEventManager.h
EVE/EveBase/AliEveMacro.h
EVE/EveBase/AliEveMacroExecutor.cxx
EVE/alice-macros/jetplane.C
EVE/alice-macros/vplot_tpc.C [new file with mode: 0644]
EVE/macros/visscan_init.C

index 8e7ae71c72e8957e5a0c8b113c8e69076b6618a1..18414909b70dbd85a1b2f34747fc920a2d6ea8a2 100644 (file)
@@ -104,6 +104,10 @@ void AliEveEventManager::InitInternals()
   fAutoLoadTimer->Connect("Timeout()", "AliEveEventManager", this, "AutoLoadNextEvent()");
 
   fExecutor = new AliEveMacroExecutor;
+
+  fTransients = new TEveElementList("Transients", "Transient per-event elements.");
+  fTransients->IncDenyDestroy();
+  gEve->AddToListTree(fTransients, kTRUE);
 }
 
 AliEveEventManager::AliEveEventManager(const TString& name) :
@@ -118,7 +122,7 @@ AliEveEventManager::AliEveEventManager(const TString& name) :
   fAutoLoad  (kFALSE), fAutoLoadTime (5.),     fAutoLoadTimer(0),
   fIsOpen    (kFALSE), fHasEvent     (kFALSE), fExternalCtrl (kFALSE),
   fSelectOnTriggerType(kFALSE), fTriggerType(""),
-  fExecutor    (0),
+  fExecutor    (0), fTransients(0),
   fSubManagers (0),
   fAutoLoadTimerRunning(kFALSE)
 {
@@ -139,7 +143,7 @@ AliEveEventManager::AliEveEventManager(const TString& name, const TString& path,
   fAutoLoad  (kFALSE), fAutoLoadTime (5),      fAutoLoadTimer(0),
   fIsOpen    (kFALSE), fHasEvent     (kFALSE), fExternalCtrl (kFALSE),
   fSelectOnTriggerType(kFALSE), fTriggerType(""),
-  fExecutor    (0),
+  fExecutor    (0), fTransients(0),
   fSubManagers (0),
   fAutoLoadTimerRunning(kFALSE)
 {
@@ -164,6 +168,9 @@ AliEveEventManager::~AliEveEventManager()
   {
     Close();
   }
+
+  fTransients->DecDenyDestroy();
+  fTransients->Destroy();
 }
 
 /******************************************************************************/
@@ -667,6 +674,7 @@ void AliEveEventManager::GotoEvent(Int_t event)
   // !!! MT this is somewhat brutal; at least optionally, one could be
   // a bit gentler, checking for objs owning their external refs and having
   // additinal parents.
+  fTransients->DestroyElements();
   DestroyElements();
 
   if (fESDTree) {
@@ -1042,6 +1050,11 @@ AliEveEventManager* AliEveEventManager::GetCurrent()
   return fgCurrent;
 }
 
+void AliEveEventManager::RegisterTransient(TEveElement* element)
+{
+  GetCurrent()->fTransients->AddElement(element);
+}
+
 //------------------------------------------------------------------------------
 // Autoloading of events
 //------------------------------------------------------------------------------
index 9a5a47a34a54c0ba35d0b8daee37fc1338bbdeb5..092a220b3f5533be3c74aaea436922e84de7ea7b 100644 (file)
@@ -49,6 +49,7 @@ public:
   static void SetAssertElements(Bool_t assertRunloader, Bool_t assertEsd,
                                Bool_t assertAod, Bool_t assertRaw);
 
+
   AliEveEventManager(const TString& name="Event");
   AliEveEventManager(const TString& name, const TString& path, Int_t ev=0);
   virtual ~AliEveEventManager();
@@ -98,6 +99,9 @@ public:
   static AliEveEventManager* GetMaster();
   static AliEveEventManager* GetCurrent();
 
+  static void                RegisterTransient(TEveElement* element);
+
+
   Double_t      GetAutoLoadTime()        const { return fAutoLoadTime; }
   Bool_t        GetAutoLoad()            const { return fAutoLoad;     }
   void          SetAutoLoadTime(Float_t time);
@@ -148,6 +152,8 @@ protected:
 
   AliEveMacroExecutor *fExecutor;       // Executor for std macros
 
+  TEveElementList     *fTransients;     // Container for additional transient (per event) elements.
+
   TList        *fSubManagers;           // Dependent event-managers, used for event embedding.
 
   static TString  fgESDFileName;        // Name by which to open ESD.
index ee6113b4fe841b88d11bf46cb571e5aaa9d6070c..d4464b051a6dedc2f2bd2c105f3a12ad120a705a 100644 (file)
@@ -28,7 +28,8 @@ public:
                       kRunLoader = 1,
                       kESD       = 2,
                       kESDfriend = 4,
-                      kRawReader = 8 };
+                      kRawReader = 8,
+                      kAOD       = 16 };
 
   enum ExecStatus_e { kNotRun    = -2,
                       kNoData    = -1,
@@ -57,6 +58,7 @@ public:
   Bool_t         RequiresESD()       const { return fSources & kESD;       }
   Bool_t         RequiresESDfriend() const { return fSources & kESDfriend; }
   Bool_t         RequiresRawReader() const { return fSources & kRawReader; }
+  Bool_t         RequiresAOD()       const { return fSources & kAOD;       }
 
   void           ResetExecState();
 
index 63642ea9d0bb8fa96fe818788b0612bbbef2b9bb..1443e96cda7b7d5331cec3a4402f50aaf3f01fbe 100644 (file)
@@ -98,7 +98,8 @@ void AliEveMacroExecutor::ExecMacros()
     if ((mac->RequiresRunLoader() && ! AliEveEventManager::HasRunLoader()) ||
         (mac->RequiresESD()       && ! AliEveEventManager::HasESD())       ||
         (mac->RequiresESDfriend() && ! AliEveEventManager::HasESDfriend()) ||
-        (mac->RequiresRawReader() && ! AliEveEventManager::HasRawReader()))
+        (mac->RequiresRawReader() && ! AliEveEventManager::HasRawReader()) ||
+       (mac->RequiresAOD()       && ! AliEveEventManager::HasAOD()))
     {
       mac->SetExecNoData();
       continue;
index 719661aa49bb14b7d1a42543e916c51ec6016b58..e32838c050cbcac3176bb9968da50e3813b16bb5 100644 (file)
@@ -27,11 +27,12 @@ AliEveJetPlane* jetplane()
   }
 
   AliAODEvent* aod = AliEveEventManager::AssertAOD();
-
   
   // We have event id everywhere now.
   Int_t iev = AliEveEventManager::GetMaster()->GetEventId();
 
+  gStyle->SetPalette(1, 0);
+
   AliEveJetPlane* jp = new AliEveJetPlane(iev);
   jp->SetPickable(kTRUE);
 
@@ -60,9 +61,8 @@ AliEveJetPlane* jetplane()
   }
 
   // Render Jet Plane
-  gStyle->SetPalette(1, 0);
-  // gEve->AddElement(jp);
   gJPScene->AddElement(jp);
+  AliEveEventManager::RegisterTransient(jp);
 
   gEve->Redraw3D();
 
diff --git a/EVE/alice-macros/vplot_tpc.C b/EVE/alice-macros/vplot_tpc.C
new file mode 100644 (file)
index 0000000..9d7bb94
--- /dev/null
@@ -0,0 +1,158 @@
+// $Id$
+// Main authors: Adam Jacholkowski & Matevz Tadel: 2009
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
+ * full copyright notice.                                                 *
+ **************************************************************************/
+
+#ifndef __CINT__
+
+#include <TGLViewer.h>
+#include <TGLCameraOverlay.h>
+
+#include <TEveManager.h>
+#include <TEveBrowser.h>
+#include <TEveViewer.h>
+#include <TEveScene.h>
+#include <TEvePointSet.h>
+
+#include <EveBase/AliEveEventManager.h>
+
+#include <AliRunLoader.h>
+#include <AliCluster.h>
+#include <TPC/AliTPCClustersRow.h>
+
+#endif
+
+TEveViewer *gVPTPCView   = 0;
+TEveScene  *gVPTPCScene  = 0;
+
+TEvePointSet* vplot_tpc(TEveElement* cont=0, Float_t maxR=270)
+{
+  if (gVPTPCView == 0)
+  {
+    TEveWindowSlot *slot    = 0;
+    TEveBrowser    *browser = gEve->GetBrowser();
+
+    slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
+    slot->MakeCurrent();
+    gVPTPCView  = gEve->SpawnNewViewer("V-Plot", "");
+    gVPTPCScene = gEve->SpawnNewScene("V-Plot", "Scene holding elements for the V-Plot TPC.");
+    gVPTPCView->AddScene(gVPTPCScene);
+
+    TGLViewer *glv = gVPTPCView->GetGLViewer();
+    glv->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
+    glv->ResetCamerasAfterNextUpdate();
+
+    TGLCameraOverlay* co = glv->GetCameraOverlay();
+    co->SetShowOrthographic(true); //(false);
+    co->SetOrthographicMode(TGLCameraOverlay::kAxis); // ::kPlaneIntersect or ::kBar
+  }
+
+  const Int_t kMaxCl=100*160;
+
+  AliEveEventManager::AssertGeometry();
+
+  AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
+  rl->LoadRecPoints("TPC");
+
+  TTree *cTree = rl->GetTreeR("TPC", false);
+  if (cTree == 0)
+    return 0;
+
+  AliTPCClustersRow *clrow = new AliTPCClustersRow();
+  clrow->SetClass("AliTPCclusterMI");
+  clrow->SetArray(kMaxCl);
+  cTree->SetBranchAddress("Segment", &clrow);
+
+  TEvePointSet* vplot = new TEvePointSet(kMaxCl);
+  vplot->SetOwnIds(kTRUE);
+
+  const Float_t phimin = -3.15;
+  const Float_t phimax =  3.15;
+  const Float_t etamin = -1.2;
+  const Float_t etamax =  1.2;
+  const Float_t vconst =  0.0003;
+
+  Float_t rhomax = 246.6;
+  Float_t rholim, rhoup;
+  Float_t zmax = 250.0;
+  Float_t rho, eta, phi, theta;
+  Float_t r3d, r3dmax, r3d1, r3d2;
+  //
+  Float_t maxRsqr = maxR*maxR;
+
+  Int_t nentr = (Int_t) cTree->GetEntries();
+  for (Int_t i = 0; i < nentr; ++i)
+  {
+    if (!cTree->GetEvent(i)) continue;
+
+    TClonesArray *cl = clrow->GetArray();
+    Int_t ncl = cl->GetEntriesFast();
+
+    while (ncl--)
+    {
+      AliCluster *c = (AliCluster*) cl->UncheckedAt(ncl);
+      Float_t g[3]; //global coordinates
+      c->GetGlobalXYZ(g);
+      if (g[0]*g[0] + g[1]*g[1] < maxRsqr)
+      {
+        phi    =  TMath::ATan2(g[1], g[0]);
+        rho    =  TMath::Sqrt(g[0]*g[0] + g[1]*g[1]);
+        theta  =  TMath::ATan2(rho, g[2]);
+        eta    = -1.0*TMath::Log(TMath::Tan(0.5*theta));
+        rhoup  =  zmax*rho / TMath::Abs(g[2]);
+        rholim =  TMath::Min(rhoup,rhomax);
+       // a version using rather r3d
+        r3d    =  TMath::Sqrt(rho*rho + g[2]*g[2]);
+        r3d1   =  rhomax / TMath::Sin(theta);
+        r3d2   =  TMath::Abs(zmax/TMath::Cos(theta));
+        r3dmax =  TMath::Min(r3d1, r3d2);
+
+        if (eta>etamin && eta<etamax && phi>phimin && phi<phimax)
+       {
+         Float_t deta = vconst*(r3dmax - r3d);
+
+         vplot->SetNextPoint(eta + deta, phi, 0);
+         vplot->SetNextPoint(eta - deta, phi, 0);
+        }
+      }
+    }
+    cl->Clear();
+  }
+
+  delete clrow;
+
+  rl->UnloadRecPoints("TPC");
+
+  if (vplot->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE)
+  {
+    Warning("vplot_tpc.C", "No TPC clusters were found.");
+    delete vplot;
+    return 0;
+  }
+
+  vplot->SetName("V=Plot TPC");
+  vplot->SetTitle(Form("N=%d", vplot->Size() / 2));
+
+  vplot->SetMainColor (kOrange);
+  vplot->SetMarkerSize(0.2);
+  vplot->SetMarkerStyle(1);
+  // vplot->ApplyVizTag("V-Plot TPC", "V-Plot");
+
+  if (cont)
+  {
+    cont->AddElement(vplot);
+  }
+  else
+  {
+    gVPTPCScene->AddElement(vplot);
+  }
+  AliEveEventManager::RegisterTransient(vplot);
+
+  gEve->Redraw3D();
+
+  return vplot;
+}
index 6076540860525c3c77a72e2e4a3138bda7b92bb2..ee21f4ef0bd89422c184fe53f4d837f5a84602fb 100644 (file)
@@ -202,6 +202,9 @@ void visscan_init(Bool_t show_extra_geo=kFALSE)
   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TRD", "trd_clusters.C+", "trd_clusters"));
   exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TOF", "tof_clusters.C+", "tof_clusters"));
 
+  exec->AddMacro(new AliEveMacro(AliEveMacro::kRunLoader, "REC Clus TPC", "vplot_tpc.C+",    "vplot_tpc", "", kFALSE));
+
+  exec->AddMacro(new AliEveMacro(AliEveMacro::kAOD, "ANA Jets", "jetplane.C", "jetplane", "", kFALSE));
 
   //==============================================================================
   // Additional GUI components