Added support to display the HLT ESD Tree. See the comment in visscan_local.C for How
[u/mrichter/AliRoot.git] / EVE / alice-macros / tpc_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 #if !defined(__CINT__) || defined(__MAKECINT__)
11 #include <TString.h>
12 #include <TTree.h>
13 #include <TEvePointSet.h>
14 #include <TEveElement.h>
15 #include <TEveManager.h>
16 #include <TEveTreeTools.h>
17
18 #include <AliRunLoader.h>
19 #include <AliEveEventManager.h>
20 #endif
21
22 TEvePointSet*
23 tpc_hits(const char  *varexp    = "TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ",
24          const char  *selection = "TPC2.fArray.fR>80",
25          TEveElement *cont      = 0)
26 {
27   // Extracts 'major' TPC hits (not the compressed ones).
28   // This gives ~2.5% of all hits.
29
30   AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
31   rl->LoadHits("TPC");
32
33   TTree* ht = rl->GetTreeH("TPC", false);
34
35   TEvePointSet* points = new TEvePointSet(Form("TPC Hits '%s'", selection));
36   points->SetSourceCS(TEvePointSelectorConsumer::kTVT_RPhiZ);
37
38   TEvePointSelector ps(ht, points, varexp, selection);
39   ps.Select();
40
41   if (points->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
42     Warning("tpc_hits", "No hits match '%s'", selection);
43     delete points;
44     return 0;
45   }
46   
47   points->SetName(Form("TPC Hits"));
48   const TString viz_tag("SIM Hits TPC");
49   points->ApplyVizTag(viz_tag, "Hits");
50
51   points->SetTitle(Form("N=%d", points->Size()));
52   points->SetMarkerSize(.5);
53   points->SetMarkerColor(3);
54
55   gEve->AddElement(points, cont);
56   gEve->Redraw3D();
57
58   return points;
59 }