]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/muon_clusters.C
In muon-related macros in EVE:
[u/mrichter/AliRoot.git] / EVE / alice-macros / muon_clusters.C
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
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
19
20 #ifndef __CINT__
21
22 #include "AliMUONVCluster.h"
23 #include "AliMUONVClusterStore.h"
24
25 #include "AliRunLoader.h"
26
27 #include "EveBase/AliEveEventManager.h"
28
29 #include <TEveManager.h>
30 #include <TEvePointSet.h>
31
32 #include <TTree.h>
33 #include <Riostream.h>
34
35 #endif
36
37 //______________________________________________________________________________
38 void add_muon_clusters(TIter* next, TEvePointSet* clusterList)
39 {
40   // loop over clusters and produce corresponding graphic objects
41   AliMUONVCluster* cluster;
42   while ( ( cluster = static_cast<AliMUONVCluster*>((*next)()) ) ) 
43   {  
44     clusterList->SetNextPoint(cluster->GetX(),cluster->GetY(),cluster->GetZ());
45   }
46 }
47
48 //______________________________________________________________________________
49 void muon_clusters()
50 {
51   // load clusters
52   AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
53   rl->LoadRecPoints("MUON");
54   TTree* ct = rl->GetTreeR("MUON",kFALSE);
55   if (!ct) return;
56   AliMUONVClusterStore* clusterStore = AliMUONVClusterStore::Create(*ct);
57   clusterStore->Clear();
58   clusterStore->Connect(*ct,kFALSE);
59   ct->GetEvent(0);
60   if (clusterStore->GetSize() == 0 && !gEve->GetKeepEmptyCont()) return;
61   
62   // cluster container
63   TEvePointSet* clusterList = new TEvePointSet(10000);
64   clusterList->SetName("MUON Clusters");
65   clusterList->SetTitle(Form("N=%d",clusterStore->GetSize()));
66   clusterList->SetPickable(kFALSE);
67   clusterList->SetMarkerStyle(20);
68   clusterList->SetMarkerColor(kCyan);
69   clusterList->SetMarkerSize(1.);
70   
71   // add cluster to the container
72   TIter next(clusterStore->CreateIterator());
73   add_muon_clusters(&next, clusterList);
74   delete clusterStore;
75   
76   // add graphic containers
77   gEve->DisableRedraw();
78   gEve->AddElement(clusterList);
79   gEve->EnableRedraw();
80   gEve->Redraw3D();
81 }