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