From: mtadel Date: Mon, 9 Feb 2009 20:39:57 +0000 (+0000) Subject: AliEveMacro X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=08b0f222125b476420c2dff6a883a618bb42051d;p=u%2Fmrichter%2FAliRoot.git AliEveMacro ----------- 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). --- diff --git a/EVE/EveBase/AliEveEventManager.cxx b/EVE/EveBase/AliEveEventManager.cxx index 8e7ae71c72e..18414909b70 100644 --- a/EVE/EveBase/AliEveEventManager.cxx +++ b/EVE/EveBase/AliEveEventManager.cxx @@ -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 //------------------------------------------------------------------------------ diff --git a/EVE/EveBase/AliEveEventManager.h b/EVE/EveBase/AliEveEventManager.h index 9a5a47a34a5..092a220b3f5 100644 --- a/EVE/EveBase/AliEveEventManager.h +++ b/EVE/EveBase/AliEveEventManager.h @@ -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. diff --git a/EVE/EveBase/AliEveMacro.h b/EVE/EveBase/AliEveMacro.h index ee6113b4fe8..d4464b051a6 100644 --- a/EVE/EveBase/AliEveMacro.h +++ b/EVE/EveBase/AliEveMacro.h @@ -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(); diff --git a/EVE/EveBase/AliEveMacroExecutor.cxx b/EVE/EveBase/AliEveMacroExecutor.cxx index 63642ea9d0b..1443e96cda7 100644 --- a/EVE/EveBase/AliEveMacroExecutor.cxx +++ b/EVE/EveBase/AliEveMacroExecutor.cxx @@ -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; diff --git a/EVE/alice-macros/jetplane.C b/EVE/alice-macros/jetplane.C index 719661aa49b..e32838c050c 100644 --- a/EVE/alice-macros/jetplane.C +++ b/EVE/alice-macros/jetplane.C @@ -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 index 00000000000..9d7bb94efb8 --- /dev/null +++ b/EVE/alice-macros/vplot_tpc.C @@ -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 +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#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 && etaphimin && phiSetNextPoint(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; +} diff --git a/EVE/macros/visscan_init.C b/EVE/macros/visscan_init.C index 60765408605..ee21f4ef0bd 100644 --- a/EVE/macros/visscan_init.C +++ b/EVE/macros/visscan_init.C @@ -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