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 **************************************************************************/
10 #if !defined(__CINT__) || defined(__MAKECINT__)
11 #include <TClonesArray.h>
14 #include <TEveManager.h>
15 #include <TEveElement.h>
16 #include <TEvePointSet.h>
18 #include <AliRunLoader.h>
19 #include <AliCluster.h>
20 #include <AliEveEventManager.h>
28 TEvePointSet* its_clusters(TEveElement* cont=0, Float_t maxR=50)
30 AliEveEventManager::AssertGeometry();
32 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
33 rl->LoadRecPoints("ITS");
35 TTree *cTree = rl->GetTreeR("ITS", false);
39 TClonesArray *cl = NULL;
40 TBranch *branch = cTree->GetBranch("ITSRecPoints");
41 branch->SetAddress(&cl);
43 TEvePointSet* clusters = new TEvePointSet(10000);
44 clusters->SetOwnIds(kTRUE);
46 Int_t nentr = (Int_t) cTree->GetEntries();
47 for (Int_t i=0; i<nentr; i++)
49 if (!cTree->GetEvent(i)) continue;
51 Int_t ncl = cl->GetEntriesFast();
53 Float_t maxRsqr = maxR*maxR;
54 for (Int_t icl = 0; icl < ncl; ++icl)
56 AliCluster *c = (AliCluster*) cl->UncheckedAt(icl);
57 // This really should not happen, but did in online display once.
60 ::Warning("its_clusters", "Got NULL AliCluster*, idx=%d, N=%d.",
64 Float_t g[3]; //global coordinates
66 if (g[0]*g[0] + g[1]*g[1] < maxRsqr)
68 clusters->SetNextPoint(g[0], g[1], g[2]);
69 AliCluster *atp = new AliCluster(*c);
70 clusters->SetPointId(atp);
75 rl->UnloadRecPoints("ITS");
77 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
78 Warning("its_clusters.C", "No ITS clusters");
83 clusters->SetName("ITS Clusters");
85 clusters->SetTitle(Form("N=%d", clusters->Size()));
87 const TString viz_tag("REC Clusters ITS");
89 clusters->ApplyVizTag(viz_tag, "Clusters");
91 gEve->AddElement(clusters, cont);