36249bf2c9620b0b8ceea1371eaaf56ca78cd43a
[u/mrichter/AliRoot.git] / EVE / alice-macros / t0_hits.C
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
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
10 TEvePointSet*
11 t0_hits(const char *varexp    = "T0.fX:T0.fY:T0.fZ",
12         const char *selection = "")
13 {
14   // Extracts  T0 hits.
15
16
17   AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
18   rl->LoadHits("T0");
19
20   TTree* ht = rl->GetTreeH("T0", false);
21
22   Int_t nTracks = ht->GetEntries();
23   // printf("Found %d tracks. \n",nTracks);
24   for (Int_t it = 0; it < nTracks; it++) {
25
26     TClonesArray *hits = 0;
27     ht->SetBranchAddress("T0",&hits);
28
29     ht->GetEvent(it);
30     // Int_t nHits = hits->GetEntriesFast();
31     // printf("Found %d hits in track %d.\n", nHits, it);
32
33   }
34   TEvePointSet* points = new TEvePointSet(Form("T0 Hits '%s'", selection));
35   points->SetSourceCS(TEvePointSelectorConsumer::kTVT_XYZ);
36
37   TEvePointSelector ps(ht, points, varexp, selection);
38   ps.Select();
39
40   points->SetTitle(Form("N=%d", points->Size()));
41   points->SetMarkerSize(.5);
42   points->SetMarkerColor(3);
43
44   gEve->AddElement(points);
45   gEve->Redraw3D();
46
47   return points;
48 }