]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/muon_raw.C
changes for Vertex and Tracks classes
[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 <AliLog.h>
29 #include <AliMUONDigitMaker.h>
30 #include <AliMUONDigitStoreV2R.h>
31 #include <AliMpCDB.h>
32 #include <AliRawReader.h>
33 #include <AliEveEventManager.h>
34 #endif
35
36 void muon_raw()
37 {
38   // load mapping
39   AliMpCDB::LoadAll(kFALSE);
40
41   // load raw data
42   AliRawReader* reader = AliEveEventManager::AssertRawReader();
43   if ( reader->GetEventHeader() ) 
44     AliInfoGeneral("muon_raw.C", Form("RUN %d EVENT %d", reader->GetRunNumber(),reader->GetEventIndex()) );
45   else
46     AliInfoGeneral("muon_raw.C", "NO EVENT HEADER ?");
47   
48   // convert raw to digits
49   AliMUONDigitMaker digitMaker;
50   digitMaker.SetMakeTriggerDigits(kTRUE);
51   AliMUONDigitStoreV2R digitStore;
52   digitMaker.Raw2Digits(reader,&digitStore);
53   if (digitStore.GetSize() == 0 && !gEve->GetKeepEmptyCont()) return;
54   
55   // container for graphic representation of digits
56   TEveElementList* cont = new TEveElementList("MUON Raw digits");
57   cont->SetTitle(Form("N=%d",digitStore.GetSize()));
58   
59   TEveQuadSet* bending = new TEveQuadSet(TEveQuadSet::kQT_RectangleXY, kFALSE, 32);
60   bending->SetName("Bending");
61   bending->SetRenderMode(TEveDigitSet::kRM_Fill);
62   bending->SetPickable(kFALSE);
63   cont->AddElement(bending);
64   
65   TEveQuadSet* nonBending = new TEveQuadSet(TEveQuadSet::kQT_RectangleXY, kFALSE, 32);
66   nonBending->SetName("Non bending");
67   nonBending->SetRenderMode(TEveDigitSet::kRM_Line);
68   nonBending->SetPickable(kFALSE);
69   cont->AddElement(nonBending);
70   
71   // add digits to the containers
72   TEveUtil::LoadMacro("muon_digits.C+");
73   TIter next(digitStore.CreateIterator());
74   gROOT->ProcessLine(Form("add_muon_digits((TIter*)%p, (TEveQuadSet*)%p, (TEveQuadSet*)%p, kTRUE);",
75                           &next, bending, nonBending));
76   
77   // set containers' title
78   bending->SetTitle(Form("N=%d",bending->GetPlex()->Size()));
79   nonBending->SetTitle(Form("N=%d",nonBending->GetPlex()->Size()));
80   
81   // automatic scaling
82   gStyle->SetPalette(1);
83   bending->AssertPalette();
84   nonBending->AssertPalette();
85   
86   // add graphic containers
87   gEve->DisableRedraw();
88   gEve->AddElement(cont);
89   gEve->EnableRedraw();
90   gEve->Redraw3D();
91 }