a28c48f73b45f7ee6c62441b615da47b3efd3c70
[u/mrichter/AliRoot.git] / EVE / alice-macros / tof_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 tof_hits(const char *varexp    = "fX:fY:fZ",
12          const char *selection = "",
13          TEveElement* cont)
14 {
15   AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
16   rl->LoadHits("TOF");
17
18   TTree* ht = rl->GetTreeH("TOF", false);
19   
20   //PH The line below is replaced waiting for a fix in Root
21   //PH which permits to use variable siza arguments in CINT
22   //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
23   //PH  TEvePointSet* points = new TEvePointSet(Form("TOF Hits '%s'", selection));
24   char form[1000];
25   sprintf(form,"TOF Hits '%s'", selection);
26   TEvePointSet* points = new TEvePointSet(form);
27
28   TEvePointSelector ps(ht, points, varexp, selection);
29   ps.Select();
30
31   if( points->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
32     Warning("tof_hits", Form("No hits match '%s'", selection));
33     delete points;
34     return 0;
35   }
36
37   //PH  points->SetTitle(Form("N=%d", points->Size()));
38   sprintf(form,"N=%d", points->Size());
39   points->SetTitle(form);
40   points->SetMarkerSize(.5);
41   points->SetMarkerColor(2);
42
43   gEve->AddElement(points, cont);
44   gEve->Redraw3D();
45
46   return points;
47 }