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 **************************************************************************/
16 #include <TEveManager.h>
17 #include <TEvePointSet.h>
18 #include <EveBase/AliEveEventManager.h>
20 #include <AliRunLoader.h>
21 #include <AliCluster.h>
23 #include <TClonesArray.h>
27 TEvePointSet* its_clusters(TEveElement* cont=0, Float_t maxR=50)
29 AliEveEventManager::AssertGeometry();
31 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
32 rl->LoadRecPoints("ITS");
34 TTree *cTree = rl->GetTreeR("ITS", false);
38 TClonesArray *cl = NULL;
39 TBranch *branch = cTree->GetBranch("ITSRecPoints");
40 branch->SetAddress(&cl);
42 TEvePointSet* clusters = new TEvePointSet(10000);
43 clusters->SetOwnIds(kTRUE);
45 Int_t nentr=(Int_t)cTree->GetEntries();
46 for (Int_t i=0; i<nentr; i++) {
47 if (!cTree->GetEvent(i)) continue;
49 Int_t ncl=cl->GetEntriesFast();
51 Float_t maxRsqr = maxR*maxR;
53 AliCluster *c=(AliCluster*)cl->UncheckedAt(ncl);
54 Float_t g[3]; //global coordinates
56 if (g[0]*g[0]+g[1]*g[1] < maxRsqr)
58 clusters->SetNextPoint(g[0], g[1], g[2]);
59 AliCluster *atp = new AliCluster(*c);
60 clusters->SetPointId(atp);
65 rl->UnloadRecPoints("ITS");
67 if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
68 Warning("its_clusters.C", "No ITS clusters");
74 sprintf(form,"ITS Clusters");
75 clusters->SetName(form);
78 sprintf(tip,"N=%d", clusters->Size());
79 clusters->SetTitle(tip);
81 const TString viz_tag("ITS Clusters");
82 if (gEve->FindVizDBEntry(viz_tag) == 0)
84 TEvePointSet* m = new TEvePointSet();
86 m->SetMarkerSize(0.2);
88 gEve->InsertVizDBEntry(viz_tag, m);
90 // The above can be removed when going to new root - then call:
91 // clusters->ApplyVizTag(viz_tag, "Clusters");
92 clusters->ApplyVizTag(viz_tag);
94 gEve->AddElement(clusters, cont);