In muon-related macros in EVE:
[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 TEvePointSet*
11 tpc_hits(const char  *varexp    = "TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ",
12          const char  *selection = "TPC2.fArray.fR>80",
13          TEveElement *cont      = 0)
14 {
15   // Extracts 'major' TPC hits (not the compressed ones).
16   // This gives ~2.5% of all hits.
17
18   AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
19   rl->LoadHits("TPC");
20
21   TTree* ht = rl->GetTreeH("TPC", false);
22
23   TEvePointSet* points = new TEvePointSet(Form("TPC Hits '%s'", selection));
24   points->SetSourceCS(TEvePointSelectorConsumer::kTVT_RPhiZ);
25
26   TEvePointSelector ps(ht, points, varexp, selection);
27   ps.Select();
28
29   if (points->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
30     Warning("tpc_hits", Form("No hits match '%s'", selection));
31     delete points;
32     return 0;
33   }
34   
35   points->SetName(Form("TPC Hits"));
36   const TString viz_tag("SIM Hits TPC");
37   points->ApplyVizTag(viz_tag, "Hits");
38
39   points->SetTitle(Form("N=%d", points->Size()));
40   points->SetMarkerSize(.5);
41   points->SetMarkerColor(3);
42
43
44
45   gEve->AddElement(points, cont);
46   gEve->Redraw3D();
47
48   return points;
49 }