]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/muon_raw.C
31b778103ac5e3e4642e750f373e9c3d5de90750
[u/mrichter/AliRoot.git] / EVE / alice-macros / muon_raw.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 rootified raw-data from MUON spectrometer 
10 // (both tracker and trigger).
11 //
12 // Use muon_raw() in order to run it
13 //
14 // Needs that alieve_init() is already called
15
16 #if !defined(__CINT__) || defined(__MAKECINT__)
17
18 #include "AliMUONDigitMaker.h"
19 #include "AliMUONDigitStoreV2R.h"
20
21 #include "AliMpCDB.h"
22
23 #include "AliRawReader.h"
24
25 #include "EveBase/AliEveEventManager.h"
26
27 #include <TEveManager.h>
28 #include <TEveUtil.h>
29 #include <TEveQuadSet.h>
30
31 #include <TStyle.h>
32 #include <Riostream.h>
33 #include <TROOT.h>
34
35 #endif
36
37 void muon_raw()
38 {
39   // load mapping
40   AliMpCDB::LoadAll(kFALSE);
41
42   // load raw data
43   AliRawReader* reader = AliEveEventManager::AssertRawReader();
44   if ( reader->GetEventHeader() ) 
45     cout << "RUN " << reader->GetRunNumber() << " EVENT " << reader->GetEventIndex() << endl;
46   else
47     cout << "NO EVENT HEADER ?" << endl;
48   
49   // convert raw to digits
50   AliMUONDigitMaker digitMaker;
51   digitMaker.SetMakeTriggerDigits(kTRUE);
52   AliMUONDigitStoreV2R digitStore;
53   digitMaker.Raw2Digits(reader,&digitStore);
54   if (digitStore.GetSize() == 0 && !gEve->GetKeepEmptyCont()) return;
55   
56   // container for graphic representation of digits
57   TEveElementList* cont = new TEveElementList("MUON Raw digits");
58   cont->SetTitle(Form("N=%d",digitStore.GetSize()));
59   
60   TEveQuadSet* bending = new TEveQuadSet(TEveQuadSet::kQT_RectangleXY, kFALSE, 32);
61   bending->SetName("Bending");
62   bending->SetRenderMode(TEveDigitSet::kRM_Fill);
63   bending->SetPickable(kFALSE);
64   cont->AddElement(bending);
65   
66   TEveQuadSet* nonBending = new TEveQuadSet(TEveQuadSet::kQT_RectangleXY, kFALSE, 32);
67   nonBending->SetName("Non bending");
68   nonBending->SetRenderMode(TEveDigitSet::kRM_Line);
69   nonBending->SetPickable(kFALSE);
70   cont->AddElement(nonBending);
71   
72   // add digits to the containers
73   TEveUtil::LoadMacro("muon_digits.C+");
74   TIter next(digitStore.CreateIterator());
75   gROOT->ProcessLine(Form("add_muon_digits((TIter*)%p, (TEveQuadSet*)%p, (TEveQuadSet*)%p, kTRUE);",
76                           &next, bending, nonBending));
77   
78   // set containers' title
79   bending->SetTitle(Form("N=%d",bending->GetPlex()->Size()));
80   nonBending->SetTitle(Form("N=%d",nonBending->GetPlex()->Size()));
81   
82   // automatic scaling
83   gStyle->SetPalette(1);
84   bending->AssertPalette();
85   nonBending->AssertPalette();
86   
87   // add graphic containers
88   gEve->DisableRedraw();
89   gEve->AddElement(cont);
90   gEve->EnableRedraw();
91   gEve->Redraw3D();
92 }