2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
9 #if !defined(__CINT__) || defined(__MAKECINT__)
10 #include <TClonesArray.h>
13 #include <TEveManager.h>
14 #include <TEveElement.h>
15 #include <TEvePointSet.h>
17 #include <EveBase/AliEveEventManager.h>
18 #include <STEER/STEER/AliRunLoader.h>
19 #include <STEER/STEER/AliCluster.h>
30 TEvePointSet* its_clusters(TEveElement* cont=0, Float_t maxR=50)
32 AliEveEventManager::AssertGeometry();
34 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
35 rl->LoadRecPoints("ITS");
37 TTree *cTree = rl->GetTreeR("ITS", false);
41 TClonesArray *cl = NULL;
42 TBranch *branch = cTree->GetBranch("ITSRecPoints");
43 branch->SetAddress(&cl);
45 TEvePointSet* clusters = new TEvePointSet(10000);
46 clusters->SetOwnIds(kTRUE);
48 Int_t nentr = (Int_t) cTree->GetEntries();
49 for (Int_t i=0; i<nentr; i++)
51 if (!cTree->GetEvent(i)) continue;
53 Int_t ncl = cl->GetEntriesFast();
55 Float_t maxRsqr = maxR*maxR;
56 for (Int_t icl = 0; icl < ncl; ++icl)
58 AliCluster *c = (AliCluster*) cl->UncheckedAt(icl);
59 // This really should not happen, but did in online display once.
62 ::Warning("its_clusters", "Got NULL AliCluster*, idx=%d, N=%d.",
66 Float_t g[3]; //global coordinates
68 if (g[0]*g[0] + g[1]*g[1] < maxRsqr)
70 clusters->SetNextPoint(g[0], g[1], g[2]);
71 AliCluster *atp = new AliCluster(*c);
72 clusters->SetPointId(atp);
77 rl->UnloadRecPoints("ITS");
79 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
80 Warning("its_clusters.C", "No ITS clusters");
85 clusters->SetName("ITS Clusters");
87 clusters->SetTitle(Form("N=%d", clusters->Size()));
89 const TString viz_tag("REC Clusters ITS");
91 clusters->ApplyVizTag(viz_tag, "Clusters");
93 gEve->AddElement(clusters, cont);