Example for analysis on kine tree.
[u/mrichter/AliRoot.git] / EVE / alice-macros / its_raw.C
CommitLineData
d810d0de 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 *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
20807c14 9
961e5e6c 10void its_raw(const char *input = "rawdata.root",
11 Int_t mode = 63,
cb35cec3 12 Int_t nrun = 0,
961e5e6c 13 Int_t event = 0,
14 Bool_t accumulate = kFALSE)
9d7caeed 15{
16 if (gSystem->AccessPathName(input, kReadPermission))
17 {
18 Error("its_raw", "file '%s' not found.", input);
19 return;
20 }
21
cb35cec3 22 AliCDBManager::Instance()->SetRun(nrun);
20807c14 23 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
24
9d7caeed 25 AliRawReader *rawReader = NULL;
26 TString fileName(input);
27 if (fileName.EndsWith("/")) {
28 rawReader = new AliRawReaderFile(fileName);
29 } else if (fileName.EndsWith(".root")) {
30 rawReader = new AliRawReaderRoot(fileName);
31 } else if (!fileName.IsNull()) {
32 rawReader = new AliRawReaderDate(fileName);
9d7caeed 33 }
34
d810d0de 35 AliEveITSDigitsInfo* di = new AliEveITSDigitsInfo();
961e5e6c 36
37 if (accumulate) AliLog::SetGlobalLogLevel(AliLog::kError);
38 Int_t ev = 0;
39 do {
d810d0de 40 if (ev % 100 == 0) printf("AliEveEventManager: %d\n", ev);
961e5e6c 41 if (rawReader->NextEvent() == kFALSE)
42 {
43 Error("its_raw", "Reading event %d failed (requested event %d).", ev, event);
44 if (accumulate)
45 break;
46 else
47 return;
48 }
540e156e 49 if (accumulate) di->ReadRaw(rawReader,mode);
961e5e6c 50 } while (++ev < event);
51
540e156e 52 if ( ! accumulate) di->ReadRaw(rawReader,mode);
961e5e6c 53
9d7caeed 54 di->Dump();
55
56 delete rawReader;
9d7caeed 57
58 gStyle->SetPalette(1, 0);
9d7caeed 59
84aff7a4 60 gEve->DisableRedraw();
9d7caeed 61
62 TString sSector;
63 TString bsSector="Sector";
64 TString sStave;
65 TString bsStave="Stave";
66 TString sLadder;
67 TString bsLadder="Ladder";
68
69 Int_t i=0;
70 Int_t nsec, nstave, nlad, nMod;
71
72 if (mode & 1) {
84aff7a4 73 TEveElementList* l = new TEveElementList("SPD0");
9d7caeed 74 l->SetTitle("SPDs' first layer");
75 l->SetMainColor((Color_t)2);
84aff7a4 76 gEve->AddElement(l);
77 for (nsec=0; nsec<10; nsec++) {
9d7caeed 78 sSector = bsSector;
79 sSector += nsec;
84aff7a4 80 TEveElementList* relSector = new TEveElementList(sSector.Data());
9d7caeed 81 relSector->SetMainColor((Color_t)2);
84aff7a4 82 gEve->AddElement(relSector, l);
83 for (nstave=0; nstave<2; nstave++){
9d7caeed 84 sStave = bsStave;
85 sStave += nstave;
84aff7a4 86 TEveElementList* relStave = new TEveElementList(sStave.Data());
9d7caeed 87 relStave->SetMainColor((Color_t)2);
84aff7a4 88 gEve->AddElement(relStave, relSector);
89 for (nMod=0; nMod<4; nMod++)
961e5e6c 90 {
91 if (di->GetDigits(i, 0) && di->GetDigits(i, 0)->GetEntriesFast() > 0)
92 {
d810d0de 93 AliEveITSModule* m = new AliEveITSModule(i, di);
84aff7a4 94 gEve->AddElement(m, relStave);
961e5e6c 95 }
96 ++i;
9d7caeed 97 }
98 }
99 }
100 } else {
101 i += 10*2*4;
102 }
103
104 if (mode & 2) {
84aff7a4 105 TEveElementList* l = new TEveElementList("SPD1");
9d7caeed 106 l->SetTitle("SPDs' second layer");
107 l->SetMainColor((Color_t)2);
84aff7a4 108 gEve->AddElement(l);
9d7caeed 109
84aff7a4 110 for (nsec=0; nsec<10; nsec++) {
9d7caeed 111 sSector = bsSector;
112 sSector += nsec;
84aff7a4 113 TEveElementList* relSector = new TEveElementList(sSector.Data());
9d7caeed 114 relSector->SetMainColor((Color_t)2);
84aff7a4 115 gEve->AddElement(relSector, l);
116 for (nstave=0; nstave<4; nstave++){
9d7caeed 117 sStave = bsStave;
118 sStave += nstave;
84aff7a4 119 TEveElementList* relStave = new TEveElementList(sStave.Data());
9d7caeed 120 relStave->SetMainColor((Color_t)2);
84aff7a4 121 gEve->AddElement(relStave, relSector);
122 for (nMod=0; nMod<4; nMod++)
961e5e6c 123 {
124 if (di->GetDigits(i, 0) && di->GetDigits(i, 0)->GetEntriesFast() > 0)
125 {
d810d0de 126 AliEveITSModule* m = new AliEveITSModule(i, di);
84aff7a4 127 gEve->AddElement(m, relStave);
961e5e6c 128 }
129 ++i;
9d7caeed 130 }
131 }
132 }
133 } else {
134 i += 10*4*4;
135 }
136
137 if (mode & 4) {
84aff7a4 138 TEveElementList* l = new TEveElementList("SDD2");
9d7caeed 139 l->SetTitle("SDDs' first layer");
140 l->SetMainColor((Color_t)3);
84aff7a4 141 gEve->AddElement(l);
9d7caeed 142
84aff7a4 143 for (nlad=0; nlad<14; nlad++) {
9d7caeed 144 sLadder = bsLadder;
145 sLadder += nlad;
84aff7a4 146 TEveElementList* relLadder = new TEveElementList(sLadder.Data());
9d7caeed 147 relLadder->SetMainColor((Color_t)3);
84aff7a4 148 gEve->AddElement(relLadder, l);
149 for (nMod=0; nMod<6; nMod++) {
d810d0de 150 AliEveITSModule* m = new AliEveITSModule(i++, di);
84aff7a4 151 gEve->AddElement(m, relLadder);
9d7caeed 152 }
153 }
154 } else {
155 i += 14*6;
156 }
157
158 if (mode & 8) {
84aff7a4 159 TEveElementList* l = new TEveElementList("SDD3");
9d7caeed 160 l->SetTitle("SDDs' second layer");
161 l->SetMainColor((Color_t)3);
84aff7a4 162 gEve->AddElement(l);
163 for (nlad=0; nlad<22; nlad++) {
9d7caeed 164 sLadder = bsLadder;
165 sLadder += nlad;
84aff7a4 166 TEveElementList* relLadder = new TEveElementList(sLadder.Data());
9d7caeed 167 relLadder->SetMainColor((Color_t)3);
84aff7a4 168 gEve->AddElement(relLadder, l);
169 for (nMod=0; nMod<8; nMod++) {
d810d0de 170 AliEveITSModule* m = new AliEveITSModule(i++, di);
84aff7a4 171 gEve->AddElement(m, relLadder);
9d7caeed 172 }
173 }
174 } else {
175 i += 22*8;
176 }
177
178 if (mode & 16) {
84aff7a4 179 TEveElementList* l = new TEveElementList("SSD4");
9d7caeed 180 l->SetTitle("SSDs' first layer");
181 l->SetMainColor((Color_t)4);
84aff7a4 182 gEve->AddElement(l);
183 for (nlad=0; nlad<34; nlad++) {
9d7caeed 184 sLadder = bsLadder;
185 sLadder += nlad;
84aff7a4 186 TEveElementList* relLadder = new TEveElementList(sLadder.Data());
9d7caeed 187 relLadder->SetMainColor((Color_t)4);
84aff7a4 188 gEve->AddElement(relLadder, l);
189 for (nMod=0; nMod<22; nMod++) {
d810d0de 190 AliEveITSModule* m = new AliEveITSModule(i++, di);
84aff7a4 191 gEve->AddElement(m, relLadder);
9d7caeed 192 }
193 }
194 } else {
195 i += 34*22;
196 }
197
198 if (mode & 32) {
84aff7a4 199 TEveElementList* l = new TEveElementList("SSD5");
9d7caeed 200 l->SetTitle("SSDs' second layer");
201 l->SetMainColor((Color_t)4);
84aff7a4 202 gEve->AddElement(l);
203 for (nlad=0; nlad<38; nlad++) {
9d7caeed 204 sLadder = bsLadder;
205 sLadder += nlad;
84aff7a4 206 TEveElementList* relLadder = new TEveElementList(sLadder.Data());
9d7caeed 207 relLadder->SetMainColor((Color_t)4);
84aff7a4 208 gEve->AddElement(relLadder, l);
209 for (nMod=0; nMod<25; nMod++) {
d810d0de 210 AliEveITSModule* m = new AliEveITSModule(i++, di);
84aff7a4 211 gEve->AddElement(m, relLadder);
9d7caeed 212 }
213 }
214 } else {
215 i += 38*25;
216 }
217
84aff7a4 218 gEve->EnableRedraw();
9d7caeed 219}