X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EVE%2Falice-macros%2Fits_clusters.C;h=8808ee6f01ddce867904f801ec34a506a54b8d03;hb=d0a3e43973f5c8ed7cda971c23ffcaeca03bf3c8;hp=a619e0cd57953322fbb9547e0c240ad9639b35e1;hpb=0ccc545cdf98f9ad18ae7d1154ea740c72107eb5;p=u%2Fmrichter%2FAliRoot.git diff --git a/EVE/alice-macros/its_clusters.C b/EVE/alice-macros/its_clusters.C index a619e0cd579..8808ee6f01d 100644 --- a/EVE/alice-macros/its_clusters.C +++ b/EVE/alice-macros/its_clusters.C @@ -1,35 +1,68 @@ +// $Id$ +// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 -Reve::PointSet* its_clusters(RenderElement* cont=0, Float_t maxR=50) -{ - AliLog::EnableDebug(1); - AliLog::SetGlobalDebugLevel(AliLog::kMaxType); +/************************************************************************** + * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * + * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * + * full copyright notice. * + **************************************************************************/ +#ifdef __CINT__ + +class TEveElement; +class TEvePointSet; + +#else + +#include +#include +#include + +#include +#include - Alieve::Event::AssertGeometry(); +#include - AliRunLoader* rl = Alieve::Event::AssertRunLoader(); +#endif + +TEvePointSet* its_clusters(TEveElement* cont=0, Float_t maxR=50) +{ + AliEveEventManager::AssertGeometry(); + + AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); rl->LoadRecPoints("ITS"); TTree *cTree = rl->GetTreeR("ITS", false); + if (cTree == 0) + return 0; - Reve::PointSet* clusters = new Reve::PointSet(10000); - clusters->SetOwnIds(kTRUE); - - TClonesArray *cl=NULL; - TBranch *branch=cTree->GetBranch("ITSRecPoints"); + TClonesArray *cl = NULL; + TBranch *branch = cTree->GetBranch("ITSRecPoints"); branch->SetAddress(&cl); - Int_t nentr=(Int_t)cTree->GetEntries(); - for (Int_t i=0; iSetOwnIds(kTRUE); + + Int_t nentr = (Int_t) cTree->GetEntries(); + for (Int_t i=0; iGetEvent(i)) continue; - Int_t ncl=cl->GetEntriesFast(); + Int_t ncl = cl->GetEntriesFast(); Float_t maxRsqr = maxR*maxR; - while (ncl--) { - AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl); + for (Int_t icl = 0; icl < ncl; ++icl) + { + AliCluster *c = (AliCluster*) cl->UncheckedAt(icl); + // This really should not happen, but did in online display once. + if (c == 0) + { + ::Warning("its_clusters", "Got NULL AliCluster*, idx=%d, N=%d.", + icl, ncl); + continue; + } Float_t g[3]; //global coordinates c->GetGlobalXYZ(g); - if (g[0]*g[0]+g[1]*g[1] < maxRsqr) + if (g[0]*g[0] + g[1]*g[1] < maxRsqr) { clusters->SetNextPoint(g[0], g[1], g[2]); AliCluster *atp = new AliCluster(*c); @@ -38,27 +71,25 @@ Reve::PointSet* its_clusters(RenderElement* cont=0, Float_t maxR=50) } } - if(clusters->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) { - Warning("its_clusters", "No ITS clusters"); + rl->UnloadRecPoints("ITS"); + + if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) { + Warning("its_clusters.C", "No ITS clusters"); delete clusters; return 0; } - clusters->SetMarkerStyle(2); - clusters->SetMarkerSize(0.2); - clusters->SetMarkerColor(4); + clusters->SetName("ITS Clusters"); + + clusters->SetTitle(Form("N=%d", clusters->Size())); + + const TString viz_tag("REC Clusters ITS"); - char form[1000]; - sprintf(form,"ITS Clusters"); - clusters->SetName(form); + clusters->ApplyVizTag(viz_tag, "Clusters"); - char tip[1000]; - sprintf(tip,"N=%d", clusters->Size()); - clusters->SetTitle(tip); + gEve->AddElement(clusters, cont); - using namespace Reve; - gReve->AddRenderElement(clusters); - gReve->Redraw3D(); + gEve->Redraw3D(); return clusters; }