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