]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/tpc_hits.C
Handle missing rec-point tree in a uniform way: return null pointer to TEvePointSet.
[u/mrichter/AliRoot.git] / EVE / alice-macros / tpc_hits.C
CommitLineData
5a5a1232 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 **************************************************************************/
5a5a1232 9
84aff7a4 10TEvePointSet*
16718cdc 11tpc_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)
5a5a1232 14{
15 // Extracts 'major' TPC hits (not the compressed ones).
16 // This gives ~2.5% of all hits.
17
d810d0de 18 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
5a5a1232 19 rl->LoadHits("TPC");
20
21 TTree* ht = rl->GetTreeH("TPC", false);
f37061fc 22
7be1e8cd 23 //PH The line below is replaced waiting for a fix in Root
24 //PH which permits to use variable siza arguments in CINT
25 //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
84aff7a4 26 //PH TEvePointSet* points = new TEvePointSet(Form("TPC Hits '%s'", selection));
7be1e8cd 27 char form[1000];
28 sprintf(form,"TPC Hits '%s'", selection);
84aff7a4 29 TEvePointSet* points = new TEvePointSet(form);
30 points->SetSourceCS(TEvePointSelectorConsumer::kTVT_RPhiZ);
f37061fc 31
84aff7a4 32 TEvePointSelector ps(ht, points, varexp, selection);
f37061fc 33 ps.Select();
34
84aff7a4 35 if (points->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
bcb585f3 36 Warning("tpc_hits", Form("No hits match '%s'", selection));
52465a1b 37 delete points;
38 return 0;
39 }
40
7be1e8cd 41 //PH points->SetTitle(Form("N=%d", points->Size()));
42 sprintf(form,"N=%d", points->Size());
43 points->SetTitle(form);
8a68912d 44 points->SetMarkerSize(.5);
5a5a1232 45 points->SetMarkerColor((Color_t)3);
46
84aff7a4 47 gEve->AddElement(points, cont);
48 gEve->Redraw3D();
5a5a1232 49
50 return points;
51}