]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/pmd_raw.C
AliInfo displays better than std::cout
[u/mrichter/AliRoot.git] / EVE / alice-macros / pmd_raw.C
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9 // ---------------------------------------------------------------------- //
10
11 #if !defined(__CINT__) || defined(__MAKECINT__)
12 #include <TObjArray.h>
13 #include <TString.h>
14 #include <TStyle.h>
15 #include <TEveManager.h>
16 #include <TEveElement.h>
17 #include <TEvePointSet.h>
18
19 #include <AliPMDRawStream.h>
20 #include <AliRawReaderRoot.h>
21 #include <AliCluster.h>
22 #include <AliEveEventManager.h>
23 #include <AliEvePMDModule.h>
24 #endif
25
26 void pmd_raw(Int_t mode = 0)
27 {
28   gStyle->SetPalette(1, 0);
29
30
31   TObjArray *pmdddlcont = new TObjArray();
32
33   TString spl;
34
35   TString sddl;
36   TString bsddl="DDL";
37
38   // Use this to get data consistent with current event:
39   // AliRawReader *reader = AliEveEventManager::AssertRawReader();
40
41   Int_t ievt = 159;
42   AliRawReaderRoot reader("raw.root",ievt);
43   AliPMDRawStream stream(&reader);
44
45   gEve->DisableRedraw();
46
47   TEveElementList* l = new TEveElementList("PMD");
48   //  l->SetTitle("PMD");
49   //  l->SetMainColor(3);
50   gEve->AddElement(l);
51
52   Int_t NSM       = 0;
53   Int_t istartDDL = 0;
54   Int_t iendDDL   = 0;
55   Int_t modnumber = 0;
56   Int_t istartPlane = 0;
57   Int_t iendPlane   = 0;
58   Float_t zpos      = 0;
59
60   switch(mode)
61     {
62     case 0:
63       istartPlane = 0;
64       iendPlane   = 1;
65       printf("--- Visualization is set for PREshower Plane ---\n");
66       break;
67
68     case 1:
69       istartPlane = 1;
70       iendPlane   = 2;
71       printf("--- Visualization is set for CPV Plane ---\n");
72       break;
73
74     case 2:
75       istartPlane = 0;
76       iendPlane   = 2;
77       printf("--- Visualization is set for both the Plane ---\n");
78       break;
79
80     default:
81       printf("--- Not set for any Plane ---\n");
82     }
83
84   for (Int_t ipl = istartPlane; ipl < iendPlane; ipl++)
85     {
86
87       if (ipl == 0)
88         {
89           spl       = "PRE";
90           istartDDL = 0;
91           iendDDL   = 4;
92           zpos      = 365.;
93         }
94       if (ipl == 1)
95         {
96           spl = "CPV";
97           istartDDL = 4;
98           iendDDL   = 6;
99           zpos      = 360.;
100         }
101
102       TEveElementList* lplane = new TEveElementList(spl.Data());
103       //  l->SetMainColor(3);
104       gEve->AddElement(lplane, l);
105
106       Int_t iddl = -1;
107
108       while ((iddl = stream.DdlData(pmdddlcont)) >=0) {
109           if (iddl >= istartDDL && iddl < iendDDL){
110               sddl = bsddl;
111               sddl += iddl;
112               TEveElementList* lddl = new TEveElementList(sddl.Data());
113               //  l->SetMainColor(3);
114               gEve->AddElement(lddl, lplane);
115               
116               modnumber = iddl*6;
117               
118               if (iddl < 4)
119               {
120                   NSM = 6;
121               }
122               else if (iddl >=4 && iddl < 6)
123               {
124                   NSM = 12;
125               }
126
127               for (Int_t ism = 0; ism < NSM; ism++)
128               {
129                   AliEvePMDModule *lmodule = new AliEvePMDModule();
130                   lmodule->SetPosition(0.,0.,zpos);
131                   lmodule->DisplayRawData(modnumber,pmdddlcont);
132                   gEve->AddElement(lmodule, lddl);
133                   modnumber++;
134                   if (iddl == 4 && modnumber == 30) modnumber = 42;
135               }
136               
137               pmdddlcont->Delete();
138           }
139       }
140       
141       gEve->EnableRedraw();
142     }
143   
144 }
145 // ---------------------------------------------------------------------- //
146