Geometry for MFT (Brigitte)
[u/mrichter/AliRoot.git] / EVE / alice-macros / t0_hits.C
CommitLineData
6a680ee5 1// $Id$
d810d0de 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 *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
6a680ee5 9
ba978640 10#if !defined(__CINT__) || defined(__MAKECINT__)
11#include <TClonesArray.h>
12#include <TTree.h>
13#include <TEvePointSet.h>
14#include <TEveElement.h>
15#include <TEveManager.h>
16#include <TEveTreeTools.h>
17
6c49a8e1 18#include <AliRunLoader.h>
19#include <AliEveEventManager.h>
ba978640 20#endif
21
84aff7a4 22TEvePointSet*
6a680ee5 23t0_hits(const char *varexp = "T0.fX:T0.fY:T0.fZ",
84aff7a4 24 const char *selection = "")
6a680ee5 25{
26 // Extracts T0 hits.
27
28
d810d0de 29 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
6a680ee5 30 rl->LoadHits("T0");
31
32 TTree* ht = rl->GetTreeH("T0", false);
33
34 Int_t nTracks = ht->GetEntries();
35 // printf("Found %d tracks. \n",nTracks);
36 for (Int_t it = 0; it < nTracks; it++) {
51346b82 37
6a680ee5 38 TClonesArray *hits = 0;
39 ht->SetBranchAddress("T0",&hits);
51346b82 40
6a680ee5 41 ht->GetEvent(it);
84aff7a4 42 // Int_t nHits = hits->GetEntriesFast();
43 // printf("Found %d hits in track %d.\n", nHits, it);
6a680ee5 44
45 }
30650838 46 TEvePointSet* points = new TEvePointSet(Form("T0 Hits '%s'", selection));
84aff7a4 47 points->SetSourceCS(TEvePointSelectorConsumer::kTVT_XYZ);
6a680ee5 48
84aff7a4 49 TEvePointSelector ps(ht, points, varexp, selection);
6a680ee5 50 ps.Select();
51
52 points->SetTitle(Form("N=%d", points->Size()));
53 points->SetMarkerSize(.5);
fbc350a3 54 points->SetMarkerColor(3);
6a680ee5 55
30650838 56 points->SetName(Form("T0 Hits"));
9dcd42ea 57 const TString viz_tag("SIM Hits T0");
58 points->ApplyVizTag(viz_tag, "Hits");
59
84aff7a4 60 gEve->AddElement(points);
61 gEve->Redraw3D();
6a680ee5 62
63 return points;
64}