]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/muon_clusters.C
clusterizer,reconstructor + many fixes (Magnus,Stefan)
[u/mrichter/AliRoot.git] / EVE / alice-macros / muon_clusters.C
CommitLineData
39d6561a 1// $Id$
2
3/**************************************************************************
4 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
5 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
6 * full copyright notice. *
7 **************************************************************************/
8
25b4bdb2 9/// \ingroup evemacros
10/// \file muon_clusters.C
11/// \brief Macro to visualise clusters from MUON spectrometer
12/// (both tracker and trigger).
13///
14/// Use muon_clusters() in order to run it.
15///
16/// Needs that alieve_init() is already called.
17///
18/// \author P. Pillot, L. Aphecetche; Subatech
39d6561a 19
ba978640 20#if !defined(__CINT__) || defined(__MAKECINT__)
21#include <Riostream.h>
22#include <TTree.h>
39d6561a 23#include <TEveManager.h>
24#include <TEvePointSet.h>
25
6c49a8e1 26#include <AliMUONVCluster.h>
27#include <AliMUONVClusterStore.h>
28#include <AliRunLoader.h>
29#include <AliEveEventManager.h>
39d6561a 30#endif
4d7448e2 31class TIter;
32class TEvePointSet;
39d6561a 33
34//______________________________________________________________________________
35void add_muon_clusters(TIter* next, TEvePointSet* clusterList)
36{
37 // loop over clusters and produce corresponding graphic objects
38 AliMUONVCluster* cluster;
39 while ( ( cluster = static_cast<AliMUONVCluster*>((*next)()) ) )
40 {
41 clusterList->SetNextPoint(cluster->GetX(),cluster->GetY(),cluster->GetZ());
42 }
43}
44
45//______________________________________________________________________________
46void muon_clusters()
47{
48 // load clusters
49 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
50 rl->LoadRecPoints("MUON");
51 TTree* ct = rl->GetTreeR("MUON",kFALSE);
52 if (!ct) return;
53 AliMUONVClusterStore* clusterStore = AliMUONVClusterStore::Create(*ct);
54 clusterStore->Clear();
55 clusterStore->Connect(*ct,kFALSE);
56 ct->GetEvent(0);
7580e2a8 57 rl->UnloadRecPoints("MUON");
58
59 if (clusterStore->GetSize() == 0 && !gEve->GetKeepEmptyCont()) {
60 delete clusterStore;
61 return;
62 }
39d6561a 63
64 // cluster container
65 TEvePointSet* clusterList = new TEvePointSet(10000);
66 clusterList->SetName("MUON Clusters");
67 clusterList->SetTitle(Form("N=%d",clusterStore->GetSize()));
68 clusterList->SetPickable(kFALSE);
69 clusterList->SetMarkerStyle(20);
70 clusterList->SetMarkerColor(kCyan);
71 clusterList->SetMarkerSize(1.);
72
73 // add cluster to the container
74 TIter next(clusterStore->CreateIterator());
75 add_muon_clusters(&next, clusterList);
76 delete clusterStore;
77
78 // add graphic containers
79 gEve->DisableRedraw();
80 gEve->AddElement(clusterList);
81 gEve->EnableRedraw();
82 gEve->Redraw3D();
83}